@autohq/cli 0.1.296 → 0.1.297

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.
@@ -23399,7 +23399,7 @@ Object.assign(lookup, {
23399
23399
  // package.json
23400
23400
  var package_default = {
23401
23401
  name: "@autohq/cli",
23402
- version: "0.1.296",
23402
+ version: "0.1.297",
23403
23403
  license: "SEE LICENSE IN README.md",
23404
23404
  publishConfig: {
23405
23405
  access: "public"
@@ -27559,7 +27559,7 @@ var SessionTurnRecordSchema = external_exports.object({
27559
27559
  });
27560
27560
 
27561
27561
  // ../../packages/schemas/src/singleton-refresh.ts
27562
- var SINGLETON_RESPAWN_REASONS = ["refresh"];
27562
+ var SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
27563
27563
  var SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
27564
27564
  var SingletonRespawnSchema = external_exports.object({
27565
27565
  reason: SingletonRespawnReasonSchema.default("refresh")
@@ -57738,18 +57738,19 @@ var ClaudeAgentBridgeSessionImpl = class {
57738
57738
  // decrements — so interleaved interrupt/result deliveries stay balanced.
57739
57739
  activeTurnCount = 0;
57740
57740
  interruptInFlight = null;
57741
- // turnResultCount at the moment an interrupt ack timed out, or null when no
57742
- // timeout is latched. While turnResultCount still equals this value the same
57743
- // wedged turn is running, so follow-up messages defer immediately instead of
57744
- // each re-racing a fresh ack timeout against the unresponsive control
57745
- // channel (and stacking pending control requests). Any terminal result
57746
- // advances turnResultCount and un-latches.
57747
- interruptAckTimeoutTurn = null;
57741
+ // turnResultCount at the moment an interrupt timed out (the ack never
57742
+ // arrived, or it arrived but the turn never settled), or null when no
57743
+ // timeout is latched. While turnResultCount still equals this value the
57744
+ // same wedged turn is running, so follow-up messages defer immediately
57745
+ // instead of each re-racing a fresh interrupt against a turn that ignores
57746
+ // them. Any terminal result advances turnResultCount and un-latches.
57747
+ interruptTimeoutTurn = null;
57748
57748
  exitReported = false;
57749
57749
  // Messages held for the turn's terminal result instead of injected mid-turn
57750
57750
  // (which would reject a pending tool_use): "deferred"-mode deliveries, plus
57751
- // interrupt-mode deliveries whose interrupt ack timed out. Flushed once the
57752
- // turn ends and the session is idle.
57751
+ // interrupt-mode deliveries whose interrupt timed out (no ack, or no
57752
+ // settlement after the ack). Flushed once the turn ends and the session is
57753
+ // idle.
57753
57754
  deferredMessages = [];
57754
57755
  // tool_use ids the assistant has emitted whose tool_result has not yet been
57755
57756
  // observed. A non-empty set means a tool call is in flight, so an immediate
@@ -58037,11 +58038,12 @@ var ClaudeAgentBridgeSessionImpl = class {
58037
58038
  }
58038
58039
  // Resolve once the interrupted turn emits its terminal `result` (turnResultCount
58039
58040
  // advances past the pre-interrupt baseline), bounded so a tool that never
58040
- // returns after interrupt cannot wedge delivery. On timeout the caller falls
58041
- // back to immediate injection rather than hanging or dropping the message.
58041
+ // returns after interrupt cannot wedge delivery. The caller reads the
58042
+ // outcome: "timeout" means the turn is still running and the message must
58043
+ // defer to the turn boundary rather than inject mid-turn.
58042
58044
  awaitTurnSettlement(baseline, startedAt) {
58043
58045
  if (this.turnResultCount > baseline) {
58044
- return Promise.resolve();
58046
+ return Promise.resolve("ready");
58045
58047
  }
58046
58048
  return new Promise((resolve2) => {
58047
58049
  let done = false;
@@ -58055,7 +58057,7 @@ var ClaudeAgentBridgeSessionImpl = class {
58055
58057
  this.input.writeOutput?.(
58056
58058
  `agent_bridge_claude_interrupt_settle_${outcome} duration_ms=${Date.now() - startedAt}`
58057
58059
  );
58058
- resolve2();
58060
+ resolve2(outcome);
58059
58061
  };
58060
58062
  const waiter = (settled) => finish(settled ? "ready" : "aborted");
58061
58063
  const timer = setTimeout(
@@ -58095,11 +58097,11 @@ var ClaudeAgentBridgeSessionImpl = class {
58095
58097
  if (this.interruptInFlight) {
58096
58098
  return await this.interruptInFlight;
58097
58099
  }
58098
- if (this.interruptAckTimeoutTurn !== null) {
58099
- if (this.interruptAckTimeoutTurn === this.turnResultCount) {
58100
+ if (this.interruptTimeoutTurn !== null) {
58101
+ if (this.interruptTimeoutTurn === this.turnResultCount) {
58100
58102
  return "defer";
58101
58103
  }
58102
- this.interruptAckTimeoutTurn = null;
58104
+ this.interruptTimeoutTurn = null;
58103
58105
  }
58104
58106
  if (this.state.kind !== "running") {
58105
58107
  return "proceed";
@@ -58114,11 +58116,18 @@ var ClaudeAgentBridgeSessionImpl = class {
58114
58116
  const interruptPromise = (async () => {
58115
58117
  const ack = await this.requestInterruptAck(query, startedAt);
58116
58118
  if (ack === "timeout") {
58117
- this.interruptAckTimeoutTurn = settlementBaseline;
58119
+ this.interruptTimeoutTurn = settlementBaseline;
58118
58120
  return "defer";
58119
58121
  }
58120
58122
  if (hadInFlightToolUse) {
58121
- await this.awaitTurnSettlement(settlementBaseline, startedAt);
58123
+ const settle = await this.awaitTurnSettlement(
58124
+ settlementBaseline,
58125
+ startedAt
58126
+ );
58127
+ if (settle === "timeout") {
58128
+ this.interruptTimeoutTurn = settlementBaseline;
58129
+ return "defer";
58130
+ }
58122
58131
  }
58123
58132
  return "proceed";
58124
58133
  })();
package/dist/index.js CHANGED
@@ -19319,7 +19319,7 @@ var init_singleton_refresh = __esm({
19319
19319
  "../../packages/schemas/src/singleton-refresh.ts"() {
19320
19320
  "use strict";
19321
19321
  init_zod();
19322
- SINGLETON_RESPAWN_REASONS = ["refresh"];
19322
+ SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
19323
19323
  SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
19324
19324
  SingletonRespawnSchema = external_exports.object({
19325
19325
  reason: SingletonRespawnReasonSchema.default("refresh")
@@ -23194,7 +23194,7 @@ var init_package = __esm({
23194
23194
  "package.json"() {
23195
23195
  package_default = {
23196
23196
  name: "@autohq/cli",
23197
- version: "0.1.296",
23197
+ version: "0.1.297",
23198
23198
  license: "SEE LICENSE IN README.md",
23199
23199
  publishConfig: {
23200
23200
  access: "public"
@@ -35199,18 +35199,19 @@ var ClaudeAgentBridgeSessionImpl = class {
35199
35199
  // decrements — so interleaved interrupt/result deliveries stay balanced.
35200
35200
  activeTurnCount = 0;
35201
35201
  interruptInFlight = null;
35202
- // turnResultCount at the moment an interrupt ack timed out, or null when no
35203
- // timeout is latched. While turnResultCount still equals this value the same
35204
- // wedged turn is running, so follow-up messages defer immediately instead of
35205
- // each re-racing a fresh ack timeout against the unresponsive control
35206
- // channel (and stacking pending control requests). Any terminal result
35207
- // advances turnResultCount and un-latches.
35208
- interruptAckTimeoutTurn = null;
35202
+ // turnResultCount at the moment an interrupt timed out (the ack never
35203
+ // arrived, or it arrived but the turn never settled), or null when no
35204
+ // timeout is latched. While turnResultCount still equals this value the
35205
+ // same wedged turn is running, so follow-up messages defer immediately
35206
+ // instead of each re-racing a fresh interrupt against a turn that ignores
35207
+ // them. Any terminal result advances turnResultCount and un-latches.
35208
+ interruptTimeoutTurn = null;
35209
35209
  exitReported = false;
35210
35210
  // Messages held for the turn's terminal result instead of injected mid-turn
35211
35211
  // (which would reject a pending tool_use): "deferred"-mode deliveries, plus
35212
- // interrupt-mode deliveries whose interrupt ack timed out. Flushed once the
35213
- // turn ends and the session is idle.
35212
+ // interrupt-mode deliveries whose interrupt timed out (no ack, or no
35213
+ // settlement after the ack). Flushed once the turn ends and the session is
35214
+ // idle.
35214
35215
  deferredMessages = [];
35215
35216
  // tool_use ids the assistant has emitted whose tool_result has not yet been
35216
35217
  // observed. A non-empty set means a tool call is in flight, so an immediate
@@ -35498,11 +35499,12 @@ var ClaudeAgentBridgeSessionImpl = class {
35498
35499
  }
35499
35500
  // Resolve once the interrupted turn emits its terminal `result` (turnResultCount
35500
35501
  // advances past the pre-interrupt baseline), bounded so a tool that never
35501
- // returns after interrupt cannot wedge delivery. On timeout the caller falls
35502
- // back to immediate injection rather than hanging or dropping the message.
35502
+ // returns after interrupt cannot wedge delivery. The caller reads the
35503
+ // outcome: "timeout" means the turn is still running and the message must
35504
+ // defer to the turn boundary rather than inject mid-turn.
35503
35505
  awaitTurnSettlement(baseline, startedAt) {
35504
35506
  if (this.turnResultCount > baseline) {
35505
- return Promise.resolve();
35507
+ return Promise.resolve("ready");
35506
35508
  }
35507
35509
  return new Promise((resolve4) => {
35508
35510
  let done = false;
@@ -35516,7 +35518,7 @@ var ClaudeAgentBridgeSessionImpl = class {
35516
35518
  this.input.writeOutput?.(
35517
35519
  `agent_bridge_claude_interrupt_settle_${outcome} duration_ms=${Date.now() - startedAt}`
35518
35520
  );
35519
- resolve4();
35521
+ resolve4(outcome);
35520
35522
  };
35521
35523
  const waiter = (settled) => finish(settled ? "ready" : "aborted");
35522
35524
  const timer = setTimeout(
@@ -35556,11 +35558,11 @@ var ClaudeAgentBridgeSessionImpl = class {
35556
35558
  if (this.interruptInFlight) {
35557
35559
  return await this.interruptInFlight;
35558
35560
  }
35559
- if (this.interruptAckTimeoutTurn !== null) {
35560
- if (this.interruptAckTimeoutTurn === this.turnResultCount) {
35561
+ if (this.interruptTimeoutTurn !== null) {
35562
+ if (this.interruptTimeoutTurn === this.turnResultCount) {
35561
35563
  return "defer";
35562
35564
  }
35563
- this.interruptAckTimeoutTurn = null;
35565
+ this.interruptTimeoutTurn = null;
35564
35566
  }
35565
35567
  if (this.state.kind !== "running") {
35566
35568
  return "proceed";
@@ -35575,11 +35577,18 @@ var ClaudeAgentBridgeSessionImpl = class {
35575
35577
  const interruptPromise = (async () => {
35576
35578
  const ack = await this.requestInterruptAck(query, startedAt);
35577
35579
  if (ack === "timeout") {
35578
- this.interruptAckTimeoutTurn = settlementBaseline;
35580
+ this.interruptTimeoutTurn = settlementBaseline;
35579
35581
  return "defer";
35580
35582
  }
35581
35583
  if (hadInFlightToolUse) {
35582
- await this.awaitTurnSettlement(settlementBaseline, startedAt);
35584
+ const settle = await this.awaitTurnSettlement(
35585
+ settlementBaseline,
35586
+ startedAt
35587
+ );
35588
+ if (settle === "timeout") {
35589
+ this.interruptTimeoutTurn = settlementBaseline;
35590
+ return "defer";
35591
+ }
35583
35592
  }
35584
35593
  return "proceed";
35585
35594
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.296",
3
+ "version": "0.1.297",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"