@sideboard-ai/core 0.1.348 → 0.1.350

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 (84) hide show
  1. package/dist/{abletime-CGFJZB7L.js → abletime-TX7BTTR2.js} +5 -5
  2. package/dist/{abletime-3HRWLQZJ.js → abletime-URSRZW7P.js} +4 -4
  3. package/dist/{abletime-oauth-QNJQLHR4.js → abletime-oauth-QS3WPSCC.js} +3 -3
  4. package/dist/{abletime-oauth-JQDSH5OL.js → abletime-oauth-SL3NMNEC.js} +4 -4
  5. package/dist/{abletime-rest-TANL5TMY.js → abletime-rest-GGQLUO55.js} +3 -3
  6. package/dist/{abletime-rest-UQA2CRZN.js → abletime-rest-JZU6JJCV.js} +4 -4
  7. package/dist/agents/acp-runner.cjs +491 -0
  8. package/dist/agents/acp-runner.d.cts +46 -0
  9. package/dist/agents/acp-runner.d.ts +46 -0
  10. package/dist/agents/acp-runner.js +323 -0
  11. package/dist/agents/cursor-runner.js +3 -3
  12. package/dist/{agents-T4XBZZDA.js → agents-P5QIV24I.js} +38 -8
  13. package/dist/{agents-5MFGVK7C.js → agents-RGAV5OHD.js} +44 -13
  14. package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
  15. package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
  16. package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
  17. package/dist/{chunk-OH3BAUMC.js → chunk-2MESZ5XR.js} +273 -84
  18. package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
  19. package/dist/{chunk-Y6VQX2LY.js → chunk-5AHWUJRT.js} +1927 -1718
  20. package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
  21. package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
  22. package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
  23. package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
  24. package/dist/chunk-BF6INES4.js +144 -0
  25. package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
  26. package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
  27. package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
  28. package/dist/{chunk-6TV6L2DD.js → chunk-EZ2MUWNW.js} +7 -6
  29. package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
  30. package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
  31. package/dist/{chunk-NTY5WGRD.js → chunk-FQ3JYUKI.js} +2 -2
  32. package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
  33. package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
  34. package/dist/{chunk-XNGW4OYD.js → chunk-LFSTOECH.js} +7 -6
  35. package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
  36. package/dist/{chunk-ZJMYCDYQ.js → chunk-MANERA6F.js} +55 -10
  37. package/dist/{chunk-Q4TZA4MN.js → chunk-NDEVAA34.js} +1629 -1486
  38. package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
  39. package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
  40. package/dist/{chunk-MOUAM6ZC.js → chunk-SMSD6U3N.js} +135 -3
  41. package/dist/{chunk-ATS7SYHG.js → chunk-TCEUNSLX.js} +135 -3
  42. package/dist/chunk-TRMPDDVL.js +232 -0
  43. package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
  44. package/dist/{chunk-2HPVGTHF.js → chunk-VHQ6OG3U.js} +2 -2
  45. package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
  46. package/dist/{chunk-WMD77UCY.js → chunk-W5GHFT7E.js} +279 -87
  47. package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
  48. package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
  49. package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
  50. package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
  51. package/dist/chunk-YE7Z5WH3.js +142 -0
  52. package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
  53. package/dist/{chunk-GAGTEI6B.js → chunk-ZBSEJIOV.js} +56 -11
  54. package/dist/{conductor-LYQKONSA.js → conductor-HVOGBK63.js} +7 -6
  55. package/dist/{conductor-EMGMDNHL.js → conductor-VGCXUUG6.js} +9 -8
  56. package/dist/connected-teams-2YDE2EZ2.js +1 -1
  57. package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-DPO7L2JO.js} +5 -5
  58. package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-E736TJBS.js} +4 -4
  59. package/dist/{global-workspace-UG2A3CEM.js → global-workspace-4RDPAOTT.js} +5 -5
  60. package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-TG2TVLUF.js} +4 -4
  61. package/dist/index.cjs +2881 -1761
  62. package/dist/index.d.cts +140 -877
  63. package/dist/index.d.ts +140 -877
  64. package/dist/index.js +865 -559
  65. package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
  66. package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
  67. package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
  68. package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
  69. package/dist/mcp/run-stdio.cjs +2112 -1287
  70. package/dist/mcp/run-stdio.js +318 -230
  71. package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
  72. package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
  73. package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-3I2FLEZL.js} +20 -18
  74. package/dist/{orchestrator-4SXTORD2.js → orchestrator-QDHZ56LA.js} +12 -11
  75. package/dist/thread-CJRchYLj.d.cts +856 -0
  76. package/dist/thread-CJRchYLj.d.ts +856 -0
  77. package/dist/{thread-store-R3G5VBII.js → thread-store-4YTOV2HL.js} +3 -3
  78. package/dist/{thread-store-MEUWZDVV.js → thread-store-LME2ICZP.js} +2 -2
  79. package/dist/{workspaces-KWGTP7DI.js → workspaces-4PA24IX6.js} +4 -4
  80. package/dist/{workspaces-35T6FW57.js → workspaces-6TMYV4N2.js} +5 -5
  81. package/dist/{worktree-ROJXGBWS.js → worktree-4ATMCYIE.js} +3 -3
  82. package/dist/{worktree-5P7SCST3.js → worktree-DA6SKIU5.js} +4 -4
  83. package/package.json +3 -3
  84. /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
@@ -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-2MESZ5XR.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-5AHWUJRT.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-MANERA6F.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,
@@ -87,13 +87,14 @@ import {
87
87
  searchAbleTimeTasks,
88
88
  toAbleTimeIssueInfo,
89
89
  updateAbleTimeTask
90
- } from "../chunk-62ALWH3T.js";
91
- import "../chunk-OHUAAX3O.js";
92
- import "../chunk-RYPD7XWV.js";
90
+ } from "../chunk-DL4OHDBV.js";
91
+ import "../chunk-M45WGODR.js";
92
+ import "../chunk-B4EFQTMP.js";
93
93
  import {
94
94
  normalizeServiceOrigin
95
- } from "../chunk-F7WP2U5I.js";
96
- import "../chunk-7B2OUQON.js";
95
+ } from "../chunk-WJURGCBR.js";
96
+ import "../chunk-5TCMXEYL.js";
97
+ import "../chunk-BF6INES4.js";
97
98
  import {
98
99
  PRESENT_PLAN_REQUIRES_PLAN_MODE,
99
100
  PRESENT_PLAN_TOOL_DESCRIPTION,
@@ -106,20 +107,22 @@ import {
106
107
  isCloudCoordinatorThread,
107
108
  isGlobalThread,
108
109
  isOrchestratorThread
109
- } from "../chunk-6TV6L2DD.js";
110
+ } from "../chunk-EZ2MUWNW.js";
110
111
  import {
111
112
  canonicalizeRepoPath,
112
113
  formatGhLandError,
114
+ getPrCiChecks,
113
115
  ghRepoSelectArgs,
114
116
  listBranches,
115
117
  listPrs,
116
118
  resolveGithubRepoSlug,
117
119
  resolveListPrsOptions,
118
120
  resolveOriginRemote,
121
+ resolvePrSelector,
119
122
  resolveProjectRemoteTag,
120
123
  resolveRepoRoot,
121
124
  warmGithubAgentAuth
122
- } from "../chunk-2HPVGTHF.js";
125
+ } from "../chunk-VHQ6OG3U.js";
123
126
  import "../chunk-I6RGRUNY.js";
124
127
  import "../chunk-E63AM3PW.js";
125
128
  import {
@@ -132,7 +135,7 @@ import {
132
135
  listLinearProjects,
133
136
  listLinearTeams,
134
137
  updateLinearIssue
135
- } from "../chunk-E77SRVVO.js";
138
+ } from "../chunk-FCKTBE26.js";
136
139
  import {
137
140
  formatGitHubSearchUpdatedSince,
138
141
  issueMatchesUpdatedSince,
@@ -152,7 +155,7 @@ import {
152
155
  import {
153
156
  httpFetch
154
157
  } from "../chunk-2GPQZZLY.js";
155
- import "../chunk-JCYGQKER.js";
158
+ import "../chunk-WFX4ZVSZ.js";
156
159
  import "../chunk-GK7H3SY7.js";
157
160
  import {
158
161
  gh,
@@ -160,12 +163,15 @@ import {
160
163
  run
161
164
  } from "../chunk-TL2HK6LZ.js";
162
165
  import {
166
+ addChatFollowUp,
167
+ ciChecksSettled,
163
168
  createSchedule,
164
169
  deleteSchedule,
165
170
  findThreadByRef,
166
171
  getSchedule,
167
172
  listSchedules,
168
173
  listThreads,
174
+ normalizeChatFollowUps,
169
175
  normalizeWorkspaceTags,
170
176
  normalizeWorktreePath,
171
177
  parseWeeklyDays,
@@ -174,7 +180,7 @@ import {
174
180
  scheduleNeedsCaffeinate,
175
181
  updateSchedule,
176
182
  updateThread
177
- } from "../chunk-MOUAM6ZC.js";
183
+ } from "../chunk-SMSD6U3N.js";
178
184
  import "../chunk-WMZIANPV.js";
179
185
  import {
180
186
  formatWorkspaceProfileSuffix,
@@ -189,7 +195,7 @@ import {
189
195
  resolveViewerProfileForRepo,
190
196
  savePosthogOAuth,
191
197
  wakeOrchestratorOnGithubEdgesEnabled
192
- } from "../chunk-WWU4SYZR.js";
198
+ } from "../chunk-VL6F2KRE.js";
193
199
  import {
194
200
  writePrivateFile
195
201
  } from "../chunk-NSTQ6QKD.js";
@@ -309,7 +315,7 @@ function createClippedMcpServer() {
309
315
  }
310
316
 
311
317
  // src/mcp/server.ts
312
- import { z as z9 } from "zod";
318
+ import { z as z10 } from "zod";
313
319
  import { randomUUID as randomUUID4 } from "crypto";
314
320
  import { basename } from "path";
315
321
 
@@ -333,7 +339,7 @@ function extractGitHubIssueAttachments(issue) {
333
339
  const texts = [issue.body ?? "", ...issue.comments.map((comment) => comment.body)];
334
340
  return mergeIssueAttachments(
335
341
  texts.flatMap(
336
- (text5) => extractHttpUrls(text5).filter(isGitHubIssueAttachmentUrl).map((url) => ({
342
+ (text6) => extractHttpUrls(text6).filter(isGitHubIssueAttachmentUrl).map((url) => ({
337
343
  id: url,
338
344
  name: url.split("/").pop() || "attachment",
339
345
  url
@@ -364,11 +370,11 @@ async function downloadGitHubIssueAttachment(input, opts) {
364
370
 
365
371
  // src/integrations/github-projects.ts
366
372
  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.`;
373
+ const text6 = detail.trim() || "gh could not read GitHub Projects";
374
+ if (/read:project|project scope|missing required scopes/i.test(text6)) {
375
+ return `${text6} \u2014 run \`gh auth refresh -s read:project\` so Sideboard can read GitHub Projects.`;
370
376
  }
371
- return text5;
377
+ return text6;
372
378
  }
373
379
  function githubProjectsUnreadable(result) {
374
380
  return /project|scope|unknown json field/i.test(`${result.stderr}
@@ -1195,6 +1201,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions) {
1195
1201
  sourceType: args.sourceType,
1196
1202
  sourceRef: args.sourceRef,
1197
1203
  agent: opts.agent,
1204
+ ...opts.agent === "acp" ? { acpHarness: args.acpHarness } : {},
1198
1205
  model: opts.model,
1199
1206
  effort: opts.effort,
1200
1207
  fast: opts.fast,
@@ -1219,6 +1226,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions) {
1219
1226
  branchName: thread.branchName,
1220
1227
  worktreePath: thread.worktreePath,
1221
1228
  agent: thread.agent,
1229
+ ...thread.acpHarness ? { acpHarness: thread.acpHarness } : {},
1222
1230
  model: thread.model,
1223
1231
  status: thread.status,
1224
1232
  cowboy: Boolean(thread.cowboy),
@@ -1244,9 +1252,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions) {
1244
1252
  function lastMessagePreview(messages, max = 160) {
1245
1253
  if (!messages?.length) return null;
1246
1254
  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, " ");
1255
+ const text6 = messages[i]?.text?.trim();
1256
+ if (!text6 || isInternalAgentStatusText(text6) || isInjectedNoticeText(text6)) continue;
1257
+ const flat = text6.replace(/\s+/g, " ");
1250
1258
  return flat.length > max ? `${flat.slice(0, max)}\u2026` : flat;
1251
1259
  }
1252
1260
  return null;
@@ -1276,15 +1284,15 @@ var CRUSH_COMMENT_MAX_CHARS = 16e3;
1276
1284
  var CRUSH_BODY_MIN_CHARS = 12e3;
1277
1285
  var CRUSH_BODY_MAX_CHARS = 8e3;
1278
1286
  var NEAR_DUP_JACCARD = 0.92;
1279
- function looksLikeMustKeep(text5) {
1280
- return MUST_KEEP_TEXT_RE.test(text5);
1287
+ function looksLikeMustKeep(text6) {
1288
+ return MUST_KEEP_TEXT_RE.test(text6);
1281
1289
  }
1282
- function normalizeText(text5) {
1283
- return text5.replace(/\s+/g, " ").trim().toLowerCase();
1290
+ function normalizeText(text6) {
1291
+ return text6.replace(/\s+/g, " ").trim().toLowerCase();
1284
1292
  }
1285
- function wordSet(text5) {
1293
+ function wordSet(text6) {
1286
1294
  return new Set(
1287
- text5.toLowerCase().split(/\W+/).filter((w) => w.length > 2)
1295
+ text6.toLowerCase().split(/\W+/).filter((w) => w.length > 2)
1288
1296
  );
1289
1297
  }
1290
1298
  function jaccard(a, b) {
@@ -1296,11 +1304,11 @@ function jaccard(a, b) {
1296
1304
  const union = a.size + b.size - inter;
1297
1305
  return union === 0 ? 0 : inter / union;
1298
1306
  }
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;
1307
+ function importance(text6) {
1308
+ let score = text6.length;
1309
+ if (/```/.test(text6)) score += 400;
1310
+ if (/https?:\/\//.test(text6)) score += 50;
1311
+ if (looksLikeMustKeep(text6)) score += 1e4;
1304
1312
  return score;
1305
1313
  }
1306
1314
  function meanStd(values) {
@@ -1314,15 +1322,15 @@ function dedupTextItems(items, getText) {
1314
1322
  const keptNorm = [];
1315
1323
  const keptWords = [];
1316
1324
  for (const item of items) {
1317
- const text5 = getText(item);
1318
- const norm = normalizeText(text5);
1325
+ const text6 = getText(item);
1326
+ const norm = normalizeText(text6);
1319
1327
  if (!norm) {
1320
1328
  kept.push(item);
1321
1329
  keptNorm.push(norm);
1322
- keptWords.push(wordSet(text5));
1330
+ keptWords.push(wordSet(text6));
1323
1331
  continue;
1324
1332
  }
1325
- const words = wordSet(text5);
1333
+ const words = wordSet(text6);
1326
1334
  let dupAt = -1;
1327
1335
  for (let i = 0; i < kept.length; i++) {
1328
1336
  if (keptNorm[i] === norm) {
@@ -1340,7 +1348,7 @@ function dedupTextItems(items, getText) {
1340
1348
  keptWords.push(words);
1341
1349
  continue;
1342
1350
  }
1343
- if (text5.length > getText(kept[dupAt]).length) {
1351
+ if (text6.length > getText(kept[dupAt]).length) {
1344
1352
  kept[dupAt] = item;
1345
1353
  keptNorm[dupAt] = norm;
1346
1354
  keptWords[dupAt] = words;
@@ -1381,8 +1389,8 @@ function crushTextItems(items, getText, opts = {}) {
1381
1389
  const outlierFloor = mean + 2 * std;
1382
1390
  const mustKeep = /* @__PURE__ */ new Set();
1383
1391
  unique.forEach((item, i) => {
1384
- const text5 = getText(item);
1385
- if (looksLikeMustKeep(text5) || text5.length > outlierFloor) mustKeep.add(i);
1392
+ const text6 = getText(item);
1393
+ if (looksLikeMustKeep(text6) || text6.length > outlierFloor) mustKeep.add(i);
1386
1394
  });
1387
1395
  const remainingIdx = unique.map((_, i) => i).filter((i) => !mustKeep.has(i));
1388
1396
  let used = [...mustKeep].reduce((n, i) => n + lengths[i], 0);
@@ -1424,9 +1432,9 @@ function crushTextItems(items, getText, opts = {}) {
1424
1432
  reason: "budget"
1425
1433
  };
1426
1434
  }
1427
- function splitBlocks(text5) {
1428
- if (/\n\n/.test(text5)) return text5.split(/\n\n+/);
1429
- return text5.split("\n");
1435
+ function splitBlocks(text6) {
1436
+ if (/\n\n/.test(text6)) return text6.split(/\n\n+/);
1437
+ return text6.split("\n");
1430
1438
  }
1431
1439
  function capOversizedBlock(block, maxChars) {
1432
1440
  if (block.length <= maxChars) return block;
@@ -1438,8 +1446,8 @@ function capOversizedBlock(block, maxChars) {
1438
1446
 
1439
1447
  ${block.slice(-tail)}`;
1440
1448
  }
1441
- function crushMarkdown(text5, opts) {
1442
- const original = text5 ?? "";
1449
+ function crushMarkdown(text6, opts) {
1450
+ const original = text6 ?? "";
1443
1451
  const minChars = opts?.minChars ?? CRUSH_BODY_MIN_CHARS;
1444
1452
  const maxChars = opts?.maxChars ?? CRUSH_BODY_MAX_CHARS;
1445
1453
  if (original.length < minChars) {
@@ -1529,13 +1537,13 @@ function withComments(comments, meta) {
1529
1537
  }
1530
1538
  return { comments: crushed.items, meta };
1531
1539
  }
1532
- function withBody(text5, meta) {
1533
- const crushed = crushMarkdown(text5);
1540
+ function withBody(text6, meta) {
1541
+ const crushed = crushMarkdown(text6);
1534
1542
  if (crushed.truncated) {
1535
1543
  meta.body = { originalChars: crushed.originalChars };
1536
1544
  return { value: crushed.text, meta };
1537
1545
  }
1538
- return { value: text5, meta };
1546
+ return { value: text6, meta };
1539
1547
  }
1540
1548
  function attachCrush(payload, meta) {
1541
1549
  if (!meta.comments && !meta.body) return payload;
@@ -2324,9 +2332,9 @@ async function runPosthogApi(input) {
2324
2332
  body,
2325
2333
  signal: AbortSignal.timeout(POSTHOG_TIMEOUT_MS)
2326
2334
  });
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;
2335
+ const text6 = await res.text();
2336
+ const truncated = text6.length > POSTHOG_RESPONSE_MAX_CHARS;
2337
+ const slice = truncated ? text6.slice(0, POSTHOG_RESPONSE_MAX_CHARS) : text6;
2330
2338
  let parsed = slice;
2331
2339
  if (slice.trim()) {
2332
2340
  try {
@@ -2469,7 +2477,7 @@ function registerArchiveTools(server, orch) {
2469
2477
  );
2470
2478
  server.tool(
2471
2479
  "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.",
2480
+ "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
2481
  { ref: z6.string().describe("Chat id to archive") },
2474
2482
  async ({ ref }) => {
2475
2483
  const t = orch.getThread(ref);
@@ -2772,8 +2780,80 @@ function registerScheduleTools(server) {
2772
2780
  );
2773
2781
  }
2774
2782
 
2775
- // src/mcp/order-tools.ts
2783
+ // src/mcp/follow-up-tools.ts
2776
2784
  import { z as z8 } from "zod";
2785
+ function text5(payload, isError = false) {
2786
+ return mcpJson(payload, isError);
2787
+ }
2788
+ function callerThread() {
2789
+ const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
2790
+ if (!id) return null;
2791
+ return findThreadByRef(id);
2792
+ }
2793
+ async function baselineCi(thread) {
2794
+ const selector = resolvePrSelector(thread);
2795
+ if (!selector) return "none";
2796
+ try {
2797
+ const checks = await getPrCiChecks(thread.worktreePath, selector);
2798
+ return ciChecksSettled(checks);
2799
+ } catch {
2800
+ return "unknown";
2801
+ }
2802
+ }
2803
+ function registerFollowUpTools(server) {
2804
+ server.tool(
2805
+ "list_follow_ups",
2806
+ "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.",
2807
+ {},
2808
+ async () => {
2809
+ const thread = callerThread();
2810
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2811
+ return text5({ followUps: normalizeChatFollowUps(thread.followUps) });
2812
+ }
2813
+ );
2814
+ server.tool(
2815
+ "create_follow_up",
2816
+ "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.",
2817
+ {
2818
+ kind: z8.enum(["ci", "at"]),
2819
+ prompt: z8.string(),
2820
+ at: z8.string().optional(),
2821
+ deadline: z8.string().optional()
2822
+ },
2823
+ async ({ kind, prompt, at, deadline }) => {
2824
+ const thread = callerThread();
2825
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2826
+ if (thread.status === "archived") return text5({ error: "This chat is archived" }, true);
2827
+ const existing = normalizeChatFollowUps(thread.followUps);
2828
+ const ciBaseline = kind === "ci" ? await baselineCi(thread) : void 0;
2829
+ const added = addChatFollowUp(
2830
+ existing,
2831
+ { kind, prompt, at, deadline, ciBaseline },
2832
+ /* @__PURE__ */ new Date()
2833
+ );
2834
+ if (!added.ok) return text5({ error: added.error }, true);
2835
+ updateThread(thread.id, { followUps: added.followUps });
2836
+ return text5({ followUps: added.followUps });
2837
+ }
2838
+ );
2839
+ server.tool(
2840
+ "delete_follow_up",
2841
+ "Remove one follow-up from this chat by id.",
2842
+ { id: z8.string() },
2843
+ async ({ id }) => {
2844
+ const thread = callerThread();
2845
+ if (!thread) return text5({ error: "This chat id is missing" }, true);
2846
+ const existing = normalizeChatFollowUps(thread.followUps);
2847
+ const followUps = existing.filter((item) => item.id !== id.trim());
2848
+ if (followUps.length === existing.length) return text5({ error: "Follow-up not found" }, true);
2849
+ updateThread(thread.id, { followUps });
2850
+ return text5({ followUps });
2851
+ }
2852
+ );
2853
+ }
2854
+
2855
+ // src/mcp/order-tools.ts
2856
+ import { z as z9 } from "zod";
2777
2857
 
2778
2858
  // src/order/order.ts
2779
2859
  import { randomUUID } from "crypto";
@@ -3622,8 +3702,8 @@ function satisfyOrderDependency(id, satisfied = true) {
3622
3702
  }
3623
3703
 
3624
3704
  // src/mcp/order-tools.ts
3625
- var kindSchema = z8.enum(["pr", "issue", "workspace", "orchestration"]);
3626
- function callerThread() {
3705
+ var kindSchema = z9.enum(["pr", "issue", "workspace", "orchestration"]);
3706
+ function callerThread2() {
3627
3707
  const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim();
3628
3708
  if (!id) return null;
3629
3709
  return readThread(id);
@@ -3636,7 +3716,7 @@ function readCheckoutPlan(caller) {
3636
3716
  return readPlanFile(root);
3637
3717
  }
3638
3718
  function orchestrationOwnerId(worktree) {
3639
- const caller = callerThread();
3719
+ const caller = callerThread2();
3640
3720
  if (!caller) {
3641
3721
  throw new Error(
3642
3722
  worktree ? "No worktree chat is bound to this tool." : "No orchestration chat is bound to this tool."
@@ -3672,10 +3752,10 @@ function registerOrderTools(server) {
3672
3752
  try {
3673
3753
  const owner = orchestrationOwnerId(worktree);
3674
3754
  const plan = getOrderPlan(owner);
3675
- const caller = callerThread();
3755
+ const caller = callerThread2();
3676
3756
  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 }] };
3757
+ 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.";
3758
+ return { content: [{ type: "text", text: text6 }] };
3679
3759
  }
3680
3760
  const rows = listOrderRows(plan.id);
3681
3761
  const place = worktree && caller ? `${formatOrderPlace(rows, orderSnapshotFromThread(caller))}
@@ -3694,16 +3774,16 @@ function registerOrderTools(server) {
3694
3774
  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
3775
  {
3696
3776
  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"),
3777
+ waitsOnRef: z9.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
3778
+ waitsOnRepoPath: z9.string().optional().describe("Project path when a PR or issue number is not unique"),
3779
+ waitsOnLabel: z9.string().optional().describe("Short label on the planner"),
3780
+ gate: z9.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
3781
+ hold: z9.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
3702
3782
  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")
3783
+ subjectRef: z9.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
3784
+ subjectRepoPath: z9.string().optional(),
3785
+ subjectLabel: z9.string().optional(),
3786
+ note: z9.string().optional().describe("Why this order matters")
3707
3787
  },
3708
3788
  async (args) => {
3709
3789
  try {
@@ -3712,7 +3792,7 @@ function registerOrderTools(server) {
3712
3792
  if (hasKind !== hasRef) {
3713
3793
  throw new Error("Pass subjectKind and subjectRef together, or omit both on a worktree.");
3714
3794
  }
3715
- const caller = callerThread();
3795
+ const caller = callerThread2();
3716
3796
  let subject;
3717
3797
  const hold = parseOrderHold(args.hold);
3718
3798
  if (!hasKind) {
@@ -3767,9 +3847,9 @@ function registerOrderTools(server) {
3767
3847
  "set_plan",
3768
3848
  "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
3849
  {
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")
3850
+ title: z9.string().describe("Short name for the plan"),
3851
+ summary: z9.string().optional().describe("What this order is for, in a sentence or two"),
3852
+ goal: z9.string().optional().describe("Outcome the steps are trying to reach")
3773
3853
  },
3774
3854
  async ({ title, summary, goal }) => {
3775
3855
  try {
@@ -3789,7 +3869,7 @@ function registerOrderTools(server) {
3789
3869
  "execute_plan",
3790
3870
  "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
3871
  {
3792
- agreed: z8.literal(true).describe("True only after the user has seen the plan and told you to run it")
3872
+ agreed: z9.literal(true).describe("True only after the user has seen the plan and told you to run it")
3793
3873
  },
3794
3874
  async () => {
3795
3875
  try {
@@ -3822,7 +3902,7 @@ function registerOrderTools(server) {
3822
3902
  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
3903
  {},
3824
3904
  async () => {
3825
- const caller = callerThread();
3905
+ const caller = callerThread2();
3826
3906
  let diagramHtml = null;
3827
3907
  let diagramTitle = "Planner";
3828
3908
  let diagramError = null;
@@ -3860,10 +3940,10 @@ function registerOrderTools(server) {
3860
3940
  server.tool(
3861
3941
  "clear_dependency",
3862
3942
  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") },
3943
+ { id: z9.string().describe("Step id from list_order") },
3864
3944
  async ({ id }) => {
3865
3945
  try {
3866
- const caller = callerThread();
3946
+ const caller = callerThread2();
3867
3947
  clearOrderDependency(
3868
3948
  id,
3869
3949
  worktree && caller ? orderSnapshotFromThread(caller) : null,
@@ -3879,8 +3959,8 @@ function registerOrderTools(server) {
3879
3959
  "satisfy_dependency",
3880
3960
  "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
3961
  {
3882
- id: z8.string().describe("Step id from list_order"),
3883
- satisfied: z8.boolean().optional().describe("false clears the manual mark. Default true.")
3962
+ id: z9.string().describe("Step id from list_order"),
3963
+ satisfied: z9.boolean().optional().describe("false clears the manual mark. Default true.")
3884
3964
  },
3885
3965
  async ({ id, satisfied }) => {
3886
3966
  try {
@@ -3890,7 +3970,7 @@ function registerOrderTools(server) {
3890
3970
  const rows = listOrderRows(plan.id);
3891
3971
  const hit = rows.find((row) => row.id === id || id.length >= 8 && row.id.startsWith(id));
3892
3972
  if (!hit) throw new Error("That step is on another orchestration chat's plan.");
3893
- const caller = callerThread();
3973
+ const caller = callerThread2();
3894
3974
  if (worktree && caller && !orderEdgeTouches(hit, orderSnapshotFromThread(caller))) {
3895
3975
  throw new Error("This checkout can only change a step it is part of.");
3896
3976
  }
@@ -4199,9 +4279,9 @@ async function getGitHubStatus() {
4199
4279
  };
4200
4280
  }
4201
4281
  const status = await run("gh", ["auth", "status"], { reject: false });
4202
- const text5 = `${status.stdout}
4282
+ const text6 = `${status.stdout}
4203
4283
  ${status.stderr}`;
4204
- const loginMatch = text5.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text5.match(/Logged in to ([^\s]+) as (\S+)/i);
4284
+ const loginMatch = text6.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text6.match(/Logged in to ([^\s]+) as (\S+)/i);
4205
4285
  if (loginMatch) {
4206
4286
  return {
4207
4287
  connected: true,
@@ -4233,7 +4313,7 @@ async function startMcpServer() {
4233
4313
  );
4234
4314
  }
4235
4315
  try {
4236
- const { maxConcurrentAgents } = await import("../app-settings-PPIMYJKS.js");
4316
+ const { maxConcurrentAgents } = await import("../app-settings-XILTSD6L.js");
4237
4317
  orch.setMaxConcurrent(maxConcurrentAgents());
4238
4318
  } catch {
4239
4319
  }
@@ -4317,16 +4397,16 @@ async function startMcpServer() {
4317
4397
  "list_board",
4318
4398
  "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
4399
  {
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(
4400
+ query: z10.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
4401
+ repoPath: z10.string().optional().describe("Limit to one project path from list_projects"),
4402
+ kind: z10.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
4403
+ ownership: z10.enum(["all", "mine", "reviewing"]).optional().describe(
4324
4404
  "Mine = PRs you authored or local WIP; reviewing = someone else's PR. Uses the gh login."
4325
4405
  ),
4326
- column: z9.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
4406
+ column: z10.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
4327
4407
  "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
4408
  ),
4329
- limit: z9.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
4409
+ limit: z10.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
4330
4410
  },
4331
4411
  async ({ query, repoPath, kind, ownership, column, limit }) => {
4332
4412
  const workspaces = orch.listWorkspaces();
@@ -4356,7 +4436,7 @@ async function startMcpServer() {
4356
4436
  server.tool(
4357
4437
  "get_chat",
4358
4438
  "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() },
4439
+ { ref: z10.string() },
4360
4440
  async ({ ref }) => {
4361
4441
  const t = orch.getThread(ref);
4362
4442
  if (!t) {
@@ -4403,17 +4483,17 @@ async function startMcpServer() {
4403
4483
  "present_artifact",
4404
4484
  "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
4485
  {
4406
- title: z9.string().describe("Short title shown in the artifact pane header"),
4407
- type: z9.enum(["html", "svg", "markdown", "react", "log"]).describe(
4486
+ title: z10.string().describe("Short title shown in the artifact pane header"),
4487
+ type: z10.enum(["html", "svg", "markdown", "react", "log"]).describe(
4408
4488
  "html/svg/markdown/react replace the pane. log appends content to the same artifact_id (new lines only)."
4409
4489
  ),
4410
- content: z9.string().describe(
4490
+ content: z10.string().describe(
4411
4491
  "html/svg/markdown/react: full document. log: only the new lines since the last call (empty is ok for a status-only update)."
4412
4492
  ),
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")
4493
+ artifact_id: z10.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
4494
+ status: z10.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
4495
+ phase: z10.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
4496
+ mode: z10.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
4417
4497
  },
4418
4498
  async ({ title, type, artifact_id, status, phase, mode }) => {
4419
4499
  return mcpJson(
@@ -4426,15 +4506,15 @@ async function startMcpServer() {
4426
4506
  "ask_user",
4427
4507
  "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
4508
  {
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)")
4509
+ questions: z10.array(
4510
+ z10.object({
4511
+ question: z10.string().describe("Full question text ending with ?"),
4512
+ header: z10.string().max(24).optional().describe("Short label shown above the question"),
4513
+ multiSelect: z10.boolean().optional().describe("Allow selecting multiple options"),
4514
+ options: z10.array(
4515
+ z10.object({
4516
+ label: z10.string(),
4517
+ description: z10.string().optional().describe("What this option means / when to choose it (strongly preferred)")
4438
4518
  })
4439
4519
  ).min(2).max(6).describe("2\u20136 choices (Sideboard also offers Other)")
4440
4520
  })
@@ -4460,9 +4540,9 @@ async function startMcpServer() {
4460
4540
  "present_plan",
4461
4541
  PRESENT_PLAN_TOOL_DESCRIPTION,
4462
4542
  {
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")
4543
+ title: z10.string().optional().describe("Short plan title (defaults to Plan)"),
4544
+ content: z10.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
4545
+ thread_id: z10.string().optional().describe("Sideboard thread id when cwd is not the worktree")
4466
4546
  },
4467
4547
  async ({ title, content, thread_id }) => {
4468
4548
  const { writePlanFile } = await import("../plan-file-VAHV5WBB.js");
@@ -4491,15 +4571,15 @@ async function startMcpServer() {
4491
4571
  "present_schema",
4492
4572
  "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
4573
  {
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")
4574
+ title: z10.string().describe("Pane title"),
4575
+ mode: z10.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
4576
+ datasource: z10.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
4577
+ resource_id: z10.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
4578
+ record_id: z10.string().optional().describe("Record id when opening form mode"),
4579
+ resource: z10.record(z10.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
4580
+ record: z10.record(z10.unknown()).optional().describe("Inline record { id, data, published_at? }"),
4581
+ records: z10.array(z10.record(z10.unknown())).optional().describe("Inline records for table mode"),
4582
+ pane_id: z10.string().optional().describe("Stable pane id across updates")
4503
4583
  },
4504
4584
  async (args) => {
4505
4585
  const id = args.pane_id?.trim() || `schema_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
@@ -4520,10 +4600,10 @@ async function startMcpServer() {
4520
4600
  "present_files",
4521
4601
  "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
4602
  {
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")
4603
+ title: z10.string().optional().describe("Pane title (default: Files)"),
4604
+ datasource: z10.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
4605
+ path: z10.string().optional().describe("Initial folder path (e.g. public)"),
4606
+ pane_id: z10.string().optional().describe("Stable pane id across updates")
4527
4607
  },
4528
4608
  async (args) => {
4529
4609
  const id = args.pane_id?.trim() || `files_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
@@ -4543,8 +4623,8 @@ async function startMcpServer() {
4543
4623
  "wait_for_job",
4544
4624
  "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
4625
  {
4546
- id: z9.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4547
- timeoutMs: z9.number().optional()
4626
+ id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4627
+ timeoutMs: z10.number().optional()
4548
4628
  },
4549
4629
  async ({ id, timeoutMs }) => {
4550
4630
  const result = await waitForDetachedJob(process.cwd(), id, {
@@ -4557,8 +4637,8 @@ async function startMcpServer() {
4557
4637
  "stop_job",
4558
4638
  "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
4639
  {
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)")
4640
+ id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
4641
+ reason: z10.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
4562
4642
  },
4563
4643
  async ({ id, reason }) => {
4564
4644
  const result = await stopDetachedJob(process.cwd(), id, { reason });
@@ -4570,7 +4650,7 @@ async function startMcpServer() {
4570
4650
  "list_run_scripts",
4571
4651
  "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
4652
  {
4573
- ref: z9.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
4653
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
4574
4654
  },
4575
4655
  async ({ ref }) => {
4576
4656
  try {
@@ -4600,8 +4680,8 @@ async function startMcpServer() {
4600
4680
  "run_dev_script",
4601
4681
  "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
4682
  {
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).")
4683
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4684
+ name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
4605
4685
  },
4606
4686
  async ({ ref, name }) => {
4607
4687
  try {
@@ -4629,8 +4709,8 @@ async function startMcpServer() {
4629
4709
  "stop_dev_script",
4630
4710
  "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
4711
  {
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.")
4712
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4713
+ name: z10.string().optional().describe("Script name to stop; omit to stop all active scripts.")
4634
4714
  },
4635
4715
  async ({ ref, name }) => {
4636
4716
  try {
@@ -4647,9 +4727,9 @@ async function startMcpServer() {
4647
4727
  "get_run_log",
4648
4728
  "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
4729
  {
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(
4730
+ ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
4731
+ name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
4732
+ tail: z10.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
4653
4733
  `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
4734
  )
4655
4735
  },
@@ -4703,8 +4783,8 @@ async function startMcpServer() {
4703
4783
  }
4704
4784
  });
4705
4785
  } catch (err) {
4706
- const text5 = err instanceof Error ? err.message : String(err);
4707
- return { content: [{ type: "text", text: text5 }], isError: true };
4786
+ const text6 = err instanceof Error ? err.message : String(err);
4787
+ return { content: [{ type: "text", text: text6 }], isError: true };
4708
4788
  }
4709
4789
  }
4710
4790
  );
@@ -4712,8 +4792,8 @@ async function startMcpServer() {
4712
4792
  "notify_orchestrator",
4713
4793
  "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
4794
  {
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(
4795
+ message: z10.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
4796
+ reason: z10.enum(["input-required", "blocked"]).optional().describe(
4717
4797
  "input-required = waiting on the user in this chat; blocked = need the coordinator (default)."
4718
4798
  )
4719
4799
  },
@@ -4739,23 +4819,24 @@ async function startMcpServer() {
4739
4819
  ...result.deduped ? { deduped: true } : {}
4740
4820
  });
4741
4821
  } catch (err) {
4742
- const text5 = err instanceof Error ? err.message : String(err);
4743
- return { content: [{ type: "text", text: text5 }], isError: true };
4822
+ const text6 = err instanceof Error ? err.message : String(err);
4823
+ return { content: [{ type: "text", text: text6 }], isError: true };
4744
4824
  }
4745
4825
  }
4746
4826
  );
4747
4827
  }
4748
4828
  registerScheduleTools(server);
4829
+ registerFollowUpTools(server);
4749
4830
  registerOrderTools(server);
4750
4831
  server.tool(
4751
4832
  "set_workspace_tags",
4752
4833
  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
4834
  {
4754
- ref: z9.string().optional().describe(
4835
+ ref: z10.string().optional().describe(
4755
4836
  worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace to label."
4756
4837
  ),
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()
4838
+ tags: z10.union([z10.string(), z10.array(z10.string())]).describe("Labels to set. A string may be comma-separated."),
4839
+ mode: z10.enum(["replace", "add", "remove"]).optional()
4759
4840
  },
4760
4841
  async ({ ref, tags, mode }) => {
4761
4842
  try {
@@ -4783,10 +4864,10 @@ async function startMcpServer() {
4783
4864
  "set_wake_on_github_edges",
4784
4865
  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
4866
  {
4786
- ref: z9.string().optional().describe(
4867
+ ref: z10.string().optional().describe(
4787
4868
  worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
4788
4869
  ),
4789
- enabled: z9.boolean().describe("True opts the checkout in. False turns it off.")
4870
+ enabled: z10.boolean().describe("True opts the checkout in. False turns it off.")
4790
4871
  },
4791
4872
  async ({ ref, enabled }) => {
4792
4873
  try {
@@ -4812,14 +4893,14 @@ async function startMcpServer() {
4812
4893
  if (!worktreeProfile) {
4813
4894
  registerConnectedIssueVendorTools(server);
4814
4895
  const { getCaffeinateHold, setCaffeinateHold } = await import("../caffeinate-hold-H7TTUDGM.js");
4815
- const { resolveNewThreadOptions, resolveThreadDefaults } = await import("../app-settings-PPIMYJKS.js");
4896
+ const { resolveNewThreadOptions, resolveThreadDefaults } = await import("../app-settings-XILTSD6L.js");
4816
4897
  const accountDefaults = resolveThreadDefaults();
4817
4898
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
4818
4899
  server.tool(
4819
4900
  "set_caffeinate",
4820
4901
  "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
4902
  {
4822
- enabled: z9.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
4903
+ enabled: z10.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
4823
4904
  },
4824
4905
  async ({ enabled }) => {
4825
4906
  const threadId = process.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
@@ -4845,24 +4926,25 @@ async function startMcpServer() {
4845
4926
  "create_workspace",
4846
4927
  `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
4928
  {
4848
- sourceType: z9.enum(["branch", "pr", "ticket"]),
4849
- sourceRef: z9.string(),
4850
- agent: z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
4851
- `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
4929
+ sourceType: z10.enum(["branch", "pr", "ticket"]),
4930
+ sourceRef: z10.string(),
4931
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]).optional().describe(
4932
+ `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored. Pass agent=acp and acpHarness=gemini or copilot for Gemini CLI or Copilot CLI.`
4852
4933
  ),
4853
- model: z9.string().nullable().optional().describe(
4934
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini (Gemini CLI) or copilot (GitHub Copilot CLI)."),
4935
+ model: z10.string().nullable().optional().describe(
4854
4936
  `Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
4855
4937
  ),
4856
- repoPath: z9.string(),
4857
- title: z9.string().optional(),
4858
- cowboy: z9.boolean().optional().describe(
4938
+ repoPath: z10.string(),
4939
+ title: z10.string().optional(),
4940
+ cowboy: z10.boolean().optional().describe(
4859
4941
  "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
4942
  ),
4861
- parentChatId: z9.string().optional().describe(
4943
+ parentChatId: z10.string().optional().describe(
4862
4944
  "Orchestration: omit (preferred) or pass YOUR chat id from the turn reminder / AGENTS.md. Do not invent uuids."
4863
4945
  ),
4864
- parentThreadId: z9.string().optional().describe("Legacy alias for parentChatId."),
4865
- tags: z9.union([z9.string(), z9.array(z9.string())]).optional().describe(
4946
+ parentThreadId: z10.string().optional().describe("Legacy alias for parentChatId."),
4947
+ tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
4866
4948
  "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
4949
  )
4868
4950
  },
@@ -4878,11 +4960,11 @@ async function startMcpServer() {
4878
4960
  "start_board_card",
4879
4961
  "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
4962
  {
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(
4963
+ kind: z10.enum(["ticket", "pr", "branch"]),
4964
+ ref: z10.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
4965
+ repoPath: z10.string().describe("Project path from list_projects / list_board"),
4966
+ title: z10.string().optional(),
4967
+ tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
4886
4968
  "Short labels for this workspace. Same tags on every checkout for one task. Added when the checkout already exists."
4887
4969
  )
4888
4970
  },
@@ -4985,11 +5067,11 @@ async function startMcpServer() {
4985
5067
  );
4986
5068
  server.tool(
4987
5069
  "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.',
5070
+ '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
5071
  {
4990
- ref: z9.string(),
4991
- prompt: z9.string(),
4992
- force_stop: z9.boolean().optional()
5072
+ ref: z10.string(),
5073
+ prompt: z10.string(),
5074
+ force_stop: z10.boolean().optional()
4993
5075
  },
4994
5076
  async ({ ref, prompt, force_stop }) => {
4995
5077
  if (force_stop) {
@@ -4999,7 +5081,7 @@ async function startMcpServer() {
4999
5081
  }
5000
5082
  }
5001
5083
  const thread = await orch.send(ref, prompt, {
5002
- followUp: resolveOrchChildFollowUp()
5084
+ followUp: force_stop ? "steer" : "join"
5003
5085
  });
5004
5086
  return mcpJson({
5005
5087
  id: thread.id,
@@ -5012,10 +5094,10 @@ async function startMcpServer() {
5012
5094
  if (shouldRegisterMcpWaitForTurn()) {
5013
5095
  server.tool(
5014
5096
  "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).",
5097
+ "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
5098
  {
5017
- ref: z9.string(),
5018
- timeoutMs: z9.number().optional()
5099
+ ref: z10.string(),
5100
+ timeoutMs: z10.number().optional()
5019
5101
  },
5020
5102
  async ({ ref, timeoutMs }) => {
5021
5103
  const thread = await orch.waitForTurn(ref, mcpWaitForTurnTimeoutMs(timeoutMs), {
@@ -5042,14 +5124,16 @@ async function startMcpServer() {
5042
5124
  }
5043
5125
  server.tool(
5044
5126
  "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() },
5127
+ "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).",
5128
+ { ref: z10.string() },
5047
5129
  async ({ ref }) => {
5048
5130
  const result = orch.getTurnResult(ref);
5049
- const hint = mcpWaitTaskHint(result.taskState, result.status, result.blockedReason);
5131
+ const failureClass = result.taskState === "failed" && result.status !== "broken" ? classifyTurnFailure(result.lastError || result.text) : null;
5132
+ const hint = mcpWaitTaskHint(result.taskState, result.status, result.blockedReason, failureClass);
5050
5133
  const waiting = Boolean(result.blockedReason) && !result.stillRunning && result.taskState !== "failed" && result.taskState !== "canceled";
5051
5134
  return mcpJson({
5052
5135
  ...result,
5136
+ failureClass,
5053
5137
  hint,
5054
5138
  incomplete: needsCoordinatorAction(result.taskState) || waiting
5055
5139
  });
@@ -5059,9 +5143,9 @@ async function startMcpServer() {
5059
5143
  "stop_chat",
5060
5144
  "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
5145
  {
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.")
5146
+ ref: z10.string(),
5147
+ force: z10.boolean().optional(),
5148
+ reason: z10.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
5065
5149
  },
5066
5150
  async ({ ref, force, reason }) => {
5067
5151
  const t = orch.getThread(ref);
@@ -5087,8 +5171,8 @@ async function startMcpServer() {
5087
5171
  "get_diff",
5088
5172
  "Compact diff summary (capped hunks, paginated)",
5089
5173
  {
5090
- ref: z9.string(),
5091
- maxFiles: z9.number().optional()
5174
+ ref: z10.string(),
5175
+ maxFiles: z10.number().optional()
5092
5176
  },
5093
5177
  async ({ ref, maxFiles }) => {
5094
5178
  const summary = await orch.diffSummary(ref);
@@ -5101,7 +5185,7 @@ async function startMcpServer() {
5101
5185
  server.tool(
5102
5186
  "get_pr_checks",
5103
5187
  "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") },
5188
+ { ref: z10.string().describe("Worktree thread id/ref") },
5105
5189
  async ({ ref }) => {
5106
5190
  try {
5107
5191
  const checks = await orch.getPrChecks(ref);
@@ -5115,7 +5199,7 @@ async function startMcpServer() {
5115
5199
  server.tool(
5116
5200
  "request_review",
5117
5201
  '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") },
5202
+ { ref: z10.string().describe("Worktree thread id/ref to review") },
5119
5203
  async ({ ref }) => {
5120
5204
  try {
5121
5205
  const tab = await orch.requestReview(ref);
@@ -5137,8 +5221,8 @@ async function startMcpServer() {
5137
5221
  "ask_git",
5138
5222
  "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
5223
  {
5140
- ref: z9.string().describe("Worktree thread id/ref"),
5141
- action: z9.enum(AGENT_GIT_ACTIONS).describe(
5224
+ ref: z10.string().describe("Worktree thread id/ref"),
5225
+ action: z10.enum(AGENT_GIT_ACTIONS).describe(
5142
5226
  "commit-push | create-draft | create-web | resolve-conflicts | ready-for-review | merge"
5143
5227
  )
5144
5228
  },
@@ -5167,7 +5251,7 @@ async function startMcpServer() {
5167
5251
  }
5168
5252
  }
5169
5253
  );
5170
- const agentEnum = z9.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
5254
+ const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
5171
5255
  server.tool(
5172
5256
  "list_models",
5173
5257
  "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,13 +5272,14 @@ async function startMcpServer() {
5188
5272
  "fork_workspace",
5189
5273
  "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
5274
  {
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)"),
5275
+ ref: z10.string().describe("Worktree thread id/ref to fork"),
5276
+ through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5193
5277
  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()
5278
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
5279
+ model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5280
+ title: z10.string().optional()
5196
5281
  },
5197
- async ({ ref, through_index, agent, model, title }) => {
5282
+ async ({ ref, through_index, agent, model, title, acpHarness }) => {
5198
5283
  try {
5199
5284
  const source = orch.getThread(ref);
5200
5285
  if (source) await orch.reconcile(source.repoPath, { drainQueues: false });
@@ -5202,6 +5287,7 @@ async function startMcpServer() {
5202
5287
  threadId: ref,
5203
5288
  throughIndex: through_index,
5204
5289
  agent,
5290
+ acpHarness,
5205
5291
  model,
5206
5292
  title
5207
5293
  });
@@ -5226,13 +5312,14 @@ async function startMcpServer() {
5226
5312
  "fork_chat",
5227
5313
  "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
5314
  {
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)"),
5231
- 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()
5315
+ ref: z10.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
5316
+ through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
5317
+ agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source). agent=acp with acpHarness=gemini or copilot opens Gemini CLI or Copilot CLI. An orchestration fork cannot use acp."),
5318
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
5319
+ model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
5320
+ title: z10.string().optional()
5234
5321
  },
5235
- async ({ ref, through_index, agent, model, title }) => {
5322
+ async ({ ref, through_index, agent, model, title, acpHarness }) => {
5236
5323
  try {
5237
5324
  const source = orch.getThread(ref);
5238
5325
  if (!source) {
@@ -5245,6 +5332,7 @@ async function startMcpServer() {
5245
5332
  threadId: source.id,
5246
5333
  throughIndex: through_index,
5247
5334
  agent,
5335
+ acpHarness,
5248
5336
  model,
5249
5337
  title
5250
5338
  });
@@ -5268,7 +5356,7 @@ async function startMcpServer() {
5268
5356
  server.tool(
5269
5357
  "run_setup",
5270
5358
  "Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
5271
- { ref: z9.string() },
5359
+ { ref: z10.string() },
5272
5360
  async ({ ref }) => {
5273
5361
  const result = await orch.runSetup(ref);
5274
5362
  return mcpJson(result);
@@ -5277,7 +5365,7 @@ async function startMcpServer() {
5277
5365
  server.tool(
5278
5366
  "add_project",
5279
5367
  "Register a git repo as a Sideboard workspace",
5280
- { repoPath: z9.string() },
5368
+ { repoPath: z10.string() },
5281
5369
  async ({ repoPath }) => {
5282
5370
  const ws = await orch.addWorkspace(repoPath);
5283
5371
  return mcpJson(ws);
@@ -5286,7 +5374,7 @@ async function startMcpServer() {
5286
5374
  server.tool(
5287
5375
  "remove_project",
5288
5376
  "Unregister a Sideboard workspace and archive its chats",
5289
- { repoPath: z9.string() },
5377
+ { repoPath: z10.string() },
5290
5378
  async ({ repoPath }) => {
5291
5379
  await orch.removeWorkspace(repoPath);
5292
5380
  return { content: [{ type: "text", text: "ok" }] };
@@ -5296,12 +5384,12 @@ async function startMcpServer() {
5296
5384
  "fanout",
5297
5385
  "Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
5298
5386
  {
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()
5387
+ prompt: z10.string(),
5388
+ agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"])),
5389
+ repoPath: z10.string(),
5390
+ sourceType: z10.enum(["branch", "pr", "ticket"]).optional(),
5391
+ sourceRef: z10.string().optional(),
5392
+ title: z10.string().optional()
5305
5393
  },
5306
5394
  async (args) => {
5307
5395
  const threads = await orch.bestOfN(args);
@@ -5319,8 +5407,8 @@ async function startMcpServer() {
5319
5407
  "list_branches",
5320
5408
  "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
5409
  {
5322
- repoPath: z9.string(),
5323
- unmergedOnly: z9.boolean().optional()
5410
+ repoPath: z10.string(),
5411
+ unmergedOnly: z10.boolean().optional()
5324
5412
  },
5325
5413
  async ({ repoPath, unmergedOnly }) => {
5326
5414
  const root = await resolveRepoRoot(repoPath);
@@ -5341,19 +5429,19 @@ async function startMcpServer() {
5341
5429
  "list_prs",
5342
5430
  `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
5431
  {
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(
5432
+ repoPath: z10.string(),
5433
+ query: z10.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
5434
+ queue: z10.enum(["review", "mine", "approved", "changes"]).optional().describe(
5347
5435
  "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
5436
  ),
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(
5437
+ state: z10.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
5438
+ label: z10.string().optional().describe(
5351
5439
  "GitHub label / workflow tag. Comma-separated AND. Examples: eng-review, eng-approved, eng-requested-changes"
5352
5440
  ),
5353
- reviewer: z9.string().optional().describe(
5441
+ reviewer: z10.string().optional().describe(
5354
5442
  "me (review requested of you), unassigned (no individual reviewer; team queues like engineering-team still count), all, or a GitHub login"
5355
5443
  ),
5356
- limit: z9.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
5444
+ limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
5357
5445
  },
5358
5446
  async ({ repoPath, query, queue, state, label, reviewer, limit }) => {
5359
5447
  const root = await resolveRepoRoot(repoPath);
@@ -5386,7 +5474,7 @@ async function startMcpServer() {
5386
5474
  server.tool(
5387
5475
  "get_pr_stack",
5388
5476
  "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() },
5477
+ { ref: z10.string() },
5390
5478
  async ({ ref }) => {
5391
5479
  const stack = await orch.getPrStack(ref);
5392
5480
  return mcpJson(stack);
@@ -5396,8 +5484,8 @@ async function startMcpServer() {
5396
5484
  "open_pr_stack_layers",
5397
5485
  "Materialize one worktree+thread per stack layer (or a single 1-based layer). Pass a thread ref already on the stack.",
5398
5486
  {
5399
- ref: z9.string(),
5400
- layer: z9.number().int().positive().optional()
5487
+ ref: z10.string(),
5488
+ layer: z10.number().int().positive().optional()
5401
5489
  },
5402
5490
  async ({ ref, layer }) => {
5403
5491
  const result = await orch.openPrStackLayers(ref, { layer });
@@ -5420,9 +5508,9 @@ async function startMcpServer() {
5420
5508
  "add_stack_layer",
5421
5509
  "Add a branch on top of the current stack (`gh stack add`) and open a worktree+thread for it.",
5422
5510
  {
5423
- ref: z9.string(),
5424
- branchName: z9.string(),
5425
- title: z9.string().optional()
5511
+ ref: z10.string(),
5512
+ branchName: z10.string(),
5513
+ title: z10.string().optional()
5426
5514
  },
5427
5515
  async ({ ref, branchName, title }) => {
5428
5516
  const result = await orch.addStackLayer(ref, branchName, { title });
@@ -5440,11 +5528,11 @@ async function startMcpServer() {
5440
5528
  "create_pr_stack",
5441
5529
  "Create a new GitHub PR stack with one Sideboard worktree per layer (bottom\u2192top branch names). Requires `gh extension install github/gh-stack`.",
5442
5530
  {
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()
5531
+ repoPath: z10.string(),
5532
+ branches: z10.array(z10.string()).min(1),
5533
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]),
5534
+ base: z10.string().optional(),
5535
+ title: z10.string().optional()
5448
5536
  },
5449
5537
  async (args) => {
5450
5538
  const result = await orch.createPrStack({
@@ -5472,10 +5560,10 @@ async function startMcpServer() {
5472
5560
  "list_issues",
5473
5561
  "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
5562
  {
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."),
5563
+ repoPath: z10.string(),
5564
+ query: z10.string().optional().describe("Search title, identifier, or description"),
5565
+ assignee: z10.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
5566
+ limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
5479
5567
  updatedSince: mcpIssueUpdatedSinceSchema
5480
5568
  },
5481
5569
  async ({ repoPath, query, assignee, limit, updatedSince }) => {