@sideboard-ai/core 0.1.243 → 0.1.245

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 (27) hide show
  1. package/dist/{agents-CPME6O2H.js → agents-BOIIFMNG.js} +3 -3
  2. package/dist/{agents-VKO5UZO6.js → agents-FTQZFMDS.js} +3 -3
  3. package/dist/{chunk-HR4RNC73.js → chunk-3ZEBUVUI.js} +113 -29
  4. package/dist/{chunk-ECZTXNYR.js → chunk-576S3HJ7.js} +3 -3
  5. package/dist/{chunk-7UCZ4DRF.js → chunk-5ZFULOTC.js} +8 -0
  6. package/dist/{chunk-CCD2QIFK.js → chunk-E6C5NR46.js} +8 -0
  7. package/dist/{chunk-3P5OCI2X.js → chunk-GFRC6JQN.js} +3 -3
  8. package/dist/{chunk-DARSRQUE.js → chunk-J5IZXFLD.js} +16 -14
  9. package/dist/{chunk-NEOAHPMK.js → chunk-NT6MCFSB.js} +17 -15
  10. package/dist/{chunk-ISZERVDT.js → chunk-QRWVKBGP.js} +122 -30
  11. package/dist/{coordinator-prompt-AJ3E6LBX.js → coordinator-prompt-WQIICPT6.js} +2 -2
  12. package/dist/{coordinator-prompt-PYIRQGU7.js → coordinator-prompt-ZBYRREHD.js} +2 -2
  13. package/dist/{global-workspace-GQM653DP.js → global-workspace-2N6KISDO.js} +2 -2
  14. package/dist/{global-workspace-GIQ6F6IJ.js → global-workspace-3SQU4GL4.js} +2 -2
  15. package/dist/index.cjs +140 -34
  16. package/dist/index.d.cts +22 -6
  17. package/dist/index.d.ts +22 -6
  18. package/dist/index.js +12 -6
  19. package/dist/mcp/run-stdio.cjs +128 -34
  20. package/dist/mcp/run-stdio.js +6 -6
  21. package/dist/{orchestrator-3IOISDFS.js → orchestrator-5ROSTGGH.js} +4 -4
  22. package/dist/{orchestrator-YDPDMXUY.js → orchestrator-7YCQ7V5S.js} +4 -4
  23. package/dist/{workspaces-WYC5TLC3.js → workspaces-CFI7XVAE.js} +2 -2
  24. package/dist/{workspaces-OIBSD5B6.js → workspaces-QLKWW3O2.js} +2 -2
  25. package/dist/{worktree-DGDM7LGV.js → worktree-4UAOZUJ4.js} +3 -1
  26. package/dist/{worktree-5VRZVGP3.js → worktree-PK3QETXO.js} +3 -1
  27. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-3P5OCI2X.js";
3
+ } from "./chunk-GFRC6JQN.js";
4
4
  import {
5
5
  codexUnattendedGitConfigArgs,
6
6
  mergeAgentGitAuthEnv,
7
7
  resolveAgentGitAuthEnv,
8
8
  resolveCodexGitWritableRoots
9
- } from "./chunk-CCD2QIFK.js";
9
+ } from "./chunk-E6C5NR46.js";
10
10
  import {
11
11
  applyConnectedTeamToCli,
12
12
  brightsyMcpServerName,
@@ -1187,23 +1187,38 @@ function looksLikeComposerSkillExpansion(text) {
1187
1187
  const t = text.trim();
1188
1188
  return /^## Skill: \//m.test(t) && /Follow this skill for the request above:/i.test(t);
1189
1189
  }
1190
+ var SKILL_FRONTMATTER_NAME = /^\s*name\s*:\s*['"]?([A-Za-z0-9][A-Za-z0-9._-]*)['"]?\s*$/m;
1191
+ function skillNameFromFrontmatter(text) {
1192
+ const t = text.trim();
1193
+ if (!t) return void 0;
1194
+ let yaml = t;
1195
+ if (!yaml.startsWith("---")) {
1196
+ const at = t.search(/(?:^|\n)---(?:\r?\n)/);
1197
+ if (at < 0 || at > 800) return void 0;
1198
+ yaml = t.slice(at).replace(/^\n/, "");
1199
+ }
1200
+ if (!yaml.startsWith("---")) return void 0;
1201
+ const close = yaml.indexOf("\n---", 3);
1202
+ if (close < 0) return void 0;
1203
+ return yaml.slice(3, close).match(SKILL_FRONTMATTER_NAME)?.[1];
1204
+ }
1205
+ function skillCommandFromBody(text) {
1206
+ return skillNameFromFrontmatter(text) ?? text.match(/^## Skill: \/([A-Za-z0-9][A-Za-z0-9._-]*)/m)?.[1] ?? text.match(/^Launching skill:\s*\/?([A-Za-z0-9][A-Za-z0-9._-]*)/im)?.[1];
1207
+ }
1190
1208
  function looksLikeSkillBody(text) {
1191
1209
  const t = text.trim();
1192
1210
  if (!t) return false;
1193
1211
  if (looksLikeComposerSkillExpansion(t)) return true;
1194
- return skillNameFromFrontmatter(t) != null;
1212
+ if (skillNameFromFrontmatter(t) != null) return true;
1213
+ return /^Launching skill:/im.test(t) && /Base directory for this skill:/i.test(t);
1195
1214
  }
1196
- function skillNameFromFrontmatter(text) {
1215
+ function looksLikeIncompleteSkillDump(text) {
1197
1216
  const t = text.trim();
1198
- if (!t.startsWith("---")) return void 0;
1199
- const close = t.indexOf("\n---", 3);
1200
- if (close < 0) return void 0;
1201
- const fm = t.slice(3, close);
1202
- const m = fm.match(/^\s*name\s*:\s*['"]?([A-Za-z0-9][A-Za-z0-9._-]*)['"]?\s*$/m);
1203
- return m?.[1];
1204
- }
1205
- function skillCommandFromBody(text) {
1206
- return skillNameFromFrontmatter(text) ?? text.match(/^## Skill: \/([A-Za-z0-9][A-Za-z0-9._-]*)/m)?.[1];
1217
+ if (!t || looksLikeSkillBody(t)) return false;
1218
+ if (/^## Skill: \//m.test(t)) return true;
1219
+ if (/^Launching skill:/im.test(t)) return true;
1220
+ if (/Base directory for this skill:/i.test(t)) return true;
1221
+ return t.startsWith("---") && SKILL_FRONTMATTER_NAME.test(t);
1207
1222
  }
1208
1223
  function isCompactToolName(name) {
1209
1224
  const short = (name ?? "").replace(/^mcp__[^_]+__/, "").trim();
@@ -1605,22 +1620,70 @@ function withPartTimes(next, prev) {
1605
1620
  const startedAt = prev && typeof prev.startedAt === "number" ? prev.startedAt : now;
1606
1621
  return { ...next, startedAt, updatedAt: now };
1607
1622
  }
1608
- function skillToolFromTextPart(part, id) {
1623
+ function skillToolFromTextPart(part, id, status = "done") {
1609
1624
  const command = skillCommandFromBody(part.text);
1610
1625
  const input = command ? { skill: command } : void 0;
1611
1626
  return {
1612
1627
  type: "tool",
1613
- id,
1628
+ id: command ? `skill-${command}` : id,
1614
1629
  name: "Skill",
1615
1630
  input,
1616
1631
  description: toolDescription("Skill", input),
1617
- status: "done",
1632
+ status,
1618
1633
  result: clipToolResultForStore(part.text),
1619
1634
  ...part.parentId ? { parentId: part.parentId } : {},
1620
1635
  startedAt: part.startedAt,
1621
1636
  updatedAt: Date.now()
1622
1637
  };
1623
1638
  }
1639
+ function lastSkillToolIndex(parts, parentId) {
1640
+ for (let i = parts.length - 1; i >= 0; i--) {
1641
+ const p = parts[i];
1642
+ if (p.type === "tool" && isSkillToolName(p.name) && sameParentId(p.parentId, parentId)) {
1643
+ return i;
1644
+ }
1645
+ }
1646
+ return -1;
1647
+ }
1648
+ function lastRunningSkillIndex(parts, parentId) {
1649
+ for (let i = parts.length - 1; i >= 0; i--) {
1650
+ const p = parts[i];
1651
+ if (p.type === "tool" && isSkillToolName(p.name) && p.status === "running" && sameParentId(p.parentId, parentId)) {
1652
+ return i;
1653
+ }
1654
+ }
1655
+ return -1;
1656
+ }
1657
+ function promoteOrFoldSkillText(parts, textIdx) {
1658
+ const acc = parts[textIdx];
1659
+ if (acc?.type !== "text") return parts;
1660
+ const complete = looksLikeSkillBody(acc.text);
1661
+ const incomplete = looksLikeIncompleteSkillDump(acc.text);
1662
+ if (!complete && !incomplete) return parts;
1663
+ const existing = lastSkillToolIndex(parts, acc.parentId);
1664
+ if (existing >= 0 && existing !== textIdx) {
1665
+ const prev = parts[existing];
1666
+ const next2 = parts.filter((_, i) => i !== textIdx);
1667
+ const existingIdx = lastSkillToolIndex(next2, acc.parentId);
1668
+ if (existingIdx < 0) return parts;
1669
+ next2[existingIdx] = withPartTimes(
1670
+ {
1671
+ ...prev,
1672
+ status: complete ? "done" : prev.status,
1673
+ result: clipToolResultForStore(acc.text) ?? prev.result
1674
+ },
1675
+ prev
1676
+ );
1677
+ return next2;
1678
+ }
1679
+ const next = [...parts];
1680
+ next[textIdx] = skillToolFromTextPart(
1681
+ acc,
1682
+ `skill-${next.length}`,
1683
+ complete ? "done" : "running"
1684
+ );
1685
+ return next;
1686
+ }
1624
1687
  function compactSummaryPart(text, id = "compact-summary") {
1625
1688
  return compactToolPart(text, id, { status: "done" });
1626
1689
  }
@@ -1716,6 +1779,21 @@ function applyAgentEvent(parts, event) {
1716
1779
  })
1717
1780
  ];
1718
1781
  }
1782
+ const runningSkillIdx = lastRunningSkillIndex(parts, event.parentId);
1783
+ if (runningSkillIdx >= 0) {
1784
+ const prev = parts[runningSkillIdx];
1785
+ const result = `${prev.result ?? ""}${data}`;
1786
+ const next2 = [...parts];
1787
+ next2[runningSkillIdx] = withPartTimes(
1788
+ {
1789
+ ...prev,
1790
+ result: clipToolResultForStore(result),
1791
+ status: looksLikeSkillBody(result) ? "done" : prev.status
1792
+ },
1793
+ prev
1794
+ );
1795
+ return next2;
1796
+ }
1719
1797
  const next = [...parts];
1720
1798
  const last = next[next.length - 1];
1721
1799
  if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
@@ -1737,9 +1815,10 @@ function applyAgentEvent(parts, event) {
1737
1815
  );
1738
1816
  }
1739
1817
  const acc = next[next.length - 1];
1740
- if (acc?.type === "text" && looksLikeComposerSkillExpansion(acc.text)) {
1741
- next[next.length - 1] = skillToolFromTextPart(acc, `skill-${next.length}`);
1742
- } else if (acc?.type === "text" && looksLikeConversationSummary(acc.text)) {
1818
+ if (acc?.type === "text" && (looksLikeSkillBody(acc.text) || looksLikeIncompleteSkillDump(acc.text))) {
1819
+ return promoteOrFoldSkillText(next, next.length - 1);
1820
+ }
1821
+ if (acc?.type === "text" && looksLikeConversationSummary(acc.text)) {
1743
1822
  next[next.length - 1] = compactToolPart(acc.text, `compact-${next.length}`, {
1744
1823
  parentId: acc.parentId,
1745
1824
  status: "done",
@@ -1908,6 +1987,12 @@ function partsToAssistantText(parts) {
1908
1987
  (p) => p.type === "text" && !messagePartParentId(p)
1909
1988
  ).map((p) => p.text).join("").trim();
1910
1989
  }
1990
+ function visibleAssistantText(text, parts) {
1991
+ const fromParts = partsToAssistantText(parts ?? []);
1992
+ if (fromParts) return fromParts;
1993
+ if (parts?.some((p) => p.type === "tool" || p.type === "thinking")) return "";
1994
+ return (text ?? "").trim();
1995
+ }
1911
1996
  function lastAssistantMessageText(parts) {
1912
1997
  if (!parts?.length) return "";
1913
1998
  for (let i = parts.length - 1; i >= 0; i--) {
@@ -2114,13 +2199,17 @@ function eventsFromInjectedUserText(text, parentId) {
2114
2199
  if (looksLikeConversationSummary(text)) return compactToolEventsFromBody(text, parentId);
2115
2200
  return [];
2116
2201
  }
2202
+ function eventsFromAssistantText(text, parentId) {
2203
+ if (looksLikeSkillBody(text)) return skillToolEventsFromBody(text, parentId);
2204
+ return [withEventParentId({ type: "stdout", data: text }, parentId)];
2205
+ }
2117
2206
  function eventsFromUserContent(content, parentId) {
2118
2207
  if (typeof content === "string" && content.trim()) {
2119
2208
  return eventsFromInjectedUserText(content, parentId);
2120
2209
  }
2121
2210
  if (!Array.isArray(content) || content.length === 0) return [];
2122
2211
  const out = [];
2123
- const textBlocks = [];
2212
+ const injected = [];
2124
2213
  for (const block of content) {
2125
2214
  if (!block?.type) continue;
2126
2215
  if (block.type === "tool_use" && block.id && block.name) {
@@ -2151,13 +2240,12 @@ function eventsFromUserContent(content, parentId) {
2151
2240
  );
2152
2241
  continue;
2153
2242
  }
2154
- if (block.type === "text" && block.text) textBlocks.push(block.text);
2155
- }
2156
- if (out.length > 0) return out;
2157
- for (const text of textBlocks) {
2158
- out.push(...eventsFromInjectedUserText(text, parentId));
2243
+ if (block.type === "text" && block.text) {
2244
+ injected.push(...eventsFromInjectedUserText(block.text, parentId));
2245
+ }
2159
2246
  }
2160
- return out;
2247
+ if (out.length === 0 && injected.length === 0) return [];
2248
+ return [...out, ...injected];
2161
2249
  }
2162
2250
  function eventsFromContentBlocks(blocks, parentId) {
2163
2251
  if (!blocks?.length) return [];
@@ -2165,7 +2253,7 @@ function eventsFromContentBlocks(blocks, parentId) {
2165
2253
  for (const block of blocks) {
2166
2254
  if (!block?.type) continue;
2167
2255
  if (block.type === "text" && block.text) {
2168
- out.push(withEventParentId({ type: "stdout", data: block.text }, parentId));
2256
+ out.push(...eventsFromAssistantText(block.text, parentId));
2169
2257
  continue;
2170
2258
  }
2171
2259
  if ((block.type === "thinking" || block.type === "redacted_thinking") && block.thinking) {
@@ -2432,7 +2520,7 @@ var claudeAdapter = {
2432
2520
  );
2433
2521
  }
2434
2522
  const mode = permissionMode(thread);
2435
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-GQM653DP.js");
2523
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-2N6KISDO.js");
2436
2524
  const isOrchestrator = isOrchestratorThread2(thread);
2437
2525
  const injectedServers = await buildInjectedMcpServers({
2438
2526
  includeSideboard: true,
@@ -2594,7 +2682,9 @@ var claudeAdapter = {
2594
2682
  events.push({ type: "stderr", data: errorDetail });
2595
2683
  } else {
2596
2684
  const text = obj.result;
2597
- if (typeof text === "string" && text) events.push({ type: "stdout", data: text });
2685
+ if (typeof text === "string" && text) {
2686
+ events.push(...eventsFromAssistantText(text));
2687
+ }
2598
2688
  }
2599
2689
  const usage = usageFromClaude(obj.usage);
2600
2690
  if (usage) {
@@ -4419,9 +4509,10 @@ export {
4419
4509
  isSkillToolName,
4420
4510
  skillCommandFromInput,
4421
4511
  looksLikeComposerSkillExpansion,
4422
- looksLikeSkillBody,
4423
4512
  skillNameFromFrontmatter,
4424
4513
  skillCommandFromBody,
4514
+ looksLikeSkillBody,
4515
+ looksLikeIncompleteSkillDump,
4425
4516
  isCompactToolName,
4426
4517
  isContextCompactDone,
4427
4518
  isContextCompactInProgress,
@@ -4447,6 +4538,7 @@ export {
4447
4538
  compactPartsForSummaryMessage,
4448
4539
  applyAgentEvent,
4449
4540
  partsToAssistantText,
4541
+ visibleAssistantText,
4450
4542
  lastAssistantMessageText,
4451
4543
  stripBrightsyNdjsonNoise,
4452
4544
  isBrightsyNdjsonLine,
@@ -7,8 +7,8 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-3P5OCI2X.js";
11
- import "./chunk-CCD2QIFK.js";
10
+ } from "./chunk-GFRC6JQN.js";
11
+ import "./chunk-E6C5NR46.js";
12
12
  import "./chunk-6K64FJDD.js";
13
13
  import "./chunk-2P4XKWV2.js";
14
14
  import "./chunk-PPJ5JTWA.js";
@@ -9,8 +9,8 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-ECZTXNYR.js";
13
- import "./chunk-7UCZ4DRF.js";
12
+ } from "./chunk-576S3HJ7.js";
13
+ import "./chunk-5ZFULOTC.js";
14
14
  import "./chunk-D6JWYJ4P.js";
15
15
  import "./chunk-7HOKP4GR.js";
16
16
  import "./chunk-N6XI5KXL.js";
@@ -15,8 +15,8 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-3P5OCI2X.js";
19
- import "./chunk-CCD2QIFK.js";
18
+ } from "./chunk-GFRC6JQN.js";
19
+ import "./chunk-E6C5NR46.js";
20
20
  import "./chunk-6K64FJDD.js";
21
21
  import "./chunk-2P4XKWV2.js";
22
22
  import "./chunk-PPJ5JTWA.js";
@@ -17,8 +17,8 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-ECZTXNYR.js";
21
- import "./chunk-7UCZ4DRF.js";
20
+ } from "./chunk-576S3HJ7.js";
21
+ import "./chunk-5ZFULOTC.js";
22
22
  import "./chunk-D6JWYJ4P.js";
23
23
  import "./chunk-7HOKP4GR.js";
24
24
  import "./chunk-N6XI5KXL.js";