@zvada/agent-server 0.3.25 → 0.3.27

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 (256) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +4 -1
  3. package/dist/client/client.js +27 -11
  4. package/dist/client/connection.js +35 -3
  5. package/dist/core/agents/acp/acp-agent.js +91 -14
  6. package/dist/core/agents/acp/mappings.js +5 -1
  7. package/dist/core/agents/claude-code/approvals.js +3 -2
  8. package/dist/core/agents/claude-code/claude-agent.js +12 -2
  9. package/dist/core/agents/claude-code/mcp.js +9 -1
  10. package/dist/core/agents/claude-code/models.js +16 -10
  11. package/dist/core/agents/claude-code/options.js +23 -2
  12. package/dist/core/agents/claude-code/session.js +21 -1
  13. package/dist/core/agents/claude-code/tools.js +9 -4
  14. package/dist/core/agents/claude-code/turn.js +2 -0
  15. package/dist/core/agents/codex-app-server/adapter.js +2 -0
  16. package/dist/core/agents/codex-app-server/client.js +8 -5
  17. package/dist/core/agents/codex-app-server/codex-agent.js +35 -2
  18. package/dist/core/agents/codex-app-server/effort.js +13 -6
  19. package/dist/core/agents/codex-app-server/mcp.js +35 -18
  20. package/dist/core/agents/codex-app-server/models.js +10 -10
  21. package/dist/core/agents/codex-app-server/options.js +11 -2
  22. package/dist/core/agents/codex-app-server/plan-approval.js +1 -1
  23. package/dist/core/agents/codex-app-server/session.js +11 -4
  24. package/dist/core/agents/codex-app-server/thread-settings.js +30 -11
  25. package/dist/core/agents/host-tools.js +493 -0
  26. package/dist/core/agents/mcp-config.js +6 -2
  27. package/dist/core/agents/scripted/scripted-agent.js +39 -6
  28. package/dist/core/agents/scripted/steps.js +5 -1
  29. package/dist/core/agents/session-agent.js +70 -2
  30. package/dist/core/agents/thinking-levels.js +8 -5
  31. package/dist/core/index.js +1 -0
  32. package/dist/core/presets.js +16 -3
  33. package/dist/core/processes/lifeline.js +9 -5
  34. package/dist/core/provision/pins.js +7 -16
  35. package/dist/core/provision/releases.js +25 -25
  36. package/dist/core/proxy/loopback.js +22 -4
  37. package/dist/core/runtime/agent-runtime.js +15 -5
  38. package/dist/core/runtime/event-processor.js +13 -8
  39. package/dist/core/runtime/origin-line.js +42 -0
  40. package/dist/core/runtime/request-broker.js +2 -1
  41. package/dist/core/runtime/steering.js +4 -3
  42. package/dist/core/runtime/turn.js +6 -4
  43. package/dist/operator/errors.js +97 -0
  44. package/dist/operator/index.js +10 -5
  45. package/dist/operator/mcp.js +7 -12
  46. package/dist/operator/operator.js +1336 -380
  47. package/dist/operator/refs.js +59 -0
  48. package/dist/operator/render.js +171 -74
  49. package/dist/operator/session-tools.js +87 -0
  50. package/dist/operator/types.js +30 -0
  51. package/dist/operator/view.js +82 -27
  52. package/dist/protocol/config.js +33 -6
  53. package/dist/protocol/conversation.js +3 -0
  54. package/dist/protocol/history.js +2 -1
  55. package/dist/protocol/index.js +1 -0
  56. package/dist/protocol/lifecycle.js +19 -0
  57. package/dist/protocol/model-catalog.js +58 -18
  58. package/dist/protocol/models.js +6 -27
  59. package/dist/protocol/origin.js +39 -0
  60. package/dist/protocol/reduce.js +2 -0
  61. package/dist/protocol/thinking.js +22 -9
  62. package/dist/protocol/wire-api.js +2 -2
  63. package/dist/protocol/wire.js +17 -0
  64. package/dist/server/bin.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/acp-agent.d.ts +15 -0
  72. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  73. package/dist/types/core/agents/acp/mappings.d.ts +5 -1
  74. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  75. package/dist/types/core/agents/acp/requests.d.ts +2 -0
  76. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  77. package/dist/types/core/agents/base.d.ts +2 -0
  78. package/dist/types/core/agents/base.d.ts.map +1 -1
  79. package/dist/types/core/agents/claude-code/approvals.d.ts +2 -1
  80. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
  81. package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -0
  82. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  83. package/dist/types/core/agents/claude-code/mcp.d.ts +8 -1
  84. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
  85. package/dist/types/core/agents/claude-code/models.d.ts +9 -5
  86. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
  87. package/dist/types/core/agents/claude-code/options.d.ts +10 -1
  88. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  89. package/dist/types/core/agents/claude-code/session.d.ts +2 -0
  90. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  91. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
  92. package/dist/types/core/agents/claude-code/turn.d.ts +3 -0
  93. package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
  94. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
  95. package/dist/types/core/agents/codex-app-server/client.d.ts +2 -0
  96. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  97. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +11 -0
  98. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
  99. package/dist/types/core/agents/codex-app-server/effort.d.ts +7 -7
  100. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
  101. package/dist/types/core/agents/codex-app-server/mcp.d.ts +11 -3
  102. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
  103. package/dist/types/core/agents/codex-app-server/models.d.ts +4 -1
  104. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
  105. package/dist/types/core/agents/codex-app-server/options.d.ts +9 -2
  106. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
  107. package/dist/types/core/agents/codex-app-server/requests.d.ts +2 -0
  108. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
  109. package/dist/types/core/agents/codex-app-server/session.d.ts +6 -3
  110. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
  111. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
  112. package/dist/types/core/agents/host-tools.d.ts +162 -0
  113. package/dist/types/core/agents/host-tools.d.ts.map +1 -0
  114. package/dist/types/core/agents/mcp-config.d.ts +11 -2
  115. package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
  116. package/dist/types/core/agents/scripted/scripted-agent.d.ts +14 -1
  117. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
  118. package/dist/types/core/agents/scripted/steps.d.ts.map +1 -1
  119. package/dist/types/core/agents/session-agent.d.ts +2 -7
  120. package/dist/types/core/agents/session-agent.d.ts.map +1 -1
  121. package/dist/types/core/agents/thinking-levels.d.ts +7 -3
  122. package/dist/types/core/agents/thinking-levels.d.ts.map +1 -1
  123. package/dist/types/core/index.d.ts +1 -0
  124. package/dist/types/core/index.d.ts.map +1 -1
  125. package/dist/types/core/presets.d.ts +11 -1
  126. package/dist/types/core/presets.d.ts.map +1 -1
  127. package/dist/types/core/processes/lifeline.d.ts.map +1 -1
  128. package/dist/types/core/provision/pins.d.ts +5 -4
  129. package/dist/types/core/provision/pins.d.ts.map +1 -1
  130. package/dist/types/core/proxy/loopback.d.ts.map +1 -1
  131. package/dist/types/core/runtime/agent-runtime.d.ts +4 -2
  132. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  133. package/dist/types/core/runtime/event-processor.d.ts +2 -2
  134. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  135. package/dist/types/core/runtime/origin-line.d.ts +15 -0
  136. package/dist/types/core/runtime/origin-line.d.ts.map +1 -0
  137. package/dist/types/core/runtime/request-broker.d.ts +1 -1
  138. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  139. package/dist/types/core/runtime/steering.d.ts +7 -4
  140. package/dist/types/core/runtime/steering.d.ts.map +1 -1
  141. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  142. package/dist/types/operator/errors.d.ts +83 -0
  143. package/dist/types/operator/errors.d.ts.map +1 -0
  144. package/dist/types/operator/index.d.ts +10 -5
  145. package/dist/types/operator/index.d.ts.map +1 -1
  146. package/dist/types/operator/mcp.d.ts +1 -1
  147. package/dist/types/operator/mcp.d.ts.map +1 -1
  148. package/dist/types/operator/operator.d.ts +15 -197
  149. package/dist/types/operator/operator.d.ts.map +1 -1
  150. package/dist/types/operator/refs.d.ts +25 -0
  151. package/dist/types/operator/refs.d.ts.map +1 -0
  152. package/dist/types/operator/render.d.ts +59 -19
  153. package/dist/types/operator/render.d.ts.map +1 -1
  154. package/dist/types/operator/session-tools.d.ts +61 -0
  155. package/dist/types/operator/session-tools.d.ts.map +1 -0
  156. package/dist/types/operator/types.d.ts +441 -0
  157. package/dist/types/operator/types.d.ts.map +1 -0
  158. package/dist/types/operator/view.d.ts +19 -29
  159. package/dist/types/operator/view.d.ts.map +1 -1
  160. package/dist/types/protocol/config.d.ts +32 -24
  161. package/dist/types/protocol/config.d.ts.map +1 -1
  162. package/dist/types/protocol/conversation.d.ts +48 -39
  163. package/dist/types/protocol/conversation.d.ts.map +1 -1
  164. package/dist/types/protocol/execution.d.ts +2 -18
  165. package/dist/types/protocol/execution.d.ts.map +1 -1
  166. package/dist/types/protocol/history.d.ts +1 -1
  167. package/dist/types/protocol/history.d.ts.map +1 -1
  168. package/dist/types/protocol/index.d.ts +1 -0
  169. package/dist/types/protocol/index.d.ts.map +1 -1
  170. package/dist/types/protocol/lifecycle.d.ts +48 -74
  171. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  172. package/dist/types/protocol/model-catalog.d.ts.map +1 -1
  173. package/dist/types/protocol/models.d.ts +4 -42
  174. package/dist/types/protocol/models.d.ts.map +1 -1
  175. package/dist/types/protocol/origin.d.ts +49 -0
  176. package/dist/types/protocol/origin.d.ts.map +1 -0
  177. package/dist/types/protocol/reduce.d.ts.map +1 -1
  178. package/dist/types/protocol/thinking.d.ts +19 -19
  179. package/dist/types/protocol/thinking.d.ts.map +1 -1
  180. package/dist/types/protocol/wire-api.d.ts +59 -106
  181. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  182. package/dist/types/protocol/wire.d.ts +81 -119
  183. package/dist/types/protocol/wire.d.ts.map +1 -1
  184. package/dist/types/server/routes.d.ts.map +1 -1
  185. package/docs/consuming.md +124 -132
  186. package/docs/deploy.md +6 -5
  187. package/docs/harnesses.md +79 -31
  188. package/docs/sync-history.md +2 -1
  189. package/package.json +4 -4
  190. package/src/client/client.ts +36 -9
  191. package/src/client/connection.ts +31 -1
  192. package/src/client/turns.ts +2 -1
  193. package/src/core/agents/acp/acp-agent.ts +123 -17
  194. package/src/core/agents/acp/mappings.ts +5 -1
  195. package/src/core/agents/acp/requests.ts +2 -0
  196. package/src/core/agents/base.ts +2 -0
  197. package/src/core/agents/claude-code/approvals.ts +4 -3
  198. package/src/core/agents/claude-code/claude-agent.ts +14 -2
  199. package/src/core/agents/claude-code/mcp.ts +11 -1
  200. package/src/core/agents/claude-code/models.ts +15 -10
  201. package/src/core/agents/claude-code/options.ts +33 -3
  202. package/src/core/agents/claude-code/session.ts +26 -1
  203. package/src/core/agents/claude-code/tools.ts +10 -4
  204. package/src/core/agents/claude-code/turn.ts +4 -0
  205. package/src/core/agents/codex-app-server/adapter.ts +2 -0
  206. package/src/core/agents/codex-app-server/client.ts +11 -5
  207. package/src/core/agents/codex-app-server/codex-agent.ts +45 -1
  208. package/src/core/agents/codex-app-server/effort.ts +15 -20
  209. package/src/core/agents/codex-app-server/mcp.ts +46 -23
  210. package/src/core/agents/codex-app-server/models.ts +10 -10
  211. package/src/core/agents/codex-app-server/options.ts +16 -2
  212. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  213. package/src/core/agents/codex-app-server/requests.ts +2 -0
  214. package/src/core/agents/codex-app-server/session.ts +19 -4
  215. package/src/core/agents/codex-app-server/thread-settings.ts +31 -11
  216. package/src/core/agents/host-tools.ts +649 -0
  217. package/src/core/agents/mcp-config.ts +15 -3
  218. package/src/core/agents/scripted/scripted-agent.ts +51 -5
  219. package/src/core/agents/scripted/steps.ts +5 -1
  220. package/src/core/agents/session-agent.ts +78 -2
  221. package/src/core/agents/thinking-levels.ts +9 -6
  222. package/src/core/index.ts +9 -0
  223. package/src/core/presets.ts +28 -4
  224. package/src/core/processes/lifeline.ts +9 -5
  225. package/src/core/provision/pins.ts +7 -16
  226. package/src/core/provision/releases.ts +25 -25
  227. package/src/core/proxy/loopback.ts +25 -4
  228. package/src/core/runtime/agent-runtime.ts +31 -7
  229. package/src/core/runtime/event-processor.ts +13 -6
  230. package/src/core/runtime/origin-line.ts +43 -0
  231. package/src/core/runtime/request-broker.ts +2 -0
  232. package/src/core/runtime/steering.ts +8 -4
  233. package/src/core/runtime/turn.ts +11 -4
  234. package/src/operator/errors.ts +218 -0
  235. package/src/operator/index.ts +18 -23
  236. package/src/operator/mcp.ts +7 -16
  237. package/src/operator/operator.ts +1583 -613
  238. package/src/operator/refs.ts +75 -0
  239. package/src/operator/render.ts +208 -98
  240. package/src/operator/session-tools.ts +126 -0
  241. package/src/operator/types.ts +505 -0
  242. package/src/operator/view.ts +93 -42
  243. package/src/protocol/config.ts +36 -7
  244. package/src/protocol/conversation.ts +3 -0
  245. package/src/protocol/history.ts +2 -1
  246. package/src/protocol/index.ts +1 -0
  247. package/src/protocol/lifecycle.ts +21 -0
  248. package/src/protocol/model-catalog.ts +58 -18
  249. package/src/protocol/models.ts +6 -26
  250. package/src/protocol/origin.ts +47 -0
  251. package/src/protocol/reduce.ts +4 -0
  252. package/src/protocol/thinking.ts +27 -14
  253. package/src/protocol/wire-api.ts +2 -2
  254. package/src/protocol/wire.ts +18 -0
  255. package/src/server/bin.ts +6 -4
  256. package/src/server/routes.ts +16 -5
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AgentHarnessSchema } from "./harness.js";
3
+ import { OriginSchema, agentOrigin } from "./origin.js";
3
4
  import { AgentInputSchema } from "./part-input.js";
4
5
  import { ThinkingLevelSchema } from "./thinking.js";
5
6
  import { openVocabulary } from "./vocabulary.js";
@@ -19,7 +20,7 @@ export const PermissionModeSchema = z.enum([
19
20
  "bypass_permissions",
20
21
  ]);
21
22
  export const ReportedPermissionModeSchema = openVocabulary(PermissionModeSchema.options);
22
- /** The longest `requestTimeoutMs`: a timer's own limit, about 24.8 days. */
23
+ /** The longest `requestTimeoutMs` and the longest MCP `timeoutMs`: a timer's own limit, about 24.8 days. */
23
24
  export const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
24
25
  /**
25
26
  * Whether a turn needs the server (default `true`). A turn fails before the
@@ -29,6 +30,23 @@ export const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
29
30
  * agent connects its servers itself and decides.
30
31
  */
31
32
  const required = z.boolean().optional();
33
+ /**
34
+ * How long one call to one of the server's tools may run, in milliseconds,
35
+ * on any transport: past it the call fails, and the model is told it timed out.
36
+ * - Claude: the server's `timeout`. A value under 1000 is ignored, as if unset.
37
+ * Unset, a call to an HTTP or SSE server is cut at 60 s unless
38
+ * `MCP_TOOL_TIMEOUT` (ms) is in the turn's or the engine's environment; a
39
+ * call to a stdio server is not cut at 60 s (one ran 70 s), and Claude's
40
+ * own longer limits still apply.
41
+ * - Codex: the server's `tool_timeout_sec`, in whole seconds rounded up
42
+ * (1118 cuts a call at 2 s), as Codex reads a fraction back changed.
43
+ * Unset, a call is cut at 300 s.
44
+ * - An ACP agent is not given it (ACP v1 has no such field): the agent keeps
45
+ * its own limit, if it has one.
46
+ * At most `MAX_REQUEST_TIMEOUT_MS`, a timer's own limit; a larger value is refused.
47
+ * A changed value applies from the next turn of a warm session.
48
+ */
49
+ const timeoutMs = z.number().int().positive().max(MAX_REQUEST_TIMEOUT_MS).optional();
32
50
  /** Minimal external MCP server descriptor (stdio or http/sse). */
33
51
  export const McpServerConfigSchema = z.discriminatedUnion("type", [
34
52
  z.object({
@@ -37,18 +55,21 @@ export const McpServerConfigSchema = z.discriminatedUnion("type", [
37
55
  args: z.array(z.string()).optional(),
38
56
  env: z.record(z.string(), z.string()).optional(),
39
57
  required,
58
+ timeoutMs,
40
59
  }),
41
60
  z.object({
42
61
  type: z.literal("http"),
43
62
  url: z.string(),
44
63
  headers: z.record(z.string(), z.string()).optional(),
45
64
  required,
65
+ timeoutMs,
46
66
  }),
47
67
  z.object({
48
68
  type: z.literal("sse"),
49
69
  url: z.string(),
50
70
  headers: z.record(z.string(), z.string()).optional(),
51
71
  required,
72
+ timeoutMs,
52
73
  }),
53
74
  ]);
54
75
  /** Everything needed to configure a turn against a harness. */
@@ -124,14 +145,20 @@ export const RunRequestSchema = z.object({
124
145
  turnId: z.string(),
125
146
  input: AgentInputSchema,
126
147
  config: RunConfigSchema,
148
+ /** Who sent the input; absent is the person (`OriginSchema`). */
149
+ origin: OriginSchema.optional(),
127
150
  });
151
+ // @ref LLP 0019#origin-on-the-wire-and-to-the-model — another sender is another turn
128
152
  /**
129
- * What makes a turn the same turn when a client sends its ids again: its input
130
- * and the config that shapes what the agent does. What a client's own restart
131
- * can change without making it another turn stays out: MCP endpoints (a fresh
132
- * per-session URL), the environment, the API key, and raw passthrough.
153
+ * What makes a turn the same turn when a client sends its ids again: its
154
+ * input, who sent it, and the config that shapes what the agent does. What a
155
+ * client's own restart can change without making it another turn stays out:
156
+ * MCP endpoints (a fresh per-session URL), the environment, the API key, and
157
+ * raw passthrough. The person's origin, said or not, adds nothing, so a
158
+ * request's identity is what it was before origins existed.
133
159
  */
134
160
  export function turnIdentity(request) {
135
161
  const { mcpServers: _mcp, env: _env, apiKey: _key, includeRaw: _raw, ...config } = request.config;
136
- return { input: request.input, config };
162
+ const origin = agentOrigin(request.origin);
163
+ return { input: request.input, config, ...(origin && { origin }) };
137
164
  }
@@ -4,6 +4,7 @@ import { ErrorCategorySchema, ErrorInfoSchema } from "./errors.js";
4
4
  import { TurnExecutionSchema } from "./execution.js";
5
5
  import { HarnessIdSchema } from "./harness.js";
6
6
  import { CompactionStatusSchema, CompactionTriggerSchema, ElicitationOutcomeSchema, ElicitationRequestedEventSchema, ErrorEventSchema, LimitStatusSchema, LimitWindowSchema, PermissionOutcomeSchema, PermissionRequestedEventSchema, SessionEndReasonSchema, StopReasonSchema, UnknownEventSchema, } from "./lifecycle.js";
7
+ import { ReportedOriginSchema } from "./origin.js";
7
8
  import { PartSchema, UnknownPartSchema } from "./parts.js";
8
9
  import { EpochMsSchema } from "./time.js";
9
10
  import { DEFAULT_TOKEN_USAGE, TokenUsageSchema } from "./tokens.js";
@@ -24,6 +25,8 @@ export const ConversationMessageSchema = z.object({
24
25
  /** Set when this is a sub-agent's output — nest it under that tool call. */
25
26
  parentToolCallId: z.string().optional(),
26
27
  model: z.string().optional(),
28
+ /** A user message's sender when it is not the person (`message.started`'s `origin`). */
29
+ origin: ReportedOriginSchema.optional(),
27
30
  parts: z.array(z.union([PartSchema, UnknownPartSchema])),
28
31
  startedAt: EpochMsSchema,
29
32
  endedAt: EpochMsSchema.optional(),
@@ -155,7 +155,8 @@ export const HistoryWaitSchema = z.object({
155
155
  });
156
156
  /** Projection cache format changes whenever reducer semantics become incompatible.
157
157
  * Raw canonical events remain authoritative and are never pruned by this cache. */
158
- export const CONVERSATION_CHECKPOINT_FORMAT = "agent-server.conversation.v1";
158
+ // v2: user messages carry `origin` (LLP 0019); a v1 checkpoint was folded without it.
159
+ export const CONVERSATION_CHECKPOINT_FORMAT = "agent-server.conversation.v2";
159
160
  export const HistoryCheckpointRequestSchema = z.object({ through: HistoryVersionSchema });
160
161
  export const HistoryCheckpointSchema = z.object({
161
162
  version: HistoryVersionSchema,
@@ -20,6 +20,7 @@ export * from "./clis.js";
20
20
  export * from "./account.js";
21
21
  export * from "./auth.js";
22
22
  export * from "./credentials.js";
23
+ export * from "./origin.js";
23
24
  export * from "./config.js";
24
25
  export * from "./execution.js";
25
26
  export * from "./lifecycle.js";
@@ -5,6 +5,7 @@ import { TurnExecutionSchema } from "./execution.js";
5
5
  import { isKnownLifecycleEventType } from "./guards.js";
6
6
  import { HarnessIdSchema } from "./harness.js";
7
7
  import { MetaSchema } from "./meta.js";
8
+ import { ReportedOriginSchema } from "./origin.js";
8
9
  import { PartSchema, decodePart } from "./parts.js";
9
10
  import { EpochMsSchema } from "./time.js";
10
11
  import { TokenUsageSchema } from "./tokens.js";
@@ -244,6 +245,12 @@ export const MessageStartedEventSchema = z.object({
244
245
  * the turn asked for.
245
246
  */
246
247
  model: z.string().optional(),
248
+ /**
249
+ * A user message's sender when it is not the person: the request's
250
+ * `origin`, the turn's echo and a steer's alike. Absent on the person's
251
+ * messages and on every assistant message.
252
+ */
253
+ origin: ReportedOriginSchema.optional(),
247
254
  ...stamped,
248
255
  });
249
256
  /**
@@ -365,10 +372,22 @@ export const PermissionOutcomeSchema = z.discriminatedUnion("outcome", [
365
372
  * `options` is THE source of buttons — clients render the server's list,
366
373
  * never derive affordances from local policy.
367
374
  */
375
+ // @ref LLP 0019#answer_request-write — the kind of a request is said, never read from its options
376
+ /**
377
+ * What a permission request decides. OPEN: `tool`, whether a tool call may
378
+ * run (every built-in harness's tool approvals, and an ACP agent's, whose
379
+ * requests are tool-scoped); `plan`, whether to leave planning and carry out
380
+ * a plan (Claude's and Codex's plan approvals). A value this build does not
381
+ * know, or none, is read as `tool`: the stricter one.
382
+ */
383
+ export const PERMISSION_PURPOSES = ["tool", "plan"];
384
+ export const PermissionPurposeSchema = openVocabulary(PERMISSION_PURPOSES);
368
385
  export const PermissionRequestedEventSchema = z.object({
369
386
  type: z.literal("permission.requested"),
370
387
  ...inTurn,
371
388
  requestId: z.string(),
389
+ /** What it decides; absent on an older engine's events, which read as `tool`. */
390
+ purpose: PermissionPurposeSchema.optional(),
372
391
  /** Human-readable one-line prompt, always present (render this). */
373
392
  title: z.string(),
374
393
  /**
@@ -1,8 +1,8 @@
1
1
  /** What the pinned CLIs listed for the maintainer's login when this release was built. */
2
2
  export const GENERATED_MODEL_CATALOG = {
3
3
  cli: {
4
- claude: "0.3.288",
5
- codex: "0.160.0",
4
+ claude: "0.3.327",
5
+ codex: "0.169.1",
6
6
  },
7
7
  models: [
8
8
  {
@@ -26,6 +26,16 @@ export const GENERATED_MODEL_CATALOG = {
26
26
  levels: ["low", "medium", "high", "xhigh", "max"],
27
27
  },
28
28
  },
29
+ {
30
+ id: "fable",
31
+ harness: "claude-code",
32
+ label: "Fable 5.2",
33
+ description: "For your toughest challenges",
34
+ resolvedId: "claude-fable-5-2",
35
+ thinking: {
36
+ levels: ["low", "medium", "high", "xhigh", "max"],
37
+ },
38
+ },
29
39
  {
30
40
  id: "sonnet",
31
41
  harness: "claude-code",
@@ -37,21 +47,29 @@ export const GENERATED_MODEL_CATALOG = {
37
47
  },
38
48
  },
39
49
  {
40
- id: "fable",
50
+ id: "haiku",
51
+ harness: "claude-code",
52
+ label: "Haiku 5.5",
53
+ description: "Fastest for quick answers",
54
+ resolvedId: "claude-haiku-5-5",
55
+ thinking: {
56
+ levels: ["low", "medium", "high", "xhigh", "max"],
57
+ },
58
+ },
59
+ {
60
+ id: "claude-fable-5-1",
41
61
  harness: "claude-code",
42
62
  label: "Fable 5.1",
43
63
  description: "Most capable for your hardest and longest-running tasks",
44
- resolvedId: "claude-fable-5-1",
45
64
  thinking: {
46
65
  levels: ["low", "medium", "high", "xhigh", "max"],
47
66
  },
48
67
  },
49
68
  {
50
- id: "haiku",
69
+ id: "claude-haiku-4-5-20251001",
51
70
  harness: "claude-code",
52
71
  label: "Haiku 4.5",
53
72
  description: "Fastest for quick answers",
54
- resolvedId: "claude-haiku-4-5-20251001",
55
73
  thinking: {
56
74
  levels: [],
57
75
  },
@@ -120,10 +138,10 @@ export const GENERATED_MODEL_CATALOG = {
120
138
  },
121
139
  },
122
140
  {
123
- id: "gpt-6.1-sol",
141
+ id: "gpt-6.2-sol",
124
142
  harness: "codex-app-server",
125
- label: "GPT-6.1-Sol",
126
- description: "Latest workhorse model for coding and everyday work.",
143
+ label: "GPT-6.2-Sol",
144
+ description: "Fast, go-to model for coding and everyday work.",
127
145
  isDefault: true,
128
146
  thinking: {
129
147
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
@@ -132,13 +150,13 @@ export const GENERATED_MODEL_CATALOG = {
132
150
  images: true,
133
151
  },
134
152
  {
135
- id: "gpt-6-astra",
153
+ id: "gpt-6.2-astra",
136
154
  harness: "codex-app-server",
137
- label: "GPT-6-Astra",
138
- description: "Frontier intelligence for the most demanding work.",
155
+ label: "GPT-6.2-Astra",
156
+ description: "Our most capable model for complex coding and professional work.",
139
157
  thinking: {
140
158
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
141
- default: "medium",
159
+ default: "low",
142
160
  },
143
161
  images: true,
144
162
  },
@@ -146,18 +164,40 @@ export const GENERATED_MODEL_CATALOG = {
146
164
  id: "gpt-6.1-terra",
147
165
  harness: "codex-app-server",
148
166
  label: "GPT-6.1 Terra",
149
- description: "GPT-6.1 Terra Codex model.",
167
+ description: "Efficient model that excels at visual understanding and computer use.",
168
+ thinking: {
169
+ levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
170
+ default: "low",
171
+ },
172
+ images: true,
173
+ },
174
+ {
175
+ id: "gpt-6.1-sol",
176
+ harness: "codex-app-server",
177
+ label: "GPT-6.1-Sol",
178
+ description: "Previous generation model for coding and everyday work.",
150
179
  thinking: {
151
180
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
152
181
  default: "low",
153
182
  },
154
183
  images: true,
155
184
  },
185
+ {
186
+ id: "gpt-6-astra",
187
+ harness: "codex-app-server",
188
+ label: "GPT-6-Astra",
189
+ description: "Previous generation model for complex coding and professional work.",
190
+ thinking: {
191
+ levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
192
+ default: "medium",
193
+ },
194
+ images: true,
195
+ },
156
196
  {
157
197
  id: "gpt-6-sol",
158
198
  harness: "codex-app-server",
159
199
  label: "GPT-6-Sol",
160
- description: "Previous generation workhorse model.",
200
+ description: "Legacy model for coding and everyday work.",
161
201
  thinking: {
162
202
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
163
203
  default: "medium",
@@ -179,7 +219,7 @@ export const GENERATED_MODEL_CATALOG = {
179
219
  id: "gpt-5.6-sol",
180
220
  harness: "codex-app-server",
181
221
  label: "GPT-5.6-Sol",
182
- description: "Older generation workhorse model.",
222
+ description: "Legacy model for coding and everyday work.",
183
223
  thinking: {
184
224
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
185
225
  default: "low",
@@ -190,7 +230,7 @@ export const GENERATED_MODEL_CATALOG = {
190
230
  id: "gpt-5.6-terra",
191
231
  harness: "codex-app-server",
192
232
  label: "GPT-5.6-Terra",
193
- description: "Older balanced model for straightforward work.",
233
+ description: "Legacy balanced model for agentic coding.",
194
234
  thinking: {
195
235
  levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
196
236
  default: "medium",
@@ -201,7 +241,7 @@ export const GENERATED_MODEL_CATALOG = {
201
241
  id: "gpt-5.6-luna",
202
242
  harness: "codex-app-server",
203
243
  label: "GPT-5.6-Luna",
204
- description: "Older fast and efficient model.",
244
+ description: "Legacy fast model for simpler tasks.",
205
245
  thinking: {
206
246
  levels: ["low", "medium", "high", "xhigh", "max"],
207
247
  default: "medium",
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { AgentHarnessSchema } from "./harness.js";
3
3
  import { MetaSchema } from "./meta.js";
4
4
  import { GENERATED_MODEL_CATALOG } from "./model-catalog.js";
5
- import { ThinkingLevelSchema, isThinkingLevel } from "./thinking.js";
5
+ import { ThinkingLevelSchema } from "./thinking.js";
6
6
  import { EpochMsSchema } from "./time.js";
7
7
  /**
8
8
  * One model a harness can run, in the same shape for every harness. Claude
@@ -19,7 +19,11 @@ export const ModelDescriptorSchema = z.object({
19
19
  /** The model a turn runs when its config names none. */
20
20
  isDefault: z.boolean().optional(),
21
21
  thinking: z.object({
22
- /** The levels the model runs as distinct settings, lowest first. Empty: no thinking control. */
22
+ /**
23
+ * The levels the model runs as distinct settings, by the harness's own
24
+ * names and in its order (both CLIs list lowest first); a name may be
25
+ * one this build does not know. Empty: no thinking control.
26
+ */
23
27
  levels: z.array(ThinkingLevelSchema),
24
28
  /** The model's own default, when the harness states one. Never invented. */
25
29
  default: ThinkingLevelSchema.optional(),
@@ -47,31 +51,6 @@ export const ModelListSchema = z.object({
47
51
  /** When the list was read. */
48
52
  fetchedAt: EpochMsSchema,
49
53
  });
50
- /**
51
- * Parse a model list from a server that may be newer than this build: a
52
- * thinking level this build does not know is dropped from `levels` (and from
53
- * `default`) instead of failing the whole list.
54
- */
55
- export function decodeModelList(value) {
56
- const raw = value;
57
- if (!Array.isArray(raw?.models))
58
- return ModelListSchema.parse(value);
59
- const models = raw.models.map((model) => {
60
- const thinking = model?.thinking;
61
- if (!thinking || typeof thinking !== "object")
62
- return model;
63
- const levels = Array.isArray(thinking.levels)
64
- ? thinking.levels.filter((level) => typeof level === "string" && isThinkingLevel(level))
65
- : thinking.levels;
66
- const known = typeof thinking.default === "string" && isThinkingLevel(thinking.default);
67
- const { default: _dropped, ...rest } = thinking;
68
- return {
69
- ...model,
70
- thinking: { ...rest, levels, ...(known && { default: thinking.default }) },
71
- };
72
- });
73
- return ModelListSchema.parse({ ...value, models });
74
- }
75
54
  /**
76
55
  * The models each harness's pinned CLI listed when this release was built
77
56
  * (`bun run models:refresh`), for a picker without a live list. The live list
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ // @ref LLP 0019#origin-on-the-wire-and-to-the-model — who sent a message, carried from the request to the echo
3
+ /**
4
+ * Who sent a turn's or a steer's message. Absent, or `person`, is the person
5
+ * the product serves; anything else is an agent, and the engine tells the
6
+ * receiving model so in one line before the input it is given. `name` is the
7
+ * host's, untrusted: the engine quotes it.
8
+ */
9
+ /**
10
+ * The longest id or name an origin carries, in UTF-16 units: at most 765
11
+ * bytes of UTF-8, under the 1 KiB below which a journal never cuts a string
12
+ * to fit (`sync/fit.ts`), so a kept origin reads back exactly as it was sent.
13
+ * The line the model reads clips a name further, to 200 characters.
14
+ */
15
+ export const ORIGIN_FIELD_MAX = 255;
16
+ const field = z.string().min(1).max(ORIGIN_FIELD_MAX);
17
+ export const OriginSchema = z.discriminatedUnion("kind", [
18
+ z.object({ kind: z.literal("person") }),
19
+ /** Another session; `name` is how the host's tools name it (`deus/voyager:2`). */
20
+ z.object({ kind: z.literal("session"), sessionId: field, name: field.optional() }),
21
+ /** An outside assistant the person connected. */
22
+ z.object({ kind: z.literal("assistant"), id: field, name: field }),
23
+ ]);
24
+ const KNOWN_ORIGIN_KINDS = ["person", "session", "assistant"];
25
+ /**
26
+ * An origin as the stream reports it (the user message's `origin`): one this
27
+ * build knows, or a newer engine's kind, kept intact rather than refused.
28
+ */
29
+ export const ReportedOriginSchema = z.union([
30
+ OriginSchema,
31
+ // A kind this build does not know, kept whole; a known kind must be well formed.
32
+ z
33
+ .looseObject({ kind: z.string().min(1).regex(/\S/, "must not be blank") })
34
+ .refine((origin) => !KNOWN_ORIGIN_KINDS.includes(origin.kind), "a malformed known origin"),
35
+ ]);
36
+ /** The origin as the engine carries it: undefined for the person, whose messages carry none. */
37
+ export function agentOrigin(origin) {
38
+ return origin && origin.kind !== "person" ? origin : undefined;
39
+ }
@@ -61,6 +61,8 @@ function openMessage(state, init, record) {
61
61
  // depth alongside the producer gate: a hand-built or replayed
62
62
  // `message.started{role:"user", model}` does not leak into the fold.
63
63
  ...(init.role === "assistant" && init.model !== undefined && { model: init.model }),
64
+ // Who sent a user message, when not the person; never on the agent's own.
65
+ ...(init.role === "user" && init.origin !== undefined && { origin: init.origin }),
64
66
  parts: [],
65
67
  startedAt: init.timestamp,
66
68
  };
@@ -1,27 +1,40 @@
1
- import { z } from "zod";
1
+ import { openVocabulary } from "./vocabulary.js";
2
2
  /**
3
3
  * A single, harness-agnostic reasoning dial. Each harness maps it to its own
4
4
  * native control: Claude -> adaptive `thinking` + `effort`; Codex ->
5
- * `ReasoningEffort`. What runs depends on the model: Claude's ceiling is `max`
6
- * (it runs `ultra` as `max`), and Codex runs the nearest level the model
7
- * accepts.
5
+ * `ReasoningEffort`. What runs depends on the model: each harness runs the
6
+ * nearest level the model accepts (`ultra` on a Claude model topping out at
7
+ * `max` runs `max`).
8
+ *
9
+ * The levels this build knows, in order, lowest first. A harness may list
10
+ * others for a model: the names are an open vocabulary, the harness's own.
8
11
  */
9
12
  export const THINKING_LEVELS = ["off", "low", "medium", "high", "xhigh", "max", "ultra"];
10
- export const ThinkingLevelSchema = z.enum(THINKING_LEVELS);
13
+ // @ref LLP 0002#open-vocabularies — a level a harness lists is kept, known or not
14
+ export const ThinkingLevelSchema = openVocabulary(THINKING_LEVELS);
15
+ /** Whether `v` is a level this build knows. */
11
16
  export function isThinkingLevel(v) {
12
17
  return THINKING_LEVELS.includes(v);
13
18
  }
14
19
  const rank = (level) => THINKING_LEVELS.indexOf(level);
15
20
  /**
16
- * The level a model runs when it offers only `supported`: the highest one at
17
- * or below `level`, else its lowest. Use it when switching models, so `ultra`
18
- * on a model topping out at `max` becomes `max`, not a fixed fallback.
19
- * `undefined` when the model offers none.
21
+ * The level a model runs when it offers only `supported`. A level it lists is
22
+ * itself. Otherwise, for a level this build knows, the highest known level it
23
+ * lists at or below `level`, else its lowest known one: use it when switching
24
+ * models, so `ultra` on a model topping out at `max` becomes `max`, not a
25
+ * fixed fallback. `undefined` for a level this build does not know and the
26
+ * model does not list, and when the model offers none.
20
27
  */
21
28
  export function clampThinkingLevel(level, supported) {
29
+ if (supported.includes(level))
30
+ return level;
31
+ if (!isThinkingLevel(level))
32
+ return undefined;
22
33
  let below;
23
34
  let lowest;
24
35
  for (const candidate of supported) {
36
+ if (!isThinkingLevel(candidate))
37
+ continue;
25
38
  if (lowest === undefined || rank(candidate) < rank(lowest))
26
39
  lowest = candidate;
27
40
  if (rank(candidate) <= rank(level) && (below === undefined || rank(candidate) > rank(below)))
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { AuthCancelParamsSchema, AuthCancelResultSchema, AuthCompleteParamsSchema, AuthLoginParamsSchema, AuthLoginSchema, AuthLogoutParamsSchema, AuthStatusParamsSchema, AuthStatusResultSchema, AuthUpdatedSchema, HarnessAuthSchema, } from "./auth.js";
3
3
  import { ClisParamsSchema, ClisResultSchema } from "./clis.js";
4
4
  import { HISTORY_METHODS, HistoryCatalogSchema, HistoryCheckpointRequestSchema, HistoryCheckpointSchema, HistoryCommitSchema, HistoryForkSchema, HistoryHeadSchema, HistoryListSchema, HistoryReadSchema, HistorySliceSchema, HistoryVersionSchema, HistoryWaitSchema, SessionRefSchema, } from "./history.js";
5
- import { ModelListSchema, decodeModelList } from "./models.js";
5
+ import { ModelListSchema } from "./models.js";
6
6
  import { DurableSessionSchema, ElicitationRespondParamsSchema, ElicitationRespondResultSchema, EventsReplayParamsSchema, EventsReplayResultSchema, InitializeParamsSchema, InitializeResultSchema, ModelsListParamsSchema, PermissionRespondParamsSchema, PermissionRespondResultSchema, RecoveryReasonSchema, SessionCloseParamsSchema, SessionCloseResultSchema, SessionConfirmStoppedParamsSchema, SessionConfirmStoppedResultSchema, SessionGetParamsSchema, SessionReleaseParamsSchema, SessionReleaseResultSchema, SessionSubscribeAllParamsSchema, SessionSubscribeAllResultSchema, SessionSubscribeParamsSchema, SessionSubscribeResultSchema, SessionUnsubscribeAllParamsSchema, SessionUnsubscribeParamsSchema, SessionUnsubscribeResultSchema, ShutdownResultSchema, TurnCancelParamsSchema, TurnCancelResultSchema, TurnGetParamsSchema, TurnReceiptSchema, TurnStartParamsSchema, TurnStartResultSchema, TurnSteerParamsSchema, TurnSteerResultSchema, WIRE_ERROR_CODES, WIRE_METHODS, decodeEventsReplayResult, } from "./wire.js";
7
7
  /** `shutdown` takes nothing. */
8
8
  const ShutdownParamsSchema = z.object({});
@@ -18,7 +18,7 @@ const API = {
18
18
  [WIRE_METHODS.permissionRespond]: method(PermissionRespondParamsSchema, PermissionRespondResultSchema),
19
19
  [WIRE_METHODS.elicitationRespond]: method(ElicitationRespondParamsSchema, ElicitationRespondResultSchema),
20
20
  [WIRE_METHODS.eventsReplay]: method(EventsReplayParamsSchema, EventsReplayResultSchema, decodeEventsReplayResult),
21
- [WIRE_METHODS.modelsList]: method(ModelsListParamsSchema, ModelListSchema, decodeModelList),
21
+ [WIRE_METHODS.modelsList]: method(ModelsListParamsSchema, ModelListSchema),
22
22
  [WIRE_METHODS.clisList]: method(ClisParamsSchema, ClisResultSchema),
23
23
  [WIRE_METHODS.clisPrepare]: method(ClisParamsSchema, ClisResultSchema),
24
24
  [WIRE_METHODS.authStatus]: method(AuthStatusParamsSchema, AuthStatusResultSchema),
@@ -3,6 +3,7 @@ import { RunConfigSchema } from "./config.js";
3
3
  import { AgentCapabilitiesSchema, AgentHarnessSchema } from "./harness.js";
4
4
  import { ElicitationOutcomeSchema, LifecycleEventSchema, PermissionOutcomeSchema, TurnEndedEventSchema, decodeLifecycleEvent, } from "./lifecycle.js";
5
5
  import { ModelListSchema } from "./models.js";
6
+ import { OriginSchema } from "./origin.js";
6
7
  import { AgentInputSchema } from "./part-input.js";
7
8
  /**
8
9
  * The standard wire: JSON-RPC 2.0 over a newline-delimited JSON
@@ -34,6 +35,16 @@ import { AgentInputSchema } from "./part-input.js";
34
35
  * `session/unsubscribeAll`, each with its own answer, not `{all: true}`.
35
36
  */
36
37
  export const WIRE_PROTOCOL_VERSION = 6;
38
+ /**
39
+ * What a server takes beyond its protocol version, named in `initialize`'s
40
+ * `features`. A field a server's schema does not know is stripped, not
41
+ * refused, so a client asks before it sends one whose loss would change
42
+ * what the agent does.
43
+ * - `origin`: `turn/start` and `turn/steer` carry who sent the input, and the
44
+ * agent is told when it is not the person (LLP 0019). A client sends a
45
+ * non-person origin only to a server that names it.
46
+ */
47
+ export const WIRE_FEATURES = { origin: "origin" };
37
48
  // ---- JSON-RPC 2.0 envelopes --------------------------------------------------
38
49
  export const JsonRpcIdSchema = z.union([z.string(), z.number()]);
39
50
  export const JsonRpcErrorSchema = z.object({
@@ -183,6 +194,8 @@ export const InitializeResultSchema = z.object({
183
194
  historyId: z.string().optional(),
184
195
  /** Capabilities per registered harness — only available harnesses appear. */
185
196
  harnesses: z.record(z.string(), AgentCapabilitiesSchema),
197
+ /** What it takes beyond the protocol version (`WIRE_FEATURES`); absent on older servers. */
198
+ features: z.array(z.string()).optional(),
186
199
  });
187
200
  /**
188
201
  * `turn/start` params are a RunRequest whose ids may be omitted — the server
@@ -195,6 +208,8 @@ export const TurnStartParamsSchema = z.object({
195
208
  turnId: z.string().min(1).optional(),
196
209
  input: AgentInputSchema,
197
210
  config: RunConfigSchema,
211
+ /** Who sent the input; absent is the person. The agent is told when it is not (LLP 0019). */
212
+ origin: OriginSchema.optional(),
198
213
  /**
199
214
  * Stream the session to the caller from the head at admission until the
200
215
  * turn ends, as `session/subscribe {sessionId, turnId}` does. Default true;
@@ -261,6 +276,8 @@ export const TurnSteerParamsSchema = z.object({
261
276
  turnId: z.string().min(1),
262
277
  steerId: z.string().min(1).optional(),
263
278
  input: AgentInputSchema.refine((input) => (typeof input === "string" ? input.trim() !== "" : input.length > 0), "a steer carries input"),
279
+ /** Who sent the input; absent is the person. Part of the steer's identity, as its input is. */
280
+ origin: OriginSchema.optional(),
264
281
  });
265
282
  /**
266
283
  * What a steer did, as one outcome:
@@ -22,7 +22,7 @@ import { homedir } from "node:os";
22
22
  import { join } from "node:path";
23
23
  import pkg from "../../package.json" with { type: "json" };
24
24
  import { createAgentRuntime, credentialsFromUrl, isInheritConfig, resolveAcpLaunch, resolveHarnessName, scriptedFile, } from "../core/index.js";
25
- import { THINKING_LEVELS, isThinkingLevel } from "../protocol/index.js";
25
+ import { THINKING_LEVELS } from "../protocol/index.js";
26
26
  import { AgentServer } from "./agent-server.js";
27
27
  import { runFeedbackCommand } from "./feedback.js";
28
28
  import { installedLine, nothingToInstall, runInstall, toolsFor } from "./install.js";
@@ -39,7 +39,8 @@ function usage(exitCode) {
39
39
  " --stdio serve NDJSON JSON-RPC on stdio (the default)",
40
40
  " --acp speak ACP v1 on stdio instead (be the agent)",
41
41
  " --model <id> every turn runs on this model (default: the harness's own)",
42
- ` --thinking <level> and at this thinking level (${THINKING_LEVELS.join(", ")});`,
42
+ ` --thinking <level> and at this thinking level (${THINKING_LEVELS.join(", ")},`,
43
+ " or another the model lists);",
43
44
  " the operator's choice: an ACP client cannot change either",
44
45
  " install download the pinned agent CLIs into the managed cache",
45
46
  " (always downloads — run at image build time to erase",
@@ -199,8 +200,9 @@ function parseArgs(argv) {
199
200
  }
200
201
  else if (arg === "--thinking") {
201
202
  const level = next();
202
- if (!isThinkingLevel(level))
203
- fail(`--thinking ${level}: use ${THINKING_LEVELS.slice(0, -1).join(", ")} or ${THINKING_LEVELS.at(-1)}`);
203
+ // A flag where the level belongs means the level was left out.
204
+ if (!level.trim() || level.startsWith("-"))
205
+ fail(`--thinking needs a level: ${THINKING_LEVELS.slice(0, -1).join(", ")} or ${THINKING_LEVELS.at(-1)}, or another the model lists`);
204
206
  args.thinking = level;
205
207
  }
206
208
  else if (arg === "--credentials-url") {
@@ -1,4 +1,4 @@
1
- import { WIRE_METHODS, WIRE_PROTOCOL_VERSION, WireRefusal, generateUUIDv7, } from "../protocol/index.js";
1
+ import { WIRE_FEATURES, WIRE_METHODS, WIRE_PROTOCOL_VERSION, WireRefusal, generateUUIDv7, } from "../protocol/index.js";
2
2
  function assertHarness(runtime, harness) {
3
3
  if (!runtime.harnesses.includes(harness))
4
4
  throw new WireRefusal("harnessNotAvailable", `harness not available: ${harness}`, {
@@ -70,12 +70,17 @@ export function executionRoutes(host) {
70
70
  const harnesses = {};
71
71
  for (const harness of runtime.harnesses)
72
72
  harnesses[harness] = runtime.capabilities(harness);
73
- return { protocolVersion: WIRE_PROTOCOL_VERSION, ...host.identity, harnesses };
73
+ return {
74
+ protocolVersion: WIRE_PROTOCOL_VERSION,
75
+ ...host.identity,
76
+ harnesses,
77
+ features: Object.values(WIRE_FEATURES),
78
+ };
74
79
  },
75
80
  [WIRE_METHODS.turnStart]: (parsed, context) => {
76
81
  if (!host.accepting())
77
82
  throw new WireRefusal("shuttingDown", "server is shutting down");
78
- const { config, input } = parsed;
83
+ const { config, input, origin } = parsed;
79
84
  assertHarness(runtime, config.harness);
80
85
  const sessionId = parsed.sessionId ?? generateUUIDv7();
81
86
  const turnId = parsed.turnId ?? generateUUIDv7();
@@ -91,7 +96,7 @@ export function executionRoutes(host) {
91
96
  // caller to the turn while it runs. A durable store remembers every
92
97
  // turn it admitted, the runtime only its recent ones. The same turnId
93
98
  // with different input is a caller bug → turnConflict.
94
- const request = { sessionId, turnId, input, config };
99
+ const request = { sessionId, turnId, input, config, ...(origin && { origin }) };
95
100
  const duplicate = store.duplicateOf(request) ?? converged(request);
96
101
  if (duplicate) {
97
102
  const headSeq = store.point(sessionId)?.headSeq;
@@ -144,7 +149,12 @@ export function executionRoutes(host) {
144
149
  };
145
150
  },
146
151
  // @ref LLP 0001#d13--input-while-a-turn-runs-steers-it — the runtime decides
147
- [WIRE_METHODS.turnSteer]: ({ sessionId, turnId, steerId, input }) => runtime.steer(sessionId, { turnId, steerId: steerId ?? generateUUIDv7(), input }),
152
+ [WIRE_METHODS.turnSteer]: ({ sessionId, turnId, steerId, input, origin }) => runtime.steer(sessionId, {
153
+ turnId,
154
+ steerId: steerId ?? generateUUIDv7(),
155
+ input,
156
+ ...(origin && { origin }),
157
+ }),
148
158
  [WIRE_METHODS.sessionClose]: async ({ sessionId }) => {
149
159
  gate.assertIdle(sessionId);
150
160
  const harness = store.closing(sessionId);