@sideboard-ai/core 0.1.309 → 0.1.311
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/agents/cursor-runner.js +1 -1
- package/dist/{agents-LK6JGQRF.js → agents-QIIZYNOM.js} +1 -1
- package/dist/{agents-DG2UPJ6N.js → agents-XXXRQJJO.js} +2 -2
- package/dist/{chunk-M6PAT6HG.js → chunk-2ER7DQJP.js} +45 -5
- package/dist/{chunk-FMSLOWKR.js → chunk-4YBQBVYL.js} +1 -1
- package/dist/{chunk-OU5V56OI.js → chunk-7ORMOP3D.js} +43 -3
- package/dist/{chunk-VXI7FFGO.js → chunk-GQJOLTZU.js} +40 -18
- package/dist/{chunk-VBVSJUM2.js → chunk-QC2TQMPJ.js} +31 -20
- package/dist/{chunk-UA3YKQ3D.js → chunk-Y3Y7SZBZ.js} +46 -15
- package/dist/{chunk-AILQRQ26.js → chunk-ZW7RSQHY.js} +25 -9
- package/dist/{conductor-AMZ5SKG2.js → conductor-CTWR6NH4.js} +1 -1
- package/dist/{conductor-OFXA5BST.js → conductor-YOBSYPLT.js} +1 -1
- package/dist/index.cjs +320 -207
- package/dist/index.d.cts +71 -21
- package/dist/index.d.ts +71 -21
- package/dist/index.js +54 -22
- package/dist/mcp/run-stdio.cjs +104 -29
- package/dist/mcp/run-stdio.js +5 -12
- package/dist/{orchestrator-T76JRIIN.js → orchestrator-2CCFGYAA.js} +4 -4
- package/dist/{orchestrator-4OIMDLIR.js → orchestrator-3W5S6TNP.js} +3 -3
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
planModeTurnInstruction,
|
|
38
38
|
resolveCursorModelId,
|
|
39
39
|
resolveQuotaFallbackAgent
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4YBQBVYL.js";
|
|
41
41
|
import "./chunk-VEVFHO6K.js";
|
|
42
42
|
import "./chunk-7Q327QF2.js";
|
|
43
43
|
import {
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
preferredCursorCostCents,
|
|
68
68
|
resolveCursorSdkRoot,
|
|
69
69
|
turnCostUsdFromCursorUsage
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-Y3Y7SZBZ.js";
|
|
71
71
|
import "./chunk-5XNT6BCG.js";
|
|
72
72
|
import "./chunk-6K64FJDD.js";
|
|
73
73
|
import "./chunk-LG6RJBIY.js";
|
|
@@ -14,10 +14,11 @@ import {
|
|
|
14
14
|
parseSessionQuotaResetAt,
|
|
15
15
|
planModeTurnInstruction,
|
|
16
16
|
resolveQuotaFallbackAgent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4YBQBVYL.js";
|
|
18
18
|
import {
|
|
19
19
|
REVIEW_TAB_TITLE,
|
|
20
20
|
applyWorktreePkgCacheEnv,
|
|
21
|
+
askBlockStillWaiting,
|
|
21
22
|
buildBrightsySessionSeed,
|
|
22
23
|
buildForkTranscriptAttachment,
|
|
23
24
|
buildSessionSeed,
|
|
@@ -55,7 +56,7 @@ import {
|
|
|
55
56
|
worktreeDevProcessKey,
|
|
56
57
|
worktreeRunProcessKey,
|
|
57
58
|
worktreeSetupProcessKey
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-QC2TQMPJ.js";
|
|
59
60
|
import {
|
|
60
61
|
applyAgentEvent,
|
|
61
62
|
clipAgentEventForPaint,
|
|
@@ -181,7 +182,7 @@ import {
|
|
|
181
182
|
import {
|
|
182
183
|
applyAgentRunnerHeapEnv,
|
|
183
184
|
packagedMcpDir
|
|
184
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-Y3Y7SZBZ.js";
|
|
185
186
|
import {
|
|
186
187
|
fallbackTurnFailDetail,
|
|
187
188
|
formatAgentErrorContinuePrompt,
|
|
@@ -1643,6 +1644,11 @@ function visibleAgentBlock(thread) {
|
|
|
1643
1644
|
const block = thread.agentBlock;
|
|
1644
1645
|
if (!block?.reason?.trim()) return null;
|
|
1645
1646
|
if (isDismissedAskUserBlock(block, thread.dismissedQuestionSignature)) return null;
|
|
1647
|
+
if (block.source === "ask_user") {
|
|
1648
|
+
const inFlight = thread.status === "running" || thread.status === "queued";
|
|
1649
|
+
if (inFlight && !block.onScreen) return null;
|
|
1650
|
+
if (!askBlockStillWaiting(block, thread.messages)) return null;
|
|
1651
|
+
}
|
|
1646
1652
|
return block;
|
|
1647
1653
|
}
|
|
1648
1654
|
function worktreeAgentBlock(group) {
|
|
@@ -1817,6 +1823,7 @@ function decisionBlockFromParts(parts, planMode, at = (/* @__PURE__ */ new Date(
|
|
|
1817
1823
|
const reason = pending ? formatAskUserNotifyMessage(pending.questions) : "Waiting for an answer in that chat.";
|
|
1818
1824
|
return {
|
|
1819
1825
|
...makeAgentBlock("ask_user", reason, at),
|
|
1826
|
+
onScreen: true,
|
|
1820
1827
|
...pending ? { questionSignature: pending.signature, questions: pending.questions } : {}
|
|
1821
1828
|
};
|
|
1822
1829
|
}
|
|
@@ -1874,6 +1881,38 @@ function dismissAskUserQuestion(threadId, signature) {
|
|
|
1874
1881
|
...clearBlock ? { agentBlock: null } : {}
|
|
1875
1882
|
});
|
|
1876
1883
|
}
|
|
1884
|
+
function askBlocksEqual(a, b) {
|
|
1885
|
+
if (a === b) return true;
|
|
1886
|
+
if (!a || !b) return false;
|
|
1887
|
+
return a.source === b.source && a.reason === b.reason && a.at === b.at && a.onScreen === b.onScreen && a.questionSignature === b.questionSignature;
|
|
1888
|
+
}
|
|
1889
|
+
function askBlockAfterLiveParts(existing, parts) {
|
|
1890
|
+
const last = lastTopLevelTool(parts);
|
|
1891
|
+
if (last?.type === "tool" && isAskUserToolName(last.name)) {
|
|
1892
|
+
if (existing?.source === "ask_user" && existing.onScreen) return existing;
|
|
1893
|
+
const pending = extractPendingPlanQuestions(parts);
|
|
1894
|
+
const questions = pending?.questions ?? existing?.questions;
|
|
1895
|
+
if (!questions?.length) {
|
|
1896
|
+
return existing?.source === "ask_user" ? { ...existing, onScreen: true } : existing ?? null;
|
|
1897
|
+
}
|
|
1898
|
+
const at = existing?.source === "ask_user" ? existing.at : void 0;
|
|
1899
|
+
return {
|
|
1900
|
+
...makeAgentBlock("ask_user", formatAskUserNotifyMessage(questions), at),
|
|
1901
|
+
onScreen: true,
|
|
1902
|
+
questionSignature: pending?.signature ?? existing?.questionSignature,
|
|
1903
|
+
questions
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
if (last && existing?.source === "ask_user") return null;
|
|
1907
|
+
return existing ?? null;
|
|
1908
|
+
}
|
|
1909
|
+
function syncAskUserBlockFromLive(threadId, parts) {
|
|
1910
|
+
const thread = readThread(threadId);
|
|
1911
|
+
if (!thread || thread.status === "archived") return;
|
|
1912
|
+
const next = askBlockAfterLiveParts(thread.agentBlock, parts);
|
|
1913
|
+
if (askBlocksEqual(thread.agentBlock, next)) return;
|
|
1914
|
+
updateThread(threadId, { agentBlock: next });
|
|
1915
|
+
}
|
|
1877
1916
|
function writeAgentBlock(threadId, block) {
|
|
1878
1917
|
const thread = readThread(threadId);
|
|
1879
1918
|
if (!thread || thread.status === "archived") return;
|
|
@@ -3027,7 +3066,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3027
3066
|
return readThread(thread.id) ?? thread;
|
|
3028
3067
|
}
|
|
3029
3068
|
async function listLinearIssues(agent, repoPath) {
|
|
3030
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
3069
|
+
const { getAdapter: getAdapter2 } = await import("./agents-XXXRQJJO.js");
|
|
3031
3070
|
await requireAgent(agent, { requireLinear: true });
|
|
3032
3071
|
const adapter = getAdapter2(agent);
|
|
3033
3072
|
if (!adapter.listLinearIssues) {
|
|
@@ -3419,6 +3458,7 @@ function noteTurnLiveEvent(threadId, event) {
|
|
|
3419
3458
|
const prev = buffers.get(threadId) ?? { parts: [], timer: null };
|
|
3420
3459
|
prev.parts = trimParts(applyAgentEvent(prev.parts, event));
|
|
3421
3460
|
buffers.set(threadId, prev);
|
|
3461
|
+
syncAskUserBlockFromLive(threadId, prev.parts);
|
|
3422
3462
|
if (event.type === "exit") {
|
|
3423
3463
|
flush(threadId);
|
|
3424
3464
|
const cur = buffers.get(threadId);
|
|
@@ -6741,7 +6781,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6741
6781
|
${prompt}`;
|
|
6742
6782
|
}
|
|
6743
6783
|
async function defaultDeps() {
|
|
6744
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6784
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-2CCFGYAA.js");
|
|
6745
6785
|
const orch = getOrchestrator2();
|
|
6746
6786
|
return {
|
|
6747
6787
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -27,10 +27,11 @@ import {
|
|
|
27
27
|
parseSessionQuotaResetAt,
|
|
28
28
|
planModeTurnInstruction,
|
|
29
29
|
resolveQuotaFallbackAgent
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GQJOLTZU.js";
|
|
31
31
|
import {
|
|
32
32
|
REVIEW_TAB_TITLE,
|
|
33
33
|
applyWorktreePkgCacheEnv,
|
|
34
|
+
askBlockStillWaiting,
|
|
34
35
|
buildBrightsySessionSeed,
|
|
35
36
|
buildForkTranscriptAttachment,
|
|
36
37
|
buildSessionSeed,
|
|
@@ -68,7 +69,7 @@ import {
|
|
|
68
69
|
worktreeDevProcessKey,
|
|
69
70
|
worktreeRunProcessKey,
|
|
70
71
|
worktreeSetupProcessKey
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-ZW7RSQHY.js";
|
|
72
73
|
import {
|
|
73
74
|
applyAgentEvent,
|
|
74
75
|
clipAgentEventForPaint,
|
|
@@ -1546,6 +1547,11 @@ function visibleAgentBlock(thread) {
|
|
|
1546
1547
|
const block = thread.agentBlock;
|
|
1547
1548
|
if (!block?.reason?.trim()) return null;
|
|
1548
1549
|
if (isDismissedAskUserBlock(block, thread.dismissedQuestionSignature)) return null;
|
|
1550
|
+
if (block.source === "ask_user") {
|
|
1551
|
+
const inFlight = thread.status === "running" || thread.status === "queued";
|
|
1552
|
+
if (inFlight && !block.onScreen) return null;
|
|
1553
|
+
if (!askBlockStillWaiting(block, thread.messages)) return null;
|
|
1554
|
+
}
|
|
1549
1555
|
return block;
|
|
1550
1556
|
}
|
|
1551
1557
|
function worktreeAgentBlock(group) {
|
|
@@ -1703,6 +1709,7 @@ function decisionBlockFromParts(parts, planMode, at = (/* @__PURE__ */ new Date(
|
|
|
1703
1709
|
const reason = pending ? formatAskUserNotifyMessage(pending.questions) : "Waiting for an answer in that chat.";
|
|
1704
1710
|
return {
|
|
1705
1711
|
...makeAgentBlock("ask_user", reason, at),
|
|
1712
|
+
onScreen: true,
|
|
1706
1713
|
...pending ? { questionSignature: pending.signature, questions: pending.questions } : {}
|
|
1707
1714
|
};
|
|
1708
1715
|
}
|
|
@@ -1760,6 +1767,38 @@ function dismissAskUserQuestion(threadId, signature) {
|
|
|
1760
1767
|
...clearBlock ? { agentBlock: null } : {}
|
|
1761
1768
|
});
|
|
1762
1769
|
}
|
|
1770
|
+
function askBlocksEqual(a, b) {
|
|
1771
|
+
if (a === b) return true;
|
|
1772
|
+
if (!a || !b) return false;
|
|
1773
|
+
return a.source === b.source && a.reason === b.reason && a.at === b.at && a.onScreen === b.onScreen && a.questionSignature === b.questionSignature;
|
|
1774
|
+
}
|
|
1775
|
+
function askBlockAfterLiveParts(existing, parts) {
|
|
1776
|
+
const last = lastTopLevelTool(parts);
|
|
1777
|
+
if (last?.type === "tool" && isAskUserToolName(last.name)) {
|
|
1778
|
+
if (existing?.source === "ask_user" && existing.onScreen) return existing;
|
|
1779
|
+
const pending = extractPendingPlanQuestions(parts);
|
|
1780
|
+
const questions = pending?.questions ?? existing?.questions;
|
|
1781
|
+
if (!questions?.length) {
|
|
1782
|
+
return existing?.source === "ask_user" ? { ...existing, onScreen: true } : existing ?? null;
|
|
1783
|
+
}
|
|
1784
|
+
const at = existing?.source === "ask_user" ? existing.at : void 0;
|
|
1785
|
+
return {
|
|
1786
|
+
...makeAgentBlock("ask_user", formatAskUserNotifyMessage(questions), at),
|
|
1787
|
+
onScreen: true,
|
|
1788
|
+
questionSignature: pending?.signature ?? existing?.questionSignature,
|
|
1789
|
+
questions
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
if (last && existing?.source === "ask_user") return null;
|
|
1793
|
+
return existing ?? null;
|
|
1794
|
+
}
|
|
1795
|
+
function syncAskUserBlockFromLive(threadId, parts) {
|
|
1796
|
+
const thread = readThread(threadId);
|
|
1797
|
+
if (!thread || thread.status === "archived") return;
|
|
1798
|
+
const next = askBlockAfterLiveParts(thread.agentBlock, parts);
|
|
1799
|
+
if (askBlocksEqual(thread.agentBlock, next)) return;
|
|
1800
|
+
updateThread(threadId, { agentBlock: next });
|
|
1801
|
+
}
|
|
1763
1802
|
function writeAgentBlock(threadId, block) {
|
|
1764
1803
|
const thread = readThread(threadId);
|
|
1765
1804
|
if (!thread || thread.status === "archived") return;
|
|
@@ -3117,6 +3156,7 @@ function noteTurnLiveEvent(threadId, event) {
|
|
|
3117
3156
|
const prev = buffers.get(threadId) ?? { parts: [], timer: null };
|
|
3118
3157
|
prev.parts = trimParts(applyAgentEvent(prev.parts, event));
|
|
3119
3158
|
buffers.set(threadId, prev);
|
|
3159
|
+
syncAskUserBlockFromLive(threadId, prev.parts);
|
|
3120
3160
|
if (event.type === "exit") {
|
|
3121
3161
|
flush(threadId);
|
|
3122
3162
|
const cur = buffers.get(threadId);
|
|
@@ -6389,7 +6429,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6389
6429
|
${prompt}`;
|
|
6390
6430
|
}
|
|
6391
6431
|
async function defaultDeps() {
|
|
6392
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6432
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-3W5S6TNP.js");
|
|
6393
6433
|
const orch = getOrchestrator2();
|
|
6394
6434
|
return {
|
|
6395
6435
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -881,31 +881,55 @@ function applySystemCaEnv(env) {
|
|
|
881
881
|
const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
882
882
|
if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
|
|
883
883
|
}
|
|
884
|
-
function extraCertsFromBundle() {
|
|
884
|
+
function extraCertsFromBundle(io = {}) {
|
|
885
885
|
const path = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
886
886
|
if (path) return splitPemCertificates(readExistingFile(path));
|
|
887
|
-
|
|
888
|
-
|
|
887
|
+
return splitPemCertificates(readExistingFile(systemCaBundlePath(io)));
|
|
888
|
+
}
|
|
889
|
+
function extraSystemCaPems(io = {}) {
|
|
890
|
+
const fromBundle = extraCertsFromBundle(io);
|
|
891
|
+
if (fromBundle.length > 0) return fromBundle;
|
|
892
|
+
return splitPemCertificates(collectSystemCaPem(io));
|
|
893
|
+
}
|
|
894
|
+
function mergeSystemCaIntoTlsOptions(options, extra, roots = tls.rootCertificates) {
|
|
895
|
+
const existing = options?.ca;
|
|
896
|
+
const base = existing == null ? [...roots] : Array.isArray(existing) ? [...existing] : [existing];
|
|
897
|
+
return { ...options, ca: [...base, ...extra] };
|
|
898
|
+
}
|
|
899
|
+
function installCreateSecureContextCaPatch(api, extra) {
|
|
900
|
+
if (api.__sideboardSystemCaPatched) return true;
|
|
901
|
+
if (typeof api.createSecureContext !== "function") return false;
|
|
902
|
+
const orig = api.createSecureContext;
|
|
903
|
+
const roots = api.rootCertificates ?? tls.rootCertificates;
|
|
904
|
+
api.createSecureContext = ((options) => orig(mergeSystemCaIntoTlsOptions(options, extra, roots)));
|
|
905
|
+
api.__sideboardSystemCaPatched = true;
|
|
906
|
+
return true;
|
|
889
907
|
}
|
|
890
908
|
function trustSystemCertificates(io = {}) {
|
|
891
909
|
try {
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
extra = splitPemCertificates(collectSystemCaPem(io));
|
|
910
|
+
const extra = extraSystemCaPems(io);
|
|
911
|
+
const api = io.tls ?? tls;
|
|
912
|
+
if (typeof api.getCACertificates === "function" && typeof api.setDefaultCACertificates === "function") {
|
|
913
|
+
const current = api.getCACertificates("default");
|
|
914
|
+
const system = api.getCACertificates("system");
|
|
915
|
+
if (system.length === 0 && extra.length === 0) return false;
|
|
916
|
+
api.setDefaultCACertificates([...current, ...system, ...extra]);
|
|
917
|
+
return true;
|
|
901
918
|
}
|
|
902
|
-
if (
|
|
903
|
-
api
|
|
904
|
-
return true;
|
|
919
|
+
if (extra.length === 0) return false;
|
|
920
|
+
return installCreateSecureContextCaPatch(api, extra);
|
|
905
921
|
} catch {
|
|
906
922
|
return false;
|
|
907
923
|
}
|
|
908
924
|
}
|
|
925
|
+
function bootstrapSystemCa(io = {}) {
|
|
926
|
+
const systemCaBundle = materializeSystemCaBundle(io);
|
|
927
|
+
if (systemCaBundle && !process.env.NODE_EXTRA_CA_CERTS?.trim()) {
|
|
928
|
+
process.env.NODE_EXTRA_CA_CERTS = systemCaBundle;
|
|
929
|
+
}
|
|
930
|
+
applySystemCaEnv(process.env);
|
|
931
|
+
trustSystemCertificates(io);
|
|
932
|
+
}
|
|
909
933
|
|
|
910
934
|
// src/agents/packaged-runtime.ts
|
|
911
935
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -4521,9 +4545,7 @@ function allAdapters() {
|
|
|
4521
4545
|
}
|
|
4522
4546
|
|
|
4523
4547
|
export {
|
|
4524
|
-
|
|
4525
|
-
applySystemCaEnv,
|
|
4526
|
-
trustSystemCertificates,
|
|
4548
|
+
bootstrapSystemCa,
|
|
4527
4549
|
encodeBrightsyTarget,
|
|
4528
4550
|
decodeBrightsyTarget,
|
|
4529
4551
|
parseBrightsyCliLine,
|
|
@@ -1288,6 +1288,19 @@ function isAskUserToolName(name) {
|
|
|
1288
1288
|
const base = name.replace(/^mcp__sideboard__/i, "");
|
|
1289
1289
|
return ASK_USER_TOOL_RE.test(name) || /^ask_user$/i.test(base);
|
|
1290
1290
|
}
|
|
1291
|
+
function lastTopLevelToolIsAskUser(parts) {
|
|
1292
|
+
if (!parts?.length) return false;
|
|
1293
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
|
1294
|
+
const part = parts[i];
|
|
1295
|
+
if (part.type === "tool" && !part.parentId) {
|
|
1296
|
+
return isAskUserToolName(part.name);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
function hasTopLevelTool(parts) {
|
|
1302
|
+
return Boolean(parts?.some((part) => part.type === "tool" && !part.parentId));
|
|
1303
|
+
}
|
|
1291
1304
|
function questionsFromToolPart(part) {
|
|
1292
1305
|
const fromInput = parsePlanQuestionsInput(part.input);
|
|
1293
1306
|
if (fromInput.length) return fromInput;
|
|
@@ -1330,6 +1343,7 @@ function pendingFromAskBlock(block, dismissedQuestionSignature) {
|
|
|
1330
1343
|
};
|
|
1331
1344
|
}
|
|
1332
1345
|
function askBlockStillWaiting(block, messages) {
|
|
1346
|
+
if (!messages?.length) return Boolean(block?.at);
|
|
1333
1347
|
const askedAt = block?.at;
|
|
1334
1348
|
if (!askedAt) return false;
|
|
1335
1349
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -1342,19 +1356,21 @@ function askBlockStillWaiting(block, messages) {
|
|
|
1342
1356
|
}
|
|
1343
1357
|
function latestPendingPlanQuestions(input) {
|
|
1344
1358
|
if (input.userReplied) return null;
|
|
1345
|
-
const
|
|
1346
|
-
if (
|
|
1359
|
+
const fromBlock = () => pendingFromAskBlock(input.agentBlock, input.dismissedQuestionSignature);
|
|
1360
|
+
if (lastTopLevelToolIsAskUser(input.liveParts)) {
|
|
1361
|
+
return extractPendingPlanQuestions(input.liveParts) ?? fromBlock();
|
|
1362
|
+
}
|
|
1347
1363
|
const last = input.messages[input.messages.length - 1];
|
|
1348
|
-
if (last?.role === "agent") {
|
|
1349
|
-
|
|
1350
|
-
if (fromParts) return fromParts;
|
|
1364
|
+
if (last?.role === "agent" && lastTopLevelToolIsAskUser(last.parts)) {
|
|
1365
|
+
return extractPendingPlanQuestions(last.parts) ?? fromBlock();
|
|
1351
1366
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
);
|
|
1356
|
-
|
|
1357
|
-
|
|
1367
|
+
if (hasTopLevelTool(input.liveParts) || last?.role === "agent" && hasTopLevelTool(last.parts)) {
|
|
1368
|
+
return null;
|
|
1369
|
+
}
|
|
1370
|
+
if (input.status === "running" || input.status === "queued") return null;
|
|
1371
|
+
const stamped = fromBlock();
|
|
1372
|
+
if (stamped && askBlockStillWaiting(input.agentBlock, input.messages)) {
|
|
1373
|
+
return stamped;
|
|
1358
1374
|
}
|
|
1359
1375
|
return null;
|
|
1360
1376
|
}
|
|
@@ -1407,14 +1423,7 @@ function needsCoordinatorAction(state) {
|
|
|
1407
1423
|
return isIncompleteTaskState(state) || state === "input-required";
|
|
1408
1424
|
}
|
|
1409
1425
|
function endedOnAskUser(parts) {
|
|
1410
|
-
|
|
1411
|
-
for (let i = parts.length - 1; i >= 0; i--) {
|
|
1412
|
-
const p = parts[i];
|
|
1413
|
-
if (p.type === "tool" && !p.parentId) {
|
|
1414
|
-
return isAskUserToolName(p.name);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
return false;
|
|
1426
|
+
return lastTopLevelToolIsAskUser(parts);
|
|
1418
1427
|
}
|
|
1419
1428
|
function deriveTaskState(input) {
|
|
1420
1429
|
if (input.stillRunning) {
|
|
@@ -1823,7 +1832,7 @@ var PORT_RANGE_SIZE = 10;
|
|
|
1823
1832
|
var RECLAIM_RETRY_DELAY_MS = 40;
|
|
1824
1833
|
var RECLAIM_TRIES = 8;
|
|
1825
1834
|
async function killReclaimable(ports, worktreePath, signal) {
|
|
1826
|
-
const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-
|
|
1835
|
+
const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-YOBSYPLT.js");
|
|
1827
1836
|
if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
|
|
1828
1837
|
else killListenersOnPorts2(ports);
|
|
1829
1838
|
}
|
|
@@ -2507,7 +2516,9 @@ export {
|
|
|
2507
2516
|
planQuestionsSignature,
|
|
2508
2517
|
parsePlanQuestionsInput,
|
|
2509
2518
|
isAskUserToolName,
|
|
2519
|
+
lastTopLevelToolIsAskUser,
|
|
2510
2520
|
extractPendingPlanQuestions,
|
|
2521
|
+
askBlockStillWaiting,
|
|
2511
2522
|
latestPendingPlanQuestions,
|
|
2512
2523
|
PLAN_QUESTION_ANSWERS_PREFIX,
|
|
2513
2524
|
isPlanQuestionAnswersMessage,
|
|
@@ -113,31 +113,60 @@ function applySystemCaEnv(env) {
|
|
|
113
113
|
const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
114
114
|
if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
|
|
115
115
|
}
|
|
116
|
-
function extraCertsFromBundle() {
|
|
116
|
+
function extraCertsFromBundle(io = {}) {
|
|
117
117
|
const path = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
118
118
|
if (path) return splitPemCertificates(readExistingFile(path));
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
return splitPemCertificates(readExistingFile(systemCaBundlePath(io)));
|
|
120
|
+
}
|
|
121
|
+
function extraSystemCaPems(io = {}) {
|
|
122
|
+
const fromBundle = extraCertsFromBundle(io);
|
|
123
|
+
if (fromBundle.length > 0) return fromBundle;
|
|
124
|
+
return splitPemCertificates(collectSystemCaPem(io));
|
|
125
|
+
}
|
|
126
|
+
function mergeSystemCaIntoTlsOptions(options, extra, roots = tls.rootCertificates) {
|
|
127
|
+
const existing = options?.ca;
|
|
128
|
+
const base = existing == null ? [...roots] : Array.isArray(existing) ? [...existing] : [existing];
|
|
129
|
+
return { ...options, ca: [...base, ...extra] };
|
|
130
|
+
}
|
|
131
|
+
function systemCaTlsOptions(io = {}) {
|
|
132
|
+
const extra = extraSystemCaPems(io);
|
|
133
|
+
if (extra.length === 0) return {};
|
|
134
|
+
return { ca: [...tls.rootCertificates, ...extra] };
|
|
135
|
+
}
|
|
136
|
+
function installCreateSecureContextCaPatch(api, extra) {
|
|
137
|
+
if (api.__sideboardSystemCaPatched) return true;
|
|
138
|
+
if (typeof api.createSecureContext !== "function") return false;
|
|
139
|
+
const orig = api.createSecureContext;
|
|
140
|
+
const roots = api.rootCertificates ?? tls.rootCertificates;
|
|
141
|
+
api.createSecureContext = ((options) => orig(mergeSystemCaIntoTlsOptions(options, extra, roots)));
|
|
142
|
+
api.__sideboardSystemCaPatched = true;
|
|
143
|
+
return true;
|
|
121
144
|
}
|
|
122
145
|
function trustSystemCertificates(io = {}) {
|
|
123
146
|
try {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
147
|
+
const extra = extraSystemCaPems(io);
|
|
148
|
+
const api = io.tls ?? tls;
|
|
149
|
+
if (typeof api.getCACertificates === "function" && typeof api.setDefaultCACertificates === "function") {
|
|
150
|
+
const current = api.getCACertificates("default");
|
|
151
|
+
const system = api.getCACertificates("system");
|
|
152
|
+
if (system.length === 0 && extra.length === 0) return false;
|
|
153
|
+
api.setDefaultCACertificates([...current, ...system, ...extra]);
|
|
154
|
+
return true;
|
|
127
155
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let extra = extraCertsFromBundle();
|
|
131
|
-
if (system.length === 0 && extra.length === 0) {
|
|
132
|
-
extra = splitPemCertificates(collectSystemCaPem(io));
|
|
133
|
-
}
|
|
134
|
-
if (system.length === 0 && extra.length === 0) return false;
|
|
135
|
-
api.setDefaultCACertificates([...current, ...system, ...extra]);
|
|
136
|
-
return true;
|
|
156
|
+
if (extra.length === 0) return false;
|
|
157
|
+
return installCreateSecureContextCaPatch(api, extra);
|
|
137
158
|
} catch {
|
|
138
159
|
return false;
|
|
139
160
|
}
|
|
140
161
|
}
|
|
162
|
+
function bootstrapSystemCa(io = {}) {
|
|
163
|
+
const systemCaBundle = materializeSystemCaBundle(io);
|
|
164
|
+
if (systemCaBundle && !process.env.NODE_EXTRA_CA_CERTS?.trim()) {
|
|
165
|
+
process.env.NODE_EXTRA_CA_CERTS = systemCaBundle;
|
|
166
|
+
}
|
|
167
|
+
applySystemCaEnv(process.env);
|
|
168
|
+
trustSystemCertificates(io);
|
|
169
|
+
}
|
|
141
170
|
|
|
142
171
|
// src/agents/node-launch.ts
|
|
143
172
|
import { existsSync as existsSync3, readdirSync, realpathSync } from "fs";
|
|
@@ -878,7 +907,9 @@ function ensureCursorRipgrepPath(opts) {
|
|
|
878
907
|
export {
|
|
879
908
|
materializeSystemCaBundle,
|
|
880
909
|
applySystemCaEnv,
|
|
910
|
+
systemCaTlsOptions,
|
|
881
911
|
trustSystemCertificates,
|
|
912
|
+
bootstrapSystemCa,
|
|
882
913
|
packagedCursorRuntimeDir,
|
|
883
914
|
packagedCursorRunnerPath,
|
|
884
915
|
packagedMcpDir,
|
|
@@ -1235,6 +1235,16 @@ function isAskUserToolName(name) {
|
|
|
1235
1235
|
const base = name.replace(/^mcp__sideboard__/i, "");
|
|
1236
1236
|
return ASK_USER_TOOL_RE.test(name) || /^ask_user$/i.test(base);
|
|
1237
1237
|
}
|
|
1238
|
+
function lastTopLevelToolIsAskUser(parts) {
|
|
1239
|
+
if (!parts?.length) return false;
|
|
1240
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
|
1241
|
+
const part = parts[i];
|
|
1242
|
+
if (part.type === "tool" && !part.parentId) {
|
|
1243
|
+
return isAskUserToolName(part.name);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1238
1248
|
function questionsFromToolPart(part) {
|
|
1239
1249
|
const fromInput = parsePlanQuestionsInput(part.input);
|
|
1240
1250
|
if (fromInput.length) return fromInput;
|
|
@@ -1262,6 +1272,18 @@ function extractPendingPlanQuestions(parts) {
|
|
|
1262
1272
|
}
|
|
1263
1273
|
return null;
|
|
1264
1274
|
}
|
|
1275
|
+
function askBlockStillWaiting(block, messages) {
|
|
1276
|
+
if (!messages?.length) return Boolean(block?.at);
|
|
1277
|
+
const askedAt = block?.at;
|
|
1278
|
+
if (!askedAt) return false;
|
|
1279
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1280
|
+
const message = messages[i];
|
|
1281
|
+
if (message.role !== "user" || message.origin === "continue") continue;
|
|
1282
|
+
if (!message.ts) return true;
|
|
1283
|
+
return askedAt > message.ts;
|
|
1284
|
+
}
|
|
1285
|
+
return true;
|
|
1286
|
+
}
|
|
1265
1287
|
|
|
1266
1288
|
// src/orchestrator/task-state.ts
|
|
1267
1289
|
function isIncompleteTaskState(state) {
|
|
@@ -1271,14 +1293,7 @@ function needsCoordinatorAction(state) {
|
|
|
1271
1293
|
return isIncompleteTaskState(state) || state === "input-required";
|
|
1272
1294
|
}
|
|
1273
1295
|
function endedOnAskUser(parts) {
|
|
1274
|
-
|
|
1275
|
-
for (let i = parts.length - 1; i >= 0; i--) {
|
|
1276
|
-
const p = parts[i];
|
|
1277
|
-
if (p.type === "tool" && !p.parentId) {
|
|
1278
|
-
return isAskUserToolName(p.name);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
return false;
|
|
1296
|
+
return lastTopLevelToolIsAskUser(parts);
|
|
1282
1297
|
}
|
|
1283
1298
|
function deriveTaskState(input) {
|
|
1284
1299
|
if (input.stillRunning) {
|
|
@@ -1687,7 +1702,7 @@ var PORT_RANGE_SIZE = 10;
|
|
|
1687
1702
|
var RECLAIM_RETRY_DELAY_MS = 40;
|
|
1688
1703
|
var RECLAIM_TRIES = 8;
|
|
1689
1704
|
async function killReclaimable(ports, worktreePath, signal) {
|
|
1690
|
-
const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-
|
|
1705
|
+
const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-CTWR6NH4.js");
|
|
1691
1706
|
if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
|
|
1692
1707
|
else killListenersOnPorts2(ports);
|
|
1693
1708
|
}
|
|
@@ -2372,6 +2387,7 @@ export {
|
|
|
2372
2387
|
parsePlanQuestionsInput,
|
|
2373
2388
|
isAskUserToolName,
|
|
2374
2389
|
extractPendingPlanQuestions,
|
|
2390
|
+
askBlockStillWaiting,
|
|
2375
2391
|
needsCoordinatorAction,
|
|
2376
2392
|
deriveTaskState,
|
|
2377
2393
|
mcpWaitForTurnTimeoutMs,
|