@zvada/agent-server 0.3.11 → 0.3.12

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.12
4
+
5
+ - Report a Claude turn whose API call failed as an error. Claude Code ends it
6
+ as a `success` result flagged `is_error` (a rejected key, an exhausted quota,
7
+ an overloaded provider), with the failure as its text; it was reported as a
8
+ completed `end_turn` whose answer quoted the failure. The failure's text now
9
+ classifies the error (a 401 is `auth`).
10
+
3
11
  ## 0.3.11
4
12
 
5
13
  - Report a Claude turn stopped while a tool runs as `cancelled`. Claude Code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zvada/agent-server",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Harness-agnostic agent execution engine: run Claude Code, Codex (SDK/CLI + app-server), and any ACP agent behind one interface with a normalized event stream, multi-turn sessions, and resume. Root export is the wire contract; /core, /server, /client are the seats.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -97,6 +97,8 @@ type ClaudeMessage =
97
97
  turn_cost_usd?: number | null;
98
98
  stop_reason?: string | null;
99
99
  is_error?: boolean;
100
+ /** On an `is_error` success, the API failure's text. */
101
+ result?: string;
100
102
  };
101
103
 
102
104
  type BlockKind = "text" | "reasoning" | "tool";
@@ -505,7 +507,7 @@ export class ClaudeCodeTransformer implements EventTransformer<unknown> {
505
507
  }
506
508
 
507
509
  private captureResult(msg: Extract<ClaudeMessage, { type: "result" }>): AdapterEvent[] {
508
- this.succeeded = msg.subtype === "success";
510
+ this.succeeded = msg.subtype === "success" && !msg.is_error;
509
511
  if (msg.usage) {
510
512
  const creation = msg.usage.cache_creation;
511
513
  this.usage = {
@@ -538,6 +540,11 @@ export class ClaudeCodeTransformer implements EventTransformer<unknown> {
538
540
  } else {
539
541
  this.error = `Claude turn ended: ${msg.subtype}`;
540
542
  }
543
+ } else if (msg.is_error) {
544
+ // A failed API call (a rejected key, an exhausted quota, an overloaded
545
+ // provider) ends the turn as a "success" whose text is the error. The
546
+ // text names the failure, so the runtime classifies it (401 -> auth).
547
+ this.error = msg.result || "Claude turn ended with an API error";
541
548
  }
542
549
  // Final authoritative gauge: the result knows the context-window size.
543
550
  if (!msg.usage) return [];