@autohq/cli 0.1.453 → 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.
- package/dist/agent-bridge.js +85 -4
- package/dist/index.js +85 -4
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -72327,6 +72388,20 @@ var AgentBridgeOutputBuffer = class {
|
|
|
72327
72388
|
await this.flushPendingDelta({ force: true });
|
|
72328
72389
|
await this.drainPendingOutputs({ force: true });
|
|
72329
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
|
+
}
|
|
72330
72405
|
// Emits one runtime liveness beat through the same ordered, acked drain as
|
|
72331
72406
|
// content envelopes — deliberately, so a beat landing at the bridge proves
|
|
72332
72407
|
// the pipeline is healthy end to end. While a previous beat is still
|
|
@@ -94857,6 +94932,9 @@ var ClaudeCodeCommandHandler = class {
|
|
|
94857
94932
|
async replayPendingOutputs() {
|
|
94858
94933
|
await this.outputBuffer.replayPendingOutputs();
|
|
94859
94934
|
}
|
|
94935
|
+
pendingOutputStats() {
|
|
94936
|
+
return this.outputBuffer.pendingOutputStats();
|
|
94937
|
+
}
|
|
94860
94938
|
async prepare() {
|
|
94861
94939
|
await this.ensureAgentSession().prepare();
|
|
94862
94940
|
}
|
|
@@ -96932,6 +97010,9 @@ var CodexCommandHandler = class {
|
|
|
96932
97010
|
async replayPendingOutputs() {
|
|
96933
97011
|
await this.outputBuffer.replayPendingOutputs();
|
|
96934
97012
|
}
|
|
97013
|
+
pendingOutputStats() {
|
|
97014
|
+
return this.outputBuffer.pendingOutputStats();
|
|
97015
|
+
}
|
|
96935
97016
|
async prepare() {
|
|
96936
97017
|
await this.ensureSession().prepare();
|
|
96937
97018
|
}
|
package/dist/index.js
CHANGED
|
@@ -50870,7 +50870,7 @@ var init_package = __esm({
|
|
|
50870
50870
|
"package.json"() {
|
|
50871
50871
|
package_default = {
|
|
50872
50872
|
name: "@autohq/cli",
|
|
50873
|
-
version: "0.1.
|
|
50873
|
+
version: "0.1.454",
|
|
50874
50874
|
license: "SEE LICENSE IN README.md",
|
|
50875
50875
|
publishConfig: {
|
|
50876
50876
|
access: "public"
|
|
@@ -61866,6 +61866,7 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
|
|
|
61866
61866
|
}
|
|
61867
61867
|
};
|
|
61868
61868
|
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS = 6e4;
|
|
61869
|
+
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
|
|
61869
61870
|
async function runAgentBridgeSocket(options) {
|
|
61870
61871
|
const socket = io(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
|
|
61871
61872
|
auth: {
|
|
@@ -61929,7 +61930,7 @@ async function runAgentBridgeSocket(options) {
|
|
|
61929
61930
|
return;
|
|
61930
61931
|
}
|
|
61931
61932
|
options.writeOutput?.(`agent_bridge_disconnected reason=${reason}`);
|
|
61932
|
-
if (terminalAuthDrain.
|
|
61933
|
+
if (terminalAuthDrain.handleDisconnect()) {
|
|
61933
61934
|
return;
|
|
61934
61935
|
}
|
|
61935
61936
|
reconnectLoop.start();
|
|
@@ -62226,9 +62227,48 @@ function createTerminalAuthDrainController(input) {
|
|
|
62226
62227
|
return;
|
|
62227
62228
|
}
|
|
62228
62229
|
clearTimeout(current.timeout);
|
|
62230
|
+
if (current.redialTimer) {
|
|
62231
|
+
clearTimeout(current.redialTimer);
|
|
62232
|
+
}
|
|
62229
62233
|
state = null;
|
|
62230
62234
|
callback();
|
|
62231
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
|
+
};
|
|
62232
62272
|
const begin = () => {
|
|
62233
62273
|
terminalAuthExit = true;
|
|
62234
62274
|
if (state) {
|
|
@@ -62252,6 +62292,7 @@ function createTerminalAuthDrainController(input) {
|
|
|
62252
62292
|
rejectDrain = reject;
|
|
62253
62293
|
});
|
|
62254
62294
|
const timeout = setTimeout(() => {
|
|
62295
|
+
logDroppedPendingOutputs("drain_timeout");
|
|
62255
62296
|
settle(() => {
|
|
62256
62297
|
rejectDrain(
|
|
62257
62298
|
new Error(
|
|
@@ -62263,6 +62304,7 @@ function createTerminalAuthDrainController(input) {
|
|
|
62263
62304
|
timeout.unref?.();
|
|
62264
62305
|
state = {
|
|
62265
62306
|
promise: promise2,
|
|
62307
|
+
redialTimer: null,
|
|
62266
62308
|
reject: rejectDrain,
|
|
62267
62309
|
resolve: resolveDrain,
|
|
62268
62310
|
startedAt,
|
|
@@ -62305,7 +62347,10 @@ function createTerminalAuthDrainController(input) {
|
|
|
62305
62347
|
current.resolve();
|
|
62306
62348
|
});
|
|
62307
62349
|
})().catch((error51) => {
|
|
62308
|
-
|
|
62350
|
+
input.writeOutput?.(
|
|
62351
|
+
`agent_bridge_terminal_auth_drain_replay_error error=${errorMessage(error51)}`
|
|
62352
|
+
);
|
|
62353
|
+
scheduleRedial();
|
|
62309
62354
|
});
|
|
62310
62355
|
return true;
|
|
62311
62356
|
};
|
|
@@ -62314,13 +62359,29 @@ function createTerminalAuthDrainController(input) {
|
|
|
62314
62359
|
if (!current) {
|
|
62315
62360
|
return false;
|
|
62316
62361
|
}
|
|
62317
|
-
|
|
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();
|
|
62318
62371
|
return true;
|
|
62319
62372
|
};
|
|
62373
|
+
const handleDisconnect = () => {
|
|
62374
|
+
if (state) {
|
|
62375
|
+
scheduleRedial();
|
|
62376
|
+
return true;
|
|
62377
|
+
}
|
|
62378
|
+
return terminalAuthExit;
|
|
62379
|
+
};
|
|
62320
62380
|
return {
|
|
62321
62381
|
begin,
|
|
62322
62382
|
handleConnected,
|
|
62323
62383
|
handleConnectError,
|
|
62384
|
+
handleDisconnect,
|
|
62324
62385
|
suppressesReconnect: () => terminalAuthExit || state !== null
|
|
62325
62386
|
};
|
|
62326
62387
|
}
|
|
@@ -62937,6 +62998,20 @@ var AgentBridgeOutputBuffer = class {
|
|
|
62937
62998
|
await this.flushPendingDelta({ force: true });
|
|
62938
62999
|
await this.drainPendingOutputs({ force: true });
|
|
62939
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
|
+
}
|
|
62940
63015
|
// Emits one runtime liveness beat through the same ordered, acked drain as
|
|
62941
63016
|
// content envelopes — deliberately, so a beat landing at the bridge proves
|
|
62942
63017
|
// the pipeline is healthy end to end. While a previous beat is still
|
|
@@ -65897,6 +65972,9 @@ var ClaudeCodeCommandHandler = class {
|
|
|
65897
65972
|
async replayPendingOutputs() {
|
|
65898
65973
|
await this.outputBuffer.replayPendingOutputs();
|
|
65899
65974
|
}
|
|
65975
|
+
pendingOutputStats() {
|
|
65976
|
+
return this.outputBuffer.pendingOutputStats();
|
|
65977
|
+
}
|
|
65900
65978
|
async prepare() {
|
|
65901
65979
|
await this.ensureAgentSession().prepare();
|
|
65902
65980
|
}
|
|
@@ -67977,6 +68055,9 @@ var CodexCommandHandler = class {
|
|
|
67977
68055
|
async replayPendingOutputs() {
|
|
67978
68056
|
await this.outputBuffer.replayPendingOutputs();
|
|
67979
68057
|
}
|
|
68058
|
+
pendingOutputStats() {
|
|
68059
|
+
return this.outputBuffer.pendingOutputStats();
|
|
68060
|
+
}
|
|
67980
68061
|
async prepare() {
|
|
67981
68062
|
await this.ensureSession().prepare();
|
|
67982
68063
|
}
|