@autohq/cli 0.1.563 → 0.1.564
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.
- package/dist/agent-bridge.js +56 -17
- package/dist/index.js +452 -17
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -30870,7 +30870,7 @@ Object.assign(lookup, {
|
|
|
30870
30870
|
// package.json
|
|
30871
30871
|
var package_default = {
|
|
30872
30872
|
name: "@autohq/cli",
|
|
30873
|
-
version: "0.1.
|
|
30873
|
+
version: "0.1.564",
|
|
30874
30874
|
license: "SEE LICENSE IN README.md",
|
|
30875
30875
|
publishConfig: {
|
|
30876
30876
|
access: "public"
|
|
@@ -30973,7 +30973,8 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
|
|
|
30973
30973
|
this.name = "AgentBridgeOutputAckTimeoutError";
|
|
30974
30974
|
}
|
|
30975
30975
|
};
|
|
30976
|
-
var
|
|
30976
|
+
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS = 6e4;
|
|
30977
|
+
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS = 30 * 6e4;
|
|
30977
30978
|
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
|
|
30978
30979
|
async function runAgentBridgeSocket(options) {
|
|
30979
30980
|
const socket = lookup(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
|
|
@@ -31050,6 +31051,7 @@ async function runAgentBridgeSocket(options) {
|
|
|
31050
31051
|
onBootstrap: options.onBootstrap,
|
|
31051
31052
|
createHandler: (bootstrap) => options.createHandler({
|
|
31052
31053
|
emitOutput: (output) => emitOutputWithAck(socket, output, options.runtimeLogger),
|
|
31054
|
+
onOutputAckProgress: terminalAuthDrain.handleOutputAckProgress,
|
|
31053
31055
|
cycleSocket: () => {
|
|
31054
31056
|
options.writeOutput?.(
|
|
31055
31057
|
"agent_bridge_socket_cycle reason=output_ack_retries_exhausted"
|
|
@@ -31336,7 +31338,12 @@ function createTerminalAuthDrainController(input) {
|
|
|
31336
31338
|
if (!current) {
|
|
31337
31339
|
return;
|
|
31338
31340
|
}
|
|
31339
|
-
|
|
31341
|
+
if (current.absoluteTimeout) {
|
|
31342
|
+
clearTimeout(current.absoluteTimeout);
|
|
31343
|
+
}
|
|
31344
|
+
if (current.noProgressTimeout) {
|
|
31345
|
+
clearTimeout(current.noProgressTimeout);
|
|
31346
|
+
}
|
|
31340
31347
|
if (current.redialTimer) {
|
|
31341
31348
|
clearTimeout(current.redialTimer);
|
|
31342
31349
|
}
|
|
@@ -31362,6 +31369,34 @@ function createTerminalAuthDrainController(input) {
|
|
|
31362
31369
|
context
|
|
31363
31370
|
);
|
|
31364
31371
|
};
|
|
31372
|
+
const timeoutDrain = (current, input2) => {
|
|
31373
|
+
if (state !== current) {
|
|
31374
|
+
return;
|
|
31375
|
+
}
|
|
31376
|
+
logDroppedPendingOutputs(input2.reason);
|
|
31377
|
+
settle(() => current.reject(new Error(input2.error)));
|
|
31378
|
+
};
|
|
31379
|
+
const scheduleNoProgressTimeout = (current) => {
|
|
31380
|
+
if (current.noProgressTimeout) {
|
|
31381
|
+
clearTimeout(current.noProgressTimeout);
|
|
31382
|
+
}
|
|
31383
|
+
current.noProgressTimeout = setTimeout(() => {
|
|
31384
|
+
timeoutDrain(current, {
|
|
31385
|
+
reason: "drain_no_progress_timeout",
|
|
31386
|
+
error: `Timed out draining pending bridge output after terminal auth with no output ack progress for ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS}ms`
|
|
31387
|
+
});
|
|
31388
|
+
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS);
|
|
31389
|
+
current.noProgressTimeout.unref?.();
|
|
31390
|
+
};
|
|
31391
|
+
const scheduleAbsoluteTimeout = (current) => {
|
|
31392
|
+
current.absoluteTimeout = setTimeout(() => {
|
|
31393
|
+
timeoutDrain(current, {
|
|
31394
|
+
reason: "drain_absolute_timeout",
|
|
31395
|
+
error: `Timed out draining pending bridge output after terminal auth at the ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS}ms absolute safety bound`
|
|
31396
|
+
});
|
|
31397
|
+
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS);
|
|
31398
|
+
current.absoluteTimeout.unref?.();
|
|
31399
|
+
};
|
|
31365
31400
|
const scheduleRedial = () => {
|
|
31366
31401
|
const current = state;
|
|
31367
31402
|
if (!current || current.redialTimer) {
|
|
@@ -31401,25 +31436,18 @@ function createTerminalAuthDrainController(input) {
|
|
|
31401
31436
|
resolveDrain = resolve4;
|
|
31402
31437
|
rejectDrain = reject;
|
|
31403
31438
|
});
|
|
31404
|
-
const
|
|
31405
|
-
|
|
31406
|
-
|
|
31407
|
-
rejectDrain(
|
|
31408
|
-
new Error(
|
|
31409
|
-
`Timed out draining pending bridge output after terminal auth in ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS}ms`
|
|
31410
|
-
)
|
|
31411
|
-
);
|
|
31412
|
-
});
|
|
31413
|
-
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS);
|
|
31414
|
-
timeout.unref?.();
|
|
31415
|
-
state = {
|
|
31439
|
+
const current = {
|
|
31440
|
+
absoluteTimeout: null,
|
|
31441
|
+
noProgressTimeout: null,
|
|
31416
31442
|
promise: promise2,
|
|
31417
31443
|
redialTimer: null,
|
|
31418
31444
|
reject: rejectDrain,
|
|
31419
31445
|
resolve: resolveDrain,
|
|
31420
|
-
startedAt
|
|
31421
|
-
timeout
|
|
31446
|
+
startedAt
|
|
31422
31447
|
};
|
|
31448
|
+
state = current;
|
|
31449
|
+
scheduleNoProgressTimeout(current);
|
|
31450
|
+
scheduleAbsoluteTimeout(current);
|
|
31423
31451
|
input.writeOutput?.("agent_bridge_terminal_auth_drain_started");
|
|
31424
31452
|
input.runtimeLogger?.warn("agent_bridge_terminal_auth_drain_started");
|
|
31425
31453
|
input.socket.auth = { token: input.token, terminalDrain: true };
|
|
@@ -31487,11 +31515,20 @@ function createTerminalAuthDrainController(input) {
|
|
|
31487
31515
|
}
|
|
31488
31516
|
return terminalAuthExit;
|
|
31489
31517
|
};
|
|
31518
|
+
const handleOutputAckProgress = () => {
|
|
31519
|
+
const current = state;
|
|
31520
|
+
if (!current) {
|
|
31521
|
+
return false;
|
|
31522
|
+
}
|
|
31523
|
+
scheduleNoProgressTimeout(current);
|
|
31524
|
+
return true;
|
|
31525
|
+
};
|
|
31490
31526
|
return {
|
|
31491
31527
|
begin,
|
|
31492
31528
|
handleConnected,
|
|
31493
31529
|
handleConnectError,
|
|
31494
31530
|
handleDisconnect,
|
|
31531
|
+
handleOutputAckProgress,
|
|
31495
31532
|
suppressesReconnect: () => terminalAuthExit || state !== null
|
|
31496
31533
|
};
|
|
31497
31534
|
}
|
|
@@ -72602,6 +72639,7 @@ var AgentBridgeOutputBuffer = class {
|
|
|
72602
72639
|
if (isSuccessfulOutputAck(ack)) {
|
|
72603
72640
|
this.pendingOutputs.delete(output.outputSeq);
|
|
72604
72641
|
this.discardOnFailureOutputSeqs.delete(output.outputSeq);
|
|
72642
|
+
this.input.onOutputAckProgress?.();
|
|
72605
72643
|
this.input.runtimeLogger?.info(
|
|
72606
72644
|
"agent_bridge_output_buffer_emit_ready",
|
|
72607
72645
|
this.outputLogContext(output, {
|
|
@@ -77921,6 +77959,7 @@ function createHarnessCommandHandler(input) {
|
|
|
77921
77959
|
const config2 = resolveHarnessConfig(input.bootstrap);
|
|
77922
77960
|
const base = {
|
|
77923
77961
|
emitOutput: input.emitOutput,
|
|
77962
|
+
...input.onOutputAckProgress ? { onOutputAckProgress: input.onOutputAckProgress } : {},
|
|
77924
77963
|
...input.cycleSocket ? { cycleSocket: input.cycleSocket } : {},
|
|
77925
77964
|
...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
|
|
77926
77965
|
...input.runtimeLogger ? { runtimeLogger: input.runtimeLogger } : {},
|