@sideboard-ai/core 0.1.199 → 0.1.201

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 (39) hide show
  1. package/dist/{abletime-3CSCNAXU.js → abletime-345SE3B4.js} +2 -2
  2. package/dist/{abletime-H74RNIKV.js → abletime-KGPD3UUJ.js} +2 -2
  3. package/dist/{agents-BOYOK56K.js → agents-HB6N3XJL.js} +7 -5
  4. package/dist/{agents-AVH44CBS.js → agents-KFAGRM46.js} +7 -5
  5. package/dist/{app-settings-MMPLJHWF.js → app-settings-AXCURTZJ.js} +9 -1
  6. package/dist/{app-settings-FMTDH5RD.js → app-settings-V6IHESEQ.js} +9 -1
  7. package/dist/{chunk-DU2ICKLA.js → chunk-3TOGAUQT.js} +23 -9
  8. package/dist/{chunk-S4EEYOSU.js → chunk-54RSAMBH.js} +3 -3
  9. package/dist/{chunk-CA7PWMQ7.js → chunk-7AHAABKN.js} +1 -1
  10. package/dist/{chunk-PPVN3APP.js → chunk-AHPIU2VP.js} +113 -64
  11. package/dist/{chunk-2IQ6W47G.js → chunk-CXFW5LIH.js} +40 -3
  12. package/dist/{chunk-KJBYIIJU.js → chunk-DFUES6QU.js} +5 -0
  13. package/dist/{chunk-CTABTALL.js → chunk-EXZMNINM.js} +60 -43
  14. package/dist/{chunk-CJFBSQIB.js → chunk-INNLWYXW.js} +5 -0
  15. package/dist/{chunk-HQKGK4KO.js → chunk-ISV5IFH3.js} +40 -3
  16. package/dist/{chunk-BLOKJY4U.js → chunk-LJHC62LZ.js} +3 -3
  17. package/dist/{chunk-PTAMHXBT.js → chunk-PGQGP4FD.js} +1 -1
  18. package/dist/{chunk-QFABSE3Q.js → chunk-RPX6VDW7.js} +2 -2
  19. package/dist/{chunk-KI4YI72Y.js → chunk-RV3ZKE4Y.js} +45 -31
  20. package/dist/{chunk-DU4ID3DA.js → chunk-STPZQR5B.js} +2 -2
  21. package/dist/{coordinator-prompt-ROWPLVQ3.js → coordinator-prompt-BH4EHFOO.js} +4 -4
  22. package/dist/{coordinator-prompt-LB3GA3U4.js → coordinator-prompt-TY5FHAXC.js} +4 -4
  23. package/dist/{global-workspace-V2A4YKZ6.js → global-workspace-5AZEEQRU.js} +4 -4
  24. package/dist/{global-workspace-C5XKWCRH.js → global-workspace-NLLAPQJI.js} +4 -4
  25. package/dist/index.cjs +13458 -13261
  26. package/dist/index.d.cts +54 -14
  27. package/dist/index.d.ts +54 -14
  28. package/dist/index.js +93 -9
  29. package/dist/mcp/run-stdio.cjs +92 -24
  30. package/dist/mcp/run-stdio.js +9 -9
  31. package/dist/{orchestrator-AJGDZEAS.js → orchestrator-47JZUHRC.js} +6 -6
  32. package/dist/{orchestrator-NCGYNVYN.js → orchestrator-SWWQQFFD.js} +6 -6
  33. package/dist/{thread-store-M4B52FUS.js → thread-store-2SS5V5CN.js} +3 -1
  34. package/dist/{thread-store-CO77HV2K.js → thread-store-ZGVWPVHP.js} +3 -1
  35. package/dist/{workspaces-WIRJQ6HA.js → workspaces-PEWYWVHZ.js} +4 -4
  36. package/dist/{workspaces-GWEKIS3B.js → workspaces-RP76JH3J.js} +4 -4
  37. package/dist/{worktree-QA4J75FI.js → worktree-72TZWUSH.js} +3 -3
  38. package/dist/{worktree-UI5WJC3A.js → worktree-ZQEUKSNE.js} +3 -3
  39. package/package.json +1 -1
@@ -16,6 +16,7 @@ import {
16
16
  isInternalAgentStatusText,
17
17
  isPollWrapperToolName,
18
18
  isSessionQuotaLimit,
19
+ lastAssistantMessageText,
19
20
  liveActivitySummary,
20
21
  normalizeParseResult,
21
22
  parseBrightsyCliLine,
@@ -25,7 +26,7 @@ import {
25
26
  stripBrightsyNdjsonNoise,
26
27
  sumUsageList,
27
28
  toolDescription
28
- } from "./chunk-KI4YI72Y.js";
29
+ } from "./chunk-RV3ZKE4Y.js";
29
30
  import {
30
31
  SLACK_REPLY_FORMATTING,
31
32
  addWorkspace,
@@ -48,7 +49,7 @@ import {
48
49
  stageAbsolutePathsAsAttachments,
49
50
  stageBuffersAsAttachments,
50
51
  syncWorkspacesFromThreads
51
- } from "./chunk-BLOKJY4U.js";
52
+ } from "./chunk-LJHC62LZ.js";
52
53
  import {
53
54
  addPrStackLayer,
54
55
  allocateTeamName,
@@ -98,7 +99,7 @@ import {
98
99
  worktreeDisplayLabelForGroup,
99
100
  worktreeNameFromPath,
100
101
  worktreeSlugForTicket
101
- } from "./chunk-DU4ID3DA.js";
102
+ } from "./chunk-STPZQR5B.js";
102
103
  import {
103
104
  ATTACHMENTS_DIR,
104
105
  DETACHED_JOBS_DIR,
@@ -144,7 +145,6 @@ import {
144
145
  isSecureFileEncrypted,
145
146
  loadAppSettings,
146
147
  orchestrationQuotaFallbackAgent,
147
- orchestrationQuotaOnLimit,
148
148
  readSecureJson,
149
149
  resolveEffectiveIssueSource,
150
150
  resolveNewThreadOptions,
@@ -153,8 +153,9 @@ import {
153
153
  resolveViewerProfileForRepo,
154
154
  saveAppSettings,
155
155
  updateAdvancedSettings,
156
+ usageOnLimit,
156
157
  writeSecureJson
157
- } from "./chunk-2IQ6W47G.js";
158
+ } from "./chunk-CXFW5LIH.js";
158
159
  import {
159
160
  stripNestedElectronEnv
160
161
  } from "./chunk-4TR3HZFT.js";
@@ -179,7 +180,7 @@ import {
179
180
  updateThread,
180
181
  withThreadLock,
181
182
  writeThread
182
- } from "./chunk-KJBYIIJU.js";
183
+ } from "./chunk-DFUES6QU.js";
183
184
  import {
184
185
  appDataDir,
185
186
  findConventionSetup,
@@ -473,7 +474,7 @@ async function continueSourceThread(threadId, prompt) {
473
474
  await continueOnReply(threadId, prompt);
474
475
  return;
475
476
  }
476
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-NCGYNVYN.js");
477
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-SWWQQFFD.js");
477
478
  await getOrchestrator2().send(threadId, prompt);
478
479
  } catch {
479
480
  }
@@ -807,9 +808,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
807
808
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
808
809
  );
809
810
  }
810
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-V2A4YKZ6.js");
811
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-5AZEEQRU.js");
811
812
  if (isGlobalThread2(thread)) {
812
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-LB3GA3U4.js");
813
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-TY5FHAXC.js");
813
814
  ensureGlobalCoordinatorCwd2(
814
815
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
815
816
  );
@@ -3543,6 +3544,35 @@ function visiblePage(items, shown) {
3543
3544
  hidden: Math.max(0, items.length - n)
3544
3545
  };
3545
3546
  }
3547
+ function markdownPreviewSource(text, max = 480) {
3548
+ const trimmed = text.trim();
3549
+ if (trimmed.length <= max) return trimmed;
3550
+ const slice = trimmed.slice(0, max);
3551
+ const nl = slice.lastIndexOf("\n");
3552
+ if (nl > 40) return slice.slice(0, nl);
3553
+ const sp = slice.lastIndexOf(" ");
3554
+ return sp > 40 ? slice.slice(0, sp) : slice;
3555
+ }
3556
+ function latestVisibleMessageText(messages, liveParts) {
3557
+ const live = lastAssistantMessageText(liveParts);
3558
+ if (live) return live;
3559
+ if (!messages?.length) return "";
3560
+ for (let i = messages.length - 1; i >= 0; i--) {
3561
+ const m = messages[i];
3562
+ if (!m) continue;
3563
+ if (m.role === "agent") {
3564
+ const fromParts = lastAssistantMessageText(m.parts);
3565
+ const text = (fromParts || m.text || "").trim();
3566
+ if (text && !isInternalAgentStatusText(text)) return text;
3567
+ continue;
3568
+ }
3569
+ if (m.role === "user") {
3570
+ const text = m.text?.trim();
3571
+ if (text) return text;
3572
+ }
3573
+ }
3574
+ return "";
3575
+ }
3546
3576
  function emptyColumns() {
3547
3577
  return {
3548
3578
  backlog: [],
@@ -3728,7 +3758,7 @@ async function createThread(input, _onSetupLine) {
3728
3758
  });
3729
3759
  await requireAgent(resolved.agent);
3730
3760
  if (input.cowboy) {
3731
- const { cowboyModeEnabled } = await import("./app-settings-MMPLJHWF.js");
3761
+ const { cowboyModeEnabled } = await import("./app-settings-AXCURTZJ.js");
3732
3762
  if (!cowboyModeEnabled()) {
3733
3763
  throw new Error(
3734
3764
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3786,7 +3816,7 @@ async function createThread(input, _onSetupLine) {
3786
3816
  let sourceIsFork = false;
3787
3817
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3788
3818
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3789
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-3CSCNAXU.js");
3819
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-345SE3B4.js");
3790
3820
  const task = await ensureAbleTimeTask({
3791
3821
  title: title?.trim() || "Untitled work",
3792
3822
  description: input.prompt?.trim() || void 0
@@ -3888,7 +3918,7 @@ async function createThread(input, _onSetupLine) {
3888
3918
  return readThread(thread.id) ?? thread;
3889
3919
  }
3890
3920
  async function listLinearIssues(agent, repoPath) {
3891
- const { getAdapter: getAdapter2 } = await import("./agents-AVH44CBS.js");
3921
+ const { getAdapter: getAdapter2 } = await import("./agents-KFAGRM46.js");
3892
3922
  await requireAgent(agent, { requireLinear: true });
3893
3923
  const adapter = getAdapter2(agent);
3894
3924
  if (!adapter.listLinearIssues) {
@@ -4110,12 +4140,18 @@ async function forkThreadWorktree(input, onSetupLine) {
4110
4140
  // src/orchestrator/quota-failover.ts
4111
4141
  import { randomUUID as randomUUID3 } from "crypto";
4112
4142
  function planOrchestrationQuotaFailover(thread, limitText, opts) {
4113
- if (!isOrchestratorThread(thread)) return null;
4114
4143
  if (!isSessionQuotaLimit(limitText)) return null;
4115
- const onLimit = opts?.onLimit ?? orchestrationQuotaOnLimit();
4144
+ const onLimit = opts?.onLimit ?? usageOnLimit();
4116
4145
  const resumeAt = parseSessionQuotaResetAt(limitText, opts?.now);
4146
+ if (onLimit === "keep_going" || onLimit === "confirm") {
4147
+ return {
4148
+ action: "none",
4149
+ reason: onLimit === "confirm" ? "Settings: confirm with user; no automatic continue." : "Settings: keep going; no automatic continue.",
4150
+ limitText
4151
+ };
4152
+ }
4117
4153
  if (thread.quotaContinuedFromId) {
4118
- if (resumeAt) {
4154
+ if (onLimit === "switch_agent" && resumeAt) {
4119
4155
  return {
4120
4156
  action: "wait_reset",
4121
4157
  reason: "Already continued once; waiting for quota reset instead.",
@@ -4125,7 +4161,7 @@ function planOrchestrationQuotaFailover(thread, limitText, opts) {
4125
4161
  }
4126
4162
  return {
4127
4163
  action: "none",
4128
- reason: "Already continued once; no parseable reset time.",
4164
+ reason: "Already continued once; no further automatic continue.",
4129
4165
  limitText
4130
4166
  };
4131
4167
  }
@@ -4162,8 +4198,19 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
4162
4198
  const text = m.text.trim().replace(/\s+/g, " ").slice(0, 280);
4163
4199
  return text ? `- ${role}: ${text}` : null;
4164
4200
  }).filter(Boolean);
4201
+ const orch = isOrchestratorThread(from);
4202
+ const instructions = orch ? [
4203
+ "- Continue fleet orchestration from this handoff.",
4204
+ "- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.",
4205
+ "- Leave model Auto unless there is a specific reason to pin one.",
4206
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4207
+ ] : [
4208
+ "- Continue this worktree chat from the handoff.",
4209
+ "- Leave model Auto unless there is a specific reason to pin one.",
4210
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4211
+ ];
4165
4212
  const body = [
4166
- `# Orchestration handoff`,
4213
+ `# ${orch ? "Orchestration" : "Chat"} handoff`,
4167
4214
  "",
4168
4215
  `Previous chat: ${from.title} (\`${from.id}\`) on **${from.agent}** hit a session/usage limit.`,
4169
4216
  `Limit: ${limitText.trim()}`,
@@ -4179,23 +4226,20 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
4179
4226
  recent.length ? recent.join("\n") : "(none)",
4180
4227
  "",
4181
4228
  `## Instructions`,
4182
- `- Continue fleet orchestration from this handoff.`,
4183
- `- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.`,
4184
- `- Leave model Auto unless there is a specific reason to pin one.`,
4185
- `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4229
+ ...instructions
4186
4230
  ].join("\n");
4187
4231
  return {
4188
4232
  id: randomUUID3(),
4189
- name: "Orchestration quota handoff.md",
4233
+ name: orch ? "Orchestration quota handoff.md" : "Quota handoff.md",
4190
4234
  kind: "transcript",
4191
4235
  content: body
4192
4236
  };
4193
4237
  }
4194
4238
  var QUOTA_CONTINUE_PROMPT = (fromAgent, fallback) => [
4195
- `${fromAgent} hit a session/usage limit. Continue this orchestration on ${fallback} using the attached handoff.`,
4196
- "Call list_board or list_threads for live fleet status, then proceed with the goal. Leave model Auto unless needed."
4239
+ `${fromAgent} hit a session/usage limit. Continue this chat on ${fallback} using the attached handoff.`,
4240
+ "Proceed with the goal. Leave model Auto unless needed."
4197
4241
  ].join(" ");
4198
- var QUOTA_RESUME_PROMPT = "Session/usage limit window should have reset. Continue the orchestration from where you left off. Use list_board or list_threads for fleet status.";
4242
+ var QUOTA_RESUME_PROMPT = "Session/usage limit window should have reset. Continue this chat from where you left off.";
4199
4243
  function createQuotaFailoverChat(from, fallbackAgent, limitText) {
4200
4244
  const handoff = buildQuotaHandoffAttachment(from, limitText, fallbackAgent);
4201
4245
  const tab = createChatTab({
@@ -4204,12 +4248,15 @@ function createQuotaFailoverChat(from, fallbackAgent, limitText) {
4204
4248
  model: null,
4205
4249
  attachments: [handoff]
4206
4250
  });
4207
- return updateThread(tab.id, {
4208
- parentThreadId: from.id,
4251
+ const patch = {
4209
4252
  quotaContinuedFromId: from.id,
4210
- sourceRef: from.sourceRef,
4211
- sourceType: "orchestration"
4212
- });
4253
+ sourceRef: from.sourceRef
4254
+ };
4255
+ if (isOrchestratorThread(from)) {
4256
+ patch.parentThreadId = from.id;
4257
+ patch.sourceType = "orchestration";
4258
+ }
4259
+ return updateThread(tab.id, patch);
4213
4260
  }
4214
4261
 
4215
4262
  // src/threads/adopt.ts
@@ -4310,7 +4357,7 @@ async function adoptThread(input) {
4310
4357
  messages: input.messages ?? []
4311
4358
  });
4312
4359
  writeThread(thread);
4313
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-GWEKIS3B.js");
4360
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-RP76JH3J.js");
4314
4361
  await ensureWorkspace2(repoPath);
4315
4362
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
4316
4363
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6894,7 +6941,7 @@ function formatScheduledPrompt(name, prompt) {
6894
6941
  ${prompt}`;
6895
6942
  }
6896
6943
  async function defaultDeps() {
6897
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NCGYNVYN.js");
6944
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-SWWQQFFD.js");
6898
6945
  const orch = getOrchestrator2();
6899
6946
  return {
6900
6947
  findThread: (id) => findThreadByRef(id),
@@ -7169,7 +7216,7 @@ var Orchestrator = class {
7169
7216
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7170
7217
  });
7171
7218
  }
7172
- const { autoCleanupOrphansEnabled } = await import("./app-settings-MMPLJHWF.js");
7219
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-AXCURTZJ.js");
7173
7220
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7174
7221
  await cleanupOrphanWorktrees({ repoPaths });
7175
7222
  }
@@ -7280,8 +7327,8 @@ var Orchestrator = class {
7280
7327
  await this.send(threadId, QUOTA_RESUME_PROMPT);
7281
7328
  }
7282
7329
  /**
7283
- * Host-side continue when an orchestration chat hits a provider session/usage
7284
- * limit (not context size): switch agent (Auto) or wait until reset.
7330
+ * Host-side continue when any chat hits a provider session/usage limit
7331
+ * (not context size): switch agent (Auto) or wait until reset.
7285
7332
  */
7286
7333
  async maybeHandleOrchestrationQuotaFailover(threadId, limitText) {
7287
7334
  const thread = findThreadByRef(threadId);
@@ -7294,7 +7341,7 @@ var Orchestrator = class {
7294
7341
  setStatus(threadId, "idle", null);
7295
7342
  appendMessage(threadId, {
7296
7343
  role: "agent",
7297
- text: `Sideboard will auto-retry this orchestration around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
7344
+ text: `Sideboard will auto-retry this chat around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
7298
7345
  ts: (/* @__PURE__ */ new Date()).toISOString()
7299
7346
  });
7300
7347
  this.emit({
@@ -7448,7 +7495,7 @@ var Orchestrator = class {
7448
7495
  }
7449
7496
  await setup;
7450
7497
  if (skipSetup) return;
7451
- const { autoRunAfterSetupEnabled } = await import("./app-settings-MMPLJHWF.js");
7498
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-AXCURTZJ.js");
7452
7499
  if (autoRunAfterSetupEnabled()) {
7453
7500
  try {
7454
7501
  await this.startDev(threadId);
@@ -7772,7 +7819,7 @@ var Orchestrator = class {
7772
7819
  }
7773
7820
  const isBrightsy = fresh.agent === "brightsy";
7774
7821
  const isOrchestration = isOrchestratorThread(fresh);
7775
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-MMPLJHWF.js");
7822
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-AXCURTZJ.js");
7776
7823
  const gitAuthMode = getGithubGitAuthMode();
7777
7824
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7778
7825
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -8757,7 +8804,7 @@ var Orchestrator = class {
8757
8804
  updateThread(thread.id, { title: meta.title });
8758
8805
  }
8759
8806
  }
8760
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-MMPLJHWF.js");
8807
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-AXCURTZJ.js");
8761
8808
  const latest = this.requireThread(thread.id);
8762
8809
  if (!shouldAutoArchiveOnPrMerge({
8763
8810
  previousPrState: prevState || null,
@@ -9049,7 +9096,7 @@ var Orchestrator = class {
9049
9096
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
9050
9097
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
9051
9098
  try {
9052
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-GWEKIS3B.js");
9099
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-RP76JH3J.js");
9053
9100
  await ensureWorkspace2(thread.repoPath);
9054
9101
  } catch {
9055
9102
  }
@@ -9076,7 +9123,7 @@ var Orchestrator = class {
9076
9123
  await runArchiveScript(thread.repoPath, thread.worktreePath);
9077
9124
  } catch {
9078
9125
  }
9079
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-MMPLJHWF.js");
9126
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-AXCURTZJ.js");
9080
9127
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
9081
9128
  await removeWorktree(thread.repoPath, thread.worktreePath, {
9082
9129
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -9103,7 +9150,7 @@ var Orchestrator = class {
9103
9150
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
9104
9151
  );
9105
9152
  }
9106
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-QA4J75FI.js");
9153
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-72TZWUSH.js");
9107
9154
  const slug = thread.worktreePath.split("/").pop();
9108
9155
  const dest = thread.worktreePath;
9109
9156
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9213,7 +9260,7 @@ async function startOrchestration(opts) {
9213
9260
  sourceRef: "default",
9214
9261
  ...createOpts
9215
9262
  }).catch(async () => {
9216
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-QA4J75FI.js");
9263
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-72TZWUSH.js");
9217
9264
  const repo = await resolveRepoRoot2(repoPath);
9218
9265
  const def = await resolveDefaultBranch2(repo);
9219
9266
  return orch.createThread({
@@ -9223,7 +9270,7 @@ async function startOrchestration(opts) {
9223
9270
  repoPath: repo
9224
9271
  });
9225
9272
  });
9226
- const { updateThread: upd } = await import("./thread-store-M4B52FUS.js");
9273
+ const { updateThread: upd } = await import("./thread-store-2SS5V5CN.js");
9227
9274
  const updated = upd(thread.id, {
9228
9275
  sourceType: "orchestration",
9229
9276
  sourceRef: goal
@@ -9235,6 +9282,28 @@ async function startOrchestration(opts) {
9235
9282
  }
9236
9283
 
9237
9284
  export {
9285
+ isHomeBoardThread,
9286
+ BOARD_COLUMN_DEFS,
9287
+ HOME_BOARD_CACHE_TTL_MS,
9288
+ DEFAULT_WORKTREE_SORT,
9289
+ groupHomeBoardWorktrees,
9290
+ classifyWorktreeColumn,
9291
+ worktreeBoardStatus,
9292
+ dedupeBoardIssues,
9293
+ issueNeedsWorkspacePick,
9294
+ isAccountWideIssueSource,
9295
+ findLiveThreadForCreate,
9296
+ findLiveThreadForCreateSource,
9297
+ boardPinIdentity,
9298
+ findBoardPin,
9299
+ syncBoardPins,
9300
+ dedupeBoardPrs,
9301
+ markdownPreviewSource,
9302
+ latestVisibleMessageText,
9303
+ findBoardIssue,
9304
+ findBoardPr,
9305
+ assembleHomeBoard,
9306
+ HOME_BOARD_AGENT_HINT,
9238
9307
  emptySetupLog,
9239
9308
  mergeSetupOutput,
9240
9309
  readSetupLog,
@@ -9370,26 +9439,6 @@ export {
9370
9439
  stopDetachedJob,
9371
9440
  detectAgents,
9372
9441
  requireAgent,
9373
- isHomeBoardThread,
9374
- BOARD_COLUMN_DEFS,
9375
- HOME_BOARD_CACHE_TTL_MS,
9376
- DEFAULT_WORKTREE_SORT,
9377
- groupHomeBoardWorktrees,
9378
- classifyWorktreeColumn,
9379
- worktreeBoardStatus,
9380
- dedupeBoardIssues,
9381
- issueNeedsWorkspacePick,
9382
- isAccountWideIssueSource,
9383
- findLiveThreadForCreate,
9384
- findLiveThreadForCreateSource,
9385
- boardPinIdentity,
9386
- findBoardPin,
9387
- syncBoardPins,
9388
- dedupeBoardPrs,
9389
- findBoardIssue,
9390
- findBoardPr,
9391
- assembleHomeBoard,
9392
- HOME_BOARD_AGENT_HINT,
9393
9442
  createThread,
9394
9443
  listLinearIssues,
9395
9444
  IMPLIED_TICKET_RESOLVE_PROMPT,
@@ -352,6 +352,24 @@ function normalizeVault(raw) {
352
352
  return out;
353
353
  }
354
354
 
355
+ // src/store/usage-on-limit.ts
356
+ var USAGE_ON_LIMIT_VALUES = [
357
+ "keep_going",
358
+ "confirm",
359
+ "switch_agent",
360
+ "wait_reset"
361
+ ];
362
+ function isUsageOnLimit(value) {
363
+ return value === "keep_going" || value === "confirm" || value === "switch_agent" || value === "wait_reset";
364
+ }
365
+ function resolveUsageOnLimit(advanced = {}) {
366
+ if (isUsageOnLimit(advanced.usageOnLimit)) return advanced.usageOnLimit;
367
+ if (advanced.confirmClaudeUsageOverLimit) return "confirm";
368
+ if (advanced.orchestrationQuotaOnLimit === "wait_reset") return "wait_reset";
369
+ if (advanced.orchestrationQuotaOnLimit === "switch_agent") return "switch_agent";
370
+ return "keep_going";
371
+ }
372
+
355
373
  // src/store/issue-source-labels.ts
356
374
  var ISSUE_SOURCE_LABELS = {
357
375
  github: "GitHub",
@@ -753,6 +771,9 @@ function normalizeAdvanced(raw) {
753
771
  if (typeof source.showCost === "boolean") {
754
772
  out.showCost = source.showCost;
755
773
  }
774
+ if (isUsageOnLimit(source.usageOnLimit)) {
775
+ out.usageOnLimit = source.usageOnLimit;
776
+ }
756
777
  if (typeof source.confirmClaudeUsageOverLimit === "boolean") {
757
778
  out.confirmClaudeUsageOverLimit = source.confirmClaudeUsageOverLimit;
758
779
  }
@@ -1631,8 +1652,16 @@ function updateAdvancedSettings(patch) {
1631
1652
  if (typeof patch.showCost === "boolean") {
1632
1653
  advanced.showCost = patch.showCost;
1633
1654
  }
1634
- if (typeof patch.confirmClaudeUsageOverLimit === "boolean") {
1655
+ if (isUsageOnLimit(patch.usageOnLimit)) {
1656
+ advanced.usageOnLimit = patch.usageOnLimit;
1657
+ advanced.confirmClaudeUsageOverLimit = patch.usageOnLimit === "confirm";
1658
+ if (patch.usageOnLimit === "switch_agent" || patch.usageOnLimit === "wait_reset") {
1659
+ advanced.orchestrationQuotaOnLimit = patch.usageOnLimit;
1660
+ }
1661
+ } else if (typeof patch.confirmClaudeUsageOverLimit === "boolean") {
1635
1662
  advanced.confirmClaudeUsageOverLimit = patch.confirmClaudeUsageOverLimit;
1663
+ if (patch.confirmClaudeUsageOverLimit) advanced.usageOnLimit = "confirm";
1664
+ else if (advanced.usageOnLimit === "confirm") advanced.usageOnLimit = "keep_going";
1636
1665
  }
1637
1666
  if (typeof patch.autoArchiveOnMerge === "boolean") {
1638
1667
  advanced.autoArchiveOnMerge = patch.autoArchiveOnMerge;
@@ -1697,7 +1726,7 @@ function showCostEnabled(settings = loadAppSettings()) {
1697
1726
  return Boolean(settings.advanced.showCost);
1698
1727
  }
1699
1728
  function confirmClaudeUsageOverLimitEnabled(settings = loadAppSettings()) {
1700
- return Boolean(settings.advanced.confirmClaudeUsageOverLimit);
1729
+ return usageOnLimit(settings) === "confirm";
1701
1730
  }
1702
1731
  function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
1703
1732
  return Boolean(settings.advanced.autoArchiveOnMerge);
@@ -1705,8 +1734,12 @@ function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
1705
1734
  function autoCleanupOrphansEnabled(settings = loadAppSettings()) {
1706
1735
  return Boolean(settings.advanced.autoCleanupOrphans);
1707
1736
  }
1737
+ function usageOnLimit(settings = loadAppSettings()) {
1738
+ return resolveUsageOnLimit(settings.advanced);
1739
+ }
1708
1740
  function orchestrationQuotaOnLimit(settings = loadAppSettings()) {
1709
- return settings.advanced.orchestrationQuotaOnLimit ?? "switch_agent";
1741
+ const action = usageOnLimit(settings);
1742
+ return action === "wait_reset" ? "wait_reset" : "switch_agent";
1710
1743
  }
1711
1744
  function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
1712
1745
  const preferred = settings.advanced.orchestrationQuotaFallbackAgent;
@@ -1834,6 +1867,9 @@ export {
1834
1867
  writeSecureJson,
1835
1868
  isSecureFileEncrypted,
1836
1869
  secureFileUnlocksWith,
1870
+ USAGE_ON_LIMIT_VALUES,
1871
+ isUsageOnLimit,
1872
+ resolveUsageOnLimit,
1837
1873
  ISSUE_SOURCE_LABELS,
1838
1874
  issueSourceLabel,
1839
1875
  HARNESS_ENV_KEYS,
@@ -1900,6 +1936,7 @@ export {
1900
1936
  confirmClaudeUsageOverLimitEnabled,
1901
1937
  autoArchiveOnMergeEnabled,
1902
1938
  autoCleanupOrphansEnabled,
1939
+ usageOnLimit,
1903
1940
  orchestrationQuotaOnLimit,
1904
1941
  orchestrationQuotaFallbackAgent,
1905
1942
  followUpBehavior,
@@ -137,6 +137,10 @@ function forgetThread(id) {
137
137
  function invalidateThreadListCache() {
138
138
  listCache = null;
139
139
  }
140
+ function invalidateThreadRecord(id) {
141
+ if (!id) return;
142
+ forgetThread(id);
143
+ }
140
144
  function readThread(id) {
141
145
  const path = threadFilePath(id);
142
146
  const mtimeMs = fileMtimeMs(path);
@@ -229,6 +233,7 @@ export {
229
233
  createEmptyThread,
230
234
  withThreadLock,
231
235
  invalidateThreadListCache,
236
+ invalidateThreadRecord,
232
237
  readThread,
233
238
  writeThread,
234
239
  isThreadRecordFile,