@deepseek-ai/dsh 0.0.1-rc.1
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.
- package/LICENSE +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +38 -0
- package/README.zh.md +38 -0
- package/config/agent-presets/code/agent.cordis.yml +254 -0
- package/config/agent-presets/code/preset.yml +3 -0
- package/config/agent-presets/cordis/agent.cordis.yml +254 -0
- package/config/agent-presets/cordis/preset.yml +3 -0
- package/config/agent-presets/cordis/skills/editing-cordis-compositions/SKILL.md +96 -0
- package/config/agent-presets/minimal/agent.cordis.yml +70 -0
- package/config/agent-presets/minimal/preset.yml +3 -0
- package/config/agent-presets/standard/agent.cordis.yml +243 -0
- package/config/agent-presets/standard/preset.yml +3 -0
- package/lib/bin.js +154 -0
- package/lib/dump-config-DlxoPVYx.js +57 -0
- package/lib/plugin-Xxr7y7sa.js +129 -0
- package/lib/profile-boot-DQYCwKII.js +335 -0
- package/lib/profile-boot-T5aOCb6v.js +2 -0
- package/package.json +95 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: editing-cordis-compositions
|
|
3
|
+
description: Use when creating or changing a Cordis composition for this harness — writing or editing an agent preset, adding or removing a plugin row, deciding whether something belongs to the host composition or to one session, or diagnosing a row that mounted but contributed nothing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Editing Cordis compositions
|
|
7
|
+
|
|
8
|
+
Every capability in this harness is a plugin row in a `cordis.yml`. There is no separate configuration language: changing what an agent can do means changing which rows are composed for it.
|
|
9
|
+
|
|
10
|
+
## Decide the plane first
|
|
11
|
+
|
|
12
|
+
Two planes, and the choice is not about how "agent-related" something feels — it is about whether the thing must be shared.
|
|
13
|
+
|
|
14
|
+
**Host composition.** The registries themselves (`tools`, `systemPrompt`, `agents`, `agent-loop`, `sessions`), anything crossing sessions (persistence, session query, storage, settings, credentials, telemetry), the sandbox and approval stack, the model route, and the subagent registry with its spawn/fork backends. One instance for the process.
|
|
15
|
+
|
|
16
|
+
**Agent preset.** What one session contributes to those registries: its tool plugins, its persona and prompt sections, its compaction policy. One instance per session, mounted under that session's scope and unwound with it.
|
|
17
|
+
|
|
18
|
+
**A service with a consumer outside the agent plane cannot move into a preset.** `subagents` is the worked example: the registry answers cross-session queries for the host api-proxy, so a per-session copy both starves that host row — it waits forever for a service nothing provides — and collides on the second session, since a provider name registers once. The preset contributes the delegation *tools*; the registry and its backends stay host-side.
|
|
19
|
+
|
|
20
|
+
A preset is a directory holding one `agent.cordis.yml`, optionally beside a `preset.yml` carrying display metadata — `name` and `description` (and, for shipped presets, a roster `order`). Write the metadata too: a preset without it shows up in every picker as its bare directory name. The shipped presets live beside the deployment's composition; locally authored ones live under `${DSH_HOME:-$HOME/.dsh}/.agent-presets/<name>/`.
|
|
21
|
+
|
|
22
|
+
## Authoring a preset
|
|
23
|
+
|
|
24
|
+
1. **Start from a copy.** Read a shipped composition close to what you want (the `standard` preset is the full coding agent) and copy its whole directory into `${DSH_HOME:-$HOME/.dsh}/.agent-presets/<id>/` — the id must be lowercase letters, digits, and hyphens, because it becomes the directory name. A composition written from scratch usually forgets a group realm or a consumer row; a copy starts loadable.
|
|
25
|
+
2. **Expect the file sandbox.** The preset root lies outside the session workspace, so under the default `workspace-write` policy the first write is denied. Retry that exact command once with `sandbox_permissions` escalation and a short justification — the user sees and approves it. Batch your writes (one heredoc per file) rather than escalating many small commands.
|
|
26
|
+
3. **Rewrite `preset.yml`**: give the copy its own `name` and `description`, and drop any `order` the source declared — that field sorts the shipped roster.
|
|
27
|
+
4. **Edit `agent.cordis.yml`** row by row, keeping the plane rule and realm rule above.
|
|
28
|
+
|
|
29
|
+
### Native product subagents
|
|
30
|
+
|
|
31
|
+
Codex and Claude Code providers already live in the host composition. A preset chooses either product by contributing the same ordinary delegation-tool row used for spawn and fork; never move a product provider into the preset and never add a product-specific settings field.
|
|
32
|
+
|
|
33
|
+
Copy these disabled templates from a shipped full preset and remove `disabled` only for the products the user requested:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
- id: tool-subagent-codex
|
|
37
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
38
|
+
disabled: true
|
|
39
|
+
config:
|
|
40
|
+
provider: codex
|
|
41
|
+
toolName: subagent_codex
|
|
42
|
+
enableRunInBackground: false
|
|
43
|
+
maxDepth: provider-managed
|
|
44
|
+
|
|
45
|
+
- id: tool-subagent-claude-code
|
|
46
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
47
|
+
disabled: true
|
|
48
|
+
config:
|
|
49
|
+
provider: claude-code
|
|
50
|
+
toolName: subagent_claude_code
|
|
51
|
+
enableRunInBackground: false
|
|
52
|
+
maxDepth: provider-managed
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The two rows are independent. Leaving both disabled preserves the copied preset, enabling one exposes only that product tool, and enabling both exposes both. The host must provide `codex` or `claude` on `PATH`; the preset does not install, authenticate, select a model for, or probe either product.
|
|
56
|
+
|
|
57
|
+
The shipped preset directories are off-limits: never edit or delete them, and never escalate the sandbox to reach them, even when a change there looks quicker — an upgrade overwrites the install, and corrupting the `cordis` preset disables preset authoring itself. Locally authored presets under the user root are yours to create, edit, and delete.
|
|
58
|
+
|
|
59
|
+
## The rule that catches people
|
|
60
|
+
|
|
61
|
+
**A row that publishes a service may not sit loose in a preset.** Registering a service without an isolate realm puts it in the process-global realm, so the second session mounting that preset collides with the first. The mount rejects it rather than letting the collision surface later.
|
|
62
|
+
|
|
63
|
+
Whether a row publishes a service is not visible from its name. `tool-bash` reads like a tool but provides `bashEnv`. Check the package's README, or mount the preset and read the rejection — it names the offending service.
|
|
64
|
+
|
|
65
|
+
When a preset genuinely owns a service, wrap the provider **and every consumer that reaches it** in one group carrying an `isolate` realm:
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
- id: tasks
|
|
69
|
+
name: cordis:group
|
|
70
|
+
group: true
|
|
71
|
+
isolate:
|
|
72
|
+
tasks: true
|
|
73
|
+
config:
|
|
74
|
+
- id: tasks-local
|
|
75
|
+
name: '@deepseek-ai/dsh-tasks-local'
|
|
76
|
+
- id: tool-tasks
|
|
77
|
+
name: '@deepseek-ai/dsh-tool-tasks'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`true` means a realm private to each mounting session. A string label instead pools one instance across every subtree naming that label — use it only for something genuinely expensive to duplicate.
|
|
81
|
+
|
|
82
|
+
A consumer left outside the group resolves the host's registry, which the preset did not populate, and then contributes nothing. That is the quietest failure here: the mount succeeds and a tool is simply missing.
|
|
83
|
+
|
|
84
|
+
Host capabilities exposed through registries need no realm: the host `tools` and `skills` registries are layered per scope, so rows like `skill-local` and `tool-skill` sit loose in the preset and their registrations file into this preset's layer automatically — the agent's catalog merges them with whatever the deployment registered globally.
|
|
85
|
+
|
|
86
|
+
## Verifying a change
|
|
87
|
+
|
|
88
|
+
Read the live runtime with `cordis_inspect` — it reports the services, the plugin fibers, and the registered tools as they actually are, which is the only reliable check that a row did what its name suggests. Note it shows THIS session's composition: a preset you just wrote is not mounted anywhere until a session starts on it.
|
|
89
|
+
|
|
90
|
+
To check a preset you authored, re-read the files and validate these fields: the top level is a YAML list, every row is a map with a `name`, every group carries its own list, and service-publishing rows sit behind an `isolate` realm. The settings page's preset roster validates the same fields and marks an unloadable preset broken in red — point the user there, and ask them to start a session on the new preset to confirm the tool list; you cannot start one yourself.
|
|
91
|
+
|
|
92
|
+
`cordis_mount` evaluates JavaScript against the live runtime and disappears on restart. It is for probing, not for shipping a capability: a capability belongs in a composition file.
|
|
93
|
+
|
|
94
|
+
## What not to move into a preset
|
|
95
|
+
|
|
96
|
+
`agent-loop` registers the one agent factory and throws on a second. The registries own the per-session layering and cannot themselves be per-session. Session persistence must stay host-side or the session list fragments. The sandbox, approval, and permission rows are a deliberate boundary: a preset is exactly as privileged as the plugins it names, so letting one relax its own confinement would defeat the confinement.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# The `minimal` agent preset: a fixed-prompt, two-tool coding surface.
|
|
2
|
+
#
|
|
3
|
+
# The persona is the complete system prompt, so global identity, Web surface,
|
|
4
|
+
# tool guidance, and later assembly listeners cannot add prompt text. The model
|
|
5
|
+
# composes only the persistent `bash` and `str_replace_editor` tools.
|
|
6
|
+
|
|
7
|
+
- id: persona
|
|
8
|
+
name: '@deepseek-ai/dsh-persona'
|
|
9
|
+
config:
|
|
10
|
+
text: You are a helpful software engineer assistant.
|
|
11
|
+
complete: true
|
|
12
|
+
|
|
13
|
+
# The PTY registry is an agent-owned service, so it lives in an entry-local
|
|
14
|
+
# realm. The backend still consumes the host sandbox policy and subprocess
|
|
15
|
+
# implementation, while the tool registers into this agent's scoped catalog.
|
|
16
|
+
- id: persistent-shell
|
|
17
|
+
name: cordis:group
|
|
18
|
+
group: true
|
|
19
|
+
isolate:
|
|
20
|
+
pty: true
|
|
21
|
+
config:
|
|
22
|
+
- id: pty
|
|
23
|
+
name: '@deepseek-ai/dsh-pty'
|
|
24
|
+
|
|
25
|
+
- id: pty-local
|
|
26
|
+
name: '@deepseek-ai/dsh-pty-local'
|
|
27
|
+
config:
|
|
28
|
+
timeoutMs: 300000
|
|
29
|
+
|
|
30
|
+
- id: persistent-bash
|
|
31
|
+
name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
32
|
+
config:
|
|
33
|
+
timeoutMs: 300000
|
|
34
|
+
description: |-
|
|
35
|
+
Run commands in a bash shell
|
|
36
|
+
* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
|
|
37
|
+
* You don't have access to the internet via this tool.
|
|
38
|
+
* You do have access to a mirror of common linux and python packages via apt and pip.
|
|
39
|
+
* State is persistent across command calls and discussions with the user.
|
|
40
|
+
* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
|
|
41
|
+
* Please avoid commands that may produce a very large amount of output.
|
|
42
|
+
* Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
|
|
43
|
+
|
|
44
|
+
# The editor requires absolute paths unconditionally.
|
|
45
|
+
- id: str-replace-editor
|
|
46
|
+
name: '@deepseek-ai/dsh-tool-str-replace-editor'
|
|
47
|
+
config:
|
|
48
|
+
maxOutputChars: 16000
|
|
49
|
+
|
|
50
|
+
# Model capacity comes from routed model metadata; this block states the
|
|
51
|
+
# compaction policy explicitly.
|
|
52
|
+
- id: compaction
|
|
53
|
+
name: cordis:group
|
|
54
|
+
group: true
|
|
55
|
+
isolate:
|
|
56
|
+
tokenMeter: true
|
|
57
|
+
compact: true
|
|
58
|
+
config:
|
|
59
|
+
- id: token-meter
|
|
60
|
+
name: '@deepseek-ai/dsh-token-meter'
|
|
61
|
+
|
|
62
|
+
- id: compact-basic
|
|
63
|
+
name: '@deepseek-ai/dsh-compact-basic'
|
|
64
|
+
config:
|
|
65
|
+
thresholdRatio: 0.8
|
|
66
|
+
retainTokens: 20480
|
|
67
|
+
summarizationProvider: ''
|
|
68
|
+
summarizationModel: ''
|
|
69
|
+
maxTokens: 8192
|
|
70
|
+
compactionRetries: 1
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# The `standard` agent preset: the full coding agent, mounted once per process.
|
|
2
|
+
#
|
|
3
|
+
# This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
|
|
4
|
+
# standing scope; every session naming it joins by scope parentage, so the
|
|
5
|
+
# tools and prompt sections registered here cover each joined agent while a
|
|
6
|
+
# session's own state stays keyed per Session/Agent inside the plugins. The
|
|
7
|
+
# host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
|
|
8
|
+
# preset must not own: the registries themselves, the sandbox and approval
|
|
9
|
+
# stack, persistence, and the model route.
|
|
10
|
+
#
|
|
11
|
+
# A service row here MUST sit inside a group carrying an `isolate` realm.
|
|
12
|
+
# Without one it publishes into the root realm, where it is process-global —
|
|
13
|
+
# another preset publishing the same name collides, and a host reader would
|
|
14
|
+
# resolve one preset's instance for every session; `dsh-agent-presets` rejects
|
|
15
|
+
# that at mount. `true` means an entry-local realm: this standing mount's own
|
|
16
|
+
# private instance, apart from every other preset's. (A shared label does NOT
|
|
17
|
+
# pool instances — `provide()` throws on the second registration under the
|
|
18
|
+
# same realm symbol; labels join REALMS, and are not what this file needs.)
|
|
19
|
+
|
|
20
|
+
# ── identity ────────────────────────────────────────────────────────────────
|
|
21
|
+
|
|
22
|
+
# The preset's own persona, shadowing the deployment default for this agent.
|
|
23
|
+
# `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
|
|
24
|
+
- id: persona
|
|
25
|
+
name: '@deepseek-ai/dsh-persona'
|
|
26
|
+
config:
|
|
27
|
+
text: >-
|
|
28
|
+
You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
|
|
29
|
+
|
|
30
|
+
- id: workspace-context
|
|
31
|
+
name: '@deepseek-ai/dsh-workspace-context'
|
|
32
|
+
config:
|
|
33
|
+
maxBytes: 65536
|
|
34
|
+
|
|
35
|
+
# ── shell ───────────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
# `bash-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
|
|
38
|
+
# publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
|
|
39
|
+
# the criterion for host-plane ownership — injection resolves before any session
|
|
40
|
+
# exists, so there is no agent to key by. Behind a preset realm those variables
|
|
41
|
+
# never reached the model's shell at all. `tool-bash` consumes the host registry
|
|
42
|
+
# from here; the executor behind it (`bash-sandbox`) is host-plane too, where the
|
|
43
|
+
# sandbox policy owns it.
|
|
44
|
+
- id: tool-bash
|
|
45
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
46
|
+
|
|
47
|
+
# ── filesystem ──────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
# Both register into the host `tools` registry and provide nothing, so
|
|
50
|
+
# they need no realm. The `fs` service and its policy stay in the host.
|
|
51
|
+
- id: tool-fs
|
|
52
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
53
|
+
|
|
54
|
+
- id: tool-fs-search
|
|
55
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
56
|
+
config:
|
|
57
|
+
sampleOverCapGlobResults: false
|
|
58
|
+
|
|
59
|
+
# ── background tasks ────────────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
# Only the model-facing controls. The task REGISTRY stays on the host plane:
|
|
62
|
+
# its producers sit outside any realm this file could put it in — `tool-bash`
|
|
63
|
+
# above resolves it with `ctx.get`, and an entry-local realm here is invisible
|
|
64
|
+
# to every sibling row, so `run_in_background` would answer "background tasks
|
|
65
|
+
# unavailable" while these controls sat in the catalog. The registry is keyed by
|
|
66
|
+
# owning agent anyway, so one host instance serves every session. What a preset
|
|
67
|
+
# chooses is whether its agent can collect and stop background work at all.
|
|
68
|
+
- id: tool-tasks
|
|
69
|
+
name: '@deepseek-ai/dsh-tool-tasks'
|
|
70
|
+
|
|
71
|
+
# ── skills ──────────────────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
# The skill REGISTRY lives in the host composition and is layered per scope:
|
|
74
|
+
# these rows register into THIS preset's layer of it, so they need no realm.
|
|
75
|
+
# `skill-local` contributes local-root discovery for agents on this preset, and
|
|
76
|
+
# `tool-skill` gives them the catalog and loader; the merged catalog also
|
|
77
|
+
# carries whatever the deployment registered globally (repository plugins).
|
|
78
|
+
- id: skill-local
|
|
79
|
+
name: '@deepseek-ai/dsh-skill-local'
|
|
80
|
+
|
|
81
|
+
- id: tool-skill
|
|
82
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
83
|
+
|
|
84
|
+
# ── goals ───────────────────────────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
# Only the model-facing tool. The goal SERVICE, its session driver, and the
|
|
87
|
+
# `/goal` command stay on the host plane: the Gateway serves the goal domain as
|
|
88
|
+
# Remote endpoints whose receiver comes from a generated descriptor, so it
|
|
89
|
+
# resolves `goals` on the host and an entry-local realm here would hide it. The
|
|
90
|
+
# registry is keyed by session anyway, so one host instance serves every
|
|
91
|
+
# session. What a preset chooses is whether its agent can call the goal tool.
|
|
92
|
+
- id: tool-goal
|
|
93
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
94
|
+
|
|
95
|
+
# ── plan mode ───────────────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
# Plan state is per-agent by nature, so an entry-local realm is not a
|
|
98
|
+
# workaround here — it is the correct lifetime.
|
|
99
|
+
- id: planning
|
|
100
|
+
name: cordis:group
|
|
101
|
+
group: true
|
|
102
|
+
isolate:
|
|
103
|
+
planMode: true
|
|
104
|
+
config:
|
|
105
|
+
- id: plan-mode
|
|
106
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
107
|
+
config:
|
|
108
|
+
section: |
|
|
109
|
+
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
110
|
+
|
|
111
|
+
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
112
|
+
|
|
113
|
+
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
114
|
+
|
|
115
|
+
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
116
|
+
|
|
117
|
+
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
118
|
+
|
|
119
|
+
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
120
|
+
|
|
121
|
+
# ── compaction ──────────────────────────────────────────────────────────────
|
|
122
|
+
|
|
123
|
+
# `compact-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
|
|
124
|
+
# share this realm rather than sit outside it.
|
|
125
|
+
- id: compaction
|
|
126
|
+
name: cordis:group
|
|
127
|
+
group: true
|
|
128
|
+
isolate:
|
|
129
|
+
tokenMeter: true
|
|
130
|
+
compact: true
|
|
131
|
+
toolResultPrune: true
|
|
132
|
+
config:
|
|
133
|
+
- id: token-meter
|
|
134
|
+
name: '@deepseek-ai/dsh-token-meter'
|
|
135
|
+
|
|
136
|
+
- id: compact-basic
|
|
137
|
+
name: '@deepseek-ai/dsh-compact-basic'
|
|
138
|
+
|
|
139
|
+
- id: command-compact
|
|
140
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
141
|
+
|
|
142
|
+
- id: tool-result-prune
|
|
143
|
+
name: '@deepseek-ai/dsh-compact-tool-result-prune'
|
|
144
|
+
config:
|
|
145
|
+
thresholdChars: 8192
|
|
146
|
+
headChars: 4096
|
|
147
|
+
tailChars: 1024
|
|
148
|
+
|
|
149
|
+
# ── delegation and workflows ────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
# The `subagents` registry and its spawn/fork backends live in the HOST
|
|
152
|
+
# composition: the registry is a process singleton whose cross-session queries
|
|
153
|
+
# the api-proxy serves to the browser, and a provider name may only be
|
|
154
|
+
# registered once. This preset contributes the delegation TOOLS, which resolve
|
|
155
|
+
# that host registry.
|
|
156
|
+
#
|
|
157
|
+
# `workflows` is different — nothing outside an agent reads it — so every row
|
|
158
|
+
# that reaches it shares one entry-local realm here, and a consumer left
|
|
159
|
+
# outside would resolve a host registry this preset does not populate.
|
|
160
|
+
#
|
|
161
|
+
# `tool-subagent-report` is host-plane for the same reason as the registry,
|
|
162
|
+
# not because a preset may not want it: it registers a CONTINUABLE SETUP on
|
|
163
|
+
# that singleton rather than a tool this agent calls, and the setup list is
|
|
164
|
+
# not scope-aware — one copy per mounted preset means every child gets
|
|
165
|
+
# `report` registered once per live session, which throws on the second.
|
|
166
|
+
- id: delegation
|
|
167
|
+
name: cordis:group
|
|
168
|
+
group: true
|
|
169
|
+
isolate:
|
|
170
|
+
workflows: true
|
|
171
|
+
config:
|
|
172
|
+
- id: tool-subagent-control
|
|
173
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
174
|
+
|
|
175
|
+
- id: tool-subagent-list-agents
|
|
176
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
177
|
+
|
|
178
|
+
- id: tool-subagent
|
|
179
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
180
|
+
config:
|
|
181
|
+
provider: spawn
|
|
182
|
+
toolName: subagent
|
|
183
|
+
backgroundMode: continuable
|
|
184
|
+
|
|
185
|
+
- id: tool-subagent-fork
|
|
186
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
187
|
+
config:
|
|
188
|
+
provider: fork
|
|
189
|
+
toolName: subagent_fork
|
|
190
|
+
backgroundMode: continuable
|
|
191
|
+
|
|
192
|
+
# Product providers are host-plane singletons. Copy this preset, then
|
|
193
|
+
# remove `disabled` from either ordinary tool row to expose that product
|
|
194
|
+
# only to agents composed from the copy.
|
|
195
|
+
- id: tool-subagent-codex
|
|
196
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
197
|
+
disabled: true
|
|
198
|
+
config:
|
|
199
|
+
provider: codex
|
|
200
|
+
toolName: subagent_codex
|
|
201
|
+
enableRunInBackground: false
|
|
202
|
+
maxDepth: provider-managed
|
|
203
|
+
|
|
204
|
+
- id: tool-subagent-claude-code
|
|
205
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
206
|
+
disabled: true
|
|
207
|
+
config:
|
|
208
|
+
provider: claude-code
|
|
209
|
+
toolName: subagent_claude_code
|
|
210
|
+
enableRunInBackground: false
|
|
211
|
+
maxDepth: provider-managed
|
|
212
|
+
|
|
213
|
+
- id: workflow-workerthread
|
|
214
|
+
name: '@deepseek-ai/dsh-workflow-workerthread'
|
|
215
|
+
config:
|
|
216
|
+
provider: spawn
|
|
217
|
+
|
|
218
|
+
- id: tool-workflow
|
|
219
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
220
|
+
|
|
221
|
+
- id: tool-ralph
|
|
222
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
223
|
+
config:
|
|
224
|
+
subagentProvider: spawn
|
|
225
|
+
maxRounds: 64
|
|
226
|
+
|
|
227
|
+
# ── remaining model-facing rows ─────────────────────────────────────────────
|
|
228
|
+
|
|
229
|
+
- id: tool-ask-user
|
|
230
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
231
|
+
|
|
232
|
+
- id: tool-todo
|
|
233
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
234
|
+
config:
|
|
235
|
+
allowParallelInProgress: true
|
|
236
|
+
|
|
237
|
+
# The `web` service and its search provider stay in the host composition; only
|
|
238
|
+
# the model-facing tool is per-session.
|
|
239
|
+
- id: tool-web
|
|
240
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
241
|
+
config:
|
|
242
|
+
fetch: false
|
|
243
|
+
searchTimeoutMs: 60000
|
package/lib/bin.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { loadLayeredEnv } from "@deepseek-ai/dsh-app-boot";
|
|
5
|
+
import { Command, CommanderError } from "commander";
|
|
6
|
+
//#region lib/types/args.js
|
|
7
|
+
/**
|
|
8
|
+
* Commander adapter for the `dsh` command line.
|
|
9
|
+
*
|
|
10
|
+
* The launcher parses only what it owns — which profile to boot, which extra
|
|
11
|
+
* patch overlays to apply, and the config dumps — and hands **everything after
|
|
12
|
+
* its own flags** to the booted tree verbatim, where injected app plugins parse
|
|
13
|
+
* their own flag families and print their own `--help` (see
|
|
14
|
+
* `@deepseek-ai/dsh-cmdline`). Launcher flags therefore come first: the first
|
|
15
|
+
* token this parser does not recognize starts the inner arguments, so
|
|
16
|
+
* `dsh --profile tui --resume abc` boots the tui profile with `--resume abc`,
|
|
17
|
+
* and `dsh --profile web -h` prints the web app's help, not this one's.
|
|
18
|
+
*
|
|
19
|
+
* `web` is a hardcoded alias for `--profile web`; `plugin` manages a profile's
|
|
20
|
+
* plugin dependencies by forwarding to pnpm.
|
|
21
|
+
* @module @deepseek-ai/dsh/args
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Repeatable single-value collector: `--patch a.yml --patch b.yml`. Never
|
|
25
|
+
* variadic — a variadic `--patch` would swallow the inner arguments.
|
|
26
|
+
*/
|
|
27
|
+
const collect = (value, previous = []) => [...previous, value];
|
|
28
|
+
/** The launcher's own help text; each app prints its own. */
|
|
29
|
+
const HELP_EXAMPLES = `
|
|
30
|
+
Examples:
|
|
31
|
+
dsh --profile web boot the web profile (same as: dsh web)
|
|
32
|
+
dsh --profile headless "run the tests" answer one task, print the result, and exit
|
|
33
|
+
dsh --profile tui --patch ./extra.yml boot a custom profile with one extra overlay
|
|
34
|
+
dsh --profile tui --resume <session> arguments after the launcher flags reach the app
|
|
35
|
+
dsh --profile web --help the web app's own flags and help
|
|
36
|
+
dsh plugin --profile tui add <package> install a plugin into the tui profile
|
|
37
|
+
`;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a boot or dump invocation from the launcher flags and the leftover
|
|
40
|
+
* inner arguments.
|
|
41
|
+
* @param program - the command whose options were parsed (the root, or the `web` alias).
|
|
42
|
+
* @param profile - the profile these flags boot.
|
|
43
|
+
* @param options - the launcher flags commander collected.
|
|
44
|
+
* @param args - the leftover arguments, in argv order.
|
|
45
|
+
* @returns the resolved invocation.
|
|
46
|
+
*/
|
|
47
|
+
function resolveBoot(program, profile, options, args) {
|
|
48
|
+
const patches = options.patch ?? [];
|
|
49
|
+
if (patches.includes("")) program.error("error: --patch needs a path");
|
|
50
|
+
if (options.dumpConfig !== true && options.dumpDefaultConfig !== true) return {
|
|
51
|
+
mode: "profile",
|
|
52
|
+
profile,
|
|
53
|
+
patches,
|
|
54
|
+
args
|
|
55
|
+
};
|
|
56
|
+
if (options.dumpConfig === true && options.dumpDefaultConfig === true) program.error("error: --dump-config and --dump-default-config are mutually exclusive");
|
|
57
|
+
if (args.length > 0) program.error(`error: config dumps take no app arguments, got ${args.map((argument) => JSON.stringify(argument)).join(" ")}`);
|
|
58
|
+
const defaultOnly = options.dumpDefaultConfig === true;
|
|
59
|
+
if (defaultOnly && patches.length > 0) program.error("error: --dump-default-config prints the bundle layers and takes no --patch");
|
|
60
|
+
return {
|
|
61
|
+
mode: "dump-config",
|
|
62
|
+
profile,
|
|
63
|
+
defaultOnly,
|
|
64
|
+
patches
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolve argv into one invocation, or print and exit for help, version, or an
|
|
69
|
+
* error.
|
|
70
|
+
* @param argv - arguments after the Node binary and script.
|
|
71
|
+
* @param version - version string printed by `--version`.
|
|
72
|
+
* @returns the resolved invocation.
|
|
73
|
+
*/
|
|
74
|
+
function parseDshArgs(argv, version) {
|
|
75
|
+
let resolved;
|
|
76
|
+
const program = new Command();
|
|
77
|
+
program.name("dsh").version(version, "-V, --version", "output the version number").description("dsh: boot a DeepSeek Harness profile — an ordered stack of plugin-bundle patch layers under your own overrides.").addHelpText("after", HELP_EXAMPLES).exitOverride().helpOption(false).allowUnknownOption().passThroughOptions().enablePositionalOptions().argument("[args...]", "arguments for the booted profile's app (see: dsh --profile <name> --help)").option("--profile <name>", "the profile under $DSH_HOME/profiles to boot").option("--patch <path>", "extra patch-list overlay applied after the profile layer (repeatable)", collect).option("--dump-config", "print the composed profile tree and exit").option("--dump-default-config", "print the profile tree without its user layer or --patch overlays and exit").action((args, options) => {
|
|
78
|
+
if (options.profile === void 0) {
|
|
79
|
+
if (args.some((argument) => argument === "-h" || argument === "--help")) program.help();
|
|
80
|
+
program.error("error: --profile <name> is required");
|
|
81
|
+
}
|
|
82
|
+
const profile = options.profile;
|
|
83
|
+
if (profile === "") program.error("error: --profile needs a name");
|
|
84
|
+
resolved = resolveBoot(program, profile, options, args);
|
|
85
|
+
});
|
|
86
|
+
/** Reject parent options supplied before a subcommand. */
|
|
87
|
+
const rejectParentOptions = (command) => {
|
|
88
|
+
const parent = program.opts();
|
|
89
|
+
if (parent.profile !== void 0 || parent.patch !== void 0 || parent.dumpConfig !== void 0 || parent.dumpDefaultConfig !== void 0) program.error(`error: ${command} takes none of parent --profile, --patch, --dump-config, or --dump-default-config`);
|
|
90
|
+
};
|
|
91
|
+
const web = program.command("web").description("boot the web profile (alias of --profile web); the web app's own flags follow");
|
|
92
|
+
web.helpOption(false).allowUnknownOption().passThroughOptions().enablePositionalOptions().argument("[args...]", "arguments for the web app (see: dsh web --help)").option("--patch <path>", "extra patch-list overlay applied after the profile layer (repeatable)", collect).option("--dump-config", "print the composed web-profile tree (with the user layer and any --patch) and exit").option("--dump-default-config", "print the web profile's bundle layers (no user layer) and exit").action((args, options) => {
|
|
93
|
+
rejectParentOptions("web");
|
|
94
|
+
resolved = resolveBoot(web, "web", options, args);
|
|
95
|
+
});
|
|
96
|
+
program.command("plugin").description("manage a profile's plugins by forwarding the remaining arguments to pnpm in the profile directory").requiredOption("--profile <name>", "the profile whose plugins to manage (initialized on first use)").allowUnknownOption().argument("[args...]", "pnpm arguments, forwarded verbatim (add <pkg>, remove <pkg>, why <pkg>, ...)").action((args, options) => {
|
|
97
|
+
rejectParentOptions("plugin");
|
|
98
|
+
if (options.profile === "") program.error("error: --profile needs a name");
|
|
99
|
+
if (args.length === 0) program.error("error: plugin needs pnpm arguments to forward (e.g. add <package>)");
|
|
100
|
+
resolved = {
|
|
101
|
+
mode: "plugin",
|
|
102
|
+
profile: options.profile,
|
|
103
|
+
args
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
try {
|
|
107
|
+
program.parse(argv, { from: "user" });
|
|
108
|
+
} catch (error) {
|
|
109
|
+
return process.exit(error instanceof CommanderError ? error.exitCode : 1);
|
|
110
|
+
}
|
|
111
|
+
/* v8 ignore next -- an action resolves or Commander throws */
|
|
112
|
+
if (resolved === void 0) throw new Error("dsh: no invocation resolved");
|
|
113
|
+
return resolved;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region lib/types/bin.js
|
|
117
|
+
/**
|
|
118
|
+
* dsh — command-line entry. Dynamic imports per mode keep unrelated modes out
|
|
119
|
+
* of each dispatch path; the adapter prints and exits for
|
|
120
|
+
* `--help`/`--version`/a parse error, so only a valid mode reaches the switch.
|
|
121
|
+
* @module @deepseek-ai/dsh/bin
|
|
122
|
+
*/
|
|
123
|
+
/* v8 ignore file -- built-bin acceptance exercises this self-executing dispatch. */
|
|
124
|
+
/** This app's version, read from its checked-in package.json. */
|
|
125
|
+
function readVersion() {
|
|
126
|
+
const manifest = JSON.parse(readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf8"));
|
|
127
|
+
return typeof manifest.version === "string" ? manifest.version : "0.0.0";
|
|
128
|
+
}
|
|
129
|
+
const invocation = parseDshArgs(process.argv.slice(2), readVersion());
|
|
130
|
+
switch (invocation.mode) {
|
|
131
|
+
case "profile": {
|
|
132
|
+
const { runProfile } = await import("./profile-boot-T5aOCb6v.js");
|
|
133
|
+
await runProfile({
|
|
134
|
+
environment: loadLayeredEnv("dsh"),
|
|
135
|
+
profile: invocation.profile,
|
|
136
|
+
patchFiles: invocation.patches,
|
|
137
|
+
args: invocation.args
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "plugin": {
|
|
142
|
+
const { runPlugin } = await import("./plugin-Xxr7y7sa.js");
|
|
143
|
+
process.exit(runPlugin(invocation.profile, invocation.args));
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "dump-config": {
|
|
147
|
+
const { runDumpConfig } = await import("./dump-config-DlxoPVYx.js");
|
|
148
|
+
runDumpConfig(invocation.profile, invocation.defaultOnly, invocation.patches);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
default: throw new Error(`dsh: unhandled invocation mode ${JSON.stringify(invocation)}`);
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { i as prepareProfile, n as PROFILE_ROOT_FILENAME, r as homePatchPath, s as resolveWindowsShellLayer } from "./profile-boot-DQYCwKII.js";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { loadOptionalPatches, loadOverlayPatches, renderConfigDump } from "@deepseek-ai/dsh-app-boot";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
//#region lib/types/dump-config.js
|
|
6
|
+
/**
|
|
7
|
+
* Config-dump entry for `dsh --profile <name> --dump-config`: compose the
|
|
8
|
+
* profile's patch layers through the include plugin's patch algorithm without
|
|
9
|
+
* booting or evaluating `!!js`, with one source layer per bundle, the
|
|
10
|
+
* profile's own patch file, and each `--patch` overlay.
|
|
11
|
+
* @module @deepseek-ai/dsh/dump-config
|
|
12
|
+
*/
|
|
13
|
+
const NAME = "dsh";
|
|
14
|
+
/* v8 ignore start -- built-bin acceptance drives this boot-free dispatch */
|
|
15
|
+
/**
|
|
16
|
+
* Print a profile composition with comments naming each source file and patch layer.
|
|
17
|
+
* @param profile - the profile name.
|
|
18
|
+
* @param defaultOnly - omit the profile's user layer and `--patch` overlays
|
|
19
|
+
* (the recovery diagnostic for a broken `cordis.patch.yml`, which is then
|
|
20
|
+
* never parsed).
|
|
21
|
+
* @param patches - `--patch` overlay paths, in argv order.
|
|
22
|
+
*/
|
|
23
|
+
function runDumpConfig(profile, defaultOnly, patches) {
|
|
24
|
+
const loaded = prepareProfile(profile, !defaultOnly);
|
|
25
|
+
const layers = loaded.layers.map((layer) => ({
|
|
26
|
+
label: layer.packageName,
|
|
27
|
+
patches: layer.patches
|
|
28
|
+
}));
|
|
29
|
+
const windowsShellLayer = resolveWindowsShellLayer(process.platform, loaded.layers, NAME);
|
|
30
|
+
if (windowsShellLayer !== void 0) layers.push({
|
|
31
|
+
label: windowsShellLayer.label,
|
|
32
|
+
patches: windowsShellLayer.patches
|
|
33
|
+
});
|
|
34
|
+
if (!defaultOnly) {
|
|
35
|
+
if (existsSync(loaded.patchPath)) layers.push({
|
|
36
|
+
label: loaded.patchPath,
|
|
37
|
+
patches: loaded.patches
|
|
38
|
+
});
|
|
39
|
+
const homePatchFile = homePatchPath();
|
|
40
|
+
const homePatches = loadOptionalPatches(NAME, homePatchFile);
|
|
41
|
+
if (homePatches !== void 0) layers.push({
|
|
42
|
+
label: homePatchFile,
|
|
43
|
+
patches: homePatches
|
|
44
|
+
});
|
|
45
|
+
for (const file of patches) {
|
|
46
|
+
const absolute = resolve(file);
|
|
47
|
+
layers.push({
|
|
48
|
+
label: absolute,
|
|
49
|
+
patches: loadOverlayPatches(NAME, absolute)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
process.stdout.write(renderConfigDump(NAME, join(loaded.dir, PROFILE_ROOT_FILENAME), layers));
|
|
54
|
+
}
|
|
55
|
+
/* v8 ignore stop */
|
|
56
|
+
//#endregion
|
|
57
|
+
export { runDumpConfig };
|