fix(agent-presets): bound the mount registry on a host that never reads it

Records are pruned by observation rather than by a disposal hook, for the
reason the module already states: three different owners can tear a
subtree down, and a cleared `uid` is what they share. That leaves the
pruning to whoever reads — and the only production reader is the
invariant companion, whose package is a development composition a
shipped host never loads.

So a live host pruned nothing: every session ever composed left a record
retaining its whole disposed subtree, since the fiber holds its config
and that config is the key its EntryTree is stored under.

Prune on the mount path too. Every session takes it, which bounds the
set at one generation of dead records instead of one per session.
This commit is contained in:
Yichen Jiang
2026-08-06 11:05:01 +08:00
parent 18fe174897
commit 065257addb
11 changed files with 63 additions and 37 deletions
+7 -7
View File
@@ -115,25 +115,25 @@ Source: [`packages/core/agent-loop/src/index.ts:236`](../packages/core/agent-loo
Requires: `loader`
```ts config-catalog
/** Plugin config: which profile is the default, and where profiles live. */
/** Plugin config: which preset is the default, and where presets live. */
export interface Config {
/** Profile id mounted when a caller names none. Missing at mount time fails loud. */
/** Preset id mounted when a caller names none. Missing at mount time fails loud. */
default: string
/** Scanned roots in precedence order; an earlier root wins a duplicate id. */
roots: PresetRoot[]
}
/** One directory scanned for profile subdirectories. */
/** One directory scanned for preset subdirectories. */
export interface PresetRoot {
/** Directory holding one subdirectory per profile; a leading `~` expands. */
/** Directory holding one subdirectory per preset; a leading `~` expands. */
path: string
/** Trust recorded on every profile discovered under this root. */
/** Trust recorded on every preset discovered under this root. */
trust: PresetTrust
}
/**
* Where a profile's composition came from. A `system` profile ships with the
* deployment; a `user` profile was authored locally, by a person or by an
* Where a preset's composition came from. A `system` preset ships with the
* deployment; a `user` preset was authored locally, by a person or by an
* agent, and therefore carries the same trust as shell access.
*/
export type PresetTrust = 'system' | 'user'