dsh-plugin-prompt-tool 0.4.2 → 0.6.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.
- package/README.md +131 -222
- package/engine/anchor-match.mjs +117 -0
- package/engine/compaction-epoch.mjs +139 -0
- package/engine/compositions/library/bootstrap-filesystem.yml +19 -0
- package/engine/compositions/library/compaction.yml +52 -0
- package/engine/compositions/library/context-gate.yml +40 -0
- package/engine/compositions/library/custom-bash.yml +14 -0
- package/engine/compositions/library/delegation.yml +85 -0
- package/engine/compositions/library/official-agent-instructions.yml +17 -0
- package/engine/compositions/library/official-persistent-shell.yml +56 -0
- package/engine/compositions/library/official-skill-filesystem-cordis.yml +10 -0
- package/engine/compositions/library/official-tool-bash.yml +6 -0
- package/engine/compositions/library/official-tool-cordis.yml +13 -0
- package/engine/compositions/library/official-tool-presentation.yml +7 -0
- package/engine/compositions/library/official-tool-skill.yml +14 -0
- package/engine/compositions/library/persistent-shell.yml +36 -0
- package/engine/compositions/library/persona.yml +9 -0
- package/engine/compositions/library/planning.yml +41 -0
- package/engine/compositions/library/prompt-config-engine.yml +16 -0
- package/engine/compositions/library/run-code-env.yml +15 -0
- package/engine/compositions/library/skill-filesystem.yml +13 -0
- package/engine/compositions/library/skill-search.yml +14 -0
- package/engine/compositions/library/str-replace-editor.yml +10 -0
- package/engine/compositions/library/tool-ask-user.yml +8 -0
- package/engine/compositions/library/tool-bash.yml +16 -0
- package/engine/compositions/library/tool-bootstrap.yml +16 -0
- package/engine/compositions/library/tool-filter.yml +12 -0
- package/engine/compositions/library/tool-fs-search.yml +18 -0
- package/engine/compositions/library/tool-fs.yml +10 -0
- package/engine/compositions/library/tool-goal.yml +19 -0
- package/engine/compositions/library/tool-jobs.yml +23 -0
- package/engine/compositions/library/tool-pwsh.yml +12 -0
- package/engine/compositions/library/tool-todo.yml +11 -0
- package/engine/compositions/library/tool-web.yml +9 -0
- package/engine/compositions/source/local/context-gate.yml +37 -0
- package/engine/compositions/source/local/custom-bash.yml +11 -0
- package/engine/compositions/source/local/prompt-config-engine.yml +13 -0
- package/engine/compositions/source/local/run-code-env.yml +12 -0
- package/engine/compositions/source/local/skill-search.yml +11 -0
- package/engine/compositions/source/local/tool-bootstrap.yml +13 -0
- package/engine/context-gate.mjs +305 -0
- package/{preset → engine}/custom-bash.mjs +243 -243
- package/engine/executor.mjs +278 -0
- package/engine/fillers.mjs +273 -0
- package/engine/interpolate.mjs +66 -0
- package/engine/layers.mjs +224 -0
- package/engine/prompt-config-engine.mjs +49 -0
- package/engine/run-code-env.mjs +208 -0
- package/engine/schema.mjs +312 -0
- package/engine/session-vars.mjs +52 -0
- package/{preset → engine}/shared.mjs +35 -0
- package/engine/strategies.mjs +213 -0
- package/{preset → engine}/tool-bootstrap.mjs +350 -282
- package/engine/tool-filter.mjs +80 -0
- package/engine/vendor/yaml/LICENSE +13 -0
- package/engine/vendor/yaml/dist/compose/compose-collection.js +88 -0
- package/engine/vendor/yaml/dist/compose/compose-doc.js +43 -0
- package/engine/vendor/yaml/dist/compose/compose-node.js +109 -0
- package/engine/vendor/yaml/dist/compose/compose-scalar.js +86 -0
- package/engine/vendor/yaml/dist/compose/composer.js +219 -0
- package/engine/vendor/yaml/dist/compose/resolve-block-map.js +115 -0
- package/engine/vendor/yaml/dist/compose/resolve-block-scalar.js +198 -0
- package/engine/vendor/yaml/dist/compose/resolve-block-seq.js +49 -0
- package/engine/vendor/yaml/dist/compose/resolve-end.js +37 -0
- package/engine/vendor/yaml/dist/compose/resolve-flow-collection.js +207 -0
- package/engine/vendor/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/engine/vendor/yaml/dist/compose/resolve-props.js +146 -0
- package/engine/vendor/yaml/dist/compose/util-contains-newline.js +34 -0
- package/engine/vendor/yaml/dist/compose/util-empty-scalar-position.js +26 -0
- package/engine/vendor/yaml/dist/compose/util-flow-indent-check.js +15 -0
- package/engine/vendor/yaml/dist/compose/util-map-includes.js +13 -0
- package/engine/vendor/yaml/dist/doc/Document.js +335 -0
- package/engine/vendor/yaml/dist/doc/anchors.js +71 -0
- package/engine/vendor/yaml/dist/doc/applyReviver.js +55 -0
- package/engine/vendor/yaml/dist/doc/createNode.js +88 -0
- package/engine/vendor/yaml/dist/doc/directives.js +176 -0
- package/engine/vendor/yaml/dist/errors.js +57 -0
- package/engine/vendor/yaml/dist/index.js +17 -0
- package/engine/vendor/yaml/dist/log.js +11 -0
- package/engine/vendor/yaml/dist/nodes/Alias.js +116 -0
- package/engine/vendor/yaml/dist/nodes/Collection.js +147 -0
- package/engine/vendor/yaml/dist/nodes/Node.js +38 -0
- package/engine/vendor/yaml/dist/nodes/Pair.js +36 -0
- package/engine/vendor/yaml/dist/nodes/Scalar.js +24 -0
- package/engine/vendor/yaml/dist/nodes/YAMLMap.js +144 -0
- package/engine/vendor/yaml/dist/nodes/YAMLSeq.js +113 -0
- package/engine/vendor/yaml/dist/nodes/addPairToJSMap.js +63 -0
- package/engine/vendor/yaml/dist/nodes/identity.js +36 -0
- package/engine/vendor/yaml/dist/nodes/toJS.js +37 -0
- package/engine/vendor/yaml/dist/parse/cst-scalar.js +214 -0
- package/engine/vendor/yaml/dist/parse/cst-stringify.js +61 -0
- package/engine/vendor/yaml/dist/parse/cst-visit.js +97 -0
- package/engine/vendor/yaml/dist/parse/cst.js +98 -0
- package/engine/vendor/yaml/dist/parse/lexer.js +721 -0
- package/engine/vendor/yaml/dist/parse/line-counter.js +39 -0
- package/engine/vendor/yaml/dist/parse/parser.js +975 -0
- package/engine/vendor/yaml/dist/public-api.js +102 -0
- package/engine/vendor/yaml/dist/schema/Schema.js +37 -0
- package/engine/vendor/yaml/dist/schema/common/map.js +17 -0
- package/engine/vendor/yaml/dist/schema/common/null.js +15 -0
- package/engine/vendor/yaml/dist/schema/common/seq.js +17 -0
- package/engine/vendor/yaml/dist/schema/common/string.js +14 -0
- package/engine/vendor/yaml/dist/schema/core/bool.js +19 -0
- package/engine/vendor/yaml/dist/schema/core/float.js +43 -0
- package/engine/vendor/yaml/dist/schema/core/int.js +38 -0
- package/engine/vendor/yaml/dist/schema/core/schema.js +23 -0
- package/engine/vendor/yaml/dist/schema/json/schema.js +62 -0
- package/engine/vendor/yaml/dist/schema/tags.js +96 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/binary.js +58 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/bool.js +26 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/float.js +46 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/int.js +71 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/merge.js +67 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/omap.js +74 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/pairs.js +78 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/schema.js +39 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/set.js +93 -0
- package/engine/vendor/yaml/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/engine/vendor/yaml/dist/stringify/foldFlowLines.js +146 -0
- package/engine/vendor/yaml/dist/stringify/stringify.js +129 -0
- package/engine/vendor/yaml/dist/stringify/stringifyCollection.js +153 -0
- package/engine/vendor/yaml/dist/stringify/stringifyComment.js +20 -0
- package/engine/vendor/yaml/dist/stringify/stringifyDocument.js +85 -0
- package/engine/vendor/yaml/dist/stringify/stringifyNumber.js +25 -0
- package/engine/vendor/yaml/dist/stringify/stringifyPair.js +150 -0
- package/engine/vendor/yaml/dist/stringify/stringifyString.js +336 -0
- package/engine/vendor/yaml/dist/util.js +11 -0
- package/engine/vendor/yaml/dist/visit.js +233 -0
- package/engine/vendor/yaml/index.js +5 -0
- package/engine/vendor/yaml/package.json +11 -0
- package/lib/client.js +4724 -775
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +530 -51
- package/lib/index.mjs +4164 -740
- package/lib/preset-core.d.mts +7 -37
- package/lib/preset-core.mjs +43 -285
- package/lib/prompt-configs-B4vH09wx.d.mts +100 -0
- package/lib/prompt-configs-ThS4iXPg.mjs +771 -0
- package/package.json +36 -29
- package/preset/anchored/preset.yml +342 -0
- package/preset/creative/preset.yml +65 -0
- package/preset/creative/skills/cordis-plugin-development/SKILL.md +420 -0
- package/preset/creative/skills/editing-cordis-compositions/SKILL.md +165 -0
- package/preset/custom/preset.yml +13 -0
- package/preset/liangshen/preset.yml +72 -0
- package/preset/minimal/preset.yml +44 -0
- package/preset/ptc/preset.yml +56 -0
- package/preset/standard/preset.yml +55 -0
- package/skills/manifest.json +7 -0
- package/skills/sandboxmod/SKILL.md +49 -49
- package/skills/web ui/SKILL.md +42 -0
- package/templates/10-pre-step.yml +28 -0
- package/templates/11-merged-a.yml +11 -0
- package/templates/13-anchor.yml +19 -0
- package/templates/14-first-turn-anchor.yml +27 -0
- package/templates/15-guide-auto.yml +25 -0
- package/templates/16-custom-fallback.yml +21 -0
- package/templates/17-instruction-hint.yml +23 -0
- package/templates/18-placeholder-env-facts.yml +11 -0
- package/templates/19-placeholder-skill-catalog.yml +19 -0
- package/templates/20-system-section.yml +19 -0
- package/templates/30-runtime-context.yml +10 -0
- package/templates/31-runtime-context-placeholder.yml +18 -0
- package/templates/40-agent-request.yml +11 -0
- package/templates/50-llm-stream.yml +9 -0
- package/templates/60-tool-pipeline.yml +12 -0
- package/AGENTS.md +0 -4
- package/plan.md +0 -312
- package/preset/agent.cordis.yml +0 -443
- package/preset/compaction-epoch.mjs +0 -81
- package/preset/context-gate.mjs +0 -165
- package/preset/instruction-hint.mjs +0 -217
- package/preset/near-anchor.mjs +0 -101
- package/preset/preset.yml +0 -3
- package/preset/prompt-injector.mjs +0 -112
- package/preset/router-first-turn.mjs +0 -73
- package/preset/router-guide.mjs +0 -79
- package/preset.md +0 -115
- package/upstream/dsh-anchored-standard/LICENSE +0 -22
- package/upstream/dsh-anchored-standard/NOTICE +0 -19
- package/upstream/dsh-anchored-standard/REVISION +0 -1
- package/upstream/dsh-anchored-standard/preset/agent.cordis.yml +0 -440
- package/upstream/dsh-anchored-standard/preset/compaction-epoch.mjs +0 -81
- package/upstream/dsh-anchored-standard/preset/context-gate.mjs +0 -202
- package/upstream/dsh-anchored-standard/preset/custom-bash.mjs +0 -219
- package/upstream/dsh-anchored-standard/preset/dev-tool-search.mjs +0 -131
- package/upstream/dsh-anchored-standard/preset/instruction-hint.mjs +0 -231
- package/upstream/dsh-anchored-standard/preset/preset.yml +0 -3
- package/upstream/dsh-anchored-standard/preset/skill-search.mjs +0 -142
- package/upstream/dsh-anchored-standard/preset/tool-bootstrap.mjs +0 -301
- /package/{preset → engine}/skill-search.mjs +0 -0
package/lib/preset-core.d.mts
CHANGED
|
@@ -1,40 +1,10 @@
|
|
|
1
|
+
import { a as mergePromptConfigs, i as loadPromptConfigFiles, n as PromptConfigFile, o as renderPromptConfigYaml, r as PromptConfigSpec, t as BuildCordisOptions } from "./prompt-configs-B4vH09wx.mjs";
|
|
1
2
|
//#region src/preset-core.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare function parseFrontmatter(text: string): {
|
|
9
|
-
data: SkillFrontmatter;
|
|
10
|
-
body: string;
|
|
11
|
-
};
|
|
12
|
-
interface BuildCordisOptions {
|
|
13
|
-
/** 首轮近距离锚定:首条真实用户消息后追加一次性首句锚点。 */
|
|
14
|
-
anchorFirstTurn?: boolean;
|
|
15
|
-
/** 自定义锚点文本;anchorCustom=true 时固定使用。 */
|
|
16
|
-
anchorText?: string;
|
|
17
|
-
/** 自定义锚点开关:true 固定使用 anchorText;false 按任务自动选择。 */
|
|
18
|
-
anchorCustom?: boolean;
|
|
19
|
-
/** 自定义每轮引导文本;guideCustom=true 时固定使用。 */
|
|
20
|
-
guideText?: string;
|
|
21
|
-
/** 自定义每轮引导开关:true 固定使用 guideText;false 按任务自动选择。 */
|
|
22
|
-
guideCustom?: boolean;
|
|
23
|
-
/** 锚定确认后注入 preset.md;关闭时仍保留工具引导,但不注册 prompt-injector 行。 */
|
|
24
|
-
injectPrompt?: boolean;
|
|
25
|
-
/** 子代理固定 Flash 模型:true 时给 subagent/subagent_fork 行加 agentOptions。 */
|
|
26
|
-
subagentFlash?: boolean;
|
|
27
|
-
/** 子代理 Flash 路由 provider(默认 deepseek-official)。 */
|
|
28
|
-
subagentFlashProvider?: string;
|
|
29
|
-
/** 子代理 Flash 模型名(默认 deepseek-v4-flash)。 */
|
|
30
|
-
subagentFlashModel?: string;
|
|
31
|
-
/** 首轮输出封顶(bootstrapMaxTokens);0 或未设置 = 本项目默认无封顶。 */
|
|
32
|
-
bootstrapMaxTokens?: number;
|
|
33
|
-
/** 使用 PTC 模式:默认 true——晋升后把 wire 切换为 Code Mode(单一 run_code,完整插件工具经生成 SDK 调用);显式 false 时晋升后恢复原生完整工具目录。 */
|
|
34
|
-
usePtcMode?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/** 给生成的 tool-bootstrap.mjs 打补丁:子代理全量放行 + 可选的 PTC 呈现切换。 */
|
|
37
|
-
declare function patchToolBootstrap(source: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* 渲染 anchored 组合文件:
|
|
5
|
+
* agent.cordis.yml 是模板自带完整组合(含 prompt-config-engine 行),
|
|
6
|
+
* 动态值全部由 preset.yml 的 variables 声明为 __TOKEN__;本函数只做变量替换 + YAML 校验。
|
|
7
|
+
*/
|
|
38
8
|
declare function buildCordis(prompt: string, options?: BuildCordisOptions): string;
|
|
39
9
|
//#endregion
|
|
40
|
-
export { BuildCordisOptions,
|
|
10
|
+
export { type BuildCordisOptions, type PromptConfigFile, type PromptConfigSpec, buildCordis, loadPromptConfigFiles, mergePromptConfigs, renderPromptConfigYaml };
|
package/lib/preset-core.mjs
CHANGED
|
@@ -1,293 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as mergePromptConfigs, o as assertCompositionArray, p as loadPresetSpec, r as renderPromptConfigYaml, t as loadPromptConfigFiles, y as renderComposition } from "./prompt-configs-ThS4iXPg.mjs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { parse } from "yaml";
|
|
4
3
|
//#region src/preset-core.ts
|
|
5
4
|
/**
|
|
6
|
-
* prompt-tool preset
|
|
7
|
-
*
|
|
5
|
+
* prompt-tool preset 核心(兼容层):
|
|
6
|
+
* - buildCordis:按单一参数 preset.yml 渲染 anchored 组合文件(不再做字符串补丁)。
|
|
7
|
+
* 新代码请使用 src/host/ 下的 manifest / write-preset / prompt-configs / templates。
|
|
8
|
+
*/
|
|
9
|
+
const ANCHORED_TEMPLATE_DIR = fileURLToPath(new URL("../preset/anchored/", import.meta.url));
|
|
10
|
+
/**
|
|
11
|
+
* 渲染 anchored 组合文件:
|
|
12
|
+
* agent.cordis.yml 是模板自带完整组合(含 prompt-config-engine 行),
|
|
13
|
+
* 动态值全部由 preset.yml 的 variables 声明为 __TOKEN__;本函数只做变量替换 + YAML 校验。
|
|
8
14
|
*/
|
|
9
|
-
const CORDIS_TEMPLATE = fileURLToPath(new URL("../preset/agent.cordis.yml", import.meta.url));
|
|
10
|
-
const ROUTER_FIRST_TURN_BLOCK = `# prompt-tool 本地附加件(最优组合):首轮只保留计划段 + 训练原句,
|
|
11
|
-
# 并清空自动注入 contexts;子代理直接放行。注册在 tool-bootstrap 之后,
|
|
12
|
-
# 不参与首轮工具目录裁剪——tools 仍由原版 tool-bootstrap 负责。
|
|
13
|
-
- id: router-first-turn
|
|
14
|
-
name: ./router-first-turn.mjs
|
|
15
|
-
`;
|
|
16
|
-
const ROUTER_GUIDE_BLOCK = `# Flash 主会话每轮近距离深度引导(dsh-router-standard 方案)。
|
|
17
|
-
# 模型为 Flash 且会话晋升后,每个真实用户消息之后追加固定引导。
|
|
18
|
-
# useCustom=true 时固定使用 text;false 按任务自动选择。
|
|
19
|
-
- id: router-guide
|
|
20
|
-
name: ./router-guide.mjs
|
|
21
|
-
config:
|
|
22
|
-
text: |-
|
|
23
|
-
__GUIDE_TEXT__
|
|
24
|
-
useCustom: __USE_GUIDE_CUSTOM__
|
|
25
|
-
enabled: __GUIDE_ENABLED__
|
|
26
|
-
`;
|
|
27
|
-
const NEAR_ANCHOR_BLOCK = `# prompt-tool 近距离首句锚定:在首条真实用户消息之后追加一次性锚点。
|
|
28
|
-
# 不拆轮、不挪任务;useCustom=false 时按任务自动选择 we/let 首句,
|
|
29
|
-
# useCustom=true 时固定使用 anchorText。
|
|
30
|
-
- id: near-anchor
|
|
31
|
-
name: ./near-anchor.mjs
|
|
32
|
-
config:
|
|
33
|
-
anchorText: |-
|
|
34
|
-
__ANCHOR_TEXT__
|
|
35
|
-
useCustom: __USE_CUSTOM__
|
|
36
|
-
`;
|
|
37
|
-
const LOCAL_INJECTOR_BLOCK = `# prompt-tool 附加件:锚定确认后注入 preset.md。注册在工具引导之后,
|
|
38
|
-
# 不参与首轮剥离顺序;tools / 上下文剥离由 tool-bootstrap 与
|
|
39
|
-
# router-first-turn 负责(首轮 = Minimal 真实 schema + 训练原句)。
|
|
40
|
-
- id: prompt-injector
|
|
41
|
-
name: ./prompt-injector.mjs
|
|
42
|
-
config:
|
|
43
|
-
promptText: |-
|
|
44
|
-
__PROMPT_TOOL_TEXT__
|
|
45
|
-
`;
|
|
46
|
-
function parseFrontmatter(text) {
|
|
47
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text);
|
|
48
|
-
if (!match) return {
|
|
49
|
-
data: {},
|
|
50
|
-
body: text
|
|
51
|
-
};
|
|
52
|
-
const data = {};
|
|
53
|
-
const doc = parse(match[1], { logLevel: "silent" });
|
|
54
|
-
if (doc !== null && typeof doc === "object") {
|
|
55
|
-
if (typeof doc.name === "string") data.name = doc.name;
|
|
56
|
-
if (typeof doc.description === "string") data.description = doc.description;
|
|
57
|
-
if (typeof doc.whenToUse === "string") data.whenToUse = doc.whenToUse;
|
|
58
|
-
if (doc.metadata !== null && typeof doc.metadata === "object") data.metadata = doc.metadata;
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
data,
|
|
62
|
-
body: text.slice(match[0].length)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/** dsh-router-standard 的 Flash 弱路由 persona(子代理版)。 */
|
|
66
|
-
const ROUTER_FLASH_PERSONA = [
|
|
67
|
-
"You are a helpful assistant.",
|
|
68
|
-
"Before acting, decide the task type (build or fix) and adopt the matching style: build → hands-on production; fix → inspect-and-plan.",
|
|
69
|
-
"Before acting, briefly review what you have already done in this session and continue from where you left off; do not repeat completed steps. Do not run environment checks (echo, whoami, uname, node --version, date) or exhaustive grep/glob scans.",
|
|
70
|
-
"Think deeply first, then produce."
|
|
71
|
-
].join("\n");
|
|
72
|
-
/** 按开关向本地 tool-bootstrap 行注入 usePtcMode / bootstrapMaxTokens。 */
|
|
73
|
-
function applyToolBootstrapOptions(source, usePtcMode, bootstrapMaxTokens) {
|
|
74
|
-
const rowStart = source.indexOf("- id: tool-bootstrap\n name: ./tool-bootstrap.mjs\n config:\n");
|
|
75
|
-
if (rowStart < 0) throw new Error("preset/agent.cordis.yml missing tool-bootstrap config block");
|
|
76
|
-
const include = source.indexOf(" includeSubagents: true\n", rowStart);
|
|
77
|
-
if (include < 0) throw new Error("preset/agent.cordis.yml tool-bootstrap row missing includeSubagents");
|
|
78
|
-
const at = include + 26 + 1;
|
|
79
|
-
const lines = [` usePtcMode: ${usePtcMode}`];
|
|
80
|
-
if (bootstrapMaxTokens !== void 0 && Number.isSafeInteger(bootstrapMaxTokens) && bootstrapMaxTokens > 0) lines.push(` bootstrapMaxTokens: ${bootstrapMaxTokens}`);
|
|
81
|
-
return source.slice(0, at) + lines.join("\n") + "\n" + source.slice(at);
|
|
82
|
-
}
|
|
83
|
-
/** 给 subagent/subagent_fork 行加 dsh-router-standard 的 Flash 子代理方案;关闭时保持继承主会话路由。 */
|
|
84
|
-
function applySubagentFlash(source, enabled, provider, model) {
|
|
85
|
-
if (!enabled) return source;
|
|
86
|
-
const agentOptions = ` agentOptions:
|
|
87
|
-
provider: ${provider}
|
|
88
|
-
model: ${model}`;
|
|
89
|
-
const persona = ROUTER_FLASH_PERSONA.split("\n").map((line) => ` ${line}`).join("\n");
|
|
90
|
-
const targets = [{
|
|
91
|
-
id: "tool-subagent",
|
|
92
|
-
toolName: "subagent",
|
|
93
|
-
provider: "spawn"
|
|
94
|
-
}, {
|
|
95
|
-
id: "tool-subagent-fork",
|
|
96
|
-
toolName: "subagent_fork",
|
|
97
|
-
provider: "fork"
|
|
98
|
-
}];
|
|
99
|
-
let out = source;
|
|
100
|
-
for (const target of targets) {
|
|
101
|
-
const block = ` - id: ${target.id}
|
|
102
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
103
|
-
config:
|
|
104
|
-
provider: ${target.provider}
|
|
105
|
-
toolName: ${target.toolName}
|
|
106
|
-
backgroundMode: continuable`;
|
|
107
|
-
const replaced = `${block}
|
|
108
|
-
${agentOptions}
|
|
109
|
-
persona: |-
|
|
110
|
-
${persona}`;
|
|
111
|
-
if (!out.includes(block)) throw new Error(`preset/agent.cordis.yml missing ${target.id} row`);
|
|
112
|
-
out = out.replace(block, replaced);
|
|
113
|
-
}
|
|
114
|
-
return out;
|
|
115
|
-
}
|
|
116
|
-
/** 给生成的 tool-bootstrap.mjs 打补丁:子代理全量放行 + 可选的 PTC 呈现切换。 */
|
|
117
|
-
function patchToolBootstrap(source) {
|
|
118
|
-
source = source.replace(/\r\n/g, "\n");
|
|
119
|
-
const original = [
|
|
120
|
-
" const assembled = await next()",
|
|
121
|
-
" try {",
|
|
122
|
-
" const status = promotion.status(context.agent)"
|
|
123
|
-
].join("\n");
|
|
124
|
-
const replacement = [
|
|
125
|
-
" const assembled = await next()",
|
|
126
|
-
" try {",
|
|
127
|
-
" const agent = context.agent",
|
|
128
|
-
" if (agent === undefined) return assembled",
|
|
129
|
-
" // prompt-tool patch: subagents skip catalog narrowing and use assembled tools directly.",
|
|
130
|
-
" // Callers (such as dsh-mnemon) already filter assembled.tools through their own whitelists.",
|
|
131
|
-
" // New plugin tools with any prefix therefore appear in the subagent first session automatically.",
|
|
132
|
-
" agentBySession.set(agent.session, agent)",
|
|
133
|
-
" if ((agent.session?.header?.delegationDepth ?? 0) > 0) {",
|
|
134
|
-
" if (usePtcMode) applyCodePresentation(agent)",
|
|
135
|
-
" return assembled",
|
|
136
|
-
" }",
|
|
137
|
-
" const status = promotion.status(agent)"
|
|
138
|
-
].join("\n");
|
|
139
|
-
if (!source.includes(original)) throw new Error("tool-bootstrap.mjs assembled marker missing");
|
|
140
|
-
source = source.replace(original, replacement);
|
|
141
|
-
const allowedOriginal = "const ALLOWED_KEYS = new Set(['bootstrapTools', 'promoteOn', 'bootstrapMaxTokens', 'compactionTools', 'includeSubagents'])";
|
|
142
|
-
const allowedReplacement = "const ALLOWED_KEYS = new Set(['bootstrapTools', 'promoteOn', 'bootstrapMaxTokens', 'compactionTools', 'includeSubagents', 'usePtcMode'])";
|
|
143
|
-
if (!source.includes(allowedOriginal)) throw new Error("tool-bootstrap.mjs ALLOWED_KEYS marker missing");
|
|
144
|
-
source = source.replace(allowedOriginal, allowedReplacement);
|
|
145
|
-
const parseOriginal = " const includeSubagents = booleanOption(source.includeSubagents, 'includeSubagents', false)";
|
|
146
|
-
const parseReplacement = " const includeSubagents = booleanOption(source.includeSubagents, 'includeSubagents', false)\n const usePtcMode = booleanOption(source.usePtcMode, 'usePtcMode', true)";
|
|
147
|
-
if (!source.includes(parseOriginal)) throw new Error("tool-bootstrap.mjs includeSubagents parse marker missing");
|
|
148
|
-
source = source.replace(parseOriginal, parseReplacement);
|
|
149
|
-
const trackerOriginal = [" const promotion = createEpochPromotion(promoteEvents, { includeSubagents })", " ctx.on('session/event', (session, event) => promotion.observe(session, event))"].join("\n");
|
|
150
|
-
const trackerReplacement = [
|
|
151
|
-
" const promotion = createEpochPromotion(promoteEvents, { includeSubagents })",
|
|
152
|
-
"",
|
|
153
|
-
" // prompt-tool patch: optional Code Mode (PTC) wire presentation after promotion.",
|
|
154
|
-
" const presentationBySession = new WeakMap()",
|
|
155
|
-
" const agentBySession = new WeakMap()",
|
|
156
|
-
" const presentationState = (session) => {",
|
|
157
|
-
" let state = presentationBySession.get(session)",
|
|
158
|
-
" if (state === undefined) {",
|
|
159
|
-
" state = { applied: false, disposer: undefined }",
|
|
160
|
-
" presentationBySession.set(session, state)",
|
|
161
|
-
" }",
|
|
162
|
-
" return state",
|
|
163
|
-
" }",
|
|
164
|
-
" const applyCodePresentation = (agent) => {",
|
|
165
|
-
" const session = agent?.session",
|
|
166
|
-
" if (session === undefined) return",
|
|
167
|
-
" const state = presentationState(session)",
|
|
168
|
-
" if (state.applied) return",
|
|
169
|
-
" const tools = agent.ctx?.tools",
|
|
170
|
-
" if (tools === undefined || typeof tools.presentAs !== 'function') return",
|
|
171
|
-
" state.disposer = tools.presentAs('code')",
|
|
172
|
-
" state.applied = true",
|
|
173
|
-
" }",
|
|
174
|
-
" const releaseCodePresentation = (session) => {",
|
|
175
|
-
" const state = presentationBySession.get(session)",
|
|
176
|
-
" if (state === undefined) return",
|
|
177
|
-
" if (typeof state.disposer === 'function') {",
|
|
178
|
-
" try { state.disposer() } catch { /* never brick the session */ }",
|
|
179
|
-
" }",
|
|
180
|
-
" state.disposer = undefined",
|
|
181
|
-
" state.applied = false",
|
|
182
|
-
" }",
|
|
183
|
-
" ctx.on('session/event', (session, event) => promotion.observe(session, event))",
|
|
184
|
-
"",
|
|
185
|
-
" ctx.on('session/event', (session, event) => {",
|
|
186
|
-
" if (!usePtcMode) return",
|
|
187
|
-
" if (event.type === 'compaction/end') {",
|
|
188
|
-
" releaseCodePresentation(session)",
|
|
189
|
-
" return",
|
|
190
|
-
" }",
|
|
191
|
-
" if (event.type !== 'step/end' && event.type !== 'turn/end') return",
|
|
192
|
-
" const agent = agentBySession.get(session)",
|
|
193
|
-
" if (agent !== undefined && promotion.status(agent).promoted) applyCodePresentation(agent)",
|
|
194
|
-
" })"
|
|
195
|
-
].join("\n");
|
|
196
|
-
if (!source.includes(trackerOriginal)) throw new Error("tool-bootstrap.mjs promotion tracker marker missing");
|
|
197
|
-
source = source.replace(trackerOriginal, trackerReplacement);
|
|
198
|
-
const promotedStart = source.indexOf(" if (status.promoted) {\n // PROMOTED:");
|
|
199
|
-
const promotedEnd = source.indexOf(" // Controlled phase:", promotedStart);
|
|
200
|
-
if (promotedStart < 0 || promotedEnd < 0) throw new Error("tool-bootstrap.mjs promoted/controlled marker missing");
|
|
201
|
-
const promotedReplacement = [
|
|
202
|
-
" if (status.promoted) {",
|
|
203
|
-
" // prompt-tool patch: both modes keep the assembled catalog after promotion.",
|
|
204
|
-
" // usePtcMode switches the wire presentation instead of narrowing resident tools.",
|
|
205
|
-
" if (usePtcMode) applyCodePresentation(agent)",
|
|
206
|
-
" return assembled",
|
|
207
|
-
" }",
|
|
208
|
-
""
|
|
209
|
-
].join("\n");
|
|
210
|
-
source = source.slice(0, promotedStart) + promotedReplacement + source.slice(promotedEnd);
|
|
211
|
-
const residentOriginal = "const RESIDENT_DISCOVERY_TOOLS = ['dev_tool_search', 'skill_search', 'skill_load']\n\n";
|
|
212
|
-
if (source.includes(residentOriginal)) source = source.replace(residentOriginal, "");
|
|
213
|
-
const unlockedStart = source.indexOf("/**\n * Tool names the model explicitly unlocked via `dev_tool_search`");
|
|
214
|
-
const unlockedEnd = source.indexOf(" /** Narrow the assembled catalog", unlockedStart);
|
|
215
|
-
if (unlockedStart >= 0 && unlockedEnd > unlockedStart) source = source.slice(0, unlockedStart) + source.slice(unlockedEnd);
|
|
216
|
-
const headerStart = source.indexOf(" * POST-PROMOTION RESIDENT SET");
|
|
217
|
-
const headerEnd = source.indexOf(" * COMPACTION (local addition)", headerStart);
|
|
218
|
-
if (headerStart >= 0 && headerEnd > headerStart) {
|
|
219
|
-
const headerReplacement = [
|
|
220
|
-
" * POST-PROMOTION CATALOG (prompt-tool patch): after promotion both modes",
|
|
221
|
-
" * keep the assembled catalog. `usePtcMode` switches the wire presentation",
|
|
222
|
-
" * to Code Mode (PTC, single run_code) instead of narrowing the resident set.",
|
|
223
|
-
" * The controlled phase below still narrows the catalog before promotion and",
|
|
224
|
-
" * after compaction.",
|
|
225
|
-
""
|
|
226
|
-
].join(String.fromCharCode(10));
|
|
227
|
-
source = source.slice(0, headerStart) + headerReplacement + source.slice(headerEnd);
|
|
228
|
-
}
|
|
229
|
-
return source;
|
|
230
|
-
}
|
|
231
15
|
function buildCordis(prompt, options = {}) {
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
if (
|
|
264
|
-
const anchorMarker = " anchorText: |-\n __ANCHOR_TEXT__";
|
|
265
|
-
if (!NEAR_ANCHOR_BLOCK.includes(anchorMarker)) throw new Error("internal error: near-anchor template lost its anchorText placeholder");
|
|
266
|
-
const anchorBlock = NEAR_ANCHOR_BLOCK.replace(" useCustom: __USE_CUSTOM__", ` useCustom: ${anchorCustom}`).replace(anchorMarker, " anchorText: |-\n" + (anchorText.length > 0 ? indent(anchorText) : " "));
|
|
267
|
-
parts.push(anchorBlock);
|
|
268
|
-
}
|
|
269
|
-
if (injectPrompt) {
|
|
270
|
-
const promptMarker = " promptText: |-\n __PROMPT_TOOL_TEXT__";
|
|
271
|
-
if (!LOCAL_INJECTOR_BLOCK.includes(promptMarker)) throw new Error("internal error: prompt-injector template lost its promptText placeholder");
|
|
272
|
-
parts.push(LOCAL_INJECTOR_BLOCK.replace(promptMarker, " promptText: |-\n" + indent(prompt)));
|
|
273
|
-
}
|
|
274
|
-
const extra = parts.join("\n");
|
|
275
|
-
const out = head + separator + extra + "\n" + tail;
|
|
276
|
-
if (injectPrompt && out.includes("__PROMPT_TOOL_TEXT__") || anchorFirstTurn && (out.includes("__ANCHOR_TEXT__") || out.includes("__USE_CUSTOM__")) || out.includes("__GUIDE_TEXT__") || out.includes("__USE_GUIDE_CUSTOM__") || out.includes("__GUIDE_ENABLED__")) throw new Error("internal error: preset template placeholder was not replaced");
|
|
277
|
-
let parsed;
|
|
278
|
-
try {
|
|
279
|
-
parsed = parse(out, { logLevel: "silent" });
|
|
280
|
-
} catch (error) {
|
|
281
|
-
throw new Error(`generated agent.cordis.yml is invalid YAML: ${String(error.message ?? error)}`);
|
|
282
|
-
}
|
|
283
|
-
if (!Array.isArray(parsed)) throw new Error("generated agent.cordis.yml is not a YAML array");
|
|
284
|
-
const ids = new Set(parsed.map((row) => row?.id));
|
|
285
|
-
if (!ids.has("router-first-turn")) throw new Error("generated agent.cordis.yml is missing the router-first-turn row");
|
|
286
|
-
if (injectPrompt && !ids.has("prompt-injector")) throw new Error("generated agent.cordis.yml is missing the prompt-injector row");
|
|
287
|
-
if (!injectPrompt && ids.has("prompt-injector")) throw new Error("generated agent.cordis.yml still contains the prompt-injector row");
|
|
288
|
-
if (anchorFirstTurn && !ids.has("near-anchor")) throw new Error("generated agent.cordis.yml is missing the near-anchor row");
|
|
289
|
-
if (!anchorFirstTurn && ids.has("near-anchor")) throw new Error("generated agent.cordis.yml still contains the near-anchor row");
|
|
16
|
+
const spec = loadPresetSpec(ANCHORED_TEMPLATE_DIR);
|
|
17
|
+
const runtime = {
|
|
18
|
+
promptText: prompt,
|
|
19
|
+
firstTurnAnchor: options.firstTurnAnchor === true,
|
|
20
|
+
firstTurnCustom: options.firstTurnCustom === true,
|
|
21
|
+
firstTurnText: typeof options.firstTurnText === "string" ? options.firstTurnText : "",
|
|
22
|
+
guideCustom: options.guideCustom === true,
|
|
23
|
+
guideText: typeof options.guideText === "string" ? options.guideText : "",
|
|
24
|
+
injectPrompt: options.injectPrompt !== false,
|
|
25
|
+
usePtcMode: options.usePtcMode !== false,
|
|
26
|
+
bootstrapMaxTokens: Number.isSafeInteger(options.bootstrapMaxTokens) && (options.bootstrapMaxTokens ?? 0) > 0 ? options.bootstrapMaxTokens : 0,
|
|
27
|
+
modelProvider: typeof options.modelProvider === "string" && options.modelProvider.length > 0 ? options.modelProvider : "",
|
|
28
|
+
modelName: typeof options.modelName === "string" && options.modelName.length > 0 ? options.modelName : "",
|
|
29
|
+
subagentModelProvider: typeof options.subagentModelProvider === "string" && options.subagentModelProvider.length > 0 ? options.subagentModelProvider : "",
|
|
30
|
+
subagentModelName: typeof options.subagentModelName === "string" && options.subagentModelName.length > 0 ? options.subagentModelName : "",
|
|
31
|
+
modelReasoningEffort: typeof options.modelReasoningEffort === "string" ? options.modelReasoningEffort : "",
|
|
32
|
+
modelTemperature: typeof options.modelTemperature === "string" ? options.modelTemperature : "",
|
|
33
|
+
modelMaxTokens: typeof options.modelMaxTokens === "string" ? options.modelMaxTokens : "",
|
|
34
|
+
subagentReasoningEffort: typeof options.subagentReasoningEffort === "string" ? options.subagentReasoningEffort : "",
|
|
35
|
+
subagentTemperature: typeof options.subagentTemperature === "string" ? options.subagentTemperature : "",
|
|
36
|
+
subagentMaxTokens: typeof options.subagentMaxTokens === "string" ? options.subagentMaxTokens : "",
|
|
37
|
+
subagentPersona: typeof options.subagentPersona === "string" && options.subagentPersona.length > 0 ? options.subagentPersona : "",
|
|
38
|
+
toolFilterAllow: options.toolFilterAllow,
|
|
39
|
+
toolFilterDeny: options.toolFilterDeny,
|
|
40
|
+
maxDepth: options.maxDepth,
|
|
41
|
+
allowKinds: options.allowKinds,
|
|
42
|
+
firstTurnWord: typeof options.firstTurnWord === "string" && options.firstTurnWord.length > 0 ? options.firstTurnWord : void 0
|
|
43
|
+
};
|
|
44
|
+
const out = renderComposition(spec, runtime, ANCHORED_TEMPLATE_DIR);
|
|
45
|
+
const parsed = assertCompositionArray(out, spec);
|
|
46
|
+
if (!new Set(parsed.map((row) => row?.id)).has("prompt-config-engine")) throw new Error("generated agent.cordis.yml is missing the prompt-config-engine row");
|
|
47
|
+
if (parsed.find((row) => row?.id === "prompt-config-engine")?.config?.configsDir !== "../prompt-configs") throw new Error("generated agent.cordis.yml prompt-config-engine row must point configsDir at ../prompt-configs");
|
|
290
48
|
return out;
|
|
291
49
|
}
|
|
292
50
|
//#endregion
|
|
293
|
-
export { buildCordis,
|
|
51
|
+
export { buildCordis, loadPromptConfigFiles, mergePromptConfigs, renderPromptConfigYaml };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/host/prompt-configs.d.ts
|
|
2
|
+
interface PromptConfigSpec {
|
|
3
|
+
id: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
strategy?: string;
|
|
7
|
+
layer?: string;
|
|
8
|
+
configKind?: 'ordered' | 'anchor';
|
|
9
|
+
order?: number;
|
|
10
|
+
role?: 'user' | 'assistant';
|
|
11
|
+
group?: string;
|
|
12
|
+
exclusive?: boolean;
|
|
13
|
+
position?: 'after-user' | 'before-all' | 'after-all';
|
|
14
|
+
dedupe?: 'session' | 'batch' | 'none';
|
|
15
|
+
promotion?: 'none' | 'main' | 'include-subagents';
|
|
16
|
+
/** 消息受众:缺省(省略/null)= 公用(主会话+子代理);main=仅主会话;subagent=仅子代理。 */
|
|
17
|
+
audience?: 'main' | 'subagent' | null;
|
|
18
|
+
modelScope?: 'all' | 'pro' | 'flash';
|
|
19
|
+
sourceKind?: string;
|
|
20
|
+
form?: string;
|
|
21
|
+
summary?: string;
|
|
22
|
+
identity?: {
|
|
23
|
+
field: 'plugin' | 'kind';
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
text?: string;
|
|
27
|
+
/** 单条提示词配置的多段文本:注入为一条消息的多个 text 内容块。 */
|
|
28
|
+
texts?: string[];
|
|
29
|
+
/** 同位置多条提示词配置的插入方式:separate=先后插入独立消息(默认);merged=拼接为一条消息。 */
|
|
30
|
+
mergeMode?: 'separate' | 'merged';
|
|
31
|
+
templateFile?: string;
|
|
32
|
+
fill?: string;
|
|
33
|
+
variables?: Record<string, string>;
|
|
34
|
+
params?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
interface PromptConfigFile {
|
|
37
|
+
/** 模块文件夹内文件名(数字前缀决定引擎执行顺序)。 */
|
|
38
|
+
file: string;
|
|
39
|
+
/** yml 文件内容。 */
|
|
40
|
+
content: string;
|
|
41
|
+
}
|
|
42
|
+
/** buildCordis 兼容层的运行时选项(生产路径为 writePreset + preset.yml 数据驱动)。 */
|
|
43
|
+
interface BuildCordisOptions {
|
|
44
|
+
/** 首轮近距离锚定:首条真实用户消息后追加一次性首句锚点。 */
|
|
45
|
+
firstTurnAnchor?: boolean;
|
|
46
|
+
/** 自定义锚点文本;firstTurnCustom=true 时固定使用。 */
|
|
47
|
+
firstTurnText?: string;
|
|
48
|
+
/** 自定义锚点开关:true 固定使用 firstTurnText;false 按任务自动选择。 */
|
|
49
|
+
firstTurnCustom?: boolean;
|
|
50
|
+
/** 自定义每轮引导文本;guideCustom=true 时固定使用。 */
|
|
51
|
+
guideText?: string;
|
|
52
|
+
/** 自定义每轮引导开关:true 固定使用 guideText;false 按任务自动选择。 */
|
|
53
|
+
guideCustom?: boolean;
|
|
54
|
+
/** 锚定确认后注入 preset.md;关闭时仍保留工具引导,但不生成 prompt-injector 提示词配置内容。 */
|
|
55
|
+
injectPrompt?: boolean;
|
|
56
|
+
/** 模型路由 provider;与模型名同时非空时给 subagent/subagent_fork 行加 agentOptions(主对话直派子代理与委派子代理通用)。 */
|
|
57
|
+
modelProvider?: string;
|
|
58
|
+
/** 模型名;与 provider 同时非空时生效。 */
|
|
59
|
+
modelName?: string;
|
|
60
|
+
/** 子代理固定模型路由 provider(agentOptions 注入 tool-subagent)。 */
|
|
61
|
+
subagentModelProvider?: string;
|
|
62
|
+
/** 子代理固定模型名。 */
|
|
63
|
+
subagentModelName?: string;
|
|
64
|
+
/** 主对话思维程度(agent-request patch reasoningEffort;''=不设置,官方档位 off/low/high/max)。 */
|
|
65
|
+
modelReasoningEffort?: string;
|
|
66
|
+
/** 主对话采样温度(agent-request patch temperature;''=不设置)。 */
|
|
67
|
+
modelTemperature?: string;
|
|
68
|
+
/** 主对话输出上限(agent-request patch maxTokens;''=不设置)。 */
|
|
69
|
+
modelMaxTokens?: string;
|
|
70
|
+
/** 子代理思维程度(agent-request patch,audience=subagent;''=不设置)。 */
|
|
71
|
+
subagentReasoningEffort?: string;
|
|
72
|
+
/** 子代理采样温度(agent-request patch,audience=subagent;''=不设置)。 */
|
|
73
|
+
subagentTemperature?: string;
|
|
74
|
+
/** 子代理输出上限(agent-request patch,audience=subagent;''=不设置)。 */
|
|
75
|
+
subagentMaxTokens?: string;
|
|
76
|
+
/** 子代理自定义模型人设(per-child shadow;缺省 = 经 scope 链继承主会话 persona 模块)。 */
|
|
77
|
+
subagentPersona?: string;
|
|
78
|
+
/** 委派工具集白名单(toolFilter.allow;支持数组或逗号/空格分隔字符串)。 */
|
|
79
|
+
toolFilterAllow?: string[] | string;
|
|
80
|
+
/** 委派工具集黑名单(toolFilter.deny)。 */
|
|
81
|
+
toolFilterDeny?: string[] | string;
|
|
82
|
+
/** 委派递归深度上限(0 禁止委派 / provider-managed / 正整数)。 */
|
|
83
|
+
maxDepth?: number | 'provider-managed';
|
|
84
|
+
/** 注入 kind 白名单(context-gate allowKinds;数组或逗号分隔字符串)。 */
|
|
85
|
+
allowKinds?: string[] | string;
|
|
86
|
+
/** custom-fallback 锚定词(prompt-injector params.firstTurnWord)。 */
|
|
87
|
+
firstTurnWord?: string;
|
|
88
|
+
/** 首轮输出封顶(bootstrapMaxTokens);0 或未设置 = 本项目默认无封顶。 */
|
|
89
|
+
bootstrapMaxTokens?: number;
|
|
90
|
+
/** 使用 PTC 模式:默认 true。 */
|
|
91
|
+
usePtcMode?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** 把任意提示词配置 spec 渲染为独立提示词配置模块 yml(全部字段开放可配置)。 */
|
|
94
|
+
declare function renderPromptConfigYaml(spec: PromptConfigSpec): string;
|
|
95
|
+
/** 多源提示词配置合并:同名 id 后者覆盖(保留默认提示词配置位置),新 id 追加在末尾。 */
|
|
96
|
+
declare function mergePromptConfigs(...sources: Array<PromptConfigSpec[] | undefined>): PromptConfigSpec[];
|
|
97
|
+
/** 从用户提示词配置目录加载 yml/json 提示词配置(文件名排序;内容必须能解析)。 */
|
|
98
|
+
declare function loadPromptConfigFiles(dir: string): PromptConfigSpec[];
|
|
99
|
+
//#endregion
|
|
100
|
+
export { mergePromptConfigs as a, loadPromptConfigFiles as i, PromptConfigFile as n, renderPromptConfigYaml as o, PromptConfigSpec as r, BuildCordisOptions as t };
|