dsh-plugin-prompt-tool 0.7.2 → 0.8.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 (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
@@ -51,7 +51,7 @@ export function parseRegexFromString(key) {
51
51
 
52
52
  /** 单键正则编译(逐键匹配:any/all/not 需要精确的命中键数,捕获组会干扰 match 计数)。
53
53
  * useRegex 三态:true=强制正则;false=强制字面;缺省=ST 语义自动检测。 */
54
- function compileSingle(key, { caseSensitive, wholeWords, useRegex }) {
54
+ function compileSingle(key, { caseSensitive, wholeWords, useRegex, stWords }) {
55
55
  const flags = caseSensitive ? '' : 'i'
56
56
  if (useRegex === true) {
57
57
  // ST use_regex=true:键原样作为正则(作者负责合法性)。
@@ -62,6 +62,7 @@ function compileSingle(key, { caseSensitive, wholeWords, useRegex }) {
62
62
  if (auto !== undefined) return auto
63
63
  }
64
64
  if (wholeWords) {
65
+ if (stWords) return new RegExp(key.split(/\s+/).length > 1 ? escapeRegExp(key) : `(?:^|\\W)(${escapeRegExp(key)})(?:$|\\W)`, flags)
65
66
  return new RegExp(`(^|[^\\p{L}\\p{N}])(${escapeRegExp(key)})(?![\\p{L}\\p{N}])`, `${flags}u`)
66
67
  }
67
68
  return new RegExp(escapeRegExp(key), flags)
@@ -85,6 +86,7 @@ function compileKeyList(list, options) {
85
86
  * @param {boolean} [options.useRegex] 三态:true=强制正则 / false=强制字面 / 缺省=自动检测(ST 语义)
86
87
  * @param {'any'|'all'|'not'|'notAny'} [options.logic] 组合逻辑(缺省 any)
87
88
  * @param {'scan'|'prefix'} [options.mode] 匹配模式(缺省 scan)
89
+ * @param {boolean} [options.stWords] ST 整词规则:多词子串、单词 ASCII 边界;仅 ST 导入开启
88
90
  * @returns {{ scan: (text: string) => { primary: number, secondary: number, active: boolean } }}
89
91
  */
90
92
  export function createAnchorMatcher(options = {}) {
@@ -96,9 +98,10 @@ export function createAnchorMatcher(options = {}) {
96
98
  useRegex = undefined,
97
99
  logic = MATCH_LOGIC.ANY,
98
100
  mode = 'scan',
101
+ stWords = false,
99
102
  } = options
100
- const primaryList = compileKeyList(keys, { caseSensitive, wholeWords, useRegex })
101
- const secondaryList = compileKeyList(secondaryKeys, { caseSensitive, wholeWords, useRegex })
103
+ const primaryList = compileKeyList(keys, { caseSensitive, wholeWords, useRegex, stWords })
104
+ const secondaryList = compileKeyList(secondaryKeys, { caseSensitive, wholeWords, useRegex, stWords })
102
105
 
103
106
  const scan = (raw) => {
104
107
  const text = String(raw ?? '')
@@ -0,0 +1,11 @@
1
+ /** 角色卡库工具预设模块。 */
2
+ export const name = "character-tools"
3
+
4
+ export function apply(ctx) {
5
+ const service = ctx.get("pt-character-tools")
6
+ if (service === null || service === undefined || typeof service.mount !== "function") {
7
+ ctx.logger?.warn(name + ": service unavailable; character tools not mounted for this preset")
8
+ return
9
+ }
10
+ ctx.effect(() => service.mount(ctx), name + ": mount")
11
+ }
@@ -33,3 +33,21 @@ export function createTaskClassifier({ buildPattern, complexPattern }) {
33
33
  },
34
34
  }
35
35
  }
36
+
37
+ /**
38
+ * 通用有序任务规则分类器(subagentToolPolicy.taskRules 单一实现)。
39
+ * 规则:order 升序(同 order 按数组顺序)、首个匹配获胜;输入为
40
+ * description + "\n" + prompt;无匹配回落 undefined(调用方用 default)。
41
+ * 规则在保存时已编译(非法 pattern 拒绝整次保存),此处只按顺序 test。
42
+ */
43
+ export function createOrderedTaskClassifier(rules) {
44
+ const ordered = [...(Array.isArray(rules) ? rules : [])]
45
+ .filter((rule) => rule !== null && typeof rule === 'object' && typeof rule.re?.test === 'function')
46
+ .sort((a, b) => (a.order - b.order) || 0)
47
+ return (text) => {
48
+ for (const rule of ordered) {
49
+ if (rule.re.test(String(text ?? ''))) return rule.id
50
+ }
51
+ return undefined
52
+ }
53
+ }
@@ -2,14 +2,14 @@
2
2
  * Epoch-aware promotion tracker shared by the bootstrap and baseline-gate
3
3
  * plugins of the anchored presets.
4
4
  *
5
- * A compaction rewrites the model-visible surface: the pre-compaction
5
+ * A successful compaction rewrites the model-visible surface: the pre-compaction
6
6
  * conversation collapses into one synthetic summary message, and the
7
7
  * workspace-instruction baseline is re-injected from scratch. The first
8
8
  * post-compaction request is therefore a "second first request" — the same
9
9
  * first-token conditions the anchored presets exist to control. Promotion is
10
10
  * epoch-aware: only a durable promotion signal (`tool/call` and/or
11
11
  * `assistant/message`, per the caller's `promoteEvents`) recorded AFTER the
12
- * last `compaction/end` boundary counts as promoted. Before any compaction
12
+ * last successful `compaction/end` boundary counts as promoted. Before any compaction
13
13
  * the boundary is -1, which preserves the original one-shot semantics.
14
14
  *
15
15
  * State is memoized per session id and maintained incrementally through
@@ -21,10 +21,10 @@
21
21
  * to make subagents follow the same bootstrap/anchor phase as top-level
22
22
  * sessions.
23
23
  *
24
- * GATE MODE (liangshen 稳定化扩展, source: xiaobright/dsh-anchored-standard
24
+ * GATE MODE (strict two-phase stabilization extension, source: xiaobright/dsh-anchored-standard
25
25
  * MIT + phase-1 quarantine): `promoteGate: true` gates the promotion on the
26
26
  * first reasoning block classifying minimal-like (`we` present, no `let me`),
27
- * with a `maxPromoteSteps` (default 4) fallback; `promoteAfterFirstResponse:
27
+ * with a `maxPromoteSteps` fallback supplied by the caller's config; `promoteAfterFirstResponse:
28
28
  * true` promotes a tool-less first response once it has responded, and also
29
29
  * releases an anchor-gated session when its first turn ends. Gate mode uses
30
30
  * the durable-event state machine below and ignores `promoteEvents` (fixed
@@ -32,7 +32,9 @@
32
32
  * Non-gate mode keeps the original event-set semantics byte-for-byte.
33
33
  */
34
34
 
35
- /** 首段 reasoning 块分类(liangshen 移植):we 且无 let me = minimal-like。 */
35
+ import { sessionEvents, sessionState } from './shared.mjs'
36
+
37
+ /** 首段 reasoning 块分类(严格门控扩展):we 且无 let me = minimal-like。 */
36
38
  export function classifyReasoning(text) {
37
39
  const trimmed = String(text ?? '').trim()
38
40
  const we = [...trimmed.matchAll(/\bwe\b/gi)].length
@@ -50,19 +52,21 @@ export function hasAnchoredReasoning(content) {
50
52
  return first !== undefined && classifyReasoning(first.text).label === 'minimal-like'
51
53
  }
52
54
 
55
+ /** True only when compaction completed and changed the model-visible surface. */
56
+ export function isSuccessfulCompactionEnd(event) {
57
+ return event?.type === 'compaction/end' && event.data?.error === undefined
58
+ }
59
+
53
60
  /** Build one epoch-aware promotion tracker. */
54
61
  export function createEpochPromotion(promoteEvents, options = {}) {
55
62
  const includeSubagents = options.includeSubagents === true
56
63
  const promoteGate = options.promoteGate === true
57
64
  const promoteAfterFirstResponse = options.promoteAfterFirstResponse === true
58
- const maxPromoteSteps = Number.isSafeInteger(options.maxPromoteSteps) && options.maxPromoteSteps > 0
59
- ? options.maxPromoteSteps
60
- : 4
65
+ // 门控回退步数由调用方配置提供(tool-bootstrap 在开启门控时做必填校验):
66
+ // 引擎不内置默认;未提供时步数兜底不生效,只按 anchored 判定。
67
+ const maxPromoteSteps = options.maxPromoteSteps
61
68
  const promote = new Set(promoteEvents)
62
69
  const gated = promoteGate || promoteAfterFirstResponse
63
- /** sessionId -> entry(boundary/promoted + 门控字段) */
64
- const state = new Map()
65
-
66
70
  const freshEntry = (boundary) => ({
67
71
  boundary,
68
72
  promoted: false,
@@ -73,7 +77,24 @@ export function createEpochPromotion(promoteEvents, options = {}) {
73
77
  steps: 0,
74
78
  })
75
79
 
76
- /** 门控晋升判定(liangshen decidePromotion 移植)。 */
80
+ /**
81
+ * 会话 epoch 条目容器(`sessionState`:统一访问接口,键 / 淘汰 / 复位三项与迁移前逐条相同)。
82
+ *
83
+ * - 键类型:`session.id`。
84
+ * - 淘汰策略:超 `MAX_TRACKED_SESSIONS` 时 `clear()` 全清(`evict` 缺省档),
85
+ * 清空只触发一次冷扫重建,相位由 durable 事件流重建。
86
+ * - 复位:**不声明**——压缩边界不是「删条目」:`applyEvent` 遇成功 `compaction/end`
87
+ * 直接把条目重置为 `freshEntry(seq)` 新边界(见 `scan` / `observe`),条目本身必须留在
88
+ * 容器里。声明 `reset` 只会多注册一条监听并改变语义,故 `ctx` 完全用不到、不传入。
89
+ *
90
+ * 无 `session.id` 的会话不记账(`sessionState` 既有决定,见 `predicates.mjs`):`peek` 恒
91
+ * 未命中 → 每次按该会话自己的 durable 事件流重建。旧实现把这类会话的条目存在共享的
92
+ * `undefined` 键上(跨会话串味、且能把 `observe` 喂进来但不在事件流里的状态钉住),
93
+ * 现在以 durable 事实为准——方向与「状态是快路径、真相在事件流」的纪律一致。
94
+ */
95
+ const state = sessionState(undefined, () => freshEntry(-1))
96
+
97
+ /** 门控晋升判定(严格门控扩展)。 */
77
98
  const decideGate = (entry) => {
78
99
  if (entry.promoted) return true
79
100
  if (entry.toolCalled && !promoteGate) return true
@@ -83,10 +104,10 @@ export function createEpochPromotion(promoteEvents, options = {}) {
83
104
  return false
84
105
  }
85
106
 
86
- /** 应用一个事件;compaction/end 返回新 entry(旧状态清零、boundary 前推)。 */
107
+ /** 应用一个事件;成功 compaction/end 返回新 entry(旧状态清零、boundary 前推)。 */
87
108
  const applyEvent = (entry, event) => {
88
109
  const seq = event.seq ?? 0
89
- if (event.type === 'compaction/end') return freshEntry(seq)
110
+ if (isSuccessfulCompactionEnd(event)) return freshEntry(seq)
90
111
  if (seq <= entry.boundary) return entry
91
112
  if (gated) {
92
113
  if (event.type === 'tool/call') entry.toolCalled = true
@@ -106,8 +127,8 @@ export function createEpochPromotion(promoteEvents, options = {}) {
106
127
  /** Scan a session's durable log from scratch (cold start / resume). */
107
128
  const scan = (session) => {
108
129
  let entry = freshEntry(-1)
109
- for (const event of session.events) entry = applyEvent(entry, event)
110
- state.set(session.id, entry)
130
+ for (const event of sessionEvents(session)) entry = applyEvent(entry, event)
131
+ state.set(session, entry)
111
132
  return entry
112
133
  }
113
134
 
@@ -115,7 +136,7 @@ export function createEpochPromotion(promoteEvents, options = {}) {
115
136
  /**
116
137
  * Current phase of the agent's session.
117
138
  * @param agent - the assembly/pre-step agent, or undefined outside an agent.
118
- * @returns { boundary, promoted } — `boundary` is the last compaction/end
139
+ * @returns { boundary, promoted } — `boundary` is the last successful compaction/end
119
140
  * seq (-1 before any compaction); `promoted` is true when a durable
120
141
  * promotion signal exists after that boundary.
121
142
  */
@@ -126,14 +147,14 @@ export function createEpochPromotion(promoteEvents, options = {}) {
126
147
  // By default subagents keep the full catalog from their very first
127
148
  // request; includeSubagents makes them follow the normal bootstrap phase.
128
149
  if (!includeSubagents && (session.header?.delegationDepth ?? 0) > 0) return { boundary: -1, promoted: true }
129
- return state.get(session.id) ?? scan(session)
150
+ return state.peek(session) ?? scan(session)
130
151
  },
131
152
  /** Incremental feed: call on every `session/event`. */
132
153
  observe(session, event) {
133
- const entry = state.get(session.id)
154
+ const entry = state.peek(session)
134
155
  if (entry === undefined) return
135
156
  const next = applyEvent(entry, event)
136
- if (next !== entry) state.set(session.id, next)
157
+ if (next !== entry) state.set(session, next)
137
158
  },
138
159
  }
139
160
  }
@@ -0,0 +1,9 @@
1
+ # module: agent-instructions
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: agent-instructions
7
+ name: '@deepseek-ai/dsh-agent-instructions'
8
+ config:
9
+ maxBytes: 65536
@@ -1,11 +1,7 @@
1
1
  # module: command-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
- # ── goals ───────────────────────────────────────────────────────────────────
6
-
7
- # The goal service and session driver stay on the host plane, where the Gateway
8
- # can resolve them. The human command and model-facing tool register into this
9
- # preset's scoped layers.
10
6
  - id: command-goal
11
7
  name: '@deepseek-ai/dsh-command-goal'
@@ -1,18 +1,8 @@
1
1
  # module: compaction
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
- # ── compaction ──────────────────────────────────────────────────────────────
6
-
7
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
8
- # share this realm rather than sit outside it.
9
- #
10
- # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
11
- # plane, and the rows here resolve that one instance. It takes no configuration,
12
- # keys every fold by Session, and owns the context-meter projection units the
13
- # browser reads for every session — behind a realm those units would come and go
14
- # with whichever presets happen to be mounted. What a preset chooses is whether
15
- # its agent compacts at all, which is `compaction-basic` below.
16
6
  - id: compaction
17
7
  name: cordis:group
18
8
  group: true
@@ -22,31 +12,11 @@
22
12
  config:
23
13
  - id: compaction-basic
24
14
  name: '@deepseek-ai/dsh-compaction-basic'
25
-
26
15
  - id: command-compact
27
16
  name: '@deepseek-ai/dsh-command-compact'
28
-
29
17
  - id: tool-result-pruner
30
18
  name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
31
19
  config:
32
20
  thresholdChars: 8192
33
21
  headChars: 4096
34
22
  tailChars: 1024
35
-
36
- # ── delegation and workflows ────────────────────────────────────────────────
37
-
38
- # The `subagents` registry and its spawn/fork backends live in the HOST
39
- # composition: the registry is a process singleton whose cross-session queries
40
- # the api-proxy serves to the browser, and a provider name may only be
41
- # registered once. This preset contributes the delegation TOOLS, which resolve
42
- # that host registry.
43
- #
44
- # `workflows` is different — nothing outside an agent reads it — so every row
45
- # that reaches it shares one entry-local realm here, and a consumer left
46
- # outside would resolve a host registry this preset does not populate.
47
- #
48
- # `tool-subagent-report` is host-plane for the same reason as the registry,
49
- # not because a preset may not want it: it registers a CONTINUABLE SETUP on
50
- # that singleton rather than a tool this agent calls, and the setup list is
51
- # not scope-aware — one copy per mounted preset means every child gets
52
- # `report` registered once per live session, which throws on the second.
@@ -0,0 +1,58 @@
1
+ # module: delegation-ptc
2
+ # source: master/packages/bundle/web-app/presets/ptc.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: delegation
7
+ name: cordis:group
8
+ group: true
9
+ isolate:
10
+ workflowEngine: true
11
+ config:
12
+ - id: tool-subagent-control
13
+ name: '@deepseek-ai/dsh-tool-subagent-control'
14
+ - id: tool-subagent-list-agents
15
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
16
+ - id: tool-subagent
17
+ name: '@deepseek-ai/dsh-tool-subagent'
18
+ config:
19
+ provider: spawn
20
+ toolName: subagent
21
+ modelSelectionSettings: true
22
+ backgroundMode: continuable
23
+ - id: tool-subagent-fork
24
+ name: '@deepseek-ai/dsh-tool-subagent'
25
+ config:
26
+ provider: fork
27
+ toolName: subagent_fork
28
+ backgroundMode: continuable
29
+ - id: tool-subagent-codex
30
+ name: '@deepseek-ai/dsh-tool-subagent'
31
+ disabled: true
32
+ config:
33
+ provider: codex
34
+ toolName: subagent_codex
35
+ backgroundMode: one-shot
36
+ maxDepth: provider-managed
37
+ - id: tool-subagent-claude-code
38
+ name: '@deepseek-ai/dsh-tool-subagent'
39
+ disabled: true
40
+ config:
41
+ provider: claude-code
42
+ toolName: subagent_claude_code
43
+ backgroundMode: one-shot
44
+ maxDepth: provider-managed
45
+ - id: workflow-ptc
46
+ name: '@deepseek-ai/dsh-workflow-ptc'
47
+ disabled: true
48
+ config:
49
+ provider: spawn
50
+ - id: tool-workflow
51
+ name: '@deepseek-ai/dsh-tool-workflow'
52
+ disabled: true
53
+ - id: tool-ralph
54
+ name: '@deepseek-ai/dsh-tool-ralph'
55
+ disabled: true
56
+ config:
57
+ subagentProvider: spawn
58
+ maxRounds: 64
@@ -1,24 +1,8 @@
1
1
  # module: delegation
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
- # ── delegation and workflows ────────────────────────────────────────────────
6
-
7
- # The `subagents` registry and its spawn/fork backends live in the HOST
8
- # composition: the registry is a process singleton whose cross-session queries
9
- # the api-proxy serves to the browser, and a provider name may only be
10
- # registered once. This preset contributes the delegation TOOLS, which resolve
11
- # that host registry.
12
- #
13
- # `workflows` is different — nothing outside an agent reads it — so every row
14
- # that reaches it shares one entry-local realm here, and a consumer left
15
- # outside would resolve a host registry this preset does not populate.
16
- #
17
- # `tool-subagent-report` is host-plane for the same reason as the registry,
18
- # not because a preset may not want it: it registers a CONTINUABLE SETUP on
19
- # that singleton rather than a tool this agent calls, and the setup list is
20
- # not scope-aware — one copy per mounted preset means every child gets
21
- # `report` registered once per live session, which throws on the second.
22
6
  - id: delegation
23
7
  name: cordis:group
24
8
  group: true
@@ -27,10 +11,8 @@
27
11
  config:
28
12
  - id: tool-subagent-control
29
13
  name: '@deepseek-ai/dsh-tool-subagent-control'
30
-
31
14
  - id: tool-subagent-list-agents
32
15
  name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
33
-
34
16
  - id: tool-subagent
35
17
  name: '@deepseek-ai/dsh-tool-subagent'
36
18
  config:
@@ -38,22 +20,12 @@
38
20
  toolName: subagent
39
21
  modelSelectionSettings: true
40
22
  backgroundMode: continuable
41
-
42
- # Fork omits model selection so provider/model stay equal to the parent and
43
- # the inherited history remains eligible for KV Cache reuse. This preset
44
- # keeps fork continuable and accepts its child-scoped `report` additions invalidating
45
- # that prefix; issue #2124 tracks cache-preserving continuable fork.
46
23
  - id: tool-subagent-fork
47
24
  name: '@deepseek-ai/dsh-tool-subagent'
48
25
  config:
49
26
  provider: fork
50
27
  toolName: subagent_fork
51
28
  backgroundMode: continuable
52
-
53
- # Production dsh does not install these optional providers. Install the
54
- # matching Bundle in this Profile and restart the Host, then copy this
55
- # preset and remove `disabled` from the matching tool row. Host availability
56
- # alone grants no tool.
57
29
  - id: tool-subagent-codex
58
30
  name: '@deepseek-ai/dsh-tool-subagent'
59
31
  disabled: true
@@ -62,7 +34,6 @@
62
34
  toolName: subagent_codex
63
35
  backgroundMode: one-shot
64
36
  maxDepth: provider-managed
65
-
66
37
  - id: tool-subagent-claude-code
67
38
  name: '@deepseek-ai/dsh-tool-subagent'
68
39
  disabled: true
@@ -71,19 +42,15 @@
71
42
  toolName: subagent_claude_code
72
43
  backgroundMode: one-shot
73
44
  maxDepth: provider-managed
74
-
75
- - id: workflow-worker-thread
76
- name: '@deepseek-ai/dsh-workflow-worker-thread'
45
+ - id: workflow-ptc
46
+ name: '@deepseek-ai/dsh-workflow-ptc'
77
47
  config:
78
48
  provider: spawn
79
-
80
49
  - id: tool-workflow
81
50
  name: '@deepseek-ai/dsh-tool-workflow'
82
-
83
51
  - id: tool-ralph
84
52
  name: '@deepseek-ai/dsh-tool-ralph'
53
+ disabled: true
85
54
  config:
86
55
  subagentProvider: spawn
87
56
  maxRounds: 64
88
-
89
- # ── remaining model-facing rows ─────────────────────────────────────────────
@@ -1,24 +1,21 @@
1
1
  # module: persistent-shell
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/minimal/agent.cordis.yml
3
- # local patches: 2
2
+ # source: master/packages/bundle/web-app/presets/minimal.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
4
5
 
5
6
  - id: persistent-shell
6
7
  name: cordis:group
7
8
  group: true
8
- disabled: !!js process.platform === 'win32'
9
9
  isolate:
10
10
  terminals: true
11
11
  config:
12
12
  - id: pty
13
13
  name: '@deepseek-ai/dsh-terminal'
14
-
15
14
  - id: terminal-bash
16
15
  name: '@deepseek-ai/dsh-terminal-bash'
17
16
  disabled: !!js process.platform === 'win32'
18
17
  config:
19
- shellPath: !!js "process.getBuiltinModule?.('node:fs')?.existsSync('/bin/bash') ? '/bin/bash' : 'bash'"
20
18
  timeoutMs: 300000
21
-
22
19
  - id: persistent-bash
23
20
  name: '@deepseek-ai/dsh-tool-bash-persistent'
24
21
  disabled: !!js process.platform === 'win32'
@@ -27,20 +24,17 @@
27
24
  description: |-
28
25
  Run commands in a bash shell
29
26
  * When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
30
- * You don't have access to the internet via this tool.
31
- * You do have access to a mirror of common linux and python packages via apt and pip.
27
+ * Network access depends on the task environment. Prefer configured mirrors/proxies when they are available.
32
28
  * State is persistent across command calls and discussions with the user.
33
29
  * To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
34
30
  * Please avoid commands that may produce a very large amount of output.
35
31
  * Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
36
-
37
32
  - id: terminal-pwsh
38
33
  name: '@deepseek-ai/dsh-terminal-bash'
39
34
  disabled: !!js process.platform !== 'win32'
40
35
  config:
41
36
  shellDialect: pwsh
42
37
  timeoutMs: 300000
43
-
44
38
  - id: persistent-pwsh
45
39
  name: '@deepseek-ai/dsh-tool-pwsh-persistent'
46
40
  disabled: !!js process.platform !== 'win32'
@@ -54,6 +48,3 @@
54
48
  * Use native Windows paths (C:\...) and $env:NAME variables; this is PowerShell, not bash.
55
49
  * Please avoid commands that may produce a very large amount of output.
56
50
  * Please run long lived commands in the background, e.g. 'Start-Job' or start a server with Start-Process.
57
-
58
- # The bare local filesystem shadows the host's sandboxed provider only for this
59
- # preset. The editor shares that realm and requires absolute paths.
@@ -1,11 +1,8 @@
1
1
  # module: planning
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
- # ── plan mode ───────────────────────────────────────────────────────────────
6
-
7
- # Plan state is per-agent by nature, so an entry-local realm is not a
8
- # workaround here — it is the correct lifetime.
9
6
  - id: planning
10
7
  name: cordis:group
11
8
  group: true
@@ -16,26 +13,14 @@
16
13
  name: '@deepseek-ai/dsh-plan-mode'
17
14
  config:
18
15
  section: |
19
- 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.
20
-
21
- 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.
22
-
23
- 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.
16
+ 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.
24
17
 
25
- 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.
18
+ 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.
26
19
 
27
- 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.
20
+ 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.
28
21
 
29
- 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.
22
+ 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.
30
23
 
31
- # ── compaction ──────────────────────────────────────────────────────────────
24
+ 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.
32
25
 
33
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
34
- # share this realm rather than sit outside it.
35
- #
36
- # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
37
- # plane, and the rows here resolve that one instance. It takes no configuration,
38
- # keys every fold by Session, and owns the context-meter projection units the
39
- # browser reads for every session — behind a realm those units would come and go
40
- # with whichever presets happen to be mounted. What a preset chooses is whether
41
- # its agent compacts at all, which is `compaction-basic` below.
26
+ 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.
@@ -0,0 +1,10 @@
1
+ # module: skill-filesystem-cordis
2
+ # source: master/packages/bundle/web-app/presets/cordis.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: skill-filesystem
7
+ name: '@deepseek-ai/dsh-skill-filesystem'
8
+ config:
9
+ customSkillDirs:
10
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
@@ -1,13 +1,7 @@
1
1
  # module: skill-filesystem
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
- # ── skills ──────────────────────────────────────────────────────────────────
6
-
7
- # The skill REGISTRY lives in the host composition and is layered per scope:
8
- # these rows register into THIS preset's layer of it, so they need no realm.
9
- # `skill-filesystem` contributes local-root discovery for agents on this preset, and
10
- # `tool-skill` gives them the catalog and loader; the merged catalog also
11
- # carries whatever the deployment registered globally (repository plugins).
12
6
  - id: skill-filesystem
13
7
  name: '@deepseek-ai/dsh-skill-filesystem'
@@ -1,8 +1,7 @@
1
1
  # module: tool-ask-user
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
- # ── remaining model-facing rows ─────────────────────────────────────────────
6
-
7
6
  - id: tool-ask-user
8
7
  name: '@deepseek-ai/dsh-tool-ask-user'
@@ -1,16 +1,8 @@
1
1
  # module: tool-bash
2
- # source: D:\AI\GitHub\deepseek-harness/packages/preset/agent-presets/presets/standard/agent.cordis.yml
3
- # local patches: 1
2
+ # source: master/packages/bundle/web-app/presets/standard.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
4
5
 
5
- # ── shell ───────────────────────────────────────────────────────────────────
6
-
7
- # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
8
- # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
9
- # the criterion for host-plane ownership — injection resolves before any session
10
- # exists, so there is no agent to key by. Behind a preset realm those variables
11
- # never reached the model's shell at all. Both shell tools consume the host
12
- # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
13
- # host-plane too.
14
6
  - id: tool-bash
15
7
  name: '@deepseek-ai/dsh-tool-bash'
16
- disabled: true
8
+ disabled: !!js process.platform === 'win32'
@@ -0,0 +1,7 @@
1
+ # module: tool-cordis
2
+ # source: master/packages/bundle/web-app/presets/cordis.patch.yml
3
+ # commit: c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
4
+ # local patches: 0
5
+
6
+ - id: tool-cordis
7
+ name: '@deepseek-ai/dsh-tool-cordis'