@sideboard-ai/core 0.1.348 → 0.1.349

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 (41) hide show
  1. package/dist/agents/cursor-runner.js +3 -3
  2. package/dist/{agents-5MFGVK7C.js → agents-AZ2PV6XP.js} +7 -7
  3. package/dist/{agents-T4XBZZDA.js → agents-DMPBFF3F.js} +5 -5
  4. package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
  5. package/dist/{chunk-NTY5WGRD.js → chunk-3DBL2C45.js} +1 -1
  6. package/dist/{chunk-MOUAM6ZC.js → chunk-6RIPZ73M.js} +132 -2
  7. package/dist/{chunk-6TV6L2DD.js → chunk-CATTIFSP.js} +6 -5
  8. package/dist/{chunk-WMD77UCY.js → chunk-IRFBD6GU.js} +223 -55
  9. package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
  10. package/dist/{chunk-XNGW4OYD.js → chunk-MHSBF3SO.js} +6 -5
  11. package/dist/{chunk-ZJMYCDYQ.js → chunk-MVFFLU5V.js} +47 -9
  12. package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
  13. package/dist/{chunk-OH3BAUMC.js → chunk-Q4I6KDOL.js} +227 -59
  14. package/dist/{chunk-2HPVGTHF.js → chunk-QHXZKHUL.js} +1 -1
  15. package/dist/{chunk-GAGTEI6B.js → chunk-ROXM6QZV.js} +48 -10
  16. package/dist/{chunk-ATS7SYHG.js → chunk-RPHH4FNK.js} +132 -2
  17. package/dist/{chunk-Y6VQX2LY.js → chunk-WHMLMCPU.js} +11 -5
  18. package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
  19. package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
  20. package/dist/{chunk-Q4TZA4MN.js → chunk-ZXI5DR5S.js} +12 -6
  21. package/dist/{conductor-EMGMDNHL.js → conductor-65VPUPOW.js} +6 -6
  22. package/dist/{conductor-LYQKONSA.js → conductor-NHC6X74J.js} +5 -5
  23. package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-5GZWIVSY.js} +3 -3
  24. package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-R2PURZL3.js} +3 -3
  25. package/dist/{global-workspace-UG2A3CEM.js → global-workspace-64KC7PST.js} +3 -3
  26. package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-UEECLWSX.js} +3 -3
  27. package/dist/index.cjs +1298 -849
  28. package/dist/index.d.cts +30 -8
  29. package/dist/index.d.ts +30 -8
  30. package/dist/index.js +445 -365
  31. package/dist/mcp/run-stdio.cjs +1033 -585
  32. package/dist/mcp/run-stdio.js +296 -216
  33. package/dist/{orchestrator-4SXTORD2.js → orchestrator-I5G5A5BV.js} +7 -7
  34. package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-Y5PYSMR6.js} +9 -9
  35. package/dist/{thread-store-R3G5VBII.js → thread-store-HZ4U4OXB.js} +1 -1
  36. package/dist/{thread-store-MEUWZDVV.js → thread-store-QKNU5CHM.js} +1 -1
  37. package/dist/{workspaces-KWGTP7DI.js → workspaces-6TIM2TM2.js} +3 -3
  38. package/dist/{workspaces-35T6FW57.js → workspaces-I2EHNTFE.js} +3 -3
  39. package/dist/{worktree-ROJXGBWS.js → worktree-7JFYDNUX.js} +2 -2
  40. package/dist/{worktree-5P7SCST3.js → worktree-M2GJGK2P.js} +2 -2
  41. package/package.json +1 -1
@@ -36,7 +36,6 @@ import {
36
36
  readTurnLive,
37
37
  registerViewerContextTools,
38
38
  resolveNotifyCallerThread,
39
- resolveOrchChildFollowUp,
40
39
  setToolPermissionPublisher,
41
40
  sliceRunLogOutput,
42
41
  stampAskUserBlock,
@@ -45,7 +44,7 @@ import {
45
44
  syncBoardPins,
46
45
  workspaceTagTargetRef,
47
46
  writeAgentBlock
48
- } from "../chunk-OH3BAUMC.js";
47
+ } from "../chunk-Q4I6KDOL.js";
49
48
  import "../chunk-DC3VZXMA.js";
50
49
  import {
51
50
  SIDEBOARD_THREAD_ID_ENV,
@@ -55,8 +54,9 @@ import {
55
54
  shouldRegisterMcpWaitForTurn,
56
55
  sideboardMcpProfile,
57
56
  worktreeMcpToolNames
58
- } from "../chunk-Y6VQX2LY.js";
57
+ } from "../chunk-WHMLMCPU.js";
59
58
  import {
59
+ classifyTurnFailure,
60
60
  mcpWaitForJobTimeoutMs,
61
61
  mcpWaitForTurnTimeoutMs,
62
62
  mcpWaitTaskHint,
@@ -66,14 +66,14 @@ import {
66
66
  waitForDetachedJob,
67
67
  waitForTurnToolResult,
68
68
  workspaceAgentChatSummaries
69
- } from "../chunk-ZJMYCDYQ.js";
69
+ } from "../chunk-MVFFLU5V.js";
70
70
  import {
71
71
  HUGE_TOOL_RESULT_SUMMARY,
72
72
  clipToolResultForStore,
73
73
  formatUnknownDetail,
74
74
  isInternalAgentStatusText,
75
75
  looksLikeHugeToolResultDump
76
- } from "../chunk-ORO4ENZR.js";
76
+ } from "../chunk-LESWJ7L4.js";
77
77
  import "../chunk-LX5R5JOR.js";
78
78
  import {
79
79
  commentAbleTimeTask,
@@ -106,20 +106,22 @@ import {
106
106
  isCloudCoordinatorThread,
107
107
  isGlobalThread,
108
108
  isOrchestratorThread
109
- } from "../chunk-6TV6L2DD.js";
109
+ } from "../chunk-CATTIFSP.js";
110
110
  import {
111
111
  canonicalizeRepoPath,
112
112
  formatGhLandError,
113
+ getPrCiChecks,
113
114
  ghRepoSelectArgs,
114
115
  listBranches,
115
116
  listPrs,
116
117
  resolveGithubRepoSlug,
117
118
  resolveListPrsOptions,
118
119
  resolveOriginRemote,
120
+ resolvePrSelector,
119
121
  resolveProjectRemoteTag,
120
122
  resolveRepoRoot,
121
123
  warmGithubAgentAuth
122
- } from "../chunk-2HPVGTHF.js";
124
+ } from "../chunk-QHXZKHUL.js";
123
125
  import "../chunk-I6RGRUNY.js";
124
126
  import "../chunk-E63AM3PW.js";
125
127
  import {
@@ -160,12 +162,15 @@ import {
160
162
  run
161
163
  } from "../chunk-TL2HK6LZ.js";
162
164
  import {
165
+ addChatFollowUp,
166
+ ciChecksSettled,
163
167
  createSchedule,
164
168
  deleteSchedule,
165
169
  findThreadByRef,
166
170
  getSchedule,
167
171
  listSchedules,
168
172
  listThreads,
173
+ normalizeChatFollowUps,
169
174
  normalizeWorkspaceTags,
170
175
  normalizeWorktreePath,
171
176
  parseWeeklyDays,
@@ -174,7 +179,7 @@ import {
174
179
  scheduleNeedsCaffeinate,
175
180
  updateSchedule,
176
181
  updateThread
177
- } from "../chunk-MOUAM6ZC.js";
182
+ } from "../chunk-6RIPZ73M.js";
178
183
  import "../chunk-WMZIANPV.js";
179
184
  import {
180
185
  formatWorkspaceProfileSuffix,
@@ -309,7 +314,7 @@ function createClippedMcpServer() {
309
314
  }
310
315
 
311
316
  // src/mcp/server.ts
312
- import { z as z9 } from "zod";
317
+ import { z as z10 } from "zod";
313
318
  import { randomUUID as randomUUID4 } from "crypto";
314
319
  import { basename } from "path";
315
320
 
@@ -333,7 +338,7 @@ function extractGitHubIssueAttachments(issue) {
333
338
  const texts = [issue.body ?? "", ...issue.comments.map((comment) => comment.body)];
334
339
  return mergeIssueAttachments(
335
340
  texts.flatMap(
336
- (text5) => extractHttpUrls(text5).filter(isGitHubIssueAttachmentUrl).map((url) => ({
341
+ (text6) => extractHttpUrls(text6).filter(isGitHubIssueAttachmentUrl).map((url) => ({
337
342
  id: url,
338
343
  name: url.split("/").pop() || "attachment",
339
344
  url
@@ -364,11 +369,11 @@ async function downloadGitHubIssueAttachment(input, opts) {
364
369
 
365
370
  // src/integrations/github-projects.ts
366
371
  function rewriteGitHubProjectReadError(detail) {
367
- const text5 = detail.trim() || "gh could not read GitHub Projects";
368
- if (/read:project|project scope|missing required scopes/i.test(text5)) {
369
- return `${text5} \u2014 run \`gh auth refresh -s read:project\` so Sideboard can read GitHub Projects.`;
372
+ const text6 = detail.trim() || "gh could not read GitHub Projects";
373
+ if (/read:project|project scope|missing required scopes/i.test(text6)) {
374
+ return `${text6} \u2014 run \`gh auth refresh -s read:project\` so Sideboard can read GitHub Projects.`;
370
375
  }
371
- return text5;
376
+ return text6;
372
377
  }
373
378
  function githubProjectsUnreadable(result) {
374
379
  return /project|scope|unknown json field/i.test(`${result.stderr}
@@ -1244,9 +1249,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions) {
1244
1249
  function lastMessagePreview(messages, max = 160) {
1245
1250
  if (!messages?.length) return null;
1246
1251
  for (let i = messages.length - 1; i >= 0; i--) {
1247
- const text5 = messages[i]?.text?.trim();
1248
- if (!text5 || isInternalAgentStatusText(text5) || isInjectedNoticeText(text5)) continue;
1249
- const flat = text5.replace(/\s+/g, " ");
1252
+ const text6 = messages[i]?.text?.trim();
1253
+ if (!text6 || isInternalAgentStatusText(text6) || isInjectedNoticeText(text6)) continue;
1254
+ const flat = text6.replace(/\s+/g, " ");
1250
1255
  return flat.length > max ? `${flat.slice(0, max)}\u2026` : flat;
1251
1256
  }
1252
1257
  return null;
@@ -1276,15 +1281,15 @@ var CRUSH_COMMENT_MAX_CHARS = 16e3;
1276
1281
  var CRUSH_BODY_MIN_CHARS = 12e3;
1277
1282
  var CRUSH_BODY_MAX_CHARS = 8e3;
1278
1283
  var NEAR_DUP_JACCARD = 0.92;
1279
- function looksLikeMustKeep(text5) {
1280
- return MUST_KEEP_TEXT_RE.test(text5);
1284
+ function looksLikeMustKeep(text6) {
1285
+ return MUST_KEEP_TEXT_RE.test(text6);
1281
1286
  }
1282
- function normalizeText(text5) {
1283
- return text5.replace(/\s+/g, " ").trim().toLowerCase();
1287
+ function normalizeText(text6) {
1288
+ return text6.replace(/\s+/g, " ").trim().toLowerCase();
1284
1289
  }
1285
- function wordSet(text5) {
1290
+ function wordSet(text6) {
1286
1291
  return new Set(
1287
- text5.toLowerCase().split(/\W+/).filter((w) => w.length > 2)
1292
+ text6.toLowerCase().split(/\W+/).filter((w) => w.length > 2)
1288
1293
  );
1289
1294
  }
1290
1295
  function jaccard(a, b) {
@@ -1296,11 +1301,11 @@ function jaccard(a, b) {
1296
1301
  const union = a.size + b.size - inter;
1297
1302
  return union === 0 ? 0 : inter / union;
1298
1303
  }
1299
- function importance(text5) {
1300
- let score = text5.length;
1301
- if (/```/.test(text5)) score += 400;
1302
- if (/https?:\/\//.test(text5)) score += 50;
1303
- if (looksLikeMustKeep(text5)) score += 1e4;
1304
+ function importance(text6) {
1305
+ let score = text6.length;
1306
+ if (/```/.test(text6)) score += 400;
1307
+ if (/https?:\/\//.test(text6)) score += 50;
1308
+ if (looksLikeMustKeep(text6)) score += 1e4;
1304
1309
  return score;
1305
1310
  }
1306
1311
  function meanStd(values) {
@@ -1314,15 +1319,15 @@ function dedupTextItems(items, getText) {
1314
1319
  const keptNorm = [];
1315
1320
  const keptWords = [];
1316
1321
  for (const item of items) {
1317
- const text5 = getText(item);
1318
- const norm = normalizeText(text5);
1322
+ const text6 = getText(item);
1323
+ const norm = normalizeText(text6);
1319
1324
  if (!norm) {
1320
1325
  kept.push(item);
1321
1326
  keptNorm.push(norm);
1322
- keptWords.push(wordSet(text5));
1327
+ keptWords.push(wordSet(text6));
1323
1328
  continue;
1324
1329
  }
1325
- const words = wordSet(text5);
1330
+ const words = wordSet(text6);
1326
1331
  let dupAt = -1;
1327
1332
  for (let i = 0; i < kept.length; i++) {
1328
1333
  if (keptNorm[i] === norm) {
@@ -1340,7 +1345,7 @@ function dedupTextItems(items, getText) {
1340
1345
  keptWords.push(words);
1341
1346
  continue;
1342
1347
  }
1343
- if (text5.length > getText(kept[dupAt]).length) {
1348
+ if (text6.length > getText(kept[dupAt]).length) {
1344
1349
  kept[dupAt] = item;
1345
1350
  keptNorm[dupAt] = norm;
1346
1351
  keptWords[dupAt] = words;
@@ -1381,8 +1386,8 @@ function crushTextItems(items, getText, opts = {}) {
1381
1386
  const outlierFloor = mean + 2 * std;
1382
1387
  const mustKeep = /* @__PURE__ */ new Set();
1383
1388
  unique.forEach((item, i) => {
1384
- const text5 = getText(item);
1385
- if (looksLikeMustKeep(text5) || text5.length > outlierFloor) mustKeep.add(i);
1389
+ const text6 = getText(item);
1390
+ if (looksLikeMustKeep(text6) || text6.length > outlierFloor) mustKeep.add(i);
1386
1391
  });
1387
1392
  const remainingIdx = unique.map((_, i) => i).filter((i) => !mustKeep.has(i));
1388
1393
  let used = [...mustKeep].reduce((n, i) => n + lengths[i], 0);
@@ -1424,9 +1429,9 @@ function crushTextItems(items, getText, opts = {}) {
1424
1429
  reason: "budget"
1425
1430
  };
1426
1431
  }
1427
- function splitBlocks(text5) {
1428
- if (/\n\n/.test(text5)) return text5.split(/\n\n+/);
1429
- return text5.split("\n");
1432
+ function splitBlocks(text6) {
1433
+ if (/\n\n/.test(text6)) return text6.split(/\n\n+/);
1434
+ return text6.split("\n");
1430
1435
  }
1431
1436
  function capOversizedBlock(block, maxChars) {
1432
1437
  if (block.length <= maxChars) return block;
@@ -1438,8 +1443,8 @@ function capOversizedBlock(block, maxChars) {
1438
1443
 
1439
1444
  ${block.slice(-tail)}`;
1440
1445
  }
1441
- function crushMarkdown(text5, opts) {
1442
- const original = text5 ?? "";
1446
+ function crushMarkdown(text6, opts) {
1447
+ const original = text6 ?? "";
1443
1448
  const minChars = opts?.minChars ?? CRUSH_BODY_MIN_CHARS;
1444
1449
  const maxChars = opts?.maxChars ?? CRUSH_BODY_MAX_CHARS;
1445
1450
  if (original.length < minChars) {
@@ -1529,13 +1534,13 @@ function withComments(comments, meta) {
1529
1534
  }
1530
1535
  return { comments: crushed.items, meta };
1531
1536
  }
1532
- function withBody(text5, meta) {
1533
- const crushed = crushMarkdown(text5);
1537
+ function withBody(text6, meta) {
1538
+ const crushed = crushMarkdown(text6);
1534
1539
  if (crushed.truncated) {
1535
1540
  meta.body = { originalChars: crushed.originalChars };
1536
1541
  return { value: crushed.text, meta };
1537
1542
  }
1538
- return { value: text5, meta };
1543
+ return { value: text6, meta };
1539
1544
  }
1540
1545
  function attachCrush(payload, meta) {
1541
1546
  if (!meta.comments && !meta.body) return payload;
@@ -2324,9 +2329,9 @@ async function runPosthogApi(input) {
2324
2329
  body,
2325
2330
  signal: AbortSignal.timeout(POSTHOG_TIMEOUT_MS)
2326
2331
  });
2327
- const text5 = await res.text();
2328
- const truncated = text5.length > POSTHOG_RESPONSE_MAX_CHARS;
2329
- const slice = truncated ? text5.slice(0, POSTHOG_RESPONSE_MAX_CHARS) : text5;
2332
+ const text6 = await res.text();
2333
+ const truncated = text6.length > POSTHOG_RESPONSE_MAX_CHARS;
2334
+ const slice = truncated ? text6.slice(0, POSTHOG_RESPONSE_MAX_CHARS) : text6;
2330
2335
  let parsed = slice;
2331
2336
  if (slice.trim()) {
2332
2337
  try {
@@ -2469,7 +2474,7 @@ function registerArchiveTools(server, orch) {
2469
2474
  );
2470
2475
  server.tool(
2471
2476
  "archive_chat",
2472
- "Archive one agent chat: stop the turn and move that chat to Settings \u2192 History. Other agents on the workspace stay, and the worktree is removed only when this is the last agent. Orchestration chats archive without removing a project checkout. Refuses the cloud coordinator. To archive every agent on a checkout, use archive_workspace. Commit, push, and open PRs via ask_git before archiving when the work should be kept. Merge only when the user explicitly asked.",
2477
+ "Archive one agent chat: stop the turn and move that chat to Settings \u2192 History. Other agents on the workspace stay, and the worktree is removed only when this is the last agent. Uncommitted and untracked files are saved on a hidden git ref and put back uncommitted if that checkout is restored. If that snapshot fails, the checkout stays. History Delete does not keep the snapshot. Orchestration chats archive without removing a project checkout. Refuses the cloud coordinator. To archive every agent on a checkout, use archive_workspace. Commit, push, and open PRs via ask_git before archiving when the work should be kept. Merge only when the user explicitly asked.",
2473
2478
  { ref: z6.string().describe("Chat id to archive") },
2474
2479
  async ({ ref }) => {
2475
2480
  const t = orch.getThread(ref);
@@ -2772,8 +2777,80 @@ function registerScheduleTools(server) {
2772
2777
  );
2773
2778
  }
2774
2779
 
2775
- // src/mcp/order-tools.ts
2780
+ // src/mcp/follow-up-tools.ts
2776
2781
  import { z as z8 } from "zod";
2782
+ function text5(payload, isError = false) {
2783
+ return mcpJson(payload, isError);
2784
+ }
2785
+ function callerThread() {
2786
+ const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
2787
+ if (!id) return null;
2788
+ return findThreadByRef(id);
2789
+ }
2790
+ async function baselineCi(thread) {
2791
+ const selector = resolvePrSelector(thread);
2792
+ if (!selector) return "none";
2793
+ try {
2794
+ const checks = await getPrCiChecks(thread.worktreePath, selector);
2795
+ return ciChecksSettled(checks);
2796
+ } catch {
2797
+ return "unknown";
2798
+ }
2799
+ }
2800
+ function registerFollowUpTools(server) {
2801
+ server.tool(
2802
+ "list_follow_ups",
2803
+ "List follow-ups on this chat. kind=ci wakes when GitHub checks finish. kind=at wakes at a time. A running turn is not interrupted.",
2804
+ {},
2805
+ async () => {
2806
+ const thread = callerThread();
2807
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2808
+ return text5({ followUps: normalizeChatFollowUps(thread.followUps) });
2809
+ }
2810
+ );
2811
+ server.tool(
2812
+ "create_follow_up",
2813
+ "Register a follow-up on THIS chat. kind=ci sends the prompt when GitHub checks on this chat\u2019s PR finish (pass or fail). Checks that are already finished do not send until a later run finishes. A failed checks read does not count as finished or in progress. A CI follow-up that is still pending at deadline (default 7 days) ends silently. kind=at sends at `30m`, `2h`, `1d`, or an ISO time and waits behind a turn that is already running. Cap 10.",
2814
+ {
2815
+ kind: z8.enum(["ci", "at"]),
2816
+ prompt: z8.string(),
2817
+ at: z8.string().optional(),
2818
+ deadline: z8.string().optional()
2819
+ },
2820
+ async ({ kind, prompt, at, deadline }) => {
2821
+ const thread = callerThread();
2822
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2823
+ if (thread.status === "archived") return text5({ error: "This chat is archived" }, true);
2824
+ const existing = normalizeChatFollowUps(thread.followUps);
2825
+ const ciBaseline = kind === "ci" ? await baselineCi(thread) : void 0;
2826
+ const added = addChatFollowUp(
2827
+ existing,
2828
+ { kind, prompt, at, deadline, ciBaseline },
2829
+ /* @__PURE__ */ new Date()
2830
+ );
2831
+ if (!added.ok) return text5({ error: added.error }, true);
2832
+ updateThread(thread.id, { followUps: added.followUps });
2833
+ return text5({ followUps: added.followUps });
2834
+ }
2835
+ );
2836
+ server.tool(
2837
+ "delete_follow_up",
2838
+ "Remove one follow-up from this chat by id.",
2839
+ { id: z8.string() },
2840
+ async ({ id }) => {
2841
+ const thread = callerThread();
2842
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2843
+ const existing = normalizeChatFollowUps(thread.followUps);
2844
+ const followUps = existing.filter((item) => item.id !== id.trim());
2845
+ if (followUps.length === existing.length) return text5({ error: "Follow-up not found" }, true);
2846
+ updateThread(thread.id, { followUps });
2847
+ return text5({ followUps });
2848
+ }
2849
+ );
2850
+ }
2851
+
2852
+ // src/mcp/order-tools.ts
2853
+ import { z as z9 } from "zod";
2777
2854
 
2778
2855
  // src/order/order.ts
2779
2856
  import { randomUUID } from "crypto";
@@ -3622,8 +3699,8 @@ function satisfyOrderDependency(id, satisfied = true) {
3622
3699
  }
3623
3700
 
3624
3701
  // src/mcp/order-tools.ts
3625
- var kindSchema = z8.enum(["pr", "issue", "workspace", "orchestration"]);
3626
- function callerThread() {
3702
+ var kindSchema = z9.enum(["pr", "issue", "workspace", "orchestration"]);
3703
+ function callerThread2() {
3627
3704
  const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim();
3628
3705
  if (!id) return null;
3629
3706
  return readThread(id);
@@ -3636,7 +3713,7 @@ function readCheckoutPlan(caller) {
3636
3713
  return readPlanFile(root);
3637
3714
  }
3638
3715
  function orchestrationOwnerId(worktree) {
3639
- const caller = callerThread();
3716
+ const caller = callerThread2();
3640
3717
  if (!caller) {
3641
3718
  throw new Error(
3642
3719
  worktree ? "No worktree chat is bound to this tool." : "No orchestration chat is bound to this tool."
@@ -3672,10 +3749,10 @@ function registerOrderTools(server) {
3672
3749
  try {
3673
3750
  const owner = orchestrationOwnerId(worktree);
3674
3751
  const plan = getOrderPlan(owner);
3675
- const caller = callerThread();
3752
+ const caller = callerThread2();
3676
3753
  if (!plan) {
3677
- const text5 = worktree ? "This checkout's orchestrator has no plan yet." : "This chat has no plan. set_plan drafts one. Then show_plan so the user sees it.";
3678
- return { content: [{ type: "text", text: text5 }] };
3754
+ const text6 = worktree ? "This checkout's orchestrator has no plan yet." : "This chat has no plan. set_plan drafts one. Then show_plan so the user sees it.";
3755
+ return { content: [{ type: "text", text: text6 }] };
3679
3756
  }
3680
3757
  const rows = listOrderRows(plan.id);
3681
3758
  const place = worktree && caller ? `${formatOrderPlace(rows, orderSnapshotFromThread(caller))}
@@ -3694,16 +3771,16 @@ function registerOrderTools(server) {
3694
3771
  worktree ? "Change what this checkout waits on. Omit subject to mean this workspace (hold=merge uses this PR; hold=start on a ticket uses this issue). gate=in-main (met when that PR is merged) or in-prod (stays waiting until satisfy_dependency). hold=start means do not begin; hold=merge means do not merge. You cannot set a dependency for a different checkout. show_plan so the user sees the change." : "Record a step on this orchestration plan. waitsOn must reach gate before subject can hold. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency. hold=start blocks starting the subject; hold=merge blocks merging it. Example: PR 1 in prod before PR 2 can merge; PR 3 in main before issue 4 can start. Pass repoPath when the same PR number exists in more than one project. Worktree agents set their own checkout and can omit subject. Then show_plan so the user sees it.",
3695
3772
  {
3696
3773
  waitsOnKind: kindSchema.describe("What must happen first: pr, issue, workspace, or orchestration"),
3697
- waitsOnRef: z8.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
3698
- waitsOnRepoPath: z8.string().optional().describe("Project path when a PR or issue number is not unique"),
3699
- waitsOnLabel: z8.string().optional().describe("Short label on the planner"),
3700
- gate: z8.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
3701
- hold: z8.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
3774
+ waitsOnRef: z9.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
3775
+ waitsOnRepoPath: z9.string().optional().describe("Project path when a PR or issue number is not unique"),
3776
+ waitsOnLabel: z9.string().optional().describe("Short label on the planner"),
3777
+ gate: z9.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
3778
+ hold: z9.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
3702
3779
  subjectKind: kindSchema.optional().describe("What is held. Required from orchestration. Omit on a worktree to mean this checkout."),
3703
- subjectRef: z8.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
3704
- subjectRepoPath: z8.string().optional(),
3705
- subjectLabel: z8.string().optional(),
3706
- note: z8.string().optional().describe("Why this order matters")
3780
+ subjectRef: z9.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
3781
+ subjectRepoPath: z9.string().optional(),
3782
+ subjectLabel: z9.string().optional(),
3783
+ note: z9.string().optional().describe("Why this order matters")
3707
3784
  },
3708
3785
  async (args) => {
3709
3786
  try {
@@ -3712,7 +3789,7 @@ function registerOrderTools(server) {
3712
3789
  if (hasKind !== hasRef) {
3713
3790
  throw new Error("Pass subjectKind and subjectRef together, or omit both on a worktree.");
3714
3791
  }
3715
- const caller = callerThread();
3792
+ const caller = callerThread2();
3716
3793
  let subject;
3717
3794
  const hold = parseOrderHold(args.hold);
3718
3795
  if (!hasKind) {
@@ -3767,9 +3844,9 @@ function registerOrderTools(server) {
3767
3844
  "set_plan",
3768
3845
  "Draft or retitle this chat's plan. It stays draft until execute_plan. Pass goal for the outcome the steps are trying to reach. Then set_dependency for each gate. A step may loop back to an earlier one. Call show_plan so the user sees it. Do not paste the diagram in chat. Do not start workspaces while it is draft.",
3769
3846
  {
3770
- title: z8.string().describe("Short name for the plan"),
3771
- summary: z8.string().optional().describe("What this order is for, in a sentence or two"),
3772
- goal: z8.string().optional().describe("Outcome the steps are trying to reach")
3847
+ title: z9.string().describe("Short name for the plan"),
3848
+ summary: z9.string().optional().describe("What this order is for, in a sentence or two"),
3849
+ goal: z9.string().optional().describe("Outcome the steps are trying to reach")
3773
3850
  },
3774
3851
  async ({ title, summary, goal }) => {
3775
3852
  try {
@@ -3789,7 +3866,7 @@ function registerOrderTools(server) {
3789
3866
  "execute_plan",
3790
3867
  "Mark the plan active after the user has seen it and told you to run it. Returns ready steps (start those with create_workspace or send_to_chat) and waiting steps (leave them alone). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
3791
3868
  {
3792
- agreed: z8.literal(true).describe("True only after the user has seen the plan and told you to run it")
3869
+ agreed: z9.literal(true).describe("True only after the user has seen the plan and told you to run it")
3793
3870
  },
3794
3871
  async () => {
3795
3872
  try {
@@ -3822,7 +3899,7 @@ function registerOrderTools(server) {
3822
3899
  worktree ? "Open the plans for this checkout in the side column. That is the orchestration diagram, with this checkout marked, and this checkout's implementation plan (plan.md) when the file exists. Does not write either plan. Change a step with set_dependency or clear_dependency, then show it again. Do not paste the diagram in chat." : "Open this chat's plan in the side column. Call it after set_plan or set_dependency so the user sees the plan. A worktree show_plan also opens that checkout's implementation plan (plan.md) when the file exists. Does not write either plan. Do not paste the diagram in chat.",
3823
3900
  {},
3824
3901
  async () => {
3825
- const caller = callerThread();
3902
+ const caller = callerThread2();
3826
3903
  let diagramHtml = null;
3827
3904
  let diagramTitle = "Planner";
3828
3905
  let diagramError = null;
@@ -3860,10 +3937,10 @@ function registerOrderTools(server) {
3860
3937
  server.tool(
3861
3938
  "clear_dependency",
3862
3939
  worktree ? "Remove a planner step this checkout is part of. Pass id from list_order. Then show_plan so the user sees it." : "Remove one planner step. Pass id from list_order. Then show_plan so the user sees it.",
3863
- { id: z8.string().describe("Step id from list_order") },
3940
+ { id: z9.string().describe("Step id from list_order") },
3864
3941
  async ({ id }) => {
3865
3942
  try {
3866
- const caller = callerThread();
3943
+ const caller = callerThread2();
3867
3944
  clearOrderDependency(
3868
3945
  id,
3869
3946
  worktree && caller ? orderSnapshotFromThread(caller) : null,
@@ -3879,8 +3956,8 @@ function registerOrderTools(server) {
3879
3956
  "satisfy_dependency",
3880
3957
  "Mark a planner gate met. Use this when a PR is in production \u2014 Sideboard cannot see deploys. in-main also clears on its own once that PR is merged. Pass satisfied=false to undo a manual mark. One mark covers every step waiting on that same gate.",
3881
3958
  {
3882
- id: z8.string().describe("Step id from list_order"),
3883
- satisfied: z8.boolean().optional().describe("false clears the manual mark. Default true.")
3959
+ id: z9.string().describe("Step id from list_order"),
3960
+ satisfied: z9.boolean().optional().describe("false clears the manual mark. Default true.")
3884
3961
  },
3885
3962
  async ({ id, satisfied }) => {
3886
3963
  try {
@@ -3890,7 +3967,7 @@ function registerOrderTools(server) {
3890
3967
  const rows = listOrderRows(plan.id);
3891
3968
  const hit = rows.find((row) => row.id === id || id.length >= 8 && row.id.startsWith(id));
3892
3969
  if (!hit) throw new Error("That step is on another orchestration chat's plan.");
3893
- const caller = callerThread();
3970
+ const caller = callerThread2();
3894
3971
  if (worktree && caller && !orderEdgeTouches(hit, orderSnapshotFromThread(caller))) {
3895
3972
  throw new Error("This checkout can only change a step it is part of.");
3896
3973
  }
@@ -4199,9 +4276,9 @@ async function getGitHubStatus() {
4199
4276
  };
4200
4277
  }
4201
4278
  const status = await run("gh", ["auth", "status"], { reject: false });
4202
- const text5 = `${status.stdout}
4279
+ const text6 = `${status.stdout}
4203
4280
  ${status.stderr}`;
4204
- const loginMatch = text5.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text5.match(/Logged in to ([^\s]+) as (\S+)/i);
4281
+ const loginMatch = text6.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text6.match(/Logged in to ([^\s]+) as (\S+)/i);
4205
4282
  if (loginMatch) {
4206
4283
  return {
4207
4284
  connected: true,
@@ -4317,16 +4394,16 @@ async function startMcpServer() {
4317
4394
  "list_board",
4318
4395
  "Home Kanban of workspaces (New, Draft, Review, Approved, Merged) \u2014 one card per checkout; sibling chats on that card are separate agents. Same cards as desktop Home. Path to merge: no PR \u2192 draft PR \u2192 open PR \u2192 approved \u2192 merged. Archive removes the card to Settings \u2192 History (list_archive to browse, restore_workspace to bring it back). Queued/running are activity on the card, not stages. Orchestration chats are not on the board. Filters: query, repoPath, kind (ticket/PR/branch source), ownership (mine = your PRs / WIP; reviewing = someone else's PR), column, limit (default 40). create_workspace adds a workspace (and a Home card), or returns the live checkout if that ticket/PR/named branch is already checked out. That reuse is one checkout, not one agent \u2014 fork_chat to add another.",
4319
4396
  {
4320
- query: z9.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
4321
- repoPath: z9.string().optional().describe("Limit to one project path from list_projects"),
4322
- kind: z9.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
4323
- ownership: z9.enum(["all", "mine", "reviewing"]).optional().describe(
4397
+ query: z10.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
4398
+ repoPath: z10.string().optional().describe("Limit to one project path from list_projects"),
4399
+ kind: z10.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
4400
+ ownership: z10.enum(["all", "mine", "reviewing"]).optional().describe(
4324
4401
  "Mine = PRs you authored or local WIP; reviewing = someone else's PR. Uses the gh login."
4325
4402
  ),
4326
- column: z9.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
4403
+ column: z10.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
4327
4404
  "Return cards for this column only (totals still include the rest). approved is an open PR GitHub has approved. needs_you is a legacy alias for new."
4328
4405
  ),
4329
- limit: z9.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
4406
+ limit: z10.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
4330
4407
  },
4331
4408
  async ({ query, repoPath, kind, ownership, column, limit }) => {
4332
4409
  const workspaces = orch.listWorkspaces();
@@ -4356,7 +4433,7 @@ async function startMcpServer() {
4356
4433
  server.tool(
4357
4434
  "get_chat",
4358
4435
  "Get a compact chat summary by id/ref. Includes last message preview, parentChatId, and child workspace chats (status + lastText). While running, includes progress (last tool/thinking) and lastActivityAt. Includes usage (billed token + costUsd totals when providers reported cost) and lastTurnUsage. blockedReason is why that agent is waiting on a person (question, plan approval, or a reported block).",
4359
- { ref: z9.string() },
4436
+ { ref: z10.string() },
4360
4437
  async ({ ref }) => {
4361
4438
  const t = orch.getThread(ref);
4362
4439
  if (!t) {
@@ -4403,17 +4480,17 @@ async function startMcpServer() {
4403
4480
  "present_artifact",
4404
4481
  "Show a document or live log in Sideboard\u2019s side column. For html/svg/markdown/react, pass the FULL document and do not also fence that same body in chat. For type=log, pass only NEW lines (same artifact_id appends). Prefer type=log for long-running job output \u2014 do not resend HTML. type=react is a single default-export component (JSX/TSX); only react/react-dom imports.",
4405
4482
  {
4406
- title: z9.string().describe("Short title shown in the artifact pane header"),
4407
- type: z9.enum(["html", "svg", "markdown", "react", "log"]).describe(
4483
+ title: z10.string().describe("Short title shown in the artifact pane header"),
4484
+ type: z10.enum(["html", "svg", "markdown", "react", "log"]).describe(
4408
4485
  "html/svg/markdown/react replace the pane. log appends content to the same artifact_id (new lines only)."
4409
4486
  ),
4410
- content: z9.string().describe(
4487
+ content: z10.string().describe(
4411
4488
  "html/svg/markdown/react: full document. log: only the new lines since the last call (empty is ok for a status-only update)."
4412
4489
  ),
4413
- artifact_id: z9.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
4414
- status: z9.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
4415
- phase: z9.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
4416
- mode: z9.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
4490
+ artifact_id: z10.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
4491
+ status: z10.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
4492
+ phase: z10.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
4493
+ mode: z10.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
4417
4494
  },
4418
4495
  async ({ title, type, artifact_id, status, phase, mode }) => {
4419
4496
  return mcpJson(
@@ -4426,15 +4503,15 @@ async function startMcpServer() {
4426
4503
  "ask_user",
4427
4504
  "Ask the user a clarifying multiple-choice question in Sideboard\u2019s composer. Call only when work is blocked on choosing among a few concrete options (approach fork, which API, auth vs cookies). Do not call for greetings, check-ins, \u201Chello\u201D, open-ended how-can-I-help, or to invent a menu of possible next tasks \u2014 reply in chat instead. If one option is the obvious default, proceed without asking. Before calling, write a short chat message explaining the decision and what each option means. Include a description on every option. After calling, stop and wait for answers. Not for \u201Cis the plan ready?\u201D.",
4428
4505
  {
4429
- questions: z9.array(
4430
- z9.object({
4431
- question: z9.string().describe("Full question text ending with ?"),
4432
- header: z9.string().max(24).optional().describe("Short label shown above the question"),
4433
- multiSelect: z9.boolean().optional().describe("Allow selecting multiple options"),
4434
- options: z9.array(
4435
- z9.object({
4436
- label: z9.string(),
4437
- description: z9.string().optional().describe("What this option means / when to choose it (strongly preferred)")
4506
+ questions: z10.array(
4507
+ z10.object({
4508
+ question: z10.string().describe("Full question text ending with ?"),
4509
+ header: z10.string().max(24).optional().describe("Short label shown above the question"),
4510
+ multiSelect: z10.boolean().optional().describe("Allow selecting multiple options"),
4511
+ options: z10.array(
4512
+ z10.object({
4513
+ label: z10.string(),
4514
+ description: z10.string().optional().describe("What this option means / when to choose it (strongly preferred)")
4438
4515
  })
4439
4516
  ).min(2).max(6).describe("2\u20136 choices (Sideboard also offers Other)")
4440
4517
  })
@@ -4460,9 +4537,9 @@ async function startMcpServer() {
4460
4537
  "present_plan",
4461
4538
  PRESENT_PLAN_TOOL_DESCRIPTION,
4462
4539
  {
4463
- title: z9.string().optional().describe("Short plan title (defaults to Plan)"),
4464
- content: z9.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
4465
- thread_id: z9.string().optional().describe("Sideboard thread id when cwd is not the worktree")
4540
+ title: z10.string().optional().describe("Short plan title (defaults to Plan)"),
4541
+ content: z10.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
4542
+ thread_id: z10.string().optional().describe("Sideboard thread id when cwd is not the worktree")
4466
4543
  },
4467
4544
  async ({ title, content, thread_id }) => {
4468
4545
  const { writePlanFile } = await import("../plan-file-VAHV5WBB.js");
@@ -4491,15 +4568,15 @@ async function startMcpServer() {
4491
4568
  "present_schema",
4492
4569
  "Open Sideboard\u2019s schema-driven side column (filterable table and/or form) when the user needs to filter, edit, publish, or persist records. Do not call this just to re-display rows you already wrote as a markdown table. If the user asks for an editable / interactive table, call this even if chat already showed those rows. Pass JSON Schema + optional schemaUi. Prefer datasource=inline with embedded resource/records. Use datasource=brightsy with resource_id only when the user is logged into Brightsy.",
4493
4570
  {
4494
- title: z9.string().describe("Pane title"),
4495
- mode: z9.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
4496
- datasource: z9.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
4497
- resource_id: z9.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
4498
- record_id: z9.string().optional().describe("Record id when opening form mode"),
4499
- resource: z9.record(z9.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
4500
- record: z9.record(z9.unknown()).optional().describe("Inline record { id, data, published_at? }"),
4501
- records: z9.array(z9.record(z9.unknown())).optional().describe("Inline records for table mode"),
4502
- pane_id: z9.string().optional().describe("Stable pane id across updates")
4571
+ title: z10.string().describe("Pane title"),
4572
+ mode: z10.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
4573
+ datasource: z10.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
4574
+ resource_id: z10.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
4575
+ record_id: z10.string().optional().describe("Record id when opening form mode"),
4576
+ resource: z10.record(z10.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
4577
+ record: z10.record(z10.unknown()).optional().describe("Inline record { id, data, published_at? }"),
4578
+ records: z10.array(z10.record(z10.unknown())).optional().describe("Inline records for table mode"),
4579
+ pane_id: z10.string().optional().describe("Stable pane id across updates")
4503
4580
  },
4504
4581
  async (args) => {
4505
4582
  const id = args.pane_id?.trim() || `schema_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
@@ -4520,10 +4597,10 @@ async function startMcpServer() {
4520
4597
  "present_files",
4521
4598
  "Open Sideboard\u2019s Files column (CMS-style file manager: browse, upload, pick). Use datasource=brightsy when the user is logged into Brightsy account storage; datasource=memory for a session-local demo store. Prefer this over claiming a file manager UI is unavailable. Pair with present_schema when editing records that need media.",
4522
4599
  {
4523
- title: z9.string().optional().describe("Pane title (default: Files)"),
4524
- datasource: z9.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
4525
- path: z9.string().optional().describe("Initial folder path (e.g. public)"),
4526
- pane_id: z9.string().optional().describe("Stable pane id across updates")
4600
+ title: z10.string().optional().describe("Pane title (default: Files)"),
4601
+ datasource: z10.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
4602
+ path: z10.string().optional().describe("Initial folder path (e.g. public)"),
4603
+ pane_id: z10.string().optional().describe("Stable pane id across updates")
4527
4604
  },
4528
4605
  async (args) => {
4529
4606
  const id = args.pane_id?.trim() || `files_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
@@ -4543,8 +4620,8 @@ async function startMcpServer() {
4543
4620
  "wait_for_job",
4544
4621
  "Wait on a detached long job (tests, pack, deploy, connector CLI) started with detached-job.cjs. MCP clients kill tools around 60s, so this returns within 45s. Sideboard opens a type=log pane from this result (artifact_id = job id, content = delta). stillRunning is the source of truth \u2014 if true, call wait_for_job again. If the job is hanging, producing no useful output, or doing the wrong thing, call stop_job instead of looping forever. Do not end the turn or tell the user you will let them know later. If false, ok/failed is the result.",
4545
4622
  {
4546
- id: z9.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4547
- timeoutMs: z9.number().optional()
4623
+ id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4624
+ timeoutMs: z10.number().optional()
4548
4625
  },
4549
4626
  async ({ id, timeoutMs }) => {
4550
4627
  const result = await waitForDetachedJob(process.cwd(), id, {
@@ -4557,8 +4634,8 @@ async function startMcpServer() {
4557
4634
  "stop_job",
4558
4635
  "Stop a detached job you started with detached-job.cjs when it is hanging, producing no useful output, buffering forever, or doing the wrong thing (wrong project, infinite watch, huge dump). Do not stop a pack/test/deploy that is clearly making progress. The type=log pane updates to status=failed with the last delta. Then decide the next step.",
4559
4636
  {
4560
- id: z9.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4561
- reason: z9.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
4637
+ id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4638
+ reason: z10.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
4562
4639
  },
4563
4640
  async ({ id, reason }) => {
4564
4641
  const result = await stopDetachedJob(process.cwd(), id, { reason });
@@ -4570,7 +4647,7 @@ async function startMcpServer() {
4570
4647
  "list_run_scripts",
4571
4648
  "List .sideboard/.conductor run scripts for this thread (same menu as the desktop Dev button) and which are active. Each script and active run includes preview: url (open http://localhost:<SIDEBOARD_PORT>) or window (Electron: native window is the app; url is renderer/HMR only). Never guess :3000. Worktree turns may omit ref (uses cwd).",
4572
4649
  {
4573
- ref: z9.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
4650
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
4574
4651
  },
4575
4652
  async ({ ref }) => {
4576
4653
  try {
@@ -4600,8 +4677,8 @@ async function startMcpServer() {
4600
4677
  "run_dev_script",
4601
4678
  "Start a .sideboard/.conductor run script (same as the desktop Dev / play button). Several named scripts can run at once; each gets its own port, and starting one does not stop the others. Logs and Stop appear in the thread UI \u2014 do not detached-job or shell-spawn the same command. Returns {port, ports, url, preview}. preview=url \u2192 open url (browser, curl, Playwright). preview=window \u2192 Electron: the native window is the app; url is renderer/HMR only (no preload/IPC in a browser). The port is allocated SIDEBOARD_PORT, not 3000. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
4602
4679
  {
4603
- ref: z9.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4604
- name: z9.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
4680
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4681
+ name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
4605
4682
  },
4606
4683
  async ({ ref, name }) => {
4607
4684
  try {
@@ -4629,8 +4706,8 @@ async function startMcpServer() {
4629
4706
  "stop_dev_script",
4630
4707
  "Stop a run script started with run_dev_script or the desktop Dev button (same as UI Stop). Omit name to stop all scripts on this worktree. Worktree turns may omit ref (uses cwd).",
4631
4708
  {
4632
- ref: z9.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4633
- name: z9.string().optional().describe("Script name to stop; omit to stop all active scripts.")
4709
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4710
+ name: z10.string().optional().describe("Script name to stop; omit to stop all active scripts.")
4634
4711
  },
4635
4712
  async ({ ref, name }) => {
4636
4713
  try {
@@ -4647,9 +4724,9 @@ async function startMcpServer() {
4647
4724
  "get_run_log",
4648
4725
  "Read the Run-tab terminal for a worktree script (same stdout/stderr as the desktop Dev pane). Default is a tail \u2014 raise `tail` only if the error is missing. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
4649
4726
  {
4650
- ref: z9.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4651
- name: z9.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
4652
- tail: z9.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
4727
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4728
+ name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
4729
+ tail: z10.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
4653
4730
  `Max characters to return from the end (default ${DEFAULT_RUN_LOG_TAIL_CHARS}). Do not request the full buffer unless the tail is truncated and you still need more.`
4654
4731
  )
4655
4732
  },
@@ -4703,8 +4780,8 @@ async function startMcpServer() {
4703
4780
  }
4704
4781
  });
4705
4782
  } catch (err) {
4706
- const text5 = err instanceof Error ? err.message : String(err);
4707
- return { content: [{ type: "text", text: text5 }], isError: true };
4783
+ const text6 = err instanceof Error ? err.message : String(err);
4784
+ return { content: [{ type: "text", text: text6 }], isError: true };
4708
4785
  }
4709
4786
  }
4710
4787
  );
@@ -4712,8 +4789,8 @@ async function startMcpServer() {
4712
4789
  "notify_orchestrator",
4713
4790
  "Wake the parent Global orchestrator with a short status so it does not have to poll wait_for_turn. Use when you are blocked and the parent may have moved on (missing access, waiting on something the coordinator must handle). The message is shown on the sidebar and board until the next user message in this chat. ask_user already notifies for input-required \u2014 do not call this for the same question. Information only: never a git command. Do not use this to steer other worktrees.",
4714
4791
  {
4715
- message: z9.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
4716
- reason: z9.enum(["input-required", "blocked"]).optional().describe(
4792
+ message: z10.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
4793
+ reason: z10.enum(["input-required", "blocked"]).optional().describe(
4717
4794
  "input-required = waiting on the user in this chat; blocked = need the coordinator (default)."
4718
4795
  )
4719
4796
  },
@@ -4739,23 +4816,24 @@ async function startMcpServer() {
4739
4816
  ...result.deduped ? { deduped: true } : {}
4740
4817
  });
4741
4818
  } catch (err) {
4742
- const text5 = err instanceof Error ? err.message : String(err);
4743
- return { content: [{ type: "text", text: text5 }], isError: true };
4819
+ const text6 = err instanceof Error ? err.message : String(err);
4820
+ return { content: [{ type: "text", text: text6 }], isError: true };
4744
4821
  }
4745
4822
  }
4746
4823
  );
4747
4824
  }
4748
4825
  registerScheduleTools(server);
4826
+ registerFollowUpTools(server);
4749
4827
  registerOrderTools(server);
4750
4828
  server.tool(
4751
4829
  "set_workspace_tags",
4752
4830
  worktreeProfile ? "Update tags on this workspace (the checkout you are in). Omit ref to use this chat. mode=replace (default), add, or remove. Short labels \u2014 the same ones the orchestrator used for this task. You cannot retag a different checkout." : "Label a project workspace so related checkouts stay recognizable in the sidebar and on the phone. Pass any chat id on that workspace. Use the same tags on every workspace from one task. mode=replace is the default; add and remove change the set. create_workspace tags= sets them at create time. Not for orchestration chats.",
4753
4831
  {
4754
- ref: z9.string().optional().describe(
4832
+ ref: z10.string().optional().describe(
4755
4833
  worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace to label."
4756
4834
  ),
4757
- tags: z9.union([z9.string(), z9.array(z9.string())]).describe("Labels to set. A string may be comma-separated."),
4758
- mode: z9.enum(["replace", "add", "remove"]).optional()
4835
+ tags: z10.union([z10.string(), z10.array(z10.string())]).describe("Labels to set. A string may be comma-separated."),
4836
+ mode: z10.enum(["replace", "add", "remove"]).optional()
4759
4837
  },
4760
4838
  async ({ ref, tags, mode }) => {
4761
4839
  try {
@@ -4783,10 +4861,10 @@ async function startMcpServer() {
4783
4861
  "set_wake_on_github_edges",
4784
4862
  worktreeProfile ? "Opt this checkout into orchestrator wakes when CI starts failing or GitHub requests a review. Omit ref. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is on. Do not change that Advanced switch." : "Opt a project workspace into CI and review-request wakes. Pass any chat id on that checkout. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is already on. Do not change that Advanced switch. Not for orchestration chats.",
4785
4863
  {
4786
- ref: z9.string().optional().describe(
4864
+ ref: z10.string().optional().describe(
4787
4865
  worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
4788
4866
  ),
4789
- enabled: z9.boolean().describe("True opts the checkout in. False turns it off.")
4867
+ enabled: z10.boolean().describe("True opts the checkout in. False turns it off.")
4790
4868
  },
4791
4869
  async ({ ref, enabled }) => {
4792
4870
  try {
@@ -4819,7 +4897,7 @@ async function startMcpServer() {
4819
4897
  "set_caffeinate",
4820
4898
  "Keep this Mac awake with caffeinate across turns \u2014 independent of Settings toggles. A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn ON when the user will be away and no phone is connected, or they ask you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
4821
4899
  {
4822
- enabled: z9.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
4900
+ enabled: z10.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
4823
4901
  },
4824
4902
  async ({ enabled }) => {
4825
4903
  const threadId = process.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
@@ -4845,24 +4923,24 @@ async function startMcpServer() {
4845
4923
  "create_workspace",
4846
4924
  `Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags. Each orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.`,
4847
4925
  {
4848
- sourceType: z9.enum(["branch", "pr", "ticket"]),
4849
- sourceRef: z9.string(),
4850
- agent: z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
4926
+ sourceType: z10.enum(["branch", "pr", "ticket"]),
4927
+ sourceRef: z10.string(),
4928
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
4851
4929
  `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
4852
4930
  ),
4853
- model: z9.string().nullable().optional().describe(
4931
+ model: z10.string().nullable().optional().describe(
4854
4932
  `Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
4855
4933
  ),
4856
- repoPath: z9.string(),
4857
- title: z9.string().optional(),
4858
- cowboy: z9.boolean().optional().describe(
4934
+ repoPath: z10.string(),
4935
+ title: z10.string().optional(),
4936
+ cowboy: z10.boolean().optional().describe(
4859
4937
  "If true, work in the project folder on the default branch (no thread/* worktree). Requires Settings \u2192 Advanced \u2192 Cowboy mode. Land is commit+push to that branch. Archive does not delete the folder."
4860
4938
  ),
4861
- parentChatId: z9.string().optional().describe(
4939
+ parentChatId: z10.string().optional().describe(
4862
4940
  "Orchestration: omit (preferred) or pass YOUR chat id from the turn reminder / AGENTS.md. Do not invent uuids."
4863
4941
  ),
4864
- parentThreadId: z9.string().optional().describe("Legacy alias for parentChatId."),
4865
- tags: z9.union([z9.string(), z9.array(z9.string())]).optional().describe(
4942
+ parentThreadId: z10.string().optional().describe("Legacy alias for parentChatId."),
4943
+ tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
4866
4944
  "Short labels for this workspace (or a comma-separated string). Use the same tags on every checkout for one task. Added when the checkout already exists."
4867
4945
  )
4868
4946
  },
@@ -4878,11 +4956,11 @@ async function startMcpServer() {
4878
4956
  "start_board_card",
4879
4957
  "Same as create_workspace for a ticket, PR, or named branch (attaches issue text when Sideboard can resolve it). Does not create a second checkout when one already matches \u2014 returns that workspace (alreadyStarted) and its chats. A workspace can have many agents. fork_chat to add one; send_to_chat only the chat that should do this job.",
4880
4958
  {
4881
- kind: z9.enum(["ticket", "pr", "branch"]),
4882
- ref: z9.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
4883
- repoPath: z9.string().describe("Project path from list_projects / list_board"),
4884
- title: z9.string().optional(),
4885
- tags: z9.union([z9.string(), z9.array(z9.string())]).optional().describe(
4959
+ kind: z10.enum(["ticket", "pr", "branch"]),
4960
+ ref: z10.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
4961
+ repoPath: z10.string().describe("Project path from list_projects / list_board"),
4962
+ title: z10.string().optional(),
4963
+ tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
4886
4964
  "Short labels for this workspace. Same tags on every checkout for one task. Added when the checkout already exists."
4887
4965
  )
4888
4966
  },
@@ -4985,11 +5063,11 @@ async function startMcpServer() {
4985
5063
  );
4986
5064
  server.tool(
4987
5065
  "send_to_chat",
4988
- 'Steer a prompt on a workspace chat (Settings \u2192 Follow-up, default steer: interrupt the in-flight turn and start now, same as the workspace composer). Use after create_workspace to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. Do not send_to_chat to check in, resume after a halt notice, or because wait_for_turn returned stillRunning; that interrupts the child mid-thought. Call wait_for_turn again instead.',
5066
+ 'Send a prompt to a workspace chat. A second send joins that prompt only while it is still queued or not yet handed to the process. Once the process has started, the send waits behind the turn and does not stop it or change the prompt already running. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. The workspace composer still follows Settings \u2192 Follow-up. Use after create_workspace to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. Do not send_to_chat to check in, resume after a halt notice, or because wait_for_turn returned stillRunning. Call wait_for_turn again instead.',
4989
5067
  {
4990
- ref: z9.string(),
4991
- prompt: z9.string(),
4992
- force_stop: z9.boolean().optional()
5068
+ ref: z10.string(),
5069
+ prompt: z10.string(),
5070
+ force_stop: z10.boolean().optional()
4993
5071
  },
4994
5072
  async ({ ref, prompt, force_stop }) => {
4995
5073
  if (force_stop) {
@@ -4999,7 +5077,7 @@ async function startMcpServer() {
4999
5077
  }
5000
5078
  }
5001
5079
  const thread = await orch.send(ref, prompt, {
5002
- followUp: resolveOrchChildFollowUp()
5080
+ followUp: force_stop ? "steer" : "join"
5003
5081
  });
5004
5082
  return mcpJson({
5005
5083
  id: thread.id,
@@ -5012,10 +5090,10 @@ async function startMcpServer() {
5012
5090
  if (shouldRegisterMcpWaitForTurn()) {
5013
5091
  server.tool(
5014
5092
  "wait_for_turn",
5015
- "Wait until the chat finishes its current/queued turn, or return early with a live progress snapshot. MCP clients often kill tools around 60s, so this returns within 45s even while the child is still working. taskState is the A2A-style lifecycle: submitted (queued, not started), working, input-required (ask_user), completed, failed, canceled. stillRunning is true only for submitted/working. blockedReason is why the child is waiting on a person (the question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress and call wait_for_turn again. Do not send_to_chat a check-in (that steers / interrupts). On failed, lastError/text is the failure. On canceled, the child did not finish \u2014 resume with send_to_chat or tell the user. On input-required, wait for the user in that chat. When finished, text is this turn\u2019s assistant reply and usage is that turn\u2019s tokens + costUsd (this turn, not the Claude session total; sessionCostUsd is the provider session total when present).",
5093
+ "Wait until the chat finishes its current/queued turn, or return early with a live progress snapshot. MCP clients often kill tools around 60s, so this returns within 45s even while the child is still working. taskState is the A2A-style lifecycle: submitted (queued, not started), working, input-required (ask_user), completed, failed, canceled. stillRunning is true only for submitted/working. blockedReason is why the child is waiting on a person (the question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress and call wait_for_turn again. Do not send_to_chat a check-in. On failed, read failureClass: auth, quota, and refused are not a retry; timeout or runner can be one. lastError/text is the failure. On canceled, the child did not finish \u2014 resume with send_to_chat or tell the user. On input-required, wait for the user in that chat. When finished, text is this turn\u2019s assistant reply and usage is that turn\u2019s tokens + costUsd (this turn, not the Claude session total; sessionCostUsd is the provider session total when present).",
5016
5094
  {
5017
- ref: z9.string(),
5018
- timeoutMs: z9.number().optional()
5095
+ ref: z10.string(),
5096
+ timeoutMs: z10.number().optional()
5019
5097
  },
5020
5098
  async ({ ref, timeoutMs }) => {
5021
5099
  const thread = await orch.waitForTurn(ref, mcpWaitForTurnTimeoutMs(timeoutMs), {
@@ -5042,14 +5120,16 @@ async function startMcpServer() {
5042
5120
  }
5043
5121
  server.tool(
5044
5122
  "get_turn_result",
5045
- "Assistant message and last-turn usage when the turn finished. While stillRunning (submitted/working), text and usage are empty so a previous reply cannot be mistaken for this turn \u2014 use progress for tools/thinking. Not the full transcript. Includes taskState (A2A lifecycle) and blockedReason (why the agent is waiting on a person).",
5046
- { ref: z9.string() },
5123
+ "Assistant message and last-turn usage when the turn finished. While stillRunning (submitted/working), text and usage are empty so a previous reply cannot be mistaken for this turn \u2014 use progress for tools/thinking. Not the full transcript. Includes taskState (A2A lifecycle), failureClass when the turn failed (auth, quota, refused, timeout, runner, other), and blockedReason (why the agent is waiting on a person).",
5124
+ { ref: z10.string() },
5047
5125
  async ({ ref }) => {
5048
5126
  const result = orch.getTurnResult(ref);
5049
- const hint = mcpWaitTaskHint(result.taskState, result.status, result.blockedReason);
5127
+ const failureClass = result.taskState === "failed" && result.status !== "broken" ? classifyTurnFailure(result.lastError || result.text) : null;
5128
+ const hint = mcpWaitTaskHint(result.taskState, result.status, result.blockedReason, failureClass);
5050
5129
  const waiting = Boolean(result.blockedReason) && !result.stillRunning && result.taskState !== "failed" && result.taskState !== "canceled";
5051
5130
  return mcpJson({
5052
5131
  ...result,
5132
+ failureClass,
5053
5133
  hint,
5054
5134
  incomplete: needsCoordinatorAction(result.taskState) || waiting
5055
5135
  });
@@ -5059,9 +5139,9 @@ async function startMcpServer() {
5059
5139
  "stop_chat",
5060
5140
  "Force-stop a thread: kill any in-flight agent turn AND clear queued prompts so drainQueue cannot continue. Does not archive the worktree. Optional force defaults to true. Pass reason \u2014 a short note on why this chat is stopping. It is stored on the thread and kept when the turn unwinds. If you omit it, Sideboard still records that the queue was cleared.",
5061
5141
  {
5062
- ref: z9.string(),
5063
- force: z9.boolean().optional(),
5064
- reason: z9.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
5142
+ ref: z10.string(),
5143
+ force: z10.boolean().optional(),
5144
+ reason: z10.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
5065
5145
  },
5066
5146
  async ({ ref, force, reason }) => {
5067
5147
  const t = orch.getThread(ref);
@@ -5087,8 +5167,8 @@ async function startMcpServer() {
5087
5167
  "get_diff",
5088
5168
  "Compact diff summary (capped hunks, paginated)",
5089
5169
  {
5090
- ref: z9.string(),
5091
- maxFiles: z9.number().optional()
5170
+ ref: z10.string(),
5171
+ maxFiles: z10.number().optional()
5092
5172
  },
5093
5173
  async ({ ref, maxFiles }) => {
5094
5174
  const summary = await orch.diffSummary(ref);
@@ -5101,7 +5181,7 @@ async function startMcpServer() {
5101
5181
  server.tool(
5102
5182
  "get_pr_checks",
5103
5183
  "Snapshot of GitHub PR checks for a worktree thread (`gh pr checks` plus merge/review gates). null = no PR. If the user gave a goal (Greptile 5/5, CI green), the worktree agent watches with `gh pr checks --watch` via /long-running \u2014 this tool is a snapshot, not a waiter. Coordinators: do not run gh from the orchestration cwd.",
5104
- { ref: z9.string().describe("Worktree thread id/ref") },
5184
+ { ref: z10.string().describe("Worktree thread id/ref") },
5105
5185
  async ({ ref }) => {
5106
5186
  try {
5107
5187
  const checks = await orch.getPrChecks(ref);
@@ -5115,7 +5195,7 @@ async function startMcpServer() {
5115
5195
  server.tool(
5116
5196
  "request_review",
5117
5197
  'Start a merge-readiness Review on a worktree agent thread (same as the desktop Review button). If that worktree has a single unused idle agent (no messages), runs the review there; otherwise opens a new Review chat tab. Attaches .claude/skills/review/SKILL.md when present (else copies .sideboard/review.md into .context/review.md, or seeds that file from the stock template), and sends "Review changes in this workspace." Expect Approve / Approve with nits / Request changes / Needs more information in that chat. The review stays there so the user can read it and type next steps \u2014 do not comment on or update the PR or ticket, and do not ask_user after the review, until they ask. Pass a worktree thread ref \u2014 not the orchestrator. Then wait_for_turn (loop while stillRunning) / get_turn_result on the returned review thread id.',
5118
- { ref: z9.string().describe("Worktree thread id/ref to review") },
5198
+ { ref: z10.string().describe("Worktree thread id/ref to review") },
5119
5199
  async ({ ref }) => {
5120
5200
  try {
5121
5201
  const tab = await orch.requestReview(ref);
@@ -5137,8 +5217,8 @@ async function startMcpServer() {
5137
5217
  "ask_git",
5138
5218
  "Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (CI green, a review score, until checks pass). A push can wake a third-party PR review; the worktree agent acknowledges it only inside that goal. Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
5139
5219
  {
5140
- ref: z9.string().describe("Worktree thread id/ref"),
5141
- action: z9.enum(AGENT_GIT_ACTIONS).describe(
5220
+ ref: z10.string().describe("Worktree thread id/ref"),
5221
+ action: z10.enum(AGENT_GIT_ACTIONS).describe(
5142
5222
  "commit-push | create-draft | create-web | resolve-conflicts | ready-for-review | merge"
5143
5223
  )
5144
5224
  },
@@ -5167,7 +5247,7 @@ async function startMcpServer() {
5167
5247
  }
5168
5248
  }
5169
5249
  );
5170
- const agentEnum = z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
5250
+ const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
5171
5251
  server.tool(
5172
5252
  "list_models",
5173
5253
  "List models for an agent. Prefer Auto: do not call this unless you have a reason to pin a specific model (user request, cost/latency, capability). Omit agent to list all.",
@@ -5188,11 +5268,11 @@ async function startMcpServer() {
5188
5268
  "fork_workspace",
5189
5269
  "Fork a worktree agent chat into a NEW git worktree + chat (desktop \u201CFork to new workspace\u201D). Seeds a transcript (through through_index, default all). Optional agent override. Leave model unset for Auto (default) \u2014 only pass model when you have a reason. Not for the orchestrator. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id.",
5190
5270
  {
5191
- ref: z9.string().describe("Worktree thread id/ref to fork"),
5192
- through_index: z9.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5271
+ ref: z10.string().describe("Worktree thread id/ref to fork"),
5272
+ through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5193
5273
  agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
5194
- model: z9.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5195
- title: z9.string().optional()
5274
+ model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5275
+ title: z10.string().optional()
5196
5276
  },
5197
5277
  async ({ ref, through_index, agent, model, title }) => {
5198
5278
  try {
@@ -5226,11 +5306,11 @@ async function startMcpServer() {
5226
5306
  "fork_chat",
5227
5307
  "Add another agent chat on the SAME workspace (same files, Run, and git). Also forks a Global orchestration chat into a new orchestration tab. Pass agent when the new chat should use a different harness. Leave model unset for Auto unless you have a reason. Orchestration forks require an MCP-capable agent (claude, cursor, codex, opencode \u2014 not brightsy). Use this for a second agent on a checkout (review, another harness, parallel work on the same branch). Do not create_workspace again for that \u2014 it returns the existing checkout. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id. Use fork_workspace only when the work needs its own git checkout.",
5228
5308
  {
5229
- ref: z9.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
5230
- through_index: z9.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5309
+ ref: z10.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
5310
+ through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5231
5311
  agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
5232
- model: z9.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5233
- title: z9.string().optional()
5312
+ model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5313
+ title: z10.string().optional()
5234
5314
  },
5235
5315
  async ({ ref, through_index, agent, model, title }) => {
5236
5316
  try {
@@ -5268,7 +5348,7 @@ async function startMcpServer() {
5268
5348
  server.tool(
5269
5349
  "run_setup",
5270
5350
  "Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
5271
- { ref: z9.string() },
5351
+ { ref: z10.string() },
5272
5352
  async ({ ref }) => {
5273
5353
  const result = await orch.runSetup(ref);
5274
5354
  return mcpJson(result);
@@ -5277,7 +5357,7 @@ async function startMcpServer() {
5277
5357
  server.tool(
5278
5358
  "add_project",
5279
5359
  "Register a git repo as a Sideboard workspace",
5280
- { repoPath: z9.string() },
5360
+ { repoPath: z10.string() },
5281
5361
  async ({ repoPath }) => {
5282
5362
  const ws = await orch.addWorkspace(repoPath);
5283
5363
  return mcpJson(ws);
@@ -5286,7 +5366,7 @@ async function startMcpServer() {
5286
5366
  server.tool(
5287
5367
  "remove_project",
5288
5368
  "Unregister a Sideboard workspace and archive its chats",
5289
- { repoPath: z9.string() },
5369
+ { repoPath: z10.string() },
5290
5370
  async ({ repoPath }) => {
5291
5371
  await orch.removeWorkspace(repoPath);
5292
5372
  return { content: [{ type: "text", text: "ok" }] };
@@ -5296,12 +5376,12 @@ async function startMcpServer() {
5296
5376
  "fanout",
5297
5377
  "Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
5298
5378
  {
5299
- prompt: z9.string(),
5300
- agents: z9.array(z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"])),
5301
- repoPath: z9.string(),
5302
- sourceType: z9.enum(["branch", "pr", "ticket"]).optional(),
5303
- sourceRef: z9.string().optional(),
5304
- title: z9.string().optional()
5379
+ prompt: z10.string(),
5380
+ agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"])),
5381
+ repoPath: z10.string(),
5382
+ sourceType: z10.enum(["branch", "pr", "ticket"]).optional(),
5383
+ sourceRef: z10.string().optional(),
5384
+ title: z10.string().optional()
5305
5385
  },
5306
5386
  async (args) => {
5307
5387
  const threads = await orch.bestOfN(args);
@@ -5319,8 +5399,8 @@ async function startMcpServer() {
5319
5399
  "list_branches",
5320
5400
  "List git branches in a registered workspace. Pass repoPath from list_projects (unmerged into the default branch by default \u2014 for create_workspace sourceType=branch).",
5321
5401
  {
5322
- repoPath: z9.string(),
5323
- unmergedOnly: z9.boolean().optional()
5402
+ repoPath: z10.string(),
5403
+ unmergedOnly: z10.boolean().optional()
5324
5404
  },
5325
5405
  async ({ repoPath, unmergedOnly }) => {
5326
5406
  const root = await resolveRepoRoot(repoPath);
@@ -5341,19 +5421,19 @@ async function startMcpServer() {
5341
5421
  "list_prs",
5342
5422
  `List GitHub PRs for a registered workspace (the review surface for assigned ticket work \u2014 not the tickets). Pass repoPath from list_projects. "Get me N tickets to review" \u2192 queue=review and limit=N: open non-draft PRs labeled with this project's ready-for-review GitHub label (Settings \u2192 Projects; default eng-review) with no individual user reviewer. Prefer teams that match Settings \u2192 Agents / Projects roles for this repo. A team like engineering-team is not a claim (you are on that team). Also: state (open|closed|merged|all|review), label, reviewer (me|unassigned|login), query, limit (default 40, max 250). Then create_workspace with sourceType=pr.`,
5343
5423
  {
5344
- repoPath: z9.string(),
5345
- query: z9.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
5346
- queue: z9.enum(["review", "mine", "approved", "changes"]).optional().describe(
5424
+ repoPath: z10.string(),
5425
+ query: z10.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
5426
+ queue: z10.enum(["review", "mine", "approved", "changes"]).optional().describe(
5347
5427
  "review = unclaimed ready-for-review inbox (Settings \u2192 Projects label, default eng-review). mine = review-requested:@me. approved / changes = eng-approved / eng-requested-changes."
5348
5428
  ),
5349
- state: z9.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
5350
- label: z9.string().optional().describe(
5429
+ state: z10.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
5430
+ label: z10.string().optional().describe(
5351
5431
  "GitHub label / workflow tag. Comma-separated AND. Examples: eng-review, eng-approved, eng-requested-changes"
5352
5432
  ),
5353
- reviewer: z9.string().optional().describe(
5433
+ reviewer: z10.string().optional().describe(
5354
5434
  "me (review requested of you), unassigned (no individual reviewer; team queues like engineering-team still count), all, or a GitHub login"
5355
5435
  ),
5356
- limit: z9.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
5436
+ limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
5357
5437
  },
5358
5438
  async ({ repoPath, query, queue, state, label, reviewer, limit }) => {
5359
5439
  const root = await resolveRepoRoot(repoPath);
@@ -5386,7 +5466,7 @@ async function startMcpServer() {
5386
5466
  server.tool(
5387
5467
  "get_pr_stack",
5388
5468
  "Load the GitHub PR stack for a thread worktree (`gh stack view --json`). Returns null JSON when the branch is not stacked. Prefer this before ask_git merge on stacked PRs (and only merge when the user explicitly asked).",
5389
- { ref: z9.string() },
5469
+ { ref: z10.string() },
5390
5470
  async ({ ref }) => {
5391
5471
  const stack = await orch.getPrStack(ref);
5392
5472
  return mcpJson(stack);
@@ -5396,8 +5476,8 @@ async function startMcpServer() {
5396
5476
  "open_pr_stack_layers",
5397
5477
  "Materialize one worktree+thread per stack layer (or a single 1-based layer). Pass a thread ref already on the stack.",
5398
5478
  {
5399
- ref: z9.string(),
5400
- layer: z9.number().int().positive().optional()
5479
+ ref: z10.string(),
5480
+ layer: z10.number().int().positive().optional()
5401
5481
  },
5402
5482
  async ({ ref, layer }) => {
5403
5483
  const result = await orch.openPrStackLayers(ref, { layer });
@@ -5420,9 +5500,9 @@ async function startMcpServer() {
5420
5500
  "add_stack_layer",
5421
5501
  "Add a branch on top of the current stack (`gh stack add`) and open a worktree+thread for it.",
5422
5502
  {
5423
- ref: z9.string(),
5424
- branchName: z9.string(),
5425
- title: z9.string().optional()
5503
+ ref: z10.string(),
5504
+ branchName: z10.string(),
5505
+ title: z10.string().optional()
5426
5506
  },
5427
5507
  async ({ ref, branchName, title }) => {
5428
5508
  const result = await orch.addStackLayer(ref, branchName, { title });
@@ -5440,11 +5520,11 @@ async function startMcpServer() {
5440
5520
  "create_pr_stack",
5441
5521
  "Create a new GitHub PR stack with one Sideboard worktree per layer (bottom\u2192top branch names). Requires `gh extension install github/gh-stack`.",
5442
5522
  {
5443
- repoPath: z9.string(),
5444
- branches: z9.array(z9.string()).min(1),
5445
- agent: z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"]),
5446
- base: z9.string().optional(),
5447
- title: z9.string().optional()
5523
+ repoPath: z10.string(),
5524
+ branches: z10.array(z10.string()).min(1),
5525
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]),
5526
+ base: z10.string().optional(),
5527
+ title: z10.string().optional()
5448
5528
  },
5449
5529
  async (args) => {
5450
5530
  const result = await orch.createPrStack({
@@ -5472,10 +5552,10 @@ async function startMcpServer() {
5472
5552
  "list_issues",
5473
5553
  "List or search issues (Linear, AbleTime, or GitHub; falls back to GitHub). Cursor Origin has no issue tracker \u2014 a Cursor repo returns unavailableReason unless Linear or AbleTime is the source. Entire tickets are Trails (`entire trail`), not GitHub Issues, so an Entire repo does the same unless Linear or AbleTime is the source. Use Settings \u2192 Agents / Projects notes and roles to pick tickets relevant to the viewer (query + assignee=me or unassigned as the notes say). Default 40; pass query and/or limit (max 250) when truncated. assignee: me (Linear default), unassigned, all, or a user id. Pass updatedSince for new/updated tickets and new comments (\u201Cany updates since yesterday?\u201D). Then create_workspace with sourceType=ticket.",
5474
5554
  {
5475
- repoPath: z9.string(),
5476
- query: z9.string().optional().describe("Search title, identifier, or description"),
5477
- assignee: z9.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
5478
- limit: z9.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
5555
+ repoPath: z10.string(),
5556
+ query: z10.string().optional().describe("Search title, identifier, or description"),
5557
+ assignee: z10.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
5558
+ limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
5479
5559
  updatedSince: mcpIssueUpdatedSinceSchema
5480
5560
  },
5481
5561
  async ({ repoPath, query, assignee, limit, updatedSince }) => {