@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/cli.js
CHANGED
|
@@ -7720,14 +7720,14 @@ var init_access = __esm({
|
|
|
7720
7720
|
|
|
7721
7721
|
// src/sqlite/read-migration-sql.ts
|
|
7722
7722
|
import { existsSync, readFileSync } from "node:fs";
|
|
7723
|
-
import { dirname, join as
|
|
7723
|
+
import { dirname, join as join3 } from "node:path";
|
|
7724
7724
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7725
7725
|
function readMigrationSql(filename, ...searchSubdirs) {
|
|
7726
7726
|
const moduleDir = dirname(fileURLToPath2(import.meta.url));
|
|
7727
7727
|
const candidates = searchSubdirs.flatMap((sub) => [
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7728
|
+
join3(moduleDir, sub, filename),
|
|
7729
|
+
join3(moduleDir, "..", sub, filename),
|
|
7730
|
+
join3(moduleDir, "..", "..", "dist", sub, filename)
|
|
7731
7731
|
]);
|
|
7732
7732
|
const resolved = candidates.find((path84) => existsSync(path84));
|
|
7733
7733
|
if (!resolved) {
|
|
@@ -10608,26 +10608,26 @@ var init_member_access = __esm({
|
|
|
10608
10608
|
|
|
10609
10609
|
// src/code-nav/tree-sitter-assets-dir.ts
|
|
10610
10610
|
import { existsSync as existsSync2 } from "node:fs";
|
|
10611
|
-
import { dirname as dirname2, join as
|
|
10611
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
10612
10612
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
10613
10613
|
function repoNodeModulesDir(fromDir) {
|
|
10614
|
-
return
|
|
10614
|
+
return join4(fromDir, "..", "..", "..", "node_modules");
|
|
10615
10615
|
}
|
|
10616
10616
|
function firstDirWithWebTreeSitterWasm(candidates) {
|
|
10617
10617
|
for (const dir of candidates) {
|
|
10618
|
-
if (existsSync2(
|
|
10618
|
+
if (existsSync2(join4(dir, "web-tree-sitter.wasm"))) return dir;
|
|
10619
10619
|
}
|
|
10620
10620
|
return null;
|
|
10621
10621
|
}
|
|
10622
10622
|
function getTreeSitterAssetsDir() {
|
|
10623
10623
|
const moduleDir = dirname2(fileURLToPath3(import.meta.url));
|
|
10624
10624
|
const fromModule = firstDirWithWebTreeSitterWasm([
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10625
|
+
join4(moduleDir, "tree-sitter"),
|
|
10626
|
+
join4(moduleDir, "..", "tree-sitter"),
|
|
10627
|
+
join4(moduleDir, "..", "..", "dist", "tree-sitter")
|
|
10628
10628
|
]);
|
|
10629
10629
|
if (fromModule) return fromModule;
|
|
10630
|
-
const fromNodeModules = firstDirWithWebTreeSitterWasm([
|
|
10630
|
+
const fromNodeModules = firstDirWithWebTreeSitterWasm([join4(repoNodeModulesDir(moduleDir), "web-tree-sitter")]);
|
|
10631
10631
|
if (fromNodeModules) return fromNodeModules;
|
|
10632
10632
|
throw new Error(
|
|
10633
10633
|
"Missing web-tree-sitter.wasm. Run `pnpm build` in packages/cli to copy tree-sitter assets into dist/tree-sitter."
|
|
@@ -10641,7 +10641,7 @@ var init_tree_sitter_assets_dir = __esm({
|
|
|
10641
10641
|
|
|
10642
10642
|
// src/code-nav/parser/tree-sitter-runtime.ts
|
|
10643
10643
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
10644
|
-
import { dirname as dirname3, join as
|
|
10644
|
+
import { dirname as dirname3, join as join5 } from "node:path";
|
|
10645
10645
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
10646
10646
|
import { Parser, Language, Query, LANGUAGE_VERSION, MIN_COMPATIBLE_VERSION } from "web-tree-sitter";
|
|
10647
10647
|
function withTreeSitterRuntimeLock(fn) {
|
|
@@ -10656,7 +10656,7 @@ async function ensureParserInit() {
|
|
|
10656
10656
|
if (!initPromise2) {
|
|
10657
10657
|
const assetsDir = getTreeSitterAssetsDir();
|
|
10658
10658
|
initPromise2 = Parser.init({
|
|
10659
|
-
locateFile: (scriptName) =>
|
|
10659
|
+
locateFile: (scriptName) => join5(assetsDir, scriptName)
|
|
10660
10660
|
}).catch((e) => {
|
|
10661
10661
|
initPromise2 = null;
|
|
10662
10662
|
throw e;
|
|
@@ -10666,9 +10666,9 @@ async function ensureParserInit() {
|
|
|
10666
10666
|
}
|
|
10667
10667
|
function resolveWasmPath(assetsDir, wasmFile) {
|
|
10668
10668
|
const candidates = [
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10669
|
+
join5(assetsDir, wasmFile),
|
|
10670
|
+
join5(assetsDir, "..", "..", "dist", "tree-sitter", wasmFile),
|
|
10671
|
+
join5(assetsDir, "..", "..", "..", "node_modules", wasmFile.replace(".wasm", ""), wasmFile)
|
|
10672
10672
|
];
|
|
10673
10673
|
const hit = candidates.find((p) => existsSync3(p));
|
|
10674
10674
|
if (!hit) throw new Error(`Missing tree-sitter wasm: ${wasmFile}`);
|
|
@@ -10677,10 +10677,10 @@ function resolveWasmPath(assetsDir, wasmFile) {
|
|
|
10677
10677
|
function resolveTagsPath(assetsDir, tagsQueryFile) {
|
|
10678
10678
|
const pkgName = tagsQueryFile.split("/")[0] ?? "";
|
|
10679
10679
|
const candidates = [
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10680
|
+
join5(CODE_NAV_QUERIES_ROOT, tagsQueryFile),
|
|
10681
|
+
join5(assetsDir, tagsQueryFile),
|
|
10682
|
+
join5(assetsDir, "..", "..", "dist", "tree-sitter", tagsQueryFile),
|
|
10683
|
+
join5(assetsDir, "..", "..", "..", "node_modules", pkgName, "queries", "tags.scm")
|
|
10684
10684
|
];
|
|
10685
10685
|
const hit = candidates.find((p) => existsSync3(p));
|
|
10686
10686
|
if (!hit) throw new Error(`Missing tags query: ${tagsQueryFile}`);
|
|
@@ -10718,7 +10718,7 @@ var init_tree_sitter_runtime = __esm({
|
|
|
10718
10718
|
loadedByKey = /* @__PURE__ */ new Map();
|
|
10719
10719
|
failedLanguageKeys = /* @__PURE__ */ new Set();
|
|
10720
10720
|
runtimeChain = Promise.resolve();
|
|
10721
|
-
CODE_NAV_QUERIES_ROOT =
|
|
10721
|
+
CODE_NAV_QUERIES_ROOT = join5(dirname3(fileURLToPath4(import.meta.url)), "..", "queries");
|
|
10722
10722
|
}
|
|
10723
10723
|
});
|
|
10724
10724
|
|
|
@@ -12289,7 +12289,7 @@ var init_in_process_bridge = __esm({
|
|
|
12289
12289
|
});
|
|
12290
12290
|
|
|
12291
12291
|
// src/code-nav/symbol-index/worker/lifecycle/state.ts
|
|
12292
|
-
import { dirname as dirname4, join as
|
|
12292
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
12293
12293
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
12294
12294
|
function getWorker() {
|
|
12295
12295
|
return worker;
|
|
@@ -12308,7 +12308,7 @@ function shouldUseInProcessWorker() {
|
|
|
12308
12308
|
}
|
|
12309
12309
|
function resolveWorkerScriptPath() {
|
|
12310
12310
|
const moduleDir = dirname4(fileURLToPath5(import.meta.url));
|
|
12311
|
-
return
|
|
12311
|
+
return join6(moduleDir, "..", "worker.js");
|
|
12312
12312
|
}
|
|
12313
12313
|
function resetLifecycleStateForTests() {
|
|
12314
12314
|
terminatePromise = null;
|
|
@@ -31064,7 +31064,7 @@ var {
|
|
|
31064
31064
|
} = import_index.default;
|
|
31065
31065
|
|
|
31066
31066
|
// src/cli-version.ts
|
|
31067
|
-
var CLI_VERSION = "0.1.
|
|
31067
|
+
var CLI_VERSION = "0.1.72".length > 0 ? "0.1.72" : "0.0.0-dev";
|
|
31068
31068
|
|
|
31069
31069
|
// src/cli/defaults.ts
|
|
31070
31070
|
var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
|
|
@@ -32816,6 +32816,46 @@ function runPendingAuth(options) {
|
|
|
32816
32816
|
// src/run-bridge-connected.ts
|
|
32817
32817
|
init_log();
|
|
32818
32818
|
|
|
32819
|
+
// src/agents/acp/clients/bridge-agent-path.ts
|
|
32820
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
32821
|
+
import { homedir } from "node:os";
|
|
32822
|
+
import { join as join2 } from "node:path";
|
|
32823
|
+
function getBridgeAgentPathEntries(home = process.env.HOME ?? homedir()) {
|
|
32824
|
+
const entries = [
|
|
32825
|
+
join2(home, ".local", "bin"),
|
|
32826
|
+
join2(home, ".npm-global", "bin"),
|
|
32827
|
+
"/usr/local/bin"
|
|
32828
|
+
];
|
|
32829
|
+
const prefix = process.env.NPM_CONFIG_PREFIX;
|
|
32830
|
+
if (prefix) entries.push(join2(prefix, "bin"));
|
|
32831
|
+
try {
|
|
32832
|
+
const npmBin = execFileSync2("npm", ["bin", "-g"], { encoding: "utf8", timeout: 2e3 }).trim();
|
|
32833
|
+
if (npmBin) entries.push(npmBin);
|
|
32834
|
+
} catch {
|
|
32835
|
+
}
|
|
32836
|
+
return entries;
|
|
32837
|
+
}
|
|
32838
|
+
function augmentPath(pathValue, extra) {
|
|
32839
|
+
const current = pathValue ?? "";
|
|
32840
|
+
const parts = current.split(":").filter(Boolean);
|
|
32841
|
+
const seen = new Set(parts);
|
|
32842
|
+
const prefix = [];
|
|
32843
|
+
for (const entry of extra) {
|
|
32844
|
+
if (!entry || seen.has(entry)) continue;
|
|
32845
|
+
seen.add(entry);
|
|
32846
|
+
prefix.push(entry);
|
|
32847
|
+
}
|
|
32848
|
+
if (prefix.length === 0) return current;
|
|
32849
|
+
return current ? `${prefix.join(":")}:${current}` : prefix.join(":");
|
|
32850
|
+
}
|
|
32851
|
+
function ensureBridgeAgentPathInProcessEnv() {
|
|
32852
|
+
const extra = getBridgeAgentPathEntries();
|
|
32853
|
+
process.env.PATH = augmentPath(process.env.PATH, extra);
|
|
32854
|
+
}
|
|
32855
|
+
function bridgeAgentPathEnv(base = process.env) {
|
|
32856
|
+
return { ...base, PATH: augmentPath(base.PATH, getBridgeAgentPathEntries()) };
|
|
32857
|
+
}
|
|
32858
|
+
|
|
32819
32859
|
// src/files/watch-file-index.ts
|
|
32820
32860
|
import path25 from "node:path";
|
|
32821
32861
|
|
|
@@ -34950,7 +34990,11 @@ __export(claude_code_acp_client_exports, {
|
|
|
34950
34990
|
|
|
34951
34991
|
// src/agents/acp/clients/detect-command-on-path.ts
|
|
34952
34992
|
init_cli_process_interrupt();
|
|
34993
|
+
import { constants } from "node:fs";
|
|
34994
|
+
import { access } from "node:fs/promises";
|
|
34953
34995
|
import { execFile as execFile6 } from "node:child_process";
|
|
34996
|
+
import { homedir as homedir2 } from "node:os";
|
|
34997
|
+
import { join as join7 } from "node:path";
|
|
34954
34998
|
import { promisify as promisify6 } from "node:util";
|
|
34955
34999
|
var execFileAsync5 = promisify6(execFile6);
|
|
34956
35000
|
var COMMAND_ON_PATH_PROBE_TIMEOUT_MS = 750;
|
|
@@ -34967,15 +35011,43 @@ async function execFileShutdownAware(file2, args, timeoutMs) {
|
|
|
34967
35011
|
clearInterval(shutdownPoll);
|
|
34968
35012
|
}
|
|
34969
35013
|
}
|
|
35014
|
+
async function isExecutableFile(filePath) {
|
|
35015
|
+
try {
|
|
35016
|
+
await access(filePath, constants.X_OK);
|
|
35017
|
+
return true;
|
|
35018
|
+
} catch {
|
|
35019
|
+
return false;
|
|
35020
|
+
}
|
|
35021
|
+
}
|
|
35022
|
+
async function isCommandInBridgeAgentDirs(command) {
|
|
35023
|
+
const home = process.env.HOME ?? homedir2();
|
|
35024
|
+
for (const dir of getBridgeAgentPathEntries(home)) {
|
|
35025
|
+
if (await isExecutableFile(join7(dir, command))) return true;
|
|
35026
|
+
}
|
|
35027
|
+
return false;
|
|
35028
|
+
}
|
|
34970
35029
|
async function isCommandOnPath(command, timeoutMs = COMMAND_ON_PATH_PROBE_TIMEOUT_MS) {
|
|
34971
35030
|
if (isCliImmediateShutdownRequested()) return false;
|
|
34972
35031
|
try {
|
|
34973
|
-
await
|
|
35032
|
+
await execFileAsync5("which", [command], {
|
|
35033
|
+
timeout: timeoutMs,
|
|
35034
|
+
env: bridgeAgentPathEnv()
|
|
35035
|
+
});
|
|
34974
35036
|
return true;
|
|
34975
35037
|
} catch {
|
|
34976
|
-
return
|
|
35038
|
+
return isCommandInBridgeAgentDirs(command);
|
|
34977
35039
|
}
|
|
34978
35040
|
}
|
|
35041
|
+
async function waitForCommandOnPath(command, opts = {}) {
|
|
35042
|
+
const maxAttempts = opts.maxAttempts ?? 8;
|
|
35043
|
+
const delayMs = opts.delayMs ?? 400;
|
|
35044
|
+
const timeoutMs = opts.timeoutMs ?? COMMAND_ON_PATH_PROBE_TIMEOUT_MS;
|
|
35045
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
35046
|
+
if (await isCommandOnPath(command, timeoutMs)) return true;
|
|
35047
|
+
if (attempt < maxAttempts - 1) await new Promise((r) => setTimeout(r, delayMs));
|
|
35048
|
+
}
|
|
35049
|
+
return false;
|
|
35050
|
+
}
|
|
34979
35051
|
async function execProbeShutdownAware(file2, args, timeoutMs) {
|
|
34980
35052
|
if (isCliImmediateShutdownRequested()) return false;
|
|
34981
35053
|
try {
|
|
@@ -36685,15 +36757,15 @@ function resolveAgentCommand(preferredAgentType) {
|
|
|
36685
36757
|
}
|
|
36686
36758
|
|
|
36687
36759
|
// src/agents/acp/session-file-change-path-kind.ts
|
|
36688
|
-
import { execFileSync as
|
|
36760
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
36689
36761
|
import { existsSync as existsSync4, statSync } from "node:fs";
|
|
36690
36762
|
|
|
36691
36763
|
// src/git/get-git-repo-root-sync.ts
|
|
36692
|
-
import { execFileSync as
|
|
36764
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
36693
36765
|
import * as path28 from "node:path";
|
|
36694
36766
|
function getGitRepoRootSync(startDir) {
|
|
36695
36767
|
try {
|
|
36696
|
-
const out =
|
|
36768
|
+
const out = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
36697
36769
|
cwd: path28.resolve(startDir),
|
|
36698
36770
|
encoding: "utf8",
|
|
36699
36771
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -36706,7 +36778,7 @@ function getGitRepoRootSync(startDir) {
|
|
|
36706
36778
|
}
|
|
36707
36779
|
|
|
36708
36780
|
// src/agents/acp/workspace-files.ts
|
|
36709
|
-
import { execFileSync as
|
|
36781
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
36710
36782
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
36711
36783
|
import * as path29 from "node:path";
|
|
36712
36784
|
function resolveWorkspaceFilePath(sessionParentPath, rawPath) {
|
|
@@ -36767,7 +36839,7 @@ function readGitHeadBlob(sessionParentPath, displayPath) {
|
|
|
36767
36839
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
36768
36840
|
const execCwd = gitRoot ?? sessionParentPath;
|
|
36769
36841
|
try {
|
|
36770
|
-
return
|
|
36842
|
+
return execFileSync4("git", ["show", `HEAD:${displayPath}`], {
|
|
36771
36843
|
cwd: execCwd,
|
|
36772
36844
|
encoding: "utf8",
|
|
36773
36845
|
maxBuffer: 50 * 1024 * 1024
|
|
@@ -36783,7 +36855,7 @@ function gitHeadPathObjectType(sessionParentPath, displayPath) {
|
|
|
36783
36855
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
36784
36856
|
if (!gitRoot) return null;
|
|
36785
36857
|
try {
|
|
36786
|
-
return
|
|
36858
|
+
return execFileSync5("git", ["cat-file", "-t", `HEAD:${displayPath}`], {
|
|
36787
36859
|
cwd: gitRoot,
|
|
36788
36860
|
encoding: "utf8"
|
|
36789
36861
|
}).trim();
|
|
@@ -37638,11 +37710,11 @@ init_cli_process_interrupt();
|
|
|
37638
37710
|
var BRIDGE_MCP_SERVER_NAME2 = "buildautomaton-bridge";
|
|
37639
37711
|
|
|
37640
37712
|
// src/mcp/resolve-bridge-mcp-server-path.ts
|
|
37641
|
-
import { dirname as dirname7, join as
|
|
37713
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
37642
37714
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
37643
37715
|
function resolveBridgeMcpServerScriptPath() {
|
|
37644
37716
|
const cliDir = dirname7(fileURLToPath7(import.meta.url));
|
|
37645
|
-
return
|
|
37717
|
+
return join8(cliDir, "bridge-mcp-server.js");
|
|
37646
37718
|
}
|
|
37647
37719
|
|
|
37648
37720
|
// src/mcp/build-acp-mcp-servers.ts
|
|
@@ -52901,9 +52973,22 @@ var handleInstallSkillsMessage = (msg, deps) => {
|
|
|
52901
52973
|
// src/agents/install/commands/run-npm-global-install.ts
|
|
52902
52974
|
import { execFile as execFile9 } from "node:child_process";
|
|
52903
52975
|
import { promisify as promisify10 } from "node:util";
|
|
52976
|
+
|
|
52977
|
+
// src/agents/install/format-command-output.ts
|
|
52978
|
+
function formatCommandOutput(stdout, stderr) {
|
|
52979
|
+
const parts = [String(stdout ?? "").trimEnd(), String(stderr ?? "").trimEnd()].filter(Boolean);
|
|
52980
|
+
return parts.join("\n");
|
|
52981
|
+
}
|
|
52982
|
+
|
|
52983
|
+
// src/agents/install/commands/run-npm-global-install.ts
|
|
52904
52984
|
var execFileAsync8 = promisify10(execFile9);
|
|
52905
52985
|
async function runNpmGlobalInstall(packageName, env, timeoutMs = 3e5) {
|
|
52906
|
-
await execFileAsync8("npm", ["install", "-g", packageName], {
|
|
52986
|
+
const { stdout, stderr } = await execFileAsync8("npm", ["install", "-g", packageName], {
|
|
52987
|
+
timeout: timeoutMs,
|
|
52988
|
+
env: bridgeAgentPathEnv(env),
|
|
52989
|
+
maxBuffer: 10 * 1024 * 1024
|
|
52990
|
+
});
|
|
52991
|
+
return formatCommandOutput(stdout, stderr);
|
|
52907
52992
|
}
|
|
52908
52993
|
|
|
52909
52994
|
// src/agents/install/commands/claude-code.ts
|
|
@@ -52911,11 +52996,11 @@ var claudeCodeInstallCommand = {
|
|
|
52911
52996
|
agentType: "claude-code",
|
|
52912
52997
|
detectCommand: "claude",
|
|
52913
52998
|
async install(ctx) {
|
|
52914
|
-
|
|
52915
|
-
await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
52999
|
+
const logOutput = await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
52916
53000
|
...ctx.env,
|
|
52917
53001
|
ANTHROPIC_API_KEY: ctx.authToken
|
|
52918
53002
|
});
|
|
53003
|
+
ctx.onProgress?.("Installing Anthropic Claude Code", logOutput || void 0);
|
|
52919
53004
|
}
|
|
52920
53005
|
};
|
|
52921
53006
|
|
|
@@ -52924,11 +53009,11 @@ var codexAcpInstallCommand = {
|
|
|
52924
53009
|
agentType: "codex-acp",
|
|
52925
53010
|
detectCommand: "codex",
|
|
52926
53011
|
async install(ctx) {
|
|
52927
|
-
|
|
52928
|
-
await runNpmGlobalInstall("@openai/codex", {
|
|
53012
|
+
const logOutput = await runNpmGlobalInstall("@openai/codex", {
|
|
52929
53013
|
...ctx.env,
|
|
52930
53014
|
OPENAI_API_KEY: ctx.authToken
|
|
52931
53015
|
});
|
|
53016
|
+
ctx.onProgress?.("Installing Codex", logOutput || void 0);
|
|
52932
53017
|
}
|
|
52933
53018
|
};
|
|
52934
53019
|
|
|
@@ -52939,12 +53024,19 @@ var execFileAsync9 = promisify11(execFile10);
|
|
|
52939
53024
|
var cursorCliInstallCommand = {
|
|
52940
53025
|
agentType: "cursor-cli",
|
|
52941
53026
|
detectCommand: "agent",
|
|
53027
|
+
alternateDetectCommands: ["cursor-agent"],
|
|
52942
53028
|
async install(ctx) {
|
|
52943
|
-
|
|
52944
|
-
|
|
52945
|
-
|
|
52946
|
-
|
|
52947
|
-
|
|
53029
|
+
const { stdout, stderr } = await execFileAsync9(
|
|
53030
|
+
"bash",
|
|
53031
|
+
["-lc", "curl -fsSL https://cursor.com/install | bash"],
|
|
53032
|
+
{
|
|
53033
|
+
timeout: 3e5,
|
|
53034
|
+
env: { ...bridgeAgentPathEnv(ctx.env), CURSOR_API_KEY: ctx.authToken },
|
|
53035
|
+
maxBuffer: 10 * 1024 * 1024
|
|
53036
|
+
}
|
|
53037
|
+
);
|
|
53038
|
+
const logOutput = formatCommandOutput(stdout, stderr);
|
|
53039
|
+
ctx.onProgress?.("Installing Cursor CLI", logOutput || void 0);
|
|
52948
53040
|
}
|
|
52949
53041
|
};
|
|
52950
53042
|
|
|
@@ -52953,11 +53045,11 @@ var opencodeInstallCommand = {
|
|
|
52953
53045
|
agentType: "opencode",
|
|
52954
53046
|
detectCommand: "opencode",
|
|
52955
53047
|
async install(ctx) {
|
|
52956
|
-
|
|
52957
|
-
await runNpmGlobalInstall("opencode-ai", {
|
|
53048
|
+
const logOutput = await runNpmGlobalInstall("opencode-ai", {
|
|
52958
53049
|
...ctx.env,
|
|
52959
53050
|
OPENCODE_API_KEY: ctx.authToken
|
|
52960
53051
|
});
|
|
53052
|
+
ctx.onProgress?.("Installing OpenCode", logOutput || void 0);
|
|
52961
53053
|
}
|
|
52962
53054
|
};
|
|
52963
53055
|
|
|
@@ -52990,7 +53082,18 @@ async function installLocalAgentOnBridge(params) {
|
|
|
52990
53082
|
const msg = e instanceof Error ? e.message : String(e);
|
|
52991
53083
|
return { success: false, error: msg };
|
|
52992
53084
|
}
|
|
52993
|
-
|
|
53085
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
53086
|
+
const detectNames = [
|
|
53087
|
+
command.detectCommand,
|
|
53088
|
+
...command.alternateDetectCommands ?? []
|
|
53089
|
+
];
|
|
53090
|
+
let found = false;
|
|
53091
|
+
for (const name of detectNames) {
|
|
53092
|
+
if (await waitForCommandOnPath(name)) {
|
|
53093
|
+
found = true;
|
|
53094
|
+
break;
|
|
53095
|
+
}
|
|
53096
|
+
}
|
|
52994
53097
|
if (!found) {
|
|
52995
53098
|
return { success: false, error: `${command.detectCommand} not found on PATH after install` };
|
|
52996
53099
|
}
|
|
@@ -53007,7 +53110,7 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
53007
53110
|
if (!processId || !agentId || !tokenId || !agentType || !authToken) return;
|
|
53008
53111
|
void (async () => {
|
|
53009
53112
|
const socket = deps.getWs();
|
|
53010
|
-
const report = (step, message) => {
|
|
53113
|
+
const report = (step, message, logOutput) => {
|
|
53011
53114
|
if (socket) {
|
|
53012
53115
|
sendWsMessage(socket, {
|
|
53013
53116
|
type: "install_agent_progress",
|
|
@@ -53016,14 +53119,15 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
53016
53119
|
tokenId,
|
|
53017
53120
|
agentType,
|
|
53018
53121
|
step,
|
|
53019
|
-
message
|
|
53122
|
+
message,
|
|
53123
|
+
...logOutput ? { logOutput } : {}
|
|
53020
53124
|
});
|
|
53021
53125
|
}
|
|
53022
53126
|
};
|
|
53023
53127
|
const result = await installLocalAgentOnBridge({
|
|
53024
53128
|
agentType,
|
|
53025
53129
|
authToken,
|
|
53026
|
-
onProgress: (message) => report("agent_install_package", message)
|
|
53130
|
+
onProgress: (message, logOutput) => report("agent_install_package", message, logOutput)
|
|
53027
53131
|
});
|
|
53028
53132
|
if (socket) {
|
|
53029
53133
|
sendWsMessage(socket, {
|
|
@@ -53036,6 +53140,9 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
53036
53140
|
error: result.error
|
|
53037
53141
|
});
|
|
53038
53142
|
}
|
|
53143
|
+
if (result.success) {
|
|
53144
|
+
await deps.reportAutoDetectedAgents?.();
|
|
53145
|
+
}
|
|
53039
53146
|
if (!result.success) {
|
|
53040
53147
|
deps.log(`[Bridge service] Install agent failed: ${result.error ?? "unknown"}`);
|
|
53041
53148
|
}
|
|
@@ -53721,6 +53828,7 @@ init_log();
|
|
|
53721
53828
|
async function createBridgeConnection(options) {
|
|
53722
53829
|
const { apiUrl, workspaceId, justAuthenticated, onAuthInvalid, persistTokens } = options;
|
|
53723
53830
|
const logFn = options.log ?? log;
|
|
53831
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
53724
53832
|
await ensureBridgeConnectionDatabases(logFn);
|
|
53725
53833
|
const { state, getWs } = createMainBridgeReconnectState();
|
|
53726
53834
|
const runtime = await createBridgeConnectionRuntime(options, { state, getWs, logFn });
|