@sideboard-ai/core 0.1.341 → 0.1.343

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 (67) hide show
  1. package/dist/{abletime-MK4T5FZY.js → abletime-MSIMJKKQ.js} +4 -4
  2. package/dist/{abletime-AYYRRDT2.js → abletime-ZIYFR4SI.js} +4 -4
  3. package/dist/{abletime-oauth-NB34M4X4.js → abletime-oauth-2RUKRZYZ.js} +3 -3
  4. package/dist/{abletime-oauth-7TOEFRWH.js → abletime-oauth-IQZ3LOB2.js} +3 -3
  5. package/dist/{abletime-rest-IF7IMJGU.js → abletime-rest-7YAO5B74.js} +3 -3
  6. package/dist/{abletime-rest-7M3QXAXY.js → abletime-rest-UBLSGMSA.js} +3 -3
  7. package/dist/{agents-4WL4U5WD.js → agents-7DCNOMFP.js} +7 -7
  8. package/dist/{agents-FH5NVVCJ.js → agents-LNZ465IM.js} +7 -7
  9. package/dist/{app-settings-377375BJ.js → app-settings-FS7TM55D.js} +9 -1
  10. package/dist/{app-settings-YTOPIRDH.js → app-settings-Q2F57NVK.js} +9 -1
  11. package/dist/{chunk-MGV6JFDY.js → chunk-2BLJ726H.js} +4 -3
  12. package/dist/{chunk-3HJ2USRA.js → chunk-3DMRQB4Y.js} +1 -1
  13. package/dist/{chunk-I5C42O2M.js → chunk-3J3XOIHF.js} +3 -3
  14. package/dist/{chunk-2IA556KV.js → chunk-4HELMBYR.js} +2 -2
  15. package/dist/{chunk-5MHENWO5.js → chunk-4PXHJA5K.js} +2 -2
  16. package/dist/{chunk-TZFYBQAD.js → chunk-4TTTEKNV.js} +2 -2
  17. package/dist/{chunk-K355SYYX.js → chunk-5BFEHSHO.js} +4 -3
  18. package/dist/{chunk-CN7GSNEL.js → chunk-5SJGR3VS.js} +1 -1
  19. package/dist/{chunk-WSW27W5R.js → chunk-5TS3KVGI.js} +1 -1
  20. package/dist/{chunk-43BOPWFV.js → chunk-6RO2AOE5.js} +2 -2
  21. package/dist/{chunk-QULOUTDQ.js → chunk-A4ZI7SA3.js} +3 -3
  22. package/dist/{chunk-NF3KRZXV.js → chunk-D7US5R4H.js} +1 -1
  23. package/dist/{chunk-4RIKHUKB.js → chunk-DEQLDEYR.js} +5 -5
  24. package/dist/{chunk-PHLFFV2M.js → chunk-EDEYEYU6.js} +159 -89
  25. package/dist/{chunk-HZRYQ27Z.js → chunk-G3UV3GXJ.js} +2 -2
  26. package/dist/{chunk-IY4YNHYD.js → chunk-GUIJMZQG.js} +1 -1
  27. package/dist/{chunk-O6UAW76V.js → chunk-JHT3CYLT.js} +1 -1
  28. package/dist/{chunk-SLTWZRBN.js → chunk-JX3OWNOT.js} +1 -1
  29. package/dist/{chunk-COFHTNQU.js → chunk-KCZM7WZ3.js} +152 -84
  30. package/dist/{chunk-5VXE4ZI4.js → chunk-LDJT3TLN.js} +7 -7
  31. package/dist/{chunk-FVX7JWFW.js → chunk-LHU6ZBFB.js} +2 -2
  32. package/dist/{chunk-ZS7AY6DS.js → chunk-NDBMDHQ5.js} +5 -5
  33. package/dist/{chunk-DF3S5X3H.js → chunk-NGIGRAZB.js} +5 -5
  34. package/dist/{chunk-47UDPUVZ.js → chunk-O2IRQAFB.js} +3 -3
  35. package/dist/{chunk-QBUX2EDG.js → chunk-RTZO2YJC.js} +2 -2
  36. package/dist/{chunk-CMYGUGGZ.js → chunk-S3DTEGMK.js} +8 -8
  37. package/dist/{chunk-DF34F3QR.js → chunk-S3UGLMGE.js} +21 -0
  38. package/dist/{chunk-4BUTF5LN.js → chunk-SLLTEMIL.js} +2 -2
  39. package/dist/{chunk-RZUZU5KD.js → chunk-TKEYXNXY.js} +21 -0
  40. package/dist/{chunk-HNIEEKKR.js → chunk-WO7VF4FG.js} +5 -5
  41. package/dist/{conductor-RGVRIOTZ.js → conductor-4SWJM5FS.js} +5 -5
  42. package/dist/{conductor-QZKG7YPO.js → conductor-Q433HU77.js} +5 -5
  43. package/dist/{coordinator-prompt-CDVIFBYS.js → coordinator-prompt-5QHWCO7V.js} +4 -4
  44. package/dist/{coordinator-prompt-66UHVADL.js → coordinator-prompt-Z7PPP45X.js} +4 -4
  45. package/dist/{global-workspace-KMQSUF2G.js → global-workspace-DL4K4K7O.js} +4 -4
  46. package/dist/{global-workspace-FNDRAJLF.js → global-workspace-VDCZMFCZ.js} +4 -4
  47. package/dist/index.cjs +193 -73
  48. package/dist/index.d.cts +18 -2
  49. package/dist/index.d.ts +18 -2
  50. package/dist/index.js +53 -26
  51. package/dist/{linear-ZJQM5IGJ.js → linear-JE4WAZ3W.js} +2 -2
  52. package/dist/{linear-6DM4FJWT.js → linear-UXMDJAD4.js} +2 -2
  53. package/dist/{linear-list-POPBU2VC.js → linear-list-I4NAOWPN.js} +1 -1
  54. package/dist/{linear-list-4EPKZTYE.js → linear-list-KDLU7QWX.js} +1 -1
  55. package/dist/mcp/run-stdio.cjs +181 -73
  56. package/dist/mcp/run-stdio.js +39 -22
  57. package/dist/{optional-cli-3G2274LT.js → optional-cli-7QXXPEN6.js} +3 -3
  58. package/dist/{optional-cli-CZF2ZFU5.js → optional-cli-RUUCLNSM.js} +4 -4
  59. package/dist/{orchestrator-BKCQUMLB.js → orchestrator-RLFBFRAG.js} +10 -10
  60. package/dist/{orchestrator-SCFWTIE7.js → orchestrator-Y5JCAJGV.js} +10 -10
  61. package/dist/{thread-store-OARQT6DL.js → thread-store-HETUMDVA.js} +2 -2
  62. package/dist/{thread-store-W2SSO6IQ.js → thread-store-ILM2ZJCB.js} +2 -2
  63. package/dist/{workspaces-6GB56LMJ.js → workspaces-EIIHHH4S.js} +4 -4
  64. package/dist/{workspaces-EWWLVSZ5.js → workspaces-MX4W4SSB.js} +4 -4
  65. package/dist/{worktree-BRKMPZMJ.js → worktree-BD3EJE24.js} +3 -3
  66. package/dist/{worktree-OB5ABI22.js → worktree-QBVLKACU.js} +3 -3
  67. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2266,6 +2266,9 @@ __export(app_settings_exports, {
2266
2266
  GITHUB_GIT_AUTH_MODES: () => GITHUB_GIT_AUTH_MODES,
2267
2267
  HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
2268
2268
  ISSUE_SOURCE_LABELS: () => ISSUE_SOURCE_LABELS,
2269
+ MAX_ORCH_THREADS_DEFAULT: () => MAX_ORCH_THREADS_DEFAULT,
2270
+ MAX_ORCH_THREADS_MAX: () => MAX_ORCH_THREADS_MAX,
2271
+ MAX_ORCH_THREADS_MIN: () => MAX_ORCH_THREADS_MIN,
2269
2272
  PROFILE_NOTES_MAX: () => PROFILE_NOTES_MAX,
2270
2273
  REVIEW_LABEL_MAX: () => REVIEW_LABEL_MAX,
2271
2274
  USAGE_ON_LIMIT_VALUES: () => USAGE_ON_LIMIT_VALUES,
@@ -2328,6 +2331,7 @@ __export(app_settings_exports, {
2328
2331
  issueSourceLabel: () => issueSourceLabel,
2329
2332
  loadAppSettings: () => loadAppSettings,
2330
2333
  maxConcurrentAgents: () => maxConcurrentAgents,
2334
+ maxOrchThreads: () => maxOrchThreads,
2331
2335
  normalizeReviewLabel: () => normalizeReviewLabel,
2332
2336
  orchestrationQuotaFallbackAgent: () => orchestrationQuotaFallbackAgent,
2333
2337
  orchestrationQuotaOnLimit: () => orchestrationQuotaOnLimit,
@@ -2790,6 +2794,9 @@ function normalizeAdvanced(raw) {
2790
2794
  if (typeof source.maxConcurrent === "number" && Number.isFinite(source.maxConcurrent)) {
2791
2795
  out.maxConcurrent = Math.max(1, Math.min(32, Math.floor(source.maxConcurrent)));
2792
2796
  }
2797
+ if (typeof source.maxOrchThreads === "number" && Number.isFinite(source.maxOrchThreads)) {
2798
+ out.maxOrchThreads = clampMaxOrchThreads(source.maxOrchThreads);
2799
+ }
2793
2800
  if (typeof source.worktreeMaxCount === "number" && Number.isFinite(source.worktreeMaxCount)) {
2794
2801
  out.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(source.worktreeMaxCount)));
2795
2802
  }
@@ -3686,6 +3693,9 @@ function updateAdvancedSettings(patch) {
3686
3693
  if (typeof patch.maxConcurrent === "number" && Number.isFinite(patch.maxConcurrent)) {
3687
3694
  advanced.maxConcurrent = Math.max(1, Math.min(32, Math.floor(patch.maxConcurrent)));
3688
3695
  }
3696
+ if (typeof patch.maxOrchThreads === "number" && Number.isFinite(patch.maxOrchThreads)) {
3697
+ advanced.maxOrchThreads = clampMaxOrchThreads(patch.maxOrchThreads);
3698
+ }
3689
3699
  if (typeof patch.worktreeMaxCount === "number" && Number.isFinite(patch.worktreeMaxCount)) {
3690
3700
  advanced.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(patch.worktreeMaxCount)));
3691
3701
  }
@@ -3822,6 +3832,14 @@ function maxConcurrentAgents(settings = loadAppSettings()) {
3822
3832
  }
3823
3833
  return 5;
3824
3834
  }
3835
+ function clampMaxOrchThreads(n) {
3836
+ return Math.max(MAX_ORCH_THREADS_MIN, Math.min(MAX_ORCH_THREADS_MAX, Math.floor(n)));
3837
+ }
3838
+ function maxOrchThreads(settings = loadAppSettings()) {
3839
+ const n = settings.advanced.maxOrchThreads;
3840
+ if (typeof n === "number" && Number.isFinite(n)) return clampMaxOrchThreads(n);
3841
+ return MAX_ORCH_THREADS_DEFAULT;
3842
+ }
3825
3843
  function resolveClaudeExecutable(settings = loadAppSettings()) {
3826
3844
  return resolveAgentExecutable("claude", settings);
3827
3845
  }
@@ -3902,7 +3920,7 @@ function childEnvWithAppSettings(extra) {
3902
3920
  function harnessEnvKey(harness) {
3903
3921
  return HARNESS_ENV_KEYS[harness];
3904
3922
  }
3905
- var import_node_crypto3, import_node_fs9, import_node_os4, import_node_path11, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, DEFAULT_CLI_BIN;
3923
+ var import_node_crypto3, import_node_fs9, import_node_os4, import_node_path11, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, MAX_ORCH_THREADS_DEFAULT, MAX_ORCH_THREADS_MIN, MAX_ORCH_THREADS_MAX, DEFAULT_CLI_BIN;
3906
3924
  var init_app_settings = __esm({
3907
3925
  "src/store/app-settings.ts"() {
3908
3926
  "use strict";
@@ -3999,6 +4017,9 @@ var init_app_settings = __esm({
3999
4017
  };
4000
4018
  CONFIRM_ACCOUNT = "Show the user the proposed account context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
4001
4019
  CONFIRM_PROJECT = "Show the user the proposed project context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
4020
+ MAX_ORCH_THREADS_DEFAULT = 5;
4021
+ MAX_ORCH_THREADS_MIN = 1;
4022
+ MAX_ORCH_THREADS_MAX = 32;
4002
4023
  DEFAULT_CLI_BIN = {
4003
4024
  claude: "claude",
4004
4025
  codex: "codex",
@@ -13307,6 +13328,7 @@ var init_coordinator_prompt = __esm({
13307
13328
  "- add_project / remove_project \u2014 register or unregister a git repo",
13308
13329
  "Workspaces and chats:",
13309
13330
  '- 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',
13331
+ "- 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.",
13310
13332
  "- 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.",
13311
13333
  "- 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.",
13312
13334
  "- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
@@ -31392,54 +31414,6 @@ var init_expand = __esm({
31392
31414
  }
31393
31415
  });
31394
31416
 
31395
- // src/composer/agent-has-replied.ts
31396
- function joinSteerPrompt(base, addition) {
31397
- const next = addition.trim();
31398
- if (!next) return base;
31399
- const head = base.replace(/\s+$/, "");
31400
- if (!head) return next;
31401
- return `${head}
31402
- ${next}`;
31403
- }
31404
- function messagesWithRewrittenUserPrompt(messages, from, to) {
31405
- if (from === to) return null;
31406
- const next = messages.slice();
31407
- for (let i = next.length - 1; i >= 0; i--) {
31408
- const message = next[i];
31409
- if (!message || message.origin === "continue" || message.role === "summary") continue;
31410
- if (message.role !== "user") continue;
31411
- if (message.text !== from) return null;
31412
- next[i] = { ...message, text: to };
31413
- return next;
31414
- }
31415
- return null;
31416
- }
31417
- function trailingUnansweredUserText(messages) {
31418
- for (let i = messages.length - 1; i >= 0; i--) {
31419
- const message = messages[i];
31420
- if (!message || message.origin === "continue" || message.role === "summary") continue;
31421
- if (message.role === "agent") {
31422
- const text7 = (message.text ?? "").trim();
31423
- if (text7 || (message.parts?.length ?? 0) > 0) return null;
31424
- continue;
31425
- }
31426
- if (message.role === "user") return message.text;
31427
- }
31428
- return null;
31429
- }
31430
- function livePartsShowAgentReply(parts) {
31431
- for (const part of parts) {
31432
- if (part.type === "tool") return true;
31433
- if ((part.type === "text" || part.type === "thinking") && part.text.trim()) return true;
31434
- }
31435
- return false;
31436
- }
31437
- var init_agent_has_replied = __esm({
31438
- "src/composer/agent-has-replied.ts"() {
31439
- "use strict";
31440
- }
31441
- });
31442
-
31443
31417
  // src/composer/consume-attachments.ts
31444
31418
  function consumeComposerAttachments(thread) {
31445
31419
  return {
@@ -31450,6 +31424,22 @@ function consumeComposerAttachments(thread) {
31450
31424
  function takePendingTurnAttachments(thread) {
31451
31425
  return [...thread.pendingTurnAttachments ?? []];
31452
31426
  }
31427
+ function mergeTurnAttachments(base, extra) {
31428
+ const next = [];
31429
+ const seen = /* @__PURE__ */ new Set();
31430
+ for (const att of [...base ?? [], ...extra ?? []]) {
31431
+ if (seen.has(att.id)) continue;
31432
+ seen.add(att.id);
31433
+ next.push(att);
31434
+ }
31435
+ return next;
31436
+ }
31437
+ function sameTurnAttachments(a, b) {
31438
+ const left = a ?? [];
31439
+ const right = b ?? [];
31440
+ if (left.length !== right.length) return false;
31441
+ return left.every((att, i) => att.id === right[i]?.id);
31442
+ }
31453
31443
  function alignQueueAttachments(queueLength, existing) {
31454
31444
  const next = (existing ?? []).slice(0, queueLength).map((slot) => [...slot ?? []]);
31455
31445
  while (next.length < queueLength) next.push([]);
@@ -31497,15 +31487,101 @@ var init_consume_attachments = __esm({
31497
31487
  }
31498
31488
  });
31499
31489
 
31490
+ // src/composer/agent-has-replied.ts
31491
+ function joinSteerPrompt(base, addition) {
31492
+ const next = addition.trim();
31493
+ if (!next) return base;
31494
+ const head = base.replace(/\s+$/, "");
31495
+ if (!head) return next;
31496
+ return `${head}
31497
+ ${next}`;
31498
+ }
31499
+ function messagesWithRewrittenUserPrompt(messages, from, to, attachments) {
31500
+ const extra = attachments ?? [];
31501
+ if (from === to && extra.length === 0) return null;
31502
+ const next = messages.slice();
31503
+ for (let i = next.length - 1; i >= 0; i--) {
31504
+ const message = next[i];
31505
+ if (!message || message.origin === "continue" || message.role === "summary") continue;
31506
+ if (message.role !== "user") continue;
31507
+ if (message.text !== from) return null;
31508
+ const merged = mergeTurnAttachments(message.attachments, extra);
31509
+ if (from === to && merged.length === (message.attachments?.length ?? 0)) return null;
31510
+ next[i] = {
31511
+ ...message,
31512
+ text: to,
31513
+ ...merged.length > 0 ? { attachments: merged } : {}
31514
+ };
31515
+ return next;
31516
+ }
31517
+ return null;
31518
+ }
31519
+ function trailingUnansweredUserText(messages) {
31520
+ for (let i = messages.length - 1; i >= 0; i--) {
31521
+ const message = messages[i];
31522
+ if (!message || message.origin === "continue" || message.role === "summary") continue;
31523
+ if (message.role === "agent") {
31524
+ const text7 = (message.text ?? "").trim();
31525
+ if (text7 || (message.parts?.length ?? 0) > 0) return null;
31526
+ continue;
31527
+ }
31528
+ if (message.role === "user") return message.text;
31529
+ }
31530
+ return null;
31531
+ }
31532
+ function livePartsShowAgentReply(parts) {
31533
+ for (const part of parts) {
31534
+ if (part.type === "tool") return true;
31535
+ if ((part.type === "text" || part.type === "thinking") && part.text.trim()) return true;
31536
+ }
31537
+ return false;
31538
+ }
31539
+ var init_agent_has_replied = __esm({
31540
+ "src/composer/agent-has-replied.ts"() {
31541
+ "use strict";
31542
+ init_consume_attachments();
31543
+ }
31544
+ });
31545
+
31500
31546
  // src/orchestrator/enqueue-thread-send.ts
31501
31547
  function resolveSendFollowUp(thread, requested) {
31502
31548
  if (requested === "steer" || requested === "queue") return requested;
31503
31549
  return isOrchestratorThread(thread) ? followUpBehavior() : "queue";
31504
31550
  }
31505
- function rewriteTrailingUserPrompt(threadId, from, to) {
31551
+ function beginOpenSteerDraft(text7) {
31552
+ return { text: text7, spawned: false, attachments: [] };
31553
+ }
31554
+ function seedOpenSteerAttachments(draft, sent) {
31555
+ if (!draft) return [...sent ?? []];
31556
+ draft.attachments = mergeTurnAttachments(sent, draft.attachments);
31557
+ return draft.attachments ?? [];
31558
+ }
31559
+ function openSteerTurnAttachments(draft, fallback, autoContinue) {
31560
+ if (autoContinue) return [];
31561
+ return [...draft?.attachments ?? fallback];
31562
+ }
31563
+ function promptAfterJoinedSteer(input) {
31564
+ if (input.draft) input.draft.spawned = true;
31565
+ return promptForJoinedSteer({
31566
+ threadId: input.threadId,
31567
+ promptText: input.promptText,
31568
+ latestPrompt: input.draft?.text ?? input.promptText,
31569
+ agentPrompt: input.agentPrompt,
31570
+ expandedPrompt: input.expandedPrompt,
31571
+ worktreePath: input.worktreePath,
31572
+ attachments: input.expandedAttachments,
31573
+ latestAttachments: openSteerTurnAttachments(
31574
+ input.draft,
31575
+ input.expandedAttachments,
31576
+ input.autoContinue
31577
+ ),
31578
+ gitForge: input.gitForge
31579
+ });
31580
+ }
31581
+ function rewriteTrailingUserPrompt(threadId, from, to, attachments) {
31506
31582
  const thread = readThread(threadId);
31507
31583
  if (!thread) return;
31508
- const messages = messagesWithRewrittenUserPrompt(thread.messages, from, to);
31584
+ const messages = messagesWithRewrittenUserPrompt(thread.messages, from, to, attachments);
31509
31585
  if (!messages) return;
31510
31586
  updateThread(threadId, { messages });
31511
31587
  }
@@ -31520,12 +31596,18 @@ function reuseJoinedUserBubble(reused, threadId, messages, promptText) {
31520
31596
  return false;
31521
31597
  }
31522
31598
  function promptForJoinedSteer(input) {
31523
- if (input.latestPrompt === input.promptText) return input.agentPrompt;
31524
- rewriteTrailingUserPrompt(input.threadId, input.promptText, input.latestPrompt);
31599
+ const latestAttachments = input.latestAttachments ?? input.attachments;
31600
+ const textSame = input.latestPrompt === input.promptText;
31601
+ if (textSame && sameTurnAttachments(input.attachments, latestAttachments)) {
31602
+ return input.agentPrompt;
31603
+ }
31604
+ if (!textSame) {
31605
+ rewriteTrailingUserPrompt(input.threadId, input.promptText, input.latestPrompt);
31606
+ }
31525
31607
  const { agentPrompt: expandedLatest } = expandComposerPrompt(
31526
31608
  input.worktreePath,
31527
31609
  expandCanonicalGitRequest(input.latestPrompt, { forge: input.gitForge }),
31528
- { attachments: input.attachments }
31610
+ { attachments: latestAttachments }
31529
31611
  );
31530
31612
  return input.expandedPrompt && input.agentPrompt.endsWith(input.expandedPrompt) ? input.agentPrompt.slice(0, -input.expandedPrompt.length) + expandedLatest : `${input.agentPrompt}
31531
31613
 
@@ -31561,7 +31643,13 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
31561
31643
  const combined = joinSteerPrompt(unanswered, prompt);
31562
31644
  if (draft && !draft.spawned) {
31563
31645
  draft.text = combined;
31564
- rewriteTrailingUserPrompt(current.id, unanswered, combined);
31646
+ if (consumed.consumed.length > 0) {
31647
+ draft.attachments = mergeTurnAttachments(draft.attachments, consumed.consumed);
31648
+ }
31649
+ rewriteTrailingUserPrompt(current.id, unanswered, combined, consumed.consumed);
31650
+ if (explicit === void 0 && consumed.consumed.length > 0) {
31651
+ updateThread(current.id, { attachments: consumed.attachments });
31652
+ }
31565
31653
  } else {
31566
31654
  const queue = current.queue.slice();
31567
31655
  queue[0] = combined;
@@ -31583,8 +31671,13 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
31583
31671
  }
31584
31672
  const promptToQueue = unanswered != null ? joinSteerPrompt(unanswered, prompt) : prompt;
31585
31673
  if (unanswered != null) {
31586
- if (draft) draft.text = promptToQueue;
31587
- rewriteTrailingUserPrompt(current.id, unanswered, promptToQueue);
31674
+ if (draft) {
31675
+ draft.text = promptToQueue;
31676
+ if (consumed.consumed.length > 0) {
31677
+ draft.attachments = mergeTurnAttachments(draft.attachments, consumed.consumed);
31678
+ }
31679
+ }
31680
+ rewriteTrailingUserPrompt(current.id, unanswered, promptToQueue, consumed.consumed);
31588
31681
  host.reusedUserPrompt.add(current.id);
31589
31682
  }
31590
31683
  const queued = appendQueuedItem(
@@ -34561,10 +34654,7 @@ var init_orchestrator = __esm({
34561
34654
  this.emit({ type: "status_changed", threadId, status: "running" });
34562
34655
  this.emit({ type: "turn_started", threadId, prompt });
34563
34656
  try {
34564
- this.openSteerPrompt.set(threadId, {
34565
- text: typeof prompt === "string" ? prompt : "",
34566
- spawned: false
34567
- });
34657
+ this.openSteerPrompt.set(threadId, beginOpenSteerDraft(typeof prompt === "string" ? prompt : ""));
34568
34658
  try {
34569
34659
  const baseline = await captureTurnBaseline(thread.worktreePath);
34570
34660
  if (baseline) this.turnBaselines.set(threadId, baseline);
@@ -34594,13 +34684,14 @@ var init_orchestrator = __esm({
34594
34684
  const autoContinue = isJobContinuePrompt(promptText) || promptText.startsWith("The previous agent process ended before it finished.");
34595
34685
  const parked = takePendingTurnAttachments(thread);
34596
34686
  const sentAttachments = !autoContinue && parked.length > 0 ? parked : void 0;
34687
+ const turnAttachments = seedOpenSteerAttachments(this.openSteerPrompt.get(threadId), sentAttachments);
34597
34688
  if (!autoContinue) clearAgentBlock(threadId);
34598
34689
  const shown = this.requireThread(threadId).messages;
34599
34690
  if (!reuseJoinedUserBubble(this.reusedUserPrompt, threadId, shown, promptText)) {
34600
34691
  appendMessage(threadId, {
34601
34692
  role: "user",
34602
34693
  text: promptText,
34603
- ...sentAttachments ? { attachments: sentAttachments } : {},
34694
+ ...turnAttachments.length > 0 ? { attachments: turnAttachments } : {},
34604
34695
  ...autoContinue ? { origin: "continue" } : {},
34605
34696
  ts: (/* @__PURE__ */ new Date()).toISOString()
34606
34697
  });
@@ -34630,11 +34721,12 @@ var init_orchestrator = __esm({
34630
34721
  thread = this.requireThread(threadId);
34631
34722
  const turnOrigin = thread.worktreePath?.trim() ? await resolveOriginRemote(thread.worktreePath).catch(() => null) : null;
34632
34723
  const gitPrompt = expandCanonicalGitRequest(promptText, { forge: turnOrigin?.forge });
34724
+ const expandedAttachments = openSteerTurnAttachments(this.openSteerPrompt.get(threadId), turnAttachments, autoContinue);
34633
34725
  const { agentPrompt: expandedPrompt } = expandComposerPrompt(
34634
34726
  thread.worktreePath,
34635
34727
  gitPrompt,
34636
34728
  {
34637
- attachments: autoContinue ? [] : sentAttachments ?? []
34729
+ attachments: expandedAttachments
34638
34730
  }
34639
34731
  );
34640
34732
  const slackInbound = /^(Slack DM|Slack @mention)(?:\n|$)/.test(
@@ -34802,16 +34894,15 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
34802
34894
  ].filter(Boolean).join("\n\n---\n\n");
34803
34895
  const stderrTail = [];
34804
34896
  traceTurn("runTurn.beforeSpawn", { threadId, agent: fresh.agent });
34805
- const steerDraft = this.openSteerPrompt.get(threadId);
34806
- if (steerDraft) steerDraft.spawned = true;
34807
- const promptForAgent = promptForJoinedSteer({
34897
+ const promptForAgent = promptAfterJoinedSteer({
34898
+ draft: this.openSteerPrompt.get(threadId),
34899
+ autoContinue,
34900
+ expandedAttachments,
34808
34901
  threadId,
34809
34902
  promptText,
34810
- latestPrompt: steerDraft?.text ?? promptText,
34811
34903
  agentPrompt,
34812
34904
  expandedPrompt,
34813
34905
  worktreePath: fresh.worktreePath,
34814
- attachments: autoContinue ? [] : sentAttachments ?? [],
34815
34906
  gitForge: turnOrigin?.forge
34816
34907
  });
34817
34908
  const handle = await spawnAgentTurn(
@@ -36742,6 +36833,9 @@ __export(index_exports, {
36742
36833
  LONG_RUNNING_SKILL_COMMAND: () => LONG_RUNNING_SKILL_COMMAND,
36743
36834
  LinearOAuthCancelledError: () => LinearOAuthCancelledError,
36744
36835
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS: () => MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
36836
+ MAX_ORCH_THREADS_DEFAULT: () => MAX_ORCH_THREADS_DEFAULT,
36837
+ MAX_ORCH_THREADS_MAX: () => MAX_ORCH_THREADS_MAX,
36838
+ MAX_ORCH_THREADS_MIN: () => MAX_ORCH_THREADS_MIN,
36745
36839
  OPTIONAL_SERVICES: () => OPTIONAL_SERVICES,
36746
36840
  OPTIONAL_SERVICE_IDS: () => OPTIONAL_SERVICE_IDS,
36747
36841
  ORCHESTRATOR_AGENT_KINDS: () => ORCHESTRATOR_AGENT_KINDS,
@@ -37408,6 +37502,7 @@ __export(index_exports, {
37408
37502
  markPrReady: () => markPrReady,
37409
37503
  materializeSystemCaBundle: () => materializeSystemCaBundle,
37410
37504
  maxConcurrentAgents: () => maxConcurrentAgents,
37505
+ maxOrchThreads: () => maxOrchThreads,
37411
37506
  maybeCompactContext: () => maybeCompactContext,
37412
37507
  mcpAllowTools: () => mcpAllowTools,
37413
37508
  mcpAllowToolsFromNames: () => mcpAllowToolsFromNames,
@@ -37423,6 +37518,7 @@ __export(index_exports, {
37423
37518
  mergeSetupOutput: () => mergeSetupOutput,
37424
37519
  mergeSideboardIntoMcpServersJson: () => mergeSideboardIntoMcpServersJson,
37425
37520
  mergeSlackClientIds: () => mergeSlackClientIds,
37521
+ mergeTurnAttachments: () => mergeTurnAttachments,
37426
37522
  mergeUsage: () => mergeUsage,
37427
37523
  messagePartParentId: () => messagePartParentId,
37428
37524
  messagesForCompactArchive: () => messagesForCompactArchive,
@@ -37630,6 +37726,7 @@ __export(index_exports, {
37630
37726
  runSlackListen: () => runSlackListen,
37631
37727
  runSlackRelayClient: () => runSlackRelayClient,
37632
37728
  runWorkspaceSetup: () => runWorkspaceSetup,
37729
+ sameTurnAttachments: () => sameTurnAttachments,
37633
37730
  sameWorkspacePath: () => sameWorkspacePath,
37634
37731
  sameWorktreePath: () => sameWorktreePath,
37635
37732
  sanitizeGitBranchPrefix: () => sanitizeGitBranchPrefix,
@@ -47075,6 +47172,8 @@ init_workspace_tags();
47075
47172
  // src/mcp/create-orch-child.ts
47076
47173
  init_chat_tabs();
47077
47174
  init_worktree_labels();
47175
+ init_app_settings();
47176
+ init_global_workspace();
47078
47177
 
47079
47178
  // src/mcp/create-thread-agent.ts
47080
47179
  init_cursor();
@@ -47123,8 +47222,22 @@ function orchCreateThreadAgentNote(input) {
47123
47222
  }
47124
47223
 
47125
47224
  // src/mcp/create-orch-child.ts
47126
- var MAX_ORCH_THREADS = 5;
47127
47225
  var CREATE_THREAD_TIMEOUT_MS = 9e4;
47226
+ function orchChildWorkspaceCount(threads, parentId) {
47227
+ const seen = /* @__PURE__ */ new Set();
47228
+ let unpathed = 0;
47229
+ for (const thread of threads) {
47230
+ if (thread.parentThreadId !== parentId) continue;
47231
+ if (isOrchestratorThread(thread)) continue;
47232
+ const raw = thread.worktreePath?.trim();
47233
+ if (!raw) {
47234
+ unpathed += 1;
47235
+ continue;
47236
+ }
47237
+ seen.add(normalizeWorktreePath(raw));
47238
+ }
47239
+ return seen.size + unpathed;
47240
+ }
47128
47241
  function withTimeout2(promise, ms, label) {
47129
47242
  return new Promise((resolve3, reject) => {
47130
47243
  const timer2 = setTimeout(() => {
@@ -47162,11 +47275,12 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
47162
47275
  parent = null;
47163
47276
  }
47164
47277
  if (parentId) {
47165
- const children = orch.getThreads(false).filter((t) => t.parentThreadId === parentId);
47166
- if (children.length >= MAX_ORCH_THREADS) {
47278
+ const cap = maxOrchThreads();
47279
+ const used = orchChildWorkspaceCount(orch.getThreads(false), parentId);
47280
+ if (used >= cap) {
47167
47281
  return {
47168
47282
  ok: false,
47169
- text: `Thread-creation cap (${MAX_ORCH_THREADS}) reached for this orchestration session`
47283
+ text: `Workspace cap (${cap}) reached for this orchestration session. Raise it in Settings \u2192 Advanced \u2192 Max orchestration threads.`
47170
47284
  };
47171
47285
  }
47172
47286
  }
@@ -50166,7 +50280,7 @@ async function startMcpServer() {
50166
50280
  );
50167
50281
  server.tool(
50168
50282
  "create_workspace",
50169
- `Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags.`,
50283
+ `Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags. Each orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.`,
50170
50284
  {
50171
50285
  sourceType: import_zod12.z.enum(["branch", "pr", "ticket"]),
50172
50286
  sourceRef: import_zod12.z.string(),
@@ -53211,6 +53325,9 @@ async function pollSlackOutboundWatches(opts) {
53211
53325
  LONG_RUNNING_SKILL_COMMAND,
53212
53326
  LinearOAuthCancelledError,
53213
53327
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
53328
+ MAX_ORCH_THREADS_DEFAULT,
53329
+ MAX_ORCH_THREADS_MAX,
53330
+ MAX_ORCH_THREADS_MIN,
53214
53331
  OPTIONAL_SERVICES,
53215
53332
  OPTIONAL_SERVICE_IDS,
53216
53333
  ORCHESTRATOR_AGENT_KINDS,
@@ -53877,6 +53994,7 @@ async function pollSlackOutboundWatches(opts) {
53877
53994
  markPrReady,
53878
53995
  materializeSystemCaBundle,
53879
53996
  maxConcurrentAgents,
53997
+ maxOrchThreads,
53880
53998
  maybeCompactContext,
53881
53999
  mcpAllowTools,
53882
54000
  mcpAllowToolsFromNames,
@@ -53892,6 +54010,7 @@ async function pollSlackOutboundWatches(opts) {
53892
54010
  mergeSetupOutput,
53893
54011
  mergeSideboardIntoMcpServersJson,
53894
54012
  mergeSlackClientIds,
54013
+ mergeTurnAttachments,
53895
54014
  mergeUsage,
53896
54015
  messagePartParentId,
53897
54016
  messagesForCompactArchive,
@@ -54099,6 +54218,7 @@ async function pollSlackOutboundWatches(opts) {
54099
54218
  runSlackListen,
54100
54219
  runSlackRelayClient,
54101
54220
  runWorkspaceSetup,
54221
+ sameTurnAttachments,
54102
54222
  sameWorkspacePath,
54103
54223
  sameWorktreePath,
54104
54224
  sanitizeGitBranchPrefix,