dsh-plugin-prompt-tool 2.0.1 → 2.1.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 (60) hide show
  1. package/README.md +6 -6
  2. package/engine/actions/catalog.mjs +1 -1
  3. package/engine/actions/inbox-prepend.mjs +1 -2
  4. package/engine/actions/shared.mjs +1 -2
  5. package/engine/branch.mjs +1 -1
  6. package/engine/compositions/source/local/instruction-hint.yml +2 -3
  7. package/engine/conditions/composite.mjs +1 -1
  8. package/engine/conditions/count.mjs +1 -2
  9. package/engine/conditions/phase.mjs +1 -2
  10. package/engine/conditions/subject.mjs +1 -1
  11. package/engine/layers.mjs +3 -4
  12. package/engine/rule-spec.mjs +1 -1
  13. package/engine/shared.mjs +1 -13
  14. package/engine/subagent-tool-policy.mjs +2 -2
  15. package/engine/tool-config-engine.mjs +1 -1
  16. package/engine/trigger-spec.mjs +3 -3
  17. package/engine/trigger.mjs +2 -2
  18. package/lib/index.d.mts +1380 -1
  19. package/lib/index.mjs +33 -3
  20. package/lib/migrate-rules.mjs +572 -1
  21. package/lib/{module-package-CHPFweqK.mjs → module-package-DqJZaE71.mjs} +1 -1
  22. package/lib/{module-package-Cnd1_mwx.mjs → module-package-q2gDRu9H.mjs} +19 -22
  23. package/lib/{rules-migration-DJ6vASB5.mjs → rule-builder-DMrJten6.mjs} +28 -595
  24. package/package.json +4 -2
  25. package/skills/dsh-module/SKILL.md +199 -0
  26. package/skills/dsh-module/reference.md +158 -0
  27. package/templates/61-deny-tools-presentation.yml +27 -0
  28. package/templates/62-guard-deny-tools.yml +20 -0
  29. package/templates/63-append-context.yml +22 -0
  30. package/templates/64-pre-step-filter.yml +23 -0
  31. package/templates/67-inbox-prepend.yml +22 -0
  32. package/templates/80-tool-surface.yml +6 -6
  33. package/engine/compositions/library/agent-instructions.yml +0 -9
  34. package/engine/compositions/library/command-goal.yml +0 -7
  35. package/engine/compositions/library/compaction.yml +0 -22
  36. package/engine/compositions/library/delegation-ptc.yml +0 -58
  37. package/engine/compositions/library/delegation.yml +0 -56
  38. package/engine/compositions/library/persistent-shell.yml +0 -50
  39. package/engine/compositions/library/planning.yml +0 -26
  40. package/engine/compositions/library/skill-filesystem-cordis.yml +0 -10
  41. package/engine/compositions/library/skill-filesystem.yml +0 -7
  42. package/engine/compositions/library/tool-ask-user.yml +0 -7
  43. package/engine/compositions/library/tool-bash.yml +0 -8
  44. package/engine/compositions/library/tool-cordis.yml +0 -7
  45. package/engine/compositions/library/tool-fs-search.yml +0 -9
  46. package/engine/compositions/library/tool-fs.yml +0 -7
  47. package/engine/compositions/library/tool-goal.yml +0 -7
  48. package/engine/compositions/library/tool-jobs.yml +0 -7
  49. package/engine/compositions/library/tool-plugin-manager-disabled.yml +0 -8
  50. package/engine/compositions/library/tool-plugin-manager.yml +0 -8
  51. package/engine/compositions/library/tool-present.yml +0 -7
  52. package/engine/compositions/library/tool-presentation.yml +0 -9
  53. package/engine/compositions/library/tool-pwsh.yml +0 -8
  54. package/engine/compositions/library/tool-skill.yml +0 -7
  55. package/engine/compositions/library/tool-todo.yml +0 -9
  56. package/engine/compositions/library/tool-web.yml +0 -10
  57. package/engine/compositions/source/local/declared-triggers.yml +0 -12
  58. package/lib/paths-CyP0IkaM.d.mts +0 -1390
  59. package/lib/preset-transfer.d.mts +0 -2
  60. package/lib/preset-transfer.mjs +0 -3
@@ -1,4 +1,4 @@
1
- import { A as packageEngineDir, Ct as assertModuleTree, D as loadModuleSpec, Et as setModuleDefinitionId, F as resolveModuleDir, Ft as validateCustomToolIdentities, G as assertCanonicalRuleSource, H as editModuleRules, J as rulePromptConfigOptions, K as ensureModuleSlices, P as renderComposition, Q as injectionConfigSpec, St as assertModuleId, Tt as modulePathExists, U as readModuleRules, Ut as MODULES_DIR, V as withModuleDefinition, W as ModuleRulesError, Wt as MODULE_DEFINITION_FILE, X as withModuleLock, Y as validateModuleDefinitionText, Z as compileRules, bt as readModuleLayerSettings, d as assertSafeConfigId, dt as prepareStText, ft as renderStText, g as appendModuleCapabilities, gt as atomicWriteTextFile, i as promptConfigToRule, n as convertLegacyModuleRules, p as enabledModuleIds, q as loadModuleDefinition, s as appendModuleConfigOrder, v as assertCompositionArray, w as invalidateModuleSpec, wt as canonicalModulesRoot, xt as assertModuleDirectory, yt as engineParamPath } from "./rules-migration-DJ6vASB5.mjs";
1
+ import { $ as injectionConfigSpec, A as packageEngineDir, At as modulePathExists, Bt as validateCustomToolIdentities, D as loadModuleSpec, Dt as assertModuleId, Et as assertModuleDirectory, F as resolveModuleDir, G as assertCanonicalRuleSource, H as editModuleRules, J as loadModuleDefinition, Ot as assertModuleTree, P as renderComposition, Q as compileRules, Tt as readModuleLayerSettings, U as readModuleRules, V as withModuleDefinition, W as ModuleRulesError, X as validateModuleDefinitionText, Xt as MODULES_DIR, Y as rulePromptConfigOptions, Z as withModuleLock, Zt as MODULE_DEFINITION_FILE, a as appendModuleConfigOrder, g as appendModuleCapabilities, gt as renderStText, ht as prepareStText, jt as setModuleDefinitionId, kt as canonicalModulesRoot, l as assertSafeConfigId, p as enabledModuleIds, q as ensureModuleSlices, r as promptConfigToRule, v as assertCompositionArray, w as invalidateModuleSpec, wt as engineParamPath, xt as atomicWriteTextFile } from "./rule-builder-DMrJten6.mjs";
2
2
  import { basename, dirname, join, posix, resolve } from "node:path";
3
3
  import { appendFileSync, cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { YAMLMap, YAMLSeq, parse, parseDocument, stringify } from "yaml";
@@ -191,7 +191,7 @@ function deleteWorldBookEntry(moduleDir, id) {
191
191
  * - 采样参数(temperature/openai_max_tokens/reasoning_effort)**不转译**:
192
192
  * 模型参数由「模型设置」UI 统一管理(预设级 params.model*,writePreset 渲染
193
193
  * agent-request patch),ST 卡固化值会覆盖用户在模型设置里的设置,故剥离;
194
- * - modules 按需组装:prompt-config-engine 始终,system-section 注入需要
194
+ * - modules 按需组装:rule-engine 始终,system-section 注入需要
195
195
  * persona(complete: false 允许 system-section 生效),世界书条目需要 world-book-tools。
196
196
  */
197
197
  /** 转换器版本:报告用它解释本次生成使用了哪一版语义(语义调整时同步递增)。
@@ -410,8 +410,8 @@ function convertStToModuleWithReport(card, baseName, options = {}) {
410
410
  }
411
411
  }
412
412
  const configs = [];
413
- /** module.yml 顶层触发器声明(`enable_web_search: false` 的 web 拒绝名单在此登记)。 */
414
- const triggers = [];
413
+ /** `enable_web_search: false` 的三条 Web 防护规则(呈现裁剪 / SDK 正文裁剪 / 执行 guard)。 */
414
+ const webRules = [];
415
415
  const worldBookSources = /* @__PURE__ */ new Map();
416
416
  const droppedMarkers = [];
417
417
  const diagnostics = [];
@@ -1018,30 +1018,28 @@ function convertStToModuleWithReport(card, baseName, options = {}) {
1018
1018
  prefix: "",
1019
1019
  complete: false
1020
1020
  } : void 0;
1021
- if (record.enable_web_search === true) {
1022
- modules.push("tool-web");
1023
- moduleConfigs["tool-web"] = { fetch: true };
1024
- } else if (record.enable_web_search === false) triggers.push({
1021
+ if (record.enable_web_search === true) noteInfo("st-web-search-preset-provided", "enable_web_search: true —— web 工具行已从模块库退役,本插件不再组装;请确认会话预设装配了 web 工具", { field: "enable_web_search" });
1022
+ else if (record.enable_web_search === false) webRules.push({
1025
1023
  id: "st-web-assembly",
1026
- channel: "system-prompt/assemble",
1027
- do: {
1024
+ then: [{
1025
+ id: "st-web-assembly",
1028
1026
  kind: "assembly",
1029
1027
  target: { tools: { deny: [...ST_WEB_TOOLS] } }
1030
- }
1028
+ }]
1031
1029
  }, {
1032
1030
  id: "st-web-sdk-strip",
1033
- channel: "system-prompt/assemble",
1034
- do: {
1031
+ then: [{
1032
+ id: "st-web-sdk-strip",
1035
1033
  kind: "sdk-strip",
1036
1034
  mask: { deny: [...ST_WEB_TOOLS] }
1037
- }
1035
+ }]
1038
1036
  }, {
1039
1037
  id: "st-web-guard",
1040
- channel: "system-prompt/assemble",
1041
- do: {
1038
+ then: [{
1039
+ id: "st-web-guard",
1042
1040
  kind: "guard",
1043
1041
  mask: { deny: [...ST_WEB_TOOLS] }
1044
- }
1042
+ }]
1045
1043
  });
1046
1044
  const moduleId = stModuleId(baseName);
1047
1045
  for (const config of configs) {
@@ -1134,6 +1132,8 @@ function convertStToModuleWithReport(card, baseName, options = {}) {
1134
1132
  },
1135
1133
  ...reportTruncated ? { truncated: true } : {}
1136
1134
  };
1135
+ const rules = [...configs.map((config) => promptConfigToRule(config)), ...webRules];
1136
+ compileRules(rules);
1137
1137
  return {
1138
1138
  spec: {
1139
1139
  id: moduleId,
@@ -1149,10 +1149,7 @@ function convertStToModuleWithReport(card, baseName, options = {}) {
1149
1149
  ...persona === void 0 ? {} : { persona },
1150
1150
  modules: [...new Set(modules.map((name) => name === "prompt-config-engine" || name === "declared-triggers" ? "rule-engine" : name))],
1151
1151
  moduleConfigs,
1152
- rules: convertLegacyModuleRules({
1153
- promptConfigs: configs,
1154
- triggers
1155
- }).rules
1152
+ rules
1156
1153
  },
1157
1154
  report
1158
1155
  };
@@ -1646,7 +1643,7 @@ async function importCharacterCard(root, files, options = {}) {
1646
1643
  message: "请先选择角色内容类型或提示顺序组"
1647
1644
  };
1648
1645
  const moduleFiles = prepared.files;
1649
- const { moduleImportPreview, installModulePackage } = await import("./module-package-CHPFweqK.mjs");
1646
+ const { moduleImportPreview, installModulePackage } = await import("./module-package-DqJZaE71.mjs");
1650
1647
  const request = {
1651
1648
  ...importChoices(options),
1652
1649
  sourceKind: "native-character"