@buildautomaton/cli 0.1.71 → 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 +80 -20
- package/dist/cli.js.map +4 -4
- package/dist/index.js +80 -20
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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;
|
|
@@ -33032,7 +33032,11 @@ __export(claude_code_acp_client_exports, {
|
|
|
33032
33032
|
|
|
33033
33033
|
// src/agents/acp/clients/detect-command-on-path.ts
|
|
33034
33034
|
init_cli_process_interrupt();
|
|
33035
|
+
import { constants } from "node:fs";
|
|
33036
|
+
import { access } from "node:fs/promises";
|
|
33035
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";
|
|
33036
33040
|
import { promisify as promisify7 } from "node:util";
|
|
33037
33041
|
var execFileAsync5 = promisify7(execFile6);
|
|
33038
33042
|
var COMMAND_ON_PATH_PROBE_TIMEOUT_MS = 750;
|
|
@@ -33049,6 +33053,21 @@ async function execFileShutdownAware(file2, args, timeoutMs) {
|
|
|
33049
33053
|
clearInterval(shutdownPoll);
|
|
33050
33054
|
}
|
|
33051
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
|
+
}
|
|
33052
33071
|
async function isCommandOnPath(command, timeoutMs = COMMAND_ON_PATH_PROBE_TIMEOUT_MS) {
|
|
33053
33072
|
if (isCliImmediateShutdownRequested()) return false;
|
|
33054
33073
|
try {
|
|
@@ -33058,9 +33077,19 @@ async function isCommandOnPath(command, timeoutMs = COMMAND_ON_PATH_PROBE_TIMEOU
|
|
|
33058
33077
|
});
|
|
33059
33078
|
return true;
|
|
33060
33079
|
} catch {
|
|
33061
|
-
return
|
|
33080
|
+
return isCommandInBridgeAgentDirs(command);
|
|
33062
33081
|
}
|
|
33063
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
|
+
}
|
|
33064
33093
|
async function execProbeShutdownAware(file2, args, timeoutMs) {
|
|
33065
33094
|
if (isCliImmediateShutdownRequested()) return false;
|
|
33066
33095
|
try {
|
|
@@ -34700,11 +34729,11 @@ init_cli_process_interrupt();
|
|
|
34700
34729
|
var BRIDGE_MCP_SERVER_NAME2 = "buildautomaton-bridge";
|
|
34701
34730
|
|
|
34702
34731
|
// src/mcp/resolve-bridge-mcp-server-path.ts
|
|
34703
|
-
import { dirname as dirname7, join as
|
|
34732
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
34704
34733
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
34705
34734
|
function resolveBridgeMcpServerScriptPath() {
|
|
34706
34735
|
const cliDir = dirname7(fileURLToPath7(import.meta.url));
|
|
34707
|
-
return
|
|
34736
|
+
return join7(cliDir, "bridge-mcp-server.js");
|
|
34708
34737
|
}
|
|
34709
34738
|
|
|
34710
34739
|
// src/mcp/build-acp-mcp-servers.ts
|
|
@@ -49724,9 +49753,22 @@ var handleInstallSkillsMessage = (msg, deps) => {
|
|
|
49724
49753
|
// src/agents/install/commands/run-npm-global-install.ts
|
|
49725
49754
|
import { execFile as execFile9 } from "node:child_process";
|
|
49726
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
|
|
49727
49764
|
var execFileAsync8 = promisify10(execFile9);
|
|
49728
49765
|
async function runNpmGlobalInstall(packageName, env, timeoutMs = 3e5) {
|
|
49729
|
-
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);
|
|
49730
49772
|
}
|
|
49731
49773
|
|
|
49732
49774
|
// src/agents/install/commands/claude-code.ts
|
|
@@ -49734,11 +49776,11 @@ var claudeCodeInstallCommand = {
|
|
|
49734
49776
|
agentType: "claude-code",
|
|
49735
49777
|
detectCommand: "claude",
|
|
49736
49778
|
async install(ctx) {
|
|
49737
|
-
|
|
49738
|
-
await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
49779
|
+
const logOutput = await runNpmGlobalInstall("@anthropic-ai/claude-code", {
|
|
49739
49780
|
...ctx.env,
|
|
49740
49781
|
ANTHROPIC_API_KEY: ctx.authToken
|
|
49741
49782
|
});
|
|
49783
|
+
ctx.onProgress?.("Installing Anthropic Claude Code", logOutput || void 0);
|
|
49742
49784
|
}
|
|
49743
49785
|
};
|
|
49744
49786
|
|
|
@@ -49747,11 +49789,11 @@ var codexAcpInstallCommand = {
|
|
|
49747
49789
|
agentType: "codex-acp",
|
|
49748
49790
|
detectCommand: "codex",
|
|
49749
49791
|
async install(ctx) {
|
|
49750
|
-
|
|
49751
|
-
await runNpmGlobalInstall("@openai/codex", {
|
|
49792
|
+
const logOutput = await runNpmGlobalInstall("@openai/codex", {
|
|
49752
49793
|
...ctx.env,
|
|
49753
49794
|
OPENAI_API_KEY: ctx.authToken
|
|
49754
49795
|
});
|
|
49796
|
+
ctx.onProgress?.("Installing Codex", logOutput || void 0);
|
|
49755
49797
|
}
|
|
49756
49798
|
};
|
|
49757
49799
|
|
|
@@ -49762,12 +49804,19 @@ var execFileAsync9 = promisify11(execFile10);
|
|
|
49762
49804
|
var cursorCliInstallCommand = {
|
|
49763
49805
|
agentType: "cursor-cli",
|
|
49764
49806
|
detectCommand: "agent",
|
|
49807
|
+
alternateDetectCommands: ["cursor-agent"],
|
|
49765
49808
|
async install(ctx) {
|
|
49766
|
-
|
|
49767
|
-
|
|
49768
|
-
|
|
49769
|
-
|
|
49770
|
-
|
|
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);
|
|
49771
49820
|
}
|
|
49772
49821
|
};
|
|
49773
49822
|
|
|
@@ -49776,11 +49825,11 @@ var opencodeInstallCommand = {
|
|
|
49776
49825
|
agentType: "opencode",
|
|
49777
49826
|
detectCommand: "opencode",
|
|
49778
49827
|
async install(ctx) {
|
|
49779
|
-
|
|
49780
|
-
await runNpmGlobalInstall("opencode-ai", {
|
|
49828
|
+
const logOutput = await runNpmGlobalInstall("opencode-ai", {
|
|
49781
49829
|
...ctx.env,
|
|
49782
49830
|
OPENCODE_API_KEY: ctx.authToken
|
|
49783
49831
|
});
|
|
49832
|
+
ctx.onProgress?.("Installing OpenCode", logOutput || void 0);
|
|
49784
49833
|
}
|
|
49785
49834
|
};
|
|
49786
49835
|
|
|
@@ -49814,7 +49863,17 @@ async function installLocalAgentOnBridge(params) {
|
|
|
49814
49863
|
return { success: false, error: msg };
|
|
49815
49864
|
}
|
|
49816
49865
|
ensureBridgeAgentPathInProcessEnv();
|
|
49817
|
-
const
|
|
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
|
+
}
|
|
49818
49877
|
if (!found) {
|
|
49819
49878
|
return { success: false, error: `${command.detectCommand} not found on PATH after install` };
|
|
49820
49879
|
}
|
|
@@ -49831,7 +49890,7 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49831
49890
|
if (!processId || !agentId || !tokenId || !agentType || !authToken) return;
|
|
49832
49891
|
void (async () => {
|
|
49833
49892
|
const socket = deps.getWs();
|
|
49834
|
-
const report = (step, message) => {
|
|
49893
|
+
const report = (step, message, logOutput) => {
|
|
49835
49894
|
if (socket) {
|
|
49836
49895
|
sendWsMessage(socket, {
|
|
49837
49896
|
type: "install_agent_progress",
|
|
@@ -49840,14 +49899,15 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49840
49899
|
tokenId,
|
|
49841
49900
|
agentType,
|
|
49842
49901
|
step,
|
|
49843
|
-
message
|
|
49902
|
+
message,
|
|
49903
|
+
...logOutput ? { logOutput } : {}
|
|
49844
49904
|
});
|
|
49845
49905
|
}
|
|
49846
49906
|
};
|
|
49847
49907
|
const result = await installLocalAgentOnBridge({
|
|
49848
49908
|
agentType,
|
|
49849
49909
|
authToken,
|
|
49850
|
-
onProgress: (message) => report("agent_install_package", message)
|
|
49910
|
+
onProgress: (message, logOutput) => report("agent_install_package", message, logOutput)
|
|
49851
49911
|
});
|
|
49852
49912
|
if (socket) {
|
|
49853
49913
|
sendWsMessage(socket, {
|