@sideboard-ai/core 0.1.278 → 0.1.280

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 (34) hide show
  1. package/dist/agents/cursor-runner.cjs +3 -3
  2. package/dist/agents/cursor-runner.js +5 -5
  3. package/dist/{agents-2FOWVJCN.js → agents-DYCFLDNL.js} +5 -5
  4. package/dist/{agents-JBVJRDH3.js → agents-RXP5NZBC.js} +3 -3
  5. package/dist/{chunk-FELFTNH2.js → chunk-2P75E243.js} +320 -39
  6. package/dist/{chunk-UKSJO36E.js → chunk-CPA43FBK.js} +4 -4
  7. package/dist/{chunk-SQOAFR2U.js → chunk-DK4DKQ2H.js} +329 -43
  8. package/dist/{chunk-NIB2IZ6J.js → chunk-HNNS25SG.js} +5 -5
  9. package/dist/{chunk-MGS5T2A3.js → chunk-HQXBBUQX.js} +161 -9
  10. package/dist/{chunk-FIBZEFKA.js → chunk-IFURHRAR.js} +1 -1
  11. package/dist/{chunk-5N4Q46SG.js → chunk-K2S33ZCB.js} +5 -5
  12. package/dist/{chunk-NT7RIWRR.js → chunk-RK5PIWCW.js} +3 -3
  13. package/dist/{chunk-A2G3ZBJS.js → chunk-SKSOCIJT.js} +8 -8
  14. package/dist/{chunk-QTZO4LPU.js → chunk-TZ5JHIYK.js} +8 -8
  15. package/dist/{chunk-27Z4MEQ5.js → chunk-UZUXWBXK.js} +1 -1
  16. package/dist/{chunk-FAGK33E2.js → chunk-Y7JPL4WA.js} +1 -1
  17. package/dist/{chunk-HOMZKYHF.js → chunk-YDXNCBA2.js} +107 -8
  18. package/dist/{conductor-YYQKZAND.js → conductor-J6WDOXWM.js} +3 -3
  19. package/dist/{conductor-GBCE37K4.js → conductor-OW6NAK3N.js} +4 -4
  20. package/dist/{coordinator-prompt-SFZCZ3HR.js → coordinator-prompt-ERTHREGJ.js} +1 -1
  21. package/dist/{coordinator-prompt-B3GLVXPP.js → coordinator-prompt-Z2D32HWK.js} +1 -1
  22. package/dist/{global-workspace-7XEXTIHL.js → global-workspace-5PJXO45Z.js} +1 -1
  23. package/dist/{global-workspace-N2YYJKA5.js → global-workspace-AK5PSPQ2.js} +1 -1
  24. package/dist/index.cjs +941 -542
  25. package/dist/index.d.cts +54 -17
  26. package/dist/index.d.ts +54 -17
  27. package/dist/index.js +251 -290
  28. package/dist/mcp/run-stdio.cjs +663 -345
  29. package/dist/mcp/run-stdio.js +40 -124
  30. package/dist/{orchestrator-6QJLM6Y4.js → orchestrator-K66OMTQO.js} +5 -5
  31. package/dist/{orchestrator-QMKVXVUR.js → orchestrator-XEKODYDQ.js} +7 -7
  32. package/dist/{workspaces-PBB6HY2D.js → workspaces-UP6DQ3WL.js} +1 -1
  33. package/dist/{workspaces-BJCHMGVG.js → workspaces-WU2RNLDV.js} +1 -1
  34. package/package.json +1 -1
@@ -5,13 +5,13 @@ import {
5
5
  compactSummaryPart,
6
6
  isInternalAgentStatusText,
7
7
  lastAssistantMessageText
8
- } from "./chunk-UKSJO36E.js";
8
+ } from "./chunk-CPA43FBK.js";
9
9
  import {
10
10
  isCloudCoordinatorThread,
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-QTZO4LPU.js";
14
+ } from "./chunk-TZ5JHIYK.js";
15
15
  import {
16
16
  allocateTeamName,
17
17
  mergeAgentGitAuthEnv,
@@ -676,6 +676,17 @@ function threadsSharingWorktree(worktreePath) {
676
676
  (t) => Boolean(t.worktreePath) && sameWorktreePath(t.worktreePath, key) && t.status !== "archived"
677
677
  ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
678
678
  }
679
+ function workspaceAgentChatSummaries(worktreePath) {
680
+ if (!worktreePath) return [];
681
+ return threadsSharingWorktree(worktreePath).map((t) => ({
682
+ id: t.id,
683
+ title: t.title,
684
+ agent: t.agent,
685
+ status: t.status,
686
+ link: `sideboard://chat/${t.id}`,
687
+ ...t.agentBlock?.reason ? { blockedReason: t.agentBlock.reason, blockedSource: t.agentBlock.source } : {}
688
+ }));
689
+ }
679
690
  function formatTranscriptMarkdown(title, messages) {
680
691
  const body = formatMessagesAsTranscript(messages, { tools: "full" });
681
692
  return [`# Transcript: ${title}`, "", `Forked ${(/* @__PURE__ */ new Date()).toISOString()}`, "", body].join("\n");
@@ -1166,6 +1177,78 @@ function jobTreeAlive(pid) {
1166
1177
  return jobAlive(pid) || processGroupAlive(pid);
1167
1178
  }
1168
1179
 
1180
+ // src/plan/ask-user.ts
1181
+ function planQuestionsSignature(questions) {
1182
+ return questions.map((q) => {
1183
+ const opts = q.options.map((o) => o.label).join("");
1184
+ return `${q.question}${opts}`;
1185
+ }).join("");
1186
+ }
1187
+ function asRecord(v) {
1188
+ return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
1189
+ }
1190
+ function parseOptions(raw) {
1191
+ if (!Array.isArray(raw)) return [];
1192
+ const out = [];
1193
+ for (const item of raw) {
1194
+ if (typeof item === "string" && item.trim()) {
1195
+ out.push({ label: item.trim() });
1196
+ continue;
1197
+ }
1198
+ const o = asRecord(item);
1199
+ if (!o) continue;
1200
+ const label = typeof o.label === "string" ? o.label.trim() : typeof o.text === "string" ? o.text.trim() : typeof o.title === "string" ? o.title.trim() : "";
1201
+ if (!label) continue;
1202
+ const description = typeof o.description === "string" && o.description.trim() ? o.description.trim() : void 0;
1203
+ out.push({ label, description });
1204
+ }
1205
+ return out;
1206
+ }
1207
+ function parseOneQuestion(raw) {
1208
+ const o = asRecord(raw);
1209
+ if (!o) return null;
1210
+ const question = typeof o.question === "string" ? o.question.trim() : typeof o.text === "string" ? o.text.trim() : typeof o.prompt === "string" ? o.prompt.trim() : "";
1211
+ if (!question) return null;
1212
+ const options = parseOptions(o.options);
1213
+ if (options.length < 1) return null;
1214
+ const header = typeof o.header === "string" && o.header.trim() ? o.header.trim() : void 0;
1215
+ const multiSelect = Boolean(o.multiSelect ?? o.multi_select);
1216
+ return { question, header, multiSelect, options };
1217
+ }
1218
+ function parsePlanQuestionsInput(input) {
1219
+ const root = asRecord(input);
1220
+ if (!root) return [];
1221
+ const list = Array.isArray(root.questions) ? root.questions : Array.isArray(root.question) ? root.question : root.question || root.prompt ? [root] : [];
1222
+ const out = [];
1223
+ for (const item of list) {
1224
+ const q = parseOneQuestion(item);
1225
+ if (q) out.push(q);
1226
+ }
1227
+ return out;
1228
+ }
1229
+ var ASK_USER_TOOL_RE = /^(AskUserQuestion|ask_user|mcp__sideboard__ask_user)$/i;
1230
+ function isAskUserToolName(name) {
1231
+ if (!name) return false;
1232
+ const base = name.replace(/^mcp__sideboard__/i, "");
1233
+ return ASK_USER_TOOL_RE.test(name) || /^ask_user$/i.test(base);
1234
+ }
1235
+ function extractPendingPlanQuestions(parts) {
1236
+ if (!parts?.length) return null;
1237
+ for (let i = parts.length - 1; i >= 0; i--) {
1238
+ const p = parts[i];
1239
+ if (p.type !== "tool" || !isAskUserToolName(p.name)) continue;
1240
+ const questions = parsePlanQuestionsInput(p.input);
1241
+ if (!questions.length) continue;
1242
+ return {
1243
+ id: p.id || `ask-${i}`,
1244
+ signature: planQuestionsSignature(questions),
1245
+ questions,
1246
+ source: p.name || "ask_user"
1247
+ };
1248
+ }
1249
+ return null;
1250
+ }
1251
+
1169
1252
  // src/orchestrator/task-state.ts
1170
1253
  function isIncompleteTaskState(state) {
1171
1254
  return state === "failed" || state === "canceled";
@@ -1173,13 +1256,12 @@ function isIncompleteTaskState(state) {
1173
1256
  function needsCoordinatorAction(state) {
1174
1257
  return isIncompleteTaskState(state) || state === "input-required";
1175
1258
  }
1176
- var ASK_USER_TOOL = /(^|[_.:/])ask_user$/i;
1177
1259
  function endedOnAskUser(parts) {
1178
1260
  if (!parts?.length) return false;
1179
1261
  for (let i = parts.length - 1; i >= 0; i--) {
1180
1262
  const p = parts[i];
1181
1263
  if (p.type === "tool" && !p.parentId) {
1182
- return ASK_USER_TOOL.test(p.name);
1264
+ return isAskUserToolName(p.name);
1183
1265
  }
1184
1266
  }
1185
1267
  return false;
@@ -1212,7 +1294,17 @@ var MCP_WAIT_STOPPED_HINT = "Child was stopped before the turn finished. Do not
1212
1294
  var MCP_WAIT_BROKEN_HINT = "Child worktree is broken (missing on disk). Tell the user \u2014 do not treat this as success.";
1213
1295
  var MCP_WAIT_ERROR_HINT = "Child turn failed. lastError/text is the failure \u2014 switch agent, tell the user, or retry. Do not treat empty text as success.";
1214
1296
  var MCP_WAIT_INPUT_REQUIRED_HINT = "Child asked the user a question (ask_user). taskState is input-required. Wait for the user to answer in that chat \u2014 do not send_to_chat a check-in.";
1215
- function mcpWaitTaskHint(taskState, status) {
1297
+ function mcpWaitTaskHint(taskState, status, blockedReason) {
1298
+ const why = blockedReason?.trim();
1299
+ if (why && taskState !== "failed" && taskState !== "canceled") {
1300
+ if (taskState === "submitted" || taskState === "working") {
1301
+ return `Child is blocked: ${why} It has not finished the turn. Do not send_to_chat a check-in.`;
1302
+ }
1303
+ if (taskState === "input-required") {
1304
+ return `Child is blocked: ${why} Wait for the user in that chat \u2014 do not send_to_chat a check-in.`;
1305
+ }
1306
+ return `Child is blocked: ${why} Help if this is your child; otherwise tell the user. Do not send_to_chat a check-in.`;
1307
+ }
1216
1308
  switch (taskState) {
1217
1309
  case "submitted":
1218
1310
  return MCP_WAIT_QUEUED_HINT;
@@ -1241,11 +1333,15 @@ function lastActivityAtForWait(stillRunning, liveUpdatedAt, fallbacks) {
1241
1333
  return null;
1242
1334
  }
1243
1335
  function waitForTurnToolResult(input) {
1336
+ const blockedReason = input.blockedReason?.trim() ? input.blockedReason.trim() : null;
1337
+ const waiting = Boolean(blockedReason) && !input.stillRunning && input.taskState !== "failed" && input.taskState !== "canceled";
1244
1338
  return {
1245
1339
  ...input,
1246
1340
  usage: input.usage ?? null,
1247
- hint: mcpWaitTaskHint(input.taskState, input.status),
1248
- incomplete: needsCoordinatorAction(input.taskState)
1341
+ blockedReason,
1342
+ blockedSource: blockedReason ? input.blockedSource ?? null : null,
1343
+ hint: mcpWaitTaskHint(input.taskState, input.status, blockedReason),
1344
+ incomplete: needsCoordinatorAction(input.taskState) || waiting
1249
1345
  };
1250
1346
  }
1251
1347
 
@@ -1577,7 +1673,7 @@ var PORT_RANGE_SIZE = 10;
1577
1673
  var RECLAIM_RETRY_DELAY_MS = 40;
1578
1674
  var RECLAIM_TRIES = 8;
1579
1675
  async function killReclaimable(ports, worktreePath, signal) {
1580
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-YYQKZAND.js");
1676
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-J6WDOXWM.js");
1581
1677
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1582
1678
  else killListenersOnPorts2(ports);
1583
1679
  }
@@ -2210,6 +2306,8 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
2210
2306
  }
2211
2307
 
2212
2308
  export {
2309
+ isAskUserToolName,
2310
+ extractPendingPlanQuestions,
2213
2311
  needsCoordinatorAction,
2214
2312
  deriveTaskState,
2215
2313
  mcpWaitForTurnTimeoutMs,
@@ -2227,6 +2325,7 @@ export {
2227
2325
  resolveWorktreeSetupLog,
2228
2326
  mergeWorktreeActiveRuns,
2229
2327
  threadsSharingWorktree,
2328
+ workspaceAgentChatSummaries,
2230
2329
  forkMessageSlice,
2231
2330
  buildForkTranscriptAttachment,
2232
2331
  createChatTab,
@@ -33,9 +33,9 @@ import {
33
33
  tryReservePort,
34
34
  tryReservePorts,
35
35
  worktreeRunPortsPath
36
- } from "./chunk-HOMZKYHF.js";
37
- import "./chunk-UKSJO36E.js";
38
- import "./chunk-QTZO4LPU.js";
36
+ } from "./chunk-YDXNCBA2.js";
37
+ import "./chunk-CPA43FBK.js";
38
+ import "./chunk-TZ5JHIYK.js";
39
39
  import "./chunk-K7MWJLR7.js";
40
40
  import "./chunk-N2WW62LF.js";
41
41
  import "./chunk-DD67JWTN.js";
@@ -31,13 +31,13 @@ import {
31
31
  tryReservePort,
32
32
  tryReservePorts,
33
33
  worktreeRunPortsPath
34
- } from "./chunk-MGS5T2A3.js";
35
- import "./chunk-FAGK33E2.js";
36
- import "./chunk-A2G3ZBJS.js";
34
+ } from "./chunk-HQXBBUQX.js";
35
+ import "./chunk-Y7JPL4WA.js";
36
+ import "./chunk-SKSOCIJT.js";
37
37
  import "./chunk-IPPY3FG5.js";
38
38
  import "./chunk-FWNL62VA.js";
39
39
  import "./chunk-2P4XKWV2.js";
40
- import "./chunk-5N4Q46SG.js";
40
+ import "./chunk-K2S33ZCB.js";
41
41
  import "./chunk-6K64FJDD.js";
42
42
  import "./chunk-UWQ6UCIB.js";
43
43
  import "./chunk-QVN2WOKJ.js";
@@ -9,7 +9,7 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-QTZO4LPU.js";
12
+ } from "./chunk-TZ5JHIYK.js";
13
13
  import "./chunk-K7MWJLR7.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-DD67JWTN.js";
@@ -7,7 +7,7 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-A2G3ZBJS.js";
10
+ } from "./chunk-SKSOCIJT.js";
11
11
  import "./chunk-IPPY3FG5.js";
12
12
  import "./chunk-FWNL62VA.js";
13
13
  import "./chunk-2P4XKWV2.js";
@@ -20,7 +20,7 @@ import {
20
20
  remoteCoordinatorSourceRef,
21
21
  slackCoordinatorSourceRef,
22
22
  takenTeamSlugsForOrchestration
23
- } from "./chunk-QTZO4LPU.js";
23
+ } from "./chunk-TZ5JHIYK.js";
24
24
  import "./chunk-K7MWJLR7.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-DD67JWTN.js";
@@ -18,7 +18,7 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-A2G3ZBJS.js";
21
+ } from "./chunk-SKSOCIJT.js";
22
22
  import "./chunk-IPPY3FG5.js";
23
23
  import "./chunk-FWNL62VA.js";
24
24
  import "./chunk-2P4XKWV2.js";