feat(agent-presets): own the writable preset root instead of awaiting an app
`Config.roots` defaulted to `[]`, so a deployment that did not patch both roots in got a roster with none — `dsh run` once booted exactly that and failed resolving `standard`. The user root never needed an app: `<dshHome>/.agent-presets` is the same place in every deployment, resolvable here the way `dsh-skill-local` resolves `<dshHome>/skills`. The roster now derives that root itself unless `includeUserRoot` is false, and `apps/cli` supplies only the SHIPPED root, whose path an installed app alone can resolve. The derived root is appended after every configured root, so a shipped id still shadows a home directory claiming it and `writableRoot()` still prefers an explicitly configured `user` root; the set is resolved once at construction, because a root set that changed between a `list()` and the `copy()` acting on its answer would author into a directory the caller never saw. Every test that pins an exact roster now says `includeUserRoot: false` — the machine's real harness home must not decide what a golden or an assertion counts.
This commit is contained in:
@@ -86,9 +86,20 @@ Every read failure degrades to no metadata — absent, malformed, wrongly typed,
|
||||
|---|---|---|
|
||||
| `default` | required | Preset id mounted when a caller names none |
|
||||
| `roots` | `[]` | Scanned directories in precedence order; each supplies `path` (a leading `~` expands) and `trust` (defaults to `user`) |
|
||||
| `includeUserRoot` | `true` | Append `<dshHome>/.agent-presets` as a `user` root, after every configured root |
|
||||
|
||||
An absent root supplies no presets rather than failing: the user root does not exist until the first locally authored preset, and naming a default no root supplies already fails loud at resolution.
|
||||
|
||||
### The writable root is this package's, the shipped root is the app's
|
||||
|
||||
`<dshHome>/.agent-presets` is where a person's own presets live, the way `<dshHome>/skills` is where their own skills live ([`dsh-skill-local`](../../skill/skill-local/README.md)), so the roster derives it rather than waiting for a deployment to remember it — a launcher that configures nothing still finds and authors presets. It is appended AFTER every configured root, which keeps an earlier root winning a duplicate id: a shipped `standard` still shadows a home directory that claimed the name, and `copy()` refuses that id rather than landing a preset nothing would resolve.
|
||||
|
||||
The roots are resolved once, when the service is constructed. A root set that changed between a `list()` and the `copy()` acting on its answer would author into a directory the caller never saw.
|
||||
|
||||
`includeUserRoot: false` mounts a roster over `roots` alone. A deployment that confines presets to its own directories needs it, and so does any test pinning an exact roster — otherwise the machine's real `<dshHome>` decides what the roster contains.
|
||||
|
||||
The SHIPPED root stays an assembly fact: it sits beside the installed app's own config, a path only that app can resolve.
|
||||
|
||||
### The default preset is a user setting
|
||||
|
||||
When a settings provider is composed, this plugin registers the `agent-presets` namespace with `config.default` as its composition base, so the user document layers over the deployment's engineering default:
|
||||
|
||||
Reference in New Issue
Block a user