@autohq/cli 0.1.452 → 0.1.454

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.452",
30828
+ version: "0.1.454",
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
  }
@@ -31564,13 +31625,23 @@ var ConnectionListResponseSchema = external_exports.object({
31564
31625
  connections: external_exports.array(ConnectionViewSchema)
31565
31626
  });
31566
31627
  var ConnectionRepositorySchema = external_exports.object({
31567
- fullName: external_exports.string().trim().min(1)
31628
+ id: external_exports.string().trim().min(1),
31629
+ fullName: external_exports.string().trim().min(1),
31630
+ defaultBranch: external_exports.string().trim().min(1),
31631
+ availability: external_exports.enum(["available", "needs_access", "connection_error"])
31632
+ });
31633
+ var ConnectionRepositorySourceSchema = external_exports.object({
31634
+ connection: external_exports.string().trim().min(1),
31635
+ providerGrantId: external_exports.string().trim().min(1),
31636
+ installationId: external_exports.string().trim().min(1)
31568
31637
  });
31569
31638
  var ConnectionRepositoryListResponseSchema = external_exports.object({
31639
+ source: ConnectionRepositorySourceSchema,
31570
31640
  repositories: external_exports.array(ConnectionRepositorySchema),
31571
31641
  /**
31572
31642
  * True when the provider exposes more repositories than the listing cap;
31573
- * the returned list is a prefix and clients should allow manual entry.
31643
+ * the returned list is a prefix and clients should direct the user to the
31644
+ * provider's installation settings instead of accepting an unverified name.
31574
31645
  */
31575
31646
  truncated: external_exports.boolean()
31576
31647
  });
@@ -33482,6 +33553,28 @@ var GithubConnectionRepositorySchema = external_exports.object({
33482
33553
  id: external_exports.number().int().positive().optional(),
33483
33554
  fullName: external_exports.string().trim().min(1)
33484
33555
  });
33556
+ var ProjectGithubRepositorySelectionReplaceRequestSchema = external_exports.object({
33557
+ connection: ConnectionNameSchema,
33558
+ repositoryIds: external_exports.array(external_exports.string().trim().min(1)),
33559
+ disableSync: external_exports.boolean().default(false)
33560
+ });
33561
+ var ProjectGithubRepositorySelectionReplaceResponseSchema = external_exports.object({
33562
+ connection: ConnectionNameSchema,
33563
+ providerGrantId: external_exports.string().trim().min(1),
33564
+ repositoryIds: external_exports.array(external_exports.string().trim().min(1)),
33565
+ changed: external_exports.boolean(),
33566
+ syncDisabled: external_exports.boolean()
33567
+ });
33568
+ var ProjectGithubConnectionDisconnectRequestSchema = external_exports.object({
33569
+ connection: ConnectionNameSchema,
33570
+ disableSync: external_exports.boolean().default(false)
33571
+ });
33572
+ var ProjectGithubConnectionDisconnectResponseSchema = external_exports.object({
33573
+ connection: ConnectionNameSchema,
33574
+ providerGrantId: external_exports.string().trim().min(1),
33575
+ disconnected: external_exports.boolean(),
33576
+ syncDisabled: external_exports.boolean()
33577
+ });
33485
33578
  var GITHUB_CONNECTION_EVENTS = [
33486
33579
  "push",
33487
33580
  "pull_request",
@@ -33726,6 +33819,9 @@ var GithubSyncBindingCreateResponseSchema = external_exports.object({
33726
33819
  var GithubSyncBindingListResponseSchema = external_exports.object({
33727
33820
  bindings: external_exports.array(GithubSyncBindingSchema)
33728
33821
  });
33822
+ var GithubSyncBindingDisableResponseSchema = external_exports.object({
33823
+ binding: GithubSyncBindingSchema.nullable()
33824
+ });
33729
33825
  var GithubSyncTriggerArtifactSchema = external_exports.object({
33730
33826
  type: external_exports.string().trim().min(1),
33731
33827
  externalId: external_exports.string().trim().min(1),
@@ -72292,6 +72388,20 @@ var AgentBridgeOutputBuffer = class {
72292
72388
  await this.flushPendingDelta({ force: true });
72293
72389
  await this.drainPendingOutputs({ force: true });
72294
72390
  }
72391
+ // Snapshot of the not-yet-acked envelopes, for the terminal-auth drain's
72392
+ // dropped-output diagnostics. Parked (not yet materialized) delta chunks are
72393
+ // excluded: they only become envelopes when a replay materializes them.
72394
+ pendingOutputStats() {
72395
+ const seqs = [...this.pendingOutputs.keys()];
72396
+ if (seqs.length === 0) {
72397
+ return { pendingCount: 0, lowestSeq: null, highestSeq: null };
72398
+ }
72399
+ return {
72400
+ pendingCount: seqs.length,
72401
+ lowestSeq: Math.min(...seqs),
72402
+ highestSeq: Math.max(...seqs)
72403
+ };
72404
+ }
72295
72405
  // Emits one runtime liveness beat through the same ordered, acked drain as
72296
72406
  // content envelopes — deliberately, so a beat landing at the bridge proves
72297
72407
  // the pipeline is healthy end to end. While a previous beat is still
@@ -94822,6 +94932,9 @@ var ClaudeCodeCommandHandler = class {
94822
94932
  async replayPendingOutputs() {
94823
94933
  await this.outputBuffer.replayPendingOutputs();
94824
94934
  }
94935
+ pendingOutputStats() {
94936
+ return this.outputBuffer.pendingOutputStats();
94937
+ }
94825
94938
  async prepare() {
94826
94939
  await this.ensureAgentSession().prepare();
94827
94940
  }
@@ -96897,6 +97010,9 @@ var CodexCommandHandler = class {
96897
97010
  async replayPendingOutputs() {
96898
97011
  await this.outputBuffer.replayPendingOutputs();
96899
97012
  }
97013
+ pendingOutputStats() {
97014
+ return this.outputBuffer.pendingOutputStats();
97015
+ }
96900
97016
  async prepare() {
96901
97017
  await this.ensureSession().prepare();
96902
97018
  }
package/dist/index.js CHANGED
@@ -15237,7 +15237,7 @@ var init_primitives = __esm({
15237
15237
  });
15238
15238
 
15239
15239
  // ../../packages/schemas/src/provider-grants.ts
15240
- var ProviderNameSchema, ExternalAccountTypeSchema, ProviderCredentialKindSchema, ProviderGrantStatusSchema, ProviderResourceSelectionSchema, ExternalAccountSchema, ProviderGrantSchema, ProjectProviderAccessSchema, ConnectionViewSchema, ConnectionListResponseSchema, ConnectionRepositorySchema, ConnectionRepositoryListResponseSchema;
15240
+ var ProviderNameSchema, ExternalAccountTypeSchema, ProviderCredentialKindSchema, ProviderGrantStatusSchema, ProviderResourceSelectionSchema, ExternalAccountSchema, ProviderGrantSchema, ProjectProviderAccessSchema, ConnectionViewSchema, ConnectionListResponseSchema, ConnectionRepositorySchema, ConnectionRepositorySourceSchema, ConnectionRepositoryListResponseSchema;
15241
15241
  var init_provider_grants = __esm({
15242
15242
  "../../packages/schemas/src/provider-grants.ts"() {
15243
15243
  "use strict";
@@ -15314,13 +15314,23 @@ var init_provider_grants = __esm({
15314
15314
  connections: external_exports.array(ConnectionViewSchema)
15315
15315
  });
15316
15316
  ConnectionRepositorySchema = external_exports.object({
15317
- fullName: external_exports.string().trim().min(1)
15317
+ id: external_exports.string().trim().min(1),
15318
+ fullName: external_exports.string().trim().min(1),
15319
+ defaultBranch: external_exports.string().trim().min(1),
15320
+ availability: external_exports.enum(["available", "needs_access", "connection_error"])
15321
+ });
15322
+ ConnectionRepositorySourceSchema = external_exports.object({
15323
+ connection: external_exports.string().trim().min(1),
15324
+ providerGrantId: external_exports.string().trim().min(1),
15325
+ installationId: external_exports.string().trim().min(1)
15318
15326
  });
15319
15327
  ConnectionRepositoryListResponseSchema = external_exports.object({
15328
+ source: ConnectionRepositorySourceSchema,
15320
15329
  repositories: external_exports.array(ConnectionRepositorySchema),
15321
15330
  /**
15322
15331
  * True when the provider exposes more repositories than the listing cap;
15323
- * the returned list is a prefix and clients should allow manual entry.
15332
+ * the returned list is a prefix and clients should direct the user to the
15333
+ * provider's installation settings instead of accepting an unverified name.
15324
15334
  */
15325
15335
  truncated: external_exports.boolean()
15326
15336
  });
@@ -17388,7 +17398,7 @@ var init_resources = __esm({
17388
17398
  });
17389
17399
 
17390
17400
  // ../../packages/schemas/src/connections.ts
17391
- var RESOURCE_KIND_CONNECTION, ConnectionNameSchema, ProviderConnectionReferenceSchema, ProjectConnectionAllocationSpecSchema, ProjectConnectionAllocationResourceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartReturnToSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, ModelProviderConnectionCreateRequestSchema, ModelProviderConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
17401
+ var RESOURCE_KIND_CONNECTION, ConnectionNameSchema, ProviderConnectionReferenceSchema, ProjectConnectionAllocationSpecSchema, ProjectConnectionAllocationResourceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, ProjectGithubRepositorySelectionReplaceRequestSchema, ProjectGithubRepositorySelectionReplaceResponseSchema, ProjectGithubConnectionDisconnectRequestSchema, ProjectGithubConnectionDisconnectResponseSchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartReturnToSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, ModelProviderConnectionCreateRequestSchema, ModelProviderConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
17392
17402
  var init_connections = __esm({
17393
17403
  "../../packages/schemas/src/connections.ts"() {
17394
17404
  "use strict";
@@ -17417,6 +17427,28 @@ var init_connections = __esm({
17417
17427
  id: external_exports.number().int().positive().optional(),
17418
17428
  fullName: external_exports.string().trim().min(1)
17419
17429
  });
17430
+ ProjectGithubRepositorySelectionReplaceRequestSchema = external_exports.object({
17431
+ connection: ConnectionNameSchema,
17432
+ repositoryIds: external_exports.array(external_exports.string().trim().min(1)),
17433
+ disableSync: external_exports.boolean().default(false)
17434
+ });
17435
+ ProjectGithubRepositorySelectionReplaceResponseSchema = external_exports.object({
17436
+ connection: ConnectionNameSchema,
17437
+ providerGrantId: external_exports.string().trim().min(1),
17438
+ repositoryIds: external_exports.array(external_exports.string().trim().min(1)),
17439
+ changed: external_exports.boolean(),
17440
+ syncDisabled: external_exports.boolean()
17441
+ });
17442
+ ProjectGithubConnectionDisconnectRequestSchema = external_exports.object({
17443
+ connection: ConnectionNameSchema,
17444
+ disableSync: external_exports.boolean().default(false)
17445
+ });
17446
+ ProjectGithubConnectionDisconnectResponseSchema = external_exports.object({
17447
+ connection: ConnectionNameSchema,
17448
+ providerGrantId: external_exports.string().trim().min(1),
17449
+ disconnected: external_exports.boolean(),
17450
+ syncDisabled: external_exports.boolean()
17451
+ });
17420
17452
  GITHUB_CONNECTION_EVENTS = [
17421
17453
  "push",
17422
17454
  "pull_request",
@@ -17619,7 +17651,7 @@ var init_dormant_capabilities = __esm({
17619
17651
  });
17620
17652
 
17621
17653
  // ../../packages/schemas/src/github-sync.ts
17622
- var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncInitialSyncSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
17654
+ var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncInitialSyncSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncBindingDisableResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
17623
17655
  var init_github_sync = __esm({
17624
17656
  "../../packages/schemas/src/github-sync.ts"() {
17625
17657
  "use strict";
@@ -17684,6 +17716,9 @@ var init_github_sync = __esm({
17684
17716
  GithubSyncBindingListResponseSchema = external_exports.object({
17685
17717
  bindings: external_exports.array(GithubSyncBindingSchema)
17686
17718
  });
17719
+ GithubSyncBindingDisableResponseSchema = external_exports.object({
17720
+ binding: GithubSyncBindingSchema.nullable()
17721
+ });
17687
17722
  GithubSyncTriggerArtifactSchema = external_exports.object({
17688
17723
  type: external_exports.string().trim().min(1),
17689
17724
  externalId: external_exports.string().trim().min(1),
@@ -50835,7 +50870,7 @@ var init_package = __esm({
50835
50870
  "package.json"() {
50836
50871
  package_default = {
50837
50872
  name: "@autohq/cli",
50838
- version: "0.1.452",
50873
+ version: "0.1.454",
50839
50874
  license: "SEE LICENSE IN README.md",
50840
50875
  publishConfig: {
50841
50876
  access: "public"
@@ -61831,6 +61866,7 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
61831
61866
  }
61832
61867
  };
61833
61868
  var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS = 6e4;
61869
+ var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
61834
61870
  async function runAgentBridgeSocket(options) {
61835
61871
  const socket = io(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
61836
61872
  auth: {
@@ -61894,7 +61930,7 @@ async function runAgentBridgeSocket(options) {
61894
61930
  return;
61895
61931
  }
61896
61932
  options.writeOutput?.(`agent_bridge_disconnected reason=${reason}`);
61897
- if (terminalAuthDrain.suppressesReconnect()) {
61933
+ if (terminalAuthDrain.handleDisconnect()) {
61898
61934
  return;
61899
61935
  }
61900
61936
  reconnectLoop.start();
@@ -62191,9 +62227,48 @@ function createTerminalAuthDrainController(input) {
62191
62227
  return;
62192
62228
  }
62193
62229
  clearTimeout(current.timeout);
62230
+ if (current.redialTimer) {
62231
+ clearTimeout(current.redialTimer);
62232
+ }
62194
62233
  state = null;
62195
62234
  callback();
62196
62235
  };
62236
+ const logDroppedPendingOutputs = (reason) => {
62237
+ const stats = input.getHandler()?.pendingOutputStats?.();
62238
+ if (!stats || stats.pendingCount === 0) {
62239
+ return;
62240
+ }
62241
+ const context = {
62242
+ reason,
62243
+ pending_count: stats.pendingCount,
62244
+ lowest_seq: stats.lowestSeq,
62245
+ highest_seq: stats.highestSeq
62246
+ };
62247
+ input.writeOutput?.(
62248
+ `agent_bridge_terminal_auth_drain_dropped_outputs reason=${reason} pending_count=${stats.pendingCount} lowest_seq=${stats.lowestSeq} highest_seq=${stats.highestSeq}`
62249
+ );
62250
+ input.runtimeLogger?.error(
62251
+ "agent_bridge_terminal_auth_drain_dropped_outputs",
62252
+ context
62253
+ );
62254
+ };
62255
+ const scheduleRedial = () => {
62256
+ const current = state;
62257
+ if (!current || current.redialTimer) {
62258
+ return;
62259
+ }
62260
+ current.redialTimer = setTimeout(() => {
62261
+ current.redialTimer = null;
62262
+ if (state !== current) {
62263
+ return;
62264
+ }
62265
+ if (input.socket.connected) {
62266
+ input.socket.disconnect();
62267
+ }
62268
+ input.socket.connect();
62269
+ }, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS);
62270
+ current.redialTimer.unref?.();
62271
+ };
62197
62272
  const begin = () => {
62198
62273
  terminalAuthExit = true;
62199
62274
  if (state) {
@@ -62217,6 +62292,7 @@ function createTerminalAuthDrainController(input) {
62217
62292
  rejectDrain = reject;
62218
62293
  });
62219
62294
  const timeout = setTimeout(() => {
62295
+ logDroppedPendingOutputs("drain_timeout");
62220
62296
  settle(() => {
62221
62297
  rejectDrain(
62222
62298
  new Error(
@@ -62228,6 +62304,7 @@ function createTerminalAuthDrainController(input) {
62228
62304
  timeout.unref?.();
62229
62305
  state = {
62230
62306
  promise: promise2,
62307
+ redialTimer: null,
62231
62308
  reject: rejectDrain,
62232
62309
  resolve: resolveDrain,
62233
62310
  startedAt,
@@ -62270,7 +62347,10 @@ function createTerminalAuthDrainController(input) {
62270
62347
  current.resolve();
62271
62348
  });
62272
62349
  })().catch((error51) => {
62273
- settle(() => current.reject(error51));
62350
+ input.writeOutput?.(
62351
+ `agent_bridge_terminal_auth_drain_replay_error error=${errorMessage(error51)}`
62352
+ );
62353
+ scheduleRedial();
62274
62354
  });
62275
62355
  return true;
62276
62356
  };
@@ -62279,13 +62359,29 @@ function createTerminalAuthDrainController(input) {
62279
62359
  if (!current) {
62280
62360
  return false;
62281
62361
  }
62282
- settle(() => current.reject(error51));
62362
+ if (isTerminalAuthError(error51)) {
62363
+ logDroppedPendingOutputs("drain_auth_rejected");
62364
+ settle(() => current.reject(error51));
62365
+ return true;
62366
+ }
62367
+ input.writeOutput?.(
62368
+ `agent_bridge_terminal_auth_drain_connect_error error=${error51.message}`
62369
+ );
62370
+ scheduleRedial();
62283
62371
  return true;
62284
62372
  };
62373
+ const handleDisconnect = () => {
62374
+ if (state) {
62375
+ scheduleRedial();
62376
+ return true;
62377
+ }
62378
+ return terminalAuthExit;
62379
+ };
62285
62380
  return {
62286
62381
  begin,
62287
62382
  handleConnected,
62288
62383
  handleConnectError,
62384
+ handleDisconnect,
62289
62385
  suppressesReconnect: () => terminalAuthExit || state !== null
62290
62386
  };
62291
62387
  }
@@ -62902,6 +62998,20 @@ var AgentBridgeOutputBuffer = class {
62902
62998
  await this.flushPendingDelta({ force: true });
62903
62999
  await this.drainPendingOutputs({ force: true });
62904
63000
  }
63001
+ // Snapshot of the not-yet-acked envelopes, for the terminal-auth drain's
63002
+ // dropped-output diagnostics. Parked (not yet materialized) delta chunks are
63003
+ // excluded: they only become envelopes when a replay materializes them.
63004
+ pendingOutputStats() {
63005
+ const seqs = [...this.pendingOutputs.keys()];
63006
+ if (seqs.length === 0) {
63007
+ return { pendingCount: 0, lowestSeq: null, highestSeq: null };
63008
+ }
63009
+ return {
63010
+ pendingCount: seqs.length,
63011
+ lowestSeq: Math.min(...seqs),
63012
+ highestSeq: Math.max(...seqs)
63013
+ };
63014
+ }
62905
63015
  // Emits one runtime liveness beat through the same ordered, acked drain as
62906
63016
  // content envelopes — deliberately, so a beat landing at the bridge proves
62907
63017
  // the pipeline is healthy end to end. While a previous beat is still
@@ -65862,6 +65972,9 @@ var ClaudeCodeCommandHandler = class {
65862
65972
  async replayPendingOutputs() {
65863
65973
  await this.outputBuffer.replayPendingOutputs();
65864
65974
  }
65975
+ pendingOutputStats() {
65976
+ return this.outputBuffer.pendingOutputStats();
65977
+ }
65865
65978
  async prepare() {
65866
65979
  await this.ensureAgentSession().prepare();
65867
65980
  }
@@ -67942,6 +68055,9 @@ var CodexCommandHandler = class {
67942
68055
  async replayPendingOutputs() {
67943
68056
  await this.outputBuffer.replayPendingOutputs();
67944
68057
  }
68058
+ pendingOutputStats() {
68059
+ return this.outputBuffer.pendingOutputStats();
68060
+ }
67945
68061
  async prepare() {
67946
68062
  await this.ensureSession().prepare();
67947
68063
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.452",
3
+ "version": "0.1.454",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"