@autohq/cli 0.1.196 → 0.1.198

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.198",
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.198",
21627
21627
  license: "SEE LICENSE IN README.md",
21628
21628
  publishConfig: {
21629
21629
  access: "public"
@@ -25935,14 +25935,6 @@ function ConversationView({
25935
25935
  const isFailed = status === "failed";
25936
25936
  const showPalette = input.startsWith("/") && !isFailed;
25937
25937
  const paletteQuery = showPalette ? input.slice(1) : "";
25938
- useInput3((_input, key) => {
25939
- if (key.escape) {
25940
- if (showPalette) {
25941
- setInput("");
25942
- return;
25943
- }
25944
- }
25945
- });
25946
25938
  const { finalized, pending } = useMemo2(
25947
25939
  () => partitionTranscriptRows(entries),
25948
25940
  [entries]
@@ -25950,6 +25942,21 @@ function ConversationView({
25950
25942
  const pendingQuestion = isFailed ? null : pendingQuestionRow([...finalized, ...pending], answeredQuestionIds);
25951
25943
  const showQuestionPrompt = pendingQuestion !== null && pendingQuestion.toolCallId !== null && !dismissedQuestionIds.has(pendingQuestion.toolCallId);
25952
25944
  const pendingQuestionToolCallId = pendingQuestion?.toolCallId ?? null;
25945
+ useInput3((_input, key) => {
25946
+ if (!key.escape) {
25947
+ return;
25948
+ }
25949
+ switch (conversationEscapeAction({ showPalette, showQuestionPrompt })) {
25950
+ case "clear-command-palette":
25951
+ setInput("");
25952
+ return;
25953
+ case "defer-to-question-prompt":
25954
+ return;
25955
+ case "go-back":
25956
+ exit();
25957
+ return;
25958
+ }
25959
+ });
25953
25960
  const handleSubmit = useCallback(
25954
25961
  async (value) => {
25955
25962
  if (!value.trim()) return;
@@ -26126,7 +26133,7 @@ function ConversationView({
26126
26133
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: workingDirectory })
26127
26134
  ] }),
26128
26135
  /* @__PURE__ */ jsx4(Text4, { children: " " }),
26129
- /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "/back to exit \xB7 scroll for history" })
26136
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "esc or /back to exit \xB7 scroll for history" })
26130
26137
  ] })
26131
26138
  }
26132
26139
  ) }, item.id) : /* @__PURE__ */ jsx4(Box4, { paddingX: 2, children: /* @__PURE__ */ jsx4(TranscriptRowView, { row: item }) }, item.id) }),
@@ -26210,9 +26217,13 @@ function ConversationView({
26210
26217
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "\xB7" }),
26211
26218
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: sessionId })
26212
26219
  ] }),
26213
- /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
26214
- awaitingReply && !isFailed ? "working" : status,
26215
- debugActive ? " \xB7 debug" : ""
26220
+ /* @__PURE__ */ jsxs4(Box4, { gap: 2, children: [
26221
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "esc to go back" }),
26222
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "\xB7" }),
26223
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
26224
+ awaitingReply && !isFailed ? "working" : status,
26225
+ debugActive ? " \xB7 debug" : ""
26226
+ ] })
26216
26227
  ] })
26217
26228
  ] })
26218
26229
  ] }),
@@ -26233,6 +26244,15 @@ function ConversationView({
26233
26244
  ] })
26234
26245
  ] });
26235
26246
  }
26247
+ function conversationEscapeAction(input) {
26248
+ if (input.showPalette) {
26249
+ return "clear-command-palette";
26250
+ }
26251
+ if (input.showQuestionPrompt) {
26252
+ return "defer-to-question-prompt";
26253
+ }
26254
+ return "go-back";
26255
+ }
26236
26256
  function WorkingIndicator({
26237
26257
  word,
26238
26258
  startedAt,
@@ -31701,13 +31721,14 @@ var ClaudeCodeProjector = class {
31701
31721
  }
31702
31722
  };
31703
31723
  function projectClaudeCodeResult(result) {
31724
+ const failedButRecoverable = isRecoverableToolUseDiagnostic(result);
31704
31725
  return {
31705
31726
  type: "entry",
31706
31727
  entry: {
31707
31728
  role: "system",
31708
31729
  kind: "status",
31709
31730
  status: result.isError ? "failed" : "completed",
31710
- sessionStatusAfter: result.isError ? "failed" : "awaiting",
31731
+ sessionStatusAfter: result.isError && !failedButRecoverable ? "failed" : "awaiting",
31711
31732
  content: {
31712
31733
  parts: [
31713
31734
  {
@@ -31719,6 +31740,13 @@ function projectClaudeCodeResult(result) {
31719
31740
  }
31720
31741
  };
31721
31742
  }
31743
+ function isRecoverableToolUseDiagnostic(result) {
31744
+ if (!result.isError) {
31745
+ return false;
31746
+ }
31747
+ const message = result.errorMessage ?? "";
31748
+ return message.startsWith("[ede_diagnostic]") && message.includes("stop_reason=tool_use");
31749
+ }
31722
31750
  function anthropicMessageIdFromStreamStart(message) {
31723
31751
  const event = message.event;
31724
31752
  if (event.type !== "message_start") {
@@ -32236,7 +32264,8 @@ var ClaudeAgentBridgeSessionImpl = class {
32236
32264
  return this.pendingToolUseIds.size > 0;
32237
32265
  }
32238
32266
  // Track tool_use/tool_result pairs as they stream so hasInFlightToolUse()
32239
- // reflects the live transcript. tool_use opens a call; the matching
32267
+ // reflects the live transcript. A tool_use may appear first as a streaming
32268
+ // content block before the full assistant message is available; the matching
32240
32269
  // tool_result closes it; the turn's terminal result clears any remainder.
32241
32270
  trackToolUseLifecycle(message) {
32242
32271
  for (const id of toolUseIds(message)) {
@@ -32489,12 +32518,20 @@ function isClaudeAgentTurnResult(message) {
32489
32518
  return message.type === "result";
32490
32519
  }
32491
32520
  function toolUseIds(message) {
32492
- if (message.type !== "assistant") {
32521
+ if (message.type === "assistant") {
32522
+ return contentBlocks(message.message.content).flatMap(
32523
+ (block2) => block2.type === "tool_use" && typeof block2.id === "string" ? [block2.id] : []
32524
+ );
32525
+ }
32526
+ if (message.type !== "stream_event") {
32493
32527
  return [];
32494
32528
  }
32495
- return contentBlocks(message.message.content).flatMap(
32496
- (block) => block.type === "tool_use" && typeof block.id === "string" ? [block.id] : []
32497
- );
32529
+ const event = message.event;
32530
+ if (event.type !== "content_block_start") {
32531
+ return [];
32532
+ }
32533
+ const block = event.content_block;
32534
+ return block.type === "tool_use" && typeof block.id === "string" ? [block.id] : [];
32498
32535
  }
32499
32536
  function toolResultIds(message) {
32500
32537
  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.198",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"