@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
@@ -1,10 +1,8 @@
1
1
  /**
2
- * What an operator needs to know about one session, however its host keeps it.
3
- *
4
- * A host that holds a folded `ConversationState` gets this with `viewOf`. A host
5
- * that keeps its own rows (messages with their parts, a status column) builds
6
- * the same shape directly. Nothing here knows about projects, workspaces,
7
- * accounts or storage: those are the host's.
2
+ * What the operator needs to know about one session, however its host keeps
3
+ * it. A host that holds a folded `ConversationState` gets it with `viewOf`; a
4
+ * host that keeps its own rows builds the same shape. Nothing here knows about
5
+ * projects, workspaces, accounts or storage: those are the host's.
8
6
  */
9
7
 
10
8
  import {
@@ -15,14 +13,24 @@ import {
15
13
  pendingElicitations,
16
14
  pendingPermissions,
17
15
  } from "../protocol/conversation.ts";
16
+ import type { ReportedOrigin } from "../protocol/origin.ts";
18
17
  import type { Part, UnknownPart } from "../protocol/parts.ts";
19
- import { PLAN_OPTION_IDS } from "../protocol/plan.ts";
18
+ import type {
19
+ SessionStatus,
20
+ SessionView,
21
+ TurnFact,
22
+ TurnOutcome,
23
+ ViewTurn,
24
+ Waiting,
25
+ } from "./types.ts";
20
26
 
21
27
  export interface ViewMessage {
22
28
  role: "user" | "assistant";
23
29
  parts: readonly (Part | UnknownPart)[];
24
30
  /** A sub-agent's output: shown nested, never as the agent's reply. */
25
31
  nested?: boolean;
32
+ /** A user message's sender when it is not the person (LLP 0019). */
33
+ origin?: ReportedOrigin;
26
34
  }
27
35
 
28
36
  /** A question the agent asked, as the engine's `elicitation.requested` carries it. */
@@ -33,50 +41,93 @@ export type QuestionRequest = Pick<
33
41
  /** A decision the agent waits on (a tool's approval, or a plan), as `permission.requested` carries it. */
34
42
  export type DecisionRequest = Pick<
35
43
  ConversationPermission,
36
- "requestId" | "title" | "toolCall" | "options"
44
+ "requestId" | "title" | "toolCall" | "options" | "purpose"
37
45
  >;
38
46
 
39
- export type Waiting =
40
- | { kind: "question"; request: QuestionRequest }
41
- | { kind: "decision"; request: DecisionRequest };
42
-
43
- export interface SessionView {
44
- /** Whether a turn is running. "Waiting on a person" is `waiting`, not a status. */
45
- status: "idle" | "working" | "error";
46
- messages: readonly ViewMessage[];
47
- waiting: readonly Waiting[];
48
- error?: string;
49
- /** The host holds earlier messages than the ones given here. */
50
- older?: boolean;
47
+ // @ref LLP 0019#answer_request-write — a plan only when the engine says so; anything else is a permission
48
+ /** A decision's kind, from its `purpose`: `plan` when it says so, else a permission. */
49
+ export function waitingOf(request: DecisionRequest): Waiting {
50
+ return { kind: request.purpose === "plan" ? "plan" : "permission", request };
51
51
  }
52
52
 
53
- /** What a person would call the session's state. Waiting on them is not "finished". */
54
- export type Phase = "idle" | "working" | "needs_input" | "error";
53
+ /** Whether a status needs no more waiting: a wait returns it. */
54
+ export const settledStatus = (status: SessionStatus): boolean =>
55
+ status !== "working" && status !== "setting_up";
55
56
 
56
- export function phaseOf(view: Pick<SessionView, "status" | "waiting">): Phase {
57
- return view.waiting.length > 0 ? "needs_input" : view.status;
57
+ /**
58
+ * The view of a session whose events were folded with the engine's reducer,
59
+ * with its turn facts (`running`, `lastEnded`) from every turn, not a page.
60
+ */
61
+ export function viewOf(state: ConversationState): SessionView {
62
+ return viewWithFacts(state);
58
63
  }
59
64
 
60
- /** A plan's approval is a decision whose options include "keep planning" (`PLAN_OPTIONS`). */
61
- export function isPlan(request: DecisionRequest): boolean {
62
- return request.options.some((option) => option.optionId === PLAN_OPTION_IDS.keepPlanning);
65
+ /** One turn of a folded state, by id: the host's `turn`, for a host that folds. */
66
+ export function turnOf(state: ConversationState, turnId: string): TurnFact {
67
+ const turn = state.turns.find((t) => t.turnId === turnId);
68
+ if (!turn) return { state: "unknown" };
69
+ if (turn.status === "active") return { state: "running" };
70
+ return {
71
+ state: "ended",
72
+ outcome: turn.error ? "failed" : turn.stopReason === "cancelled" ? "cancelled" : "done",
73
+ };
63
74
  }
64
75
 
65
- /** The view of a session whose events were folded with the engine's reducer. */
66
- export function viewOf(state: ConversationState): SessionView {
67
- const last = state.turns.at(-1);
68
- const failed = last?.status === "ended" ? last.error : undefined;
76
+ function viewWithFacts(state: ConversationState): SessionView {
77
+ const messages = conversationMessages(state);
78
+ const waiting: Waiting[] = [
79
+ ...pendingElicitations(state).map((request) => ({ kind: "question" as const, request })),
80
+ ...pendingPermissions(state).map(waitingOf),
81
+ ];
82
+ const turns: ViewTurn[] = state.turns.map((turn) => {
83
+ const outcome: TurnOutcome =
84
+ turn.status === "active"
85
+ ? "running"
86
+ : turn.error
87
+ ? "failed"
88
+ : turn.stopReason === "cancelled"
89
+ ? "cancelled"
90
+ : "done";
91
+ return {
92
+ turnId: turn.turnId,
93
+ outcome,
94
+ ...(turn.error ? { error: turn.error.message } : {}),
95
+ messages: messages
96
+ .filter((message) => message.turnId === turn.turnId)
97
+ .map((message) => ({
98
+ role: message.role,
99
+ parts: message.parts,
100
+ ...(message.parentToolCallId ? { nested: true } : {}),
101
+ ...(message.origin ? { origin: message.origin } : {}),
102
+ })),
103
+ startedAt: turn.startedAt,
104
+ ...(turn.endedAt !== undefined ? { endedAt: turn.endedAt } : {}),
105
+ };
106
+ });
107
+ const last = turns.at(-1)?.outcome;
108
+ const status: SessionStatus = waiting.length
109
+ ? "needs_input"
110
+ : last === "running"
111
+ ? "working"
112
+ : last === "failed"
113
+ ? "error"
114
+ : last === "cancelled"
115
+ ? "stopped"
116
+ : "idle";
117
+ const running = turns.find((t) => t.outcome === "running")?.turnId;
118
+ const ended = [...turns].reverse().find((t) => t.outcome !== "running");
69
119
  return {
70
- status: last?.status === "active" ? "working" : failed ? "error" : "idle",
71
- messages: conversationMessages(state).map((message) => ({
72
- role: message.role,
73
- parts: message.parts,
74
- ...(message.parentToolCallId ? { nested: true } : {}),
75
- })),
76
- waiting: [
77
- ...pendingElicitations(state).map((request) => ({ kind: "question" as const, request })),
78
- ...pendingPermissions(state).map((request) => ({ kind: "decision" as const, request })),
79
- ],
80
- ...(failed ? { error: failed.message } : {}),
120
+ status,
121
+ turns,
122
+ waiting,
123
+ ...(running ? { running } : {}),
124
+ ...(ended
125
+ ? {
126
+ lastEnded: {
127
+ turnId: ended.turnId,
128
+ outcome: ended.outcome as "done" | "cancelled" | "failed",
129
+ },
130
+ }
131
+ : {}),
81
132
  };
82
133
  }
@@ -52,16 +52,19 @@ const CLOUDS: Partial<Record<string, string>> = {
52
52
  /**
53
53
  * What to call a login, the same wherever it lives: `Claude Max`, `ChatGPT
54
54
  * Pro`, `Claude subscription` (plan unknown), `OpenAI API key`, `Amazon
55
- * Bedrock`. A plan this table does not know shows as the provider names it.
55
+ * Bedrock`. A subscription whose login names its own plan (`label`) is
56
+ * called that; otherwise the name is made from its plan, and a plan this
57
+ * table does not know shows as the provider names it.
56
58
  */
57
59
  export function accountLabel(
58
60
  harness: string,
59
- login: Pick<HarnessAuth, "credential" | "plan" | "provider">,
61
+ login: Pick<HarnessAuth, "credential" | "plan" | "provider" | "label">,
60
62
  ): string | undefined {
61
63
  if (login.credential === "api_key") return KEYS[harness] ?? "API key";
62
64
  if (login.credential === "cloud")
63
65
  return login.provider && (CLOUDS[login.provider] ?? login.provider);
64
66
  if (login.credential !== "subscription") return undefined;
67
+ if (login.label) return login.label;
65
68
  const names = PLANS[harness];
66
69
  if (!names) return login.plan;
67
70
  const plan = login.plan && (names.plans[login.plan] ?? login.plan);
@@ -96,7 +96,11 @@ export const HarnessAuthSchema = AccountInfoSchema.extend({
96
96
  state: openVocabulary(AUTH_STATES),
97
97
  credential: openVocabulary(AUTH_CREDENTIALS).optional(),
98
98
  source: openVocabulary(AUTH_SOURCES).optional(),
99
- /** What to show for it (`Claude Max`, `ChatGPT Pro`, `OpenAI API key`): `accountLabel`. */
99
+ /**
100
+ * What to show for it (`Claude Max`, `ChatGPT Pro`, `OpenAI API key`):
101
+ * `accountLabel`, which keeps the name a subscription's login gives its
102
+ * own plan, where it gives one, and otherwise makes one from its plan.
103
+ */
100
104
  label: z.string().optional(),
101
105
  /** When the credential stops working (epoch ms), where known. */
102
106
  expiresAt: z.number().int().optional(),
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AgentHarnessSchema } from "./harness.ts";
3
+ import { type Origin, OriginSchema, agentOrigin } from "./origin.ts";
3
4
  import { AgentInputSchema } from "./part-input.ts";
4
5
  import { ThinkingLevelSchema } from "./thinking.ts";
5
6
  import { openVocabulary } from "./vocabulary.ts";
@@ -161,19 +162,26 @@ export const RunRequestSchema = z.object({
161
162
  turnId: z.string(),
162
163
  input: AgentInputSchema,
163
164
  config: RunConfigSchema,
165
+ /** Who sent the input; absent is the person (`OriginSchema`). */
166
+ origin: OriginSchema.optional(),
164
167
  });
165
168
  export type RunRequest = z.infer<typeof RunRequestSchema>;
166
169
 
170
+ // @ref LLP 0019#origin-on-the-wire-and-to-the-model — another sender is another turn
167
171
  /**
168
- * What makes a turn the same turn when a client sends its ids again: its input
169
- * and the config that shapes what the agent does. What a client's own restart
170
- * can change without making it another turn stays out: MCP endpoints (a fresh
171
- * per-session URL), the environment, the API key, and raw passthrough.
172
+ * What makes a turn the same turn when a client sends its ids again: its
173
+ * input, who sent it, and the config that shapes what the agent does. What a
174
+ * client's own restart can change without making it another turn stays out:
175
+ * MCP endpoints (a fresh per-session URL), the environment, the API key, and
176
+ * raw passthrough. The person's origin, said or not, adds nothing, so a
177
+ * request's identity is what it was before origins existed.
172
178
  */
173
- export function turnIdentity(request: Pick<RunRequest, "input" | "config">): {
179
+ export function turnIdentity(request: Pick<RunRequest, "input" | "config" | "origin">): {
174
180
  input: RunRequest["input"];
175
181
  config: Omit<RunConfig, "mcpServers" | "env" | "apiKey" | "includeRaw">;
182
+ origin?: Origin;
176
183
  } {
177
184
  const { mcpServers: _mcp, env: _env, apiKey: _key, includeRaw: _raw, ...config } = request.config;
178
- return { input: request.input, config };
185
+ const origin = agentOrigin(request.origin);
186
+ return { input: request.input, config, ...(origin && { origin }) };
179
187
  }
@@ -17,6 +17,7 @@ import {
17
17
  StopReasonSchema,
18
18
  UnknownEventSchema,
19
19
  } from "./lifecycle.ts";
20
+ import { ReportedOriginSchema } from "./origin.ts";
20
21
  import { PartSchema, UnknownPartSchema } from "./parts.ts";
21
22
  import { EpochMsSchema } from "./time.ts";
22
23
  import { DEFAULT_TOKEN_USAGE, TokenUsageSchema } from "./tokens.ts";
@@ -39,6 +40,8 @@ export const ConversationMessageSchema = z.object({
39
40
  /** Set when this is a sub-agent's output — nest it under that tool call. */
40
41
  parentToolCallId: z.string().optional(),
41
42
  model: z.string().optional(),
43
+ /** A user message's sender when it is not the person (`message.started`'s `origin`). */
44
+ origin: ReportedOriginSchema.optional(),
42
45
  parts: z.array(z.union([PartSchema, UnknownPartSchema])),
43
46
  startedAt: EpochMsSchema,
44
47
  endedAt: EpochMsSchema.optional(),
@@ -60,6 +60,15 @@ const RUNS_ON = {
60
60
  "codex-app-server": CodexCredentialSchema,
61
61
  } as const;
62
62
 
63
+ /**
64
+ * Whether a product can hold a login for `harness`: it runs on a credential
65
+ * the product hands each turn (LLP 0012). One that runs only on its CLI's own
66
+ * sign-in, or on none (ACP, scripted), cannot.
67
+ */
68
+ export function takesHeldCredential(harness: string): harness is keyof HarnessCredentials {
69
+ return Object.hasOwn(RUNS_ON, harness);
70
+ }
71
+
63
72
  /**
64
73
  * The credential as the kind `harness` runs on, or why that harness cannot
65
74
  * run it. Any harness may be asked, one only known at run time too: one that
@@ -77,9 +86,9 @@ export function credentialRunsOn(
77
86
  harness: AgentHarness,
78
87
  credential: HarnessCredential,
79
88
  ): { ok: true; credential: HarnessCredential } | { ok: false; error: string } {
80
- if (!Object.hasOwn(RUNS_ON, harness))
89
+ if (!takesHeldCredential(harness))
81
90
  return { ok: false, error: `${harness} runs on no credential a product holds.` };
82
- const parsed = RUNS_ON[harness as keyof HarnessCredentials].safeParse(credential);
91
+ const parsed = RUNS_ON[harness].safeParse(credential);
83
92
  if (parsed.success) return { ok: true, credential: parsed.data };
84
93
  const what =
85
94
  credential.type === "api_key" && credential.baseUrl
@@ -5,13 +5,21 @@ import { openVocabulary } from "./vocabulary.ts";
5
5
  * The agent harnesses this engine can drive:
6
6
  * - `claude-code` — Claude Code via @anthropic-ai/claude-agent-sdk (CLI under the hood)
7
7
  * - `codex-app-server` — OpenAI Codex via `codex app-server` (long-lived JSON-RPC subprocess)
8
+ * - `gemini` — Gemini models via Google's Antigravity CLI (`agy acp`, an ACP agent),
9
+ * on the person's own Antigravity sign-in
8
10
  * - `acp` — any Agent Client Protocol v1 agent subprocess (`gemini --acp`,
9
11
  * `claude-code-acp`, `codex-acp`, ACP registry agents); the launch
10
12
  * command is operator-configured, never taken from the wire
11
13
  * - `scripted` — a script the operator gives plays the agent (a product's
12
14
  * free test double); registered only with its script
13
15
  */
14
- export const AGENT_HARNESSES = ["claude-code", "codex-app-server", "acp", "scripted"] as const;
16
+ export const AGENT_HARNESSES = [
17
+ "claude-code",
18
+ "codex-app-server",
19
+ "gemini",
20
+ "acp",
21
+ "scripted",
22
+ ] as const;
15
23
  export type AgentHarness = (typeof AGENT_HARNESSES)[number];
16
24
  export const AgentHarnessSchema = z.enum(AGENT_HARNESSES);
17
25
 
@@ -205,7 +205,8 @@ export type HistoryWait = z.input<typeof HistoryWaitSchema>;
205
205
 
206
206
  /** Projection cache format changes whenever reducer semantics become incompatible.
207
207
  * Raw canonical events remain authoritative and are never pruned by this cache. */
208
- export const CONVERSATION_CHECKPOINT_FORMAT = "agent-server.conversation.v1";
208
+ // v2: user messages carry `origin` (LLP 0019); a v1 checkpoint was folded without it.
209
+ export const CONVERSATION_CHECKPOINT_FORMAT = "agent-server.conversation.v2";
209
210
  export const HistoryCheckpointRequestSchema = z.object({ through: HistoryVersionSchema });
210
211
  export type HistoryCheckpointRequest = z.infer<typeof HistoryCheckpointRequestSchema>;
211
212
  export const HistoryCheckpointSchema = z.object({
@@ -21,6 +21,7 @@ export * from "./clis.ts";
21
21
  export * from "./account.ts";
22
22
  export * from "./auth.ts";
23
23
  export * from "./credentials.ts";
24
+ export * from "./origin.ts";
24
25
  export * from "./config.ts";
25
26
  export * from "./execution.ts";
26
27
  export * from "./lifecycle.ts";
@@ -5,6 +5,7 @@ import { TurnExecutionSchema } from "./execution.ts";
5
5
  import { isKnownLifecycleEventType } from "./guards.ts";
6
6
  import { HarnessIdSchema } from "./harness.ts";
7
7
  import { MetaSchema } from "./meta.ts";
8
+ import { ReportedOriginSchema } from "./origin.ts";
8
9
  import { type Part, PartSchema, type UnknownPart, decodePart } from "./parts.ts";
9
10
  import { EpochMsSchema } from "./time.ts";
10
11
  import { TokenUsageSchema } from "./tokens.ts";
@@ -278,6 +279,12 @@ export const MessageStartedEventSchema = z.object({
278
279
  * the turn asked for.
279
280
  */
280
281
  model: z.string().optional(),
282
+ /**
283
+ * A user message's sender when it is not the person: the request's
284
+ * `origin`, the turn's echo and a steer's alike. Absent on the person's
285
+ * messages and on every assistant message.
286
+ */
287
+ origin: ReportedOriginSchema.optional(),
281
288
  ...stamped,
282
289
  });
283
290
  export type MessageStartedEvent = z.infer<typeof MessageStartedEventSchema>;
@@ -418,10 +425,24 @@ export type PermissionOutcome = z.infer<typeof PermissionOutcomeSchema>;
418
425
  * `options` is THE source of buttons — clients render the server's list,
419
426
  * never derive affordances from local policy.
420
427
  */
428
+ // @ref LLP 0019#answer_request-write — the kind of a request is said, never read from its options
429
+ /**
430
+ * What a permission request decides. OPEN: `tool`, whether a tool call may
431
+ * run (every built-in harness's tool approvals, and an ACP agent's, whose
432
+ * requests are tool-scoped); `plan`, whether to leave planning and carry out
433
+ * a plan (Claude's and Codex's plan approvals). A value this build does not
434
+ * know, or none, is read as `tool`: the stricter one.
435
+ */
436
+ export const PERMISSION_PURPOSES = ["tool", "plan"] as const;
437
+ export type PermissionPurpose = (typeof PERMISSION_PURPOSES)[number] | (string & {});
438
+ export const PermissionPurposeSchema = openVocabulary(PERMISSION_PURPOSES);
439
+
421
440
  export const PermissionRequestedEventSchema = z.object({
422
441
  type: z.literal("permission.requested"),
423
442
  ...inTurn,
424
443
  requestId: z.string(),
444
+ /** What it decides; absent on an older engine's events, which read as `tool`. */
445
+ purpose: PermissionPurposeSchema.optional(),
425
446
  /** Human-readable one-line prompt, always present (render this). */
426
447
  title: z.string(),
427
448
  /**
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+
3
+ // @ref LLP 0019#origin-on-the-wire-and-to-the-model — who sent a message, carried from the request to the echo
4
+ /**
5
+ * Who sent a turn's or a steer's message. Absent, or `person`, is the person
6
+ * the product serves; anything else is an agent, and the engine tells the
7
+ * receiving model so in one line before the input it is given. `name` is the
8
+ * host's, untrusted: the engine quotes it.
9
+ */
10
+ /**
11
+ * The longest id or name an origin carries, in UTF-16 units: at most 765
12
+ * bytes of UTF-8, under the 1 KiB below which a journal never cuts a string
13
+ * to fit (`sync/fit.ts`), so a kept origin reads back exactly as it was sent.
14
+ * The line the model reads clips a name further, to 200 characters.
15
+ */
16
+ export const ORIGIN_FIELD_MAX = 255;
17
+ const field = z.string().min(1).max(ORIGIN_FIELD_MAX);
18
+
19
+ export const OriginSchema = z.discriminatedUnion("kind", [
20
+ z.object({ kind: z.literal("person") }),
21
+ /** Another session; `name` is how the host's tools name it (`deus/voyager:2`). */
22
+ z.object({ kind: z.literal("session"), sessionId: field, name: field.optional() }),
23
+ /** An outside assistant the person connected. */
24
+ z.object({ kind: z.literal("assistant"), id: field, name: field }),
25
+ ]);
26
+ const KNOWN_ORIGIN_KINDS: readonly string[] = ["person", "session", "assistant"];
27
+ export type Origin = z.infer<typeof OriginSchema>;
28
+
29
+ /**
30
+ * An origin as the stream reports it (the user message's `origin`): one this
31
+ * build knows, or a newer engine's kind, kept intact rather than refused.
32
+ */
33
+ export const ReportedOriginSchema = z.union([
34
+ OriginSchema,
35
+ // A kind this build does not know, kept whole; a known kind must be well formed.
36
+ z
37
+ .looseObject({ kind: z.string().min(1).regex(/\S/, "must not be blank") })
38
+ .refine((origin) => !KNOWN_ORIGIN_KINDS.includes(origin.kind), "a malformed known origin"),
39
+ ]);
40
+ export type ReportedOrigin = z.infer<typeof ReportedOriginSchema>;
41
+
42
+ /** The origin as the engine carries it: undefined for the person, whose messages carry none. */
43
+ export function agentOrigin(
44
+ origin: Origin | undefined,
45
+ ): Exclude<Origin, { kind: "person" }> | undefined {
46
+ return origin && origin.kind !== "person" ? origin : undefined;
47
+ }
@@ -14,6 +14,7 @@ import type {
14
14
  StopReason,
15
15
  UnknownEvent,
16
16
  } from "./lifecycle.ts";
17
+ import type { ReportedOrigin } from "./origin.ts";
17
18
  import type { Part, ToolPart, UnknownPart } from "./parts.ts";
18
19
  import { addTokenUsage } from "./tokens.ts";
19
20
  import { closeToolLeftOpen } from "./tool-closure.ts";
@@ -118,6 +119,7 @@ function openMessage(
118
119
  role: "user" | "assistant";
119
120
  parentToolCallId?: string;
120
121
  model?: string;
122
+ origin?: ReportedOrigin;
121
123
  },
122
124
  record: ChangeRecorder,
123
125
  ): ConversationState {
@@ -138,6 +140,8 @@ function openMessage(
138
140
  // depth alongside the producer gate: a hand-built or replayed
139
141
  // `message.started{role:"user", model}` does not leak into the fold.
140
142
  ...(init.role === "assistant" && init.model !== undefined && { model: init.model }),
143
+ // Who sent a user message, when not the person; never on the agent's own.
144
+ ...(init.role === "user" && init.origin !== undefined && { origin: init.origin }),
141
145
  parts: [],
142
146
  startedAt: init.timestamp,
143
147
  };
@@ -11,6 +11,7 @@ import {
11
11
  decodeLifecycleEvent,
12
12
  } from "./lifecycle.ts";
13
13
  import { ModelListSchema } from "./models.ts";
14
+ import { OriginSchema } from "./origin.ts";
14
15
  import { AgentInputSchema } from "./part-input.ts";
15
16
 
16
17
  /**
@@ -44,6 +45,17 @@ import { AgentInputSchema } from "./part-input.ts";
44
45
  */
45
46
  export const WIRE_PROTOCOL_VERSION = 6;
46
47
 
48
+ /**
49
+ * What a server takes beyond its protocol version, named in `initialize`'s
50
+ * `features`. A field a server's schema does not know is stripped, not
51
+ * refused, so a client asks before it sends one whose loss would change
52
+ * what the agent does.
53
+ * - `origin`: `turn/start` and `turn/steer` carry who sent the input, and the
54
+ * agent is told when it is not the person (LLP 0019). A client sends a
55
+ * non-person origin only to a server that names it.
56
+ */
57
+ export const WIRE_FEATURES = { origin: "origin" } as const;
58
+
47
59
  // ---- JSON-RPC 2.0 envelopes --------------------------------------------------
48
60
 
49
61
  export const JsonRpcIdSchema = z.union([z.string(), z.number()]);
@@ -208,6 +220,8 @@ export const InitializeResultSchema = z.object({
208
220
  historyId: z.string().optional(),
209
221
  /** Capabilities per registered harness — only available harnesses appear. */
210
222
  harnesses: z.record(z.string(), AgentCapabilitiesSchema),
223
+ /** What it takes beyond the protocol version (`WIRE_FEATURES`); absent on older servers. */
224
+ features: z.array(z.string()).optional(),
211
225
  });
212
226
  export type InitializeResult = z.infer<typeof InitializeResultSchema>;
213
227
 
@@ -222,6 +236,8 @@ export const TurnStartParamsSchema = z.object({
222
236
  turnId: z.string().min(1).optional(),
223
237
  input: AgentInputSchema,
224
238
  config: RunConfigSchema,
239
+ /** Who sent the input; absent is the person. The agent is told when it is not (LLP 0019). */
240
+ origin: OriginSchema.optional(),
225
241
  /**
226
242
  * Stream the session to the caller from the head at admission until the
227
243
  * turn ends, as `session/subscribe {sessionId, turnId}` does. Default true;
@@ -299,6 +315,8 @@ export const TurnSteerParamsSchema = z.object({
299
315
  (input) => (typeof input === "string" ? input.trim() !== "" : input.length > 0),
300
316
  "a steer carries input",
301
317
  ),
318
+ /** Who sent the input; absent is the person. Part of the steer's identity, as its input is. */
319
+ origin: OriginSchema.optional(),
302
320
  });
303
321
  export type TurnSteerParams = z.infer<typeof TurnSteerParamsSchema>;
304
322
 
package/src/server/bin.ts CHANGED
@@ -22,6 +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 {
25
+ CLI_TOOLS,
25
26
  type CredentialSource,
26
27
  type InheritConfig,
27
28
  type ProvisionMode,
@@ -33,6 +34,7 @@ import {
33
34
  resolveHarnessName,
34
35
  scriptedFile,
35
36
  } from "../core/index.ts";
37
+ import { CLI_TOOL_SPECS } from "../core/provision/tools.ts";
36
38
  import { THINKING_LEVELS, type ThinkingLevel } from "../protocol/index.ts";
37
39
  import { AgentServer } from "./agent-server.ts";
38
40
  import { runFeedbackCommand } from "./feedback.ts";
@@ -111,7 +113,7 @@ function usage(exitCode: number): never {
111
113
  " --dial <ws-url> dial out to a consumer (auto-reconnect); its credential:",
112
114
  " $AGENT_SERVER_DIAL_TOKEN, never argv or the URL",
113
115
  " --harness <a,b> restrict harnesses (default: all installed)",
114
- " --acp-agent <spec> ACP agent: known name (pi|gemini) or launch command",
116
+ " --acp-agent <spec> ACP agent: known name (pi|gemini-cli) or launch command",
115
117
  " --script <file> the scripted harness plays this JSONL script, one step a",
116
118
  " line (its only harness unless --harness names others);",
117
119
  " one turn plays at a time, from the start at each start",
@@ -131,7 +133,7 @@ function usage(exitCode: number): never {
131
133
  "env: AGENT_SERVER_TOKEN (the listener's token, if no --token-file),",
132
134
  " AGENT_SERVER_DIAL_TOKEN (what --dial presents: Authorization: Bearer),",
133
135
  " AGENT_SERVER_CREDENTIALS_TOKEN (what --credentials-url presents),",
134
- " CLAUDE_CLI_PATH / CODEX_CLI_PATH (explicit binaries),",
136
+ ` ${CLI_TOOLS.map((tool) => CLI_TOOL_SPECS[tool].overrideEnv).join(" / ")} (explicit binaries),`,
135
137
  " AGENT_SERVER_PROVISION, AGENT_SERVER_CACHE_DIR, AGENT_SERVER_NPM_REGISTRY,",
136
138
  " AGENT_SERVER_BUNDLE_DIR (folders `install --dir` staged, a path list),",
137
139
  " AGENT_SERVER_ACP_SESSION_DIR (--acp: where resumable session ids are kept)",
@@ -216,7 +218,7 @@ function parseArgs(argv: string[]): Args {
216
218
  else if (arg === "--acp-agent") {
217
219
  const spec = inline ?? argv[++i];
218
220
  if (spec === undefined || !spec.trim() || spec.startsWith("-"))
219
- fail("--acp-agent needs a known agent name (pi, gemini) or a launch command");
221
+ fail("--acp-agent needs a known agent name (pi, gemini-cli) or a launch command");
220
222
  args.acpAgent = spec;
221
223
  } else if (arg === "--script") {
222
224
  args.script = next();
@@ -366,7 +368,7 @@ const credential = args.command === "serve" && args.mode === "dial" ? dialToken(
366
368
  const named = args.harnesses?.map((h) => {
367
369
  const choice = resolveHarnessName(h);
368
370
  if (!choice) fail(`unknown harness: ${h}`);
369
- // Friendly ACP agent names ("pi", "gemini") ride the acp harness.
371
+ // Friendly ACP agent names ("pi", "gemini-cli") ride the acp harness.
370
372
  if (choice.acpAgent) args.acpAgent ??= choice.acpAgent;
371
373
  return choice.harness;
372
374
  });
@@ -381,10 +383,22 @@ if (args.command !== "install" && named?.includes("scripted") && args.script ===
381
383
  fail("the scripted harness needs a script: --script <file>");
382
384
  const harnesses = named ?? (args.script !== undefined ? ["scripted" as const] : undefined);
383
385
  const provision = args.provisionMode ? { mode: args.provisionMode } : {};
384
- const acpLaunch = resolveAcpLaunch(args.acpAgent ?? process.env.AGENT_SERVER_ACP_AGENT);
386
+ // The ACP agent setting is read only where the acp harness runs: named, or,
387
+ // with no --harness, turned on by the setting itself. A stale
388
+ // `$AGENT_SERVER_ACP_AGENT` stops no other harness, nor `install`.
389
+ const acpSpec = args.acpAgent ?? process.env.AGENT_SERVER_ACP_AGENT;
390
+ const acpInUse = args.command !== "install" && (harnesses ? harnesses.includes("acp") : !!acpSpec);
391
+ const acpLaunch = (() => {
392
+ if (!acpInUse) return undefined;
393
+ try {
394
+ return resolveAcpLaunch(acpSpec);
395
+ } catch (error) {
396
+ return fail((error as Error).message);
397
+ }
398
+ })();
385
399
  // `install` runs no agent: an acp harness there has nothing to install, and says so.
386
400
  if (args.command !== "install" && harnesses?.includes("acp") && !acpLaunch)
387
- fail('the acp harness needs an agent: --harness pi|gemini or --acp-agent "<spec>"');
401
+ fail('the acp harness needs an agent: --harness pi|gemini-cli or --acp-agent "<spec>"');
388
402
 
389
403
  if (args.command === "install") {
390
404
  // A harness the engine installs nothing for is said, not passed over in silence.
@@ -92,12 +92,15 @@ function claudeCodeVersion(version: string): string | undefined {
92
92
  /**
93
93
  * The line `install` prints for a CLI it installed, saying what its version
94
94
  * is: Claude's is the Claude SDK package's (`0.3.288`), which carries a
95
- * Claude Code of its own number (`2.1.288`), the one `claude --version` says.
95
+ * Claude Code of its own number (`2.1.288`), the one `claude --version` says;
96
+ * every other tool's is its CLI's own.
96
97
  */
97
98
  export function installedLine({ tool, platform, cli }: InstallResult): string {
98
99
  const where = `for ${platform} ready: ${cli.path} (${cli.source})`;
99
- if (tool === "codex") return `codex: Codex CLI ${cli.version ?? "(version not known)"} ${where}`;
100
- if (!cli.version) return `claude: Claude Code (version not known) ${where}`;
100
+ const { title } = CLI_TOOL_SPECS[tool];
101
+ if (tool !== "claude")
102
+ return `${tool}: ${title} ${cli.version ?? "(version not known)"} ${where}`;
103
+ if (!cli.version) return `claude: ${title} (version not known) ${where}`;
101
104
  const code = claudeCodeVersion(cli.version);
102
105
  return `claude: Claude SDK package ${cli.version}${code ? ` (Claude Code ${code})` : ""} ${where}`;
103
106
  }