@buildautomaton/cli 0.1.70 → 0.1.72
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 +158 -50
- package/dist/cli.js.map +4 -4
- package/dist/index.js +158 -50
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22367,14 +22367,14 @@ var init_access = __esm({
|
|
|
22367
22367
|
|
|
22368
22368
|
// src/sqlite/read-migration-sql.ts
|
|
22369
22369
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
22370
|
-
import { dirname as dirname2, join } from "node:path";
|
|
22370
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
22371
22371
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
22372
22372
|
function readMigrationSql(filename, ...searchSubdirs) {
|
|
22373
22373
|
const moduleDir = dirname2(fileURLToPath2(import.meta.url));
|
|
22374
22374
|
const candidates = searchSubdirs.flatMap((sub) => [
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22375
|
+
join2(moduleDir, sub, filename),
|
|
22376
|
+
join2(moduleDir, "..", sub, filename),
|
|
22377
|
+
join2(moduleDir, "..", "..", "dist", sub, filename)
|
|
22378
22378
|
]);
|
|
22379
22379
|
const resolved = candidates.find((path82) => existsSync(path82));
|
|
22380
22380
|
if (!resolved) {
|
|
@@ -25255,26 +25255,26 @@ var init_member_access = __esm({
|
|
|
25255
25255
|
|
|
25256
25256
|
// src/code-nav/tree-sitter-assets-dir.ts
|
|
25257
25257
|
import { existsSync as existsSync2 } from "node:fs";
|
|
25258
|
-
import { dirname as dirname3, join as
|
|
25258
|
+
import { dirname as dirname3, join as join3 } from "node:path";
|
|
25259
25259
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
25260
25260
|
function repoNodeModulesDir(fromDir) {
|
|
25261
|
-
return
|
|
25261
|
+
return join3(fromDir, "..", "..", "..", "node_modules");
|
|
25262
25262
|
}
|
|
25263
25263
|
function firstDirWithWebTreeSitterWasm(candidates) {
|
|
25264
25264
|
for (const dir of candidates) {
|
|
25265
|
-
if (existsSync2(
|
|
25265
|
+
if (existsSync2(join3(dir, "web-tree-sitter.wasm"))) return dir;
|
|
25266
25266
|
}
|
|
25267
25267
|
return null;
|
|
25268
25268
|
}
|
|
25269
25269
|
function getTreeSitterAssetsDir() {
|
|
25270
25270
|
const moduleDir = dirname3(fileURLToPath3(import.meta.url));
|
|
25271
25271
|
const fromModule = firstDirWithWebTreeSitterWasm([
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25272
|
+
join3(moduleDir, "tree-sitter"),
|
|
25273
|
+
join3(moduleDir, "..", "tree-sitter"),
|
|
25274
|
+
join3(moduleDir, "..", "..", "dist", "tree-sitter")
|
|
25275
25275
|
]);
|
|
25276
25276
|
if (fromModule) return fromModule;
|
|
25277
|
-
const fromNodeModules = firstDirWithWebTreeSitterWasm([
|
|
25277
|
+
const fromNodeModules = firstDirWithWebTreeSitterWasm([join3(repoNodeModulesDir(moduleDir), "web-tree-sitter")]);
|
|
25278
25278
|
if (fromNodeModules) return fromNodeModules;
|
|
25279
25279
|
throw new Error(
|
|
25280
25280
|
"Missing web-tree-sitter.wasm. Run `pnpm build` in packages/cli to copy tree-sitter assets into dist/tree-sitter."
|
|
@@ -25288,7 +25288,7 @@ var init_tree_sitter_assets_dir = __esm({
|
|
|
25288
25288
|
|
|
25289
25289
|
// src/code-nav/parser/tree-sitter-runtime.ts
|
|
25290
25290
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
25291
|
-
import { dirname as dirname4, join as
|
|
25291
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
25292
25292
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
25293
25293
|
import { Parser, Language, Query, LANGUAGE_VERSION, MIN_COMPATIBLE_VERSION } from "web-tree-sitter";
|
|
25294
25294
|
function withTreeSitterRuntimeLock(fn) {
|
|
@@ -25303,7 +25303,7 @@ async function ensureParserInit() {
|
|
|
25303
25303
|
if (!initPromise2) {
|
|
25304
25304
|
const assetsDir = getTreeSitterAssetsDir();
|
|
25305
25305
|
initPromise2 = Parser.init({
|
|
25306
|
-
locateFile: (scriptName) =>
|
|
25306
|
+
locateFile: (scriptName) => join4(assetsDir, scriptName)
|
|
25307
25307
|
}).catch((e) => {
|
|
25308
25308
|
initPromise2 = null;
|
|
25309
25309
|
throw e;
|
|
@@ -25313,9 +25313,9 @@ async function ensureParserInit() {
|
|
|
25313
25313
|
}
|
|
25314
25314
|
function resolveWasmPath(assetsDir, wasmFile) {
|
|
25315
25315
|
const candidates = [
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25316
|
+
join4(assetsDir, wasmFile),
|
|
25317
|
+
join4(assetsDir, "..", "..", "dist", "tree-sitter", wasmFile),
|
|
25318
|
+
join4(assetsDir, "..", "..", "..", "node_modules", wasmFile.replace(".wasm", ""), wasmFile)
|
|
25319
25319
|
];
|
|
25320
25320
|
const hit = candidates.find((p) => existsSync3(p));
|
|
25321
25321
|
if (!hit) throw new Error(`Missing tree-sitter wasm: ${wasmFile}`);
|
|
@@ -25324,10 +25324,10 @@ function resolveWasmPath(assetsDir, wasmFile) {
|
|
|
25324
25324
|
function resolveTagsPath(assetsDir, tagsQueryFile) {
|
|
25325
25325
|
const pkgName = tagsQueryFile.split("/")[0] ?? "";
|
|
25326
25326
|
const candidates = [
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25327
|
+
join4(CODE_NAV_QUERIES_ROOT, tagsQueryFile),
|
|
25328
|
+
join4(assetsDir, tagsQueryFile),
|
|
25329
|
+
join4(assetsDir, "..", "..", "dist", "tree-sitter", tagsQueryFile),
|
|
25330
|
+
join4(assetsDir, "..", "..", "..", "node_modules", pkgName, "queries", "tags.scm")
|
|
25331
25331
|
];
|
|
25332
25332
|
const hit = candidates.find((p) => existsSync3(p));
|
|
25333
25333
|
if (!hit) throw new Error(`Missing tags query: ${tagsQueryFile}`);
|
|
@@ -25365,7 +25365,7 @@ var init_tree_sitter_runtime = __esm({
|
|
|
25365
25365
|
loadedByKey = /* @__PURE__ */ new Map();
|
|
25366
25366
|
failedLanguageKeys = /* @__PURE__ */ new Set();
|
|
25367
25367
|
runtimeChain = Promise.resolve();
|
|
25368
|
-
CODE_NAV_QUERIES_ROOT =
|
|
25368
|
+
CODE_NAV_QUERIES_ROOT = join4(dirname4(fileURLToPath4(import.meta.url)), "..", "queries");
|
|
25369
25369
|
}
|
|
25370
25370
|
});
|
|
25371
25371
|
|
|
@@ -26936,7 +26936,7 @@ var init_in_process_bridge = __esm({
|
|
|
26936
26936
|
});
|
|
26937
26937
|
|
|
26938
26938
|
// src/code-nav/symbol-index/worker/lifecycle/state.ts
|
|
26939
|
-
import { dirname as dirname5, join as
|
|
26939
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
26940
26940
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
26941
26941
|
function getWorker() {
|
|
26942
26942
|
return worker;
|
|
@@ -26955,7 +26955,7 @@ function shouldUseInProcessWorker() {
|
|
|
26955
26955
|
}
|
|
26956
26956
|
function resolveWorkerScriptPath() {
|
|
26957
26957
|
const moduleDir = dirname5(fileURLToPath5(import.meta.url));
|
|
26958
|
-
return
|
|
26958
|
+
return join5(moduleDir, "..", "worker.js");
|
|
26959
26959
|
}
|
|
26960
26960
|
function resetLifecycleStateForTests() {
|
|
26961
26961
|
terminatePromise = null;
|
|
@@ -30586,7 +30586,7 @@ function installBridgeProcessResilience() {
|
|
|
30586
30586
|
}
|
|
30587
30587
|
|
|
30588
30588
|
// src/cli-version.ts
|
|
30589
|
-
var CLI_VERSION = "0.1.
|
|
30589
|
+
var CLI_VERSION = "0.1.72".length > 0 ? "0.1.72" : "0.0.0-dev";
|
|
30590
30590
|
|
|
30591
30591
|
// src/connection/heartbeat/constants.ts
|
|
30592
30592
|
var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
@@ -31708,6 +31708,46 @@ function runPendingAuth(options) {
|
|
|
31708
31708
|
// src/run-bridge-connected.ts
|
|
31709
31709
|
init_log();
|
|
31710
31710
|
|
|
31711
|
+
// src/agents/acp/clients/bridge-agent-path.ts
|
|
31712
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
31713
|
+
import { homedir } from "node:os";
|
|
31714
|
+
import { join } from "node:path";
|
|
31715
|
+
function getBridgeAgentPathEntries(home = process.env.HOME ?? homedir()) {
|
|
31716
|
+
const entries = [
|
|
31717
|
+
join(home, ".local", "bin"),
|
|
31718
|
+
join(home, ".npm-global", "bin"),
|
|
31719
|
+
"/usr/local/bin"
|
|
31720
|
+
];
|
|
31721
|
+
const prefix = process.env.NPM_CONFIG_PREFIX;
|
|
31722
|
+
if (prefix) entries.push(join(prefix, "bin"));
|
|
31723
|
+
try {
|
|
31724
|
+
const npmBin = execFileSync2("npm", ["bin", "-g"], { encoding: "utf8", timeout: 2e3 }).trim();
|
|
31725
|
+
if (npmBin) entries.push(npmBin);
|
|
31726
|
+
} catch {
|
|
31727
|
+
}
|
|
31728
|
+
return entries;
|
|
31729
|
+
}
|
|
31730
|
+
function augmentPath(pathValue, extra) {
|
|
31731
|
+
const current = pathValue ?? "";
|
|
31732
|
+
const parts = current.split(":").filter(Boolean);
|
|
31733
|
+
const seen = new Set(parts);
|
|
31734
|
+
const prefix = [];
|
|
31735
|
+
for (const entry of extra) {
|
|
31736
|
+
if (!entry || seen.has(entry)) continue;
|
|
31737
|
+
seen.add(entry);
|
|
31738
|
+
prefix.push(entry);
|
|
31739
|
+
}
|
|
31740
|
+
if (prefix.length === 0) return current;
|
|
31741
|
+
return current ? `${prefix.join(":")}:${current}` : prefix.join(":");
|
|
31742
|
+
}
|
|
31743
|
+
function ensureBridgeAgentPathInProcessEnv() {
|
|
31744
|
+
const extra = getBridgeAgentPathEntries();
|
|
31745
|
+
process.env.PATH = augmentPath(process.env.PATH, extra);
|
|
31746
|
+
}
|
|
31747
|
+
function bridgeAgentPathEnv(base = process.env) {
|
|
31748
|
+
return { ...base, PATH: augmentPath(base.PATH, getBridgeAgentPathEntries()) };
|
|
31749
|
+
}
|
|
31750
|
+
|
|
31711
31751
|
// src/files/watch-file-index.ts
|
|
31712
31752
|
import path25 from "node:path";
|
|
31713
31753
|
|
|
@@ -32992,7 +33032,11 @@ __export(claude_code_acp_client_exports, {
|
|
|
32992
33032
|
|
|
32993
33033
|
// src/agents/acp/clients/detect-command-on-path.ts
|
|
32994
33034
|
init_cli_process_interrupt();
|
|
33035
|
+
import { constants } from "node:fs";
|
|
33036
|
+
import { access } from "node:fs/promises";
|
|
32995
33037
|
import { execFile as execFile6 } from "node:child_process";
|
|
33038
|
+
import { homedir as homedir2 } from "node:os";
|
|
33039
|
+
import { join as join6 } from "node:path";
|
|
32996
33040
|
import { promisify as promisify7 } from "node:util";
|
|
32997
33041
|
var execFileAsync5 = promisify7(execFile6);
|
|
32998
33042
|
var COMMAND_ON_PATH_PROBE_TIMEOUT_MS = 750;
|
|
@@ -33009,15 +33053,43 @@ async function execFileShutdownAware(file2, args, timeoutMs) {
|
|
|
33009
33053
|
clearInterval(shutdownPoll);
|
|
33010
33054
|
}
|
|
33011
33055
|
}
|
|
33056
|
+
async function isExecutableFile(filePath) {
|
|
33057
|
+
try {
|
|
33058
|
+
await access(filePath, constants.X_OK);
|
|
33059
|
+
return true;
|
|
33060
|
+
} catch {
|
|
33061
|
+
return false;
|
|
33062
|
+
}
|
|
33063
|
+
}
|
|
33064
|
+
async function isCommandInBridgeAgentDirs(command) {
|
|
33065
|
+
const home = process.env.HOME ?? homedir2();
|
|
33066
|
+
for (const dir of getBridgeAgentPathEntries(home)) {
|
|
33067
|
+
if (await isExecutableFile(join6(dir, command))) return true;
|
|
33068
|
+
}
|
|
33069
|
+
return false;
|
|
33070
|
+
}
|
|
33012
33071
|
async function isCommandOnPath(command, timeoutMs = COMMAND_ON_PATH_PROBE_TIMEOUT_MS) {
|
|
33013
33072
|
if (isCliImmediateShutdownRequested()) return false;
|
|
33014
33073
|
try {
|
|
33015
|
-
await
|
|
33074
|
+
await execFileAsync5("which", [command], {
|
|
33075
|
+
timeout: timeoutMs,
|
|
33076
|
+
env: bridgeAgentPathEnv()
|
|
33077
|
+
});
|
|
33016
33078
|
return true;
|
|
33017
33079
|
} catch {
|
|
33018
|
-
return
|
|
33080
|
+
return isCommandInBridgeAgentDirs(command);
|
|
33019
33081
|
}
|
|
33020
33082
|
}
|
|
33083
|
+
async function waitForCommandOnPath(command, opts = {}) {
|
|
33084
|
+
const maxAttempts = opts.maxAttempts ?? 8;
|
|
33085
|
+
const delayMs = opts.delayMs ?? 400;
|
|
33086
|
+
const timeoutMs = opts.timeoutMs ?? COMMAND_ON_PATH_PROBE_TIMEOUT_MS;
|
|
33087
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
33088
|
+
if (await isCommandOnPath(command, timeoutMs)) return true;
|
|
33089
|
+
if (attempt < maxAttempts - 1) await new Promise((r) => setTimeout(r, delayMs));
|
|
33090
|
+
}
|
|
33091
|
+
return false;
|
|
33092
|
+
}
|
|
33021
33093
|
async function execProbeShutdownAware(file2, args, timeoutMs) {
|
|
33022
33094
|
if (isCliImmediateShutdownRequested()) return false;
|
|
33023
33095
|
try {
|
|
@@ -33704,15 +33776,15 @@ function resolveAgentCommand(preferredAgentType) {
|
|
|
33704
33776
|
}
|
|
33705
33777
|
|
|
33706
33778
|
// src/agents/acp/session-file-change-path-kind.ts
|
|
33707
|
-
import { execFileSync as
|
|
33779
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
33708
33780
|
import { existsSync as existsSync4, statSync } from "node:fs";
|
|
33709
33781
|
|
|
33710
33782
|
// src/git/get-git-repo-root-sync.ts
|
|
33711
|
-
import { execFileSync as
|
|
33783
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
33712
33784
|
import * as path27 from "node:path";
|
|
33713
33785
|
function getGitRepoRootSync(startDir) {
|
|
33714
33786
|
try {
|
|
33715
|
-
const out =
|
|
33787
|
+
const out = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
33716
33788
|
cwd: path27.resolve(startDir),
|
|
33717
33789
|
encoding: "utf8",
|
|
33718
33790
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -33725,7 +33797,7 @@ function getGitRepoRootSync(startDir) {
|
|
|
33725
33797
|
}
|
|
33726
33798
|
|
|
33727
33799
|
// src/agents/acp/workspace-files.ts
|
|
33728
|
-
import { execFileSync as
|
|
33800
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
33729
33801
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
33730
33802
|
import * as path28 from "node:path";
|
|
33731
33803
|
function resolveWorkspaceFilePath(sessionParentPath, rawPath) {
|
|
@@ -33786,7 +33858,7 @@ function readGitHeadBlob(sessionParentPath, displayPath) {
|
|
|
33786
33858
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
33787
33859
|
const execCwd = gitRoot ?? sessionParentPath;
|
|
33788
33860
|
try {
|
|
33789
|
-
return
|
|
33861
|
+
return execFileSync4("git", ["show", `HEAD:${displayPath}`], {
|
|
33790
33862
|
cwd: execCwd,
|
|
33791
33863
|
encoding: "utf8",
|
|
33792
33864
|
maxBuffer: 50 * 1024 * 1024
|
|
@@ -33802,7 +33874,7 @@ function gitHeadPathObjectType(sessionParentPath, displayPath) {
|
|
|
33802
33874
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
33803
33875
|
if (!gitRoot) return null;
|
|
33804
33876
|
try {
|
|
33805
|
-
return
|
|
33877
|
+
return execFileSync5("git", ["cat-file", "-t", `HEAD:${displayPath}`], {
|
|
33806
33878
|
cwd: gitRoot,
|
|
33807
33879
|
encoding: "utf8"
|
|
33808
33880
|
}).trim();
|
|
@@ -34657,11 +34729,11 @@ init_cli_process_interrupt();
|
|
|
34657
34729
|
var BRIDGE_MCP_SERVER_NAME2 = "buildautomaton-bridge";
|
|
34658
34730
|
|
|
34659
34731
|
// src/mcp/resolve-bridge-mcp-server-path.ts
|
|
34660
|
-
import { dirname as dirname7, join as
|
|
34732
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
34661
34733
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
34662
34734
|
function resolveBridgeMcpServerScriptPath() {
|
|
34663
34735
|
const cliDir = dirname7(fileURLToPath7(import.meta.url));
|
|
34664
|
-
return
|
|
34736
|
+
return join7(cliDir, "bridge-mcp-server.js");
|
|
34665
34737
|
}
|
|
34666
34738
|
|
|
34667
34739
|
// src/mcp/build-acp-mcp-servers.ts
|
|
@@ -49681,9 +49753,22 @@ var handleInstallSkillsMessage = (msg, deps) => {
|
|
|
49681
49753
|
// src/agents/install/commands/run-npm-global-install.ts
|
|
49682
49754
|
import { execFile as execFile9 } from "node:child_process";
|
|
49683
49755
|
import { promisify as promisify10 } from "node:util";
|
|
49756
|
+
|
|
49757
|
+
// src/agents/install/format-command-output.ts
|
|
49758
|
+
function formatCommandOutput(stdout, stderr) {
|
|
49759
|
+
const parts = [String(stdout ?? "").trimEnd(), String(stderr ?? "").trimEnd()].filter(Boolean);
|
|
49760
|
+
return parts.join("\n");
|
|
49761
|
+
}
|
|
49762
|
+
|
|
49763
|
+
// src/agents/install/commands/run-npm-global-install.ts
|
|
49684
49764
|
var execFileAsync8 = promisify10(execFile9);
|
|
49685
49765
|
async function runNpmGlobalInstall(packageName, env, timeoutMs = 3e5) {
|
|
49686
|
-
await execFileAsync8("npm", ["install", "-g", packageName], {
|
|
49766
|
+
const { stdout, stderr } = await execFileAsync8("npm", ["install", "-g", packageName], {
|
|
49767
|
+
timeout: timeoutMs,
|
|
49768
|
+
env: bridgeAgentPathEnv(env),
|
|
49769
|
+
maxBuffer: 10 * 1024 * 1024
|
|
49770
|
+
});
|
|
49771
|
+
return formatCommandOutput(stdout, stderr);
|
|
49687
49772
|
}
|
|
49688
49773
|
|
|
49689
49774
|
// src/agents/install/commands/claude-code.ts
|
|
@@ -49691,11 +49776,11 @@ var claudeCodeInstallCommand = {
|
|
|
49691
49776
|
agentType: "claude-code",
|
|
49692
49777
|
detectCommand: "claude",
|
|
49693
49778
|
async install(ctx) {
|
|
49694
|
-
|
|
49695
|
-
await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
49779
|
+
const logOutput = await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
49696
49780
|
...ctx.env,
|
|
49697
49781
|
ANTHROPIC_API_KEY: ctx.authToken
|
|
49698
49782
|
});
|
|
49783
|
+
ctx.onProgress?.("Installing Anthropic Claude Code", logOutput || void 0);
|
|
49699
49784
|
}
|
|
49700
49785
|
};
|
|
49701
49786
|
|
|
@@ -49704,11 +49789,11 @@ var codexAcpInstallCommand = {
|
|
|
49704
49789
|
agentType: "codex-acp",
|
|
49705
49790
|
detectCommand: "codex",
|
|
49706
49791
|
async install(ctx) {
|
|
49707
|
-
|
|
49708
|
-
await runNpmGlobalInstall("@openai/codex", {
|
|
49792
|
+
const logOutput = await runNpmGlobalInstall("@openai/codex", {
|
|
49709
49793
|
...ctx.env,
|
|
49710
49794
|
OPENAI_API_KEY: ctx.authToken
|
|
49711
49795
|
});
|
|
49796
|
+
ctx.onProgress?.("Installing Codex", logOutput || void 0);
|
|
49712
49797
|
}
|
|
49713
49798
|
};
|
|
49714
49799
|
|
|
@@ -49719,12 +49804,19 @@ var execFileAsync9 = promisify11(execFile10);
|
|
|
49719
49804
|
var cursorCliInstallCommand = {
|
|
49720
49805
|
agentType: "cursor-cli",
|
|
49721
49806
|
detectCommand: "agent",
|
|
49807
|
+
alternateDetectCommands: ["cursor-agent"],
|
|
49722
49808
|
async install(ctx) {
|
|
49723
|
-
|
|
49724
|
-
|
|
49725
|
-
|
|
49726
|
-
|
|
49727
|
-
|
|
49809
|
+
const { stdout, stderr } = await execFileAsync9(
|
|
49810
|
+
"bash",
|
|
49811
|
+
["-lc", "curl -fsSL https://cursor.com/install | bash"],
|
|
49812
|
+
{
|
|
49813
|
+
timeout: 3e5,
|
|
49814
|
+
env: { ...bridgeAgentPathEnv(ctx.env), CURSOR_API_KEY: ctx.authToken },
|
|
49815
|
+
maxBuffer: 10 * 1024 * 1024
|
|
49816
|
+
}
|
|
49817
|
+
);
|
|
49818
|
+
const logOutput = formatCommandOutput(stdout, stderr);
|
|
49819
|
+
ctx.onProgress?.("Installing Cursor CLI", logOutput || void 0);
|
|
49728
49820
|
}
|
|
49729
49821
|
};
|
|
49730
49822
|
|
|
@@ -49733,11 +49825,11 @@ var opencodeInstallCommand = {
|
|
|
49733
49825
|
agentType: "opencode",
|
|
49734
49826
|
detectCommand: "opencode",
|
|
49735
49827
|
async install(ctx) {
|
|
49736
|
-
|
|
49737
|
-
await runNpmGlobalInstall("opencode-ai", {
|
|
49828
|
+
const logOutput = await runNpmGlobalInstall("opencode-ai", {
|
|
49738
49829
|
...ctx.env,
|
|
49739
49830
|
OPENCODE_API_KEY: ctx.authToken
|
|
49740
49831
|
});
|
|
49832
|
+
ctx.onProgress?.("Installing OpenCode", logOutput || void 0);
|
|
49741
49833
|
}
|
|
49742
49834
|
};
|
|
49743
49835
|
|
|
@@ -49770,7 +49862,18 @@ async function installLocalAgentOnBridge(params) {
|
|
|
49770
49862
|
const msg = e instanceof Error ? e.message : String(e);
|
|
49771
49863
|
return { success: false, error: msg };
|
|
49772
49864
|
}
|
|
49773
|
-
|
|
49865
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
49866
|
+
const detectNames = [
|
|
49867
|
+
command.detectCommand,
|
|
49868
|
+
...command.alternateDetectCommands ?? []
|
|
49869
|
+
];
|
|
49870
|
+
let found = false;
|
|
49871
|
+
for (const name of detectNames) {
|
|
49872
|
+
if (await waitForCommandOnPath(name)) {
|
|
49873
|
+
found = true;
|
|
49874
|
+
break;
|
|
49875
|
+
}
|
|
49876
|
+
}
|
|
49774
49877
|
if (!found) {
|
|
49775
49878
|
return { success: false, error: `${command.detectCommand} not found on PATH after install` };
|
|
49776
49879
|
}
|
|
@@ -49787,7 +49890,7 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49787
49890
|
if (!processId || !agentId || !tokenId || !agentType || !authToken) return;
|
|
49788
49891
|
void (async () => {
|
|
49789
49892
|
const socket = deps.getWs();
|
|
49790
|
-
const report = (step, message) => {
|
|
49893
|
+
const report = (step, message, logOutput) => {
|
|
49791
49894
|
if (socket) {
|
|
49792
49895
|
sendWsMessage(socket, {
|
|
49793
49896
|
type: "install_agent_progress",
|
|
@@ -49796,14 +49899,15 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49796
49899
|
tokenId,
|
|
49797
49900
|
agentType,
|
|
49798
49901
|
step,
|
|
49799
|
-
message
|
|
49902
|
+
message,
|
|
49903
|
+
...logOutput ? { logOutput } : {}
|
|
49800
49904
|
});
|
|
49801
49905
|
}
|
|
49802
49906
|
};
|
|
49803
49907
|
const result = await installLocalAgentOnBridge({
|
|
49804
49908
|
agentType,
|
|
49805
49909
|
authToken,
|
|
49806
|
-
onProgress: (message) => report("agent_install_package", message)
|
|
49910
|
+
onProgress: (message, logOutput) => report("agent_install_package", message, logOutput)
|
|
49807
49911
|
});
|
|
49808
49912
|
if (socket) {
|
|
49809
49913
|
sendWsMessage(socket, {
|
|
@@ -49816,6 +49920,9 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49816
49920
|
error: result.error
|
|
49817
49921
|
});
|
|
49818
49922
|
}
|
|
49923
|
+
if (result.success) {
|
|
49924
|
+
await deps.reportAutoDetectedAgents?.();
|
|
49925
|
+
}
|
|
49819
49926
|
if (!result.success) {
|
|
49820
49927
|
deps.log(`[Bridge service] Install agent failed: ${result.error ?? "unknown"}`);
|
|
49821
49928
|
}
|
|
@@ -50501,6 +50608,7 @@ init_log();
|
|
|
50501
50608
|
async function createBridgeConnection(options) {
|
|
50502
50609
|
const { apiUrl, workspaceId, justAuthenticated, onAuthInvalid, persistTokens } = options;
|
|
50503
50610
|
const logFn = options.log ?? log;
|
|
50611
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
50504
50612
|
await ensureBridgeConnectionDatabases(logFn);
|
|
50505
50613
|
const { state, getWs } = createMainBridgeReconnectState();
|
|
50506
50614
|
const runtime = await createBridgeConnectionRuntime(options, { state, getWs, logFn });
|