@sideboard-ai/core 0.1.73 → 0.1.74

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 (26) hide show
  1. package/dist/agents/cursor-runner.cjs +1 -1
  2. package/dist/agents/cursor-runner.js +1 -1
  3. package/dist/{agents-77GE7VRW.js → agents-2S2JVLZ6.js} +3 -3
  4. package/dist/{agents-GUFUYXKP.js → agents-H7M5CQY2.js} +4 -4
  5. package/dist/{chunk-POW7JCB5.js → chunk-2NKSHIRI.js} +1 -1
  6. package/dist/{chunk-WSFZPOPH.js → chunk-5KJMNNCB.js} +17 -11
  7. package/dist/{chunk-NF6Y4GTE.js → chunk-77W62MTX.js} +1 -1
  8. package/dist/{chunk-CYKPUTXN.js → chunk-DG3S2UXP.js} +1 -1
  9. package/dist/{chunk-CXT2PLO7.js → chunk-GJ2LZQJI.js} +1 -1
  10. package/dist/{chunk-V4ACEJX2.js → chunk-HCWAIEBU.js} +11 -10
  11. package/dist/{chunk-AFW3M6LU.js → chunk-KBKPVKYZ.js} +17 -11
  12. package/dist/{chunk-3WJAUKIL.js → chunk-SEOICVGB.js} +1 -1
  13. package/dist/{chunk-6RFPKZNC.js → chunk-XA2FQJTN.js} +11 -10
  14. package/dist/{coordinator-prompt-4U2QNHGT.js → coordinator-prompt-3XXSG7M2.js} +1 -1
  15. package/dist/{coordinator-prompt-ZHBDHMZB.js → coordinator-prompt-RTUCCPCI.js} +1 -1
  16. package/dist/{global-workspace-S3B6ESZS.js → global-workspace-CSIS62Z4.js} +2 -2
  17. package/dist/{global-workspace-VF56FTPY.js → global-workspace-PJU6HISJ.js} +2 -2
  18. package/dist/index.cjs +155 -32
  19. package/dist/index.d.cts +34 -3
  20. package/dist/index.d.ts +34 -3
  21. package/dist/index.js +134 -23
  22. package/dist/mcp/run-stdio.cjs +141 -32
  23. package/dist/mcp/run-stdio.js +124 -22
  24. package/dist/{workspaces-ZJ45O4CD.js → workspaces-L4TXMUNM.js} +3 -3
  25. package/dist/{workspaces-R66324S7.js → workspaces-W72KZL4B.js} +3 -3
  26. package/package.json +1 -1
@@ -209,7 +209,7 @@ function cursorSdkMessageToEvents(msg) {
209
209
  }
210
210
  if (msg.type === "usage") {
211
211
  const usage = usageFromCursor(msg.usage);
212
- if (usage) return [{ type: "usage", data: usage }];
212
+ if (usage) return [{ type: "usage", data: usage, scope: "request" }];
213
213
  }
214
214
  if (msg.type === "status" && msg.status === "ERROR") {
215
215
  const rawMessage = msg.message;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  cursorSdkMessageToEvents,
4
4
  formatUnknownDetail
5
- } from "../chunk-3WJAUKIL.js";
5
+ } from "../chunk-SEOICVGB.js";
6
6
  import {
7
7
  appDataDir
8
8
  } from "../chunk-M37RITA6.js";
@@ -32,15 +32,15 @@ import {
32
32
  resolveCursorModelId,
33
33
  resolveLoginCommand,
34
34
  resolveQuotaFallbackAgent
35
- } from "./chunk-AFW3M6LU.js";
35
+ } from "./chunk-KBKPVKYZ.js";
36
36
  import "./chunk-VROPG6QF.js";
37
37
  import {
38
38
  ORCHESTRATOR_AGENT_KINDS,
39
39
  assertOrchestratorCapableAgent,
40
40
  coerceOrchestratorAgent,
41
41
  isOrchestratorCapableAgent
42
- } from "./chunk-POW7JCB5.js";
43
- import "./chunk-6RFPKZNC.js";
42
+ } from "./chunk-2NKSHIRI.js";
43
+ import "./chunk-XA2FQJTN.js";
44
44
  import "./chunk-OE7YBB5X.js";
45
45
  import "./chunk-B3SJXYIJ.js";
46
46
  import "./chunk-7FD7COKE.js";
@@ -28,19 +28,19 @@ import {
28
28
  resolveCursorModelId,
29
29
  resolveLoginCommand,
30
30
  resolveQuotaFallbackAgent
31
- } from "./chunk-WSFZPOPH.js";
31
+ } from "./chunk-5KJMNNCB.js";
32
32
  import {
33
33
  ORCHESTRATOR_AGENT_KINDS,
34
34
  assertOrchestratorCapableAgent,
35
35
  coerceOrchestratorAgent,
36
36
  isOrchestratorCapableAgent
37
- } from "./chunk-NF6Y4GTE.js";
38
- import "./chunk-V4ACEJX2.js";
37
+ } from "./chunk-77W62MTX.js";
38
+ import "./chunk-HCWAIEBU.js";
39
39
  import "./chunk-BTL7EMGT.js";
40
40
  import {
41
41
  cursorSdkMessageToEvents,
42
42
  parseCursorRunnerLine
43
- } from "./chunk-3WJAUKIL.js";
43
+ } from "./chunk-SEOICVGB.js";
44
44
  import "./chunk-W7YOTDVO.js";
45
45
  import "./chunk-JT7R45JB.js";
46
46
  import "./chunk-MF2YMEGD.js";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-6RFPKZNC.js";
5
+ } from "./chunk-XA2FQJTN.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-NF6Y4GTE.js";
3
+ } from "./chunk-77W62MTX.js";
4
4
  import {
5
5
  applyConnectedTeamToCli,
6
6
  brightsyMcpServerName,
@@ -13,7 +13,7 @@ import {
13
13
  formatUnknownDetail,
14
14
  looksLikeAgentFailureMessage,
15
15
  parseCursorRunnerLine
16
- } from "./chunk-3WJAUKIL.js";
16
+ } from "./chunk-SEOICVGB.js";
17
17
  import {
18
18
  claudeChromeEnabled,
19
19
  loadAppSettings,
@@ -825,12 +825,14 @@ function usageFromClaude(usage) {
825
825
  if (!usage) return null;
826
826
  const inputTokens = Number(usage.input_tokens ?? 0);
827
827
  const outputTokens = Number(usage.output_tokens ?? 0);
828
- if (!inputTokens && !outputTokens) return null;
828
+ const cacheReadTokens = Number(usage.cache_read_input_tokens ?? 0);
829
+ const cacheWriteTokens = Number(usage.cache_creation_input_tokens ?? 0);
830
+ if (!inputTokens && !outputTokens && !cacheReadTokens && !cacheWriteTokens) return null;
829
831
  return {
830
832
  inputTokens,
831
833
  outputTokens,
832
- cacheReadTokens: usage.cache_read_input_tokens ? Number(usage.cache_read_input_tokens) : void 0,
833
- cacheWriteTokens: usage.cache_creation_input_tokens ? Number(usage.cache_creation_input_tokens) : void 0
834
+ cacheReadTokens: cacheReadTokens || void 0,
835
+ cacheWriteTokens: cacheWriteTokens || void 0
834
836
  };
835
837
  }
836
838
  function claudeResultErrorDetail(obj) {
@@ -947,7 +949,7 @@ var claudeAdapter = {
947
949
  );
948
950
  }
949
951
  const mode = permissionMode(thread);
950
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-S3B6ESZS.js");
952
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-CSIS62Z4.js");
951
953
  const isOrchestrator = isOrchestratorThread2(thread);
952
954
  const injectedServers = await buildInjectedMcpServers({
953
955
  includeSideboard: true,
@@ -1030,8 +1032,12 @@ var claudeAdapter = {
1030
1032
  return { type: "session_id", data: obj.session_id };
1031
1033
  }
1032
1034
  if (obj.type === "assistant" || obj.type === "user") {
1033
- const content = obj.message?.content;
1034
- const events = eventsFromContentBlocks(content);
1035
+ const message = obj.message;
1036
+ const events = eventsFromContentBlocks(message?.content);
1037
+ if (obj.type === "assistant") {
1038
+ const usage = usageFromClaude(message?.usage);
1039
+ if (usage) events.push({ type: "usage", data: usage, scope: "request" });
1040
+ }
1035
1041
  if (events.length === 0) return null;
1036
1042
  return events.length === 1 ? events[0] : events;
1037
1043
  }
@@ -1076,7 +1082,7 @@ var claudeAdapter = {
1076
1082
  if (typeof text === "string" && text) events.push({ type: "stdout", data: text });
1077
1083
  }
1078
1084
  const usage = usageFromClaude(obj.usage);
1079
- if (usage) events.push({ type: "usage", data: usage });
1085
+ if (usage) events.push({ type: "usage", data: usage, scope: "turn" });
1080
1086
  if (events.length === 0) return null;
1081
1087
  return events.length === 1 ? events[0] : events;
1082
1088
  }
@@ -1412,7 +1418,7 @@ var codexAdapter = {
1412
1418
  }
1413
1419
  if (type === "turn.completed" || type === "turn_completed") {
1414
1420
  const usage = usageFromCodex(obj.usage);
1415
- return usage ? { type: "usage", data: usage } : null;
1421
+ return usage ? { type: "usage", data: usage, scope: "turn" } : null;
1416
1422
  }
1417
1423
  if (typeof obj.content === "string" && obj.content.trim()) {
1418
1424
  return { type: "stdout", data: obj.content };
@@ -1830,7 +1836,7 @@ var opencodeAdapter = {
1830
1836
  const usage = usageFromOpencode(
1831
1837
  part?.tokens ?? obj.tokens
1832
1838
  );
1833
- return usage ? { type: "usage", data: usage } : null;
1839
+ return usage ? { type: "usage", data: usage, scope: "request" } : null;
1834
1840
  }
1835
1841
  return null;
1836
1842
  } catch {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-V4ACEJX2.js";
3
+ } from "./chunk-HCWAIEBU.js";
4
4
  import {
5
5
  resolveNewThreadOptions,
6
6
  resolveThreadDefaults
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-NF6Y4GTE.js";
3
+ } from "./chunk-77W62MTX.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-POW7JCB5.js";
5
+ } from "./chunk-2NKSHIRI.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
@@ -34,7 +34,7 @@ function coordinatorGreenfieldPlaybook(reposDir) {
34
34
  "- Examples:",
35
35
  ` - Clone: \`git clone <url> ${reposDir}/<name>\``,
36
36
  ` - New GitHub repo: \`gh repo create <owner>/<name> --private --clone -- ${reposDir}/<name>\` (or mkdir + git init + gh repo create + remote add + push)`,
37
- "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 send_to_thread (`gh pr create --draft -R <origin-owner/name>`).",
37
+ "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 ask_git create-draft (or send_to_thread `gh pr create --draft -R <origin-owner/name>`).",
38
38
  "- Always target the child worktree's **origin** (`github:` slug from list_workspaces / `git remote get-url origin` in that worktree). Never open PRs against `upstream`.",
39
39
  "- Do coding work in the child worktree thread, not by editing files in this home cwd."
40
40
  ].join("\n");
@@ -67,8 +67,9 @@ var COORDINATOR_TOOL_PLAYBOOK = [
67
67
  "Inspect / review / PRs:",
68
68
  "- get_diff \u2014 compact diff summary",
69
69
  '- request_review \u2014 open a Review chat tab on a worktree thread (attaches .sideboard/review.md when present, else local guidelines; sends "Review changes in this workspace."); then wait_for_turn / get_turn_result on the returned id',
70
- "- Ask the worktree agent via send_to_thread to open a draft PR with `gh pr create --draft -R <origin-owner/name>` (workspace `github:` slug / that worktree's origin \u2014 never upstream). Do not open PRs from the orchestrator yourself.",
71
- "Human-only (do not attempt): merge, ready-for-review land, purge_thread.",
70
+ "- ask_git \u2014 tell a worktree agent to commit & push, open a draft PR, resolve conflicts, or merge (`Merge PR.`). You only queue that prompt \u2014 the worktree agent runs git/gh (including `gh pr merge`). Then wait_for_turn. Prefer this over paraphrasing.",
71
+ '- Or send_to_thread with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Fix merge conflicts.", "Merge PR." (draft PRs: `gh pr create --draft -R <origin-owner/name>` using the workspace `github:` slug \u2014 never upstream). Never run git/gh from this orchestration cwd, and never merge the PR yourself.',
72
+ "Human-only (do not attempt): ready-for-review land (confirm_land), purge_thread.",
72
73
  "Thread links in replies: when mentioning a chat/thread for the user, include a markdown link `[Title](sideboard://thread/<id>)` using the full id (or the link field from create_thread / list_threads). Sideboard renders these as clickable opens.",
73
74
  "Bash / Read / etc: allowed for (1) inspecting target worktrees / registered repo paths from MCP, and (2) greenfield setup under ~/sideboard/repos (git clone, gh repo create, git init+remote). Never git init/clone *inside* this synthetic home cwd \u2014 emptiness here is expected, not a bug."
74
75
  ].join("\n");
@@ -97,8 +98,8 @@ function coordinatorTurnReminder(opts) {
97
98
  goal ? `- Goal / title: ${goal}` : null,
98
99
  accountDefaultsPlaybookLine(),
99
100
  `- For "what's going on": call list_threads (and list_workspaces if needed). Summarize fleet status \u2014 do not ls/git-status this synthetic home.`,
100
- "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn.",
101
- "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR.",
101
+ "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn. Land with ask_git (commit-push / create-draft / merge) on the child, then wait_for_turn \u2014 never git/gh from this cwd.",
102
+ "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft.",
102
103
  "- When naming threads for the user, link them as `[Title](sideboard://thread/<id>)`.",
103
104
  "- If they will wait on Slack or leave the Mac, call set_caffeinate enabled=true. When they say they are done / wrapping up / going to sleep, call set_caffeinate enabled=false."
104
105
  ].filter(Boolean).join("\n");
@@ -151,9 +152,9 @@ function ensureGlobalCoordinatorCwd(opts) {
151
152
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
152
153
  "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
153
154
  "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
154
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn.",
155
- "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
156
- "Always ask worktree agents to open draft PRs (`send_to_thread` + `gh pr create --draft -R <origin>`); never open PRs from the orchestrator."
155
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft \u2192 wait_for_turn \u2192 (when ready) ask_git merge \u2192 wait_for_turn.",
156
+ "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 ask_git create-draft.",
157
+ "Always ask worktree agents to commit, push, open draft PRs, and merge (`ask_git` / `send_to_thread`). The worktree agent runs git/gh; never merge from this orchestration cwd."
157
158
  ].join("\n");
158
159
  try {
159
160
  writeFileSync(join(dir, "CLAUDE.md"), `${body}
@@ -190,8 +191,8 @@ function coordinatorSystemPrompt(opts) {
190
191
  "When creating threads, pass the correct repoPath for the target workspace.",
191
192
  `YOUR orchestration thread id is ${opts.parentId} \u2014 pass parentThreadId="${opts.parentId}" on create_thread, or omit parentThreadId (Sideboard binds it). Never invent a uuid.`,
192
193
  "Omit agent/model on create_thread unless you need to override Account defaults.",
193
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 send_to_thread (ask for `gh pr create --draft -R <origin-owner/name>` using the workspace github slug) \u2192 wait_for_turn. Never target upstream. Never open PRs from the orchestrator.",
194
- "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
194
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 ask_git create-draft \u2192 wait_for_turn \u2192 (when ready) ask_git merge \u2192 wait_for_turn. Never target upstream. Never git/gh from this orchestration cwd.",
195
+ "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft.",
195
196
  `Goal: ${opts.goal}`,
196
197
  "Registered workspaces:",
197
198
  formatWorkspaceInventory(opts.workspaces)
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-VROPG6QF.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-POW7JCB5.js";
12
+ } from "./chunk-2NKSHIRI.js";
13
13
  import {
14
14
  enrichPathWithNpmGlobalBin,
15
15
  isConductorBundledCli,
@@ -885,12 +885,14 @@ function usageFromClaude(usage) {
885
885
  if (!usage) return null;
886
886
  const inputTokens = Number(usage.input_tokens ?? 0);
887
887
  const outputTokens = Number(usage.output_tokens ?? 0);
888
- if (!inputTokens && !outputTokens) return null;
888
+ const cacheReadTokens = Number(usage.cache_read_input_tokens ?? 0);
889
+ const cacheWriteTokens = Number(usage.cache_creation_input_tokens ?? 0);
890
+ if (!inputTokens && !outputTokens && !cacheReadTokens && !cacheWriteTokens) return null;
889
891
  return {
890
892
  inputTokens,
891
893
  outputTokens,
892
- cacheReadTokens: usage.cache_read_input_tokens ? Number(usage.cache_read_input_tokens) : void 0,
893
- cacheWriteTokens: usage.cache_creation_input_tokens ? Number(usage.cache_creation_input_tokens) : void 0
894
+ cacheReadTokens: cacheReadTokens || void 0,
895
+ cacheWriteTokens: cacheWriteTokens || void 0
894
896
  };
895
897
  }
896
898
  function claudeResultErrorDetail(obj) {
@@ -1007,7 +1009,7 @@ var claudeAdapter = {
1007
1009
  );
1008
1010
  }
1009
1011
  const mode = permissionMode(thread);
1010
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-VF56FTPY.js");
1012
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-PJU6HISJ.js");
1011
1013
  const isOrchestrator = isOrchestratorThread2(thread);
1012
1014
  const injectedServers = await buildInjectedMcpServers({
1013
1015
  includeSideboard: true,
@@ -1090,8 +1092,12 @@ var claudeAdapter = {
1090
1092
  return { type: "session_id", data: obj.session_id };
1091
1093
  }
1092
1094
  if (obj.type === "assistant" || obj.type === "user") {
1093
- const content = obj.message?.content;
1094
- const events = eventsFromContentBlocks(content);
1095
+ const message = obj.message;
1096
+ const events = eventsFromContentBlocks(message?.content);
1097
+ if (obj.type === "assistant") {
1098
+ const usage = usageFromClaude(message?.usage);
1099
+ if (usage) events.push({ type: "usage", data: usage, scope: "request" });
1100
+ }
1095
1101
  if (events.length === 0) return null;
1096
1102
  return events.length === 1 ? events[0] : events;
1097
1103
  }
@@ -1136,7 +1142,7 @@ var claudeAdapter = {
1136
1142
  if (typeof text === "string" && text) events.push({ type: "stdout", data: text });
1137
1143
  }
1138
1144
  const usage = usageFromClaude(obj.usage);
1139
- if (usage) events.push({ type: "usage", data: usage });
1145
+ if (usage) events.push({ type: "usage", data: usage, scope: "turn" });
1140
1146
  if (events.length === 0) return null;
1141
1147
  return events.length === 1 ? events[0] : events;
1142
1148
  }
@@ -1472,7 +1478,7 @@ var codexAdapter = {
1472
1478
  }
1473
1479
  if (type === "turn.completed" || type === "turn_completed") {
1474
1480
  const usage = usageFromCodex(obj.usage);
1475
- return usage ? { type: "usage", data: usage } : null;
1481
+ return usage ? { type: "usage", data: usage, scope: "turn" } : null;
1476
1482
  }
1477
1483
  if (typeof obj.content === "string" && obj.content.trim()) {
1478
1484
  return { type: "stdout", data: obj.content };
@@ -1676,7 +1682,7 @@ function cursorSdkMessageToEvents(msg) {
1676
1682
  }
1677
1683
  if (msg.type === "usage") {
1678
1684
  const usage = usageFromCursor(msg.usage);
1679
- if (usage) return [{ type: "usage", data: usage }];
1685
+ if (usage) return [{ type: "usage", data: usage, scope: "request" }];
1680
1686
  }
1681
1687
  if (msg.type === "status" && msg.status === "ERROR") {
1682
1688
  const rawMessage = msg.message;
@@ -2061,7 +2067,7 @@ var opencodeAdapter = {
2061
2067
  const usage = usageFromOpencode(
2062
2068
  part?.tokens ?? obj.tokens
2063
2069
  );
2064
- return usage ? { type: "usage", data: usage } : null;
2070
+ return usage ? { type: "usage", data: usage, scope: "request" } : null;
2065
2071
  }
2066
2072
  return null;
2067
2073
  } catch {
@@ -257,7 +257,7 @@ function cursorSdkMessageToEvents(msg) {
257
257
  }
258
258
  if (msg.type === "usage") {
259
259
  const usage = usageFromCursor(msg.usage);
260
- if (usage) return [{ type: "usage", data: usage }];
260
+ if (usage) return [{ type: "usage", data: usage, scope: "request" }];
261
261
  }
262
262
  if (msg.type === "status" && msg.status === "ERROR") {
263
263
  const rawMessage = msg.message;
@@ -36,7 +36,7 @@ function coordinatorGreenfieldPlaybook(reposDir) {
36
36
  "- Examples:",
37
37
  ` - Clone: \`git clone <url> ${reposDir}/<name>\``,
38
38
  ` - New GitHub repo: \`gh repo create <owner>/<name> --private --clone -- ${reposDir}/<name>\` (or mkdir + git init + gh repo create + remote add + push)`,
39
- "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 send_to_thread (`gh pr create --draft -R <origin-owner/name>`).",
39
+ "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 ask_git create-draft (or send_to_thread `gh pr create --draft -R <origin-owner/name>`).",
40
40
  "- Always target the child worktree's **origin** (`github:` slug from list_workspaces / `git remote get-url origin` in that worktree). Never open PRs against `upstream`.",
41
41
  "- Do coding work in the child worktree thread, not by editing files in this home cwd."
42
42
  ].join("\n");
@@ -69,8 +69,9 @@ var COORDINATOR_TOOL_PLAYBOOK = [
69
69
  "Inspect / review / PRs:",
70
70
  "- get_diff \u2014 compact diff summary",
71
71
  '- request_review \u2014 open a Review chat tab on a worktree thread (attaches .sideboard/review.md when present, else local guidelines; sends "Review changes in this workspace."); then wait_for_turn / get_turn_result on the returned id',
72
- "- Ask the worktree agent via send_to_thread to open a draft PR with `gh pr create --draft -R <origin-owner/name>` (workspace `github:` slug / that worktree's origin \u2014 never upstream). Do not open PRs from the orchestrator yourself.",
73
- "Human-only (do not attempt): merge, ready-for-review land, purge_thread.",
72
+ "- ask_git \u2014 tell a worktree agent to commit & push, open a draft PR, resolve conflicts, or merge (`Merge PR.`). You only queue that prompt \u2014 the worktree agent runs git/gh (including `gh pr merge`). Then wait_for_turn. Prefer this over paraphrasing.",
73
+ '- Or send_to_thread with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Fix merge conflicts.", "Merge PR." (draft PRs: `gh pr create --draft -R <origin-owner/name>` using the workspace `github:` slug \u2014 never upstream). Never run git/gh from this orchestration cwd, and never merge the PR yourself.',
74
+ "Human-only (do not attempt): ready-for-review land (confirm_land), purge_thread.",
74
75
  "Thread links in replies: when mentioning a chat/thread for the user, include a markdown link `[Title](sideboard://thread/<id>)` using the full id (or the link field from create_thread / list_threads). Sideboard renders these as clickable opens.",
75
76
  "Bash / Read / etc: allowed for (1) inspecting target worktrees / registered repo paths from MCP, and (2) greenfield setup under ~/sideboard/repos (git clone, gh repo create, git init+remote). Never git init/clone *inside* this synthetic home cwd \u2014 emptiness here is expected, not a bug."
76
77
  ].join("\n");
@@ -99,8 +100,8 @@ function coordinatorTurnReminder(opts) {
99
100
  goal ? `- Goal / title: ${goal}` : null,
100
101
  accountDefaultsPlaybookLine(),
101
102
  `- For "what's going on": call list_threads (and list_workspaces if needed). Summarize fleet status \u2014 do not ls/git-status this synthetic home.`,
102
- "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn.",
103
- "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR.",
103
+ "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn. Land with ask_git (commit-push / create-draft / merge) on the child, then wait_for_turn \u2014 never git/gh from this cwd.",
104
+ "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft.",
104
105
  "- When naming threads for the user, link them as `[Title](sideboard://thread/<id>)`.",
105
106
  "- If they will wait on Slack or leave the Mac, call set_caffeinate enabled=true. When they say they are done / wrapping up / going to sleep, call set_caffeinate enabled=false."
106
107
  ].filter(Boolean).join("\n");
@@ -153,9 +154,9 @@ function ensureGlobalCoordinatorCwd(opts) {
153
154
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
154
155
  "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
155
156
  "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
156
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn.",
157
- "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
158
- "Always ask worktree agents to open draft PRs (`send_to_thread` + `gh pr create --draft -R <origin>`); never open PRs from the orchestrator."
157
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft \u2192 wait_for_turn \u2192 (when ready) ask_git merge \u2192 wait_for_turn.",
158
+ "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 ask_git create-draft.",
159
+ "Always ask worktree agents to commit, push, open draft PRs, and merge (`ask_git` / `send_to_thread`). The worktree agent runs git/gh; never merge from this orchestration cwd."
159
160
  ].join("\n");
160
161
  try {
161
162
  writeFileSync(join(dir, "CLAUDE.md"), `${body}
@@ -192,8 +193,8 @@ function coordinatorSystemPrompt(opts) {
192
193
  "When creating threads, pass the correct repoPath for the target workspace.",
193
194
  `YOUR orchestration thread id is ${opts.parentId} \u2014 pass parentThreadId="${opts.parentId}" on create_thread, or omit parentThreadId (Sideboard binds it). Never invent a uuid.`,
194
195
  "Omit agent/model on create_thread unless you need to override Account defaults.",
195
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 send_to_thread (ask for `gh pr create --draft -R <origin-owner/name>` using the workspace github slug) \u2192 wait_for_turn. Never target upstream. Never open PRs from the orchestrator.",
196
- "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 draft PR via worktree agent.",
196
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 ask_git create-draft \u2192 wait_for_turn \u2192 (when ready) ask_git merge \u2192 wait_for_turn. Never target upstream. Never git/gh from this orchestration cwd.",
197
+ "Typical flow (new app): Bash under repos dir (clone or gh repo create) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft.",
197
198
  `Goal: ${opts.goal}`,
198
199
  "Registered workspaces:",
199
200
  formatWorkspaceInventory(opts.workspaces)
@@ -7,7 +7,7 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-V4ACEJX2.js";
10
+ } from "./chunk-HCWAIEBU.js";
11
11
  import "./chunk-W7YOTDVO.js";
12
12
  import "./chunk-JT7R45JB.js";
13
13
  import "./chunk-MF2YMEGD.js";
@@ -9,7 +9,7 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-6RFPKZNC.js";
12
+ } from "./chunk-XA2FQJTN.js";
13
13
  import "./chunk-OE7YBB5X.js";
14
14
  import "./chunk-B3SJXYIJ.js";
15
15
  import "./chunk-7FD7COKE.js";
@@ -14,8 +14,8 @@ import {
14
14
  orchestratorSessionPoisonedByBuiltins,
15
15
  slackCoordinatorSourceRef,
16
16
  takenTeamSlugsForOrchestration
17
- } from "./chunk-NF6Y4GTE.js";
18
- import "./chunk-V4ACEJX2.js";
17
+ } from "./chunk-77W62MTX.js";
18
+ import "./chunk-HCWAIEBU.js";
19
19
  import "./chunk-W7YOTDVO.js";
20
20
  import "./chunk-JT7R45JB.js";
21
21
  import "./chunk-MF2YMEGD.js";
@@ -16,8 +16,8 @@ import {
16
16
  orchestratorSessionPoisonedByBuiltins,
17
17
  slackCoordinatorSourceRef,
18
18
  takenTeamSlugsForOrchestration
19
- } from "./chunk-POW7JCB5.js";
20
- import "./chunk-6RFPKZNC.js";
19
+ } from "./chunk-2NKSHIRI.js";
20
+ import "./chunk-XA2FQJTN.js";
21
21
  import "./chunk-OE7YBB5X.js";
22
22
  import "./chunk-B3SJXYIJ.js";
23
23
  import "./chunk-7FD7COKE.js";