@autohq/cli 0.1.527 → 0.1.529
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 +50 -6
- package/dist/index.js +50 -6
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -30866,7 +30866,7 @@ Object.assign(lookup, {
|
|
|
30866
30866
|
// package.json
|
|
30867
30867
|
var package_default = {
|
|
30868
30868
|
name: "@autohq/cli",
|
|
30869
|
-
version: "0.1.
|
|
30869
|
+
version: "0.1.529",
|
|
30870
30870
|
license: "SEE LICENSE IN README.md",
|
|
30871
30871
|
publishConfig: {
|
|
30872
30872
|
access: "public"
|
|
@@ -30954,6 +30954,14 @@ var AgentBridgeTerminalAuthError = class extends Error {
|
|
|
30954
30954
|
this.name = "AgentBridgeTerminalAuthError";
|
|
30955
30955
|
}
|
|
30956
30956
|
};
|
|
30957
|
+
var AGENT_BRIDGE_TERMINAL_PREPARE_EXIT_CODE = 79;
|
|
30958
|
+
var AgentBridgeTerminalPrepareError = class extends Error {
|
|
30959
|
+
exitCode = AGENT_BRIDGE_TERMINAL_PREPARE_EXIT_CODE;
|
|
30960
|
+
constructor(message, options) {
|
|
30961
|
+
super(message, options);
|
|
30962
|
+
this.name = "AgentBridgeTerminalPrepareError";
|
|
30963
|
+
}
|
|
30964
|
+
};
|
|
30957
30965
|
var AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS = 1e4;
|
|
30958
30966
|
var AgentBridgeOutputAckTimeoutError = class extends Error {
|
|
30959
30967
|
constructor(message) {
|
|
@@ -62369,7 +62377,7 @@ async function createClaudeAutoMcpServer(input) {
|
|
|
62369
62377
|
const transformed = input.transformDryRun ? transformToolsListResponse(JSON.stringify(listResponse)) : { body: JSON.stringify(listResponse), pathsCompatible: false };
|
|
62370
62378
|
const listed = JSON.parse(transformed.body);
|
|
62371
62379
|
if (isRecord(listed.error)) {
|
|
62372
|
-
throw new
|
|
62380
|
+
throw new AgentBridgeTerminalPrepareError(
|
|
62373
62381
|
typeof listed.error.message === "string" ? listed.error.message : `Auto MCP server ${input.name} failed tools/list`
|
|
62374
62382
|
);
|
|
62375
62383
|
}
|
|
@@ -62425,11 +62433,37 @@ async function createClaudeAutoMcpServer(input) {
|
|
|
62425
62433
|
async function forwardJsonRpc(input) {
|
|
62426
62434
|
const response = await forwardRequest(
|
|
62427
62435
|
input.upstream,
|
|
62428
|
-
{
|
|
62436
|
+
{
|
|
62437
|
+
accept: "application/json, text/event-stream",
|
|
62438
|
+
"content-type": "application/json"
|
|
62439
|
+
},
|
|
62429
62440
|
JSON.stringify(input.message),
|
|
62430
62441
|
input.commandId
|
|
62431
62442
|
);
|
|
62432
|
-
return
|
|
62443
|
+
return parseJsonRpcResponseBody(response.body);
|
|
62444
|
+
}
|
|
62445
|
+
function parseJsonRpcResponseBody(body) {
|
|
62446
|
+
const trimmed = body.trimStart();
|
|
62447
|
+
if (!trimmed.startsWith("event:") && !trimmed.startsWith("data:")) {
|
|
62448
|
+
return JSON.parse(body);
|
|
62449
|
+
}
|
|
62450
|
+
let parsed;
|
|
62451
|
+
for (const line of body.split("\n")) {
|
|
62452
|
+
if (!line.startsWith("data:")) {
|
|
62453
|
+
continue;
|
|
62454
|
+
}
|
|
62455
|
+
try {
|
|
62456
|
+
const candidate = JSON.parse(line.slice("data:".length).trim());
|
|
62457
|
+
if (isRecord(candidate)) {
|
|
62458
|
+
parsed = candidate;
|
|
62459
|
+
}
|
|
62460
|
+
} catch {
|
|
62461
|
+
}
|
|
62462
|
+
}
|
|
62463
|
+
if (!parsed) {
|
|
62464
|
+
throw new Error("Auto MCP server returned an unparseable SSE response");
|
|
62465
|
+
}
|
|
62466
|
+
return parsed;
|
|
62433
62467
|
}
|
|
62434
62468
|
function asCallToolResult(value2) {
|
|
62435
62469
|
if (isRecord(value2) && Array.isArray(value2.content)) {
|
|
@@ -74266,7 +74300,7 @@ ${cancelledToolPlatformNotice(cancelledToolRuns)}` : text2,
|
|
|
74266
74300
|
// configured MCP servers, or whose query failed to attach, skip the gate and
|
|
74267
74301
|
// fall through to the existing enqueue/error path unchanged.
|
|
74268
74302
|
async awaitMcpRegistration() {
|
|
74269
|
-
if (
|
|
74303
|
+
if (this.gatedMcpServerNames().length === 0) {
|
|
74270
74304
|
return;
|
|
74271
74305
|
}
|
|
74272
74306
|
let query;
|
|
@@ -74309,8 +74343,18 @@ ${cancelledToolPlatformNotice(cancelledToolRuns)}` : text2,
|
|
|
74309
74343
|
// immediately even while unrelated configured servers remain pending. A
|
|
74310
74344
|
// timeout or status-read failure returns a distinct not-ready result so the
|
|
74311
74345
|
// caller closes the session and rejects before first-turn injection.
|
|
74346
|
+
// The gate can only await servers the runtime connects to externally
|
|
74347
|
+
// (stdio/http/sse). SDK-hosted in-process servers have nothing to await —
|
|
74348
|
+
// their tool registry was built synchronously from the prepare-time
|
|
74349
|
+
// tools/list snapshot — and the claude runtime's mcp_status does not report
|
|
74350
|
+
// them at all, so polling for them holds the gate to its timeout on every
|
|
74351
|
+
// turn of a healthy runtime (the 2026-07-21 camfeed retry: repeating
|
|
74352
|
+
// gate_not_ready with an empty status list, zero session output).
|
|
74353
|
+
gatedMcpServerNames() {
|
|
74354
|
+
return Object.entries(this.options.mcpServers ?? {}).filter(([, config2]) => config2.type !== "sdk").map(([name23]) => name23);
|
|
74355
|
+
}
|
|
74312
74356
|
async pollMcpRegistration(query) {
|
|
74313
|
-
const configuredNames =
|
|
74357
|
+
const configuredNames = this.gatedMcpServerNames();
|
|
74314
74358
|
const startedAt = Date.now();
|
|
74315
74359
|
const deadline = startedAt + CLAUDE_MCP_REGISTRATION_TIMEOUT_MS;
|
|
74316
74360
|
this.input.writeOutput?.(
|
package/dist/index.js
CHANGED
|
@@ -78587,7 +78587,7 @@ var init_package = __esm({
|
|
|
78587
78587
|
"package.json"() {
|
|
78588
78588
|
package_default = {
|
|
78589
78589
|
name: "@autohq/cli",
|
|
78590
|
-
version: "0.1.
|
|
78590
|
+
version: "0.1.529",
|
|
78591
78591
|
license: "SEE LICENSE IN README.md",
|
|
78592
78592
|
publishConfig: {
|
|
78593
78593
|
access: "public"
|
|
@@ -89908,6 +89908,14 @@ var AgentBridgeTerminalAuthError = class extends Error {
|
|
|
89908
89908
|
this.name = "AgentBridgeTerminalAuthError";
|
|
89909
89909
|
}
|
|
89910
89910
|
};
|
|
89911
|
+
var AGENT_BRIDGE_TERMINAL_PREPARE_EXIT_CODE = 79;
|
|
89912
|
+
var AgentBridgeTerminalPrepareError = class extends Error {
|
|
89913
|
+
exitCode = AGENT_BRIDGE_TERMINAL_PREPARE_EXIT_CODE;
|
|
89914
|
+
constructor(message, options) {
|
|
89915
|
+
super(message, options);
|
|
89916
|
+
this.name = "AgentBridgeTerminalPrepareError";
|
|
89917
|
+
}
|
|
89918
|
+
};
|
|
89911
89919
|
var AGENT_BRIDGE_OUTPUT_ACK_TIMEOUT_MS = 1e4;
|
|
89912
89920
|
var AgentBridgeOutputAckTimeoutError = class extends Error {
|
|
89913
89921
|
constructor(message) {
|
|
@@ -90620,7 +90628,7 @@ async function createClaudeAutoMcpServer(input) {
|
|
|
90620
90628
|
const transformed = input.transformDryRun ? transformToolsListResponse(JSON.stringify(listResponse)) : { body: JSON.stringify(listResponse), pathsCompatible: false };
|
|
90621
90629
|
const listed = JSON.parse(transformed.body);
|
|
90622
90630
|
if (isRecord2(listed.error)) {
|
|
90623
|
-
throw new
|
|
90631
|
+
throw new AgentBridgeTerminalPrepareError(
|
|
90624
90632
|
typeof listed.error.message === "string" ? listed.error.message : `Auto MCP server ${input.name} failed tools/list`
|
|
90625
90633
|
);
|
|
90626
90634
|
}
|
|
@@ -90676,11 +90684,37 @@ async function createClaudeAutoMcpServer(input) {
|
|
|
90676
90684
|
async function forwardJsonRpc(input) {
|
|
90677
90685
|
const response = await forwardRequest(
|
|
90678
90686
|
input.upstream,
|
|
90679
|
-
{
|
|
90687
|
+
{
|
|
90688
|
+
accept: "application/json, text/event-stream",
|
|
90689
|
+
"content-type": "application/json"
|
|
90690
|
+
},
|
|
90680
90691
|
JSON.stringify(input.message),
|
|
90681
90692
|
input.commandId
|
|
90682
90693
|
);
|
|
90683
|
-
return
|
|
90694
|
+
return parseJsonRpcResponseBody(response.body);
|
|
90695
|
+
}
|
|
90696
|
+
function parseJsonRpcResponseBody(body) {
|
|
90697
|
+
const trimmed = body.trimStart();
|
|
90698
|
+
if (!trimmed.startsWith("event:") && !trimmed.startsWith("data:")) {
|
|
90699
|
+
return JSON.parse(body);
|
|
90700
|
+
}
|
|
90701
|
+
let parsed;
|
|
90702
|
+
for (const line of body.split("\n")) {
|
|
90703
|
+
if (!line.startsWith("data:")) {
|
|
90704
|
+
continue;
|
|
90705
|
+
}
|
|
90706
|
+
try {
|
|
90707
|
+
const candidate = JSON.parse(line.slice("data:".length).trim());
|
|
90708
|
+
if (isRecord2(candidate)) {
|
|
90709
|
+
parsed = candidate;
|
|
90710
|
+
}
|
|
90711
|
+
} catch {
|
|
90712
|
+
}
|
|
90713
|
+
}
|
|
90714
|
+
if (!parsed) {
|
|
90715
|
+
throw new Error("Auto MCP server returned an unparseable SSE response");
|
|
90716
|
+
}
|
|
90717
|
+
return parsed;
|
|
90684
90718
|
}
|
|
90685
90719
|
function asCallToolResult(value) {
|
|
90686
90720
|
if (isRecord2(value) && Array.isArray(value.content)) {
|
|
@@ -94325,7 +94359,7 @@ ${cancelledToolPlatformNotice(cancelledToolRuns)}` : text,
|
|
|
94325
94359
|
// configured MCP servers, or whose query failed to attach, skip the gate and
|
|
94326
94360
|
// fall through to the existing enqueue/error path unchanged.
|
|
94327
94361
|
async awaitMcpRegistration() {
|
|
94328
|
-
if (
|
|
94362
|
+
if (this.gatedMcpServerNames().length === 0) {
|
|
94329
94363
|
return;
|
|
94330
94364
|
}
|
|
94331
94365
|
let query;
|
|
@@ -94368,8 +94402,18 @@ ${cancelledToolPlatformNotice(cancelledToolRuns)}` : text,
|
|
|
94368
94402
|
// immediately even while unrelated configured servers remain pending. A
|
|
94369
94403
|
// timeout or status-read failure returns a distinct not-ready result so the
|
|
94370
94404
|
// caller closes the session and rejects before first-turn injection.
|
|
94405
|
+
// The gate can only await servers the runtime connects to externally
|
|
94406
|
+
// (stdio/http/sse). SDK-hosted in-process servers have nothing to await —
|
|
94407
|
+
// their tool registry was built synchronously from the prepare-time
|
|
94408
|
+
// tools/list snapshot — and the claude runtime's mcp_status does not report
|
|
94409
|
+
// them at all, so polling for them holds the gate to its timeout on every
|
|
94410
|
+
// turn of a healthy runtime (the 2026-07-21 camfeed retry: repeating
|
|
94411
|
+
// gate_not_ready with an empty status list, zero session output).
|
|
94412
|
+
gatedMcpServerNames() {
|
|
94413
|
+
return Object.entries(this.options.mcpServers ?? {}).filter(([, config2]) => config2.type !== "sdk").map(([name]) => name);
|
|
94414
|
+
}
|
|
94371
94415
|
async pollMcpRegistration(query) {
|
|
94372
|
-
const configuredNames =
|
|
94416
|
+
const configuredNames = this.gatedMcpServerNames();
|
|
94373
94417
|
const startedAt = Date.now();
|
|
94374
94418
|
const deadline = startedAt + CLAUDE_MCP_REGISTRATION_TIMEOUT_MS;
|
|
94375
94419
|
this.input.writeOutput?.(
|