7 Commits
Author SHA1 Message Date
gitea-actions c48e9cabd9 Release v0.4.2 [skip release] [skip actions] 2026-11-06 07:22:02 +00:00
NotExpectedYet 4152c72730 docs: install the latest release, not the 0.1 line
Release / release (push) Successful in 9s
The install command pinned `#semver:^0.1.0`, and for a `0.x` package a caret
range stops before the next minor: `^0.1.0` can never resolve the `0.4.x` line,
so the documented command installs v0.1.4 rather than the current release.
`>=0.1.0` follows the tags the release workflow publishes, which is what the
paragraph promises, and the note now says why the range is not a caret.
2026-11-06 07:21:03 +00:00
NotExpectedYet 1697c24c3c test: fail when a preset drifts from the harness standard
The two files under `presets/` are frozen copies of the harness's `standard`
composition, and nothing noticed when the harness moved on — a missing row only
surfaced as a broken preset in a session, after the copy had already shipped.

`test/presets.test.js` now loads the installed harness's `standard` patch,
removes the deltas this bundle documents, and requires the remaining rows to
match exactly; it also resolves every plugin and subpath a preset names against
the harness scope, so a removed export fails the suite instead of a session.
Both checks skip when a checkout has no harness.

The scope search and the `js-yaml` link the comparison needs live in
`scripts/harness-scope.mjs` and `dev-links.mjs`; the search tries every
candidate scope because the legacy `profiles/node_modules` mirror is only a
snapshot of the installation.
2026-11-06 07:20:35 +00:00
NotExpectedYet 616cad75ce fix: rebuild both shipped presets from the harness standard
On dsh 0.2.2-rc.1 the harness folded `list_agents` into
`@deepseek-ai/dsh-tool-subagent-control` and stopped exporting its
`./list-agents` subpath. Both files under `presets/` are frozen copies of the
shipped `standard` composition, and the copy still named that row. A preset
declaration mounts every row it lists, so the row that could never start broke
the whole declaration: `facet` appeared on the roster with a `broken`
diagnostic and no session could compose it, which is why facet sessions stopped
resuming.

Both files are re-copied from the current `standard` patch and the three
documented changes are re-applied — the guard, the compaction budget, and the
persona's model-only prefix. The drift that came with the stale copy is fixed
with them: `time-context`, `tool-schedule` and `tool-plugin-market` are back,
`tool-subagent` uses the keys the harness reads (`modelSelection`,
`modelDiscovery`) instead of the retired `modelSelectionSettings`/`backgroundMode`,
`tool-fs` keeps `applyPatch: false`, and the plugin-manager row uses the shipped
`profileContext` condition.

The README now names this failure mode and why one dead row is fatal.
2026-11-06 07:20:32 +00:00
gitea-actions 7e75bcf79e Release v0.4.1 [skip release] [skip actions] 2026-10-19 08:58:21 +00:00
NotExpectedYet 9065a5c9d6 Merge branch 'master' of https://git.notexpectedyet.com/Not-Expected-Yet/dsh-facet
Release / release (push) Successful in 8s
2026-10-19 09:58:06 +01:00
NotExpectedYet 4bc4296494 fix: stop the facet preset naming a prompt variable the harness dropped
The preset's persona row copied the deployment's suffix, "Your working directory
is {{cwd}}". The harness substitutes only registered prompt variables and throws
on an unregistered one during prompt assembly — so when a harness release stopped
registering `cwd` (only `provider` and `model` remain), every session on this
preset failed its first turn with

  unknown prompt variable "{{cwd}}" in section "deployment:persona-suffix"

and chat was dead rather than degraded. The row now carries the prefix only.

The folder is stated where it can follow the session instead: the facet binding
already names the facet, and now names the session folder as well when the two
differ — which is every conversation that started higher up and was narrowed, and
exactly the case where relative tool paths need saying out loud.

`test/presets.test.js` makes this class of failure impossible to reintroduce
silently: it scans every shipped preset for a variable reference and requires the
name to be one the harness registers, and holds this bundle's own rule and
binding text to no references at all. Restoring the old suffix fails it.
2026-10-19 09:56:26 +01:00
10 changed files with 428 additions and 101 deletions

No files matched your search

+22
View File
@@ -2,6 +2,28 @@
Every release, newest first, generated from the commits in each release. Every release, newest first, generated from the commits in each release.
## v0.4.2 — 2026-11-06
### Fixed
- rebuild both shipped presets from the harness standard
### Documented
- install the latest release, not the 0.1 line
### Other
- fail when a preset drifts from the harness standard
## v0.4.1 — 2026-10-19
### Fixed
- stop the facet preset naming a prompt variable the harness dropped
## v0.4.0 — 2026-09-28 ## v0.4.0 — 2026-09-28
### Added ### Added
+56 -11
View File
@@ -74,7 +74,7 @@ because otherwise there would be no way to grant anything at all.
From the repository, following releases: From the repository, following releases:
```sh ```sh
dsh plugin --profile web add "git+https://git.notexpectedyet.com/Not-Expected-Yet/dsh-facet.git#semver:^0.1.0" dsh plugin --profile web add "git+https://git.notexpectedyet.com/Not-Expected-Yet/dsh-facet.git#semver:>=0.1.0"
dsh --profile web --dump-config | grep preset-facet # expect the row dsh --profile web --dump-config | grep preset-facet # expect the row
``` ```
@@ -84,13 +84,16 @@ Or from a checkout, while working on the plugin itself:
dsh plugin --profile web add "/path/to/dsh-facet" dsh plugin --profile web add "/path/to/dsh-facet"
``` ```
The `#semver:^0.1.0` fragment is the difference between an install that can be The `#semver:>=0.1.0` fragment is the difference between an install that can be
updated and one that cannot. Leave it off and pnpm resolves the default branch to updated and one that cannot. Leave it off and pnpm resolves the default branch to
a **commit** and records that commit in `pnpm-lock.yaml` — `dsh plugin update` a **commit** and records that commit in `pnpm-lock.yaml` — `dsh plugin update`
then has no version to move to, because there is nothing to move between. With then has no version to move to, because there is nothing to move between. With
the fragment, pnpm resolves against the repository's tags, which the release the fragment, pnpm resolves against the repository's tags, which the release
workflow creates on every push to `master`. The fragment needs a tag to resolve workflow creates on every push to `master`. The range is written `>=` rather
against, so it only works once the first release has been published. than `^` because this package is still `0.x`: a caret range stops before the next
minor, so `^0.1.0` can never reach the `0.4.x` line and would silently install an
old release. The fragment needs a tag to resolve against, so it only works once
the first release has been published.
Either way the command is `pnpm add` run inside the profile, and it registers the Either way the command is `pnpm add` run inside the profile, and it registers the
bundle in `dsh.profile.bundles` for you. A git-hosted plugin that builds on bundle in `dsh.profile.bundles` for you. A git-hosted plugin that builds on
@@ -237,6 +240,42 @@ replaces the whole plugin list rather than merging into it, so the file is a
frozen copy of `standard` that will not follow the harness when `standard` frozen copy of `standard` that will not follow the harness when `standard`
changes. changes.
### Preset drift, and why one dead row breaks the preset
A preset declaration mounts every row it lists, so a single row the harness no
longer provides fails the whole declaration rather than just that tool: the
roster shows the preset with a `broken` diagnostic and no session can compose it.
That is how this bundle broke on dsh `0.2.2-rc.1`. The harness folded
`list_agents` into `@deepseek-ai/dsh-tool-subagent-control` and stopped exporting
its `./list-agents` subpath; the frozen copy still named it, the row could never
start, and every session on the `facet` preset failed to resume.
`test/presets.test.js` now compares both files under `presets/` against the
`standard` preset of the installed harness — after removing the documented
deltas — and resolves every plugin name they list, so the next time the harness
moves a row the copy fails the tests instead of failing sessions.
### Prompt variables, and why the preset's persona has no suffix
Both preset files used to copy the deployment's persona line, *Your working
directory is {{cwd}}*. The harness registers prompt variables per section and an
unregistered reference **throws during prompt assembly**, which fails the entire
turn — not a warning, not a literal left in the text. That is not a hypothetical:
a harness release stopped registering `cwd` (only `provider` and `model` remain),
and every session on this bundle's preset failed with
`unknown prompt variable "{{cwd}}" in section "deployment:persona-suffix"`.
So neither preset carries that suffix now, and the folder is stated where it can
follow the session instead: `facet-guard`'s runtime binding names the facet, and
names the session folder too when the two differ — which is exactly the case
where relative tool paths need saying out loud. `test/presets.test.js` scans both
files for `{{…}}` and fails on any name outside `provider, model`, and the same
test holds this bundle's own rule and binding text to no references at all.
If a *deployment* still fails with that message on a non-facet preset, the
reference is in the deployment's own `system-prompt` config (`personaSuffix`) or
in a copy of the shipped `standard` patch, not in this bundle.
## What it does not cover ## What it does not cover
Honest boundaries, because each one is a decision rather than an oversight: Honest boundaries, because each one is a decision rather than an oversight:
@@ -264,7 +303,7 @@ Honest boundaries, because each one is a decision rather than an oversight:
Verified: Verified:
- 93 tests (`npm test`) over the scope algebra, the policy state, the guard, and - 98 tests (`npm test`) over the scope algebra, the policy state, the guard, and
the browser half — including that containment is decided on canonical targets the browser half — including that containment is decided on canonical targets
(a symlink inside the facet pointing outside it is refused), that a prefix is (a symlink inside the facet pointing outside it is refused), that a prefix is
not a parent (`/a/room` does not contain `/a/roommate`), that a malformed tool not a parent (`/a/room` does not contain `/a/roommate`), that a malformed tool
@@ -275,8 +314,12 @@ Verified:
is refused when the directory it defaults to is outside the facet, that a is refused when the directory it defaults to is outside the facet, that a
delegated session inherits its parent's root at any depth and is not a way back delegated session inherits its parent's root at any depth and is not a way back
out of a self-narrowing, that both listings normalise into one picker level and out of a self-narrowing, that both listings normalise into one picker level and
that a file listing the Host confines still leaves a browsable one, and that that a file listing the Host confines still leaves a browsable one, that no
every `facet` result satisfies the tool's own declared output schema. preset or contributed prompt text references a prompt variable the harness
does not register, that each shipped preset is the installed harness's
`standard` composition plus only its documented changes and names only plugins
the harness provides, and that every `facet` result satisfies the tool's own
declared output schema.
- The bundle's patch layers parse, merge and land correctly against the real - The bundle's patch layers parse, merge and land correctly against the real
profile: `dsh --profile web --patch ./cordis.patch.yml --patch profile: `dsh --profile web --patch ./cordis.patch.yml --patch
./presets/facet.patch.yml --dump-config` shows `facet-policy`, `preset-facet`, ./presets/facet.patch.yml --dump-config` shows `facet-policy`, `preset-facet`,
@@ -334,15 +377,17 @@ would publish.
## Development ## Development
```sh ```sh
node scripts/dev-links.mjs # link the harness's cordis/schemastery/dsh-tools node scripts/dev-links.mjs # link the harness's cordis/schemastery/dsh-tools/js-yaml
npm test npm test
``` ```
`dev-links.mjs` links rather than installs those three packages, and for `dev-links.mjs` links rather than installs those four packages, and for
`@deepseek-ai/cordis` that is a correctness requirement rather than tidiness: a `@deepseek-ai/cordis` that is a correctness requirement rather than tidiness: a
second copy of Cordis means a second `Context` class, two service registries in second copy of Cordis means a second `Context` class, two service registries in
one process, and a plugin whose services are invisible to the harness that loaded one process, and a plugin whose services are invisible to the harness that loaded
it. it. `js-yaml` is there so the preset-drift tests can read the harness's own
`standard` patch; the scope search both share lives in
`scripts/harness-scope.mjs`.
## Layout ## Layout
@@ -354,7 +399,7 @@ lib/scope.js the pure half — argument extraction, text, reason
lib/guard.js preset row: rule, binding, tool, pre-execute guard lib/guard.js preset row: rule, binding, tool, pre-execute guard
presets/facet.patch.yml the `facet` agent preset presets/facet.patch.yml the `facet` agent preset
presets/standard-compaction.patch.yml optional: the same budget for `standard` presets/standard-compaction.patch.yml optional: the same budget for `standard`
test/ 93 tests test/ 98 tests
``` ```
`client/client.js` is a browser half rather than a module the host imports, and `client/client.js` is a browser half rather than a module the host imports, and
+12
View File
@@ -233,6 +233,18 @@ export function facetContextText(input) {
// model needs a path it can reason about, and the user reading an approval // model needs a path it can reason about, and the user reading an approval
// prompt needs to see which folder they are being asked about. // prompt needs to see which folder they are being asked about.
const lines = [`facet: ${root}`] const lines = [`facet: ${root}`]
// The session folder is named only when it is not the facet — the case wherever
// the user narrowed a conversation that started higher up — because that is when
// the two differ and relative paths in tool calls need saying out loud.
//
// It used to be the deployment persona's suffix that stated this, through the
// `cwd` prompt variable. The harness stopped registering that variable, and an
// unknown one now throws during prompt assembly instead of rendering as text, so
// a static template cannot carry a per-session fact any more. This can: it is
// rebuilt for each request from the same header the tool calls resolve against.
if (typeof cwd === 'string' && cwd !== '' && cwd !== root) {
lines.push(`session folder: ${cwd} — relative paths in tool calls resolve here`)
}
if (extras.length > 0) lines.push(`granted outside it: ${extras.map((path) => displayPath(cwd, path)).join(', ')}`) if (extras.length > 0) lines.push(`granted outside it: ${extras.map((path) => displayPath(cwd, path)).join(', ')}`)
lines.push(`outside the facet: ${reach}`) lines.push(`outside the facet: ${reach}`)
return lines.join('\n') return lines.join('\n')
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dsh-facet", "name": "dsh-facet",
"version": "0.4.0", "version": "0.4.2",
"private": true, "private": true,
"type": "module", "type": "module",
"description": "Scope an agent session to one facet of a multi-faceted system: the session's own folder, plus whatever files the user grants it.", "description": "Scope an agent session to one facet of a multi-faceted system: the session's own folder, plus whatever files the user grants it.",
+31 -35
View File
@@ -1,21 +1,33 @@
# Agent preset facet: one `@deepseek-ai/dsh-agent-preset` declaration inserted # Agent preset facet: one `@deepseek-ai/dsh-agent-preset` declaration inserted
# after the web patch. # after the web patch.
# #
# The composition is `standard` with two changes, and this file is the only place # The composition is the shipped `standard` patch with three changes, and this
# either of them is decided: # file is the only place any of them is decided:
# #
# * compaction is configured (see the `compaction` row below) so the pressure # * compaction is configured (see the `compaction` row below) so the pressure
# trigger is a budget rather than a formality. The shipped ratio is 0.80 of a # trigger is a budget rather than a formality. The shipped ratio is 0.80 of a
# 1,000,000-token window, i.e. 800k, and on this deployment nothing has ever # 1,000,000-token window, i.e. 800k, and on this deployment nothing has ever
# come within 1.5% of it — compaction had never once run; # come within 1.5% of it — compaction had never once run;
# #
# * `facet-guard` is mounted, which confines the session to its own folder. # * `facet-guard` is mounted, which confines the session to its own folder;
#
# * the persona row carries no suffix. The shipped one used to state the
# working directory through a prompt variable the harness no longer
# registers, and an unregistered variable fails the whole turn — see the
# note on that row.
# #
# Everything else is copied verbatim from the shipped `standard` patch, and that # Everything else is copied verbatim from the shipped `standard` patch, and that
# is deliberate: a preset declaration replaces the whole plugin list rather than # is deliberate: a preset declaration replaces the whole plugin list rather than
# merging into it, so a clone that drifts from the original silently loses # merging into it, so a clone that drifts from the original silently loses
# whatever it drifted past. When the harness next changes `standard`, re-copy # whatever it drifted past — and a clone that keeps a row the harness has since
# this file and re-apply the two changes — do not hand-patch around it. # removed fails to mount at all. That is how this preset broke on dsh
# 0.2.2-rc.1: the harness folded `list_agents` into
# `@deepseek-ai/dsh-tool-subagent-control` and stopped exporting its
# `./list-agents` subpath, so the copied row could never start and the whole
# preset reported as broken. When the harness next changes `standard`, re-copy
# this file and re-apply the three changes — do not hand-patch around it.
# `test/presets.test.js` compares this file against the installed `standard`
# and fails on any drift, so the reminder is enforced rather than remembered.
- insert: - insert:
- id: preset-facet - id: preset-facet
name: '@deepseek-ai/dsh-agent-preset' name: '@deepseek-ai/dsh-agent-preset'
@@ -28,12 +40,13 @@
- id: persona - id: persona
name: '@deepseek-ai/dsh-persona' name: '@deepseek-ai/dsh-persona'
config: config:
suffix: Your working directory is {{cwd}}.
prefix: You are a coding agent powered by the {{model}} model. prefix: You are a coding agent powered by the {{model}} model.
- id: agent-instructions - id: agent-instructions
name: '@deepseek-ai/dsh-agent-instructions' name: '@deepseek-ai/dsh-agent-instructions'
config: config:
maxBytes: 65536 maxBytes: 65536
- id: time-context
name: '@deepseek-ai/dsh-time-context'
# The facet itself: a rule in the system prompt, the binding in the # The facet itself: a rule in the system prompt, the binding in the
# runtime context, the `facet` tool, and the pre-execute guard that # runtime context, the `facet` tool, and the pre-execute guard that
# asks before a file call leaves the session's folder. Configured by # asks before a file call leaves the session's folder. Configured by
@@ -49,12 +62,17 @@
disabled: !!js process.platform !== 'win32' disabled: !!js process.platform !== 'win32'
- id: tool-fs - id: tool-fs
name: '@deepseek-ai/dsh-tool-fs' name: '@deepseek-ai/dsh-tool-fs'
config:
# Set false to drop the apply_patch tool beside edit.
applyPatch: false
- id: tool-fs-search - id: tool-fs-search
name: '@deepseek-ai/dsh-tool-fs-search' name: '@deepseek-ai/dsh-tool-fs-search'
config: config:
sampleOverCapGlobResults: false sampleOverCapGlobResults: false
- id: tool-jobs - id: tool-jobs
name: '@deepseek-ai/dsh-tool-jobs' name: '@deepseek-ai/dsh-tool-jobs'
- id: tool-schedule
name: '@deepseek-ai/dsh-tool-schedule'
- id: skill-filesystem - id: skill-filesystem
name: '@deepseek-ai/dsh-skill-filesystem' name: '@deepseek-ai/dsh-skill-filesystem'
- id: tool-skill - id: tool-skill
@@ -73,7 +91,7 @@
name: '@deepseek-ai/dsh-plan-mode' name: '@deepseek-ai/dsh-plan-mode'
config: config:
section: | section: |
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. You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or 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.
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. 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.
@@ -94,7 +112,7 @@
- id: compaction-basic - id: compaction-basic
name: '@deepseek-ai/dsh-compaction-basic' name: '@deepseek-ai/dsh-compaction-basic'
config: config:
# 0.80 of a 1M window is a 800k trigger, and the deepest session # 0.80 of a 1M window is an 800k trigger, and the deepest session
# ever recorded here peaked at 787,668 pressure tokens: the # ever recorded here peaked at 787,668 pressure tokens: the
# trigger was never reached, so every token below it was re-read # trigger was never reached, so every token below it was re-read
# on every subsequent step. 0.35 puts the ceiling at 350k. # on every subsequent step. 0.35 puts the ceiling at 350k.
@@ -122,49 +140,24 @@
config: config:
- id: tool-subagent-control - id: tool-subagent-control
name: '@deepseek-ai/dsh-tool-subagent-control' name: '@deepseek-ai/dsh-tool-subagent-control'
- id: tool-subagent-list-agents
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
- id: tool-subagent - id: tool-subagent
name: '@deepseek-ai/dsh-tool-subagent' name: '@deepseek-ai/dsh-tool-subagent'
config: config:
provider: spawn provider: spawn
toolName: subagent toolName: subagent
modelSelectionSettings: true modelSelection: true
backgroundMode: continuable modelDiscovery: true
- id: tool-subagent-fork - id: tool-subagent-fork
name: '@deepseek-ai/dsh-tool-subagent' name: '@deepseek-ai/dsh-tool-subagent'
config: config:
provider: fork provider: fork
toolName: subagent_fork toolName: subagent_fork
backgroundMode: continuable
- id: tool-subagent-codex
name: '@deepseek-ai/dsh-tool-subagent'
disabled: true
config:
provider: codex
toolName: subagent_codex
backgroundMode: one-shot
maxDepth: provider-managed
- id: tool-subagent-claude-code
name: '@deepseek-ai/dsh-tool-subagent'
disabled: true
config:
provider: claude-code
toolName: subagent_claude_code
backgroundMode: one-shot
maxDepth: provider-managed
- id: workflow-ptc - id: workflow-ptc
name: '@deepseek-ai/dsh-workflow-ptc' name: '@deepseek-ai/dsh-workflow-ptc'
config: config:
provider: spawn provider: spawn
- id: tool-workflow - id: tool-workflow
name: '@deepseek-ai/dsh-tool-workflow' name: '@deepseek-ai/dsh-tool-workflow'
- id: tool-ralph
name: '@deepseek-ai/dsh-tool-ralph'
disabled: true
config:
subagentProvider: spawn
maxRounds: 64
- id: tool-ask-user - id: tool-ask-user
name: '@deepseek-ai/dsh-tool-ask-user' name: '@deepseek-ai/dsh-tool-ask-user'
- id: tool-todo - id: tool-todo
@@ -180,4 +173,7 @@
name: '@deepseek-ai/dsh-tool-present' name: '@deepseek-ai/dsh-tool-present'
- id: tool-plugin-manager - id: tool-plugin-manager
name: '@deepseek-ai/dsh-plugin-manager/tools' name: '@deepseek-ai/dsh-plugin-manager/tools'
disabled: !!js "!ctx.get('profileContext')"
- id: tool-plugin-market
name: '@deepseek-ai/dsh-plugin-market/tools'
disabled: true disabled: true
+20 -33
View File
@@ -13,11 +13,14 @@
# into it, so this file is a frozen copy of the shipped `standard` composition # into it, so this file is a frozen copy of the shipped `standard` composition
# plus one change. When the harness next updates `standard` — a new tool, a # plus one change. When the harness next updates `standard` — a new tool, a
# renamed row — this copy will not follow it, and the sessions on this preset # renamed row — this copy will not follow it, and the sessions on this preset
# will silently lose whatever was added. Use it if you are prepared to re-copy # will silently lose whatever was added, or fail to mount if the copy keeps a
# and re-apply when that happens; otherwise take the compaction settings into # row the harness removed. Use it if you are prepared to re-copy and re-apply
# whichever preset you actually run. # when that happens; otherwise take the compaction settings into whichever
# preset you actually run.
# #
# The only change from the shipped file is the `compaction-basic` row's config. # The one change from the shipped file is the `compaction-basic` row's config.
# `test/presets.test.js` compares this file against the installed `standard`
# and fails on any other difference.
- insert: - insert:
- id: preset-standard - id: preset-standard
name: '@deepseek-ai/dsh-agent-preset' name: '@deepseek-ai/dsh-agent-preset'
@@ -28,12 +31,13 @@
- id: persona - id: persona
name: '@deepseek-ai/dsh-persona' name: '@deepseek-ai/dsh-persona'
config: config:
suffix: Your working directory is {{cwd}}.
prefix: You are a coding agent powered by the {{model}} model. prefix: You are a coding agent powered by the {{model}} model.
- id: agent-instructions - id: agent-instructions
name: '@deepseek-ai/dsh-agent-instructions' name: '@deepseek-ai/dsh-agent-instructions'
config: config:
maxBytes: 65536 maxBytes: 65536
- id: time-context
name: '@deepseek-ai/dsh-time-context'
- id: tool-bash - id: tool-bash
name: '@deepseek-ai/dsh-tool-bash' name: '@deepseek-ai/dsh-tool-bash'
disabled: !!js process.platform === 'win32' disabled: !!js process.platform === 'win32'
@@ -42,12 +46,17 @@
disabled: !!js process.platform !== 'win32' disabled: !!js process.platform !== 'win32'
- id: tool-fs - id: tool-fs
name: '@deepseek-ai/dsh-tool-fs' name: '@deepseek-ai/dsh-tool-fs'
config:
# Set false to drop the apply_patch tool beside edit.
applyPatch: false
- id: tool-fs-search - id: tool-fs-search
name: '@deepseek-ai/dsh-tool-fs-search' name: '@deepseek-ai/dsh-tool-fs-search'
config: config:
sampleOverCapGlobResults: false sampleOverCapGlobResults: false
- id: tool-jobs - id: tool-jobs
name: '@deepseek-ai/dsh-tool-jobs' name: '@deepseek-ai/dsh-tool-jobs'
- id: tool-schedule
name: '@deepseek-ai/dsh-tool-schedule'
- id: skill-filesystem - id: skill-filesystem
name: '@deepseek-ai/dsh-skill-filesystem' name: '@deepseek-ai/dsh-skill-filesystem'
- id: tool-skill - id: tool-skill
@@ -66,7 +75,7 @@
name: '@deepseek-ai/dsh-plan-mode' name: '@deepseek-ai/dsh-plan-mode'
config: config:
section: | section: |
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. You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or 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.
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. 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.
@@ -107,49 +116,24 @@
config: config:
- id: tool-subagent-control - id: tool-subagent-control
name: '@deepseek-ai/dsh-tool-subagent-control' name: '@deepseek-ai/dsh-tool-subagent-control'
- id: tool-subagent-list-agents
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
- id: tool-subagent - id: tool-subagent
name: '@deepseek-ai/dsh-tool-subagent' name: '@deepseek-ai/dsh-tool-subagent'
config: config:
provider: spawn provider: spawn
toolName: subagent toolName: subagent
modelSelectionSettings: true modelSelection: true
backgroundMode: continuable modelDiscovery: true
- id: tool-subagent-fork - id: tool-subagent-fork
name: '@deepseek-ai/dsh-tool-subagent' name: '@deepseek-ai/dsh-tool-subagent'
config: config:
provider: fork provider: fork
toolName: subagent_fork toolName: subagent_fork
backgroundMode: continuable
- id: tool-subagent-codex
name: '@deepseek-ai/dsh-tool-subagent'
disabled: true
config:
provider: codex
toolName: subagent_codex
backgroundMode: one-shot
maxDepth: provider-managed
- id: tool-subagent-claude-code
name: '@deepseek-ai/dsh-tool-subagent'
disabled: true
config:
provider: claude-code
toolName: subagent_claude_code
backgroundMode: one-shot
maxDepth: provider-managed
- id: workflow-ptc - id: workflow-ptc
name: '@deepseek-ai/dsh-workflow-ptc' name: '@deepseek-ai/dsh-workflow-ptc'
config: config:
provider: spawn provider: spawn
- id: tool-workflow - id: tool-workflow
name: '@deepseek-ai/dsh-tool-workflow' name: '@deepseek-ai/dsh-tool-workflow'
- id: tool-ralph
name: '@deepseek-ai/dsh-tool-ralph'
disabled: true
config:
subagentProvider: spawn
maxRounds: 64
- id: tool-ask-user - id: tool-ask-user
name: '@deepseek-ai/dsh-tool-ask-user' name: '@deepseek-ai/dsh-tool-ask-user'
- id: tool-todo - id: tool-todo
@@ -165,4 +149,7 @@
name: '@deepseek-ai/dsh-tool-present' name: '@deepseek-ai/dsh-tool-present'
- id: tool-plugin-manager - id: tool-plugin-manager
name: '@deepseek-ai/dsh-plugin-manager/tools' name: '@deepseek-ai/dsh-plugin-manager/tools'
disabled: !!js "!ctx.get('profileContext')"
- id: tool-plugin-market
name: '@deepseek-ai/dsh-plugin-market/tools'
disabled: true disabled: true
+13 -21
View File
@@ -5,10 +5,12 @@
* *
* ## Why this exists * ## Why this exists
* *
* The plugin imports `@deepseek-ai/dsh-tools` and `@deepseek-ai/schemastery`. * The plugin imports `@deepseek-ai/dsh-tools` and `@deepseek-ai/schemastery`,
* Once installed into a profile those resolve from the profile's own * and `test/presets.test.js` reads the shipped `standard` preset through
* `node_modules`, which is where the harness lives — but a bare checkout has no * `js-yaml` to compare it with this bundle's frozen copies. Once installed into
* such tree, so the tests cannot even load the module under test. * a profile those resolve from the profile's own `node_modules`, which is where
* the harness lives — but a bare checkout has no such tree, so the tests cannot
* even load the module under test.
* *
* The alternative is declaring them as dependencies, and for `@deepseek-ai/cordis` * The alternative is declaring them as dependencies, and for `@deepseek-ai/cordis`
* that would be a genuine bug rather than untidiness: a second copy of Cordis * that would be a genuine bug rather than untidiness: a second copy of Cordis
@@ -23,25 +25,14 @@ import { existsSync, mkdirSync, readdirSync, rmSync, symlinkSync } from 'node:fs
import { dirname, join, resolve } from 'node:path' import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url' import { fileURLToPath } from 'node:url'
import { findHarnessScope } from './harness-scope.mjs'
/** Packages this checkout imports at runtime, and which the harness must supply. */ /** Packages this checkout imports at runtime, and which the harness must supply. */
const NEEDED = ['cordis', 'schemastery', 'dsh-tools'] const NEEDED = ['@deepseek-ai/cordis', '@deepseek-ai/schemastery', '@deepseek-ai/dsh-tools', 'js-yaml']
const here = dirname(fileURLToPath(import.meta.url)) const here = dirname(fileURLToPath(import.meta.url))
const packageRoot = resolve(here, '..') const packageRoot = resolve(here, '..')
/** Where a dsh installation keeps the scope, newest layout first. */
function findHarnessScope() {
const candidates = [
process.env.DSH_HARNESS_NODE_MODULES,
resolve(process.env.DSH_HOME ?? join(process.env.HOME ?? '', '.dsh'), 'profiles', 'node_modules'),
'/usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules',
]
for (const candidate of candidates) {
if (typeof candidate === 'string' && existsSync(join(candidate, '@deepseek-ai', 'cordis'))) return candidate
}
return undefined
}
const scope = findHarnessScope() const scope = findHarnessScope()
if (scope === undefined) { if (scope === undefined) {
console.error('dev-links: no dsh installation found. Set DSH_HARNESS_NODE_MODULES to its node_modules directory.') console.error('dev-links: no dsh installation found. Set DSH_HARNESS_NODE_MODULES to its node_modules directory.')
@@ -49,16 +40,17 @@ if (scope === undefined) {
} }
const target = join(packageRoot, 'node_modules') const target = join(packageRoot, 'node_modules')
mkdirSync(join(target, '@deepseek-ai'), { recursive: true }) mkdirSync(target, { recursive: true })
let linked = 0 let linked = 0
for (const name of NEEDED) { for (const name of NEEDED) {
const source = join(scope, '@deepseek-ai', name) const source = join(scope, name)
if (!existsSync(source)) { if (!existsSync(source)) {
console.error(`dev-links: ${name} is not in ${scope}; skipping`) console.error(`dev-links: ${name} is not in ${scope}; skipping`)
continue continue
} }
const link = join(target, '@deepseek-ai', name) const link = join(target, name)
mkdirSync(dirname(link), { recursive: true })
if (existsSync(link)) rmSync(link, { recursive: true, force: true }) if (existsSync(link)) rmSync(link, { recursive: true, force: true })
symlinkSync(source, link, 'dir') symlinkSync(source, link, 'dir')
linked += 1 linked += 1
+46
View File
@@ -0,0 +1,46 @@
/**
* Locate a dsh installation's dependency scope from a checkout.
*
* The plugin links harness packages into a bare checkout (see `dev-links.mjs`)
* and `test/presets.test.js` reads the shipped `standard` preset to compare it
* with this bundle's frozen copies. Both need the same answer to "where is the
* harness?", so the search lives here rather than twice.
*
* There can be more than one answer. A harness home may carry the legacy
* `profiles/node_modules` mirror that an older link backend projected, and that
* mirror is a snapshot: packages added to the installation later are missing
* from it. Callers that resolve more than one package should therefore try
* every scope, not only {@link findHarnessScope}'s first answer.
*/
import { existsSync } from 'node:fs'
import { join, resolve } from 'node:path'
/**
* Every dependency scope a dsh installation may occupy, newest layout first.
*
* @returns the directories that hold `@deepseek-ai/cordis`, deduplicated, in
* preference order.
*/
export function harnessScopes() {
const candidates = [
process.env.DSH_HARNESS_NODE_MODULES,
resolve(process.env.DSH_HOME ?? join(process.env.HOME ?? '', '.dsh'), 'profiles', 'node_modules'),
'/usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules',
]
const scopes = []
for (const candidate of candidates) {
if (typeof candidate !== 'string' || !existsSync(join(candidate, '@deepseek-ai', 'cordis'))) continue
if (!scopes.includes(candidate)) scopes.push(candidate)
}
return scopes
}
/**
* The preferred dependency scope of a dsh installation.
*
* @returns the first directory that holds `@deepseek-ai/cordis`, or undefined.
*/
export function findHarnessScope() {
return harnessScopes()[0]
}
+225
View File
@@ -0,0 +1,225 @@
import assert from 'node:assert/strict'
import { existsSync, readFileSync, readdirSync } from 'node:fs'
import { createRequire } from 'node:module'
import { dirname, join } from 'node:path'
import { test } from 'node:test'
import { fileURLToPath } from 'node:url'
import yaml from 'js-yaml'
import { facetContextText, facetRuleText } from '../lib/scope.js'
import { harnessScopes } from '../scripts/harness-scope.mjs'
const PRESETS = join(dirname(fileURLToPath(import.meta.url)), '..', 'presets')
/**
* The prompt variables the harness registers for a section.
*
* `dsh-agent-loop` puts each of these into the prompt registry, and an assembly
* substitutes only what is registered. An unknown reference is not rendered as
* text — interpolation throws, and the throw takes the entire turn with it, so
* the user sees "This turn failed" and nothing else. A harness release that
* stopped registering `cwd` is exactly how this bundle's preset stopped
* composing sessions: the persona suffix it copied from the deployment said
* "Your working directory is …" with that variable in it.
*/
const REGISTERED = ['provider', 'model']
/** Every `{{name}}` reference in one text, as the name alone. */
function referencesIn(text) {
return [...text.matchAll(/\{\{([^{}]*)\}\}/g)].map((match) => match[1])
}
test('no preset references a prompt variable the harness does not register', () => {
const files = readdirSync(PRESETS).filter((name) => name.endsWith('.yml'))
assert.ok(files.length > 0, 'the bundle ships at least one preset')
const found = []
for (const file of files) {
for (const name of referencesIn(readFileSync(join(PRESETS, file), 'utf8'))) found.push([file, name])
}
// The model reference is the one that has to keep working, so the guard cannot
// be satisfied by a preset that references nothing at all.
assert.ok(
found.some(([, name]) => name === 'model'),
'a preset still names the model',
)
for (const [file, name] of found) {
assert.ok(
REGISTERED.includes(name),
`${file} references {{${name}}}; the harness registers only ${REGISTERED.join(', ')}, and an unregistered reference fails the whole turn`,
)
}
})
test('the text this bundle contributes to the prompt holds no variable references', () => {
// The rule and the binding are rebuilt from real values on every request, so a
// placeholder in either would be a reference the harness never resolves — the
// same failure, this time from the bundle's own hand.
const rule = facetRuleText()
const binding = facetContextText({ cwd: '/w', root: '/w/src', extras: ['/w/shared'], mode: 'ask' })
assert.ok(rule.length > 0 && binding.length > 0, 'both halves contribute text')
assert.deepEqual(referencesIn(rule), [])
assert.deepEqual(referencesIn(binding), [])
})
/*
* Drift against the shipped `standard` composition.
*
* A preset declaration replaces the whole plugin list rather than merging into
* it, so both files under `presets/` are frozen copies of the harness's
* `standard` patch. That copy is what breaks when the harness changes: on dsh
* 0.2.2-rc.1 the harness folded `list_agents` into
* `@deepseek-ai/dsh-tool-subagent-control` and dropped its `./list-agents`
* subpath, and the copied row could never start — which breaks the *whole*
* preset, because one row that fails to mount fails the declaration. These
* tests turn "remember to re-copy it" into a build failure.
*
* They need the installed harness, so they skip on a checkout without one.
*/
const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
const FACET_PRESET = join(PRESETS, 'facet.patch.yml')
const COMPACTION_PRESET = join(PRESETS, 'standard-compaction.patch.yml')
const HARNESS_SCOPES = harnessScopes()
const STANDARD_PRESET = HARNESS_SCOPES
.map((scope) => join(scope, '@deepseek-ai', 'dsh-web-app', 'presets', 'standard.patch.yml'))
.find((file) => existsSync(file))
const SKIP_DRIFT =
HARNESS_SCOPES.length === 0
? 'no dsh installation found; set DSH_HARNESS_NODE_MODULES to compare against the shipped standard preset'
: STANDARD_PRESET === undefined
? 'the shipped standard preset was not found in any harness scope'
: false
/** The `!!js` tag carries a source expression; both compared sides keep it as text. */
const PRESET_SCHEMA = yaml.DEFAULT_SCHEMA.extend([
new yaml.Type('tag:yaml.org,2002:js', { kind: 'scalar', construct: (value) => value }),
])
/** The plugin rows of a single-preset patch file, as written. */
function presetPlugins(file) {
const [patch] = yaml.load(readFileSync(file, 'utf8'), { schema: PRESET_SCHEMA })
return patch.insert[0].config.plugins
}
/** Drop absent keys, so a missing field and an undefined field compare the same. */
function normalizedRows(rows) {
return rows.map((row) => ({
id: row.id,
name: row.name,
...(row.disabled === undefined ? {} : { disabled: row.disabled }),
...(row.group === true ? { group: true } : {}),
...(row.isolate === undefined ? {} : { isolate: row.isolate }),
...(row.config === undefined ? {} : { config: Array.isArray(row.config) ? normalizedRows(row.config) : row.config }),
}))
}
/** One row by id, at any depth. */
function rowById(rows, id) {
for (const row of rows) {
if (row.id === id) return row
if (Array.isArray(row.config)) {
const found = rowById(row.config, id)
if (found !== undefined) return found
}
}
return undefined
}
/** A copy with the bundle's compaction budget removed, so everything else can be compared. */
function withoutCompactionBudget(rows) {
const copy = structuredClone(rows)
const strip = (list) => {
for (const row of list) {
if (row.id === 'compaction-basic') delete row.config
if (Array.isArray(row.config)) strip(row.config)
}
}
strip(copy)
return copy
}
/** The only settings either file adds to a `standard` row. */
const COMPACTION_BUDGET = { thresholdRatio: 0.35, retainTokens: 80000, maxTokens: 16384 }
test('the facet preset is the shipped standard composition plus its documented changes', { skip: SKIP_DRIFT }, () => {
const standard = normalizedRows(presetPlugins(STANDARD_PRESET))
const facet = normalizedRows(presetPlugins(FACET_PRESET))
const guard = facet.filter((row) => row.id === 'facet-guard')
assert.deepEqual(guard, [{ id: 'facet-guard', name: 'dsh-facet/guard' }], 'the facet preset mounts facet-guard exactly once')
const withoutGuard = facet.filter((row) => row.id !== 'facet-guard')
assert.deepEqual(
withoutCompactionBudget(withoutGuard),
withoutCompactionBudget(standard),
'presets/facet.patch.yml has drifted from the shipped standard composition; re-copy it from the harness and re-apply only the guard and the compaction budget',
)
assert.deepEqual(
rowById(withoutGuard, 'compaction-basic')?.config,
COMPACTION_BUDGET,
'the facet preset keeps its compaction budget',
)
})
test('the standard-compaction overlay is the shipped standard composition plus the compaction budget', { skip: SKIP_DRIFT }, () => {
const standard = normalizedRows(presetPlugins(STANDARD_PRESET))
const overlay = normalizedRows(presetPlugins(COMPACTION_PRESET))
assert.deepEqual(
rowById(overlay, 'compaction-basic')?.config,
COMPACTION_BUDGET,
'the optional overlay configures the compaction budget',
)
assert.deepEqual(
withoutCompactionBudget(overlay),
withoutCompactionBudget(standard),
'presets/standard-compaction.patch.yml has drifted from the shipped standard composition; re-copy it from the harness and re-apply only the compaction budget',
)
})
/** Every row's id and module specifier, groups included. */
function namedRows(rows) {
return rows.flatMap((row) => [
{ id: row.id, name: row.name },
...(Array.isArray(row.config) ? namedRows(row.config) : []),
])
}
test('every plugin a shipped preset names resolves against the installed harness', { skip: SKIP_DRIFT }, () => {
// Anchoring inside a scope makes Node look in that scope's own node_modules:
// its parent directory carries the scope as a `node_modules` entry, which is
// exactly the lookup the profile uses. Several scopes are tried because a
// legacy `profiles/node_modules` mirror is only a snapshot of the installation.
const harnessResolvers = HARNESS_SCOPES.map((scope) => createRequire(join(scope, 'noop.mjs')))
const fromPlugin = createRequire(join(PACKAGE_ROOT, 'package.json'))
const unresolved = []
for (const file of [FACET_PRESET, COMPACTION_PRESET]) {
for (const { id, name } of namedRows(presetPlugins(file))) {
// `cordis:group` is a loader builtin rather than an installed package.
if (name === 'cordis:group') continue
const resolvers = name === 'dsh-facet/guard' ? [fromPlugin] : harnessResolvers
let failure
const resolved = resolvers.some((resolver) => {
try {
resolver.resolve(name)
return true
} catch (error) {
failure = error
return false
}
})
if (!resolved) unresolved.push(`${file.split('/').pop()}: ${id} (${name}): ${failure?.code ?? failure?.message}`)
}
}
assert.deepEqual(
unresolved,
[],
'a preset names a plugin or subpath the harness no longer provides; re-copy the preset from the shipped standard',
)
})
+2
View File
@@ -74,6 +74,7 @@ test('facetContextText carries the binding that does change', () => {
assert.equal( assert.equal(
ask, ask,
'facet: /w/src/room\n' + 'facet: /w/src/room\n' +
'session folder: /w — relative paths in tool calls resolve here\n' +
'outside the facet: put to the user as a question — say in one line what you need and why, then record it with `facet action=add` so the rest of the session does not have to ask again', 'outside the facet: put to the user as a question — say in one line what you need and why, then record it with `facet action=add` so the rest of the session does not have to ask again',
) )
@@ -81,6 +82,7 @@ test('facetContextText carries the binding that does change', () => {
assert.equal( assert.equal(
deny, deny,
'facet: /w/src/room\n' + 'facet: /w/src/room\n' +
'session folder: /w — relative paths in tool calls resolve here\n' +
'granted outside it: src/shared\n' + 'granted outside it: src/shared\n' +
'outside the facet: refused — ask the user to widen the facet from its context panel, or with `facet action=add` where that can be granted', 'outside the facet: refused — ask the user to widen the facet from its context panel, or with `facet action=add` where that can be granted',
) )