@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
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  toAbleTimeIssueInfo,
26
26
  updateAbleTimeTask,
27
27
  verifyAbleTimeConnection
28
- } from "./chunk-CA7PWMQ7.js";
28
+ } from "./chunk-7AHAABKN.js";
29
29
  import {
30
30
  AGENT_GIT_ACTIONS,
31
31
  BOARD_COLUMN_DEFS,
@@ -180,6 +180,7 @@ import {
180
180
  issueNeedsWorkspacePick,
181
181
  issueTicketFromThread,
182
182
  lastRequestOccupancy,
183
+ latestVisibleMessageText,
183
184
  linearTicketIdFromThread,
184
185
  listBranchCommits,
185
186
  listConductorWorkspaces,
@@ -190,6 +191,7 @@ import {
190
191
  listSlackWorkspaces,
191
192
  listSlackWorkspacesRaw,
192
193
  listWorktreeFiles,
194
+ markdownPreviewSource,
193
195
  maybeCompactContext,
194
196
  mcpWaitFinishedHint,
195
197
  mcpWaitForJobTimeoutMs,
@@ -268,7 +270,7 @@ import {
268
270
  worktreeCleanupSettings,
269
271
  wrapReviewSkillMarkdown,
270
272
  writeWorktreeFile
271
- } from "./chunk-PPVN3APP.js";
273
+ } from "./chunk-AHPIU2VP.js";
272
274
  import {
273
275
  LEGACY_PLAN_FILE_REL,
274
276
  PLAN_FILE_NAME,
@@ -316,6 +318,7 @@ import {
316
318
  formatClaudeUsageCompact,
317
319
  formatClaudeUsageFetchedAt,
318
320
  formatClaudeUsageOverLimitConfirm,
321
+ formatClaudeUsageOverLimitWait,
319
322
  formatClaudeUsageReset,
320
323
  formatClaudeUsageResetClock,
321
324
  formatClaudeUsageTooltip,
@@ -387,7 +390,7 @@ import {
387
390
  withEventParentId,
388
391
  withEventsParentId,
389
392
  writeInjectedMcpConfig
390
- } from "./chunk-KI4YI72Y.js";
393
+ } from "./chunk-RV3ZKE4Y.js";
391
394
  import {
392
395
  CLOUD_COORDINATOR_BUSY_REPLY,
393
396
  CLOUD_COORDINATOR_STOPPED_REPLY,
@@ -430,7 +433,7 @@ import {
430
433
  stageBuffersAsAttachments,
431
434
  syncWorkspacesFromThreads,
432
435
  takenTeamSlugsForOrchestration
433
- } from "./chunk-BLOKJY4U.js";
436
+ } from "./chunk-LJHC62LZ.js";
434
437
  import {
435
438
  FAMOUS_SOCCER_TEAMS,
436
439
  GITHUB_PR_BODY_MAX_CHARS,
@@ -527,7 +530,7 @@ import {
527
530
  worktreeDisplayLabelForGroup,
528
531
  worktreeNameFromPath,
529
532
  worktreeSlugForTicket
530
- } from "./chunk-DU4ID3DA.js";
533
+ } from "./chunk-STPZQR5B.js";
531
534
  import {
532
535
  ATTACHMENTS_DIR,
533
536
  CLI_DIR,
@@ -581,6 +584,7 @@ import {
581
584
  ISSUE_SOURCE_LABELS,
582
585
  ORCHESTRATOR_AGENT_KINDS,
583
586
  PROFILE_NOTES_MAX,
587
+ USAGE_ON_LIMIT_VALUES,
584
588
  appSettingsPath,
585
589
  applyAppEnvironment,
586
590
  assertOrchestratorCapableAgent,
@@ -630,6 +634,7 @@ import {
630
634
  isIssueSourceConnected,
631
635
  isLinearConnected,
632
636
  isOrchestratorCapableAgent,
637
+ isUsageOnLimit,
633
638
  issueSourceLabel,
634
639
  loadAppSettings,
635
640
  maxConcurrentAgents,
@@ -647,6 +652,7 @@ import {
647
652
  resolveNewThreadOptions,
648
653
  resolveOrchestratorDefaults,
649
654
  resolveThreadDefaults,
655
+ resolveUsageOnLimit,
650
656
  resolveVaultKey,
651
657
  resolveViewerProfile,
652
658
  resolveViewerProfileForRepo,
@@ -669,8 +675,9 @@ import {
669
675
  updateIntegrationsSettings,
670
676
  updateOpencodeSettings,
671
677
  updateProjectProfileSettings,
678
+ usageOnLimit,
672
679
  writeViewerContext
673
- } from "./chunk-2IQ6W47G.js";
680
+ } from "./chunk-CXFW5LIH.js";
674
681
  import {
675
682
  stripNestedElectronEnv
676
683
  } from "./chunk-4TR3HZFT.js";
@@ -693,6 +700,7 @@ import {
693
700
  deleteThreadRecord,
694
701
  findThreadByRef,
695
702
  invalidateThreadListCache,
703
+ invalidateThreadRecord,
696
704
  isThreadRecordFile,
697
705
  listThreads,
698
706
  normalizeThread,
@@ -702,7 +710,7 @@ import {
702
710
  updateThread,
703
711
  withThreadLock,
704
712
  writeThread
705
- } from "./chunk-KJBYIIJU.js";
713
+ } from "./chunk-DFUES6QU.js";
706
714
  import {
707
715
  THINKING_EFFORTS,
708
716
  isThinkingEffort,
@@ -754,6 +762,74 @@ import {
754
762
  withExportedPath
755
763
  } from "./chunk-UFHNSFAS.js";
756
764
 
765
+ // src/store/thread-list.ts
766
+ var LIST_PREVIEW_MAX = 480;
767
+ function slimThreadForUiList(thread) {
768
+ const messages = thread.messages ?? [];
769
+ return {
770
+ ...thread,
771
+ attachments: [],
772
+ messages: slimMessagesForUiList(messages, thread.updatedAt)
773
+ };
774
+ }
775
+ function slimMessagesForUiList(messages, fallbackTs) {
776
+ if (messages.length === 0) return [];
777
+ const usage = sumUsageList(messages.map((m) => m.usage));
778
+ const lastAgent = lastAgentMessage(messages);
779
+ const lastVisible = lastVisibleMessage(messages);
780
+ const preview = markdownPreviewSource(latestVisibleMessageText(messages), LIST_PREVIEW_MAX);
781
+ if (lastVisible && lastAgent && lastVisible !== lastAgent) {
782
+ return [
783
+ agentStub(lastAgent, "", usage),
784
+ { role: lastVisible.role, text: preview, ts: lastVisible.ts }
785
+ ];
786
+ }
787
+ if (lastVisible) {
788
+ return [
789
+ lastVisible.role === "agent" ? agentStub(lastVisible, preview, usage) : { role: lastVisible.role, text: preview, ts: lastVisible.ts, ...usage ? { usage } : {} }
790
+ ];
791
+ }
792
+ if (lastAgent) {
793
+ return [agentStub(lastAgent, "", usage)];
794
+ }
795
+ return [
796
+ {
797
+ role: "summary",
798
+ text: "",
799
+ ts: messages[messages.length - 1]?.ts ?? fallbackTs,
800
+ ...usage ? { usage } : {}
801
+ }
802
+ ];
803
+ }
804
+ function lastAgentMessage(messages) {
805
+ for (let i = messages.length - 1; i >= 0; i--) {
806
+ const m = messages[i];
807
+ if (m?.role === "agent") return m;
808
+ }
809
+ return void 0;
810
+ }
811
+ function lastVisibleMessage(messages) {
812
+ for (let i = messages.length - 1; i >= 0; i--) {
813
+ const m = messages[i];
814
+ if (!m) continue;
815
+ if (m.role === "agent") {
816
+ const text7 = (lastAssistantMessageText(m.parts) || m.text || "").trim();
817
+ if (text7 && !isInternalAgentStatusText(text7)) return m;
818
+ continue;
819
+ }
820
+ if (m.role === "user" && m.text?.trim()) return m;
821
+ }
822
+ return void 0;
823
+ }
824
+ function agentStub(source, text7, usage) {
825
+ return {
826
+ role: "agent",
827
+ text: text7,
828
+ ts: source.ts,
829
+ ...usage ? { usage } : {}
830
+ };
831
+ }
832
+
757
833
  // src/integrations/github.ts
758
834
  async function getGitHubStatus() {
759
835
  const which = await run("which", ["gh"], { reject: false });
@@ -5119,7 +5195,7 @@ async function startMcpServer() {
5119
5195
  );
5120
5196
  }
5121
5197
  try {
5122
- const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-MMPLJHWF.js");
5198
+ const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-AXCURTZJ.js");
5123
5199
  orch.setMaxConcurrent(maxConcurrentAgents2());
5124
5200
  } catch {
5125
5201
  }
@@ -5434,7 +5510,7 @@ async function startMcpServer() {
5434
5510
  registerConnectedIssueVendorTools(server);
5435
5511
  registerScheduleTools(server);
5436
5512
  const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-22VFDPSO.js");
5437
- const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-MMPLJHWF.js");
5513
+ const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-AXCURTZJ.js");
5438
5514
  const accountDefaults = resolveThreadDefaults2();
5439
5515
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
5440
5516
  server.tool(
@@ -8487,6 +8563,7 @@ export {
8487
8563
  SlackRelayHub,
8488
8564
  THINKING_EFFORTS,
8489
8565
  THINKING_PART_MAX_CHARS,
8566
+ USAGE_ON_LIMIT_VALUES,
8490
8567
  WORKTREE_ABLETIME_MCP_TOOLS,
8491
8568
  WORKTREE_GITHUB_MCP_TOOLS,
8492
8569
  WORKTREE_LINEAR_MCP_TOOLS,
@@ -8692,6 +8769,7 @@ export {
8692
8769
  formatClaudeUsageCompact,
8693
8770
  formatClaudeUsageFetchedAt,
8694
8771
  formatClaudeUsageOverLimitConfirm,
8772
+ formatClaudeUsageOverLimitWait,
8695
8773
  formatClaudeUsageReset,
8696
8774
  formatClaudeUsageResetClock,
8697
8775
  formatClaudeUsageTooltip,
@@ -8807,6 +8885,7 @@ export {
8807
8885
  installOptionalServiceCli,
8808
8886
  interruptSlackCoordinatorForInbound,
8809
8887
  invalidateThreadListCache,
8888
+ invalidateThreadRecord,
8810
8889
  isAbleTimeConnected,
8811
8890
  isAskUserToolName,
8812
8891
  isBrightsyConnected,
@@ -8856,6 +8935,7 @@ export {
8856
8935
  isThisProcessDesktopHost,
8857
8936
  isThreadCaffeinated,
8858
8937
  isThreadRecordFile,
8938
+ isUsageOnLimit,
8859
8939
  isWorkspaceScratchPath,
8860
8940
  issueAttachmentForAbleTimeTask,
8861
8941
  issueMatchesAssignee,
@@ -9055,6 +9135,7 @@ export {
9055
9135
  resolveSlackListenMode,
9056
9136
  resolveThreadDefaults,
9057
9137
  resolveThreadEffort,
9138
+ resolveUsageOnLimit,
9058
9139
  resolveVaultKey,
9059
9140
  resolveViewerProfile,
9060
9141
  resolveViewerProfileForRepo,
@@ -9105,6 +9186,8 @@ export {
9105
9186
  slackOAuthCredentials,
9106
9187
  slackOAuthResultUrl,
9107
9188
  slackRelayUrl,
9189
+ slimMessagesForUiList,
9190
+ slimThreadForUiList,
9108
9191
  slugify,
9109
9192
  spawnAgentTurn,
9110
9193
  splitForCompaction,
@@ -9169,6 +9252,7 @@ export {
9169
9252
  updateProjectProfileSettings,
9170
9253
  updateSchedule,
9171
9254
  updateThread,
9255
+ usageOnLimit,
9172
9256
  userClaudeMcpConfigPath,
9173
9257
  userCursorMcpConfigPath,
9174
9258
  userMcpNamesToDisable,
@@ -809,6 +809,7 @@ __export(thread_store_exports, {
809
809
  deleteThreadRecord: () => deleteThreadRecord,
810
810
  findThreadByRef: () => findThreadByRef,
811
811
  invalidateThreadListCache: () => invalidateThreadListCache,
812
+ invalidateThreadRecord: () => invalidateThreadRecord,
812
813
  isThreadRecordFile: () => isThreadRecordFile,
813
814
  listThreads: () => listThreads,
814
815
  normalizeThread: () => normalizeThread,
@@ -935,6 +936,10 @@ function forgetThread(id) {
935
936
  function invalidateThreadListCache() {
936
937
  listCache = null;
937
938
  }
939
+ function invalidateThreadRecord(id) {
940
+ if (!id) return;
941
+ forgetThread(id);
942
+ }
938
943
  function readThread(id) {
939
944
  const path = threadFilePath(id);
940
945
  const mtimeMs = fileMtimeMs(path);
@@ -3478,6 +3483,30 @@ var init_branch_prefix = __esm({
3478
3483
  }
3479
3484
  });
3480
3485
 
3486
+ // src/store/usage-on-limit.ts
3487
+ function isUsageOnLimit(value) {
3488
+ return value === "keep_going" || value === "confirm" || value === "switch_agent" || value === "wait_reset";
3489
+ }
3490
+ function resolveUsageOnLimit(advanced = {}) {
3491
+ if (isUsageOnLimit(advanced.usageOnLimit)) return advanced.usageOnLimit;
3492
+ if (advanced.confirmClaudeUsageOverLimit) return "confirm";
3493
+ if (advanced.orchestrationQuotaOnLimit === "wait_reset") return "wait_reset";
3494
+ if (advanced.orchestrationQuotaOnLimit === "switch_agent") return "switch_agent";
3495
+ return "keep_going";
3496
+ }
3497
+ var USAGE_ON_LIMIT_VALUES;
3498
+ var init_usage_on_limit = __esm({
3499
+ "src/store/usage-on-limit.ts"() {
3500
+ "use strict";
3501
+ USAGE_ON_LIMIT_VALUES = [
3502
+ "keep_going",
3503
+ "confirm",
3504
+ "switch_agent",
3505
+ "wait_reset"
3506
+ ];
3507
+ }
3508
+ });
3509
+
3481
3510
  // src/store/issue-source-labels.ts
3482
3511
  function issueSourceLabel(source) {
3483
3512
  if (source && source in ISSUE_SOURCE_LABELS) {
@@ -3506,6 +3535,7 @@ __export(app_settings_exports, {
3506
3535
  HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
3507
3536
  ISSUE_SOURCE_LABELS: () => ISSUE_SOURCE_LABELS,
3508
3537
  PROFILE_NOTES_MAX: () => PROFILE_NOTES_MAX,
3538
+ USAGE_ON_LIMIT_VALUES: () => USAGE_ON_LIMIT_VALUES,
3509
3539
  appSettingsPath: () => appSettingsPath,
3510
3540
  applyAppEnvironment: () => applyAppEnvironment,
3511
3541
  autoArchiveOnMergeEnabled: () => autoArchiveOnMergeEnabled,
@@ -3552,6 +3582,7 @@ __export(app_settings_exports, {
3552
3582
  isAbleTimeConnected: () => isAbleTimeConnected,
3553
3583
  isIssueSourceConnected: () => isIssueSourceConnected,
3554
3584
  isLinearConnected: () => isLinearConnected,
3585
+ isUsageOnLimit: () => isUsageOnLimit,
3555
3586
  issueSourceLabel: () => issueSourceLabel,
3556
3587
  loadAppSettings: () => loadAppSettings,
3557
3588
  maxConcurrentAgents: () => maxConcurrentAgents,
@@ -3567,6 +3598,7 @@ __export(app_settings_exports, {
3567
3598
  resolveNewThreadOptions: () => resolveNewThreadOptions,
3568
3599
  resolveOrchestratorDefaults: () => resolveOrchestratorDefaults,
3569
3600
  resolveThreadDefaults: () => resolveThreadDefaults,
3601
+ resolveUsageOnLimit: () => resolveUsageOnLimit,
3570
3602
  resolveViewerProfile: () => resolveViewerProfile,
3571
3603
  resolveViewerProfileForRepo: () => resolveViewerProfileForRepo,
3572
3604
  saveAbleTimeConnection: () => saveAbleTimeConnection,
@@ -3586,6 +3618,7 @@ __export(app_settings_exports, {
3586
3618
  updateIntegrationsSettings: () => updateIntegrationsSettings,
3587
3619
  updateOpencodeSettings: () => updateOpencodeSettings,
3588
3620
  updateProjectProfileSettings: () => updateProjectProfileSettings,
3621
+ usageOnLimit: () => usageOnLimit,
3589
3622
  writeViewerContext: () => writeViewerContext
3590
3623
  });
3591
3624
  function emptyPublicIntegrations() {
@@ -3950,6 +3983,9 @@ function normalizeAdvanced(raw) {
3950
3983
  if (typeof source.showCost === "boolean") {
3951
3984
  out.showCost = source.showCost;
3952
3985
  }
3986
+ if (isUsageOnLimit(source.usageOnLimit)) {
3987
+ out.usageOnLimit = source.usageOnLimit;
3988
+ }
3953
3989
  if (typeof source.confirmClaudeUsageOverLimit === "boolean") {
3954
3990
  out.confirmClaudeUsageOverLimit = source.confirmClaudeUsageOverLimit;
3955
3991
  }
@@ -4815,8 +4851,16 @@ function updateAdvancedSettings(patch) {
4815
4851
  if (typeof patch.showCost === "boolean") {
4816
4852
  advanced.showCost = patch.showCost;
4817
4853
  }
4818
- if (typeof patch.confirmClaudeUsageOverLimit === "boolean") {
4854
+ if (isUsageOnLimit(patch.usageOnLimit)) {
4855
+ advanced.usageOnLimit = patch.usageOnLimit;
4856
+ advanced.confirmClaudeUsageOverLimit = patch.usageOnLimit === "confirm";
4857
+ if (patch.usageOnLimit === "switch_agent" || patch.usageOnLimit === "wait_reset") {
4858
+ advanced.orchestrationQuotaOnLimit = patch.usageOnLimit;
4859
+ }
4860
+ } else if (typeof patch.confirmClaudeUsageOverLimit === "boolean") {
4819
4861
  advanced.confirmClaudeUsageOverLimit = patch.confirmClaudeUsageOverLimit;
4862
+ if (patch.confirmClaudeUsageOverLimit) advanced.usageOnLimit = "confirm";
4863
+ else if (advanced.usageOnLimit === "confirm") advanced.usageOnLimit = "keep_going";
4820
4864
  }
4821
4865
  if (typeof patch.autoArchiveOnMerge === "boolean") {
4822
4866
  advanced.autoArchiveOnMerge = patch.autoArchiveOnMerge;
@@ -4881,7 +4925,7 @@ function showCostEnabled(settings = loadAppSettings()) {
4881
4925
  return Boolean(settings.advanced.showCost);
4882
4926
  }
4883
4927
  function confirmClaudeUsageOverLimitEnabled(settings = loadAppSettings()) {
4884
- return Boolean(settings.advanced.confirmClaudeUsageOverLimit);
4928
+ return usageOnLimit(settings) === "confirm";
4885
4929
  }
4886
4930
  function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
4887
4931
  return Boolean(settings.advanced.autoArchiveOnMerge);
@@ -4889,8 +4933,12 @@ function autoArchiveOnMergeEnabled(settings = loadAppSettings()) {
4889
4933
  function autoCleanupOrphansEnabled(settings = loadAppSettings()) {
4890
4934
  return Boolean(settings.advanced.autoCleanupOrphans);
4891
4935
  }
4936
+ function usageOnLimit(settings = loadAppSettings()) {
4937
+ return resolveUsageOnLimit(settings.advanced);
4938
+ }
4892
4939
  function orchestrationQuotaOnLimit(settings = loadAppSettings()) {
4893
- return settings.advanced.orchestrationQuotaOnLimit ?? "switch_agent";
4940
+ const action = usageOnLimit(settings);
4941
+ return action === "wait_reset" ? "wait_reset" : "switch_agent";
4894
4942
  }
4895
4943
  function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
4896
4944
  const preferred = settings.advanced.orchestrationQuotaFallbackAgent;
@@ -5005,6 +5053,8 @@ var init_app_settings = __esm({
5005
5053
  init_private_file();
5006
5054
  init_secret_vault();
5007
5055
  init_branch_prefix();
5056
+ init_usage_on_limit();
5057
+ init_usage_on_limit();
5008
5058
  init_issue_source_labels();
5009
5059
  init_account_profile();
5010
5060
  HARNESS_ENV_KEYS = {
@@ -12215,6 +12265,7 @@ var init_claude_usage_client = __esm({
12215
12265
  import_node_os13 = require("os");
12216
12266
  import_node_path33 = require("path");
12217
12267
  init_run();
12268
+ init_fetch();
12218
12269
  init_app_settings();
12219
12270
  init_claude_usage();
12220
12271
  CLAUDE_USAGE_ERROR_TTL_MS = 5 * 6e4;
@@ -16456,12 +16507,18 @@ var init_fork_worktree = __esm({
16456
16507
 
16457
16508
  // src/orchestrator/quota-failover.ts
16458
16509
  function planOrchestrationQuotaFailover(thread, limitText, opts) {
16459
- if (!isOrchestratorThread(thread)) return null;
16460
16510
  if (!isSessionQuotaLimit(limitText)) return null;
16461
- const onLimit = opts?.onLimit ?? orchestrationQuotaOnLimit();
16511
+ const onLimit = opts?.onLimit ?? usageOnLimit();
16462
16512
  const resumeAt = parseSessionQuotaResetAt(limitText, opts?.now);
16513
+ if (onLimit === "keep_going" || onLimit === "confirm") {
16514
+ return {
16515
+ action: "none",
16516
+ reason: onLimit === "confirm" ? "Settings: confirm with user; no automatic continue." : "Settings: keep going; no automatic continue.",
16517
+ limitText
16518
+ };
16519
+ }
16463
16520
  if (thread.quotaContinuedFromId) {
16464
- if (resumeAt) {
16521
+ if (onLimit === "switch_agent" && resumeAt) {
16465
16522
  return {
16466
16523
  action: "wait_reset",
16467
16524
  reason: "Already continued once; waiting for quota reset instead.",
@@ -16471,7 +16528,7 @@ function planOrchestrationQuotaFailover(thread, limitText, opts) {
16471
16528
  }
16472
16529
  return {
16473
16530
  action: "none",
16474
- reason: "Already continued once; no parseable reset time.",
16531
+ reason: "Already continued once; no further automatic continue.",
16475
16532
  limitText
16476
16533
  };
16477
16534
  }
@@ -16508,8 +16565,19 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
16508
16565
  const text7 = m.text.trim().replace(/\s+/g, " ").slice(0, 280);
16509
16566
  return text7 ? `- ${role}: ${text7}` : null;
16510
16567
  }).filter(Boolean);
16568
+ const orch = isOrchestratorThread(from);
16569
+ const instructions = orch ? [
16570
+ "- Continue fleet orchestration from this handoff.",
16571
+ "- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.",
16572
+ "- Leave model Auto unless there is a specific reason to pin one.",
16573
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
16574
+ ] : [
16575
+ "- Continue this worktree chat from the handoff.",
16576
+ "- Leave model Auto unless there is a specific reason to pin one.",
16577
+ `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
16578
+ ];
16511
16579
  const body = [
16512
- `# Orchestration handoff`,
16580
+ `# ${orch ? "Orchestration" : "Chat"} handoff`,
16513
16581
  "",
16514
16582
  `Previous chat: ${from.title} (\`${from.id}\`) on **${from.agent}** hit a session/usage limit.`,
16515
16583
  `Limit: ${limitText.trim()}`,
@@ -16525,14 +16593,11 @@ function buildQuotaHandoffAttachment(from, limitText, fallbackAgent) {
16525
16593
  recent.length ? recent.join("\n") : "(none)",
16526
16594
  "",
16527
16595
  `## Instructions`,
16528
- `- Continue fleet orchestration from this handoff.`,
16529
- `- Prefer Sideboard MCP (list_board, list_threads, get_thread, send_to_thread, \u2026) for live status.`,
16530
- `- Leave model Auto unless there is a specific reason to pin one.`,
16531
- `- Do not wait on the limited ${from.agent} account; keep going on ${fallbackAgent}.`
16596
+ ...instructions
16532
16597
  ].join("\n");
16533
16598
  return {
16534
16599
  id: (0, import_node_crypto9.randomUUID)(),
16535
- name: "Orchestration quota handoff.md",
16600
+ name: orch ? "Orchestration quota handoff.md" : "Quota handoff.md",
16536
16601
  kind: "transcript",
16537
16602
  content: body
16538
16603
  };
@@ -16545,12 +16610,15 @@ function createQuotaFailoverChat(from, fallbackAgent, limitText) {
16545
16610
  model: null,
16546
16611
  attachments: [handoff]
16547
16612
  });
16548
- return updateThread(tab.id, {
16549
- parentThreadId: from.id,
16613
+ const patch = {
16550
16614
  quotaContinuedFromId: from.id,
16551
- sourceRef: from.sourceRef,
16552
- sourceType: "orchestration"
16553
- });
16615
+ sourceRef: from.sourceRef
16616
+ };
16617
+ if (isOrchestratorThread(from)) {
16618
+ patch.parentThreadId = from.id;
16619
+ patch.sourceType = "orchestration";
16620
+ }
16621
+ return updateThread(tab.id, patch);
16554
16622
  }
16555
16623
  var import_node_crypto9, QUOTA_CONTINUE_PROMPT, QUOTA_RESUME_PROMPT;
16556
16624
  var init_quota_failover = __esm({
@@ -16563,10 +16631,10 @@ var init_quota_failover = __esm({
16563
16631
  init_thread_store();
16564
16632
  init_chat_tabs();
16565
16633
  QUOTA_CONTINUE_PROMPT = (fromAgent, fallback) => [
16566
- `${fromAgent} hit a session/usage limit. Continue this orchestration on ${fallback} using the attached handoff.`,
16567
- "Call list_board or list_threads for live fleet status, then proceed with the goal. Leave model Auto unless needed."
16634
+ `${fromAgent} hit a session/usage limit. Continue this chat on ${fallback} using the attached handoff.`,
16635
+ "Proceed with the goal. Leave model Auto unless needed."
16568
16636
  ].join(" ");
16569
- 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.";
16637
+ QUOTA_RESUME_PROMPT = "Session/usage limit window should have reset. Continue this chat from where you left off.";
16570
16638
  }
16571
16639
  });
16572
16640
 
@@ -20083,8 +20151,8 @@ var init_orchestrator = __esm({
20083
20151
  await this.send(threadId, QUOTA_RESUME_PROMPT);
20084
20152
  }
20085
20153
  /**
20086
- * Host-side continue when an orchestration chat hits a provider session/usage
20087
- * limit (not context size): switch agent (Auto) or wait until reset.
20154
+ * Host-side continue when any chat hits a provider session/usage limit
20155
+ * (not context size): switch agent (Auto) or wait until reset.
20088
20156
  */
20089
20157
  async maybeHandleOrchestrationQuotaFailover(threadId, limitText) {
20090
20158
  const thread = findThreadByRef(threadId);
@@ -20097,7 +20165,7 @@ var init_orchestrator = __esm({
20097
20165
  setStatus(threadId, "idle", null);
20098
20166
  appendMessage(threadId, {
20099
20167
  role: "agent",
20100
- text: `Sideboard will auto-retry this orchestration around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
20168
+ text: `Sideboard will auto-retry this chat around ${plan.resumeAt.toLocaleString()} when the session limit resets.`,
20101
20169
  ts: (/* @__PURE__ */ new Date()).toISOString()
20102
20170
  });
20103
20171
  this.emit({
@@ -38,7 +38,7 @@ import {
38
38
  syncBoardPins,
39
39
  updateSchedule,
40
40
  waitForDetachedJob
41
- } from "../chunk-CTABTALL.js";
41
+ } from "../chunk-EXZMNINM.js";
42
42
  import "../chunk-YWI3IBP2.js";
43
43
  import {
44
44
  applySystemCaEnv,
@@ -48,12 +48,12 @@ import {
48
48
  materializeSystemCaBundle,
49
49
  sideboardMcpProfile,
50
50
  trustSystemCertificates
51
- } from "../chunk-DU2ICKLA.js";
51
+ } from "../chunk-3TOGAUQT.js";
52
52
  import {
53
53
  GLOBAL_WORKSPACE_ID,
54
54
  isCloudCoordinatorThread,
55
55
  listWorkspaces
56
- } from "../chunk-S4EEYOSU.js";
56
+ } from "../chunk-54RSAMBH.js";
57
57
  import "../chunk-3OHR73VK.js";
58
58
  import "../chunk-Y4MIXGPA.js";
59
59
  import {
@@ -67,7 +67,7 @@ import {
67
67
  searchAbleTimeTasks,
68
68
  toAbleTimeIssueInfo,
69
69
  updateAbleTimeTask
70
- } from "../chunk-PTAMHXBT.js";
70
+ } from "../chunk-PGQGP4FD.js";
71
71
  import {
72
72
  httpFetch
73
73
  } from "../chunk-VKQGAWHY.js";
@@ -82,9 +82,9 @@ import {
82
82
  resolveListPrsOptions,
83
83
  resolveRepoRoot,
84
84
  warmGithubAgentAuth
85
- } from "../chunk-QFABSE3Q.js";
85
+ } from "../chunk-RPX6VDW7.js";
86
86
  import "../chunk-D6JWYJ4P.js";
87
- import "../chunk-CJFBSQIB.js";
87
+ import "../chunk-INNLWYXW.js";
88
88
  import "../chunk-SYFVUF2C.js";
89
89
  import {
90
90
  gh,
@@ -103,7 +103,7 @@ import {
103
103
  resolveViewerProfileForRepo,
104
104
  saveLinearOAuth,
105
105
  writeViewerContext
106
- } from "../chunk-HQKGK4KO.js";
106
+ } from "../chunk-ISV5IFH3.js";
107
107
  import "../chunk-NSTQ6QKD.js";
108
108
  import "../chunk-KGZBYWZ3.js";
109
109
  import {
@@ -3878,7 +3878,7 @@ async function startMcpServer() {
3878
3878
  );
3879
3879
  }
3880
3880
  try {
3881
- const { maxConcurrentAgents } = await import("../app-settings-FMTDH5RD.js");
3881
+ const { maxConcurrentAgents } = await import("../app-settings-V6IHESEQ.js");
3882
3882
  orch.setMaxConcurrent(maxConcurrentAgents());
3883
3883
  } catch {
3884
3884
  }
@@ -4193,7 +4193,7 @@ async function startMcpServer() {
4193
4193
  registerConnectedIssueVendorTools(server);
4194
4194
  registerScheduleTools(server);
4195
4195
  const { getCaffeinateHold, setCaffeinateHold } = await import("../caffeinate-hold-OK4JJ5PP.js");
4196
- const { resolveNewThreadOptions, resolveThreadDefaults } = await import("../app-settings-FMTDH5RD.js");
4196
+ const { resolveNewThreadOptions, resolveThreadDefaults } = await import("../app-settings-V6IHESEQ.js");
4197
4197
  const accountDefaults = resolveThreadDefaults();
4198
4198
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
4199
4199
  server.tool(
@@ -9,20 +9,20 @@ import {
9
9
  resolveSendFollowUp,
10
10
  startOrchestration,
11
11
  waitForPidExit
12
- } from "./chunk-CTABTALL.js";
12
+ } from "./chunk-EXZMNINM.js";
13
13
  import "./chunk-YWI3IBP2.js";
14
- import "./chunk-DU2ICKLA.js";
15
- import "./chunk-S4EEYOSU.js";
14
+ import "./chunk-3TOGAUQT.js";
15
+ import "./chunk-54RSAMBH.js";
16
16
  import "./chunk-3OHR73VK.js";
17
17
  import "./chunk-Y4MIXGPA.js";
18
18
  import "./chunk-VKQGAWHY.js";
19
19
  import "./chunk-JFOPOMK7.js";
20
- import "./chunk-QFABSE3Q.js";
20
+ import "./chunk-RPX6VDW7.js";
21
21
  import "./chunk-D6JWYJ4P.js";
22
- import "./chunk-CJFBSQIB.js";
22
+ import "./chunk-INNLWYXW.js";
23
23
  import "./chunk-SYFVUF2C.js";
24
24
  import "./chunk-FNQNJOHY.js";
25
- import "./chunk-HQKGK4KO.js";
25
+ import "./chunk-ISV5IFH3.js";
26
26
  import "./chunk-NSTQ6QKD.js";
27
27
  import "./chunk-KGZBYWZ3.js";
28
28
  import "./chunk-EQNRWDLN.js";
@@ -7,11 +7,11 @@ import {
7
7
  resolveSendFollowUp,
8
8
  startOrchestration,
9
9
  waitForPidExit
10
- } from "./chunk-PPVN3APP.js";
10
+ } from "./chunk-AHPIU2VP.js";
11
11
  import "./chunk-DJU54RYW.js";
12
- import "./chunk-KI4YI72Y.js";
13
- import "./chunk-BLOKJY4U.js";
14
- import "./chunk-DU4ID3DA.js";
12
+ import "./chunk-RV3ZKE4Y.js";
13
+ import "./chunk-LJHC62LZ.js";
14
+ import "./chunk-STPZQR5B.js";
15
15
  import "./chunk-6K64FJDD.js";
16
16
  import "./chunk-QQKDGPUI.js";
17
17
  import "./chunk-SALM35KD.js";
@@ -19,12 +19,12 @@ import "./chunk-AN3THU7F.js";
19
19
  import "./chunk-N7WZ6NIN.js";
20
20
  import "./chunk-AXQ4ZWHK.js";
21
21
  import "./chunk-CQ5R3VPP.js";
22
- import "./chunk-2IQ6W47G.js";
22
+ import "./chunk-CXFW5LIH.js";
23
23
  import "./chunk-4TR3HZFT.js";
24
24
  import "./chunk-WDRMZKVB.js";
25
25
  import "./chunk-4TYXWPAJ.js";
26
26
  import "./chunk-JT7R45JB.js";
27
- import "./chunk-KJBYIIJU.js";
27
+ import "./chunk-DFUES6QU.js";
28
28
  import "./chunk-77WWLBCI.js";
29
29
  import "./chunk-WFUDY6PC.js";
30
30
  import "./chunk-UFHNSFAS.js";
@@ -4,6 +4,7 @@ import {
4
4
  deleteThreadRecord,
5
5
  findThreadByRef,
6
6
  invalidateThreadListCache,
7
+ invalidateThreadRecord,
7
8
  isThreadRecordFile,
8
9
  listThreads,
9
10
  normalizeThread,
@@ -13,7 +14,7 @@ import {
13
14
  updateThread,
14
15
  withThreadLock,
15
16
  writeThread
16
- } from "./chunk-KJBYIIJU.js";
17
+ } from "./chunk-DFUES6QU.js";
17
18
  import "./chunk-77WWLBCI.js";
18
19
  import "./chunk-WFUDY6PC.js";
19
20
  export {
@@ -22,6 +23,7 @@ export {
22
23
  deleteThreadRecord,
23
24
  findThreadByRef,
24
25
  invalidateThreadListCache,
26
+ invalidateThreadRecord,
25
27
  isThreadRecordFile,
26
28
  listThreads,
27
29
  normalizeThread,