@sideboard-ai/core 0.1.325 → 0.1.327

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 (76) hide show
  1. package/dist/{abletime-M7STTMZT.js → abletime-NW4PJGHN.js} +4 -5
  2. package/dist/{abletime-VL234MCP.js → abletime-OW7LTFQD.js} +4 -5
  3. package/dist/{abletime-oauth-LMMGMAPA.js → abletime-oauth-KWQQRHOQ.js} +3 -4
  4. package/dist/{abletime-oauth-P4ZFBEAL.js → abletime-oauth-TPR2QDRI.js} +3 -4
  5. package/dist/{abletime-rest-DLV7EIWS.js → abletime-rest-5DCWN3P4.js} +3 -4
  6. package/dist/{abletime-rest-GOI7HELR.js → abletime-rest-UJ6SXDBN.js} +3 -4
  7. package/dist/agents/claude-runner.cjs +11 -0
  8. package/dist/agents/claude-runner.js +7 -1
  9. package/dist/agents/cursor-runner.cjs +1 -1
  10. package/dist/agents/cursor-runner.js +1 -1
  11. package/dist/{agents-MBIEAETM.js → agents-IYBY3JT5.js} +9 -10
  12. package/dist/{agents-LDRM3BTY.js → agents-XWIPONJR.js} +8 -9
  13. package/dist/{app-settings-UQHUNOLV.js → app-settings-A5D364JD.js} +1 -2
  14. package/dist/{app-settings-E7DMMEKC.js → app-settings-SA4HX3ZQ.js} +1 -2
  15. package/dist/{chunk-BOFYI6LC.js → chunk-2GEUFPQQ.js} +1 -1
  16. package/dist/{chunk-F65JMKUR.js → chunk-4F7THWIO.js} +2 -2
  17. package/dist/{chunk-A76MKMSF.js → chunk-4G3W23X3.js} +3 -3
  18. package/dist/{chunk-Q3FHTGIW.js → chunk-5Y2C7Q55.js} +441 -20
  19. package/dist/{chunk-PPTJMBUY.js → chunk-ATQLP22S.js} +1 -1
  20. package/dist/{chunk-NWGINMEA.js → chunk-CHYUUETG.js} +3 -3
  21. package/dist/{chunk-RZJTGBXY.js → chunk-D446IWPP.js} +50 -4
  22. package/dist/{chunk-ZEUMWHOH.js → chunk-DACWFN4O.js} +5 -5
  23. package/dist/{chunk-SACHHTBJ.js → chunk-DEB47BII.js} +52 -488
  24. package/dist/{chunk-2UP3XD2D.js → chunk-ECY7WL6T.js} +2 -2
  25. package/dist/{chunk-CI4M54LS.js → chunk-EJRCHCXM.js} +21 -4
  26. package/dist/{chunk-H36GKGU2.js → chunk-EUIVQAPK.js} +2 -2
  27. package/dist/{chunk-WYEST76H.js → chunk-IXWPCOLQ.js} +19 -203
  28. package/dist/{chunk-EO6ZFLG6.js → chunk-JKHCADKB.js} +5 -5
  29. package/dist/{chunk-SK6NYGPD.js → chunk-KLVW3J2B.js} +2 -2
  30. package/dist/{chunk-HG6KS7OT.js → chunk-MO46K6WK.js} +22 -18
  31. package/dist/{chunk-F2PVRF3B.js → chunk-N6ZF3XRP.js} +2 -1
  32. package/dist/{chunk-MFMDZAA6.js → chunk-NQGLDQYB.js} +16 -12
  33. package/dist/{chunk-U5WO6MEB.js → chunk-NURZOXGN.js} +1 -1
  34. package/dist/{chunk-ZHDXLDLA.js → chunk-Q4UPRQOS.js} +12 -12
  35. package/dist/{chunk-SQQBU7Z6.js → chunk-QMLDR63X.js} +2 -2
  36. package/dist/{chunk-BTF3ATST.js → chunk-R2C45NHT.js} +2 -2
  37. package/dist/{chunk-APKUI4BP.js → chunk-RDXODLEN.js} +4 -4
  38. package/dist/{chunk-7G27TB4M.js → chunk-RZJ3QJZT.js} +18 -14
  39. package/dist/{chunk-AQEKPJWU.js → chunk-SB5ADEZZ.js} +5 -5
  40. package/dist/{chunk-7LUOLYFM.js → chunk-SFXGD5KJ.js} +1 -1
  41. package/dist/{chunk-EZR6W4B3.js → chunk-TUH4ICHQ.js} +1 -1
  42. package/dist/chunk-ULWPSBAB.js +192 -0
  43. package/dist/{chunk-MBT6WDAB.js → chunk-UMXBH344.js} +1 -1
  44. package/dist/{chunk-SS6CYGLF.js → chunk-XBBZZHJY.js} +3 -3
  45. package/dist/{chunk-ZSHS46V5.js → chunk-Y6OHM672.js} +476 -20
  46. package/dist/{chunk-GNLKBS3U.js → chunk-YUHZEIVG.js} +69 -473
  47. package/dist/{chunk-VAFQS4D2.js → chunk-ZPBOWO64.js} +2 -2
  48. package/dist/{conductor-KB7L7NQN.js → conductor-CP7TW6TN.js} +7 -7
  49. package/dist/{conductor-D4KFZF54.js → conductor-D62Q2XJC.js} +6 -7
  50. package/dist/{coordinator-prompt-OBXEC63K.js → coordinator-prompt-3PJLU3UH.js} +5 -6
  51. package/dist/{coordinator-prompt-SUO4FRY3.js → coordinator-prompt-J7O7JB26.js} +5 -6
  52. package/dist/{global-workspace-Z2SURNHA.js → global-workspace-4CTLU2BV.js} +5 -6
  53. package/dist/{global-workspace-UHU2FXTY.js → global-workspace-Y3UDZYJX.js} +5 -6
  54. package/dist/index.cjs +527 -506
  55. package/dist/index.d.cts +16 -10
  56. package/dist/index.d.ts +16 -10
  57. package/dist/index.js +68 -66
  58. package/dist/{linear-SIHEBU3X.js → linear-CXWGH2TW.js} +2 -3
  59. package/dist/{linear-HFUOUJ5H.js → linear-WLDCJ3AF.js} +2 -3
  60. package/dist/{linear-list-JFV3EES6.js → linear-list-52LEDEWO.js} +1 -1
  61. package/dist/{linear-list-63I7QUC6.js → linear-list-FGVN65JU.js} +1 -1
  62. package/dist/mcp/run-stdio.cjs +19655 -19635
  63. package/dist/mcp/run-stdio.js +33 -34
  64. package/dist/{optional-cli-ULDP3O5S.js → optional-cli-FN4MGB6W.js} +4 -5
  65. package/dist/{optional-cli-U2GUA2X6.js → optional-cli-INRVBBBG.js} +3 -4
  66. package/dist/{orchestrator-3H4KNGPN.js → orchestrator-EN3ZKD73.js} +13 -13
  67. package/dist/{orchestrator-6ROMEWBP.js → orchestrator-W4TZBBDO.js} +11 -12
  68. package/dist/{thread-store-4ZN3DS2W.js → thread-store-4WE24XA2.js} +6 -2
  69. package/dist/{thread-store-IC4BQXDW.js → thread-store-K2ZNGUSM.js} +7 -3
  70. package/dist/{workspaces-MG5JHRKW.js → workspaces-MM7CQYR6.js} +5 -6
  71. package/dist/{workspaces-QJNKEGEM.js → workspaces-WYCVZ6XH.js} +5 -6
  72. package/dist/{worktree-MYJYUHZM.js → worktree-JBNEMJ5Z.js} +7 -8
  73. package/dist/{worktree-KSJPTHGZ.js → worktree-NNVRGPP4.js} +4 -5
  74. package/package.json +1 -1
  75. package/dist/chunk-77WWLBCI.js +0 -50
  76. package/dist/chunk-KGZBYWZ3.js +0 -23
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  loadAppSettings,
6
6
  saveAppSettings
7
- } from "./chunk-RZJTGBXY.js";
7
+ } from "./chunk-D446IWPP.js";
8
8
 
9
9
  // src/integrations/optional-services.ts
10
10
  var OPTIONAL_SERVICE_IDS = ["vercel", "supabase", "posthog", "sentry"];
@@ -273,7 +273,7 @@ async function connectedCliPresence(integrations) {
273
273
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
274
274
  if (ids.length === 0) return void 0;
275
275
  try {
276
- const { optionalCliPresence } = await import("./optional-cli-ULDP3O5S.js");
276
+ const { optionalCliPresence } = await import("./optional-cli-FN4MGB6W.js");
277
277
  return await optionalCliPresence(ids);
278
278
  } catch {
279
279
  return void 0;
@@ -18,9 +18,6 @@ import {
18
18
  withRemovedAccount,
19
19
  withSelectedAccount
20
20
  } from "./chunk-J2LNLI4S.js";
21
- import {
22
- normalizeThinkingEffort
23
- } from "./chunk-KGZBYWZ3.js";
24
21
  import {
25
22
  appDataDir
26
23
  } from "./chunk-WOU343SI.js";
@@ -55,6 +52,23 @@ function coerceOrchestratorAgent(agent, fallback = "claude") {
55
52
  return isOrchestratorCapableAgent(agent) ? agent : fallback;
56
53
  }
57
54
 
55
+ // src/types/thinking-effort.ts
56
+ var THINKING_EFFORTS = [
57
+ "low",
58
+ "medium",
59
+ "high",
60
+ "xhigh",
61
+ "max"
62
+ ];
63
+ var EFFORT_SET = new Set(THINKING_EFFORTS);
64
+ function normalizeThinkingEffort(value) {
65
+ if (typeof value !== "string") return null;
66
+ const v = value.trim().toLowerCase();
67
+ if (v === "normal") return "medium";
68
+ if (EFFORT_SET.has(v)) return v;
69
+ return null;
70
+ }
71
+
58
72
  // src/store/thread-option-defaults.ts
59
73
  function normalizeAutonomy(value) {
60
74
  return value === "default" || value === "full" ? value : void 0;
@@ -531,10 +545,11 @@ function applyTurnUsage(current, incoming, scope = "request") {
531
545
  ...incoming.sessionCostUsd != null ? { sessionCostUsd: incoming.sessionCostUsd } : {}
532
546
  };
533
547
  }
548
+ const explicit = incoming.lastRequestTokens != null && incoming.lastRequestTokens > 0 ? incoming.lastRequestTokens : void 0;
534
549
  return {
535
550
  ...incoming,
536
551
  costUsd: incoming.costUsd ?? current?.costUsd,
537
- lastRequestTokens: current?.lastRequestTokens ?? requestOccupancy(incoming),
552
+ lastRequestTokens: current?.lastRequestTokens ?? explicit,
538
553
  ...incoming.sessionCostUsd == null && current?.sessionCostUsd != null ? { sessionCostUsd: current.sessionCostUsd } : {}
539
554
  };
540
555
  }
@@ -2371,6 +2386,7 @@ export {
2371
2386
  isOrchestratorCapableAgent,
2372
2387
  assertOrchestratorCapableAgent,
2373
2388
  coerceOrchestratorAgent,
2389
+ normalizeThinkingEffort,
2374
2390
  getDefaultAgent,
2375
2391
  getDefaultModel,
2376
2392
  getDefaultEffort,
@@ -2390,6 +2406,7 @@ export {
2390
2406
  formatViewerContextDirective,
2391
2407
  formatViewerContextReminder,
2392
2408
  fromInclusiveInputUsage,
2409
+ requestOccupancy,
2393
2410
  subtractUsage,
2394
2411
  sumUsageList,
2395
2412
  applyTurnUsage,
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-ZEUMWHOH.js";
7
+ } from "./chunk-DACWFN4O.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-D446IWPP.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -8,11 +8,11 @@ import {
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-APKUI4BP.js";
11
+ } from "./chunk-RDXODLEN.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
15
- } from "./chunk-BTF3ATST.js";
15
+ } from "./chunk-R2C45NHT.js";
16
16
  import {
17
17
  REVIEW_TAB_TITLE,
18
18
  allocateTeamName,
@@ -24,10 +24,13 @@ import {
24
24
  updateThread,
25
25
  worktreeNameFromPath,
26
26
  writeThread
27
- } from "./chunk-ZSHS46V5.js";
27
+ } from "./chunk-Y6OHM672.js";
28
28
  import {
29
29
  ensureWorktreeSideboardIgnored
30
30
  } from "./chunk-QKHEVSB5.js";
31
+ import {
32
+ lastTopLevelToolIsAskUser
33
+ } from "./chunk-ULWPSBAB.js";
31
34
  import {
32
35
  clipToolResultForStore
33
36
  } from "./chunk-OPXEJJBM.js";
@@ -44,7 +47,7 @@ import {
44
47
  import {
45
48
  assertOrchestratorCapableAgent,
46
49
  contextTokens
47
- } from "./chunk-RZJTGBXY.js";
50
+ } from "./chunk-D446IWPP.js";
48
51
  import {
49
52
  stripNestedElectronEnv
50
53
  } from "./chunk-4TR3HZFT.js";
@@ -161,13 +164,12 @@ function estimateOccupancyTokens(messages) {
161
164
  function threadHasCompactedContext(messages) {
162
165
  return messages.some((m) => m.role === "summary");
163
166
  }
164
- function forwardOccupancyTokens(messages, usage, windowTokens = 1e6) {
167
+ function forwardOccupancyTokens(messages, usage, windowTokens = 1e6, opts) {
165
168
  const estimated = estimateOccupancyTokens(messages);
169
+ if (opts?.trustProviderOccupancy === false) return estimated;
166
170
  if (threadHasCompactedContext(messages) && estimated > 0) return estimated;
167
- if (usage) {
168
- const last = contextTokens(usage);
169
- if (last > 0 && last <= windowTokens) return last;
170
- }
171
+ const explicit = usage?.lastRequestTokens;
172
+ if (explicit != null && explicit > 0 && explicit <= windowTokens) return explicit;
171
173
  return estimated;
172
174
  }
173
175
  function forwardContextUsage(usage, messages) {
@@ -553,11 +555,15 @@ function applyCompaction(messages, summaryText, thresholds = {}) {
553
555
  return [summary, ...recent];
554
556
  }
555
557
  function lastRequestOccupancy(thread) {
558
+ if (thread.agent === "cursor") return estimateOccupancyTokens(thread.messages);
556
559
  for (let i = thread.messages.length - 1; i >= 0; i--) {
557
560
  const usage = thread.messages[i]?.usage;
558
- if (usage) return contextTokens(usage);
561
+ if (!usage) continue;
562
+ const n = usage.lastRequestTokens;
563
+ if (n != null && n > 0) return n;
564
+ if (thread.agent === "codex") return estimateOccupancyTokens(thread.messages);
559
565
  }
560
- return 0;
566
+ return thread.agent === "codex" ? estimateOccupancyTokens(thread.messages) : 0;
561
567
  }
562
568
  function shouldResetSessionForOccupancy(thread, occupancyTokens = SESSION_RESET_OCCUPANCY_TOKENS) {
563
569
  return lastRequestOccupancy(thread) >= occupancyTokens;
@@ -576,7 +582,7 @@ async function maybeCompactContext(thread, thresholds = {}, summarize = summariz
576
582
  });
577
583
  let messages = applyCompaction(thread.messages, summary, thresholds);
578
584
  const compactedMessages = appendCompactedMessages(thread.compactedMessages, older);
579
- const resetSession = shouldResetSessionForOccupancy({ messages: thread.messages });
585
+ const resetSession = shouldResetSessionForOccupancy(thread);
580
586
  if (resetSession) {
581
587
  messages = applyForwardOccupancy(messages);
582
588
  }
@@ -1209,185 +1215,6 @@ function jobTreeAlive(pid) {
1209
1215
  return jobAlive(pid) || processGroupAlive(pid);
1210
1216
  }
1211
1217
 
1212
- // src/plan/ask-user.ts
1213
- function planQuestionsSignature(questions) {
1214
- return questions.map((q) => {
1215
- const opts = q.options.map((o) => o.label).join("");
1216
- return `${q.question}${opts}`;
1217
- }).join("");
1218
- }
1219
- function asRecord(v) {
1220
- return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
1221
- }
1222
- function parseOptions(raw) {
1223
- if (!Array.isArray(raw)) return [];
1224
- const out = [];
1225
- for (const item of raw) {
1226
- if (typeof item === "string" && item.trim()) {
1227
- out.push({ label: item.trim() });
1228
- continue;
1229
- }
1230
- const o = asRecord(item);
1231
- if (!o) continue;
1232
- const label = typeof o.label === "string" ? o.label.trim() : typeof o.text === "string" ? o.text.trim() : typeof o.title === "string" ? o.title.trim() : "";
1233
- if (!label) continue;
1234
- const description = typeof o.description === "string" && o.description.trim() ? o.description.trim() : void 0;
1235
- out.push({ label, description });
1236
- }
1237
- return out;
1238
- }
1239
- function parseOneQuestion(raw) {
1240
- const o = asRecord(raw);
1241
- if (!o) return null;
1242
- const question = typeof o.question === "string" ? o.question.trim() : typeof o.text === "string" ? o.text.trim() : typeof o.prompt === "string" ? o.prompt.trim() : "";
1243
- if (!question) return null;
1244
- const options = parseOptions(o.options);
1245
- if (options.length < 1) return null;
1246
- const header = typeof o.header === "string" && o.header.trim() ? o.header.trim() : void 0;
1247
- const multiSelect = Boolean(o.multiSelect ?? o.multi_select);
1248
- return { question, header, multiSelect, options };
1249
- }
1250
- function parsePlanQuestionsInput(input) {
1251
- const root = asRecord(input);
1252
- if (!root) return [];
1253
- const list = Array.isArray(root.questions) ? root.questions : Array.isArray(root.question) ? root.question : root.question || root.prompt ? [root] : [];
1254
- const out = [];
1255
- for (const item of list) {
1256
- const q = parseOneQuestion(item);
1257
- if (q) out.push(q);
1258
- }
1259
- return out;
1260
- }
1261
- var ASK_USER_TOOL_RE = /^(AskUserQuestion|ask_user|mcp__sideboard__ask_user)$/i;
1262
- function isAskUserToolName(name) {
1263
- if (!name) return false;
1264
- const base = name.replace(/^mcp__sideboard__/i, "");
1265
- return ASK_USER_TOOL_RE.test(name) || /^ask_user$/i.test(base);
1266
- }
1267
- function lastTopLevelToolIsAskUser(parts) {
1268
- if (!parts?.length) return false;
1269
- for (let i = parts.length - 1; i >= 0; i--) {
1270
- const part = parts[i];
1271
- if (part.type === "tool" && !part.parentId) {
1272
- return isAskUserToolName(part.name);
1273
- }
1274
- }
1275
- return false;
1276
- }
1277
- function hasTopLevelTool(parts) {
1278
- return Boolean(parts?.some((part) => part.type === "tool" && !part.parentId));
1279
- }
1280
- function questionsFromToolPart(part) {
1281
- const fromInput = parsePlanQuestionsInput(part.input);
1282
- if (fromInput.length) return fromInput;
1283
- const raw = part.result?.trim();
1284
- if (!raw || !raw.startsWith("{")) return [];
1285
- try {
1286
- return parsePlanQuestionsInput(JSON.parse(raw));
1287
- } catch {
1288
- return [];
1289
- }
1290
- }
1291
- function extractPendingPlanQuestions(parts) {
1292
- if (!parts?.length) return null;
1293
- for (let i = parts.length - 1; i >= 0; i--) {
1294
- const p = parts[i];
1295
- if (p.type !== "tool" || !isAskUserToolName(p.name)) continue;
1296
- const questions = questionsFromToolPart(p);
1297
- if (!questions.length) continue;
1298
- return {
1299
- id: p.id || `ask-${i}`,
1300
- signature: planQuestionsSignature(questions),
1301
- questions,
1302
- source: p.name || "ask_user"
1303
- };
1304
- }
1305
- return null;
1306
- }
1307
- function pendingFromAskBlock(block, dismissedQuestionSignature) {
1308
- if (!block || block.source !== "ask_user" || !block.questions?.length) return null;
1309
- const dismissed = dismissedQuestionSignature?.trim();
1310
- if (dismissed && (!block.questionSignature || block.questionSignature === dismissed)) {
1311
- return null;
1312
- }
1313
- const signature = block.questionSignature?.trim() || planQuestionsSignature(block.questions);
1314
- return {
1315
- id: `ask-block:${signature}`,
1316
- signature,
1317
- questions: block.questions,
1318
- source: "ask_user"
1319
- };
1320
- }
1321
- function askBlockStillWaiting(block, messages) {
1322
- if (!messages?.length) return Boolean(block?.at);
1323
- const askedAt = block?.at;
1324
- if (!askedAt) return false;
1325
- for (let i = messages.length - 1; i >= 0; i--) {
1326
- const message = messages[i];
1327
- if (message.role !== "user" || message.origin === "continue") continue;
1328
- if (!message.ts) return true;
1329
- return askedAt > message.ts;
1330
- }
1331
- return true;
1332
- }
1333
- function latestPendingPlanQuestions(input) {
1334
- if (input.userReplied) return null;
1335
- const fromBlock = () => pendingFromAskBlock(input.agentBlock, input.dismissedQuestionSignature);
1336
- if (lastTopLevelToolIsAskUser(input.liveParts)) {
1337
- return extractPendingPlanQuestions(input.liveParts) ?? fromBlock();
1338
- }
1339
- const last = input.messages[input.messages.length - 1];
1340
- if (last?.role === "agent" && lastTopLevelToolIsAskUser(last.parts)) {
1341
- return extractPendingPlanQuestions(last.parts) ?? fromBlock();
1342
- }
1343
- if (hasTopLevelTool(input.liveParts) || last?.role === "agent" && hasTopLevelTool(last.parts)) {
1344
- return null;
1345
- }
1346
- if (input.status === "running" || input.status === "queued") return null;
1347
- const stamped = fromBlock();
1348
- if (stamped && askBlockStillWaiting(input.agentBlock, input.messages)) {
1349
- return stamped;
1350
- }
1351
- return null;
1352
- }
1353
- var PLAN_QUESTION_ANSWERS_PREFIX = "Answers to your questions:";
1354
- function isPlanQuestionAnswersMessage(text) {
1355
- return text.startsWith(PLAN_QUESTION_ANSWERS_PREFIX);
1356
- }
1357
- function formatPlanQuestionAnswers(questions, answers) {
1358
- const lines = [PLAN_QUESTION_ANSWERS_PREFIX, ""];
1359
- for (let i = 0; i < questions.length; i++) {
1360
- const q = questions[i];
1361
- const a = answers.find((x) => x.questionIndex === i);
1362
- const header = q.header ? `**${q.header}** \u2014 ` : "";
1363
- const parts = [];
1364
- if (a?.selected.length) parts.push(a.selected.join(", "));
1365
- if (a?.other?.trim()) parts.push(a.other.trim());
1366
- const body = parts.length ? parts.join(" \xB7 ") : "(no answer)";
1367
- lines.push(`${i + 1}. ${header}${q.question} `);
1368
- lines.push(` \u2192 ${body}`);
1369
- }
1370
- return lines.join("\n");
1371
- }
1372
- function formatPlanQuestionsForChat(questions) {
1373
- const lines = ["### Questions for you", ""];
1374
- for (let i = 0; i < questions.length; i++) {
1375
- const q = questions[i];
1376
- const header = q.header ? `**${q.header}** \u2014 ` : "";
1377
- lines.push(`${i + 1}. ${header}${q.question}`);
1378
- for (let oi = 0; oi < q.options.length; oi++) {
1379
- const opt = q.options[oi];
1380
- const desc = opt.description?.trim();
1381
- lines.push(
1382
- desc ? ` - **${opt.label}** \u2014 ${desc}` : ` - **${opt.label}**`
1383
- );
1384
- }
1385
- lines.push("");
1386
- }
1387
- lines.push("_Answer in the composer below._");
1388
- return lines.join("\n").trimEnd();
1389
- }
1390
-
1391
1218
  // src/orchestrator/task-state.ts
1392
1219
  function isTerminalTaskState(state) {
1393
1220
  return state !== "submitted" && state !== "working";
@@ -1808,7 +1635,7 @@ var PORT_RANGE_SIZE = 10;
1808
1635
  var RECLAIM_RETRY_DELAY_MS = 40;
1809
1636
  var RECLAIM_TRIES = 8;
1810
1637
  async function killReclaimable(ports, worktreePath, signal) {
1811
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-KB7L7NQN.js");
1638
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-CP7TW6TN.js");
1812
1639
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1813
1640
  else killListenersOnPorts2(ports);
1814
1641
  }
@@ -2489,17 +2316,6 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
2489
2316
  }
2490
2317
 
2491
2318
  export {
2492
- planQuestionsSignature,
2493
- parsePlanQuestionsInput,
2494
- isAskUserToolName,
2495
- lastTopLevelToolIsAskUser,
2496
- extractPendingPlanQuestions,
2497
- askBlockStillWaiting,
2498
- latestPendingPlanQuestions,
2499
- PLAN_QUESTION_ANSWERS_PREFIX,
2500
- isPlanQuestionAnswersMessage,
2501
- formatPlanQuestionAnswers,
2502
- formatPlanQuestionsForChat,
2503
2319
  isTerminalTaskState,
2504
2320
  isIncompleteTaskState,
2505
2321
  needsCoordinatorAction,
@@ -17,17 +17,17 @@ import {
17
17
  originCli,
18
18
  resolveGhAuthToken
19
19
  } from "./chunk-YBTSZ2SW.js";
20
- import {
21
- getGithubGitAuthMode,
22
- getGithubPat
23
- } from "./chunk-CI4M54LS.js";
24
20
  import {
25
21
  allocateTeamName,
26
22
  listThreads,
27
23
  normalizeTakenSlug,
28
24
  normalizeWorktreePath,
29
25
  takenSlugsFromThread
30
- } from "./chunk-Q3FHTGIW.js";
26
+ } from "./chunk-5Y2C7Q55.js";
27
+ import {
28
+ getGithubGitAuthMode,
29
+ getGithubPat
30
+ } from "./chunk-EJRCHCXM.js";
31
31
  import {
32
32
  worktreesRoot
33
33
  } from "./chunk-WOU343SI.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-2TUE6JKQ.js";
8
8
  import {
9
9
  resolveAgentExecutable
10
- } from "./chunk-RZJTGBXY.js";
10
+ } from "./chunk-D446IWPP.js";
11
11
 
12
12
  // src/agents/install.ts
13
13
  import { existsSync } from "fs";
@@ -265,7 +265,7 @@ async function loginAgent(agent) {
265
265
  };
266
266
  }
267
267
  async function loginManagedAccount(accountId) {
268
- const { loadAppSettings } = await import("./app-settings-UQHUNOLV.js");
268
+ const { loadAppSettings } = await import("./app-settings-A5D364JD.js");
269
269
  const { loginEnvPrefix } = await import("./managed-accounts-JJTAKHMG.js");
270
270
  const account = loadAppSettings().accounts.accounts.find((a) => a.id === accountId);
271
271
  if (!account) {
@@ -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-Q4UPRQOS.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
19
19
  resolveAgentGitAuthEnv,
20
20
  resolveCodexGitWritableRoots
21
- } from "./chunk-EO6ZFLG6.js";
21
+ } from "./chunk-JKHCADKB.js";
22
22
  import {
23
23
  applyConnectedTeamToCli,
24
24
  brightsyMcpServerName,
@@ -33,12 +33,19 @@ import {
33
33
  } from "./chunk-2GPQZZLY.js";
34
34
  import {
35
35
  listAssignedLinearIssues
36
- } from "./chunk-MBT6WDAB.js";
36
+ } from "./chunk-UMXBH344.js";
37
37
  import {
38
38
  githubAgentAuthReady,
39
39
  npmGlobalNodeModules,
40
40
  run
41
41
  } from "./chunk-YBTSZ2SW.js";
42
+ import {
43
+ BASE_ALLOWED_TOOLS,
44
+ CLAUDE_CHROME_ALLOWED_TOOLS,
45
+ CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS,
46
+ CLAUDE_PRINT_BG_WAIT_CEILING_MS,
47
+ mcpAllowToolsFromNames
48
+ } from "./chunk-5Y2C7Q55.js";
42
49
  import {
43
50
  claudeChromeEnabled,
44
51
  fromInclusiveInputUsage,
@@ -46,21 +53,15 @@ import {
46
53
  isLinearConnected,
47
54
  isPosthogConnected,
48
55
  loadAppSettings,
56
+ requestOccupancy,
49
57
  resolveAgentExecutable,
50
58
  resolveClaudeExecutable
51
- } from "./chunk-CI4M54LS.js";
59
+ } from "./chunk-EJRCHCXM.js";
52
60
  import {
53
61
  isElectronLikeCommand,
54
62
  unwrapStrippedElectronLaunch,
55
63
  wrapElectronAsNodeLaunch
56
64
  } from "./chunk-WWUABK6B.js";
57
- import {
58
- BASE_ALLOWED_TOOLS,
59
- CLAUDE_CHROME_ALLOWED_TOOLS,
60
- CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS,
61
- CLAUDE_PRINT_BG_WAIT_CEILING_MS,
62
- mcpAllowToolsFromNames
63
- } from "./chunk-Q3FHTGIW.js";
64
65
  import {
65
66
  appDataDir
66
67
  } from "./chunk-WOU343SI.js";
@@ -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-Y3UDZYJX.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-52LEDEWO.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-52LEDEWO.js");
4667
4671
  return listAssignedLinearIssues2();
4668
4672
  }
4669
4673
  };
@@ -84,7 +84,8 @@ var BASE_ALLOWED_TOOLS = [
84
84
  "TaskStop",
85
85
  "EnterWorktree",
86
86
  "ExitWorktree",
87
- "Skill"
87
+ "Skill",
88
+ "AskUserQuestion"
88
89
  ];
89
90
  var CLAUDE_PRINT_BG_WAIT_CEILING_MS = 72e5;
90
91
  var CLAUDE_CHROME_ALLOWED_TOOLS = [
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-S5CJUIPY.js";
7
7
  import {
8
8
  listAssignedLinearIssues
9
- } from "./chunk-PPTJMBUY.js";
9
+ } from "./chunk-ATQLP22S.js";
10
10
  import {
11
11
  looksLikeConversationSummary,
12
12
  looksLikeSkillBody,
@@ -15,13 +15,13 @@ import {
15
15
  } from "./chunk-OOXRMTU6.js";
16
16
  import {
17
17
  isOrchestratorThread
18
- } from "./chunk-APKUI4BP.js";
18
+ } from "./chunk-RDXODLEN.js";
19
19
  import {
20
20
  codexUnattendedGitConfigArgs,
21
21
  mergeAgentGitAuthEnv,
22
22
  resolveAgentGitAuthEnv,
23
23
  resolveCodexGitWritableRoots
24
- } from "./chunk-BTF3ATST.js";
24
+ } from "./chunk-R2C45NHT.js";
25
25
  import {
26
26
  loadBrightsyConfig
27
27
  } from "./chunk-RSA47QYR.js";
@@ -34,7 +34,7 @@ import {
34
34
  CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS,
35
35
  CLAUDE_PRINT_BG_WAIT_CEILING_MS,
36
36
  mcpAllowToolsFromNames
37
- } from "./chunk-F2PVRF3B.js";
37
+ } from "./chunk-N6ZF3XRP.js";
38
38
  import {
39
39
  CURSOR_SDK_INSTALL_HINT,
40
40
  applyAgentRunnerHeapEnv,
@@ -48,7 +48,7 @@ import {
48
48
  packagedMcpStdioPath,
49
49
  parseCursorRunnerLine,
50
50
  resolveNodeLaunch
51
- } from "./chunk-U5WO6MEB.js";
51
+ } from "./chunk-NURZOXGN.js";
52
52
  import {
53
53
  extractJsonErrorMessage,
54
54
  formatUnknownDetail,
@@ -77,9 +77,10 @@ import {
77
77
  isLinearConnected,
78
78
  isPosthogConnected,
79
79
  loadAppSettings,
80
+ requestOccupancy,
80
81
  resolveAgentExecutable,
81
82
  resolveClaudeExecutable
82
- } from "./chunk-RZJTGBXY.js";
83
+ } from "./chunk-D446IWPP.js";
83
84
  import {
84
85
  isElectronLikeCommand,
85
86
  unwrapStrippedElectronLaunch
@@ -2658,7 +2659,7 @@ var claudeAdapter = {
2658
2659
  );
2659
2660
  }
2660
2661
  const mode = permissionMode(thread);
2661
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-Z2SURNHA.js");
2662
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-4CTLU2BV.js");
2662
2663
  const isOrchestrator = isOrchestratorThread2(thread);
2663
2664
  const rpc = worktreeAgentRpc(isOrchestrator);
2664
2665
  const injectedServers = await buildInjectedMcpServers({
@@ -2885,7 +2886,7 @@ var claudeAdapter = {
2885
2886
  return { file: claude, args, cwd: thread.worktreePath };
2886
2887
  },
2887
2888
  async listLinearIssues(_repoPath) {
2888
- const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-63I7QUC6.js");
2889
+ const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-FGVN65JU.js");
2889
2890
  return listAssignedLinearIssues2();
2890
2891
  }
2891
2892
  };
@@ -2970,13 +2971,16 @@ async function listCodexModels() {
2970
2971
  return cachedCodexModels?.models ?? FALLBACK_CODEX_MODELS;
2971
2972
  }
2972
2973
  }
2973
- function usageFromCodex(usage) {
2974
+ function usageFromCodex(usage, asContext = false) {
2974
2975
  if (!usage) return null;
2975
- return fromInclusiveInputUsage({
2976
+ const mapped = fromInclusiveInputUsage({
2976
2977
  inputTokens: Number(usage.input_tokens ?? 0),
2977
2978
  outputTokens: Number(usage.output_tokens ?? 0),
2978
2979
  cachedInputTokens: Number(usage.cached_input_tokens ?? 0)
2979
2980
  });
2981
+ if (!mapped || !asContext) return mapped;
2982
+ const occ = requestOccupancy(mapped);
2983
+ return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
2980
2984
  }
2981
2985
  function codexHomeDir() {
2982
2986
  return process.env.CODEX_HOME?.trim() || join7(homedir6(), ".codex");
@@ -3242,7 +3246,7 @@ var codexAdapter = {
3242
3246
  }
3243
3247
  if (type === "turn.completed" || type === "turn_completed") {
3244
3248
  const payload = obj;
3245
- const usage = usageFromCodex(payload.last_token_usage ?? payload.usage);
3249
+ const usage = payload.last_token_usage ? usageFromCodex(payload.last_token_usage, true) : usageFromCodex(payload.usage);
3246
3250
  return usage ? { type: "usage", data: usage, scope: "turn" } : null;
3247
3251
  }
3248
3252
  if (typeof obj.content === "string" && obj.content.trim()) {
@@ -3973,7 +3977,7 @@ var opencodeAdapter = {
3973
3977
  };
3974
3978
  },
3975
3979
  async listLinearIssues(_repoPath) {
3976
- const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-63I7QUC6.js");
3980
+ const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-FGVN65JU.js");
3977
3981
  return listAssignedLinearIssues2();
3978
3982
  }
3979
3983
  };
@@ -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;