@zvada/agent-server 0.3.26 → 0.3.28

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 (262) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +7 -5
  3. package/dist/client/client.js +27 -11
  4. package/dist/client/connection.js +35 -3
  5. package/dist/core/agents/acp/account.js +111 -0
  6. package/dist/core/agents/acp/acp-agent.js +247 -158
  7. package/dist/core/agents/acp/adapter.js +103 -34
  8. package/dist/core/agents/acp/client.js +169 -42
  9. package/dist/core/agents/acp/known-agents.js +12 -5
  10. package/dist/core/agents/acp/mappings.js +84 -20
  11. package/dist/core/agents/acp/models.js +59 -0
  12. package/dist/core/agents/acp/profile.js +36 -0
  13. package/dist/core/agents/acp/prompts.js +248 -0
  14. package/dist/core/agents/acp/requests.js +4 -4
  15. package/dist/core/agents/claude-code/approvals.js +1 -1
  16. package/dist/core/agents/claude-code/login.js +4 -1
  17. package/dist/core/agents/claude-code/session.js +38 -10
  18. package/dist/core/agents/claude-code/spawn.js +0 -26
  19. package/dist/core/agents/codex-app-server/client.js +12 -13
  20. package/dist/core/agents/codex-app-server/login.js +4 -1
  21. package/dist/core/agents/codex-app-server/plan-approval.js +1 -1
  22. package/dist/core/agents/gemini/failures.js +133 -0
  23. package/dist/core/agents/gemini/login.js +173 -0
  24. package/dist/core/agents/gemini/profile.js +137 -0
  25. package/dist/core/agents/gemini/tools.js +91 -0
  26. package/dist/core/agents/login.js +8 -6
  27. package/dist/core/agents/scripted/scripted-agent.js +30 -3
  28. package/dist/core/agents/stderr-tail.js +5 -2
  29. package/dist/core/presets.js +17 -1
  30. package/dist/core/processes/native-processes.js +23 -1
  31. package/dist/core/provision/install-build.js +70 -26
  32. package/dist/core/provision/pins.js +5 -0
  33. package/dist/core/provision/provisioner.js +39 -16
  34. package/dist/core/provision/releases.js +39 -1
  35. package/dist/core/provision/tools.js +87 -28
  36. package/dist/core/runtime/agent-runtime.js +15 -5
  37. package/dist/core/runtime/event-processor.js +13 -8
  38. package/dist/core/runtime/origin-line.js +42 -0
  39. package/dist/core/runtime/request-broker.js +2 -1
  40. package/dist/core/runtime/steering.js +4 -3
  41. package/dist/core/runtime/turn.js +6 -4
  42. package/dist/operator/errors.js +97 -0
  43. package/dist/operator/index.js +10 -5
  44. package/dist/operator/mcp.js +7 -12
  45. package/dist/operator/operator.js +1431 -378
  46. package/dist/operator/refs.js +59 -0
  47. package/dist/operator/render.js +199 -94
  48. package/dist/operator/session-tools.js +88 -0
  49. package/dist/operator/types.js +30 -0
  50. package/dist/operator/view.js +82 -27
  51. package/dist/protocol/account.js +5 -1
  52. package/dist/protocol/auth.js +5 -1
  53. package/dist/protocol/config.js +12 -5
  54. package/dist/protocol/conversation.js +3 -0
  55. package/dist/protocol/credentials.js +9 -1
  56. package/dist/protocol/harness.js +9 -1
  57. package/dist/protocol/history.js +2 -1
  58. package/dist/protocol/index.js +1 -0
  59. package/dist/protocol/lifecycle.js +19 -0
  60. package/dist/protocol/origin.js +39 -0
  61. package/dist/protocol/reduce.js +2 -0
  62. package/dist/protocol/wire.js +17 -0
  63. package/dist/server/bin.js +22 -7
  64. package/dist/server/install.js +6 -4
  65. package/dist/server/routes.js +15 -5
  66. package/dist/types/client/client.d.ts.map +1 -1
  67. package/dist/types/client/connection.d.ts +14 -2
  68. package/dist/types/client/connection.d.ts.map +1 -1
  69. package/dist/types/client/turns.d.ts +2 -2
  70. package/dist/types/client/turns.d.ts.map +1 -1
  71. package/dist/types/core/agents/acp/account.d.ts +55 -0
  72. package/dist/types/core/agents/acp/account.d.ts.map +1 -0
  73. package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
  74. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  75. package/dist/types/core/agents/acp/adapter.d.ts +28 -3
  76. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  77. package/dist/types/core/agents/acp/client.d.ts +66 -4
  78. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  79. package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
  80. package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
  81. package/dist/types/core/agents/acp/mappings.d.ts +53 -7
  82. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  83. package/dist/types/core/agents/acp/models.d.ts +22 -0
  84. package/dist/types/core/agents/acp/models.d.ts.map +1 -0
  85. package/dist/types/core/agents/acp/profile.d.ts +92 -0
  86. package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
  87. package/dist/types/core/agents/acp/prompts.d.ts +108 -0
  88. package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
  89. package/dist/types/core/agents/acp/requests.d.ts +7 -1
  90. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  91. package/dist/types/core/agents/base.d.ts +2 -0
  92. package/dist/types/core/agents/base.d.ts.map +1 -1
  93. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  94. package/dist/types/core/agents/claude-code/session.d.ts +3 -0
  95. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  96. package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
  97. package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
  98. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  99. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  100. package/dist/types/core/agents/gemini/failures.d.ts +25 -0
  101. package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
  102. package/dist/types/core/agents/gemini/login.d.ts +28 -0
  103. package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
  104. package/dist/types/core/agents/gemini/profile.d.ts +30 -0
  105. package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
  106. package/dist/types/core/agents/gemini/tools.d.ts +18 -0
  107. package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
  108. package/dist/types/core/agents/login.d.ts +15 -5
  109. package/dist/types/core/agents/login.d.ts.map +1 -1
  110. package/dist/types/core/agents/scripted/scripted-agent.d.ts +14 -1
  111. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
  112. package/dist/types/core/agents/stderr-tail.d.ts +1 -1
  113. package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
  114. package/dist/types/core/presets.d.ts +2 -2
  115. package/dist/types/core/presets.d.ts.map +1 -1
  116. package/dist/types/core/processes/native-processes.d.ts +6 -0
  117. package/dist/types/core/processes/native-processes.d.ts.map +1 -1
  118. package/dist/types/core/provision/checksums.d.ts +7 -1
  119. package/dist/types/core/provision/checksums.d.ts.map +1 -1
  120. package/dist/types/core/provision/install-build.d.ts +32 -6
  121. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  122. package/dist/types/core/provision/pins.d.ts +4 -0
  123. package/dist/types/core/provision/pins.d.ts.map +1 -1
  124. package/dist/types/core/provision/provisioner.d.ts +18 -7
  125. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  126. package/dist/types/core/provision/releases.d.ts +2 -1
  127. package/dist/types/core/provision/releases.d.ts.map +1 -1
  128. package/dist/types/core/provision/tools.d.ts +36 -7
  129. package/dist/types/core/provision/tools.d.ts.map +1 -1
  130. package/dist/types/core/runtime/agent-runtime.d.ts +4 -2
  131. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  132. package/dist/types/core/runtime/event-processor.d.ts +2 -2
  133. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  134. package/dist/types/core/runtime/origin-line.d.ts +15 -0
  135. package/dist/types/core/runtime/origin-line.d.ts.map +1 -0
  136. package/dist/types/core/runtime/request-broker.d.ts +1 -1
  137. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  138. package/dist/types/core/runtime/steering.d.ts +7 -4
  139. package/dist/types/core/runtime/steering.d.ts.map +1 -1
  140. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  141. package/dist/types/operator/errors.d.ts +87 -0
  142. package/dist/types/operator/errors.d.ts.map +1 -0
  143. package/dist/types/operator/index.d.ts +10 -5
  144. package/dist/types/operator/index.d.ts.map +1 -1
  145. package/dist/types/operator/mcp.d.ts +1 -1
  146. package/dist/types/operator/mcp.d.ts.map +1 -1
  147. package/dist/types/operator/operator.d.ts +15 -197
  148. package/dist/types/operator/operator.d.ts.map +1 -1
  149. package/dist/types/operator/refs.d.ts +25 -0
  150. package/dist/types/operator/refs.d.ts.map +1 -0
  151. package/dist/types/operator/render.d.ts +67 -22
  152. package/dist/types/operator/render.d.ts.map +1 -1
  153. package/dist/types/operator/session-tools.d.ts +61 -0
  154. package/dist/types/operator/session-tools.d.ts.map +1 -0
  155. package/dist/types/operator/types.d.ts +442 -0
  156. package/dist/types/operator/types.d.ts.map +1 -0
  157. package/dist/types/operator/view.d.ts +19 -29
  158. package/dist/types/operator/view.d.ts.map +1 -1
  159. package/dist/types/protocol/account.d.ts +4 -2
  160. package/dist/types/protocol/account.d.ts.map +1 -1
  161. package/dist/types/protocol/auth.d.ts +10 -7
  162. package/dist/types/protocol/auth.d.ts.map +1 -1
  163. package/dist/types/protocol/clis.d.ts +4 -3
  164. package/dist/types/protocol/clis.d.ts.map +1 -1
  165. package/dist/types/protocol/config.d.ts +22 -5
  166. package/dist/types/protocol/config.d.ts.map +1 -1
  167. package/dist/types/protocol/conversation.d.ts +47 -6
  168. package/dist/types/protocol/conversation.d.ts.map +1 -1
  169. package/dist/types/protocol/credentials.d.ts +8 -0
  170. package/dist/types/protocol/credentials.d.ts.map +1 -1
  171. package/dist/types/protocol/execution.d.ts +1 -1
  172. package/dist/types/protocol/harness.d.ts +5 -2
  173. package/dist/types/protocol/harness.d.ts.map +1 -1
  174. package/dist/types/protocol/history.d.ts +1 -1
  175. package/dist/types/protocol/history.d.ts.map +1 -1
  176. package/dist/types/protocol/index.d.ts +1 -0
  177. package/dist/types/protocol/index.d.ts.map +1 -1
  178. package/dist/types/protocol/lifecycle.d.ts +48 -10
  179. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  180. package/dist/types/protocol/models.d.ts +3 -0
  181. package/dist/types/protocol/models.d.ts.map +1 -1
  182. package/dist/types/protocol/origin.d.ts +49 -0
  183. package/dist/types/protocol/origin.d.ts.map +1 -0
  184. package/dist/types/protocol/reduce.d.ts.map +1 -1
  185. package/dist/types/protocol/wire-api.d.ts +78 -30
  186. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  187. package/dist/types/protocol/wire.d.ts +78 -12
  188. package/dist/types/protocol/wire.d.ts.map +1 -1
  189. package/dist/types/server/install.d.ts +2 -1
  190. package/dist/types/server/install.d.ts.map +1 -1
  191. package/dist/types/server/routes.d.ts.map +1 -1
  192. package/docs/consuming.md +62 -121
  193. package/docs/deploy.md +17 -8
  194. package/docs/harnesses.md +166 -44
  195. package/docs/sync-history.md +2 -1
  196. package/package.json +1 -1
  197. package/src/client/client.ts +36 -9
  198. package/src/client/connection.ts +31 -1
  199. package/src/client/turns.ts +2 -1
  200. package/src/core/agents/acp/account.ts +158 -0
  201. package/src/core/agents/acp/acp-agent.ts +288 -178
  202. package/src/core/agents/acp/adapter.ts +126 -35
  203. package/src/core/agents/acp/client.ts +196 -49
  204. package/src/core/agents/acp/known-agents.ts +14 -5
  205. package/src/core/agents/acp/mappings.ts +112 -21
  206. package/src/core/agents/acp/models.ts +72 -0
  207. package/src/core/agents/acp/profile.ts +127 -0
  208. package/src/core/agents/acp/prompts.ts +287 -0
  209. package/src/core/agents/acp/requests.ts +16 -9
  210. package/src/core/agents/base.ts +2 -0
  211. package/src/core/agents/claude-code/approvals.ts +2 -2
  212. package/src/core/agents/claude-code/login.ts +4 -1
  213. package/src/core/agents/claude-code/session.ts +38 -8
  214. package/src/core/agents/claude-code/spawn.ts +0 -26
  215. package/src/core/agents/codex-app-server/client.ts +11 -18
  216. package/src/core/agents/codex-app-server/login.ts +4 -5
  217. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  218. package/src/core/agents/gemini/failures.ts +148 -0
  219. package/src/core/agents/gemini/login.ts +188 -0
  220. package/src/core/agents/gemini/profile.ts +162 -0
  221. package/src/core/agents/gemini/tools.ts +99 -0
  222. package/src/core/agents/login.ts +14 -8
  223. package/src/core/agents/scripted/scripted-agent.ts +42 -3
  224. package/src/core/agents/stderr-tail.ts +5 -2
  225. package/src/core/presets.ts +19 -3
  226. package/src/core/processes/native-processes.ts +32 -1
  227. package/src/core/provision/checksums.ts +12 -2
  228. package/src/core/provision/install-build.ts +122 -55
  229. package/src/core/provision/pins.ts +5 -0
  230. package/src/core/provision/provisioner.ts +62 -27
  231. package/src/core/provision/releases.ts +47 -1
  232. package/src/core/provision/tools.ts +124 -31
  233. package/src/core/runtime/agent-runtime.ts +31 -7
  234. package/src/core/runtime/event-processor.ts +13 -6
  235. package/src/core/runtime/origin-line.ts +43 -0
  236. package/src/core/runtime/request-broker.ts +2 -0
  237. package/src/core/runtime/steering.ts +8 -4
  238. package/src/core/runtime/turn.ts +11 -4
  239. package/src/operator/errors.ts +221 -0
  240. package/src/operator/index.ts +18 -23
  241. package/src/operator/mcp.ts +7 -16
  242. package/src/operator/operator.ts +1684 -610
  243. package/src/operator/refs.ts +75 -0
  244. package/src/operator/render.ts +260 -118
  245. package/src/operator/session-tools.ts +127 -0
  246. package/src/operator/types.ts +506 -0
  247. package/src/operator/view.ts +93 -42
  248. package/src/protocol/account.ts +5 -2
  249. package/src/protocol/auth.ts +5 -1
  250. package/src/protocol/config.ts +14 -6
  251. package/src/protocol/conversation.ts +3 -0
  252. package/src/protocol/credentials.ts +11 -2
  253. package/src/protocol/harness.ts +9 -1
  254. package/src/protocol/history.ts +2 -1
  255. package/src/protocol/index.ts +1 -0
  256. package/src/protocol/lifecycle.ts +21 -0
  257. package/src/protocol/origin.ts +47 -0
  258. package/src/protocol/reduce.ts +4 -0
  259. package/src/protocol/wire.ts +18 -0
  260. package/src/server/bin.ts +20 -6
  261. package/src/server/install.ts +6 -3
  262. package/src/server/routes.ts +16 -5
package/docs/harnesses.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Harness support matrix
2
2
 
3
- Four harnesses, one event stream. The lifecycle event *structure* is identical
3
+ Five harnesses, one event stream. The lifecycle event *structure* is identical
4
4
  across harnesses (one generic `EventProcessor` drives it); payloads and config
5
5
  support differ only where the backends genuinely do.
6
6
 
@@ -8,14 +8,16 @@ support differ only where the backends genuinely do.
8
8
  | --- | --- | --- | --- | --- |
9
9
  | `claude-code` | `@anthropic-ai/claude-agent-sdk` (claude CLI) | token-level | yes (`resume`) | `in_session` (`setModel`) |
10
10
  | `codex-app-server` | `codex app-server` (JSON-RPC subprocess) | token-level | yes (`thread/resume`) | `in_session` (per-turn) |
11
+ | `gemini` | Google's Antigravity CLI, `agy acp`, an ACP agent ([below](#the-gemini-harness)) | chunk-level | yes (`session/resume`) | `in_session` (its `model` option) |
11
12
  | `acp` | any ACP v1 agent via `@agentclientprotocol/sdk` | per-agent | yes (`session/resume`, else `session/load`) | when the agent offers a `model` config option (so the capability says `unsupported`) |
12
13
  | `scripted` | a script the operator gives, no process ([below](#the-scripted-harness)) | a word at a time (`stream` steps) | any id (nothing to lose) | `unsupported`: it runs no model |
13
14
 
14
15
  The `acp` harness is opt-in (an operator-supplied launch command, never
15
16
  wire-sourced): well-known agents run by name (`--harness=pi`,
16
- `--harness=gemini`); anything else via `--acp-agent="<launch command>"` /
17
+ `--harness=gemini-cli`, Google's Gemini CLI, the enterprise one without
18
+ Gemini 4); anything else via `--acp-agent="<launch command>"` /
17
19
  `$AGENT_SERVER_ACP_AGENT`, or `CreateRegistryOptions.acp.resolveLaunch` when
18
- embedding.
20
+ embedding. `--harness=gemini` is the `gemini` harness.
19
21
 
20
22
  What the `acp` harness asks of an agent, and what it does when the agent
21
23
  offers it (checked against SDK 1.7.0 with `claude-agent-acp` and `codex-acp`):
@@ -24,14 +26,20 @@ offers it (checked against SDK 1.7.0 with `claude-agent-acp` and `codex-acp`):
24
26
  (the replayed history is discarded). An agent with neither fails the turn
25
27
  as `resume_failed`.
26
28
  - **Model and thinking level:** selected through the agent's `model` and
27
- `thought_level` config options (`session/set_config_option`). An agent
28
- without the option keeps its default. A model the agent does not list fails
29
- the turn as `invalid_request`; an unlisted thinking level is left alone.
29
+ `thought_level` config options (`session/set_config_option`), the model
30
+ first. An agent without the option keeps its default. A model the agent
31
+ does not list fails the turn as `invalid_request`. The levels are those
32
+ offered once the model is set, and the turn runs the nearest of them
33
+ (`clampThinkingLevel`); one that cannot be fitted is left alone.
34
+ `turn.ended.execution` reports the model and level the options then state.
30
35
  - **Permission mode:** an agent that offers modes is put in the turn's
31
36
  (`default` when it names none) with `session/set_mode`, by the agent's own
32
- id (`acceptEdits`, `bypassPermissions` and the like are read as the
33
- engine's); one it offers none of is reported not applied. The engine also
34
- answers the agent's permission requests by the mode.
37
+ id, whatever its case and separators (`acceptEdits`, `accept-edits`,
38
+ `bypassPermissions`). One with no id for the mode is put in its `default`,
39
+ and the engine answers what it asks by the turn's mode; `plan` there, or
40
+ any mode on an agent with no `default` either, is reported not applied.
41
+ In `accept_edits` the engine allows edits and reads and asks the person
42
+ for anything else, as Claude and Codex ask for a command.
35
43
  - **Extra directories:** `additionalDirectories` is sent to agents that
36
44
  advertise the capability and ignored otherwise.
37
45
  - **Token usage:** read from the prompt response when the agent sends it. The
@@ -81,8 +89,9 @@ rather than reaching the agent unread, and a steer carrying one is refused the
81
89
  same way. A Codex turn with `disableTools` fails so too, before Codex starts:
82
90
  with every feature that offers a tool turned off, Codex 0.160 still gives a
83
91
  model its code-mode `exec`, `apply_patch` inside it, its sub-agent tools and
84
- `request_user_input`, so the model would act anyway. ACP agents cannot be steered: ACP v1 has no input for a running
85
- prompt, so `turn/steer` answers `unsupported`. An ACP agent takes image data with its
92
+ `request_user_input`, so the model would act anyway. An ACP agent cannot be steered: ACP v1 has no input for a running
93
+ prompt, so `turn/steer` answers `unsupported`; the `gemini` harness steers,
94
+ since Antigravity takes a prompt sent while one runs as input to it. An ACP agent takes image data with its
86
95
  `image` prompt capability and files as embedded resources with
87
96
  `embeddedContext`; otherwise text files go inline and links as resource links.
88
97
  The harness states the most an agent can take (`images`, `files: text, pdf,
@@ -198,7 +207,8 @@ advertise is declined; for a client that advertises neither, the turn runs
198
207
  without `elicitation`, so the agent is told no one can answer.
199
208
 
200
209
  What a Claude or Codex session loads by itself is the operator's
201
- `inheritConfig` (LLP 0001, D17; choosing one: [consuming.md](consuming.md#choose-what-a-turn-inherits)).
210
+ `inheritConfig` (LLP 0001, D17; choosing one: [consuming.md](consuming.md#choose-what-a-turn-inherits)). A gemini
211
+ session runs at `all` only ([below](#the-gemini-harness)).
202
212
  At `all`, the default, a Claude session loads every settings source (user,
203
213
  project and local), as the CLI does: the operator's own MCP servers, hooks and
204
214
  plugins join the turn beside the servers its config names, and so does the
@@ -300,26 +310,26 @@ turn fails. **The agent's**: an ACP agent decides, by what it advertises.
300
310
  ends "(not applied: …)" is a case a harness finds as the turn runs, named in
301
311
  `turn.ended.execution.notApplied`.
302
312
 
303
- | Setting | claude-code | codex-app-server | acp | scripted |
304
- | --- | --- | --- | --- | --- |
305
- | `harness` | the engine | the engine | the engine | the engine |
306
- | `model` | applied, switched live | applied (`turn/start`) | the agent's: set through its `model` config option; an agent without one keeps its own (not applied: `model`); a value it does not list is refused | ignored: `echo: "config"` says it |
307
- | `thinkingLevel` | applied, fitted to the model's levels (a model with none: not applied: `thinkingLevel`) | applied as reasoning effort, fitted to the model; `off` is its lowest effort (a model with no reasoning control: not applied: `thinkingLevel`) | the agent's: set through its `thought_level` option when it lists the level (otherwise not applied: `thinkingLevel`) | ignored: `echo: "config"` says it |
308
- | `cwd` | applied | applied | applied | another meaning: a change needs a resume (as on every harness), and `echo: "config"` says it |
309
- | `additionalDirectories` | applied | another meaning: writable roots of the `accept_edits` sandbox, nothing in the other modes | the agent's: sent only to an agent that takes them (otherwise not applied: `additionalDirectories`) | ignored: `echo: "config"` says them |
310
- | `systemPromptAppend` | applied, appended to Claude Code's system prompt | another meaning: a developer message (`developerInstructions`) | ignored: ACP v1 has no system prompt | ignored: `echo: "config"` says it |
311
- | `maxTurns` | applied (unset is 100) | ignored | ignored | ignored |
312
- | `subagentMode` | applied | another meaning: Codex's `multi_agent` on, an instruction to collect every sub-agent, a native cleanup at the end | refused | refused |
313
- | `permissionMode` | applied (SDK modes) | another meaning: a sandbox and an approval policy (the table below) | applied where the agent offers a mode of that meaning (`session/set_mode`, by its own id; `default` when the turn names none), and the engine answers its requests by the mode; one it offers none of is not applied (`permissionMode`), nor `plan` on an agent with no modes | ignored: the script says which calls ask (`ask: true`); `echo: "config"` says it |
314
- | `elicitation` | applied | applied | applied: the agent's form and URL requests (ACP v1 has no question tool) | applied: an `ask` step asks the person, else the agent is told no one can answer |
315
- | `requestTimeoutMs` | the engine | the engine | the engine | the engine |
316
- | `resumeSessionId` | applied | applied (`thread/resume`) | the agent's: `session/resume`, else `session/load`; refused for an agent with neither | applied: reported as the native id, resumed |
317
- | `resumeSessionAt` | applied with a resume (without one: not applied: `resumeSessionAt`) | ignored | ignored | ignored |
318
- | `mcpServers` | applied, switched live | applied; SSE and the name `codex_apps` refused | the agent's: every server is sent, whatever it advertises; `required` is not checked | applied: a `call` step calls an `http` one |
319
- | `env` | applied | applied; `CODEX_HOME` is the session's home (below `all`, required) | applied | another meaning: a change needs a resume, and `echo: "config"` says its keys |
320
- | `apiKey` | applied (`ANTHROPIC_API_KEY`) | applied (an in-memory login) | ignored: the agent's credentials are its launch command's | ignored: it runs on no credential |
321
- | `disableTools` | applied (no tools, no MCP servers) | refused (`invalid_request`) | ignored: ACP v1 cannot ask for it | ignored: its tool calls are the script's |
322
- | `includeRaw` | the engine | the engine | the engine | the engine |
313
+ | Setting | claude-code | codex-app-server | gemini | acp | scripted |
314
+ | --- | --- | --- | --- | --- | --- |
315
+ | `harness` | the engine | the engine | the engine | the engine | the engine |
316
+ | `model` | applied, switched live | applied (`turn/start`) | applied (its `model` option, switched live); Antigravity's Claude, GPT-OSS and orchestrator models are refused | the agent's: set through its `model` config option; an agent without one keeps its own (not applied: `model`); a value it does not list is refused | ignored: `echo: "config"` says it |
317
+ | `thinkingLevel` | applied, fitted to the model's levels (a model with none: not applied: `thinkingLevel`) | applied as reasoning effort, fitted to the model; `off` is its lowest effort (a model with no reasoning control: not applied: `thinkingLevel`) | applied, fitted to the model's own levels (a level no ordering fits: not applied: `thinkingLevel`) | the agent's: set through its `thought_level` option, fitted to the levels the model offers (a level no ordering fits, or no option: not applied: `thinkingLevel`) | ignored: `echo: "config"` says it |
318
+ | `cwd` | applied | applied | applied | applied | another meaning: a change needs a resume (as on every harness), and `echo: "config"` says it |
319
+ | `additionalDirectories` | applied | another meaning: writable roots of the `accept_edits` sandbox, nothing in the other modes | applied | the agent's: sent only to an agent that takes them (otherwise not applied: `additionalDirectories`) | ignored: `echo: "config"` says them |
320
+ | `systemPromptAppend` | applied, appended to Claude Code's system prompt | another meaning: a developer message (`developerInstructions`) | applied once, at `session/new` (`_meta.antigravity.systemPrompt.append`); a later different one: not applied: `systemPromptAppend` | ignored: ACP v1 has no system prompt | ignored: `echo: "config"` says it |
321
+ | `maxTurns` | applied (unset is 100) | ignored | ignored | ignored | ignored |
322
+ | `subagentMode` | applied | another meaning: Codex's `multi_agent` on, an instruction to collect every sub-agent, a native cleanup at the end | refused | refused | refused |
323
+ | `permissionMode` | applied (SDK modes) | another meaning: a sandbox and an approval policy (the table below) | another meaning: Antigravity's modes, `auto` for `bypass_permissions`, its `default` for `dont_ask` (the table below) | applied: the agent's own mode for it (`session/set_mode`; `default` when the turn names none), else its `default` with the engine answering its requests by the mode; `plan` there, or any mode on an agent with no `default`, is not applied (`permissionMode`) | ignored: the script says which calls ask (`ask: true`); `echo: "config"` says it |
324
+ | `elicitation` | applied | applied | applied: the agent's form and URL requests | applied: the agent's form and URL requests (ACP v1 has no question tool) | applied: an `ask` step asks the person, else the agent is told no one can answer |
325
+ | `requestTimeoutMs` | the engine | the engine | the engine | the engine | the engine |
326
+ | `resumeSessionId` | applied | applied (`thread/resume`) | applied (`session/resume`) | the agent's: `session/resume`, else `session/load`; refused for an agent with neither | applied: reported as the native id, resumed |
327
+ | `resumeSessionAt` | applied with a resume (without one: not applied: `resumeSessionAt`) | ignored | ignored | ignored | ignored |
328
+ | `mcpServers` | applied, switched live | applied; SSE and the name `codex_apps` refused | applied: stdio and HTTP, though `initialize` does not advertise HTTP | the agent's: every server is sent, whatever it advertises; `required` is not checked | applied: a `call` step calls an `http` one |
329
+ | `env` | applied | applied; `CODEX_HOME` is the session's home (below `all`, required) | applied | applied | another meaning: a change needs a resume, and `echo: "config"` says its keys |
330
+ | `apiKey` | applied (`ANTHROPIC_API_KEY`) | applied (an in-memory login) | ignored: it runs on the person's own Antigravity sign-in | ignored: the agent's credentials are its launch command's | ignored: it runs on no credential |
331
+ | `disableTools` | applied (no tools, no MCP servers) | refused (`invalid_request`) | ignored: ACP v1 cannot ask for it | ignored: ACP v1 cannot ask for it | ignored: its tool calls are the script's |
332
+ | `includeRaw` | the engine | the engine | the engine | the engine | the engine |
323
333
 
324
334
  `test/core/agents/ignored-settings.test.ts` holds this table's verdicts; a
325
335
  new `RunConfig` field fails it until each harness's verdict is written there.
@@ -409,6 +419,21 @@ other:
409
419
  `default`, `gpt-6-luna` did not retry: no request came, and no tool part
410
420
  reached the stream.
411
421
 
422
+ The `gemini` harness puts Antigravity in its own mode for each (measured on
423
+ Antigravity 1.5.13 on 2026-11-21, live through the engine; LLP 0020.000,
424
+ Modes). It is not in the `permission-modes` scenario's tables.
425
+
426
+ | Engine mode | Antigravity's | A write in the folder | A command | An MCP tool |
427
+ | --- | --- | --- | --- | --- |
428
+ | `default` | `default` | asks | asks | asks |
429
+ | `accept_edits` | `accept-edits` | runs | asks | asks |
430
+ | `plan` | `plan` | writes a plan file and stops, asking nothing | not run | not run |
431
+ | `bypass_permissions` | `auto` | runs | runs | asked; the engine allows it |
432
+ | `dont_ask` | `default` | refused by the engine | refused by the engine | refused by the engine |
433
+
434
+ A later turn in another mode carries a plan out; there is no approval
435
+ request for it.
436
+
412
437
  ## Model lists
413
438
 
414
439
  `runtime.models({ harness, cwd })` (wire `models/list`, `client.listModels()`)
@@ -419,6 +444,7 @@ a turn with the same `cwd`, `env` and `apiKey` would use:
419
444
  | --- | --- | --- |
420
445
  | `claude-code` | `query().supportedModels()` on an idle CLI (no prompt, MCP servers or hooks), at the operator's `inheritConfig` | The folder's `availableModels` setting narrows the list. `default` is a model id: the account's default. Haiku 4.5 lists no levels; `haiku` runs Haiku 5.5, which does. Operator `sdkOptions` are not applied. |
421
446
  | `codex-app-server` | `model/list`, on the session's own process when `sessionId` has one | Lists what the login can run (a ChatGPT login gets no `gpt-5.5`). The default is the model `~/.codex/config.toml` selects, else Codex's own. With host-managed auth, pass the `sessionId` whose account to list. |
447
+ | `gemini` | a session with no turn, in a new private folder: the `model` option's Gemini models, each set in turn to read its `thought_level` values | About 1 s, and free. Antigravity's Claude, GPT-OSS and orchestrator models are left out. `thinking.default` only on the default model: the others' current level is the one carried over. The catalog has no rows: a failed read answers an empty list with its `error`. |
422
448
  | `acp` | none | The catalog (empty). ACP agents describe models as session config options. |
423
449
  | `scripted` | the harness | One model, `scripted`, with no thinking levels. |
424
450
 
@@ -468,11 +494,13 @@ recipe is in
468
494
  | --- | --- | --- | --- |
469
495
  | `claude-code` | `claude auth status --json`, with the turn's environment | `claudeai`, `console` (`browser`, with a `codeUrl` for another device; over the SDK's control requests, CLI 2.1.220 and later), `terminal` (`claude auth login`) | `claude auth logout` |
470
496
  | `codex-app-server` | `account/read` on an app-server of its own | `chatgpt` (`browser`, callback on `127.0.0.1:1455`, one per machine), `chatgpt_device_code`, `api_key`, `terminal` (`codex login`) | `account/logout` |
497
+ | `gemini` | a session with no turn opened in a new private folder: `signed_in`, a subscription from the CLI's login on the plan Antigravity's tier names (`Google AI Pro`) where the session names one, and claiming nothing more where it names none (a key; a wrong key reads `signed_in` too, its first turn failing as `auth`), or `signed_out` for `Authentication required`; shared as every harness's status read | `google` (`browser`: `agy acp --login`, a `codeUrl`, then the code the page shows), `terminal` (`agy acp --login`) | ACP `logout`, which removes the OS keyring entry |
471
498
  | `acp` | — (`unknown`: the agent signs in on its own) | none | — |
472
499
  | `scripted` | — (`signed_in`: it runs on nothing, so there is nothing to sign in to) | none | refused (`invalid_request`) |
473
500
 
474
501
  A login lands in the store a turn with the same `env` uses (`CLAUDE_CONFIG_DIR`,
475
- `CODEX_HOME`). Claude reports the credential a turn would run with, so a key in
502
+ `CODEX_HOME`); Antigravity's is one system keyring entry per user, whatever
503
+ the `env`. Claude reports the credential a turn would run with, so a key in
476
504
  the environment shows as `source: "environment"` over any login. A login change
477
505
  starts each session's next turn on a new CLI. A Codex session on its home's own
478
506
  login also follows a change made outside the engine (`codex login` in a
@@ -558,14 +586,24 @@ What a product draws a terminal step, a fetch, a diff or a permission card
558
586
  from, without reading a harness's own input keys (LLP 0002, A tool call says
559
587
  what it acts on). A field a harness does not give is left out.
560
588
 
561
- | Field | claude-code | codex-app-server | acp |
562
- | --- | --- | --- | --- |
563
- | `command` (part and request) | a `Bash` call's `input.command` | the line apart from the shell Codex wraps it in (`/bin/zsh -lc '…'`), unquoted; any other shape as Codex reports it. `input.command` stays wrapped | none: an agent's `title` is all ACP v1 gives |
564
- | `url` | a `WebFetch` call's `input.url` | none: its network approval was not observed | none |
565
- | `locations` | a file tool's path; once an `Edit` or a `Write` over a file is done, each hunk at its start line in the new file | a file change's hunks, each at its start line in the new file; a move's source and destination; an add's or a delete's path | the agent's own |
566
- | `reason` (request) | the CLI's `decisionReason`, when it sends one ("Path is outside allowed working directories") | the approval's `reason`, the model's own justification. `title` is never it | none: ACP v1's request has no field for it |
567
- | `diff` content | from the CLI's structured result: an `Edit`'s or an overwriting `Write`'s hunks; a created file's content as `newText`; a `NotebookEdit`'s cell, `old_source` to `new_source`. None on a failed edit | a hunk per entry for an update (at a move's destination, without its `Moved to:` trailer); an add's content as `newText`; a delete's as `oldText`, `newText` `""`. None on a failed or declined change | the agent's `diff` and `terminal` content, as it sent them, the latest update's winning |
568
- | `metadata.exitCode` | on a failed `Bash` call only, from the `Exit code N` its result begins with: the CLI reports no code for a success, and counts some non-zero exits as one | Codex's `exitCode`, on a completed and a failed command alike | none |
589
+ | Field | claude-code | codex-app-server | gemini | acp |
590
+ | --- | --- | --- | --- | --- |
591
+ | `command` (part and request) | a `Bash` call's `input.command` | the line apart from the shell Codex wraps it in (`/bin/zsh -lc '…'`), unquoted; any other shape as Codex reports it. `input.command` stays wrapped | a `run_command` call's `CommandLine` | none: an agent's `title` is all ACP v1 gives |
592
+ | `url` | a `WebFetch` call's `input.url` | none: its network approval was not observed | none | none |
593
+ | `locations` | a file tool's path; once an `Edit` or a `Write` over a file is done, each hunk at its start line in the new file | a file change's hunks, each at its start line in the new file; a move's source and destination; an add's or a delete's path | the agent's own (macOS paths may come as `/private/tmp/…`) | the agent's own |
594
+ | `reason` (request) | the CLI's `decisionReason`, when it sends one ("Path is outside allowed working directories") | the approval's `reason`, the model's own justification. `title` is never it | none: ACP v1's request has no field for it | none: ACP v1's request has no field for it |
595
+ | `diff` content | from the CLI's structured result: an `Edit`'s or an overwriting `Write`'s hunks; a created file's content as `newText`; a `NotebookEdit`'s cell, `old_source` to `new_source`. None on a failed edit | a hunk per entry for an update (at a move's destination, without its `Moved to:` trailer); an add's content as `newText`; a delete's as `oldText`, `newText` `""`. None on a failed or declined change | the agent's own: a write's new text | the agent's `diff` and `terminal` content, as it sent them, the latest update's winning |
596
+ | `metadata.exitCode` | on a failed `Bash` call only, from the `Exit code N` its result begins with: the CLI reports no code for a success, and counts some non-zero exits as one | Codex's `exitCode`, on a completed and a failed command alike | a `run_command` call's `exit_code`; non-zero fails it | none |
597
+
598
+ The `gemini` harness also names an MCP call's server and tool (`mcp`): for a
599
+ server the engine passed, from Antigravity's `mcp_<server>_<tool>` against
600
+ the session's own server names (a space spelled `_`), the longest first,
601
+ and none when none fits; for one from a configuration file, the person's or
602
+ the project's, from `call_mcp_tool`'s `ServerName` and `ToolName`. A
603
+ command's `output` is what it printed, without Antigravity's lines about it,
604
+ and its exit code `metadata.exitCode`; a non-zero one fails it, though
605
+ Antigravity says `completed`. A write, a read and an MCP call to a server
606
+ the engine passed send no text, and their `output` is empty.
569
607
 
570
608
  Every tool the pinned Claude CLI offers has a decided `kind`. A Claude pin
571
609
  bump runs `bun run test:live:free`: its `claude-tool-kinds` check starts the
@@ -587,7 +625,7 @@ context and added lines; a `` marker is dropped.
587
625
  the raw provider string travels in `finishReason`.
588
626
  - `cost` is reported only by Claude; `reasoning` tokens by every harness whose
589
627
  backend counts them (Claude's thinking, Codex's reasoning, an ACP agent's
590
- thought tokens).
628
+ thought tokens). An ACP turn steered by prompt sums every prompt's answer.
591
629
  - Tool names are provider-native for Claude (`Bash`, `Read`) and normalized
592
630
  for Codex (`shell`, `apply_patch`, …) — but the tool `kind`
593
631
  (`read`/`edit`/`execute`/…) is normalized for all.
@@ -635,6 +673,89 @@ turn totals take precedence over intermediate message usage.
635
673
  cache accounting. An ACP/custom agent that exposes only this gauge cannot
636
674
  provide the cache breakdown without an additional native usage report.
637
675
 
676
+ ## The gemini harness
677
+
678
+ Gemini models through Google's Antigravity CLI (`agy acp`), on the person's
679
+ own Antigravity sign-in (LLP 0020). It is the ACP harness with a profile of
680
+ Antigravity's (`core/agents/gemini/`), and is in the default set.
681
+ It runs on the person's own sign-in only. A Gemini API key the product holds
682
+ was measured to work and is not built (LLP 0020, decision 13); a
683
+ `GEMINI_API_KEY` or `GOOGLE_API_KEY` in the engine's environment changes
684
+ nothing, and the sign-in stays in charge.
685
+
686
+ - **Its CLI:** `agy`, installed and pinned by the engine as Claude's and
687
+ Codex's are ([deploy.md](deploy.md#cli-provisioning-deterministic-agents)):
688
+ `$ANTIGRAVITY_CLI_PATH` (operator-level), then a bundle folder, then the
689
+ cache, then a download of the pin (1.5.14), checked against the sha512
690
+ Google's unsigned update manifest named for it when this release was made
691
+ (LLP 0010, Source kinds). The person's own (`~/.local/bin/agy`;
692
+ `%LOCALAPPDATA%\agy\bin\agy.exe` on Windows; then PATH) runs only in
693
+ `system` mode. Every start sets `AGY_CLI_DISABLE_AUTO_UPDATE=true` over
694
+ any environment a turn brings, and the terminal sign-in carries it, so the
695
+ pinned build is the one that runs; one older than 1.5.13 is refused.
696
+ - **Redistribution:** downloading agy onto the user's machine at run time
697
+ is what Google's own installer and the AUR and Chocolatey packages do.
698
+ Bundling it in an app or an image (`install --dir`) is copying and
699
+ distributing, which Google's terms do not grant: that is the operator's to
700
+ clear.
701
+ - **`inheritConfig`:** `all` only; a turn at `project` or `none` fails as
702
+ `invalid_request` before agy starts, while the login's status and the
703
+ model list answer at every level. Antigravity always loads the folder's
704
+ own rules, skills, MCP servers and hooks (`AGENTS.md`, `GEMINI.md`,
705
+ `.agents/`), so `none` cannot be; `project` needs an Antigravity home of
706
+ the session's own (`--gemini-dir`), not taken yet (LLP 0020, decision 11).
707
+ - **Skills, MCP servers and hooks:** the person's and the folder's load. A
708
+ skill runs by `/name` or when the request calls for one, and shows on the
709
+ stream as a `read` of its `SKILL.md`; a folder's MCP server starts at the
710
+ first prompt. Started in the session's folder, as the engine starts it,
711
+ Antigravity runs each of the folder's hooks twice (LLP 0020.000, Skills,
712
+ MCP servers and hooks in a session).
713
+ - **Models:** the account's Gemini models, read live ([Model lists](#model-lists));
714
+ a turn naming another model Antigravity offers (Claude, GPT-OSS, an
715
+ orchestrator) fails as `invalid_request`, and a turn naming none runs a
716
+ Gemini model even when the account's own default is another: the one the
717
+ list marks default.
718
+ - **Files:** images and text files; a PDF or another binary file fails the
719
+ turn before any process starts, since Antigravity drops them unread.
720
+ - **Steering:** a steer is a second `session/prompt`, sent in order, each
721
+ once the one before it was taken, and while the agent asks nothing (until
722
+ it reports on the tool call it asked about). One the agent refused because
723
+ a request of its own crossed it on the wire goes again in its place; one
724
+ refused otherwise is undelivered. Its echo sits before the first model
725
+ call that read it: the call running when it was taken finishes first. The turn ends when no prompt is in flight, with the newest
726
+ prompt's stop reason and every answer's usage (LLP 0016.000, An ACP agent
727
+ steered by prompt).
728
+ - **A failed model call:** Antigravity tells it as the turn's last text and
729
+ answers as if it succeeded; the engine ends that turn `error` instead
730
+ (LLP 0020, decision 12), with Google's own sentence and its status as the
731
+ message. A wrong key is `auth` ("API key not valid. Please pass a valid
732
+ API key.", with 400 or 401 by the key's shape), a used-up quota `rate_limit` (429), an
733
+ overloaded model `overloaded` (503), a broken connection `network`, an
734
+ executor error in other words by those words.
735
+ Antigravity retries a 429, a 503 and a network failure eight times over
736
+ 2.5 to 4.6 minutes, saying nothing meanwhile: a turn can be silent for
737
+ minutes, then fail. A stalled connection has no timeout: only a cancel
738
+ ends it.
739
+ - **Known limits:** after one denial in a batch, Antigravity fails every
740
+ call still pending without asking, with empty output, and ends the turn
741
+ with no text. A command that could not run (its folder gone) fails with
742
+ Antigravity's own line saying why. An agy that dies on its own leaves its
743
+ shell command running until it ends by itself. A one-line edit of a large
744
+ file carries the whole file on both sides of the diff, and an image goes
745
+ back out on the stream in the user message. A session folder that is not
746
+ a directory fails the turn as `process_exit`, naming the binary.
747
+ - **Background commands:** a command Antigravity sends to the background is
748
+ still running when its turn ends; the stream closes its part at
749
+ `turn.ended`, and its process ends with the session's agy, whose process
750
+ group the engine owns.
751
+ - **Questions:** the model's question comes as a form elicitation whose
752
+ `message` is only "The agent has a question.": show the form's field
753
+ titles, which hold the question and its options, not `message` alone.
754
+ - **The system prompt:** given once, with the conversation's start; a later
755
+ turn asking another is told it was not applied.
756
+ - **Not offered:** a credential the product holds, `maxTurns`,
757
+ `disableTools`, a plan's approval, cost.
758
+
638
759
  ## The scripted harness
639
760
 
640
761
  `scripted` plays a script instead of a model, so a product can test its whole
@@ -753,11 +874,12 @@ once. Unstable methods (`session/list`, `session/fork`, `session/delete`,
753
874
  | --- | --- | --- | --- |
754
875
  | `initialize` | protocol 1; `clientInfo` (`agent-server`, the stock program's release); advertises form and URL elicitation, no `fs`, no `terminal` | answers protocol 1; images; MCP transports per harness; `resume` and `close`; no `loadSession`; no auth methods | loopback, `acp-session-config`, `bin.test` |
755
876
  | `authenticate`, `authMethods` | never called: an agent signs in on its own, and a turn fails with its words | none offered | — |
756
- | `session/new` | the turn's folder, MCP servers, extra directories when advertised | a session, its modes | loopback |
877
+ | `logout` | the gemini harness's sign-out, where `initialize` has `auth.logout` | not offered | `gemini/login` |
878
+ | `session/new` | the turn's folder, MCP servers, extra directories when advertised; a profile's `_meta` (gemini's system prompt) | a session, its modes | loopback |
757
879
  | `session/resume` | when advertised | from memory, else the session record | loopback (a new engine), `acp-session-config` |
758
880
  | `session/load` | when no resume (the replay is dropped) | not offered | `acp-session-config` |
759
881
  | `session/close` | not sent: the agent's process is ended | ends the session's turn and process | `acp-close-during-turn`, loopback (process table) |
760
- | `session/prompt`, `session/cancel` | yes; a cancel confirmed when the prompt ends within 2 s | yes | loopback, `acp-cancel` |
882
+ | `session/prompt`, `session/cancel` | yes; a cancel confirmed when the prompts end within 2 s; a second prompt during a turn is a steer where the profile says so (gemini) | yes | loopback, `acp-cancel`, `acp-steering` |
761
883
  | `session/set_mode` | the turn's permission mode, by the agent's own id | `default`, `accept_edits`, `plan` and the operator's own | loopback, `acp-session-config`, `acp-binding-modes` |
762
884
  | `session/set_config_option` | `model` and `thought_level` | none offered: the operator's `--model`, `--thinking` | `acp-session-config`, `bin.test` |
763
885
  | `session/request_permission` | to the engine's broker (an option id back; edited input denies) | from the broker: `name`, `kind`, `locations`, `rawInput`; no `content` | loopback |
@@ -161,7 +161,8 @@ each increment. `openHistory` applies a checkpoint only at or before each
161
161
  segment's pinned cut, after verifying that prefix, then folds the tail; a newer
162
162
  checkpoint never substitutes for an older fork cut. A checkpoint in an unknown
163
163
  format is skipped and the events replayed, and `{checkpoints: false}` forces it.
164
- The format `agent-server.conversation.v1` changes whenever reducer semantics do.
164
+ The format (`agent-server.conversation.v2` since user messages carry `origin`)
165
+ changes whenever reducer semantics do.
165
166
  No method accepts an uploaded projection: stores build them from their own
166
167
  events, which stay authoritative.
167
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zvada/agent-server",
3
- "version": "0.3.26",
3
+ "version": "0.3.28",
4
4
  "description": "Harness-agnostic agent execution engine: run Claude Code, Codex (app-server), and any ACP agent behind one interface with a normalized event stream, multi-turn sessions, and resume. Root export is the wire contract; /core, /server, /client are the seats.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,6 +15,7 @@ import {
15
15
  type InitializeResult,
16
16
  type ModelList,
17
17
  type ModelsListParams,
18
+ type Origin,
18
19
  type PermissionOutcome,
19
20
  type RunningTurn,
20
21
  type SessionConfirmStoppedParams,
@@ -27,8 +28,10 @@ import {
27
28
  type TurnSteerParams,
28
29
  type TurnSteerResult,
29
30
  WIRE_ERROR_CODES,
31
+ WIRE_FEATURES,
30
32
  WIRE_METHODS,
31
33
  type WireTransport,
34
+ agentOrigin,
32
35
  decodeWireEventEnvelope,
33
36
  decodeWireMessage,
34
37
  generateUUIDv7,
@@ -321,7 +324,7 @@ export class AgentServerClient {
321
324
  // Before the first `await`: a cancel sent right behind this call goes out after the start.
322
325
  const release = this.starts.begin(sessionId, turnId);
323
326
  try {
324
- await this.initialize();
327
+ carriesOrigin(await this.initialize(), params.origin);
325
328
  if (this.turns.running(sessionId))
326
329
  throw new Error(`session ${sessionId} already has an active turn`);
327
330
  const handle = this.turns.open(sessionId, turnId, true);
@@ -335,6 +338,7 @@ export class AgentServerClient {
335
338
  (ack) => {
336
339
  if (!ack.terminal) this.joinAt(handle, ack.headSeq, { turnId });
337
340
  },
341
+ (server) => carriesOrigin(server, params.origin),
338
342
  );
339
343
  release();
340
344
  const accepted = await sending;
@@ -373,7 +377,7 @@ export class AgentServerClient {
373
377
  // As in `runTurn`: a cancel sent right behind this call goes out after the start.
374
378
  const release = this.starts.begin(sessionId, turnId);
375
379
  try {
376
- await this.initialize();
380
+ carriesOrigin(await this.initialize(), params.origin);
377
381
  // `request` sends (or fails for no connection) in this call.
378
382
  const answer = this.connection.request(
379
383
  WIRE_METHODS.turnStart,
@@ -382,6 +386,7 @@ export class AgentServerClient {
382
386
  if (params.subscribe !== false && !ack.terminal)
383
387
  this.streams.joined(sessionId, ack.headSeq, { turnId });
384
388
  },
389
+ (server) => carriesOrigin(server, params.origin),
385
390
  );
386
391
  release();
387
392
  return await answer;
@@ -431,7 +436,7 @@ export class AgentServerClient {
431
436
  * steer's user message, its receipt, reaches it.
432
437
  */
433
438
  async steerTurn(params: TurnSteerParams): Promise<TurnSteerResult> {
434
- await this.initialize();
439
+ carriesOrigin(await this.initialize(), params.origin);
435
440
  const { sessionId, turnId } = params;
436
441
  // One it cannot subscribe to still takes the steer; only its receipt is lost.
437
442
  if (!this.streams.follows(sessionId))
@@ -440,10 +445,12 @@ export class AgentServerClient {
440
445
  if (ack.activeTurn?.turnId === turnId)
441
446
  this.streams.joined(sessionId, ack.headSeq, { turnId });
442
447
  }).catch(() => undefined);
443
- return this.connection.resend(WIRE_METHODS.turnSteer, {
444
- ...params,
445
- steerId: params.steerId ?? generateUUIDv7(),
446
- });
448
+ return this.connection.resend(
449
+ WIRE_METHODS.turnSteer,
450
+ { ...params, steerId: params.steerId ?? generateUUIDv7() },
451
+ undefined,
452
+ (server) => carriesOrigin(server, params.origin),
453
+ );
447
454
  }
448
455
 
449
456
  /**
@@ -895,8 +902,14 @@ export class AgentServerClient {
895
902
  get catchUp() {
896
903
  return handle.catchUp;
897
904
  },
898
- steer: (input: AgentInput, steerId?: string) =>
899
- this.steerTurn({ sessionId, turnId, input, ...(steerId !== undefined && { steerId }) }),
905
+ steer: (input: AgentInput, steerId?: string, origin?: Origin) =>
906
+ this.steerTurn({
907
+ sessionId,
908
+ turnId,
909
+ input,
910
+ ...(steerId !== undefined && { steerId }),
911
+ ...(origin && { origin }),
912
+ }),
900
913
  };
901
914
  }
902
915
 
@@ -971,3 +984,17 @@ export class AgentServerClient {
971
984
  return this.connection.request(WIRE_METHODS.sessionSubscribe, params, onAnswer);
972
985
  }
973
986
  }
987
+
988
+ // @ref LLP 0019#origin-on-the-wire-and-to-the-model — fail closed: an origin a server would strip reads as the person's
989
+ /**
990
+ * Refuse to send another sender's input to a server that does not carry
991
+ * `origin`: its schema would drop the field, and the agent would read the
992
+ * message as the person's. The person's input goes anywhere.
993
+ */
994
+ function carriesOrigin(server: InitializeResult, origin: Origin | undefined): void {
995
+ if (!agentOrigin(origin)) return;
996
+ if (server.features?.includes(WIRE_FEATURES.origin)) return;
997
+ throw new Error(
998
+ "This server does not carry a message's origin (no `origin` in its features); nothing was sent. Upgrade the server, or send the input as the person's.",
999
+ );
1000
+ }
@@ -180,6 +180,10 @@ export class Connection {
180
180
  /** The server process (or, durable, the journal) whose logs the client follows. */
181
181
  private serverIdentity: string | undefined;
182
182
  private initializing: Promise<InitializeResult> | null = null;
183
+ /** The current transport's handshake, once answered; cleared when it is asked again. */
184
+ private negotiated: InitializeResult | undefined;
185
+ /** The transport `negotiated` was answered on: a feature check holds only for it. */
186
+ private negotiatedOn: WireTransport | null = null;
183
187
  private reconnecting = false;
184
188
  /** Ends the redial backoff early: `close()` must not wait it out. */
185
189
  private stopBackoff: (() => void) | null = null;
@@ -218,6 +222,10 @@ export class Connection {
218
222
  }
219
223
  if (transport.closed) throw new ConnectionClosedError("transport opened already closed");
220
224
  this.transport = transport;
225
+ // A new transport's server is not the old one's until its own handshake says so.
226
+ this.initializing = null;
227
+ this.negotiated = undefined;
228
+ this.negotiatedOn = null;
221
229
  this.host.opened(this.reconnecting);
222
230
  transport.onLine((line) => {
223
231
  if (this.transport === transport) this.host.line(line, transport);
@@ -230,6 +238,8 @@ export class Connection {
230
238
  * client for good: it rejects with `ProtocolVersionMismatchError`.
231
239
  */
232
240
  initialize(): Promise<InitializeResult> {
241
+ if (!this.initializing) this.negotiated = undefined;
242
+ const on = this.transport;
233
243
  this.initializing ??= this.request(WIRE_METHODS.initialize, {
234
244
  protocolVersion: WIRE_PROTOCOL_VERSION,
235
245
  client: this.options.clientInfo,
@@ -245,6 +255,8 @@ export class Connection {
245
255
  if (this.serverIdentity !== undefined && this.serverIdentity !== identity)
246
256
  this.host.serverChanged();
247
257
  this.serverIdentity = identity;
258
+ this.negotiated = result;
259
+ this.negotiatedOn = on;
248
260
  return result;
249
261
  })
250
262
  .catch((error: unknown) => {
@@ -280,11 +292,23 @@ export class Connection {
280
292
  method: M,
281
293
  params: WireParams<M>,
282
294
  onAnswer?: OnAnswer<WireDecodedResult<M>>,
295
+ /** Asked with the handshake of the very transport the request goes on; throw to send nothing. */
296
+ admit?: (server: InitializeResult) => void,
283
297
  ): Promise<WireDecodedResult<M>> {
284
298
  if (this.closed)
285
299
  return Promise.reject(this.refusal ?? new ConnectionClosedError("client closed"));
286
300
  const transport = this.transport;
287
301
  if (!transport) return Promise.reject(new ConnectionClosedError("not connected"));
302
+ if (admit) {
303
+ // This transport's handshake not answered yet: wait for it, then ask again.
304
+ if (this.negotiatedOn !== transport || !this.negotiated)
305
+ return this.initialize().then(() => this.request(method, params, onAnswer, admit));
306
+ try {
307
+ admit(this.negotiated);
308
+ } catch (error) {
309
+ return Promise.reject(error);
310
+ }
311
+ }
288
312
  return this.rpc.request(transport, method, params, WIRE_API[method].decode, onAnswer);
289
313
  }
290
314
 
@@ -301,11 +325,17 @@ export class Connection {
301
325
  method: M,
302
326
  params: WireParams<M>,
303
327
  onAnswer?: OnAnswer<WireDecodedResult<M>>,
328
+ /**
329
+ * Asked with the server this attempt goes to, before each send, re-sends
330
+ * included: a redial may reach another build of the server. Throw to send
331
+ * nothing (LLP 0019: an origin that server would strip).
332
+ */
333
+ admit?: (server: InitializeResult) => void,
304
334
  ): Promise<WireDecodedResult<M>> {
305
335
  for (let resends = 0; ; resends++) {
306
336
  const identity = this.serverIdentity;
307
337
  try {
308
- return await this.request(method, params, onAnswer);
338
+ return await this.request(method, params, onAnswer, admit);
309
339
  } catch (error) {
310
340
  if (!(error instanceof ConnectionClosedError) || !this.redials || resends >= MAX_RESENDS)
311
341
  throw error;
@@ -3,6 +3,7 @@ import {
3
3
  AsyncQueue,
4
4
  type DecodedLifecycleEvent,
5
5
  type DecodedWireEventEnvelope,
6
+ type Origin,
6
7
  type TurnEndedEvent,
7
8
  type TurnSteerResult,
8
9
  type UnknownEvent,
@@ -35,7 +36,7 @@ export interface TurnHandle {
35
36
  */
36
37
  readonly catchUp: number;
37
38
  /** Add input to this turn while it runs (see `AgentServerClient.steerTurn`). */
38
- steer(input: AgentInput, steerId?: string): Promise<TurnSteerResult>;
39
+ steer(input: AgentInput, steerId?: string, origin?: Origin): Promise<TurnSteerResult>;
39
40
  }
40
41
 
41
42
  /**