instar 1.3.783 → 1.3.784

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 (41) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +41 -15
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/MachineIdentity.d.ts +13 -0
  5. package/dist/core/MachineIdentity.d.ts.map +1 -1
  6. package/dist/core/MachineIdentity.js +31 -0
  7. package/dist/core/MachineIdentity.js.map +1 -1
  8. package/dist/core/MeteredSpendGate.d.ts +8 -0
  9. package/dist/core/MeteredSpendGate.d.ts.map +1 -1
  10. package/dist/core/MeteredSpendGate.js +20 -0
  11. package/dist/core/MeteredSpendGate.js.map +1 -1
  12. package/dist/core/SpendAlertDispatcher.d.ts +94 -0
  13. package/dist/core/SpendAlertDispatcher.d.ts.map +1 -0
  14. package/dist/core/SpendAlertDispatcher.js +168 -0
  15. package/dist/core/SpendAlertDispatcher.js.map +1 -0
  16. package/dist/core/SpendAlertEmitters.d.ts +118 -0
  17. package/dist/core/SpendAlertEmitters.d.ts.map +1 -0
  18. package/dist/core/SpendAlertEmitters.js +220 -0
  19. package/dist/core/SpendAlertEmitters.js.map +1 -0
  20. package/dist/core/SpendAlertResolver.d.ts +12 -0
  21. package/dist/core/SpendAlertResolver.d.ts.map +1 -1
  22. package/dist/core/SpendAlertResolver.js +34 -0
  23. package/dist/core/SpendAlertResolver.js.map +1 -1
  24. package/dist/core/TelegramSpendTopicChannel.d.ts +50 -0
  25. package/dist/core/TelegramSpendTopicChannel.d.ts.map +1 -0
  26. package/dist/core/TelegramSpendTopicChannel.js +106 -0
  27. package/dist/core/TelegramSpendTopicChannel.js.map +1 -0
  28. package/dist/core/types.d.ts +22 -2
  29. package/dist/core/types.d.ts.map +1 -1
  30. package/dist/core/types.js.map +1 -1
  31. package/dist/server/AgentServer.d.ts +16 -0
  32. package/dist/server/AgentServer.d.ts.map +1 -1
  33. package/dist/server/AgentServer.js +173 -46
  34. package/dist/server/AgentServer.js.map +1 -1
  35. package/dist/testing/selfActionRegistry.d.ts.map +1 -1
  36. package/dist/testing/selfActionRegistry.js +128 -0
  37. package/dist/testing/selfActionRegistry.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/data/builtin-manifest.json +3 -3
  40. package/upgrades/1.3.784.md +59 -0
  41. package/upgrades/side-effects/routing-spend-increment-c.md +44 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwDH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAyBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA6H7D,OAAO,KAAK,EAAW,oBAAoB,EAAe,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgFtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAgmDD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,oBAAoB,GAAG,IAAI,GACxC;IACD,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,C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AE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -5801,6 +5801,14 @@ export async function startServer(options) {
5801
5801
  });
5802
5802
  }
5803
5803
  catch { /* never break the LLM path on a degradation report */ }
5804
+ // Increment C fallback counting (spec "Fallback used"): every served
5805
+ // fallback (a swap-tail/degrade position answering instead of the
5806
+ // primary) increments the Near-Silent hourly counter; a Telegram digest
5807
+ // line fires ONLY on the rate-spike ceiling. Observer-isolated.
5808
+ try {
5809
+ _agentServerRef?.getSpendAlertEmitters?.()?.onNatureRoutePlan({ dryRun: false, servedFallback: true });
5810
+ }
5811
+ catch { /* @silent-fallback-ok: observer isolation (I-9) — the fallback counter is a notifier, never the LLM path */ }
5804
5812
  },
5805
5813
  // Never-silent tracking (Resilient Degradation Ladder §4): a non-gating call that
5806
5814
  // exhausts the ladder (→ caller heuristic) opens a tracked degradation; a successful
@@ -5835,23 +5843,41 @@ export async function startServer(options) {
5835
5843
  };
5836
5844
  },
5837
5845
  onNatureRoutePlan: (plan) => {
5838
- // A2.1 observe-only breadcrumb (env-gated so a dev agent's hot path stays quiet;
5839
- // the durable logs/nature-routing.jsonl + GET /intelligence/routing dryRun plan
5840
- // surface are the tracked A2.2 remainder). Never breaks the LLM call path.
5846
+ // I-9 (Increment C): onNatureRoutePlan is a SINGLE optional callback
5847
+ // fan out to each subscriber with observer ISOLATION (throw-swallow per
5848
+ // subscriber; one throwing never breaks the LLM path or double-fires
5849
+ // the others). Subscribers: (1) the A2.1 env-gated console breadcrumb;
5850
+ // (2) the spend-alert emitters (door-dark / fallback-spike), resolved
5851
+ // LATE via the AgentServer accessor so construction order never races.
5841
5852
  try {
5842
- if (process.env.INSTAR_NATURE_ROUTING_LOG !== '1')
5843
- return;
5844
- const r = plan.resolution;
5845
- const detail = r && r.outcome === 'route'
5846
- ? `chain=${r.resolvedChain} primary=${r.primary.door}/${r.primary.modelId}` +
5847
- `${r.primary.clamped ? ' (clamped)' : ''} tail=${r.swapTail.length}`
5848
- : plan.failClosed
5849
- ? 'FAIL-CLOSED (critical gate, no door)'
5850
- : `outcome=${r?.outcome ?? 'n/a'}`;
5851
- console.log(`[nature-routing] ${plan.component ?? '(none)'} (${plan.category}) ${detail} ` +
5852
- `dryRun=${plan.dryRun}`);
5853
+ if (process.env.INSTAR_NATURE_ROUTING_LOG === '1') {
5854
+ const r = plan.resolution;
5855
+ const detail = r && r.outcome === 'route'
5856
+ ? `chain=${r.resolvedChain} primary=${r.primary.door}/${r.primary.modelId}` +
5857
+ `${r.primary.clamped ? ' (clamped)' : ''} tail=${r.swapTail.length}`
5858
+ : plan.failClosed
5859
+ ? 'FAIL-CLOSED (critical gate, no door)'
5860
+ : `outcome=${r?.outcome ?? 'n/a'}`;
5861
+ console.log(`[nature-routing] ${plan.component ?? '(none)'} (${plan.category}) ${detail} ` +
5862
+ `dryRun=${plan.dryRun}`);
5863
+ }
5864
+ }
5865
+ catch { /* @silent-fallback-ok: the env-gated console breadcrumb is observability — never break the LLM path on an observation */ }
5866
+ try {
5867
+ const emitters = _agentServerRef?.getSpendAlertEmitters?.();
5868
+ emitters?.onNatureRoutePlan({
5869
+ component: plan.component,
5870
+ dryRun: plan.dryRun,
5871
+ failClosed: plan.failClosed,
5872
+ resolution: plan.resolution,
5873
+ // A served fallback = a swap/degrade position answering instead of
5874
+ // the primary. That signal rides the router's onDegrade callback
5875
+ // (wired below in this file) — at RESOLUTION time only fail-closed
5876
+ // (door-dark) is derivable here.
5877
+ servedFallback: false,
5878
+ });
5853
5879
  }
5854
- catch { /* never break the LLM path on an observation */ }
5880
+ catch { /* @silent-fallback-ok: observer isolation (I-9) — a notifier failure never breaks the LLM path */ }
5855
5881
  },
5856
5882
  });
5857
5883
  }