Route discovery, management, and prompting through Chord services. Retain low-level lane watches and reattach Radius clients through SessionManagement.
Bundle declarative plugin packages with Chord and load fresh generations. Scope client selections to persisted Session and TUI branches, and replace stale local server generations after protocol changes.
Bundle content-addressed Chord facet entries, distribute server-selected presentation artifacts during the handshake, and reload Session and TUI generations through /reload.
Deliver observed services as ordinary typed proxies, expose optional instance-key lookup, and rename the deferred multi-instance capability to ServiceSpawner.
Move service, replicated-state, facet host, and loader ownership into the standalone Chord package. Migrate consumers and leave runtime JSON enforcement to serializers.
Run next-turn preparation only when the agent loop continues, allowing threshold compaction before the next provider request. Restore interactive progress when the same run resumes.
Closes#6879
Important to notice:
this changes when prepareNextTurn & prepareNextTurnWithContext are invoked:
the now run only when a next turn actually happens, and after shouldStopAfterTurn.
Reuse the stable renderer, viewport layout, theme detection, and terminal appearance updates. Keep successful operation status derived from replicated lane state.
Replace raw Harness and Chat service exposure with AgentController and replicated lane state. Start directly in new or resumed sessions and persist model selection.
Make facets non-generic and resolve host-local dependencies through service bindings. Rename local assembly to createFacetHost and consolidate TUI host mechanics behind one service.
A presentation draws tool calls and colours; it executes nothing and validates
nothing. Both cost it typebox anyway, which is 17 MB of module graph: 682 ESM
modules whose narrowest entry re-exports ~300 of them, so there is no
cherry-picking and both doors had to close before any process stopped paying.
ToolExecutionComponent no longer looks up createAllToolDefinitions by tool name;
callers pass what to render, and its parameter type now says so. Each built-in
tool's presentation moves to core/tools/renderers/<tool>.ts, leaving the schema
and execute path behind; bash and powershell share createShellRenderers(prompt).
Tool definitions keep their exact public shape and spread the renderers in.
withBuiltInRenderers() preserves the old fallback, where an extension override
without renderers still draws like the built-in - that behaviour used to live
inside the component, and two tests caught its absence.
theme.ts keeps palettes; the typebox schema and its error formatting move to
theme-json.ts, installed through setThemeJsonValidator. Built-in themes were
never validated, so only processes that load user-authored themes need it. pi
installs it during startup, before the first theme loads, and the invalid-theme
message is unchanged.
Measured with mini, running built output: the presentation drops from 87 MB and
99 files to 72 MB and 88 files, with typebox absent from its graph, while still
rendering tool output through the real built-in renderers.
Also: packages/server's vitest aliases were prefix matches, so a subpath import
resolved onto index.ts/utils/uuid and failed five suites; they are exact now
with explicit subpath rules. And mini-test.sh spawns mini the way pi-test.sh
spawns pi, with --fresh/--stop for the detached session server.
A barrel forces Node to evaluate its whole graph: importing reduceLaneSnapshot
(1 file, 6 KB) through pi-agent-core's index evaluated 106 files, and mini's
server loaded 112 files to enumerate JSONL headers. Types are free, so this only
ever affected value imports.
pi-ai gains ./utils/* alongside the existing ./providers/* and ./api/*
wildcards. pi-agent-core gains ./harness/context, ./harness/env/nodejs,
./harness/runtime/reducer and ./harness/session, and ./session/testing becomes
./harness/session/testing so every export mirrors its source path. The barrel
and ./node keep their batteries-included semantics.
The session layer takes uuidv7 from @earendil-works/pi-ai/utils/uuid rather than
the pi-ai barrel, which is what let ./harness/session drop from 42 files to 19.
Two imports there were written `import { type Usage } from` - not a type-only
statement, so it emitted a runtime import of the barrel.
scripts/check-entry-graphs.mjs walks each declared entry's value-import graph and
enforces per-entry budgets and forbidden paths, so a stray `export *` cannot
silently undo this. It caught the two `import { type ... }` regressions above.
Measured with mini: server 112 files and 98 MB to 28 files and 69 MB, presentation
204 files and 125 MB to 99 files and 110 MB. The worker still loads the provider
graph, correctly.