@agentclientprotocol/claude-agent-acp 0.90.1-preview.1 → 0.90.1-preview.11

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.
@@ -49,6 +49,13 @@ export class AcpToolCallRenderer {
49
49
  get keepsMeta() {
50
50
  return this.capabilities.air.client || this.capabilities.v2;
51
51
  }
52
+ /**
53
+ * Whether a tool call with these facts gets a display terminal: a command, for a client
54
+ * that renders terminals.
55
+ */
56
+ hasTerminal(facts) {
57
+ return facts.command === true && this.capabilities.terminalOutput;
58
+ }
52
59
  /**
53
60
  * The status of a tool result. Claude Code reports a run that it aborted in
54
61
  * one of three ways:
@@ -100,9 +107,7 @@ export class AcpToolCallRenderer {
100
107
  return {
101
108
  _meta: {
102
109
  ...this.toolUseMeta(toolUse, options.cwd),
103
- ...(facts.command && this.capabilities.terminalOutput
104
- ? { terminal_info: { terminal_id: toolUse.id } }
105
- : {}),
110
+ ...(this.hasTerminal(facts) ? { terminal_info: { terminal_id: toolUse.id } } : {}),
106
111
  // Only AIR gets the MCP flag. The upstream adapter does not send it.
107
112
  ...(isMcp && this.capabilities.air.client ? { is_mcp_tool_call: true } : {}),
108
113
  },
@@ -462,7 +467,7 @@ export class AcpToolCallRenderer {
462
467
  * client `failed`, since v1 has no `cancelled`. If Claude Code ran it but
463
468
  * returned no result, it failed, unless a `session/cancel` ended the turn
464
469
  * (`cancelled`): the cancel stopped the run, so a v2 client gets `cancelled`
465
- * for it too.
470
+ * for it too. The report does not end the call's terminal: see {@link terminalExit}.
466
471
  */
467
472
  unfinished(call) {
468
473
  const stopped = !call.ran || call.cancelled === true;
@@ -479,6 +484,24 @@ export class AcpToolCallRenderer {
479
484
  ],
480
485
  };
481
486
  }
487
+ /**
488
+ * The `_meta` that ends the display terminal of a command whose tool call gets no result, to
489
+ * add to the report from {@link unfinished}. Undefined when the tool call has no terminal
490
+ * (see {@link toolCall}). The exit code is unknown, since the command ended without a result:
491
+ * null, or 1 for AIR, which always gets a number and reads 1 for a command that did not
492
+ * succeed.
493
+ */
494
+ terminalExit(toolUse) {
495
+ if (!this.hasTerminal(this.facts(toolUse)))
496
+ return undefined;
497
+ return {
498
+ terminal_exit: {
499
+ terminal_id: toolUse.id,
500
+ exit_code: this.capabilities.air.client ? 1 : null,
501
+ signal: null,
502
+ },
503
+ };
504
+ }
482
505
  /**
483
506
  * The report of a tool progress beat. The field tracker sends the
484
507
  * `in_progress` status once, so a later beat carries only the progress.
@@ -529,7 +552,7 @@ export class AcpToolCallRenderer {
529
552
  * does not render `rawInput` itself, and never next to a terminal.
530
553
  */
531
554
  toolUseContent(toolCallId, facts) {
532
- const terminal = facts.command === true && this.capabilities.terminalOutput;
555
+ const terminal = this.hasTerminal(facts);
533
556
  return [
534
557
  ...(terminal ? [{ type: "terminal", terminalId: toolCallId }] : []),
535
558
  ...(facts.change ?? []),
@@ -53,7 +53,11 @@ export interface TurnEvents {
53
53
  * the cycle reports nothing more, and the turn reports from there.
54
54
  */
55
55
  export interface ForegroundEvents {
56
- /** The work started, or works again after it waited for the user. */
56
+ /**
57
+ * The work started, or works again after it waited for the user. Not after
58
+ * a wait that a cancel ended: Claude Code's interrupt withdrew the last
59
+ * request, so the work is being stopped, and {@link ended} follows at once.
60
+ */
57
61
  running(): void;
58
62
  /**
59
63
  * The work waits for the user: a permission request or a question is open in
@@ -1 +1 @@
1
- {"version":3,"file":"turn-events.d.ts","sourceRoot":"","sources":["../src/turn-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM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IG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB;;;;OAIG;IACH,YAAY,IAAI,IAAI,CAAC;IACrB,sBAAsB;IACtB,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;AAEnG,wBAAwB;AACxB,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
@@ -28,7 +28,8 @@ export declare function v2Prompt(agent: ClaudeAcpAgent, params: v2.PromptRequest
28
28
  *
29
29
  * - Started: `running`. For a prompt's turn, right after its `user_message`.
30
30
  * - Waiting on a permission request or a question: `requires_action`, and
31
- * `running` once none is open.
31
+ * `running` once none is open, unless a cancel withdrew the last one: the
32
+ * work is being stopped then, and its `idle` follows.
32
33
  * - Ended: `idle` with the stop reason, usage, and `_meta` of the work.
33
34
  * - Failed: `idle` with the `error` stop reason and the JSON-RPC error that v1
34
35
  * answers the prompt with, so a client can show its message and handle its
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/v2/prompt.ts"],"names":[],"mappings":"A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AAC,cAAc,CAAC,CAiC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,GAAG,gBAAgB,CAoBvF;AAgCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,aAAa,GAAG,aAAa,CAEvF"}
package/dist/v2/prompt.js CHANGED
@@ -57,7 +57,8 @@ export function v2Prompt(agent, params, send) {
57
57
  *
58
58
  * - Started: `running`. For a prompt's turn, right after its `user_message`.
59
59
  * - Waiting on a permission request or a question: `requires_action`, and
60
- * `running` once none is open.
60
+ * `running` once none is open, unless a cancel withdrew the last one: the
61
+ * work is being stopped then, and its `idle` follows.
61
62
  * - Ended: `idle` with the stop reason, usage, and `_meta` of the work.
62
63
  * - Failed: `idle` with the `error` stop reason and the JSON-RPC error that v1
63
64
  * answers the prompt with, so a client can show its message and handle its
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.90.1-preview.1",
6
+ "version": "0.90.1-preview.11",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",