@sideboard-ai/core 0.1.336 → 0.1.338

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-ISEAOZD5.js → agents-4ZABRO2T.js} +2 -2
  2. package/dist/{agents-VTLFLMMT.js → agents-MM6VNDOI.js} +2 -2
  3. package/dist/{chunk-B6TPN624.js → chunk-2QN74PVY.js} +54 -13
  4. package/dist/{chunk-MGEUXR6E.js → chunk-BR3C3EX5.js} +3 -2
  5. package/dist/{chunk-EKI7D2AJ.js → chunk-JGJIR66Z.js} +75 -14
  6. package/dist/{chunk-NB4U75TJ.js → chunk-LJESHMFJ.js} +2 -2
  7. package/dist/{chunk-4O7436ZH.js → chunk-QJGAWDAX.js} +54 -13
  8. package/dist/{chunk-CDRGQ6GX.js → chunk-T76WCIQN.js} +3 -2
  9. package/dist/{chunk-PSXBOMXI.js → chunk-UPZD4SYD.js} +74 -13
  10. package/dist/{chunk-54GBJC6J.js → chunk-X3W3HBLK.js} +2 -2
  11. package/dist/{conductor-JH26KU3W.js → conductor-HKZKX2JD.js} +2 -2
  12. package/dist/{conductor-77L3QTZ2.js → conductor-OTYQMFNT.js} +2 -2
  13. package/dist/{coordinator-prompt-WVVC2TLP.js → coordinator-prompt-AHR54RWJ.js} +1 -1
  14. package/dist/{coordinator-prompt-UKJJAMBG.js → coordinator-prompt-GMGYQ5XT.js} +1 -1
  15. package/dist/{global-workspace-QDIPRW6G.js → global-workspace-TDR6OHL6.js} +1 -1
  16. package/dist/{global-workspace-B5IHENCP.js → global-workspace-WRME3OJ5.js} +1 -1
  17. package/dist/index.cjs +345 -171
  18. package/dist/index.d.cts +3 -10
  19. package/dist/index.d.ts +3 -10
  20. package/dist/index.js +207 -157
  21. package/dist/mcp/run-stdio.cjs +140 -20
  22. package/dist/mcp/run-stdio.js +4 -4
  23. package/dist/{orchestrator-ZUIU667R.js → orchestrator-CJBYJVD7.js} +4 -4
  24. package/dist/{orchestrator-BOLYQZO7.js → orchestrator-NXLV3FF4.js} +4 -4
  25. package/dist/{workspaces-VXE2MBKD.js → workspaces-7ZB6GUXB.js} +1 -1
  26. package/dist/{workspaces-WZZNNUJL.js → workspaces-XXO2T45C.js} +1 -1
  27. package/package.json +1 -1
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-54GBJC6J.js";
17
+ } from "./chunk-X3W3HBLK.js";
18
18
  import {
19
19
  applyWorktreePkgCacheEnv,
20
20
  askBlockStillWaiting,
@@ -39,6 +39,7 @@ import {
39
39
  listRunningDetachedJobs,
40
40
  maybeCompactContext,
41
41
  mergeWorktreeActiveRuns,
42
+ orchestratorPromisedLaterReport,
42
43
  parsePlanQuestionsInput,
43
44
  planJobContinue,
44
45
  planQuestionsSignature,
@@ -53,7 +54,7 @@ import {
53
54
  worktreeDevProcessKey,
54
55
  worktreeRunProcessKey,
55
56
  worktreeSetupProcessKey
56
- } from "./chunk-4O7436ZH.js";
57
+ } from "./chunk-QJGAWDAX.js";
57
58
  import {
58
59
  applyAgentEvent,
59
60
  clipAgentEventForPaint,
@@ -118,7 +119,7 @@ import {
118
119
  stageAbsolutePathsAsAttachments,
119
120
  stageBuffersAsAttachments,
120
121
  syncWorkspacesFromThreads
121
- } from "./chunk-MGEUXR6E.js";
122
+ } from "./chunk-BR3C3EX5.js";
122
123
  import {
123
124
  addPrStackLayer,
124
125
  allocateTeamSlug,
@@ -561,9 +562,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
561
562
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
562
563
  );
563
564
  }
564
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-B5IHENCP.js");
565
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-WRME3OJ5.js");
565
566
  if (isGlobalThread2(thread)) {
566
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-WVVC2TLP.js");
567
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-AHR54RWJ.js");
567
568
  ensureGlobalCoordinatorCwd2(
568
569
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
569
570
  );
@@ -2133,6 +2134,69 @@ function notifyParentOfChildHalt(child, status, send) {
2133
2134
  return true;
2134
2135
  }
2135
2136
 
2137
+ // src/orchestrator/child-report.ts
2138
+ var MAX_REPORT_WAKES = 2;
2139
+ var sentForReply = /* @__PURE__ */ new Set();
2140
+ var wakesByParent = /* @__PURE__ */ new Map();
2141
+ function clearParentReportWake(parentId) {
2142
+ wakesByParent.delete(parentId);
2143
+ const prefix = `${parentId}:`;
2144
+ for (const key of sentForReply) {
2145
+ if (key.startsWith(prefix)) sentForReply.delete(key);
2146
+ }
2147
+ }
2148
+ function parentOwesDeferredReport(parent) {
2149
+ if (!parent || parent.status === "archived") return false;
2150
+ if (!isOrchestratorThread(parent)) return false;
2151
+ if (parent.status !== "idle") return false;
2152
+ if (parent.queue.length > 0) return false;
2153
+ const last = lastAgentReply(parent.messages);
2154
+ return orchestratorPromisedLaterReport(last?.text);
2155
+ }
2156
+ function childFinishedReportPrompt(child) {
2157
+ const title = child.title?.trim() || "Untitled";
2158
+ const link = `[${title}](sideboard://chat/${child.id})`;
2159
+ return [
2160
+ `Sideboard: child worktree ${link} finished (status=idle).`,
2161
+ "You told the user you would report later. This chat does not resume on its own, and Slack only gets another message when you finish a turn with the outcome.",
2162
+ "Read get_turn_result for this child and any siblings. If any are still running (stillRunning true), loop wait_for_turn until they finish.",
2163
+ "Then reply with the outcome. Do not promise a later update.",
2164
+ "This is information \u2014 not a new user request."
2165
+ ].join("\n");
2166
+ }
2167
+ function replyKey(parent) {
2168
+ const last = lastAgentReply(parent.messages);
2169
+ if (!last) return null;
2170
+ return `${parent.id}:${last.ts}`;
2171
+ }
2172
+ function notifyParentOfChildReport(child, send) {
2173
+ if (!child.parentThreadId) return false;
2174
+ const parent = readThread(child.parentThreadId);
2175
+ if (!parentOwesDeferredReport(parent)) return false;
2176
+ const key = replyKey(parent);
2177
+ if (!key || sentForReply.has(key)) return false;
2178
+ const wakes = wakesByParent.get(parent.id) ?? 0;
2179
+ if (wakes >= MAX_REPORT_WAKES) return false;
2180
+ sentForReply.add(key);
2181
+ wakesByParent.set(parent.id, wakes + 1);
2182
+ const parentId = parent.id;
2183
+ void send(parentId, childFinishedReportPrompt(child)).catch(() => {
2184
+ sentForReply.delete(key);
2185
+ const current = wakesByParent.get(parentId) ?? 1;
2186
+ if (current <= 1) wakesByParent.delete(parentId);
2187
+ else wakesByParent.set(parentId, current - 1);
2188
+ });
2189
+ return true;
2190
+ }
2191
+ function settleChildReportAfterTurn(thread, chatText, send) {
2192
+ if (!thread) return;
2193
+ if (isOrchestratorThread(thread)) {
2194
+ if (!orchestratorPromisedLaterReport(chatText)) clearParentReportWake(thread.id);
2195
+ return;
2196
+ }
2197
+ notifyParentOfChildReport(thread, send);
2198
+ }
2199
+
2136
2200
  // src/orchestrator/stop-reason.ts
2137
2201
  var STOP_REASON_MAX = 500;
2138
2202
  function resolveStopReason(opts) {
@@ -3864,7 +3928,7 @@ async function adoptThread(input) {
3864
3928
  messages: input.messages ?? []
3865
3929
  });
3866
3930
  writeThread(thread);
3867
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-VXE2MBKD.js");
3931
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-7ZB6GUXB.js");
3868
3932
  await addWorkspace2(repoPath);
3869
3933
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-KMZQXZKP.js");
3870
3934
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6818,7 +6882,7 @@ function formatScheduledPrompt(name, prompt) {
6818
6882
  ${prompt}`;
6819
6883
  }
6820
6884
  async function defaultDeps() {
6821
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-BOLYQZO7.js");
6885
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NXLV3FF4.js");
6822
6886
  const orch = getOrchestrator2();
6823
6887
  return {
6824
6888
  findThread: (id) => findThreadByRef(id),
@@ -7484,11 +7548,7 @@ var Orchestrator = class {
7484
7548
  this.emit({ type: "queue_changed", threadId, queue: next.queue });
7485
7549
  this.haltDrain.delete(threadId);
7486
7550
  }
7487
- /**
7488
- * Worktree agent ended the turn after “I’ll let you know” (or left a
7489
- * detached test/pack job running). Queue a continue so the chat does not
7490
- * go idle with nobody watching the log.
7491
- */
7551
+ /** Queue a continue when a turn promised a later report or left a detached job running. */
7492
7552
  maybeEnqueueJobContinue(threadId, chatText, parts = []) {
7493
7553
  if (this.haltDrain.has(threadId)) return;
7494
7554
  const thread = readThread(threadId);
@@ -7885,7 +7945,7 @@ var Orchestrator = class {
7885
7945
  goal: thread.sourceRef || thread.title
7886
7946
  }),
7887
7947
  slackInbound ? [
7888
- "This turn is a Slack DM or @mention. Your reply is posted back in Slack \u2014 keep it concise. Sideboard signs it with this Mac's destination name; do not prefix the name yourself.",
7948
+ "This turn is a Slack DM or @mention. Your reply is posted back in Slack \u2014 keep it concise. Sideboard signs it with this Mac's destination name; do not prefix the name yourself. Do not end the turn by saying you will get back to them. If a child is still running, loop wait_for_turn until stillRunning is false, then reply with the outcome. If the agents are already idle, read get_turn_result and reply now. Ending the turn does not send a later Slack message.",
7889
7949
  SLACK_REPLY_FORMATTING
7890
7950
  ].join("\n") : null
7891
7951
  ].filter(Boolean).join("\n") : null;
@@ -8292,6 +8352,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8292
8352
  if (exitCode === 0) {
8293
8353
  this.crashContinued.delete(threadId);
8294
8354
  this.maybeEnqueueJobContinue(threadId, chatText, parts);
8355
+ settleChildReportAfterTurn(readThread(threadId), chatText, (id, prompt2) => this.send(id, prompt2));
8295
8356
  } else {
8296
8357
  const blob = [chatText, detail].filter(Boolean).join("\n");
8297
8358
  const failedOver = await isolateQuotaFailover(
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-5MXLDDYF.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-MGEUXR6E.js";
15
+ } from "./chunk-BR3C3EX5.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
@@ -2966,7 +2966,7 @@ var claudeAdapter = {
2966
2966
  );
2967
2967
  }
2968
2968
  const mode = permissionMode(thread);
2969
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-B5IHENCP.js");
2969
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-WRME3OJ5.js");
2970
2970
  const isOrchestrator = isOrchestratorThread2(thread);
2971
2971
  const rpc = worktreeAgentRpc(isOrchestrator);
2972
2972
  const injectedServers = await buildInjectedMcpServers({
@@ -32,9 +32,9 @@ import {
32
32
  tryReservePort,
33
33
  tryReservePorts,
34
34
  worktreeRunPortsPath
35
- } from "./chunk-B6TPN624.js";
35
+ } from "./chunk-2QN74PVY.js";
36
36
  import "./chunk-OOXRMTU6.js";
37
- import "./chunk-CDRGQ6GX.js";
37
+ import "./chunk-T76WCIQN.js";
38
38
  import "./chunk-4OVQGZEI.js";
39
39
  import "./chunk-BDQFZAE6.js";
40
40
  import "./chunk-BMRJNRQK.js";
@@ -34,9 +34,9 @@ import {
34
34
  tryReservePort,
35
35
  tryReservePorts,
36
36
  worktreeRunPortsPath
37
- } from "./chunk-4O7436ZH.js";
37
+ } from "./chunk-QJGAWDAX.js";
38
38
  import "./chunk-5MXLDDYF.js";
39
- import "./chunk-MGEUXR6E.js";
39
+ import "./chunk-BR3C3EX5.js";
40
40
  import "./chunk-ERCYQTJU.js";
41
41
  import "./chunk-N2WW62LF.js";
42
42
  import "./chunk-GK7H3SY7.js";
@@ -9,7 +9,7 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-MGEUXR6E.js";
12
+ } from "./chunk-BR3C3EX5.js";
13
13
  import "./chunk-ERCYQTJU.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-GK7H3SY7.js";
@@ -7,7 +7,7 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-CDRGQ6GX.js";
10
+ } from "./chunk-T76WCIQN.js";
11
11
  import "./chunk-4OVQGZEI.js";
12
12
  import "./chunk-BDQFZAE6.js";
13
13
  import "./chunk-BMRJNRQK.js";
@@ -18,7 +18,7 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-CDRGQ6GX.js";
21
+ } from "./chunk-T76WCIQN.js";
22
22
  import "./chunk-4OVQGZEI.js";
23
23
  import "./chunk-BDQFZAE6.js";
24
24
  import "./chunk-BMRJNRQK.js";
@@ -20,7 +20,7 @@ import {
20
20
  remoteCoordinatorSourceRef,
21
21
  slackCoordinatorSourceRef,
22
22
  takenTeamSlugsForOrchestration
23
- } from "./chunk-MGEUXR6E.js";
23
+ } from "./chunk-BR3C3EX5.js";
24
24
  import "./chunk-ERCYQTJU.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-GK7H3SY7.js";