@sideboard-ai/core 0.1.198 → 0.1.200

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 (35) hide show
  1. package/dist/{abletime-JINF5KJV.js → abletime-345SE3B4.js} +2 -2
  2. package/dist/{abletime-HR6P4GJH.js → abletime-KGPD3UUJ.js} +2 -2
  3. package/dist/{agents-5TZY6LLX.js → agents-N7WXOGN6.js} +28 -4
  4. package/dist/{agents-AQQKPD46.js → agents-ZRIFDXCB.js} +28 -4
  5. package/dist/{app-settings-5KHVKJKO.js → app-settings-AXCURTZJ.js} +11 -1
  6. package/dist/{app-settings-J775CYOO.js → app-settings-V6IHESEQ.js} +11 -1
  7. package/dist/{chunk-SYXSSU7G.js → chunk-5XSDGJMP.js} +369 -4
  8. package/dist/{chunk-DROELG52.js → chunk-62IMZIIZ.js} +58 -41
  9. package/dist/{chunk-E37JHCO3.js → chunk-7AHAABKN.js} +1 -1
  10. package/dist/{chunk-S5GLSRLP.js → chunk-CXFW5LIH.js} +48 -1
  11. package/dist/{chunk-6YTI2HBG.js → chunk-EWDE54OI.js} +2 -2
  12. package/dist/{chunk-AH6WIBLY.js → chunk-ISV5IFH3.js} +48 -1
  13. package/dist/{chunk-DP4TKAMZ.js → chunk-NXM45OS3.js} +1 -1
  14. package/dist/{chunk-6YS5IKD2.js → chunk-O2DRYD2B.js} +59 -42
  15. package/dist/{chunk-S4QCBBXS.js → chunk-OSPE25A7.js} +1 -1
  16. package/dist/{chunk-HZTHWU6A.js → chunk-PDMNYCPL.js} +2 -2
  17. package/dist/{chunk-KTHRWHA3.js → chunk-PGQGP4FD.js} +1 -1
  18. package/dist/{chunk-EA67VQM2.js → chunk-PKUPOVKP.js} +369 -4
  19. package/dist/{coordinator-prompt-IX66YUJ2.js → coordinator-prompt-2RWBH6W7.js} +3 -3
  20. package/dist/{coordinator-prompt-LYKS3YNG.js → coordinator-prompt-AL62H73U.js} +3 -3
  21. package/dist/{global-workspace-SNJ2Z6SL.js → global-workspace-VAO3BQP5.js} +3 -3
  22. package/dist/{global-workspace-4QX6UEOY.js → global-workspace-Y5KKGXN7.js} +3 -3
  23. package/dist/index.cjs +766 -280
  24. package/dist/index.d.cts +116 -11
  25. package/dist/index.d.ts +116 -11
  26. package/dist/index.js +42 -8
  27. package/dist/mcp/run-stdio.cjs +374 -276
  28. package/dist/mcp/run-stdio.js +8 -8
  29. package/dist/{orchestrator-L2H42HPW.js → orchestrator-D2EJ4Z7Z.js} +5 -5
  30. package/dist/{orchestrator-6ZNKCPNL.js → orchestrator-DPHIMK44.js} +5 -5
  31. package/dist/{workspaces-URMUVGAQ.js → workspaces-DZZQM745.js} +3 -3
  32. package/dist/{workspaces-UTOYGBYB.js → workspaces-HEKFQP4B.js} +3 -3
  33. package/dist/{worktree-R43JOR4V.js → worktree-ENRMJUI3.js} +2 -2
  34. package/dist/{worktree-RM6UWNGZ.js → worktree-IEUSQ63V.js} +2 -2
  35. package/package.json +1 -1
@@ -38,7 +38,7 @@ import {
38
38
  summarizeTurnStderr,
39
39
  toolDescription,
40
40
  turnFailChatText
41
- } from "./chunk-SYXSSU7G.js";
41
+ } from "./chunk-5XSDGJMP.js";
42
42
  import {
43
43
  SLACK_REPLY_FORMATTING,
44
44
  addWorkspace,
@@ -61,7 +61,7 @@ import {
61
61
  stageAbsolutePathsAsAttachments,
62
62
  stageBuffersAsAttachments,
63
63
  syncWorkspacesFromThreads
64
- } from "./chunk-6YTI2HBG.js";
64
+ } from "./chunk-EWDE54OI.js";
65
65
  import {
66
66
  extractPresentedPlan,
67
67
  readPlanFile,
@@ -116,7 +116,7 @@ import {
116
116
  worktreeDisplayLabelForGroup,
117
117
  worktreeNameFromPath,
118
118
  worktreeSlugForTicket
119
- } from "./chunk-DP4TKAMZ.js";
119
+ } from "./chunk-NXM45OS3.js";
120
120
  import {
121
121
  ATTACHMENTS_DIR,
122
122
  DETACHED_JOBS_DIR,
@@ -160,7 +160,6 @@ import {
160
160
  isSecureFileEncrypted,
161
161
  loadAppSettings,
162
162
  orchestrationQuotaFallbackAgent,
163
- orchestrationQuotaOnLimit,
164
163
  readSecureJson,
165
164
  resolveEffectiveIssueSource,
166
165
  resolveNewThreadOptions,
@@ -169,8 +168,9 @@ import {
169
168
  resolveViewerProfileForRepo,
170
169
  stripNestedElectronEnv,
171
170
  updateAdvancedSettings,
171
+ usageOnLimit,
172
172
  writeSecureJson
173
- } from "./chunk-AH6WIBLY.js";
173
+ } from "./chunk-ISV5IFH3.js";
174
174
  import {
175
175
  writePrivateFile
176
176
  } from "./chunk-NSTQ6QKD.js";
@@ -408,7 +408,7 @@ async function continueSourceThread(threadId, prompt) {
408
408
  await continueOnReply(threadId, prompt);
409
409
  return;
410
410
  }
411
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-L2H42HPW.js");
411
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-D2EJ4Z7Z.js");
412
412
  await getOrchestrator2().send(threadId, prompt);
413
413
  } catch {
414
414
  }
@@ -801,9 +801,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
801
801
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
802
802
  );
803
803
  }
804
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-SNJ2Z6SL.js");
804
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-VAO3BQP5.js");
805
805
  if (isGlobalThread2(thread)) {
806
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-LYKS3YNG.js");
806
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-AL62H73U.js");
807
807
  ensureGlobalCoordinatorCwd2(
808
808
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
809
809
  );
@@ -3599,7 +3599,7 @@ async function createThread(input, _onSetupLine) {
3599
3599
  });
3600
3600
  await requireAgent(resolved.agent);
3601
3601
  if (input.cowboy) {
3602
- const { cowboyModeEnabled } = await import("./app-settings-J775CYOO.js");
3602
+ const { cowboyModeEnabled } = await import("./app-settings-V6IHESEQ.js");
3603
3603
  if (!cowboyModeEnabled()) {
3604
3604
  throw new Error(
3605
3605
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3657,7 +3657,7 @@ async function createThread(input, _onSetupLine) {
3657
3657
  let sourceIsFork = false;
3658
3658
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3659
3659
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3660
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-HR6P4GJH.js");
3660
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-KGPD3UUJ.js");
3661
3661
  const task = await ensureAbleTimeTask({
3662
3662
  title: title?.trim() || "Untitled work",
3663
3663
  description: input.prompt?.trim() || void 0
@@ -3969,12 +3969,18 @@ async function forkThreadWorktree(input, onSetupLine) {
3969
3969
  // src/orchestrator/quota-failover.ts
3970
3970
  import { randomUUID as randomUUID3 } from "crypto";
3971
3971
  function planOrchestrationQuotaFailover(thread, limitText, opts) {
3972
- if (!isOrchestratorThread(thread)) return null;
3973
3972
  if (!isSessionQuotaLimit(limitText)) return null;
3974
- const onLimit = opts?.onLimit ?? orchestrationQuotaOnLimit();
3973
+ const onLimit = opts?.onLimit ?? usageOnLimit();
3975
3974
  const resumeAt = parseSessionQuotaResetAt(limitText, opts?.now);
3975
+ if (onLimit === "keep_going" || onLimit === "confirm") {
3976
+ return {
3977
+ action: "none",
3978
+ reason: onLimit === "confirm" ? "Settings: confirm with user; no automatic continue." : "Settings: keep going; no automatic continue.",
3979
+ limitText
3980
+ };
3981
+ }
3976
3982
  if (thread.quotaContinuedFromId) {
3977
- if (resumeAt) {
3983
+ if (onLimit === "switch_agent" && resumeAt) {
3978
3984
  return {
3979
3985
  action: "wait_reset",
3980
3986
  reason: "Already continued once; waiting for quota reset instead.",
@@ -3984,7 +3990,7 @@ function planOrchestrationQuotaFailover(thread, limitText, opts) {
3984
3990
  }
3985
3991
  return {
3986
3992
  action: "none",
3987
- reason: "Already continued once; no parseable reset time.",
3993
+ reason: "Already continued once; no further automatic continue.",
3988
3994
  limitText
3989
3995
  };
3990
3996
  }
@@ -4021,8 +4027,19 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
4021
4027
  const text = m.text.trim().replace(/\s+/g, " ").slice(0, 280);
4022
4028
  return text ? `- ${role}: ${text}` : null;
4023
4029
  }).filter(Boolean);
4030
+ const orch = isOrchestratorThread(from);
4031
+ const instructions = orch ? [
4032
+ "- Continue fleet orchestration from this handoff.",
4033
+ "- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.",
4034
+ "- Leave model Auto unless there is a specific reason to pin one.",
4035
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4036
+ ] : [
4037
+ "- Continue this worktree chat from the handoff.",
4038
+ "- Leave model Auto unless there is a specific reason to pin one.",
4039
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4040
+ ];
4024
4041
  const body = [
4025
- `# Orchestration handoff`,
4042
+ `# ${orch ? "Orchestration" : "Chat"} handoff`,
4026
4043
  "",
4027
4044
  `Previous chat: ${from.title} (\`${from.id}\`) on **${from.agent}** hit a session/usage limit.`,
4028
4045
  `Limit: ${limitText.trim()}`,
@@ -4038,23 +4055,20 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
4038
4055
  recent.length ? recent.join("\n") : "(none)",
4039
4056
  "",
4040
4057
  `## Instructions`,
4041
- `- Continue fleet orchestration from this handoff.`,
4042
- `- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.`,
4043
- `- Leave model Auto unless there is a specific reason to pin one.`,
4044
- `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
4058
+ ...instructions
4045
4059
  ].join("\n");
4046
4060
  return {
4047
4061
  id: randomUUID3(),
4048
- name: "Orchestration quota handoff.md",
4062
+ name: orch ? "Orchestration quota handoff.md" : "Quota handoff.md",
4049
4063
  kind: "transcript",
4050
4064
  content: body
4051
4065
  };
4052
4066
  }
4053
4067
  var QUOTA_CONTINUE_PROMPT = (fromAgent, fallback) => [
4054
- `${fromAgent} hit a session/usage limit. Continue this orchestration on ${fallback} using the attached handoff.`,
4055
- "Call list_board or list_threads for live fleet status, then proceed with the goal. Leave model Auto unless needed."
4068
+ `${fromAgent} hit a session/usage limit. Continue this chat on ${fallback} using the attached handoff.`,
4069
+ "Proceed with the goal. Leave model Auto unless needed."
4056
4070
  ].join(" ");
4057
- 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.";
4071
+ var QUOTA_RESUME_PROMPT = "Session/usage limit window should have reset. Continue this chat from where you left off.";
4058
4072
  function createQuotaFailoverChat(from, fallbackAgent, limitText) {
4059
4073
  const handoff = buildQuotaHandoffAttachment(from, limitText, fallbackAgent);
4060
4074
  const tab = createChatTab({
@@ -4063,12 +4077,15 @@ function createQuotaFailoverChat(from, fallbackAgent, limitText) {
4063
4077
  model: null,
4064
4078
  attachments: [handoff]
4065
4079
  });
4066
- return updateThread(tab.id, {
4067
- parentThreadId: from.id,
4080
+ const patch = {
4068
4081
  quotaContinuedFromId: from.id,
4069
- sourceRef: from.sourceRef,
4070
- sourceType: "orchestration"
4071
- });
4082
+ sourceRef: from.sourceRef
4083
+ };
4084
+ if (isOrchestratorThread(from)) {
4085
+ patch.parentThreadId = from.id;
4086
+ patch.sourceType = "orchestration";
4087
+ }
4088
+ return updateThread(tab.id, patch);
4072
4089
  }
4073
4090
 
4074
4091
  // src/threads/adopt.ts
@@ -4169,7 +4186,7 @@ async function adoptThread(input) {
4169
4186
  messages: input.messages ?? []
4170
4187
  });
4171
4188
  writeThread(thread);
4172
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-UTOYGBYB.js");
4189
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HEKFQP4B.js");
4173
4190
  await ensureWorkspace2(repoPath);
4174
4191
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-N5X5I422.js");
4175
4192
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6547,7 +6564,7 @@ function formatScheduledPrompt(name, prompt) {
6547
6564
  ${prompt}`;
6548
6565
  }
6549
6566
  async function defaultDeps() {
6550
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-L2H42HPW.js");
6567
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-D2EJ4Z7Z.js");
6551
6568
  const orch = getOrchestrator2();
6552
6569
  return {
6553
6570
  findThread: (id) => findThreadByRef(id),
@@ -6822,7 +6839,7 @@ var Orchestrator = class {
6822
6839
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6823
6840
  });
6824
6841
  }
6825
- const { autoCleanupOrphansEnabled } = await import("./app-settings-J775CYOO.js");
6842
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-V6IHESEQ.js");
6826
6843
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6827
6844
  await cleanupOrphanWorktrees({ repoPaths });
6828
6845
  }
@@ -6933,8 +6950,8 @@ var Orchestrator = class {
6933
6950
  await this.send(threadId, QUOTA_RESUME_PROMPT);
6934
6951
  }
6935
6952
  /**
6936
- * Host-side continue when an orchestration chat hits a provider session/usage
6937
- * limit (not context size): switch agent (Auto) or wait until reset.
6953
+ * Host-side continue when any chat hits a provider session/usage limit
6954
+ * (not context size): switch agent (Auto) or wait until reset.
6938
6955
  */
6939
6956
  async maybeHandleOrchestrationQuotaFailover(threadId, limitText) {
6940
6957
  const thread = findThreadByRef(threadId);
@@ -6947,7 +6964,7 @@ var Orchestrator = class {
6947
6964
  setStatus(threadId, "idle", null);
6948
6965
  appendMessage(threadId, {
6949
6966
  role: "agent",
6950
- text: `Sideboard will auto-retry this orchestration around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
6967
+ text: `Sideboard will auto-retry this chat around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
6951
6968
  ts: (/* @__PURE__ */ new Date()).toISOString()
6952
6969
  });
6953
6970
  this.emit({
@@ -7101,7 +7118,7 @@ var Orchestrator = class {
7101
7118
  }
7102
7119
  await setup;
7103
7120
  if (skipSetup) return;
7104
- const { autoRunAfterSetupEnabled } = await import("./app-settings-J775CYOO.js");
7121
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-V6IHESEQ.js");
7105
7122
  if (autoRunAfterSetupEnabled()) {
7106
7123
  try {
7107
7124
  await this.startDev(threadId);
@@ -7425,7 +7442,7 @@ var Orchestrator = class {
7425
7442
  }
7426
7443
  const isBrightsy = fresh.agent === "brightsy";
7427
7444
  const isOrchestration = isOrchestratorThread(fresh);
7428
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-J775CYOO.js");
7445
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-V6IHESEQ.js");
7429
7446
  const gitAuthMode = getGithubGitAuthMode();
7430
7447
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7431
7448
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -8410,7 +8427,7 @@ var Orchestrator = class {
8410
8427
  updateThread(thread.id, { title: meta.title });
8411
8428
  }
8412
8429
  }
8413
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-J775CYOO.js");
8430
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-V6IHESEQ.js");
8414
8431
  const latest = this.requireThread(thread.id);
8415
8432
  if (!shouldAutoArchiveOnPrMerge({
8416
8433
  previousPrState: prevState || null,
@@ -8702,7 +8719,7 @@ var Orchestrator = class {
8702
8719
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
8703
8720
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8704
8721
  try {
8705
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-UTOYGBYB.js");
8722
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HEKFQP4B.js");
8706
8723
  await ensureWorkspace2(thread.repoPath);
8707
8724
  } catch {
8708
8725
  }
@@ -8729,7 +8746,7 @@ var Orchestrator = class {
8729
8746
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8730
8747
  } catch {
8731
8748
  }
8732
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-J775CYOO.js");
8749
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-V6IHESEQ.js");
8733
8750
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8734
8751
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8735
8752
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8756,7 +8773,7 @@ var Orchestrator = class {
8756
8773
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8757
8774
  );
8758
8775
  }
8759
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-R43JOR4V.js");
8776
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-ENRMJUI3.js");
8760
8777
  const slug = thread.worktreePath.split("/").pop();
8761
8778
  const dest = thread.worktreePath;
8762
8779
  await withRepoGitLock(thread.repoPath, async () => {
@@ -8866,7 +8883,7 @@ async function startOrchestration(opts) {
8866
8883
  sourceRef: "default",
8867
8884
  ...createOpts
8868
8885
  }).catch(async () => {
8869
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-R43JOR4V.js");
8886
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ENRMJUI3.js");
8870
8887
  const repo = await resolveRepoRoot2(repoPath);
8871
8888
  const def = await resolveDefaultBranch2(repo);
8872
8889
  return orch.createThread({
@@ -6,7 +6,7 @@ import {
6
6
  getAbleTimeHost,
7
7
  isAbleTimeConnected,
8
8
  saveAbleTimeConnection
9
- } from "./chunk-S5GLSRLP.js";
9
+ } from "./chunk-CXFW5LIH.js";
10
10
 
11
11
  // src/integrations/abletime-mcp.ts
12
12
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -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,12 @@ 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
+ }
777
+ if (typeof source.confirmClaudeUsageOverLimit === "boolean") {
778
+ out.confirmClaudeUsageOverLimit = source.confirmClaudeUsageOverLimit;
779
+ }
756
780
  if (typeof source.autoArchiveOnMerge === "boolean") {
757
781
  out.autoArchiveOnMerge = source.autoArchiveOnMerge;
758
782
  }
@@ -1628,6 +1652,17 @@ function updateAdvancedSettings(patch) {
1628
1652
  if (typeof patch.showCost === "boolean") {
1629
1653
  advanced.showCost = patch.showCost;
1630
1654
  }
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") {
1662
+ advanced.confirmClaudeUsageOverLimit = patch.confirmClaudeUsageOverLimit;
1663
+ if (patch.confirmClaudeUsageOverLimit) advanced.usageOnLimit = "confirm";
1664
+ else if (advanced.usageOnLimit === "confirm") advanced.usageOnLimit = "keep_going";
1665
+ }
1631
1666
  if (typeof patch.autoArchiveOnMerge === "boolean") {
1632
1667
  advanced.autoArchiveOnMerge = patch.autoArchiveOnMerge;
1633
1668
  }
@@ -1690,14 +1725,21 @@ function cowboyModeEnabled(settings = loadAppSettings()) {
1690
1725
  function showCostEnabled(settings = loadAppSettings()) {
1691
1726
  return Boolean(settings.advanced.showCost);
1692
1727
  }
1728
+ function confirmClaudeUsageOverLimitEnabled(settings = loadAppSettings()) {
1729
+ return usageOnLimit(settings) === "confirm";
1730
+ }
1693
1731
  function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
1694
1732
  return Boolean(settings.advanced.autoArchiveOnMerge);
1695
1733
  }
1696
1734
  function autoCleanupOrphansEnabled(settings = loadAppSettings()) {
1697
1735
  return Boolean(settings.advanced.autoCleanupOrphans);
1698
1736
  }
1737
+ function usageOnLimit(settings = loadAppSettings()) {
1738
+ return resolveUsageOnLimit(settings.advanced);
1739
+ }
1699
1740
  function orchestrationQuotaOnLimit(settings = loadAppSettings()) {
1700
- return settings.advanced.orchestrationQuotaOnLimit ?? "switch_agent";
1741
+ const action = usageOnLimit(settings);
1742
+ return action === "wait_reset" ? "wait_reset" : "switch_agent";
1701
1743
  }
1702
1744
  function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
1703
1745
  const preferred = settings.advanced.orchestrationQuotaFallbackAgent;
@@ -1825,6 +1867,9 @@ export {
1825
1867
  writeSecureJson,
1826
1868
  isSecureFileEncrypted,
1827
1869
  secureFileUnlocksWith,
1870
+ USAGE_ON_LIMIT_VALUES,
1871
+ isUsageOnLimit,
1872
+ resolveUsageOnLimit,
1828
1873
  ISSUE_SOURCE_LABELS,
1829
1874
  issueSourceLabel,
1830
1875
  HARNESS_ENV_KEYS,
@@ -1888,8 +1933,10 @@ export {
1888
1933
  deleteBranchOnPurgeEnabled,
1889
1934
  cowboyModeEnabled,
1890
1935
  showCostEnabled,
1936
+ confirmClaudeUsageOverLimitEnabled,
1891
1937
  autoArchiveOnMergeEnabled,
1892
1938
  autoCleanupOrphansEnabled,
1939
+ usageOnLimit,
1893
1940
  orchestrationQuotaOnLimit,
1894
1941
  orchestrationQuotaFallbackAgent,
1895
1942
  followUpBehavior,
@@ -7,7 +7,7 @@ import {
7
7
  resolveRepoRoot,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-DP4TKAMZ.js";
10
+ } from "./chunk-NXM45OS3.js";
11
11
  import {
12
12
  ATTACHMENTS_DIR,
13
13
  attachmentsGitignoreBody
@@ -30,7 +30,7 @@ import {
30
30
  resolveThreadDefaults,
31
31
  resolveViewerProfile,
32
32
  resolveViewerProfileForRepo
33
- } from "./chunk-AH6WIBLY.js";
33
+ } from "./chunk-ISV5IFH3.js";
34
34
  import {
35
35
  appDataDir,
36
36
  globalAgentCwd,
@@ -380,6 +380,24 @@ function normalizeVault(raw) {
380
380
  return out;
381
381
  }
382
382
 
383
+ // src/store/usage-on-limit.ts
384
+ var USAGE_ON_LIMIT_VALUES = [
385
+ "keep_going",
386
+ "confirm",
387
+ "switch_agent",
388
+ "wait_reset"
389
+ ];
390
+ function isUsageOnLimit(value) {
391
+ return value === "keep_going" || value === "confirm" || value === "switch_agent" || value === "wait_reset";
392
+ }
393
+ function resolveUsageOnLimit(advanced = {}) {
394
+ if (isUsageOnLimit(advanced.usageOnLimit)) return advanced.usageOnLimit;
395
+ if (advanced.confirmClaudeUsageOverLimit) return "confirm";
396
+ if (advanced.orchestrationQuotaOnLimit === "wait_reset") return "wait_reset";
397
+ if (advanced.orchestrationQuotaOnLimit === "switch_agent") return "switch_agent";
398
+ return "keep_going";
399
+ }
400
+
383
401
  // src/store/issue-source-labels.ts
384
402
  var ISSUE_SOURCE_LABELS = {
385
403
  github: "GitHub",
@@ -781,6 +799,12 @@ function normalizeAdvanced(raw) {
781
799
  if (typeof source.showCost === "boolean") {
782
800
  out.showCost = source.showCost;
783
801
  }
802
+ if (isUsageOnLimit(source.usageOnLimit)) {
803
+ out.usageOnLimit = source.usageOnLimit;
804
+ }
805
+ if (typeof source.confirmClaudeUsageOverLimit === "boolean") {
806
+ out.confirmClaudeUsageOverLimit = source.confirmClaudeUsageOverLimit;
807
+ }
784
808
  if (typeof source.autoArchiveOnMerge === "boolean") {
785
809
  out.autoArchiveOnMerge = source.autoArchiveOnMerge;
786
810
  }
@@ -1656,6 +1680,17 @@ function updateAdvancedSettings(patch) {
1656
1680
  if (typeof patch.showCost === "boolean") {
1657
1681
  advanced.showCost = patch.showCost;
1658
1682
  }
1683
+ if (isUsageOnLimit(patch.usageOnLimit)) {
1684
+ advanced.usageOnLimit = patch.usageOnLimit;
1685
+ advanced.confirmClaudeUsageOverLimit = patch.usageOnLimit === "confirm";
1686
+ if (patch.usageOnLimit === "switch_agent" || patch.usageOnLimit === "wait_reset") {
1687
+ advanced.orchestrationQuotaOnLimit = patch.usageOnLimit;
1688
+ }
1689
+ } else if (typeof patch.confirmClaudeUsageOverLimit === "boolean") {
1690
+ advanced.confirmClaudeUsageOverLimit = patch.confirmClaudeUsageOverLimit;
1691
+ if (patch.confirmClaudeUsageOverLimit) advanced.usageOnLimit = "confirm";
1692
+ else if (advanced.usageOnLimit === "confirm") advanced.usageOnLimit = "keep_going";
1693
+ }
1659
1694
  if (typeof patch.autoArchiveOnMerge === "boolean") {
1660
1695
  advanced.autoArchiveOnMerge = patch.autoArchiveOnMerge;
1661
1696
  }
@@ -1718,14 +1753,21 @@ function cowboyModeEnabled(settings = loadAppSettings()) {
1718
1753
  function showCostEnabled(settings = loadAppSettings()) {
1719
1754
  return Boolean(settings.advanced.showCost);
1720
1755
  }
1756
+ function confirmClaudeUsageOverLimitEnabled(settings = loadAppSettings()) {
1757
+ return usageOnLimit(settings) === "confirm";
1758
+ }
1721
1759
  function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
1722
1760
  return Boolean(settings.advanced.autoArchiveOnMerge);
1723
1761
  }
1724
1762
  function autoCleanupOrphansEnabled(settings = loadAppSettings()) {
1725
1763
  return Boolean(settings.advanced.autoCleanupOrphans);
1726
1764
  }
1765
+ function usageOnLimit(settings = loadAppSettings()) {
1766
+ return resolveUsageOnLimit(settings.advanced);
1767
+ }
1727
1768
  function orchestrationQuotaOnLimit(settings = loadAppSettings()) {
1728
- return settings.advanced.orchestrationQuotaOnLimit ?? "switch_agent";
1769
+ const action = usageOnLimit(settings);
1770
+ return action === "wait_reset" ? "wait_reset" : "switch_agent";
1729
1771
  }
1730
1772
  function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
1731
1773
  const preferred = settings.advanced.orchestrationQuotaFallbackAgent;
@@ -1854,6 +1896,9 @@ export {
1854
1896
  formatWorkspaceProfileSuffix,
1855
1897
  formatViewerContextDirective,
1856
1898
  formatViewerContextReminder,
1899
+ USAGE_ON_LIMIT_VALUES,
1900
+ isUsageOnLimit,
1901
+ resolveUsageOnLimit,
1857
1902
  ISSUE_SOURCE_LABELS,
1858
1903
  issueSourceLabel,
1859
1904
  HARNESS_ENV_KEYS,
@@ -1917,8 +1962,10 @@ export {
1917
1962
  deleteBranchOnPurgeEnabled,
1918
1963
  cowboyModeEnabled,
1919
1964
  showCostEnabled,
1965
+ confirmClaudeUsageOverLimitEnabled,
1920
1966
  autoArchiveOnMergeEnabled,
1921
1967
  autoCleanupOrphansEnabled,
1968
+ usageOnLimit,
1922
1969
  orchestrationQuotaOnLimit,
1923
1970
  orchestrationQuotaFallbackAgent,
1924
1971
  followUpBehavior,
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  getGithubGitAuthMode,
24
24
  getGithubPat
25
- } from "./chunk-AH6WIBLY.js";
25
+ } from "./chunk-ISV5IFH3.js";
26
26
  import {
27
27
  worktreesRoot
28
28
  } from "./chunk-EQNRWDLN.js";