@askexenow/exe-os 0.9.330 → 0.9.332

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 (172) hide show
  1. package/dist/{backfill-metadata-AVWHS332.js → backfill-metadata-FDQVVGRQ.js} +1 -1
  2. package/dist/{behaviors-ZV6HNI2M.js → behaviors-SAS6JALZ.js} +2 -2
  3. package/dist/bin/agentic-ontology-backfill.js +1 -1
  4. package/dist/bin/agentic-reflection-backfill.js +1 -1
  5. package/dist/bin/agentic-semantic-label.js +1 -1
  6. package/dist/bin/backfill-conversations.js +1 -1
  7. package/dist/bin/backfill-responses.js +1 -1
  8. package/dist/bin/backfill-vectors.js +2 -2
  9. package/dist/bin/bulk-sync-postgres.js +3 -3
  10. package/dist/bin/cleanup-stale-review-tasks.js +3 -3
  11. package/dist/bin/cli.js +6 -6
  12. package/dist/bin/deferred-daemon-restart.js +35 -35
  13. package/dist/bin/exe-assign.js +1 -1
  14. package/dist/bin/exe-boot.js +7 -7
  15. package/dist/bin/exe-cloud.js +3 -3
  16. package/dist/bin/exe-config-dump.js +0 -0
  17. package/dist/bin/exe-dispatch.js +3 -3
  18. package/dist/bin/exe-doctor.js +2 -2
  19. package/dist/bin/exe-export-behaviors.js +4 -4
  20. package/dist/bin/exe-forget.js +3 -3
  21. package/dist/bin/exe-gateway.js +5 -5
  22. package/dist/bin/exe-heartbeat.js +3 -3
  23. package/dist/bin/exe-kill.js +5 -5
  24. package/dist/bin/exe-launch-agent.js +6 -6
  25. package/dist/bin/exe-pending-messages.js +4 -4
  26. package/dist/bin/exe-pending-notifications.js +3 -3
  27. package/dist/bin/exe-pending-reviews.js +3 -3
  28. package/dist/bin/exe-review.js +4 -4
  29. package/dist/bin/exe-search.js +2 -2
  30. package/dist/bin/exe-session-cleanup.js +5 -5
  31. package/dist/bin/exe-settings.js +3 -3
  32. package/dist/bin/exe-start-codex.js +3 -3
  33. package/dist/bin/exe-start-opencode.js +3 -3
  34. package/dist/bin/exe-status.js +4 -4
  35. package/dist/bin/exe-team.js +1 -1
  36. package/dist/bin/git-sweep.js +3 -3
  37. package/dist/bin/graph-backfill.js +1 -1
  38. package/dist/bin/graph-export.js +2 -2
  39. package/dist/bin/import-history.js +2 -2
  40. package/dist/bin/install.js +35 -35
  41. package/dist/bin/intercom-check.js +4 -4
  42. package/dist/bin/mcp-sessions.js +2 -2
  43. package/dist/bin/orchestration-metrics.js +1 -1
  44. package/dist/bin/scan-tasks.js +3 -3
  45. package/dist/bin/setup.js +1 -1
  46. package/dist/bin/shard-migrate.js +1 -1
  47. package/dist/{capacity-monitor-VNAUNTTH.js → capacity-monitor-I6TX3OZA.js} +4 -4
  48. package/dist/{catchup-brief-2V6WXZGD.js → catchup-brief-RAZTRECT.js} +4 -4
  49. package/dist/{chunk-LKB2VIIV.js → chunk-267TDVN7.js} +1 -1
  50. package/dist/{chunk-7RDZDCWY.js → chunk-2ES3ACCO.js} +4 -4
  51. package/dist/{chunk-ZSMF37M6.js → chunk-3KAYKHVB.js} +64 -4
  52. package/dist/{chunk-UJRZD77V.js → chunk-3PHTJIC3.js} +1 -1
  53. package/dist/{chunk-QAYGX7KA.js → chunk-4X3VWI22.js} +1 -1
  54. package/dist/{chunk-GTCJU2RF.js → chunk-5CZ2ZH6L.js} +1 -1
  55. package/dist/{chunk-5JILQMRS.js → chunk-6AY7VXSF.js} +6 -6
  56. package/dist/{chunk-UX5YA6ZY.js → chunk-7YTO3LHB.js} +2 -2
  57. package/dist/{chunk-RY7UV6CU.js → chunk-B3ZUS3UU.js} +1 -1
  58. package/dist/{chunk-CPXFQBBN.js → chunk-BST5NSJC.js} +1 -1
  59. package/dist/{chunk-5IX2ZW6O.js → chunk-E5UHM2KN.js} +107 -0
  60. package/dist/{chunk-CERY66PJ.js → chunk-EC4O5ITE.js} +1 -1
  61. package/dist/{chunk-DSL5D3TH.js → chunk-FZQBWOIB.js} +2 -2
  62. package/dist/{chunk-U7ORCOJH.js → chunk-HG7ZX2UT.js} +75 -53
  63. package/dist/{chunk-YL5S6I3R.js → chunk-HRUI3Q42.js} +2 -2
  64. package/dist/{chunk-OR7JFLIL.js → chunk-IVN7UUKK.js} +6 -6
  65. package/dist/{chunk-JCBQQIUV.js → chunk-J53PHGGC.js} +1 -1
  66. package/dist/{chunk-TKG6LCSQ.js → chunk-JRRNRSZC.js} +1 -1
  67. package/dist/{chunk-GSFGVYCG.js → chunk-JRTJKLON.js} +2 -2
  68. package/dist/{chunk-D5SZ3U5L.js → chunk-KNLQAVLI.js} +37 -6
  69. package/dist/{chunk-MTX3FQRR.js → chunk-L6CLX2QF.js} +1 -1
  70. package/dist/{chunk-MNLSPTWM.js → chunk-LB5B4NJ6.js} +1 -1
  71. package/dist/{chunk-4NGPNH3F.js → chunk-M6E76DMO.js} +1 -1
  72. package/dist/{chunk-O6RMSGXQ.js → chunk-MPUIO6GF.js} +1 -1
  73. package/dist/{chunk-QVT4LNHH.js → chunk-N2J6FWMQ.js} +3 -3
  74. package/dist/{chunk-XDJEPGMF.js → chunk-NUPU7TRA.js} +1 -1
  75. package/dist/{chunk-N5ACQ7C2.js → chunk-OEA44GCC.js} +1 -1
  76. package/dist/{chunk-KKZPF6YI.js → chunk-OIMQGA62.js} +1 -1
  77. package/dist/{chunk-QXXG2MCZ.js → chunk-OXZHAERM.js} +29 -3
  78. package/dist/{chunk-OV7OFYIR.js → chunk-QGVXUTHX.js} +1 -1
  79. package/dist/{chunk-KCHIJUYX.js → chunk-QUZ4VK3R.js} +1 -1
  80. package/dist/{chunk-CCDQ6NIZ.js → chunk-RGBABIFH.js} +21 -3
  81. package/dist/{chunk-MTHQR76V.js → chunk-T5JJBIUB.js} +4 -4
  82. package/dist/{chunk-DDA7IAWM.js → chunk-TK7ZDWU3.js} +2 -2
  83. package/dist/{chunk-QOMCLPQI.js → chunk-TQM7RGOB.js} +2 -2
  84. package/dist/{chunk-6YONUN6T.js → chunk-TXUSQZLH.js} +11 -1
  85. package/dist/{chunk-MZ2MBZ3E.js → chunk-YDUS2DFZ.js} +1 -1
  86. package/dist/{chunk-ZWWHEX3Y.js → chunk-YFYUNROP.js} +1 -1
  87. package/dist/{chunk-EQCYEYCJ.js → chunk-ZJSH3L6R.js} +1 -1
  88. package/dist/{cleanup-graph-garbage-FD34BPLR.js → cleanup-graph-garbage-6QGLERF2.js} +1 -1
  89. package/dist/{crm-webhook-6YDLPLVH.js → crm-webhook-DHFRIRLN.js} +2 -2
  90. package/dist/{cto-delegation-gate-JMO6VVTO.js → cto-delegation-gate-Z7UVTVYO.js} +2 -2
  91. package/dist/{daemon-orchestration-U5HW7YT5.js → daemon-orchestration-XWDFUFJG.js} +6 -6
  92. package/dist/{documents-TXMACEEP.js → documents-OMKCMWR7.js} +2 -2
  93. package/dist/{dreaming-KJ4P52EC.js → dreaming-SDFWY5FY.js} +3 -3
  94. package/dist/{exe-export-PH23G3F7.js → exe-export-BY6IFTEP.js} +3 -3
  95. package/dist/{exe-import-QCAFH4AM.js → exe-import-55UKB2X7.js} +3 -3
  96. package/dist/{exe-key-XV4VACRP.js → exe-key-F3BM5GEW.js} +35 -35
  97. package/dist/{exe-snapshot-DDSSZ377.js → exe-snapshot-RGIJJ2ZX.js} +5 -5
  98. package/dist/{fast-db-init-6KBEZK66.js → fast-db-init-OZDG42SZ.js} +1 -1
  99. package/dist/gateway/index.js +6 -6
  100. package/dist/hooks/bug-report-worker.js +5 -5
  101. package/dist/hooks/codex-stop-task-finalizer.js +5 -5
  102. package/dist/hooks/commit-complete.js +5 -5
  103. package/dist/hooks/error-recall.js +7 -4
  104. package/dist/hooks/ingest.js +2 -2
  105. package/dist/hooks/instructions-loaded.js +1 -1
  106. package/dist/hooks/manifest.json +18 -18
  107. package/dist/hooks/notification.js +1 -1
  108. package/dist/hooks/post-compact.js +3 -3
  109. package/dist/hooks/post-tool-combined.js +2 -2
  110. package/dist/hooks/pre-compact.js +4 -4
  111. package/dist/hooks/pre-tool-use.js +7 -7
  112. package/dist/hooks/prompt-submit.js +16 -16
  113. package/dist/hooks/session-end.js +6 -6
  114. package/dist/hooks/session-start.js +6 -6
  115. package/dist/hooks/stop.js +6 -6
  116. package/dist/hooks/subagent-stop.js +3 -3
  117. package/dist/hooks/summary-worker.js +6 -6
  118. package/dist/index.js +10 -10
  119. package/dist/{intercom-queue-4A7XH72M.js → intercom-queue-JFBMDV6J.js} +2 -2
  120. package/dist/lib/cloud-sync.js +3 -3
  121. package/dist/lib/consolidation.js +2 -2
  122. package/dist/lib/exe-daemon.js +28 -28
  123. package/dist/lib/hybrid-search.js +2 -2
  124. package/dist/lib/messaging.js +3 -3
  125. package/dist/lib/schedules.js +2 -2
  126. package/dist/lib/skill-learning.js +3 -3
  127. package/dist/lib/store.js +1 -1
  128. package/dist/lib/tasks.js +4 -4
  129. package/dist/lib/tmux-routing.js +2 -2
  130. package/dist/lib/token-spend.js +9 -3
  131. package/dist/mcp/register-tools.js +34 -34
  132. package/dist/mcp/server.js +35 -35
  133. package/dist/mcp/tools/create-task.js +5 -5
  134. package/dist/mcp/tools/deactivate-behavior.js +3 -3
  135. package/dist/mcp/tools/list-tasks.js +5 -5
  136. package/dist/mcp/tools/send-message.js +4 -4
  137. package/dist/mcp/tools/update-task.js +5 -5
  138. package/dist/{memory-cards-7Z66A6AF.js → memory-cards-7YIZUWSJ.js} +1 -1
  139. package/dist/{memory-pressure-watchdog-Z25XTMNY.js → memory-pressure-watchdog-MZWX4YIA.js} +3 -3
  140. package/dist/{notifications-3MIUQXX6.js → notifications-42Z4ZRNV.js} +2 -2
  141. package/dist/{orchestrator-IKRGCGWD.js → orchestrator-ALAA4P6M.js} +3 -3
  142. package/dist/{pipeline-router-BNKNM454.js → pipeline-router-F226AZRB.js} +1 -1
  143. package/dist/{projection-worker-RIOEZPKQ.js → projection-worker-UL2HHHPO.js} +1 -1
  144. package/dist/{reranker-H3TCF74O.js → reranker-G24KWZKH.js} +1 -1
  145. package/dist/{retrieval-health-3VRJMK47.js → retrieval-health-GFGXNPSN.js} +1 -1
  146. package/dist/{review-polling-FDHBFWSY.js → review-polling-REHBTRU6.js} +3 -3
  147. package/dist/runtime/index.js +4 -4
  148. package/dist/{session-events-GM2OUFON.js → session-events-F3DPBY4P.js} +3 -3
  149. package/dist/{session-kill-telemetry-XN6LYPWA.js → session-kill-telemetry-USNB6ND7.js} +3 -3
  150. package/dist/{session-scope-3OGEPOW7.js → session-scope-CJQE4LVB.js} +2 -2
  151. package/dist/{setup-wizard-ISCAH4EV.js → setup-wizard-S6XYW2WH.js} +1 -1
  152. package/dist/{skill-refinement-X4HZANPI.js → skill-refinement-XXYCXA2U.js} +1 -1
  153. package/dist/{task-enforcement-7GXGH6DB.js → task-enforcement-ZKB2VZ6W.js} +3 -3
  154. package/dist/{task-scope-J3OMPV5A.js → task-scope-CATQQNVX.js} +2 -2
  155. package/dist/{tasks-crud-NGMRLJH5.js → tasks-crud-RDWLWYWV.js} +2 -2
  156. package/dist/{tasks-notify-4OZXON6S.js → tasks-notify-CKT5A6WK.js} +3 -3
  157. package/dist/{tasks-review-U5QEKLNP.js → tasks-review-UXWXJ6H3.js} +2 -2
  158. package/dist/{telemetry-upload-QCM44FAE.js → telemetry-upload-UUJULBSV.js} +1 -1
  159. package/dist/tui/App.js +8 -8
  160. package/dist/{tui-data-YPS2SMWF.js → tui-data-7SQLIY2O.js} +2 -2
  161. package/dist/{worker-gate-M6OGQF7H.js → worker-gate-2O27EXUE.js} +1 -1
  162. package/dist/{workflow-engine-OVVJRMD2.js → workflow-engine-QGSEQV2Z.js} +2 -2
  163. package/package.json +1 -1
  164. package/release-notes.json +16 -15
  165. /package/dist/{chunk-ME3WDWL6.js → chunk-26GM62C3.js} +0 -0
  166. /package/dist/{chunk-KOQ6WZBS.js → chunk-3HIYBZ62.js} +0 -0
  167. /package/dist/{chunk-BPH6YPHA.js → chunk-BAXNI3A5.js} +0 -0
  168. /package/dist/{chunk-VV422PGC.js → chunk-CDVA67B2.js} +0 -0
  169. /package/dist/{chunk-NPAGBSEN.js → chunk-G3UK4TTT.js} +0 -0
  170. /package/dist/{chunk-N4G4M6LE.js → chunk-VYLDGF4D.js} +0 -0
  171. /package/dist/{chunk-YOOK5NOZ.js → chunk-YWIOFMHL.js} +0 -0
  172. /package/dist/{core-memory-YHACNEAS.js → core-memory-KMBRE2HU.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sendMessage
3
- } from "./chunk-N5ACQ7C2.js";
3
+ } from "./chunk-OEA44GCC.js";
4
4
  import {
5
5
  getActiveAgent
6
6
  } from "./chunk-EOYVD5U3.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-75H4R62K.js";
4
4
  import {
5
5
  initStore
6
- } from "./chunk-KKZPF6YI.js";
6
+ } from "./chunk-OIMQGA62.js";
7
7
  import {
8
8
  getClient,
9
9
  isInitialized
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeAction,
3
3
  substituteTemplate
4
- } from "./chunk-N4G4M6LE.js";
4
+ } from "./chunk-VYLDGF4D.js";
5
5
 
6
6
  // src/automation/workflow-engine.ts
7
7
  import { randomUUID } from "crypto";
@@ -2,7 +2,7 @@ import {
2
2
  dispatchTaskToEmployee,
3
3
  markTaskNotificationsRead,
4
4
  notifyTaskDone
5
- } from "./chunk-YL5S6I3R.js";
5
+ } from "./chunk-HRUI3Q42.js";
6
6
  import {
7
7
  cleanupReviewFile,
8
8
  createTaskCore,
@@ -11,7 +11,7 @@ import {
11
11
  sessionScopeFilter,
12
12
  updateTaskStatus,
13
13
  writeNotification
14
- } from "./chunk-ZSMF37M6.js";
14
+ } from "./chunk-3KAYKHVB.js";
15
15
  import {
16
16
  orgBus
17
17
  } from "./chunk-MP2AFCGL.js";
@@ -61,7 +61,7 @@ async function cascadeUnblock(taskId, baseDir, now) {
61
61
  }
62
62
  if (unblockedRows.rows.length > 0 && !process.env.VITEST) {
63
63
  try {
64
- const { dispatchTaskToEmployee: dispatchTaskToEmployee2 } = await import("./tasks-notify-4OZXON6S.js");
64
+ const { dispatchTaskToEmployee: dispatchTaskToEmployee2 } = await import("./tasks-notify-CKT5A6WK.js");
65
65
  const dispatched = /* @__PURE__ */ new Set();
66
66
  for (const ur of unblockedRows.rows) {
67
67
  const assignee = String(ur.assigned_to);
@@ -86,7 +86,7 @@ async function cascadeUnblock(taskId, baseDir, now) {
86
86
  }
87
87
  } catch {
88
88
  try {
89
- const { queueIntercom } = await import("./intercom-queue-4A7XH72M.js");
89
+ const { queueIntercom } = await import("./intercom-queue-JFBMDV6J.js");
90
90
  const dispatched = /* @__PURE__ */ new Set();
91
91
  for (const ur of unblockedRows.rows) {
92
92
  const assignee = String(ur.assigned_to);
@@ -289,7 +289,7 @@ async function updateTask(input) {
289
289
  try {
290
290
  process.stderr.write(`[tasks] EVENT: tmux delivery failed for reviewer="${reviewer}". Queueing for daemon delivery.
291
291
  `);
292
- const { queueIntercom } = await import("./intercom-queue-4A7XH72M.js");
292
+ const { queueIntercom } = await import("./intercom-queue-JFBMDV6J.js");
293
293
  const { resolveExeSession } = await import("./lib/tmux-routing.js");
294
294
  const exeSession = row.session_scope ? String(row.session_scope) : resolveExeSession();
295
295
  if (exeSession) {
@@ -333,7 +333,7 @@ async function updateTask(input) {
333
333
  await markTaskNotificationsRead(taskFile);
334
334
  if (isCompletionReviewTransition && !isCoordinator && row.reviewer) {
335
335
  try {
336
- const { writeNotification: writeNotification2 } = await import("./notifications-3MIUQXX6.js");
336
+ const { writeNotification: writeNotification2 } = await import("./notifications-42Z4ZRNV.js");
337
337
  const reviewer = String(row.reviewer);
338
338
  await writeNotification2({
339
339
  agentId: reviewer,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  recordSessionKill
3
- } from "./chunk-MNLSPTWM.js";
3
+ } from "./chunk-LB5B4NJ6.js";
4
4
  import {
5
5
  sessionScopeFilter,
6
6
  verifyPaneAtCapacity,
7
7
  writeNotification
8
- } from "./chunk-ZSMF37M6.js";
8
+ } from "./chunk-3KAYKHVB.js";
9
9
  import {
10
10
  listSessions
11
11
  } from "./chunk-3HMHSTHQ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCurrentSessionScope,
3
3
  strictSessionScopeFilter
4
- } from "./chunk-ZSMF37M6.js";
4
+ } from "./chunk-3KAYKHVB.js";
5
5
  import {
6
6
  getProjectName
7
7
  } from "./chunk-OPU3NYOO.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  reserveVersions,
6
6
  vectorToBlob
7
- } from "./chunk-KKZPF6YI.js";
7
+ } from "./chunk-OIMQGA62.js";
8
8
  import {
9
9
  getClient
10
10
  } from "./chunk-BIM763ML.js";
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  getClient
3
3
  } from "./chunk-BIM763ML.js";
4
+ import {
5
+ loadConfigSync
6
+ } from "./chunk-7Y5UDEVM.js";
4
7
 
5
8
  // src/lib/token-spend.ts
6
9
  import { readdir, stat } from "fs/promises";
@@ -8,6 +11,107 @@ import { createReadStream } from "fs";
8
11
  import { createInterface } from "readline";
9
12
  import path from "path";
10
13
  import os from "os";
14
+ var DEFAULT_SPEND_WARNING_THRESHOLD = 0.8;
15
+ function asRecord(value) {
16
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
17
+ }
18
+ function finitePositiveNumber(value) {
19
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
20
+ if (typeof value === "string" && value.trim() !== "") {
21
+ const parsed = Number(value);
22
+ if (Number.isFinite(parsed) && parsed > 0) return parsed;
23
+ }
24
+ return null;
25
+ }
26
+ function normalizeWarningThreshold(value) {
27
+ const parsed = finitePositiveNumber(value);
28
+ if (parsed === null) return DEFAULT_SPEND_WARNING_THRESHOLD;
29
+ const ratio = parsed > 1 ? parsed / 100 : parsed;
30
+ return ratio > 0 && ratio <= 1 ? ratio : DEFAULT_SPEND_WARNING_THRESHOLD;
31
+ }
32
+ function firstPositiveNumber(records, keys) {
33
+ for (const { source, record } of records) {
34
+ for (const key of keys) {
35
+ const value = finitePositiveNumber(record[key]);
36
+ if (value !== null) return { value, source: `${source}.${key}` };
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+ function resolveGlobalSpendCapConfig(config, env = process.env) {
42
+ const envCap = finitePositiveNumber(env.EXE_GLOBAL_SPEND_CAP_USD ?? env.EXE_TOKEN_SPEND_CAP_USD ?? env.EXE_SPEND_CAP_USD);
43
+ if (envCap !== null) {
44
+ return {
45
+ capUSD: envCap,
46
+ warningThreshold: normalizeWarningThreshold(
47
+ env.EXE_GLOBAL_SPEND_WARN_THRESHOLD ?? env.EXE_TOKEN_SPEND_WARN_THRESHOLD ?? env.EXE_SPEND_WARN_THRESHOLD
48
+ ),
49
+ source: env.EXE_GLOBAL_SPEND_CAP_USD ? "env.EXE_GLOBAL_SPEND_CAP_USD" : env.EXE_TOKEN_SPEND_CAP_USD ? "env.EXE_TOKEN_SPEND_CAP_USD" : "env.EXE_SPEND_CAP_USD"
50
+ };
51
+ }
52
+ const tokenSpend = asRecord(config.tokenSpend);
53
+ const spend = asRecord(config.spend);
54
+ const records = [
55
+ ...tokenSpend ? [{ source: "config.tokenSpend", record: tokenSpend }] : [],
56
+ ...spend ? [{ source: "config.spend", record: spend }] : [],
57
+ { source: "config", record: config }
58
+ ];
59
+ const cap = firstPositiveNumber(records, [
60
+ "globalCapUSD",
61
+ "globalSpendCapUSD",
62
+ "capUSD",
63
+ "spendCapUSD"
64
+ ]);
65
+ if (!cap) return null;
66
+ const warning = firstPositiveNumber(records, [
67
+ "warningThreshold",
68
+ "warningThresholdPercent",
69
+ "warnAt",
70
+ "warnAtPercent"
71
+ ]);
72
+ return {
73
+ capUSD: cap.value,
74
+ warningThreshold: normalizeWarningThreshold(warning?.value),
75
+ source: cap.source
76
+ };
77
+ }
78
+ function getConfiguredGlobalSpendCap() {
79
+ try {
80
+ return resolveGlobalSpendCapConfig(loadConfigSync());
81
+ } catch {
82
+ return resolveGlobalSpendCapConfig({});
83
+ }
84
+ }
85
+ function evaluateGlobalSpendCap(totalCostUSD, period, config = getConfiguredGlobalSpendCap()) {
86
+ const normalizedCost = Number.isFinite(totalCostUSD) && totalCostUSD > 0 ? totalCostUSD : 0;
87
+ if (!config) {
88
+ return {
89
+ configured: false,
90
+ period,
91
+ capUSD: null,
92
+ totalCostUSD: normalizedCost,
93
+ percentUsed: 0,
94
+ warningThresholdPercent: null,
95
+ status: "unconfigured",
96
+ message: "No global spend cap configured. Set tokenSpend.globalCapUSD in config.json or EXE_GLOBAL_SPEND_CAP_USD to enable spend warnings.",
97
+ source: null
98
+ };
99
+ }
100
+ const percentUsed = Math.round(normalizedCost / config.capUSD * 100);
101
+ const status = normalizedCost >= config.capUSD ? "over_cap" : normalizedCost >= config.capUSD * config.warningThreshold ? "near_cap" : "ok";
102
+ const warningThresholdPercent = Math.round(config.warningThreshold * 100);
103
+ return {
104
+ configured: true,
105
+ period,
106
+ capUSD: config.capUSD,
107
+ totalCostUSD: normalizedCost,
108
+ percentUsed,
109
+ warningThresholdPercent,
110
+ status,
111
+ message: status === "over_cap" ? `Global spend cap exceeded for ${period}: $${normalizedCost.toFixed(2)} / $${config.capUSD.toFixed(2)} (${percentUsed}%).` : status === "near_cap" ? `Global spend is near cap for ${period}: $${normalizedCost.toFixed(2)} / $${config.capUSD.toFixed(2)} (${percentUsed}%, warning at ${warningThresholdPercent}%).` : `Global spend is within cap for ${period}: $${normalizedCost.toFixed(2)} / $${config.capUSD.toFixed(2)} (${percentUsed}%).`,
112
+ source: config.source
113
+ };
114
+ }
11
115
  var MODEL_PRICING = {
12
116
  // Opus 4.5+ ($5/$25 — Anthropic price drop from original Opus 4)
13
117
  "claude-opus-4-7": { input: 5 / 1e6, output: 25 / 1e6, cacheRead: 0.5 / 1e6, cacheWrite: 6.25 / 1e6 },
@@ -223,6 +327,9 @@ function periodToCutoff(period) {
223
327
  }
224
328
 
225
329
  export {
330
+ resolveGlobalSpendCapConfig,
331
+ getConfiguredGlobalSpendCap,
332
+ evaluateGlobalSpendCap,
226
333
  getPricing,
227
334
  getAgentSpend
228
335
  };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VGMACSEV.js";
8
8
  import {
9
9
  vectorToBlob
10
- } from "./chunk-KKZPF6YI.js";
10
+ } from "./chunk-OIMQGA62.js";
11
11
  import {
12
12
  extractKeywords,
13
13
  keywordsToString
@@ -2,10 +2,10 @@ import {
2
2
  listWorkflowDefinitions,
3
3
  runWorkflow,
4
4
  startWorkflow
5
- } from "./chunk-GTCJU2RF.js";
5
+ } from "./chunk-5CZ2ZH6L.js";
6
6
  import {
7
7
  ingest
8
- } from "./chunk-ME3WDWL6.js";
8
+ } from "./chunk-26GM62C3.js";
9
9
  import {
10
10
  initCRMBridge
11
11
  } from "./chunk-ML4S5SHZ.js";