@ours.network/fleet 2.4.0 → 2.4.2

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 (33) hide show
  1. package/README.md +2 -0
  2. package/contrib/.claude-plugin/marketplace.json +1 -0
  3. package/contrib/claude-native/.claude-plugin/plugin.json +1 -0
  4. package/contrib/claude-native/hooks/hooks.json +1 -0
  5. package/contrib/claude-native/hooks/register.js +160 -0
  6. package/dist/application/fleet-query-service.d.ts +9 -0
  7. package/dist/application/fleet-query-service.js +36 -2
  8. package/dist/application/native-claude-conversation.d.ts +34 -0
  9. package/dist/application/native-claude-conversation.js +102 -0
  10. package/dist/application/native-codex-conversation.d.ts +20 -0
  11. package/dist/application/native-codex-conversation.js +68 -0
  12. package/dist/application/native-conversation.d.ts +120 -0
  13. package/dist/application/native-conversation.js +193 -0
  14. package/dist/application/native-conversations.d.ts +19 -0
  15. package/dist/application/native-conversations.js +74 -0
  16. package/dist/application/native-correspondence.d.ts +98 -0
  17. package/dist/application/native-correspondence.js +161 -0
  18. package/dist/application/native-mailbox.d.ts +14 -0
  19. package/dist/application/native-mailbox.js +77 -0
  20. package/dist/application/types.d.ts +7 -1
  21. package/dist/build-info.json +4 -4
  22. package/dist/cli.js +2 -0
  23. package/dist/native-codex-history.d.ts +9 -0
  24. package/dist/native-codex-history.js +62 -0
  25. package/dist/native-codex-wake.d.ts +25 -0
  26. package/dist/native-codex-wake.js +237 -0
  27. package/dist/native-participation-cli.d.ts +62 -0
  28. package/dist/native-participation-cli.js +279 -0
  29. package/dist/native-participation.d.ts +125 -0
  30. package/dist/native-participation.js +446 -0
  31. package/dist/web/runtime.js +49 -3
  32. package/docs/native-session-participation.md +193 -0
  33. package/package.json +7 -6
@@ -0,0 +1,193 @@
1
+ # Native terminal participation in Fleet
2
+
3
+ This experiment enrolls ordinary interactive Claude Code and Codex
4
+ conversations in Ours. The terminal stays open with its context, input,
5
+ interrupt controls and approval settings. An enrolled conversation keeps the
6
+ temporary identity its own Ours integration is bound to, under the explicitly
7
+ authorized Human root; Fleet reads it with the session's read-only
8
+ `current_identity` tool and never creates, binds or closes an identity. Peers use
9
+ normal Ours contacts and message APIs to address that CID.
10
+
11
+ A session with no bound identity is refused once with this action: in that
12
+ terminal, bind one with the session's own Ours tool `create_temporary_identity`
13
+ under the Human root, then restart or resume the Claude session (or reload the
14
+ Codex thread). A durable identity, the Human root itself, or an identity under
15
+ another root is refused the same way.
16
+
17
+ ## One-time setup
18
+
19
+ Use the experimental branch and build it with `npm ci` and `npm run build`.
20
+ The commands below use `ours-fleet` to mean `node /absolute/path/to/fleet/dist/cli.js`
21
+ from this build. The native Ours MCP integration and Fleet must use the same
22
+ gateway profile and application state. They read `OURS_CONFIG` and
23
+ `OURS_MCP_CONFIG` when set. With the standard integration, both use the same
24
+ default paths. With a custom Codex MCP profile, pass both overrides in
25
+ `[mcp_servers.ours.env]` as well.
26
+
27
+ Enable automatic registration and wake under the intended Human root:
28
+
29
+ ```sh
30
+ ours-fleet participation enable --human-cid "$HUMAN_CID" --authorize-registration-and-wake
31
+ ```
32
+
33
+ Include the Codex socket described below in this command if using Codex.
34
+ `participation disable` revokes the existing grant before it can be replaced.
35
+
36
+ ### Claude Code
37
+
38
+ Run `ours-fleet participation hooks claude` and merge the generated hook entries
39
+ into the user-scope Claude Code settings. Keep the existing Ours plugin and any
40
+ other configured hooks. In a trusted workspace, open Claude Code as usual.
41
+ The `SessionStart` hook enrolls the conversation before its first prompt. An
42
+ `asyncRewake` hook asks Claude to read its own Ours inbox when mail arrives.
43
+ `Stop` rearms the watcher after a wake. The experiment gives each watch a
44
+ 24-hour hook timeout.
45
+
46
+ ### Codex
47
+
48
+ Use stock Codex 0.172.0 with its standard local App Server. An eligible ordinary
49
+ `codex` invocation discovers that socket automatically. There is no shell alias,
50
+ wrapper, replacement Codex binary, or extra session-launch argument.
51
+
52
+ One-time setup (reuse a running compatible daemon):
53
+
54
+ ```sh
55
+ codex app-server daemon version
56
+ # Only if no daemon is running:
57
+ codex app-server daemon start
58
+ ours-fleet participation enable --human-cid "$HUMAN_CID" \
59
+ --authorize-registration-and-wake --codex
60
+ ours-fleet participation serve-codex
61
+ ```
62
+
63
+ Run the last command as a persistent user service. It must use the same Ours
64
+ profile and MCP application state as the native integration. Configure Ours MCP
65
+ in Codex's normal user configuration once. Then open any trusted project with:
66
+
67
+ ```sh
68
+ codex
69
+ ```
70
+
71
+ Fleet watches the standard private socket at
72
+ `$CODEX_HOME/app-server-control/app-server-control.sock` (default home `~/.codex`).
73
+ It checks the actual runtime's connected Ours tools and verifies its current
74
+ identity through the read-only Ours MCP tool before publishing participation.
75
+ An explicit grant authorizes registration and wake under the exact Human root;
76
+ same-user socket access alone is insufficient. A different Ours profile or an
77
+ unrelated runtime must not appear as a registered participant.
78
+
79
+ Wake uses Codex's native experimental queue, which starts a turn only when the
80
+ runtime is idle. Human turns are not steered by arriving mail. Withdrawal removes
81
+ only this grant's pending wake entries. Native controls still own work that has
82
+ already started. Queue correlation IDs are not idempotency keys: uncertain
83
+ acknowledgments are reconciled with pending entries and dispatched history and
84
+ never blindly resubmitted.
85
+
86
+ Discovery observes loaded root runtimes, not OS processes or exact UI presence.
87
+ Codex labels its ordinary TUI on this server as `vscode`. Fleet does not resume or
88
+ subscribe just to retain a runtime. When the last client leaves an idle runtime,
89
+ Codex normally unloads it after 60 seconds; active work or another subscriber can
90
+ retain it longer. Registration retires after runtime disappearance is observed.
91
+
92
+ Already-running embedded Codex conversations are not migrated. `--no-daemon`,
93
+ `--oss`, certain CLI config overrides, `CODEX_EXEC_SERVER_URL`, and unsupported
94
+ profiles can bypass native default discovery. Such sessions are not advertised
95
+ as connected. A missing or incompatible socket/queue capability is a setup
96
+ failure, never a fallback to intercepting terminal input.
97
+
98
+ ## Use and withdrawal
99
+
100
+ From another terminal, `ours-fleet participation ls` reports the name,
101
+ harness and temporary CID of each native participant. Peers use that CID
102
+ through their usual Ours integration. Wake submits a fixed notice in the
103
+ original conversation. The native Ours MCP reads the message using the same
104
+ session owner and the harness's normal permission policy.
105
+
106
+ Withdraw one connected session by running
107
+ `ours-fleet participation leave claude <session-uuid>` or
108
+ `ours-fleet participation leave codex <thread-uuid>`. Alternatively,
109
+ `ours-fleet participation disable` revokes the grant and withdraws its sessions.
110
+ Leaving only removes Fleet's participation state: the identity, its CID and its
111
+ inbox stay with the native session. Claude's `SessionEnd` and Codex thread
112
+ unload trigger teardown for a conversation. The terminal can keep running
113
+ after either command.
114
+
115
+ A refusal, or a watcher, wake or discovery failure, is reported once with the
116
+ action to take and ends that operation. Fleet does not retry it or restart the
117
+ watcher; restarting or resuming the Claude session, reloading the Codex thread,
118
+ or a new `serve-codex` run starts again.
119
+
120
+ Wake reads the identity's notification page with Fleet's own API-authenticated
121
+ daemon client, from the inbox tip at joining. Mail stays unread; only mail that
122
+ arrives after joining starts a turn.
123
+
124
+ ## Local verification
125
+
126
+ After building, run these against installed native CLIs and Python 3:
127
+
128
+ ```sh
129
+ node test/native-participation.integration.mjs
130
+ node test/native-participation.integration.mjs claude
131
+ node test/native-participation.integration.mjs codex
132
+ ```
133
+
134
+ The tests use isolated local credentials, a real Ours daemon, real native
135
+ terminals and a scripted local model. They exercise registration before first
136
+ input, wake in the same conversation, waiting during a human turn and
137
+ withdrawal. They need permission to bind localhost and Unix sockets.
138
+
139
+ ## Shared Human conversation without a PWA update
140
+
141
+ The main chat in the existing App projects the native terminal's user and
142
+ assistant text. Input from the authenticated workspace Human enters that same
143
+ native conversation; it is not sent as Ours peer mail. Peer contacts and peer
144
+ history are read on demand, when the App asks, through the session's own Ours
145
+ MCP connection (`list_contacts`, `list_history`, with `current_identity` checked
146
+ before and after): Codex through the App Server, Claude through the
147
+ `ours-fleet-native` plugin, off its pulse, one read at a time (15 s limit,
148
+ never repeated). The read runs only while `current_identity` shows the
149
+ participant's identity. Fleet never opens or rebinds the session's attachment.
150
+ Both reads ask for the provider's machine-readable result (`format: "json"`):
151
+ Codex returns it as structured content, Claude's plugin API as the single JSON
152
+ text block. Anything else, including an Ours integration without json mode, is
153
+ reported as unavailable with the update action. A native history page holds at
154
+ most 200 messages. Native peer views are read-only. Tool
155
+ approvals and interruption remain in the native client.
156
+
157
+ Codex uses its native input queue and reads history with `thread/read`
158
+ including turns. If the running Codex rejects turn listing (for example
159
+ `list_turns is not supported`), the App reports that native error with the
160
+ action to update Codex; Fleet does not read history another way.
161
+
162
+ Claude uses the bundled `ours-fleet-native` plugin and its official mods API.
163
+ Install it once from the local packaged marketplace:
164
+
165
+ ```sh
166
+ claude plugin install ours-fleet-native --marketplace /absolute/path/to/fleet/contrib --scope user
167
+ ```
168
+
169
+ Then start ordinary `claude`, without launch flags. Existing Claude sessions
170
+ must reload the plugin or be restarted/resumed; the old mail-wake hook alone
171
+ cannot provide shared Human input. The plugin submits through `prompt.submit`,
172
+ keeps its native plugin provenance, and preserves Claude's permission and Stop
173
+ behavior. It publishes a transcript watermark alongside input correlation so a
174
+ PWA echo cannot race into the history twice. Commands retain durable admission
175
+ order. The plugin also joins the session: it reads the session's identity with
176
+ `current_identity` through the session's own Ours MCP connection, and the
177
+ registration/mail hooks wait for that join.
178
+
179
+ An ambiguous queue or plugin handoff is never blindly repeated. The operator
180
+ must inspect the terminal before creating a new command after an uncertain
181
+ submission. A plugin restart preserves previously published correlation, but
182
+ cannot prove the outcome of an unpublished native event. This remains an
183
+ experimental integration, not exactly-once execution across arbitrary crashes.
184
+
185
+ Installed verification for code b1874f7: actual stock Codex and Claude sessions
186
+ accepted terminal text, answered a PWA-API-origin follow-up using that same
187
+ context, and exposed native completion. Claude displayed no duplicate echoed
188
+ input and withdrew on normal exit; Codex retired after its native unload grace.
189
+ Existing populated Codex histories also opened through the installed HTTP API.
190
+ This establishes backend compatibility tests, not visual acceptance of the PWA.
191
+ Full-suite green and final upstream readiness are not claimed. Keep the
192
+ experimental package installed for operator acceptance; retain its previous
193
+ package and Claude configuration backups, and do not push remotely.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/fleet",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Harness-agnostic fleet of persistent, identity-bound AI agents. Declarative fleet.yaml, managed native/ACP sessions, supervision, and ours.network messaging.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -27,7 +27,8 @@
27
27
  "LICENSE",
28
28
  "docs/acp-files.md",
29
29
  "docs/self-reminders.md",
30
- "docs/task-progress-review.md"
30
+ "docs/task-progress-review.md",
31
+ "docs/native-session-participation.md"
31
32
  ],
32
33
  "engines": {
33
34
  "node": ">=22.23.4 <23 || >=24.22.1 <25 || >=26.12.1 <27"
@@ -49,9 +50,9 @@
49
50
  "dependencies": {
50
51
  "@agentclientprotocol/sdk": "^1.3.0",
51
52
  "@fastify/websocket": "^11.2.0",
52
- "@ours.network/cli": "4.2.0",
53
- "@ours.network/mcp": "2.0.4",
54
- "@ours.network/sdk": "5.2.0",
53
+ "@ours.network/cli": "5.1.0",
54
+ "@ours.network/mcp": "2.0.6",
55
+ "@ours.network/sdk": "6.1.0",
55
56
  "commander": "^12.1.0",
56
57
  "fastify": "^5.4.0",
57
58
  "qrcode": "1.5.4",
@@ -65,7 +66,7 @@
65
66
  "@agentclientprotocol/codex-acp": "2.7.0"
66
67
  },
67
68
  "devDependencies": {
68
- "@ours.network/daemon": "5.2.0",
69
+ "@ours.network/daemon": "6.1.0",
69
70
  "@types/node": "^22.20.4",
70
71
  "@types/qrcode": "^1.5.6",
71
72
  "@types/ws": "^8.18.1",