@buildautomaton/cli 0.1.44 → 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 +30 -24
- package/dist/cli.js.map +2 -2
- package/dist/index.js +30 -24
- 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 {
|
|
@@ -30696,6 +30696,11 @@ function writeLocalAgentSessionFile(cloudSessionId, patch) {
|
|
|
30696
30696
|
}
|
|
30697
30697
|
|
|
30698
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
|
+
}
|
|
30699
30704
|
function computeAcpAgentKey(preferredAgentType, mode, agentConfig) {
|
|
30700
30705
|
const resolved = resolveAgentCommand(preferredAgentType);
|
|
30701
30706
|
if (!resolved) return null;
|
|
@@ -36144,11 +36149,11 @@ async function sendPromptToAgent(options) {
|
|
|
36144
36149
|
}
|
|
36145
36150
|
|
|
36146
36151
|
// src/agents/acp/manager/get-acp-agent-state.ts
|
|
36147
|
-
function
|
|
36148
|
-
let state = ctx.acpAgents.get(
|
|
36152
|
+
function getAcpSessionAgentState(ctx, acpSessionAgentKey) {
|
|
36153
|
+
let state = ctx.acpAgents.get(acpSessionAgentKey);
|
|
36149
36154
|
if (!state) {
|
|
36150
36155
|
state = createEmptyAcpClientState();
|
|
36151
|
-
ctx.acpAgents.set(
|
|
36156
|
+
ctx.acpAgents.set(acpSessionAgentKey, state);
|
|
36152
36157
|
}
|
|
36153
36158
|
return state;
|
|
36154
36159
|
}
|
|
@@ -36192,11 +36197,12 @@ function handlePrompt(ctx, opts) {
|
|
|
36192
36197
|
return;
|
|
36193
36198
|
}
|
|
36194
36199
|
const activeAcpAgentKey = acpAgentKey;
|
|
36200
|
+
const activeAcpSessionAgentKey = computeAcpSessionAgentKey(sessionId, activeAcpAgentKey);
|
|
36195
36201
|
ctx.pendingCancelRunIds.delete(activeRunId);
|
|
36196
36202
|
ctx.promptRouting.registerRun({ sessionId, runId: activeRunId });
|
|
36197
|
-
ctx.runDispatch.set(activeRunId, {
|
|
36203
|
+
ctx.runDispatch.set(activeRunId, { acpSessionAgentKey: activeAcpSessionAgentKey });
|
|
36198
36204
|
async function run() {
|
|
36199
|
-
const acpAgentState =
|
|
36205
|
+
const acpAgentState = getAcpSessionAgentState(ctx, activeAcpSessionAgentKey);
|
|
36200
36206
|
const handle = await ensureAcpClient({
|
|
36201
36207
|
state: acpAgentState,
|
|
36202
36208
|
acpAgentKey: activeAcpAgentKey,
|
|
@@ -36204,7 +36210,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36204
36210
|
mode,
|
|
36205
36211
|
agentConfig: agentConfig ?? null,
|
|
36206
36212
|
sessionParentPath,
|
|
36207
|
-
resolveRouting: () => ctx.promptRouting.resolveRouting(
|
|
36213
|
+
resolveRouting: () => ctx.promptRouting.resolveRouting(activeAcpSessionAgentKey),
|
|
36208
36214
|
cloudSessionId: sessionId,
|
|
36209
36215
|
sendSessionUpdate,
|
|
36210
36216
|
sendRequest: sendSessionUpdate,
|
|
@@ -36247,7 +36253,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36247
36253
|
});
|
|
36248
36254
|
return;
|
|
36249
36255
|
}
|
|
36250
|
-
ctx.promptRouting.setStreamingRunId(
|
|
36256
|
+
ctx.promptRouting.setStreamingRunId(activeAcpSessionAgentKey, activeRunId);
|
|
36251
36257
|
try {
|
|
36252
36258
|
await sendPromptToAgent({
|
|
36253
36259
|
handle,
|
|
@@ -36268,7 +36274,7 @@ function handlePrompt(ctx, opts) {
|
|
|
36268
36274
|
attachments
|
|
36269
36275
|
});
|
|
36270
36276
|
} finally {
|
|
36271
|
-
ctx.promptRouting.clearStreamingRunId(
|
|
36277
|
+
ctx.promptRouting.clearStreamingRunId(activeAcpSessionAgentKey, activeRunId);
|
|
36272
36278
|
}
|
|
36273
36279
|
}
|
|
36274
36280
|
void run().finally(() => {
|