@ours.network/fleet 1.2.0-nightly.2 → 1.2.0-nightly.20
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 +152 -29
- package/dist/agent-ours/bridge.d.ts +3 -0
- package/dist/agent-ours/bridge.js +178 -0
- package/dist/agent-ours/controller.d.ts +14 -0
- package/dist/agent-ours/controller.js +60 -0
- package/dist/agent-ours/correspondence.d.ts +10 -0
- package/dist/agent-ours/correspondence.js +1 -0
- package/dist/agent-ours/file-rpc.d.ts +23 -0
- package/dist/agent-ours/file-rpc.js +123 -0
- package/dist/agent-ours/harness.d.ts +14 -0
- package/dist/agent-ours/harness.js +72 -0
- package/dist/agent-ours/mcp-endpoint.d.ts +15 -0
- package/dist/agent-ours/mcp-endpoint.js +111 -0
- package/dist/agent-ours/runtime.d.ts +59 -0
- package/dist/agent-ours/runtime.js +283 -0
- package/dist/agent-ours/service.d.ts +23 -0
- package/dist/agent-ours/service.js +372 -0
- package/dist/agent-ours/state.d.ts +45 -0
- package/dist/agent-ours/state.js +95 -0
- package/dist/agent-ours/wire.d.ts +14 -0
- package/dist/agent-ours/wire.js +55 -0
- package/dist/agent-recovery-gate.js +1 -1
- package/dist/application/conversation-history.d.ts +6 -0
- package/dist/application/conversation-history.js +65 -0
- package/dist/application/fleet-query-service.d.ts +1 -1
- package/dist/application/fleet-query-service.js +2 -2
- package/dist/application/legacy-supervisor-identity.d.ts +7 -0
- package/dist/application/legacy-supervisor-identity.js +43 -0
- package/dist/application/model-catalog.d.ts +1 -1
- package/dist/application/model-catalog.js +5 -2
- package/dist/application/preset-provenance.d.ts +19 -0
- package/dist/application/preset-provenance.js +59 -0
- package/dist/application/room-layout-definitions.d.ts +45 -0
- package/dist/application/room-layout-definitions.js +130 -0
- package/dist/application/session-control.d.ts +8 -0
- package/dist/application/session-control.js +21 -3
- package/dist/application/supervisor-ours-tools.d.ts +159 -0
- package/dist/application/supervisor-ours-tools.js +113 -0
- package/dist/application/task-layouts.d.ts +89 -0
- package/dist/application/task-layouts.js +248 -0
- package/dist/application/task-room-service.d.ts +99 -3
- package/dist/application/task-room-service.js +296 -31
- package/dist/atomic-file.d.ts +5 -0
- package/dist/atomic-file.js +62 -1
- package/dist/briefing.js +10 -59
- package/dist/build-info.json +5 -4
- package/dist/capabilities.d.ts +2 -1
- package/dist/capabilities.js +2 -0
- package/dist/cli.js +65 -2
- package/dist/client-profile.d.ts +5 -16
- package/dist/client-profile.js +4 -112
- package/dist/config.d.ts +4 -0
- package/dist/config.js +7 -0
- package/dist/creation.d.ts +1 -1
- package/dist/creation.js +5 -16
- package/dist/daemon-recovery.d.ts +1 -8
- package/dist/daemon-recovery.js +8 -113
- package/dist/docs.d.ts +3 -3
- package/dist/docs.js +43 -23
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +46 -59
- package/dist/erased-resources.d.ts +9 -0
- package/dist/erased-resources.js +87 -0
- package/dist/fleet-command-audit.d.ts +1 -0
- package/dist/fleet-command-audit.js +12 -7
- package/dist/harness/agent-session.d.ts +2 -0
- package/dist/harness/claude-code-session.js +4 -2
- package/dist/harness/codex-app-server-proxy.d.ts +4 -1
- package/dist/harness/codex-app-server-proxy.js +41 -5
- package/dist/harness/codex-session.js +9 -2
- package/dist/harness/codex.d.ts +3 -2
- package/dist/harness/codex.js +4 -3
- package/dist/harness/hermes-session.js +7 -1
- package/dist/init-wizard.js +19 -9
- package/dist/monitor.d.ts +1 -34
- package/dist/monitor.js +24 -151
- package/dist/owner-channel/channel.d.ts +3 -0
- package/dist/owner-channel/channel.js +34 -6
- package/dist/owner-channel/commands.d.ts +4 -0
- package/dist/owner-channel/commands.js +8 -0
- package/dist/owner-channel/lifecycle-outbox.js +4 -3
- package/dist/owner-channel/ours-client.js +2 -17
- package/dist/preset-migration.js +15 -0
- package/dist/rooms-tasks/add-member.d.ts +48 -0
- package/dist/rooms-tasks/add-member.js +83 -0
- package/dist/rooms-tasks/archived-absence.d.ts +8 -0
- package/dist/rooms-tasks/archived-absence.js +48 -0
- package/dist/rooms-tasks/cli.js +34 -5
- package/dist/rooms-tasks/close.d.ts +5 -2
- package/dist/rooms-tasks/close.js +208 -28
- package/dist/rooms-tasks/config.js +3 -1
- package/dist/rooms-tasks/cowork-adapter.d.ts +6 -4
- package/dist/rooms-tasks/cowork-adapter.js +11 -117
- package/dist/rooms-tasks/cowork-http.d.ts +3 -0
- package/dist/rooms-tasks/cowork-http.js +70 -0
- package/dist/rooms-tasks/deletion.d.ts +1 -1
- package/dist/rooms-tasks/deletion.js +74 -5
- package/dist/rooms-tasks/erasure.d.ts +6 -0
- package/dist/rooms-tasks/erasure.js +169 -0
- package/dist/rooms-tasks/external-worker.d.ts +1 -1
- package/dist/rooms-tasks/external-worker.js +3 -4
- package/dist/rooms-tasks/layout-cli.d.ts +2 -0
- package/dist/rooms-tasks/layout-cli.js +81 -0
- package/dist/rooms-tasks/layout-config.d.ts +11 -0
- package/dist/rooms-tasks/layout-config.js +89 -0
- package/dist/rooms-tasks/layout-control.d.ts +21 -0
- package/dist/rooms-tasks/layout-control.js +52 -0
- package/dist/rooms-tasks/layout-service.d.ts +39 -0
- package/dist/rooms-tasks/layout-service.js +173 -0
- package/dist/rooms-tasks/layout.d.ts +102 -0
- package/dist/rooms-tasks/layout.js +227 -0
- package/dist/rooms-tasks/live-readiness.d.ts +18 -0
- package/dist/rooms-tasks/live-readiness.js +85 -0
- package/dist/rooms-tasks/member-startup.d.ts +1 -0
- package/dist/rooms-tasks/member-startup.js +2 -0
- package/dist/rooms-tasks/provision.d.ts +14 -0
- package/dist/rooms-tasks/provision.js +182 -48
- package/dist/rooms-tasks/room-state.d.ts +4 -2
- package/dist/rooms-tasks/room-state.js +53 -8
- package/dist/rooms-tasks/task-state.d.ts +42 -7
- package/dist/rooms-tasks/task-state.js +153 -23
- package/dist/rooms-tasks/types.d.ts +28 -0
- package/dist/rooms-tasks/workspace-artifacts.d.ts +6 -0
- package/dist/rooms-tasks/workspace-artifacts.js +93 -0
- package/dist/rooms-tasks/workspace.d.ts +26 -0
- package/dist/rooms-tasks/workspace.js +195 -0
- package/dist/runner.d.ts +23 -3
- package/dist/runner.js +574 -494
- package/dist/session/acp.d.ts +3 -0
- package/dist/session/acp.js +7 -0
- package/dist/session/arbiter.d.ts +3 -0
- package/dist/session/arbiter.js +20 -2
- package/dist/session/codex-app-server-transport.js +1 -1
- package/dist/session/codex-app-server.d.ts +3 -0
- package/dist/session/codex-app-server.js +25 -1
- package/dist/session/control.d.ts +10 -1
- package/dist/session/control.js +36 -2
- package/dist/session/conversation-normalizer.d.ts +2 -1
- package/dist/session/conversation-normalizer.js +1 -1
- package/dist/session/conversation-types.d.ts +5 -3
- package/dist/session/task-notice.d.ts +14 -0
- package/dist/session/task-notice.js +13 -0
- package/dist/session/types.d.ts +3 -0
- package/dist/socket-path.d.ts +2 -0
- package/dist/socket-path.js +22 -0
- package/dist/spawn.js +19 -16
- package/dist/startup-readiness.d.ts +13 -0
- package/dist/startup-readiness.js +38 -0
- package/dist/supervisor/launchd.js +2 -1
- package/dist/supervisor/systemd.js +9 -23
- package/dist/temp-idle.d.ts +17 -0
- package/dist/temp-idle.js +42 -0
- package/dist/temp-lifecycle.d.ts +6 -1
- package/dist/temp-lifecycle.js +29 -13
- package/dist/temp-supervisor-recovery.d.ts +3 -0
- package/dist/temp-supervisor-recovery.js +46 -0
- package/dist/watchdog/briefing.js +3 -16
- package/dist/watchdog/run.js +19 -5
- package/dist/web/agent-attachments.d.ts +29 -0
- package/dist/web/agent-attachments.js +162 -0
- package/dist/web/auth.d.ts +4 -1
- package/dist/web/auth.js +23 -2
- package/dist/web/control.js +2 -1
- package/dist/web/fleet-config-service.d.ts +4 -1
- package/dist/web/fleet-config-service.js +46 -15
- package/dist/web/prefix-gateway.d.ts +20 -0
- package/dist/web/prefix-gateway.js +150 -0
- package/dist/web/runtime.d.ts +4 -0
- package/dist/web/runtime.js +19 -14
- package/dist/web/server.d.ts +7 -0
- package/dist/web/server.js +293 -25
- package/docs/room-layouts.md +92 -0
- package/docs/task-workspaces.md +130 -0
- package/examples/room-layouts/fresh.yaml +27 -0
- package/examples/room-layouts/shared.yaml +19 -0
- package/package.json +17 -13
- package/presets/README.md +66 -0
- package/presets/brain-catalog.json +7 -2
- package/presets/fleet/agent_templates/Engineer.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-1-high.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-1-low.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-1-max.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-1-medium.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-1-xhigh.yaml +5 -0
- package/presets/fleet/brains/claude-fable-5-high.yaml +1 -1
- package/presets/fleet/brains/claude-fable-5-low.yaml +1 -1
- package/presets/fleet/brains/claude-fable-5-max.yaml +1 -1
- package/presets/fleet/brains/claude-fable-5-medium.yaml +1 -1
- package/presets/fleet/brains/claude-fable-5-xhigh.yaml +1 -1
- package/presets/fleet/brains/claude-haiku-4-5-20251001-default.yaml +4 -0
- package/presets/fleet/brains/claude-opus-5-5-high.yaml +5 -0
- package/presets/fleet/brains/claude-opus-5-5-low.yaml +5 -0
- package/presets/fleet/brains/claude-opus-5-5-max.yaml +5 -0
- package/presets/fleet/brains/claude-opus-5-5-medium.yaml +5 -0
- package/presets/fleet/brains/claude-opus-5-5-xhigh.yaml +5 -0
- package/presets/fleet/brains/claude-opus-5-high.yaml +1 -1
- package/presets/fleet/brains/claude-opus-5-low.yaml +1 -1
- package/presets/fleet/brains/claude-opus-5-max.yaml +1 -1
- package/presets/fleet/brains/claude-opus-5-medium.yaml +1 -1
- package/presets/fleet/brains/claude-opus-5-xhigh.yaml +1 -1
- package/presets/fleet/brains/claude-sonnet-5-high.yaml +1 -1
- package/presets/fleet/brains/claude-sonnet-5-low.yaml +1 -1
- package/presets/fleet/brains/claude-sonnet-5-max.yaml +1 -1
- package/presets/fleet/brains/claude-sonnet-5-medium.yaml +1 -1
- package/presets/fleet/brains/claude-sonnet-5-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-3-codex-spark-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-3-codex-spark-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-3-codex-spark-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-3-codex-spark-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-mini-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-mini-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-mini-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-mini-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-4-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-5-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-5-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-5-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-5-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-luna-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-luna-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-luna-max.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-luna-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-luna-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-max.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-ultra.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-sol-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-max.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-ultra.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-5-6-terra-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-high.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-low.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-max.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-medium.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-ultra.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-astra-xhigh.yaml +1 -1
- package/presets/fleet/brains/codex-gpt-6-luna-high.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-luna-low.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-luna-max.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-luna-medium.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-luna-xhigh.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-high.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-low.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-max.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-medium.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-ultra.yaml +5 -0
- package/presets/fleet/brains/codex-gpt-6-sol-xhigh.yaml +5 -0
- package/presets/fleet/roles/Coordinator.yaml +22 -0
- package/presets/fleet/roles/Engineer.yaml +40 -0
- package/presets/fleet/room_layouts/engineering.yaml +25 -0
- package/presets/fleet/room_layouts/pair.yaml +24 -0
- package/presets/fleet/room_layouts/single.yaml +17 -0
- package/presets/fleet/room_layouts/team.yaml +30 -0
- package/presets/fleet/room_templates/engineering.yaml +19 -0
- package/presets/manifest.json +2 -2
- package/dist/web-app/assets/index-59GF-gsZ.css +0 -1
- package/dist/web-app/assets/index-C0h3ALvs.js +0 -10
- package/dist/web-app/icons/ours-fleet-maskable.svg +0 -4
- package/dist/web-app/icons/ours-fleet.svg +0 -4
- package/dist/web-app/index.html +0 -17
- package/dist/web-app/manifest.webmanifest +0 -15
- package/dist/web-app/offline.html +0 -18
- package/dist/web-app/sw.js +0 -51
package/README.md
CHANGED
|
@@ -52,11 +52,10 @@ briefing.md per role ──► agent session adapter ──► native app-se
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Each role gets a state dir (`~/.ours-fleet/agents/<Name>/`) holding its briefing,
|
|
55
|
-
logs, routines, and session markers.
|
|
56
|
-
|
|
55
|
+
logs, routines, and session markers. Before boot, the supervisor binds the assigned identity and prepares its room.
|
|
56
|
+
The agent then reads its briefing and starts work — while the
|
|
57
57
|
supervisor delivers its mail wakes as `[fleet-monitor]` console lines (see
|
|
58
|
-
[Mail monitor](#mail-monitor)).
|
|
59
|
-
should own mail wake instead. On crash the supervisor relaunches it and the
|
|
58
|
+
[Mail monitor](#mail-monitor)). Managed ours sessions use supervisor-owned mail wakes. On crash the supervisor relaunches it and the
|
|
60
59
|
harness resumes the same session.
|
|
61
60
|
|
|
62
61
|
The state dir contract:
|
|
@@ -80,7 +79,7 @@ The state dir contract:
|
|
|
80
79
|
|---|---|---|
|
|
81
80
|
| Node ≥ 22 | runs `ours-fleet` and its maintained adapters | nodejs.org, `apt`, or `brew` |
|
|
82
81
|
| a harness CLI, logged in | the agent itself | e.g. Claude Code (`claude`) or Codex CLI (`codex`) |
|
|
83
|
-
| `ours` CLI + shared daemon | identity + agent-to-agent messaging | `
|
|
82
|
+
| `ours` CLI + shared daemon | identity + agent-to-agent messaging | `ours-install client --config /absolute/private/profile.json --integrations fleet --fleet-settings /absolute/fleet-settings.json` |
|
|
84
83
|
|
|
85
84
|
Linux only: `ours-fleet init` enables *linger* so roles run without a login session
|
|
86
85
|
and survive reboots. macOS: launchd agents start **at login** (no linger
|
|
@@ -140,7 +139,11 @@ the caller's owner channel with the caller and spawned-role details. This is an
|
|
|
140
139
|
honest-actor convenience and attribution path, not a security boundary; host
|
|
141
140
|
shells and deliberately bypassed absolute binaries retain direct behavior.
|
|
142
141
|
|
|
143
|
-
## Local web
|
|
142
|
+
## Local web API
|
|
143
|
+
|
|
144
|
+
Frontend source and builds are maintained in the standalone `ours-web` repository. Fleet builds only its backend API. Configure a separately built frontend static root when serving the unified application through the gateway. The former console source is preserved there under `legacy-fleet/`.
|
|
145
|
+
|
|
146
|
+
### Console API usage
|
|
144
147
|
|
|
145
148
|
The interactive console is packaged with `@ours.network/fleet` and binds to
|
|
146
149
|
IPv4 loopback by default. Remote or proxy exposure is always explicit:
|
|
@@ -231,15 +234,11 @@ from the current runner generation and excludes adapter `session/load` replay;
|
|
|
231
234
|
those replay events remain in the durable ledger with `agent_replay` provenance
|
|
232
235
|
for diagnosis and recovery rather than appearing as current work.
|
|
233
236
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
A collision, missing tool, or creation error stops for operator review; fleet
|
|
240
|
-
never force-adopts or deletes identity state. Permanent roles are
|
|
241
|
-
provisioned by fleet before launch and never delegate normal identity creation
|
|
242
|
-
to the harness.
|
|
237
|
+
The Fleet supervisor creates and binds the assigned identity before the harness
|
|
238
|
+
starts. Temporary identities survive harness reconnects and are released only when
|
|
239
|
+
the logical run ends. Permanent identities remain available after the supervisor
|
|
240
|
+
releases ownership. Agents receive ready tools; no model-owned identity bootstrap
|
|
241
|
+
or onboarding skill is required.
|
|
243
242
|
|
|
244
243
|
The web console uses structured ACP activity rather than exposing a raw agent terminal.
|
|
245
244
|
|
|
@@ -381,9 +380,9 @@ preserve at most one recent late occurrence. The trusted authoring file and
|
|
|
381
380
|
private sealed role snapshot retain exact prompt text; resolved launch, task,
|
|
382
381
|
room, provenance, and audit presentation surfaces show only bytes and SHA-256.
|
|
383
382
|
|
|
384
|
-
Every packaged `Developer`, `Critic`, and `LocalCoordinator` Agent Template uses
|
|
383
|
+
Every packaged `Developer`, `Engineer`, `Critic`, and `LocalCoordinator` Agent Template uses
|
|
385
384
|
`monitor.mode: fleet` with `monitor.interrupt: after_tool`. Consequently every
|
|
386
|
-
member of the standard `single`, `pair`, and `
|
|
385
|
+
member of the standard `single`, `pair`, `team`, and `engineering` Room Templates resolves to
|
|
387
386
|
that policy. A custom Agent Template or explicit per-member override remains
|
|
388
387
|
authoritative and is merged key by key without rewriting unrelated values.
|
|
389
388
|
|
|
@@ -529,7 +528,7 @@ ours-fleet up
|
|
|
529
528
|
|
|
530
529
|
### Rooms and tasks
|
|
531
530
|
|
|
532
|
-
Init installs editable `single`, `pair`, and `
|
|
531
|
+
Init installs editable `single`, `pair`, `team`, and `engineering` definitions under
|
|
533
532
|
`~/fleet/room_templates/`, plus every exact-cased Agent, Role, and Brain they
|
|
534
533
|
reference. Inspect them with `ours-fleet template list` and
|
|
535
534
|
`ours-fleet template show team`. After configuring the authenticated owner below:
|
|
@@ -538,8 +537,25 @@ reference. Inspect them with `ours-fleet template list` and
|
|
|
538
537
|
ours-fleet task create --title "Solo task" --template single
|
|
539
538
|
ours-fleet task create --title "Reviewed change" --template pair
|
|
540
539
|
ours-fleet task create --title "Phased delivery" --template team
|
|
540
|
+
ours-fleet task create --title "Gated feature build" --template engineering
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
+
`engineering` pairs a gate-pipeline `Engineer` with the standard `Critic`. The
|
|
544
|
+
Engineer works every non-trivial task through ordered gates — scope and a numbered
|
|
545
|
+
Definition of Done before code, an over-engineering check, spec before
|
|
546
|
+
implementation, test-first, review, a sized security pass, docs, and evidence-backed
|
|
547
|
+
DoD verification — invoking an installed gate-pipeline skill when one is present and
|
|
548
|
+
walking the same gates by hand otherwise. The seat is labelled `Engineer`, so a
|
|
549
|
+
gated seat is never mistaken for a plain `Developer`. To make it the default for
|
|
550
|
+
development tasks, set `tasks: { default_room_template: engineering }` in
|
|
551
|
+
`fleet.yaml`.
|
|
552
|
+
|
|
553
|
+
The `engineering` starter expresses a prompt-level workflow mandate; Fleet does not enforce
|
|
554
|
+
the gates at runtime or install pipeline skills. The Engineer label identifies that mandate,
|
|
555
|
+
not a completed review. When migrating an existing install, a newly added Engineer uses
|
|
556
|
+
the existing Developer template's brain selection and keeps the packaged restrictive permissions.
|
|
557
|
+
Existing customized Engineer files are preserved.
|
|
558
|
+
|
|
543
559
|
The default `team` gives only its LocalCoordinator Agent Template a 15-minute
|
|
544
560
|
continuity loop. Each idle-only pass uses authenticated assigned-room evidence,
|
|
545
561
|
posts at most one missing interval update or status request, and reports `STALLED`
|
|
@@ -593,8 +609,9 @@ non-owner-controlled parent fail closed before host setup and are rechecked unde
|
|
|
593
609
|
per-setup init lock before publication.
|
|
594
610
|
|
|
595
611
|
The generated task experiences are fixed consequences, not extra questions: `single`
|
|
596
|
-
uses `Developer`; `pair` uses `Developer` with an independent `Critic`;
|
|
597
|
-
task-local `LocalCoordinator`, `Developer`, and `Critic
|
|
612
|
+
uses `Developer`; `pair` uses `Developer` with an independent `Critic`; `team` uses
|
|
613
|
+
task-local `LocalCoordinator`, `Developer`, and `Critic`; and `engineering` uses the
|
|
614
|
+
gate-pipeline `Engineer` with an independent `Critic`. The persistent
|
|
598
615
|
`FleetCoordinator` uses the separate packaged `Coordinator` contract and coordination
|
|
599
616
|
model.
|
|
600
617
|
|
|
@@ -649,10 +666,10 @@ originating task. Existing active rooms are not retroactively migrated, and room
|
|
|
649
666
|
with Owner attachment disabled receive no Owner grant.
|
|
650
667
|
|
|
651
668
|
Fleet launches each template member with a dedicated one-time Cowork invite.
|
|
652
|
-
The
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
669
|
+
The supervisor accepts the startup invite and verifies the provisioned identity CID
|
|
670
|
+
in the authenticated room seat before starting the model. The generated briefing
|
|
671
|
+
contains the assigned identity, room, role and task, without invite material.
|
|
672
|
+
A room is ready only after the Cowork room (and its task, when
|
|
656
673
|
task-bound) is durably active, every configured member seat is authenticated and active with its matching
|
|
657
674
|
live Fleet launch, and the configured Owner seat is active when owner attachment is
|
|
658
675
|
enabled. There is no briefing hash, startup ACK, or separate role-briefing readiness
|
|
@@ -671,12 +688,35 @@ continuation is serialized per Task and remains alive until convergence or an
|
|
|
671
688
|
Owner-action blocker. Re-running `task start <id>` safely resumes the same durable
|
|
672
689
|
provisioning operation after the blocker is corrected or a process restarts.
|
|
673
690
|
|
|
691
|
+
Live health is distinct from durable lifecycle. `task show TASK --json` adds a
|
|
692
|
+
`readiness` observation for active tasks (`ready`, `degraded`, or `unknown`); human
|
|
693
|
+
and authenticated Owner task-show output display the same observation. Task start/work
|
|
694
|
+
continue to reject unavailable health with `task_not_ready`. A same-role untracked
|
|
695
|
+
seat or a changed recorded launch cannot satisfy an original slot. Each control,
|
|
696
|
+
liveness, and production Cowork probe is bounded; members are checked sequentially,
|
|
697
|
+
so total latency grows with room size. These are point-in-time observations, not
|
|
698
|
+
proof that a timed-out session is dead or permission to respawn it.
|
|
699
|
+
|
|
700
|
+
Before deliberate recovery, Fleet Coordinator must inspect existing room seats and
|
|
701
|
+
the exact old launch's termination record and worklog under `recovery/temporary`.
|
|
702
|
+
Keep original slot records and archives intact; record verified old/new identity
|
|
703
|
+
and launch provenance privately. Never restore archived identity state or reuse
|
|
704
|
+
consumed invites. A same-role seat is only a possible replacement, not proven ownership.
|
|
705
|
+
|
|
706
|
+
A replacement's empty inbox does not establish that no work is pending. Paginate
|
|
707
|
+
scoped room/operator history to the end, retain the cursor privately, authenticate
|
|
708
|
+
historical Owner instructions from identity metadata, and compare replies, worklogs,
|
|
709
|
+
and already-completed actions before resuming. Ask the Owner when authority or
|
|
710
|
+
completion is uncertain. Transfer only necessary non-secret context; never replay
|
|
711
|
+
instructions blindly. Observation does not adopt seats, launch replacements, change
|
|
712
|
+
lifecycle, or modify retained recovery evidence.
|
|
713
|
+
|
|
674
714
|
Set `room.anonymous: true` on a room template, or pass `--anonymous` to
|
|
675
715
|
`task create`, `task start`, `task work`, or `room create`, to create an
|
|
676
716
|
anonymous Cowork room. `--no-anonymous` explicitly overrides an anonymous
|
|
677
717
|
template. Fleet records the resolved value before room creation so retries keep
|
|
678
|
-
the same choice.
|
|
679
|
-
|
|
718
|
+
the same choice. The supervisor creates anonymous room members with local contact-book exposure
|
|
719
|
+
disabled. Their generated briefings
|
|
680
720
|
do not disclose or compare an Owner participant CID. A participant-originated
|
|
681
721
|
instruction has Owner authority only when the authenticated Cowork room envelope
|
|
682
722
|
attributes that participant seat the exact `Owner` role. Literal text, display
|
|
@@ -1353,8 +1393,9 @@ The command override is exact: Fleet does not append `--profile`, `--search`, or
|
|
|
1353
1393
|
|
|
1354
1394
|
One-off/permanent spawn selects a Brain that owns model, reasoning, native permission,
|
|
1355
1395
|
sandbox, profile, launcher, search, monitor consent, native config, and additional roots.
|
|
1356
|
-
|
|
1357
|
-
|
|
1396
|
+
All roles use the shared gateway profile `~/.ours-client/profile.json`.
|
|
1397
|
+
`OURS_CONFIG` selects an alternate whole profile. Legacy port/token/state-dir
|
|
1398
|
+
overrides are rejected. See the [gateway setup guide](https://github.com/adapt-toolkit/ours-network/blob/prerelease/packages/installer/GATEWAY_SETUP.md).
|
|
1358
1399
|
|
|
1359
1400
|
## Agent isolation
|
|
1360
1401
|
|
|
@@ -1653,7 +1694,7 @@ After building Fleet with the selected SDK and CLI artifacts installed, run
|
|
|
1653
1694
|
`npm run test:v1-recovery` in an isolated Docker container with external networking
|
|
1654
1695
|
disabled. The existing test covers retry and terminal failure cases using a
|
|
1655
1696
|
temporary daemon and no authenticated AI harness. By default both daemon and
|
|
1656
|
-
token-update commands use `node_modules/@ours.network/
|
|
1697
|
+
token-update commands use `node_modules/@ours.network/daemon/dist/cli.js`;
|
|
1657
1698
|
`FLEET_DAEMON_CLI` and `FLEET_TOKEN_CLI` can select explicitly prepared CLI entries.
|
|
1658
1699
|
These package checks do not replace native Fleet/harness or platform acceptance.
|
|
1659
1700
|
|
|
@@ -1697,3 +1738,85 @@ origin directly. UUID/capability checks still precede credential-bearing calls.
|
|
|
1697
1738
|
This adds client HTTPS support, not an HTTPS daemon listener, certificate
|
|
1698
1739
|
provisioning or automatic reverse-proxy configuration. Existing local HTTP and
|
|
1699
1740
|
SSH-tunnel profiles continue to work.
|
|
1741
|
+
|
|
1742
|
+
See [supervisor-owned ours and migration](docs/supervisor-ours.md) for the runtime contract and review build instructions.
|
|
1743
|
+
|
|
1744
|
+
### One-server gateway profile
|
|
1745
|
+
|
|
1746
|
+
A private client profile may include `serverUrl`, for example
|
|
1747
|
+
`https://ours.example/base`, together with `endpoint` set to
|
|
1748
|
+
`https://ours.example/base/daemon`, the existing `expectedInstanceId`, and the
|
|
1749
|
+
absolute private `credentialPath`. Fleet preserves that daemon prefix for doctor
|
|
1750
|
+
and monitoring and derives `/cowork/management/rpc` from `serverUrl` for room
|
|
1751
|
+
management. Requests use the issued server credential, reject redirects, have
|
|
1752
|
+
bounded bodies/deadlines, and never replay mutations. This capability is declared
|
|
1753
|
+
as `cowork.http-management-v1` in the built artifact.
|
|
1754
|
+
|
|
1755
|
+
Explicit Cowork socket, config or state-directory overrides continue to select
|
|
1756
|
+
local Unix management. Profiles without `serverUrl` retain legacy behavior. The
|
|
1757
|
+
HTTP API grants operator room authority; use the installer's supported private
|
|
1758
|
+
or authenticated external gateway entry, and keep its backend ports private.
|
|
1759
|
+
|
|
1760
|
+
### Agent ours tools through the supervisor
|
|
1761
|
+
|
|
1762
|
+
Operators can invoke the running agent's ordinary ours MCP tools without sending
|
|
1763
|
+
an LLM prompt or binding another session to its identity:
|
|
1764
|
+
|
|
1765
|
+
```sh
|
|
1766
|
+
ours-fleet ours tools Critic1
|
|
1767
|
+
ours-fleet ours call Critic1 current_identity
|
|
1768
|
+
ours-fleet ours call Critic1 list_contacts
|
|
1769
|
+
ours-fleet ours call Critic1 generate_invite --args-file /private/invite-options.json
|
|
1770
|
+
ours-fleet ours call Critic1 add_contact --args-file /private/contact.json
|
|
1771
|
+
```
|
|
1772
|
+
|
|
1773
|
+
`tools` returns the managed MCP tool names and argument schemas, plus the selected
|
|
1774
|
+
agent's identity name, CID, and supervisor generation. `call` returns the same
|
|
1775
|
+
identity metadata and the MCP result. The private JSON file contains the tool's
|
|
1776
|
+
arguments (for example `{"invite":"…"}` for `add_contact`); omitted arguments mean
|
|
1777
|
+
`{}`. Protect files containing invites and protect command output containing a
|
|
1778
|
+
new invite. Tool errors set a nonzero CLI exit status.
|
|
1779
|
+
|
|
1780
|
+
The authenticated REST equivalents are `GET /api/v1/roles/:id/ours/tools` and
|
|
1781
|
+
`POST /api/v1/roles/:id/ours/call`, with the normal Fleet session and CSRF token.
|
|
1782
|
+
The POST body is `{"tool":"list_contacts","arguments":{}}`. MCP tool errors
|
|
1783
|
+
remain in `result.isError`; transport failures use the normal Fleet error envelope.
|
|
1784
|
+
Request arguments and results are excluded from the Fleet audit log.
|
|
1785
|
+
|
|
1786
|
+
Both interfaces use the supervisor's existing fixed-identity MCP server and tool
|
|
1787
|
+
policy. Identity creation, removal, switching, and binding are not exposed. The
|
|
1788
|
+
supervisor must be running. Older descriptors are supported only when a unique
|
|
1789
|
+
existing runtime journal, instance record, and identity pin prove the selected
|
|
1790
|
+
agent and generation, and the same MCP connection confirms its identity and
|
|
1791
|
+
lifetime before the operation. This reads existing state without rewriting the
|
|
1792
|
+
descriptor or restarting the agent. Missing, ambiguous, stale, or mismatched
|
|
1793
|
+
proofs fail closed. Unknown identity descriptions also fail closed. Closing an operator call
|
|
1794
|
+
retains the supervisor's identity. An interrupted mutation can have an unknown
|
|
1795
|
+
outcome: inspect state before retrying, because there is no automatic retry or
|
|
1796
|
+
exactly-once guarantee. Contact acceptance alone does not prove peer verification
|
|
1797
|
+
or message delivery. File tools resolve paths in the invoking CLI process or
|
|
1798
|
+
Fleet web server's filesystem context, with that process's access permissions.
|
|
1799
|
+
|
|
1800
|
+
Task workspace ownership, retention, safe deletion and legacy migration are documented in [Task workspaces](docs/task-workspaces.md).
|
|
1801
|
+
|
|
1802
|
+
### Active task readiness after interruption
|
|
1803
|
+
|
|
1804
|
+
Task and room list states, and `taskProvisioningOutcome`, describe durable lifecycle
|
|
1805
|
+
and provisioning progress; they are not live health checks. Retrying `task start`
|
|
1806
|
+
or `task work` on an active task checks the current Cowork room identity and seats,
|
|
1807
|
+
member launch ownership, supervisor liveness, and authenticated session status
|
|
1808
|
+
before reporting success. Waiting for provisioning completion also checks live
|
|
1809
|
+
readiness. This is a point-in-time observation, not proof of an agent-authored reply.
|
|
1810
|
+
|
|
1811
|
+
A `task_not_ready` result distinguishes confirmed degradation from unknown health
|
|
1812
|
+
(for example, an unavailable control socket). Ask Fleet Coordinator to inspect room
|
|
1813
|
+
and member status and choose supported recovery. These checks do not restart agents,
|
|
1814
|
+
recreate identities, redeem invites, or rewrite lifecycle state. Temporary room agents
|
|
1815
|
+
remain transient across host reboot; retained launch records do not restore them.
|
|
1816
|
+
|
|
1817
|
+
See [predefined Brain models and runtime requirements](presets/README.md) for the verified model/effort matrix and regeneration instructions.
|
|
1818
|
+
|
|
1819
|
+
### YAML room layouts
|
|
1820
|
+
|
|
1821
|
+
Room layouts describe room composition with shared or fresh participant sessions and independent room closure.
|
|
1822
|
+
See [Room layouts](docs/room-layouts.md) for YAML examples and CLI commands.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { connect } from 'node:net';
|
|
4
|
+
import { access, mkdir, open, readFile } from 'node:fs/promises';
|
|
5
|
+
import { constants } from 'node:fs';
|
|
6
|
+
import { basename, dirname, resolve } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { MAX_CHUNK_BYTES, MAX_FRAME_BYTES, Wire } from './wire.js';
|
|
9
|
+
/** Runs inside exactly the harness OS sandbox. Only this process opens agent paths. */
|
|
10
|
+
export async function runBridge(descriptorPath) {
|
|
11
|
+
const descriptor = JSON.parse(await readFile(descriptorPath, 'utf8'));
|
|
12
|
+
if (typeof descriptor.socket !== 'string' ||
|
|
13
|
+
typeof descriptor.capability !== 'string' ||
|
|
14
|
+
!Number.isInteger(descriptor.generation))
|
|
15
|
+
throw Error('INVALID_BRIDGE_DESCRIPTOR');
|
|
16
|
+
if (process.env.FLEET_OURS_BRIDGE_EXPECTED) {
|
|
17
|
+
const expected = JSON.parse(process.env.FLEET_OURS_BRIDGE_EXPECTED);
|
|
18
|
+
const digest = createHash('sha256').update(JSON.stringify([descriptor.socket, descriptor.capability, descriptor.generation])).digest('hex');
|
|
19
|
+
if (expected.transportDigest !== digest)
|
|
20
|
+
throw Error('SUPERVISOR_TRANSPORT_CHANGED');
|
|
21
|
+
if (['role', 'identity', 'cid', 'generation'].some(key => descriptor[key] !== expected[key]))
|
|
22
|
+
throw Error('SUPERVISOR_SELECTION_CHANGED');
|
|
23
|
+
}
|
|
24
|
+
const wire = new Wire(connect(descriptor.socket));
|
|
25
|
+
const handles = new Map();
|
|
26
|
+
const cleanup = async () => {
|
|
27
|
+
for (const row of handles.values())
|
|
28
|
+
await row.file.close().catch(() => { });
|
|
29
|
+
handles.clear();
|
|
30
|
+
};
|
|
31
|
+
let admitted = false;
|
|
32
|
+
let stdin = Buffer.alloc(0);
|
|
33
|
+
let chain = Promise.resolve();
|
|
34
|
+
const fail = () => {
|
|
35
|
+
wire.close();
|
|
36
|
+
process.stdin.pause();
|
|
37
|
+
void cleanup();
|
|
38
|
+
};
|
|
39
|
+
wire.onClose = fail;
|
|
40
|
+
wire.onFrame = (raw) => {
|
|
41
|
+
if (raw?.kind === 'ready') {
|
|
42
|
+
if (admitted)
|
|
43
|
+
throw Error('DUPLICATE_READY');
|
|
44
|
+
admitted = true;
|
|
45
|
+
process.stdin.resume();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!admitted)
|
|
49
|
+
throw Error('BRIDGE_NOT_READY');
|
|
50
|
+
if (raw?.kind === 'mcp') {
|
|
51
|
+
const line = JSON.stringify(raw.value) + '\n';
|
|
52
|
+
if (!process.stdout.write(line)) {
|
|
53
|
+
wire.socket.pause();
|
|
54
|
+
process.stdout.once('drain', () => wire.socket.resume());
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (raw?.kind !== 'fs' || typeof raw.id !== 'string' || typeof raw.call !== 'string')
|
|
59
|
+
throw Error('INVALID_BRIDGE_FRAME');
|
|
60
|
+
chain = chain
|
|
61
|
+
.then(async () => {
|
|
62
|
+
try {
|
|
63
|
+
const { op, args, call } = raw;
|
|
64
|
+
let value;
|
|
65
|
+
if (op === 'probe') {
|
|
66
|
+
try {
|
|
67
|
+
await access(args.path, constants.R_OK);
|
|
68
|
+
value = true;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
value = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (op === 'read-open' || op === 'write-open') {
|
|
75
|
+
if (handles.size >= 32 ||
|
|
76
|
+
typeof args.handle !== 'string' ||
|
|
77
|
+
handles.has(args.handle) ||
|
|
78
|
+
typeof args.path !== 'string')
|
|
79
|
+
throw Error('FILE_LIMIT');
|
|
80
|
+
const path = resolve(args.path);
|
|
81
|
+
if (op === 'write-open')
|
|
82
|
+
await mkdir(dirname(path), { recursive: true });
|
|
83
|
+
const file = await open(path, op === 'write-open' ? 'w' : 'r');
|
|
84
|
+
handles.set(args.handle, { file, call, write: op === 'write-open' });
|
|
85
|
+
value =
|
|
86
|
+
op === 'write-open'
|
|
87
|
+
? path
|
|
88
|
+
: { filename: basename(path), size: (await file.stat()).size };
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const row = handles.get(args.handle);
|
|
92
|
+
if (!row) {
|
|
93
|
+
if (op === 'close') {
|
|
94
|
+
value = null;
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
throw Error('UNKNOWN_FILE_HANDLE');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (row.call !== call)
|
|
101
|
+
throw Error('FOREIGN_FILE_CALL');
|
|
102
|
+
if (op === 'close') {
|
|
103
|
+
handles.delete(args.handle);
|
|
104
|
+
await row.file.close();
|
|
105
|
+
value = null;
|
|
106
|
+
}
|
|
107
|
+
else if (op === 'read' && !row.write) {
|
|
108
|
+
const buffer = Buffer.alloc(MAX_CHUNK_BYTES);
|
|
109
|
+
const { bytesRead } = await row.file.read(buffer);
|
|
110
|
+
value = bytesRead ? buffer.subarray(0, bytesRead).toString('base64') : null;
|
|
111
|
+
}
|
|
112
|
+
else if (op === 'write' && row.write) {
|
|
113
|
+
if (typeof args.data !== 'string' ||
|
|
114
|
+
args.data.length > Math.ceil(MAX_CHUNK_BYTES / 3) * 4)
|
|
115
|
+
throw Error('FILE_CHUNK_LIMIT');
|
|
116
|
+
const buffer = Buffer.from(args.data, 'base64');
|
|
117
|
+
let offset = 0;
|
|
118
|
+
while (offset < buffer.length) {
|
|
119
|
+
const r = await row.file.write(buffer, offset, buffer.length - offset);
|
|
120
|
+
if (!r.bytesWritten)
|
|
121
|
+
throw Error('SHORT_WRITE');
|
|
122
|
+
offset += r.bytesWritten;
|
|
123
|
+
}
|
|
124
|
+
value = null;
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
throw Error('INVALID_FILE_OPERATION');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
await wire.send({ kind: 'fs-result', id: raw.id, value });
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
await wire.send({ kind: 'fs-result', id: raw.id, error: 'FILE_OPERATION_FAILED' });
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
.catch(fail);
|
|
137
|
+
};
|
|
138
|
+
process.stdin.pause();
|
|
139
|
+
process.stdin.on('data', (chunk) => {
|
|
140
|
+
stdin = Buffer.concat([stdin, chunk]);
|
|
141
|
+
for (;;) {
|
|
142
|
+
const end = stdin.indexOf(10);
|
|
143
|
+
if (end < 0) {
|
|
144
|
+
if (stdin.length > MAX_FRAME_BYTES)
|
|
145
|
+
fail();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (end > MAX_FRAME_BYTES) {
|
|
149
|
+
fail();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const line = stdin.subarray(0, end);
|
|
153
|
+
stdin = stdin.subarray(end + 1);
|
|
154
|
+
try {
|
|
155
|
+
const value = JSON.parse(line.toString('utf8'));
|
|
156
|
+
process.stdin.pause();
|
|
157
|
+
void wire.send({ kind: 'mcp', value }).then(() => process.stdin.resume(), fail);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
fail();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
process.stdin.on('end', fail);
|
|
166
|
+
process.stdout.on('error', fail);
|
|
167
|
+
await wire.send({
|
|
168
|
+
kind: 'hello',
|
|
169
|
+
capability: descriptor.capability,
|
|
170
|
+
generation: descriptor.generation,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
174
|
+
runBridge(process.env.FLEET_OURS_BRIDGE_DESCRIPTOR ?? '').catch(() => {
|
|
175
|
+
process.stderr.write('Fleet ours bridge unavailable\n');
|
|
176
|
+
process.exitCode = 1;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RuntimeJournal } from './state.js';
|
|
2
|
+
/** Reuse Fleet's process-lifetime binder to serialize startup and cleanup. */
|
|
3
|
+
export declare class RuntimeController {
|
|
4
|
+
private readonly lease;
|
|
5
|
+
readonly privateDir: string;
|
|
6
|
+
readonly journal: RuntimeJournal;
|
|
7
|
+
private active;
|
|
8
|
+
private constructor();
|
|
9
|
+
static acquire(root: string, daemon: string, name: string, instance: string): Promise<RuntimeController>;
|
|
10
|
+
assertFence: () => void;
|
|
11
|
+
successor(): string;
|
|
12
|
+
resumeGeneration(): number;
|
|
13
|
+
unlock(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdirSync, renameSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { acquireOwnerBinderLease } from '../owner-channel/binder.js';
|
|
5
|
+
import { binderKey, RuntimeJournal } from './state.js';
|
|
6
|
+
/** Reuse Fleet's process-lifetime binder to serialize startup and cleanup. */
|
|
7
|
+
export class RuntimeController {
|
|
8
|
+
lease;
|
|
9
|
+
privateDir;
|
|
10
|
+
journal;
|
|
11
|
+
active = true;
|
|
12
|
+
constructor(lease, privateDir) {
|
|
13
|
+
this.lease = lease;
|
|
14
|
+
this.privateDir = privateDir;
|
|
15
|
+
this.journal = new RuntimeJournal(privateDir);
|
|
16
|
+
}
|
|
17
|
+
static async acquire(root, daemon, name, instance) {
|
|
18
|
+
const dir = join(root, binderKey(daemon, name));
|
|
19
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
20
|
+
const lease = await acquireOwnerBinderLease(dir, 'agent-ours', name);
|
|
21
|
+
const controller = new RuntimeController(lease, dir);
|
|
22
|
+
if (controller.journal.read()?.instance && controller.journal.read().instance !== instance) {
|
|
23
|
+
lease.release();
|
|
24
|
+
throw Error('RUNTIME_INSTANCE_MISMATCH');
|
|
25
|
+
}
|
|
26
|
+
return controller;
|
|
27
|
+
}
|
|
28
|
+
assertFence = () => {
|
|
29
|
+
if (!this.active)
|
|
30
|
+
throw Error('STALE_RUNTIME_CONTROLLER');
|
|
31
|
+
};
|
|
32
|
+
successor() {
|
|
33
|
+
this.assertFence();
|
|
34
|
+
const state = this.journal.read();
|
|
35
|
+
if (state?.phase !== 'RELEASED')
|
|
36
|
+
throw Error('PREDECESSOR_NOT_RELEASED');
|
|
37
|
+
const archive = join(this.privateDir, `retired-${state.instance}`);
|
|
38
|
+
mkdirSync(archive, { mode: 0o700 });
|
|
39
|
+
for (const file of ['state.json', 'owner.json', 'instance.json'])
|
|
40
|
+
renameSync(join(this.privateDir, file), join(archive, file));
|
|
41
|
+
return randomUUID();
|
|
42
|
+
}
|
|
43
|
+
resumeGeneration() {
|
|
44
|
+
this.assertFence();
|
|
45
|
+
const s = this.journal.read();
|
|
46
|
+
if (!s)
|
|
47
|
+
return 1;
|
|
48
|
+
if (['TERMINAL_INTENT', 'CLEANUP_PENDING', 'RELEASED', 'FAILED'].includes(s.phase))
|
|
49
|
+
throw Error('RUNTIME_RETIRED_OR_FAILED');
|
|
50
|
+
if (!s.cid)
|
|
51
|
+
throw Error('UNCERTAIN_PROVISIONING');
|
|
52
|
+
this.journal.commit({ ...s, generation: s.generation + 1, phase: 'RECOVERING' }, s.revision);
|
|
53
|
+
return s.generation + 1;
|
|
54
|
+
}
|
|
55
|
+
unlock() {
|
|
56
|
+
this.assertFence();
|
|
57
|
+
this.lease.release();
|
|
58
|
+
this.active = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Read-only operations exposed by the identity-owning supervisor. */
|
|
2
|
+
export interface AgentHistoryQuery {
|
|
3
|
+
peer_cid: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
before_seq?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SupervisorCorrespondence {
|
|
8
|
+
contacts(): Promise<unknown>;
|
|
9
|
+
history(request: AgentHistoryQuery): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FileExecutionContext } from '@ours.network/mcp/server';
|
|
2
|
+
import type { ToolRequestExtra } from '@ours.network/mcp/dist/types/mcp/tool.js';
|
|
3
|
+
import { type Wire } from './wire.js';
|
|
4
|
+
/** Call-scoped callbacks carry no daemon credentials or upload receipts. */
|
|
5
|
+
export declare class FileCallbacks implements FileExecutionContext {
|
|
6
|
+
private readonly wire;
|
|
7
|
+
private pending;
|
|
8
|
+
constructor(wire: Wire);
|
|
9
|
+
receive(frame: any): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
private rpc;
|
|
12
|
+
canRead(path: string, extra: ToolRequestExtra): Promise<boolean>;
|
|
13
|
+
read(path: string, extra: ToolRequestExtra): Promise<{
|
|
14
|
+
filename: any;
|
|
15
|
+
size: any;
|
|
16
|
+
body: ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
17
|
+
close: () => Promise<void>;
|
|
18
|
+
}>;
|
|
19
|
+
write(path: string, body: ReadableStream<Uint8Array>, extra: ToolRequestExtra): Promise<{
|
|
20
|
+
path: string;
|
|
21
|
+
size: number;
|
|
22
|
+
}>;
|
|
23
|
+
}
|