@event4u/agent-config 14.21.0 → 14.22.0

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 (181) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +198 -0
  5. package/CREDITS.md +37 -0
  6. package/dist/agent-src/commands/analyze/inbox.md +380 -5
  7. package/dist/agent-src/commands/analyze/repo.md +4 -2
  8. package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +69 -0
  9. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +5 -5
  10. package/dist/agent-src/rules/external-code-graph-interop.md +19 -14
  11. package/dist/agent-src/rules/token-efficiency.md +26 -3
  12. package/dist/agent-src/scripts/_cli_entry.ts +51 -0
  13. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +14 -23
  14. package/dist/agent-src/scripts/roadmap_gates.ts +4 -20
  15. package/dist/agent-src/scripts/roadmap_set_step.ts +5 -2
  16. package/dist/agent-src/scripts/stubs_due.ts +4 -18
  17. package/dist/agent-src/scripts/update_roadmap_progress.ts +7 -24
  18. package/dist/agent-src/skills/code-intelligence/SKILL.md +25 -0
  19. package/dist/agent-src/skills/roadmap-writing/SKILL.md +17 -0
  20. package/dist/agent-src/templates/agent-settings.md +0 -1
  21. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  22. package/dist/cli-delegate/_cli_entry.js +8 -0
  23. package/dist/cli-delegate/_lib/pin_resolver.js +170 -0
  24. package/dist/cli-delegate/archival_sweep.js +8 -0
  25. package/dist/cli-delegate/archive_completed_roadmaps.js +494 -0
  26. package/dist/cli-delegate/check_update_banner.js +923 -0
  27. package/dist/cli-delegate/chunk-5EK5WQN6.js +28 -0
  28. package/dist/cli-delegate/chunk-7XGD2OEU.js +96 -0
  29. package/dist/cli-delegate/{chunk-643Z7FIC.js → chunk-BIXEDQPZ.js} +6 -0
  30. package/dist/cli-delegate/chunk-DBH4AHDK.js +155 -0
  31. package/dist/cli-delegate/chunk-JO25G5H7.js +20 -0
  32. package/dist/cli-delegate/chunk-LTYVIY76.js +7961 -0
  33. package/dist/cli-delegate/chunk-QAJS5YWY.js +999 -0
  34. package/dist/cli-delegate/{chunk-ZVBOHSVF.js → chunk-TGIPZBCW.js} +1 -1
  35. package/dist/cli-delegate/{chunk-YS6XTLEK.js → chunk-TYSY33MD.js} +56 -6
  36. package/dist/cli-delegate/chunk-ULET4BYS.js +328 -0
  37. package/dist/cli-delegate/chunk-YDQSHTD7.js +187 -0
  38. package/dist/cli-delegate/chunk-YWVXLR44.js +48 -0
  39. package/dist/cli-delegate/chunk-ZZQBUHFK.js +273 -0
  40. package/dist/cli-delegate/cmd_conformance.js +2 -2
  41. package/dist/cli-delegate/cmd_export.js +1 -1
  42. package/dist/cli-delegate/cmd_handoff.js +26 -2
  43. package/dist/cli-delegate/cmd_prune.js +1 -1
  44. package/dist/cli-delegate/cmd_session_recycle.js +2 -2
  45. package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
  46. package/dist/cli-delegate/cmd_sync.js +1 -1
  47. package/dist/cli-delegate/cmd_uninstall.js +1 -1
  48. package/dist/cli-delegate/cmd_validate.js +1 -1
  49. package/dist/cli-delegate/dashboard_mode.js +16 -0
  50. package/dist/cli-delegate/gate_budget.js +24 -0
  51. package/dist/cli-delegate/gate_execute.js +25 -0
  52. package/dist/cli-delegate/guarded_baseline.js +18 -0
  53. package/dist/cli-delegate/resume_probe.js +22 -0
  54. package/dist/cli-delegate/roadmap_gates.js +638 -0
  55. package/dist/cli-delegate/roadmap_set_step.js +173 -0
  56. package/dist/cli-delegate/stub_queue.js +47 -0
  57. package/dist/cli-delegate/stubs_due.js +38 -0
  58. package/dist/cli-delegate/ticket_bundles.js +59 -0
  59. package/dist/cli-delegate/update_roadmap_progress.js +60 -0
  60. package/dist/discovery/deprecation-report.md +1 -1
  61. package/dist/discovery/discovery-manifest.json +8 -8
  62. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  63. package/dist/discovery/discovery-manifest.summary.md +1 -1
  64. package/dist/discovery/dormancy-report.md +1 -1
  65. package/dist/discovery/orphan-report.md +1 -1
  66. package/dist/discovery/packs.json +2 -2
  67. package/dist/discovery/trust-report.md +1 -1
  68. package/dist/discovery/workspaces.json +2 -2
  69. package/dist/hooks/dispatch.js +1193 -917
  70. package/dist/install/claudeLayerCarriage.js +237 -0
  71. package/dist/install/claudePathsPlan.js +79 -0
  72. package/dist/install/hostLayerFingerprint.js +1 -1
  73. package/dist/install/install.mjs +6 -0
  74. package/dist/install/partitionEligibility.js +231 -117
  75. package/dist/install/ruleLayerPartition.js +10 -7
  76. package/dist/mcp/registry-manifest.json +2 -2
  77. package/dist/mcp/server.json +2 -2
  78. package/dist/mcp/server.mjs +39219 -38995
  79. package/dist/scripts/condense.js +32 -25
  80. package/docs/MIGRATION.md +49 -1
  81. package/docs/contracts/settings-classes.md +1 -1
  82. package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +73 -0
  83. package/package.json +7 -4
  84. package/src/agent-src/scripts/_cli_entry.ts +51 -0
  85. package/src/agent-src/scripts/archive_completed_roadmaps.ts +14 -23
  86. package/src/agent-src/scripts/roadmap_gates.ts +4 -20
  87. package/src/agent-src/scripts/roadmap_set_step.ts +5 -2
  88. package/src/agent-src/scripts/stubs_due.ts +4 -18
  89. package/src/agent-src/scripts/update_roadmap_progress.ts +7 -24
  90. package/src/config/continuity-surface.json +509 -0
  91. package/src/config/estate-count-budget.json +1 -1
  92. package/src/config/gate-coverage.yml +29 -8
  93. package/src/config/gate-violation-baselines.json +8 -8
  94. package/src/config/gitignore-block.txt +19 -0
  95. package/src/config/host-injection-effect.json +73 -0
  96. package/src/config/packed-binary-manifest.json +33 -0
  97. package/src/config/preamble-payload-budget.json +112 -105
  98. package/src/config/publish-surface.json +4 -2
  99. package/src/install/claudeLayerCarriage.ts +273 -0
  100. package/src/install/claudePathsPlan.ts +76 -0
  101. package/src/install/hostLayerFingerprint.ts +1 -1
  102. package/src/install/partitionEligibility.ts +261 -127
  103. package/src/install/ruleLayerPartition.ts +19 -23
  104. package/src/scripts/_dispatch.bash +77 -27
  105. package/src/scripts/_lib/auto_dispatch.ts +2 -2
  106. package/src/scripts/_lib/catalogue_layer_parity.ts +146 -0
  107. package/src/scripts/_lib/continuity_surface.ts +296 -0
  108. package/src/scripts/_lib/corpus_manifest.ts +26 -9
  109. package/src/scripts/_lib/hook_settings.ts +1 -1
  110. package/src/scripts/_lib/injection_effect.ts +151 -0
  111. package/src/scripts/_lib/layer_overlap_notice.ts +50 -6
  112. package/src/scripts/_lib/packed_binary_predicate.ts +225 -0
  113. package/src/scripts/_lib/pin_resolver.ts +13 -0
  114. package/src/scripts/_lib/regression_neighbourhood.ts +1 -1
  115. package/src/scripts/_lib/retired_status.ts +74 -0
  116. package/src/scripts/_lib/skill_catalogue.ts +156 -21
  117. package/src/scripts/_lib/subagent_capsule.ts +117 -8
  118. package/src/scripts/ai_council/api_transport.ts +5 -0
  119. package/src/scripts/ai_council/deliberation_metrics.ts +353 -0
  120. package/src/scripts/ai_council/prompts.ts +9 -0
  121. package/src/scripts/ai_council/synthesis_disagreement.ts +206 -0
  122. package/src/scripts/capture_skill_catalogue.ts +24 -11
  123. package/src/scripts/check_candidate_lines.ts +499 -0
  124. package/src/scripts/check_continuity_surface.ts +475 -0
  125. package/src/scripts/check_dependency_floors.ts +13 -6
  126. package/src/scripts/check_estate_count.ts +40 -79
  127. package/src/scripts/check_pack_size.ts +262 -23
  128. package/src/scripts/check_roadmap_trackable.ts +19 -16
  129. package/src/scripts/check_rule_layer_partition.ts +54 -34
  130. package/src/scripts/check_single_delivery.ts +97 -31
  131. package/src/scripts/check_update_banner.ts +13 -0
  132. package/src/scripts/code_graph/build.ts +138 -15
  133. package/src/scripts/code_graph/cli.ts +76 -8
  134. package/src/scripts/code_graph/extract.ts +11 -0
  135. package/src/scripts/code_graph/grammar_probe.ts +43 -0
  136. package/src/scripts/code_graph/loader.ts +88 -14
  137. package/src/scripts/code_graph/query.ts +121 -11
  138. package/src/scripts/code_graph/resolution_tiers.ts +238 -0
  139. package/src/scripts/code_graph/sqlite_store.ts +247 -6
  140. package/src/scripts/code_graph/types.ts +66 -1
  141. package/src/scripts/code_graph/validate.ts +23 -0
  142. package/src/scripts/condense.ts +34 -22
  143. package/src/scripts/corpus_manifest.ts +5 -5
  144. package/src/scripts/council_cli.ts +11 -12
  145. package/src/scripts/count_intent_disagreement.ts +426 -0
  146. package/src/scripts/handoff_context_hook.ts +79 -0
  147. package/src/scripts/hook_effect_doctor.ts +82 -1
  148. package/src/scripts/hook_manifest.json +1 -1
  149. package/src/scripts/hook_manifest.yaml +64 -12
  150. package/src/scripts/hooks/chain_nudge_hook.ts +282 -0
  151. package/src/scripts/hooks/code_graph_context_hook.ts +212 -0
  152. package/src/scripts/hooks/concern_registry.ts +4 -2
  153. package/src/scripts/hooks/host_semantics.ts +1 -1
  154. package/src/scripts/hooks/orchestration_record_hook.ts +2 -2
  155. package/src/scripts/hooks/rule_inject_hook.ts +1 -1
  156. package/src/scripts/hooks/skill_route_hook.ts +11 -4
  157. package/src/scripts/inbox_source_census.ts +322 -0
  158. package/src/scripts/install-hooks.sh +82 -0
  159. package/src/scripts/{lint_carrier_integrity.ts → lint_deferral_integrity.ts} +60 -214
  160. package/src/scripts/lint_plan_risk_register.ts +13 -17
  161. package/src/scripts/mcp_server/suggest_skill.ts +72 -0
  162. package/src/scripts/mcp_server/tools.ts +2 -56
  163. package/src/scripts/media/lib/adapter-contract.md +7 -2
  164. package/src/scripts/media/lib/fixtures/flux/asset-0001.png +0 -0
  165. package/src/scripts/media/lib/fixtures/gemini-image/asset-0001.png +0 -0
  166. package/src/scripts/media/lib/fixtures/ideogram/asset-0001.png +0 -0
  167. package/src/scripts/rdp_candidates_delta.ts +276 -0
  168. package/src/scripts/rdp_quality_eval.ts +217 -19
  169. package/src/scripts/release_mix_taxonomy.json +3 -2
  170. package/src/scripts/report_host_injection_effect.ts +189 -0
  171. package/src/scripts/report_layer_overlap.ts +41 -0
  172. package/src/scripts/report_skill_menu_census.ts +341 -0
  173. package/src/scripts/skill_tools/score_skill_relevance.ts +70 -6
  174. package/src/scripts/skill_tools/suggest_skill_for_task.ts +37 -3
  175. package/src/vendor/grammars/README.md +61 -0
  176. package/src/vendor/grammars/tree-sitter-javascript.wasm +0 -0
  177. package/src/vendor/grammars/tree-sitter-php.wasm +0 -0
  178. package/src/vendor/grammars/tree-sitter-typescript.wasm +0 -0
  179. package/src/scripts/_lib/carrier_status.ts +0 -118
  180. package/src/scripts/_lib/estate_carrier_cases.ts +0 -72
  181. package/src/scripts/hooks/code_graph_nudge_hook.ts +0 -191
@@ -0,0 +1,28 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+
3
+ // src/agent-src/scripts/_cli_entry.ts
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+ function isCliEntry(moduleUrl, name) {
8
+ const argv1 = process.argv[1];
9
+ if (argv1 === void 0) {
10
+ return false;
11
+ }
12
+ if (path.basename(argv1, ".js") === name) {
13
+ return true;
14
+ }
15
+ const argvPath = path.resolve(argv1);
16
+ if (moduleUrl === pathToFileURL(argvPath).href) {
17
+ return true;
18
+ }
19
+ try {
20
+ return fs.realpathSync(fileURLToPath(moduleUrl)) === fs.realpathSync(argvPath);
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ export {
27
+ isCliEntry
28
+ };
@@ -0,0 +1,96 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+
3
+ // src/agent-src/scripts/dashboard_mode.ts
4
+ import { spawnSync } from "node:child_process";
5
+ import * as fs from "node:fs";
6
+ function isTrackedInGit(abs, repo_root) {
7
+ const r = spawnSync("git", ["ls-files", "--error-unmatch", "--", abs], {
8
+ cwd: repo_root,
9
+ encoding: "utf-8",
10
+ timeout: 1e4
11
+ });
12
+ return r.status === 0;
13
+ }
14
+ var REGEN = "Run `./scripts-run src/agent-src/scripts/update_roadmap_progress` to regenerate (or `task roadmap-progress` in Taskfile projects).";
15
+ function evaluateDashboardState(inp) {
16
+ const { mode, present, trackedInGit, current, rel } = inp;
17
+ const regen = inp.regen ?? REGEN;
18
+ const noun = inp.noun ?? "dashboard";
19
+ if (mode === "untracked" && trackedInGit) {
20
+ return {
21
+ stale: true,
22
+ error: `\u274C ${rel} is still tracked by git, but this repository runs \`--untracked-mode\`. Untrack it, keeping the working-tree file:
23
+ git rm --cached ${rel}
24
+ `,
25
+ ok: null
26
+ };
27
+ }
28
+ if (!present) {
29
+ if (mode === "tracked") {
30
+ return {
31
+ stale: true,
32
+ error: `\u274C ${rel} is missing. ` + regen.replace("to regenerate", "to generate it") + ` If this repository deliberately does not commit the ${noun}, pass \`--untracked-mode\`.
33
+ `,
34
+ ok: null
35
+ };
36
+ }
37
+ return {
38
+ stale: false,
39
+ error: null,
40
+ ok: `\u2705 ${rel} is not committed here (--untracked-mode) and no stale copy is on disk.
41
+ `
42
+ };
43
+ }
44
+ if (!current) {
45
+ return { stale: true, error: `\u274C ${rel} is stale. ${regen}
46
+ `, ok: null };
47
+ }
48
+ return { stale: false, error: null, ok: `\u2705 ${rel} is up to date.
49
+ ` };
50
+ }
51
+ function evaluateDashboardOnDisk(opts) {
52
+ const present = fs.existsSync(opts.target);
53
+ return evaluateDashboardState({
54
+ mode: opts.mode,
55
+ present,
56
+ trackedInGit: opts.mode === "untracked" && isTrackedInGit(opts.target, opts.repo_root),
57
+ current: present && fs.readFileSync(opts.target, { encoding: "utf-8" }) === opts.rendered,
58
+ rel: opts.rel,
59
+ ...opts.regen === void 0 ? {} : { regen: opts.regen },
60
+ ...opts.noun === void 0 ? {} : { noun: opts.noun }
61
+ });
62
+ }
63
+ function reportCheckVerdict(inp) {
64
+ const { verdict, dashboardOnly } = inp;
65
+ const complete = dashboardOnly ? [] : inp.complete;
66
+ const pending = dashboardOnly ? [] : inp.pending;
67
+ let err = verdict.error ?? "";
68
+ if (complete.length) {
69
+ err += "\u274C Completed roadmaps are still in `agents/roadmaps/` \u2014 move them to `agents/roadmaps/archive/` (per the `roadmap-progress-sync` rule):\n";
70
+ for (const r of complete) err += ` - ${r.rel} (${r.done}/${r.total_active} done)
71
+ `;
72
+ }
73
+ if (pending.length) {
74
+ err += "\u274C Iron Law 3 \u2014 roadmaps with unresolved `[~]` deferred items must NOT auto-archive. Resolve via `roadmap-management \xA7 4b` (spawn follow-up, restore, or cancel):\n";
75
+ for (const r of pending) {
76
+ err += ` - ${r.rel} (${r.done}/${r.total_active} done \xB7 ${r.deferred} deferred)
77
+ `;
78
+ }
79
+ }
80
+ if (!dashboardOnly && inp.gatedCount > 0) inp.warnMergeGated();
81
+ const rc = verdict.stale || complete.length > 0 || pending.length > 0 ? 1 : 0;
82
+ return { rc, stdout: rc === 0 ? verdict.ok ?? "" : "", stderr: err };
83
+ }
84
+ function parseModeToken(tok) {
85
+ if (tok === "--tracked-mode") return "tracked";
86
+ if (tok === "--untracked-mode") return "untracked";
87
+ return null;
88
+ }
89
+
90
+ export {
91
+ isTrackedInGit,
92
+ evaluateDashboardState,
93
+ evaluateDashboardOnDisk,
94
+ reportCheckVerdict,
95
+ parseModeToken
96
+ };
@@ -748,6 +748,12 @@ function format_drift_report(entries) {
748
748
  // src/scripts/_lib/skill_catalogue.ts
749
749
  import * as fs4 from "node:fs";
750
750
  import * as path4 from "node:path";
751
+ var PROJECT_CATALOGUE_ROOTS = ["src/skills", ".claude/skills"];
752
+ var HOST_CATALOGUE_ROOT = ".claude/skills";
753
+ var DEFAULT_CATALOGUE_ROOTS = [
754
+ ...PROJECT_CATALOGUE_ROOTS,
755
+ `~/${HOST_CATALOGUE_ROOT}`
756
+ ];
751
757
  var OBSERVATION_LOG = path4.join(
752
758
  "agents",
753
759
  "evidence",
@@ -0,0 +1,155 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+
3
+ // src/agent-src/scripts/gate_budget.ts
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ var GATE_BUDGET_LEDGER_REL = path.join(
7
+ "agents",
8
+ "runtime",
9
+ "state",
10
+ "gate-budget-ledger.jsonl"
11
+ );
12
+ function gateBudgetLedgerPath(workspaceRoot) {
13
+ return path.join(workspaceRoot, GATE_BUDGET_LEDGER_REL);
14
+ }
15
+ var ROLLING_WINDOW_DAYS = 7;
16
+ function _num(value) {
17
+ if (typeof value === "number" && Number.isFinite(value)) {
18
+ return value;
19
+ }
20
+ return null;
21
+ }
22
+ function _dig(settings, keys) {
23
+ let cursor = settings;
24
+ for (const k of keys) {
25
+ if (cursor === null || typeof cursor !== "object" || Array.isArray(cursor)) {
26
+ return void 0;
27
+ }
28
+ cursor = cursor[k];
29
+ }
30
+ return cursor;
31
+ }
32
+ function readGateBudgetCaps(settings) {
33
+ const perRun = _num(_dig(settings, ["roadmap", "gate_budget", "max_cost_per_run_usd"]));
34
+ const rolling = _num(
35
+ _dig(settings, ["roadmap", "gate_budget", "max_cost_per_rolling_7d_usd"])
36
+ );
37
+ if (perRun === null || rolling === null) {
38
+ return null;
39
+ }
40
+ return { maxCostPerRunUsd: perRun, maxCostPerRolling7dUsd: rolling };
41
+ }
42
+ function parseBudgetUsd(field) {
43
+ const text = field.trim();
44
+ if (text === "") {
45
+ return null;
46
+ }
47
+ const dollar = /\$\s*([0-9]+(?:[.,][0-9]+)?)/.exec(text);
48
+ if (dollar) {
49
+ return Number.parseFloat(dollar[1].replace(",", "."));
50
+ }
51
+ const usd = /([0-9]+(?:[.,][0-9]+)?)\s*(?:usd|dollars?)\b/i.exec(text);
52
+ if (usd) {
53
+ return Number.parseFloat(usd[1].replace(",", "."));
54
+ }
55
+ return null;
56
+ }
57
+ function readGateBudgetLedger(workspaceRoot) {
58
+ const file = gateBudgetLedgerPath(workspaceRoot);
59
+ if (!fs.existsSync(file)) {
60
+ return [];
61
+ }
62
+ const out = [];
63
+ for (const line of fs.readFileSync(file, "utf-8").split("\n")) {
64
+ const trimmed = line.trim();
65
+ if (trimmed === "") {
66
+ continue;
67
+ }
68
+ let parsed;
69
+ try {
70
+ parsed = JSON.parse(trimmed);
71
+ } catch {
72
+ continue;
73
+ }
74
+ if (parsed === null || typeof parsed !== "object") {
75
+ continue;
76
+ }
77
+ const rec = parsed;
78
+ if (rec["kind"] !== "consumption" || typeof rec["blocker"] !== "string") {
79
+ continue;
80
+ }
81
+ out.push({
82
+ kind: "consumption",
83
+ blocker: rec["blocker"],
84
+ authorization: "confirm-flag",
85
+ estimated_usd: _num(rec["estimated_usd"]) ?? 0,
86
+ actual_usd: _num(rec["actual_usd"]),
87
+ at: typeof rec["at"] === "string" ? rec["at"] : "",
88
+ single_use: true
89
+ });
90
+ }
91
+ return out;
92
+ }
93
+ function appendGateBudgetReceipt(workspaceRoot, receipt) {
94
+ const file = gateBudgetLedgerPath(workspaceRoot);
95
+ fs.mkdirSync(path.dirname(file), { recursive: true });
96
+ fs.appendFileSync(file, `${JSON.stringify(receipt)}
97
+ `, "utf-8");
98
+ }
99
+ function rollingSpendUsd(records, now) {
100
+ const cutoff = now.getTime() - ROLLING_WINDOW_DAYS * 24 * 60 * 60 * 1e3;
101
+ let total = 0;
102
+ for (const r of records) {
103
+ const stamp = Date.parse(r.at);
104
+ if (Number.isFinite(stamp) && stamp < cutoff) {
105
+ continue;
106
+ }
107
+ total += r.actual_usd ?? r.estimated_usd;
108
+ }
109
+ return total;
110
+ }
111
+ function evaluateGateBudget(opts) {
112
+ const { caps, records, estimateUsd, now } = opts;
113
+ if (caps === null) {
114
+ return {
115
+ ok: false,
116
+ reason: "no_caps",
117
+ detail: "no standing class-1 budget is configured (`roadmap.gate_budget.max_cost_per_run_usd` and `roadmap.gate_budget.max_cost_per_rolling_7d_usd`)"
118
+ };
119
+ }
120
+ if (estimateUsd === null) {
121
+ return {
122
+ ok: false,
123
+ reason: "no_estimate",
124
+ detail: "the entry states no USD estimate in its **Budget:** field, so no cap can be compared against it"
125
+ };
126
+ }
127
+ if (estimateUsd > caps.maxCostPerRunUsd) {
128
+ return {
129
+ ok: false,
130
+ reason: "over_per_run",
131
+ detail: `the estimate ($${estimateUsd.toFixed(2)}) exceeds the per-run cap ($${caps.maxCostPerRunUsd.toFixed(2)})`
132
+ };
133
+ }
134
+ const spent = rollingSpendUsd(records, now);
135
+ if (spent + estimateUsd > caps.maxCostPerRolling7dUsd) {
136
+ return {
137
+ ok: false,
138
+ reason: "over_rolling_7d",
139
+ detail: `$${spent.toFixed(2)} is already receipted in the last ${String(ROLLING_WINDOW_DAYS)} days and this run would add $${estimateUsd.toFixed(2)}, over the rolling cap ($${caps.maxCostPerRolling7dUsd.toFixed(2)})`
140
+ };
141
+ }
142
+ return { ok: true, estimateUsd, rollingUsd: spent };
143
+ }
144
+
145
+ export {
146
+ GATE_BUDGET_LEDGER_REL,
147
+ gateBudgetLedgerPath,
148
+ ROLLING_WINDOW_DAYS,
149
+ readGateBudgetCaps,
150
+ parseBudgetUsd,
151
+ readGateBudgetLedger,
152
+ appendGateBudgetReceipt,
153
+ rollingSpendUsd,
154
+ evaluateGateBudget
155
+ };
@@ -0,0 +1,20 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+ var __commonJS = (cb, mod) => function __require2() {
10
+ try {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ } catch (e) {
13
+ throw mod = 0, e;
14
+ }
15
+ };
16
+
17
+ export {
18
+ __require,
19
+ __commonJS
20
+ };