@godv61/dsh-task-engine 0.17.0 → 0.19.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.
@@ -2,9 +2,10 @@
2
2
  * Built-in engineering workflows. A workflow is a complete, engine-resolved
3
3
  * `WorkflowConfig` a project adopts by id: the stage graph, transition guards,
4
4
  * artifacts, commit rule, and default skill/rule bindings are all baked in
5
- * here. A project overrides only its stage bindings (which skill/rule each
6
- * node mounts); every other field is a fixed property of the chosen preset, so
7
- * a project cannot hand-edit the gate semantics.
5
+ * here. A project overrides only its stage bindings by APPENDING skill/rule
6
+ * names to the preset defaults; every guard, artifact, and commit field stays
7
+ * a fixed property of the chosen preset, so a project cannot hand-edit the gate
8
+ * semantics or cancel a core binding.
8
9
  *
9
10
  * @module dsh-task-engine/workflows
10
11
  */
@@ -15,20 +16,54 @@ export interface FlowOption {
15
16
  label: string;
16
17
  description: string;
17
18
  }
19
+ /** A gate capability a flow either has or lacks; high-risk tasks require a subset. */
20
+ export type WorkflowCapability = 'artifact_gate' | 'verification_gate' | 'file_scope' | 'review_gate';
21
+ /** A versioned preset: fixed gate semantics plus its derived capability set. */
22
+ export interface FlowPreset extends FlowOption {
23
+ /** Preset schema version; bumped only by a shipped preset edit (`standard@1` → `standard@2`). */
24
+ version: number;
25
+ /** Gate capabilities derived from the preset's own structure. */
26
+ capabilities: WorkflowCapability[];
27
+ /** The complete engine config this preset resolves to. */
28
+ config: WorkflowConfig;
29
+ }
18
30
  /** The selectable preset workflows (shown in the workbench flow picker). */
19
31
  export declare const FLOW_OPTIONS: readonly FlowOption[];
20
- export declare const FLOW_CONFIGS: Record<string, WorkflowConfig>;
32
+ export declare const FLOW_PRESETS: Record<string, FlowPreset>;
21
33
  /** Whether `flow` names a built-in workflow. */
22
34
  export declare function isKnownFlow(flow: string): boolean;
23
35
  /**
24
- * Resolve a preset workflow plus a project's stage-binding override into the
25
- * complete engine config. Unknown `flow` ids fall back to `standard` when
26
- * reading (a stale file must not break the gate); writes reject unknown ids
27
- * before calling this.
36
+ * The capabilities a high-risk task must have from its flow. A `high_risk`
37
+ * task therefore cannot be created on a flow that lacks a verification gate,
38
+ * file-scope protection, or a code review gate — choosing a looser flow can
39
+ * never downgrade the risk bar.
40
+ */
41
+ export declare const HIGH_RISK_REQUIRED_CAPABILITIES: readonly WorkflowCapability[];
42
+ /** Whether a flow's derived capabilities cover every required capability. */
43
+ export declare function flowSatisfies(flow: string, required: readonly WorkflowCapability[]): boolean;
44
+ /** Resolve an unknown flow id's failure, surprising no caller with a fallback. */
45
+ export interface UnknownFlow {
46
+ ok: false;
47
+ code: 'UNKNOWN_FLOW';
48
+ flow: string;
49
+ knownFlows: string[];
50
+ }
51
+ /** Resolve a known flow id's complete config. */
52
+ export interface KnownFlow {
53
+ ok: true;
54
+ config: WorkflowConfig;
55
+ preset: FlowPreset;
56
+ }
57
+ export type FlowResolve = KnownFlow | UnknownFlow;
58
+ /**
59
+ * Resolve a preset workflow plus a project's stage-binding additions into the
60
+ * complete engine config. Unknown `flow` ids fail closed with an explicit
61
+ * `UNKNOWN_FLOW` result instead of silently falling back to `standard`, so a
62
+ * project that names a missing or stale preset stops instead of running the
63
+ * wrong gate.
28
64
  * @param flow - workflow id from the project's `.dsh/eng.json`.
29
- * @param override - optional whole `stage_bindings` map replacing the preset default.
30
- * @returns the resolved workflow, always structurally complete.
65
+ * @param override - optional whole `stage_bindings` map APPENDED to the preset defaults.
31
66
  */
32
- export declare function resolveFlowConfig(flow: string, override?: {
67
+ export declare function resolveFlow(flow: string, override?: {
33
68
  stage_bindings?: Record<string, StageBinding>;
34
- }): WorkflowConfig;
69
+ }): FlowResolve;
package/lib/workflows.js CHANGED
@@ -2,9 +2,10 @@
2
2
  * Built-in engineering workflows. A workflow is a complete, engine-resolved
3
3
  * `WorkflowConfig` a project adopts by id: the stage graph, transition guards,
4
4
  * artifacts, commit rule, and default skill/rule bindings are all baked in
5
- * here. A project overrides only its stage bindings (which skill/rule each
6
- * node mounts); every other field is a fixed property of the chosen preset, so
7
- * a project cannot hand-edit the gate semantics.
5
+ * here. A project overrides only its stage bindings by APPENDING skill/rule
6
+ * names to the preset defaults; every guard, artifact, and commit field stays
7
+ * a fixed property of the chosen preset, so a project cannot hand-edit the gate
8
+ * semantics or cancel a core binding.
8
9
  *
9
10
  * @module dsh-task-engine/workflows
10
11
  */
@@ -94,29 +95,98 @@ const MINIMAL = {
94
95
  '交付': { skills: ['code-commit'], rules: ['commit-conventions'] },
95
96
  },
96
97
  };
97
- export const FLOW_CONFIGS = {
98
- standard: STANDARD,
99
- agile: AGILE,
100
- minimal: MINIMAL,
98
+ /**
99
+ * Derive a preset's capability set from its own structure, so the capability
100
+ * claims can never drift from the actual gate graph.
101
+ */
102
+ function deriveCapabilities(config) {
103
+ const caps = [];
104
+ const guards = new Set(config.transitions.flatMap(t => t.requires ?? []));
105
+ if (guards.has('verified'))
106
+ caps.push('verification_gate');
107
+ if (guards.has('review_passed'))
108
+ caps.push('review_gate');
109
+ if (guards.has('artifacts_present'))
110
+ caps.push('artifact_gate');
111
+ if (config.commit.file_scope)
112
+ caps.push('file_scope');
113
+ return caps;
114
+ }
115
+ function preset(id, version, label, description, config) {
116
+ return { id, version, label, description, capabilities: deriveCapabilities(config), config };
117
+ }
118
+ export const FLOW_PRESETS = {
119
+ standard: preset('standard', 1, '标准研发', '需求评审 → 设计 → 开发 → 交付 → 代码审核,含产物门 + 确认门', STANDARD),
120
+ agile: preset('agile', 1, '敏捷轻量', '需求 → 开发 → 交付 → 审查,四阶段、少产物', AGILE),
121
+ minimal: preset('minimal', 1, '纯代码', '开发 → 交付,两阶段,只留提交门禁', MINIMAL),
101
122
  };
102
123
  /** Whether `flow` names a built-in workflow. */
103
124
  export function isKnownFlow(flow) {
104
- return Object.prototype.hasOwnProperty.call(FLOW_CONFIGS, flow);
125
+ return Object.prototype.hasOwnProperty.call(FLOW_PRESETS, flow);
126
+ }
127
+ /**
128
+ * The capabilities a high-risk task must have from its flow. A `high_risk`
129
+ * task therefore cannot be created on a flow that lacks a verification gate,
130
+ * file-scope protection, or a code review gate — choosing a looser flow can
131
+ * never downgrade the risk bar.
132
+ */
133
+ export const HIGH_RISK_REQUIRED_CAPABILITIES = [
134
+ 'verification_gate',
135
+ 'file_scope',
136
+ 'review_gate',
137
+ ];
138
+ /** Whether a flow's derived capabilities cover every required capability. */
139
+ export function flowSatisfies(flow, required) {
140
+ const preset = FLOW_PRESETS[flow];
141
+ if (preset === undefined)
142
+ return false;
143
+ return required.every(cap => preset.capabilities.includes(cap));
144
+ }
145
+ /** Stable ordered dedupe that keeps each name's first occurrence. */
146
+ function dedupe(names) {
147
+ return [...new Set(names)];
148
+ }
149
+ /**
150
+ * Merge a project's stage-binding additions into a preset's defaults without
151
+ * ever removing a core binding. A stage's `skills`/`rules` become the preset
152
+ * defaults followed by the project additions, de-duplicated in order; the seed
153
+ * bindings can therefore never be cancelled by an override, only extended.
154
+ */
155
+ function mergeBindings(base, override) {
156
+ if (override === undefined)
157
+ return base;
158
+ let changed = false;
159
+ const merged = { ...base.stage_bindings };
160
+ for (const [stage, addition] of Object.entries(override)) {
161
+ const existing = merged[stage];
162
+ const skills = dedupe([...(existing?.skills ?? []), ...(addition.skills ?? [])]);
163
+ const rules = dedupe([...(existing?.rules ?? []), ...(addition.rules ?? [])]);
164
+ const binding = {};
165
+ if (skills.length > 0)
166
+ binding.skills = skills;
167
+ if (rules.length > 0)
168
+ binding.rules = rules;
169
+ merged[stage] = binding;
170
+ changed = true;
171
+ }
172
+ if (!changed)
173
+ return base;
174
+ return { ...base, stage_bindings: merged };
105
175
  }
106
176
  /**
107
- * Resolve a preset workflow plus a project's stage-binding override into the
108
- * complete engine config. Unknown `flow` ids fall back to `standard` when
109
- * reading (a stale file must not break the gate); writes reject unknown ids
110
- * before calling this.
177
+ * Resolve a preset workflow plus a project's stage-binding additions into the
178
+ * complete engine config. Unknown `flow` ids fail closed with an explicit
179
+ * `UNKNOWN_FLOW` result instead of silently falling back to `standard`, so a
180
+ * project that names a missing or stale preset stops instead of running the
181
+ * wrong gate.
111
182
  * @param flow - workflow id from the project's `.dsh/eng.json`.
112
- * @param override - optional whole `stage_bindings` map replacing the preset default.
113
- * @returns the resolved workflow, always structurally complete.
183
+ * @param override - optional whole `stage_bindings` map APPENDED to the preset defaults.
114
184
  */
115
- export function resolveFlowConfig(flow, override) {
116
- const base = FLOW_CONFIGS[flow] ?? STANDARD;
117
- if (override?.stage_bindings !== undefined) {
118
- return { ...base, stage_bindings: { ...override.stage_bindings } };
185
+ export function resolveFlow(flow, override) {
186
+ const preset = FLOW_PRESETS[flow];
187
+ if (preset === undefined) {
188
+ return { ok: false, code: 'UNKNOWN_FLOW', flow, knownFlows: Object.keys(FLOW_PRESETS) };
119
189
  }
120
- return base;
190
+ return { ok: true, config: mergeBindings(preset.config, override?.stage_bindings), preset };
121
191
  }
122
192
  //# sourceMappingURL=workflows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,uCAAuC,EAAE;IACvF,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,2BAA2B,EAAE;IACxE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE;CACnE,CAAA;AAED,4DAA4D;AAC5D,MAAM,QAAQ,GAAmB;IAC/B,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC;IAChD,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE;QACX,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IA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AC5C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,QAA4D;IACpG,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAA;IACzF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;AAC7F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godv61/dsh-task-engine",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Preset-workflow engineering delivery engine for DeepSeek Harness: a `dev_task` tool that hard-gates stage transitions and commit scope/message, per-node skill/rule bindings with progressive disclosure, a workbench to pick a flow preset and mount skills/rules, and preset-scoped activation — the tool and skills activate only for sessions on a preset that names the agent row.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -52,19 +52,23 @@
52
52
  "scripts": {
53
53
  "build": "tsc -p tsconfig.json && node build-client.mjs",
54
54
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json --noEmit",
55
+ "test": "node .p0-test.mjs",
55
56
  "prepare": "npm run build"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "@deepseek-ai/cordis": "^4.0.2",
59
60
  "@deepseek-ai/dsh-agent-presets": "^0.1.2-rc.1",
61
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
60
62
  "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
61
63
  "@deepseek-ai/dsh-typert-protocol": "^0.1.2-rc.1"
62
64
  },
63
65
  "devDependencies": {
64
66
  "@deepseek-ai/cordis": "^4.0.2",
67
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.2-rc.1",
65
68
  "@deepseek-ai/dsh-agent-presets": "^0.1.2-rc.1",
66
- "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
67
69
  "@deepseek-ai/dsh-fs": "^0.1.2-rc.1",
70
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
71
+ "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
68
72
  "@deepseek-ai/dsh-typert-protocol": "^0.1.2-rc.1",
69
73
  "@types/node": "^22.0.0",
70
74
  "@types/react": "~18.3.1",
@@ -10,7 +10,7 @@ whenToUse: 开始任何开发、改 bug、加功能、代码评审或提交任
10
10
 
11
11
  ## 项目认知(可选前置)
12
12
 
13
- 接手一个还不熟悉(尤其二开 / 遗留)的项目、且项目根没有 `AGENTS.md` 时,先 `dev_task`(operation=init)扫描项目并生成项目根的 `AGENTS.md` 描述文件——DSH 会把它自动注入到每个会话,之后每个任务开工自带项目认知。生成落盘前硬校验 200 行上限,只写「项目是什么 → 怎么跑 → 结构 → 约定 → 坑」,超限即精简;已有 `AGENTS.md` 时先读回、合并后再带 overwrite 重写,不裸覆盖。
13
+ 接手一个还不熟悉(尤其二开 / 遗留)的项目、且项目根没有 `AGENTS.md` 时,先 `dev_task`(operation=init)走 inspect → propose → apply 三阶段生成项目根的 `AGENTS.md` 描述文件——DSH 会把它自动注入到每个会话,之后每个任务开工自带项目认知。扫项目后先 propose 草稿(只预览、硬校验 200 行上限,只写「项目是什么 → 怎么跑 → 结构 → 约定 → 坑」,超限即精简),再 apply 落盘;已有 `AGENTS.md` 时默认只读,覆盖需 overwrite + 人工批准,绝不裸覆盖项目已有治理文件。
14
14
 
15
15
  ## 入口
16
16