@zvada/agent-server 0.3.27 → 0.3.30

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 (190) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +6 -4
  3. package/dist/core/agents/acp/account.js +111 -0
  4. package/dist/core/agents/acp/acp-agent.js +249 -158
  5. package/dist/core/agents/acp/adapter.js +103 -34
  6. package/dist/core/agents/acp/client.js +169 -42
  7. package/dist/core/agents/acp/known-agents.js +12 -5
  8. package/dist/core/agents/acp/mappings.js +84 -20
  9. package/dist/core/agents/acp/models.js +59 -0
  10. package/dist/core/agents/acp/profile.js +36 -0
  11. package/dist/core/agents/acp/prompts.js +248 -0
  12. package/dist/core/agents/acp/requests.js +4 -4
  13. package/dist/core/agents/claude-code/claude-agent.js +2 -12
  14. package/dist/core/agents/claude-code/login.js +4 -1
  15. package/dist/core/agents/claude-code/session.js +50 -18
  16. package/dist/core/agents/claude-code/spawn.js +0 -26
  17. package/dist/core/agents/claude-code/turn.js +6 -2
  18. package/dist/core/agents/codex-app-server/client.js +12 -13
  19. package/dist/core/agents/codex-app-server/login.js +4 -1
  20. package/dist/core/agents/gemini/failures.js +133 -0
  21. package/dist/core/agents/gemini/login.js +173 -0
  22. package/dist/core/agents/gemini/profile.js +138 -0
  23. package/dist/core/agents/gemini/tools.js +91 -0
  24. package/dist/core/agents/login.js +8 -6
  25. package/dist/core/agents/stderr-tail.js +5 -2
  26. package/dist/core/presets.js +13 -0
  27. package/dist/core/processes/native-processes.js +23 -1
  28. package/dist/core/provision/install-build.js +70 -26
  29. package/dist/core/provision/pins.js +5 -0
  30. package/dist/core/provision/provisioner.js +39 -16
  31. package/dist/core/provision/releases.js +39 -1
  32. package/dist/core/provision/tools.js +87 -28
  33. package/dist/operator/errors.js +2 -2
  34. package/dist/operator/operator.js +201 -90
  35. package/dist/operator/render.js +34 -28
  36. package/dist/operator/session-tools.js +2 -1
  37. package/dist/protocol/account.js +5 -1
  38. package/dist/protocol/auth.js +5 -1
  39. package/dist/protocol/config.js +4 -2
  40. package/dist/protocol/credentials.js +9 -1
  41. package/dist/protocol/harness.js +9 -1
  42. package/dist/protocol/part-input.js +2 -6
  43. package/dist/protocol/text-parts.js +10 -0
  44. package/dist/server/bin.js +22 -7
  45. package/dist/server/install.js +6 -4
  46. package/dist/types/core/agents/acp/account.d.ts +55 -0
  47. package/dist/types/core/agents/acp/account.d.ts.map +1 -0
  48. package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
  49. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  50. package/dist/types/core/agents/acp/adapter.d.ts +28 -3
  51. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  52. package/dist/types/core/agents/acp/client.d.ts +66 -4
  53. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  54. package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
  55. package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
  56. package/dist/types/core/agents/acp/mappings.d.ts +53 -7
  57. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  58. package/dist/types/core/agents/acp/models.d.ts +22 -0
  59. package/dist/types/core/agents/acp/models.d.ts.map +1 -0
  60. package/dist/types/core/agents/acp/profile.d.ts +97 -0
  61. package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
  62. package/dist/types/core/agents/acp/prompts.d.ts +108 -0
  63. package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
  64. package/dist/types/core/agents/acp/requests.d.ts +7 -1
  65. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  66. package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -2
  67. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  68. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  69. package/dist/types/core/agents/claude-code/options.d.ts +1 -1
  70. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  71. package/dist/types/core/agents/claude-code/session.d.ts +7 -6
  72. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  73. package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
  74. package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
  75. package/dist/types/core/agents/claude-code/turn.d.ts +3 -2
  76. package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
  77. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  78. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  79. package/dist/types/core/agents/gemini/failures.d.ts +25 -0
  80. package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
  81. package/dist/types/core/agents/gemini/login.d.ts +28 -0
  82. package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
  83. package/dist/types/core/agents/gemini/profile.d.ts +30 -0
  84. package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
  85. package/dist/types/core/agents/gemini/tools.d.ts +18 -0
  86. package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
  87. package/dist/types/core/agents/login.d.ts +15 -5
  88. package/dist/types/core/agents/login.d.ts.map +1 -1
  89. package/dist/types/core/agents/stderr-tail.d.ts +1 -1
  90. package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
  91. package/dist/types/core/presets.d.ts +2 -2
  92. package/dist/types/core/presets.d.ts.map +1 -1
  93. package/dist/types/core/processes/native-processes.d.ts +6 -0
  94. package/dist/types/core/processes/native-processes.d.ts.map +1 -1
  95. package/dist/types/core/provision/checksums.d.ts +7 -1
  96. package/dist/types/core/provision/checksums.d.ts.map +1 -1
  97. package/dist/types/core/provision/install-build.d.ts +32 -6
  98. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  99. package/dist/types/core/provision/pins.d.ts +4 -0
  100. package/dist/types/core/provision/pins.d.ts.map +1 -1
  101. package/dist/types/core/provision/provisioner.d.ts +18 -7
  102. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  103. package/dist/types/core/provision/releases.d.ts +2 -1
  104. package/dist/types/core/provision/releases.d.ts.map +1 -1
  105. package/dist/types/core/provision/tools.d.ts +36 -7
  106. package/dist/types/core/provision/tools.d.ts.map +1 -1
  107. package/dist/types/operator/errors.d.ts +5 -1
  108. package/dist/types/operator/errors.d.ts.map +1 -1
  109. package/dist/types/operator/operator.d.ts.map +1 -1
  110. package/dist/types/operator/render.d.ts +11 -6
  111. package/dist/types/operator/render.d.ts.map +1 -1
  112. package/dist/types/operator/session-tools.d.ts.map +1 -1
  113. package/dist/types/operator/types.d.ts +5 -4
  114. package/dist/types/operator/types.d.ts.map +1 -1
  115. package/dist/types/protocol/account.d.ts +4 -2
  116. package/dist/types/protocol/account.d.ts.map +1 -1
  117. package/dist/types/protocol/auth.d.ts +10 -7
  118. package/dist/types/protocol/auth.d.ts.map +1 -1
  119. package/dist/types/protocol/clis.d.ts +4 -3
  120. package/dist/types/protocol/clis.d.ts.map +1 -1
  121. package/dist/types/protocol/config.d.ts +6 -2
  122. package/dist/types/protocol/config.d.ts.map +1 -1
  123. package/dist/types/protocol/conversation.d.ts +3 -3
  124. package/dist/types/protocol/credentials.d.ts +8 -0
  125. package/dist/types/protocol/credentials.d.ts.map +1 -1
  126. package/dist/types/protocol/execution.d.ts +1 -1
  127. package/dist/types/protocol/harness.d.ts +5 -2
  128. package/dist/types/protocol/harness.d.ts.map +1 -1
  129. package/dist/types/protocol/lifecycle.d.ts +8 -8
  130. package/dist/types/protocol/models.d.ts +3 -0
  131. package/dist/types/protocol/models.d.ts.map +1 -1
  132. package/dist/types/protocol/part-input.d.ts.map +1 -1
  133. package/dist/types/protocol/text-parts.d.ts +10 -0
  134. package/dist/types/protocol/text-parts.d.ts.map +1 -0
  135. package/dist/types/protocol/wire-api.d.ts +39 -29
  136. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  137. package/dist/types/protocol/wire.d.ts +13 -10
  138. package/dist/types/protocol/wire.d.ts.map +1 -1
  139. package/dist/types/server/install.d.ts +2 -1
  140. package/dist/types/server/install.d.ts.map +1 -1
  141. package/docs/consuming.md +8 -1
  142. package/docs/deploy.md +17 -8
  143. package/docs/harnesses.md +173 -44
  144. package/package.json +1 -1
  145. package/src/core/agents/acp/account.ts +158 -0
  146. package/src/core/agents/acp/acp-agent.ts +290 -178
  147. package/src/core/agents/acp/adapter.ts +126 -35
  148. package/src/core/agents/acp/client.ts +196 -49
  149. package/src/core/agents/acp/known-agents.ts +14 -5
  150. package/src/core/agents/acp/mappings.ts +112 -21
  151. package/src/core/agents/acp/models.ts +72 -0
  152. package/src/core/agents/acp/profile.ts +133 -0
  153. package/src/core/agents/acp/prompts.ts +287 -0
  154. package/src/core/agents/acp/requests.ts +16 -9
  155. package/src/core/agents/claude-code/claude-agent.ts +2 -13
  156. package/src/core/agents/claude-code/login.ts +4 -1
  157. package/src/core/agents/claude-code/options.ts +1 -1
  158. package/src/core/agents/claude-code/session.ts +50 -16
  159. package/src/core/agents/claude-code/spawn.ts +0 -26
  160. package/src/core/agents/claude-code/turn.ts +7 -2
  161. package/src/core/agents/codex-app-server/client.ts +11 -18
  162. package/src/core/agents/codex-app-server/login.ts +4 -5
  163. package/src/core/agents/gemini/failures.ts +148 -0
  164. package/src/core/agents/gemini/login.ts +188 -0
  165. package/src/core/agents/gemini/profile.ts +163 -0
  166. package/src/core/agents/gemini/tools.ts +99 -0
  167. package/src/core/agents/login.ts +14 -8
  168. package/src/core/agents/stderr-tail.ts +5 -2
  169. package/src/core/presets.ts +15 -2
  170. package/src/core/processes/native-processes.ts +32 -1
  171. package/src/core/provision/checksums.ts +12 -2
  172. package/src/core/provision/install-build.ts +122 -55
  173. package/src/core/provision/pins.ts +5 -0
  174. package/src/core/provision/provisioner.ts +62 -27
  175. package/src/core/provision/releases.ts +47 -1
  176. package/src/core/provision/tools.ts +124 -31
  177. package/src/operator/errors.ts +5 -2
  178. package/src/operator/operator.ts +208 -91
  179. package/src/operator/render.ts +61 -33
  180. package/src/operator/session-tools.ts +2 -1
  181. package/src/operator/types.ts +5 -4
  182. package/src/protocol/account.ts +5 -2
  183. package/src/protocol/auth.ts +5 -1
  184. package/src/protocol/config.ts +4 -2
  185. package/src/protocol/credentials.ts +11 -2
  186. package/src/protocol/harness.ts +9 -1
  187. package/src/protocol/part-input.ts +2 -5
  188. package/src/protocol/text-parts.ts +10 -0
  189. package/src/server/bin.ts +20 -6
  190. package/src/server/install.ts +6 -3
@@ -1,10 +1,14 @@
1
1
  import type { PromptResponse, SessionNotification } from "@agentclientprotocol/sdk";
2
+ import { type ErrorCategory } from "../../../protocol/index.ts";
2
3
  import type { EventTransformer } from "../types.ts";
4
+ import type { AcpProfile } from "./profile.ts";
3
5
  /**
4
6
  * Parses ACP v1 raw events into AdapterEvents. The mapping is nearly identity:
5
7
  * our part vocabulary (ToolKind, tool status, locations) was aligned to ACP up
6
8
  * front, so chunks append to text/reasoning parts and
7
- * `tool_call`/`tool_call_update` upsert tool parts by `toolCallId`. Everything
9
+ * `tool_call`/`tool_call_update` upsert tool parts by `toolCallId`. Parts keep
10
+ * the order they came in: a message has one streaming part open at a time,
11
+ * which a new tool call or a chunk of the other kind finishes. Everything
8
12
  * arrives through the SDK connection, which zod-validates inbound payloads —
9
13
  * so the SDK's own types ARE the raw shapes (no defensive re-modelling).
10
14
  *
@@ -13,7 +17,13 @@ import type { EventTransformer } from "../types.ts";
13
17
  * - `{method: "session/prompt_result", params: PromptResponse}` (synthetic —
14
18
  * ACP returns the turn's stopReason as the prompt *response*, not as a
15
19
  * notification, so the agent re-injects it into the event stream)
16
- * - `{method: "error", params: {message}}` (synthetic, prompt failure)
20
+ * - `{method: "error", params: {message, category?, usage?}}` (synthetic, a
21
+ * prompt that failed: its category when the reader knows it, and the usage
22
+ * of an answer a harness reads as a failure)
23
+ * - `{method: "agentServer/mcpServers", params: {names}}` (synthetic, the
24
+ * session's MCP servers, for a harness's tool rules)
25
+ * - `{method: "agentServer/steerRead", params: {steerId}}` (synthetic, the
26
+ * agent took a steer sent as a prompt)
17
27
  *
18
28
  * v1 `messageId` on chunks is optional: when present, a change opens a new
19
29
  * wire message; when absent the whole turn is one message (the processor
@@ -29,11 +39,26 @@ export type AcpRawEvent = {
29
39
  method: "error";
30
40
  params: {
31
41
  message?: string;
42
+ category?: ErrorCategory;
43
+ usage?: PromptResponse["usage"];
44
+ };
45
+ } | {
46
+ method: "agentServer/mcpServers";
47
+ params: {
48
+ names: string[];
49
+ };
50
+ } | {
51
+ method: "agentServer/steerRead";
52
+ params: {
53
+ steerId: string;
32
54
  };
33
55
  };
34
56
  /** How a turn the agent did not get to answer ends: cancelled. */
35
57
  export declare const CANCELLED_PROMPT_RESULT: AcpRawEvent;
58
+ /** What of its harness's profile an ACP turn's adapter reads: its tool rules and its mode ids. */
59
+ export type AcpReading = Pick<AcpProfile, "tools" | "modeIds">;
60
+ /** An ACP turn's adapter; `reading` is what of its harness's profile it reads beyond ACP. */
36
61
  export declare function createAcpTransformer(ctx: {
37
62
  sessionId: string;
38
- }): EventTransformer;
63
+ }, reading?: AcpReading): EventTransformer<AcpRawEvent>;
39
64
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,cAAc,EACd,mBAAmB,EAInB,MAAM,0BAA0B,CAAC;AAmBlC,OAAO,KAAK,EAAgB,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAGnF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,GACpB;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE,GACpE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;A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MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAiR/D,6FAA6F;AAC7F,wBAAgB,oBAAoB,CACnC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,OAAO,CAAC,EAAE,UAAU,GAClB,gBAAgB,CAAC,WAAW,CAAC,CAE/B"}
@@ -1,4 +1,5 @@
1
- import type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification } from "@agentclientprotocol/sdk";
1
+ import type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, AnyMessage, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, Stream } from "@agentclientprotocol/sdk";
2
+ import type { AgentHarness } from "../../../protocol/index.ts";
2
3
  import type { NativeProcesses } from "../../processes/native-processes.ts";
3
4
  /**
4
5
  * How to start one ACP agent subprocess. Operator-level only — the wire never
@@ -10,8 +11,61 @@ export interface AcpLaunch {
10
11
  args?: string[];
11
12
  /** Extra env layered onto the subprocess (over process.env). */
12
13
  env?: Record<string, string>;
14
+ /**
15
+ * Env set over every other, the turn's included, which comes from the
16
+ * wire: what the engine keeps for its own reasons (a pinned CLI's
17
+ * self-update off), for a turn, a read with no turn and a sign-in alike.
18
+ */
19
+ fixedEnv?: Record<string, string>;
13
20
  }
14
21
  type SessionUpdateHandler = (notification: SessionNotification) => void;
22
+ /**
23
+ * What the agent is asking on one connection, read from the messages
24
+ * themselves, for an agent steered by prompt, which refuses a prompt while it
25
+ * asks. A request (a `method` and an `id`) is open from its arrival, through
26
+ * our answer to it (that `id`, no `method`) being handed to the writer, until
27
+ * the agent shows it acted on that answer: its next `session/update` for the
28
+ * same session about the tool call the request names
29
+ * (`params.toolCall.toolCallId`, a permission's; `params.toolCallId`,
30
+ * Antigravity's question). An agent may apply an answer after it was written
31
+ * (Antigravity does), and nothing else says it has. A request that names no
32
+ * tool call cannot be seen acted on: it stays open until nothing is asked any
33
+ * more (`askNothing`). A prompt goes down the same writable as the answers,
34
+ * so one sent once `idle()` settles reaches an agent that has acted on every
35
+ * answer it waited for.
36
+ */
37
+ export declare class AgentRequests {
38
+ /** Each open request, by its id: what it is about, and whether our answer is given. */
39
+ private readonly open;
40
+ private arrivals;
41
+ private waiters;
42
+ /** The connection's messages, counted as they pass: what `AcpClient` hands the SDK. */
43
+ watch(stream: Stream): Stream;
44
+ /**
45
+ * A message from the agent: an update acts on the answers given before it
46
+ * that wait for it, and a request opens what it asks.
47
+ */
48
+ received(message: AnyMessage | readonly AnyMessage[]): void;
49
+ /** A message on its way to the agent: an answer is given, and the agent is yet to act on it. */
50
+ written(message: AnyMessage | readonly AnyMessage[]): void;
51
+ /** Whether the agent is waiting for an answer. */
52
+ get pending(): boolean;
53
+ /**
54
+ * How many requests have arrived so far: a mark a later request passes
55
+ * (`arrivedSince`).
56
+ */
57
+ get arrived(): number;
58
+ /** Whether a request arrived after `mark` (`arrived`, read earlier). */
59
+ arrivedSince(mark: number): boolean;
60
+ /** Settles once the agent asks nothing, or nothing is asked any more (`askNothing`). */
61
+ idle(): Promise<void>;
62
+ /**
63
+ * Nothing is asked any more: the connection is gone, or the turn that
64
+ * asked has ended, so a request the agent never acted on is forgotten.
65
+ */
66
+ askNothing(): void;
67
+ private wake;
68
+ }
15
69
  /** Answers agent→client `session/request_permission`. Absent handler → cancelled. */
16
70
  type AcpPermissionHandler = (request: RequestPermissionRequest) => Promise<RequestPermissionResponse>;
17
71
  /** Answers agent→client `elicitation/create`. Absent handler → declined. */
@@ -27,8 +81,15 @@ export interface AcpClientOptions {
27
81
  * recorded for `sessionId` (`createAgentRegistry` passes the runtime's).
28
82
  */
29
83
  processes: NativeProcesses;
84
+ /** The harness it runs under, which its record names. */
85
+ harness: AgentHarness;
30
86
  /** The logical session it serves, which its record names. */
31
87
  sessionId?: string;
88
+ /**
89
+ * Count what the agent asks on the connection (`asking`), for an agent
90
+ * steered by prompt; otherwise the SDK gets the stream as it is.
91
+ */
92
+ watchRequests?: boolean;
32
93
  }
33
94
  /**
34
95
  * One ACP agent subprocess + its SDK connection. The engine talks to any
@@ -47,12 +108,15 @@ export declare class AcpClient {
47
108
  private readonly closeHandlers;
48
109
  private permissionHandler?;
49
110
  private elicitationHandler?;
111
+ /** What the agent is asking, until it acted on each answer: present when `watchRequests` says so. */
112
+ readonly asking?: AgentRequests;
50
113
  private exited;
51
114
  /** The stop of its process, once one began: what `gone` waits for. */
52
115
  private leaving?;
53
116
  /** Why the agent stopped, once it has: its exit code and stderr tail. */
54
117
  private exitError?;
55
- private connectionEnded;
118
+ private readonly pending;
119
+ private connectionEnd?;
56
120
  private constructor();
57
121
  /** Spawn the agent and connect. Fails if `@agentclientprotocol/sdk` is absent. */
58
122
  static create(opts: AcpClientOptions): Promise<AcpClient>;
@@ -73,8 +137,6 @@ export declare class AcpClient {
73
137
  * pass no timeout.
74
138
  */
75
139
  request<M extends AgentRequestMethod>(method: M, params: AgentRequestParamsByMethod[M], timeoutMs?: number): Promise<AgentRequestResponsesByMethod[M]>;
76
- /** Why the agent exited, waiting briefly for its exit when the connection went first. */
77
- private whyExited;
78
140
  private send;
79
141
  /** Send a notification to the agent (`session/cancel`). */
80
142
  notify<M extends AgentNotificationMethod>(method: M, params: AgentNotificationParamsByMethod[M]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAE7B,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,MAAM,0BAA0B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sugar, not wire vocabulary
5
5
  * (like the model catalog). On the wire the harness is always `acp`; these names
6
- * let entry points offer "pi" or "gemini" as first-class choices and expand
6
+ * let entry points offer "pi" or "gemini-cli" as first-class choices and expand
7
7
  * them to launch commands at the operator edge. Anything not listed here runs
8
8
  * via an explicit launch command — any ACP-compatible agent works.
9
9
  */
@@ -29,7 +29,9 @@ export declare function resolveHarnessName(name: string): {
29
29
  /**
30
30
  * Resolve an operator spec that is either a known agent name (`"pi"`) or a
31
31
  * raw launch command (`"npx -y pi-acp"`). The canonical resolver behind
32
- * `--acp-agent` and `$AGENT_SERVER_ACP_AGENT`.
32
+ * `--acp-agent` and `$AGENT_SERVER_ACP_AGENT`. A harness's own name is no
33
+ * ACP agent and no command to launch: it is refused, naming the harness and
34
+ * the known agents, so an old setting (`gemini`) says what to write instead.
33
35
  */
34
36
  export declare function resolveAcpLaunch(spec: string | undefined): AcpLaunch | undefined;
35
37
  //# sourceMappingURL=known-agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"known-agents.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/known-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAWjF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAI9E;AAOD;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GACV;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAGhF"}
1
+ {"version":3,"file":"known-agents.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/known-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAYjF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAI9E;AAOD;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GACV;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAShF"}
@@ -1,5 +1,5 @@
1
- import type { ContentBlock, McpServer, PermissionOption, RequestPermissionRequest, RequestPermissionResponse, ToolCallContent, ToolCallLocation } from "@agentclientprotocol/sdk";
2
- import type { AgentInput, McpServerConfig, PermissionMode, PermissionToolCall, ToolKind, ToolLocation, ToolResultContent } from "../../../protocol/index.ts";
1
+ import type { ContentBlock, McpServer, PermissionOption, RequestPermissionRequest, RequestPermissionResponse, SessionConfigOption, ToolCallContent, ToolCallLocation } from "@agentclientprotocol/sdk";
2
+ import type { AgentInput, FileKind, McpServerConfig, McpTool, PermissionMode, PermissionToolCall, ToolKind, ToolLocation, ToolResultContent } from "../../../protocol/index.ts";
3
3
  /**
4
4
  * The single bridge between ACP's vocabulary and the engine's. Everything here
5
5
  * is a pure conversion shared by the agent (outbound requests, permission
@@ -28,6 +28,12 @@ export interface AcpPromptCapabilities {
28
28
  image: boolean;
29
29
  embeddedContext: boolean;
30
30
  }
31
+ /**
32
+ * Refuse a file of a kind the harness does not offer (`capabilities.files`),
33
+ * before any agent starts: what an agent says it embeds is not what it reads,
34
+ * so the harness's own list decides (LLP 0020, decision 13).
35
+ */
36
+ export declare function refuseFiles(input: AgentInput, harness: string, files: readonly FileKind[]): void;
31
37
  /**
32
38
  * Engine turn input → ACP prompt content blocks. Every agent takes text and
33
39
  * resource links; image data needs the `image` capability and inline files
@@ -35,8 +41,15 @@ export interface AcpPromptCapabilities {
35
41
  * the agent cannot take fails the turn instead of vanishing.
36
42
  */
37
43
  export declare function toPromptBlocks(input: AgentInput, prompt: AcpPromptCapabilities): ContentBlock[];
38
- /** ACP permission request → the engine's PermissionToolCall (SDK-validated, no casts). */
39
- export declare function permissionToolCall(request: RequestPermissionRequest): PermissionToolCall;
44
+ /**
45
+ * ACP permission request → the engine's PermissionToolCall (SDK-validated, no
46
+ * casts). `described` is what the harness's tool rules read of the call
47
+ * (`AcpProfile.stream`): an ACP agent names its tools by no rule of its own.
48
+ */
49
+ export declare function permissionToolCall(request: RequestPermissionRequest, described?: {
50
+ mcp?: McpTool;
51
+ command?: string;
52
+ }): PermissionToolCall;
40
53
  export declare const CANCELLED_OUTCOME: RequestPermissionResponse;
41
54
  /**
42
55
  * Pick the option matching the decision: allow → `allow_once` only, deny →
@@ -47,10 +60,43 @@ export declare const CANCELLED_OUTCOME: RequestPermissionResponse;
47
60
  */
48
61
  export declare function chooseOutcome(options: PermissionOption[], allow: boolean): RequestPermissionResponse;
49
62
  /**
50
- * Decide an ACP permission request without the engine broker: mirrors the
51
- * codex posture where only `default` mode asks — every other mode auto-decides.
63
+ * Whether a request is the user's to answer in `mode`, when the turn has a
64
+ * broker: everything in `default`; in `accept_edits` what is neither an edit
65
+ * nor a read, as Claude and Codex ask for a command in that mode. Every other
66
+ * mode decides by itself (`autoDecide`).
67
+ */
68
+ export declare function asksInMode(request: RequestPermissionRequest, mode: PermissionMode): boolean;
69
+ /**
70
+ * Decide an ACP permission request without the engine broker:
71
+ * `bypass_permissions` allows everything, `accept_edits` edits and reads, and
72
+ * every other mode denies.
52
73
  */
53
74
  export declare function autoDecide(request: RequestPermissionRequest, mode: PermissionMode | undefined): RequestPermissionResponse;
54
- /** An ACP mode id the engine has a name for: its own, or Claude's (claude-agent-acp). */
75
+ /** An ACP mode id the engine has a name for: its own, or Claude's (claude-agent-acp), however it is cased and separated. */
55
76
  export declare function permissionModeOf(modeId: string): PermissionMode | undefined;
77
+ /** An agent's own id for an engine mode, where its ids name none (`AcpProfile.modeIds`). */
78
+ export type ModeIds = Partial<Record<PermissionMode, string>>;
79
+ /**
80
+ * An agent's mode ids and the engine's modes, each way: the agent's own ids
81
+ * first (`own`), then the ids that name a mode (`permissionModeOf`).
82
+ */
83
+ export declare function modeNames(own?: ModeIds): {
84
+ /** The engine's mode an agent's mode id is, when the engine can name it. */
85
+ modeOf: (modeId: string) => PermissionMode | undefined;
86
+ /** The agent's id for `mode`, of the ids it offers. */
87
+ idOf: (mode: PermissionMode, offered: readonly string[]) => string | undefined;
88
+ };
89
+ /** A select config option (`model`, `thought_level`). */
90
+ export type SelectOption = SessionConfigOption & {
91
+ type: "select";
92
+ };
93
+ /** Every choice a select option offers, whether listed flat or in groups. */
94
+ export declare function selectableChoices(option: SelectOption): Array<{
95
+ value: string;
96
+ name: string;
97
+ }>;
98
+ /** Every value a select option offers. */
99
+ export declare function selectableValues(option: SelectOption): string[];
100
+ /** The agent's select option of a category, as it stands. */
101
+ export declare function selectOf(options: readonly SessionConfigOption[], category: "model" | "thought_level"): SelectOption | undefined;
56
102
  //# sourceMappingURL=mappings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappings.d.ts","sourceRoot":"","sources":["../../../../../src/core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7E;AAED,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEpE,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAM9F;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAE/D;AAED,6DAA6D;AAC7D,wBAAgB,QAAQ,CACvB,OAAO,EAAE,SAAS,mBAAmB,EAAE,EACvC,QAAQ,EAAE,OAAO,GAAG,eAAe,GACjC,YAAY,GAAG,SAAS,CAI1B"}
@@ -0,0 +1,22 @@
1
+ import type { AgentHarness, ModelDescriptor } from "../../../protocol/index.ts";
2
+ import type { ListModelsOptions } from "../base.ts";
3
+ import { type AcpAccount } from "./account.ts";
4
+ import { type SelectOption } from "./mappings.ts";
5
+ /**
6
+ * The model a turn that names none runs, for a harness that lists its
7
+ * models: the agent's current one when the harness offers it, else the first
8
+ * the agent lists that it offers (a person's own default may be another
9
+ * vendor's model), else none.
10
+ */
11
+ export declare function defaultModel(option: SelectOption, offers: (value: string) => boolean): string | undefined;
12
+ /**
13
+ * The models an agent offers, from a session with no turn: each value of its
14
+ * `model` option that `offers` takes, labelled by the option's name, the
15
+ * default the one a turn naming none runs (`defaultModel`). A model's levels
16
+ * are those its `thought_level` offers once it is set, which change with the
17
+ * model, so each is set in turn; only the default model's level is its own,
18
+ * the others carrying over the one set before. The read stops between models
19
+ * once `signal` aborts.
20
+ */
21
+ export declare function listAcpModels(account: AcpAccount, harness: AgentHarness, offers: (value: string) => boolean, options: ListModelsOptions): Promise<ModelDescriptor[]>;
22
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,KAAK,UAAU,EAA8B,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,KAAK,YAAY,EAAiD,MAAM,eAAe,CAAC;AAGjG;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,sBAMpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAClC,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,eAAe,EAAE,CAAC,CAmC5B"}
@@ -0,0 +1,97 @@
1
+ import type { InitializeResponse } from "@agentclientprotocol/sdk";
2
+ import type { AgentCapabilities, AgentHarness, McpTool, PermissionMode, RunConfig } from "../../../protocol/index.ts";
3
+ import type { AgentExecuteOptions } from "../base.ts";
4
+ import type { CliLogin } from "../login.ts";
5
+ import type { AcpAccount } from "./account.ts";
6
+ import type { AcpLaunch } from "./client.ts";
7
+ import type { ModeIds } from "./mappings.ts";
8
+ /** A tool call as the agent names it: ACP's `name`, its input, and once it ended its output. */
9
+ export interface AcpToolCall {
10
+ name?: string | null;
11
+ rawInput?: unknown;
12
+ rawOutput?: unknown;
13
+ }
14
+ /** What a harness reads of its agent's tool calls beyond ACP's kind and text (LLP 0002). */
15
+ export interface AcpToolRules {
16
+ /**
17
+ * What a call acts on, from the agent's own names: its MCP server and
18
+ * tool, told apart against the session's own server names, and a
19
+ * command's line. What it does not say is left out.
20
+ */
21
+ describe(call: AcpToolCall, servers: readonly string[]): {
22
+ mcp?: McpTool;
23
+ command?: string;
24
+ };
25
+ /**
26
+ * A finished call's output, where the agent's `rawOutput` holds it: its
27
+ * text, a command's exit code (`metadata.exitCode`; non-zero fails the
28
+ * call), and `failed` for a call the agent says did not run, with no exit
29
+ * code to say it (the text then says why). Undefined: ACP's reading.
30
+ */
31
+ output?(call: AcpToolCall): {
32
+ text: string;
33
+ exitCode?: number;
34
+ failed?: boolean;
35
+ } | undefined;
36
+ }
37
+ /**
38
+ * What one ACP agent decides that the protocol does not: the name it runs
39
+ * under, what it supports (`capabilities.steering`: a prompt sent while one
40
+ * runs is input to the running turn), how it starts, and where it departs
41
+ * from what its `initialize` says. The protocol is `ProfiledAcpAgent`'s, so a harness
42
+ * that runs one agent over ACP is a profile, never a second client; it
43
+ * reaches the agent only through its harness's registration
44
+ * (`ProfiledAcpAgent`). Operator-level only: nothing in it comes from the
45
+ * wire.
46
+ */
47
+ export interface AcpProfile {
48
+ /** The harness it runs under: its turns, its processes and its host-tool leases say so. */
49
+ readonly harness: AgentHarness;
50
+ /** What it supports (LLP 0001, D22). */
51
+ readonly capabilities: AgentCapabilities;
52
+ /**
53
+ * The agent subprocess to start, undefined when none is configured. Never
54
+ * from the wire: the command is arbitrary code execution.
55
+ */
56
+ launch(): Promise<AcpLaunch | undefined> | AcpLaunch | undefined;
57
+ /** Throws for a turn it cannot run (a setting the agent cannot honour), first in the turn, before anything starts. */
58
+ admit?(options: AgentExecuteOptions): void;
59
+ /** Throws for an agent it cannot drive (a version below its floor), at once after `initialize`. */
60
+ accept?(init: InitializeResponse): void;
61
+ /** The agent takes HTTP MCP servers, though its `initialize` does not say so. */
62
+ readonly httpMcp?: boolean;
63
+ /** The agent's own id for an engine mode, where its ids name none (`permissionModeOf`). */
64
+ readonly modeIds?: ModeIds;
65
+ /**
66
+ * Appended after the launch's own arguments. A turn in a mode with different
67
+ * arguments gets its own process, which resumes the conversation.
68
+ */
69
+ readonly modeArgs?: Partial<Record<PermissionMode, readonly string[]>>;
70
+ /**
71
+ * What a new conversation starts with and keeps for its life: `meta(options)`
72
+ * goes with `session/new`, never with a resume or a load. A later turn on
73
+ * that conversation whose `meta` differs did not apply `settings`.
74
+ */
75
+ readonly newSession?: {
76
+ readonly settings: readonly (keyof RunConfig)[];
77
+ meta(options: AgentExecuteOptions): Record<string, unknown> | undefined;
78
+ };
79
+ /**
80
+ * Present: the harness lists its models, and a turn runs only one it
81
+ * `offers`, also when it names none. Absent: a turn names any the agent
82
+ * offers.
83
+ */
84
+ readonly models?: {
85
+ offers(value: string): boolean;
86
+ };
87
+ /** What its tool calls are beyond ACP's kind; the harness's adapter reads them the same. */
88
+ readonly tools?: AcpToolRules;
89
+ /**
90
+ * Its CLI's own login (`Agent.login`), which reads the account through
91
+ * the agent's own sessions with no turn. Absent: the agent signs in on its own.
92
+ */
93
+ login?(account: AcpAccount): CliLogin;
94
+ }
95
+ /** The `acp` harness: any ACP v1 agent the operator launches, taken at its `initialize`'s word. */
96
+ export declare function genericAcpProfile(launch: AcpProfile["launch"]): AcpProfile;
97
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,cAAc,EACd,SAAS,EACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,gGAAgG;AAChG,MAAM,WAAW,WAAW;IAC3B,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QAAQ,CAAC,UAAU,CAAC,EAAE;QACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,SAAS,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;KACxE,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACrD,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,CAAC;CACtC;AAmCD,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAE1E"}
@@ -0,0 +1,108 @@
1
+ import type { ContentBlock, PromptResponse, SessionUpdate } from "@agentclientprotocol/sdk";
2
+ import type { AgentRequests } from "./client.ts";
3
+ /** How a turn's prompts end, and the steers the agent read on the way. */
4
+ export interface PromptEnds {
5
+ /** The agent read a steer: its echo goes before what the agent says next. */
6
+ read(steerId: string): void;
7
+ /** No prompt is in flight: the newest prompt's stop reason, the usage summed over every answer. */
8
+ ended(result: Pick<PromptResponse, "stopReason" | "usage">): void;
9
+ /** The turn's own prompt failed, and no prompt is in flight. */
10
+ failed(error: unknown): void;
11
+ }
12
+ export interface TurnPromptsOptions {
13
+ /** Send a prompt on the turn's session. */
14
+ send(prompt: ContentBlock[]): Promise<PromptResponse>;
15
+ /** What the agent asks, for a turn that takes steers (`AcpClient.asking`). */
16
+ asking?: AgentRequests;
17
+ /** The turn's: once aborted no steer is sent, and those left are undelivered. */
18
+ signal: AbortSignal;
19
+ ends: PromptEnds;
20
+ }
21
+ /**
22
+ * The prompts a turn has in flight: its own, then each steer, sent as a
23
+ * prompt of its own to an agent that takes a prompt while one runs as input
24
+ * to the running turn (Antigravity). Such an agent answers the prompt before
25
+ * at once (`end_turn`, the usage of the steps it finished) and goes on; it
26
+ * refuses a prompt while it asks the person.
27
+ *
28
+ * - Order: steers wait in order, and the head stays the head until it is
29
+ * settled. It is sent once the agent asks nothing (`asking`); it is taken
30
+ * when the prompt before it answers, and refused when its own prompt
31
+ * fails. A refused head goes again, in place, only when a request of the
32
+ * agent's arrived after it was sent (the two crossed); refused with none
33
+ * between, it is undelivered, and the next steer is the head.
34
+ * - Read: a taken steer is read by the first model call that starts after
35
+ * it was taken; the call running then goes on without it. A call ends with
36
+ * a usage report (`usage_update`, after every call; its tool calls are
37
+ * announced after it), and its output is its message and thought chunks.
38
+ * Taken while a call streams (from its first chunk to its usage report),
39
+ * it waits for that report, whatever tool calls are open (a command left
40
+ * running in the background). Otherwise, while a tool call of the turn is
41
+ * open, or after a call's usage report or the end of its last open tool
42
+ * call with no chunk since, no call is known to run: it is read at the
43
+ * next chunk, or the next usage report for a call that made none. After a tool ends the wire cannot
44
+ * tell whether Antigravity's next call carries it (one run of three did):
45
+ * the echo is then one message early at worst, never after its reply. Otherwise one usage report must pass first, then the same. A steer's
46
+ * own answer reads nothing (a later steer supersedes it at once); one still
47
+ * unread when the turn ends with its prompts answered, cancelled included,
48
+ * is read then, and none when the turn fails. The echo goes out just before
49
+ * what it is read at (`update`). One whose own prompt fails was never read,
50
+ * and is undelivered.
51
+ * - Result: the turn ends when no prompt is in flight, with the stop reason
52
+ * of the newest prompt sent that answered and the usage of every answer.
53
+ */
54
+ export declare class TurnPrompts {
55
+ private readonly options;
56
+ private readonly flying;
57
+ /** Steers not yet taken, the head first. */
58
+ private readonly waiting;
59
+ /** Steers taken and not yet read, in order. */
60
+ private readonly taken;
61
+ /** The turn's tool calls not yet `completed` or `failed`: while one is, no model call runs. */
62
+ private readonly tools;
63
+ /** The turn has made a chunk or a tool update. */
64
+ private produced;
65
+ /** No call's output since a call (its usage report, after output) or the last open tool call ended. */
66
+ private betweenCalls;
67
+ /** A model call is streaming, for certain: from a chunk to the next usage report. */
68
+ private streaming;
69
+ private sent;
70
+ private newest?;
71
+ private usage?;
72
+ private failure?;
73
+ private done;
74
+ private pumping;
75
+ private settle;
76
+ /** Settles once no prompt is in flight, or the agent is gone. */
77
+ readonly settled: Promise<void>;
78
+ constructor(options: TurnPromptsOptions);
79
+ /** Whether the turn still takes a prompt. */
80
+ get open(): boolean;
81
+ /** The turn's own prompt. */
82
+ start(prompt: ContentBlock[]): void;
83
+ /** A steer: it waits behind the steers before it. */
84
+ steer(steerId: string, prompt: ContentBlock[]): void;
85
+ /**
86
+ * An update of the turn's session, before it goes out: a chunk reads the
87
+ * steers taken whose call has started, a usage report ends a call.
88
+ */
89
+ update(update: SessionUpdate): void;
90
+ /** How many steers taken, in order, are past every usage report they waited for. */
91
+ private ready;
92
+ /** The agent is gone: nothing more is told. */
93
+ close(): void;
94
+ private send;
95
+ private answered;
96
+ private refused;
97
+ /** The head is taken: the next steer is the head. */
98
+ private take;
99
+ /** Read the first `count` steers taken. */
100
+ private read;
101
+ /** Send the head once the agent asks nothing, unless it is in flight already. */
102
+ private pump;
103
+ /** Whether a steer may still go: the turn runs, and its own prompt has not failed. */
104
+ private get sending();
105
+ private remove;
106
+ private endIfIdle;
107
+ }
108
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAS,MAAM,0BAA0B,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkCjD,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IAC1B,6EAA6E;IAC7E,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mGAAmG;IACnG,KAAK,CAAC,MAAM,E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AED,6BAA6B;IAC7B,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI;IAInC,qDAAqD;IACrD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI;IAKpD;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAgCnC,oFAAoF;IACpF,OAAO,CAAC,KAAK;IAKb,+CAA+C;IAC/C,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,IAAI;IASZ,OAAO,CAAC,QAAQ;IAgBhB,OAAO,CAAC,OAAO;IAef,qDAAqD;IACrD,OAAO,CAAC,IAAI;IAcZ,2CAA2C;IAC3C,OAAO,CAAC,IAAI;IAIZ,iFAAiF;YACnE,IAAI;IAqBlB,sFAAsF;IACtF,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,SAAS;CAcjB"}
@@ -1,6 +1,7 @@
1
1
  import type { CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse } from "@agentclientprotocol/sdk";
2
- import type { PermissionMode } from "../../../protocol/index.ts";
2
+ import type { McpTool, PermissionMode } from "../../../protocol/index.ts";
3
3
  import type { ElicitationRequestHandler, PermissionRequestHandler } from "../base.ts";
4
+ import type { AcpToolCall } from "./profile.ts";
4
5
  /**
5
6
  * What the turn running on a session answers the agent's requests with: set
6
7
  * and cleared as ONE value, so stale partial state (an authorization bypass)
@@ -20,6 +21,11 @@ export interface TurnScope {
20
21
  export interface RequestScope {
21
22
  readonly acpSessionId: string;
22
23
  turn?: TurnScope;
24
+ /** What the harness's tool rules read of a call (`AcpProfile.stream`). */
25
+ describe?(call: AcpToolCall): {
26
+ mcp?: McpTool;
27
+ command?: string;
28
+ };
23
29
  }
24
30
  /** Answer an agent permission request against the session's current turn. */
25
31
  export declare function answerPermission(scope: RequestScope, request: RequestPermissionRequest): Promise<RequestPermissionResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAUtF;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wFAAwF;AACxF,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,6EAA6E;AAC7E,wBAAsB,gBAAgB,CACrC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CAuCpC;AAcD,mFAAmF;AACnF,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CA0BpC"}
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAUtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wFAAwF;AACxF,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0EAA0E;IAC1E,QAAQ,CAAC,CAAC,IAAI,EAAE,WAAW,GAAG;QAAE,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAED,6EAA6E;AAC7E,wBAAsB,gBAAgB,CACrC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CA0CpC;AAcD,mFAAmF;AACnF,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CA0BpC"}
@@ -47,7 +47,6 @@ export declare class ClaudeCodeAgent extends SessionAgent {
47
47
  readonly login: ClaudeCliLogin;
48
48
  private readonly pool;
49
49
  private readonly credentials?;
50
- private readonly cancelGraceMs;
51
50
  private readonly host?;
52
51
  constructor(agentOptions?: ClaudeCodeAgentOptions);
53
52
  /** Options on a credential the product holds, when it holds one. */
@@ -74,7 +73,7 @@ export declare class ClaudeCodeAgent extends SessionAgent {
74
73
  * before the SDK interrupt lands (the abort-order race that could surface
75
74
  * a clean user cancel as `error`/`end_turn`). The SDK interrupt's
76
75
  * round-trip confirms the cancel, and so does the turn's end, whoever ended
77
- * it: Claude, or the grace that ended its process (`endUnstopped`). An
76
+ * it: Claude, or the grace that ended its process (`cancelTurn`). An
78
77
  * interrupt that fails while the turn runs is unconfirmed at once.
79
78
  */
80
79
  private interrupt;
@@ -1 +1 @@
1
- {"version":3,"file":"claude-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/claude-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAEX,UAAU,EACV,eAAe,EACf,eAAe,EAEf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,qCAAqC,CAAC;AAIlG,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,sBAAsB,EAAuB,MAAM,cAAc,CAAC;AAShF,KAAK,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;AA0B1D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAkChE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,cAAc,CAMjF;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAWpC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAVzC,QAAQ,CAAC,OAAO,EAAG,aAAa,CAAU;IAC1C,QAAQ,CAAC,YAAY;;;;;;;;;;;;;MAAgB;IACrC,iGAAiG;IACjG,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