@sideboard-ai/core 0.1.235 → 0.1.237

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 (67) hide show
  1. package/dist/{abletime-WZNDTRVL.js → abletime-UX4VUENQ.js} +5 -5
  2. package/dist/{abletime-BGVOCEOU.js → abletime-VSV6AUBV.js} +5 -5
  3. package/dist/{abletime-oauth-ZLU2EYRK.js → abletime-oauth-DKBUZV2C.js} +4 -4
  4. package/dist/{abletime-oauth-6M5GWEPX.js → abletime-oauth-QMDV45JC.js} +4 -4
  5. package/dist/{abletime-rest-F7XG5NGY.js → abletime-rest-NL56UVK5.js} +4 -4
  6. package/dist/{abletime-rest-WNHIATB3.js → abletime-rest-VPBC2XS5.js} +4 -4
  7. package/dist/agents/cursor-runner.cjs +39 -35
  8. package/dist/agents/cursor-runner.js +3 -3
  9. package/dist/{agents-37JCAVSC.js → agents-6NAPLJU2.js} +9 -9
  10. package/dist/{agents-MOMMKSYV.js → agents-HJU23LIF.js} +8 -8
  11. package/dist/{app-settings-KBL2G7M4.js → app-settings-AGDLF75Z.js} +2 -2
  12. package/dist/{app-settings-UXWCPDEA.js → app-settings-I27UBVI4.js} +2 -2
  13. package/dist/{caffeinate-hold-OK4JJ5PP.js → caffeinate-hold-FNKIPXDU.js} +2 -2
  14. package/dist/{caffeinate-hold-22VFDPSO.js → caffeinate-hold-PXHGH7ZN.js} +2 -2
  15. package/dist/{chunk-7J72QJOM.js → chunk-224IXQOM.js} +1 -1
  16. package/dist/{chunk-7366AB7E.js → chunk-32DG3DA2.js} +514 -745
  17. package/dist/{chunk-4VGCG2HV.js → chunk-3AJUH66R.js} +2 -2
  18. package/dist/{chunk-P6ZM5QJW.js → chunk-3PGFAVFL.js} +2 -2
  19. package/dist/{chunk-MVLXDYN5.js → chunk-5ELC3KK3.js} +5 -5
  20. package/dist/{chunk-WPD7BR6C.js → chunk-5SHYLRTU.js} +1 -1
  21. package/dist/{chunk-WFUDY6PC.js → chunk-A4JGXX2F.js} +155 -24
  22. package/dist/{chunk-S2OEFXST.js → chunk-BILEJG3V.js} +20 -7
  23. package/dist/{chunk-TNVJPFHM.js → chunk-CJKL7A4G.js} +5 -5
  24. package/dist/{chunk-SWNEA5OZ.js → chunk-CRAXJAYJ.js} +3 -3
  25. package/dist/{chunk-C774RJJA.js → chunk-CWHMLCLN.js} +3 -3
  26. package/dist/{chunk-YWI3IBP2.js → chunk-DQN5U2VH.js} +1 -1
  27. package/dist/{chunk-RGNPPRZZ.js → chunk-DXY4K5MP.js} +3 -3
  28. package/dist/{chunk-LJWF3VA3.js → chunk-E6UJGLPM.js} +497 -673
  29. package/dist/{chunk-AS4UN7QL.js → chunk-IVXPXYH2.js} +5 -5
  30. package/dist/{chunk-SPAMHHJH.js → chunk-J5GON4SU.js} +1 -1
  31. package/dist/{chunk-D4VKJO5C.js → chunk-K6UTJOE6.js} +326 -20
  32. package/dist/{chunk-EQNRWDLN.js → chunk-KK63BFYN.js} +151 -24
  33. package/dist/{chunk-X5B3OS5I.js → chunk-N6XI5KXL.js} +1 -1
  34. package/dist/{chunk-XJETIO4K.js → chunk-NJ5OXOTN.js} +2 -2
  35. package/dist/{chunk-7H2CVVLF.js → chunk-O3UAQAYA.js} +3 -3
  36. package/dist/{chunk-4TYXWPAJ.js → chunk-OJFEVWZN.js} +1 -1
  37. package/dist/{chunk-TWXSZYR2.js → chunk-OKHOYI53.js} +18 -7
  38. package/dist/{chunk-I5NC7DWO.js → chunk-P3DCZRER.js} +1 -1
  39. package/dist/{chunk-RZTRWN2V.js → chunk-QLWMHQPH.js} +5 -5
  40. package/dist/{chunk-4VFOJZPS.js → chunk-TB6UMHIF.js} +3 -3
  41. package/dist/{chunk-EAYXD2IC.js → chunk-WRUBICEF.js} +302 -18
  42. package/dist/{chunk-GHRZNPBK.js → chunk-YXOOSFAF.js} +2 -2
  43. package/dist/{connected-teams-KQUDU7LZ.js → connected-teams-62AJRDDD.js} +2 -2
  44. package/dist/{connected-teams-JUJAQZZE.js → connected-teams-GXV22ZSF.js} +2 -2
  45. package/dist/{coordinator-prompt-IGDMFKCD.js → coordinator-prompt-5UINTEA6.js} +6 -6
  46. package/dist/{coordinator-prompt-CE7MN6QY.js → coordinator-prompt-ATK73HYU.js} +6 -6
  47. package/dist/{cursor-recover-DTQAUDGO.js → cursor-recover-DFMCTZA4.js} +2 -2
  48. package/dist/{cursor-recover-4PQAADAU.js → cursor-recover-K3EBEM7M.js} +2 -2
  49. package/dist/{global-workspace-7WH24UFO.js → global-workspace-TD5SARNW.js} +6 -6
  50. package/dist/{global-workspace-NCIC2Y2U.js → global-workspace-ZJBBICFJ.js} +6 -6
  51. package/dist/index.cjs +2230 -1164
  52. package/dist/index.d.cts +243 -14
  53. package/dist/index.d.ts +243 -14
  54. package/dist/index.js +903 -70
  55. package/dist/mcp/run-stdio.cjs +4772 -3854
  56. package/dist/mcp/run-stdio.js +723 -49
  57. package/dist/{orchestrator-6NPBOBNA.js → orchestrator-AAYKR4AI.js} +10 -10
  58. package/dist/{orchestrator-RKWRI3PJ.js → orchestrator-HPMDB2SG.js} +11 -11
  59. package/dist/{paths-C2VERLAE.js → paths-LGKOG7MY.js} +1 -1
  60. package/dist/{paths-LOXCISLX.js → paths-O6ZEAEUD.js} +1 -1
  61. package/dist/{thread-store-IKJD4EOK.js → thread-store-AYPBEZT5.js} +3 -3
  62. package/dist/{thread-store-FBK5SZ5P.js → thread-store-YOPKY74K.js} +3 -3
  63. package/dist/{workspaces-NSQZSDQD.js → workspaces-4SFSCYKT.js} +6 -6
  64. package/dist/{workspaces-H2TRFDE2.js → workspaces-JX5R4V24.js} +6 -6
  65. package/dist/{worktree-W7BSI4GU.js → worktree-AGVPKDBH.js} +5 -5
  66. package/dist/{worktree-FMIX4BRV.js → worktree-Y5FES5D6.js} +5 -5
  67. package/package.json +1 -1
@@ -2,13 +2,13 @@
2
2
 
3
3
  import {
4
4
  isOrchestratorThread
5
- } from "./chunk-TWXSZYR2.js";
5
+ } from "./chunk-OKHOYI53.js";
6
6
  import {
7
7
  applyConnectedTeamToCli,
8
8
  brightsyMcpServerName,
9
9
  ensureCliTeamTracked,
10
10
  ensureConnectedBrightsyTeamTokens
11
- } from "./chunk-SPAMHHJH.js";
11
+ } from "./chunk-J5GON4SU.js";
12
12
  import {
13
13
  loadBrightsyConfig
14
14
  } from "./chunk-P2BSMNHB.js";
@@ -20,7 +20,7 @@ import {
20
20
  mergeAgentGitAuthEnv,
21
21
  resolveAgentGitAuthEnv,
22
22
  resolveCodexGitWritableRoots
23
- } from "./chunk-4VFOJZPS.js";
23
+ } from "./chunk-TB6UMHIF.js";
24
24
  import {
25
25
  enrichPathWithNpmGlobalBin,
26
26
  isConductorBundledCli,
@@ -37,10 +37,10 @@ import {
37
37
  loadAppSettings,
38
38
  resolveAgentExecutable,
39
39
  resolveClaudeExecutable
40
- } from "./chunk-RZTRWN2V.js";
40
+ } from "./chunk-QLWMHQPH.js";
41
41
  import {
42
42
  appDataDir
43
- } from "./chunk-EQNRWDLN.js";
43
+ } from "./chunk-KK63BFYN.js";
44
44
  import {
45
45
  isElectronLikeCommand,
46
46
  unwrapStrippedElectronLaunch,
@@ -846,6 +846,7 @@ import { fileURLToPath } from "url";
846
846
 
847
847
  // src/mcp/profile.ts
848
848
  var SIDEBOARD_MCP_PROFILE_ENV = "SIDEBOARD_MCP_PROFILE";
849
+ var SIDEBOARD_THREAD_ID_ENV = "SIDEBOARD_THREAD_ID";
849
850
  function sideboardMcpProfile(env = process.env) {
850
851
  return env[SIDEBOARD_MCP_PROFILE_ENV]?.trim().toLowerCase() === "worktree" ? "worktree" : "orchestration";
851
852
  }
@@ -1236,6 +1237,8 @@ var SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS = [
1236
1237
  "mcp__sideboard__list_run_scripts",
1237
1238
  "mcp__sideboard__run_dev_script",
1238
1239
  "mcp__sideboard__stop_dev_script",
1240
+ "mcp__sideboard__get_run_log",
1241
+ "mcp__sideboard__notify_orchestrator",
1239
1242
  "mcp__sideboard__get_viewer_context",
1240
1243
  "mcp__sideboard__update_viewer_context"
1241
1244
  ];
@@ -1398,6 +1401,7 @@ async function buildInjectedMcpServers(opts) {
1398
1401
  const sideboard = await resolveSideboardMcpServer();
1399
1402
  const orchId = opts.orchestratorThreadId?.trim();
1400
1403
  const profile = orchId ? "orchestration" : "worktree";
1404
+ const threadId = opts.threadId?.trim() || orchId;
1401
1405
  sideboard.env = {
1402
1406
  ...sideboard.env ?? {},
1403
1407
  SIDEBOARD_APP_DATA: appDataDir(),
@@ -1406,6 +1410,9 @@ async function buildInjectedMcpServers(opts) {
1406
1410
  if (orchId) {
1407
1411
  sideboard.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID = orchId;
1408
1412
  }
1413
+ if (threadId) {
1414
+ sideboard.env[SIDEBOARD_THREAD_ID_ENV] = threadId;
1415
+ }
1409
1416
  try {
1410
1417
  mergeAgentGitAuthEnv(
1411
1418
  sideboard.env,
@@ -1666,7 +1673,76 @@ function clipChatLine(value, max = CHAT_DETAIL_MAX) {
1666
1673
  if (line.length <= max) return line;
1667
1674
  return `${line.slice(0, Math.max(1, max - 1))}\u2026`;
1668
1675
  }
1676
+ function isSkillToolName(name) {
1677
+ const n = (name ?? "").trim();
1678
+ if (/^(Skill|SlashCommand)$/i.test(n)) return true;
1679
+ return /(?:^|__)Skill$/i.test(n);
1680
+ }
1681
+ function skillCommandFromInput(input) {
1682
+ const raw = str(input?.skill) ?? str(input?.command) ?? str(input?.name) ?? str(input?.skill_name) ?? str(input?.skillName);
1683
+ if (raw) return raw.replace(/^\//, "").trim() || void 0;
1684
+ const path = str(input?.file_path) ?? str(input?.path);
1685
+ if (path && /SKILL\.md$/i.test(path)) {
1686
+ const parts = path.replace(/\\/g, "/").split("/");
1687
+ const dir = parts[parts.length - 2];
1688
+ if (dir && dir !== "skills") return dir;
1689
+ }
1690
+ return void 0;
1691
+ }
1692
+ function looksLikeSkillBody(text) {
1693
+ const t = text.trim();
1694
+ if (!t) return false;
1695
+ if (/^## Skill: \//m.test(t) && /Follow this skill for the request above:/i.test(t)) {
1696
+ return true;
1697
+ }
1698
+ return skillNameFromFrontmatter(t) != null;
1699
+ }
1700
+ function skillNameFromFrontmatter(text) {
1701
+ const t = text.trim();
1702
+ if (!t.startsWith("---")) return void 0;
1703
+ const close = t.indexOf("\n---", 3);
1704
+ if (close < 0) return void 0;
1705
+ const fm = t.slice(3, close);
1706
+ const m = fm.match(/^\s*name\s*:\s*['"]?([A-Za-z0-9][A-Za-z0-9._-]*)['"]?\s*$/m);
1707
+ return m?.[1];
1708
+ }
1709
+ function skillCommandFromBody(text) {
1710
+ return skillNameFromFrontmatter(text) ?? text.match(/^## Skill: \/([A-Za-z0-9][A-Za-z0-9._-]*)/m)?.[1];
1711
+ }
1712
+ function isCompactToolName(name) {
1713
+ const short = (name ?? "").replace(/^mcp__[^_]+__/, "").trim();
1714
+ return /^(Compact|ConversationCompact|summarize_context|SummarizeContext|SummarizeConversation)$/i.test(
1715
+ short
1716
+ );
1717
+ }
1718
+ function isContextCompactInProgress(text) {
1719
+ return /^Compressing context/i.test(text.trim());
1720
+ }
1721
+ function isContextCompactDone(text) {
1722
+ return /^Context compressed\b/i.test(text.trim());
1723
+ }
1724
+ function looksLikeConversationSummary(text) {
1725
+ const t = text.trim();
1726
+ if (t.length < 80) return false;
1727
+ if (/<summarized_conversation\b/i.test(t) || /<conversation_summary\b/i.test(t)) {
1728
+ return true;
1729
+ }
1730
+ if (/this session is being continued from a previous conversation/i.test(t)) {
1731
+ return true;
1732
+ }
1733
+ if (/conversation compacted|replaced with a summary/i.test(t)) return true;
1734
+ if (/^## Prior summary\b/m.test(t)) return true;
1735
+ if (/_Automatic extractive summary/i.test(t)) return true;
1736
+ if (/"context_summary"\s*:/.test(t)) return true;
1737
+ if (/^(?:#+\s*)?(?:conversation summary|summary of (?:the )?conversation|compacted (?:conversation|context))\b/im.test(
1738
+ t
1739
+ )) {
1740
+ return true;
1741
+ }
1742
+ return false;
1743
+ }
1669
1744
  function toolDetail(name, input) {
1745
+ if (isSkillToolName(name) || isCompactToolName(name)) return void 0;
1670
1746
  if (!input) return void 0;
1671
1747
  const command = str(input.command) ?? str(input.cmd);
1672
1748
  if (command) return clipChatLine(command);
@@ -1718,6 +1794,21 @@ function toolDescription(name, input) {
1718
1794
  if (/stop_dev_script$/i.test(name)) {
1719
1795
  return str(input?.name) ? `Stop ${str(input?.name)}` : "Stop Dev script";
1720
1796
  }
1797
+ if (/get_run_log$/i.test(name)) {
1798
+ return str(input?.name) ? `Read ${str(input?.name)} log` : "Read Dev log";
1799
+ }
1800
+ if (/notify_orchestrator$/i.test(name)) return "Notify orchestrator";
1801
+ if (isSkillToolName(name)) {
1802
+ const cmd = skillCommandFromInput(input);
1803
+ return cmd ? `Using /${cmd}` : "Using skill";
1804
+ }
1805
+ if (isCompactToolName(name)) {
1806
+ const trigger = str(input?.trigger);
1807
+ if (trigger && !/^auto$/i.test(trigger) && trigger !== "injected") {
1808
+ return `Summarized conversation (${trigger})`;
1809
+ }
1810
+ return "Summarized conversation";
1811
+ }
1721
1812
  if (isSubagentToolName(name)) {
1722
1813
  const desc = str(input?.description);
1723
1814
  const sub = asRecord(input?.subagentType);
@@ -1933,10 +2024,107 @@ function withPartTimes(next, prev) {
1933
2024
  const startedAt = prev && typeof prev.startedAt === "number" ? prev.startedAt : now;
1934
2025
  return { ...next, startedAt, updatedAt: now };
1935
2026
  }
2027
+ function skillToolFromTextPart(part, id) {
2028
+ const command = skillCommandFromBody(part.text);
2029
+ const input = command ? { skill: command } : void 0;
2030
+ return {
2031
+ type: "tool",
2032
+ id,
2033
+ name: "Skill",
2034
+ input,
2035
+ description: toolDescription("Skill", input),
2036
+ status: "done",
2037
+ result: clipToolResultForStore(part.text),
2038
+ ...part.parentId ? { parentId: part.parentId } : {},
2039
+ startedAt: part.startedAt,
2040
+ updatedAt: Date.now()
2041
+ };
2042
+ }
2043
+ function compactToolPart(text, id, opts) {
2044
+ const input = { trigger: opts?.trigger ?? "auto" };
2045
+ return withPartTimes(
2046
+ {
2047
+ type: "tool",
2048
+ id,
2049
+ name: "Compact",
2050
+ input,
2051
+ description: toolDescription("Compact", input),
2052
+ status: opts?.status ?? "done",
2053
+ result: clipToolResultForStore(text) ?? "",
2054
+ ...opts?.parentId ? { parentId: opts.parentId } : {}
2055
+ },
2056
+ opts?.prev
2057
+ );
2058
+ }
2059
+ function contextCompactInProgress(parts, parentId) {
2060
+ let compressing = false;
2061
+ for (const p of parts) {
2062
+ if (!sameParentId(p.parentId, parentId)) continue;
2063
+ if (p.type === "thinking" && isContextCompactInProgress(p.text)) compressing = true;
2064
+ if (p.type === "thinking" && isContextCompactDone(p.text)) compressing = false;
2065
+ }
2066
+ return compressing;
2067
+ }
2068
+ function lastRunningCompactIndex(parts, parentId) {
2069
+ for (let i = parts.length - 1; i >= 0; i--) {
2070
+ const p = parts[i];
2071
+ if (p.type === "tool" && isCompactToolName(p.name) && p.status === "running" && sameParentId(p.parentId, parentId)) {
2072
+ return i;
2073
+ }
2074
+ }
2075
+ return -1;
2076
+ }
2077
+ function markRunningCompactDone(parts, parentId) {
2078
+ return parts.map((p) => {
2079
+ if (p.type === "tool" && isCompactToolName(p.name) && p.status === "running" && sameParentId(p.parentId, parentId)) {
2080
+ return withPartTimes({ ...p, status: "done" }, p);
2081
+ }
2082
+ return p;
2083
+ });
2084
+ }
2085
+ function ensureCompactTool(parts, parentId) {
2086
+ const hasCompact = parts.some(
2087
+ (p) => p.type === "tool" && isCompactToolName(p.name) && sameParentId(p.parentId, parentId)
2088
+ );
2089
+ if (hasCompact) return parts;
2090
+ return [
2091
+ ...parts,
2092
+ compactToolPart("Context compressed", `compact-${parts.length}`, {
2093
+ parentId,
2094
+ status: "done"
2095
+ })
2096
+ ];
2097
+ }
2098
+ function withCompactFinish(parts, thinking, parentId) {
2099
+ if (!isContextCompactDone(thinking)) return parts;
2100
+ return ensureCompactTool(markRunningCompactDone(parts, parentId), parentId);
2101
+ }
1936
2102
  function applyAgentEvent(parts, event) {
1937
2103
  if (event.type === "stdout") {
1938
2104
  const data = event.data;
1939
2105
  if (!data) return parts;
2106
+ const runningIdx = lastRunningCompactIndex(parts, event.parentId);
2107
+ if (runningIdx >= 0) {
2108
+ const prev = parts[runningIdx];
2109
+ const next2 = [...parts];
2110
+ next2[runningIdx] = withPartTimes(
2111
+ {
2112
+ ...prev,
2113
+ result: clipToolResultForStore(`${prev.result ?? ""}${data}`)
2114
+ },
2115
+ prev
2116
+ );
2117
+ return next2;
2118
+ }
2119
+ if (contextCompactInProgress(parts, event.parentId)) {
2120
+ return [
2121
+ ...parts,
2122
+ compactToolPart(data, `compact-${parts.length}`, {
2123
+ parentId: event.parentId,
2124
+ status: "running"
2125
+ })
2126
+ ];
2127
+ }
1940
2128
  const next = [...parts];
1941
2129
  const last = next[next.length - 1];
1942
2130
  if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
@@ -1957,6 +2145,16 @@ function applyAgentEvent(parts, event) {
1957
2145
  })
1958
2146
  );
1959
2147
  }
2148
+ const acc = next[next.length - 1];
2149
+ if (acc?.type === "text" && looksLikeSkillBody(acc.text)) {
2150
+ next[next.length - 1] = skillToolFromTextPart(acc, `skill-${next.length}`);
2151
+ } else if (acc?.type === "text" && looksLikeConversationSummary(acc.text)) {
2152
+ next[next.length - 1] = compactToolPart(acc.text, `compact-${next.length}`, {
2153
+ parentId: acc.parentId,
2154
+ status: "done",
2155
+ prev: acc
2156
+ });
2157
+ }
1960
2158
  return next;
1961
2159
  }
1962
2160
  if (event.type === "thinking") {
@@ -1975,7 +2173,7 @@ function applyAgentEvent(parts, event) {
1975
2173
  },
1976
2174
  prev
1977
2175
  );
1978
- return next;
2176
+ return withCompactFinish(next, data, event.parentId);
1979
2177
  }
1980
2178
  }
1981
2179
  next.push(
@@ -1985,7 +2183,7 @@ function applyAgentEvent(parts, event) {
1985
2183
  ...event.parentId ? { parentId: event.parentId } : {}
1986
2184
  })
1987
2185
  );
1988
- return next;
2186
+ return withCompactFinish(next, data, event.parentId);
1989
2187
  }
1990
2188
  const last = next[next.length - 1];
1991
2189
  if (last?.type === "thinking" && sameParentId(last.parentId, event.parentId)) {
@@ -2006,7 +2204,7 @@ function applyAgentEvent(parts, event) {
2006
2204
  })
2007
2205
  );
2008
2206
  }
2009
- return next;
2207
+ return withCompactFinish(next, data, event.parentId);
2010
2208
  }
2011
2209
  if (event.type === "tool_use") {
2012
2210
  const input = asRecord(event.input);
@@ -2274,6 +2472,87 @@ function claudeResultErrorDetail(obj) {
2274
2472
  }
2275
2473
  return "Claude turn failed";
2276
2474
  }
2475
+ function toolResultContent(block) {
2476
+ if (typeof block.content === "string") return block.content;
2477
+ if (Array.isArray(block.content)) {
2478
+ return block.content.map(
2479
+ (c) => typeof c === "string" ? c : c && typeof c === "object" && "text" in c ? String(c.text ?? "") : ""
2480
+ ).join("");
2481
+ }
2482
+ if (block.content != null) return JSON.stringify(block.content);
2483
+ return void 0;
2484
+ }
2485
+ function skillToolEventsFromBody(text, parentId) {
2486
+ const command = skillCommandFromBody(text) ?? "skill";
2487
+ const id = `skill-${command}`;
2488
+ return [
2489
+ withEventParentId(
2490
+ { type: "tool_use", id, name: "Skill", input: { skill: command } },
2491
+ parentId
2492
+ ),
2493
+ withEventParentId({ type: "tool_result", id, content: text }, parentId)
2494
+ ];
2495
+ }
2496
+ function compactToolEventsFromBody(text, parentId) {
2497
+ const id = "compact-summary";
2498
+ return [
2499
+ withEventParentId(
2500
+ { type: "tool_use", id, name: "Compact", input: { trigger: "injected" } },
2501
+ parentId
2502
+ ),
2503
+ withEventParentId({ type: "tool_result", id, content: text }, parentId)
2504
+ ];
2505
+ }
2506
+ function eventsFromInjectedUserText(text, parentId) {
2507
+ if (looksLikeSkillBody(text)) return skillToolEventsFromBody(text, parentId);
2508
+ if (looksLikeConversationSummary(text)) return compactToolEventsFromBody(text, parentId);
2509
+ return [];
2510
+ }
2511
+ function eventsFromUserContent(content, parentId) {
2512
+ if (typeof content === "string" && content.trim()) {
2513
+ return eventsFromInjectedUserText(content, parentId);
2514
+ }
2515
+ if (!Array.isArray(content) || content.length === 0) return [];
2516
+ const out = [];
2517
+ const textBlocks = [];
2518
+ for (const block of content) {
2519
+ if (!block?.type) continue;
2520
+ if (block.type === "tool_use" && block.id && block.name) {
2521
+ out.push(
2522
+ withEventParentId(
2523
+ {
2524
+ type: "tool_use",
2525
+ id: block.id,
2526
+ name: block.name,
2527
+ input: block.input
2528
+ },
2529
+ parentId
2530
+ )
2531
+ );
2532
+ continue;
2533
+ }
2534
+ if (block.type === "tool_result" && block.tool_use_id) {
2535
+ out.push(
2536
+ withEventParentId(
2537
+ {
2538
+ type: "tool_result",
2539
+ id: block.tool_use_id,
2540
+ content: toolResultContent(block),
2541
+ isError: Boolean(block.is_error)
2542
+ },
2543
+ parentId
2544
+ )
2545
+ );
2546
+ continue;
2547
+ }
2548
+ if (block.type === "text" && block.text) textBlocks.push(block.text);
2549
+ }
2550
+ if (out.length > 0) return out;
2551
+ for (const text of textBlocks) {
2552
+ out.push(...eventsFromInjectedUserText(text, parentId));
2553
+ }
2554
+ return out;
2555
+ }
2277
2556
  function eventsFromContentBlocks(blocks, parentId) {
2278
2557
  if (!blocks?.length) return [];
2279
2558
  const out = [];
@@ -2302,15 +2581,12 @@ function eventsFromContentBlocks(blocks, parentId) {
2302
2581
  continue;
2303
2582
  }
2304
2583
  if (block.type === "tool_result" && block.tool_use_id) {
2305
- const content = typeof block.content === "string" ? block.content : Array.isArray(block.content) ? block.content.map(
2306
- (c) => typeof c === "string" ? c : c && typeof c === "object" && "text" in c ? String(c.text ?? "") : ""
2307
- ).join("") : block.content != null ? JSON.stringify(block.content) : void 0;
2308
2584
  out.push(
2309
2585
  withEventParentId(
2310
2586
  {
2311
2587
  type: "tool_result",
2312
2588
  id: block.tool_use_id,
2313
- content,
2589
+ content: toolResultContent(block),
2314
2590
  isError: Boolean(block.is_error)
2315
2591
  },
2316
2592
  parentId
@@ -2549,14 +2825,15 @@ var claudeAdapter = {
2549
2825
  );
2550
2826
  }
2551
2827
  const mode = permissionMode(thread);
2552
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-7WH24UFO.js");
2828
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-TD5SARNW.js");
2553
2829
  const isOrchestrator = isOrchestratorThread2(thread);
2554
2830
  const injectedServers = await buildInjectedMcpServers({
2555
2831
  includeSideboard: true,
2556
2832
  includeBrightsy: shouldInjectBrightsyMcp(thread, {
2557
2833
  orchestrator: isOrchestrator
2558
2834
  }),
2559
- orchestratorThreadId: isOrchestrator ? thread.id : null
2835
+ orchestratorThreadId: isOrchestrator ? thread.id : null,
2836
+ threadId: thread.id
2560
2837
  });
2561
2838
  const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
2562
2839
  const chromeOn = claudeChromeEnabled();
@@ -2649,7 +2926,10 @@ var claudeAdapter = {
2649
2926
  if (obj.type === "assistant" || obj.type === "user") {
2650
2927
  const parentId = claudeParentToolUseId(obj);
2651
2928
  const message = obj.message;
2652
- const events = eventsFromContentBlocks(message?.content, parentId);
2929
+ const events = obj.type === "user" ? eventsFromUserContent(message?.content, parentId) : eventsFromContentBlocks(
2930
+ Array.isArray(message?.content) ? message.content : void 0,
2931
+ parentId
2932
+ );
2653
2933
  if (obj.type === "assistant") {
2654
2934
  const usage = usageFromClaude(message?.usage);
2655
2935
  if (usage) events.push({ type: "usage", data: usage, scope: "request" });
@@ -2947,7 +3227,8 @@ var codexAdapter = {
2947
3227
  includeBrightsy: shouldInjectBrightsyMcp(thread, {
2948
3228
  orchestrator: isOrchestrator
2949
3229
  }),
2950
- orchestratorThreadId: isOrchestrator ? thread.id : null
3230
+ orchestratorThreadId: isOrchestrator ? thread.id : null,
3231
+ threadId: thread.id
2951
3232
  });
2952
3233
  const isolatePlugins = isOrchestrator || Boolean(thread.isolateCodexPlugins) || Boolean(normalizeTurnInput(input).isolateCodexPlugins);
2953
3234
  const mcpOverrides = [
@@ -3670,7 +3951,8 @@ var cursorAdapter = {
3670
3951
  includeBrightsy: shouldInjectBrightsyMcp(thread, {
3671
3952
  orchestrator: isOrchestrator
3672
3953
  }),
3673
- orchestratorThreadId: isOrchestrator ? thread.id : null
3954
+ orchestratorThreadId: isOrchestrator ? thread.id : null,
3955
+ threadId: thread.id
3674
3956
  });
3675
3957
  const mcpServers = toCursorMcpServers(injected);
3676
3958
  const req = {
@@ -3876,7 +4158,8 @@ var opencodeAdapter = {
3876
4158
  includeBrightsy: shouldInjectBrightsyMcp(thread, {
3877
4159
  orchestrator: isOrchestrator
3878
4160
  }),
3879
- orchestratorThreadId: isOrchestrator ? thread.id : null
4161
+ orchestratorThreadId: isOrchestrator ? thread.id : null,
4162
+ threadId: thread.id
3880
4163
  });
3881
4164
  const disableNames = isOrchestrator ? userMcpNamesToDisable({
3882
4165
  injectedNames: injected.map((s) => s.name),
@@ -4929,6 +5212,7 @@ export {
4929
5212
  adjustBrightsyTurnExit,
4930
5213
  listBrightsyChatTargets,
4931
5214
  brightsyAdapter,
5215
+ SIDEBOARD_THREAD_ID_ENV,
4932
5216
  sideboardMcpProfile,
4933
5217
  packagedMcpDir,
4934
5218
  applyAgentRunnerHeapEnv,
@@ -6,14 +6,14 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-AS4UN7QL.js";
9
+ } from "./chunk-IVXPXYH2.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-VKQGAWHY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
16
- } from "./chunk-RZTRWN2V.js";
16
+ } from "./chunk-QLWMHQPH.js";
17
17
 
18
18
  // src/integrations/abletime-rest.ts
19
19
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -9,11 +9,11 @@ import {
9
9
  ensureConnectedBrightsyTeamTokens,
10
10
  getConnectedBrightsyTeamsRaw,
11
11
  listConnectedBrightsyTeams
12
- } from "./chunk-SPAMHHJH.js";
12
+ } from "./chunk-J5GON4SU.js";
13
13
  import "./chunk-P2BSMNHB.js";
14
14
  import "./chunk-VKQGAWHY.js";
15
15
  import "./chunk-2UG25RMK.js";
16
- import "./chunk-EQNRWDLN.js";
16
+ import "./chunk-KK63BFYN.js";
17
17
  import "./chunk-WWUABK6B.js";
18
18
  export {
19
19
  applyConnectedTeamToCli,
@@ -7,10 +7,10 @@ import {
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  getConnectedBrightsyTeamsRaw,
9
9
  listConnectedBrightsyTeams
10
- } from "./chunk-TNVJPFHM.js";
10
+ } from "./chunk-CJKL7A4G.js";
11
11
  import "./chunk-ROPGQRPU.js";
12
12
  import "./chunk-N7WZ6NIN.js";
13
- import "./chunk-WFUDY6PC.js";
13
+ import "./chunk-A4JGXX2F.js";
14
14
  import "./chunk-QVN2WOKJ.js";
15
15
  import "./chunk-4TR3HZFT.js";
16
16
  export {
@@ -7,17 +7,17 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-S2OEFXST.js";
11
- import "./chunk-7H2CVVLF.js";
10
+ } from "./chunk-BILEJG3V.js";
11
+ import "./chunk-O3UAQAYA.js";
12
12
  import "./chunk-6K64FJDD.js";
13
13
  import "./chunk-2P4XKWV2.js";
14
- import "./chunk-I5NC7DWO.js";
14
+ import "./chunk-P3DCZRER.js";
15
15
  import "./chunk-WDRMZKVB.js";
16
16
  import "./chunk-JT7R45JB.js";
17
- import "./chunk-4VGCG2HV.js";
18
- import "./chunk-7J72QJOM.js";
17
+ import "./chunk-3AJUH66R.js";
18
+ import "./chunk-224IXQOM.js";
19
19
  import "./chunk-77WWLBCI.js";
20
- import "./chunk-WFUDY6PC.js";
20
+ import "./chunk-A4JGXX2F.js";
21
21
  import "./chunk-QVN2WOKJ.js";
22
22
  import "./chunk-4TR3HZFT.js";
23
23
  export {
@@ -9,17 +9,17 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-TWXSZYR2.js";
13
- import "./chunk-4VFOJZPS.js";
12
+ } from "./chunk-OKHOYI53.js";
13
+ import "./chunk-TB6UMHIF.js";
14
14
  import "./chunk-D6JWYJ4P.js";
15
- import "./chunk-XJETIO4K.js";
16
- import "./chunk-X5B3OS5I.js";
15
+ import "./chunk-NJ5OXOTN.js";
16
+ import "./chunk-N6XI5KXL.js";
17
17
  import "./chunk-DD67JWTN.js";
18
18
  import "./chunk-2UG25RMK.js";
19
- import "./chunk-RZTRWN2V.js";
19
+ import "./chunk-QLWMHQPH.js";
20
20
  import "./chunk-NSTQ6QKD.js";
21
21
  import "./chunk-KGZBYWZ3.js";
22
- import "./chunk-EQNRWDLN.js";
22
+ import "./chunk-KK63BFYN.js";
23
23
  import "./chunk-WWUABK6B.js";
24
24
  import "./chunk-FJZWM2ON.js";
25
25
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cursorSdkRunsNdjsonSearchPaths
3
- } from "./chunk-7J72QJOM.js";
4
- import "./chunk-WFUDY6PC.js";
3
+ } from "./chunk-224IXQOM.js";
4
+ import "./chunk-A4JGXX2F.js";
5
5
 
6
6
  // src/agents/cursor-recover.ts
7
7
  import { existsSync, readFileSync } from "fs";
@@ -2,8 +2,8 @@
2
2
 
3
3
  import {
4
4
  cursorSdkRunsNdjsonSearchPaths
5
- } from "./chunk-X5B3OS5I.js";
6
- import "./chunk-EQNRWDLN.js";
5
+ } from "./chunk-N6XI5KXL.js";
6
+ import "./chunk-KK63BFYN.js";
7
7
 
8
8
  // src/agents/cursor-recover.ts
9
9
  import { existsSync, readFileSync } from "fs";
@@ -17,19 +17,19 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-TWXSZYR2.js";
21
- import "./chunk-4VFOJZPS.js";
20
+ } from "./chunk-OKHOYI53.js";
21
+ import "./chunk-TB6UMHIF.js";
22
22
  import "./chunk-D6JWYJ4P.js";
23
- import "./chunk-XJETIO4K.js";
24
- import "./chunk-X5B3OS5I.js";
23
+ import "./chunk-NJ5OXOTN.js";
24
+ import "./chunk-N6XI5KXL.js";
25
25
  import "./chunk-DD67JWTN.js";
26
26
  import "./chunk-2UG25RMK.js";
27
- import "./chunk-RZTRWN2V.js";
27
+ import "./chunk-QLWMHQPH.js";
28
28
  import "./chunk-NSTQ6QKD.js";
29
29
  import "./chunk-KGZBYWZ3.js";
30
30
  import {
31
31
  globalAgentCwd
32
- } from "./chunk-EQNRWDLN.js";
32
+ } from "./chunk-KK63BFYN.js";
33
33
  import "./chunk-WWUABK6B.js";
34
34
  import "./chunk-FJZWM2ON.js";
35
35
  export {
@@ -15,19 +15,19 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-S2OEFXST.js";
19
- import "./chunk-7H2CVVLF.js";
18
+ } from "./chunk-BILEJG3V.js";
19
+ import "./chunk-O3UAQAYA.js";
20
20
  import "./chunk-6K64FJDD.js";
21
21
  import "./chunk-2P4XKWV2.js";
22
- import "./chunk-I5NC7DWO.js";
22
+ import "./chunk-P3DCZRER.js";
23
23
  import "./chunk-WDRMZKVB.js";
24
24
  import "./chunk-JT7R45JB.js";
25
- import "./chunk-4VGCG2HV.js";
26
- import "./chunk-7J72QJOM.js";
25
+ import "./chunk-3AJUH66R.js";
26
+ import "./chunk-224IXQOM.js";
27
27
  import "./chunk-77WWLBCI.js";
28
28
  import {
29
29
  globalAgentCwd
30
- } from "./chunk-WFUDY6PC.js";
30
+ } from "./chunk-A4JGXX2F.js";
31
31
  import "./chunk-QVN2WOKJ.js";
32
32
  import "./chunk-4TR3HZFT.js";
33
33
  export {