Repository navigation
L16: hosted-git seam without the Durable Object #2856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
simple-agent-manager
merged 20 commits into
main
from
sam/self-host-landing-slice-eyt0t8
Nov 18, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
03d8570
feat(hosted-git): land the hosted-git seam without the Durable Object…
raphaeltm caef0e1
fix(hosted-git): address L16 review findings
raphaeltm 9406993
task: archive L16 hosted-git seam task
raphaeltm 4b9a6dd
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm 9a40c5c
fix: retain hosted repository cleanup when Artifacts is disabled
raphaeltm cfe0f36
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm 9abd1be
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm 7495af6
test(api): allow shared CI budget for speech import graph
raphaeltm fcdd51c
fix(vm-agent): honor callback username for standalone clones
raphaeltm 4bd1f57
test(vm-agent): simplify standalone callback regression
raphaeltm 70931e9
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm 1fe679c
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm da9f91b
fix(vm-agent): normalize hosted git HTTPS ports
raphaeltm 7a6048b
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm bcc3735
fix(vm-agent): preserve hosted git credentials across port forms
raphaeltm 12e7109
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm 2de1924
fix(vm-agent): require HTTPS for hosted git credentials
raphaeltm 5ced633
test(vm-agent): group hosted credential expectations
raphaeltm bda3332
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm c7a06b2
Merge remote-tracking branch 'origin/main' into sam/self-host-landing…
raphaeltm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { ArtifactsBackendPort } from '@simple-agent-manager/repo-hosting/ports'; | ||
|
|
||
| import type { Env } from '../env'; | ||
| import { resolveArtifactsBackend } from '../services/hosted-git/backend'; | ||
|
|
||
| /** | ||
| * Repo hosting resolves the SAM-native repository backend through the worker's hosted-git seam: | ||
| * the Cloudflare Artifacts binding, or the backend a self-host build registered. The package hands | ||
| * over its narrow env; the full worker env is what reached it. | ||
| */ | ||
| export const artifactsPort: ArtifactsBackendPort = { | ||
| resolve: (env) => resolveArtifactsBackend(env as Env), | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { Hono } from 'hono'; | ||
|
|
||
| import type { Env } from '../env'; | ||
| import { applyCacheHeaders } from '../lib/cache-headers'; | ||
| import { isArtifactsAvailable } from '../services/hosted-git/backend'; | ||
|
|
||
| /** | ||
| * Public config: whether this install can create SAM-native (Artifacts) repositories. True only | ||
| * when ARTIFACTS_ENABLED is set and a backend exists (the Cloudflare binding, or the backend a | ||
| * self-host build registered), so the UI never offers a provider that would fail on use. | ||
| */ | ||
| export const artifactsConfigRoutes = new Hono<{ Bindings: Env }>(); | ||
|
|
||
| artifactsConfigRoutes.get('/artifacts-enabled', (c) => { | ||
| applyCacheHeaders(c, 'public-config'); | ||
| return c.json({ enabled: isArtifactsAvailable(c.env) }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /** | ||
| * The SAM-native repository backend: one answer to "which `Env.ARTIFACTS` does this install use?". | ||
| * | ||
| * - `ARTIFACTS_ENABLED !== 'true'`: none. | ||
| * - A Cloudflare Artifacts binding is present: that binding. This is every Cloudflare deployment. | ||
| * - Otherwise, the fallback backend the self-host build registered, if any. The Cloudflare build | ||
| * registers none, so on Cloudflare the result is exactly the binding or null. | ||
| * | ||
| * The self-host build (`apps/api/src/selfhost/`, never imported by `src/index.ts`) registers SAM's own | ||
| * git server here. This module holds only the selection, so the Cloudflare bundle carries no | ||
| * hosted-git implementation. | ||
| * | ||
| * Every caller that needs the backend goes through `resolveArtifactsBackend`, so the capability | ||
| * flag, project creation, browsing and git tokens cannot disagree. Deletion uses the same | ||
| * selection without the enable flag, so disabling the feature cannot orphan existing repositories. | ||
| */ | ||
| import type { Env } from '../../env'; | ||
|
|
||
| export type ArtifactsBackend = NonNullable<Env['ARTIFACTS']>; | ||
|
|
||
| /** Builds the fallback backend for an install with no Artifacts binding, or returns null. */ | ||
| export type ArtifactsBackendFallback = (env: Env) => ArtifactsBackend | null; | ||
|
|
||
| let fallback: ArtifactsBackendFallback | null = null; | ||
|
|
||
| /** | ||
| * Installs the backend used when Artifacts is enabled but no Cloudflare binding exists. Called once | ||
| * at module load by the self-host build. Passing null removes it (tests). | ||
| */ | ||
| export function registerArtifactsBackendFallback(factory: ArtifactsBackendFallback | null): void { | ||
| fallback = factory; | ||
| } | ||
|
|
||
| /** The backend this install uses for SAM-native repositories, or null when it has none. */ | ||
| export function resolveArtifactsBackend(env: Env): ArtifactsBackend | null { | ||
| if (env.ARTIFACTS_ENABLED !== 'true') return null; | ||
| return resolveArtifactsBackendForCleanup(env); | ||
| } | ||
|
|
||
| /** Existing repositories still need cleanup after the feature is disabled. Never use for serving. */ | ||
| export function resolveArtifactsBackendForCleanup(env: Env): ArtifactsBackend | null { | ||
| return env.ARTIFACTS ?? fallback?.(env) ?? null; | ||
| } | ||
|
|
||
| /** Whether this install can create and serve SAM-native (Artifacts) repositories. */ | ||
| export function isArtifactsAvailable(env: Env): boolean { | ||
| return resolveArtifactsBackend(env) !== null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.