@autohq/cli 0.1.453 → 0.1.455

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.
@@ -30825,7 +30825,7 @@ Object.assign(lookup, {
30825
30825
  // package.json
30826
30826
  var package_default = {
30827
30827
  name: "@autohq/cli",
30828
- version: "0.1.453",
30828
+ version: "0.1.455",
30829
30829
  license: "SEE LICENSE IN README.md",
30830
30830
  publishConfig: {
30831
30831
  access: "public"
@@ -30920,6 +30920,7 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
30920
30920
  }
30921
30921
  };
30922
30922
  var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS = 6e4;
30923
+ var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
30923
30924
  async function runAgentBridgeSocket(options) {
30924
30925
  const socket = lookup(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
30925
30926
  auth: {
@@ -30983,7 +30984,7 @@ async function runAgentBridgeSocket(options) {
30983
30984
  return;
30984
30985
  }
30985
30986
  options.writeOutput?.(`agent_bridge_disconnected reason=${reason}`);
30986
- if (terminalAuthDrain.suppressesReconnect()) {
30987
+ if (terminalAuthDrain.handleDisconnect()) {
30987
30988
  return;
30988
30989
  }
30989
30990
  reconnectLoop.start();
@@ -31280,9 +31281,48 @@ function createTerminalAuthDrainController(input) {
31280
31281
  return;
31281
31282
  }
31282
31283
  clearTimeout(current.timeout);
31284
+ if (current.redialTimer) {
31285
+ clearTimeout(current.redialTimer);
31286
+ }
31283
31287
  state = null;
31284
31288
  callback();
31285
31289
  };
31290
+ const logDroppedPendingOutputs = (reason) => {
31291
+ const stats = input.getHandler()?.pendingOutputStats?.();
31292
+ if (!stats || stats.pendingCount === 0) {
31293
+ return;
31294
+ }
31295
+ const context = {
31296
+ reason,
31297
+ pending_count: stats.pendingCount,
31298
+ lowest_seq: stats.lowestSeq,
31299
+ highest_seq: stats.highestSeq
31300
+ };
31301
+ input.writeOutput?.(
31302
+ `agent_bridge_terminal_auth_drain_dropped_outputs reason=${reason} pending_count=${stats.pendingCount} lowest_seq=${stats.lowestSeq} highest_seq=${stats.highestSeq}`
31303
+ );
31304
+ input.runtimeLogger?.error(
31305
+ "agent_bridge_terminal_auth_drain_dropped_outputs",
31306
+ context
31307
+ );
31308
+ };
31309
+ const scheduleRedial = () => {
31310
+ const current = state;
31311
+ if (!current || current.redialTimer) {
31312
+ return;
31313
+ }
31314
+ current.redialTimer = setTimeout(() => {
31315
+ current.redialTimer = null;
31316
+ if (state !== current) {
31317
+ return;
31318
+ }
31319
+ if (input.socket.connected) {
31320
+ input.socket.disconnect();
31321
+ }
31322
+ input.socket.connect();
31323
+ }, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS);
31324
+ current.redialTimer.unref?.();
31325
+ };
31286
31326
  const begin = () => {
31287
31327
  terminalAuthExit = true;
31288
31328
  if (state) {
@@ -31306,6 +31346,7 @@ function createTerminalAuthDrainController(input) {
31306
31346
  rejectDrain = reject;
31307
31347
  });
31308
31348
  const timeout = setTimeout(() => {
31349
+ logDroppedPendingOutputs("drain_timeout");
31309
31350
  settle(() => {
31310
31351
  rejectDrain(
31311
31352
  new Error(
@@ -31317,6 +31358,7 @@ function createTerminalAuthDrainController(input) {
31317
31358
  timeout.unref?.();
31318
31359
  state = {
31319
31360
  promise: promise2,
31361
+ redialTimer: null,
31320
31362
  reject: rejectDrain,
31321
31363
  resolve: resolveDrain,
31322
31364
  startedAt,
@@ -31359,7 +31401,10 @@ function createTerminalAuthDrainController(input) {
31359
31401
  current.resolve();
31360
31402
  });
31361
31403
  })().catch((error51) => {
31362
- settle(() => current.reject(error51));
31404
+ input.writeOutput?.(
31405
+ `agent_bridge_terminal_auth_drain_replay_error error=${errorMessage(error51)}`
31406
+ );
31407
+ scheduleRedial();
31363
31408
  });
31364
31409
  return true;
31365
31410
  };
@@ -31368,13 +31413,29 @@ function createTerminalAuthDrainController(input) {
31368
31413
  if (!current) {
31369
31414
  return false;
31370
31415
  }
31371
- settle(() => current.reject(error51));
31416
+ if (isTerminalAuthError(error51)) {
31417
+ logDroppedPendingOutputs("drain_auth_rejected");
31418
+ settle(() => current.reject(error51));
31419
+ return true;
31420
+ }
31421
+ input.writeOutput?.(
31422
+ `agent_bridge_terminal_auth_drain_connect_error error=${error51.message}`
31423
+ );
31424
+ scheduleRedial();
31372
31425
  return true;
31373
31426
  };
31427
+ const handleDisconnect = () => {
31428
+ if (state) {
31429
+ scheduleRedial();
31430
+ return true;
31431
+ }
31432
+ return terminalAuthExit;
31433
+ };
31374
31434
  return {
31375
31435
  begin,
31376
31436
  handleConnected,
31377
31437
  handleConnectError,
31438
+ handleDisconnect,
31378
31439
  suppressesReconnect: () => terminalAuthExit || state !== null
31379
31440
  };
31380
31441
  }
@@ -36172,7 +36233,8 @@ var SessionListItemAgentSchema = external_exports.object({
36172
36233
  name: external_exports.string(),
36173
36234
  displayName: external_exports.string().nullable(),
36174
36235
  username: external_exports.string().nullable(),
36175
- avatarSha256: external_exports.string().nullable()
36236
+ avatarSha256: external_exports.string().nullable(),
36237
+ harness: AgentHarnessSchema.optional()
36176
36238
  });
36177
36239
  var SessionListItemSchema = external_exports.object({
36178
36240
  id: SessionIdSchema2,
@@ -72327,6 +72389,20 @@ var AgentBridgeOutputBuffer = class {
72327
72389
  await this.flushPendingDelta({ force: true });
72328
72390
  await this.drainPendingOutputs({ force: true });
72329
72391
  }
72392
+ // Snapshot of the not-yet-acked envelopes, for the terminal-auth drain's
72393
+ // dropped-output diagnostics. Parked (not yet materialized) delta chunks are
72394
+ // excluded: they only become envelopes when a replay materializes them.
72395
+ pendingOutputStats() {
72396
+ const seqs = [...this.pendingOutputs.keys()];
72397
+ if (seqs.length === 0) {
72398
+ return { pendingCount: 0, lowestSeq: null, highestSeq: null };
72399
+ }
72400
+ return {
72401
+ pendingCount: seqs.length,
72402
+ lowestSeq: Math.min(...seqs),
72403
+ highestSeq: Math.max(...seqs)
72404
+ };
72405
+ }
72330
72406
  // Emits one runtime liveness beat through the same ordered, acked drain as
72331
72407
  // content envelopes — deliberately, so a beat landing at the bridge proves
72332
72408
  // the pipeline is healthy end to end. While a previous beat is still
@@ -94857,6 +94933,9 @@ var ClaudeCodeCommandHandler = class {
94857
94933
  async replayPendingOutputs() {
94858
94934
  await this.outputBuffer.replayPendingOutputs();
94859
94935
  }
94936
+ pendingOutputStats() {
94937
+ return this.outputBuffer.pendingOutputStats();
94938
+ }
94860
94939
  async prepare() {
94861
94940
  await this.ensureAgentSession().prepare();
94862
94941
  }
@@ -96932,6 +97011,9 @@ var CodexCommandHandler = class {
96932
97011
  async replayPendingOutputs() {
96933
97012
  await this.outputBuffer.replayPendingOutputs();
96934
97013
  }
97014
+ pendingOutputStats() {
97015
+ return this.outputBuffer.pendingOutputStats();
97016
+ }
96935
97017
  async prepare() {
96936
97018
  await this.ensureSession().prepare();
96937
97019
  }
package/dist/index.js CHANGED
@@ -20345,7 +20345,8 @@ var init_sessions = __esm({
20345
20345
  name: external_exports.string(),
20346
20346
  displayName: external_exports.string().nullable(),
20347
20347
  username: external_exports.string().nullable(),
20348
- avatarSha256: external_exports.string().nullable()
20348
+ avatarSha256: external_exports.string().nullable(),
20349
+ harness: AgentHarnessSchema.optional()
20349
20350
  });
20350
20351
  SessionListItemSchema = external_exports.object({
20351
20352
  id: SessionIdSchema,
@@ -50870,7 +50871,7 @@ var init_package = __esm({
50870
50871
  "package.json"() {
50871
50872
  package_default = {
50872
50873
  name: "@autohq/cli",
50873
- version: "0.1.453",
50874
+ version: "0.1.455",
50874
50875
  license: "SEE LICENSE IN README.md",
50875
50876
  publishConfig: {
50876
50877
  access: "public"
@@ -61866,6 +61867,7 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
61866
61867
  }
61867
61868
  };
61868
61869
  var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS = 6e4;
61870
+ var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
61869
61871
  async function runAgentBridgeSocket(options) {
61870
61872
  const socket = io(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
61871
61873
  auth: {
@@ -61929,7 +61931,7 @@ async function runAgentBridgeSocket(options) {
61929
61931
  return;
61930
61932
  }
61931
61933
  options.writeOutput?.(`agent_bridge_disconnected reason=${reason}`);
61932
- if (terminalAuthDrain.suppressesReconnect()) {
61934
+ if (terminalAuthDrain.handleDisconnect()) {
61933
61935
  return;
61934
61936
  }
61935
61937
  reconnectLoop.start();
@@ -62226,9 +62228,48 @@ function createTerminalAuthDrainController(input) {
62226
62228
  return;
62227
62229
  }
62228
62230
  clearTimeout(current.timeout);
62231
+ if (current.redialTimer) {
62232
+ clearTimeout(current.redialTimer);
62233
+ }
62229
62234
  state = null;
62230
62235
  callback();
62231
62236
  };
62237
+ const logDroppedPendingOutputs = (reason) => {
62238
+ const stats = input.getHandler()?.pendingOutputStats?.();
62239
+ if (!stats || stats.pendingCount === 0) {
62240
+ return;
62241
+ }
62242
+ const context = {
62243
+ reason,
62244
+ pending_count: stats.pendingCount,
62245
+ lowest_seq: stats.lowestSeq,
62246
+ highest_seq: stats.highestSeq
62247
+ };
62248
+ input.writeOutput?.(
62249
+ `agent_bridge_terminal_auth_drain_dropped_outputs reason=${reason} pending_count=${stats.pendingCount} lowest_seq=${stats.lowestSeq} highest_seq=${stats.highestSeq}`
62250
+ );
62251
+ input.runtimeLogger?.error(
62252
+ "agent_bridge_terminal_auth_drain_dropped_outputs",
62253
+ context
62254
+ );
62255
+ };
62256
+ const scheduleRedial = () => {
62257
+ const current = state;
62258
+ if (!current || current.redialTimer) {
62259
+ return;
62260
+ }
62261
+ current.redialTimer = setTimeout(() => {
62262
+ current.redialTimer = null;
62263
+ if (state !== current) {
62264
+ return;
62265
+ }
62266
+ if (input.socket.connected) {
62267
+ input.socket.disconnect();
62268
+ }
62269
+ input.socket.connect();
62270
+ }, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS);
62271
+ current.redialTimer.unref?.();
62272
+ };
62232
62273
  const begin = () => {
62233
62274
  terminalAuthExit = true;
62234
62275
  if (state) {
@@ -62252,6 +62293,7 @@ function createTerminalAuthDrainController(input) {
62252
62293
  rejectDrain = reject;
62253
62294
  });
62254
62295
  const timeout = setTimeout(() => {
62296
+ logDroppedPendingOutputs("drain_timeout");
62255
62297
  settle(() => {
62256
62298
  rejectDrain(
62257
62299
  new Error(
@@ -62263,6 +62305,7 @@ function createTerminalAuthDrainController(input) {
62263
62305
  timeout.unref?.();
62264
62306
  state = {
62265
62307
  promise: promise2,
62308
+ redialTimer: null,
62266
62309
  reject: rejectDrain,
62267
62310
  resolve: resolveDrain,
62268
62311
  startedAt,
@@ -62305,7 +62348,10 @@ function createTerminalAuthDrainController(input) {
62305
62348
  current.resolve();
62306
62349
  });
62307
62350
  })().catch((error51) => {
62308
- settle(() => current.reject(error51));
62351
+ input.writeOutput?.(
62352
+ `agent_bridge_terminal_auth_drain_replay_error error=${errorMessage(error51)}`
62353
+ );
62354
+ scheduleRedial();
62309
62355
  });
62310
62356
  return true;
62311
62357
  };
@@ -62314,13 +62360,29 @@ function createTerminalAuthDrainController(input) {
62314
62360
  if (!current) {
62315
62361
  return false;
62316
62362
  }
62317
- settle(() => current.reject(error51));
62363
+ if (isTerminalAuthError(error51)) {
62364
+ logDroppedPendingOutputs("drain_auth_rejected");
62365
+ settle(() => current.reject(error51));
62366
+ return true;
62367
+ }
62368
+ input.writeOutput?.(
62369
+ `agent_bridge_terminal_auth_drain_connect_error error=${error51.message}`
62370
+ );
62371
+ scheduleRedial();
62318
62372
  return true;
62319
62373
  };
62374
+ const handleDisconnect = () => {
62375
+ if (state) {
62376
+ scheduleRedial();
62377
+ return true;
62378
+ }
62379
+ return terminalAuthExit;
62380
+ };
62320
62381
  return {
62321
62382
  begin,
62322
62383
  handleConnected,
62323
62384
  handleConnectError,
62385
+ handleDisconnect,
62324
62386
  suppressesReconnect: () => terminalAuthExit || state !== null
62325
62387
  };
62326
62388
  }
@@ -62937,6 +62999,20 @@ var AgentBridgeOutputBuffer = class {
62937
62999
  await this.flushPendingDelta({ force: true });
62938
63000
  await this.drainPendingOutputs({ force: true });
62939
63001
  }
63002
+ // Snapshot of the not-yet-acked envelopes, for the terminal-auth drain's
63003
+ // dropped-output diagnostics. Parked (not yet materialized) delta chunks are
63004
+ // excluded: they only become envelopes when a replay materializes them.
63005
+ pendingOutputStats() {
63006
+ const seqs = [...this.pendingOutputs.keys()];
63007
+ if (seqs.length === 0) {
63008
+ return { pendingCount: 0, lowestSeq: null, highestSeq: null };
63009
+ }
63010
+ return {
63011
+ pendingCount: seqs.length,
63012
+ lowestSeq: Math.min(...seqs),
63013
+ highestSeq: Math.max(...seqs)
63014
+ };
63015
+ }
62940
63016
  // Emits one runtime liveness beat through the same ordered, acked drain as
62941
63017
  // content envelopes — deliberately, so a beat landing at the bridge proves
62942
63018
  // the pipeline is healthy end to end. While a previous beat is still
@@ -65897,6 +65973,9 @@ var ClaudeCodeCommandHandler = class {
65897
65973
  async replayPendingOutputs() {
65898
65974
  await this.outputBuffer.replayPendingOutputs();
65899
65975
  }
65976
+ pendingOutputStats() {
65977
+ return this.outputBuffer.pendingOutputStats();
65978
+ }
65900
65979
  async prepare() {
65901
65980
  await this.ensureAgentSession().prepare();
65902
65981
  }
@@ -67977,6 +68056,9 @@ var CodexCommandHandler = class {
67977
68056
  async replayPendingOutputs() {
67978
68057
  await this.outputBuffer.replayPendingOutputs();
67979
68058
  }
68059
+ pendingOutputStats() {
68060
+ return this.outputBuffer.pendingOutputStats();
68061
+ }
67980
68062
  async prepare() {
67981
68063
  await this.ensureSession().prepare();
67982
68064
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.453",
3
+ "version": "0.1.455",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"