dsh-plugin-recipe 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,16 +4,16 @@
4
4
 
5
5
  ## 安装
6
6
 
7
- 从 GitHub Release 安装(当前推荐,无需 npm):
7
+ 从 npm 安装(推荐):
8
8
 
9
9
  ```bash
10
- dsh plugin --profile web add "https://github.com/Starlit-Sky-code/dsh-experience-optimizer/releases/download/v0.2.4/dsh-plugin-recipe-0.2.4.tgz"
10
+ dsh plugin --profile web add dsh-plugin-recipe@0.2.6
11
11
  ```
12
12
 
13
- 发布到 npm 后:
13
+ 从 GitHub Release 安装(备用,无需 npm):
14
14
 
15
15
  ```bash
16
- dsh plugin --profile web add dsh-plugin-recipe
16
+ dsh plugin --profile web add "https://github.com/Starlit-Sky-code/dsh-experience-optimizer/releases/download/v0.2.6/dsh-plugin-recipe-0.2.6.tgz"
17
17
  ```
18
18
 
19
19
  本地开发:
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ interface CapabilitySeam {
28
28
  /** True for a reasoning-only step that needs no tool. */
29
29
  modelOnly?: boolean;
30
30
  }
31
+ /** Human-in-the-loop level a step asks the downstream executor to honor. */
32
+ type ApprovalLevel = 'none' | 'suggested' | 'required';
31
33
  /** One workflow step in a plan produced by the recipe layer. */
32
34
  interface WorkflowStep {
33
35
  id: string;
@@ -38,6 +40,8 @@ interface WorkflowStep {
38
40
  pluginIds: string[];
39
41
  dependsOn: string[];
40
42
  needsConfirm: boolean;
43
+ /** `required` means the step must have a host/user approval before execution. */
44
+ approvalLevel: ApprovalLevel;
41
45
  inputs: string[];
42
46
  outputs: string[];
43
47
  onFailure: string;
package/dist/index.js CHANGED
@@ -559,6 +559,7 @@ function weeklyReportSteps(answers, capabilities, options) {
559
559
  pluginIds: [],
560
560
  dependsOn: steps.map((step) => step.id),
561
561
  needsConfirm: false,
562
+ approvalLevel: "none",
562
563
  inputs: ["commit 列表", "diff 统计"],
563
564
  outputs: ["周报正文草稿"],
564
565
  onFailure: "保留上下文,提示用户补充数据"
@@ -588,6 +589,7 @@ function genericSteps(answers, capabilities, options) {
588
589
  pluginIds: [],
589
590
  dependsOn: lastIds(steps),
590
591
  needsConfirm: false,
592
+ approvalLevel: "none",
591
593
  inputs: ["上一步输出"],
592
594
  outputs: ["汇总文本"],
593
595
  onFailure: "保留中间结果并提示用户"
@@ -600,6 +602,8 @@ function genericSteps(answers, capabilities, options) {
600
602
  return steps;
601
603
  }
602
604
  function toolStep(id, intent, capability, dependsOn, needsConfirm, inputs, outputs) {
605
+ const requiresConfirm = needsConfirm || capability.needsConfirm;
606
+ const approvalLevel = requiresConfirm ? "required" : capability.permissions.some((permission) => ["external-send", "shell"].includes(permission)) ? "suggested" : "none";
603
607
  return {
604
608
  id,
605
609
  intent,
@@ -608,7 +612,8 @@ function toolStep(id, intent, capability, dependsOn, needsConfirm, inputs, outpu
608
612
  toolNames: [...capability.tools],
609
613
  pluginIds: [...capability.pluginIds],
610
614
  dependsOn: [...dependsOn],
611
- needsConfirm: needsConfirm || capability.needsConfirm,
615
+ needsConfirm: requiresConfirm,
616
+ approvalLevel,
612
617
  inputs,
613
618
  outputs,
614
619
  onFailure: capability.trigger === "schedule" ? "停用本次运行并通知用户" : "保留草稿;采集步骤最多重试一次"
@@ -803,8 +808,8 @@ function renderBlueprintMarkdown(blueprint) {
803
808
  lines.push("");
804
809
  lines.push("## 2. 步骤");
805
810
  lines.push("");
806
- lines.push("| # | 意图 | 类型 | 能力 | 工具/插件 | 依赖 | 人工确认 | 失败处理 |");
807
- lines.push("|---|---|---|---|---|---|---|---|");
811
+ lines.push("| # | 意图 | 类型 | 能力 | 工具/插件 | 依赖 | 人工确认 | 审批级别 | 失败处理 |");
812
+ lines.push("|---|---|---|---|---|---|---|---|---|");
808
813
  for (const step of blueprint.steps) lines.push(stepRow(step));
809
814
  lines.push("");
810
815
  lines.push("## 3. 数据流");
@@ -854,7 +859,7 @@ function renderBlueprintMarkdown(blueprint) {
854
859
  function stepRow(step) {
855
860
  const tools = step.toolNames.length > 0 ? step.toolNames.join(", ") : "(模型步骤)";
856
861
  const plugins = step.pluginIds.length > 0 ? ` / ${step.pluginIds.join(", ")}` : "";
857
- return `| ${step.id} | ${escapeMarkdownCell(step.intent)} | ${step.kind} | ${step.capabilityId ?? "—"} | ${escapeMarkdownCell(tools + plugins)} | ${step.dependsOn.join(", ") || "—"} | ${step.needsConfirm ? "yes" : "no"} | ${escapeMarkdownCell(step.onFailure)} |`;
862
+ return `| ${step.id} | ${escapeMarkdownCell(step.intent)} | ${step.kind} | ${step.capabilityId ?? "—"} | ${escapeMarkdownCell(tools + plugins)} | ${step.dependsOn.join(", ") || "—"} | ${step.needsConfirm ? "yes" : "no"} | ${step.approvalLevel ?? (step.needsConfirm ? "required" : "none")} | ${escapeMarkdownCell(step.onFailure)} |`;
858
863
  }
859
864
  // src/tools.ts
860
865
  /** Register the recipe model-facing tools. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-recipe",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "DSH workflow recipe planner: translate business goals into validated workflow blueprints",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",