@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/index.js
CHANGED
|
@@ -30606,7 +30606,7 @@ function installBridgeProcessResilience() {
|
|
|
30606
30606
|
}
|
|
30607
30607
|
|
|
30608
30608
|
// src/cli-version.ts
|
|
30609
|
-
var CLI_VERSION = "0.1.
|
|
30609
|
+
var CLI_VERSION = "0.1.76".length > 0 ? "0.1.76" : "0.0.0-dev";
|
|
30610
30610
|
|
|
30611
30611
|
// src/connection/heartbeat/constants.ts
|
|
30612
30612
|
var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
@@ -35344,6 +35344,7 @@ async function loadPreTurnSnapshot(options) {
|
|
|
35344
35344
|
}
|
|
35345
35345
|
return data;
|
|
35346
35346
|
} catch (e) {
|
|
35347
|
+
if (e.code === "ENOENT") return null;
|
|
35347
35348
|
log2(
|
|
35348
35349
|
`[turn-diff] No pre-turn snapshot for run ${runId.slice(0, 8)}\u2026: ${e instanceof Error ? e.message : String(e)}`
|
|
35349
35350
|
);
|
|
@@ -48869,15 +48870,21 @@ function dispatchLocalPrompt(next, deps) {
|
|
|
48869
48870
|
|
|
48870
48871
|
// src/prompt-turn-queue/runner/run-id-queue-key-map.ts
|
|
48871
48872
|
var runIdToQueueKey = /* @__PURE__ */ new Map();
|
|
48873
|
+
var locallyDispatchedRunIds = /* @__PURE__ */ new Set();
|
|
48872
48874
|
function getRunIdQueueKey(runId) {
|
|
48873
48875
|
return runIdToQueueKey.get(runId);
|
|
48874
48876
|
}
|
|
48875
48877
|
function setRunIdQueueKey(runId, queueKey) {
|
|
48876
48878
|
runIdToQueueKey.set(runId, queueKey);
|
|
48879
|
+
locallyDispatchedRunIds.add(runId);
|
|
48880
|
+
}
|
|
48881
|
+
function isLocallyDispatchedRun(runId) {
|
|
48882
|
+
return locallyDispatchedRunIds.has(runId);
|
|
48877
48883
|
}
|
|
48878
48884
|
function deleteRunIdQueueKey(runId) {
|
|
48879
48885
|
const queueKey = runIdToQueueKey.get(runId);
|
|
48880
48886
|
runIdToQueueKey.delete(runId);
|
|
48887
|
+
locallyDispatchedRunIds.delete(runId);
|
|
48881
48888
|
return queueKey;
|
|
48882
48889
|
}
|
|
48883
48890
|
function syncRunningTurnQueueKeys(turns, queueKey) {
|
|
@@ -48900,39 +48907,11 @@ async function dispatchStartedPromptQueueRuns(entries, started, deps) {
|
|
|
48900
48907
|
|
|
48901
48908
|
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
48902
48909
|
init_yield_to_event_loop();
|
|
48903
|
-
|
|
48904
|
-
// src/prompt-turn-queue/client-report.ts
|
|
48905
|
-
function sendPromptQueueClientReport(ws, queues) {
|
|
48906
|
-
if (!ws) return false;
|
|
48907
|
-
const wireQueues = {};
|
|
48908
|
-
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
48909
|
-
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
48910
|
-
}
|
|
48911
|
-
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
48912
|
-
return true;
|
|
48913
|
-
}
|
|
48914
|
-
|
|
48915
|
-
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
48916
|
-
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
48917
|
-
if (!runId) return false;
|
|
48918
|
-
const queueKey = deleteRunIdQueueKey(runId);
|
|
48919
|
-
if (!queueKey) return false;
|
|
48920
|
-
const f = await readPersistedQueue(queueKey);
|
|
48921
|
-
if (!f) return false;
|
|
48922
|
-
const t = f.turns.find((x) => x.turnId === runId);
|
|
48923
|
-
if (!t) return false;
|
|
48924
|
-
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
48925
|
-
await writePersistedQueue(f);
|
|
48926
|
-
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
48927
|
-
return true;
|
|
48928
|
-
}
|
|
48929
|
-
|
|
48930
|
-
// src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
|
|
48931
48910
|
async function handlePromptQueueCancellations(entries, deps) {
|
|
48932
48911
|
for (const [queueKey] of entries) {
|
|
48933
48912
|
const file2 = await readPersistedQueue(queueKey);
|
|
48934
48913
|
const turn = file2?.turns.find((row) => row.bridgeServerState === "cancel_requested" && row.lastCliState === "running");
|
|
48935
|
-
if (!turn) {
|
|
48914
|
+
if (!turn || getRunIdQueueKey(turn.turnId) !== queueKey || !isLocallyDispatchedRun(turn.turnId)) {
|
|
48936
48915
|
await yieldToEventLoop();
|
|
48937
48916
|
continue;
|
|
48938
48917
|
}
|
|
@@ -48941,19 +48920,7 @@ async function handlePromptQueueCancellations(entries, deps) {
|
|
|
48941
48920
|
await yieldToEventLoop();
|
|
48942
48921
|
continue;
|
|
48943
48922
|
}
|
|
48944
|
-
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026
|
|
48945
|
-
await finalizePromptTurnOnBridge(deps.getWs, turn.turnId, false, { terminalCliState: "cancelled" });
|
|
48946
|
-
const ws = deps.getWs();
|
|
48947
|
-
if (ws && turn.sessionId) {
|
|
48948
|
-
sendWsMessage(ws, {
|
|
48949
|
-
type: "prompt_result",
|
|
48950
|
-
sessionId: turn.sessionId,
|
|
48951
|
-
runId: turn.turnId,
|
|
48952
|
-
success: false,
|
|
48953
|
-
error: "Stopped by user",
|
|
48954
|
-
stopReason: "cancelled"
|
|
48955
|
-
});
|
|
48956
|
-
}
|
|
48923
|
+
deps.log(`[Queue] cancel_requested for ${turn.turnId.slice(0, 8)}\u2026 but no local ACP run remains.`);
|
|
48957
48924
|
await yieldToEventLoop();
|
|
48958
48925
|
}
|
|
48959
48926
|
}
|
|
@@ -48981,6 +48948,17 @@ function promptQueueSnapshotEntries(queues) {
|
|
|
48981
48948
|
// src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
|
|
48982
48949
|
init_yield_to_event_loop();
|
|
48983
48950
|
|
|
48951
|
+
// src/prompt-turn-queue/client-report.ts
|
|
48952
|
+
function sendPromptQueueClientReport(ws, queues) {
|
|
48953
|
+
if (!ws) return false;
|
|
48954
|
+
const wireQueues = {};
|
|
48955
|
+
for (const [queueKey, rows] of Object.entries(queues)) {
|
|
48956
|
+
wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
|
|
48957
|
+
}
|
|
48958
|
+
sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
|
|
48959
|
+
return true;
|
|
48960
|
+
}
|
|
48961
|
+
|
|
48984
48962
|
// src/prompt-turn-queue/runner/queue-selection.ts
|
|
48985
48963
|
function pickNextRunnableTurn(turns) {
|
|
48986
48964
|
for (const t of turns) {
|
|
@@ -49154,6 +49132,21 @@ async function applyPromptQueueStateFromServer(msg, deps) {
|
|
|
49154
49132
|
await dispatchStartedPromptQueueRuns(entries, started, deps);
|
|
49155
49133
|
}
|
|
49156
49134
|
|
|
49135
|
+
// src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
|
|
49136
|
+
async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
|
|
49137
|
+
if (!runId) return false;
|
|
49138
|
+
const queueKey = deleteRunIdQueueKey(runId);
|
|
49139
|
+
if (!queueKey) return false;
|
|
49140
|
+
const f = await readPersistedQueue(queueKey);
|
|
49141
|
+
if (!f) return false;
|
|
49142
|
+
const t = f.turns.find((x) => x.turnId === runId);
|
|
49143
|
+
if (!t) return false;
|
|
49144
|
+
t.lastCliState = opts?.terminalCliState ?? (success2 ? "stopped" : "failed");
|
|
49145
|
+
await writePersistedQueue(f);
|
|
49146
|
+
sendPromptQueueClientReport(getWs(), { [queueKey]: [{ turnId: runId, cliState: t.lastCliState }] });
|
|
49147
|
+
return true;
|
|
49148
|
+
}
|
|
49149
|
+
|
|
49157
49150
|
// src/agents/acp/from-bridge/bridge-prompt-wiring.ts
|
|
49158
49151
|
function createBridgePromptSenders(deps, getWs) {
|
|
49159
49152
|
const sendBridgeMessage = (message, encryptedFields = []) => {
|