dsh-plugin-prompt-tool 0.7.2 → 0.8.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.
Files changed (169) hide show
  1. package/README.md +185 -46
  2. package/engine/THIRD_PARTY_LICENSES +25 -0
  3. package/engine/actions.mjs +931 -0
  4. package/engine/anchor-match.mjs +6 -3
  5. package/engine/character-tools.mjs +11 -0
  6. package/engine/classify-task.mjs +18 -0
  7. package/engine/compaction-epoch.mjs +41 -20
  8. package/engine/compositions/library/agent-instructions.yml +9 -0
  9. package/engine/compositions/library/command-goal.yml +2 -6
  10. package/engine/compositions/library/compaction.yml +2 -32
  11. package/engine/compositions/library/delegation-ptc.yml +58 -0
  12. package/engine/compositions/library/delegation.yml +5 -38
  13. package/engine/compositions/library/persistent-shell.yml +4 -13
  14. package/engine/compositions/library/planning.yml +8 -23
  15. package/engine/compositions/library/skill-filesystem-cordis.yml +10 -0
  16. package/engine/compositions/library/skill-filesystem.yml +2 -8
  17. package/engine/compositions/library/tool-ask-user.yml +2 -3
  18. package/engine/compositions/library/tool-bash.yml +4 -12
  19. package/engine/compositions/library/tool-cordis.yml +7 -0
  20. package/engine/compositions/library/tool-fs-search.yml +2 -11
  21. package/engine/compositions/library/tool-fs.yml +2 -5
  22. package/engine/compositions/library/tool-goal.yml +2 -6
  23. package/engine/compositions/library/tool-jobs.yml +2 -18
  24. package/engine/compositions/library/tool-plugin-manager-disabled.yml +8 -0
  25. package/engine/compositions/library/tool-plugin-manager.yml +8 -0
  26. package/engine/compositions/library/tool-present.yml +7 -0
  27. package/engine/compositions/library/tool-presentation.yml +9 -0
  28. package/engine/compositions/library/tool-pwsh.yml +2 -6
  29. package/engine/compositions/library/tool-skill.yml +7 -0
  30. package/engine/compositions/library/tool-todo.yml +2 -4
  31. package/engine/compositions/library/tool-web.yml +2 -1
  32. package/engine/compositions/source/local/character-tools.yml +5 -0
  33. package/engine/compositions/source/local/declared-triggers.yml +12 -0
  34. package/engine/compositions/source/local/filesystem-editor.yml +30 -0
  35. package/engine/compositions/source/local/instruction-hint.yml +15 -0
  36. package/engine/compositions/{library/official-persistent-shell.yml → source/local/persistent-shell-posix.yml} +10 -8
  37. package/engine/compositions/source/local/prompt-config-engine.yml +3 -9
  38. package/engine/compositions/source/local/run-code-env.yml +4 -7
  39. package/engine/compositions/source/local/session-var-tools.yml +5 -0
  40. package/engine/compositions/source/local/skill-search.yml +3 -9
  41. package/engine/compositions/source/local/subagent-tool-policy.yml +21 -0
  42. package/engine/compositions/source/local/tool-bash-disabled.yml +9 -0
  43. package/engine/compositions/source/local/tool-config-engine.yml +8 -0
  44. package/engine/compositions/source/local/tool-git-bash.yml +15 -0
  45. package/engine/compositions/source/local/world-book-tools.yml +5 -0
  46. package/engine/condition.mjs +83 -0
  47. package/engine/declared-triggers.mjs +93 -0
  48. package/engine/executor.mjs +364 -185
  49. package/engine/fields.mjs +219 -0
  50. package/engine/fillers.mjs +12 -141
  51. package/engine/host-package.mjs +51 -0
  52. package/engine/instruction-hint.mjs +285 -0
  53. package/engine/interpolate.mjs +157 -29
  54. package/engine/layers.mjs +495 -75
  55. package/engine/predicates.mjs +753 -0
  56. package/engine/prompt-config-engine.mjs +63 -8
  57. package/engine/run-code-env.mjs +48 -31
  58. package/engine/schema.mjs +444 -103
  59. package/engine/sdk-strip.mjs +365 -0
  60. package/engine/session-var-tools.mjs +11 -0
  61. package/engine/session-vars.mjs +8 -6
  62. package/engine/shared.mjs +137 -0
  63. package/engine/skill-search.mjs +34 -21
  64. package/engine/st-macros.d.mts +22 -0
  65. package/engine/st-macros.mjs +208 -0
  66. package/engine/st-render.mjs +105 -0
  67. package/engine/st-world-book.d.mts +10 -0
  68. package/engine/st-world-book.mjs +259 -0
  69. package/engine/strategies.mjs +31 -20
  70. package/engine/subagent-tool-policy-core.mjs +400 -0
  71. package/engine/subagent-tool-policy.mjs +327 -0
  72. package/engine/tool-config-engine.mjs +207 -145
  73. package/engine/tool-definition.mjs +143 -0
  74. package/engine/{custom-bash.mjs → tool-git-bash.mjs} +38 -13
  75. package/engine/trigger-editor-meta.mjs +48 -0
  76. package/engine/trigger-spec.mjs +257 -0
  77. package/engine/trigger.mjs +304 -0
  78. package/engine/world-book-tools.mjs +11 -0
  79. package/lib/client.js +16495 -5456
  80. package/lib/client.js.map +1 -1
  81. package/lib/index.d.mts +628 -382
  82. package/lib/index.mjs +5391 -2942
  83. package/lib/paths-CY5psBqE.d.mts +1233 -0
  84. package/lib/preset-package-BnJqrU4R.mjs +16792 -0
  85. package/lib/preset-transfer.d.mts +2 -0
  86. package/lib/preset-transfer.mjs +2 -0
  87. package/package.json +91 -49
  88. package/preset/pt-cordis/preset.yml +43 -0
  89. package/preset/pt-cordis/skills/cordis-composition-reference/SKILL.md +29 -0
  90. package/preset/pt-cordis/skills/cordis-composition-reference/references/packages.md +501 -0
  91. package/preset/pt-cordis/skills/cordis-plugin-development/SKILL.md +38 -0
  92. package/preset/pt-cordis/skills/cordis-plugin-development/references/host-plugin.md +60 -0
  93. package/preset/pt-cordis/skills/cordis-plugin-development/references/mcp-bundle.md +5 -0
  94. package/preset/pt-cordis/skills/cordis-plugin-development/references/ui-plugin.md +13 -0
  95. package/preset/pt-cordis/skills/cordis-plugin-development/references/verification.md +5 -0
  96. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/client.js +22 -0
  97. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/cordis.patch.yml +3 -0
  98. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/index.js +2 -0
  99. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/package.json +15 -0
  100. package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/cordis.patch.yml +8 -0
  101. package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/package.json +7 -0
  102. package/preset/pt-cordis/skills/editing-cordis-compositions/SKILL.md +84 -0
  103. package/preset/pt-custom/preset.yml +15 -0
  104. package/preset/pt-minimal/preset.yml +27 -0
  105. package/preset/pt-ptc/preset.yml +45 -0
  106. package/preset/pt-standard/preset.yml +43 -0
  107. package/templates/14-first-turn-anchor.yml +4 -4
  108. package/templates/15-guide-auto.yml +3 -3
  109. package/templates/16-custom-fallback.yml +1 -0
  110. package/templates/18-placeholder-env-facts.yml +3 -3
  111. package/templates/20-system-section.yml +3 -2
  112. package/templates/65-turn-stop.yml +18 -0
  113. package/templates/66-subagent-start.yml +14 -0
  114. package/templates/75-subagent-end.yml +15 -0
  115. package/templates/tools/10-shell-command.yml +1 -1
  116. package/templates/tools/40-delegate-character.yml +1 -1
  117. package/templates/tools/50-delegate-worldbook.yml +1 -1
  118. package/templates/tools/60-delegate-session-var.yml +1 -1
  119. package/templates/tools/70-delegate-worldbook-upsert.yml +1 -1
  120. package/engine/anchor-turn.mjs +0 -68
  121. package/engine/code-presentation.mjs +0 -103
  122. package/engine/compositions/library/anchor-turn.yml +0 -10
  123. package/engine/compositions/library/bootstrap-filesystem.yml +0 -19
  124. package/engine/compositions/library/code-presentation.yml +0 -8
  125. package/engine/compositions/library/context-gate.yml +0 -39
  126. package/engine/compositions/library/cot-drip.yml +0 -11
  127. package/engine/compositions/library/custom-bash.yml +0 -14
  128. package/engine/compositions/library/deliberation-gate.yml +0 -11
  129. package/engine/compositions/library/official-agent-instructions.yml +0 -17
  130. package/engine/compositions/library/official-skill-filesystem-cordis.yml +0 -10
  131. package/engine/compositions/library/official-tool-bash.yml +0 -6
  132. package/engine/compositions/library/official-tool-cordis.yml +0 -13
  133. package/engine/compositions/library/official-tool-presentation.yml +0 -7
  134. package/engine/compositions/library/official-tool-skill.yml +0 -14
  135. package/engine/compositions/library/persona.yml +0 -13
  136. package/engine/compositions/library/prompt-config-engine.yml +0 -16
  137. package/engine/compositions/library/run-code-env.yml +0 -15
  138. package/engine/compositions/library/skill-search.yml +0 -14
  139. package/engine/compositions/library/str-replace-editor.yml +0 -10
  140. package/engine/compositions/library/tool-bootstrap.yml +0 -14
  141. package/engine/compositions/library/tool-config-engine.yml +0 -9
  142. package/engine/compositions/library/tool-filter.yml +0 -8
  143. package/engine/compositions/source/local/code-presentation.yml +0 -8
  144. package/engine/compositions/source/local/context-gate.yml +0 -36
  145. package/engine/compositions/source/local/custom-bash.yml +0 -11
  146. package/engine/compositions/source/local/str-replace-editor.yml +0 -10
  147. package/engine/compositions/source/local/tool-bootstrap.yml +0 -11
  148. package/engine/compositions/source/local/tool-filter.yml +0 -8
  149. package/engine/context-gate.mjs +0 -305
  150. package/engine/cot-drip.mjs +0 -137
  151. package/engine/deliberation-gate.mjs +0 -127
  152. package/engine/tool-bootstrap.mjs +0 -476
  153. package/engine/tool-filter.mjs +0 -80
  154. package/lib/preset-core.d.mts +0 -10
  155. package/lib/preset-core.mjs +0 -77
  156. package/lib/prompt-configs-BnQKRHVb.mjs +0 -884
  157. package/lib/prompt-configs-CN0sJTUL.d.mts +0 -193
  158. package/preset/anchored/preset.yml +0 -296
  159. package/preset/creative/preset.yml +0 -67
  160. package/preset/creative/skills/cordis-plugin-development/SKILL.md +0 -420
  161. package/preset/creative/skills/editing-cordis-compositions/SKILL.md +0 -165
  162. package/preset/custom/preset.yml +0 -12
  163. package/preset/liangshen/preset.yml +0 -75
  164. package/preset/minimal/preset.yml +0 -45
  165. package/preset/ptc/preset.yml +0 -58
  166. package/preset/standard/preset.yml +0 -57
  167. package/skills/manifest.json +0 -7
  168. package/skills/sandboxmod/SKILL.md +0 -49
  169. package/skills/web ui/SKILL.md +0 -42
@@ -1,18 +1,9 @@
1
1
  # module: tool-fs-search
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
6
  - id: tool-fs-search
6
7
  name: '@deepseek-ai/dsh-tool-fs-search'
7
8
  config:
8
9
  sampleOverCapGlobResults: false
9
-
10
- # ── background jobs ────────────────────────────────────────────────────────
11
-
12
- # Only the model-facing controls. The task REGISTRY stays on the host plane:
13
- # its producers sit outside any realm this file could put it in — `tool-bash`
14
- # above resolves it with `ctx.get`, and an entry-local realm here is invisible
15
- # to every sibling row, so `run_in_background` would answer "background jobs
16
- # unavailable" while these controls sat in the catalog. The registry is keyed by
17
- # owning agent anyway, so one host instance serves every session. What a preset
18
- # chooses is whether its agent can collect and stop background work at all.
@@ -1,10 +1,7 @@
1
1
  # module: tool-fs
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
- # ── filesystem ──────────────────────────────────────────────────────────────
6
-
7
- # Both register into the host `tools` registry and provide nothing, so
8
- # they need no realm. The `fs` service and its policy stay in the host.
9
6
  - id: tool-fs
10
7
  name: '@deepseek-ai/dsh-tool-fs'
@@ -1,11 +1,7 @@
1
1
  # module: tool-goal
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
6
  - id: tool-goal
6
7
  name: '@deepseek-ai/dsh-tool-goal'
7
-
8
- # ── plan mode ───────────────────────────────────────────────────────────────
9
-
10
- # Plan state is per-agent by nature, so an entry-local realm is not a
11
- # workaround here — it is the correct lifetime.
@@ -1,23 +1,7 @@
1
1
  # module: tool-jobs
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
- # ── background jobs ────────────────────────────────────────────────────────
6
-
7
- # Only the model-facing controls. The task REGISTRY stays on the host plane:
8
- # its producers sit outside any realm this file could put it in — `tool-bash`
9
- # above resolves it with `ctx.get`, and an entry-local realm here is invisible
10
- # to every sibling row, so `run_in_background` would answer "background jobs
11
- # unavailable" while these controls sat in the catalog. The registry is keyed by
12
- # owning agent anyway, so one host instance serves every session. What a preset
13
- # chooses is whether its agent can collect and stop background work at all.
14
6
  - id: tool-jobs
15
7
  name: '@deepseek-ai/dsh-tool-jobs'
16
-
17
- # ── skills ──────────────────────────────────────────────────────────────────
18
-
19
- # The skill REGISTRY lives in the host composition and is layered per scope:
20
- # these rows register into THIS preset's layer of it, so they need no realm.
21
- # `skill-filesystem` contributes local-root discovery for agents on this preset, and
22
- # `tool-skill` gives them the catalog and loader; the merged catalog also
23
- # carries whatever the deployment registered globally (repository plugins).
@@ -0,0 +1,8 @@
1
+ # module: tool-plugin-manager-disabled
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: tool-plugin-manager
7
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
8
+ disabled: true
@@ -0,0 +1,8 @@
1
+ # module: tool-plugin-manager
2
+ # source: master/packages/bundle/web-app/presets/cordis.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: tool-plugin-manager
7
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
8
+ disabled: !!js "!ctx.get('profileContext')"
@@ -0,0 +1,7 @@
1
+ # module: tool-present
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: present
7
+ name: '@deepseek-ai/dsh-tool-present'
@@ -0,0 +1,9 @@
1
+ # module: tool-presentation
2
+ # source: master/packages/bundle/web-app/presets/ptc.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: tool-presentation
7
+ name: '@deepseek-ai/dsh-agent-tool-presentation'
8
+ config:
9
+ mode: ptc
@@ -1,12 +1,8 @@
1
1
  # module: tool-pwsh
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
6
  - id: tool-pwsh
6
7
  name: '@deepseek-ai/dsh-tool-pwsh'
7
8
  disabled: !!js process.platform !== 'win32'
8
-
9
- # ── filesystem ──────────────────────────────────────────────────────────────
10
-
11
- # Both register into the host `tools` registry and provide nothing, so
12
- # they need no realm. The `fs` service and its policy stay in the host.
@@ -0,0 +1,7 @@
1
+ # module: tool-skill
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: tool-skill
7
+ name: '@deepseek-ai/dsh-tool-skill'
@@ -1,11 +1,9 @@
1
1
  # module: tool-todo
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
6
  - id: tool-todo
6
7
  name: '@deepseek-ai/dsh-tool-todo'
7
8
  config:
8
9
  allowParallelInProgress: true
9
-
10
- # The `web` service and its search provider stay in the host composition; only
11
- # the model-facing tool is per-session.
@@ -1,5 +1,6 @@
1
1
  # module: tool-web
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
3
4
  # local patches: 0
4
5
 
5
6
  - id: tool-web
@@ -0,0 +1,5 @@
1
+ # module: character-tools
2
+ # source: engine/compositions/source/local/character-tools.yml (本地附加,非官方模块)
3
+
4
+ - id: character-tools
5
+ name: ./engine/character-tools.mjs
@@ -0,0 +1,12 @@
1
+ # module: declared-triggers
2
+ # source: 本地新增(B7 声明式触发器:preset.yml 顶层 triggers 段 → triggers.yml → 本模块注册)
3
+ # 声明由预设提供,引擎不带默认(2026-09-22 拍板):triggers.yml 缺失 = 没有声明,不注册任何
4
+ # 触发器、也不让预设启动失败(与 subagent-tool-policy 的 ENOENT 降级同一纪律)。
5
+ # 本行由 writePreset 按「有 triggers 段」自动装配(见 src/host/manifest.ts 的 implied modules)。
6
+ # triggersFile 是**初值**:迁移/物化时由 preset-install 的 ENGINE_MANAGED_PATHS 改写成
7
+ # ../<presetId>/triggers.yml(与 subagent-tool-policy 的 policyFile 同一规则)。
8
+
9
+ - id: declared-triggers
10
+ name: ./engine/declared-triggers.mjs
11
+ config:
12
+ triggersFile: ../triggers.yml
@@ -0,0 +1,30 @@
1
+ # module: filesystem-editor
2
+ # source: engine/compositions/source/local/filesystem-editor.yml (本地能力)
3
+ # rc.2 官方 minimal 只保留单 shell 工具,不再提供 filesystem 组;本模块保留为
4
+ # 本插件自己的引导期文件系统能力,只由显式声明本模块的预设装配(既有用户预设可继续引用)。
5
+ #
6
+ # 能力提供者边界(T4 文件归属校正):本行行下的 str-replace-editor 是**官方实现**
7
+ # —— `@deepseek-ai/dsh-tool-str-replace-editor`(官方包,配置声明与注册都在包内),
8
+ # 本仓库**没有**对应的 .mjs。它连同 subagent-tool-policy、tool-config-engine 一起
9
+ # 构成 PLAN T4 的三个能力提供者,三者都不接入 engine/trigger.mjs。
10
+ # 判据:会给模型提供可调用能力(注册工具/域)的 → 能力提供者;干预流程
11
+ # (改提示词、改装配、裁决、追加)的 → 声明式触发器。
12
+ # 注意 engine/tool-git-bash.mjs 提供的是 `bash` 工具,**不是**这第三个提供者。
13
+
14
+ # The bare local filesystem shadows the host's sandboxed provider only for this
15
+ # preset. The editor shares that realm and requires absolute paths.
16
+ - id: filesystem-editor
17
+ name: cordis:group
18
+ group: true
19
+ isolate:
20
+ fs: true
21
+ config:
22
+ - id: fs-local
23
+ name: '@deepseek-ai/dsh-fs-local'
24
+ config:
25
+ cwd: !!js process.env.DSH_CWD ?? process.cwd()
26
+
27
+ - id: str-replace-editor
28
+ name: '@deepseek-ai/dsh-tool-str-replace-editor'
29
+ config:
30
+ maxOutputChars: 16000
@@ -0,0 +1,15 @@
1
+ # module: instruction-hint
2
+ # source: engine/compositions/source/local/instruction-hint.yml (本地附加,非官方模块)
3
+ # context-gate 的 instructionHint 转换在本模块的归属行——删除前的原始语义见
4
+ # context-gate.mjs:64-66,替换点 :243-248,pre-step 挂载 :226-255:晋升后把
5
+ # agent-instructions 全文换成一次性非命令式 hint,后续全文 dump 丢弃。
6
+ # opt-in:enabled 默认 false(与原 instructionHint 默认 false 同值),由参数桥
7
+ # params.instructionHint(→ 本行 enabled)或本行 config.enabled: true 打开;
8
+ # 相位词汇与 tool-bootstrap / promoted-code-mode 同源(compaction-epoch.mjs)。
9
+
10
+ - id: instruction-hint
11
+ name: ./engine/instruction-hint.mjs
12
+ config:
13
+ enabled: false
14
+ promoteOn: either
15
+ includeSubagents: false
@@ -1,9 +1,14 @@
1
- # module: official-persistent-shell
2
- # source: deepseek-harness official minimal agent preset (persistent-shell)
1
+ # module: persistent-shell-posix
2
+ # source: engine/compositions/source/local/persistent-shell-posix.yml (本地适配)
3
+ # based on: dsh-v0.1.5-rc.2 minimal/agent.cordis.yml#persistent-shell
4
+ # commit: fb2c4b9e698e30edb738bca4cf0618587db7d203
5
+ # 本地差异:Windows 禁用整组;POSIX 缺少 /bin/bash 时从 PATH 查找 bash。
6
+ # 保留原组内服务、工具配置与隔离域,不改变工具名和权限边界。
3
7
 
4
- - id: persistent-shell
8
+ - id: persistent-shell-posix
5
9
  name: cordis:group
6
10
  group: true
11
+ disabled: !!js process.platform === 'win32'
7
12
  isolate:
8
13
  terminals: true
9
14
  config:
@@ -14,6 +19,7 @@
14
19
  name: '@deepseek-ai/dsh-terminal-bash'
15
20
  disabled: !!js process.platform === 'win32'
16
21
  config:
22
+ shellPath: !!js "process.getBuiltinModule?.('node:fs')?.existsSync('/bin/bash') ? '/bin/bash' : 'bash'"
17
23
  timeoutMs: 300000
18
24
 
19
25
  - id: persistent-bash
@@ -24,8 +30,7 @@
24
30
  description: |-
25
31
  Run commands in a bash shell
26
32
  * When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
27
- * You don't have access to the internet via this tool.
28
- * You do have access to a mirror of common linux and python packages via apt and pip.
33
+ * Network access depends on the task environment. Prefer configured mirrors/proxies when they are available.
29
34
  * State is persistent across command calls and discussions with the user.
30
35
  * To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
31
36
  * Please avoid commands that may produce a very large amount of output.
@@ -51,6 +56,3 @@
51
56
  * Use native Windows paths (C:\...) and $env:NAME variables; this is PowerShell, not bash.
52
57
  * Please avoid commands that may produce a very large amount of output.
53
58
  * Please run long lived commands in the background, e.g. 'Start-Job' or start a server with Start-Process.
54
-
55
- # The bare local filesystem shadows the host's sandboxed provider only for this
56
- # preset. The editor shares that realm and requires absolute paths.
@@ -1,13 +1,7 @@
1
+ # module: prompt-config-engine
2
+ # source: engine/compositions/source/local/prompt-config-engine.yml (本地附加,非官方模块)
3
+
1
4
  - id: prompt-config-engine
2
5
  name: ./engine/prompt-config-engine.mjs
3
6
  config:
4
7
  configsDir: ../prompt-configs
5
-
6
- # ── PTC run_code environment (prompt-tool local addition) ──────────────────
7
- #
8
- # Official Code Mode runs the model program in a worker with env={}; the
9
- # program cannot read system environment. This row patches the reserved
10
- # run_code transport so every program gets a frozen `env` global containing
11
- # the whitelisted non-secret host variables below plus managed DSH_* facts
12
- # and DSH_WORKSPACE. Add deployment-specific names to envKeys as needed.
13
- # Credential-shaped names (KEY/PASSWORD/SECRET/TOKEN) are always rejected.
@@ -1,12 +1,9 @@
1
+ # module: run-code-env
2
+ # source: engine/compositions/source/local/run-code-env.yml (本地附加,非官方模块)
3
+ # 为 PTC run_code 注入冻结的非敏感环境变量快照;凭据形态键始终拒绝。
4
+
1
5
  - id: run-code-env
2
6
  name: ./engine/run-code-env.mjs
3
7
  config:
4
8
  enabled: true
5
9
  envKeys: [PATH, PATHEXT, HOME, USERPROFILE, USERNAME, COMPUTERNAME, OS, TEMP, TMP, SystemRoot, ProgramFiles, ProgramFiles(x86), LOCALAPPDATA, APPDATA]
6
-
7
- # ── identity ────────────────────────────────────────────────────────────────
8
-
9
- # Keep this text byte-identical to the Minimal preset. `complete` prevents the
10
- # Harness identity and per-tool guidance from changing the system prompt, while
11
- # runtime-context suppression leaves task and repository rules to user messages
12
- # and explicit file reads. Tool schemas and their runtime enforcement remain.
@@ -0,0 +1,5 @@
1
+ # module: session-var-tools
2
+ # source: engine/compositions/source/local/session-var-tools.yml (本地附加,非官方模块)
3
+
4
+ - id: session-var-tools
5
+ name: ./engine/session-var-tools.mjs
@@ -1,11 +1,5 @@
1
+ # module: skill-search
2
+ # source: engine/compositions/source/local/skill-search.yml (本地附加,非官方模块)
3
+
1
4
  - id: skill-search
2
5
  name: ./engine/skill-search.mjs
3
-
4
- # ── goals ───────────────────────────────────────────────────────────────────
5
-
6
- # Only the model-facing tool. The goal SERVICE, its session driver, and the
7
- # `/goal` command stay on the host plane: the Gateway serves the goal domain as
8
- # Remote endpoints whose receiver comes from a generated descriptor, so it
9
- # resolves `goals` on the host and an entry-local realm here would hide it. The
10
- # registry is keyed by session anyway, so one host instance serves every
11
- # session. What a preset chooses is whether its agent can call the goal tool.
@@ -0,0 +1,21 @@
1
+ # module: subagent-tool-policy
2
+ # source: 本地新增(子代理实例级工具策略:agent-scoped subagent/subagent_fork shadow)
3
+ # 策略数据源 = 预设目录 subagent-tools/policy.yml(writePreset 从 preset.yml 顶层
4
+ # subagentToolPolicy 物化)。策略启用时参数桥不再把主代理 toolFilter 写入
5
+ # delegation.toolFilter;未启用策略的预设完全保持官方 delegation 行为。
6
+ #
7
+ # 能力提供者边界(T4):本行是**能力提供者**(给模型提供 subagent/subagent_fork 两个
8
+ # 可调用工具),**不接入** engine/trigger.mjs。判据:会给模型提供可调用能力
9
+ # (注册工具/域)的 → 能力提供者;干预流程(改提示词、改装配、裁决、追加)的 →
10
+ # 声明式触发器。登记数据在 engine/subagent-tool-policy.mjs 的 `engineProvider`
11
+ # 导出,与 `engineTriggers`(声明式触发器)互斥;守卫见
12
+ # test/engine/provider-boundary.test.mjs。模块内扩权审批门与 fail loud 语义是安全
13
+ # 边界,改装配方式时不得放宽。
14
+
15
+ - id: subagent-tool-policy
16
+ name: ./engine/subagent-tool-policy.mjs
17
+ config:
18
+ policyFile: ../subagent-tools/policy.yml
19
+ spawnProvider: spawn
20
+ forkProvider: fork
21
+ maxDepth: 3
@@ -0,0 +1,9 @@
1
+ # module: tool-bash-disabled
2
+ # source: engine/compositions/source/local/tool-bash-disabled.yml (本地适配)
3
+ # based on: dsh-v0.1.5-rc.2 standard/agent.cordis.yml#tool-bash
4
+ # commit: fb2c4b9e698e30edb738bca4cf0618587db7d203
5
+ # 声明本模块的预设改用持久 bash 或 Windows Git Bash,因此本行保持显式禁用,不属于原样官方模块。
6
+
7
+ - id: tool-bash-disabled
8
+ name: '@deepseek-ai/dsh-tool-bash'
9
+ disabled: true
@@ -2,6 +2,14 @@
2
2
  # source: 本地新增(自定义工具引擎:preset.yml customTools 段 → 渲染 custom-tools/ → 运行时注册)
3
3
  # 工具定义在预设目录 custom-tools/*.yml;执行器 shell/http/delegate/fs/ask-user。
4
4
  # requireApproval 数组可列出需 approval 门的执行器(默认空 = 不要求)。
5
+ #
6
+ # 能力提供者边界(T4):本行是**能力提供者**(把预设声明的自定义工具注册进官方
7
+ # registry),**不接入** engine/trigger.mjs。判据:会给模型提供可调用能力
8
+ # (注册工具/域)的 → 能力提供者;干预流程(改提示词、改装配、裁决、追加)的 →
9
+ # 声明式触发器。登记数据在 engine/tool-config-engine.mjs 的 `engineProvider` 导出
10
+ # (provides.kind = 'dynamic':工具名在装配期才由 customTools 段决定),与
11
+ # `engineTriggers`(声明式触发器)互斥;守卫见 test/engine/provider-boundary.test.mjs。
12
+ # 模块内 approvalGate 与 withinCwd 是安全边界,改装配方式时不得放宽。
5
13
 
6
14
  - id: tool-config-engine
7
15
  name: ./engine/tool-config-engine.mjs
@@ -0,0 +1,15 @@
1
+ # module: tool-git-bash
2
+ # source: engine/compositions/source/local/tool-git-bash.yml (本地附加,上游 dsh-anchored-standard 移植)
3
+ # Windows Git Bash 适配;与 tool-bash-disabled 同时声明时,普通 tool-bash 保持关闭。
4
+ # config.enabled 是本行的能力开关(引擎未声明 = 关闭):本模块此前没有开关,靠「行在组合里」
5
+ # 即启用,故这里补显式 true 保持既有装配结果不变。
6
+ # 下面的 disabled 只是**平台条件**(非 Windows 不装配),不是能力开关;disabled: 只用于平台
7
+ # 条件、树内子项与命名禁用变体(见 tool-bash-disabled.yml),能力启停一律走 config.enabled。
8
+
9
+ - id: tool-git-bash
10
+ name: ./engine/tool-git-bash.mjs
11
+ disabled: !!js process.platform !== 'win32'
12
+ config:
13
+ enabled: true
14
+ timeoutMs: 120000
15
+ maxOutputBytes: 64000
@@ -0,0 +1,5 @@
1
+ # module: world-book-tools
2
+ # source: engine/compositions/source/local/world-book-tools.yml (本地附加,非官方模块)
3
+
4
+ - id: world-book-tools
5
+ name: ./engine/world-book-tools.mjs
@@ -0,0 +1,83 @@
1
+ /**
2
+ * condition — 声明式条件判定的共享实现(pre-step / tool-pipeline / 事件层共用)。
3
+ *
4
+ * 匹配语义来自 anchor-match.mjs:键集合由 schema.mjs 在挂载期归一化并预编译为
5
+ * `config.matchScan`(非法 logic / 空键集合 / 非法正则在挂载期 fail loud)。
6
+ * 本模块只负责「按 subject 取文本」与「是否命中」两件事。
7
+ *
8
+ * 语义约定:
9
+ * - 未声明 match 的配置是**无条件**的(与引入条件判定前逐字一致);
10
+ * - 取不到匹配文本(字段缺失、类型不符、序列化失败)一律按空串处理,即不命中;
11
+ * - 判定异常不抛出:门配错不应该阻断正常链路。
12
+ */
13
+
14
+ import { extractText, sessionEvents } from './shared.mjs'
15
+
16
+ /** subject → 载荷字段名。改这里等于改所有层的匹配对象。 */
17
+ const SUBJECT_FIELDS = {
18
+ toolArgs: 'argsText',
19
+ toolResult: 'resultText',
20
+ userMessage: 'userText',
21
+ assistantText: 'assistantText',
22
+ subagentInfo: 'subagentText',
23
+ }
24
+
25
+ /** 按 subject 取参与匹配的文本;取不到一律空串(不命中,不抛错)。 */
26
+ export function subjectTextOf(subject, payload) {
27
+ if (payload === undefined || payload === null) return ''
28
+ const field = SUBJECT_FIELDS[subject]
29
+ return field !== undefined && typeof payload[field] === 'string' ? payload[field] : ''
30
+ }
31
+
32
+ /**
33
+ * 条件判定:未声明 match 恒真。
34
+ * 消费 schema 预编译的 `config.matchScan`;外部手工构造的 config 没有该函数时按无条件处理。
35
+ */
36
+ export function conditionHit(config, payload) {
37
+ if (config?.match === undefined) return true
38
+ const scan = config.matchScan
39
+ if (typeof scan !== 'function') return true
40
+ try {
41
+ return scan(subjectTextOf(config.subject, payload)).active === true
42
+ } catch {
43
+ return true
44
+ }
45
+ }
46
+
47
+ /** 工具参数的可匹配文本:对象按 JSON 序列化,字符串原样;序列化失败按空串。 */
48
+ export function toolArgsText(args) {
49
+ if (typeof args === 'string') return args
50
+ try {
51
+ return JSON.stringify(args ?? {})
52
+ } catch {
53
+ return ''
54
+ }
55
+ }
56
+
57
+ /** pre-step 的缺省匹配对象:本批用户消息的文本。 */
58
+ export function userMessagesText(messages) {
59
+ if (!Array.isArray(messages)) return ''
60
+ return messages
61
+ .filter((message) => message?.role === 'user')
62
+ .map((message) => extractText(message))
63
+ .filter((text) => text.length > 0)
64
+ .join('\n')
65
+ }
66
+
67
+ /** 最后一条 assistant 消息的文本(turn-stop 的缺省匹配对象)。 */
68
+ export function lastAssistantText(session) {
69
+ const events = sessionEvents(session)
70
+ for (let index = events.length - 1; index >= 0; index -= 1) {
71
+ if (events[index]?.type === 'assistant/message') return extractText(events[index].data)
72
+ }
73
+ return ''
74
+ }
75
+
76
+ /** 子代理事件的匹配文本:事件载荷序列化,取不到即空串。 */
77
+ export function subagentTextOf(info) {
78
+ try {
79
+ return JSON.stringify(info ?? {})
80
+ } catch {
81
+ return ''
82
+ }
83
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * declared-triggers — 声明式触发器的运行时(B7)。
3
+ *
4
+ * 链路:`preset.yml` 顶层 `triggers` 段 →(`writePreset` 保存期校验 + 物化)→ 预设根
5
+ * `triggers.yml` → 本模块读入、编译、注册。
6
+ *
7
+ * ## 声明由预设提供,引擎不带默认(2026-09-22 拍板)
8
+ *
9
+ * 所以 `triggers.yml` 缺失 = **没有声明**,不是错误:不注册任何触发器,也不让预设启动失败
10
+ * ——与 `subagent-tool-policy` 的 ENOENT 降级同一纪律。文件在但内容非法才是真错误:
11
+ * fail loud(且保存期就会先被 `engine/trigger-spec.mjs` 拒一次,这里是第二道)。
12
+ *
13
+ * ## 为什么 `apply` 是 async
14
+ *
15
+ * `preset` 原语要在**挂载期一次**解析官方模块导出(判定期零 IO,见 `predicates.mjs` 的
16
+ * 三条硬约束),而那是动态 import。async `apply` 有官方先例(`dsh-api-remotes`、
17
+ * `dsh-client-connection`),本仓库此前没有——这是第一处。
18
+ */
19
+ import { readFileSync } from 'node:fs'
20
+ import { isAbsolute } from 'node:path'
21
+ import { fileURLToPath, pathToFileURL } from 'node:url'
22
+ import { parse as parseYaml } from './vendor/yaml/index.js'
23
+ import { defineConfig, passthrough } from './fields.mjs'
24
+ import { createWarnOnce, keepDisposer } from './shared.mjs'
25
+ import { compileDeclarations, mountDeclarations } from './trigger-spec.mjs'
26
+ import { loadStandingMountFor } from './predicates.mjs'
27
+
28
+ /** Cordis plugin name used by loader diagnostics. */
29
+ export const name = 'declared-triggers'
30
+
31
+ /** 只经 `ctx.on`(动作注册)与 agent scope 的 tools 工作,无宿主服务依赖。 */
32
+ export const inject = []
33
+
34
+ export const configContract = defineConfig({
35
+ triggersFile: passthrough((value) => (typeof value === 'string' && value.length > 0 ? value : '../triggers.yml')),
36
+ strategyDir: passthrough((value) => (typeof value === 'string' && value.length > 0 ? value : undefined)),
37
+ presetRoot: passthrough((value) => (typeof value === 'string' && value.length > 0 ? value : undefined)),
38
+ })
39
+
40
+ /**
41
+ * 插件装配由注册层传入声明文件的绝对 file URL;引擎实现始终来自已安装插件包。
42
+ * 独立使用时才按本模块 URL 解析相对值,缺省路径不代表任何用户预设目录。
43
+ *
44
+ * 绝对路径必须走 `isAbsolute` 分支:`new URL(绝对路径, base)` 只在 POSIX 形态下忽略 base,
45
+ * Windows 盘符会被当成 URL scheme 并抛 `ERR_INVALID_URL_SCHEME`。而「测试/嵌入可显式
46
+ * 指定绝对路径」是本模块的契约(`loadStandingMountFor(entry)` 有同一约定)。
47
+ */
48
+ function resolveTriggersFile(config) {
49
+ const raw = typeof config?.triggersFile === 'string' && config.triggersFile.length > 0
50
+ ? config.triggersFile
51
+ : '../triggers.yml'
52
+ if (isAbsolute(raw)) return raw
53
+ return fileURLToPath(new URL(raw, import.meta.url))
54
+ }
55
+
56
+ /** 读声明;文件缺失返回 `undefined`(= 没有声明,交由调用方静默返回)。 */
57
+ function readTriggerSpecs(file) {
58
+ let raw
59
+ try {
60
+ raw = readFileSync(file, 'utf8')
61
+ } catch (error) {
62
+ if (error?.code === 'ENOENT') return undefined
63
+ throw error
64
+ }
65
+ const parsed = parseYaml(raw, { logLevel: 'silent' })
66
+ if (!Array.isArray(parsed)) {
67
+ throw new TypeError(`${name}: triggers.yml must be a YAML array of trigger declarations`)
68
+ }
69
+ return parsed
70
+ }
71
+
72
+ export async function apply(ctx, config) {
73
+ const source = configContract.parse(config, name)
74
+ const file = resolveTriggersFile(source)
75
+ const specs = readTriggerSpecs(file)
76
+ if (specs === undefined || specs.length === 0) return
77
+ // 数据路径相对实际声明文件;允许根由注册层提供,不从包内引擎位置猜测用户目录。
78
+ const templateBaseUrl = pathToFileURL(file)
79
+ const templatePresetRoot = source.presetRoot === undefined
80
+ ? new URL('./', templateBaseUrl)
81
+ : isAbsolute(source.presetRoot) ? pathToFileURL(source.presetRoot.replace(/[\\/]?$/, '/'))
82
+ : new URL(source.presetRoot.replace(/\/?$/, '/'), templateBaseUrl)
83
+ const strategyDir = source.strategyDir === undefined ? undefined : (isAbsolute(source.strategyDir)
84
+ ? pathToFileURL(source.strategyDir).href
85
+ : new URL(source.strategyDir, templateBaseUrl).href)
86
+ const promptConfigOptions = { templateBaseUrl, templatePresetRoot, strategyDir }
87
+ // `preset` 原语需要官方模块导出(判定期零 IO,故在这里一次解析);其余原语用不到它。
88
+ const standingMountFor = await loadStandingMountFor()
89
+ // 声明非法在这里 fail loud——保存期已校验过一次,这里再炸说明文件被绕过保存手改了。
90
+ const compiled = compileDeclarations(specs, { ctx, standingMountFor, promptConfigOptions })
91
+ const dispose = mountDeclarations(ctx, compiled, { plugin: name, warnOnce: createWarnOnce(ctx, name) })
92
+ keepDisposer(ctx, dispose, `${name}: declarations`)
93
+ }