dsh-plugin-prompt-tool 0.8.1 → 2.0.0

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 (139) hide show
  1. package/README.md +84 -67
  2. package/engine/actions/append-context.mjs +49 -0
  3. package/engine/actions/assembly.mjs +150 -0
  4. package/engine/actions/catalog.mjs +92 -0
  5. package/engine/actions/content.mjs +205 -0
  6. package/engine/actions/decision.mjs +54 -0
  7. package/engine/actions/examples.mjs +11 -0
  8. package/engine/actions/guard.mjs +80 -0
  9. package/engine/actions/inbox-prepend.mjs +37 -0
  10. package/engine/actions/index.mjs +100 -0
  11. package/engine/actions/inject-text.mjs +22 -0
  12. package/engine/actions/pre-step-filter.mjs +55 -0
  13. package/engine/actions/registration.mjs +168 -0
  14. package/engine/actions/request-params.mjs +32 -0
  15. package/engine/actions/sdk-strip.mjs +30 -0
  16. package/engine/actions/shared.mjs +71 -0
  17. package/engine/actions.mjs +2 -931
  18. package/engine/branch.mjs +44 -0
  19. package/engine/character-tools.mjs +3 -6
  20. package/engine/compaction-epoch.mjs +31 -13
  21. package/engine/compositions/library/agent-instructions.yml +1 -1
  22. package/engine/compositions/library/command-goal.yml +1 -1
  23. package/engine/compositions/library/compaction.yml +1 -1
  24. package/engine/compositions/library/delegation-ptc.yml +1 -1
  25. package/engine/compositions/library/delegation.yml +1 -1
  26. package/engine/compositions/library/persistent-shell.yml +1 -1
  27. package/engine/compositions/library/planning.yml +1 -1
  28. package/engine/compositions/library/skill-filesystem-cordis.yml +1 -1
  29. package/engine/compositions/library/skill-filesystem.yml +1 -1
  30. package/engine/compositions/library/tool-ask-user.yml +1 -1
  31. package/engine/compositions/library/tool-bash.yml +1 -1
  32. package/engine/compositions/library/tool-cordis.yml +1 -1
  33. package/engine/compositions/library/tool-fs-search.yml +1 -1
  34. package/engine/compositions/library/tool-fs.yml +1 -1
  35. package/engine/compositions/library/tool-goal.yml +1 -1
  36. package/engine/compositions/library/tool-jobs.yml +1 -1
  37. package/engine/compositions/library/tool-plugin-manager-disabled.yml +1 -1
  38. package/engine/compositions/library/tool-plugin-manager.yml +1 -1
  39. package/engine/compositions/library/tool-present.yml +1 -1
  40. package/engine/compositions/library/tool-presentation.yml +1 -1
  41. package/engine/compositions/library/tool-pwsh.yml +1 -1
  42. package/engine/compositions/library/tool-skill.yml +1 -1
  43. package/engine/compositions/library/tool-todo.yml +1 -1
  44. package/engine/compositions/library/tool-web.yml +1 -1
  45. package/engine/compositions/source/local/dev-tool-search.yml +11 -0
  46. package/engine/compositions/source/local/instruction-hint.yml +22 -1
  47. package/engine/compositions/source/local/rule-engine.yml +6 -0
  48. package/engine/condition.mjs +16 -3
  49. package/engine/conditions/anchor.mjs +32 -0
  50. package/engine/conditions/availability.mjs +47 -0
  51. package/engine/conditions/composite.mjs +83 -0
  52. package/engine/conditions/count.mjs +140 -0
  53. package/engine/conditions/evaluation.mjs +41 -0
  54. package/engine/conditions/examples.mjs +11 -0
  55. package/engine/conditions/index.mjs +85 -0
  56. package/engine/conditions/names.mjs +21 -0
  57. package/engine/conditions/phase.mjs +54 -0
  58. package/engine/conditions/preset.mjs +94 -0
  59. package/engine/conditions/scope.mjs +18 -0
  60. package/engine/conditions/session.mjs +22 -0
  61. package/engine/conditions/source.mjs +63 -0
  62. package/engine/conditions/subject.mjs +121 -0
  63. package/engine/conditions/text.mjs +44 -0
  64. package/engine/conditions/values.mjs +32 -0
  65. package/engine/dev-tool-search.mjs +213 -0
  66. package/engine/executor.mjs +93 -31
  67. package/engine/fillers.mjs +23 -16
  68. package/engine/instruction-hint.mjs +39 -23
  69. package/engine/layers.mjs +171 -77
  70. package/engine/order.mjs +20 -0
  71. package/engine/predicates.mjs +2 -753
  72. package/engine/rule-engine.mjs +40 -0
  73. package/engine/rule-runtime.mjs +110 -0
  74. package/engine/rule-spec.mjs +187 -0
  75. package/engine/schema.mjs +32 -11
  76. package/engine/session-var-tools.mjs +3 -6
  77. package/engine/shared.mjs +1 -1
  78. package/engine/st-render.mjs +8 -4
  79. package/engine/strategies.mjs +2 -235
  80. package/engine/subagent-tool-policy-core.mjs +7 -7
  81. package/engine/subagent-tool-policy.mjs +45 -20
  82. package/engine/tool-config-engine.mjs +53 -32
  83. package/engine/trigger-editor-meta.mjs +2 -21
  84. package/engine/trigger-spec.mjs +49 -133
  85. package/engine/world-book-tools.mjs +3 -6
  86. package/lib/client.js +10444 -10886
  87. package/lib/client.js.map +1 -1
  88. package/lib/index.d.mts +265 -361
  89. package/lib/index.mjs +1559 -2026
  90. package/lib/migrate-rules.d.mts +1 -0
  91. package/lib/migrate-rules.mjs +39 -0
  92. package/lib/module-package-CHPFweqK.mjs +2 -0
  93. package/lib/module-package-Cnd1_mwx.mjs +2872 -0
  94. package/lib/{paths-CY5psBqE.d.mts → paths-CyP0IkaM.d.mts} +388 -231
  95. package/lib/preset-transfer.d.mts +2 -2
  96. package/lib/preset-transfer.mjs +3 -2
  97. package/lib/{preset-package-BnJqrU4R.mjs → rules-migration-DJ6vASB5.mjs} +13825 -15283
  98. package/modules/ponytail/module.yml +406 -0
  99. package/modules/skill-surface/module.yml +74 -0
  100. package/modules/tool-surface/module.yml +67 -0
  101. package/package.json +50 -80
  102. package/templates/10-pre-step.yml +26 -22
  103. package/templates/14-first-turn-anchor.yml +25 -21
  104. package/templates/15-guide-auto.yml +34 -19
  105. package/templates/16-custom-fallback.yml +27 -15
  106. package/templates/18-placeholder-env-facts.yml +23 -14
  107. package/templates/20-system-section.yml +20 -11
  108. package/templates/30-runtime-context.yml +13 -7
  109. package/templates/40-agent-request.yml +11 -8
  110. package/templates/50-llm-stream.yml +14 -6
  111. package/templates/60-tool-pipeline.yml +15 -9
  112. package/templates/65-turn-stop.yml +19 -12
  113. package/templates/66-subagent-start.yml +12 -7
  114. package/templates/70-subagent-maintenance.yml +35 -29
  115. package/templates/75-subagent-end.yml +10 -5
  116. package/templates/80-tool-surface.yml +66 -0
  117. package/templates/policies/legacy-defaults.yml +34 -0
  118. package/templates/tools/50-delegate-worldbook.yml +1 -1
  119. package/engine/compositions/source/local/prompt-config-engine.yml +0 -7
  120. package/engine/prompt-config-engine.mjs +0 -104
  121. package/preset/pt-cordis/preset.yml +0 -43
  122. package/preset/pt-cordis/skills/cordis-composition-reference/SKILL.md +0 -29
  123. package/preset/pt-cordis/skills/cordis-composition-reference/references/packages.md +0 -501
  124. package/preset/pt-cordis/skills/cordis-plugin-development/SKILL.md +0 -38
  125. package/preset/pt-cordis/skills/cordis-plugin-development/references/host-plugin.md +0 -60
  126. package/preset/pt-cordis/skills/cordis-plugin-development/references/mcp-bundle.md +0 -5
  127. package/preset/pt-cordis/skills/cordis-plugin-development/references/ui-plugin.md +0 -13
  128. package/preset/pt-cordis/skills/cordis-plugin-development/references/verification.md +0 -5
  129. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/client.js +0 -22
  130. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/cordis.patch.yml +0 -3
  131. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/index.js +0 -2
  132. package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/package.json +0 -15
  133. package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/cordis.patch.yml +0 -8
  134. package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/package.json +0 -7
  135. package/preset/pt-cordis/skills/editing-cordis-compositions/SKILL.md +0 -84
  136. package/preset/pt-custom/preset.yml +0 -15
  137. package/preset/pt-minimal/preset.yml +0 -27
  138. package/preset/pt-ptc/preset.yml +0 -45
  139. package/preset/pt-standard/preset.yml +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-prompt-tool",
3
- "version": "0.8.1",
3
+ "version": "2.0.0",
4
4
  "description": "DSH 插件:提示词工具,规范模型的思维链与回答内容,提供 Web UI 编辑 preset.md 与 AGENTS.md,并按 skills 目录注册可开关技能。",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,6 +10,9 @@
10
10
  "type": "module",
11
11
  "main": "lib/index.mjs",
12
12
  "types": "lib/index.d.mts",
13
+ "bin": {
14
+ "prompt-tool-migrate-rules": "lib/migrate-rules.mjs"
15
+ },
13
16
  "exports": {
14
17
  ".": {
15
18
  "types": "./lib/index.d.mts",
@@ -43,103 +46,69 @@
43
46
  }
44
47
  },
45
48
  "peerDependencies": {
46
- "@deepseek-ai/cordis": "^4.0.3",
47
- "@deepseek-ai/dsh-agent": "^0.1.7-alpha.1",
48
- "@deepseek-ai/dsh-agent-preset-registry": "^0.1.7-alpha.1",
49
- "@deepseek-ai/dsh-api-remotes": "^0.1.7-alpha.1",
50
- "@deepseek-ai/dsh-api-session-controller": "^0.1.7-alpha.1",
51
- "@deepseek-ai/dsh-client-connection": "^0.1.7-alpha.1",
52
- "@deepseek-ai/dsh-client-locale": "^0.1.7-alpha.1",
53
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-alpha.1",
54
- "@deepseek-ai/dsh-client-ui-layout": "^0.1.7-alpha.1",
55
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.7-alpha.1",
56
- "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.7-alpha.1",
57
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-alpha.1",
58
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-alpha.1",
59
- "@deepseek-ai/dsh-client-ui-session": "^0.1.7-alpha.1",
60
- "@deepseek-ai/dsh-client-ui-workspace": "^0.1.7-alpha.1",
61
- "@deepseek-ai/dsh-commands": "^0.1.7-alpha.1",
62
- "@deepseek-ai/dsh-fs": "^0.1.7-alpha.1",
63
- "@deepseek-ai/dsh-host-webserver": "^0.1.7-alpha.1",
64
- "@deepseek-ai/dsh-scope": "^0.1.7-alpha.1",
65
- "@deepseek-ai/dsh-settings": "^0.1.7-alpha.1",
66
- "@deepseek-ai/dsh-skill": "^0.1.7-alpha.1",
67
- "@deepseek-ai/dsh-skill-filesystem": "^0.1.7-alpha.1",
68
- "@deepseek-ai/dsh-subagent": "^0.1.7-alpha.1",
69
- "@deepseek-ai/dsh-system-prompt": "^0.1.7-alpha.1",
70
- "@deepseek-ai/dsh-tools": "^0.1.7-alpha.1",
71
- "@deepseek-ai/schemastery": "^3.18.3",
49
+ "@deepseek-ai/cordis": "^4.0.4",
50
+ "@deepseek-ai/dsh-agent": ">=0.2.0-rc.1",
51
+ "@deepseek-ai/dsh-agent-preset-registry": ">=0.2.0-rc.1",
52
+ "@deepseek-ai/dsh-commands": ">=0.2.0-rc.1",
53
+ "@deepseek-ai/dsh-fs": ">=0.2.0-rc.1",
54
+ "@deepseek-ai/dsh-host-webserver": ">=0.2.0-rc.1",
55
+ "@deepseek-ai/dsh-scope": ">=0.2.0-rc.1",
56
+ "@deepseek-ai/dsh-settings": ">=0.2.0-rc.1",
57
+ "@deepseek-ai/dsh-skill": ">=0.2.0-rc.1",
58
+ "@deepseek-ai/dsh-skill-filesystem": ">=0.2.0-rc.1",
59
+ "@deepseek-ai/dsh-subagent": ">=0.2.0-rc.1",
60
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.1",
61
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.1",
72
62
  "react": "^18.2.0"
73
63
  },
74
64
  "devDependencies": {
75
- "@deepseek-ai/cordis": "4.0.3",
76
- "@deepseek-ai/dsh-agent": "0.1.7-alpha.1",
77
- "@deepseek-ai/dsh-agent-preset-registry": "0.1.7-alpha.1",
78
- "@deepseek-ai/dsh-api-remotes": "0.1.7-alpha.1",
79
- "@deepseek-ai/dsh-api-session-controller": "0.1.7-alpha.1",
80
- "@deepseek-ai/dsh-client-connection": "0.1.7-alpha.1",
81
- "@deepseek-ai/dsh-client-locale": "0.1.7-alpha.1",
82
- "@deepseek-ai/dsh-client-store": "0.1.7-alpha.1",
83
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-alpha.1",
84
- "@deepseek-ai/dsh-client-ui-layout": "0.1.7-alpha.1",
85
- "@deepseek-ai/dsh-client-ui-settings": "0.1.7-alpha.1",
86
- "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.7-alpha.1",
87
- "@deepseek-ai/dsh-client-ui-renderer": "0.1.7-alpha.1",
88
- "@deepseek-ai/dsh-client-ui-session": "0.1.7-alpha.1",
89
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.7-alpha.1",
90
- "@deepseek-ai/dsh-client-ui-slots": "0.1.7-alpha.1",
91
- "@deepseek-ai/dsh-commands": "0.1.7-alpha.1",
92
- "@deepseek-ai/dsh-fs": "0.1.7-alpha.1",
93
- "@deepseek-ai/dsh-host-webserver": "0.1.7-alpha.1",
94
- "@deepseek-ai/dsh-llm": "0.1.7-alpha.1",
95
- "@deepseek-ai/dsh-package-manifest": "0.1.7-alpha.1",
96
- "@deepseek-ai/dsh-scope": "0.1.7-alpha.1",
97
- "@deepseek-ai/dsh-session": "0.1.7-alpha.1",
98
- "@deepseek-ai/dsh-settings": "0.1.7-alpha.1",
99
- "@deepseek-ai/dsh-skill": "0.1.7-alpha.1",
100
- "@deepseek-ai/dsh-skill-filesystem": "0.1.7-alpha.1",
101
- "@deepseek-ai/dsh-subagent": "0.1.7-alpha.1",
102
- "@deepseek-ai/dsh-system-prompt": "0.1.7-alpha.1",
103
- "@deepseek-ai/dsh-tool-subagent": "0.1.7-alpha.1",
104
- "@deepseek-ai/dsh-tools": "0.1.7-alpha.1",
105
- "@shikijs/langs": "^4.3.1",
65
+ "@deepseek-ai/cordis": "4.0.4",
66
+ "@deepseek-ai/dsh-agent": ">=0.2.0-rc.1",
67
+ "@deepseek-ai/dsh-agent-preset-registry": ">=0.2.0-rc.1",
68
+ "@deepseek-ai/dsh-api-remotes": ">=0.2.0-rc.1",
69
+ "@deepseek-ai/dsh-api-session-controller": ">=0.2.0-rc.1",
70
+ "@deepseek-ai/dsh-client-connection": ">=0.2.0-rc.1",
71
+ "@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.1",
72
+ "@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1",
73
+ "@deepseek-ai/dsh-client-ui-layout": ">=0.2.0-rc.1",
74
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.1",
75
+ "@deepseek-ai/dsh-client-ui-settings-plugins": ">=0.2.0-rc.1",
76
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1",
77
+ "@deepseek-ai/dsh-client-ui-session": ">=0.2.0-rc.1",
78
+ "@deepseek-ai/dsh-client-ui-workspace": ">=0.2.0-rc.1",
79
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1",
80
+ "@deepseek-ai/dsh-commands": ">=0.2.0-rc.1",
81
+ "@deepseek-ai/dsh-fs": ">=0.2.0-rc.1",
82
+ "@deepseek-ai/dsh-host-webserver": ">=0.2.0-rc.1",
83
+ "@deepseek-ai/dsh-llm": ">=0.2.0-rc.1",
84
+ "@deepseek-ai/dsh-package-manifest": ">=0.2.0-rc.1",
85
+ "@deepseek-ai/dsh-scope": ">=0.2.0-rc.1",
86
+ "@deepseek-ai/dsh-session": ">=0.2.0-rc.1",
87
+ "@deepseek-ai/dsh-settings": ">=0.2.0-rc.1",
88
+ "@deepseek-ai/dsh-skill": ">=0.2.0-rc.1",
89
+ "@deepseek-ai/dsh-skill-filesystem": ">=0.2.0-rc.1",
90
+ "@deepseek-ai/dsh-subagent": ">=0.2.0-rc.1",
91
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.1",
92
+ "@deepseek-ai/dsh-tool-subagent": ">=0.2.0-rc.1",
93
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.1",
106
94
  "@types/node": "^26.2.0",
107
95
  "@types/react": "~18.3.1",
108
96
  "@types/react-dom": "^18.3.0",
109
- "anser": "^2.3.5",
110
97
  "clsx": "^2.1.1",
111
- "diff": "^9.0.0",
112
- "immer": "^10.1.1",
113
- "katex": "^0.16.47",
114
98
  "lightningcss": "^1.32.0",
115
- "mdast-util-from-markdown": "^2.0.3",
116
- "mdast-util-gfm": "^3.1.0",
117
- "mdast-util-math": "^3.0.0",
118
- "micromark-core-commonmark": "^2.0.3",
119
- "micromark-extension-gfm": "^3.0.0",
120
- "micromark-extension-math": "^3.1.0",
121
- "micromark-factory-space": "^2.0.1",
122
- "micromark-util-character": "^2.1.1",
123
- "micromark-util-classify-character": "^2.0.1",
124
- "micromark-util-sanitize-uri": "^2.0.1",
125
- "micromark-util-symbol": "^2.0.1",
126
- "micromark-util-types": "^2.0.1",
127
99
  "oxlint": "^1.78.0",
128
100
  "react": "^18.3.1",
129
101
  "react-dom": "^18.3.1",
130
102
  "semver": "7.8.5",
131
- "shiki": "^4.3.1",
132
- "simple-icons": "^16.31.0",
133
103
  "tsdown": "^0.22.2",
134
- "typescript": "^5.9.2",
135
- "zustand": "~4.4.7"
104
+ "typescript": "^5.9.2"
136
105
  },
137
106
  "files": [
138
107
  "lib",
139
108
  "engine",
140
109
  "cordis.patch.yml",
141
110
  "LICENSE",
142
- "preset",
111
+ "modules",
143
112
  "templates",
144
113
  "README.md"
145
114
  ],
@@ -150,13 +119,14 @@
150
119
  "lint": "oxlint src test tsdown.config.ts",
151
120
  "test": "node scripts/run-tests.mjs",
152
121
  "sync:yaml": "node scripts/sync-yaml-vendor.mjs",
153
- "rebuild:composition": "node scripts/rebuild-composition.mjs",
154
122
  "rebuild:preset-template": "node scripts/rebuild-preset-template.mjs",
155
123
  "rematerialize:presets": "node scripts/rematerialize-presets.mjs",
124
+ "migrate:rules": "node lib/migrate-rules.mjs",
156
125
  "repair:profile": "node scripts/repair-profile.mjs",
157
126
  "verify:host": "node scripts/verify-host-contracts.mjs"
158
127
  },
159
128
  "dependencies": {
129
+ "@deepseek-ai/schemastery": "^3.18.4",
160
130
  "@zip.js/zip.js": "2.15.0",
161
131
  "yaml": "^2.9.0"
162
132
  }
@@ -2,30 +2,34 @@
2
2
  # 本模板覆盖三种字段变体,插入后改字段即可:
3
3
  # - mergeMode=merged + texts 多块 → 同 position 配置拼接为一条消息(原 11-merged-a)
4
4
  # - configKind=anchor → 固定锚点序,按模块文件相对顺序排所有 ordered 之前(原 13-anchor)
5
- # 接入:复制本文件到 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
6
- # 保存前可 POST /api/prompt-tool/settings/configs-validate 做权威校验。
5
+ # 接入:复制本文件到 模块规则模板目录,或把对象写入 module.yml.rules 数组。
6
+ # 保存前可 POST /api/prompt-tool/settings/rules 做权威校验。
7
7
  # audience 为配置项(缺省=公用;main=仅主会话;subagent=仅子代理),模板不锁定。
8
8
  id: example-pre-step
9
9
  name: 示例:消息批注入
10
10
  enabled: false
11
11
  layer: pre-step
12
- strategy: static
13
- position: after-user
14
- dedupe: session
15
- promotion: none
16
- modelScope: all
17
- configKind: ordered
18
- order: 0
19
- role: user
20
- mergeMode: separate
21
- sourceKind: ''
22
- form: notice
23
- summary: ''
24
- identity:
25
- field: plugin
26
- value: example-pre-step
27
- text: |-
28
-
29
- variables:
30
- WHO: ''
31
- params: {}
12
+ then:
13
+ - id: inject
14
+ kind: inject-text
15
+ config:
16
+ id: example-pre-step
17
+ layer: pre-step
18
+ strategy: static
19
+ position: after-user
20
+ dedupe: session
21
+ configKind: ordered
22
+ order: 0
23
+ role: user
24
+ mergeMode: separate
25
+ sourceKind: ''
26
+ form: notice
27
+ summary: ''
28
+ identity:
29
+ field: plugin
30
+ value: example-pre-step
31
+ text: |
32
+
33
+ variables:
34
+ WHO: ''
35
+ params: {}
@@ -1,27 +1,31 @@
1
1
  # 模板:首句锚点(strategy=first-turn-anchor)
2
2
  # 首条真实用户消息后按任务类型(build / inspect / deep)注入锚句,每会话一次。
3
- # 纯净模板:参数全部留空,由用户自定义;默认锚句与正则见引擎内置策略默认值。
4
- # 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
3
+ # 纯净模板:参数全部留空,由用户自定义;锚句与分类正则由模板或用户配置提供,引擎不提供默认正文。
4
+ # 提示:把本文件放入 模块规则模板目录,或把对象写入 module.yml.rules 数组。
5
5
  id: example-first-turn-anchor
6
6
  name: 示例:首句锚点
7
7
  enabled: false
8
8
  layer: pre-step
9
- strategy: first-turn-anchor
10
- position: after-user
11
- dedupe: session
12
- promotion: none
13
- modelScope: all
14
- configKind: ordered
15
- order: 0
16
- role: user
17
- mergeMode: separate
18
- sourceKind: ''
19
- form: notice
20
- params:
21
- useCustom: false
22
- text: "" # 自定义锚文本(useCustom=true 时固定注入)
23
- buildPattern: "" # 构建任务正则;留空 = 该分类不生效
24
- complexPattern: "" # 复杂任务正则;留空 = 该分类不生效
25
- firstTurnBuild: "" # 构建任务锚句(留空 = 引擎内置默认锚句)
26
- firstTurnInspect: "" # 排查任务锚句(留空 = 引擎内置默认锚句)
27
- firstTurnDeep: "" # 复杂设计锚句(留空 = 引擎内置默认锚句)
9
+ then:
10
+ - id: inject
11
+ kind: inject-text
12
+ config:
13
+ id: example-first-turn-anchor
14
+ layer: pre-step
15
+ strategy: first-turn-anchor
16
+ position: after-user
17
+ dedupe: session
18
+ configKind: ordered
19
+ order: 0
20
+ role: user
21
+ mergeMode: separate
22
+ sourceKind: ''
23
+ form: notice
24
+ params:
25
+ useCustom: false
26
+ text: "" # 自定义锚文本(useCustom=true 时固定注入)
27
+ buildPattern: "" # 构建任务正则;留空 = 该分类不生效
28
+ complexPattern: "" # 复杂任务正则;留空 = 该分类不生效
29
+ firstTurnBuild: "" # 构建任务锚句(留空 = 不注入该类别锚句)
30
+ firstTurnInspect: "" # 排查任务锚句(留空 = 不注入该类别锚句)
31
+ firstTurnDeep: "" # 复杂设计锚句(留空 = 不注入该类别锚句)
@@ -1,25 +1,40 @@
1
+ # 复杂任务判定 fallback 复用锚定卡的 complexPattern;长度判定仅使用显式 complexMinChars;未设置时不按长度分类
2
+ # 简单任务自动引导句(留空 = 不注入该类别引导)
3
+ # 复杂任务自动引导句(留空 = 不注入该类别引导)
4
+
1
5
  # 模板:每轮引导(strategy=guide-auto)
2
6
  # 晋升后每轮用户消息后按复杂度注入弱/深度引导;modelScope=flash 表示仅 flash 模型会话注入。
3
- # 纯净模板:参数全部留空,由用户自定义;默认引导句文本见引擎内置策略默认值。
4
- # 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
7
+ # 纯净模板:参数全部留空,由用户自定义;引导句由模板或用户配置提供,留空不注入。
8
+ # 提示:把本文件放入 模块规则模板目录,或把对象写入 module.yml.rules 数组。
5
9
  id: example-guide-auto
6
10
  name: 示例:每轮引导
7
11
  enabled: false
8
12
  layer: pre-step
9
- strategy: guide-auto
10
- position: after-user
11
- dedupe: batch
12
- promotion: main
13
- modelScope: flash
14
- configKind: ordered
15
- order: 10
16
- role: user
17
- mergeMode: separate
18
- sourceKind: ''
19
- form: notice
20
- params:
21
- useCustom: false
22
- text: ""
23
- # 复杂任务判定 fallback 复用锚定卡的 complexPattern;留空 = 仅按文本长度 120 判定深/弱
24
- guideWeak: "" # 简单任务自动引导句(留空 = 引擎内置默认引导句)
25
- guideDeep: "" # 复杂任务自动引导句(留空 = 引擎内置默认引导句)
13
+ if:
14
+ all:
15
+ - scope:
16
+ modelScope: flash
17
+ - phase:
18
+ promoted: true
19
+ includeSubagents: false
20
+ then:
21
+ - id: inject
22
+ kind: inject-text
23
+ config:
24
+ id: example-guide-auto
25
+ layer: pre-step
26
+ strategy: guide-auto
27
+ position: after-user
28
+ dedupe: batch
29
+ configKind: ordered
30
+ order: 10
31
+ role: user
32
+ mergeMode: separate
33
+ sourceKind: ''
34
+ form: notice
35
+ params:
36
+ useCustom: false
37
+ text: ""
38
+ guideWeak: ""
39
+ guideDeep: ""
40
+ complexMinChars: 120
@@ -2,22 +2,34 @@
2
2
  # 首轮推理命中锚定确认词后注入一次;未命中最多两轮兜底。确认词集合 anchorWords 由
3
3
  # writePreset 从锚句自动派生(firstTurnWord 空时);显式 firstTurnWord 覆盖派生。
4
4
  # 两者都为空 = 不做词确认,只走未命中兜底注入(引擎不内置确认词)。
5
- # 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
5
+ # 提示:把本文件放入 模块规则模板目录,或把对象写入 module.yml.rules 数组。
6
6
  id: example-custom-fallback
7
7
  name: 示例:自定义锚词兜底注入
8
8
  enabled: false
9
9
  layer: pre-step
10
- strategy: custom-fallback
11
- position: before-all
12
- dedupe: session
13
- promotion: main
14
- modelScope: all
15
- configKind: ordered
16
- order: 20
17
- role: user
18
- mergeMode: separate
19
- sourceKind: plugin
20
- form: notice
21
- params:
22
- text: "" # 注入文本(如 preset.md 内容);留空 = 不注入
23
- firstTurnWord: "" # 锚定确认词(显式覆盖;空 = 自动派生)
10
+ if:
11
+ all:
12
+ - phase:
13
+ promoted: true
14
+ includeSubagents: false
15
+ - anchor:
16
+ keys: []
17
+ fallbackAfter: 1
18
+ then:
19
+ - id: inject
20
+ kind: inject-text
21
+ config:
22
+ id: example-custom-fallback
23
+ layer: pre-step
24
+ strategy: anchor-notice
25
+ position: before-all
26
+ dedupe: session
27
+ configKind: ordered
28
+ order: 20
29
+ role: user
30
+ mergeMode: separate
31
+ sourceKind: plugin
32
+ form: notice
33
+ params:
34
+ text: "" # 注入文本(如 preset.md 内容);留空 = 不注入
35
+ firstTurnWord: "" # 锚定确认词(显式覆盖;空 = 自动派生)
@@ -6,17 +6,26 @@
6
6
  # 可用 text 模板 + {{变量}} 完全自定义。
7
7
  id: example-placeholder
8
8
  layer: pre-step
9
- strategy: placeholder
10
- fill: env-facts
11
- position: after-all
12
- dedupe: session
13
- promotion: include-subagents
14
- text: |-
15
-
16
- params:
17
- envKeys: DSH_HOME,DSH_WORKSPACE # 环境变量白名单(逗号分隔);留空 = 只输出 CWD/WORKSPACE
18
- limit: 20 # skill-catalog:条目数上限
19
- fields: name,description # skill-catalog:输出字段
20
- providers: '' # skill-catalog:提供方过滤
21
- emptyBehavior: skip # skill-catalog:空结果行为
22
- emptyText: 当前没有可用技能。 # skill-catalog:emptyBehavior=text 时的提示;留空 = 不注入
9
+ if:
10
+ phase:
11
+ promoted: true
12
+ includeSubagents: true
13
+ then:
14
+ - id: inject
15
+ kind: inject-text
16
+ config:
17
+ id: example-placeholder
18
+ layer: pre-step
19
+ strategy: placeholder
20
+ fill: env-facts
21
+ position: after-all
22
+ dedupe: session
23
+ text: |
24
+
25
+ params:
26
+ envKeys: DSH_HOME,DSH_WORKSPACE # 环境变量白名单(逗号分隔);留空 = 只输出 CWD/WORKSPACE
27
+ limit: 20 # skill-catalog:条目数上限
28
+ fields: name,description # skill-catalog:输出字段
29
+ providers: '' # skill-catalog:提供方过滤
30
+ emptyBehavior: skip # skill-catalog:空结果行为
31
+ emptyText: 当前没有可用技能。 # skill-catalog:emptyBehavior=text 时的提示;留空 = 不注入
@@ -3,18 +3,27 @@
3
3
  # 人设用法:params.sectionName = deployment:persona-prefix(第一方指导之前)或
4
4
  # deployment:persona-suffix(第一方指导之后)时注册为人设段
5
5
  # (同名 shadow 全局 persona,模块列表显示「人设」徽标;子代理经 scope 链继承)。
6
- # - complete: true 独占整个 system prompt(预设内互斥,UI 自动收敛,手写冲突官方 fail loud)
6
+ # - complete: true 让本段成为唯一的 system prompt 段(身份注入、人设后缀、工具指南等
7
+ # 其余 system 段全部被抑制;工具链、运行时上下文与变量仍保留)。同一模块只能有一个,
8
+ # 且与顶层人设的「独占」互斥:写盘前由 bridge 拒绝(400),装配前另有一道兜底校验,
9
+ # 手改 YAML / 还原备份 / 导入包同样会被挡住。UI 不做自动收敛,需手动关闭其一。
7
10
  # - suppressRuntimeContext: true 抑制动态运行时快照(等价官方 includeRuntimeContext:false)
8
11
  id: example-system-section
9
12
  name: 示例:system 静态段
10
13
  layer: system-section
11
- strategy: static
12
- order: -50
13
- mergeMode: merged
14
- text: |-
15
-
16
- variables: {}
17
- params:
18
- complete: false
19
- suppressRuntimeContext: false
20
- sectionName: ''
14
+ then:
15
+ - id: inject
16
+ kind: inject-text
17
+ config:
18
+ id: example-system-section
19
+ layer: system-section
20
+ strategy: static
21
+ order: -50
22
+ mergeMode: merged
23
+ text: |
24
+
25
+ variables: {}
26
+ params:
27
+ complete: false
28
+ suppressRuntimeContext: false
29
+ sectionName: ''
@@ -4,10 +4,16 @@
4
4
  # 支持 placeholder 的层级)。
5
5
  id: example-runtime-context
6
6
  layer: runtime-context
7
- strategy: static
8
- order: 5
9
- mergeMode: merged
10
- text: |-
11
-
12
- params:
13
- contextName: ''
7
+ then:
8
+ - id: inject
9
+ kind: inject-text
10
+ config:
11
+ id: example-runtime-context
12
+ layer: runtime-context
13
+ strategy: static
14
+ order: 5
15
+ mergeMode: merged
16
+ text: |
17
+
18
+ params:
19
+ contextName: ''
@@ -1,11 +1,14 @@
1
1
  # 模板:agent-request 调用配置修改(LlmCallConfig 浅合并 / 整体替换)
2
2
  id: example-agent-request
3
3
  layer: agent-request
4
- strategy: static
5
- modelScope: flash
6
- order: 0
7
- params:
8
- patch:
9
- maxTokens: 4096
10
- temperature: 0.3
11
- replace: false
4
+ if:
5
+ scope:
6
+ modelScope: flash
7
+ then:
8
+ - id: request
9
+ kind: request-params
10
+ patch:
11
+ maxTokens: 4096
12
+ temperature: 0.3
13
+ replace: false
14
+ modelScope: all
@@ -1,9 +1,17 @@
1
1
  # 模板:llm-stream 模型流包装(pass 透传 / replace 用 text 替代整个流)
2
2
  id: example-llm-stream
3
3
  layer: llm-stream
4
- strategy: static
5
- modelScope: flash
6
- order: 0
7
- text: "" # mode=replace 时替代整个模型流的文本
8
- params:
9
- mode: pass
4
+ if:
5
+ scope:
6
+ modelScope: flash
7
+ then:
8
+ - id: inject
9
+ kind: inject-text
10
+ config:
11
+ id: example-llm-stream
12
+ layer: llm-stream
13
+ strategy: static
14
+ order: 0
15
+ text: "" # mode=replace 时替代整个模型流的文本
16
+ params:
17
+ mode: pass
@@ -1,13 +1,19 @@
1
+ # postAction=replace/block 时使用的文本
2
+
1
3
  # 模板:tool-pipeline 工具行为策略(对已注册工具的 pre/post 改写;
2
4
  # 自定义工具定义见工具管理区块——tool-pipeline 层筛选可见)。
3
5
  id: example-tool-pipeline
4
6
  layer: tool-pipeline
5
- strategy: static
6
- order: 0
7
- modelScope: all
8
- text: "" # postAction=replace/block 时使用的文本
9
- params:
10
- toolNames: bash,run_code
11
- preDecision: allow
12
- denyReason: 该工具被提示词配置禁用
13
- postAction: accept
7
+ then:
8
+ - id: before
9
+ kind: decision
10
+ phase: pre
11
+ decision: allow
12
+ toolNames: bash,run_code
13
+ reason: 该工具被提示词配置禁用
14
+ - id: after
15
+ kind: decision
16
+ phase: post
17
+ action: accept
18
+ toolNames: bash,run_code
19
+ text: ""
@@ -4,15 +4,22 @@
4
4
  id: example-turn-stop
5
5
  name: 未完成时强制续跑
6
6
  layer: turn-stop
7
- strategy: static
8
- order: 0
9
- modelScope: all
10
- text: |-
11
- 上一轮还没有给出完整交付。请继续把当前任务做完:不要停在中途,
12
- 也不要用「接下来我会…」的计划代替实际执行。
13
- match:
14
- keys:
15
- - 接下来我会
16
- - 稍后继续
17
- - 待办如下
18
- params: {}
7
+ if:
8
+ text:
9
+ keys:
10
+ - 接下来我会
11
+ - 稍后继续
12
+ - 待办如下
13
+ subject: assistantText
14
+ then:
15
+ - id: inject
16
+ kind: inject-text
17
+ config:
18
+ id: example-turn-stop
19
+ layer: turn-stop
20
+ strategy: static
21
+ order: 0
22
+ text: |-
23
+ 上一轮还没有给出完整交付。请继续把当前任务做完:不要停在中途,
24
+ 也不要用「接下来我会…」的计划代替实际执行。
25
+ params: {}