* feat(tool-cordis): inspect live plugin Config schemas Replace the Host `Builtin` inspect provider, which described a dynamic Host half the model can no longer define, with a `Config` provider that lists every live Loader entry with its Config status and projects one entry's native Schemastery Config into a self-contained JSON Schema document. app-boot exports its projector, native-schema check, and the shared `loaderExpression` definition for the live walk; the CLI dump keeps its profile-composition path. * fix(tool-cordis): refresh config catalog pointer and presets e2e provider list * feat(agent-preset): progressive creator skills and profile shell facts Split `cordis-plugin-development` into a short procedure with `references/` read on demand and copyable `templates/`, replace the source-reading ban in both creator skills with an ordered list of knowledge sources, and add the `cordis-composition-reference` skill with the Loader patch dialect and a generated, doc-sync-gated list of loadable plugin packages. `shell-env` exposes `DSH_PROFILE` and `DSH_PROFILE_DIR` so skills can address the installed profile. * chore(agent-preset): regenerate plugin package list after merging master * fix(tool-cordis): resolve the Loader at Config query time A Host composed programmatically without a Loader keeps registering the inspect providers; `Config.listConfigs` reports the missing Loader when queried. Refresh the advanced-toolchain recordings whose provider list now carries `Config` in place of `Builtin`. * chore(agent-preset): regenerate plugin package list after merging master * docs: regenerate module graph for the tool-cordis app-boot dependency * docs: regenerate module graph for the shell-env app-boot dependency * docs: regenerate event graph pointer for app-boot exports * fix(agent-preset): address review on creator skills `Config.listConfigs` reports each entry's resolved `packageDir` through the profile package lookup, and the skills read READMEs and built declarations there instead of guessing `$DSH_PROFILE_DIR/node_modules`, which holds only profile-installed packages. Skills name the PowerShell variable syntax and the no-profile omission; the composition reference no longer attributes `overridden` to `list_plugins`; references point at the templates instead of pasting them. The skills spec renders every skill and bounds it by the pruner threshold in code points, checks referenced files and the source-reading ban across all skill files. * fix(tool-cordis): address review on the Config inspect provider Report the Loader entry id (unique across include trees) beside the tree-local patch id, classify group and include carriers as `tree`, treat disabled and disposed fibers as `inactive`, and drop the unreachable boolean-schema branch by narrowing the projector's root type. The presets e2e now queries `Config.listConfigs` over the booted Web profile and projects the shipped `tools` row; the advanced-toolchain recordings carry the updated manifest. * fix(tool-cordis): page the Config directory and filter it by plugin name A full directory of a shipped Web profile exceeds the 50000-byte spill cap once rows carry more fields, and the spilled preview is no longer JSON. `Config.listConfigs` now returns pages (`offset`, `limit` up to 100, default 25) with `total` and `nextOffset`, and an exact plugin `name` filter; the presets e2e reads the shipped rows through the filter. * chore(agent-preset): refresh skill recordings after the paged Config query * docs(agent-preset): teach the composition skill to migrate legacy presets A preset authored before declaration rows lived in `$DSH_HOME/.agent-presets/<id>/` as `preset.yml` plus `agent.cordis.yml`; the skill now maps those files onto a declaration bundle and re-checks plugin names against the package list. * docs(agent-preset): read skill files through the file-read tool only Desktop ships the skill directory inside app.asar, which the Host process can open but shell commands, node, and pnpm cannot. The skills now say to read references and templates with the file-read tool and copy templates into the workspace before installing or checking them; the spec rejects shell reads of skill files. * docs(agent-preset): document bundle display metadata and package.json icon in the host-plugin reference
141 lines
7.4 KiB
Markdown
141 lines
7.4 KiB
Markdown
---
|
|
description: "The managed DSH_* shell environment for users and maintainers choosing, configuring, or extending the environment every model shell call runs with."
|
|
kind: "package-reference"
|
|
---
|
|
|
|
# @deepseek-ai/dsh-shell-env
|
|
|
|
English | [中文](README.zh.md)
|
|
|
|
## Summary
|
|
|
|
`dsh-shell-env` provides the trusted `DSH_*` environment that every model shell call — bash or pwsh — runs with: built-in facts such as `DSH_HOME`, `DSH_SHELL=1`, the agent's `DSH_SESSION_ID`, and the launched profile's `DSH_PROFILE` and `DSH_PROFILE_DIR`. Plugin authors can register their own facts with declared keys, collected per execution and disposed with their plugin; duplicate ownership or undeclared runtime keys fail loudly instead of silently overwriting. The registry changes nothing else the model sees — the shell tools own their own schemas and prompts. Choose it in any composition that mounts a model shell tool; configuration only picks the Harness home directory.
|
|
|
|
## Table of Contents
|
|
|
|
- [Use this package](#use-this-package)
|
|
- [Understand the implementation](#understand-the-implementation)
|
|
- [Further Exploration](#further-exploration)
|
|
- [Model Experience](#model-experience)
|
|
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
- [Dev Note](#dev-note)
|
|
|
|
-----
|
|
|
|
<a id="use-this-package"></a>
|
|
## Use this package
|
|
|
|
Load this plugin in any composition that mounts a model shell tool (`dsh-tool-bash` or `dsh-tool-pwsh`): each foreground or background shell call then runs with a freshly collected managed environment instead of whatever `DSH_*` values the process inherited.
|
|
|
|
### What every shell call receives
|
|
|
|
Every call receives `DSH_HOME` (the absolute Harness home), `DSH_SHELL=1`, and, for agent calls, `DSH_SESSION_ID` (the calling session's id). When the launcher provided a profile context, every call also receives `DSH_PROFILE` (the profile name) and `DSH_PROFILE_DIR` (its absolute directory; its `node_modules` holds only profile-installed packages, while the harness's own bundles resolve from the dsh installation); compositions booted without a profile omit both.
|
|
|
|
### Adding your own environment facts
|
|
|
|
Other plugins contribute facts by registering a contributor with a stable name, the complete set of `DSH_*` keys it may return, a description per key, and a resolver that computes values for one execution:
|
|
|
|
```ts
|
|
import type { Context } from '@deepseek-ai/cordis'
|
|
import type {} from '@deepseek-ai/dsh-shell-env'
|
|
|
|
export const inject = ['shellEnv']
|
|
|
|
export function apply(ctx: Context): void {
|
|
ctx.shellEnv.register({
|
|
name: 'deployment-region',
|
|
variables: { DSH_DEPLOYMENT_REGION: { description: 'Current deployment region.' } },
|
|
resolve: execution => execution.agent === undefined ? {} : { DSH_DEPLOYMENT_REGION: 'cn-north' },
|
|
})
|
|
}
|
|
```
|
|
|
|
Contributors must declare every key they return; returning an undeclared or non-string value fails the call. Registration is disposed with the registering plugin, so hot-reloading a plugin removes its facts.
|
|
|
|
### Choosing the Harness home
|
|
|
|
The single config field picks the home directory exposed as `DSH_HOME`; the default resolution order is the `dshHome` config, then ambient `$DSH_HOME`, then `~/.dsh`.
|
|
|
|
| Field | Default | Meaning |
|
|
|---|---|---|
|
|
| `dshHome` | `$DSH_HOME`, then `~/.dsh` | Absolute Harness home exposed as `DSH_HOME` |
|
|
|
|
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-shell-env) is the exhaustive source for every accepted field and its JSDoc.
|
|
|
|
### What can go wrong
|
|
|
|
Two contributors declaring the same key, or a contributor claiming a reserved built-in (`DSH_HOME`, `DSH_SHELL`, `DSH_SESSION_ID`, `DSH_PROFILE`, `DSH_PROFILE_DIR`), fails plugin load loudly. A `DSH_*` key must be all-caps with underscores (for example `DSH_REGION`), and a missing description fails registration.
|
|
|
|
-----
|
|
|
|
<a id="understand-the-implementation"></a>
|
|
## Understand the implementation
|
|
|
|
<details>
|
|
<summary>Implementation internals — click to expand</summary>
|
|
|
|
This section explains the design decisions behind the registry and points at the code that realizes them; the observable behavior is fully covered in [Use this package](#use-this-package).
|
|
|
|
### Design philosophy
|
|
|
|
- **Trusted namespace, rebuilt per call.** The environment is a Harness-owned `DSH_*` namespace: the shell executor discards inherited `DSH_*` values and merges the registry's current snapshot for each execution, so nested harnesses and concurrent parent/child agents cannot leak stale identities, and `process.env` is never modified.
|
|
- **Declared ownership, loud conflicts.** Contributors declare their keys up front so duplicate ownership is detected before the first command; resolvers may only return declared keys.
|
|
- **Built-ins stay here.** `DSH_HOME`, `DSH_SHELL`, `DSH_SESSION_ID`, `DSH_PROFILE`, and `DSH_PROFILE_DIR` are reserved for the registry; contributors cannot claim them.
|
|
|
|
### Source map
|
|
|
|
| File | Role |
|
|
|---|---|
|
|
| [`src/index.ts`](src/index.ts) | Plugin entry, `ShellEnvRegistry` service, and the built-in facts |
|
|
| — | No runtime invariant companion is published; the environment registry validates ownership and collected values at each registration/collection; it publishes no independent snapshot that a companion could cross-check. |
|
|
|
|
### Collection
|
|
|
|
`collect(execution)` starts from the built-ins, adds the session id when the execution carries an agent, then merges each registered contributor's resolved values sorted by contributor name. The result is a frozen, key-sorted snapshot passed through `ShellExecRequest.dshEnv`. `list()` enumerates declarations without running resolvers, so it cannot reflect execution-dependent values.
|
|
|
|
</details>
|
|
|
|
-----
|
|
|
|
<a id="further-exploration"></a>
|
|
## Further Exploration
|
|
|
|
Read these pages when the package-level contract is not enough. They move from the shell family to the executor seam and the generated catalogs.
|
|
|
|
- [shell package map](../README.md) — the bash capability family and its roles.
|
|
- [Bash executor subsystem](../../../docs/subsystems/shell.md) — the `ctx.shell` seam the tools execute through.
|
|
- [tool-bash](../tool-bash/README.md) — the bash tool that consumes this environment.
|
|
- [tool-pwsh](../tool-pwsh/README.md) — the pwsh tool that consumes this environment.
|
|
- [home paths package](../../util/home-paths/README.md) — how `DSH_HOME` is resolved.
|
|
- [Generated configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-shell-env) — every accepted config field and its source declaration.
|
|
|
|
-----
|
|
|
|
<a id="model-experience"></a>
|
|
## Model Experience
|
|
|
|
Indirectly, through the shell tools (`dsh-tool-bash`, `dsh-tool-pwsh`), which expose this registry's managed `DSH_*` facts in every shell-tool call.
|
|
|
|
#### KV Cache effect
|
|
|
|
The managed environment never enters the request prefix, so it does not invalidate provider cache reuse; the shell tools' definitions and the current request envelope own any prefix change.
|
|
|
|
## Known Limitations and Deferred Work
|
|
|
|
<a id="known-limitations-and-deferred-work"></a>
|
|
|
|
|
|
These limits define when the registry is a poor fit or needs care. They are current package constraints, not a task backlog.
|
|
|
|
- **`list()` enumerates plugin-contributed variables only** — registry-owned built-ins (`DSH_HOME`, `DSH_SHELL`, `DSH_SESSION_ID`, `DSH_PROFILE`, `DSH_PROFILE_DIR`) are not included, so diagnostics, prompt, or UI code must not treat `list()` as an exhaustive environment catalog.
|
|
|
|
<a id="dev-note"></a>
|
|
### Dev Note
|
|
|
|
<details>
|
|
<summary>Working context for maintainers — click to expand</summary>
|
|
|
|
None.
|
|
|
|
</details>
|