instar 1.3.775 → 1.3.776

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 (37) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +128 -1
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +21 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/OrchestratorActuator.d.ts +90 -0
  8. package/dist/core/OrchestratorActuator.d.ts.map +1 -0
  9. package/dist/core/OrchestratorActuator.js +88 -0
  10. package/dist/core/OrchestratorActuator.js.map +1 -0
  11. package/dist/core/OscillationBreaker.d.ts +46 -0
  12. package/dist/core/OscillationBreaker.d.ts.map +1 -0
  13. package/dist/core/OscillationBreaker.js +52 -0
  14. package/dist/core/OscillationBreaker.js.map +1 -0
  15. package/dist/core/SeamlessOrchestratorEngine.d.ts +167 -0
  16. package/dist/core/SeamlessOrchestratorEngine.d.ts.map +1 -0
  17. package/dist/core/SeamlessOrchestratorEngine.js +251 -0
  18. package/dist/core/SeamlessOrchestratorEngine.js.map +1 -0
  19. package/dist/core/WriteDomainRegistry.d.ts.map +1 -1
  20. package/dist/core/WriteDomainRegistry.js +20 -0
  21. package/dist/core/WriteDomainRegistry.js.map +1 -1
  22. package/dist/monitoring/OrchestratorPoller.d.ts +64 -0
  23. package/dist/monitoring/OrchestratorPoller.d.ts.map +1 -0
  24. package/dist/monitoring/OrchestratorPoller.js +132 -0
  25. package/dist/monitoring/OrchestratorPoller.js.map +1 -0
  26. package/dist/server/AgentServer.d.ts +1 -0
  27. package/dist/server/AgentServer.d.ts.map +1 -1
  28. package/dist/server/AgentServer.js +1 -0
  29. package/dist/server/AgentServer.js.map +1 -1
  30. package/dist/server/routes.d.ts +5 -0
  31. package/dist/server/routes.d.ts.map +1 -1
  32. package/dist/server/routes.js +51 -1
  33. package/dist/server/routes.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/data/builtin-manifest.json +47 -47
  36. package/upgrades/1.3.776.md +44 -0
  37. package/upgrades/side-effects/llm-seamlessness-orchestrator.md +240 -0
@@ -0,0 +1,240 @@
1
+ # Side-Effects Review — LLM-Driven Seamlessness Orchestrator (lease-gated, propose-only, preload-focused)
2
+
3
+ **Version / slug:** `llm-seamlessness-orchestrator`
4
+ **Date:** `2026-07-05`
5
+ **Author:** Echo (autonomous)
6
+ **Second-pass reviewer:** not required (multi-reviewer spec-converge already ran on the spec, incl. cross-model codex-cli:gpt-5.5)
7
+
8
+ ## Summary of the change
9
+
10
+ Adds a lease-gated tier-1 LLM loop that ANTICIPATES which working-set artifacts a conversation will
11
+ need next and PROPOSES a bounded, side-effect-free preload — modeled on the `CartographerSweepEngine`
12
+ pattern (a pure engine + a separate cadence poller). It is **propose-only / signal-only**: the LLM
13
+ NEVER authors a machine-move; placement stays with the deterministic `RebalancePlanner`/`PlacementExecutor`.
14
+ The first PR ships spec **Phases 1-3** (skeleton + guards + brakes); Phases 4-5 (live auto-prefetch, the
15
+ feedback-outcome memory) are the spec's own operator-gated later increments. Implementation:
16
+
17
+ - **`SeamlessOrchestratorEngine.ts`** (new, pure) — `pass()` is lease-gated at entry (F2 → standby no-op),
18
+ suspends under load-shed pressure (F7), reads bounded top-N active topics + their `ready` working-set
19
+ rows (injected readers, NO HTTP in the engine), ranks DETERMINISTIC-FIRST (recency/running), and invokes
20
+ the LLM residual ONLY when there is no clear deterministic winner (F4 A/B-lift gate) on the `LlmQueue`
21
+ `background` lane inside a neutralized `<untrusted-data>` envelope. Emits ≤3 deduped proposals (F6).
22
+ - **`OrchestratorActuator.ts`** (new) — the guarded actuation layer: re-validate-at-execute (compare-and-act,
23
+ FAIL-CLOSED), yield-to-failure-movement, respect pins + user provenance, per-window disk-byte budget,
24
+ audit-BEFORE-actuate; a `preload-artifact` is the ONLY ever-auto action (side-effect-free fetch); a
25
+ `placement-signal` writes evidence to the planner and NEVER moves. `dryRun` logs would-actuate + audits and
26
+ actuates NOTHING.
27
+ - **`OrchestratorPoller.ts`** (new) — `IdleAwareCadence`-driven, reentrancy-guarded; drives `engine.pass()` →
28
+ `actuator.actuate()` per proposal → records the per-topic actuation time (feeds the F6 cooldown); idle-backoff
29
+ + a coarse consecutive-error breaker. Modeled on `CartographerSweepPoller`.
30
+ - **`OscillationBreaker.ts`** (new) — the F6 sliding-window blacklist: ≥3 actuations of a topic in a window →
31
+ blacklist (suppressed from proposals) for a TTL, with a one-shot trip signal (one attention item per episode).
32
+ - **Routes** — `POST /intelligence/seamless-orchestrator/tick` (a manual soak tick) + `GET .../audit` (the
33
+ bounded audit tail + last-tick surface); both 503 when the orchestrator is dark.
34
+ - **Server wiring** — a dev-gated-dark (`resolveDevAgentGate`), dryRun-first construction block in `server.ts`
35
+ that injects the readers/actuator-deps as tick-time closures over the existing seams (`sharedLlmQueue`,
36
+ `leaseCoordinatorRef.holdsLease()`, `sharedPressureTier()`, `ParallelActivityIndex.activities`, #4's
37
+ `WorkingSetArtifactManager.getReadyRows`, `workingSetPullCoordinator.fetchWorkingSet`); threaded into
38
+ `RouteContext` via `AgentServer`.
39
+ - **Config** — `multiMachine.seamlessOrchestrator` (dryRun-first, `enabled` omitted so the dev-gate resolves it)
40
+ in ConfigDefaults; ships to existing agents via `applyDefaults()` deep-merge (Migration Parity).
41
+
42
+ Files: `SeamlessOrchestratorEngine.ts` (new), `OrchestratorActuator.ts` (new), `OrchestratorPoller.ts` (new),
43
+ `OscillationBreaker.ts` (new), `commands/server.ts`, `server/AgentServer.ts`, `server/routes.ts`,
44
+ `config/ConfigDefaults.ts`, `core/WriteDomainRegistry.ts` + 5 test files (engine/actuator/poller/breaker/route) +
45
+ 1 modified test (dark-gate golden map).
46
+
47
+ ## Decision-point inventory
48
+
49
+ This change adds NO block/allow decision point that gates a user or another agent. Every "decision" is a
50
+ propose/suppress signal or a self-guard on the orchestrator's OWN optional action.
51
+
52
+ - Engine deterministic-first + A/B-lift gate (`SeamlessOrchestratorEngine`) — **add** — decides whether to
53
+ spend an LLM call; a "no" runs deterministic-only (a complete result), never a block.
54
+ - Actuator guards (`OrchestratorActuator`) — **add** — decide whether the orchestrator's OWN preload may run;
55
+ a refusal is a bounded no-op (nothing moves), never a user-facing block.
56
+ - `OscillationBreaker` — **add** — suppresses re-proposing a thrashing topic; suppress-only, self-clearing.
57
+ - `POST /intelligence/seamless-orchestrator/tick` — **add** — a Bearer soak trigger; 503 when dark, no block surface.
58
+
59
+ ---
60
+
61
+ ## 1. Over-block
62
+
63
+ No user/agent block surface — over-block not applicable. The nearest "reject" is the actuator refusing to
64
+ preload (pinned/provenance/failure-episode/budget) — a bounded no-op that moves nothing; and the oscillation
65
+ breaker suppressing a thrashing topic. Neither denies a user or peer anything; they only decline the
66
+ orchestrator's own optional optimization.
67
+
68
+ ## 2. Under-block
69
+
70
+ No block surface — under-block not applicable. The honest coverage gap by design: under `dryRun` (the shipped
71
+ default) NOTHING actuates, so the actuation guards + oscillation breaker are exercised only for AUDIT rows — they
72
+ become load-bearing ONLY after the operator flips the P4 live increment. The precise pin/provenance/episode
73
+ sourcing behind `revalidate()` is a tracked prerequisite for that flip (see Tracked deferrals) — not a defect
74
+ in the dark ship, where no guard decision has any effect.
75
+
76
+ ---
77
+
78
+ ## 3. Level-of-abstraction fit
79
+
80
+ Correct layer. This is a lease-gated background OPTIMIZER that PROPOSES; it re-uses existing authorities rather
81
+ than re-implementing them. Placement stays with `RebalancePlanner`/`PlacementExecutor` (the orchestrator only
82
+ feeds a signal). The preload rides the existing `WorkingSetPullCoordinator.fetchWorkingSet` (with its slices,
83
+ hash-verify, caps, `PendingPullLedger`). The LLM call rides the existing `LlmQueue` (background lane + daily cap).
84
+ Pressure rides `sharedPressureTier()`; the lease-gate rides `leaseCoordinatorRef`. The engine/poller split mirrors
85
+ the shipped `CartographerSweepEngine`/`CartographerSweepPoller`.
86
+
87
+ ## 4. Signal vs authority compliance
88
+
89
+ - [x] No — this change produces signals consumed by existing smart gates / has no block-authority surface.
90
+
91
+ The whole feature is the constitutional "an LLM loop is signal-only unless authority is earned + gated" applied
92
+ literally: the LLM emits a preload PROPOSAL or a placement SIGNAL; it never self-authorizes a move on a predicate
93
+ it evaluates itself. The one ever-auto action (`preload-artifact`) is side-effect-free (a local copy lands; no
94
+ ownership/lease mutation) and rides the coordinator's own refusals. The dark→dryRun→live ladder is operator-only,
95
+ one increment at a time.
96
+
97
+ ---
98
+
99
+ ## 5. Interactions
100
+
101
+ - **Shadowing:** the routes are new; nothing pre-existing shadows them. The orchestrator ADDS a background poller
102
+ beside the Cartographer/autonomous-heartbeat pollers; it reads shared state, writes only its own audit logs.
103
+ - **Double-fire:** the poller is reentrancy-guarded (a second tick while one runs is a no-op); the actuation cooldown
104
+ (F6, injected `lastActuatedAt`) + dedupe (`topic+action+target`) + the oscillation breaker prevent re-proposing.
105
+ It yields to failure-movement (mesh-self-heal wins) so it never fights a recovery move.
106
+ - **Races:** the engine is pure + single-flight (`inflight` guard). The per-window byte budget + per-topic cooldown
107
+ are in-process counters read at tick time; a stale read only ever UNDER-proposes (the safe direction).
108
+ - **Feedback loops:** bounded by construction — ≤3 proposals/tick, per-topic 30m cooldown, the oscillation breaker
109
+ (blacklist after 3-in-window + give-up), the poller error-breaker, and the `LlmQueue` daily spend cap. Under
110
+ `dryRun` there is no actuation to feed back at all.
111
+
112
+ ---
113
+
114
+ ## 6. External surfaces
115
+
116
+ - **Other agents on the same machine:** none — the orchestrator is a per-machine lease-gated optimizer; its routes
117
+ are Bearer-auth API.
118
+ - **Install base (Migration Parity):** existing agents receive the `multiMachine.seamlessOrchestrator` config block
119
+ via `ConfigDefaults` deepMerge (the established multiMachine-subblock path). No new hook, no settings.json change.
120
+ On the fleet the dev-gate resolves the feature OFF, so it is never constructed — zero runtime cost.
121
+ - **External systems:** none (Telegram/Slack/GitHub/Cloudflare untouched). The only external-ish call is the
122
+ in-process `LlmQueue` background lane, itself gated by the A/B-lift gate + daily cap + `dryRun`.
123
+ - **Persistent state:** NEW append-only logs under agent-home `logs/` (`orchestrator-actions.jsonl` +
124
+ `orchestrator-placement-signals.jsonl`) — per-machine soak evidence, never converged, rebuildable. The
125
+ oscillation-blacklist is in-process memory (not persisted this increment).
126
+ - **Timing/runtime:** a 15m-cadence background poller when enabled; on the fleet (dark) it is never constructed.
127
+
128
+ "No operator-facing actions" — the routes are Bearer-auth API; there is no dashboard form, grant/revoke, PIN gate,
129
+ or secret-drop surface.
130
+
131
+ ## 6b. Operator-surface quality
132
+
133
+ No operator surface — not applicable. This change touches no `dashboard/*` renderer/markup, approval page, or
134
+ grant/revoke/secret-drop form. The only human-visible artifact is the audit log (read via the Bearer `GET .../audit`).
135
+
136
+ ---
137
+
138
+ ## 7. Multi-machine posture (Cross-Machine Coherence)
139
+
140
+ **machine-local (lease-gated), with a replicated safety follow-up.** The orchestrator runs ONLY on the lease
141
+ holder (F2) — a standby machine's `pass()` is a strict no-op — so exactly one machine optimizes at a time; there
142
+ is no cross-machine double-optimize. Its audit logs are per-machine soak evidence (never converged). The ONE piece
143
+ of state the spec says SHOULD replicate is the oscillation-blacklist (so "don't move topic T again" survives a lease
144
+ failover, spec §85) — that WS2 replication is a tracked follow-up (see Tracked deferrals), load-bearing only after
145
+ the P4-live flip; a machine-local blacklist degrades safely (a new lease holder re-learns the thrash) and moves
146
+ nothing on its own. A single-machine agent holds its own lease and runs locally — a strict no-op cross-machine.
147
+
148
+ - **User-facing notices:** none in the dark ship (the oscillation trip is a `console.warn`; the deduped
149
+ attention-item raise is a tracked P4-live prerequisite). No Telegram/one-voice surface.
150
+ - **Durable state on topic transfer:** the audit logs are machine-local by design and do not need to follow a move.
151
+ - **Generated URLs:** none.
152
+
153
+ ---
154
+
155
+ ## 8. Rollback cost
156
+
157
+ - **Hot-fix release:** the whole feature ships dark (dev-gate OFF on the fleet; `dryRun:true` even on a dev agent).
158
+ Set `multiMachine.seamlessOrchestrator.enabled:false` (or leave it dev-gated) and it is never constructed. To
159
+ fully back out: revert the change and ship a patch.
160
+ - **Data migration:** the only persistent state is the append-only audit logs under `logs/` — orphaned harmlessly
161
+ on rollback (or deleted); no schema/column migration, no downtime.
162
+ - **Agent state repair:** none. The ConfigDefaults addition is idempotent and inert while dark.
163
+ - **User visibility:** none while dark.
164
+
165
+ ---
166
+
167
+ ## Conformance fixes surfaced by the local ratchet pass (pre-push)
168
+
169
+ The four constitutional-enforcement ratchets were run LOCALLY before pushing (the #4 lesson — targeted local test
170
+ runs don't exercise them). Each was a real, correct requirement, fixed:
171
+
172
+ - **Dark-gate golden map** (`lint-dev-agent-dark-gate`): the `seamlessOrchestrator` block at the TOP of the
173
+ `multiMachine` ConfigDefaults block shifted every subsequent `enabled:` line by +21; the hand-authored dotted-path
174
+ map was updated by hand (12 entries).
175
+ - **Write-domain classification** (`write-domain-conformance-ratchet`): `POST /intelligence/seamless-orchestrator/tick`
176
+ is classified in `WriteDomainRegistry` as `machine-local` with an `ephemeral-rebuildable` convergence story
177
+ (per-machine append-only logs under agent-home `logs/`, outside git, never converged) — modeled on the
178
+ review-canary soak trigger. `GET .../audit` is read-only (correctly not flagged).
179
+ - **No Silent Fallbacks** (`no-silent-fallbacks`): three intentional deterministic-first catches (LLM-residual →
180
+ deterministic ranking, unparseable-residual → null → deterministic, poller tick-error → onError + breaker) are
181
+ annotated `@silent-fallback-ok`; none is a data-loss fallback (back to the 491 baseline).
182
+ - **Compaction Parity** (`session-context-compaction-parity`): N/A — the orchestrator adds no `/session-context`
183
+ injector.
184
+
185
+ ## Tracked deferrals (P4-live prerequisites) <!-- tracked: topic-29836 -->
186
+
187
+ The first PR ships spec Phases 1-3 (the dark/dryRun skeleton + guards + F6 brakes). The following are the spec's
188
+ OWN operator-gated later increments — each is load-bearing ONLY after the operator flips `dryRun:false` / enables
189
+ the P4 auto-prefetch increment, and each is enumerated here (not silently dropped) per Deferral = Deletion:
190
+
191
+ - **revalidate() precise sourcing** — `OrchestratorActuator.revalidate()` ships as a dark-first conservative reader
192
+ (pinned/recentlyUserMoved/inFailureEpisode all false), exercised only for `dryRun` audit rows. The precise pin /
193
+ provenance / stale-owner-release + lease-handback episode sourcing is required BEFORE any `dryRun:false` flip.
194
+ - **WS2 oscillation-blacklist replication** — the blacklist is in-process this increment; replicating it (spec §85,
195
+ survives a lease failover) rides the WS2 store machinery (#4's working-set-artifact kind is the model).
196
+ - **Deduped attention-item raise** — the oscillation trip currently `console.warn`s; the one-per-episode tone-gated
197
+ `/attention` raise (F6) lands with the live flip.
198
+ - **F8 feedback-outcome derivation** (spec Phase 5) — structured, suppress-only, machine-local preload hit-rate
199
+ memory that drives the A/B-lift decision; a tracked Phase-5 follow-up.
200
+
201
+ ## Conclusion
202
+
203
+ The build followed the converged spec (multi-reviewer + cross-model codex-cli:gpt-5.5) verbatim, grep-verifying each
204
+ foundation (the CartographerSweepEngine/Poller pattern, the LlmQueue lanes, `ParallelActivityIndex`, #4's working-set
205
+ manager, the `WorkingSetPullCoordinator` fetch, the pressure/lease seams) before writing — every piece typechecked
206
+ first-pass. The feature is additive, lease-gated, propose-only, dark on the fleet + dryRun-first on a dev agent, and
207
+ unit + route-integration tested (36 tests, Tier-1 + Tier-2). The Tier-3 cross-machine E2E is an honest named blocker
208
+ (the Laptop is offline). The four P4-live prerequisites are enumerated + tracked, load-bearing only after an
209
+ operator-only flip. Clear to ship dark.
210
+
211
+ ---
212
+
213
+ ## Second-pass review (if required)
214
+
215
+ **Reviewer:** not required
216
+ **Independent read of the artifact: concur**
217
+
218
+ The converged spec (review-convergence + approved, cross-model codex-cli:gpt-5.5 ran clean) already provided the
219
+ multi-angle adversarial read this change's risk class warrants; the build introduced no design deviation from it.
220
+
221
+ ---
222
+
223
+ ## Evidence pointers
224
+
225
+ - 36 tests green: `seamless-orchestrator-engine` (10), `orchestrator-actuator` (10), `orchestrator-poller` (6),
226
+ `orchestrator-oscillation-breaker` (4), `seamless-orchestrator-routes` integration (6).
227
+ - `npx tsc --noEmit` exit 0 across all edits.
228
+ - All 4 constitutional ratchets green locally (dark-gate, write-domain, no-silent-fallbacks, compaction-parity).
229
+ - Dark-ship verified: `resolveDevAgentGate` resolves the feature OFF on the fleet (never constructed); `dryRun:true`
230
+ default actuates nothing even on a dev agent.
231
+
232
+ ---
233
+
234
+ ## Class-Closure Declaration (display-only mirror)
235
+
236
+ No agent-authored-artifact defect — not applicable. This is a net-new additive feature; it fixes no defect in an
237
+ LLM prompt/hook/config/skill/standards text. On the `unbounded-self-action` class: the orchestrator IS a self-triggered
238
+ controller, but it is bounded by construction and ships dark/dryRun — lease-gate (one machine), ≤3 proposals/tick,
239
+ per-topic 30m cooldown, oscillation breaker (blacklist + give-up), poller error-breaker, `LlmQueue` daily spend cap,
240
+ and `dryRun` (actuates nothing). The one ever-auto action is a side-effect-free preload behind an operator-only flip.