instar 1.3.235 → 1.3.236

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 (43) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +41 -0
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/CircuitBreakingIntelligenceProvider.d.ts +1 -1
  5. package/dist/core/CircuitBreakingIntelligenceProvider.d.ts.map +1 -1
  6. package/dist/core/CircuitBreakingIntelligenceProvider.js +5 -2
  7. package/dist/core/CircuitBreakingIntelligenceProvider.js.map +1 -1
  8. package/dist/core/IntelligenceRouter.d.ts +82 -0
  9. package/dist/core/IntelligenceRouter.d.ts.map +1 -0
  10. package/dist/core/IntelligenceRouter.js +108 -0
  11. package/dist/core/IntelligenceRouter.js.map +1 -0
  12. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  13. package/dist/core/PostUpdateMigrator.js +18 -0
  14. package/dist/core/PostUpdateMigrator.js.map +1 -1
  15. package/dist/core/componentCategories.d.ts +37 -0
  16. package/dist/core/componentCategories.d.ts.map +1 -0
  17. package/dist/core/componentCategories.js +84 -0
  18. package/dist/core/componentCategories.js.map +1 -0
  19. package/dist/core/intelligenceProviderFactory.d.ts +8 -0
  20. package/dist/core/intelligenceProviderFactory.d.ts.map +1 -1
  21. package/dist/core/intelligenceProviderFactory.js +3 -3
  22. package/dist/core/intelligenceProviderFactory.js.map +1 -1
  23. package/dist/core/types.d.ts +26 -0
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/core/types.js.map +1 -1
  26. package/dist/scaffold/templates.d.ts.map +1 -1
  27. package/dist/scaffold/templates.js +6 -0
  28. package/dist/scaffold/templates.js.map +1 -1
  29. package/dist/server/AgentServer.d.ts.map +1 -1
  30. package/dist/server/AgentServer.js +3 -0
  31. package/dist/server/AgentServer.js.map +1 -1
  32. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  33. package/dist/server/CapabilityIndex.js +1 -0
  34. package/dist/server/CapabilityIndex.js.map +1 -1
  35. package/dist/server/routes.d.ts +2 -0
  36. package/dist/server/routes.d.ts.map +1 -1
  37. package/dist/server/routes.js +27 -0
  38. package/dist/server/routes.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/data/builtin-manifest.json +64 -64
  41. package/src/scaffold/templates.ts +6 -0
  42. package/upgrades/1.3.236.md +53 -0
  43. package/upgrades/side-effects/per-component-framework-routing.md +88 -0
@@ -0,0 +1,88 @@
1
+ # Side-Effects Review — Per-component framework routing (B1)
2
+
3
+ **Version / slug:** `per-component-framework-routing`
4
+ **Date:** `2026-06-03`
5
+ **Author:** `Echo (instar-dev agent)`
6
+ **Tier:** `2` (new capability; converged + approved spec: docs/specs/per-component-framework-routing.md)
7
+ **Second-pass reviewer:** `not required (the converged spec already carries a 2-reviewer adversarial+integration pass)`
8
+
9
+ ## Summary of the change
10
+ Adds an `IntelligenceRouter` at the single LLM funnel so different internal components
11
+ (sentinels, gates, …) can be routed to different agentic frameworks (e.g. all sentinels on
12
+ Codex while the agent stays on Claude), to move that LLM chatter off the Claude rate-limit
13
+ budget. ABSENT-by-default config ⇒ byte-identical to today.
14
+
15
+ New / changed:
16
+ - `src/core/componentCategories.ts` (NEW) — component-name → category registry + resolver.
17
+ - `src/core/IntelligenceRouter.ts` (NEW) — funnel-level, per-call, per-framework routing with
18
+ per-framework circuit breakers and circuit-aware fallback.
19
+ - `src/core/intelligenceProviderFactory.ts` — additive `breaker?` option threaded to the wrap
20
+ calls (lets the router give each framework its OWN breaker).
21
+ - `src/core/CircuitBreakingIntelligenceProvider.ts` — `wrapIntelligenceWithCircuitBreaker`
22
+ gains an optional `breaker` param (default unchanged = global singleton).
23
+ - `src/core/types.ts` — additive `attribution.category?` on IntelligenceOptions; additive
24
+ `sessions.componentFrameworks?` config (TYPE-ONLY — NOT added to ConfigDefaults).
25
+ - `src/commands/server.ts` — wrap the shared provider in the router in its OWN try/catch.
26
+ - `tests/unit/intelligence-router.test.ts` (NEW) — 11 tests.
27
+
28
+ ## Decision-point inventory
29
+ - `IntelligenceRouter.evaluate` routing — **add** — chooses WHICH framework answers; no
30
+ block/allow authority (providers are signal). The one safety branch is fallback (D4).
31
+ - `wrapIntelligenceWithCircuitBreaker` / factory `breaker?` — **modify (additive)** — default
32
+ path unchanged; only the router passes a distinct breaker.
33
+
34
+ ## 1. Over-block / 2. Under-block
35
+ No block/allow surface — providers are SIGNAL. The router cannot block a running agent; the
36
+ worst it does is degrade-and-report (D4). Unconfigured, it is a transparent passthrough.
37
+
38
+ ## 3. Level-of-abstraction fit
39
+ Correct — the router sits at the existing `CircuitBreakingIntelligenceProvider` funnel (the
40
+ one chokepoint every `.evaluate()` already passes), so it covers ALL callers (including the
41
+ config-path and inline-closure ones) without editing 38 call sites — Structure > Willpower.
42
+
43
+ ## 4. Signal vs authority compliance
44
+ **Reference:** docs/signal-vs-authority.md. [x] No block/allow surface of its own. Routing
45
+ changes which model answers; it adds no gate. The per-framework breakers are the existing
46
+ breaker authority, now correctly ISOLATED per framework (a Claude trip no longer pauses Codex)
47
+ — a correctness improvement, not a new authority.
48
+
49
+ ## 5. Interactions
50
+ - **Breaker isolation:** each non-default framework gets a distinct `new LlmCircuitBreaker()`
51
+ (proven by unit test — a routed call reaches a different provider instance than the default).
52
+ The default framework keeps the global singleton, so status/health surfaces are unchanged for
53
+ it. (Per-framework breaker states are additionally surfaced via GET /intelligence/routing —
54
+ part 2 of B1, see "Remaining".)
55
+ - **Fallback (D4):** binary-missing → degrade to default + DegradationReporter (no silent
56
+ fallback — composes with Task-1's re-armed gate); rate-limited → LlmCircuitOpenError
57
+ propagates and the caller swallows it into its heuristic (NO herd onto Claude).
58
+ - **Cascade-503:** the router is built in its OWN try/catch in server boot; a build failure
59
+ leaves the raw provider, never 503s the server.
60
+ - **Config:** type-only; NOT in ConfigDefaults (applyDefaults deep-merge would otherwise inject
61
+ it everywhere and break absent-equals-unchanged).
62
+
63
+ ## 6. External surfaces
64
+ - (Remaining in this PR) `GET /intelligence/routing` read-only surface + its CapabilityIndex
65
+ classification (the #727 lesson). No persistent state. Config: `sessions.componentFrameworks`
66
+ (opt-in, absent by default).
67
+
68
+ ## 7. Rollback cost
69
+ Pure additive + opt-in. Remove `componentFrameworks` (or revert) → every call routes to the
70
+ single shared provider exactly as today. No state, no migration.
71
+
72
+ ## Conclusion
73
+ B1 complete across all three test tiers (tsc clean): per-call funnel resolution,
74
+ per-framework breaker isolation, circuit-aware fallback, live-config (hot), the category
75
+ registry, factory breaker-threading, config type, server wiring, the `GET /intelligence/routing`
76
+ read surface (+ CapabilityIndex INTERNAL_PREFIXES classification — the #727 lesson),
77
+ CLAUDE.md agent-awareness (template + migrateClaudeMd for existing agents). Tests: 11 unit
78
+ (`intelligence-router.test.ts`) + 3 integration (`intelligence-routing-routes.test.ts`,
79
+ 200/503) + 3 e2e (`intelligence-routing-lifecycle.test.ts`, feature-alive on the real
80
+ AgentServer init path + Bearer-auth + read-only). The design was converged (2-reviewer
81
+ adversarial+integration) which corrected the breaker-isolation and resolution-point design
82
+ before any code — see the spec's Convergence Report. B2 (gates/reflectors + per-framework
83
+ spend accounting + dashboard view) is a deliberate follow-up.
84
+
85
+ ## Evidence pointers
86
+ - `tsc --noEmit` clean.
87
+ - `vitest run tests/unit/intelligence-router.test.ts` → 11/11 pass (resolution precedence,
88
+ dispatch, per-framework instance isolation, fallback both modes, live-config hot, for() surface).