instar 1.3.330 → 1.3.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 (54) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +145 -17
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/AnthropicSubscriptionRouter.d.ts +68 -0
  5. package/dist/core/AnthropicSubscriptionRouter.d.ts.map +1 -0
  6. package/dist/core/AnthropicSubscriptionRouter.js +82 -0
  7. package/dist/core/AnthropicSubscriptionRouter.js.map +1 -0
  8. package/dist/core/InteractivePoolIntelligenceProvider.d.ts +38 -0
  9. package/dist/core/InteractivePoolIntelligenceProvider.d.ts.map +1 -0
  10. package/dist/core/InteractivePoolIntelligenceProvider.js +61 -0
  11. package/dist/core/InteractivePoolIntelligenceProvider.js.map +1 -0
  12. package/dist/core/LiveTailSource.d.ts +19 -0
  13. package/dist/core/LiveTailSource.d.ts.map +1 -1
  14. package/dist/core/LiveTailSource.js +21 -0
  15. package/dist/core/LiveTailSource.js.map +1 -1
  16. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  17. package/dist/core/PostUpdateMigrator.js +17 -0
  18. package/dist/core/PostUpdateMigrator.js.map +1 -1
  19. package/dist/core/intelligenceProviderFactory.d.ts +21 -0
  20. package/dist/core/intelligenceProviderFactory.d.ts.map +1 -1
  21. package/dist/core/intelligenceProviderFactory.js +24 -1
  22. package/dist/core/intelligenceProviderFactory.js.map +1 -1
  23. package/dist/core/types.d.ts +38 -0
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/core/types.js.map +1 -1
  26. package/dist/providers/adapters/anthropic-interactive-pool/config.d.ts +17 -0
  27. package/dist/providers/adapters/anthropic-interactive-pool/config.d.ts.map +1 -1
  28. package/dist/providers/adapters/anthropic-interactive-pool/config.js +1 -0
  29. package/dist/providers/adapters/anthropic-interactive-pool/config.js.map +1 -1
  30. package/dist/providers/adapters/anthropic-interactive-pool/pool.d.ts +16 -2
  31. package/dist/providers/adapters/anthropic-interactive-pool/pool.d.ts.map +1 -1
  32. package/dist/providers/adapters/anthropic-interactive-pool/pool.js +95 -5
  33. package/dist/providers/adapters/anthropic-interactive-pool/pool.js.map +1 -1
  34. package/dist/providers/bootRegistration.d.ts +83 -0
  35. package/dist/providers/bootRegistration.d.ts.map +1 -0
  36. package/dist/providers/bootRegistration.js +158 -0
  37. package/dist/providers/bootRegistration.js.map +1 -0
  38. package/dist/providers/costAwareRouting.d.ts +16 -0
  39. package/dist/providers/costAwareRouting.d.ts.map +1 -1
  40. package/dist/providers/costAwareRouting.js +37 -21
  41. package/dist/providers/costAwareRouting.js.map +1 -1
  42. package/dist/scaffold/templates.d.ts.map +1 -1
  43. package/dist/scaffold/templates.js +5 -0
  44. package/dist/scaffold/templates.js.map +1 -1
  45. package/dist/server/routes.d.ts.map +1 -1
  46. package/dist/server/routes.js +26 -1
  47. package/dist/server/routes.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/data/builtin-manifest.json +63 -63
  50. package/src/scaffold/templates.ts +5 -0
  51. package/upgrades/1.3.331.md +77 -0
  52. package/upgrades/1.3.332.md +42 -0
  53. package/upgrades/side-effects/livetail-stale-signal.md +43 -0
  54. package/upgrades/side-effects/provider-substrate-live-wiring.md +145 -0
@@ -0,0 +1,42 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ Audit fix #3 under "No Unbounded Loops" (P19, Eternal Sentinel condition 4):
9
+ the live-tail flusher's capped backoff (#867) correctly retries a failing topic
10
+ forever, but a topic whose standby copy went stale never said so. Now a
11
+ per-topic episode latch (the `SlowRetrySentinelEscalation` shape) fires once
12
+ per outage when flushes have failed ≥30min: one log line + one
13
+ `DegradationReporter` record (`LiveTail.standbyFreshness`, topic NAME included,
14
+ housekeeping channel — the reporter's per-feature 1h cooldown bounds even an
15
+ all-topics-stale storm to a single alert). Success clears the episode. The
16
+ `reportStaleStandby` dep is optional — omitted, behavior is byte-identical.
17
+
18
+ ## What to Tell Your User
19
+
20
+ Only relevant if I run on more than one machine: when the standby machine's
21
+ copy of a conversation falls behind for over half an hour (because syncs to it
22
+ keep failing), that fact is now recorded in my health/degradation log instead
23
+ of being invisible. Nothing pings you — but if a machine takeover ever resumes
24
+ a conversation from an older point, there's now a checkable record explaining
25
+ exactly which conversation was behind and since when.
26
+
27
+ ## Summary of New Capabilities
28
+
29
+ - Stale-standby visibility: one degradation record per conversation per outage
30
+ when cross-machine sync has been failing ≥30min (`LiveTail.standbyFreshness`
31
+ in the degradation log / Process Health surfaces); retries continue
32
+ unchanged. No configuration needed.
33
+
34
+ ## Evidence
35
+
36
+ Gap noted by #867's own second-pass reviewer ("backoff but no breaker") and
37
+ resolved per the ratified Eternal Sentinel clause: persistence kept, silence
38
+ removed. Focused adversarial second-pass: CONCUR (episode timing, firing bound
39
+ = threshold + one backoff window, recordNoNewContent edge traced safe,
40
+ DegradationReporter flood analysis). Tests: 21 green in LiveTailSource.test.ts
41
+ incl. the P19 sustained-failure bound (~100 failing windows → exactly 1
42
+ signal) and the server.ts wiring pin; tsc clean.
@@ -0,0 +1,43 @@
1
+ # Side-Effects Review — Live-Tail Stale-Standby Signal
2
+
3
+ **Version / slug:** `livetail-stale-signal`
4
+ **Date:** `2026-06-06`
5
+ **Author:** `Echo (instar-dev agent)`
6
+ **Second-pass reviewer:** `focused adversarial reviewer subagent — CONCUR (all four novel-integration probes clean; the episode-latch pattern itself carries two same-night CONCUR reviews)`
7
+
8
+ ## Summary of the change
9
+
10
+ `LiveTailSource` gains the Eternal Sentinel's condition-4 observability for its capped-backoff retry loop: per-topic `failingSince` episode stamp + episode-keyed one-shot latch; the first attempt at/after `staleSignalAfterMs` (default 30min) logs once and calls the optional `reportStaleStandby` dep once per episode; success clears both. `server.ts` wires the dep to `DegradationReporter` (`LiveTail.standbyFreshness`, topic name resolved). Files: `LiveTailSource.ts`, one wiring block in `server.ts`, tests.
11
+
12
+ ## Decision-point inventory
13
+
14
+ - `LiveTailSource` failure branch — **modify (additive)** — adds episode accounting + one-shot signal; backoff, retry, delta, and seq semantics untouched.
15
+ - `server.ts` LiveTailSource construction — **modify** — wires the reporter dep.
16
+
17
+ ## 1. Over-block / 2. Under-block
18
+
19
+ Nothing blocked — pure signal. Detection bound: threshold + one backoff window (≤5min at cap; reviewer-confirmed attempts always resume when the window opens). Known pre-existing edge (traced by reviewer, probe 3): content reverted to exactly-streamed state while failures>0 keeps rebuilding content per tick (version gate stays bypassed) — a #867-era micro-inefficiency in a bizarre edge, unchanged here; `failingSince` persisting there is correct (success remains the only exit). Remaining audit targets <!-- tracked: CMT-1109 -->.
20
+
21
+ ## 3. Level-of-abstraction fit / 4. Signal vs authority
22
+
23
+ The latch lives in the loop it observes (third use of the established suppressor shape tonight); delivery rides the standard degradation channel — deliberately NOT the attention queue or Telegram (a stale standby copy is operator-relevant housekeeping, not a user decision). **Signal-only** per `docs/signal-vs-authority.md`: the dep can only record; removing it restores byte-identical behavior (test-pinned).
24
+
25
+ ## 5. Interactions
26
+
27
+ - **Concurrency:** flushAll is sequential; all map mutations are post-await synchronous code — no double-stamp path (reviewer probe 1).
28
+ - **Flood:** all topics share ONE reporter feature key with a 1h alert cooldown — N simultaneously-stale topics ⇒ at most one user-facing alert; per-topic records remain for inspection (reviewer probe 4). Bounded Notification Surface: no topic creation, no per-element pings.
29
+ - **Handoff force path:** shares failure accounting — a forced attempt's failure correctly extends the episode.
30
+
31
+ ## 6. External surfaces / 7. Rollback
32
+
33
+ Logs + degradation records only; no API/schema/config/persistent state (defaults in code; dep optional). Rollback = revert; only the silence returns.
34
+
35
+ ## Conclusion
36
+
37
+ Third and final observability fix in tonight's P19 series: the reaper loop got its back-off (#863), the supervisor healer got its voice (#871), the lease wire got its brakes (#874), and now the live-tail's sanctioned forever-retry can no longer go quietly stale. Persistence everywhere, silence nowhere.
38
+
39
+ ---
40
+
41
+ ## Phase 5 — Second-pass review (cross-machine continuity → performed)
42
+
43
+ The episode-keyed one-shot latch pattern carries two same-night line-level CONCUR reviews (supervisor escalation; mesh brakes). A focused adversarial pass probed only this PR's novel integration points: (1) episode-stamp timing across the awaited broadcast + same-topic concurrency — no double-stamp (sequential flushAll, single-threaded post-await mutations); (2) firing bound under backoff gating — threshold + ≤1 backoff window, and no stuck-in-backoff-without-attempts path exists; (3) the `recordNoNewContent`-while-failing edge — traced: cannot fire spuriously, cannot wedge, success is the only episode exit; (4) DegradationReporter flood analysis — per-feature 1h cooldown caps user-facing volume at one alert regardless of topic count. Ran the 21-test suite + tsc — green/clean. **Verdict: CONCUR.**
@@ -0,0 +1,145 @@
1
+ # Side-Effects Review — Provider-Substrate Live Wiring (June-15 readiness PR 1)
2
+
3
+ **Version / slug:** `provider-substrate-live-wiring`
4
+ **Date:** `2026-06-05`
5
+ **Author:** `echo (Claude Opus)`
6
+ **Second-pass reviewer:** `5-agent verification panel (build Phase 3, LARGE)`
7
+
8
+ ## Summary of the change
9
+
10
+ Wires the already-built provider substrate into production: registers both
11
+ Anthropic adapters with the providers registry at server boot (gated,
12
+ idempotent, lazy), plumbs a real TTL-cached SDK-credit reader into the
13
+ CostAwareRoutingPolicy (replacing the `() => null` stub), and adds an
14
+ opt-in `intelligence.subscriptionPath` mode (`off`/`auto`/`force`) that
15
+ routes the internal-intelligence funnel between `claude -p` (SDK-credit
16
+ path) and the interactive REPL pool (subscription floor) per spec 04
17
+ Rule 1. Files: `src/providers/bootRegistration.ts` (new),
18
+ `src/core/InteractivePoolIntelligenceProvider.ts` (new),
19
+ `src/core/AnthropicSubscriptionRouter.ts` (new),
20
+ `src/providers/costAwareRouting.ts` (decision extracted to shared pure fn),
21
+ `src/providers/adapters/anthropic-interactive-pool/{config,pool}.ts`
22
+ (model knob), `src/core/intelligenceProviderFactory.ts` (option),
23
+ `src/core/types.ts` (config type), `src/commands/server.ts` (boot+shutdown
24
+ wiring), `src/server/routes.ts` (GET /providers/registry).
25
+
26
+ ## Decision-point inventory
27
+
28
+ - `registerAnthropicAdapters` gates (claudeForbidden, enabledFrameworks) — add — refuse Claude adapters on codex-only agents
29
+ - `decideSdkVsSubscription` (extracted) — modify (refactor, semantics identical, existing tests pass) — SDK-pot vs subscription threshold
30
+ - `AnthropicSubscriptionRouter.evaluate` mode branch — add — off/auto/force routing of internal LLM calls
31
+ - `buildIntelligenceProvider` claude-code case — modify — wraps with router ONLY when the new option is passed; otherwise byte-identical
32
+ - shutdown pool dispose — add — kills pool tmux sessions at server stop
33
+ - `GET /providers/registry` — add — read-only introspection
34
+
35
+ ## 1. Over-block
36
+
37
+ **What legitimate inputs does this change reject that it shouldn't?**
38
+
39
+ In `force` mode, a pool outage (tmux missing, spawn failure) makes internal
40
+ LLM calls fail even though `claude -p` would have worked — by design (force
41
+ mode's contract is zero `claude -p` traffic), and loudly. Fleet default is
42
+ `off`, so nobody is exposed without an explicit flip. The codex-only gate
43
+ refuses registration on codex-only agents — correct, mirrors the existing
44
+ ClaudeCliIntelligenceProvider guard. No other block/allow surface.
45
+
46
+ ## 2. Under-block
47
+
48
+ **What should be rejected but passes?**
49
+
50
+ `auto` mode falls back across paths on ANY primary error, including
51
+ prompt-shaped errors (e.g. timeout from an oversized prompt) where the
52
+ retry will likely fail again — one wasted call, bounded (exactly one
53
+ fallback attempt, then a loud throw). The pool's `--dangerously-skip-
54
+ permissions` spawn means a prompt-injected judgment call could in principle
55
+ invoke tools inside the pool session; mitigated by the empty scratch
56
+ workdir and unchanged from the adapter's prototyped+parity-tested shape;
57
+ hardening is tracked in the spec (CMT-1105).
58
+
59
+ ## 3. Level-of-abstraction fit
60
+
61
+ Registration lives in `src/providers/` (substrate layer), the two
62
+ IntelligenceProvider implementations in `src/core/` next to their peers,
63
+ and the mode wiring at the composition root (server.ts) — matching the
64
+ existing layering (IntelligenceRouter precedent). The threshold logic was
65
+ EXTRACTED to one shared pure function rather than duplicated across the
66
+ two routing layers.
67
+
68
+ ## 4. Signal vs authority compliance
69
+
70
+ The router treats config (`mode`) as authority and credit snapshots as
71
+ signal: unknown signal degrades conservatively (subscription floor), never
72
+ blocks the call path. onRoute/onDegrade are observability taps with no
73
+ authority. No LLM judgment gates any decision here — all routing is
74
+ deterministic from config + credit state.
75
+
76
+ ## 5. Interactions
77
+
78
+ - **Circuit breaker**: router sits INSIDE the breaker wrap — a rate-limit
79
+ on the surviving path still trips the account-global breaker. Unchanged
80
+ for mode off.
81
+ - **Per-component IntelligenceRouter**: claude-code builds inherit the same
82
+ subscriptionPath option, so codex-default agents with claude-routed
83
+ components stay consistent.
84
+ - **/metrics/features**: pool-served calls still attribute calls+latency;
85
+ token columns read 0 (pool reports no per-call usage; onUsage is
86
+ deliberately not invoked with fake zeros).
87
+ - **SessionReaper/tmux tooling**: pool sessions are named `instar-pool-*`;
88
+ they are adapter-managed (maxIdle 30m, maxMessages 50, dispose at
89
+ shutdown). Reaper does not manage them (they are not instar sessions in
90
+ the session store).
91
+ - **QuotaTracker**: unaffected — file-based scheduler shedding stays as-is.
92
+
93
+ ## 6. External surfaces
94
+
95
+ `GET /providers/registry` (Bearer-authed like its router peers) returns
96
+ adapter ids + capability flag names + a policy-installed boolean. No prompt
97
+ content, no credentials; integration test asserts no key-material shapes in
98
+ the payload. The usage-meter call (`/api/oauth/usage`) is the EXISTING
99
+ read-only observability exception under spec 04 Rule 2, now TTL-cached
100
+ (60s) so routing volume cannot hammer it.
101
+
102
+ ## 7. Rollback cost
103
+
104
+ Mode is config-gated default-off: rollback = remove the config key (or set
105
+ `off`) + restart — no data, no state, no migration. Registration itself is
106
+ inert without the mode (lazy pool, no spawns). Worst-case orphan: pool tmux
107
+ sessions if the server dies UNgracefully mid-soak; bounded by poolSize
108
+ (default 2) and visible via `tmux ls` (`instar-pool-*`).
109
+
110
+ ## Conclusion
111
+
112
+ Ship. Default-off + pinned-argv invariance test means zero fleet behavior
113
+ change at merge; the June-15 lever becomes a config flip backed by 44 new
114
+ tests across all three tiers.
115
+
116
+ ## Second-pass review (if required)
117
+
118
+ Build Phase 3 runs the 5-agent verification panel (LARGE build) before
119
+ commit; findings folded back into code/spec before the convergence tag.
120
+
121
+ ## Evidence pointers
122
+
123
+ - Unit: `tests/unit/providers/bootRegistration.test.ts`,
124
+ `tests/unit/anthropic-subscription-router.test.ts`,
125
+ `tests/unit/intelligence-provider-factory-subscription-path.test.ts`,
126
+ `tests/unit/providers/adapters/anthropic-interactive-pool/pool-model-flag.test.ts`
127
+ - Integration: `tests/integration/providers-registry-route.test.ts`
128
+ - E2E: `tests/e2e/provider-substrate-live-wiring.test.ts`
129
+ - Spec: `docs/specs/provider-substrate-live-wiring.md` (+ `.eli16.md`)
130
+ - Live exposure measurement driving the work: /metrics/features 24h on echo
131
+ (~1,014 real internal calls, ~26.7M tokens-in).
132
+
133
+ ## CI-green follow-up (same PR)
134
+
135
+ - New side effect: a FAILED boot registration/policy install now emits a
136
+ DegradationReporter event (`serverBoot.anthropicProviderRegistration`) in
137
+ addition to the yellow boot log line — so a dark June-15 routing install is
138
+ visible in the degradation feed, not just scrollback. No behavior change on
139
+ the success path.
140
+ - Silent-fallback ratchet lowered 459 → 458 (that catch is now reporter-wired);
141
+ two non-degradation catches carry in-brace `@silent-fallback-ok`
142
+ justifications (raced tmux kill-session; HTTP 500 surfaced to caller).
143
+ - `/providers/registry` tracked in the feature-delivery-completeness guard
144
+ (read-surface class, like `/session/clock`; no framework shadow — the lever
145
+ only applies to claude-code internal traffic).