@sideboard-ai/core 0.1.350 → 0.1.351

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{agents-P5QIV24I.js → agents-D5CL4CR4.js} +2 -2
  2. package/dist/{agents-RGAV5OHD.js → agents-INTH7J3F.js} +2 -2
  3. package/dist/{chunk-2MESZ5XR.js → chunk-7WPQAVS5.js} +10 -10
  4. package/dist/{chunk-NDEVAA34.js → chunk-AAKQU4UZ.js} +2 -2
  5. package/dist/{chunk-MANERA6F.js → chunk-AEEOYLVK.js} +2 -2
  6. package/dist/{chunk-W5GHFT7E.js → chunk-BDWVBEKN.js} +11 -11
  7. package/dist/{chunk-ZBSEJIOV.js → chunk-C3E2DGDF.js} +2 -2
  8. package/dist/{chunk-LFSTOECH.js → chunk-HISSQICH.js} +1 -1
  9. package/dist/{chunk-EZ2MUWNW.js → chunk-SZY23KGS.js} +1 -1
  10. package/dist/{chunk-5AHWUJRT.js → chunk-UXAKH4AW.js} +2 -2
  11. package/dist/{conductor-VGCXUUG6.js → conductor-FWYWIHEW.js} +2 -2
  12. package/dist/{conductor-HVOGBK63.js → conductor-W2X7QUKZ.js} +2 -2
  13. package/dist/{coordinator-prompt-E736TJBS.js → coordinator-prompt-J57Q4Z4W.js} +1 -1
  14. package/dist/{coordinator-prompt-DPO7L2JO.js → coordinator-prompt-KIHNLENN.js} +1 -1
  15. package/dist/{global-workspace-TG2TVLUF.js → global-workspace-CGB5CY4U.js} +1 -1
  16. package/dist/{global-workspace-4RDPAOTT.js → global-workspace-WXDWFZAN.js} +1 -1
  17. package/dist/index.cjs +150 -21
  18. package/dist/index.d.cts +19 -4
  19. package/dist/index.d.ts +19 -4
  20. package/dist/index.js +156 -27
  21. package/dist/mcp/run-stdio.cjs +150 -21
  22. package/dist/mcp/run-stdio.js +153 -24
  23. package/dist/{orchestrator-QDHZ56LA.js → orchestrator-DMEE7CEW.js} +4 -4
  24. package/dist/{orchestrator-3I2FLEZL.js → orchestrator-MUD4FY7Q.js} +4 -4
  25. package/dist/{workspaces-4PA24IX6.js → workspaces-7DPHDXNY.js} +1 -1
  26. package/dist/{workspaces-6TMYV4N2.js → workspaces-ZCTF4ECL.js} +1 -1
  27. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -225,7 +225,7 @@ import {
225
225
  worktreeCleanupSettings,
226
226
  writeAgentBlock,
227
227
  writeWorktreeFile
228
- } from "./chunk-W5GHFT7E.js";
228
+ } from "./chunk-BDWVBEKN.js";
229
229
  import {
230
230
  OPTIONAL_SERVICES,
231
231
  OPTIONAL_SERVICE_IDS,
@@ -389,7 +389,7 @@ import {
389
389
  userMcpNamesToDisable,
390
390
  worktreeMcpToolNames,
391
391
  writeInjectedMcpConfig
392
- } from "./chunk-NDEVAA34.js";
392
+ } from "./chunk-AAKQU4UZ.js";
393
393
  import {
394
394
  getAgentSetupInfo,
395
395
  installAgent,
@@ -537,7 +537,7 @@ import {
537
537
  workspaceAgentChatSummaries,
538
538
  worktreeRunPortsPath,
539
539
  wrapReviewSkillMarkdown
540
- } from "./chunk-ZBSEJIOV.js";
540
+ } from "./chunk-C3E2DGDF.js";
541
541
  import {
542
542
  STDERR_EVENT_MAX_CHARS,
543
543
  STDOUT_EVENT_MAX_CHARS,
@@ -703,7 +703,7 @@ import {
703
703
  stageBuffersAsAttachments,
704
704
  syncWorkspacesFromThreads,
705
705
  takenTeamSlugsForOrchestration
706
- } from "./chunk-LFSTOECH.js";
706
+ } from "./chunk-HISSQICH.js";
707
707
  import {
708
708
  GITHUB_PR_BODY_MAX_CHARS,
709
709
  GITHUB_PR_BODY_SAFE_CHARS,
@@ -1971,6 +1971,53 @@ function buildWaterfall(rows) {
1971
1971
  )
1972
1972
  })).sort((a, b) => (a.nodes[0]?.label ?? "").localeCompare(b.nodes[0]?.label ?? ""));
1973
1973
  }
1974
+ function joinCapped(lines, max = 3) {
1975
+ if (lines.length <= max) return lines.join(". ");
1976
+ const extra = lines.length - max;
1977
+ return `${lines.slice(0, max).join(". ")}. ${extra} more`;
1978
+ }
1979
+ function planWatchCopy(chains) {
1980
+ const start = [];
1981
+ const waiting = [];
1982
+ const ready = [];
1983
+ for (const chain of chains) {
1984
+ const incoming = chain.nodes.flatMap((node) => node.incoming);
1985
+ for (const node of chain.nodes) {
1986
+ const gating = node.incoming.filter((edge) => !edge.loop);
1987
+ const blocked = gating.filter((edge) => !edge.met);
1988
+ if (blocked.length > 0) {
1989
+ const verb = blocked.some((edge2) => edge2.hold === "start") ? "start" : "merge";
1990
+ const edge = blocked.find((row2) => row2.hold === verb) ?? blocked[0];
1991
+ waiting.push(
1992
+ `${node.label} can ${verb} once ${edge.fromLabel} is ${gatePhrase(edge.gate)}`
1993
+ );
1994
+ if (verb === "merge") start.push(`${node.label} can start`);
1995
+ continue;
1996
+ }
1997
+ if (gating.length > 0) {
1998
+ const verb = gating.every((edge) => edge.hold === "merge") ? "merge" : "start";
1999
+ ready.push(`${node.label} can ${verb}`);
2000
+ continue;
2001
+ }
2002
+ const outgoing = incoming.filter((edge) => edge.fromKey === node.key && !edge.loop);
2003
+ if (outgoing.length > 0 && outgoing.every((edge) => edge.met)) continue;
2004
+ start.push(`${node.label} can start`);
2005
+ }
2006
+ }
2007
+ if (start.length === 0 && waiting.length === 0 && ready.length === 0) {
2008
+ return "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until you mark it.";
2009
+ }
2010
+ const sentences = [];
2011
+ if (start.length) sentences.push(joinCapped(start));
2012
+ if (ready.length) sentences.push(joinCapped(ready));
2013
+ if (waiting.length) {
2014
+ sentences.push(
2015
+ start.length || ready.length ? `Still waiting: ${joinCapped(waiting)}` : `Running and idle. ${joinCapped(waiting)}. A merge or a production mark is what moves the next step`
2016
+ );
2017
+ }
2018
+ const text6 = sentences.join(". ");
2019
+ return text6.endsWith(".") ? text6 : `${text6}.`;
2020
+ }
1974
2021
  function gatePhrase(gate) {
1975
2022
  return gate === "in-prod" ? "in production" : "in main";
1976
2023
  }
@@ -2111,10 +2158,72 @@ function formatOrderPlace(rows, you) {
2111
2158
  return lines.join("\n");
2112
2159
  }
2113
2160
  function executionSlice(rows) {
2114
- return {
2115
- ready: rows.filter((row2) => row2.met || row2.loop),
2116
- waiting: rows.filter((row2) => !row2.met && !row2.loop)
2161
+ const byKey = /* @__PURE__ */ new Map();
2162
+ const touch = (target, label, depth, asSubject) => {
2163
+ const key = targetKey(target);
2164
+ const found = byKey.get(key);
2165
+ if (!found) {
2166
+ byKey.set(key, {
2167
+ target,
2168
+ label,
2169
+ depth: asSubject ? depth : Number.POSITIVE_INFINITY,
2170
+ asSubject,
2171
+ incoming: [],
2172
+ outgoing: []
2173
+ });
2174
+ return;
2175
+ }
2176
+ if (asSubject || !found.asSubject) found.label = label;
2177
+ if (asSubject) {
2178
+ found.asSubject = true;
2179
+ found.depth = Math.min(found.depth, depth);
2180
+ }
2117
2181
  };
2182
+ for (const row2 of rows) {
2183
+ touch(row2.subject, row2.subjectLabel, row2.depth, true);
2184
+ touch(row2.waitsOn, row2.waitsOnLabel, row2.depth, false);
2185
+ if (row2.loop) continue;
2186
+ byKey.get(targetKey(row2.subject)).incoming.push(row2);
2187
+ byKey.get(targetKey(row2.waitsOn)).outgoing.push(row2);
2188
+ }
2189
+ const start = [];
2190
+ const waiting = [];
2191
+ const mergeHeld = [];
2192
+ const gateName = (row2) => row2.gate === "in-prod" ? "in prod" : "in main";
2193
+ const items = [...byKey.values()].sort((a, b) => {
2194
+ const depthA = Number.isFinite(a.depth) ? a.depth : 0;
2195
+ const depthB = Number.isFinite(b.depth) ? b.depth : 0;
2196
+ return depthA - depthB || a.label.localeCompare(b.label);
2197
+ });
2198
+ for (const item of items) {
2199
+ const startBlocked = item.incoming.filter((row2) => !row2.met && row2.hold === "start");
2200
+ const mergeBlocked = item.incoming.filter((row2) => !row2.met && row2.hold === "merge");
2201
+ const settled = item.outgoing.length > 0 && item.outgoing.every((row2) => row2.met) && startBlocked.length === 0 && mergeBlocked.length === 0;
2202
+ if (startBlocked.length > 0) {
2203
+ const edge = startBlocked[0];
2204
+ waiting.push({
2205
+ target: item.target,
2206
+ label: item.label,
2207
+ detail: `${edge.waitsOnLabel} must be ${gateName(edge)} before this can start`
2208
+ });
2209
+ } else if (!settled) {
2210
+ const pending = item.outgoing.find((row2) => !row2.met);
2211
+ start.push({
2212
+ target: item.target,
2213
+ label: item.label,
2214
+ detail: pending ? `Start this so it can reach ${pending.gate === "in-prod" ? "production" : "main"}` : "Start this"
2215
+ });
2216
+ }
2217
+ if (mergeBlocked.length > 0 && startBlocked.length === 0) {
2218
+ const edge = mergeBlocked[0];
2219
+ mergeHeld.push({
2220
+ target: item.target,
2221
+ label: item.label,
2222
+ detail: `Do not merge until ${edge.waitsOnLabel} is ${gateName(edge)}`
2223
+ });
2224
+ }
2225
+ }
2226
+ return { start, waiting, mergeHeld };
2118
2227
  }
2119
2228
  function orderEdgeTouches(edge, you) {
2120
2229
  return orderTargetMatches(edge.subject, you) || orderTargetMatches(edge.waitsOn, you);
@@ -2135,7 +2244,7 @@ function formatOrderText(rows, plan) {
2135
2244
  rows.forEach((row2, index) => {
2136
2245
  const gate = row2.gate === "in-prod" ? "in prod" : "in main";
2137
2246
  const hold = row2.hold === "merge" ? "merge" : "start";
2138
- const state = row2.loop ? "loop" : row2.met ? "clear" : "waiting";
2247
+ const state = row2.loop ? "loop" : row2.met ? "clear" : row2.hold === "merge" ? "merge" : "waiting";
2139
2248
  lines.push(
2140
2249
  row2.loop ? `${index + 1}. ${state} ${row2.subjectLabel} returns to ${row2.waitsOnLabel} once it is ${gate}` : `${index + 1}. ${state} ${row2.waitsOnLabel} must be ${gate} before ${row2.subjectLabel} can ${hold}`
2141
2250
  );
@@ -2143,6 +2252,17 @@ function formatOrderText(rows, plan) {
2143
2252
  if (row2.note) lines.push(` ${row2.note}`);
2144
2253
  lines.push(` id: ${row2.id.slice(0, 8)}`);
2145
2254
  });
2255
+ if (plan?.status === "active") {
2256
+ const slice = executionSlice(rows);
2257
+ const section = (title, items) => {
2258
+ if (!items.length) return;
2259
+ lines.push("", title);
2260
+ for (const item of items) lines.push(`- ${item.label}. ${item.detail}`);
2261
+ };
2262
+ section("Start now:", slice.start);
2263
+ section("Do not start:", slice.waiting);
2264
+ section("Do not merge:", slice.mergeHeld);
2265
+ }
2146
2266
  return lines.join("\n");
2147
2267
  }
2148
2268
  function escapeHtml(value) {
@@ -2175,6 +2295,15 @@ function markWorkingChains(chains, threads) {
2175
2295
  })
2176
2296
  }));
2177
2297
  }
2298
+ function waterfallBar(node, chain) {
2299
+ const gating = node.incoming.filter((edge) => !edge.loop);
2300
+ const startBlocked = gating.some((edge) => !edge.met && edge.hold === "start");
2301
+ const outgoing = chain.nodes.flatMap((other) => other.incoming).filter((edge) => edge.fromKey === node.key && !edge.loop);
2302
+ const settled = outgoing.length > 0 && outgoing.every((edge) => edge.met) && !startBlocked;
2303
+ if (startBlocked) return " waiting";
2304
+ if (settled || gating.length > 0 && gating.every((edge) => edge.met)) return " clear";
2305
+ return " start";
2306
+ }
2178
2307
  function nodeIsYou(node, you) {
2179
2308
  if (!you) return false;
2180
2309
  return orderTargetMatches(
@@ -2190,20 +2319,20 @@ function formatWaterfallHtml(chains, opts) {
2190
2319
  const plan = opts?.plan ?? null;
2191
2320
  const you = opts?.you ?? null;
2192
2321
  const title = plan?.title?.trim() || "Planner";
2193
- const status = plan ? plan.status === "active" ? "Running. Ready steps can start. Waiting steps stay held." : "Draft. Discuss this and change it. Nothing runs until you agree." : "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
2322
+ const watch2 = chains.length ? planWatchCopy(chains) : "";
2323
+ const status = plan ? plan.status === "active" ? watch2 || "Running. Start the steps that are free. Leave held steps alone." : watch2 ? `Draft. Nothing runs until you agree. ${watch2}` : "Draft. Discuss this and change it. Nothing runs until you agree." : watch2 || "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
2194
2324
  const body = chains.length === 0 ? '<p class="empty">No order yet.</p>' : chains.map((chain) => {
2195
2325
  const nodes = chain.nodes.map((node) => {
2196
- const waiting = node.incoming.some((edge) => !edge.met && !edge.loop);
2197
- const clear = node.incoming.some((edge) => !edge.loop) && !waiting;
2198
2326
  const yours = nodeIsYou(node, you);
2199
2327
  const working = node.working === true;
2200
- const state = `${waiting ? " waiting" : clear ? " clear" : ""}${yours ? " you" : ""}${working ? " current" : ""}`;
2328
+ const bar = waterfallBar(node, chain);
2329
+ const state = `${working ? " current" : ""}${bar}${yours ? " you" : ""}`;
2201
2330
  const drops = node.incoming.map((edge) => {
2202
2331
  const tone = edge.loop ? "loop" : edge.met ? "clear" : "waiting";
2203
2332
  const note = edge.note ? `<span>${escapeHtml(edge.note)}</span>` : "";
2204
2333
  return `<div class="drop"><span>After ${escapeHtml(edge.fromLabel)} is ${escapeHtml(gatePhrase(edge.gate))}, this ${escapeHtml(holdPhrase(edge.hold))}</span><span class="${tone}">${escapeHtml(edge.detail)}</span>${note}</div>`;
2205
2334
  }).join("");
2206
- const kicker = `${WATERFALL_KIND[node.kind]}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
2335
+ const kicker = `${WATERFALL_KIND[node.kind]}${bar === " start" ? " \xB7 Start" : ""}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
2207
2336
  return `<li class="node" style="margin-left:${node.depth * 28}px">${drops}<div class="bar${state}"><span class="kicker">${kicker}</span><strong>${escapeHtml(node.label)}</strong></div></li>`;
2208
2337
  }).join("");
2209
2338
  return `<ol class="chain">${nodes}</ol>`;
@@ -2226,6 +2355,7 @@ h1 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
2226
2355
  .bar { border: 1px solid #333; border-radius: 10px; padding: 10px 12px; background: #1c1c1c; display: flex; flex-direction: column; gap: 2px; }
2227
2356
  .bar.waiting { border-color: #6a5420; background: #221c10; }
2228
2357
  .bar.clear { border-color: #2d5a32; background: #142016; }
2358
+ .bar.start { border-color: #2a4a7a; background: #141c28; }
2229
2359
  .bar.you { outline: 1px solid #8ab4ff; }
2230
2360
  .bar.current { border-color: #8ab4ff; box-shadow: inset 3px 0 0 #8ab4ff; }
2231
2361
  .bar.current .kicker { color: #ececec; }
@@ -2437,7 +2567,7 @@ function executeOrderPlan(ownerThreadId) {
2437
2567
  const ids = new Set(edges.map((edge) => edge.id));
2438
2568
  const rows = resolveOrchestrationGates(file.plans, file.edges, threadSnapshots(), file.marks);
2439
2569
  const slice = executionSlice(rows.filter((row2) => ids.has(row2.id)));
2440
- return { plan, ready: slice.ready, waiting: slice.waiting };
2570
+ return { plan, start: slice.start, waiting: slice.waiting, mergeHeld: slice.mergeHeld };
2441
2571
  }
2442
2572
  function listOrderEdges() {
2443
2573
  return readFile().edges;
@@ -10126,7 +10256,7 @@ async function startHeadlessHost(opts) {
10126
10256
  };
10127
10257
  const refreshRunning = async () => {
10128
10258
  try {
10129
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
10259
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
10130
10260
  agentsRunning = getOrchestrator2().getRuntime().running;
10131
10261
  } catch {
10132
10262
  agentsRunning = 0;
@@ -12644,7 +12774,7 @@ function registerOrderTools(server) {
12644
12774
  );
12645
12775
  server.tool(
12646
12776
  "execute_plan",
12647
- "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.",
12777
+ "Mark the plan active after the user has seen it and told you to run it. Returns start (open or continue these, including the first step others wait on), waiting (hold=start is still unmet; leave them alone), and mergeHeld (work may proceed; do not merge). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
12648
12778
  {
12649
12779
  agreed: z9.literal(true).describe("True only after the user has seen the plan and told you to run it")
12650
12780
  },
@@ -12652,21 +12782,20 @@ function registerOrderTools(server) {
12652
12782
  try {
12653
12783
  const result = executeOrderPlan(orchestrationOwnerId(false));
12654
12784
  const brief = (row2) => ({
12655
- id: row2.id,
12656
- hold: row2.hold,
12657
- gate: row2.gate,
12658
- waitsOn: row2.waitsOnLabel,
12659
- subject: row2.subjectLabel,
12660
- detail: row2.detail,
12661
- ...row2.loop ? { loop: true } : {}
12785
+ kind: row2.target.kind,
12786
+ ref: row2.target.ref,
12787
+ ...row2.target.repoPath ? { repoPath: row2.target.repoPath } : {},
12788
+ label: row2.label,
12789
+ detail: row2.detail
12662
12790
  });
12663
12791
  return mcpJson({
12664
12792
  ok: true,
12665
12793
  status: result.plan.status,
12666
12794
  title: result.plan.title,
12667
- ready: result.ready.map(brief),
12795
+ start: result.start.map(brief),
12668
12796
  waiting: result.waiting.map(brief),
12669
- message: "Plan is active. Start ready steps with create_workspace or send_to_chat. Leave waiting steps alone. Merge only if the user asked."
12797
+ mergeHeld: result.mergeHeld.map(brief),
12798
+ message: "Plan is active. Start every step in start with create_workspace (kind pr or issue; pass repoPath when set) or send_to_chat (kind workspace or orchestration). create_workspace returns a checkout that already exists. Leave waiting alone. Steps in mergeHeld can proceed; do not merge them. Merge only if the user asked."
12670
12799
  });
12671
12800
  } catch (err) {
12672
12801
  return mcpJson({ error: err instanceof Error ? err.message : String(err) }, true);
@@ -12934,7 +13063,7 @@ async function handleJobStop(params, _ctx) {
12934
13063
  return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
12935
13064
  }
12936
13065
  async function defaultTurnWait(ref, timeoutMs) {
12937
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
13066
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
12938
13067
  const orch = getOrchestrator2();
12939
13068
  const thread = await orch.waitForTurn(ref, timeoutMs, {
12940
13069
  resolveIfStillRunning: true
@@ -16555,7 +16684,7 @@ async function continueSourceThread(threadId, prompt) {
16555
16684
  await continueOnReply(threadId, prompt);
16556
16685
  return;
16557
16686
  }
16558
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
16687
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
16559
16688
  await getOrchestrator2().send(threadId, prompt);
16560
16689
  } catch {
16561
16690
  }
@@ -11448,7 +11448,7 @@ var init_coordinator_prompt = __esm({
11448
11448
  '- create_workspace \u2014 create a workspace (isolated checkout + first chat) from branch | pr | ticket (appears on Home). A ticket, PR, or named branch has one checkout: a second call returns that workspace (alreadyStarted=true) and chats for every agent already on it. That is not one agent. To put another agent on that checkout, fork_chat. send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated workspace. Pass repoPath + parentChatId; omit agent and model so Sideboard applies Settings \u2192 Default agent, model & effort (never pass your own agent or agent=cursor). Pass the same tags (short labels, e.g. "phone-sync") on every workspace you open for one task so they group in the sidebar; reusing a checkout adds those tags. If the repo has a setup script, Sideboard runs it in the background (does not block send_to_chat). Nested Codex (you are Codex and the child would be Codex) can deadlock on ~/.codex locks \u2014 omit agent; Sideboard switches the child to Cursor when a CURSOR_API_KEY is set, otherwise keeps the Account default',
11449
11449
  "- One 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.",
11450
11450
  "- set_workspace_tags \u2014 set, add, or remove labels on a workspace after create. Pass any chat id on that checkout. Same tags on every workspace from one task. Worktree agents can update tags on their own checkout (they omit ref). set_wake_on_github_edges opts a workspace into CI and review-request wakes once Settings \u2192 Advanced is on. Pass a child chat id. Do not flip the Advanced switch.",
11451
- "- set_plan / show_plan / list_order / set_dependency / clear_dependency / satisfy_dependency / execute_plan \u2014 This chat owns one plan. show_plan opens it in the side column, the same way a worktree agent does. The Orchestration row in the sidebar opens that chat. Draft with set_plan (title, summary, and goal) and set_dependency. A step may loop back to an earlier step. This is a plan, not a one-way waterfall. Call show_plan after you draft or change the plan. Do not paste the diagram in chat. Do not create workspaces or send_to_chat for that work while the plan is draft. execute_plan with agreed: true only after they tell you to run it. It marks the plan active and returns ready vs waiting. Start ready steps with create_workspace or send_to_chat. Leave waiting steps alone. Merge only if they asked. Worktree agents show_plan to open the diagram and this checkout's implementation plan when plan.md exists. set_dependency / clear_dependency only for a step they are part of. A dependency says one PR, issue, or workspace must reach a gate before another can start or merge. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency (Sideboard cannot see production). 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 waitsOnKind (pr|issue|workspace), waitsOnRef, gate, subjectKind, subjectRef, hold. Pass repoPath when the same number exists in more than one project. A step can name another orchestration chat (kind orchestration, ref that chat id). That chat drafts its own plan. Each orchestration chat opens its own plan with show_plan. Worktree agents set their own checkout and omit subject. Plan mode on a workspace agent stays a separate plan for that checkout. Do not tell a child to merge or start while list_order still marks that step waiting.",
11451
+ "- set_plan / show_plan / list_order / set_dependency / clear_dependency / satisfy_dependency / execute_plan \u2014 This chat owns one plan. show_plan opens it in the side column, the same way a worktree agent does. The Orchestration row in the sidebar opens that chat. Draft with set_plan (title, summary, and goal) and set_dependency. A step may loop back to an earlier step. This is a plan, not a one-way waterfall. Call show_plan after you draft or change the plan. Do not paste the diagram in chat. Do not create workspaces or send_to_chat for that work while the plan is draft. execute_plan with agreed: true only after they tell you to run it. It marks the plan active and returns start, waiting, and mergeHeld. start includes the first step others wait on, until that step reaches its gate, and any later step whose hold is merge rather than start. Start each of those with create_workspace (kind pr or issue; pass repoPath when set) or send_to_chat (kind workspace or orchestration). create_workspace returns a checkout that already exists. Leave waiting alone. Steps in mergeHeld can proceed; do not merge them. Merge only if they asked. Worktree agents show_plan to open the diagram and this checkout's implementation plan when plan.md exists. set_dependency / clear_dependency only for a step they are part of. A dependency says one PR, issue, or workspace must reach a gate before another can start or merge. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency (Sideboard cannot see production). 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 waitsOnKind (pr|issue|workspace), waitsOnRef, gate, subjectKind, subjectRef, hold. Pass repoPath when the same number exists in more than one project. A step can name another orchestration chat (kind orchestration, ref that chat id). That chat drafts its own plan. Each orchestration chat opens its own plan with show_plan. Worktree agents set their own checkout and omit subject. Plan mode on a workspace agent stays a separate plan for that checkout. Do not start a step listed under Do not start. Do not merge a step listed under Do not merge. An edge line marked merge is a merge hold; that step can still be under Start now.",
11452
11452
  "- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
11453
11453
  "- fork_workspace \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
11454
11454
  "- fork_chat \u2014 add another agent on the SAME workspace (same files, Run, and git), or fork a Global orchestration chat into a new tab. Pass agent when it should be a different harness. Leave model unset (Auto) unless you have a reason. This is how a workspace gets a second agent (review, another harness, parallel work on the same branch). Do not create_workspace again for that. Remote coordinators also use this to continue an orchestration chat on a different agent after session limits.",
@@ -38006,6 +38006,53 @@ function buildWaterfall(rows) {
38006
38006
  )
38007
38007
  })).sort((a, b) => (a.nodes[0]?.label ?? "").localeCompare(b.nodes[0]?.label ?? ""));
38008
38008
  }
38009
+ function joinCapped(lines, max = 3) {
38010
+ if (lines.length <= max) return lines.join(". ");
38011
+ const extra = lines.length - max;
38012
+ return `${lines.slice(0, max).join(". ")}. ${extra} more`;
38013
+ }
38014
+ function planWatchCopy(chains) {
38015
+ const start = [];
38016
+ const waiting = [];
38017
+ const ready = [];
38018
+ for (const chain of chains) {
38019
+ const incoming = chain.nodes.flatMap((node) => node.incoming);
38020
+ for (const node of chain.nodes) {
38021
+ const gating = node.incoming.filter((edge) => !edge.loop);
38022
+ const blocked = gating.filter((edge) => !edge.met);
38023
+ if (blocked.length > 0) {
38024
+ const verb = blocked.some((edge2) => edge2.hold === "start") ? "start" : "merge";
38025
+ const edge = blocked.find((row) => row.hold === verb) ?? blocked[0];
38026
+ waiting.push(
38027
+ `${node.label} can ${verb} once ${edge.fromLabel} is ${gatePhrase(edge.gate)}`
38028
+ );
38029
+ if (verb === "merge") start.push(`${node.label} can start`);
38030
+ continue;
38031
+ }
38032
+ if (gating.length > 0) {
38033
+ const verb = gating.every((edge) => edge.hold === "merge") ? "merge" : "start";
38034
+ ready.push(`${node.label} can ${verb}`);
38035
+ continue;
38036
+ }
38037
+ const outgoing = incoming.filter((edge) => edge.fromKey === node.key && !edge.loop);
38038
+ if (outgoing.length > 0 && outgoing.every((edge) => edge.met)) continue;
38039
+ start.push(`${node.label} can start`);
38040
+ }
38041
+ }
38042
+ if (start.length === 0 && waiting.length === 0 && ready.length === 0) {
38043
+ return "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until you mark it.";
38044
+ }
38045
+ const sentences = [];
38046
+ if (start.length) sentences.push(joinCapped(start));
38047
+ if (ready.length) sentences.push(joinCapped(ready));
38048
+ if (waiting.length) {
38049
+ sentences.push(
38050
+ start.length || ready.length ? `Still waiting: ${joinCapped(waiting)}` : `Running and idle. ${joinCapped(waiting)}. A merge or a production mark is what moves the next step`
38051
+ );
38052
+ }
38053
+ const text8 = sentences.join(". ");
38054
+ return text8.endsWith(".") ? text8 : `${text8}.`;
38055
+ }
38009
38056
  function gatePhrase(gate) {
38010
38057
  return gate === "in-prod" ? "in production" : "in main";
38011
38058
  }
@@ -38081,10 +38128,72 @@ function formatOrderPlace(rows, you) {
38081
38128
  return lines.join("\n");
38082
38129
  }
38083
38130
  function executionSlice(rows) {
38084
- return {
38085
- ready: rows.filter((row) => row.met || row.loop),
38086
- waiting: rows.filter((row) => !row.met && !row.loop)
38131
+ const byKey = /* @__PURE__ */ new Map();
38132
+ const touch = (target, label, depth, asSubject) => {
38133
+ const key = targetKey(target);
38134
+ const found = byKey.get(key);
38135
+ if (!found) {
38136
+ byKey.set(key, {
38137
+ target,
38138
+ label,
38139
+ depth: asSubject ? depth : Number.POSITIVE_INFINITY,
38140
+ asSubject,
38141
+ incoming: [],
38142
+ outgoing: []
38143
+ });
38144
+ return;
38145
+ }
38146
+ if (asSubject || !found.asSubject) found.label = label;
38147
+ if (asSubject) {
38148
+ found.asSubject = true;
38149
+ found.depth = Math.min(found.depth, depth);
38150
+ }
38087
38151
  };
38152
+ for (const row of rows) {
38153
+ touch(row.subject, row.subjectLabel, row.depth, true);
38154
+ touch(row.waitsOn, row.waitsOnLabel, row.depth, false);
38155
+ if (row.loop) continue;
38156
+ byKey.get(targetKey(row.subject)).incoming.push(row);
38157
+ byKey.get(targetKey(row.waitsOn)).outgoing.push(row);
38158
+ }
38159
+ const start = [];
38160
+ const waiting = [];
38161
+ const mergeHeld = [];
38162
+ const gateName = (row) => row.gate === "in-prod" ? "in prod" : "in main";
38163
+ const items = [...byKey.values()].sort((a, b) => {
38164
+ const depthA = Number.isFinite(a.depth) ? a.depth : 0;
38165
+ const depthB = Number.isFinite(b.depth) ? b.depth : 0;
38166
+ return depthA - depthB || a.label.localeCompare(b.label);
38167
+ });
38168
+ for (const item of items) {
38169
+ const startBlocked = item.incoming.filter((row) => !row.met && row.hold === "start");
38170
+ const mergeBlocked = item.incoming.filter((row) => !row.met && row.hold === "merge");
38171
+ const settled = item.outgoing.length > 0 && item.outgoing.every((row) => row.met) && startBlocked.length === 0 && mergeBlocked.length === 0;
38172
+ if (startBlocked.length > 0) {
38173
+ const edge = startBlocked[0];
38174
+ waiting.push({
38175
+ target: item.target,
38176
+ label: item.label,
38177
+ detail: `${edge.waitsOnLabel} must be ${gateName(edge)} before this can start`
38178
+ });
38179
+ } else if (!settled) {
38180
+ const pending = item.outgoing.find((row) => !row.met);
38181
+ start.push({
38182
+ target: item.target,
38183
+ label: item.label,
38184
+ detail: pending ? `Start this so it can reach ${pending.gate === "in-prod" ? "production" : "main"}` : "Start this"
38185
+ });
38186
+ }
38187
+ if (mergeBlocked.length > 0 && startBlocked.length === 0) {
38188
+ const edge = mergeBlocked[0];
38189
+ mergeHeld.push({
38190
+ target: item.target,
38191
+ label: item.label,
38192
+ detail: `Do not merge until ${edge.waitsOnLabel} is ${gateName(edge)}`
38193
+ });
38194
+ }
38195
+ }
38196
+ return { start, waiting, mergeHeld };
38088
38197
  }
38089
38198
  function orderEdgeTouches(edge, you) {
38090
38199
  return orderTargetMatches(edge.subject, you) || orderTargetMatches(edge.waitsOn, you);
@@ -38105,7 +38214,7 @@ function formatOrderText(rows, plan) {
38105
38214
  rows.forEach((row, index) => {
38106
38215
  const gate = row.gate === "in-prod" ? "in prod" : "in main";
38107
38216
  const hold = row.hold === "merge" ? "merge" : "start";
38108
- const state = row.loop ? "loop" : row.met ? "clear" : "waiting";
38217
+ const state = row.loop ? "loop" : row.met ? "clear" : row.hold === "merge" ? "merge" : "waiting";
38109
38218
  lines.push(
38110
38219
  row.loop ? `${index + 1}. ${state} ${row.subjectLabel} returns to ${row.waitsOnLabel} once it is ${gate}` : `${index + 1}. ${state} ${row.waitsOnLabel} must be ${gate} before ${row.subjectLabel} can ${hold}`
38111
38220
  );
@@ -38113,6 +38222,17 @@ function formatOrderText(rows, plan) {
38113
38222
  if (row.note) lines.push(` ${row.note}`);
38114
38223
  lines.push(` id: ${row.id.slice(0, 8)}`);
38115
38224
  });
38225
+ if (plan?.status === "active") {
38226
+ const slice = executionSlice(rows);
38227
+ const section = (title, items) => {
38228
+ if (!items.length) return;
38229
+ lines.push("", title);
38230
+ for (const item of items) lines.push(`- ${item.label}. ${item.detail}`);
38231
+ };
38232
+ section("Start now:", slice.start);
38233
+ section("Do not start:", slice.waiting);
38234
+ section("Do not merge:", slice.mergeHeld);
38235
+ }
38116
38236
  return lines.join("\n");
38117
38237
  }
38118
38238
  function escapeHtml2(value) {
@@ -38145,6 +38265,15 @@ function markWorkingChains(chains, threads) {
38145
38265
  })
38146
38266
  }));
38147
38267
  }
38268
+ function waterfallBar(node, chain) {
38269
+ const gating = node.incoming.filter((edge) => !edge.loop);
38270
+ const startBlocked = gating.some((edge) => !edge.met && edge.hold === "start");
38271
+ const outgoing = chain.nodes.flatMap((other) => other.incoming).filter((edge) => edge.fromKey === node.key && !edge.loop);
38272
+ const settled = outgoing.length > 0 && outgoing.every((edge) => edge.met) && !startBlocked;
38273
+ if (startBlocked) return " waiting";
38274
+ if (settled || gating.length > 0 && gating.every((edge) => edge.met)) return " clear";
38275
+ return " start";
38276
+ }
38148
38277
  function nodeIsYou(node, you) {
38149
38278
  if (!you) return false;
38150
38279
  return orderTargetMatches(
@@ -38160,20 +38289,20 @@ function formatWaterfallHtml(chains, opts) {
38160
38289
  const plan = opts?.plan ?? null;
38161
38290
  const you = opts?.you ?? null;
38162
38291
  const title = plan?.title?.trim() || "Planner";
38163
- const status = plan ? plan.status === "active" ? "Running. Ready steps can start. Waiting steps stay held." : "Draft. Discuss this and change it. Nothing runs until you agree." : "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
38292
+ const watch = chains.length ? planWatchCopy(chains) : "";
38293
+ const status = plan ? plan.status === "active" ? watch || "Running. Start the steps that are free. Leave held steps alone." : watch ? `Draft. Nothing runs until you agree. ${watch}` : "Draft. Discuss this and change it. Nothing runs until you agree." : watch || "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
38164
38294
  const body = chains.length === 0 ? '<p class="empty">No order yet.</p>' : chains.map((chain) => {
38165
38295
  const nodes = chain.nodes.map((node) => {
38166
- const waiting = node.incoming.some((edge) => !edge.met && !edge.loop);
38167
- const clear = node.incoming.some((edge) => !edge.loop) && !waiting;
38168
38296
  const yours = nodeIsYou(node, you);
38169
38297
  const working = node.working === true;
38170
- const state = `${waiting ? " waiting" : clear ? " clear" : ""}${yours ? " you" : ""}${working ? " current" : ""}`;
38298
+ const bar = waterfallBar(node, chain);
38299
+ const state = `${working ? " current" : ""}${bar}${yours ? " you" : ""}`;
38171
38300
  const drops = node.incoming.map((edge) => {
38172
38301
  const tone = edge.loop ? "loop" : edge.met ? "clear" : "waiting";
38173
38302
  const note = edge.note ? `<span>${escapeHtml2(edge.note)}</span>` : "";
38174
38303
  return `<div class="drop"><span>After ${escapeHtml2(edge.fromLabel)} is ${escapeHtml2(gatePhrase(edge.gate))}, this ${escapeHtml2(holdPhrase(edge.hold))}</span><span class="${tone}">${escapeHtml2(edge.detail)}</span>${note}</div>`;
38175
38304
  }).join("");
38176
- const kicker = `${WATERFALL_KIND[node.kind]}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
38305
+ const kicker = `${WATERFALL_KIND[node.kind]}${bar === " start" ? " \xB7 Start" : ""}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
38177
38306
  return `<li class="node" style="margin-left:${node.depth * 28}px">${drops}<div class="bar${state}"><span class="kicker">${kicker}</span><strong>${escapeHtml2(node.label)}</strong></div></li>`;
38178
38307
  }).join("");
38179
38308
  return `<ol class="chain">${nodes}</ol>`;
@@ -38196,6 +38325,7 @@ h1 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
38196
38325
  .bar { border: 1px solid #333; border-radius: 10px; padding: 10px 12px; background: #1c1c1c; display: flex; flex-direction: column; gap: 2px; }
38197
38326
  .bar.waiting { border-color: #6a5420; background: #221c10; }
38198
38327
  .bar.clear { border-color: #2d5a32; background: #142016; }
38328
+ .bar.start { border-color: #2a4a7a; background: #141c28; }
38199
38329
  .bar.you { outline: 1px solid #8ab4ff; }
38200
38330
  .bar.current { border-color: #8ab4ff; box-shadow: inset 3px 0 0 #8ab4ff; }
38201
38331
  .bar.current .kicker { color: #ececec; }
@@ -38404,7 +38534,7 @@ function executeOrderPlan(ownerThreadId) {
38404
38534
  const ids = new Set(edges.map((edge) => edge.id));
38405
38535
  const rows = resolveOrchestrationGates(file.plans, file.edges, threadSnapshots(), file.marks);
38406
38536
  const slice = executionSlice(rows.filter((row) => ids.has(row.id)));
38407
- return { plan, ready: slice.ready, waiting: slice.waiting };
38537
+ return { plan, start: slice.start, waiting: slice.waiting, mergeHeld: slice.mergeHeld };
38408
38538
  }
38409
38539
  function threadSnapshots() {
38410
38540
  try {
@@ -38687,7 +38817,7 @@ function registerOrderTools(server) {
38687
38817
  );
38688
38818
  server.tool(
38689
38819
  "execute_plan",
38690
- "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.",
38820
+ "Mark the plan active after the user has seen it and told you to run it. Returns start (open or continue these, including the first step others wait on), waiting (hold=start is still unmet; leave them alone), and mergeHeld (work may proceed; do not merge). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
38691
38821
  {
38692
38822
  agreed: import_zod12.z.literal(true).describe("True only after the user has seen the plan and told you to run it")
38693
38823
  },
@@ -38695,21 +38825,20 @@ function registerOrderTools(server) {
38695
38825
  try {
38696
38826
  const result = executeOrderPlan(orchestrationOwnerId(false));
38697
38827
  const brief = (row) => ({
38698
- id: row.id,
38699
- hold: row.hold,
38700
- gate: row.gate,
38701
- waitsOn: row.waitsOnLabel,
38702
- subject: row.subjectLabel,
38703
- detail: row.detail,
38704
- ...row.loop ? { loop: true } : {}
38828
+ kind: row.target.kind,
38829
+ ref: row.target.ref,
38830
+ ...row.target.repoPath ? { repoPath: row.target.repoPath } : {},
38831
+ label: row.label,
38832
+ detail: row.detail
38705
38833
  });
38706
38834
  return mcpJson({
38707
38835
  ok: true,
38708
38836
  status: result.plan.status,
38709
38837
  title: result.plan.title,
38710
- ready: result.ready.map(brief),
38838
+ start: result.start.map(brief),
38711
38839
  waiting: result.waiting.map(brief),
38712
- message: "Plan is active. Start ready steps with create_workspace or send_to_chat. Leave waiting steps alone. Merge only if the user asked."
38840
+ mergeHeld: result.mergeHeld.map(brief),
38841
+ message: "Plan is active. Start every step in start with create_workspace (kind pr or issue; pass repoPath when set) or send_to_chat (kind workspace or orchestration). create_workspace returns a checkout that already exists. Leave waiting alone. Steps in mergeHeld can proceed; do not merge them. Merge only if the user asked."
38713
38842
  });
38714
38843
  } catch (err) {
38715
38844
  return mcpJson({ error: err instanceof Error ? err.message : String(err) }, true);