@buildautomaton/cli 0.1.41 → 0.1.42
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 +3 -67
- package/dist/cli.js.map +3 -3
- package/dist/index.js +3 -67
- package/dist/index.js.map +3 -3
- 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.42".length > 0 ? "0.1.42" : "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";
|
|
@@ -27435,18 +27435,6 @@ async function closeBridgeConnection(state, acpManager, devServerManager, log2)
|
|
|
27435
27435
|
say("Shutdown complete.");
|
|
27436
27436
|
}
|
|
27437
27437
|
|
|
27438
|
-
// src/agents/acp/acp-idle-disconnect-ms.ts
|
|
27439
|
-
var DEFAULT_ACP_IDLE_DISCONNECT_MS = 10 * 60 * 1e3;
|
|
27440
|
-
function resolveAcpIdleDisconnectMs() {
|
|
27441
|
-
const raw = process.env.BUILDAUTOMATON_ACP_IDLE_DISCONNECT_MS;
|
|
27442
|
-
if (raw === "0") return 0;
|
|
27443
|
-
if (raw != null && raw.trim() !== "") {
|
|
27444
|
-
const parsed = Number(raw);
|
|
27445
|
-
if (Number.isFinite(parsed) && parsed >= 0) return parsed;
|
|
27446
|
-
}
|
|
27447
|
-
return DEFAULT_ACP_IDLE_DISCONNECT_MS;
|
|
27448
|
-
}
|
|
27449
|
-
|
|
27450
27438
|
// src/agents/acp/acp-prompt-routing-registry.ts
|
|
27451
27439
|
var AcpPromptRoutingRegistry = class {
|
|
27452
27440
|
runs = /* @__PURE__ */ new Map();
|
|
@@ -27496,9 +27484,7 @@ function createAcpManagerContext(options) {
|
|
|
27496
27484
|
acpAgents: /* @__PURE__ */ new Map(),
|
|
27497
27485
|
promptRouting: new AcpPromptRoutingRegistry(),
|
|
27498
27486
|
runDispatch: /* @__PURE__ */ new Map(),
|
|
27499
|
-
pendingCancelRunIds: /* @__PURE__ */ new Set()
|
|
27500
|
-
idleDisconnectTimers: /* @__PURE__ */ new Map(),
|
|
27501
|
-
idleDisconnectMs: options.idleDisconnectMs
|
|
27487
|
+
pendingCancelRunIds: /* @__PURE__ */ new Set()
|
|
27502
27488
|
};
|
|
27503
27489
|
}
|
|
27504
27490
|
|
|
@@ -30846,55 +30832,8 @@ async function ensureAcpClient(options) {
|
|
|
30846
30832
|
return state.acpStartPromise;
|
|
30847
30833
|
}
|
|
30848
30834
|
|
|
30849
|
-
// src/agents/acp/manager/idle-disconnect.ts
|
|
30850
|
-
function hasActiveWorkForAcpAgent(ctx, acpAgentKey) {
|
|
30851
|
-
if (ctx.promptRouting.getStreamingRunId(acpAgentKey)) return true;
|
|
30852
|
-
for (const meta of ctx.runDispatch.values()) {
|
|
30853
|
-
if (meta.acpAgentKey === acpAgentKey) return true;
|
|
30854
|
-
}
|
|
30855
|
-
return false;
|
|
30856
|
-
}
|
|
30857
|
-
function clearIdleDisconnectTimer(ctx, acpAgentKey) {
|
|
30858
|
-
const timer = ctx.idleDisconnectTimers.get(acpAgentKey);
|
|
30859
|
-
if (timer == null) return;
|
|
30860
|
-
clearTimeout(timer);
|
|
30861
|
-
ctx.idleDisconnectTimers.delete(acpAgentKey);
|
|
30862
|
-
}
|
|
30863
|
-
function disconnectIdleAcpAgent(ctx, acpAgentKey) {
|
|
30864
|
-
clearIdleDisconnectTimer(ctx, acpAgentKey);
|
|
30865
|
-
if (hasActiveWorkForAcpAgent(ctx, acpAgentKey)) return;
|
|
30866
|
-
const state = ctx.acpAgents.get(acpAgentKey);
|
|
30867
|
-
if (!state?.acpHandle && !state?.acpStartPromise) {
|
|
30868
|
-
ctx.acpAgents.delete(acpAgentKey);
|
|
30869
|
-
return;
|
|
30870
|
-
}
|
|
30871
|
-
const handle = state.acpHandle;
|
|
30872
|
-
void (async () => {
|
|
30873
|
-
try {
|
|
30874
|
-
await handle?.disconnectGracefully();
|
|
30875
|
-
} catch {
|
|
30876
|
-
}
|
|
30877
|
-
invalidateAcpClientState(state);
|
|
30878
|
-
ctx.acpAgents.delete(acpAgentKey);
|
|
30879
|
-
logDebug(`[Agent] Idle disconnect (${acpAgentKey.split("::")[0] ?? acpAgentKey})`);
|
|
30880
|
-
})();
|
|
30881
|
-
}
|
|
30882
|
-
function scheduleIdleDisconnect(ctx, acpAgentKey) {
|
|
30883
|
-
if (ctx.idleDisconnectMs <= 0) return;
|
|
30884
|
-
clearIdleDisconnectTimer(ctx, acpAgentKey);
|
|
30885
|
-
const timer = setTimeout(() => {
|
|
30886
|
-
ctx.idleDisconnectTimers.delete(acpAgentKey);
|
|
30887
|
-
disconnectIdleAcpAgent(ctx, acpAgentKey);
|
|
30888
|
-
}, ctx.idleDisconnectMs);
|
|
30889
|
-
timer.unref?.();
|
|
30890
|
-
ctx.idleDisconnectTimers.set(acpAgentKey, timer);
|
|
30891
|
-
}
|
|
30892
|
-
|
|
30893
30835
|
// src/agents/acp/manager/disconnect-all.ts
|
|
30894
30836
|
async function disconnectAll(ctx) {
|
|
30895
|
-
for (const acpAgentKey of ctx.idleDisconnectTimers.keys()) {
|
|
30896
|
-
clearIdleDisconnectTimer(ctx, acpAgentKey);
|
|
30897
|
-
}
|
|
30898
30837
|
await Promise.all(
|
|
30899
30838
|
[...ctx.acpAgents.values()].map(async (state) => {
|
|
30900
30839
|
try {
|
|
@@ -36205,7 +36144,6 @@ function handlePrompt(ctx, opts) {
|
|
|
36205
36144
|
}
|
|
36206
36145
|
const activeAcpAgentKey = acpAgentKey;
|
|
36207
36146
|
ctx.pendingCancelRunIds.delete(activeRunId);
|
|
36208
|
-
clearIdleDisconnectTimer(ctx, activeAcpAgentKey);
|
|
36209
36147
|
ctx.promptRouting.registerRun({ sessionId, runId: activeRunId });
|
|
36210
36148
|
ctx.runDispatch.set(activeRunId, { acpAgentKey: activeAcpAgentKey });
|
|
36211
36149
|
async function run() {
|
|
@@ -36288,7 +36226,6 @@ function handlePrompt(ctx, opts) {
|
|
|
36288
36226
|
ctx.promptRouting.unregisterRun(activeRunId);
|
|
36289
36227
|
ctx.runDispatch.delete(activeRunId);
|
|
36290
36228
|
ctx.pendingCancelRunIds.delete(activeRunId);
|
|
36291
|
-
scheduleIdleDisconnect(ctx, activeAcpAgentKey);
|
|
36292
36229
|
});
|
|
36293
36230
|
}
|
|
36294
36231
|
|
|
@@ -36306,8 +36243,7 @@ function logPromptReceivedFromBridge(ctx, opts) {
|
|
|
36306
36243
|
async function createAcpManager(options) {
|
|
36307
36244
|
const ctx = createAcpManagerContext({
|
|
36308
36245
|
log: options.log,
|
|
36309
|
-
reportAgentCapabilities: options.reportAgentCapabilities
|
|
36310
|
-
idleDisconnectMs: resolveAcpIdleDisconnectMs()
|
|
36246
|
+
reportAgentCapabilities: options.reportAgentCapabilities
|
|
36311
36247
|
});
|
|
36312
36248
|
return {
|
|
36313
36249
|
setPreferredAgentType(agentType) {
|