@autohq/cli 0.1.313 → 0.1.315

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.
@@ -19722,16 +19722,16 @@ var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
19722
19722
  // ground truth. The persisting side settles exactly these turns; absent
19723
19723
  // (older runtimes, non-command turns) it falls back to cursor attribution.
19724
19724
  consumedCommandIds: external_exports.array(SessionCommandIdSchema).optional()
19725
- }).strict();
19725
+ });
19726
19726
  var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
19727
19727
  sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
19728
- }).strict().transform(({ sessionStatusAfter, ...entry }) => ({
19728
+ }).transform(({ sessionStatusAfter, ...entry }) => ({
19729
19729
  ...entry,
19730
19730
  turnStatus: legacyRuntimeTurnStatus(entry, sessionStatusAfter)
19731
19731
  }));
19732
19732
  var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.union([
19733
- RuntimeBridgeOutputEntryEnvelopeWireSchema,
19734
- LegacyRuntimeBridgeOutputEntryEnvelopeSchema
19733
+ LegacyRuntimeBridgeOutputEntryEnvelopeSchema,
19734
+ RuntimeBridgeOutputEntryEnvelopeWireSchema
19735
19735
  ]);
19736
19736
  var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
19737
19737
  type: external_exports.literal("conversation.delta"),
@@ -19786,7 +19786,7 @@ var RuntimeBridgeOutputUiMessageCompletedEnvelopeSchema = external_exports.objec
19786
19786
  consumedCommandIds: external_exports.array(SessionCommandIdSchema).optional(),
19787
19787
  createdAt: external_exports.string().datetime(),
19788
19788
  completedAt: external_exports.string().datetime().nullable()
19789
- }).strict();
19789
+ });
19790
19790
  var RuntimeBridgeOutputEnvelopeSchema = external_exports.union([
19791
19791
  RuntimeBridgeOutputEntryEnvelopeSchema,
19792
19792
  RuntimeBridgeOutputDeltaEnvelopeSchema,
@@ -23431,7 +23431,7 @@ Object.assign(lookup, {
23431
23431
  // package.json
23432
23432
  var package_default = {
23433
23433
  name: "@autohq/cli",
23434
- version: "0.1.313",
23434
+ version: "0.1.315",
23435
23435
  license: "SEE LICENSE IN README.md",
23436
23436
  publishConfig: {
23437
23437
  access: "public"
@@ -23517,6 +23517,13 @@ var AgentBridgeTerminalAuthError = class extends Error {
23517
23517
  this.name = "AgentBridgeTerminalAuthError";
23518
23518
  }
23519
23519
  };
23520
+ var AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS = 1e4;
23521
+ var AgentBridgeOutputAckTimeoutError = class extends Error {
23522
+ constructor(message) {
23523
+ super(message);
23524
+ this.name = "AgentBridgeOutputAckTimeoutError";
23525
+ }
23526
+ };
23520
23527
  async function runAgentBridgeSocket(options) {
23521
23528
  const socket = lookup(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
23522
23529
  auth: {
@@ -23569,6 +23576,13 @@ async function runAgentBridgeSocket(options) {
23569
23576
  onBootstrap: options.onBootstrap,
23570
23577
  createHandler: (bootstrap) => options.createHandler({
23571
23578
  emitOutput: (output) => emitOutputWithAck(socket, output, options.runtimeLogger),
23579
+ cycleSocket: () => {
23580
+ options.writeOutput?.(
23581
+ "agent_bridge_socket_cycle reason=output_ack_retries_exhausted"
23582
+ );
23583
+ socket.disconnect();
23584
+ socket.connect();
23585
+ },
23572
23586
  bootstrap,
23573
23587
  outputSeqStart: bootstrap.outputSeqStart,
23574
23588
  runtimeLogger: options.runtimeLogger,
@@ -23766,7 +23780,7 @@ function emitOutputWithAck(socket, output, runtimeLogger) {
23766
23780
  outputLogContext(output, socket.id)
23767
23781
  );
23768
23782
  return new Promise((resolve2, reject) => {
23769
- socket.timeout(5e3).emit(
23783
+ socket.timeout(AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS).emit(
23770
23784
  RUNTIME_BRIDGE_OUTPUT_EVENT,
23771
23785
  output,
23772
23786
  (error51, rawAck) => {
@@ -23776,7 +23790,7 @@ function emitOutputWithAck(socket, output, runtimeLogger) {
23776
23790
  duration_ms: Date.now() - startedAt,
23777
23791
  error: error51.message
23778
23792
  });
23779
- reject(error51);
23793
+ reject(new AgentBridgeOutputAckTimeoutError(error51.message));
23780
23794
  return;
23781
23795
  }
23782
23796
  const ack = RuntimeBridgeOutputAckSchema.safeParse(rawAck);
@@ -32382,6 +32396,9 @@ var ProjectUsageResponseSchema = external_exports.object({
32382
32396
  daily: external_exports.array(ProjectUsageDayPointSchema)
32383
32397
  });
32384
32398
 
32399
+ // src/commands/agent-bridge/harness/output-buffer.ts
32400
+ import { setTimeout as sleep } from "timers/promises";
32401
+
32385
32402
  // ../../node_modules/ai/node_modules/@ai-sdk/provider/dist/index.mjs
32386
32403
  var marker = "vercel.ai.error";
32387
32404
  var symbol2 = Symbol.for(marker);
@@ -40922,6 +40939,7 @@ function providerMetadataField(providerMetadata) {
40922
40939
 
40923
40940
  // src/commands/agent-bridge/harness/output-buffer.ts
40924
40941
  var AGENT_BRIDGE_OUTPUT_DELTA_FLUSH_MS = 50;
40942
+ var AGENT_BRIDGE_OUTPUT_ACK_RETRY_BACKOFF_MS = [250, 1e3];
40925
40943
  var AgentBridgeOutputBuffer = class {
40926
40944
  constructor(input) {
40927
40945
  this.input = input;
@@ -41158,6 +41176,41 @@ var AgentBridgeOutputBuffer = class {
41158
41176
  await this.drainPendingOutputs(options);
41159
41177
  }
41160
41178
  async emitUntilAcked(output) {
41179
+ for (let attempt = 0; ; attempt += 1) {
41180
+ try {
41181
+ await this.emitOnce(output);
41182
+ return;
41183
+ } catch (error51) {
41184
+ if (!(error51 instanceof AgentBridgeOutputAckTimeoutError)) {
41185
+ throw error51;
41186
+ }
41187
+ const backoffMs = AGENT_BRIDGE_OUTPUT_ACK_RETRY_BACKOFF_MS[attempt];
41188
+ if (backoffMs === void 0) {
41189
+ this.input.runtimeLogger?.error(
41190
+ "agent_bridge_output_buffer_ack_retries_exhausted",
41191
+ this.outputLogContext(output, {
41192
+ attempts: attempt + 1,
41193
+ socket_cycle: this.input.cycleSocket ? "requested" : "unavailable",
41194
+ pending_count: this.pendingOutputs.size
41195
+ })
41196
+ );
41197
+ this.input.cycleSocket?.();
41198
+ throw error51;
41199
+ }
41200
+ this.input.runtimeLogger?.warn(
41201
+ "agent_bridge_output_buffer_emit_ack_timeout",
41202
+ this.outputLogContext(output, {
41203
+ attempt: attempt + 1,
41204
+ backoff_ms: backoffMs,
41205
+ error: error51.message,
41206
+ pending_count: this.pendingOutputs.size
41207
+ })
41208
+ );
41209
+ await sleep(backoffMs);
41210
+ }
41211
+ }
41212
+ }
41213
+ async emitOnce(output) {
41161
41214
  const startedAt = Date.now();
41162
41215
  this.input.runtimeLogger?.info(
41163
41216
  "agent_bridge_output_buffer_emit_started",
@@ -64335,6 +64388,7 @@ function createHarnessCommandHandler(input) {
64335
64388
  const config2 = resolveHarnessConfig(input.bootstrap);
64336
64389
  const base = {
64337
64390
  emitOutput: input.emitOutput,
64391
+ ...input.cycleSocket ? { cycleSocket: input.cycleSocket } : {},
64338
64392
  ...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
64339
64393
  ...input.runtimeLogger ? { runtimeLogger: input.runtimeLogger } : {},
64340
64394
  socketId: input.socketId,
package/dist/index.js CHANGED
@@ -27058,7 +27058,7 @@ var init_package = __esm({
27058
27058
  "package.json"() {
27059
27059
  package_default = {
27060
27060
  name: "@autohq/cli",
27061
- version: "0.1.313",
27061
+ version: "0.1.315",
27062
27062
  license: "SEE LICENSE IN README.md",
27063
27063
  publishConfig: {
27064
27064
  access: "public"
@@ -29874,7 +29874,7 @@ async function login(input) {
29874
29874
  let firstAttempt = true;
29875
29875
  while (Date.now() < deadline) {
29876
29876
  if (!firstAttempt) {
29877
- await sleep2(Math.max(0, device.interval) * 1e3);
29877
+ await sleep3(Math.max(0, device.interval) * 1e3);
29878
29878
  }
29879
29879
  firstAttempt = false;
29880
29880
  let token3;
@@ -30046,7 +30046,7 @@ function persistLogin(config2, input) {
30046
30046
  setActiveAccount(accountKey, input.configPath);
30047
30047
  }
30048
30048
  }
30049
- async function sleep2(ms) {
30049
+ async function sleep3(ms) {
30050
30050
  await new Promise((resolve4) => setTimeout(resolve4, ms));
30051
30051
  }
30052
30052
  var init_login = __esm({
@@ -31641,10 +31641,10 @@ function ConversationView({
31641
31641
  return;
31642
31642
  }
31643
31643
  setStatus("failed");
31644
- await sleep3(1e3, abort.signal);
31644
+ await sleep4(1e3, abort.signal);
31645
31645
  continue;
31646
31646
  }
31647
- await sleep3(250, abort.signal);
31647
+ await sleep4(250, abort.signal);
31648
31648
  }
31649
31649
  })();
31650
31650
  void client.getSession(sessionId, { apiBaseUrl: apiUrl }).then(applyRunSnapshot).catch(() => void 0);
@@ -31697,10 +31697,10 @@ function ConversationView({
31697
31697
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
31698
31698
  })
31699
31699
  );
31700
- await sleep3(1e3, abort.signal);
31700
+ await sleep4(1e3, abort.signal);
31701
31701
  continue;
31702
31702
  }
31703
- await sleep3(250, abort.signal);
31703
+ await sleep4(250, abort.signal);
31704
31704
  }
31705
31705
  })();
31706
31706
  return () => {
@@ -32201,7 +32201,7 @@ function formatDuration(event) {
32201
32201
  }
32202
32202
  return `${(event.durationMs / 1e3).toFixed(1)}s`;
32203
32203
  }
32204
- function sleep3(ms, signal) {
32204
+ function sleep4(ms, signal) {
32205
32205
  if (signal.aborted) {
32206
32206
  return Promise.resolve();
32207
32207
  }
@@ -37125,16 +37125,16 @@ var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
37125
37125
  // ground truth. The persisting side settles exactly these turns; absent
37126
37126
  // (older runtimes, non-command turns) it falls back to cursor attribution.
37127
37127
  consumedCommandIds: external_exports.array(SessionCommandIdSchema2).optional()
37128
- }).strict();
37128
+ });
37129
37129
  var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
37130
37130
  sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
37131
- }).strict().transform(({ sessionStatusAfter, ...entry }) => ({
37131
+ }).transform(({ sessionStatusAfter, ...entry }) => ({
37132
37132
  ...entry,
37133
37133
  turnStatus: legacyRuntimeTurnStatus(entry, sessionStatusAfter)
37134
37134
  }));
37135
37135
  var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.union([
37136
- RuntimeBridgeOutputEntryEnvelopeWireSchema,
37137
- LegacyRuntimeBridgeOutputEntryEnvelopeSchema
37136
+ LegacyRuntimeBridgeOutputEntryEnvelopeSchema,
37137
+ RuntimeBridgeOutputEntryEnvelopeWireSchema
37138
37138
  ]);
37139
37139
  var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
37140
37140
  type: external_exports.literal("conversation.delta"),
@@ -37189,7 +37189,7 @@ var RuntimeBridgeOutputUiMessageCompletedEnvelopeSchema = external_exports.objec
37189
37189
  consumedCommandIds: external_exports.array(SessionCommandIdSchema2).optional(),
37190
37190
  createdAt: external_exports.string().datetime(),
37191
37191
  completedAt: external_exports.string().datetime().nullable()
37192
- }).strict();
37192
+ });
37193
37193
  var RuntimeBridgeOutputEnvelopeSchema = external_exports.union([
37194
37194
  RuntimeBridgeOutputEntryEnvelopeSchema,
37195
37195
  RuntimeBridgeOutputDeltaEnvelopeSchema,
@@ -37310,6 +37310,13 @@ var AgentBridgeTerminalAuthError = class extends Error {
37310
37310
  this.name = "AgentBridgeTerminalAuthError";
37311
37311
  }
37312
37312
  };
37313
+ var AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS = 1e4;
37314
+ var AgentBridgeOutputAckTimeoutError = class extends Error {
37315
+ constructor(message) {
37316
+ super(message);
37317
+ this.name = "AgentBridgeOutputAckTimeoutError";
37318
+ }
37319
+ };
37313
37320
  async function runAgentBridgeSocket(options) {
37314
37321
  const socket = io(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
37315
37322
  auth: {
@@ -37362,6 +37369,13 @@ async function runAgentBridgeSocket(options) {
37362
37369
  onBootstrap: options.onBootstrap,
37363
37370
  createHandler: (bootstrap) => options.createHandler({
37364
37371
  emitOutput: (output) => emitOutputWithAck(socket, output, options.runtimeLogger),
37372
+ cycleSocket: () => {
37373
+ options.writeOutput?.(
37374
+ "agent_bridge_socket_cycle reason=output_ack_retries_exhausted"
37375
+ );
37376
+ socket.disconnect();
37377
+ socket.connect();
37378
+ },
37365
37379
  bootstrap,
37366
37380
  outputSeqStart: bootstrap.outputSeqStart,
37367
37381
  runtimeLogger: options.runtimeLogger,
@@ -37559,7 +37573,7 @@ function emitOutputWithAck(socket, output, runtimeLogger) {
37559
37573
  outputLogContext(output, socket.id)
37560
37574
  );
37561
37575
  return new Promise((resolve4, reject) => {
37562
- socket.timeout(5e3).emit(
37576
+ socket.timeout(AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS).emit(
37563
37577
  RUNTIME_BRIDGE_OUTPUT_EVENT,
37564
37578
  output,
37565
37579
  (error51, rawAck) => {
@@ -37569,7 +37583,7 @@ function emitOutputWithAck(socket, output, runtimeLogger) {
37569
37583
  duration_ms: Date.now() - startedAt,
37570
37584
  error: error51.message
37571
37585
  });
37572
- reject(error51);
37586
+ reject(new AgentBridgeOutputAckTimeoutError(error51.message));
37573
37587
  return;
37574
37588
  }
37575
37589
  const ack = RuntimeBridgeOutputAckSchema.safeParse(rawAck);
@@ -37694,6 +37708,7 @@ function jsonRecordString(value, key) {
37694
37708
  init_src();
37695
37709
 
37696
37710
  // src/commands/agent-bridge/harness/output-buffer.ts
37711
+ import { setTimeout as sleep2 } from "timers/promises";
37697
37712
  init_src();
37698
37713
  import { readUIMessageStream } from "ai";
37699
37714
 
@@ -38036,6 +38051,7 @@ function providerMetadataField(providerMetadata) {
38036
38051
 
38037
38052
  // src/commands/agent-bridge/harness/output-buffer.ts
38038
38053
  var AGENT_BRIDGE_OUTPUT_DELTA_FLUSH_MS = 50;
38054
+ var AGENT_BRIDGE_OUTPUT_ACK_RETRY_BACKOFF_MS = [250, 1e3];
38039
38055
  var AgentBridgeOutputBuffer = class {
38040
38056
  constructor(input) {
38041
38057
  this.input = input;
@@ -38272,6 +38288,41 @@ var AgentBridgeOutputBuffer = class {
38272
38288
  await this.drainPendingOutputs(options);
38273
38289
  }
38274
38290
  async emitUntilAcked(output) {
38291
+ for (let attempt = 0; ; attempt += 1) {
38292
+ try {
38293
+ await this.emitOnce(output);
38294
+ return;
38295
+ } catch (error51) {
38296
+ if (!(error51 instanceof AgentBridgeOutputAckTimeoutError)) {
38297
+ throw error51;
38298
+ }
38299
+ const backoffMs = AGENT_BRIDGE_OUTPUT_ACK_RETRY_BACKOFF_MS[attempt];
38300
+ if (backoffMs === void 0) {
38301
+ this.input.runtimeLogger?.error(
38302
+ "agent_bridge_output_buffer_ack_retries_exhausted",
38303
+ this.outputLogContext(output, {
38304
+ attempts: attempt + 1,
38305
+ socket_cycle: this.input.cycleSocket ? "requested" : "unavailable",
38306
+ pending_count: this.pendingOutputs.size
38307
+ })
38308
+ );
38309
+ this.input.cycleSocket?.();
38310
+ throw error51;
38311
+ }
38312
+ this.input.runtimeLogger?.warn(
38313
+ "agent_bridge_output_buffer_emit_ack_timeout",
38314
+ this.outputLogContext(output, {
38315
+ attempt: attempt + 1,
38316
+ backoff_ms: backoffMs,
38317
+ error: error51.message,
38318
+ pending_count: this.pendingOutputs.size
38319
+ })
38320
+ );
38321
+ await sleep2(backoffMs);
38322
+ }
38323
+ }
38324
+ }
38325
+ async emitOnce(output) {
38275
38326
  const startedAt = Date.now();
38276
38327
  this.input.runtimeLogger?.info(
38277
38328
  "agent_bridge_output_buffer_emit_started",
@@ -41883,6 +41934,7 @@ function createHarnessCommandHandler(input) {
41883
41934
  const config2 = resolveHarnessConfig(input.bootstrap);
41884
41935
  const base = {
41885
41936
  emitOutput: input.emitOutput,
41937
+ ...input.cycleSocket ? { cycleSocket: input.cycleSocket } : {},
41886
41938
  ...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
41887
41939
  ...input.runtimeLogger ? { runtimeLogger: input.runtimeLogger } : {},
41888
41940
  socketId: input.socketId,
@@ -42267,7 +42319,7 @@ async function connectAgentPresence2(input) {
42267
42319
  );
42268
42320
  return;
42269
42321
  }
42270
- const sleep4 = input.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
42322
+ const sleep5 = input.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
42271
42323
  const openBrowser2 = input.openBrowser ?? openBrowser;
42272
42324
  const now3 = input.now ?? Date.now;
42273
42325
  const pollIntervalMs = input.pollIntervalMs ?? POLL_INTERVAL_MS;
@@ -42281,7 +42333,7 @@ async function connectAgentPresence2(input) {
42281
42333
  const deadline = now3() + pollTimeoutMs;
42282
42334
  let realized = false;
42283
42335
  while (now3() < deadline) {
42284
- await sleep4(pollIntervalMs);
42336
+ await sleep5(pollIntervalMs);
42285
42337
  const presence = await input.client.getAgentPresence(
42286
42338
  { name: input.agent },
42287
42339
  options
@@ -43045,11 +43097,11 @@ async function activeGrantIds(input) {
43045
43097
  );
43046
43098
  }
43047
43099
  async function waitForNewGrant(input, knownGrantIds) {
43048
- const sleep4 = input.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
43100
+ const sleep5 = input.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
43049
43101
  const now3 = input.now ?? Date.now;
43050
43102
  const deadline = now3() + (input.pollTimeoutMs ?? POLL_TIMEOUT_MS2);
43051
43103
  while (now3() < deadline) {
43052
- await sleep4(input.pollIntervalMs ?? POLL_INTERVAL_MS2);
43104
+ await sleep5(input.pollIntervalMs ?? POLL_INTERVAL_MS2);
43053
43105
  const result = await input.client.listConnections({
43054
43106
  provider: input.provider,
43055
43107
  apiBaseUrl: input.apiBaseUrl
@@ -46439,7 +46491,7 @@ async function askRequired(context, question) {
46439
46491
  }
46440
46492
  }
46441
46493
  async function waitForOnboardingReady(context, client, input) {
46442
- const sleep4 = input.sleep ?? defaultSleep;
46494
+ const sleep5 = input.sleep ?? defaultSleep;
46443
46495
  const pollIntervalMs = input.pollIntervalMs ?? SETUP_STATUS_POLL_INTERVAL_MS;
46444
46496
  let reportedMerged = false;
46445
46497
  let reportedApplied = false;
@@ -46465,7 +46517,7 @@ async function waitForOnboardingReady(context, client, input) {
46465
46517
  return void 0;
46466
46518
  });
46467
46519
  if (!status) {
46468
- await sleep4(pollIntervalMs);
46520
+ await sleep5(pollIntervalMs);
46469
46521
  continue;
46470
46522
  }
46471
46523
  consecutiveStatusErrors = 0;
@@ -46495,7 +46547,7 @@ async function waitForOnboardingReady(context, client, input) {
46495
46547
  status.pullRequest.merged ? "Still waiting for GitHub Sync to apply the onboarding agent..." : "Still waiting for the onboarding PR to be merged..."
46496
46548
  );
46497
46549
  }
46498
- await sleep4(pollIntervalMs);
46550
+ await sleep5(pollIntervalMs);
46499
46551
  }
46500
46552
  }
46501
46553
  function openSlackWorkspace(context, slack, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.313",
3
+ "version": "0.1.315",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"