@sideboard-ai/core 0.1.111 → 0.1.115

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.
Files changed (43) hide show
  1. package/dist/agents/cursor-runner.cjs +29 -20
  2. package/dist/agents/cursor-runner.js +3 -3
  3. package/dist/{agents-NN22A4G5.js → agents-3X3EFCQY.js} +7 -7
  4. package/dist/{agents-GH3FWDW2.js → agents-AHAFC6FR.js} +10 -10
  5. package/dist/{chunk-4EWPKYOU.js → chunk-4OJMZ6P2.js} +2 -2
  6. package/dist/{chunk-KVFNTWFG.js → chunk-66XTXHR3.js} +244 -36
  7. package/dist/{chunk-KQBI5HNT.js → chunk-7WC5UWEB.js} +2 -2
  8. package/dist/{chunk-WIHKHR5R.js → chunk-AXQ4ZWHK.js} +5 -0
  9. package/dist/{chunk-NC3U42ZP.js → chunk-C6OBY6IC.js} +268 -27
  10. package/dist/{chunk-DMJKOFTO.js → chunk-DCNR7NAL.js} +39 -31
  11. package/dist/{chunk-LGXBYZZA.js → chunk-DVM4ID64.js} +69 -13
  12. package/dist/{chunk-2GO3YKBA.js → chunk-EKIDHL2T.js} +4 -4
  13. package/dist/{chunk-C4KHDW3U.js → chunk-FZCIQYNQ.js} +1 -1
  14. package/dist/{chunk-7KWYXGIU.js → chunk-K3TIQXOH.js} +2 -2
  15. package/dist/{chunk-3KETJKYA.js → chunk-KPIYENTF.js} +69 -13
  16. package/dist/{chunk-JTQQPJAU.js → chunk-MZ6HJ7VL.js} +47 -34
  17. package/dist/{chunk-363Z34PY.js → chunk-SLU5JVKD.js} +251 -217
  18. package/dist/{chunk-VOD3HFLP.js → chunk-XOYQ7LNQ.js} +2 -2
  19. package/dist/{chunk-7YKXHBIW.js → chunk-YMRT2DU6.js} +3 -3
  20. package/dist/{chunk-YXDR43ZC.js → chunk-ZMROW673.js} +5 -5
  21. package/dist/{chunk-YFAXVUY2.js → chunk-ZRCX43LS.js} +2 -2
  22. package/dist/{chunk-AROMOP3C.js → chunk-ZYEFCSZJ.js} +2 -2
  23. package/dist/{connected-teams-M5XNXRI5.js → connected-teams-O6D4PM7A.js} +2 -2
  24. package/dist/{connected-teams-J4I5AKMR.js → connected-teams-ZCOU6KCD.js} +2 -2
  25. package/dist/{coordinator-prompt-AR66L3N4.js → coordinator-prompt-4KCALEKD.js} +3 -3
  26. package/dist/{coordinator-prompt-BHMLWL64.js → coordinator-prompt-FML4I5AR.js} +3 -3
  27. package/dist/{global-workspace-XSUFEIAQ.js → global-workspace-CSWABOG5.js} +4 -4
  28. package/dist/{global-workspace-SKFODUQQ.js → global-workspace-H4YNASM6.js} +4 -4
  29. package/dist/index.cjs +787 -427
  30. package/dist/index.d.cts +53 -1
  31. package/dist/index.d.ts +53 -1
  32. package/dist/index.js +33 -15
  33. package/dist/mcp/run-stdio.cjs +906 -625
  34. package/dist/mcp/run-stdio.js +18 -14
  35. package/dist/{orchestrator-4T2SXDZ7.js → orchestrator-GKLYKLRC.js} +8 -8
  36. package/dist/{orchestrator-EP57AB5W.js → orchestrator-TXASYNHT.js} +10 -10
  37. package/dist/{run-XKTAJRWF.js → run-USF6FRKV.js} +3 -1
  38. package/dist/{run-CFKZPY7F.js → run-XQKGHQZ2.js} +3 -1
  39. package/dist/{workspaces-XAQVKTLO.js → workspaces-HJ3EVATC.js} +5 -5
  40. package/dist/{workspaces-HV3J4TTW.js → workspaces-QG6PGFQR.js} +5 -5
  41. package/dist/{worktree-XFJED3VU.js → worktree-IW3BX26B.js} +2 -2
  42. package/dist/{worktree-N2EV24EE.js → worktree-OTFQO2W7.js} +2 -2
  43. package/package.json +1 -1
@@ -6,16 +6,23 @@ import {
6
6
  ensureCliTeamTracked,
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  loadBrightsyConfig
9
- } from "./chunk-7YKXHBIW.js";
9
+ } from "./chunk-YMRT2DU6.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-VOD3HFLP.js";
12
+ } from "./chunk-XOYQ7LNQ.js";
13
13
  import {
14
14
  codexUnattendedGitConfigArgs,
15
15
  mergeAgentGitAuthEnv,
16
16
  resolveAgentGitAuthEnv,
17
17
  resolveCodexGitWritableRoots
18
- } from "./chunk-YXDR43ZC.js";
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 = "Cursor runner ran out of memory (JavaScript heap). Retry; if it keeps happening, exclude large files from the project folder or start a new chat.";
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 "Subagent";
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 = input && Object.keys(input).length > 0 ? input : prev.input ?? input;
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: mergedInput,
888
- description: toolDescription(event.name || prev.name, mergedInput),
889
- detail: toolDetail(event.name || prev.name, mergedInput) ?? prev.detail,
890
- filePath: toolFilePath(mergedInput) ?? prev.filePath,
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
@@ -1034,6 +1128,29 @@ function packagedCursorRipgrepCandidate(platformPkg, binName) {
1034
1128
  }
1035
1129
 
1036
1130
  // src/agents/node-launch.ts
1131
+ var AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
1132
+ var MAX_OLD_SPACE_FLAG = /(?:^|\s)(--max[-_]old[-_]space[-_]size)(?:[= ](\d+))?(?=\s|$)/;
1133
+ function withMaxOldSpaceSize(nodeOptions, heapMb) {
1134
+ const existing = (nodeOptions ?? "").trim();
1135
+ const match = MAX_OLD_SPACE_FLAG.exec(existing);
1136
+ if (match) {
1137
+ const current = match[2] ? Number(match[2]) : 0;
1138
+ if (Number.isFinite(current) && current >= heapMb) return existing;
1139
+ return existing.replace(MAX_OLD_SPACE_FLAG, ` --max-old-space-size=${heapMb}`).trim();
1140
+ }
1141
+ return existing ? `${existing} --max-old-space-size=${heapMb}` : `--max-old-space-size=${heapMb}`;
1142
+ }
1143
+ function applyAgentRunnerHeapEnv(env) {
1144
+ env.NODE_OPTIONS = withMaxOldSpaceSize(
1145
+ env.NODE_OPTIONS,
1146
+ AGENT_RUNNER_MAX_OLD_SPACE_MB
1147
+ );
1148
+ }
1149
+ function envWithAgentHeap(env) {
1150
+ const next = { ...env };
1151
+ applyAgentRunnerHeapEnv(next);
1152
+ return next;
1153
+ }
1037
1154
  function isAsarPath(filePath) {
1038
1155
  if (/\.asar\.unpacked([/\\]|$)/.test(filePath)) return false;
1039
1156
  return /\.asar([/\\]|$)/.test(filePath);
@@ -1170,13 +1287,21 @@ async function findSystemNode() {
1170
1287
  function applyNodeLaunch(launch, args) {
1171
1288
  const readableArgs = args.map(nodeReadableScriptPath);
1172
1289
  if (!launch.env.ELECTRON_RUN_AS_NODE) {
1173
- return { file: launch.file, args: readableArgs, env: launch.env };
1290
+ return {
1291
+ file: launch.file,
1292
+ args: readableArgs,
1293
+ env: envWithAgentHeap(launch.env)
1294
+ };
1174
1295
  }
1175
1296
  const wrapped = wrapElectronAsNodeLaunch(launch.file, readableArgs);
1176
1297
  if (process.platform === "win32") {
1177
- return { file: wrapped.file, args: wrapped.args, env: launch.env };
1298
+ return {
1299
+ file: wrapped.file,
1300
+ args: wrapped.args,
1301
+ env: envWithAgentHeap(launch.env)
1302
+ };
1178
1303
  }
1179
- const env = { ...launch.env };
1304
+ const env = envWithAgentHeap(launch.env);
1180
1305
  delete env.ELECTRON_RUN_AS_NODE;
1181
1306
  return { file: wrapped.file, args: wrapped.args, env };
1182
1307
  }
@@ -1372,6 +1497,7 @@ async function buildInjectedMcpServers(opts) {
1372
1497
  );
1373
1498
  } catch {
1374
1499
  }
1500
+ applyAgentRunnerHeapEnv(sideboard.env);
1375
1501
  servers.push(sideboard);
1376
1502
  }
1377
1503
  if (opts.includeBrightsy && isBrightsyConnected()) {
@@ -1524,8 +1650,14 @@ var BASE_ALLOWED_TOOLS = [
1524
1650
  "WebSearch",
1525
1651
  // Subagents (Claude Code v2.1.63 renamed Task → Agent; allow both).
1526
1652
  "Task",
1527
- "Agent"
1653
+ "Agent",
1654
+ "TaskOutput",
1655
+ "TaskStop",
1656
+ "EnterWorktree",
1657
+ "ExitWorktree",
1658
+ "Skill"
1528
1659
  ];
1660
+ var CLAUDE_PRINT_BG_WAIT_CEILING_MS = 72e5;
1529
1661
  var CLAUDE_CHROME_ALLOWED_TOOLS = [
1530
1662
  "mcp__claude-in-chrome",
1531
1663
  "mcp__claude-in-chrome__*",
@@ -1629,6 +1761,80 @@ function claudeParentToolUseId(obj) {
1629
1761
  }
1630
1762
  return void 0;
1631
1763
  }
1764
+ function claudeString(obj, key) {
1765
+ const v = obj[key];
1766
+ return typeof v === "string" && v.trim() ? v.trim() : void 0;
1767
+ }
1768
+ function eventsFromClaudeSystem(obj) {
1769
+ const subtype = claudeString(obj, "subtype") ?? "";
1770
+ const parentId = claudeParentToolUseId(obj);
1771
+ if (subtype === "init") {
1772
+ if (parentId) return null;
1773
+ const sid = claudeString(obj, "session_id");
1774
+ return sid ? { type: "session_id", data: sid } : null;
1775
+ }
1776
+ if (subtype === "task_started") {
1777
+ const id = claudeString(obj, "tool_use_id") ?? claudeString(obj, "task_id");
1778
+ if (!id) return null;
1779
+ const description = claudeString(obj, "description");
1780
+ const taskType = claudeString(obj, "task_type");
1781
+ const prompt = claudeString(obj, "prompt");
1782
+ return withEventParentId(
1783
+ {
1784
+ type: "tool_use",
1785
+ id,
1786
+ name: taskType || "Agent",
1787
+ input: {
1788
+ ...description ? { description } : {},
1789
+ ...prompt ? { prompt } : {},
1790
+ ...claudeString(obj, "task_id") ? { task_id: claudeString(obj, "task_id") } : {}
1791
+ }
1792
+ },
1793
+ parentId
1794
+ );
1795
+ }
1796
+ if (subtype === "task_notification") {
1797
+ const id = claudeString(obj, "tool_use_id") ?? claudeString(obj, "task_id") ?? parentId;
1798
+ if (!id) return null;
1799
+ const status = claudeString(obj, "status") ?? "working";
1800
+ const tools = typeof obj.tool_uses === "number" ? obj.tool_uses : void 0;
1801
+ const durationMs = typeof obj.duration_ms === "number" ? obj.duration_ms : void 0;
1802
+ const lastTool = claudeString(obj, "last_tool") ?? claudeString(obj, "current_tool") ?? claudeString(obj, "tool");
1803
+ const snapshot = [
1804
+ status,
1805
+ tools != null ? `${tools} tools` : null,
1806
+ durationMs != null ? `${Math.round(durationMs / 1e3)}s` : null,
1807
+ lastTool
1808
+ ].filter((bit) => Boolean(bit)).join(" \xB7 ");
1809
+ return [
1810
+ {
1811
+ type: "tool_use",
1812
+ id,
1813
+ name: claudeString(obj, "task_type") || "Agent",
1814
+ input: {
1815
+ live_status: status,
1816
+ ...tools != null ? { live_tool_uses: tools } : {},
1817
+ ...durationMs != null ? { live_duration_ms: durationMs } : {},
1818
+ ...lastTool ? { live_last_tool: lastTool } : {}
1819
+ }
1820
+ },
1821
+ withEventParentId(
1822
+ { type: "thinking", data: snapshot, replace: true },
1823
+ id
1824
+ )
1825
+ ];
1826
+ }
1827
+ if (subtype === "api_retry") {
1828
+ const attempt = obj.attempt;
1829
+ const max = obj.max_retries;
1830
+ const delay = obj.retry_delay_ms;
1831
+ return {
1832
+ type: "thinking",
1833
+ data: `API retry ${attempt ?? "?"}/${max ?? "?"}${typeof delay === "number" ? ` (wait ${delay}ms)` : ""}`
1834
+ };
1835
+ }
1836
+ return null;
1837
+ }
1632
1838
  var claudeAdapter = {
1633
1839
  kind: "claude",
1634
1840
  async detect() {
@@ -1683,7 +1889,7 @@ var claudeAdapter = {
1683
1889
  );
1684
1890
  }
1685
1891
  const mode = permissionMode(thread);
1686
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-SKFODUQQ.js");
1892
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-H4YNASM6.js");
1687
1893
  const isOrchestrator = isOrchestratorThread2(thread);
1688
1894
  const injectedServers = await buildInjectedMcpServers({
1689
1895
  includeSideboard: true,
@@ -1751,7 +1957,12 @@ var claudeAdapter = {
1751
1957
  stdin: useStdin ? `${promptText}
1752
1958
  ` : void 0,
1753
1959
  // Nested Task/Agent thinking+text in stream-json (Claude Code 2.1.211+).
1754
- env: { CLAUDE_CODE_FORWARD_SUBAGENT_TEXT: "1" }
1960
+ // Raise the -p background-agent wait so long TaskOutput polls are not
1961
+ // abandoned at Claude Code’s 10-minute default.
1962
+ env: {
1963
+ CLAUDE_CODE_FORWARD_SUBAGENT_TEXT: "1",
1964
+ CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS: process.env.CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS ?? String(CLAUDE_PRINT_BG_WAIT_CEILING_MS)
1965
+ }
1755
1966
  };
1756
1967
  },
1757
1968
  parseEvent(line) {
@@ -1759,13 +1970,8 @@ var claudeAdapter = {
1759
1970
  if (!trimmed) return null;
1760
1971
  try {
1761
1972
  const obj = JSON.parse(trimmed);
1762
- if (obj.type === "system" && obj.subtype === "init") {
1763
- const sid = obj.session_id;
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 };
1973
+ if (obj.type === "system") {
1974
+ return eventsFromClaudeSystem(obj);
1769
1975
  }
1770
1976
  if (obj.type === "assistant" || obj.type === "user") {
1771
1977
  const parentId = claudeParentToolUseId(obj);
@@ -2195,9 +2401,6 @@ var codexAdapter = {
2195
2401
  if (sid && (type === "thread.started" || type === "session" || !type)) {
2196
2402
  return { type: "session_id", data: sid };
2197
2403
  }
2198
- if (sid && type.endsWith(".started")) {
2199
- return { type: "session_id", data: sid };
2200
- }
2201
2404
  if (type === "turn.completed" || type === "turn_completed") {
2202
2405
  const usage = usageFromCodex(obj.usage);
2203
2406
  return usage ? { type: "usage", data: usage, scope: "turn" } : null;
@@ -2832,7 +3035,8 @@ var opencodeAdapter = {
2832
3035
  return { type: "stderr", data: detail };
2833
3036
  }
2834
3037
  const sid = typeof obj.sessionID === "string" && obj.sessionID || typeof obj.sessionId === "string" && obj.sessionId || typeof obj.session_id === "string" && obj.session_id;
2835
- if (sid && (!obj.type || obj.type === "step_start" || obj.type === "session")) {
3038
+ const childSid = str2(obj.childSessionID) ?? str2(obj.childSessionId) ?? str2(obj.parentID) ?? str2(obj.parentId);
3039
+ if (sid && !childSid && (!obj.type || obj.type === "step_start" || obj.type === "session")) {
2836
3040
  return { type: "session_id", data: sid };
2837
3041
  }
2838
3042
  if (obj.type === "text") {
@@ -3429,6 +3633,7 @@ function allAdapters() {
3429
3633
 
3430
3634
  export {
3431
3635
  pushTurnStderr,
3636
+ looksLikeV8Oom,
3432
3637
  summarizeTurnStderr,
3433
3638
  looksLikeInvalidAgentSession,
3434
3639
  shouldRetryFailedAgentTurn,
@@ -3444,6 +3649,8 @@ export {
3444
3649
  listBrightsyChatTargets,
3445
3650
  brightsyAdapter,
3446
3651
  toolDescription,
3652
+ isPollWrapperToolName,
3653
+ liveActivitySummary,
3447
3654
  applyAgentEvent,
3448
3655
  partsToAssistantText,
3449
3656
  stripBrightsyNdjsonNoise,
@@ -3451,6 +3658,7 @@ export {
3451
3658
  finalizeParts,
3452
3659
  normalizeParseResult,
3453
3660
  sideboardMcpProfile,
3661
+ applyAgentRunnerHeapEnv,
3454
3662
  PLAN_MODE_INSTRUCTION,
3455
3663
  permissionMode,
3456
3664
  claudeAdapter,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveGithubRepoSlug
3
- } from "./chunk-C4KHDW3U.js";
3
+ } from "./chunk-FZCIQYNQ.js";
4
4
  import {
5
5
  resolveThreadDefaults
6
6
  } from "./chunk-4NR5FL46.js";
@@ -61,7 +61,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
61
61
  "- 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.",
62
62
  "- 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.",
63
63
  "- 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",
64
- "- 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.",
64
+ "- 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.",
65
65
  "- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
66
66
  "- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
67
67
  "Setup / run:",
@@ -36,6 +36,11 @@ function createAgentStreamCoalescer(emit, opts) {
36
36
  return;
37
37
  }
38
38
  if (!event.data) return;
39
+ if (event.type === "thinking" && event.replace) {
40
+ flush();
41
+ emit(event);
42
+ return;
43
+ }
39
44
  if (pending && pending.type === event.type && parentKey(pending) === parentKey(event)) {
40
45
  pending.data += event.data;
41
46
  } else {