instar 1.3.781 → 1.3.783

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 (63) hide show
  1. package/dist/core/IntelligenceRouter.d.ts +9 -14
  2. package/dist/core/IntelligenceRouter.d.ts.map +1 -1
  3. package/dist/core/IntelligenceRouter.js +117 -56
  4. package/dist/core/IntelligenceRouter.js.map +1 -1
  5. package/dist/core/MeteredSpendGate.d.ts +119 -0
  6. package/dist/core/MeteredSpendGate.d.ts.map +1 -0
  7. package/dist/core/MeteredSpendGate.js +228 -0
  8. package/dist/core/MeteredSpendGate.js.map +1 -0
  9. package/dist/core/MeteredSpendLedger.d.ts +154 -0
  10. package/dist/core/MeteredSpendLedger.d.ts.map +1 -0
  11. package/dist/core/MeteredSpendLedger.js +434 -0
  12. package/dist/core/MeteredSpendLedger.js.map +1 -0
  13. package/dist/core/PinAttemptStore.d.ts +35 -0
  14. package/dist/core/PinAttemptStore.d.ts.map +1 -0
  15. package/dist/core/PinAttemptStore.js +85 -0
  16. package/dist/core/PinAttemptStore.js.map +1 -0
  17. package/dist/core/PostUpdateMigrator.d.ts +7 -0
  18. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  19. package/dist/core/PostUpdateMigrator.js +24 -0
  20. package/dist/core/PostUpdateMigrator.js.map +1 -1
  21. package/dist/core/RenderedPlanStore.d.ts +61 -0
  22. package/dist/core/RenderedPlanStore.d.ts.map +1 -0
  23. package/dist/core/RenderedPlanStore.js +92 -0
  24. package/dist/core/RenderedPlanStore.js.map +1 -0
  25. package/dist/core/RoutingSpendCapsStore.d.ts +113 -0
  26. package/dist/core/RoutingSpendCapsStore.d.ts.map +1 -0
  27. package/dist/core/RoutingSpendCapsStore.js +241 -0
  28. package/dist/core/RoutingSpendCapsStore.js.map +1 -0
  29. package/dist/core/SpendAlertResolver.d.ts +77 -0
  30. package/dist/core/SpendAlertResolver.d.ts.map +1 -0
  31. package/dist/core/SpendAlertResolver.js +141 -0
  32. package/dist/core/SpendAlertResolver.js.map +1 -0
  33. package/dist/core/WriteDomainRegistry.d.ts.map +1 -1
  34. package/dist/core/WriteDomainRegistry.js +17 -0
  35. package/dist/core/WriteDomainRegistry.js.map +1 -1
  36. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  37. package/dist/core/devGatedFeatures.js +9 -0
  38. package/dist/core/devGatedFeatures.js.map +1 -1
  39. package/dist/core/routingSpendView.d.ts +10 -2
  40. package/dist/core/routingSpendView.d.ts.map +1 -1
  41. package/dist/core/routingSpendView.js +18 -10
  42. package/dist/core/routingSpendView.js.map +1 -1
  43. package/dist/core/types.d.ts +24 -2
  44. package/dist/core/types.d.ts.map +1 -1
  45. package/dist/core/types.js.map +1 -1
  46. package/dist/server/AgentServer.d.ts +9 -0
  47. package/dist/server/AgentServer.d.ts.map +1 -1
  48. package/dist/server/AgentServer.js +177 -0
  49. package/dist/server/AgentServer.js.map +1 -1
  50. package/dist/server/routes.d.ts +10 -0
  51. package/dist/server/routes.d.ts.map +1 -1
  52. package/dist/server/routes.js +196 -4
  53. package/dist/server/routes.js.map +1 -1
  54. package/dist/testing/selfActionRegistry.d.ts.map +1 -1
  55. package/dist/testing/selfActionRegistry.js +78 -0
  56. package/dist/testing/selfActionRegistry.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/data/builtin-manifest.json +64 -64
  59. package/upgrades/1.3.782.md +60 -0
  60. package/upgrades/1.3.783.md +66 -0
  61. package/upgrades/nature-routing-a2.2-enforcing.eli16.md +50 -0
  62. package/upgrades/side-effects/nature-routing-a2.2-enforcing.md +142 -0
  63. package/upgrades/side-effects/routing-spend-increment-b.md +44 -0
@@ -179,6 +179,22 @@ A READ-ONLY window on internal-LLM spend and the paid-door caps (docs/specs/rout
179
179
  - **When to use** (PROACTIVE — this is the trigger): user asks "what am I spending on routing / the internal LLM calls?" / "where do my paid-door caps sit?" / "is any paid door live?" → read \`GET /routing-spend/summary\` + \`/caps\`, or send them to the Spend tab; do NOT guess.
180
180
  `;
181
181
  }
182
+ /**
183
+ * CLAUDE.md awareness block for the Routing Control Room MONEY layer (Increment B —
184
+ * ledger + fail-closed gate + PIN caps/arming). Unique content-sniff marker:
185
+ * `Routing Spend MONEY layer`. Ships DARK for everyone (DARK_GATE_EXCLUSIONS
186
+ * action-bearing; FD-16) — the section says so honestly (Maturity Honesty).
187
+ */
188
+ export function ROUTING_SPEND_MONEY_CLAUDEMD_SECTION(port) {
189
+ return `\n### Routing Spend MONEY layer (⚗️ experimental, DARK for everyone) — caps, arming, freeze
190
+
191
+ Increment B of the Routing Control Room (docs/specs/routing-control-room-spend-alerts.md): the authoritative booking ledger + the O(1) FAIL-CLOSED money gate + PIN-gated cap controls. It ships DARK for EVERYONE — \`routingSpend.money.enabled\` is an explicit operator enable (never the dev-agent gate), and even enabled, every paid door stays deny-by-default until the operator PIN-arms it. All routes 503 while dark — say so honestly rather than guessing.
192
+ - **Adjust caps / arm a door / unfreeze (PIN plan flow):** render the canonical plan first — \`curl -X POST -H "Authorization: Bearer $AUTH" http://localhost:${port}/routing-spend/plan -H 'Content-Type: application/json' -d '{"action":"caps-adjust","keyRef":"metered_openrouter_bench","provider":"openrouter","lifetimeCapUsd":60,"dailyCapUsd":25}'\` → show the operator the \`renderedText\`; the operator approves with their PIN → \`POST /routing-spend/caps/adjust\` \`{"pin":"<dashboard PIN>","planId":"…","nonce":"…"}\`. The commit derives SOLELY from the rendered plan — a field the operator never saw rendered cannot land. NEVER ask the user to paste the PIN into chat; point them at the dashboard Spend tab controls.
193
+ - **FREEZE a key (Bearer — instant, always available to you):** \`curl -X POST -H "Authorization: Bearer $AUTH" http://localhost:${port}/routing-spend/freeze -d '{"keyRef":"metered_openrouter_bench"}'\` — set-TRUE-only; halting money is always cheap. UNFREEZING is the operator's PIN action, never yours.
194
+ - **Audit trail:** \`GET /routing-spend/caps/log\` — every cap/arm/freeze change with canonical before+after state.
195
+ - **When to use** (PROACTIVE): a runaway paid-spend concern → FREEZE first, ask questions after. User says "raise the cap / arm the paid door" → drive the plan flow and hand them the rendered plan + the dashboard for the PIN — never improvise a config edit (\`PATCH /config\` structurally cannot touch money state, by design).
196
+ `;
197
+ }
182
198
  /**
183
199
  * CLAUDE.md note for the second wedge-signature family (2026-06-05 EXO
184
200
  * incident) + the API fresh-respawn lever. Appended to NEW installs as part of
@@ -4673,6 +4689,14 @@ setTimeout(() => process.exit(0), 2000);
4673
4689
  patched = true;
4674
4690
  result.upgraded.push('CLAUDE.md: added Routing Spend view section');
4675
4691
  }
4692
+ // Routing Spend MONEY layer (Increment B) — Agent Awareness + Migration Parity:
4693
+ // existing agents learn the PIN plan flow + the Bearer freeze + the dark-by-default
4694
+ // posture. Content-sniff on the unique heading keeps it idempotent.
4695
+ if (!content.includes('Routing Spend MONEY layer')) {
4696
+ content += ROUTING_SPEND_MONEY_CLAUDEMD_SECTION(port);
4697
+ patched = true;
4698
+ result.upgraded.push('CLAUDE.md: added Routing Spend MONEY layer section');
4699
+ }
4676
4700
  // The Agent Carries the Loop (agent-owned-followthrough C1+C2) — agent
4677
4701
  // awareness for the owner⟂blockedOn commitment model + the probe + that the
4678
4702
  // user is never status-pinged for an agent-owned commitment. Content-sniffed.