@sideboard-ai/core 0.1.325 → 0.1.326

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 (66) hide show
  1. package/dist/{abletime-VL234MCP.js → abletime-RDHYSZL2.js} +4 -4
  2. package/dist/{abletime-M7STTMZT.js → abletime-RYYFGKMU.js} +4 -4
  3. package/dist/{abletime-oauth-LMMGMAPA.js → abletime-oauth-OYGS2DAU.js} +3 -3
  4. package/dist/{abletime-oauth-P4ZFBEAL.js → abletime-oauth-QR2QDVMK.js} +3 -3
  5. package/dist/{abletime-rest-GOI7HELR.js → abletime-rest-BKYKNPTC.js} +3 -3
  6. package/dist/{abletime-rest-DLV7EIWS.js → abletime-rest-QDPTWNS4.js} +3 -3
  7. package/dist/agents/cursor-runner.cjs +1 -1
  8. package/dist/agents/cursor-runner.js +1 -1
  9. package/dist/{agents-LDRM3BTY.js → agents-HANWZNI6.js} +6 -6
  10. package/dist/{agents-MBIEAETM.js → agents-QO7GKBYT.js} +7 -7
  11. package/dist/{app-settings-UQHUNOLV.js → app-settings-RXBH7KY4.js} +1 -1
  12. package/dist/{app-settings-E7DMMEKC.js → app-settings-TUVLZNDE.js} +1 -1
  13. package/dist/{chunk-GNLKBS3U.js → chunk-2EOLWHXH.js} +18 -18
  14. package/dist/{chunk-BOFYI6LC.js → chunk-3Q4XNYHY.js} +1 -1
  15. package/dist/{chunk-WYEST76H.js → chunk-46FECFZU.js} +15 -12
  16. package/dist/{chunk-SK6NYGPD.js → chunk-4H5MWZ6J.js} +2 -2
  17. package/dist/{chunk-EO6ZFLG6.js → chunk-75RPUXJS.js} +1 -1
  18. package/dist/{chunk-2UP3XD2D.js → chunk-B244TJWC.js} +2 -2
  19. package/dist/{chunk-MFMDZAA6.js → chunk-BBNWKL4I.js} +15 -11
  20. package/dist/{chunk-ZEUMWHOH.js → chunk-C7HUCBX7.js} +5 -5
  21. package/dist/{chunk-CI4M54LS.js → chunk-D744HOI5.js} +3 -1
  22. package/dist/{chunk-APKUI4BP.js → chunk-FWVUGLBG.js} +2 -2
  23. package/dist/{chunk-SACHHTBJ.js → chunk-GP3RLZ6A.js} +20 -20
  24. package/dist/{chunk-AQEKPJWU.js → chunk-JM2TGOHP.js} +5 -5
  25. package/dist/{chunk-A76MKMSF.js → chunk-K7M7MIWL.js} +3 -3
  26. package/dist/{chunk-BTF3ATST.js → chunk-KECHK3ZT.js} +1 -1
  27. package/dist/{chunk-H36GKGU2.js → chunk-KXRF6RNL.js} +2 -2
  28. package/dist/{chunk-EZR6W4B3.js → chunk-LRHUBGEM.js} +1 -1
  29. package/dist/{chunk-F65JMKUR.js → chunk-MAW7DIG7.js} +2 -2
  30. package/dist/{chunk-U5WO6MEB.js → chunk-NURZOXGN.js} +1 -1
  31. package/dist/{chunk-NWGINMEA.js → chunk-PB6HW7SA.js} +3 -3
  32. package/dist/{chunk-HG6KS7OT.js → chunk-QG4CYRA3.js} +15 -11
  33. package/dist/{chunk-RZJTGBXY.js → chunk-QPSKQP6E.js} +2 -1
  34. package/dist/{chunk-SS6CYGLF.js → chunk-RZVOX2MT.js} +3 -3
  35. package/dist/{chunk-7LUOLYFM.js → chunk-SO7G6O24.js} +1 -1
  36. package/dist/{chunk-PPTJMBUY.js → chunk-TMCK5TLA.js} +1 -1
  37. package/dist/{chunk-MBT6WDAB.js → chunk-WUCAVIIP.js} +1 -1
  38. package/dist/{chunk-7G27TB4M.js → chunk-XLVLMQKN.js} +11 -7
  39. package/dist/{chunk-ZHDXLDLA.js → chunk-YGVGXQA7.js} +2 -2
  40. package/dist/{chunk-VAFQS4D2.js → chunk-YWQF7WAG.js} +2 -2
  41. package/dist/{chunk-SQQBU7Z6.js → chunk-ZUAYA57W.js} +2 -2
  42. package/dist/{conductor-KB7L7NQN.js → conductor-4GVTHUUB.js} +4 -4
  43. package/dist/{conductor-D4KFZF54.js → conductor-TGWI6ETZ.js} +4 -4
  44. package/dist/{coordinator-prompt-OBXEC63K.js → coordinator-prompt-3E6SIDTM.js} +3 -3
  45. package/dist/{coordinator-prompt-SUO4FRY3.js → coordinator-prompt-WEYJREV6.js} +3 -3
  46. package/dist/{global-workspace-UHU2FXTY.js → global-workspace-FPDZKUPF.js} +3 -3
  47. package/dist/{global-workspace-Z2SURNHA.js → global-workspace-UIEXAG2B.js} +3 -3
  48. package/dist/index.cjs +20 -14
  49. package/dist/index.d.cts +11 -8
  50. package/dist/index.d.ts +11 -8
  51. package/dist/index.js +21 -21
  52. package/dist/{linear-SIHEBU3X.js → linear-6S7MK5YK.js} +2 -2
  53. package/dist/{linear-HFUOUJ5H.js → linear-Z2T4KUAQ.js} +2 -2
  54. package/dist/{linear-list-63I7QUC6.js → linear-list-A37WLUBO.js} +1 -1
  55. package/dist/{linear-list-JFV3EES6.js → linear-list-Q4M7AZO2.js} +1 -1
  56. package/dist/mcp/run-stdio.cjs +15 -8
  57. package/dist/mcp/run-stdio.js +15 -15
  58. package/dist/{optional-cli-U2GUA2X6.js → optional-cli-AANBL4U5.js} +3 -3
  59. package/dist/{optional-cli-ULDP3O5S.js → optional-cli-CA4LL322.js} +4 -4
  60. package/dist/{orchestrator-3H4KNGPN.js → orchestrator-7FVDBE7Y.js} +10 -10
  61. package/dist/{orchestrator-6ROMEWBP.js → orchestrator-RQXRZW7Z.js} +9 -9
  62. package/dist/{workspaces-MG5JHRKW.js → workspaces-LEW4UP56.js} +3 -3
  63. package/dist/{workspaces-QJNKEGEM.js → workspaces-QONNLHNR.js} +3 -3
  64. package/dist/{worktree-KSJPTHGZ.js → worktree-6GIONDQO.js} +2 -2
  65. package/dist/{worktree-MYJYUHZM.js → worktree-KFEJAQ2H.js} +2 -2
  66. package/package.json +1 -1
@@ -531,10 +531,11 @@ function applyTurnUsage(current, incoming, scope = "request") {
531
531
  ...incoming.sessionCostUsd != null ? { sessionCostUsd: incoming.sessionCostUsd } : {}
532
532
  };
533
533
  }
534
+ const explicit = incoming.lastRequestTokens != null && incoming.lastRequestTokens > 0 ? incoming.lastRequestTokens : void 0;
534
535
  return {
535
536
  ...incoming,
536
537
  costUsd: incoming.costUsd ?? current?.costUsd,
537
- lastRequestTokens: current?.lastRequestTokens ?? requestOccupancy(incoming),
538
+ lastRequestTokens: current?.lastRequestTokens ?? explicit,
538
539
  ...incoming.sessionCostUsd == null && current?.sessionCostUsd != null ? { sessionCostUsd: current.sessionCostUsd } : {}
539
540
  };
540
541
  }
@@ -2390,6 +2391,7 @@ export {
2390
2391
  formatViewerContextDirective,
2391
2392
  formatViewerContextReminder,
2392
2393
  fromInclusiveInputUsage,
2394
+ requestOccupancy,
2393
2395
  subtractUsage,
2394
2396
  sumUsageList,
2395
2397
  applyTurnUsage,
@@ -5,7 +5,7 @@ import {
5
5
  resolveGithubRepoSlug,
6
6
  resolveOriginRemote,
7
7
  resolveRepoRoot
8
- } from "./chunk-BTF3ATST.js";
8
+ } from "./chunk-KECHK3ZT.js";
9
9
  import {
10
10
  allocateTeamName,
11
11
  createEmptyThread,
@@ -31,7 +31,7 @@ import {
31
31
  resolveThreadDefaults,
32
32
  resolveViewerProfile,
33
33
  resolveViewerProfileForRepo
34
- } from "./chunk-RZJTGBXY.js";
34
+ } from "./chunk-QPSKQP6E.js";
35
35
  import {
36
36
  appDataDir,
37
37
  globalAgentCwd,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatOptionalServicesDirectiveForTurn,
3
3
  formatOptionalServicesReminderForTurn
4
- } from "./chunk-2UP3XD2D.js";
4
+ } from "./chunk-B244TJWC.js";
5
5
  import {
6
6
  extractPresentedPlan,
7
7
  isPresentPlanToolName,
@@ -21,7 +21,7 @@ import {
21
21
  parseSessionQuotaResetAt,
22
22
  planModeTurnInstruction,
23
23
  resolveQuotaFallbackAgent
24
- } from "./chunk-MFMDZAA6.js";
24
+ } from "./chunk-BBNWKL4I.js";
25
25
  import {
26
26
  applyWorktreePkgCacheEnv,
27
27
  askBlockStillWaiting,
@@ -59,7 +59,7 @@ import {
59
59
  worktreeDevProcessKey,
60
60
  worktreeRunProcessKey,
61
61
  worktreeSetupProcessKey
62
- } from "./chunk-WYEST76H.js";
62
+ } from "./chunk-46FECFZU.js";
63
63
  import {
64
64
  applyAgentEvent,
65
65
  clipAgentEventForPaint,
@@ -102,7 +102,7 @@ import {
102
102
  stageAbsolutePathsAsAttachments,
103
103
  stageBuffersAsAttachments,
104
104
  syncWorkspacesFromThreads
105
- } from "./chunk-APKUI4BP.js";
105
+ } from "./chunk-FWVUGLBG.js";
106
106
  import {
107
107
  addPrStackLayer,
108
108
  allocateTeamSlug,
@@ -153,7 +153,7 @@ import {
153
153
  resolveRepoRoot,
154
154
  switchWorktreeBranch,
155
155
  withRepoGitLock
156
- } from "./chunk-BTF3ATST.js";
156
+ } from "./chunk-KECHK3ZT.js";
157
157
  import {
158
158
  REVIEW_TAB_TITLE,
159
159
  agentNicknameFromWorktreePath,
@@ -192,7 +192,7 @@ import {
192
192
  import {
193
193
  applyAgentRunnerHeapEnv,
194
194
  packagedMcpDir
195
- } from "./chunk-U5WO6MEB.js";
195
+ } from "./chunk-NURZOXGN.js";
196
196
  import {
197
197
  fallbackTurnFailDetail,
198
198
  formatAgentErrorContinuePrompt,
@@ -252,7 +252,7 @@ import {
252
252
  usageOnLimit,
253
253
  withTurnScopedCost,
254
254
  writeViewerContext
255
- } from "./chunk-RZJTGBXY.js";
255
+ } from "./chunk-QPSKQP6E.js";
256
256
  import {
257
257
  normalizeThinkingEffort
258
258
  } from "./chunk-77WWLBCI.js";
@@ -518,9 +518,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
518
518
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
519
519
  );
520
520
  }
521
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-Z2SURNHA.js");
521
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-UIEXAG2B.js");
522
522
  if (isGlobalThread2(thread)) {
523
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-OBXEC63K.js");
523
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-3E6SIDTM.js");
524
524
  ensureGlobalCoordinatorCwd2(
525
525
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
526
526
  );
@@ -3163,7 +3163,7 @@ async function createThread(input, _onSetupLine) {
3163
3163
  });
3164
3164
  await requireAgent(resolved.agent);
3165
3165
  if (input.cowboy) {
3166
- const { cowboyModeEnabled } = await import("./app-settings-UQHUNOLV.js");
3166
+ const { cowboyModeEnabled } = await import("./app-settings-RXBH7KY4.js");
3167
3167
  if (!cowboyModeEnabled()) {
3168
3168
  throw new Error(
3169
3169
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3222,7 +3222,7 @@ async function createThread(input, _onSetupLine) {
3222
3222
  let sourceIsFork = false;
3223
3223
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3224
3224
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3225
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-VL234MCP.js");
3225
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-RDHYSZL2.js");
3226
3226
  const task = await ensureAbleTimeTask({
3227
3227
  title: title?.trim() || "Untitled work",
3228
3228
  description: input.prompt?.trim() || void 0
@@ -3333,7 +3333,7 @@ async function createThread(input, _onSetupLine) {
3333
3333
  return readThread(thread.id) ?? thread;
3334
3334
  }
3335
3335
  async function listLinearIssues(agent, repoPath) {
3336
- const { getAdapter: getAdapter2 } = await import("./agents-MBIEAETM.js");
3336
+ const { getAdapter: getAdapter2 } = await import("./agents-QO7GKBYT.js");
3337
3337
  await requireAgent(agent, { requireLinear: true });
3338
3338
  const adapter = getAdapter2(agent);
3339
3339
  if (!adapter.listLinearIssues) {
@@ -4116,7 +4116,7 @@ async function adoptThread(input) {
4116
4116
  messages: input.messages ?? []
4117
4117
  });
4118
4118
  writeThread(thread);
4119
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-QJNKEGEM.js");
4119
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-QONNLHNR.js");
4120
4120
  await addWorkspace2(repoPath);
4121
4121
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-INRDQFWV.js");
4122
4122
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -7511,7 +7511,7 @@ function formatScheduledPrompt(name, prompt) {
7511
7511
  ${prompt}`;
7512
7512
  }
7513
7513
  async function defaultDeps() {
7514
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-3H4KNGPN.js");
7514
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-7FVDBE7Y.js");
7515
7515
  const orch = getOrchestrator2();
7516
7516
  return {
7517
7517
  findThread: (id) => findThreadByRef(id),
@@ -7862,7 +7862,7 @@ var Orchestrator = class {
7862
7862
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7863
7863
  });
7864
7864
  }
7865
- const { autoCleanupOrphansEnabled } = await import("./app-settings-UQHUNOLV.js");
7865
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-RXBH7KY4.js");
7866
7866
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7867
7867
  await cleanupOrphanWorktrees({ repoPaths });
7868
7868
  }
@@ -8256,7 +8256,7 @@ var Orchestrator = class {
8256
8256
  }
8257
8257
  await setup;
8258
8258
  if (skipSetup) return;
8259
- const { autoRunAfterSetupEnabled } = await import("./app-settings-UQHUNOLV.js");
8259
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-RXBH7KY4.js");
8260
8260
  if (autoRunAfterSetupEnabled()) {
8261
8261
  try {
8262
8262
  await this.startDev(threadId);
@@ -8641,7 +8641,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
8641
8641
  }
8642
8642
  const isBrightsy = fresh.agent === "brightsy";
8643
8643
  const isOrchestration = isOrchestratorThread(fresh);
8644
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-UQHUNOLV.js");
8644
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-RXBH7KY4.js");
8645
8645
  const gitAuthMode = getGithubGitAuthMode();
8646
8646
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
8647
8647
  githubSlug: turnOrigin?.forge === "github" ? turnOrigin.slug : await withTimeout(resolveGithubRepoSlug(fresh.worktreePath), 8e3, "resolveGithubRepoSlug").catch(() => null),
@@ -9981,7 +9981,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9981
9981
  if (Object.keys(patch).length === 0) continue;
9982
9982
  updateThread(t.id, patch);
9983
9983
  }
9984
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-UQHUNOLV.js");
9984
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-RXBH7KY4.js");
9985
9985
  const latest = this.requireThread(thread.id);
9986
9986
  if (!shouldAutoArchiveOnPrMerge({
9987
9987
  previousPrState: prevState || null,
@@ -10305,7 +10305,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10305
10305
  await runArchiveScript(thread.repoPath, thread.worktreePath);
10306
10306
  } catch {
10307
10307
  }
10308
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-UQHUNOLV.js");
10308
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-RXBH7KY4.js");
10309
10309
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
10310
10310
  await removeWorktree(thread.repoPath, thread.worktreePath, {
10311
10311
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -10443,7 +10443,7 @@ async function startOrchestration(opts) {
10443
10443
  sourceRef: "default",
10444
10444
  ...createOpts
10445
10445
  }).catch(async () => {
10446
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-KSJPTHGZ.js");
10446
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-6GIONDQO.js");
10447
10447
  const repo = await resolveRepoRoot2(repoPath);
10448
10448
  const def = await resolveDefaultBranch2(repo);
10449
10449
  return orch.createThread({
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  getAbleTimeHost,
8
8
  isAbleTimeConnected
9
- } from "./chunk-CI4M54LS.js";
9
+ } from "./chunk-D744HOI5.js";
10
10
 
11
11
  // src/integrations/abletime-mcp.ts
12
12
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -155,7 +155,7 @@ function textsFromUnknown(value) {
155
155
  return "";
156
156
  }
157
157
  async function abletimeMcpRequest(method, params, opts) {
158
- const rawToken = opts?.token ?? await import("./abletime-oauth-P4ZFBEAL.js").then((m) => m.ensureAbleTimeAccessToken());
158
+ const rawToken = opts?.token ?? await import("./abletime-oauth-QR2QDVMK.js").then((m) => m.ensureAbleTimeAccessToken());
159
159
  if (!rawToken?.trim()) {
160
160
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
161
161
  }
@@ -226,9 +226,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
226
226
  if (!opts?.token && !isAbleTimeConnected()) {
227
227
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
228
228
  }
229
- const rawToken = opts?.token ?? await import("./abletime-oauth-P4ZFBEAL.js").then((m) => m.ensureAbleTimeAccessToken());
229
+ const rawToken = opts?.token ?? await import("./abletime-oauth-QR2QDVMK.js").then((m) => m.ensureAbleTimeAccessToken());
230
230
  if (rawToken && ableTimeUsesRest(rawToken)) {
231
- const { callAbleTimeRestTool } = await import("./abletime-rest-DLV7EIWS.js");
231
+ const { callAbleTimeRestTool } = await import("./abletime-rest-QDPTWNS4.js");
232
232
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
233
233
  }
234
234
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -244,7 +244,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
244
244
  return await call();
245
245
  }
246
246
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
247
- const { callAbleTimeRestTool } = await import("./abletime-rest-DLV7EIWS.js");
247
+ const { callAbleTimeRestTool } = await import("./abletime-rest-QDPTWNS4.js");
248
248
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
249
249
  }
250
250
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  abletimeRestUrl,
5
5
  textFromAbleTimeDoc
6
- } from "./chunk-VAFQS4D2.js";
6
+ } from "./chunk-YWQF7WAG.js";
7
7
  import {
8
8
  assertAbleTimeCredential,
9
9
  callAbleTimeTool,
10
10
  normalizeAbleTimeHost,
11
11
  rewriteAbleTimeError
12
- } from "./chunk-AQEKPJWU.js";
12
+ } from "./chunk-JM2TGOHP.js";
13
13
  import {
14
14
  downloadAuthenticatedFile,
15
15
  extractHttpUrls,
@@ -27,7 +27,7 @@ import {
27
27
  getAbleTimeHost,
28
28
  isAbleTimeConnected,
29
29
  saveAbleTimeConnection
30
- } from "./chunk-CI4M54LS.js";
30
+ } from "./chunk-D744HOI5.js";
31
31
 
32
32
  // src/integrations/abletime-attachments.ts
33
33
  function asRecord(value) {
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  getGithubGitAuthMode,
27
27
  getGithubPat
28
- } from "./chunk-RZJTGBXY.js";
28
+ } from "./chunk-QPSKQP6E.js";
29
29
  import {
30
30
  worktreesRoot
31
31
  } from "./chunk-H4UEFJRI.js";
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-ZEUMWHOH.js";
7
+ } from "./chunk-C7HUCBX7.js";
8
8
  import {
9
9
  httpFetch
10
10
  } from "./chunk-JAT3JFOS.js";
11
11
  import {
12
12
  getAbleTimeAccessToken,
13
13
  getAbleTimeHost
14
- } from "./chunk-RZJTGBXY.js";
14
+ } from "./chunk-QPSKQP6E.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -18,7 +18,7 @@ import {
18
18
  disconnectLinearConnection,
19
19
  loadAppSettings,
20
20
  saveLinearOAuth
21
- } from "./chunk-CI4M54LS.js";
21
+ } from "./chunk-D744HOI5.js";
22
22
 
23
23
  // src/integrations/linear-oauth.ts
24
24
  import { createHash, randomBytes } from "crypto";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-YBTSZ2SW.js";
10
10
  import {
11
11
  resolveAgentExecutable
12
- } from "./chunk-CI4M54LS.js";
12
+ } from "./chunk-D744HOI5.js";
13
13
 
14
14
  // src/agents/install.ts
15
15
  import { existsSync } from "fs";
@@ -267,7 +267,7 @@ async function loginAgent(agent) {
267
267
  };
268
268
  }
269
269
  async function loginManagedAccount(accountId) {
270
- const { loadAppSettings } = await import("./app-settings-E7DMMEKC.js");
270
+ const { loadAppSettings } = await import("./app-settings-TUVLZNDE.js");
271
271
  const { loginEnvPrefix } = await import("./managed-accounts-PITLFLKU.js");
272
272
  const account = loadAppSettings().accounts.accounts.find((a) => a.id === accountId);
273
273
  if (!account) {
@@ -757,7 +757,7 @@ function cursorSdkMessageToEvents(msg) {
757
757
  }
758
758
  if (msg.type === "usage") {
759
759
  const usage = usageFromCursor(msg.usage);
760
- if (usage) return [{ type: "usage", data: usage, scope: "request" }];
760
+ if (usage) return [{ type: "usage", data: usage, scope: "turn" }];
761
761
  }
762
762
  if (msg.type === "status" && msg.status === "ERROR") {
763
763
  const rawMessage = msg.message;
@@ -10,13 +10,13 @@ import {
10
10
  import {
11
11
  abletimeRestUrl,
12
12
  textFromAbleTimeDoc
13
- } from "./chunk-H36GKGU2.js";
13
+ } from "./chunk-KXRF6RNL.js";
14
14
  import {
15
15
  assertAbleTimeCredential,
16
16
  callAbleTimeTool,
17
17
  normalizeAbleTimeHost,
18
18
  rewriteAbleTimeError
19
- } from "./chunk-ZEUMWHOH.js";
19
+ } from "./chunk-C7HUCBX7.js";
20
20
  import {
21
21
  httpFetch
22
22
  } from "./chunk-JAT3JFOS.js";
@@ -25,7 +25,7 @@ import {
25
25
  getAbleTimeHost,
26
26
  isAbleTimeConnected,
27
27
  saveAbleTimeConnection
28
- } from "./chunk-RZJTGBXY.js";
28
+ } from "./chunk-QPSKQP6E.js";
29
29
 
30
30
  // src/integrations/abletime-attachments.ts
31
31
  function asRecord(value) {
@@ -12,13 +12,13 @@ import {
12
12
  } from "./chunk-5MXLDDYF.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-ZHDXLDLA.js";
15
+ } from "./chunk-YGVGXQA7.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
19
19
  resolveAgentGitAuthEnv,
20
20
  resolveCodexGitWritableRoots
21
- } from "./chunk-EO6ZFLG6.js";
21
+ } from "./chunk-75RPUXJS.js";
22
22
  import {
23
23
  applyConnectedTeamToCli,
24
24
  brightsyMcpServerName,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-2GPQZZLY.js";
34
34
  import {
35
35
  listAssignedLinearIssues
36
- } from "./chunk-MBT6WDAB.js";
36
+ } from "./chunk-WUCAVIIP.js";
37
37
  import {
38
38
  githubAgentAuthReady,
39
39
  npmGlobalNodeModules,
@@ -46,9 +46,10 @@ import {
46
46
  isLinearConnected,
47
47
  isPosthogConnected,
48
48
  loadAppSettings,
49
+ requestOccupancy,
49
50
  resolveAgentExecutable,
50
51
  resolveClaudeExecutable
51
- } from "./chunk-CI4M54LS.js";
52
+ } from "./chunk-D744HOI5.js";
52
53
  import {
53
54
  isElectronLikeCommand,
54
55
  unwrapStrippedElectronLaunch,
@@ -2965,7 +2966,7 @@ var claudeAdapter = {
2965
2966
  );
2966
2967
  }
2967
2968
  const mode = permissionMode(thread);
2968
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-UHU2FXTY.js");
2969
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-FPDZKUPF.js");
2969
2970
  const isOrchestrator = isOrchestratorThread2(thread);
2970
2971
  const rpc = worktreeAgentRpc(isOrchestrator);
2971
2972
  const injectedServers = await buildInjectedMcpServers({
@@ -3192,7 +3193,7 @@ var claudeAdapter = {
3192
3193
  return { file: claude, args, cwd: thread.worktreePath };
3193
3194
  },
3194
3195
  async listLinearIssues(_repoPath) {
3195
- const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-JFV3EES6.js");
3196
+ const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-Q4M7AZO2.js");
3196
3197
  return listAssignedLinearIssues2();
3197
3198
  }
3198
3199
  };
@@ -3277,13 +3278,16 @@ async function listCodexModels() {
3277
3278
  return cachedCodexModels?.models ?? FALLBACK_CODEX_MODELS;
3278
3279
  }
3279
3280
  }
3280
- function usageFromCodex(usage) {
3281
+ function usageFromCodex(usage, asContext = false) {
3281
3282
  if (!usage) return null;
3282
- return fromInclusiveInputUsage({
3283
+ const mapped = fromInclusiveInputUsage({
3283
3284
  inputTokens: Number(usage.input_tokens ?? 0),
3284
3285
  outputTokens: Number(usage.output_tokens ?? 0),
3285
3286
  cachedInputTokens: Number(usage.cached_input_tokens ?? 0)
3286
3287
  });
3288
+ if (!mapped || !asContext) return mapped;
3289
+ const occ = requestOccupancy(mapped);
3290
+ return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
3287
3291
  }
3288
3292
  function codexHomeDir() {
3289
3293
  return process.env.CODEX_HOME?.trim() || join11(homedir7(), ".codex");
@@ -3549,7 +3553,7 @@ var codexAdapter = {
3549
3553
  }
3550
3554
  if (type === "turn.completed" || type === "turn_completed") {
3551
3555
  const payload = obj;
3552
- const usage = usageFromCodex(payload.last_token_usage ?? payload.usage);
3556
+ const usage = payload.last_token_usage ? usageFromCodex(payload.last_token_usage, true) : usageFromCodex(payload.usage);
3553
3557
  return usage ? { type: "usage", data: usage, scope: "turn" } : null;
3554
3558
  }
3555
3559
  if (typeof obj.content === "string" && obj.content.trim()) {
@@ -3883,7 +3887,7 @@ function cursorSdkMessageToEvents(msg) {
3883
3887
  }
3884
3888
  if (msg.type === "usage") {
3885
3889
  const usage = usageFromCursor(msg.usage);
3886
- if (usage) return [{ type: "usage", data: usage, scope: "request" }];
3890
+ if (usage) return [{ type: "usage", data: usage, scope: "turn" }];
3887
3891
  }
3888
3892
  if (msg.type === "status" && msg.status === "ERROR") {
3889
3893
  const rawMessage = msg.message;
@@ -4663,7 +4667,7 @@ var opencodeAdapter = {
4663
4667
  };
4664
4668
  },
4665
4669
  async listLinearIssues(_repoPath) {
4666
- const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-JFV3EES6.js");
4670
+ const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-Q4M7AZO2.js");
4667
4671
  return listAssignedLinearIssues2();
4668
4672
  }
4669
4673
  };
@@ -743,10 +743,11 @@ function applyTurnUsage(current, incoming, scope = "request") {
743
743
  ...incoming.sessionCostUsd != null ? { sessionCostUsd: incoming.sessionCostUsd } : {}
744
744
  };
745
745
  }
746
+ const explicit = incoming.lastRequestTokens != null && incoming.lastRequestTokens > 0 ? incoming.lastRequestTokens : void 0;
746
747
  return {
747
748
  ...incoming,
748
749
  costUsd: incoming.costUsd ?? current?.costUsd,
749
- lastRequestTokens: current?.lastRequestTokens ?? requestOccupancy(incoming),
750
+ lastRequestTokens: current?.lastRequestTokens ?? explicit,
750
751
  ...incoming.sessionCostUsd == null && current?.sessionCostUsd != null ? { sessionCostUsd: current.sessionCostUsd } : {}
751
752
  };
752
753
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-ZEUMWHOH.js";
4
+ } from "./chunk-C7HUCBX7.js";
5
5
  import {
6
6
  httpFetch
7
7
  } from "./chunk-JAT3JFOS.js";
@@ -10,7 +10,7 @@ import {
10
10
  getAbleTimeHost,
11
11
  loadAppSettings,
12
12
  saveAbleTimeConnection
13
- } from "./chunk-RZJTGBXY.js";
13
+ } from "./chunk-QPSKQP6E.js";
14
14
 
15
15
  // src/integrations/abletime-oauth.ts
16
16
  import { createHash, randomBytes } from "crypto";
@@ -280,7 +280,7 @@ async function startAbleTimeOAuth(opts) {
280
280
  persistAbleTimeTokens(data, { host });
281
281
  const token = data.access_token.trim();
282
282
  try {
283
- const { getAbleTimeOrientation } = await import("./abletime-VL234MCP.js");
283
+ const { getAbleTimeOrientation } = await import("./abletime-RDHYSZL2.js");
284
284
  const orientation = await getAbleTimeOrientation({ token, host });
285
285
  return saveAbleTimeConnection({
286
286
  accessToken: token,
@@ -16,7 +16,7 @@ import {
16
16
  disconnectLinearConnection,
17
17
  loadAppSettings,
18
18
  saveLinearOAuth
19
- } from "./chunk-RZJTGBXY.js";
19
+ } from "./chunk-QPSKQP6E.js";
20
20
 
21
21
  // src/integrations/linear-oauth.ts
22
22
  import { createHash, randomBytes } from "crypto";
@@ -2,7 +2,7 @@
2
2
  var LIST_TIMEOUT_MS = 15e3;
3
3
  async function listAssignedLinearIssues(opts) {
4
4
  try {
5
- const { listLinearIssuesDirect } = await import("./linear-HFUOUJ5H.js");
5
+ const { listLinearIssuesDirect } = await import("./linear-Z2T4KUAQ.js");
6
6
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
7
7
  let timer;
8
8
  try {
@@ -5,7 +5,7 @@
5
5
  var LIST_TIMEOUT_MS = 15e3;
6
6
  async function listAssignedLinearIssues(opts) {
7
7
  try {
8
- const { listLinearIssuesDirect } = await import("./linear-SIHEBU3X.js");
8
+ const { listLinearIssuesDirect } = await import("./linear-6S7MK5YK.js");
9
9
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
10
10
  let timer;
11
11
  try {
@@ -11,11 +11,11 @@ import {
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-ZHDXLDLA.js";
14
+ } from "./chunk-YGVGXQA7.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
18
- } from "./chunk-EO6ZFLG6.js";
18
+ } from "./chunk-75RPUXJS.js";
19
19
  import {
20
20
  ATTACHMENTS_DIR,
21
21
  DETACHED_JOBS_DIR,
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  assertOrchestratorCapableAgent,
34
34
  contextTokens
35
- } from "./chunk-CI4M54LS.js";
35
+ } from "./chunk-D744HOI5.js";
36
36
  import {
37
37
  stripNestedElectronEnv
38
38
  } from "./chunk-WWUABK6B.js";
@@ -528,11 +528,15 @@ function applyCompaction(messages, summaryText, thresholds = {}) {
528
528
  return [summary, ...recent];
529
529
  }
530
530
  function lastRequestOccupancy(thread) {
531
+ if (thread.agent === "cursor") return estimateOccupancyTokens(thread.messages);
531
532
  for (let i = thread.messages.length - 1; i >= 0; i--) {
532
533
  const usage = thread.messages[i]?.usage;
533
- if (usage) return contextTokens(usage);
534
+ if (!usage) continue;
535
+ const n = usage.lastRequestTokens;
536
+ if (n != null && n > 0) return n;
537
+ if (thread.agent === "codex") return estimateOccupancyTokens(thread.messages);
534
538
  }
535
- return 0;
539
+ return thread.agent === "codex" ? estimateOccupancyTokens(thread.messages) : 0;
536
540
  }
537
541
  function shouldResetSessionForOccupancy(thread, occupancyTokens = SESSION_RESET_OCCUPANCY_TOKENS) {
538
542
  return lastRequestOccupancy(thread) >= occupancyTokens;
@@ -551,7 +555,7 @@ async function maybeCompactContext(thread, thresholds = {}, summarize = summariz
551
555
  });
552
556
  let messages = applyCompaction(thread.messages, summary, thresholds);
553
557
  const compactedMessages = appendCompactedMessages(thread.compactedMessages, older);
554
- const resetSession = shouldResetSessionForOccupancy({ messages: thread.messages });
558
+ const resetSession = shouldResetSessionForOccupancy(thread);
555
559
  if (resetSession) {
556
560
  messages = applyForwardOccupancy(messages);
557
561
  }
@@ -1678,7 +1682,7 @@ var PORT_RANGE_SIZE = 10;
1678
1682
  var RECLAIM_RETRY_DELAY_MS = 40;
1679
1683
  var RECLAIM_TRIES = 8;
1680
1684
  async function killReclaimable(ports, worktreePath, signal) {
1681
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-D4KFZF54.js");
1685
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-TGWI6ETZ.js");
1682
1686
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1683
1687
  else killListenersOnPorts2(ports);
1684
1688
  }
@@ -7,7 +7,7 @@ import {
7
7
  resolveGithubRepoSlug,
8
8
  resolveOriginRemote,
9
9
  resolveRepoRoot
10
- } from "./chunk-EO6ZFLG6.js";
10
+ } from "./chunk-75RPUXJS.js";
11
11
  import {
12
12
  ATTACHMENTS_DIR,
13
13
  attachmentsGitignoreBody
@@ -24,7 +24,7 @@ import {
24
24
  resolveThreadDefaults,
25
25
  resolveViewerProfile,
26
26
  resolveViewerProfileForRepo
27
- } from "./chunk-CI4M54LS.js";
27
+ } from "./chunk-D744HOI5.js";
28
28
  import {
29
29
  allocateTeamName,
30
30
  createEmptyThread,
@@ -6,14 +6,14 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-AQEKPJWU.js";
9
+ } from "./chunk-JM2TGOHP.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-2GPQZZLY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
16
- } from "./chunk-CI4M54LS.js";
16
+ } from "./chunk-D744HOI5.js";
17
17
 
18
18
  // src/integrations/abletime-rest.ts
19
19
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -2,11 +2,11 @@ import {
2
2
  OPTIONAL_SERVICES,
3
3
  isOptionalServiceId,
4
4
  optionalServiceSpec
5
- } from "./chunk-2UP3XD2D.js";
5
+ } from "./chunk-B244TJWC.js";
6
6
  import {
7
7
  installNpmGlobalPackage,
8
8
  whichOnPath
9
- } from "./chunk-SK6NYGPD.js";
9
+ } from "./chunk-4H5MWZ6J.js";
10
10
  import {
11
11
  enrichPathWithNpmGlobalBin
12
12
  } from "./chunk-2TUE6JKQ.js";