dsh-plugin-prompt-tool 0.5.0 → 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 +18 -12
- package/engine/anchor-match.mjs +117 -0
- package/engine/compositions/library/context-gate.yml +2 -2
- package/engine/compositions/library/delegation.yml +2 -2
- package/engine/compositions/library/str-replace-editor.yml +1 -1
- package/engine/compositions/library/tool-bootstrap.yml +2 -2
- package/engine/compositions/library/tool-filter.yml +3 -3
- package/engine/compositions/source/local/context-gate.yml +2 -2
- package/engine/compositions/source/local/tool-bootstrap.yml +3 -3
- package/engine/executor.mjs +9 -2
- package/engine/interpolate.mjs +66 -0
- package/engine/layers.mjs +26 -22
- package/engine/schema.mjs +18 -0
- package/engine/session-vars.mjs +52 -0
- package/engine/shared.mjs +0 -19
- package/engine/strategies.mjs +28 -38
- package/lib/client.js +471 -162
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +35 -9
- package/lib/index.mjs +376 -92
- package/lib/preset-core.d.mts +2 -2
- package/lib/preset-core.mjs +3 -6
- package/lib/{prompt-configs-BcP6miu9.d.mts → prompt-configs-B4vH09wx.d.mts} +1 -3
- package/lib/{prompt-configs-k7wuZs0C.mjs → prompt-configs-ThS4iXPg.mjs} +85 -33
- package/package.json +105 -104
- package/preset/anchored/preset.yml +40 -42
- package/preset/creative/preset.yml +33 -30
- package/preset/creative/skills/cordis-plugin-development/SKILL.md +420 -0
- package/preset/creative/skills/editing-cordis-compositions/SKILL.md +165 -0
- package/preset/liangshen/preset.yml +24 -18
- package/preset/minimal/preset.yml +27 -24
- package/preset/ptc/preset.yml +23 -17
- package/preset/standard/preset.yml +23 -17
- package/templates/20-system-section.yml +5 -0
- package/engine/compositions/library/router-first-turn.yml +0 -9
- package/engine/compositions/source/local/router-first-turn.yml +0 -5
- package/engine/router-first-turn.mjs +0 -85
package/lib/index.d.mts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { n as PromptConfigFile, r as PromptConfigSpec } from "./prompt-configs-
|
|
1
|
+
import { n as PromptConfigFile, r as PromptConfigSpec } from "./prompt-configs-B4vH09wx.mjs";
|
|
2
2
|
import { SettingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
3
3
|
import z from "@deepseek-ai/schemastery";
|
|
4
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/shared/param-keys.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* 引擎行为参数键(按预设存储:激活预设 preset.yml 的 params + promptConfigs)。
|
|
8
8
|
* 不进 Config schema、不进 settings namespace——每预设一份,随预设走(官方范式:
|
|
9
9
|
* Config = 部署轴,引擎行为在预设文件)。
|
|
10
|
+
*
|
|
11
|
+
* 这些键在 UI 有专门编辑入口(模型设置 / 工具与深度 / 开关),writePreset 把
|
|
12
|
+
* 预设级 params 合并进每条 promptConfig 的 params 时排除——「params(高级参数
|
|
13
|
+
* JSON)」框只保留内容变量与配置自身策略参数,避免 UI 已管理的参数冗余回写。
|
|
14
|
+
* 放 shared:host(write-preset)与 config/settings-bridge 共用,单一来源。
|
|
10
15
|
*/
|
|
11
16
|
declare const PARAM_KEYS: ReadonlySet<string>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/config.d.ts
|
|
12
19
|
interface Config {
|
|
13
20
|
/** 是否用 AGENTS.md 内容替换本地 instruction-hint 的默认提示文本(默认关闭)。 */
|
|
14
21
|
injectAgentsPrompt: boolean;
|
|
@@ -132,7 +139,7 @@ interface WritePresetOptions {
|
|
|
132
139
|
subagentTemperature?: string;
|
|
133
140
|
/** 子代理输出上限(agent-request patch,audience=subagent;''=不设置)。 */
|
|
134
141
|
subagentMaxTokens?: string;
|
|
135
|
-
/** 子代理自定义模型人设(per-child shadow
|
|
142
|
+
/** 子代理自定义模型人设(per-child shadow;缺省 = 经 scope 链继承主会话 persona 模块)。 */
|
|
136
143
|
subagentPersona?: string;
|
|
137
144
|
/** 委派工具集白名单(toolFilter.allow;支持数组或逗号/空格分隔字符串)。 */
|
|
138
145
|
toolFilterAllow?: string[] | string;
|
|
@@ -140,8 +147,6 @@ interface WritePresetOptions {
|
|
|
140
147
|
toolFilterDeny?: string[] | string;
|
|
141
148
|
/** 委派递归深度上限(0 禁止委派 / provider-managed / 正整数)。 */
|
|
142
149
|
maxDepth?: number | 'provider-managed' | string;
|
|
143
|
-
/** 主对话自定义模型人设(preset.yml mainPersona;覆盖模板默认)。 */
|
|
144
|
-
mainPersona?: string;
|
|
145
150
|
/** 注入 kind 白名单(context-gate allowKinds;数组或逗号分隔字符串)。 */
|
|
146
151
|
allowKinds?: string[] | string;
|
|
147
152
|
/** custom-fallback 锚定词(prompt-injector params.firstTurnWord)。 */
|
|
@@ -193,6 +198,10 @@ interface PresetSpec {
|
|
|
193
198
|
composition?: string;
|
|
194
199
|
/** 扁平参数:全部直读(true/false、数字、字符串),on/off 作为兼容写法。 */
|
|
195
200
|
params?: Record<string, unknown>;
|
|
201
|
+
/** 预设级模板变量({{key}} 插值源;与引擎行为参数 params 分离,顶层 variables 段)。 */
|
|
202
|
+
variables?: Record<string, string>;
|
|
203
|
+
/** 模板变量插值开关(缺省 true = 启用;false = 停用,writePreset 不生成变量文件)。 */
|
|
204
|
+
variablesEnabled?: boolean;
|
|
196
205
|
/** 宿主层默认值(唯一入口):apply 时合并进 Config,settings 仍可覆盖。 */
|
|
197
206
|
hostDefaults?: Record<string, unknown>;
|
|
198
207
|
/** 可选:模板自定义提示词配置覆盖(纯数据,不使用模板语法)。 */
|
|
@@ -230,8 +239,17 @@ declare function listBuiltinTemplates(): Array<{
|
|
|
230
239
|
id: string;
|
|
231
240
|
name: string;
|
|
232
241
|
}>;
|
|
233
|
-
|
|
234
|
-
|
|
242
|
+
interface PromptToolState {
|
|
243
|
+
seeded?: boolean;
|
|
244
|
+
paramsMigrated?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/** 读插件状态;文件缺失/损坏返回空对象(按未标记处理,触发首次动作)。 */
|
|
247
|
+
declare function readPluginState(): PromptToolState;
|
|
248
|
+
/** 原子写插件状态(tmp+rename)。 */
|
|
249
|
+
declare function writePluginState(state: PromptToolState): void;
|
|
250
|
+
/** 首次启动种子化:把插件目录全部内置模板复制到预设根(state.seeded 后不再自动补)。
|
|
251
|
+
* 用户删除的预设不会自动复活;升级新增的模板用「新建」按需复制。
|
|
252
|
+
* 兼容旧版预设根内 .pt-seeded 标记:存在即视为已种子化,并迁入状态文件后删除。 */
|
|
235
253
|
declare function ensurePresetSeed(): {
|
|
236
254
|
created: string[];
|
|
237
255
|
};
|
|
@@ -250,7 +268,7 @@ declare function cloneBuiltinPreset(id: string, autoSuffix?: boolean): {
|
|
|
250
268
|
* (保留 preset.yml 模板默认)。写入后删除 prompt-tool.overrides.yml(旧参数覆盖
|
|
251
269
|
* 通道残留——参数已并入 preset.yml,避免旧值覆盖新值)。
|
|
252
270
|
*/
|
|
253
|
-
declare function savePresetParams(presetRoot: string, templateName: string, params: Record<string, unknown> | undefined, promptConfigs: unknown[] | undefined): void;
|
|
271
|
+
declare function savePresetParams(presetRoot: string, templateName: string, params: Record<string, unknown> | undefined, promptConfigs: unknown[] | undefined, variables?: Record<string, string>, variablesEnabled?: boolean): void;
|
|
254
272
|
/** 删除预设目录(预设根/<id>;含同名导入的 .bak-* 备份目录)。
|
|
255
273
|
* 仅作用于预设根(官方 USER_PRESET_DIR),包内置模板天然不受影响;路径越界与非法 id 拒绝。
|
|
256
274
|
* 删除后宿主 agent-presets 目录列表自然不再出现该预设(官方 roster 即目录列表)。 */
|
|
@@ -274,6 +292,13 @@ declare function resolvePresetParams(spec: PresetSpec, runtime: Record<string, u
|
|
|
274
292
|
*/
|
|
275
293
|
declare function applyModuleConfigs(raw: string, configs: Record<string, Record<string, unknown>> | undefined): string;
|
|
276
294
|
//#endregion
|
|
295
|
+
//#region src/host/sillytavern.d.ts
|
|
296
|
+
/** ST 导入预设 id:必须是官方 agent-presets 可发现的目录名(PRESET_ID =
|
|
297
|
+
* /^[a-z0-9][a-z0-9-]*$/——含中文的目录会被宿主 discovery 静默跳过,会话
|
|
298
|
+
* resume 报 preset not found)。文件名 slug 化(去中文);纯中文名退化为
|
|
299
|
+
* st-<文件名短哈希>(唯一且合法);显示名 name 仍保留中文原名。 */
|
|
300
|
+
declare function stPresetId(baseName: string): string;
|
|
301
|
+
//#endregion
|
|
277
302
|
//#region src/web-surface.d.ts
|
|
278
303
|
/** 从 loader 根 Include 的 baseUrl 推导 profile 目录。 */
|
|
279
304
|
declare function resolveProfileDir(ctx: Context): string | undefined;
|
|
@@ -497,6 +522,7 @@ declare const BRIDGE_ENDPOINTS: {
|
|
|
497
522
|
readonly presetContent: "/preset-content";
|
|
498
523
|
readonly importPreset: "/import-preset";
|
|
499
524
|
readonly paramOverrides: "/param-overrides";
|
|
525
|
+
readonly presetVariables: "/preset-variables";
|
|
500
526
|
readonly importPresetPackage: "/import-preset-package";
|
|
501
527
|
readonly exportPreset: "/export-preset";
|
|
502
528
|
readonly presetDelete: "/preset-delete";
|
|
@@ -538,4 +564,4 @@ declare const name = "prompt-tool";
|
|
|
538
564
|
declare const inject: string[];
|
|
539
565
|
declare function apply(ctx: Context, configIn: Config): void;
|
|
540
566
|
//#endregion
|
|
541
|
-
export { BRIDGE_ENDPOINTS, type BridgeEndpoint, type BridgeErrorPayload, type CachedSkillsReader, Config, PARAM_KEYS, type PresetSpec, type PromptConfigTemplate, type PromptConfigValidationError, type PromptConfigValidationResult, PromptSettingsSchema, SETTINGS_BRIDGE_PREFIX, SKILL_NAME_RE, type SettingsRegistrationHooks, type SkillCatalogEntry, type SkillEntry, type SkillFixResult, type SkillFrontmatter, type WritePresetOptions, apply, applyModuleConfigs, cloneBuiltinPreset, createCachedSkillsReader, detectModels, ensurePresetSeed, ensureSettingsRegistered, ensureWebSurface, fixSkillEntry, inject, installDefaultModelRoute, isValidSkill, listAdvertisedModels, listBuiltinTemplates, listPresets, listSkillFolders, loadPresetSpec, loadPromptTemplates, mergeSkillDirs, migrateLegacyLayout, name, normalizePresetRootDir, parseFrontmatter, readSkills, registerCharacterTools, registerSettingsBridge, registerTuiCommand, registerWorldBookTools, removeUserPreset, resolvePresetDir, resolvePresetParams, resolveProfileDir, resolveProfileSkillsDir, savePresetParams, toKebabName, userPresetsDir, validSkills, validatePromptConfigs, writePreset };
|
|
567
|
+
export { BRIDGE_ENDPOINTS, type BridgeEndpoint, type BridgeErrorPayload, type CachedSkillsReader, Config, PARAM_KEYS, type PresetSpec, type PromptConfigTemplate, type PromptConfigValidationError, type PromptConfigValidationResult, PromptSettingsSchema, SETTINGS_BRIDGE_PREFIX, SKILL_NAME_RE, type SettingsRegistrationHooks, type SkillCatalogEntry, type SkillEntry, type SkillFixResult, type SkillFrontmatter, type WritePresetOptions, apply, applyModuleConfigs, cloneBuiltinPreset, createCachedSkillsReader, detectModels, ensurePresetSeed, ensureSettingsRegistered, ensureWebSurface, fixSkillEntry, inject, installDefaultModelRoute, isValidSkill, listAdvertisedModels, listBuiltinTemplates, listPresets, listSkillFolders, loadPresetSpec, loadPromptTemplates, mergeSkillDirs, migrateLegacyLayout, name, normalizePresetRootDir, parseFrontmatter, readPluginState, readSkills, registerCharacterTools, registerSettingsBridge, registerTuiCommand, registerWorldBookTools, removeUserPreset, resolvePresetDir, resolvePresetParams, resolveProfileDir, resolveProfileSkillsDir, savePresetParams, stPresetId, toKebabName, userPresetsDir, validSkills, validatePromptConfigs, writePluginState, writePreset };
|