@buildautomaton/cli 0.1.43 → 0.1.45
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 +34 -26
- package/dist/cli.js.map +2 -2
- package/dist/index.js +34 -26
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25174,7 +25174,7 @@ var {
|
|
|
25174
25174
|
} = import_index.default;
|
|
25175
25175
|
|
|
25176
25176
|
// src/cli-version.ts
|
|
25177
|
-
var CLI_VERSION = "0.1.
|
|
25177
|
+
var CLI_VERSION = "0.1.45".length > 0 ? "0.1.45" : "0.0.0-dev";
|
|
25178
25178
|
|
|
25179
25179
|
// src/cli/defaults.ts
|
|
25180
25180
|
var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
|
|
@@ -27438,38 +27438,38 @@ async function closeBridgeConnection(state, acpManager, devServerManager, log2)
|
|
|
27438
27438
|
// src/agents/acp/acp-prompt-routing-registry.ts
|
|
27439
27439
|
var AcpPromptRoutingRegistry = class {
|
|
27440
27440
|
runs = /* @__PURE__ */ new Map();
|
|
27441
|
-
|
|
27441
|
+
streamingRunIdBySessionAgent = /* @__PURE__ */ new Map();
|
|
27442
27442
|
registerRun(route) {
|
|
27443
27443
|
this.runs.set(route.runId, route);
|
|
27444
27444
|
}
|
|
27445
27445
|
unregisterRun(runId) {
|
|
27446
27446
|
this.runs.delete(runId);
|
|
27447
|
-
for (const [
|
|
27447
|
+
for (const [sessionAgentKey, streamingRunId] of this.streamingRunIdBySessionAgent.entries()) {
|
|
27448
27448
|
if (streamingRunId === runId) {
|
|
27449
|
-
this.
|
|
27449
|
+
this.streamingRunIdBySessionAgent.delete(sessionAgentKey);
|
|
27450
27450
|
}
|
|
27451
27451
|
}
|
|
27452
27452
|
}
|
|
27453
27453
|
isRegisteredRun(runId) {
|
|
27454
27454
|
return this.runs.has(runId);
|
|
27455
27455
|
}
|
|
27456
|
-
setStreamingRunId(
|
|
27456
|
+
setStreamingRunId(sessionAgentKey, runId) {
|
|
27457
27457
|
if (runId) {
|
|
27458
|
-
this.
|
|
27458
|
+
this.streamingRunIdBySessionAgent.set(sessionAgentKey, runId);
|
|
27459
27459
|
} else {
|
|
27460
|
-
this.
|
|
27460
|
+
this.streamingRunIdBySessionAgent.delete(sessionAgentKey);
|
|
27461
27461
|
}
|
|
27462
27462
|
}
|
|
27463
|
-
clearStreamingRunId(
|
|
27464
|
-
if (this.
|
|
27465
|
-
this.
|
|
27463
|
+
clearStreamingRunId(sessionAgentKey, runId) {
|
|
27464
|
+
if (this.streamingRunIdBySessionAgent.get(sessionAgentKey) === runId) {
|
|
27465
|
+
this.streamingRunIdBySessionAgent.delete(sessionAgentKey);
|
|
27466
27466
|
}
|
|
27467
27467
|
}
|
|
27468
|
-
getStreamingRunId(
|
|
27469
|
-
return this.
|
|
27468
|
+
getStreamingRunId(sessionAgentKey) {
|
|
27469
|
+
return this.streamingRunIdBySessionAgent.get(sessionAgentKey);
|
|
27470
27470
|
}
|
|
27471
|
-
resolveRouting(
|
|
27472
|
-
const runId = this.
|
|
27471
|
+
resolveRouting(sessionAgentKey) {
|
|
27472
|
+
const runId = this.streamingRunIdBySessionAgent.get(sessionAgentKey);
|
|
27473
27473
|
if (!runId) return void 0;
|
|
27474
27474
|
return this.runs.get(runId);
|
|
27475
27475
|
}
|
|
@@ -27492,9 +27492,9 @@ function createAcpManagerContext(options) {
|
|
|
27492
27492
|
async function cancelRun(ctx, runId) {
|
|
27493
27493
|
const meta = ctx.runDispatch.get(runId);
|
|
27494
27494
|
if (!meta) return false;
|
|
27495
|
-
const streamingRunId = ctx.promptRouting.getStreamingRunId(meta.
|
|
27495
|
+
const streamingRunId = ctx.promptRouting.getStreamingRunId(meta.acpSessionAgentKey);
|
|
27496
27496
|
if (streamingRunId && streamingRunId !== runId) return false;
|
|
27497
|
-
const handle = ctx.acpAgents.get(meta.
|
|
27497
|
+
const handle = ctx.acpAgents.get(meta.acpSessionAgentKey)?.acpHandle;
|
|
27498
27498
|
if (handle?.cancel) {
|
|
27499
27499
|
ctx.log("[Agent] Stop requested");
|
|
27500
27500
|
try {
|
|
@@ -29251,9 +29251,9 @@ async function createSdkStdioAcpClient(options) {
|
|
|
29251
29251
|
|
|
29252
29252
|
// src/agents/acp/clients/claude-code-acp-client.ts
|
|
29253
29253
|
var BACKEND_LOCAL_AGENT_TYPE = "claude-code";
|
|
29254
|
+
var CLAUDE_ACP_ADAPTER_NPX_ARGS = ["--yes", "@agentclientprotocol/claude-agent-acp"];
|
|
29254
29255
|
async function detectLocalAgentPresence() {
|
|
29255
|
-
|
|
29256
|
-
return execProbeShutdownAware("npx", ["--yes", "@anthropic-ai/claude-code", "--version"], 3e3);
|
|
29256
|
+
return execProbeShutdownAware("npx", [...CLAUDE_ACP_ADAPTER_NPX_ARGS, "--help"], 8e3);
|
|
29257
29257
|
}
|
|
29258
29258
|
function buildClaudeCodeAcpSpawnCommand(base, _sessionMode) {
|
|
29259
29259
|
return [...base];
|
|
@@ -30088,6 +30088,8 @@ function createBridgeOnRequest(opts) {
|
|
|
30088
30088
|
...sessionId ? { sessionId } : {},
|
|
30089
30089
|
runId,
|
|
30090
30090
|
kind,
|
|
30091
|
+
/** Top-level for bridge DO jobs / web push when `payload` is E2EE-encrypted. */
|
|
30092
|
+
requestId: request.requestId,
|
|
30091
30093
|
payload: {
|
|
30092
30094
|
sessionUpdate,
|
|
30093
30095
|
requestId: request.requestId,
|
|
@@ -30694,6 +30696,11 @@ function writeLocalAgentSessionFile(cloudSessionId, patch) {
|
|
|
30694
30696
|
}
|
|
30695
30697
|
|
|
30696
30698
|
// src/agents/acp/acp-agent.ts
|
|
30699
|
+
function computeAcpSessionAgentKey(cloudSessionId, acpAgentKey) {
|
|
30700
|
+
const sid = cloudSessionId?.trim();
|
|
30701
|
+
if (!sid) return `::${acpAgentKey}`;
|
|
30702
|
+
return `${sid}::${acpAgentKey}`;
|
|
30703
|
+
}
|
|
30697
30704
|
function computeAcpAgentKey(preferredAgentType, mode, agentConfig) {
|
|
30698
30705
|
const resolved = resolveAgentCommand(preferredAgentType);
|
|
30699
30706
|
if (!resolved) return null;
|
|
@@ -36142,11 +36149,11 @@ async function sendPromptToAgent(options) {
|
|
|
36142
36149
|
}
|
|
36143
36150
|
|
|
36144
36151
|
// src/agents/acp/manager/get-acp-agent-state.ts
|
|
36145
|
-
function
|
|
36146
|
-
let state = ctx.acpAgents.get(
|
|
36152
|
+
function getAcpSessionAgentState(ctx, acpSessionAgentKey) {
|
|
36153
|
+
let state = ctx.acpAgents.get(acpSessionAgentKey);
|
|
36147
36154
|
if (!state) {
|
|
36148
36155
|
state = createEmptyAcpClientState();
|
|
36149
|
-
ctx.acpAgents.set(
|
|
36156
|
+
ctx.acpAgents.set(acpSessionAgentKey, state);
|
|
36150
36157
|
}
|
|
36151
36158
|
return state;
|
|
36152
36159
|
}
|
|
@@ -36190,11 +36197,12 @@ function handlePrompt(ctx, opts) {
|
|
|
36190
36197
|
return;
|
|
36191
36198
|
}
|
|
36192
36199
|
const activeAcpAgentKey = acpAgentKey;
|
|
36200
|
+
const activeAcpSessionAgentKey = computeAcpSessionAgentKey(sessionId, activeAcpAgentKey);
|
|
36193
36201
|
ctx.pendingCancelRunIds.delete(activeRunId);
|
|
36194
36202
|
ctx.promptRouting.registerRun({ sessionId, runId: activeRunId });
|
|
36195
|
-
ctx.runDispatch.set(activeRunId, {
|
|
36203
|
+
ctx.runDispatch.set(activeRunId, { acpSessionAgentKey: activeAcpSessionAgentKey });
|
|
36196
36204
|
async function run() {
|
|
36197
|
-
const acpAgentState =
|
|
36205
|
+
const acpAgentState = getAcpSessionAgentState(ctx, activeAcpSessionAgentKey);
|
|
36198
36206
|
const handle = await ensureAcpClient({
|
|
36199
36207
|
state: acpAgentState,
|
|
36200
36208
|
acpAgentKey: activeAcpAgentKey,
|
|
@@ -36202,7 +36210,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36202
36210
|
mode,
|
|
36203
36211
|
agentConfig: agentConfig ?? null,
|
|
36204
36212
|
sessionParentPath,
|
|
36205
|
-
resolveRouting: () => ctx.promptRouting.resolveRouting(
|
|
36213
|
+
resolveRouting: () => ctx.promptRouting.resolveRouting(activeAcpSessionAgentKey),
|
|
36206
36214
|
cloudSessionId: sessionId,
|
|
36207
36215
|
sendSessionUpdate,
|
|
36208
36216
|
sendRequest: sendSessionUpdate,
|
|
@@ -36245,7 +36253,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36245
36253
|
});
|
|
36246
36254
|
return;
|
|
36247
36255
|
}
|
|
36248
|
-
ctx.promptRouting.setStreamingRunId(
|
|
36256
|
+
ctx.promptRouting.setStreamingRunId(activeAcpSessionAgentKey, activeRunId);
|
|
36249
36257
|
try {
|
|
36250
36258
|
await sendPromptToAgent({
|
|
36251
36259
|
handle,
|
|
@@ -36266,7 +36274,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36266
36274
|
attachments
|
|
36267
36275
|
});
|
|
36268
36276
|
} finally {
|
|
36269
|
-
ctx.promptRouting.clearStreamingRunId(
|
|
36277
|
+
ctx.promptRouting.clearStreamingRunId(activeAcpSessionAgentKey, activeRunId);
|
|
36270
36278
|
}
|
|
36271
36279
|
}
|
|
36272
36280
|
void run().finally(() => {
|