@autohq/cli 0.1.196 → 0.1.197

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.
@@ -26640,7 +26640,7 @@ Object.assign(lookup, {
26640
26640
  // package.json
26641
26641
  var package_default = {
26642
26642
  name: "@autohq/cli",
26643
- version: "0.1.196",
26643
+ version: "0.1.197",
26644
26644
  license: "SEE LICENSE IN README.md",
26645
26645
  publishConfig: {
26646
26646
  access: "public"
@@ -27109,13 +27109,14 @@ var ClaudeCodeProjector = class {
27109
27109
  }
27110
27110
  };
27111
27111
  function projectClaudeCodeResult(result) {
27112
+ const failedButRecoverable = isRecoverableToolUseDiagnostic(result);
27112
27113
  return {
27113
27114
  type: "entry",
27114
27115
  entry: {
27115
27116
  role: "system",
27116
27117
  kind: "status",
27117
27118
  status: result.isError ? "failed" : "completed",
27118
- sessionStatusAfter: result.isError ? "failed" : "awaiting",
27119
+ sessionStatusAfter: result.isError && !failedButRecoverable ? "failed" : "awaiting",
27119
27120
  content: {
27120
27121
  parts: [
27121
27122
  {
@@ -27127,6 +27128,13 @@ function projectClaudeCodeResult(result) {
27127
27128
  }
27128
27129
  };
27129
27130
  }
27131
+ function isRecoverableToolUseDiagnostic(result) {
27132
+ if (!result.isError) {
27133
+ return false;
27134
+ }
27135
+ const message = result.errorMessage ?? "";
27136
+ return message.startsWith("[ede_diagnostic]") && message.includes("stop_reason=tool_use");
27137
+ }
27130
27138
  function anthropicMessageIdFromStreamStart(message) {
27131
27139
  const event = message.event;
27132
27140
  if (event.type !== "message_start") {
@@ -47216,7 +47224,8 @@ var ClaudeAgentBridgeSessionImpl = class {
47216
47224
  return this.pendingToolUseIds.size > 0;
47217
47225
  }
47218
47226
  // Track tool_use/tool_result pairs as they stream so hasInFlightToolUse()
47219
- // reflects the live transcript. tool_use opens a call; the matching
47227
+ // reflects the live transcript. A tool_use may appear first as a streaming
47228
+ // content block before the full assistant message is available; the matching
47220
47229
  // tool_result closes it; the turn's terminal result clears any remainder.
47221
47230
  trackToolUseLifecycle(message) {
47222
47231
  for (const id of toolUseIds(message)) {
@@ -47469,12 +47478,20 @@ function isClaudeAgentTurnResult(message) {
47469
47478
  return message.type === "result";
47470
47479
  }
47471
47480
  function toolUseIds(message) {
47472
- if (message.type !== "assistant") {
47481
+ if (message.type === "assistant") {
47482
+ return contentBlocks(message.message.content).flatMap(
47483
+ (block2) => block2.type === "tool_use" && typeof block2.id === "string" ? [block2.id] : []
47484
+ );
47485
+ }
47486
+ if (message.type !== "stream_event") {
47473
47487
  return [];
47474
47488
  }
47475
- return contentBlocks(message.message.content).flatMap(
47476
- (block) => block.type === "tool_use" && typeof block.id === "string" ? [block.id] : []
47477
- );
47489
+ const event = message.event;
47490
+ if (event.type !== "content_block_start") {
47491
+ return [];
47492
+ }
47493
+ const block = event.content_block;
47494
+ return block.type === "tool_use" && typeof block.id === "string" ? [block.id] : [];
47478
47495
  }
47479
47496
  function toolResultIds(message) {
47480
47497
  if (message.type !== "user") {
package/dist/index.js CHANGED
@@ -21623,7 +21623,7 @@ var init_package = __esm({
21623
21623
  "package.json"() {
21624
21624
  package_default = {
21625
21625
  name: "@autohq/cli",
21626
- version: "0.1.196",
21626
+ version: "0.1.197",
21627
21627
  license: "SEE LICENSE IN README.md",
21628
21628
  publishConfig: {
21629
21629
  access: "public"
@@ -31701,13 +31701,14 @@ var ClaudeCodeProjector = class {
31701
31701
  }
31702
31702
  };
31703
31703
  function projectClaudeCodeResult(result) {
31704
+ const failedButRecoverable = isRecoverableToolUseDiagnostic(result);
31704
31705
  return {
31705
31706
  type: "entry",
31706
31707
  entry: {
31707
31708
  role: "system",
31708
31709
  kind: "status",
31709
31710
  status: result.isError ? "failed" : "completed",
31710
- sessionStatusAfter: result.isError ? "failed" : "awaiting",
31711
+ sessionStatusAfter: result.isError && !failedButRecoverable ? "failed" : "awaiting",
31711
31712
  content: {
31712
31713
  parts: [
31713
31714
  {
@@ -31719,6 +31720,13 @@ function projectClaudeCodeResult(result) {
31719
31720
  }
31720
31721
  };
31721
31722
  }
31723
+ function isRecoverableToolUseDiagnostic(result) {
31724
+ if (!result.isError) {
31725
+ return false;
31726
+ }
31727
+ const message = result.errorMessage ?? "";
31728
+ return message.startsWith("[ede_diagnostic]") && message.includes("stop_reason=tool_use");
31729
+ }
31722
31730
  function anthropicMessageIdFromStreamStart(message) {
31723
31731
  const event = message.event;
31724
31732
  if (event.type !== "message_start") {
@@ -32236,7 +32244,8 @@ var ClaudeAgentBridgeSessionImpl = class {
32236
32244
  return this.pendingToolUseIds.size > 0;
32237
32245
  }
32238
32246
  // Track tool_use/tool_result pairs as they stream so hasInFlightToolUse()
32239
- // reflects the live transcript. tool_use opens a call; the matching
32247
+ // reflects the live transcript. A tool_use may appear first as a streaming
32248
+ // content block before the full assistant message is available; the matching
32240
32249
  // tool_result closes it; the turn's terminal result clears any remainder.
32241
32250
  trackToolUseLifecycle(message) {
32242
32251
  for (const id of toolUseIds(message)) {
@@ -32489,12 +32498,20 @@ function isClaudeAgentTurnResult(message) {
32489
32498
  return message.type === "result";
32490
32499
  }
32491
32500
  function toolUseIds(message) {
32492
- if (message.type !== "assistant") {
32501
+ if (message.type === "assistant") {
32502
+ return contentBlocks(message.message.content).flatMap(
32503
+ (block2) => block2.type === "tool_use" && typeof block2.id === "string" ? [block2.id] : []
32504
+ );
32505
+ }
32506
+ if (message.type !== "stream_event") {
32493
32507
  return [];
32494
32508
  }
32495
- return contentBlocks(message.message.content).flatMap(
32496
- (block) => block.type === "tool_use" && typeof block.id === "string" ? [block.id] : []
32497
- );
32509
+ const event = message.event;
32510
+ if (event.type !== "content_block_start") {
32511
+ return [];
32512
+ }
32513
+ const block = event.content_block;
32514
+ return block.type === "tool_use" && typeof block.id === "string" ? [block.id] : [];
32498
32515
  }
32499
32516
  function toolResultIds(message) {
32500
32517
  if (message.type !== "user") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.196",
3
+ "version": "0.1.197",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"