@ours.network/fleet 0.18.0-nightly.5 → 0.18.0

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.
Files changed (65) hide show
  1. package/README.md +101 -25
  2. package/dist/application/fleet-query-service.js +12 -0
  3. package/dist/application/role-creation-service.js +3 -1
  4. package/dist/application/types.d.ts +11 -0
  5. package/dist/briefing.js +9 -2
  6. package/dist/build-info.json +7 -6
  7. package/dist/capabilities.d.ts +3 -1
  8. package/dist/capabilities.js +3 -0
  9. package/dist/cli.js +83 -7
  10. package/dist/config.d.ts +11 -3
  11. package/dist/config.js +40 -15
  12. package/dist/creation.d.ts +14 -15
  13. package/dist/creation.js +19 -13
  14. package/dist/docs.d.ts +1 -1
  15. package/dist/docs.js +113 -27
  16. package/dist/doctor.d.ts +1 -5
  17. package/dist/doctor.js +11 -18
  18. package/dist/fleet-proxy.d.ts +5 -0
  19. package/dist/harness/acp-agent.js +11 -6
  20. package/dist/harness/claude-code.js +204 -11
  21. package/dist/harness/codex.d.ts +4 -1
  22. package/dist/harness/codex.js +74 -12
  23. package/dist/harness/types.d.ts +54 -4
  24. package/dist/harness-plugins.d.ts +48 -0
  25. package/dist/harness-plugins.js +309 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +1 -0
  28. package/dist/loops/manager.d.ts +30 -1
  29. package/dist/loops/manager.js +69 -6
  30. package/dist/loops/state.d.ts +18 -0
  31. package/dist/loops/state.js +4 -0
  32. package/dist/model-env.d.ts +71 -0
  33. package/dist/model-env.js +106 -0
  34. package/dist/monitor.js +1 -1
  35. package/dist/ops.js +1 -1
  36. package/dist/owner-channel/attachments.d.ts +2 -25
  37. package/dist/owner-channel/attachments.js +5 -61
  38. package/dist/owner-channel/channel.d.ts +28 -17
  39. package/dist/owner-channel/channel.js +249 -158
  40. package/dist/owner-channel/mcp.d.ts +24 -0
  41. package/dist/owner-channel/mcp.js +145 -0
  42. package/dist/owner-channel/notices.d.ts +7 -0
  43. package/dist/owner-channel/notices.js +9 -0
  44. package/dist/resolved-plan.js +1 -0
  45. package/dist/runner.d.ts +48 -0
  46. package/dist/runner.js +237 -85
  47. package/dist/session/acp.d.ts +104 -0
  48. package/dist/session/acp.js +213 -10
  49. package/dist/session/activity.d.ts +31 -0
  50. package/dist/session/activity.js +48 -0
  51. package/dist/session/conversation-normalizer.d.ts +6 -0
  52. package/dist/session/conversation-normalizer.js +153 -10
  53. package/dist/session/conversation-types.d.ts +23 -4
  54. package/dist/session/types.d.ts +35 -0
  55. package/dist/spawn.js +29 -17
  56. package/dist/supervisor/systemd.js +2 -29
  57. package/dist/watchdog/briefing.js +7 -0
  58. package/dist/web-app/assets/{TerminalView-BAVk1Bot.js → TerminalView-C_G1ID2P.js} +1 -1
  59. package/dist/web-app/assets/{index-C3S-xFRU.js → index-BCBK78hw.js} +5 -5
  60. package/dist/web-app/index.html +1 -1
  61. package/dist/worklog.d.ts +7 -1
  62. package/dist/worklog.js +191 -39
  63. package/package.json +1 -3
  64. package/dist/owner-channel/ours-client.d.ts +0 -141
  65. package/dist/owner-channel/ours-client.js +0 -225
package/README.md CHANGED
@@ -79,7 +79,7 @@ The state dir contract:
79
79
  | tmux | roles using `session: tmux` (the default) | `apt install tmux` / `brew install tmux` |
80
80
  | Node ≥ 22 | Claude roles using `session: acp` | required by the maintained Claude ACP adapter |
81
81
  | a harness CLI, logged in | the agent itself | e.g. Claude Code (`claude`) or Codex CLI (`codex`) |
82
- | `ours` CLI + shared daemon | identity + agent-to-agent messaging | `npm i -g @ours.network/cli && ours daemon start` |
82
+ | `ours-mcp` daemon | identity + agent-to-agent messaging | `npm i -g @ours.network/mcp && ours-mcp start` |
83
83
 
84
84
  Linux only: `ours-fleet init` enables *linger* so roles run without a login session
85
85
  and survive reboots. macOS: launchd agents start **at login** (no linger
@@ -214,6 +214,22 @@ unknown evidence; a newly launched harness follows its generated first-boot
214
214
  instructions to choose or create and bind the identity. The console never
215
215
  claims that the host created an identity and never deletes one.
216
216
 
217
+ ACP tool diffs are normalized before they enter the durable conversation
218
+ ledger. Small diffs retain their existing before/after representation. When an
219
+ adapter reports an oversized whole-file snapshot, fleet stores only the changed
220
+ region with path, operation, original byte counts, digest, and boundedness
221
+ metadata. Each retained changed side is capped at 64 KiB as a UTF-8-safe,
222
+ newest-content tail. The tail advances to a line boundary when a complete line
223
+ fits. If one logical line alone exceeds the cap, fleet retains its newest
224
+ UTF-8-safe suffix and records that it starts mid-line, together with omitted-byte
225
+ count and digest. Paths retain at most a 4 KiB suffix with the same explicit
226
+ size/digest/omission provenance, and a 320 KiB cap covers the complete normalized
227
+ update. An append therefore cannot replay a large historical file while hiding
228
+ the current appended text. The live web-console transcript projects only events
229
+ from the current runner generation and excludes adapter `session/load` replay;
230
+ those replay events remain in the durable ledger with `agent_replay` provenance
231
+ for diagnosis and recovery rather than appearing as current work.
232
+
217
233
  For a temporary role, those first-boot instructions preserve and bind an
218
234
  existing identity when one is present. If the assigned identity is missing,
219
235
  the role capability-detects the ours MCP `create_temporary_identity` tool and
@@ -344,6 +360,10 @@ defaults:
344
360
  max_tokens: 500000 # session cap (harness-interpreted)
345
361
  monitor:
346
362
  mode: fleet # fleet (default) | native
363
+ worklog: # built-ins shown; set false to opt out
364
+ max_kb: 1024 # rotate only above this active-log size
365
+ keep_tail_kb: 256 # UTF-8 tail; line-aligned when one fits
366
+ max_archives: 12 # recent beside log; older preserved cold
347
367
  roles:
348
368
  Name: # [A-Za-z0-9_-]+
349
369
  harness: claude-code
@@ -430,6 +450,11 @@ role's `harness_options`, so a fleet can set common Codex permission/profile def
430
450
  and override individual keys per role. `monitor` merges the same way — a role block
431
451
  overrides `defaults.monitor` key-by-key.
432
452
 
453
+ Every supervised role is a client of the operator-configured ours daemon. Fleet
454
+ forces `OURS_AUTOSTART=0` in both tmux and ACP harness processes, after role environment
455
+ overlays, so `env.OURS_AUTOSTART` cannot transfer shared daemon lifecycle ownership to an
456
+ agent. Operators and explicit installer/setup flows remain responsible for starting it.
457
+
433
458
  ### Scheduled agent loops
434
459
 
435
460
  Top-level `loops` schedule literal prompts from trusted local YAML. Enabled targets
@@ -520,10 +545,13 @@ native settings actually grant, against a fixed floor:
520
545
  those requests with nobody to see it. With `unattended: wait` it **warns**,
521
546
  since a human can still attach a console and answer.
522
547
 
523
- **Security meaning.** `ask` maps to Codex `untrusted` / Claude `default`,
524
- `auto` to Codex `on-request` / Claude `acceptEdits`, and `allow` to Codex
525
- `never` / Claude `bypassPermissions`, the non-interactive modes that actually
526
- permit the actions the role was authorized to take.
548
+ **Security meaning.** `ask` maps to Codex `untrusted` / Claude `default`.
549
+ `auto` selects Codex ACP `agent` (`on-request` + `workspace-write`) / Claude
550
+ `acceptEdits`. `allow` selects Codex ACP's fully non-interactive yolo mode,
551
+ reported by the adapter as `agent-full-access` (`never` +
552
+ `danger-full-access`); Claude uses `bypassPermissions`. For Codex tmux, where the
553
+ approval and sandbox flags remain independent, `auto` is `on-request` and
554
+ `allow` is `never` while `filesystem` still chooses the sandbox.
527
555
  `dontAsk` suppresses only the *prompt*, not the denial, which is why an
528
556
  `allow` role previously ran unable to do its job. Legacy `deny` is accepted
529
557
  only for compatibility and retains its conservative Codex `on-request` /
@@ -535,10 +563,14 @@ ACP exposes agent-specific session mode IDs and `session/set_mode`, but no
535
563
  portable permission-policy capability. Fleet uses that primitive where an
536
564
  adapter has a corresponding mode and otherwise translates at the adapter. The
537
565
  bundled Codex ACP adapter couples approval and sandboxing in its advertised
538
- mode IDs, so fleet preserves the selected sandbox preset and enforces approval
539
- independently on the app-server turn request. Thus `allow` + `workspace` is
540
- actually `never` + `workspace-write`, never `danger-full-access`. Live session
541
- metadata reports the normalized policy and the ACP sandbox-preset ID.
566
+ mode IDs. Consequently, neutral `allow` selects `agent-full-access` and widens
567
+ `filesystem: workspace` or `read-only` to `danger-full-access`; neutral `auto`
568
+ selects `agent` and uses `workspace-write` even when the neutral filesystem
569
+ value differs. An explicit `harness_options.sandbox` still wins and selects its
570
+ corresponding ACP preset; explicit native approval overrides also win. Fleet
571
+ reports a coupled-mode mismatch as approximate in `config`/`doctor`, and
572
+ per-role `isolation:` remains the boundary for an `allow` ACP role. Live session
573
+ metadata reports the normalized policy and the exact native mode selected.
542
574
 
543
575
  ### Isolation at creation time
544
576
 
@@ -640,14 +672,13 @@ agent's briefing tells it **not** to arm a native harness Monitor.
640
672
 
641
673
  With `monitor.mode: native`, ours-fleet does not start its supervisor monitor;
642
674
  the generated briefing instead instructs the harness to arm its own wake
643
- mechanism (the structured `ours api watch-notifications` JSONL stream for Claude Code,
644
- or the Codex
675
+ mechanism (`ours-mcp watch` for Claude Code, or the Codex
645
676
  `arm_monitor`/`foreground_monitor` flow). The old `monitor.enabled: true|false`
646
677
  form remains accepted as a compatibility alias for `fleet|native`, respectively,
647
678
  but new configuration should use `mode`.
648
679
 
649
680
  `inject: full` (pushing message bodies
650
- inline) is on the roadmap and needs two new daemon endpoints; today all
681
+ inline) is on the roadmap and needs two new ours-mcp daemon endpoints; today all
651
682
  roles deliver `notification` lines and drain via `get_messages`.
652
683
 
653
684
  ACP stdio remains private to the persistent runner. `send`, `peek`, and the basic
@@ -875,7 +906,7 @@ Processed wire IDs are durably bounded for deduplication, while
875
906
  message and response bodies stay out of fleet state. Delivery is at-least-once
876
907
  across a crash (the bridge requeues fetched input before starting a turn); true
877
908
  exactly-once processing would require a leased claim/idempotency primitive in
878
- the ours daemon.
909
+ ours-mcp.
879
910
 
880
911
  Inbound owner attachments use the same authenticated-CID and exact-wire routing
881
912
  boundary. Fleet first calls the metadata-only `list_incoming_files`, groups a
@@ -886,7 +917,7 @@ unauthorized sender is ignored without retrieval or reply. A rejected authorized
886
917
  request receives a bounded reason correlated to its file wire.
887
918
 
888
919
  Retrieved files must be regular, non-symlink paths whose byte count and SHA-256
889
- match typed SDK metadata. Fleet additionally checks content signatures against the
920
+ match ours-mcp metadata. Fleet additionally checks content signatures against the
890
921
  declared MIME, sanitizes traversal/control characters from names, and copies each
891
922
  file into a random request-scoped directory at mode 0700 with files at mode 0600.
892
923
  The `[fleet-owner]` turn receives only bounded metadata, the private local paths,
@@ -897,17 +928,17 @@ the agent must use the audio path rather than inventing text.
897
928
  Request files are removed after final delivery and stale directories are removed
898
929
  after `retention_ms`. A bounded mode-0600 recovery journal stores only owner CID
899
930
  and wire routing metadata—never filenames, paths, captions, transcripts, or file
900
- bytes. If the daemon already marked a selected file processed when fleet restarts,
901
- fleet resumes only that journaled wire with the SDK file-fetch operation; a deferred managed-agent
931
+ bytes. If ours-mcp already marked a selected file processed when fleet restarts,
932
+ fleet resumes only that journaled wire with `save_file`; a deferred managed-agent
902
933
  caption is replayed with its journaled processed files before the group is
903
934
  admitted or relayed. Conversation route state migrates from v1 to a bounded v2
904
935
  source-wire index so a correlated group keeps the authenticated owner selected by
905
936
  its original request even after later owner traffic. Recovered voice is explicitly
906
937
  marked transcript-unavailable. Corrupt recovery state disables attachment
907
- admission. The host must run an ours daemon compatible with SDK 2.0.1 whose
908
- typed incoming-file, selective retrieval, and file-fetch operations support
909
- these guarantees; `ours config show --json` reports `sttConfigured` without
910
- revealing provider credentials.
938
+ admission. The host must run an ours-mcp version whose
939
+ `list_incoming_files`, selective `get_files`, and `save_file` schemas support
940
+ these guarantees; `ours-mcp voice-status --json` reports whether transcription
941
+ is currently configured.
911
942
 
912
943
  Managed-agent file egress is a separate trust direction. It retains the same
913
944
  metadata provenance checks, count/per-file/request byte caps, regular-file and
@@ -928,6 +959,36 @@ cannot reliably distinguish the final answer from thoughts, tool output, or
928
959
  unrelated concurrent work. The config rejects tmux instead of silently offering
929
960
  weaker semantics.
930
961
 
962
+ ## Deterministic harness plugin channels
963
+
964
+ Plugin channels are per harness and default to stable. Nightly must be selected
965
+ explicitly in the base fleet file:
966
+
967
+ ```yaml
968
+ harnesses:
969
+ codex:
970
+ plugin_channel: nightly
971
+ claude-code:
972
+ plugin_channel: stable
973
+ ```
974
+
975
+ Install or repair from the existing lock with `ours-fleet plugins install`; move
976
+ a lock deliberately with `ours-fleet plugins update`. Either command may take
977
+ `codex`, `claude-code`, or both when omitted. `ours-fleet plugins status` shows
978
+ the configured channel and exact version.
979
+
980
+ Each explicit resolution reads the channel's npm dist-tag exactly once, validates
981
+ the result, and persists it under
982
+ `~/.ours-fleet/harness-plugins/<harness>/plugin-lock.json`. Fleet then generates
983
+ a host-local marketplace containing the exact package semver and installs through
984
+ that marketplace. Stable is pinned in exactly the same way as nightly: `latest`
985
+ is never left in an install source. Normal starts, restarts, and reconciliation
986
+ only regenerate marketplace files from the persisted lock; they never query npm,
987
+ run an installer, or silently advance a version. A failed installation can be
988
+ retried with `plugins install` and reuses the same lock.
989
+ An explicitly nightly harness refuses to launch without a nightly lock, and a
990
+ configured/locked channel mismatch fails with the exact `plugins update` command.
991
+
931
992
  ## Codex roles
932
993
 
933
994
  Install Codex, the native ours plugin, and the fleet CLI once on the fleet host:
@@ -953,7 +1014,7 @@ pass the legacy `ours-fleet spawn --monitor` flag) to record explicit persistent
953
1014
  for the harness-native monitor, including supervised restarts. This does not choose the
954
1015
  wake owner; use `monitor.mode: fleet|native` for that. In the standard-Codex fallback, the agent separately surfaces the
955
1016
  `ours-codex` recommendation before asking to enter `foreground_monitor`. It never backgrounds
956
- the structured CLI watcher, because a detached process cannot wake a Codex turn. The foreground
1017
+ `ours-mcp watch`, because a detached watch cannot wake a Codex turn. The foreground
957
1018
  wait is re-entered after each handled message; `ours-codex` instead wakes the idle
958
1019
  session through its App Server integration.
959
1020
 
@@ -1037,7 +1098,7 @@ picks the most recently active session **in the role's `cwd`**. This works
1037
1098
  cleanly as long as each role has its own `cwd` (the common case); two roles
1038
1099
  sharing an identical `cwd` could have their resumes cross — give them distinct
1039
1100
  working directories if that matters. MCP and monitor wiring is provided by
1040
- [`@ours.network/codex`](https://www.npmjs.com/package/@ours.network/codex);
1101
+ [`@ours.network/codex`](https://github.com/adapt-toolkit/ours-mcp/tree/main/packages/codex);
1041
1102
  the core ours skill discovers fleet behavior through `ours-fleet docs`.
1042
1103
  `ours-fleet doctor --harness codex` verifies the CLI, ours plugin, and enhanced launcher/fallback.
1043
1104
 
@@ -1109,7 +1170,7 @@ rollout, anchors, aliases, explicit tags, non-scalar keys, and multiple document
1109
1170
  produce source-positioned warnings; opt into enforcement with
1110
1171
  `--yaml-mode strict`. Strict mode will become the next-major default.
1111
1172
 
1112
- Long-running roles may opt into bounded durable logs:
1173
+ WORKLOG rotation is enabled for roles by default with conservative built-ins:
1113
1174
 
1114
1175
  ```yaml
1115
1176
  worklog:
@@ -1119,8 +1180,23 @@ worklog:
1119
1180
  ```
1120
1181
 
1121
1182
  Rotation is conservative: a concurrent change aborts the attempt and retries at
1122
- a later fleet lifecycle point. Archives remain in the role state directory and
1123
- may contain the same sensitive material as `WORKLOG.md`.
1183
+ a later fleet lifecycle point. The active log retains a bounded UTF-8 tail,
1184
+ advancing to a line boundary when a complete line fits. If one logical line
1185
+ alone exceeds the tail budget, its newest suffix remains and
1186
+ `.worklog-rotation.json` explicitly records the mid-line start and omitted byte
1187
+ count. It also records SHA-256 digests for the archive and retained live bytes
1188
+ observed when the manifest is written. The complete prior inode is published
1189
+ under a collision-safe UTC name.
1190
+ `max_archives` bounds recent archives beside `WORKLOG.md`; older complete
1191
+ archives move to `WORKLOG.archives/` and are never deleted. Use `worklog: false` on a role or in
1192
+ `defaults` to opt out. Archives may contain the same sensitive material as
1193
+ `WORKLOG.md`. Rotation refuses a symlinked/non-regular live log or a symlinked
1194
+ cold-archive boundary before replacing the live path, and best-effort removes a
1195
+ duplicate link left by a detected failure while the original inode is still
1196
+ available. These are ordinary path/error safeguards, not a security boundary
1197
+ against a malicious concurrent process with the same Unix authority: intentional
1198
+ symlink swaps or archive-directory renames between checks are outside the threat
1199
+ model and require OS-level isolation from that process.
1124
1200
 
1125
1201
  Claude roles can use a credential-free loopback proxy:
1126
1202
 
@@ -1,5 +1,6 @@
1
1
  import { lstatSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
+ import { classifyActivity } from '../session/activity.js';
3
4
  import { controlRequest } from '../session/control.js';
4
5
  import { SessionControlError } from '../session/types.js';
5
6
  import { readExitRecord, readRestartLedger } from '../runner.js';
@@ -55,6 +56,10 @@ function sessionOverall(supervisor, session, restart, monitor, isolation, proble
55
56
  if (session.reachability === 'online'
56
57
  && (session.readiness === 'running' || session.readiness === 'awaiting_permission'))
57
58
  return 'busy';
59
+ // `readiness: idle` alone never justifies `ready`. A steered wake turn is
60
+ // invisible to readiness (FLEET-002), so observed activity outranks it.
61
+ if (session.reachability === 'online' && session.activity.state === 'active')
62
+ return 'busy';
58
63
  if (session.reachability === 'online' && session.readiness === 'idle')
59
64
  return 'ready';
60
65
  if (session.reachability === 'offline'
@@ -153,6 +158,7 @@ export class FleetQueryService {
153
158
  protocolVersion: snapshot.protocolVersion, features: snapshot.features,
154
159
  runtimeModel: snapshot.runtimeModel, reasoningEffort: snapshot.reasoningEffort,
155
160
  permissionMode: snapshot.permissionMode,
161
+ activity: classifyActivity(snapshot.activity),
156
162
  };
157
163
  }
158
164
  catch (error) {
@@ -164,6 +170,7 @@ export class FleetQueryService {
164
170
  : failure === 'control-unavailable' ? 'unavailable' : 'unknown',
165
171
  readiness: offline ? 'failed' : 'unknown',
166
172
  evidence: 'authoritative', lastError: clean(error.message),
173
+ activity: { state: 'unobservable' },
167
174
  };
168
175
  }
169
176
  }
@@ -174,18 +181,23 @@ export class FleetQueryService {
174
181
  backend: 'tmux', reachability: has ? 'online' : supervisor === 'stopped' ? 'offline' : 'unknown',
175
182
  readiness: has ? 'idle' : supervisor === 'running' ? 'starting' : 'failed',
176
183
  evidence: 'inferred',
184
+ // tmux exposes no agent-side evidence at all, and `readiness: idle`
185
+ // here is a pane-liveness inference, not an activity claim.
186
+ activity: { state: 'unobservable' },
177
187
  };
178
188
  }
179
189
  catch (error) {
180
190
  return {
181
191
  backend: 'tmux', reachability: 'unknown', readiness: 'unknown',
182
192
  evidence: 'inferred', lastError: clean(error.message),
193
+ activity: { state: 'unobservable' },
183
194
  };
184
195
  }
185
196
  }
186
197
  return {
187
198
  backend: 'unknown', reachability: supervisor === 'stopped' ? 'offline' : 'unknown',
188
199
  readiness: supervisor === 'stopped' ? 'failed' : 'unknown', evidence: 'inferred',
200
+ activity: { state: 'unobservable' },
189
201
  };
190
202
  }
191
203
  }
@@ -118,7 +118,9 @@ export class RoleCreationService {
118
118
  };
119
119
  const warnings = [];
120
120
  if (request.permissions.approval === 'allow')
121
- warnings.push('approval=allow maps to an elevated native permission mode');
121
+ warnings.push(effective.harness === 'codex' && effective.session === 'acp'
122
+ ? 'approval=allow maps to elevated Codex ACP agent-full-access and widens the native sandbox to danger-full-access'
123
+ : 'approval=allow maps to an elevated native permission mode');
122
124
  if (request.permissions.filesystem === 'unrestricted')
123
125
  warnings.push('filesystem=unrestricted grants access outside the workspace');
124
126
  if (request.permissions.unattended === 'wait')
@@ -72,6 +72,17 @@ export interface RoleStatus {
72
72
  runtimeModel?: SessionSnapshot['runtimeModel'];
73
73
  reasoningEffort?: SessionSnapshot['reasoningEffort'];
74
74
  permissionMode?: SessionSnapshot['permissionMode'];
75
+ /**
76
+ * Activity evidence, kept separate from `readiness` on purpose: `readiness`
77
+ * answers "is a fleet-tracked turn in flight" (the prompt-admission gate),
78
+ * NOT "is this agent working". `state` is the only field a human-facing
79
+ * surface may use to call a role idle or stalled.
80
+ */
81
+ activity: {
82
+ state: 'active' | 'quiet' | 'unobservable';
83
+ activeToolCalls?: number;
84
+ lastUpdateAt?: string;
85
+ };
75
86
  };
76
87
  restart: {
77
88
  circuit: 'closed' | 'open';
package/dist/briefing.js CHANGED
@@ -168,6 +168,11 @@ export function generateBriefing(role, v, opts) {
168
168
  L.push('Never translate any other failure into "dead". A busy agent, an unanswered control');
169
169
  L.push('plane and a confirmed stop look identical if you only look at one command.');
170
170
  L.push('');
171
+ L.push('`ours-fleet status` reports `session.readiness`, which is TURN OCCUPANCY only: a mail');
172
+ L.push('wake delivered by steering runs a whole turn with readiness pinned at `idle`. Read the');
173
+ L.push('`activity:` line beside it — `active` means the role is working — and never call a role');
174
+ L.push('idle or stalled from `readiness=idle` alone.');
175
+ L.push('');
171
176
  L.push('Then judge the console content: stuck on a prompt/menu/trust dialog → answer it directly');
172
177
  L.push('with `ours-fleet send <Name> "<text>"` (or `--key <K>` for raw keys); idle with work');
173
178
  L.push('assigned → nudge; actively working → do nothing, and do not mistake a long turn for a');
@@ -178,8 +183,10 @@ export function generateBriefing(role, v, opts) {
178
183
  L.push('it survives restarts.');
179
184
  if (role.worklog) {
180
185
  L.push(`Fleet rotates it above ${role.worklog.max_kb} KiB, keeps approximately the newest ` +
181
- `${role.worklog.keep_tail_kb} KiB here, and retains ${role.worklog.max_archives} archives ` +
182
- 'beside it. Continue writing only WORKLOG.md.');
186
+ `${role.worklog.keep_tail_kb} KiB here, and keeps ${role.worklog.max_archives} recent archives ` +
187
+ 'beside it. Older complete archives move to WORKLOG.archives without deletion; ' +
188
+ '.worklog-rotation.json identifies the latest archive for restart provenance. ' +
189
+ 'Continue writing only WORKLOG.md.');
183
190
  }
184
191
  L.push('', '## Routines');
185
192
  L.push(`If \`${opts.routinesPath}\` exists, re-read it at the START of every wake — before acting`);
@@ -1,10 +1,11 @@
1
1
  {
2
- "version": "0.18.0-nightly.5",
3
- "buildId": "477f5cfc014b",
4
- "commit": "d6e488fc1b991b1409134502ec0b59ba809d4cf6",
5
- "dirty": true,
6
- "builtAt": "2026-08-21T12:28:55.193Z",
2
+ "version": "0.18.0",
3
+ "buildId": "61cc47d629af",
4
+ "commit": "3d60e26d8f751537a7aab6a3df8b75eafa182cd0",
5
+ "dirty": false,
6
+ "builtAt": "2026-08-22T08:40:59.670Z",
7
7
  "capabilities": [
8
- "monitor.interrupt.after_tool"
8
+ "monitor.interrupt.after_tool",
9
+ "harness.plugins.exact-lock"
9
10
  ]
10
11
  }
@@ -14,7 +14,9 @@
14
14
  */
15
15
  /** `monitor.interrupt: after_tool` — cancel at the next tool boundary (#67). */
16
16
  export declare const CAP_MONITOR_INTERRUPT_AFTER_TOOL = "monitor.interrupt.after_tool";
17
- export declare const CAPABILITIES: readonly ["monitor.interrupt.after_tool"];
17
+ /** Exact, persisted stable/nightly harness plugin resolution and local marketplaces. */
18
+ export declare const CAP_HARNESS_PLUGIN_LOCK = "harness.plugins.exact-lock";
19
+ export declare const CAPABILITIES: readonly ["monitor.interrupt.after_tool", "harness.plugins.exact-lock"];
18
20
  export type Capability = (typeof CAPABILITIES)[number];
19
21
  /** Does this build declare `token`? */
20
22
  export declare const hasCapability: (token: string) => boolean;
@@ -14,8 +14,11 @@
14
14
  */
15
15
  /** `monitor.interrupt: after_tool` — cancel at the next tool boundary (#67). */
16
16
  export const CAP_MONITOR_INTERRUPT_AFTER_TOOL = 'monitor.interrupt.after_tool';
17
+ /** Exact, persisted stable/nightly harness plugin resolution and local marketplaces. */
18
+ export const CAP_HARNESS_PLUGIN_LOCK = 'harness.plugins.exact-lock';
17
19
  export const CAPABILITIES = [
18
20
  CAP_MONITOR_INTERRUPT_AFTER_TOOL,
21
+ CAP_HARNESS_PLUGIN_LOCK,
19
22
  ];
20
23
  /** Does this build declare `token`? */
21
24
  export const hasCapability = (token) => CAPABILITIES.includes(token);
package/dist/cli.js CHANGED
@@ -25,8 +25,9 @@ import { stringify } from 'yaml';
25
25
  import { resolvedRolePlan } from './resolved-plan.js';
26
26
  import { creationBuildNote, formatProvenance, readProvenance } from './creation.js';
27
27
  import { doctor } from './doctor.js';
28
- import { allWarnings, analyzeFleetPermissions, formatNative } from './permissions.js';
28
+ import { allWarnings, analyzeFleetPermissions, effectivePermissionMode, formatNative, } from './permissions.js';
29
29
  import { AI_DOCS } from './docs.js';
30
+ import { classifyActivity, describeSessionState } from './session/activity.js';
30
31
  import { controlRequest, controlSocketPath, followControl, livenessNote, } from './session/control.js';
31
32
  import { SessionControlError } from './session/types.js';
32
33
  import { readScheduledLoops, storedLoopHealth } from './loops/state.js';
@@ -35,6 +36,7 @@ import { requestWebControl } from './web/control.js';
35
36
  import { WebServiceManager } from './web/service.js';
36
37
  import { WebAccessStore, passwordAccess, validatePublicOrigin } from './web/access.js';
37
38
  import { FLEET_PROXY_CALLER_ENV, FLEET_PROXY_STATE_DIR_ENV, } from './fleet-proxy.js';
39
+ import { installHarnessPlugin, readHarnessPluginLock, selectedHarnessPluginIds, } from './harness-plugins.js';
38
40
  import './harness/claude-code.js'; // registers the claude-code adapter
39
41
  import './harness/codex.js'; // registers the codex adapter
40
42
  // sudo/su shells lack XDG_RUNTIME_DIR, breaking every systemctl/journalctl
@@ -65,6 +67,51 @@ const program = new Command()
65
67
  .version(VERSION);
66
68
  const cOpt = (cmd) => cmd.option('-c, --configuration <file>', 'config file (default: ~/fleet.yaml + ~/fleet.d/)');
67
69
  const collect = (value, previous) => [...previous, value];
70
+ const pluginsCommand = program.command('plugins')
71
+ .description('install exact, persisted stable/nightly harness plugins');
72
+ const changeHarnessPlugins = (update) => async (names, opts) => {
73
+ try {
74
+ const cfg = loadConfig(opts.configuration);
75
+ for (const harness of selectedHarnessPluginIds(names)) {
76
+ const channel = cfg.harnessPlugins[harness].plugin_channel;
77
+ const result = await installHarnessPlugin(harness, channel, { update });
78
+ console.log(`${harness}: ${result.lock.package}@${result.lock.version} `
79
+ + `(${channel}, ${result.resolved ? 'resolved and locked' : 'reused lock'})`);
80
+ console.log(` lock: ${result.lockPath}`);
81
+ console.log(` marketplace: ${result.marketplacePath}`);
82
+ }
83
+ }
84
+ catch (e) {
85
+ die(e);
86
+ }
87
+ };
88
+ cOpt(pluginsCommand.command('install [harnesses...]')
89
+ .description('install from the configured channel; reuse an existing same-channel lock'))
90
+ .action(changeHarnessPlugins(false));
91
+ cOpt(pluginsCommand.command('update [harnesses...]')
92
+ .description('resolve configured channels once, persist exact versions, and install them'))
93
+ .action(changeHarnessPlugins(true));
94
+ cOpt(pluginsCommand.command('status [harnesses...]')
95
+ .description('show configured channels and persisted exact versions'))
96
+ .action((names, opts) => {
97
+ try {
98
+ const cfg = loadConfig(opts.configuration);
99
+ for (const harness of selectedHarnessPluginIds(names)) {
100
+ const configured = cfg.harnessPlugins[harness].plugin_channel;
101
+ const lock = readHarnessPluginLock(harness);
102
+ if (!lock) {
103
+ console.log(`${harness}: configured=${configured}, unlocked `
104
+ + `(run \`ours-fleet plugins install ${harness}\`)`);
105
+ continue;
106
+ }
107
+ const mismatch = lock.channel === configured ? '' : `, CONFIG MISMATCH (locked=${lock.channel})`;
108
+ console.log(`${harness}: configured=${configured}, ${lock.package}@${lock.version}${mismatch}`);
109
+ }
110
+ }
111
+ catch (e) {
112
+ die(e);
113
+ }
114
+ });
68
115
  program.command('docs')
69
116
  .alias('man')
70
117
  .description('print the complete AI-friendly command and configuration reference')
@@ -363,8 +410,14 @@ program.command('ls').description('list running fleet sessions')
363
410
  continue;
364
411
  try {
365
412
  const response = await controlRequest(stateDir, { command: 'status' }, 2_000);
366
- if (response.ok && response.result?.alive)
367
- acp.push(`${name}: acp`);
413
+ const result = response.result;
414
+ if (response.ok && result?.alive) {
415
+ // Activity, not readiness: an idle-readiness role may be running a
416
+ // steered wake turn (FLEET-002), so `ls` reports what was observed.
417
+ const observed = classifyActivity(result.activity);
418
+ acp.push(`${name}: acp${observed.state === 'active' ? ' (working)'
419
+ : observed.state === 'quiet' ? ' (no recent agent activity)' : ''}`);
420
+ }
368
421
  }
369
422
  catch { /* ignore stale sockets */ }
370
423
  }
@@ -505,6 +558,14 @@ program.command('status <name>').description('unit/agent state')
505
558
  else if (ledger.consecutiveImmediateFailures > 0)
506
559
  console.log(`restarts: ${ledger.consecutiveImmediateFailures} consecutive immediate `
507
560
  + `failures, next delay ${ledger.nextDelayMs}ms (${ledger.lastReason})`);
561
+ // A kill the supervisor never saw leaves no other trace here. Say it out
562
+ // loud rather than letting the absence of a failure streak read as "fine".
563
+ if (ledger.lastTermination?.class === 'abrupt')
564
+ console.log(`last termination: ABRUPT — the previous supervisor run (started `
565
+ + `${ledger.lastTermination.runStartedAt ?? 'unknown'}) died without an orderly exit; `
566
+ + `observed ${ledger.lastTermination.observedAt}`
567
+ + `\n abrupt terminations recorded: ${ledger.abruptTerminations ?? 1}`
568
+ + `\n cause (signal / OOM-kill): journalctl --user -u ours-fleet-agent@${name}.service`);
508
569
  const modelStatus = joinPath(agentDir(name), '.model-status');
509
570
  if (existsSync(modelStatus)) {
510
571
  try {
@@ -523,8 +584,14 @@ program.command('status <name>').description('unit/agent state')
523
584
  if (stateDir) {
524
585
  try {
525
586
  const response = await controlRequest(stateDir, { command: 'status' }, 2_000);
526
- if (response.ok)
587
+ if (response.ok) {
588
+ const snapshot = response.result;
527
589
  console.log(`session: ${JSON.stringify(response.result)}`);
590
+ // `readiness` is turn occupancy, never an activity claim: a steered
591
+ // wake turn runs to completion with readiness pinned at `idle`
592
+ // (FLEET-002). Say which question each field answers.
593
+ console.log(describeSessionState(snapshot.readiness, snapshot.activity));
594
+ }
528
595
  }
529
596
  catch {
530
597
  console.log('session: acp control unavailable');
@@ -635,7 +702,10 @@ function renderLoopRows(role, state, loop) {
635
702
  return Object.entries(state.loops).filter(([name]) => !loop || name === loop).map(([name, item]) => `${role}/${name} ${item.enabled && !item.operatorDisabled ? 'enabled' : 'disabled'} `
636
703
  + `${item.activeRunId ? 'running' : 'idle'} next=${item.nextDueAt} last=${item.lastOutcome ?? 'never'} `
637
704
  + `counts=${item.counts.started}/${item.counts.completed}/${item.counts.failed} `
638
- + `skip=${item.counts.skipped}(busy=${item.counts.skippedBusy},missed=${item.counts.skippedMissed})`);
705
+ + `skip=${item.counts.skipped}(busy=${item.counts.skippedBusy},missed=${item.counts.skippedMissed})`
706
+ + (item.missedGap
707
+ ? ` gap=${item.missedGap.count}@${item.missedGap.fromAt}..${item.missedGap.throughAt}`
708
+ : ''));
639
709
  }
640
710
  cOpt(loopsCommand.command('status [role] [loop]').description('show live or stored loop state'))
641
711
  .option('--json', 'emit stable JSON')
@@ -1089,7 +1159,7 @@ cOpt(program.command('spawn [name]').description('spawn a new agent (permanent b
1089
1159
  .option('--coordinator <name>', 'announce target')
1090
1160
  .option('--model <id>', 'model id to launch on (e.g. claude-fable-5); default: launcher default')
1091
1161
  .option('--permission-mode <mode>', 'harness permission mode (Codex: untrusted|on-request|never; Claude: native values)')
1092
- .option('--approval <mode>', 'fleet permission mode: ask|auto|allow (deny is deprecated)')
1162
+ .option('--approval <mode>', 'fleet permission mode: ask|auto|allow (Codex ACP allow selects agent-full-access; deny is deprecated)')
1093
1163
  .option('--filesystem <mode>', 'common filesystem intent: read-only|workspace|unrestricted')
1094
1164
  .option('--unattended <mode>', 'permission behavior without a console: deny|wait')
1095
1165
  .option('--sandbox <mode>', 'Codex sandbox: read-only|workspace-write|danger-full-access')
@@ -1161,13 +1231,17 @@ cOpt(program.command('spawn [name]').description('spawn a new agent (permanent b
1161
1231
  console.log(`spawned ${result.lifetime} agent '${result.role}' through `
1162
1232
  + `${result.caller}'s fleet proxy (state: ${result.statePath})`);
1163
1233
  console.log(` ${result.harness}/${result.session}`
1164
- + `${result.model ? ` model=${result.model}` : ''}; `
1234
+ + `${result.model ? ` model=${result.model}` : ''}`
1235
+ + (result.permissionMode
1236
+ ? `; permission=${result.permissionMode.fleetMode} native=${result.permissionMode.nativeMode}`
1237
+ : '') + '; '
1165
1238
  + `monitor=${result.monitor.mode} interrupt=${result.monitor.interrupt}`);
1166
1239
  if (result.inherited.length)
1167
1240
  console.log(` inherited omitted defaults from ${result.caller}: ${result.inherited.join(', ')}`);
1168
1241
  console.log(`→ watch it: ours-fleet peek ${result.role} | attach: ours-fleet attach ${result.role}`);
1169
1242
  return;
1170
1243
  }
1244
+ const plannedPermissionMode = effectivePermissionMode(spawnDryRun(o).resolvedRole);
1171
1245
  if (o.temp) {
1172
1246
  const dir = await spawnTemp(o, binPath);
1173
1247
  console.log(`spawned temp agent '${roleName}' (state: ${dir}; gone on exit/reboot)`);
@@ -1185,6 +1259,8 @@ cOpt(program.command('spawn [name]').description('spawn a new agent (permanent b
1185
1259
  for (const line of formatProvenance(lastProvenance))
1186
1260
  console.log(line);
1187
1261
  }
1262
+ console.log(` permission=${plannedPermissionMode.fleetMode} `
1263
+ + `native=${plannedPermissionMode.nativeMode}`);
1188
1264
  console.log(`→ watch it: ours-fleet peek ${roleName} | attach: ours-fleet attach ${roleName}`);
1189
1265
  }
1190
1266
  catch (e) {
package/dist/config.d.ts CHANGED
@@ -2,6 +2,7 @@ import { type ConfigDiagnostic, type YamlMode } from './config-yaml.js';
2
2
  import type { IsolationConfig, WrapContext } from './isolation/types.js';
3
3
  import type { ResolvedWatchdog } from './watchdog/config.js';
4
4
  import type { ResolvedLoop, ResolvedRoleLoop } from './loops/config.js';
5
+ import { type HarnessPluginChannel, type HarnessPluginConfigs } from './harness-plugins.js';
5
6
  export interface OverseeEntry {
6
7
  role: string;
7
8
  interval: string;
@@ -11,6 +12,9 @@ export interface WorklogPolicy {
11
12
  keep_tail_kb: number;
12
13
  max_archives: number;
13
14
  }
15
+ export type WorklogPolicyInput = Partial<WorklogPolicy> | false;
16
+ /** Conservative built-in policy; `worklog: false` is the explicit opt-out. */
17
+ export declare const DEFAULT_WORKLOG_POLICY: Readonly<WorklogPolicy>;
14
18
  export interface AuthProxyConfig {
15
19
  kind: 'anthropic';
16
20
  base_url: string;
@@ -130,10 +134,10 @@ export interface RoleConfig {
130
134
  isolation?: IsolationConfig;
131
135
  monitor?: Partial<MonitorConfig>;
132
136
  owner_channel?: OwnerChannelConfigInput;
133
- worklog?: WorklogPolicy;
137
+ worklog?: WorklogPolicyInput;
134
138
  auth_proxy?: Partial<AuthProxyConfig>;
135
139
  }
136
- export interface ResolvedRole extends Omit<RoleConfig, 'model' | 'owner_channel'> {
140
+ export interface ResolvedRole extends Omit<RoleConfig, 'model' | 'owner_channel' | 'worklog'> {
137
141
  name: string;
138
142
  harness: string;
139
143
  session: SessionBackendId;
@@ -153,6 +157,8 @@ export interface ResolvedRole extends Omit<RoleConfig, 'model' | 'owner_channel'
153
157
  worklog?: WorklogPolicy;
154
158
  auth_proxy?: AuthProxyConfig;
155
159
  loops?: ResolvedRoleLoop[];
160
+ /** Configured channel for a managed first-party harness plugin. */
161
+ harnessPluginChannel?: HarnessPluginChannel;
156
162
  }
157
163
  export interface FleetConfig {
158
164
  roles: ResolvedRole[];
@@ -165,6 +171,8 @@ export interface FleetConfig {
165
171
  diagnostics: ConfigDiagnostic[];
166
172
  watchdogs: ResolvedWatchdog[];
167
173
  loops: ResolvedLoop[];
174
+ /** Per-harness plugin channel intent. Exact versions live in host-local locks. */
175
+ harnessPlugins: HarnessPluginConfigs;
168
176
  }
169
177
  export declare class ConfigError extends Error {
170
178
  }
@@ -193,7 +201,7 @@ export declare function canonicalCid(value: string): string;
193
201
  export declare function resolveOwnerChannelConfig(defaults: unknown, role: OwnerChannelConfigInput | undefined, session: SessionBackendId, file?: string, name?: string): OwnerChannelConfig | undefined;
194
202
  export declare function resolveModelChain(model: string | undefined, chain: string[] | undefined, file?: string, name?: string): string[] | undefined;
195
203
  export declare function resolveAuthProxy(defaults: unknown, role: Partial<AuthProxyConfig> | undefined, file?: string, name?: string): AuthProxyConfig | undefined;
196
- export declare function resolveWorklogPolicy(defaults: unknown, role: WorklogPolicy | undefined, file?: string, name?: string): WorklogPolicy | undefined;
204
+ export declare function resolveWorklogPolicy(defaults: unknown, role: WorklogPolicyInput | undefined, file?: string, name?: string): WorklogPolicy | undefined;
197
205
  export declare function resolvePermissions(defaults: unknown, role: Partial<CommonPermissions> | undefined, file?: string, name?: string): CommonPermissions;
198
206
  /**
199
207
  * Merge `defaults.monitor` under the role's own `monitor:` key-by-key, validate the