dsh-plugin-prompt-tool 1.0.0 → 2.0.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 +38 -29
- package/engine/actions/append-context.mjs +49 -0
- package/engine/actions/assembly.mjs +150 -0
- package/engine/actions/catalog.mjs +92 -0
- package/engine/actions/content.mjs +205 -0
- package/engine/actions/decision.mjs +54 -0
- package/engine/actions/examples.mjs +11 -0
- package/engine/actions/guard.mjs +80 -0
- package/engine/actions/inbox-prepend.mjs +37 -0
- package/engine/actions/index.mjs +100 -0
- package/engine/actions/inject-text.mjs +22 -0
- package/engine/actions/pre-step-filter.mjs +55 -0
- package/engine/actions/registration.mjs +168 -0
- package/engine/actions/request-params.mjs +32 -0
- package/engine/actions/sdk-strip.mjs +30 -0
- package/engine/actions/shared.mjs +71 -0
- package/engine/actions.mjs +2 -931
- package/engine/branch.mjs +44 -0
- package/engine/compaction-epoch.mjs +31 -13
- package/engine/compositions/source/local/dev-tool-search.yml +11 -0
- package/engine/compositions/source/local/instruction-hint.yml +22 -1
- package/engine/compositions/source/local/rule-engine.yml +6 -0
- package/engine/condition.mjs +16 -3
- package/engine/conditions/anchor.mjs +32 -0
- package/engine/conditions/availability.mjs +47 -0
- package/engine/conditions/composite.mjs +83 -0
- package/engine/conditions/count.mjs +140 -0
- package/engine/conditions/evaluation.mjs +41 -0
- package/engine/conditions/examples.mjs +11 -0
- package/engine/conditions/index.mjs +85 -0
- package/engine/conditions/names.mjs +21 -0
- package/engine/conditions/phase.mjs +54 -0
- package/engine/conditions/preset.mjs +94 -0
- package/engine/conditions/scope.mjs +18 -0
- package/engine/conditions/session.mjs +22 -0
- package/engine/conditions/source.mjs +63 -0
- package/engine/conditions/subject.mjs +121 -0
- package/engine/conditions/text.mjs +44 -0
- package/engine/conditions/values.mjs +32 -0
- package/engine/dev-tool-search.mjs +213 -0
- package/engine/executor.mjs +55 -6
- package/engine/fillers.mjs +23 -16
- package/engine/instruction-hint.mjs +34 -22
- package/engine/layers.mjs +135 -49
- package/engine/order.mjs +4 -1
- package/engine/predicates.mjs +2 -753
- package/engine/rule-engine.mjs +40 -0
- package/engine/rule-runtime.mjs +110 -0
- package/engine/rule-spec.mjs +187 -0
- package/engine/schema.mjs +16 -5
- package/engine/shared.mjs +1 -1
- package/engine/strategies.mjs +2 -235
- package/engine/subagent-tool-policy-core.mjs +7 -7
- package/engine/subagent-tool-policy.mjs +20 -10
- package/engine/tool-config-engine.mjs +53 -32
- package/engine/trigger-editor-meta.mjs +2 -21
- package/engine/trigger-spec.mjs +49 -133
- package/lib/client.js +10446 -10820
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +82 -139
- package/lib/index.mjs +826 -1087
- package/lib/migrate-rules.d.mts +1 -0
- package/lib/migrate-rules.mjs +39 -0
- package/lib/module-package-CHPFweqK.mjs +2 -0
- package/lib/module-package-Cnd1_mwx.mjs +2872 -0
- package/lib/{paths-BgL42sSM.d.mts → paths-CyP0IkaM.d.mts} +223 -108
- package/lib/preset-transfer.d.mts +2 -2
- package/lib/preset-transfer.mjs +3 -2
- package/lib/{module-package-Cm3fHHlp.mjs → rules-migration-DJ6vASB5.mjs} +13696 -15557
- package/modules/ponytail/module.yml +381 -147
- package/modules/skill-surface/module.yml +74 -0
- package/modules/tool-surface/module.yml +67 -0
- package/package.json +5 -1
- package/templates/10-pre-step.yml +26 -22
- package/templates/14-first-turn-anchor.yml +25 -21
- package/templates/15-guide-auto.yml +34 -19
- package/templates/16-custom-fallback.yml +27 -15
- package/templates/18-placeholder-env-facts.yml +23 -14
- package/templates/20-system-section.yml +16 -10
- package/templates/30-runtime-context.yml +13 -7
- package/templates/40-agent-request.yml +11 -8
- package/templates/50-llm-stream.yml +14 -6
- package/templates/60-tool-pipeline.yml +15 -9
- package/templates/65-turn-stop.yml +19 -12
- package/templates/66-subagent-start.yml +12 -7
- package/templates/70-subagent-maintenance.yml +35 -29
- package/templates/75-subagent-end.yml +10 -5
- package/templates/80-tool-surface.yml +66 -0
- package/templates/policies/legacy-defaults.yml +34 -0
- package/engine/compositions/source/local/prompt-config-engine.yml +0 -7
- package/engine/prompt-config-engine.mjs +0 -104
- package/modules/ponytail/configs/0000-ponytail-rules.yml +0 -102
- package/modules/ponytail/configs/0010-ponytail-level-full.yml +0 -19
- package/modules/ponytail/configs/0020-ponytail-level-lite.yml +0 -19
- package/modules/ponytail/configs/0030-ponytail-level-ultra.yml +0 -19
package/lib/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SkillSourceKind, A as removeUserModule, B as BridgeEndpoint, C as ensureModuleSeed, Ct as moduleCapability, D as moduleDirExists, E as loadModuleSpec, F as saveModuleParams, G as MAX_CHARACTER_CARD_STREAM_BYTES, H as BridgeRequestMap, I as saveModulePersona, J as SkillCatalogEntry, K as ModuleSummary, L as userModulesDir, M as resolveModuleDir, N as resolveModuleFacts, O as removeModuleCapability, P as resolveModuleParams, Q as SkillPolicyScope, R as withModuleDefinition, S as createModuleCapability, St as isModuleCapabilityPresent, T as listModules, U as BridgeValueMap, V as BridgeErrorPayload, W as MAX_BRIDGE_BODY_BYTES, X as SkillInvocation, Y as SkillContentSnapshot, Z as SkillPolicyChange, _ as ModuleSpec, _t as MODULE_CAPABILITIES, a as installModulePackage, at as ImportChoices, b as buildModuleConfigsFromParams, bt as ModuleSourceMode, c as convertStToModule, ct as RuleDefinition, d as mergeStModulesWithReport, dt as InstructionFileSnapshot, et as SkillsCatalogSnapshot, f as processStText, ft as InstructionFileStatus, g as ModuleCapabilityRemoveResult, gt as InjectionPoint, h as ModuleCapabilityCreateResult, ht as INJECTION_POINT_ORDER, i as exportModulePackage, it as AssetFile, j as renderComposition, k as removeModuleCapabilityDeclaration, l as convertStToModuleWithReport, lt as INSTRUCTION_FILE_STATUSES, m as ModuleCapabilityCreateRequest, mt as ENGINE_RECIPES, n as USER_SKILLS_DIR, nt as invocationForScope, o as moduleImportPreview, ot as ModuleExportRequest, p as stModuleId, pt as MAX_INSTRUCTION_FILE_BYTES, q as SETTINGS_BRIDGE_PREFIX, r as expandModuleSource, rt as scopeOfInvocation, s as StConversionOptions, st as ModuleExportResult, tt as SkillsState, u as mergeStModules, ut as InstructionContextView, v as appendModuleCapabilities, vt as ModuleCapability, w as listBuiltinTemplates, wt as validateCustomToolIdentities, x as cloneBuiltinModule, xt as engineRecipe, y as applyModuleConfigs, yt as ModuleFacts, z as BRIDGE_ENDPOINTS } from "./paths-CyP0IkaM.mjs";
|
|
2
2
|
import { parseDocument } from "yaml";
|
|
3
3
|
import z from "@deepseek-ai/schemastery";
|
|
4
4
|
import { ToolExecution } from "@deepseek-ai/dsh-tools";
|
|
@@ -11,18 +11,21 @@ declare const PARAM_KEYS: ReadonlySet<string>;
|
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/config.d.ts
|
|
13
13
|
interface Config {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
modulesEnabled: Volatile<boolean | undefined>;
|
|
15
|
+
/** 已部署配置的输入兼容;只在读取与显式保存边界归一。 */
|
|
16
|
+
writePreset?: Volatile<boolean | undefined>;
|
|
16
17
|
}
|
|
17
18
|
declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
18
|
-
|
|
19
|
+
modulesEnabled: z<boolean, boolean, "volatile">;
|
|
20
|
+
writePreset: z<boolean, boolean, "volatile">;
|
|
19
21
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
20
|
-
|
|
22
|
+
modulesEnabled: z<boolean, boolean, "volatile">;
|
|
23
|
+
writePreset: z<boolean, boolean, "volatile">;
|
|
21
24
|
}>>, "plain">;
|
|
22
25
|
interface PromptSettings {
|
|
23
26
|
/** 运行时检测:是否检测到任何模型服务商(不写入 settings)。 */
|
|
24
27
|
modelsAvailable: boolean;
|
|
25
|
-
|
|
28
|
+
modulesEnabled: boolean;
|
|
26
29
|
}
|
|
27
30
|
//#endregion
|
|
28
31
|
//#region src/shared/legacy-prompt-params.d.ts
|
|
@@ -125,11 +128,11 @@ interface EngineParams {
|
|
|
125
128
|
}
|
|
126
129
|
type EngineParamKey = keyof EngineParams;
|
|
127
130
|
/**
|
|
128
|
-
*
|
|
129
|
-
* RuntimeOptions(装配态)与
|
|
130
|
-
*
|
|
131
|
+
* writeModule 实际透传进运行时 params 的引擎参数子集。
|
|
132
|
+
* RuntimeOptions(装配态)与 WriteModuleOptions(写入态)都从这里派生,
|
|
133
|
+
* 防止「加参数只改一处、模块写者忘透传」的静默漂移(如 stageAdvanceDescription 历史事故)。
|
|
131
134
|
*/
|
|
132
|
-
type
|
|
135
|
+
type ModuleWriterParams = Partial<EngineParams & LegacyPromptParams>;
|
|
133
136
|
/**
|
|
134
137
|
* 数值型引擎参数保存前校验(与 write-preset.modelRequestConfigs 消费规则同源)。
|
|
135
138
|
* 保存层响亮失败(400 逐字段错误),渲染层保持宽容(never-brick):
|
|
@@ -148,8 +151,8 @@ interface EngineParamValueError {
|
|
|
148
151
|
message: string;
|
|
149
152
|
}
|
|
150
153
|
declare const ENGINE_PARAM_KEYS: EngineParamKey[];
|
|
151
|
-
/**
|
|
152
|
-
declare const WRITER_PARAM_KEYS: ("firstTurnAnchor" | "firstTurnText" | "firstTurnCustom" | "guideText" | "guideCustom" | "guideEnabled" | "injectPrompt" | "firstTurnWord" | "buildPattern" | "complexPattern" | "firstTurnBuild" | "firstTurnInspect" | "firstTurnDeep" | "guideWeak" | "guideDeep"
|
|
154
|
+
/** writeModule 实际透传键:全部引擎参数可直接进入 writer。 */
|
|
155
|
+
declare const WRITER_PARAM_KEYS: (keyof EngineParams | "firstTurnAnchor" | "firstTurnText" | "firstTurnCustom" | "guideText" | "guideCustom" | "guideEnabled" | "injectPrompt" | "firstTurnWord" | "buildPattern" | "complexPattern" | "firstTurnBuild" | "firstTurnInspect" | "firstTurnDeep" | "guideWeak" | "guideDeep")[];
|
|
153
156
|
/**
|
|
154
157
|
* 校验参数键值(键集合合法性由调用方白名单先行校验,本函数同样拒绝未知键)。
|
|
155
158
|
* 返回逐字段错误;空数组 = 通过。类型收窄:布尔/字符串/数值/列表各按 canonical
|
|
@@ -229,12 +232,6 @@ interface PromptConfigSpec {
|
|
|
229
232
|
declare function assertSafeConfigId(id: string): void;
|
|
230
233
|
/** 生成文件名统一 4 位零填充前缀(0000-…),超过 10 条后字典序仍稳定。 */
|
|
231
234
|
declare function configFileName(index: number, id: string): string;
|
|
232
|
-
interface PromptConfigFile {
|
|
233
|
-
/** 模块文件夹内文件名(数字前缀决定引擎执行顺序)。 */
|
|
234
|
-
file: string;
|
|
235
|
-
/** yml 文件内容。 */
|
|
236
|
-
content: string;
|
|
237
|
-
}
|
|
238
235
|
/**
|
|
239
236
|
* 条件判定的键集合:与 `engine/anchor-match.mjs` 的匹配语义同构。
|
|
240
237
|
* 键按字面文本匹配(正则元字符会被转义);要写正则须用 `/pattern/flags` 形态或 `useRegex: true`。
|
|
@@ -249,31 +246,38 @@ interface PromptConfigMatch {
|
|
|
249
246
|
}
|
|
250
247
|
//#endregion
|
|
251
248
|
//#region src/host/write-preset.d.ts
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
249
|
+
interface WriteModuleOptions {
|
|
250
|
+
modulesRoot: string;
|
|
251
|
+
moduleId: string;
|
|
252
|
+
targetModuleId?: string;
|
|
253
|
+
sourceDir?: string;
|
|
254
|
+
/** 返回独立暂存根下的合法模块目录;安装方负责交换与清理暂存根。 */
|
|
255
|
+
stageOnly?: boolean;
|
|
259
256
|
agentsInstructionText?: string;
|
|
257
|
+
warn?: (message: string) => void;
|
|
258
|
+
}
|
|
259
|
+
/** 旧入口只做名称适配;行为规则和参数必须已写入完整定义。 */
|
|
260
|
+
interface WritePresetOptions extends ModuleWriterParams {
|
|
260
261
|
moduleDir: string;
|
|
261
|
-
/** @deprecated 模块排序归模块定义;该旧输入已不再覆盖顶层 order。 */
|
|
262
|
-
presetOrder?: number;
|
|
263
|
-
/** settings 层用户自定义提示词配置(优先级最高)。 */
|
|
264
|
-
promptConfigs: PromptConfigSpec[];
|
|
265
|
-
/** 当前模块目录名;默认 pt-standard。 */
|
|
266
262
|
presetTemplate?: string;
|
|
267
|
-
/** 输出目录/模块 id 覆盖;缺省 = presetTemplate 同名输出。 */
|
|
268
263
|
outputId?: string;
|
|
269
|
-
/** 隔离的定义/资源来源;与最终 outputId 分离,不回退同名已安装模块。 */
|
|
270
264
|
sourceDir?: string;
|
|
271
|
-
/** 只生成并返回暂存目录;调用方负责安装或清理,不更新共享引擎及目标目录。 */
|
|
272
265
|
materializeOnly?: boolean;
|
|
273
|
-
|
|
266
|
+
agentsInstructionText?: string;
|
|
267
|
+
presetOrder?: number;
|
|
268
|
+
promptConfigs?: PromptConfigSpec[];
|
|
274
269
|
warn?: (message: string) => void;
|
|
275
270
|
}
|
|
276
|
-
/**
|
|
271
|
+
/** 按模块身份原地恢复切片;用户资产、正文与完整定义均不重写。 */
|
|
272
|
+
declare function ensureModuleReady(id: string, options: {
|
|
273
|
+
modulesRoot?: string;
|
|
274
|
+
moduleDir?: string;
|
|
275
|
+
presetOrder?: number;
|
|
276
|
+
warn?: (message: string) => void;
|
|
277
|
+
}): string;
|
|
278
|
+
/** 已有同一模块只恢复切片;导入/复制先完整生成合法身份候选,再交换目标。 */
|
|
279
|
+
declare function writeModule(prompt: string, options: WriteModuleOptions): string;
|
|
280
|
+
/** @deprecated 使用 writeModule;旧字段仅在此边界适配。 */
|
|
277
281
|
declare function writePreset(prompt: string, options: WritePresetOptions): string;
|
|
278
282
|
//#endregion
|
|
279
283
|
//#region src/host/agents-cards.d.ts
|
|
@@ -372,6 +376,8 @@ interface PreStepPromptConfig {
|
|
|
372
376
|
}
|
|
373
377
|
interface PreStepSource {
|
|
374
378
|
configs: readonly PreStepPromptConfig[];
|
|
379
|
+
/** 已编译的本地点规则动作;执行与配置叶子共享同一批次资格帧。 */
|
|
380
|
+
ruleActions?: readonly unknown[];
|
|
375
381
|
officialInstructions?: boolean;
|
|
376
382
|
}
|
|
377
383
|
interface PreStepCoordinatorOptions {
|
|
@@ -509,9 +515,9 @@ interface SkillsBridgeState {
|
|
|
509
515
|
* 生成目录里属于其他工作区的文件卡不再展示(写盘白名单也不含它们);
|
|
510
516
|
* 当前工作区里没有对应生成卡的文件按默认文件卡补齐。
|
|
511
517
|
*/
|
|
512
|
-
declare function mergeInstructionCards(
|
|
518
|
+
declare function mergeInstructionCards(moduleCards: readonly unknown[], files: readonly InstructionFileSnapshot[]): unknown[];
|
|
513
519
|
/** 自建 loopback settings bridge:替代 registerConfigurableProviders,避免模型设置区出现插件条目。 */
|
|
514
|
-
declare function registerSettingsBridge(ctx: Context, ns: string, getModelsState: () => ModelDetection, getSkillsState: () => SkillsBridgeState,
|
|
520
|
+
declare function registerSettingsBridge(ctx: Context, ns: string, getModelsState: () => ModelDetection, getSkillsState: () => SkillsBridgeState, _getEngineStrategyDir: () => string, afterSkillsChange?: () => void,
|
|
515
521
|
/**
|
|
516
522
|
* 生成目录(模块目录):读取/写入哪一份提示词配置。
|
|
517
523
|
*
|
|
@@ -519,20 +525,28 @@ declare function registerSettingsBridge(ctx: Context, ns: string, getModelsState
|
|
|
519
525
|
* 没给则由 host 回退启用表首项。编辑器因此不必依赖某个全局单选——配置卡自己的
|
|
520
526
|
* 模块身份决定写哪里。
|
|
521
527
|
*/
|
|
522
|
-
|
|
528
|
+
getModuleDirectory?: (moduleId?: string) => string,
|
|
523
529
|
/** 内容导入完成回调:批量 scope 只触发一次重建(更新运行时文本并重建模块)。 */
|
|
524
|
-
|
|
530
|
+
afterModuleContentImport?: (scopes: Array<'preset' | 'agents'>, moduleId?: string) => void | Promise<void>,
|
|
525
531
|
/** 参数写入后重建指定模块;省略身份表示启用表变化,刷新全部运行实例。 */
|
|
526
532
|
afterOverridesChange?: (moduleId?: string) => void | Promise<void>,
|
|
527
533
|
/** 模块已完整安装后的刷新回调;失败返回未生效诊断,不再物化或撤销安装。 */
|
|
528
|
-
|
|
529
|
-
/** 能力/recipe
|
|
534
|
+
afterModulePackageImport?: (id: string) => void | Promise<void>,
|
|
535
|
+
/** 能力/recipe 提交后刷新回调;失败保留已提交定义并明确报告。 */
|
|
530
536
|
afterCapabilityChange?: (moduleId?: string) => void | Promise<void>,
|
|
531
537
|
/** 新建、复制或删除模块后重建当前模块。 */
|
|
532
|
-
|
|
538
|
+
afterModuleListChange?: (id: string) => void | Promise<void>): {
|
|
533
539
|
invalidateDescriptor: () => void;
|
|
534
540
|
};
|
|
535
541
|
//#endregion
|
|
542
|
+
//#region src/host/module-layer-settings.d.ts
|
|
543
|
+
declare class ModuleLayerSettingsError extends Error {
|
|
544
|
+
readonly code = "module-layer-settings-invalid";
|
|
545
|
+
constructor(message: string);
|
|
546
|
+
}
|
|
547
|
+
/** 仅消费当前 layerSettings;其余段作为未知字段留存,不投影为运行时参数。 */
|
|
548
|
+
declare function readModuleLayerSettings(source: unknown): Record<string, unknown>;
|
|
549
|
+
//#endregion
|
|
536
550
|
//#region src/host/worldbook.d.ts
|
|
537
551
|
type WorldBookEntry = Record<string, unknown>;
|
|
538
552
|
/** buildWorldBookEntry 输入(两通道共用:ST 导入转换与模型 world_book_upsert 工具)。 */
|
|
@@ -597,32 +611,6 @@ type SkillsImportResult = {
|
|
|
597
611
|
/** 浏览器上传:base64 文件列表;单技能包(无顶层目录)按 frontmatter.name 归类。 */
|
|
598
612
|
declare function importSkillsPackage(root: string, files: SkillsImportFile[], overwrite?: readonly string[]): SkillsImportResult;
|
|
599
613
|
//#endregion
|
|
600
|
-
//#region src/runtime/configs-validate.d.ts
|
|
601
|
-
interface PromptConfigValidationError {
|
|
602
|
-
/** 数组下标;结构层整组错误为 -1。 */
|
|
603
|
-
index: number;
|
|
604
|
-
/** 该条配置的 id(缺失或非字符串时为空串)。 */
|
|
605
|
-
id: string;
|
|
606
|
-
/** 引擎或结构层错误消息(保留 configs[i] 前缀)。 */
|
|
607
|
-
message: string;
|
|
608
|
-
}
|
|
609
|
-
interface PromptConfigValidationResult {
|
|
610
|
-
valid: boolean;
|
|
611
|
-
errors: PromptConfigValidationError[];
|
|
612
|
-
/** valid=true 时回显归一化前的输入数组(调用方预览用)。 */
|
|
613
|
-
configs?: PromptConfigSpec[];
|
|
614
|
-
/** valid=true 时逐条渲染的 yml 模块预览(与生成目录同构)。 */
|
|
615
|
-
files?: PromptConfigFile[];
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* 逐条调用引擎权威校验并渲染预览文件。
|
|
619
|
-
* 逐条(而非整组一次)校验保证一条坏配置不吞掉其余错误,且 index 可直接映射。
|
|
620
|
-
*/
|
|
621
|
-
declare function validatePromptConfigs(value: unknown, options?: {
|
|
622
|
-
strategyDir?: string;
|
|
623
|
-
moduleDir?: string;
|
|
624
|
-
}): Promise<PromptConfigValidationResult>;
|
|
625
|
-
//#endregion
|
|
626
614
|
//#region src/host/module-tool-target.d.ts
|
|
627
615
|
interface ModuleToolTarget {
|
|
628
616
|
id: string;
|
|
@@ -635,7 +623,6 @@ interface ModuleToolHost {
|
|
|
635
623
|
}
|
|
636
624
|
//#endregion
|
|
637
625
|
//#region src/runtime/character-tools.d.ts
|
|
638
|
-
/** 注册角色卡库模型工具;返回 disposer,随 character-tools 模块生命周期清理。 */
|
|
639
626
|
declare function registerCharacterTools(ctx: Context, host: ModuleToolHost): () => void;
|
|
640
627
|
//#endregion
|
|
641
628
|
//#region src/runtime/world-book-tools.d.ts
|
|
@@ -643,44 +630,10 @@ declare function registerCharacterTools(ctx: Context, host: ModuleToolHost): ()
|
|
|
643
630
|
declare function registerWorldBookTools(ctx: Context, host: ModuleToolHost): () => void;
|
|
644
631
|
//#endregion
|
|
645
632
|
//#region src/host/characters.d.ts
|
|
646
|
-
/**
|
|
647
|
-
declare
|
|
648
|
-
/**
|
|
649
|
-
declare function
|
|
650
|
-
/** 卡自身声明的模块(声明优先:ST 转换产物自带六件套声明,行为因此不变)。
|
|
651
|
-
* 只丢弃非字符串与空串;模块名合法性仍由 appendPresetModules 校验(非法名 fail loud)。 */
|
|
652
|
-
declare function declaredCharacterModules(spec: ModuleSpec): string[];
|
|
653
|
-
/** 必需模块:`prompt-config-engine` 缺失会让 promptConfigs 静默失效,因此始终补齐;
|
|
654
|
-
* 卡内含 world-book 策略配置时另需 `world-book-tools`(与旧实现同判据)。 */
|
|
655
|
-
declare function requiredCharacterModules(configs: readonly unknown[]): string[];
|
|
656
|
-
/** 移除一张卡之后,某个模块是否仍被模块内容或其他卡需要(需要则不回退)。 */
|
|
657
|
-
interface CharacterModuleContext {
|
|
658
|
-
/** 移除本卡前缀配置之后的提示词配置。 */
|
|
659
|
-
configs: readonly Record<string, unknown>[];
|
|
660
|
-
/** 移除本卡声明的 params 键之后的模块参数。 */
|
|
661
|
-
params: Record<string, unknown>;
|
|
662
|
-
/** 模块顶层是否仍有自定义工具。 */
|
|
663
|
-
customTools: boolean;
|
|
664
|
-
/** 移除本卡之后仍标记为已导入的角色卡 id。 */
|
|
665
|
-
importedCharacters: readonly string[];
|
|
666
|
-
}
|
|
667
|
-
/** 模块的消费者判据。未知模块保守保留:宁可留一个无消费者的模块,也不误删用户或引擎要用的装配。 */
|
|
668
|
-
declare function characterModuleStillNeeded(module: string, context: CharacterModuleContext): boolean;
|
|
669
|
-
/** 角色卡记忆变更后同步已导入模块的 chara-<id>-memory 注入条目
|
|
670
|
-
* (world_book note 写入卡记忆后调用;未导入当前模块的卡返回 synced=false)。 */
|
|
671
|
-
declare function syncImportedCharacterMemory(moduleRoot: string, templateName: string, cardId: string): {
|
|
672
|
-
ok: true;
|
|
673
|
-
synced: boolean;
|
|
674
|
-
} | {
|
|
675
|
-
ok: false;
|
|
676
|
-
message: string;
|
|
677
|
-
};
|
|
678
|
-
/** 追加角色卡本地记忆(.characters/<id>/memory.md,跟随角色卡跨模块)。 */
|
|
679
|
-
declare function appendCharacterMemory(moduleRoot: string, cardId: string, note: string): void;
|
|
680
|
-
/** 追加记忆文件(时间戳列表格式;header 标注文件类型)。世界书工具与角色卡共用。 */
|
|
681
|
-
declare function appendMemoryFile(file: string, note: string, header?: string): void;
|
|
682
|
-
/** 读角色卡本地记忆文本(无记忆返回空串)。 */
|
|
683
|
-
declare function readCharacterMemory(moduleRoot: string, cardId: string): string;
|
|
633
|
+
/** 模块记忆与条目同归当前模块;来源和 id 前缀不改变位置。 */
|
|
634
|
+
declare function appendModuleMemory(moduleDir: string, note: string): void;
|
|
635
|
+
/** 每次显式读取最新字节;缺失为空,链接与读取失败原样报错。 */
|
|
636
|
+
declare function readModuleMemory(moduleDir: string): string;
|
|
684
637
|
type CharacterImportOptions = StConversionOptions & ImportChoices;
|
|
685
638
|
type CharacterImportResult = {
|
|
686
639
|
ok: true;
|
|
@@ -691,30 +644,11 @@ type CharacterImportResult = {
|
|
|
691
644
|
ok: false;
|
|
692
645
|
message: string;
|
|
693
646
|
};
|
|
694
|
-
/**
|
|
695
|
-
declare function importCharacterCard(
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
id: string;
|
|
700
|
-
name: string;
|
|
701
|
-
description?: string;
|
|
702
|
-
hasAvatar: boolean;
|
|
703
|
-
/** 是否已导入当前模块(激活模块 meta.importedCharacters 含该 id)。 */
|
|
704
|
-
imported: boolean;
|
|
705
|
-
}
|
|
706
|
-
/** 角色卡库清单 + 各卡在当前模块的导入状态。 */
|
|
707
|
-
declare function listCharacterCards(moduleRoot: string, activeTemplate: string | undefined): CharacterCardListItem[];
|
|
708
|
-
/** 删除角色卡库条目。 */
|
|
709
|
-
declare function deleteCharacterCard(moduleRoot: string, id: string): {
|
|
710
|
-
ok: true;
|
|
711
|
-
} | {
|
|
712
|
-
ok: false;
|
|
713
|
-
message: string;
|
|
714
|
-
};
|
|
715
|
-
/** 角色卡参数导入当前模块:promptConfigs 合并(chara-<id>- 前缀防冲突)、
|
|
716
|
-
* params 合并(角色卡覆盖同键)、meta.importedCharacters 记录来源。 */
|
|
717
|
-
declare function applyCharacterToPreset(moduleRoot: string, templateName: string, cardId: string): {
|
|
647
|
+
/** 复用普通模块候选校验、版本保护和目录交换,不生成角色专属存储。 */
|
|
648
|
+
declare function importCharacterCard(root: string, files: AssetFile[], options?: CharacterImportOptions): Promise<CharacterImportResult>;
|
|
649
|
+
declare function importCharacterCardFile(root: string, filePath: string, fileName?: string, options?: CharacterImportOptions): Promise<CharacterImportResult>;
|
|
650
|
+
/** 通用并入保留既有带前缀往返行为,不复制本地记忆。 */
|
|
651
|
+
declare function mergeModuleIntoModule(root: string, targetId: string, sourceId: string): {
|
|
718
652
|
ok: true;
|
|
719
653
|
count: number;
|
|
720
654
|
personaOpened?: boolean;
|
|
@@ -722,9 +656,8 @@ declare function applyCharacterToPreset(moduleRoot: string, templateName: string
|
|
|
722
656
|
ok: false;
|
|
723
657
|
message: string;
|
|
724
658
|
};
|
|
725
|
-
/**
|
|
726
|
-
|
|
727
|
-
declare function removeCharacterFromPreset(moduleRoot: string, templateName: string, cardId: string): {
|
|
659
|
+
/** 撤销并入内容;旧 chara 前缀可撤销,能力归属只写一份登记。 */
|
|
660
|
+
declare function removeMergedModule(root: string, targetId: string, sourceId: string): {
|
|
728
661
|
ok: true;
|
|
729
662
|
count: number;
|
|
730
663
|
} | {
|
|
@@ -739,7 +672,7 @@ interface PromptConfigTemplate {
|
|
|
739
672
|
/** 模板原文(编辑器源码模式可直接展示)。 */
|
|
740
673
|
content: string;
|
|
741
674
|
/** 解析后的单条提示词配置。 */
|
|
742
|
-
spec:
|
|
675
|
+
spec: RuleDefinition;
|
|
743
676
|
}
|
|
744
677
|
/** 自定义工具模板(templates/tools/*.yml;tool-config-engine 定义形态)。 */
|
|
745
678
|
interface ToolTemplate {
|
|
@@ -758,15 +691,15 @@ type TuiSource = PromptSettings & {
|
|
|
758
691
|
skillCatalog: SkillCatalogEntry[];
|
|
759
692
|
activeSkillsDirs: string[];
|
|
760
693
|
};
|
|
761
|
-
/** 参数保存回调:写激活模块
|
|
762
|
-
type
|
|
694
|
+
/** 参数保存回调:写激活模块 module.yml;失败必须抛给命令层渲染为错误。 */
|
|
695
|
+
type SaveModuleParam = (key: string, value: unknown) => void | Promise<void>;
|
|
763
696
|
/** 技能启停回调:切换受管实体的根链接。 */
|
|
764
697
|
type ToggleSkillState = (folder: string, enabled: boolean) => {
|
|
765
698
|
ok: boolean;
|
|
766
699
|
message?: string;
|
|
767
700
|
};
|
|
768
701
|
/** 通过 DSH 命令注册表暴露 /prompt-tool,Web 与 dsh-tui 都能执行。 */
|
|
769
|
-
declare function registerTuiCommand(ctx: Context, ns: 'prompt-tool', getSource: () => TuiSource, getModelsState: () => ModelDetection, getModelCatalog: () => Promise<Record<string, string[]>>,
|
|
702
|
+
declare function registerTuiCommand(ctx: Context, ns: 'prompt-tool', getSource: () => TuiSource, getModelsState: () => ModelDetection, getModelCatalog: () => Promise<Record<string, string[]>>, getModuleDirectory?: () => string, saveModuleParam?: SaveModuleParam, toggleSkillState?: ToggleSkillState, refreshModule?: (id: string) => Promise<void>): void;
|
|
770
703
|
//#endregion
|
|
771
704
|
//#region src/host/skills-refresh.d.ts
|
|
772
705
|
interface SkillsReloaderDeps {
|
|
@@ -829,6 +762,16 @@ declare function scanRoot(root: ScanRoot): ScannedSkill[];
|
|
|
829
762
|
declare function scanRoots(roots: readonly ScanRoot[]): ScannedSkill[];
|
|
830
763
|
declare function catalogFromScan(skills: readonly ScannedSkill[]): SkillCatalogEntry[];
|
|
831
764
|
//#endregion
|
|
765
|
+
//#region src/host/module-install.d.ts
|
|
766
|
+
declare function assertModuleId(id: unknown): asserts id is string;
|
|
767
|
+
/** ENOENT 才表示不存在;权限、占用与读取失败继续传播。 */
|
|
768
|
+
declare function modulePathExists(path: string): boolean;
|
|
769
|
+
declare function canonicalModulesRoot(root: string, allowMissing?: boolean): string;
|
|
770
|
+
/** 根与目标先解析真实路径,拒绝链接目录及定义身份不一致。 */
|
|
771
|
+
declare function assertModuleDirectory(root: string, id: string, allowMissing?: boolean): string;
|
|
772
|
+
/** 复制和物化只接受自有普通文件;不跟随任意层级链接读取根外数据。 */
|
|
773
|
+
declare function assertModuleTree(dir: string): void;
|
|
774
|
+
//#endregion
|
|
832
775
|
//#region src/runtime/skills-parse.d.ts
|
|
833
776
|
interface SkillFrontmatter {
|
|
834
777
|
name?: string;
|
|
@@ -860,4 +803,4 @@ declare const name = "prompt-tool";
|
|
|
860
803
|
declare const inject: string[];
|
|
861
804
|
declare function apply(ctx: Context, configIn: Config): void;
|
|
862
805
|
//#endregion
|
|
863
|
-
export { BRIDGE_ENDPOINTS, type BridgeEndpoint, type BridgeErrorPayload, type BridgeRequestMap, type BridgeValueMap,
|
|
806
|
+
export { BRIDGE_ENDPOINTS, type BridgeEndpoint, type BridgeErrorPayload, type BridgeRequestMap, type BridgeValueMap, Config, DEFAULT_MODULE_ID, MODULE_CAPABILITIES as ENGINE_CAPABILITIES, MODULE_CAPABILITIES, ENGINE_PARAM_KEYS, ENGINE_RECIPES, type ModuleCapability as EngineCapability, type ModuleCapability, type ModuleCapabilityCreateRequest as EngineCapabilityCreateRequest, type ModuleCapabilityCreateRequest, type ModuleCapabilityCreateResult as EngineCapabilityCreateResult, type ModuleCapabilityCreateResult, type ModuleCapabilityRemoveResult as EngineCapabilityRemoveResult, type ModuleCapabilityRemoveResult, INJECTION_POINT_ORDER, INSTRUCTION_FILE_STATUSES, type InjectionPoint, type InstructionContextView, type InstructionFileSnapshot, type InstructionFileStatus, MAX_BRIDGE_BODY_BYTES, MAX_CHARACTER_CARD_STREAM_BYTES, MAX_INSTRUCTION_FILE_BYTES, type ModuleExportRequest, type ModuleExportResult, type ModuleFacts, ModuleLayerSettingsError, type ModuleSourceMode, type ModuleSpec, type ModuleSummary, type ModuleWriterParams, PARAM_KEYS, PRE_STEP_COORDINATOR_SERVICE, PRE_STEP_COORDINATOR_VERSION, type PluginSubagentSeam, type PreStepCoordinatorOptions, type PreStepCoordinatorService, type PreStepPromptConfig, type PreStepSource, type PromptConfigTemplate, SETTINGS_BRIDGE_PREFIX, SKILL_NAME_PATTERN, type SkillCatalogEntry, type SkillFrontmatter, type SkillPolicyChange, type SkillPolicyRead, type SkillPolicyScope, type SkillPolicyWrite, type SkillsCatalogSnapshot, type SkillsRuntime, type SkillsState, type ToolTemplate, USER_SKILLS_DIR, WRITER_PARAM_KEYS, type WriteModuleOptions, type WritePresetOptions, agentsFileCardSpecs, agentsFileId, appendModuleCapabilities, appendModuleMemory, apply, applyModuleConfigs, assertModuleDirectory, assertModuleId, assertModuleTree, assertSafeConfigId, buildModuleConfigsFromParams, buildWorldBookEntry, canonicalModulesRoot, catalogFromScan, cloneBuiltinModule, cloneBuiltinModule as cloneBuiltinPreset, configFileName, convertStToModule, convertStToModule as convertStToPreset, convertStToModuleWithReport, createModuleCapability as createEngineCapabilityInPreset, createModuleCapability, createSkillsReloader, createSkillsRuntime, deleteWorldBookEntry, detectAgentsFileSnapshots, detectAgentsFiles, detectModels, moduleCapability as engineCapability, moduleCapability, engineRecipe, ensureModuleReady, ensureModuleSeed, ensureModuleSeed as ensurePresetSeed, ensureWebSurface, expandModuleSource, expandModuleSource as expandPresetSource, exportModulePackage, exportModulePackage as exportPresetPackage, importCharacterCard, importCharacterCardFile, importSkillsPackage, inject, installModulePackage, installModulePackage as installPresetPackage, installPreStepCoordinator, invalidateModelCatalog, invocationForScope, isModuleCapabilityPresent as isEngineCapabilityPresent, isModuleCapabilityPresent, listAdvertisedModels, listBuiltinTemplates, listModules, listWorldBookEntries, loadModuleSpec, loadPromptTemplates, loadToolTemplates, mergeInstructionCards, mergeModuleIntoModule, mergeStModules, mergeStModules as mergeStPresets, mergeStModulesWithReport, moduleDirExists, moduleImportPreview, moduleImportPreview as presetImportPreview, modulePathExists, name, parseFrontmatter, peekModelCatalog, processStText, readAgentsFileSnapshot, readModuleLayerSettings, readModuleMemory, readSkillInvocation, readSkillsState, registerCharacterTools, registerSettingsBridge, registerTuiCommand, registerWorldBookTools, removeModuleCapability as removeEngineCapabilityFromPreset, removeModuleCapability, removeMergedModule, removeModuleCapabilityDeclaration, removeModuleCapabilityDeclaration as removePresetModule, removeUserModule, removeUserModule as removeUserPreset, renderComposition, resolveModuleDir, resolveModuleFacts, resolveModuleParams, resolveModuleParams as resolvePresetParams, resolveProfileDir, resolveProjectRoot, resolveSubagentStartOptions, saveModuleParams, saveModulePersona, saveModulePersona as savePresetPersona, scanRoot, scanRoots, scheduleWebSurfaceRepair, scopeOfInvocation, setSkillInvocation, skillRoots, skillsStatePath, stModuleId, stModuleId as stPresetId, upsertWorldBookEntry, userModulesDir, validateCustomToolIdentities, validateEngineParamValues, withModuleDefinition, writeAgentsFile, writeAgentsFileChecked, writeModule, writePreset, writeSkillsState };
|