@buildautomaton/cli 0.1.93 → 0.1.94
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/cli.js +159 -132
- package/dist/cli.js.map +4 -4
- package/dist/index.js +157 -134
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20756,12 +20756,22 @@ var init_acp = __esm({
|
|
|
20756
20756
|
}
|
|
20757
20757
|
});
|
|
20758
20758
|
|
|
20759
|
+
// ../bridge/src/runtime/yield-to-event-loop.ts
|
|
20760
|
+
function yieldToEventLoop() {
|
|
20761
|
+
return new Promise((resolve36) => setImmediate(resolve36));
|
|
20762
|
+
}
|
|
20763
|
+
var init_yield_to_event_loop = __esm({
|
|
20764
|
+
"../bridge/src/runtime/yield-to-event-loop.ts"() {
|
|
20765
|
+
}
|
|
20766
|
+
});
|
|
20767
|
+
|
|
20759
20768
|
// ../bridge/src/files/index/constants.ts
|
|
20760
20769
|
import path3 from "node:path";
|
|
20761
20770
|
import os from "node:os";
|
|
20762
20771
|
var INDEX_WORK_YIELD_EVERY, INDEX_DIR, INDEX_HASH_LEN;
|
|
20763
20772
|
var init_constants = __esm({
|
|
20764
20773
|
"../bridge/src/files/index/constants.ts"() {
|
|
20774
|
+
"use strict";
|
|
20765
20775
|
INDEX_WORK_YIELD_EVERY = 128;
|
|
20766
20776
|
INDEX_DIR = path3.join(os.homedir(), ".buildautomaton");
|
|
20767
20777
|
INDEX_HASH_LEN = 16;
|
|
@@ -21026,15 +21036,6 @@ var init_activity_tracker = __esm({
|
|
|
21026
21036
|
}
|
|
21027
21037
|
});
|
|
21028
21038
|
|
|
21029
|
-
// ../bridge/src/runtime/yield-to-event-loop.ts
|
|
21030
|
-
function yieldToEventLoop() {
|
|
21031
|
-
return new Promise((resolve36) => setImmediate(resolve36));
|
|
21032
|
-
}
|
|
21033
|
-
var init_yield_to_event_loop = __esm({
|
|
21034
|
-
"../bridge/src/runtime/yield-to-event-loop.ts"() {
|
|
21035
|
-
}
|
|
21036
|
-
});
|
|
21037
|
-
|
|
21038
21039
|
// ../bridge/src/code-nav/symbol-index/deferred-indexing.ts
|
|
21039
21040
|
function isSymbolIndexDeferredError(err) {
|
|
21040
21041
|
return err instanceof SymbolIndexDeferredError;
|
|
@@ -21125,7 +21126,6 @@ function isCliSqliteLockError(e) {
|
|
|
21125
21126
|
var CliSqliteInterrupted;
|
|
21126
21127
|
var init_sqlite_errors = __esm({
|
|
21127
21128
|
"../bridge/src/sqlite/sqlite-errors.ts"() {
|
|
21128
|
-
"use strict";
|
|
21129
21129
|
CliSqliteInterrupted = class extends Error {
|
|
21130
21130
|
name = "CliSqliteInterrupted";
|
|
21131
21131
|
constructor() {
|
|
@@ -21923,7 +21923,6 @@ function withCodeNavCacheSqliteWorkLock(fn) {
|
|
|
21923
21923
|
var chain, workLockDepth;
|
|
21924
21924
|
var init_code_nav_cache_sqlite_work_lock = __esm({
|
|
21925
21925
|
"../bridge/src/sqlite/code-nav-cache/code-nav-cache-sqlite-work-lock.ts"() {
|
|
21926
|
-
"use strict";
|
|
21927
21926
|
init_code_nav_cache_paths();
|
|
21928
21927
|
chain = Promise.resolve();
|
|
21929
21928
|
workLockDepth = 0;
|
|
@@ -22065,7 +22064,6 @@ async function ensureCodeNavCacheSqliteInitialized() {
|
|
|
22065
22064
|
var safeCloseCodeNavCacheSqliteDatabase, openCodeNavCacheSqliteConnection;
|
|
22066
22065
|
var init_database = __esm({
|
|
22067
22066
|
"../bridge/src/sqlite/code-nav-cache/database.ts"() {
|
|
22068
|
-
"use strict";
|
|
22069
22067
|
init_code_nav_cache_availability();
|
|
22070
22068
|
init_instance();
|
|
22071
22069
|
init_sqlite_errors();
|
|
@@ -27443,6 +27441,12 @@ var wrapper_default = import_websocket.default;
|
|
|
27443
27441
|
// ../bridge/src/connection/ws/cli-ws-client.ts
|
|
27444
27442
|
import https from "node:https";
|
|
27445
27443
|
var CLI_WEBSOCKET_CLIENT_PING_MS = 25e3;
|
|
27444
|
+
var CLI_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 15e3;
|
|
27445
|
+
var sharedWssAgent = null;
|
|
27446
|
+
function cliWssAgent() {
|
|
27447
|
+
sharedWssAgent ??= new https.Agent({ rejectUnauthorized: false, keepAlive: true });
|
|
27448
|
+
return sharedWssAgent;
|
|
27449
|
+
}
|
|
27446
27450
|
function attachWebSocketClientPing(ws, intervalMs) {
|
|
27447
27451
|
let timer = null;
|
|
27448
27452
|
function clear() {
|
|
@@ -27463,9 +27467,12 @@ function attachWebSocketClientPing(ws, intervalMs) {
|
|
|
27463
27467
|
return clear;
|
|
27464
27468
|
}
|
|
27465
27469
|
function buildCliWebSocketClientOptions(wsUrl) {
|
|
27466
|
-
const wsOptions = {
|
|
27470
|
+
const wsOptions = {
|
|
27471
|
+
perMessageDeflate: false,
|
|
27472
|
+
handshakeTimeout: CLI_WEBSOCKET_HANDSHAKE_TIMEOUT_MS
|
|
27473
|
+
};
|
|
27467
27474
|
if (wsUrl.startsWith("wss://")) {
|
|
27468
|
-
wsOptions.agent =
|
|
27475
|
+
wsOptions.agent = cliWssAgent();
|
|
27469
27476
|
}
|
|
27470
27477
|
return wsOptions;
|
|
27471
27478
|
}
|
|
@@ -27479,6 +27486,15 @@ function safeCloseWebSocket(ws) {
|
|
|
27479
27486
|
ws.removeAllListeners();
|
|
27480
27487
|
return;
|
|
27481
27488
|
}
|
|
27489
|
+
if (ws.readyState === wrapper_default.CONNECTING) {
|
|
27490
|
+
ws.once("error", () => {
|
|
27491
|
+
});
|
|
27492
|
+
ws.once("close", () => {
|
|
27493
|
+
ws.removeAllListeners();
|
|
27494
|
+
});
|
|
27495
|
+
ws.terminate();
|
|
27496
|
+
return;
|
|
27497
|
+
}
|
|
27482
27498
|
ws.once("close", () => {
|
|
27483
27499
|
ws.removeAllListeners();
|
|
27484
27500
|
});
|
|
@@ -33501,7 +33517,25 @@ function spawnSdkStdioProcess(options) {
|
|
|
33501
33517
|
return { child, stderrCapture };
|
|
33502
33518
|
}
|
|
33503
33519
|
|
|
33520
|
+
// ../bridge/src/agents/acp/clients/listen-for-acp-client-abort.ts
|
|
33521
|
+
function listenForAcpClientAbort(child, signal, onAbort) {
|
|
33522
|
+
if (!signal) return () => {
|
|
33523
|
+
};
|
|
33524
|
+
const fire = () => {
|
|
33525
|
+
killChildProcessTree(child, "SIGKILL");
|
|
33526
|
+
onAbort();
|
|
33527
|
+
};
|
|
33528
|
+
if (signal.aborted) {
|
|
33529
|
+
fire();
|
|
33530
|
+
return () => {
|
|
33531
|
+
};
|
|
33532
|
+
}
|
|
33533
|
+
signal.addEventListener("abort", fire, { once: true });
|
|
33534
|
+
return () => signal.removeEventListener("abort", fire);
|
|
33535
|
+
}
|
|
33536
|
+
|
|
33504
33537
|
// ../bridge/src/agents/acp/clients/sdk/sdk-stdio-acp-client.ts
|
|
33538
|
+
init_yield_to_event_loop();
|
|
33505
33539
|
async function createSdkStdioAcpClient(options) {
|
|
33506
33540
|
const { PROTOCOL_VERSION: PROTOCOL_VERSION2 } = await Promise.resolve().then(() => (init_acp(), acp_exports));
|
|
33507
33541
|
const {
|
|
@@ -33519,13 +33553,18 @@ async function createSdkStdioAcpClient(options) {
|
|
|
33519
33553
|
onAcpConfigOptionsUpdated,
|
|
33520
33554
|
getActiveConfigOptions,
|
|
33521
33555
|
afterSessionEstablished,
|
|
33522
|
-
createExtNotificationHandler
|
|
33556
|
+
createExtNotificationHandler,
|
|
33557
|
+
signal
|
|
33523
33558
|
} = options;
|
|
33559
|
+
if (signal?.aborted) {
|
|
33560
|
+
throw new Error("ACP client aborted");
|
|
33561
|
+
}
|
|
33524
33562
|
const { child, stderrCapture } = spawnSdkStdioProcess({
|
|
33525
33563
|
command,
|
|
33526
33564
|
cwd,
|
|
33527
33565
|
onAgentSubprocessExit
|
|
33528
33566
|
});
|
|
33567
|
+
await yieldToEventLoop();
|
|
33529
33568
|
const sessionCtx = createSdkStdioSessionContext({
|
|
33530
33569
|
cwd,
|
|
33531
33570
|
mcpServers: options.mcpServers,
|
|
@@ -33541,7 +33580,11 @@ async function createSdkStdioAcpClient(options) {
|
|
|
33541
33580
|
});
|
|
33542
33581
|
return new Promise((resolve36, reject) => {
|
|
33543
33582
|
const init = createSdkStdioInitSettle(child);
|
|
33583
|
+
const stopAbort = listenForAcpClientAbort(child, signal, () => {
|
|
33584
|
+
init.settleReject(reject, new Error("ACP client aborted"));
|
|
33585
|
+
});
|
|
33544
33586
|
child.on("error", (err) => {
|
|
33587
|
+
stopAbort();
|
|
33545
33588
|
init.settleReject(reject, new Error(formatSpawnError(err, command[0])));
|
|
33546
33589
|
});
|
|
33547
33590
|
attachSdkStdioStderrAuthWatch({
|
|
@@ -33575,7 +33618,9 @@ async function createSdkStdioAcpClient(options) {
|
|
|
33575
33618
|
killSubprocessAfterCancelMs
|
|
33576
33619
|
})
|
|
33577
33620
|
);
|
|
33621
|
+
stopAbort();
|
|
33578
33622
|
} catch (err) {
|
|
33623
|
+
stopAbort();
|
|
33579
33624
|
if (init.settled) return;
|
|
33580
33625
|
init.settleReject(
|
|
33581
33626
|
reject,
|
|
@@ -33847,22 +33892,12 @@ function installBridgeProcessResilience() {
|
|
|
33847
33892
|
init_log();
|
|
33848
33893
|
|
|
33849
33894
|
// ../bridge/src/agents/acp/clients/bridge-agent-path.ts
|
|
33850
|
-
import { execFileSync } from "node:child_process";
|
|
33851
33895
|
import { homedir } from "node:os";
|
|
33852
33896
|
import { join } from "node:path";
|
|
33853
33897
|
function getBridgeAgentPathEntries(home = process.env.HOME ?? homedir()) {
|
|
33854
|
-
const entries = [
|
|
33855
|
-
join(home, ".local", "bin"),
|
|
33856
|
-
join(home, ".npm-global", "bin"),
|
|
33857
|
-
"/usr/local/bin"
|
|
33858
|
-
];
|
|
33898
|
+
const entries = [join(home, ".local", "bin"), join(home, ".npm-global", "bin"), "/usr/local/bin"];
|
|
33859
33899
|
const prefix = process.env.NPM_CONFIG_PREFIX;
|
|
33860
33900
|
if (prefix) entries.push(join(prefix, "bin"));
|
|
33861
|
-
try {
|
|
33862
|
-
const npmBin = execFileSync("npm", ["bin", "-g"], { encoding: "utf8", timeout: 2e3 }).trim();
|
|
33863
|
-
if (npmBin) entries.push(npmBin);
|
|
33864
|
-
} catch {
|
|
33865
|
-
}
|
|
33866
33901
|
return entries;
|
|
33867
33902
|
}
|
|
33868
33903
|
function augmentPath(pathValue, extra) {
|
|
@@ -35104,6 +35139,22 @@ function beginDeferredDisconnectForReconnect(options) {
|
|
|
35104
35139
|
}
|
|
35105
35140
|
}
|
|
35106
35141
|
|
|
35142
|
+
// ../bridge/src/connection/ws/dispose-previous-bridge-socket.ts
|
|
35143
|
+
function disposePreviousBridgeSocket(ws) {
|
|
35144
|
+
if (!ws) return;
|
|
35145
|
+
ws.removeAllListeners();
|
|
35146
|
+
ws.once("error", () => {
|
|
35147
|
+
});
|
|
35148
|
+
ws.once("close", () => {
|
|
35149
|
+
ws.removeAllListeners();
|
|
35150
|
+
});
|
|
35151
|
+
try {
|
|
35152
|
+
if (ws.readyState === wrapper_default.CONNECTING) ws.terminate();
|
|
35153
|
+
else ws.close();
|
|
35154
|
+
} catch {
|
|
35155
|
+
}
|
|
35156
|
+
}
|
|
35157
|
+
|
|
35107
35158
|
// ../bridge/src/connection/runtime/close-bridge-connection.ts
|
|
35108
35159
|
async function closeBridgeConnection(state, acpManager, previewEnvironmentManager, log2) {
|
|
35109
35160
|
requestCliImmediateShutdown();
|
|
@@ -35120,16 +35171,7 @@ async function closeBridgeConnection(state, acpManager, previewEnvironmentManage
|
|
|
35120
35171
|
await acpManager.disconnect();
|
|
35121
35172
|
if (state.currentWs) {
|
|
35122
35173
|
say("Closing bridge connection to the cloud\u2026");
|
|
35123
|
-
state.currentWs
|
|
35124
|
-
const wsState = state.currentWs.readyState;
|
|
35125
|
-
if (wsState === 1 || wsState === 2) {
|
|
35126
|
-
state.currentWs.close();
|
|
35127
|
-
} else {
|
|
35128
|
-
state.currentWs.on("error", () => {
|
|
35129
|
-
});
|
|
35130
|
-
state.currentWs.on("close", () => {
|
|
35131
|
-
});
|
|
35132
|
-
}
|
|
35174
|
+
disposePreviousBridgeSocket(state.currentWs);
|
|
35133
35175
|
state.currentWs = null;
|
|
35134
35176
|
}
|
|
35135
35177
|
if (previewEnvironmentManager) {
|
|
@@ -36323,7 +36365,8 @@ async function createCursorAcpClient(options) {
|
|
|
36323
36365
|
onAcpSessionEstablished,
|
|
36324
36366
|
onAcpConfigOptionsUpdated,
|
|
36325
36367
|
onAgentSubprocessExit,
|
|
36326
|
-
afterSessionEstablished
|
|
36368
|
+
afterSessionEstablished,
|
|
36369
|
+
signal
|
|
36327
36370
|
} = options;
|
|
36328
36371
|
const dbgFs = process.env.BUILDAUTOMATON_DEBUG_ACP_FS === "1";
|
|
36329
36372
|
const spawnEnv = bridgeInstalledAgentAuthProcessEnv(process.env);
|
|
@@ -36348,7 +36391,11 @@ async function createCursorAcpClient(options) {
|
|
|
36348
36391
|
stderrCapture
|
|
36349
36392
|
});
|
|
36350
36393
|
return new Promise((resolve36, reject) => {
|
|
36394
|
+
const stopAbort = listenForAcpClientAbort(child, signal, () => {
|
|
36395
|
+
reject(new Error("ACP client aborted"));
|
|
36396
|
+
});
|
|
36351
36397
|
child.on("error", (err) => {
|
|
36398
|
+
stopAbort();
|
|
36352
36399
|
killChildProcessTree(child, "SIGKILL");
|
|
36353
36400
|
reject(new Error(formatSpawnError(err, command[0])));
|
|
36354
36401
|
});
|
|
@@ -36360,6 +36407,7 @@ async function createCursorAcpClient(options) {
|
|
|
36360
36407
|
skipBrowserAuthenticate,
|
|
36361
36408
|
incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
|
|
36362
36409
|
});
|
|
36410
|
+
stopAbort();
|
|
36363
36411
|
resolve36(
|
|
36364
36412
|
createCursorAcpHandle({
|
|
36365
36413
|
child,
|
|
@@ -36372,6 +36420,7 @@ async function createCursorAcpClient(options) {
|
|
|
36372
36420
|
})
|
|
36373
36421
|
);
|
|
36374
36422
|
} catch (err) {
|
|
36423
|
+
stopAbort();
|
|
36375
36424
|
killChildProcessTree(child, "SIGKILL");
|
|
36376
36425
|
const merged = mergeErrorWithStderr(formatJsonRpcStyleError(err), stderrCapture.getText());
|
|
36377
36426
|
reject(merged ? new Error(merged) : err instanceof Error ? err : new Error(String(err)));
|
|
@@ -36538,7 +36587,7 @@ function getAgentTypeDisplayName(agentType) {
|
|
|
36538
36587
|
import { existsSync as existsSync4, statSync } from "node:fs";
|
|
36539
36588
|
|
|
36540
36589
|
// ../bridge/src/git/git-exec.ts
|
|
36541
|
-
import { execFile as execFile2, execFileSync
|
|
36590
|
+
import { execFile as execFile2, execFileSync, spawn as spawn4 } from "node:child_process";
|
|
36542
36591
|
import { promisify as promisify3 } from "node:util";
|
|
36543
36592
|
|
|
36544
36593
|
// ../bridge/src/git/git-runtime.ts
|
|
@@ -36596,7 +36645,7 @@ init_cli_process_interrupt();
|
|
|
36596
36645
|
var execFileAsync2 = promisify3(execFile2);
|
|
36597
36646
|
var GIT_SYNC_STDIO = ["ignore", "pipe", "pipe"];
|
|
36598
36647
|
function execGitFileSync(args, options) {
|
|
36599
|
-
return
|
|
36648
|
+
return execFileSync("git", args, {
|
|
36600
36649
|
encoding: "utf8",
|
|
36601
36650
|
maxBuffer: 10 * 1024 * 1024,
|
|
36602
36651
|
...options,
|
|
@@ -38984,45 +39033,53 @@ function listCliAgentCapabilityCacheForWorkspace(db, workspaceId) {
|
|
|
38984
39033
|
// ../bridge/src/agents/capabilities/probe-agent-capabilities-for-types.ts
|
|
38985
39034
|
init_cli_database();
|
|
38986
39035
|
|
|
39036
|
+
// ../bridge/src/agents/capabilities/agent-capability-warmup-run.ts
|
|
39037
|
+
init_cli_process_interrupt();
|
|
39038
|
+
var warmupEpoch = 0;
|
|
39039
|
+
var probedTypesThisProcess = /* @__PURE__ */ new Set();
|
|
39040
|
+
function cancelInFlightAgentCapabilityWarmup() {
|
|
39041
|
+
warmupEpoch += 1;
|
|
39042
|
+
}
|
|
39043
|
+
function beginAgentCapabilityWarmupRun() {
|
|
39044
|
+
const epoch = warmupEpoch += 1;
|
|
39045
|
+
return () => epoch === warmupEpoch && !isCliImmediateShutdownRequested();
|
|
39046
|
+
}
|
|
39047
|
+
function wasAgentCapabilityTypeProbedThisProcess(agentType) {
|
|
39048
|
+
return probedTypesThisProcess.has(agentType);
|
|
39049
|
+
}
|
|
39050
|
+
function markAgentCapabilityTypeProbedThisProcess(agentType) {
|
|
39051
|
+
probedTypesThisProcess.add(agentType);
|
|
39052
|
+
}
|
|
39053
|
+
function shouldSkipCapabilityProbeThisProcess(agentType) {
|
|
39054
|
+
if (process.env.BUILDAUTOMATON_FORCE_PROBE_ACP_CAPABILITIES === "1") return false;
|
|
39055
|
+
return wasAgentCapabilityTypeProbedThisProcess(agentType);
|
|
39056
|
+
}
|
|
39057
|
+
|
|
38987
39058
|
// ../bridge/src/agents/capabilities/probe-one-agent-type-for-capabilities.ts
|
|
38988
39059
|
import * as path34 from "node:path";
|
|
38989
39060
|
init_cli_database();
|
|
39061
|
+
init_yield_to_event_loop();
|
|
38990
39062
|
init_cli_process_interrupt();
|
|
39063
|
+
var ACP_CAPABILITY_PROBE_TIMEOUT_MS = 12e3;
|
|
38991
39064
|
async function probeOneAgentTypeForCapabilities(params) {
|
|
38992
39065
|
const { agentType, cwd, workspaceId, log: log2, reportAgentCapabilities, bridgeReport = true, shouldContinue } = params;
|
|
38993
|
-
const canContinue = () => shouldContinue?.() !== false;
|
|
39066
|
+
const canContinue = () => shouldContinue?.() !== false && !isCliImmediateShutdownRequested();
|
|
38994
39067
|
if (!canContinue()) return false;
|
|
38995
39068
|
const resolved = resolveAgentCommand(agentType);
|
|
38996
39069
|
if (!resolved) return false;
|
|
38997
|
-
|
|
38998
|
-
|
|
38999
|
-
|
|
39000
|
-
|
|
39001
|
-
|
|
39002
|
-
|
|
39003
|
-
|
|
39004
|
-
|
|
39005
|
-
|
|
39006
|
-
|
|
39007
|
-
|
|
39008
|
-
agentType,
|
|
39009
|
-
configOptions: co
|
|
39010
|
-
})
|
|
39011
|
-
);
|
|
39012
|
-
} catch {
|
|
39013
|
-
}
|
|
39014
|
-
sqliteChanged ||= changed;
|
|
39015
|
-
if (bridgeReport && changed) {
|
|
39016
|
-
reportAgentCapabilities?.({ agentType, configOptions: co });
|
|
39017
|
-
}
|
|
39018
|
-
};
|
|
39070
|
+
await yieldToEventLoop();
|
|
39071
|
+
if (!canContinue()) return false;
|
|
39072
|
+
markAgentCapabilityTypeProbedThisProcess(agentType);
|
|
39073
|
+
let pendingCo = null;
|
|
39074
|
+
const ac = new AbortController();
|
|
39075
|
+
const abortTimer = setTimeout(() => ac.abort(), ACP_CAPABILITY_PROBE_TIMEOUT_MS);
|
|
39076
|
+
abortTimer.unref?.();
|
|
39077
|
+
const abortIfStale = setInterval(() => {
|
|
39078
|
+
if (!canContinue()) ac.abort();
|
|
39079
|
+
}, 50);
|
|
39080
|
+
abortIfStale.unref?.();
|
|
39019
39081
|
let handle = null;
|
|
39020
|
-
const killTimer = setTimeout(() => {
|
|
39021
|
-
void handle?.disconnectGracefully();
|
|
39022
|
-
}, 28e3);
|
|
39023
|
-
killTimer.unref?.();
|
|
39024
39082
|
try {
|
|
39025
|
-
if (!canContinue()) return false;
|
|
39026
39083
|
handle = await resolved.createClient({
|
|
39027
39084
|
command: resolved.command,
|
|
39028
39085
|
cwd: path34.resolve(cwd),
|
|
@@ -39030,12 +39087,13 @@ async function probeOneAgentTypeForCapabilities(params) {
|
|
|
39030
39087
|
sessionMode: "agent",
|
|
39031
39088
|
persistedAcpSessionId: null,
|
|
39032
39089
|
agentConfig: null,
|
|
39090
|
+
signal: ac.signal,
|
|
39033
39091
|
getActiveConfigOptions: () => null,
|
|
39034
39092
|
onAcpSessionEstablished: (info) => {
|
|
39035
|
-
|
|
39093
|
+
if (Array.isArray(info.configOptions) && info.configOptions.length > 0) pendingCo = info.configOptions;
|
|
39036
39094
|
},
|
|
39037
39095
|
onAcpConfigOptionsUpdated: (co) => {
|
|
39038
|
-
|
|
39096
|
+
if (Array.isArray(co) && co.length > 0) pendingCo = co;
|
|
39039
39097
|
},
|
|
39040
39098
|
onAgentSubprocessExit: () => {
|
|
39041
39099
|
},
|
|
@@ -39048,13 +39106,21 @@ async function probeOneAgentTypeForCapabilities(params) {
|
|
|
39048
39106
|
`[Bridge service] Agent capability probe (${agentType}): ${e instanceof Error ? e.message : String(e)}`
|
|
39049
39107
|
);
|
|
39050
39108
|
} finally {
|
|
39051
|
-
clearTimeout(
|
|
39109
|
+
clearTimeout(abortTimer);
|
|
39110
|
+
clearInterval(abortIfStale);
|
|
39052
39111
|
try {
|
|
39053
39112
|
await handle?.disconnectGracefully();
|
|
39054
39113
|
} catch {
|
|
39055
39114
|
}
|
|
39056
39115
|
}
|
|
39057
|
-
return
|
|
39116
|
+
if (!pendingCo || !canContinue()) return false;
|
|
39117
|
+
const configOptions = pendingCo;
|
|
39118
|
+
await yieldToEventLoop();
|
|
39119
|
+
const changed = await withCliSqlite(
|
|
39120
|
+
(db) => upsertCliAgentCapabilityCache(db, { workspaceId, agentType, configOptions })
|
|
39121
|
+
);
|
|
39122
|
+
if (bridgeReport && changed) reportAgentCapabilities?.({ agentType, configOptions });
|
|
39123
|
+
return changed;
|
|
39058
39124
|
}
|
|
39059
39125
|
|
|
39060
39126
|
// ../bridge/src/agents/capabilities/probe-agent-capabilities-for-types.ts
|
|
@@ -39073,9 +39139,10 @@ async function probeAgentCapabilitiesForDetectedTypes(params) {
|
|
|
39073
39139
|
let changedCount = 0;
|
|
39074
39140
|
for (let i = 0; i < agentTypes.length; i++) {
|
|
39075
39141
|
if (!canContinue()) return changedCount;
|
|
39076
|
-
|
|
39142
|
+
await yieldToEventLoop();
|
|
39077
39143
|
const agentType = agentTypes[i];
|
|
39078
39144
|
if (!agentType.trim()) continue;
|
|
39145
|
+
if (shouldSkipCapabilityProbeThisProcess(agentType)) continue;
|
|
39079
39146
|
if (!forceAllTypes) {
|
|
39080
39147
|
try {
|
|
39081
39148
|
if (process.env.BUILDAUTOMATON_FORCE_PROBE_ACP_CAPABILITIES !== "1" && await withCliSqlite((db) => hasNonEmptyAgentCapabilityCache(db, workspaceId, agentType))) {
|
|
@@ -39101,19 +39168,6 @@ async function probeAgentCapabilitiesForDetectedTypes(params) {
|
|
|
39101
39168
|
// ../bridge/src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
|
|
39102
39169
|
init_yield_to_event_loop();
|
|
39103
39170
|
init_cli_database();
|
|
39104
|
-
|
|
39105
|
-
// ../bridge/src/agents/capabilities/agent-capability-warmup-run.ts
|
|
39106
|
-
init_cli_process_interrupt();
|
|
39107
|
-
var warmupEpoch = 0;
|
|
39108
|
-
function cancelInFlightAgentCapabilityWarmup() {
|
|
39109
|
-
warmupEpoch += 1;
|
|
39110
|
-
}
|
|
39111
|
-
function beginAgentCapabilityWarmupRun() {
|
|
39112
|
-
const epoch = warmupEpoch += 1;
|
|
39113
|
-
return () => epoch === warmupEpoch && !isCliImmediateShutdownRequested();
|
|
39114
|
-
}
|
|
39115
|
-
|
|
39116
|
-
// ../bridge/src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
|
|
39117
39171
|
async function warmupAgentCapabilitiesOnConnect(params) {
|
|
39118
39172
|
const { workspaceId, log: log2, getWs } = params;
|
|
39119
39173
|
const isCurrent = beginAgentCapabilityWarmupRun();
|
|
@@ -39125,8 +39179,7 @@ async function warmupAgentCapabilitiesOnConnect(params) {
|
|
|
39125
39179
|
if (!socket || socket.readyState !== wrapper_default.OPEN) return;
|
|
39126
39180
|
try {
|
|
39127
39181
|
const rows = await withCliSqlite((db) => listCliAgentCapabilityCacheForWorkspace(db, workspaceId));
|
|
39128
|
-
if (!isCurrent()) return;
|
|
39129
|
-
if (rows.length === 0) return;
|
|
39182
|
+
if (!isCurrent() || rows.length === 0) return;
|
|
39130
39183
|
sendWsMessage(socket, {
|
|
39131
39184
|
type: "agent_capabilities_batch",
|
|
39132
39185
|
items: rows.map((r) => ({ agentType: r.agentType, configOptions: r.configOptions }))
|
|
@@ -39140,46 +39193,30 @@ async function warmupAgentCapabilitiesOnConnect(params) {
|
|
|
39140
39193
|
}
|
|
39141
39194
|
await sendBatchFromCache();
|
|
39142
39195
|
if (!isCurrent()) return;
|
|
39143
|
-
let types = [];
|
|
39144
|
-
try {
|
|
39145
|
-
types = [...await detectLocalAgentTypes()];
|
|
39146
|
-
} catch (e) {
|
|
39147
|
-
log2(`[Bridge service] detectLocalAgentTypes failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
39148
|
-
}
|
|
39149
|
-
if (!isCurrent()) return;
|
|
39150
|
-
try {
|
|
39151
|
-
const n = await probeAgentCapabilitiesForDetectedTypes({
|
|
39152
|
-
agentTypes: types,
|
|
39153
|
-
cwd,
|
|
39154
|
-
workspaceId,
|
|
39155
|
-
log: log2,
|
|
39156
|
-
bridgeReport: false,
|
|
39157
|
-
forceAllTypes: false,
|
|
39158
|
-
shouldContinue: isCurrent
|
|
39159
|
-
});
|
|
39160
|
-
if (n > 0) await sendBatchFromCache();
|
|
39161
|
-
} catch (e) {
|
|
39162
|
-
if (e instanceof CliSqliteInterrupted) return;
|
|
39163
|
-
log2(`[Bridge service] Agent capability probe (missing cache) failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
39164
|
-
}
|
|
39165
|
-
if (!isCurrent()) return;
|
|
39166
39196
|
void (async () => {
|
|
39167
39197
|
try {
|
|
39168
39198
|
await yieldToEventLoop();
|
|
39169
39199
|
if (!isCurrent()) return;
|
|
39200
|
+
let types = [];
|
|
39201
|
+
try {
|
|
39202
|
+
types = [...await detectLocalAgentTypes()];
|
|
39203
|
+
} catch (e) {
|
|
39204
|
+
log2(`[Bridge service] detectLocalAgentTypes failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
39205
|
+
}
|
|
39206
|
+
if (!isCurrent()) return;
|
|
39170
39207
|
const n = await probeAgentCapabilitiesForDetectedTypes({
|
|
39171
39208
|
agentTypes: types,
|
|
39172
39209
|
cwd,
|
|
39173
39210
|
workspaceId,
|
|
39174
39211
|
log: log2,
|
|
39175
39212
|
bridgeReport: false,
|
|
39176
|
-
forceAllTypes:
|
|
39213
|
+
forceAllTypes: false,
|
|
39177
39214
|
shouldContinue: isCurrent
|
|
39178
39215
|
});
|
|
39179
39216
|
if (n > 0) await sendBatchFromCache();
|
|
39180
39217
|
} catch (e) {
|
|
39181
39218
|
if (e instanceof CliSqliteInterrupted) return;
|
|
39182
|
-
log2(`[Bridge service] Agent capability
|
|
39219
|
+
log2(`[Bridge service] Agent capability probe failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
39183
39220
|
}
|
|
39184
39221
|
})();
|
|
39185
39222
|
}
|
|
@@ -40591,7 +40628,7 @@ function createBridgeHeartbeatController(params) {
|
|
|
40591
40628
|
}
|
|
40592
40629
|
|
|
40593
40630
|
// ../bridge/src/cli/cli-version.ts
|
|
40594
|
-
var CLI_VERSION = "0.1.
|
|
40631
|
+
var CLI_VERSION = "0.1.94".length > 0 ? "0.1.94" : "0.0.0-dev";
|
|
40595
40632
|
|
|
40596
40633
|
// ../bridge/src/connection/identify/send-bridge-identify.ts
|
|
40597
40634
|
function sendBridgeIdentify(ws, params) {
|
|
@@ -50490,7 +50527,6 @@ var handleBridgeIdentified = (msg, deps) => {
|
|
|
50490
50527
|
});
|
|
50491
50528
|
setImmediate(() => {
|
|
50492
50529
|
void (async () => {
|
|
50493
|
-
cancelInFlightAgentCapabilityWarmup();
|
|
50494
50530
|
try {
|
|
50495
50531
|
await deps.reportAutoDetectedAgents?.();
|
|
50496
50532
|
} catch (e) {
|
|
@@ -50498,13 +50534,11 @@ var handleBridgeIdentified = (msg, deps) => {
|
|
|
50498
50534
|
`[Bridge service] Auto-detect agents failed: ${e instanceof Error ? e.message : String(e)}`
|
|
50499
50535
|
);
|
|
50500
50536
|
}
|
|
50501
|
-
|
|
50502
|
-
await deps.warmupAgentCapabilitiesOnConnect?.();
|
|
50503
|
-
} catch (e) {
|
|
50537
|
+
void deps.warmupAgentCapabilitiesOnConnect?.()?.catch((e) => {
|
|
50504
50538
|
deps.log(
|
|
50505
50539
|
`[Bridge service] Agent capability warmup failed: ${e instanceof Error ? e.message : String(e)}`
|
|
50506
50540
|
);
|
|
50507
|
-
}
|
|
50541
|
+
});
|
|
50508
50542
|
})();
|
|
50509
50543
|
});
|
|
50510
50544
|
};
|
|
@@ -52392,6 +52426,7 @@ function createMainBridgeCloseHandler(params, connect) {
|
|
|
52392
52426
|
const { state, logFn, bridgeHeartbeat } = params;
|
|
52393
52427
|
return (code, reason, closedWs) => {
|
|
52394
52428
|
if (state.currentWs !== closedWs) return;
|
|
52429
|
+
cancelInFlightAgentCapabilityWarmup();
|
|
52395
52430
|
bridgeHeartbeat?.stop();
|
|
52396
52431
|
try {
|
|
52397
52432
|
state.currentWs = null;
|
|
@@ -52519,20 +52554,8 @@ function createMainBridgeWebSocketLifecycle(params) {
|
|
|
52519
52554
|
}
|
|
52520
52555
|
}
|
|
52521
52556
|
bridgeHeartbeat?.stop();
|
|
52522
|
-
|
|
52523
|
-
|
|
52524
|
-
prev.removeAllListeners();
|
|
52525
|
-
prev.once("error", () => {
|
|
52526
|
-
});
|
|
52527
|
-
prev.once("close", () => {
|
|
52528
|
-
prev.removeAllListeners();
|
|
52529
|
-
});
|
|
52530
|
-
try {
|
|
52531
|
-
prev.close();
|
|
52532
|
-
} catch {
|
|
52533
|
-
}
|
|
52534
|
-
state.currentWs = null;
|
|
52535
|
-
}
|
|
52557
|
+
disposePreviousBridgeSocket(state.currentWs);
|
|
52558
|
+
state.currentWs = null;
|
|
52536
52559
|
try {
|
|
52537
52560
|
const url2 = plugin.transport.resolveControlPlaneUrl({
|
|
52538
52561
|
workspaceId,
|
|
@@ -53029,7 +53052,7 @@ async function defaultBrowserId() {
|
|
|
53029
53052
|
// ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
53030
53053
|
import process6 from "node:process";
|
|
53031
53054
|
import { promisify as promisify5 } from "node:util";
|
|
53032
|
-
import { execFile as execFile4, execFileSync as
|
|
53055
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
53033
53056
|
var execFileAsync4 = promisify5(execFile4);
|
|
53034
53057
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
53035
53058
|
if (process6.platform !== "darwin") {
|
|
@@ -53516,7 +53539,7 @@ function createPendingAuthOnMessage(params) {
|
|
|
53516
53539
|
}
|
|
53517
53540
|
|
|
53518
53541
|
// src/cli-version.ts
|
|
53519
|
-
var CLI_VERSION2 = "0.1.
|
|
53542
|
+
var CLI_VERSION2 = "0.1.94".length > 0 ? "0.1.94" : "0.0.0-dev";
|
|
53520
53543
|
|
|
53521
53544
|
// src/auth/pending/pending-auth-on-open.ts
|
|
53522
53545
|
function createPendingAuthOnOpen(params) {
|