@knyazevai/dsh 0.1.3 → 0.1.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Knyazev AI
3
+ Copyright (c) 2026 DeepSeek
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write apps/cli/README.md
5
+ README.md: dc3d7c057ad9da7c6239427dd8297f22b96924bb
6
+ README.zh.md: 9c8e99e07dd16c86e18b469edc0f4dca416ca08f
package/README.md CHANGED
@@ -1,115 +1,47 @@
1
- # @knyazevai/dsh
1
+ # `@knyazevai/dsh`
2
2
 
3
- Плагин [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): провайдер **Knyazev AI**, модели Flash / Kimi / MiniMax, thinking и effort `off / high / max`. После установки выбран **Flash max** — в Models остаётся только ключ.
3
+ English | [中文](README.zh.md)
4
4
 
5
- ## Установка
5
+ The `dsh` command is the product launcher for profiles: ordered stacks of plugin-bundle patch layers under the user's own overrides. [`src/args.ts`](src/args.ts) owns the command grammar, and [`src/bin.ts`](src/bin.ts) loads only the selected runner. Invalid commands, options from another mode, configuration errors, and boot failures exit nonzero.
6
6
 
7
- Нужны [Node.js](https://nodejs.org/) и [pnpm](https://pnpm.io/).
7
+ ## Entry modes
8
8
 
9
- Профили DSH — pnpm workspace, поэтому нужен `-w`.
10
-
11
- ```sh
12
- npx @deepseek-ai/dsh plugin --profile web add -w @knyazevai/dsh
13
- npx @deepseek-ai/dsh web
14
- ```
15
-
16
- Пока пакет не на npm — ставь с GitHub:
17
-
18
- ```sh
19
- npx @deepseek-ai/dsh plugin --profile web add -w git+https://github.com/knyazev741/knyazevai-dsh.git
20
- ```
21
-
22
- Локально из клона:
23
-
24
- ```sh
25
- npx @deepseek-ai/dsh plugin --profile web add -w .
26
- ```
27
-
28
- Для headless то же с `--profile headless`.
29
-
30
- ## После установки
31
-
32
- Новые сессии сразу идут на **Knyazev AI / DeepSeek V4 Flash** с effort **max**. Kimi и MiniMax уже в пикере, сабагенты на том же маршруте.
33
-
34
- Ключ в пакет не входит. Если `KNYAZEV_AI_API_KEY` ещё не в окружении — открой Harness → Models → **Knyazev AI** и вставь `kn_live_…` из [кабинета](https://knyazevai.work). Модели выбирать не нужно.
35
-
36
- Не копируй YAML руками и не дублируй провайдер в `settings.yaml`. Пакет кладёт маршрут и дефолт в composition; ключ живёт в credentials. Сохранённый выбор в `settings.yaml` по-прежнему перекрывает composition.
37
-
38
- ## Полная сборка с фиксом компактинга
39
-
40
- Обычная установка по имени использует официальный релиз DeepSeek Harness, в котором bounded-компактинг для огромных контекстов (400k) ещё не вышел. Если он нужен (большие сессии сжимаются по кусочкам, а не падают по `pi-ai stream idle timeout`) — запусти харнесс из форка с этим фиксом + плагин:
41
-
42
- ```sh
43
- git clone https://github.com/knyazev741/deepseek-harness
44
- cd deepseek-harness
45
- pnpm install
46
- pnpm run build
47
- pnpm dsh plugin --profile web add @knyazevai/dsh
48
- pnpm dsh web
49
- ```
50
-
51
- Фикс `maxSummarizationInputTokens` — код харнесса, он есть только в этой сборке; плагин несёт его конфиг (только для `knyazev-ai`).
52
-
53
- **Как форк держится свежим по upstream (автоматически, с AI-ревью).** В форке есть два воркфлоу:
54
- - `upstream-sync.yml` — раз в час тянет официальный `deepseek-ai/deepseek-harness` master в ветку-ПР `sync/upstream-master` (конфликты решаются в пользу форка);
55
- - `upstream-review.yml` — на каждом таком ПР гоняет sanity-гейты (typecheck + тесты) и прогоняет многоходовой headless-агент Knyazev (`knyazev-ai/deepseek-v4-flash`), который ревьюит дифф и отдаёт вердикт `{safe, summary, risks}`. Авто-мёрж ПР делается **только при вердикте safe**; risky остаётся человеку. Никогда ничего не деплоит.
56
-
57
- Для ревью в настройках репозитория форка нужен секрет `KNYAZEV_AI_API_KEY` (тот же ключ маршрута knyazev-ai).
58
-
59
- Для человека обновление сводится к `git pull` в клоне + `pnpm install && pnpm run build` — сами изменения upstream уже засинканы и отревьюены на стороне форка.
60
-
61
- Пока этот фикс не в официальном релизе, обычная установка по имени compaction-фикса не даёт — только запуск из форка.
62
-
63
- ## Что ставится
64
-
65
- | Поле | Значение |
9
+ | Command | Purpose |
66
10
  |---|---|
67
- | Provider | `knyazev-ai` |
68
- | Endpoint | `https://knyazevai.work/v1` |
69
- | Models | `deepseek-v4-flash`, `kimi-2.6`, `minimax-2.7` |
70
- | Thinking | qwen / `enable_thinking` |
71
- | Effort | `off`, `high`, `max` (Flash и Kimi) |
11
+ | `dsh --profile <name>` | Boot the named profile under `$DSH_HOME/profiles/<name>`. |
12
+ | `dsh --profile headless "job"` | Run one fresh persisted session, print the final answer, and exit. |
13
+ | `dsh web` | Alias of the packaged `fork-web` profile; explicit `--profile web` remains the upstream-only template. |
14
+ | `dsh plugin --profile <name> <pnpm args>` | Manage a profile's plugins by forwarding to pnpm in the profile directory. |
72
15
 
73
- MiniMax без пикера effort: модель не отдаёт reasoning отдельным полем.
16
+ The invoking directory is the default workspace root. The `web`, `fork-web`, and `headless` profiles auto-initialize on first use from shipped templates; the packaged `dsh web` alias selects `fork-web`, while explicit `dsh --profile web` selects the upstream-only template. Any other profile must be created through `dsh plugin`.
74
17
 
75
- Дефолт Harness после установки: `knyazev-ai` / `deepseek-v4-flash`, effort `max`. Сабагенты (`subagent`, `subagent_fork`) на том же маршруте.
18
+ ## App arguments
76
19
 
77
- ## Обновление / снятие
20
+ The launcher parses only its own flags and hands everything after them to the booted profile, where any injected app plugin may parse the shared immutable snapshot ([`dsh-cmdline`](../../packages/boot/cmdline/README.md)). Launcher flags therefore come first, and the first token the launcher does not recognize starts the app's arguments:
78
21
 
79
22
  ```sh
80
- npx @deepseek-ai/dsh plugin --profile web update
81
- npx @deepseek-ai/dsh plugin --profile web remove -w @knyazevai/dsh
23
+ dsh --profile web --port 8080 # --port belongs to the web app
24
+ dsh --profile tui --resume <id> # example, assuming the tui profile is installed; --resume belongs to the terminal app
25
+ dsh --profile headless "run the tests"
26
+ dsh --profile web --help # the web app's flags, not the launcher's
27
+ dsh --help # the launcher's own help
82
28
  ```
83
29
 
84
- ## Релиз (публикация в npm)
85
-
86
- Пакет публикуется автоматически: GitHub Actions прогоняет тесты и на пуш тега `v<версия>` выкладывает `@knyazevai/dsh` в npm.
87
-
88
- Один раз настрой доступ:
30
+ ## Profiles
89
31
 
90
- 1. В npm (Account → Access Tokens) создай токен уровня **Automation** (без двухфакторки).
91
- 2. На GitHub в репо → Settings → Secrets and variables → Actions добавь секрет `NPM_TOKEN` с этим токеном.
92
- 3. `publishConfig.access: public` уже стоит в `package.json`.
32
+ A profile directory holds a `package.json` (out-of-tree plugin dependencies plus the profile manifest `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml` (the user's own patch layer).
93
33
 
94
- Дальше на каждый новый релиз:
34
+ The tree composes over an empty root:
35
+ - each bundle's patch in `dsh.profile.bundles` order
36
+ - then the profile's `cordis.patch.yml`, then the home-level `$DSH_HOME/cordis.patch.yml`
37
+ - then `--patch` overlays
95
38
 
96
- ```sh
97
- npm version patch # поднимает версию: patch | minor | major
98
- git push origin main
99
- git push origin v0.1.1 # пуш тега запускает тесты + публикацию
100
- ```
39
+ Bundles named in `dsh.profile.bundles` resolve from the dsh installation first (`@knyazevai/dsh-base`, `@knyazevai/dsh-web-app`, `@knyazevai/dsh-fork-base`, `@knyazevai/dsh-fork-web`, and `@knyazevai/dsh-headless`), then from the profile's own `node_modules`, where pnpm installs out-of-tree plugins. The shipped `fork-web` template is installation-owned and layers the two upstream bundles with the two fork bundles; the default `web` template remains upstream-only.
101
40
 
102
- Тесты перед публикацией идут сами (`prepublishOnly` в `package.json`).
103
-
104
- Установка **по имени** — сразу после публикации, на любой машине:
105
-
106
- ```sh
107
- npx @deepseek-ai/dsh plugin --profile web add @knyazevai/dsh
108
- npx @deepseek-ai/dsh web
109
- ```
41
+ Use `--dump-default-config` and `--dump-config` to inspect the composed tree without booting it.
110
42
 
111
- Пока пакет не на npm — действует установка с GitHub из раздела «Установка».
43
+ The [CLI behavior reference](reference/README.md) owns exact layer precedence, flags, shutdown behavior, deployment defaults, and source execution.
112
44
 
113
- ## Docs
45
+ ## Development
114
46
 
115
- https://knyazevai.work/docs
47
+ Production runs require built package and frontend artifacts. From the repository root, run `pnpm run build` separately, then use `pnpm dsh <args...>` to run the TypeScript entry and forward every argument; the [source-execution reference](reference/README.md#source-execution) owns the module-resolution contract.
package/README.zh.md ADDED
@@ -0,0 +1,49 @@
1
+ # `@knyazevai/dsh`
2
+
3
+ [English](README.md) | 中文
4
+
5
+ `dsh` 是 DeepSeek Harness 中用于启动 profile 的命令;profile 由多个插件组合包 patch 层按顺序叠加而成,其上再应用用户自己的覆盖配置。[`src/args.ts`](src/args.ts) 负责命令语法,[`src/bin.ts`](src/bin.ts) 只加载选中的运行器。无效命令、来自其他模式的选项、配置错误和启动失败都会以非零状态退出。
6
+
7
+ ## 入口模式
8
+
9
+ | 命令 | 用途 |
10
+ |---|---|
11
+ | `dsh --profile <name>` | 启动位于 `$DSH_HOME/profiles/<name>` 的指定 profile。 |
12
+ | `dsh --profile headless "job"` | 运行一个全新的持久化会话,打印最终答案并退出。 |
13
+ | `dsh web` | 已发布 `fork-web` profile 的别名;显式 `--profile web` 仍使用仅上游模板。 |
14
+ | `dsh plugin --profile <name> <pnpm args>` | 通过在 profile 目录中转发给 pnpm 来管理该 profile 的插件。 |
15
+
16
+ 运行命令时所在的目录将作为默认 workspace 根目录。`web`、`fork-web` 和 `headless` profile 在首次使用时会从随附模板自动初始化;已发布 CLI 的 `dsh web` 别名选择 `fork-web`,而显式的 `dsh --profile web` 选择仅上游模板。其他任何 profile 都必须通过 `dsh plugin` 创建。
17
+
18
+ ## 应用参数
19
+
20
+ 启动器只解析自身的 flag,并将其后的所有内容交给已启动的 profile;注入该 profile 的任意应用插件都可以解析这份共享的不可变快照([`dsh-cmdline`](../../packages/boot/cmdline/README.zh.md))。因此,启动器的 flag 必须写在最前面;启动器无法识别的第一个 token 标志着应用参数的开始:
21
+
22
+ ```sh
23
+ dsh --profile web --port 8080 # --port belongs to the web app
24
+ dsh --profile tui --resume <id> # example, assuming the tui profile is installed; --resume belongs to the terminal app
25
+ dsh --profile headless "run the tests"
26
+ dsh --profile web --help # the web app's flags, not the launcher's
27
+ dsh --help # the launcher's own help
28
+ ```
29
+
30
+ <a id="profiles"></a>
31
+
32
+ ## Profile
33
+
34
+ profile 目录包含一个 `package.json`,其中记录树外插件依赖,以及 profile manifest(元数据清单)`dsh.profile` 和其中按顺序排列的 `bundles` 列表;还包含一个 `cordis.patch.yml`,其中保存用户自己的 patch 层。
35
+
36
+ 配置树以空根为起点,依次叠加以下配置层:
37
+ - `dsh.profile.bundles` 中各组合包的 patch
38
+ - profile 自身的 `cordis.patch.yml`,然后是 home 级的 `$DSH_HOME/cordis.patch.yml`
39
+ - `--patch` 指定的覆盖层
40
+
41
+ `dsh.profile.bundles` 中列出的组合包先从 dsh 安装目录解析(`@knyazevai/dsh-base`、`@knyazevai/dsh-web-app`、`@knyazevai/dsh-fork-base`、`@knyazevai/dsh-fork-web` 和 `@knyazevai/dsh-headless`),再从 profile 自身的 `node_modules` 解析;pnpm 会将树外插件安装到该目录。随附的 `fork-web` 模板由安装目录拥有,并按顺序挂载两个上游组合包和两个 fork 组合包;默认的 `web` 模板仍仅包含上游层。
42
+
43
+ 使用 `--dump-default-config` 和 `--dump-config` 可在不启动的情况下检查组合后的配置树。
44
+
45
+ 层的确切优先级、flag、关闭行为、部署默认值和源码执行方式,以 [CLI(命令行界面)行为参考](reference/README.zh.md)为准。
46
+
47
+ ## 开发
48
+
49
+ 生产运行需要已构建的包与前端产物。请在仓库根目录单独运行 `pnpm run build`,然后使用 `pnpm dsh <args...>` 运行 TypeScript 入口并转发所有参数;模块解析约定以[源码执行参考](reference/README.zh.md#source-execution)为准。
package/bin.mjs ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ // A workspace install must run the checkout's source launcher; an npm install
4
+ // outside the repository must run the packaged build.
5
+
6
+ import { existsSync, realpathSync } from 'node:fs'
7
+ import { dirname, join, resolve } from 'node:path'
8
+ import { fileURLToPath } from 'node:url'
9
+ import { spawnSync } from 'node:child_process'
10
+
11
+ const packageRoot = dirname(realpathSync(fileURLToPath(import.meta.url)))
12
+ const repositoryRoot = resolve(packageRoot, '../..')
13
+ const repositoryEntry = join(repositoryRoot, 'scripts/repo-dsh.ts')
14
+ const inRepository = existsSync(repositoryEntry) && existsSync(join(repositoryRoot, 'pnpm-workspace.yaml'))
15
+ const args = inRepository
16
+ ? ['--import', 'tsx/esm', repositoryEntry, ...process.argv.slice(2)]
17
+ : [join(packageRoot, 'lib/bin.js'), ...process.argv.slice(2)]
18
+ const result = spawnSync(process.execPath, args, { env: process.env, stdio: 'inherit' })
19
+
20
+ if (result.error !== undefined) {
21
+ process.stderr.write(`dsh: could not start Node: ${result.error.message}\n`)
22
+ process.exit(1)
23
+ }
24
+
25
+ process.exit(result.status ?? 1)
@@ -0,0 +1,263 @@
1
+ # The `code` agent preset: the standard coding agent, presented as Code Mode.
2
+ #
3
+ # Everything in `standard` is here unchanged. What is added is the `tool-presentation`
4
+ # row: instead of one tool call per action, the model writes a TypeScript
5
+ # program against a generated SDK and `run_code` executes it, so a sequence
6
+ # that would be five round trips becomes one.
7
+ #
8
+ # The registry itself stays on the host plane — the agent loop's scheduler and
9
+ # the API proxy's presenters are its consumers — so what this preset owns is
10
+ # the PRESENTATION of that registry for this agent alone. Native sessions run
11
+ # beside this one in the same process, each seeing its own catalog.
12
+ #
13
+ # This file is an AGENT-PLANE composition. It is mounted under one agent's
14
+ # scope context, so every tool and prompt section it registers belongs to that
15
+ # session alone. The host composition (`base.cordis.yml` + `web.cordis.yml`)
16
+ # keeps everything a preset must not own: the registries themselves, the
17
+ # sandbox and approval stack, persistence, and the model route.
18
+ #
19
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
20
+ # Without one it publishes into the root realm, where it is process-global
21
+ # rather than per-session and the second session mounting this preset collides
22
+ # with the first; `dsh-agent-presets` rejects that at mount. `true` means an
23
+ # entry-local realm — one private instance per mounted session, which is the
24
+ # default this deployment wants. A shared label would instead pool one instance
25
+ # across every session naming it.
26
+
27
+ # ── identity ────────────────────────────────────────────────────────────────
28
+
29
+ # The preset's own persona, shadowing the deployment default for this agent.
30
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
31
+ - id: persona
32
+ name: '@knyazevai/dsh-persona'
33
+ config:
34
+ text: >-
35
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
36
+
37
+ - id: agent-instructions
38
+ name: '@knyazevai/dsh-agent-instructions'
39
+ config:
40
+ maxBytes: 65536
41
+
42
+ # ── shell ───────────────────────────────────────────────────────────────────
43
+
44
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
45
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
46
+ # the criterion for host-plane ownership — injection resolves before any session
47
+ # exists, so there is no agent to key by. Behind a preset realm those variables
48
+ # never reached the model's shell at all. Both shell tools consume the host
49
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
50
+ # host-plane too.
51
+ - id: tool-bash
52
+ name: '@knyazevai/dsh-tool-bash'
53
+ disabled: !!js process.platform === 'win32'
54
+
55
+ - id: tool-pwsh
56
+ name: '@knyazevai/dsh-tool-pwsh'
57
+ disabled: !!js process.platform !== 'win32'
58
+
59
+ # ── filesystem ──────────────────────────────────────────────────────────────
60
+
61
+ # Both register into the host `tools` registry and provide nothing, so
62
+ # they need no realm. The `fs` service and its policy stay in the host.
63
+ - id: tool-fs
64
+ name: '@knyazevai/dsh-tool-fs'
65
+
66
+ - id: tool-fs-search
67
+ name: '@knyazevai/dsh-tool-fs-search'
68
+ config:
69
+ sampleOverCapGlobResults: false
70
+
71
+ # ── background jobs ────────────────────────────────────────────────────────
72
+
73
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
74
+ # its producers sit outside any realm this file could put it in — `tool-bash`
75
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
76
+ # to every sibling row, so `run_in_background` would answer "background jobs
77
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
78
+ # owning agent anyway, so one host instance serves every session. What a preset
79
+ # chooses is whether its agent can collect and stop background work at all.
80
+ - id: tool-jobs
81
+ name: '@knyazevai/dsh-tool-jobs'
82
+
83
+ # ── skills ──────────────────────────────────────────────────────────────────
84
+
85
+ # The skill REGISTRY lives in the host composition and is layered per scope:
86
+ # these rows register into THIS preset's layer of it, so they need no realm.
87
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
88
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
89
+ # carries whatever the deployment registered globally (repository plugins).
90
+ - id: skill-filesystem
91
+ name: '@knyazevai/dsh-skill-filesystem'
92
+
93
+ - id: tool-skill
94
+ name: '@knyazevai/dsh-tool-skill'
95
+
96
+ # ── goals ───────────────────────────────────────────────────────────────────
97
+
98
+ # Only the model-facing tool. The goal SERVICE, its session driver, and the
99
+ # `/goal` command stay on the host plane: the Gateway serves the goal domain as
100
+ # Remote endpoints whose receiver comes from a generated descriptor, so it
101
+ # resolves `goals` on the host and an entry-local realm here would hide it. The
102
+ # registry is keyed by session anyway, so one host instance serves every
103
+ # session. What a preset chooses is whether its agent can call the goal tool.
104
+ - id: tool-goal
105
+ name: '@knyazevai/dsh-tool-goal'
106
+
107
+ # ── plan mode ───────────────────────────────────────────────────────────────
108
+
109
+ # Plan state is per-agent by nature, so an entry-local realm is not a
110
+ # workaround here — it is the correct lifetime.
111
+ - id: planning
112
+ name: cordis:group
113
+ group: true
114
+ isolate:
115
+ planMode: true
116
+ config:
117
+ - id: plan-mode
118
+ name: '@knyazevai/dsh-plan-mode'
119
+ config:
120
+ section: |
121
+ 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.
122
+
123
+ 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.
124
+
125
+ 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.
126
+
127
+ 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.
128
+
129
+ 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.
130
+
131
+ 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.
132
+
133
+ # ── compaction ──────────────────────────────────────────────────────────────
134
+
135
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
136
+ # share this realm rather than sit outside it.
137
+ #
138
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
139
+ # plane, and the rows here resolve that one instance. It takes no configuration,
140
+ # keys every fold by Session, and owns the context-meter projection units the
141
+ # browser reads for every session — behind a realm those units would come and go
142
+ # with whichever presets happen to be mounted. What a preset chooses is whether
143
+ # its agent compacts at all, which is `compaction-basic` below.
144
+ - id: compaction
145
+ name: cordis:group
146
+ group: true
147
+ isolate:
148
+ compaction: true
149
+ toolResultPruner: true
150
+ config:
151
+ - id: compaction-basic
152
+ name: '@knyazevai/dsh-compaction-basic'
153
+
154
+ - id: command-compact
155
+ name: '@knyazevai/dsh-command-compact'
156
+
157
+ - id: tool-result-pruner
158
+ name: '@knyazevai/dsh-compaction-tool-result-pruner'
159
+ config:
160
+ thresholdChars: 8192
161
+ headChars: 4096
162
+ tailChars: 1024
163
+
164
+ # ── delegation and workflows ────────────────────────────────────────────────
165
+
166
+ # The `subagents` registry and its spawn/fork backends live in the HOST
167
+ # composition: the registry is a process singleton whose cross-session queries
168
+ # the api-proxy serves to the browser, and a provider name may only be
169
+ # registered once. This preset contributes the delegation TOOLS, which resolve
170
+ # that host registry.
171
+ #
172
+ # `workflows` is different — nothing outside an agent reads it — so every row
173
+ # that reaches it shares one entry-local realm here, and a consumer left
174
+ # outside would resolve a host registry this preset does not populate.
175
+ - id: delegation
176
+ name: cordis:group
177
+ group: true
178
+ isolate:
179
+ workflowEngine: true
180
+ config:
181
+ - id: tool-subagent-control
182
+ name: '@knyazevai/dsh-tool-subagent-control'
183
+
184
+ - id: tool-subagent-list-agents
185
+ name: '@knyazevai/dsh-tool-subagent-control/list-agents'
186
+
187
+ - id: tool-subagent
188
+ name: '@knyazevai/dsh-tool-subagent'
189
+ config:
190
+ provider: spawn
191
+ toolName: subagent
192
+ backgroundMode: continuable
193
+
194
+ - id: tool-subagent-fork
195
+ name: '@knyazevai/dsh-tool-subagent'
196
+ config:
197
+ provider: fork
198
+ toolName: subagent_fork
199
+ backgroundMode: continuable
200
+
201
+ # Production dsh does not install these optional providers. Install the
202
+ # matching Bundle in this Profile and restart the Host, then copy this
203
+ # preset and remove `disabled` from the matching tool row. Host availability
204
+ # alone grants no tool.
205
+ - id: tool-subagent-codex
206
+ name: '@knyazevai/dsh-tool-subagent'
207
+ disabled: true
208
+ config:
209
+ provider: codex
210
+ toolName: subagent_codex
211
+ backgroundMode: one-shot
212
+ maxDepth: provider-managed
213
+
214
+ - id: tool-subagent-claude-code
215
+ name: '@knyazevai/dsh-tool-subagent'
216
+ disabled: true
217
+ config:
218
+ provider: claude-code
219
+ toolName: subagent_claude_code
220
+ backgroundMode: one-shot
221
+ maxDepth: provider-managed
222
+
223
+ - id: workflow-worker-thread
224
+ name: '@knyazevai/dsh-workflow-worker-thread'
225
+ config:
226
+ provider: spawn
227
+
228
+ - id: tool-workflow
229
+ name: '@knyazevai/dsh-tool-workflow'
230
+
231
+ - id: tool-ralph
232
+ name: '@knyazevai/dsh-tool-ralph'
233
+ config:
234
+ subagentProvider: spawn
235
+ maxRounds: 64
236
+
237
+ # ── remaining model-facing rows ─────────────────────────────────────────────
238
+
239
+ - id: tool-ask-user
240
+ name: '@knyazevai/dsh-tool-ask-user'
241
+
242
+ - id: tool-todo
243
+ name: '@knyazevai/dsh-tool-todo'
244
+ config:
245
+ allowParallelInProgress: true
246
+
247
+ # The `web` service and its search provider stay in the host composition; only
248
+ # the model-facing tool is per-session.
249
+ - id: tool-web
250
+ name: '@knyazevai/dsh-tool-web'
251
+ config:
252
+ fetch: false
253
+ searchTimeoutMs: 60000
254
+
255
+ # ── presentation ────────────────────────────────────────────────────────────
256
+
257
+ # Code Mode for this agent alone. The row waits for the host's `codeRuntime`
258
+ # rather than assuming it: a deployment that composes no TypeScript runtime
259
+ # fails this preset at mount, naming this id, instead of at the first request.
260
+ - id: tool-presentation
261
+ name: '@knyazevai/dsh-agent-tool-presentation'
262
+ config:
263
+ mode: code
@@ -0,0 +1,3 @@
1
+ name: PTC 模式
2
+ description: 具备标准模式的全部能力,并通过 Code Mode SDK 呈现工具,让模型用一个 TypeScript 程序组合多步操作。
3
+ order: 2