@buildautomaton/cli 0.1.75 → 0.1.76
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 +36 -43
- package/dist/cli.js.map +4 -4
- package/dist/index.js +36 -43
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -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.76".length > 0 ? "0.1.76" : "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";
|
|
@@ -38325,6 +38325,7 @@ async function loadPreTurnSnapshot(options) {
|
|
|
38325
38325
|
}
|
|
38326
38326
|
return data;
|
|
38327
38327
|
} catch (e) {
|
|
38328
|
+
if (e.code === "ENOENT") return null;
|
|
38328
38329
|
log2(
|
|
38329
38330
|
`[turn-diff] No pre-turn snapshot for run ${runId.slice(0, 8)}\u2026: ${e instanceof Error ? e.message : String(e)}`
|
|
38330
38331
|
);
|
|
@@ -51915,15 +51916,21 @@ function dispatchLocalPrompt(next, deps) {
|
|
|
51915
51916
|
|
|
51916
51917
|
// src/prompt-turn-queue/runner/run-id-queue-key-map.ts
|
|
51917
51918
|
var runIdToQueueKey = /* @__PURE__ */ new Map();
|
|
51919
|
+
var locallyDispatchedRunIds = /* @__PURE__ */ new Set();
|
|
51918
51920
|
function getRunIdQueueKey(runId) {
|
|
51919
51921
|
return runIdToQueueKey.get(runId);
|
|
51920
51922
|
}
|
|
51921
51923
|
function setRunIdQueueKey(runId, queueKey) {
|
|
51922
51924
|
runIdToQueueKey.set(runId, queueKey);
|
|
51925
|
+
locallyDispatchedRunIds.add(runId);
|
|
51926
|
+
}
|
|
51927
|
+
function isLocallyDispatchedRun(runId) {
|
|
51928
|
+
return locallyDispatchedRunIds.has(runId);
|
|
51923
51929
|
}
|
|
51924
51930
|
function deleteRunIdQueueKey(runId) {
|
|
51925
51931
|
const queueKey = runIdToQueueKey.get(runId);
|
|
51926
51932
|
runIdToQueueKey.delete(runId);
|
|
51933
|
+
locallyDispatchedRunIds.delete(runId);
|
|
51927
51934
|
return queueKey;
|
|
51928
51935
|
}
|
|
51929
51936
|
function syncRunningTurnQueueKeys(turns, queueKey) {
|
|
@@ -51946,39 +51953,11 @@ async function dispatchStartedPromptQueueRuns(entries, started, deps) {
|
|
|
51946
51953
|
|
|
51947
51954
|
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
51948
51955
|
init_yield_to_event_loop();
|
|
51949
|
-
|
|
51950
|
-
// src/prompt-turn-queue/client-report.ts
|
|
51951
|
-
function sendPromptQueueClientReport(ws, queues) {
|
|
51952
|
-
if (!ws) return false;
|
|
51953
|
-
const wireQueues = {};
|
|
51954
|
-
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
51955
|
-
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
51956
|
-
}
|
|
51957
|
-
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
51958
|
-
return true;
|
|
51959
|
-
}
|
|
51960
|
-
|
|
51961
|
-
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
51962
|
-
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
51963
|
-
if (!runId) return false;
|
|
51964
|
-
const queueKey = deleteRunIdQueueKey(runId);
|
|
51965
|
-
if (!queueKey) return false;
|
|
51966
|
-
const f = await readPersistedQueue(queueKey);
|
|
51967
|
-
if (!f) return false;
|
|
51968
|
-
const t = f.turns.find((x) => x.turnId === runId);
|
|
51969
|
-
if (!t) return false;
|
|
51970
|
-
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
51971
|
-
await writePersistedQueue(f);
|
|
51972
|
-
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
51973
|
-
return true;
|
|
51974
|
-
}
|
|
51975
|
-
|
|
51976
|
-
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
51977
51956
|
async function handlePromptQueueCancellations(entries, deps) {
|
|
51978
51957
|
for (const [queueKey] of entries) {
|
|
51979
51958
|
const file2 = await readPersistedQueue(queueKey);
|
|
51980
51959
|
const turn = file2?.turns.find((row) => row.bridgeServerState === "cancel_requested" && row.lastCliState === "running");
|
|
51981
|
-
if (!turn) {
|
|
51960
|
+
if (!turn || getRunIdQueueKey(turn.turnId) !== queueKey || !isLocallyDispatchedRun(turn.turnId)) {
|
|
51982
51961
|
await yieldToEventLoop();
|
|
51983
51962
|
continue;
|
|
51984
51963
|
}
|
|
@@ -51987,19 +51966,7 @@ async function handlePromptQueueCancellations(entries, deps) {
|
|
|
51987
51966
|
await yieldToEventLoop();
|
|
51988
51967
|
continue;
|
|
51989
51968
|
}
|
|
51990
|
-
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026
|
|
51991
|
-
await finalizePromptTurnOnBridge(deps.getWs, turn.turnId, false, { terminalCliState: "cancelled" });
|
|
51992
|
-
const ws = deps.getWs();
|
|
51993
|
-
if (ws && turn.sessionId) {
|
|
51994
|
-
sendWsMessage(ws, {
|
|
51995
|
-
type: "prompt_result",
|
|
51996
|
-
sessionId: turn.sessionId,
|
|
51997
|
-
runId: turn.turnId,
|
|
51998
|
-
success: false,
|
|
51999
|
-
error: "Stopped by user",
|
|
52000
|
-
stopReason: "cancelled"
|
|
52001
|
-
});
|
|
52002
|
-
}
|
|
51969
|
+
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026 but no local ACP run remains.`);
|
|
52003
51970
|
await yieldToEventLoop();
|
|
52004
51971
|
}
|
|
52005
51972
|
}
|
|
@@ -52027,6 +51994,17 @@ function promptQueueSnapshotEntries(queues) {
|
|
|
52027
51994
|
// src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
|
|
52028
51995
|
init_yield_to_event_loop();
|
|
52029
51996
|
|
|
51997
|
+
// src/prompt-turn-queue/client-report.ts
|
|
51998
|
+
function sendPromptQueueClientReport(ws, queues) {
|
|
51999
|
+
if (!ws) return false;
|
|
52000
|
+
const wireQueues = {};
|
|
52001
|
+
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
52002
|
+
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
52003
|
+
}
|
|
52004
|
+
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
52005
|
+
return true;
|
|
52006
|
+
}
|
|
52007
|
+
|
|
52030
52008
|
// src/prompt-turn-queue/runner/queue-selection.ts
|
|
52031
52009
|
function pickNextRunnableTurn(turns) {
|
|
52032
52010
|
for (const t of turns) {
|
|
@@ -52200,6 +52178,21 @@ async function applyPromptQueueStateFromServer(msg, deps) {
|
|
|
52200
52178
|
await dispatchStartedPromptQueueRuns(entries, started, deps);
|
|
52201
52179
|
}
|
|
52202
52180
|
|
|
52181
|
+
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
52182
|
+
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
52183
|
+
if (!runId) return false;
|
|
52184
|
+
const queueKey = deleteRunIdQueueKey(runId);
|
|
52185
|
+
if (!queueKey) return false;
|
|
52186
|
+
const f = await readPersistedQueue(queueKey);
|
|
52187
|
+
if (!f) return false;
|
|
52188
|
+
const t = f.turns.find((x) => x.turnId === runId);
|
|
52189
|
+
if (!t) return false;
|
|
52190
|
+
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
52191
|
+
await writePersistedQueue(f);
|
|
52192
|
+
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
52193
|
+
return true;
|
|
52194
|
+
}
|
|
52195
|
+
|
|
52203
52196
|
// src/agents/acp/from-bridge/bridge-prompt-wiring.ts
|
|
52204
52197
|
function createBridgePromptSenders(deps, getWs) {
|
|
52205
52198
|
const sendBridgeMessage = (message, encryptedFields = []) => {
|