@sideboard-ai/core 0.1.111 → 0.1.116
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.cjs +51 -21
- package/dist/agents/cursor-runner.js +3 -3
- package/dist/{agents-NN22A4G5.js → agents-7NIX44RB.js} +7 -7
- package/dist/{agents-GH3FWDW2.js → agents-DU7DHY7A.js} +10 -10
- package/dist/{chunk-JTQQPJAU.js → chunk-4HOFVKPC.js} +52 -38
- package/dist/{chunk-4EWPKYOU.js → chunk-4OJMZ6P2.js} +2 -2
- package/dist/{chunk-NC3U42ZP.js → chunk-5KSLD4MU.js} +317 -33
- package/dist/{chunk-KQBI5HNT.js → chunk-7WC5UWEB.js} +2 -2
- package/dist/{chunk-WIHKHR5R.js → chunk-AXQ4ZWHK.js} +5 -0
- package/dist/{chunk-LGXBYZZA.js → chunk-DVM4ID64.js} +69 -13
- package/dist/{chunk-DMJKOFTO.js → chunk-DWP25N32.js} +44 -35
- package/dist/{chunk-2GO3YKBA.js → chunk-EKIDHL2T.js} +4 -4
- package/dist/{chunk-C4KHDW3U.js → chunk-FZCIQYNQ.js} +1 -1
- package/dist/{chunk-363Z34PY.js → chunk-GBY7OOMB.js} +273 -218
- package/dist/{chunk-7KWYXGIU.js → chunk-K3TIQXOH.js} +2 -2
- package/dist/{chunk-3KETJKYA.js → chunk-KPIYENTF.js} +69 -13
- package/dist/{chunk-KVFNTWFG.js → chunk-OFF5AFCR.js} +300 -43
- package/dist/{chunk-VOD3HFLP.js → chunk-XOYQ7LNQ.js} +2 -2
- package/dist/{chunk-7YKXHBIW.js → chunk-YMRT2DU6.js} +3 -3
- package/dist/{chunk-YXDR43ZC.js → chunk-ZMROW673.js} +5 -5
- package/dist/{chunk-YFAXVUY2.js → chunk-ZRCX43LS.js} +2 -2
- package/dist/{chunk-AROMOP3C.js → chunk-ZYEFCSZJ.js} +2 -2
- package/dist/{connected-teams-M5XNXRI5.js → connected-teams-O6D4PM7A.js} +2 -2
- package/dist/{connected-teams-J4I5AKMR.js → connected-teams-ZCOU6KCD.js} +2 -2
- package/dist/{coordinator-prompt-AR66L3N4.js → coordinator-prompt-4KCALEKD.js} +3 -3
- package/dist/{coordinator-prompt-BHMLWL64.js → coordinator-prompt-FML4I5AR.js} +3 -3
- package/dist/{global-workspace-XSUFEIAQ.js → global-workspace-CSWABOG5.js} +4 -4
- package/dist/{global-workspace-SKFODUQQ.js → global-workspace-H4YNASM6.js} +4 -4
- package/dist/index.cjs +855 -440
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +37 -17
- package/dist/mcp/run-stdio.cjs +966 -635
- package/dist/mcp/run-stdio.js +20 -16
- package/dist/{orchestrator-4T2SXDZ7.js → orchestrator-NXPANCZA.js} +8 -8
- package/dist/{orchestrator-EP57AB5W.js → orchestrator-ZY4RUJKT.js} +10 -10
- package/dist/{run-XKTAJRWF.js → run-USF6FRKV.js} +3 -1
- package/dist/{run-CFKZPY7F.js → run-XQKGHQZ2.js} +3 -1
- package/dist/{workspaces-XAQVKTLO.js → workspaces-HJ3EVATC.js} +5 -5
- package/dist/{workspaces-HV3J4TTW.js → workspaces-QG6PGFQR.js} +5 -5
- package/dist/{worktree-XFJED3VU.js → worktree-IW3BX26B.js} +2 -2
- package/dist/{worktree-N2EV24EE.js → worktree-OTFQO2W7.js} +2 -2
- package/package.json +1 -1
|
@@ -6,16 +6,23 @@ import {
|
|
|
6
6
|
ensureCliTeamTracked,
|
|
7
7
|
ensureConnectedBrightsyTeamTokens,
|
|
8
8
|
loadBrightsyConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YMRT2DU6.js";
|
|
10
10
|
import {
|
|
11
11
|
isOrchestratorThread
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XOYQ7LNQ.js";
|
|
13
13
|
import {
|
|
14
14
|
codexUnattendedGitConfigArgs,
|
|
15
15
|
mergeAgentGitAuthEnv,
|
|
16
16
|
resolveAgentGitAuthEnv,
|
|
17
17
|
resolveCodexGitWritableRoots
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZMROW673.js";
|
|
19
|
+
import {
|
|
20
|
+
enrichPathWithNpmGlobalBin,
|
|
21
|
+
isConductorBundledCli,
|
|
22
|
+
resolveCommandBinarySync,
|
|
23
|
+
run,
|
|
24
|
+
withExportedPath
|
|
25
|
+
} from "./chunk-KPIYENTF.js";
|
|
19
26
|
import {
|
|
20
27
|
claudeChromeEnabled,
|
|
21
28
|
isElectronLikeCommand,
|
|
@@ -28,13 +35,6 @@ import {
|
|
|
28
35
|
import {
|
|
29
36
|
appDataDir
|
|
30
37
|
} from "./chunk-BD2ICC4D.js";
|
|
31
|
-
import {
|
|
32
|
-
enrichPathWithNpmGlobalBin,
|
|
33
|
-
isConductorBundledCli,
|
|
34
|
-
resolveCommandBinarySync,
|
|
35
|
-
run,
|
|
36
|
-
withExportedPath
|
|
37
|
-
} from "./chunk-3KETJKYA.js";
|
|
38
38
|
|
|
39
39
|
// src/agents/brightsy.ts
|
|
40
40
|
import { existsSync } from "fs";
|
|
@@ -197,7 +197,7 @@ function looksLikeHomebrewLibuvCrash(text) {
|
|
|
197
197
|
var NESTED_ELECTRON_SUMMARY = "Cursor local agent crashed at Electron startup (nested Chromium / HasCustomHostObject)";
|
|
198
198
|
var HOMEBREW_LIBUV_SUMMARY = "Cursor runner crashed in Node (Homebrew Node + shared libuv). Install Node 22 LTS (`brew install node@22`) and retry.";
|
|
199
199
|
var BUNDLED_NODE_CRASH_SUMMARY = "Cursor runner crashed in Node. Retry the turn.";
|
|
200
|
-
var V8_OOM_SUMMARY = "
|
|
200
|
+
var V8_OOM_SUMMARY = "Agent ran out of memory (JavaScript heap). If it keeps happening, exclude large files from the project folder.";
|
|
201
201
|
var MINIFIED_DUMP_SUMMARY = "Cursor local agent crashed during startup (truncated crash dump)";
|
|
202
202
|
function clipStderr(text, maxChars) {
|
|
203
203
|
const trimmed = text.trim();
|
|
@@ -252,6 +252,7 @@ function looksLikeRetryableRunnerCrash(text) {
|
|
|
252
252
|
}
|
|
253
253
|
function shouldRetryFailedAgentTurn(detail, opts) {
|
|
254
254
|
if (looksLikeInvalidAgentSession(detail) && opts.hasSession) return true;
|
|
255
|
+
if (looksLikeV8Oom(detail) && opts.hasSession) return true;
|
|
255
256
|
return looksLikeRetryableRunnerCrash(detail);
|
|
256
257
|
}
|
|
257
258
|
function looksLikeAgentFailureMessage(text) {
|
|
@@ -742,9 +743,9 @@ function toolDescription(name, input) {
|
|
|
742
743
|
if (/connectedAgentRequest/i.test(name)) {
|
|
743
744
|
return str(input?.agent_id) ? `Ask connected agent` : "Ask connected agent";
|
|
744
745
|
}
|
|
745
|
-
if (desc && kind) return `${kind}: ${desc}`;
|
|
746
|
-
if (desc) return desc
|
|
747
|
-
return
|
|
746
|
+
if (desc && kind) return `${kind}: ${desc}${subagentLiveSuffix(input)}`;
|
|
747
|
+
if (desc) return `${desc}${subagentLiveSuffix(input)}`;
|
|
748
|
+
return `Subagent${subagentLiveSuffix(input)}`;
|
|
748
749
|
}
|
|
749
750
|
if (/^(create|update)_artifact$/i.test(name.replace(/^mcp__[^_]+__/, ""))) {
|
|
750
751
|
return str(input?.title) ? `Artifact ${str(input?.title)}` : "Artifact";
|
|
@@ -769,13 +770,83 @@ function toolDescription(name, input) {
|
|
|
769
770
|
}
|
|
770
771
|
if (/grep/i.test(name)) return "Search files";
|
|
771
772
|
if (/glob/i.test(name)) return "Find files";
|
|
773
|
+
const compact = n.replace(/[_-]/g, "");
|
|
774
|
+
if (/^taskoutput$/i.test(compact)) {
|
|
775
|
+
return str(input.task_id) ? `Wait for ${str(input.task_id)}` : "Wait for background task";
|
|
776
|
+
}
|
|
777
|
+
if (/^taskstop$/i.test(compact)) {
|
|
778
|
+
return str(input.task_id) ? `Stop ${str(input.task_id)}` : "Stop background task";
|
|
779
|
+
}
|
|
780
|
+
if (/^monitor$/i.test(compact)) {
|
|
781
|
+
const command = str(input.command);
|
|
782
|
+
return command ? `Watch ${command.length > 48 ? `${command.slice(0, 45)}\u2026` : command}` : "Watch command";
|
|
783
|
+
}
|
|
772
784
|
return n;
|
|
773
785
|
}
|
|
786
|
+
function subagentLiveSuffix(input) {
|
|
787
|
+
if (!input) return "";
|
|
788
|
+
const bits = [];
|
|
789
|
+
const status = str(input.live_status);
|
|
790
|
+
if (status && !/^runn(ing)?$|^working$/i.test(status)) bits.push(status);
|
|
791
|
+
if (typeof input.live_tool_uses === "number") bits.push(`${input.live_tool_uses} tools`);
|
|
792
|
+
if (typeof input.live_duration_ms === "number") {
|
|
793
|
+
bits.push(`${Math.max(0, Math.round(Number(input.live_duration_ms) / 1e3))}s`);
|
|
794
|
+
}
|
|
795
|
+
const last = str(input.live_last_tool);
|
|
796
|
+
if (last) bits.push(last);
|
|
797
|
+
return bits.length ? ` \xB7 ${bits.join(" \xB7 ")}` : "";
|
|
798
|
+
}
|
|
774
799
|
function isSubagentToolName(name) {
|
|
775
800
|
const n = (name ?? "").trim();
|
|
776
801
|
if (/^(task|agent|spawn_agent)$/i.test(n)) return true;
|
|
777
802
|
return /connectedAgentRequest/i.test(n);
|
|
778
803
|
}
|
|
804
|
+
function isPollWrapperToolName(name) {
|
|
805
|
+
const n = (name ?? "").replace(/[_-]/g, "");
|
|
806
|
+
return /^(taskoutput|taskstop|sleep)$/i.test(n);
|
|
807
|
+
}
|
|
808
|
+
function lastTextPart(parts, type) {
|
|
809
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
|
810
|
+
const p = parts[i];
|
|
811
|
+
if (p.type === type && p.text.trim()) return p.text.trim();
|
|
812
|
+
}
|
|
813
|
+
return "";
|
|
814
|
+
}
|
|
815
|
+
function toolLabel(tool) {
|
|
816
|
+
return tool.description || toolDescription(tool.name, tool.input) || tool.name;
|
|
817
|
+
}
|
|
818
|
+
function liveActivitySummary(parts, opts) {
|
|
819
|
+
if (opts?.queued && parts.length === 0) {
|
|
820
|
+
return "Queued \u2014 waiting for a slot";
|
|
821
|
+
}
|
|
822
|
+
const tools = parts.filter((p) => p.type === "tool");
|
|
823
|
+
const runningSubs = tools.filter(
|
|
824
|
+
(t) => t.status === "running" && !t.parentId && isSubagentToolName(t.name)
|
|
825
|
+
);
|
|
826
|
+
const runningNested = [...tools].reverse().find((t) => t.status === "running" && t.parentId && !isPollWrapperToolName(t.name));
|
|
827
|
+
const runningTop = [...tools].reverse().find(
|
|
828
|
+
(t) => t.status === "running" && !t.parentId && !isPollWrapperToolName(t.name) && !isSubagentToolName(t.name)
|
|
829
|
+
);
|
|
830
|
+
const runningPoll = [...tools].reverse().find((t) => t.status === "running" && isPollWrapperToolName(t.name));
|
|
831
|
+
const thinking = lastTextPart(parts, "thinking");
|
|
832
|
+
const text = lastTextPart(parts, "text");
|
|
833
|
+
if (runningSubs.length > 0) {
|
|
834
|
+
const heads = runningSubs.map(toolLabel);
|
|
835
|
+
const head = runningSubs.length === 1 ? heads[0] : `${runningSubs.length} subagents \xB7 ${heads.slice(0, 2).join(" \xB7 ")}`;
|
|
836
|
+
if (runningNested) return `${head} \xB7 ${toolLabel(runningNested)}`;
|
|
837
|
+
return head;
|
|
838
|
+
}
|
|
839
|
+
if (runningTop) return toolLabel(runningTop);
|
|
840
|
+
if (runningPoll) return toolLabel(runningPoll);
|
|
841
|
+
if (thinking) return thinking.length > 96 ? `\u2026${thinking.slice(-96)}` : thinking;
|
|
842
|
+
if (text) return "Writing reply\u2026";
|
|
843
|
+
const last = [...tools].reverse().find((t) => !isPollWrapperToolName(t.name)) ?? tools.at(-1);
|
|
844
|
+
if (last) {
|
|
845
|
+
const label = toolLabel(last);
|
|
846
|
+
return last.status === "running" ? label : `Finished ${label}`;
|
|
847
|
+
}
|
|
848
|
+
return "Working\u2026";
|
|
849
|
+
}
|
|
779
850
|
function messagePartParentId(part) {
|
|
780
851
|
if ("parentId" in part && typeof part.parentId === "string" && part.parentId.trim()) {
|
|
781
852
|
return part.parentId;
|
|
@@ -857,6 +928,25 @@ function applyAgentEvent(parts, event) {
|
|
|
857
928
|
const data = event.data;
|
|
858
929
|
if (!data) return parts;
|
|
859
930
|
const next = [...parts];
|
|
931
|
+
if (event.replace) {
|
|
932
|
+
for (let i = next.length - 1; i >= 0; i--) {
|
|
933
|
+
const prev = next[i];
|
|
934
|
+
if (prev?.type === "thinking" && sameParentId(prev.parentId, event.parentId)) {
|
|
935
|
+
next[i] = {
|
|
936
|
+
type: "thinking",
|
|
937
|
+
text: data,
|
|
938
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
939
|
+
};
|
|
940
|
+
return next;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
next.push({
|
|
944
|
+
type: "thinking",
|
|
945
|
+
text: data,
|
|
946
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
947
|
+
});
|
|
948
|
+
return next;
|
|
949
|
+
}
|
|
860
950
|
const last = next[next.length - 1];
|
|
861
951
|
if (last?.type === "thinking" && sameParentId(last.parentId, event.parentId)) {
|
|
862
952
|
next[next.length - 1] = {
|
|
@@ -880,14 +970,18 @@ function applyAgentEvent(parts, event) {
|
|
|
880
970
|
if (existing >= 0) {
|
|
881
971
|
const prev = parts[existing];
|
|
882
972
|
const next = [...parts];
|
|
883
|
-
const mergedInput =
|
|
973
|
+
const mergedInput = {
|
|
974
|
+
...prev.input ?? {},
|
|
975
|
+
...input ?? {}
|
|
976
|
+
};
|
|
977
|
+
const mergedRecord = Object.keys(mergedInput).length > 0 ? mergedInput : void 0;
|
|
884
978
|
next[existing] = {
|
|
885
979
|
...prev,
|
|
886
980
|
name: event.name || prev.name,
|
|
887
|
-
input:
|
|
888
|
-
description: toolDescription(event.name || prev.name,
|
|
889
|
-
detail: toolDetail(event.name || prev.name,
|
|
890
|
-
filePath: toolFilePath(
|
|
981
|
+
input: mergedRecord,
|
|
982
|
+
description: toolDescription(event.name || prev.name, mergedRecord),
|
|
983
|
+
detail: toolDetail(event.name || prev.name, mergedRecord) ?? prev.detail,
|
|
984
|
+
filePath: toolFilePath(mergedRecord) ?? prev.filePath,
|
|
891
985
|
additions: diff.additions ?? prev.additions,
|
|
892
986
|
deletions: diff.deletions ?? prev.deletions,
|
|
893
987
|
parentId: event.parentId ?? prev.parentId
|
|
@@ -913,6 +1007,30 @@ function applyAgentEvent(parts, event) {
|
|
|
913
1007
|
if (event.type === "tool_result") {
|
|
914
1008
|
const existing = parts.findIndex((p) => p.type === "tool" && p.id === event.id);
|
|
915
1009
|
const fromResult = parseDiffStat(event.content);
|
|
1010
|
+
if (event.partial) {
|
|
1011
|
+
if (existing < 0) {
|
|
1012
|
+
return [
|
|
1013
|
+
...parts,
|
|
1014
|
+
{
|
|
1015
|
+
type: "tool",
|
|
1016
|
+
id: event.id,
|
|
1017
|
+
name: "tool",
|
|
1018
|
+
description: "tool",
|
|
1019
|
+
status: event.isError ? "error" : "running",
|
|
1020
|
+
result: event.content,
|
|
1021
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
1022
|
+
}
|
|
1023
|
+
];
|
|
1024
|
+
}
|
|
1025
|
+
return parts.map((p, i) => {
|
|
1026
|
+
if (i !== existing || p.type !== "tool") return p;
|
|
1027
|
+
if (p.status === "done" || p.status === "error") return p;
|
|
1028
|
+
return {
|
|
1029
|
+
...p,
|
|
1030
|
+
result: event.content ?? p.result
|
|
1031
|
+
};
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
916
1034
|
if (existing < 0) {
|
|
917
1035
|
return [
|
|
918
1036
|
...parts,
|
|
@@ -1034,6 +1152,29 @@ function packagedCursorRipgrepCandidate(platformPkg, binName) {
|
|
|
1034
1152
|
}
|
|
1035
1153
|
|
|
1036
1154
|
// src/agents/node-launch.ts
|
|
1155
|
+
var AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
|
|
1156
|
+
var MAX_OLD_SPACE_FLAG = /(?:^|\s)(--max[-_]old[-_]space[-_]size)(?:[= ](\d+))?(?=\s|$)/;
|
|
1157
|
+
function withMaxOldSpaceSize(nodeOptions, heapMb) {
|
|
1158
|
+
const existing = (nodeOptions ?? "").trim();
|
|
1159
|
+
const match = MAX_OLD_SPACE_FLAG.exec(existing);
|
|
1160
|
+
if (match) {
|
|
1161
|
+
const current = match[2] ? Number(match[2]) : 0;
|
|
1162
|
+
if (Number.isFinite(current) && current >= heapMb) return existing;
|
|
1163
|
+
return existing.replace(MAX_OLD_SPACE_FLAG, ` --max-old-space-size=${heapMb}`).trim();
|
|
1164
|
+
}
|
|
1165
|
+
return existing ? `${existing} --max-old-space-size=${heapMb}` : `--max-old-space-size=${heapMb}`;
|
|
1166
|
+
}
|
|
1167
|
+
function applyAgentRunnerHeapEnv(env) {
|
|
1168
|
+
env.NODE_OPTIONS = withMaxOldSpaceSize(
|
|
1169
|
+
env.NODE_OPTIONS,
|
|
1170
|
+
AGENT_RUNNER_MAX_OLD_SPACE_MB
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
function envWithAgentHeap(env) {
|
|
1174
|
+
const next = { ...env };
|
|
1175
|
+
applyAgentRunnerHeapEnv(next);
|
|
1176
|
+
return next;
|
|
1177
|
+
}
|
|
1037
1178
|
function isAsarPath(filePath) {
|
|
1038
1179
|
if (/\.asar\.unpacked([/\\]|$)/.test(filePath)) return false;
|
|
1039
1180
|
return /\.asar([/\\]|$)/.test(filePath);
|
|
@@ -1170,13 +1311,21 @@ async function findSystemNode() {
|
|
|
1170
1311
|
function applyNodeLaunch(launch, args) {
|
|
1171
1312
|
const readableArgs = args.map(nodeReadableScriptPath);
|
|
1172
1313
|
if (!launch.env.ELECTRON_RUN_AS_NODE) {
|
|
1173
|
-
return {
|
|
1314
|
+
return {
|
|
1315
|
+
file: launch.file,
|
|
1316
|
+
args: readableArgs,
|
|
1317
|
+
env: envWithAgentHeap(launch.env)
|
|
1318
|
+
};
|
|
1174
1319
|
}
|
|
1175
1320
|
const wrapped = wrapElectronAsNodeLaunch(launch.file, readableArgs);
|
|
1176
1321
|
if (process.platform === "win32") {
|
|
1177
|
-
return {
|
|
1322
|
+
return {
|
|
1323
|
+
file: wrapped.file,
|
|
1324
|
+
args: wrapped.args,
|
|
1325
|
+
env: envWithAgentHeap(launch.env)
|
|
1326
|
+
};
|
|
1178
1327
|
}
|
|
1179
|
-
const env =
|
|
1328
|
+
const env = envWithAgentHeap(launch.env);
|
|
1180
1329
|
delete env.ELECTRON_RUN_AS_NODE;
|
|
1181
1330
|
return { file: wrapped.file, args: wrapped.args, env };
|
|
1182
1331
|
}
|
|
@@ -1372,6 +1521,7 @@ async function buildInjectedMcpServers(opts) {
|
|
|
1372
1521
|
);
|
|
1373
1522
|
} catch {
|
|
1374
1523
|
}
|
|
1524
|
+
applyAgentRunnerHeapEnv(sideboard.env);
|
|
1375
1525
|
servers.push(sideboard);
|
|
1376
1526
|
}
|
|
1377
1527
|
if (opts.includeBrightsy && isBrightsyConnected()) {
|
|
@@ -1524,8 +1674,14 @@ var BASE_ALLOWED_TOOLS = [
|
|
|
1524
1674
|
"WebSearch",
|
|
1525
1675
|
// Subagents (Claude Code v2.1.63 renamed Task → Agent; allow both).
|
|
1526
1676
|
"Task",
|
|
1527
|
-
"Agent"
|
|
1677
|
+
"Agent",
|
|
1678
|
+
"TaskOutput",
|
|
1679
|
+
"TaskStop",
|
|
1680
|
+
"EnterWorktree",
|
|
1681
|
+
"ExitWorktree",
|
|
1682
|
+
"Skill"
|
|
1528
1683
|
];
|
|
1684
|
+
var CLAUDE_PRINT_BG_WAIT_CEILING_MS = 72e5;
|
|
1529
1685
|
var CLAUDE_CHROME_ALLOWED_TOOLS = [
|
|
1530
1686
|
"mcp__claude-in-chrome",
|
|
1531
1687
|
"mcp__claude-in-chrome__*",
|
|
@@ -1629,6 +1785,80 @@ function claudeParentToolUseId(obj) {
|
|
|
1629
1785
|
}
|
|
1630
1786
|
return void 0;
|
|
1631
1787
|
}
|
|
1788
|
+
function claudeString(obj, key) {
|
|
1789
|
+
const v = obj[key];
|
|
1790
|
+
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
1791
|
+
}
|
|
1792
|
+
function eventsFromClaudeSystem(obj) {
|
|
1793
|
+
const subtype = claudeString(obj, "subtype") ?? "";
|
|
1794
|
+
const parentId = claudeParentToolUseId(obj);
|
|
1795
|
+
if (subtype === "init") {
|
|
1796
|
+
if (parentId) return null;
|
|
1797
|
+
const sid = claudeString(obj, "session_id");
|
|
1798
|
+
return sid ? { type: "session_id", data: sid } : null;
|
|
1799
|
+
}
|
|
1800
|
+
if (subtype === "task_started") {
|
|
1801
|
+
const id = claudeString(obj, "tool_use_id") ?? claudeString(obj, "task_id");
|
|
1802
|
+
if (!id) return null;
|
|
1803
|
+
const description = claudeString(obj, "description");
|
|
1804
|
+
const taskType = claudeString(obj, "task_type");
|
|
1805
|
+
const prompt = claudeString(obj, "prompt");
|
|
1806
|
+
return withEventParentId(
|
|
1807
|
+
{
|
|
1808
|
+
type: "tool_use",
|
|
1809
|
+
id,
|
|
1810
|
+
name: taskType || "Agent",
|
|
1811
|
+
input: {
|
|
1812
|
+
...description ? { description } : {},
|
|
1813
|
+
...prompt ? { prompt } : {},
|
|
1814
|
+
...claudeString(obj, "task_id") ? { task_id: claudeString(obj, "task_id") } : {}
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
parentId
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1820
|
+
if (subtype === "task_notification") {
|
|
1821
|
+
const id = claudeString(obj, "tool_use_id") ?? claudeString(obj, "task_id") ?? parentId;
|
|
1822
|
+
if (!id) return null;
|
|
1823
|
+
const status = claudeString(obj, "status") ?? "working";
|
|
1824
|
+
const tools = typeof obj.tool_uses === "number" ? obj.tool_uses : void 0;
|
|
1825
|
+
const durationMs = typeof obj.duration_ms === "number" ? obj.duration_ms : void 0;
|
|
1826
|
+
const lastTool = claudeString(obj, "last_tool") ?? claudeString(obj, "current_tool") ?? claudeString(obj, "tool");
|
|
1827
|
+
const snapshot = [
|
|
1828
|
+
status,
|
|
1829
|
+
tools != null ? `${tools} tools` : null,
|
|
1830
|
+
durationMs != null ? `${Math.round(durationMs / 1e3)}s` : null,
|
|
1831
|
+
lastTool
|
|
1832
|
+
].filter((bit) => Boolean(bit)).join(" \xB7 ");
|
|
1833
|
+
return [
|
|
1834
|
+
{
|
|
1835
|
+
type: "tool_use",
|
|
1836
|
+
id,
|
|
1837
|
+
name: claudeString(obj, "task_type") || "Agent",
|
|
1838
|
+
input: {
|
|
1839
|
+
live_status: status,
|
|
1840
|
+
...tools != null ? { live_tool_uses: tools } : {},
|
|
1841
|
+
...durationMs != null ? { live_duration_ms: durationMs } : {},
|
|
1842
|
+
...lastTool ? { live_last_tool: lastTool } : {}
|
|
1843
|
+
}
|
|
1844
|
+
},
|
|
1845
|
+
withEventParentId(
|
|
1846
|
+
{ type: "thinking", data: snapshot, replace: true },
|
|
1847
|
+
id
|
|
1848
|
+
)
|
|
1849
|
+
];
|
|
1850
|
+
}
|
|
1851
|
+
if (subtype === "api_retry") {
|
|
1852
|
+
const attempt = obj.attempt;
|
|
1853
|
+
const max = obj.max_retries;
|
|
1854
|
+
const delay = obj.retry_delay_ms;
|
|
1855
|
+
return {
|
|
1856
|
+
type: "thinking",
|
|
1857
|
+
data: `API retry ${attempt ?? "?"}/${max ?? "?"}${typeof delay === "number" ? ` (wait ${delay}ms)` : ""}`
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
return null;
|
|
1861
|
+
}
|
|
1632
1862
|
var claudeAdapter = {
|
|
1633
1863
|
kind: "claude",
|
|
1634
1864
|
async detect() {
|
|
@@ -1683,7 +1913,7 @@ var claudeAdapter = {
|
|
|
1683
1913
|
);
|
|
1684
1914
|
}
|
|
1685
1915
|
const mode = permissionMode(thread);
|
|
1686
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
1916
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-H4YNASM6.js");
|
|
1687
1917
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1688
1918
|
const injectedServers = await buildInjectedMcpServers({
|
|
1689
1919
|
includeSideboard: true,
|
|
@@ -1751,7 +1981,12 @@ var claudeAdapter = {
|
|
|
1751
1981
|
stdin: useStdin ? `${promptText}
|
|
1752
1982
|
` : void 0,
|
|
1753
1983
|
// Nested Task/Agent thinking+text in stream-json (Claude Code 2.1.211+).
|
|
1754
|
-
|
|
1984
|
+
// Raise the -p background-agent wait so long TaskOutput polls are not
|
|
1985
|
+
// abandoned at Claude Code’s 10-minute default.
|
|
1986
|
+
env: {
|
|
1987
|
+
CLAUDE_CODE_FORWARD_SUBAGENT_TEXT: "1",
|
|
1988
|
+
CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS: process.env.CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS ?? String(CLAUDE_PRINT_BG_WAIT_CEILING_MS)
|
|
1989
|
+
}
|
|
1755
1990
|
};
|
|
1756
1991
|
},
|
|
1757
1992
|
parseEvent(line) {
|
|
@@ -1759,13 +1994,8 @@ var claudeAdapter = {
|
|
|
1759
1994
|
if (!trimmed) return null;
|
|
1760
1995
|
try {
|
|
1761
1996
|
const obj = JSON.parse(trimmed);
|
|
1762
|
-
if (obj.type === "system"
|
|
1763
|
-
|
|
1764
|
-
if (typeof sid === "string") return { type: "session_id", data: sid };
|
|
1765
|
-
return null;
|
|
1766
|
-
}
|
|
1767
|
-
if (obj.type === "system" && typeof obj.session_id === "string") {
|
|
1768
|
-
return { type: "session_id", data: obj.session_id };
|
|
1997
|
+
if (obj.type === "system") {
|
|
1998
|
+
return eventsFromClaudeSystem(obj);
|
|
1769
1999
|
}
|
|
1770
2000
|
if (obj.type === "assistant" || obj.type === "user") {
|
|
1771
2001
|
const parentId = claudeParentToolUseId(obj);
|
|
@@ -2146,13 +2376,22 @@ var codexAdapter = {
|
|
|
2146
2376
|
const events = [
|
|
2147
2377
|
{ type: "tool_use", id: item.id, name: "Bash", input }
|
|
2148
2378
|
];
|
|
2149
|
-
|
|
2379
|
+
const finished = type === "item.completed" || item.status === "completed" || item.status === "failed";
|
|
2380
|
+
const output = typeof item.aggregated_output === "string" && item.aggregated_output ? item.aggregated_output : void 0;
|
|
2381
|
+
if (finished) {
|
|
2150
2382
|
events.push({
|
|
2151
2383
|
type: "tool_result",
|
|
2152
2384
|
id: item.id,
|
|
2153
|
-
content:
|
|
2385
|
+
content: output,
|
|
2154
2386
|
isError: item.status === "failed"
|
|
2155
2387
|
});
|
|
2388
|
+
} else if (output) {
|
|
2389
|
+
events.push({
|
|
2390
|
+
type: "tool_result",
|
|
2391
|
+
id: item.id,
|
|
2392
|
+
content: output,
|
|
2393
|
+
partial: true
|
|
2394
|
+
});
|
|
2156
2395
|
}
|
|
2157
2396
|
return events.length === 1 ? events[0] : events;
|
|
2158
2397
|
}
|
|
@@ -2195,9 +2434,6 @@ var codexAdapter = {
|
|
|
2195
2434
|
if (sid && (type === "thread.started" || type === "session" || !type)) {
|
|
2196
2435
|
return { type: "session_id", data: sid };
|
|
2197
2436
|
}
|
|
2198
|
-
if (sid && type.endsWith(".started")) {
|
|
2199
|
-
return { type: "session_id", data: sid };
|
|
2200
|
-
}
|
|
2201
2437
|
if (type === "turn.completed" || type === "turn_completed") {
|
|
2202
2438
|
const usage = usageFromCodex(obj.usage);
|
|
2203
2439
|
return usage ? { type: "usage", data: usage, scope: "turn" } : null;
|
|
@@ -2376,7 +2612,7 @@ function cursorSdkMessageToEvents(msg) {
|
|
|
2376
2612
|
if (msg.type === "tool_call" && msg.call_id && msg.name) {
|
|
2377
2613
|
const normalized = normalizeCursorToolCall(msg.name, msg.args);
|
|
2378
2614
|
if (msg.status === "running") {
|
|
2379
|
-
|
|
2615
|
+
const events = [
|
|
2380
2616
|
{
|
|
2381
2617
|
type: "tool_use",
|
|
2382
2618
|
id: msg.call_id,
|
|
@@ -2384,6 +2620,16 @@ function cursorSdkMessageToEvents(msg) {
|
|
|
2384
2620
|
input: normalized.input
|
|
2385
2621
|
}
|
|
2386
2622
|
];
|
|
2623
|
+
const live = unwrapCursorToolResult(msg.result);
|
|
2624
|
+
if (live) {
|
|
2625
|
+
events.push({
|
|
2626
|
+
type: "tool_result",
|
|
2627
|
+
id: msg.call_id,
|
|
2628
|
+
content: live,
|
|
2629
|
+
partial: true
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
return events;
|
|
2387
2633
|
}
|
|
2388
2634
|
if (msg.status === "completed" || msg.status === "error") {
|
|
2389
2635
|
return [
|
|
@@ -2832,7 +3078,8 @@ var opencodeAdapter = {
|
|
|
2832
3078
|
return { type: "stderr", data: detail };
|
|
2833
3079
|
}
|
|
2834
3080
|
const sid = typeof obj.sessionID === "string" && obj.sessionID || typeof obj.sessionId === "string" && obj.sessionId || typeof obj.session_id === "string" && obj.session_id;
|
|
2835
|
-
|
|
3081
|
+
const childSid = str2(obj.childSessionID) ?? str2(obj.childSessionId) ?? str2(obj.parentID) ?? str2(obj.parentId);
|
|
3082
|
+
if (sid && !childSid && (!obj.type || obj.type === "step_start" || obj.type === "session")) {
|
|
2836
3083
|
return { type: "session_id", data: sid };
|
|
2837
3084
|
}
|
|
2838
3085
|
if (obj.type === "text") {
|
|
@@ -2852,13 +3099,16 @@ var opencodeAdapter = {
|
|
|
2852
3099
|
);
|
|
2853
3100
|
const events = [{ type: "tool_use", id, name, input }];
|
|
2854
3101
|
const output = state?.output;
|
|
2855
|
-
|
|
3102
|
+
const finished = state?.status === "completed" || state?.status === "error" || state?.status === "failed";
|
|
3103
|
+
const running = state?.status === "running" || state?.status === "in_progress" || state?.status === "pending";
|
|
3104
|
+
if (output != null || finished) {
|
|
2856
3105
|
const content = typeof output === "string" ? output : output != null ? JSON.stringify(output) : formatUnknownDetail(state?.error) || void 0;
|
|
2857
3106
|
events.push({
|
|
2858
3107
|
type: "tool_result",
|
|
2859
3108
|
id,
|
|
2860
3109
|
content,
|
|
2861
|
-
isError: state?.status === "error" || state?.status === "failed"
|
|
3110
|
+
isError: state?.status === "error" || state?.status === "failed",
|
|
3111
|
+
...running && !finished ? { partial: true } : {}
|
|
2862
3112
|
});
|
|
2863
3113
|
}
|
|
2864
3114
|
return events.length === 1 ? events[0] : events;
|
|
@@ -2893,14 +3143,17 @@ var opencodeAdapter = {
|
|
|
2893
3143
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
2894
3144
|
];
|
|
2895
3145
|
const output = state?.output ?? part.output;
|
|
2896
|
-
|
|
3146
|
+
const finished = state?.status === "completed" || state?.status === "error" || state?.status === "failed";
|
|
3147
|
+
const running = state?.status === "running" || state?.status === "in_progress" || state?.status === "pending";
|
|
3148
|
+
if (output != null || finished) {
|
|
2897
3149
|
nested.push(
|
|
2898
3150
|
withEventParentId(
|
|
2899
3151
|
{
|
|
2900
3152
|
type: "tool_result",
|
|
2901
3153
|
id,
|
|
2902
3154
|
content: typeof output === "string" ? output : output != null ? JSON.stringify(output) : void 0,
|
|
2903
|
-
isError: state?.status === "error" || state?.status === "failed"
|
|
3155
|
+
isError: state?.status === "error" || state?.status === "failed",
|
|
3156
|
+
...running && !finished ? { partial: true } : {}
|
|
2904
3157
|
},
|
|
2905
3158
|
parentId
|
|
2906
3159
|
)
|
|
@@ -3429,6 +3682,7 @@ function allAdapters() {
|
|
|
3429
3682
|
|
|
3430
3683
|
export {
|
|
3431
3684
|
pushTurnStderr,
|
|
3685
|
+
looksLikeV8Oom,
|
|
3432
3686
|
summarizeTurnStderr,
|
|
3433
3687
|
looksLikeInvalidAgentSession,
|
|
3434
3688
|
shouldRetryFailedAgentTurn,
|
|
@@ -3444,6 +3698,8 @@ export {
|
|
|
3444
3698
|
listBrightsyChatTargets,
|
|
3445
3699
|
brightsyAdapter,
|
|
3446
3700
|
toolDescription,
|
|
3701
|
+
isPollWrapperToolName,
|
|
3702
|
+
liveActivitySummary,
|
|
3447
3703
|
applyAgentEvent,
|
|
3448
3704
|
partsToAssistantText,
|
|
3449
3705
|
stripBrightsyNdjsonNoise,
|
|
@@ -3451,6 +3707,7 @@ export {
|
|
|
3451
3707
|
finalizeParts,
|
|
3452
3708
|
normalizeParseResult,
|
|
3453
3709
|
sideboardMcpProfile,
|
|
3710
|
+
applyAgentRunnerHeapEnv,
|
|
3454
3711
|
PLAN_MODE_INSTRUCTION,
|
|
3455
3712
|
permissionMode,
|
|
3456
3713
|
claudeAdapter,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ensureGlobalCoordinatorCwd
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZYEFCSZJ.js";
|
|
6
6
|
import {
|
|
7
7
|
allocateTeamName,
|
|
8
8
|
takenSlugsFromThread,
|
|
9
9
|
teamSlugFromName
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZMROW673.js";
|
|
11
11
|
import {
|
|
12
12
|
createEmptyThread,
|
|
13
13
|
listThreads,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
run
|
|
5
|
+
} from "./chunk-KPIYENTF.js";
|
|
3
6
|
import {
|
|
4
7
|
appDataDir
|
|
5
8
|
} from "./chunk-BD2ICC4D.js";
|
|
6
|
-
import {
|
|
7
|
-
run
|
|
8
|
-
} from "./chunk-3KETJKYA.js";
|
|
9
9
|
|
|
10
10
|
// src/brightsy/connected-teams.ts
|
|
11
11
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -6,6 +6,11 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
listThreads
|
|
8
8
|
} from "./chunk-KYOTBZ6S.js";
|
|
9
|
+
import {
|
|
10
|
+
gh,
|
|
11
|
+
git,
|
|
12
|
+
resolveGhAuthToken
|
|
13
|
+
} from "./chunk-KPIYENTF.js";
|
|
9
14
|
import {
|
|
10
15
|
getGithubGitAuthMode,
|
|
11
16
|
getGithubPat
|
|
@@ -13,11 +18,6 @@ import {
|
|
|
13
18
|
import {
|
|
14
19
|
worktreesRoot
|
|
15
20
|
} from "./chunk-BD2ICC4D.js";
|
|
16
|
-
import {
|
|
17
|
-
gh,
|
|
18
|
-
git,
|
|
19
|
-
resolveGhAuthToken
|
|
20
|
-
} from "./chunk-3KETJKYA.js";
|
|
21
21
|
|
|
22
22
|
// src/git/worktree.ts
|
|
23
23
|
import { existsSync as existsSync2, readdirSync } from "fs";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
isGlobalRepoPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XOYQ7LNQ.js";
|
|
6
6
|
import {
|
|
7
7
|
ensureGhPreferOrigin,
|
|
8
8
|
resolveRepoRoot
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZMROW673.js";
|
|
10
10
|
import {
|
|
11
11
|
appDataDir
|
|
12
12
|
} from "./chunk-BD2ICC4D.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
resolveGithubRepoSlug
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZMROW673.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveThreadDefaults
|
|
8
8
|
} from "./chunk-SGEVS5SY.js";
|
|
@@ -63,7 +63,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
|
|
|
63
63
|
"- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
|
|
64
64
|
"- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
|
|
65
65
|
"- send_to_thread \u2014 queue a prompt (start/continue a chat turn); pass force_stop: true to interrupt mid-turn / clear stale queued prompts before replacing with a new request",
|
|
66
|
-
"- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). If stillRunning is true, progress is a live snapshot of tools/thinking \u2014 call wait_for_turn again. Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
|
|
66
|
+
"- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). If stillRunning is true, progress is a live snapshot of tools/thinking \u2014 call wait_for_turn again. status=queued with no lastActivityAt means the child has not started yet (concurrency cap) \u2014 keep waiting; do not force_stop or send a check-in. Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
|
|
67
67
|
"- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
|
|
68
68
|
"- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
|
|
69
69
|
"Setup / run:",
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
ensureConnectedBrightsyTeamTokens,
|
|
10
10
|
getConnectedBrightsyTeamsRaw,
|
|
11
11
|
listConnectedBrightsyTeams
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YMRT2DU6.js";
|
|
13
|
+
import "./chunk-KPIYENTF.js";
|
|
13
14
|
import "./chunk-BD2ICC4D.js";
|
|
14
|
-
import "./chunk-3KETJKYA.js";
|
|
15
15
|
export {
|
|
16
16
|
applyConnectedTeamToCli,
|
|
17
17
|
brightsyMcpServerName,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
ensureConnectedBrightsyTeamTokens,
|
|
8
8
|
getConnectedBrightsyTeamsRaw,
|
|
9
9
|
listConnectedBrightsyTeams
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EKIDHL2T.js";
|
|
11
11
|
import "./chunk-QZQEXME2.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-DVM4ID64.js";
|
|
13
13
|
export {
|
|
14
14
|
applyConnectedTeamToCli,
|
|
15
15
|
brightsyMcpServerName,
|