@loucompanion/forge-bridge 0.1.3-dev.f66395c3ac21 → 0.1.4-dev.1ff37038366e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -1
- package/dist/bridge/bridge-chat.types.d.ts +111 -0
- package/dist/bridge/bridge-chat.types.js +401 -0
- package/dist/bridge/bridge.base.d.ts +9 -1
- package/dist/bridge/bridge.service.d.ts +129 -3
- package/dist/bridge/bridge.service.js +2427 -70
- package/dist/bridge/bridge.types.d.ts +218 -2
- package/dist/bridge/dispatch-result-outbox.d.ts +25 -0
- package/dist/bridge/dispatch-result-outbox.js +62 -0
- package/dist/bridge/dispatch-result-worker.d.ts +2 -0
- package/dist/bridge/dispatch-result-worker.js +122 -0
- package/dist/bridge/internals.d.ts +2 -0
- package/dist/bridge/internals.js +1 -0
- package/dist/bridge/readiness-result-outbox.d.ts +21 -0
- package/dist/bridge/readiness-result-outbox.js +54 -0
- package/dist/bridge/readiness-result-worker.d.ts +2 -0
- package/dist/bridge/readiness-result-worker.js +121 -0
- package/dist/bridge/runner-host-capabilities.d.ts +15 -0
- package/dist/bridge/runner-host-capabilities.js +93 -0
- package/dist/cleanup/cleanup.service.d.ts +14 -2
- package/dist/cleanup/cleanup.service.js +496 -3
- package/dist/cleanup/cleanup.types.d.ts +10 -0
- package/dist/cleanup/index.d.ts +1 -1
- package/dist/cleanup/index.js +1 -1
- package/dist/cleanup/internals.d.ts +2 -2
- package/dist/cleanup/internals.js +1 -1
- package/dist/cli/cli.help.d.ts +2 -0
- package/dist/cli/cli.help.js +217 -0
- package/dist/cli/cli.service.d.ts +55 -7
- package/dist/cli/cli.service.js +429 -219
- package/dist/cli/local-config.d.ts +7 -0
- package/dist/cli/local-config.js +51 -3
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +36 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +341 -0
- package/dist/runtime/attempt-database-broker.d.ts +89 -0
- package/dist/runtime/attempt-database-broker.js +390 -0
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +18 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +140 -0
- package/dist/runtime/attempt-path-operation.d.ts +21 -0
- package/dist/runtime/attempt-path-operation.js +94 -0
- package/dist/runtime/attempt-private-directory.d.ts +6 -0
- package/dist/runtime/attempt-private-directory.js +54 -0
- package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
- package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +97 -0
- package/dist/runtime/attempt-process-supervisor.js +397 -0
- package/dist/runtime/canonical-source-file.d.ts +3 -0
- package/dist/runtime/canonical-source-file.js +54 -0
- package/dist/runtime/docker-engine-probe.d.ts +90 -0
- package/dist/runtime/docker-engine-probe.js +333 -0
- package/dist/runtime/generated-output-reset.d.ts +20 -0
- package/dist/runtime/generated-output-reset.js +157 -0
- package/dist/runtime/host-database-capability-boundary.d.ts +16 -0
- package/dist/runtime/host-database-capability-boundary.js +62 -0
- package/dist/runtime/host-diagnostics.d.ts +11 -0
- package/dist/runtime/host-diagnostics.js +191 -0
- package/dist/runtime/host-execution-root.d.ts +4 -0
- package/dist/runtime/host-execution-root.js +39 -0
- package/dist/runtime/host-listener-inspector.d.ts +51 -0
- package/dist/runtime/host-listener-inspector.js +385 -0
- package/dist/runtime/host-port-broker.d.ts +76 -0
- package/dist/runtime/host-port-broker.js +333 -0
- package/dist/runtime/host-runtime-contract.d.ts +58 -0
- package/dist/runtime/host-runtime-contract.js +813 -0
- package/dist/runtime/host-runtime-lease.d.ts +217 -0
- package/dist/runtime/host-runtime-lease.js +2487 -0
- package/dist/runtime/host-runtime-promotion.d.ts +32 -0
- package/dist/runtime/host-runtime-promotion.js +206 -0
- package/dist/runtime/memory-capacity.d.ts +70 -0
- package/dist/runtime/memory-capacity.js +123 -0
- package/dist/runtime/native-test-postgres-fallback.d.ts +25 -0
- package/dist/runtime/native-test-postgres-fallback.js +91 -0
- package/dist/runtime/node-host-runtime-adapter.d.ts +54 -0
- package/dist/runtime/node-host-runtime-adapter.js +285 -0
- package/dist/runtime/pinned-directory-process.d.ts +9 -0
- package/dist/runtime/pinned-directory-process.js +61 -0
- package/dist/runtime/pinned-source-directory.d.ts +17 -0
- package/dist/runtime/pinned-source-directory.js +94 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +21 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +268 -0
- package/dist/runtime/prepared-runtime-identity.d.ts +6 -0
- package/dist/runtime/prepared-runtime-identity.js +218 -0
- package/dist/runtime/prepared-runtime-readiness.d.ts +30 -0
- package/dist/runtime/prepared-runtime-readiness.js +285 -0
- package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
- package/dist/runtime/runtime-isolation-lease.js +161 -0
- package/dist/runtime/workspace-resource-estimator.d.ts +17 -0
- package/dist/runtime/workspace-resource-estimator.js +174 -0
- package/dist/sandbox/command-runner.d.ts +4 -0
- package/dist/sandbox/command-runner.js +47 -0
- package/dist/sandbox/contract.d.ts +5 -0
- package/dist/sandbox/contract.js +276 -0
- package/dist/sandbox/event-budget.d.ts +11 -0
- package/dist/sandbox/event-budget.js +27 -0
- package/dist/sandbox/image-policy.d.ts +35 -0
- package/dist/sandbox/image-policy.js +247 -0
- package/dist/sandbox/index.d.ts +5 -0
- package/dist/sandbox/index.js +5 -0
- package/dist/sandbox/lease-watchdog.d.ts +18 -0
- package/dist/sandbox/lease-watchdog.js +67 -0
- package/dist/sandbox/preflight.d.ts +84 -0
- package/dist/sandbox/preflight.js +521 -0
- package/dist/sandbox/process.d.ts +20 -0
- package/dist/sandbox/process.js +209 -0
- package/dist/sandbox/provider-auth/codex.d.ts +26 -0
- package/dist/sandbox/provider-auth/codex.js +212 -0
- package/dist/sandbox/repository-lock.d.ts +6 -0
- package/dist/sandbox/repository-lock.js +128 -0
- package/dist/sandbox/runtime.d.ts +302 -0
- package/dist/sandbox/runtime.js +2367 -0
- package/dist/sandbox/sandbox.types.d.ts +93 -0
- package/dist/sandbox/sandbox.types.js +1 -0
- package/dist/sandbox/smoke.d.ts +76 -0
- package/dist/sandbox/smoke.js +380 -0
- package/dist/sandbox/worker-supervisor.d.ts +13 -0
- package/dist/sandbox/worker-supervisor.js +36 -0
- package/dist/sandbox/worker.d.ts +1 -0
- package/dist/sandbox/worker.js +225 -0
- package/dist/sandbox/workspace.service.d.ts +13 -0
- package/dist/sandbox/workspace.service.js +74 -0
- package/dist/session/managed-attempt-tools.d.ts +28 -0
- package/dist/session/managed-attempt-tools.js +1015 -0
- package/dist/session/managed-build-coordinator.d.ts +5 -0
- package/dist/session/managed-build-coordinator.js +105 -0
- package/dist/session/managed-build-receipt.d.ts +21 -0
- package/dist/session/managed-build-receipt.js +337 -0
- package/dist/session/managed-verification-timeouts.d.ts +8 -0
- package/dist/session/managed-verification-timeouts.js +17 -0
- package/dist/session/phase-completion.artifacts.d.ts +27 -0
- package/dist/session/phase-completion.artifacts.js +829 -0
- package/dist/session/phase-completion.d.ts +53 -42
- package/dist/session/phase-completion.helpers.d.ts +117 -0
- package/dist/session/phase-completion.helpers.js +707 -0
- package/dist/session/phase-completion.js +125 -3007
- package/dist/session/phase-completion.prompts.d.ts +14 -0
- package/dist/session/phase-completion.prompts.js +233 -0
- package/dist/session/phase-completion.runtime.d.ts +49 -0
- package/dist/session/phase-completion.runtime.js +840 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -0
- package/dist/session/phase-completion.schemas.js +859 -0
- package/dist/session/phase-completion.validation.d.ts +38 -0
- package/dist/session/phase-completion.validation.js +918 -0
- package/dist/session/pre-publication-validation.d.ts +75 -0
- package/dist/session/pre-publication-validation.js +661 -0
- package/dist/session/provider-cli/bridge-cli.conformance-fixtures.d.ts +72 -0
- package/dist/session/provider-cli/bridge-cli.conformance-fixtures.js +462 -0
- package/dist/session/provider-cli/ci-repair-readiness.d.ts +16 -0
- package/dist/session/provider-cli/ci-repair-readiness.js +110 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +95 -0
- package/dist/session/provider-cli/provider-cli.artifacts.js +812 -0
- package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.deterministic-payloads.d.ts +12 -0
- package/dist/session/provider-cli/provider-cli.deterministic-payloads.js +279 -0
- package/dist/session/provider-cli/provider-cli.deterministic.d.ts +14 -0
- package/dist/session/provider-cli/provider-cli.deterministic.js +407 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +99 -0
- package/dist/session/provider-cli/provider-cli.process.js +874 -0
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +52 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +715 -0
- package/dist/session/provider-cli/provider-cli.qa-sidecars.d.ts +11 -0
- package/dist/session/provider-cli/provider-cli.qa-sidecars.js +66 -0
- package/dist/session/provider-cli/provider-cli.repair-epoch.d.ts +6 -0
- package/dist/session/provider-cli/provider-cli.repair-epoch.js +11 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +16 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +81 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +47 -53
- package/dist/session/provider-cli/provider-cli.service.js +1257 -2497
- package/dist/session/provider-cli/provider-cli.types.d.ts +8 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +32 -0
- package/dist/session/provider-cli/provider-output-state.js +817 -0
- package/dist/session/provider-cli/provider-usage.d.ts +7 -0
- package/dist/session/provider-cli/provider-usage.js +28 -5
- package/dist/session/session-redaction.d.ts +3 -0
- package/dist/session/session-redaction.js +448 -0
- package/dist/session/session.base.d.ts +6 -1
- package/dist/session/session.service.d.ts +8 -2
- package/dist/session/session.service.js +586 -59
- package/dist/session/session.types.d.ts +324 -3
- package/dist/session/session.types.js +939 -10
- package/dist/session/unreferenced-exports.d.ts +12 -0
- package/dist/session/unreferenced-exports.js +59 -0
- package/dist/shared/format/format-bytes.d.ts +1 -0
- package/dist/shared/format/format-bytes.js +9 -0
- package/dist/shared/git/git.js +2 -1
- package/dist/shared/path/path.d.ts +1 -0
- package/dist/shared/path/path.js +21 -1
- package/dist/shared/process/dotnet-toolchain.d.ts +17 -0
- package/dist/shared/process/dotnet-toolchain.js +307 -0
- package/dist/shared/process/host-process-recovery.d.ts +12 -0
- package/dist/shared/process/host-process-recovery.js +78 -0
- package/dist/shared/process/host-process-supervisor.d.ts +59 -0
- package/dist/shared/process/host-process-supervisor.js +330 -0
- package/dist/shared/process/process.d.ts +3 -0
- package/dist/shared/process/process.js +13 -7
- package/dist/shared/process/windows-launch.d.ts +8 -0
- package/dist/shared/process/windows-launch.js +41 -0
- package/dist/shared/provider-capabilities.d.ts +4 -0
- package/dist/shared/provider-capabilities.js +88 -0
- package/dist/shared/redaction/redaction.d.ts +1 -0
- package/dist/shared/redaction/redaction.js +47 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.d.ts +3 -2
- package/dist/worktree/artifact-injector.js +82 -10
- package/dist/worktree/dependency-warmer.d.ts +53 -1
- package/dist/worktree/dependency-warmer.js +619 -11
- package/dist/worktree/index.d.ts +2 -1
- package/dist/worktree/index.js +1 -0
- package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
- package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
- package/dist/worktree/story-qa-reference-hydrator.d.ts +4 -0
- package/dist/worktree/story-qa-reference-hydrator.js +253 -0
- package/dist/worktree/worktree-paths.d.ts +4 -0
- package/dist/worktree/worktree-paths.js +30 -0
- package/dist/worktree/worktree.base.d.ts +3 -0
- package/dist/worktree/worktree.service.d.ts +16 -3
- package/dist/worktree/worktree.service.js +334 -54
- package/dist/worktree/worktree.types.d.ts +9 -1
- package/package.json +12 -7
- package/runtime/windows-job-supervisor.ps1 +722 -0
- package/runtime/windows-listener-owner.ps1 +33 -0
package/README.md
CHANGED
|
@@ -31,7 +31,44 @@ The bridge can also read connection settings from environment variables:
|
|
|
31
31
|
- `FORGE_DEVICE_NAME`
|
|
32
32
|
- `FORGE_REPO_ROOT`
|
|
33
33
|
- `FORGE_CLI_PROVIDERS`
|
|
34
|
-
- `FORGE_CODEX_MODELS` / `FORGE_CURSOR_MODELS` (optional comma-separated model ids advertised in runner capabilities)
|
|
34
|
+
- `FORGE_CODEX_MODELS` / `FORGE_CURSOR_MODELS` / `FORGE_CLAUDE_MODELS` (optional comma-separated model ids advertised in runner capabilities)
|
|
35
|
+
- `FORGE_DOTNET_PATH` (optional absolute `dotnet` executable; the bridge otherwise selects one SDK compatible with its mapped repositories)
|
|
36
|
+
|
|
37
|
+
At `connect`, the bridge inspects mapped .NET repositories and the configured repository root,
|
|
38
|
+
selects one installation satisfying their SDK policies, and pins that executable through `PATH` and `DOTNET_ROOT` for dependency warming,
|
|
39
|
+
managed commands, tests, and host-runtime launches. It fails before accepting work when
|
|
40
|
+
no compatible SDK is available instead of falling through to an older ambient SDK.
|
|
41
|
+
During a framework transition, that installation may need both SDK 8 and SDK 10 side by side;
|
|
42
|
+
separate installations do not combine their SDK inventories. Each checkout retains its own
|
|
43
|
+
`global.json` policy. Keep the default clone root narrowly scoped rather than pointing it at
|
|
44
|
+
a parent containing unrelated maintenance checkouts and generated projects.
|
|
45
|
+
|
|
46
|
+
## Provider CLIs
|
|
47
|
+
|
|
48
|
+
The bridge auto-detects these provider CLIs on `PATH` and advertises the ones it finds:
|
|
49
|
+
|
|
50
|
+
| Provider | CLI | Sign-in | Headless invocation |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `codex` | `codex` | `codex login` | `codex exec --json` |
|
|
53
|
+
| `cursor` | `cursor-agent` | `cursor-agent login` | `cursor-agent --print --output-format stream-json` |
|
|
54
|
+
| `claude` | `claude` (Claude Code) | `claude` then `/login`, or an Anthropic API key granted by Forge | `claude -p --output-format stream-json --verbose` |
|
|
55
|
+
|
|
56
|
+
Claude Code notes:
|
|
57
|
+
|
|
58
|
+
- Install with the native installer or `npm install -g @anthropic-ai/claude-code`. On Windows, Claude Code needs Git for Windows; set `CLAUDE_CODE_GIT_BASH_PATH` if `bash.exe` is not on `PATH`. `CLAUDE_CONFIG_DIR` is passed through if you keep config outside `~/.claude`.
|
|
59
|
+
- Forge pipes the prompt on stdin, runs with `--permission-mode bypassPermissions` inside the managed worktree, and registers its completion MCP server through a temporary `--mcp-config` file outside the worktree with `--strict-mcp-config`, so user-level MCP servers are not loaded into unattended runs. Forge tools appear to the model as `mcp__forge__<tool>`.
|
|
60
|
+
- Claude Code has no model-listing command, so the bridge advertises the `sonnet`, `opus`, and `haiku` aliases. Set `FORGE_CLAUDE_MODELS` to advertise specific model ids instead.
|
|
61
|
+
- Claude runs in host mode only. Docker sandbox placement currently supports Codex only.
|
|
62
|
+
|
|
63
|
+
Show or change the saved server without editing `bridge.json`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
forge-bridge server show
|
|
67
|
+
forge-bridge server set http://localhost:5208
|
|
68
|
+
forge-bridge server set https://srv1493013.tail66073d.ts.net:8443
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`FORGE_URL` overrides the saved server. Changing the saved URL retains runner credentials so aliases for the same deployment keep working; pair again with `--server` when switching to a different Forge deployment.
|
|
35
72
|
|
|
36
73
|
## Repo-local development
|
|
37
74
|
|
|
@@ -53,6 +90,133 @@ forge-bridge add-repo Forge /path/to/Forge
|
|
|
53
90
|
forge-bridge remove-repo Forge
|
|
54
91
|
```
|
|
55
92
|
|
|
93
|
+
Readiness probes and Story dispatch select the same local mapping: repository ID first,
|
|
94
|
+
then a remote-only mapping, then a legacy name-only mapping. Explicit mappings may point
|
|
95
|
+
outside the default clone root; both paths use the mapped checkout's parent without moving
|
|
96
|
+
existing managed worktrees. A readiness request must name the same fully qualified local
|
|
97
|
+
checkout. Missing, ambiguous or mismatched mappings fail before runtime preparation; a
|
|
98
|
+
server-supplied path never grants access to a different repository.
|
|
99
|
+
|
|
100
|
+
Before narrowing a runner's default root, inventory its advertisements, explicitly retain
|
|
101
|
+
every approved or intended executable mapping and its QA launch targets, and document any
|
|
102
|
+
intentional exclusions. An omitted repository mapping can lose its server-side execution
|
|
103
|
+
approval. Reconcile a stale mapping rather than widening filesystem
|
|
104
|
+
access to make a failed readiness request pass.
|
|
105
|
+
|
|
106
|
+
## Host Docker engine capability
|
|
107
|
+
|
|
108
|
+
The bridge probes ordinary Docker-daemon access under its own process identity and advertises the
|
|
109
|
+
generic `docker_engine` execution facility independently from Docker sandbox placement. A Story whose
|
|
110
|
+
QA scope requires `docker_engine` is admitted only to a managed host runner with a fresh successful
|
|
111
|
+
probe. This supports repository-owned Testcontainers, Compose services, and other container tests;
|
|
112
|
+
the repository remains responsible for database and image versions. Forge agent sandboxes do not
|
|
113
|
+
receive the host Docker socket, so a Docker-engine requirement is not eligible for
|
|
114
|
+
`executionMode: docker`. The probe is refreshed on heartbeats and again immediately before a matching
|
|
115
|
+
dispatch.
|
|
116
|
+
|
|
117
|
+
On developer Windows runners, local Docker Desktop recovery can be explicitly enabled by setting
|
|
118
|
+
`dockerDesktopRecoveryEnabled` to `true` in the bridge's local `bridge.json`, or with the
|
|
119
|
+
`FORGE_DOCKER_DESKTOP_AUTO_RECOVERY=true` operator override. The bridge waits for three consecutive
|
|
120
|
+
failed daemon probes plus a fresh confirmation probe after a 30-second grace period. It recovers only
|
|
121
|
+
the local `default` or `desktop-linux` context, and only while it owns no active session or
|
|
122
|
+
reservation. If Docker Desktop is already stopped, recovery starts it without issuing shutdown or
|
|
123
|
+
WSL termination commands. Before relaunch, it removes only verified orphaned Docker companion
|
|
124
|
+
processes whose executable is inside the Docker installation and whose parent is no longer a valid
|
|
125
|
+
Docker backend. A running but unresponsive Desktop is stopped, allowed to settle, and relaunched
|
|
126
|
+
with bounded retries that reject an immediately exiting process. Every recovery is
|
|
127
|
+
single-flight, must pass a fresh `docker info` probe before the capability is advertised again, and
|
|
128
|
+
enters a ten-minute cooldown after an unsuccessful attempt. Remote `DOCKER_HOST` endpoints are never
|
|
129
|
+
restarted. Operators can tune the bounded policy with `FORGE_DOCKER_RECOVERY_FAILURE_THRESHOLD`,
|
|
130
|
+
`FORGE_DOCKER_RECOVERY_COOLDOWN_MS`, and `FORGE_DOCKER_RECOVERY_STARTUP_TIMEOUT_MS`.
|
|
131
|
+
|
|
132
|
+
## Docker sandbox runners
|
|
133
|
+
|
|
134
|
+
Protocol-v2 bridges preflight Docker before advertising the `docker` sandbox runtime. Validate a repository contract and the local runner before enabling a project's `sandbox_required` policy:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
forge sandbox init
|
|
138
|
+
forge sandbox doctor
|
|
139
|
+
forge sandbox smoke
|
|
140
|
+
forge-bridge sandbox reap
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Configure the local bridge's persistent Docker placement policy with:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
forge-bridge sandbox on
|
|
147
|
+
forge-bridge sandbox on --allow-open-public
|
|
148
|
+
forge-bridge sandbox status
|
|
149
|
+
forge-bridge sandbox off
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`sandbox on` keeps unrestricted public networking denied by default. The developer-only
|
|
153
|
+
`--allow-open-public` option stores an explicit local approval in `bridge.json`; it survives
|
|
154
|
+
bridge restarts and is reported by `sandbox status`. Restart a connected bridge after changing
|
|
155
|
+
the policy. `FORGE_DOCKER_SANDBOX` and `FORGE_ALLOW_OPEN_PUBLIC_SANDBOX` remain higher-priority
|
|
156
|
+
operator overrides when present.
|
|
157
|
+
|
|
158
|
+
`forge sandbox smoke` runs doctor, builds the repository-owned `.forge/Dockerfile`, launches a disposable hardened container on an internal network with a fresh workspace volume, and verifies that its exact attempt-labeled container, network, volume, and image are gone afterward. It writes a redacted JSON report under `FORGE_SANDBOX_STATE_ROOT/smoke-reports`; use `--report <path>` to choose a different destination. Stop the connected bridge before running smoke so the command can exclusively acquire the Docker-context ownership lock.
|
|
159
|
+
|
|
160
|
+
Use `forge sandbox smoke --probe-loopback-port` only when proving Docker host-port allocation. The normal hardened container remains internal with no publication; a separate exact-labeled fixture requests `127.0.0.1::8080/tcp`, records Docker's assigned loopback port, rejects wildcard or ambiguous mappings, and is removed by the same exact-label cleanup verification.
|
|
161
|
+
|
|
162
|
+
Production shared runners require a Linux rootless Docker daemon. Docker Desktop is developer-only and must be opted in with `FORGE_ALLOW_DOCKER_DESKTOP_SANDBOX=true`. Useful runner settings are:
|
|
163
|
+
|
|
164
|
+
- `FORGE_TRUST_DOMAIN_ID` — must match the project trust domain.
|
|
165
|
+
- `FORGE_MAX_CONCURRENT_SANDBOXES` — hard slot ceiling; start at `1`.
|
|
166
|
+
- `FORGE_MAX_CONCURRENT_SANDBOX_BUILDS` / `FORGE_SANDBOX_PID_CAPACITY` — weighted build and PID admission ceilings (defaults: `1` and `2048`).
|
|
167
|
+
- `FORGE_DOCKER_CONTEXT` / `FORGE_DOCKER_EXECUTABLE` — dedicated daemon selection.
|
|
168
|
+
- `FORGE_SANDBOX_STATE_ROOT` — fsync'd attempt ledgers, restricted diagnostics, and build state.
|
|
169
|
+
- `FORGE_SANDBOX_EXECUTION_ROOT` — optional absolute root for disposable managed-host temp/cache/test trees. Windows defaults to the compact per-user `%USERPROFILE%\.fgx` root and rejects a configured root that cannot fit Forge's nested Git/test path budget before an agent starts. Durable ledgers and retained diagnostics remain under `FORGE_SANDBOX_STATE_ROOT`.
|
|
170
|
+
- `FORGE_DISK_HIGH_WATERMARK_PERCENT` / `FORGE_DISK_LOW_WATERMARK_PERCENT` / `FORGE_MINIMUM_WORKSPACE_BYTES` — admission watermarks with high/low hysteresis.
|
|
171
|
+
- Per-attempt workspace reservations are calculated from the repository source footprint, detected Node/.NET/browser toolchains, the execution role, and immutable sandbox app services. The API uses that request for local and Bridge placement; a Bridge rechecks its authoritative checkout and Docker contract before acceptance. Shared Docker images and package caches remain runner-level capacity, while `FORGE_MINIMUM_WORKSPACE_BYTES` remains a separate host safety reserve rather than a per-lane charge.
|
|
172
|
+
- `FORGE_SANDBOX_HOST_MEMORY_RESERVE_BYTES` — explicit host-memory safety-reserve override for sandbox admission. Without an override, Forge derives a bounded reserve from the sampled capacity domain (Linux: 12.5%, 1–4 GiB; Docker Desktop development: 6.25%, 1–2 GiB). The floor, ceiling, and percentage are configurable with `FORGE_SANDBOX_HOST_MEMORY_RESERVE_FLOOR_BYTES`, `FORGE_SANDBOX_HOST_MEMORY_RESERVE_CEILING_BYTES`, and `FORGE_SANDBOX_HOST_MEMORY_RESERVE_PERCENT`.
|
|
173
|
+
- Managed-host admission uses the same bounded 12.5% physical-memory policy through `FORGE_HOST_MEMORY_RESERVE_BYTES` or its `_FLOOR_BYTES`, `_CEILING_BYTES`, and `_PERCENT` controls. While no Forge attempt holds capacity, the first worker is admitted against the configured reserve floor (1 GiB by default); `FORGE_HOST_IDLE_MEMORY_RESERVE_BYTES` can override that idle reserve. Once an attempt is admitted, every additional admission enforces the full target reserve. Pressure is applied immediately; recovery requires two samples one second apart by default (`FORGE_HOST_MEMORY_RECOVERY_SAMPLES` and `FORGE_HOST_MEMORY_RECOVERY_SAMPLE_INTERVAL_MS`). `FORGE_HOST_DEFAULT_WORKER_MEMORY_LIMIT_BYTES` configures only the conservative cold-start fallback for legacy packets that omit an exact worker request; current packets remain governed by their explicit role request.
|
|
174
|
+
- `FORGE_SANDBOX_MEMORY_SAMPLE_INTERVAL_MS` — interval for sampled Docker peak-memory telemetry (default `1000` ms, clamped to `250`–`30000` ms). Sampling is diagnostic and never changes an attempt outcome.
|
|
175
|
+
- `FORGE_SANDBOX_DEDICATED_DISK=true` — operator assertion that sandbox storage is on a dedicated, conservatively watermarked disk when the Docker storage driver cannot enforce per-volume quotas. `sandbox_required` fails placement unless either quota support or this assertion is advertised.
|
|
176
|
+
- `FORGE_SANDBOX_IMAGE_RETENTION_COUNT` / `FORGE_SANDBOX_IMAGE_RETENTION_TTL_MS` — per-project image-cache retention (defaults: 3 images and 7 days).
|
|
177
|
+
- `FORGE_SANDBOX_AUDIT_RETENTION_COUNT` / `FORGE_SANDBOX_AUDIT_RETENTION_TTL_MS` — restricted failed-build/attestation retention (defaults: 200 keys and 30 days); evidence for active image digests is protected.
|
|
178
|
+
- `FORGE_AGENT_TOOLING_IMAGE` — digest-pinned Node tooling base required by `sandbox_required`.
|
|
179
|
+
- `FORGE_SANDBOX_IMAGE_POLICY_ENFORCED`, `FORGE_SANDBOX_SBOM_EXECUTABLE`, `FORGE_SANDBOX_VULNERABILITY_EXECUTABLE`, and `FORGE_SANDBOX_PROVENANCE_SIGNING_KEY` — required generated-image promotion gates. The SBOM command must accept Syft-compatible `<image> -o spdx-json`; the vulnerability command must accept Trivy-compatible image arguments.
|
|
180
|
+
- `FORGE_SANDBOX_SIGNATURE_EXECUTABLE` / `FORGE_SANDBOX_SIGNATURE_PUBLIC_KEY` — Cosign-compatible verifier and bounded public-key file. `sandbox_required` verifies every digest-pinned external Dockerfile base/`COPY --from` source and Forge tooling base before generated-image promotion, plus every service-catalog and egress-proxy image before runtime use; adoption modes emit a warning when verification is not configured.
|
|
181
|
+
- `FORGE_SANDBOX_BUILD_EGRESS_ENFORCED` — confirms the dedicated BuildKit builder is behind the approved build-egress control; required for `sandbox_required`.
|
|
182
|
+
- `FORGE_SANDBOX_BUILD_NOFILE` — bounded per-build-step file-descriptor cap (default: `4096`). `FORGE_SANDBOX_BUILDER_PIDS_LIMIT` caps and verifies aggregate processes on the dedicated BuildKit container (default `512`). Buildx `--resource` memory/CPU caps are intentionally not emitted because they are not portable across supported Buildx versions; agent runtime containers still receive Docker memory/CPU limits.
|
|
183
|
+
- `FORGE_SANDBOX_BUILDKIT_CACHE_MAX` / `FORGE_SANDBOX_BUILDKIT_CACHE_RESERVED` — pressure-triggered dedicated-builder cache bounds (defaults: 20 GiB maximum and 2 GiB reserved; minimum free space follows `FORGE_MINIMUM_WORKSPACE_BYTES`).
|
|
184
|
+
- `FORGE_SANDBOX_SECCOMP_PROFILE` / `FORGE_SANDBOX_LSM_SECURITY_OPT` — absolute hardened seccomp profile and AppArmor/SELinux Docker security option applied to every agent and service; required for `sandbox_required`.
|
|
185
|
+
- `FORGE_SANDBOX_HARD_WALL_SECONDS` / `FORGE_SANDBOX_IDLE_SECONDS` — monotonic worker deadlines (defaults: 8 hours and 30 minutes; both are capped by the 8-hour hard maximum).
|
|
186
|
+
- `FORGE_SANDBOX_PUBLICATION_MODE=bridge_push` — remote-safe exact-SHA result publication. This is required for `sandbox_required`; the default `shared_filesystem` mode is intended only for deployments where the bridge and API intentionally share the repository filesystem.
|
|
187
|
+
- `FORGE_SERVICE_POSTGRES_IMAGE`, `FORGE_SERVICE_REDIS_IMAGE`, and `FORGE_SERVICE_BROWSER_IMAGE` — digest-pinned service-catalog images when declared by a contract.
|
|
188
|
+
|
|
189
|
+
`public_allowlist` uses an internal agent network plus a separate external network joined only by a restricted Squid-compatible proxy. Configure a digest-pinned `FORGE_SANDBOX_EGRESS_PROXY_IMAGE` and `FORGE_SANDBOX_EGRESS_ENFORCED=true`; Forge generates the domain allowlist with private, loopback, link-local, metadata, unsafe-port, and default-deny rules and injects proxy variables into the worker. `open_public` is developer-only and additionally requires `FORGE_ALLOW_OPEN_PUBLIC_SANDBOX=true`. Neither setting weakens `sandbox_required`.
|
|
190
|
+
|
|
191
|
+
Before selecting `sandbox_required`, save the full approved 40- or 64-character Git commit SHA in the project's Sandbox policy dialog. The server persists that SHA on the immutable attempt and the bridge reads `.forge/forge.sandbox.yml`, `.forge/Dockerfile`, and the tracked build context only from that commit. API-key dispatches carry an opaque one-time grant handle; the authenticated current runner instance redeems it after reservation, and plaintext stays out of offers, database payloads, Docker metadata, and host-persisted control files.
|
|
192
|
+
|
|
193
|
+
Temporary host fallback for `sandbox_preferred` requires both sides to opt in: a project owner must save a reason and future expiry (maximum 30 days), and an operator must enable **Host fallback** for the runner in Profile Settings. Either missing or expired authorization fails closed. `sandbox_required` never falls back.
|
|
194
|
+
|
|
195
|
+
The bridge reaps exact-labeled orphan resources before connecting and every minute afterward. Connected passes reconcile current-instance ledgers against an authoritative, instance-scoped server attempt snapshot; startup does not adopt old-instance resources and terminates them before advertising capacity. Per-resource removal outcomes are written mode-0600 under `FORGE_SANDBOX_STATE_ROOT/cleanup-reports` before transmission, replayed after reconnect, acknowledged by report ID, and persisted by the API only when attempt, fence, resource runner instance, and current reporting runner match. Fenced dispatch events also persist image/cache status, build/agent-start/import/teardown timestamps, and a validated inventory of created agent/sidecar containers, networks, volumes, and published ports. Selected-session diagnostics expose that lifecycle data and recent cleanup actions while retaining cleanup-pending state after the agent outcome is terminal. Install `forge-bridge sandbox reap` as an independently supervised OS timer with the same `FORGE_RUNNER_ID`, Docker context, and state root so resources are reconciled while the bridge is down; the Docker-context ownership lock makes an overlapping pass fail safely. A non-zero `degradedReservationCount` means teardown has not completed; the affected capacity remains unavailable until a successful reaper pass. Drain a runner from Profile Settings before upgrades or Docker maintenance, wait for active/starting counts to reach zero, then restart the bridge. Profile Settings also exposes a scoped **Reap** action; the API delivers it only to the currently established protocol-v2 runner instance. Image GC runs only while disk pressure is latched, shares the build lock, preserves active image digests, and prunes only expired images beyond the per-project retention count. Lease renewals are HMAC-bound to the attempt and fence and advance an in-container monotonic deadline; lease, hard-wall, and idle expiry produce distinct failure codes.
|
|
196
|
+
|
|
197
|
+
Every attempt-owned container (including short-lived initialization helpers), network, and volume carries `dev.forge.resource-lease-id` equal to the dispatch execution lease. Ledger schema v2 persists the same `resourceLeaseId`; teardown compares the complete expected label set, and orphan reaping fails closed unless the managed, resource-lease, execution-lease, attempt, runner, runner-instance, and fencing identities are all present and consistent.
|
|
198
|
+
|
|
199
|
+
Host-mode diagnostics retain logs and test results under the 200 MiB archive budget, but omit reproducible `.dll` and `.pdb` copies from `test-output`; the archive manifest records their count and bytes. If other evidence exceeds the budget after supervised children and adapters have stopped, the Bridge releases runtime capacity while preserving the original attempt directory and a released ledger for restricted operator review. It does not delete over-budget original evidence automatically. Process-cleanup failures and unsafe evidence paths still fail closed and retain the runtime claim.
|
|
200
|
+
|
|
201
|
+
In `bridge_push` mode, the start packet carries only an attempt/fence/branch-bound publication handle. After validating and importing the output bundle, the authenticated current bridge redeems that handle for an in-memory, exact-repository credential; the API rechecks the live lease/fence/grant/branch/result SHA and records redemption before returning it. Git receives the credential through a process environment configuration, never command arguments, files, Git config, or the container. The bridge compares the remote branch with the immutable input commit and pushes only the exact result commit using `--force-with-lease`; cancellation aborts Git, an already-published matching result is an idempotent success, and any other remote value is rejected as stale. The API records the fenced publication acknowledgment before sign-off and does not push the branch a second time while opening the pull request.
|
|
202
|
+
|
|
203
|
+
Failed project, tooling, and agent image stages preserve only a redacted, capped, mode-0600 diagnostic at `FORGE_SANDBOX_STATE_ROOT/build-logs/<image-key>/<stage>.log`. The event stream carries its digest, byte count, and truncation flag, never the log contents. Treat this directory as restricted source-bearing audit data and apply local retention controls.
|
|
204
|
+
|
|
205
|
+
## Owned test evidence
|
|
206
|
+
|
|
207
|
+
`npm test` closes a manifest over the complete Bridge source, test, runtime, configuration, workflow,
|
|
208
|
+
and imported fixture set before compilation. It records the Git commit and exact Node, npm, Git, .NET,
|
|
209
|
+
TypeScript, Vitest, OS, and temporary-root identities, compiles into an owned temporary root, runs
|
|
210
|
+
Vitest through the Windows process-tree supervisor, revalidates the source and toolchain, independently
|
|
211
|
+
rehashes the compiled output, and removes the exact owner root before reporting success.
|
|
212
|
+
|
|
213
|
+
Set `FORGE_BRIDGE_SUITE_RECEIPT_PATH` to an absolute path for a nonexistent output file to retain the
|
|
214
|
+
verified execution receipt. On Windows evidence runs, `TEMP`, `TMP`, `TMPDIR`, and `FORGE_TMPDIR` may
|
|
215
|
+
point to the same short, empty, high-capacity root. This changes only owned temporary-file placement; it
|
|
216
|
+
does not weaken disk, memory, cleanup, or Docker preflight policy. A Bridge receipt remains
|
|
217
|
+
`fullGateAttested=false` until the suite is registered with the live residue auditor and the required
|
|
218
|
+
source/toolchain-identical repeat evidence is complete.
|
|
219
|
+
|
|
56
220
|
## Package smoke check
|
|
57
221
|
|
|
58
222
|
From this package directory:
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export declare const bridgeChatProtocolVersion = "chat_interactive_v1";
|
|
2
|
+
export declare const bridgeChatUpdateRequiredCode = "update_required";
|
|
3
|
+
export declare const bridgeChatMaxCallbackPayloadBytes: number;
|
|
4
|
+
export declare const bridgeChatMaxProviderThreadIdChars = 256;
|
|
5
|
+
export type BridgeChatAvailability = "available" | "degraded" | "unavailable";
|
|
6
|
+
export type BridgeChatRequestedCapability = "text" | "cancel" | "resume" | "thread_continuity" | "attachment_handoffs" | "action_broker_grants";
|
|
7
|
+
export type ChatTurnCallbackKind = "turn_started" | "output_delta" | "output_completed" | "failed" | "cancelled" | "expired";
|
|
8
|
+
export type ChatTurnCallbackRedactionStatus = "redacted" | "not_applicable";
|
|
9
|
+
export interface BridgeChatCapability {
|
|
10
|
+
readonly availability: BridgeChatAvailability;
|
|
11
|
+
readonly protocolVersion: string;
|
|
12
|
+
readonly supportedProviders: readonly string[];
|
|
13
|
+
readonly supportedModels: readonly string[];
|
|
14
|
+
readonly supportsTextStreaming: boolean;
|
|
15
|
+
readonly supportsCancel: boolean;
|
|
16
|
+
readonly supportsResume: boolean;
|
|
17
|
+
readonly supportsProviderThreadContinuity: boolean;
|
|
18
|
+
readonly supportsAttachments: boolean;
|
|
19
|
+
readonly supportsActionBrokerGrants: boolean;
|
|
20
|
+
readonly maxMessageBytes: number;
|
|
21
|
+
readonly maxContextRefs: number;
|
|
22
|
+
readonly unavailableCode?: string | null;
|
|
23
|
+
readonly unavailableReason?: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface ChatTurnDispatchPacket {
|
|
26
|
+
readonly chatRunId: string;
|
|
27
|
+
readonly conversationId: string;
|
|
28
|
+
readonly turnId: string;
|
|
29
|
+
readonly leaseId: string;
|
|
30
|
+
readonly fencingToken: string;
|
|
31
|
+
readonly runnerInstanceId: string;
|
|
32
|
+
readonly providerKind: string;
|
|
33
|
+
readonly model: string;
|
|
34
|
+
readonly messages: readonly ChatTurnMessage[];
|
|
35
|
+
readonly contextRefs: readonly ChatTurnContextRef[];
|
|
36
|
+
readonly idempotencyKey: string;
|
|
37
|
+
readonly providerThreadId?: string | null;
|
|
38
|
+
readonly protocolVersion: typeof bridgeChatProtocolVersion;
|
|
39
|
+
readonly requestedCapabilities: readonly BridgeChatRequestedCapability[];
|
|
40
|
+
readonly attachmentHandoffs: readonly ChatAttachmentHandoffHandle[];
|
|
41
|
+
readonly actionBrokerGrants: readonly ChatActionBrokerGrant[];
|
|
42
|
+
}
|
|
43
|
+
export interface ChatTurnMessage {
|
|
44
|
+
readonly role: string;
|
|
45
|
+
readonly content: string;
|
|
46
|
+
readonly metadata?: Readonly<Record<string, unknown>> | null;
|
|
47
|
+
}
|
|
48
|
+
export interface ChatTurnContextRef {
|
|
49
|
+
readonly kind: string;
|
|
50
|
+
readonly refId: string;
|
|
51
|
+
readonly title?: string | null;
|
|
52
|
+
readonly summary?: string | null;
|
|
53
|
+
readonly metadata?: Readonly<Record<string, unknown>> | null;
|
|
54
|
+
}
|
|
55
|
+
export interface ChatAttachmentHandoffHandle {
|
|
56
|
+
readonly turnId: string;
|
|
57
|
+
readonly attachmentId: string;
|
|
58
|
+
readonly tempFileToken: string;
|
|
59
|
+
readonly mimeType: string;
|
|
60
|
+
readonly sizeBytes: number;
|
|
61
|
+
readonly sha256: string;
|
|
62
|
+
readonly fileNameDisplay: string;
|
|
63
|
+
readonly expiresAt: string;
|
|
64
|
+
readonly status: "available";
|
|
65
|
+
}
|
|
66
|
+
export interface ChatActionBrokerGrant {
|
|
67
|
+
readonly grantId: string;
|
|
68
|
+
readonly turnId: string;
|
|
69
|
+
readonly leaseId: string;
|
|
70
|
+
readonly fencingToken: string;
|
|
71
|
+
readonly allowedScopes: readonly string[];
|
|
72
|
+
readonly nonce: string;
|
|
73
|
+
readonly expiresAt: string;
|
|
74
|
+
readonly redactionStatus: ChatTurnCallbackRedactionStatus;
|
|
75
|
+
}
|
|
76
|
+
export interface ChatTurnCallbackEnvelope {
|
|
77
|
+
readonly callbackId: string;
|
|
78
|
+
readonly chatRunId: string;
|
|
79
|
+
readonly conversationId: string;
|
|
80
|
+
readonly turnId: string;
|
|
81
|
+
readonly leaseId: string;
|
|
82
|
+
readonly fencingToken: string;
|
|
83
|
+
readonly runnerId: string;
|
|
84
|
+
readonly runnerInstanceId: string;
|
|
85
|
+
readonly sequence: number;
|
|
86
|
+
readonly eventType: ChatTurnCallbackKind;
|
|
87
|
+
readonly redactionStatus: ChatTurnCallbackRedactionStatus;
|
|
88
|
+
readonly providerThreadId?: string | null;
|
|
89
|
+
readonly payload?: Readonly<Record<string, unknown>> | null;
|
|
90
|
+
readonly occurredAt?: string | null;
|
|
91
|
+
readonly protocolVersion: typeof bridgeChatProtocolVersion;
|
|
92
|
+
}
|
|
93
|
+
export interface ChatTurnCancelPacket {
|
|
94
|
+
readonly chatRunId?: string | null;
|
|
95
|
+
readonly conversationId?: string | null;
|
|
96
|
+
readonly turnId?: string | null;
|
|
97
|
+
readonly leaseId: string;
|
|
98
|
+
readonly fencingToken: string;
|
|
99
|
+
readonly runnerId?: string | null;
|
|
100
|
+
readonly runnerInstanceId?: string | null;
|
|
101
|
+
readonly providerThreadId?: string | null;
|
|
102
|
+
readonly reason?: string | null;
|
|
103
|
+
readonly payload?: Readonly<Record<string, unknown>> | null;
|
|
104
|
+
readonly requestedAt?: string | null;
|
|
105
|
+
readonly protocolVersion?: string | null;
|
|
106
|
+
}
|
|
107
|
+
export declare function unavailableBridgeChatCapability(protocolVersion?: string, unavailableCode?: string | null, unavailableReason?: string | null): BridgeChatCapability;
|
|
108
|
+
export declare function normalizeBridgeChatCapability(value: BridgeChatCapability | null | undefined): BridgeChatCapability;
|
|
109
|
+
export declare function parseChatTurnDispatchPacket(value: unknown, capability?: BridgeChatCapability): ChatTurnDispatchPacket;
|
|
110
|
+
export declare function isTerminalChatTurnCallbackKind(kind: ChatTurnCallbackKind): boolean;
|
|
111
|
+
export declare function assertBridgeChatCallbackPayload(value: unknown, label?: string): void;
|