nx-kv 0.63.0 → 0.64.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/CHANGELOG.md +29 -0
- package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +6 -5
- package/package.json +2 -2
- package/src/core/attachmentdb/docs.ts +3 -6
- package/src/core/attachmentdb/query.ts +2 -2
- package/src/core/attachmentdb/relations.ts +36 -21
- package/src/core/db/import-json/refs.ts +17 -19
- package/src/core/db/import-json/repos.ts +4 -8
- package/src/core/db/migrations/index.ts +2 -0
- package/src/core/db/migrations/v13.sql +24 -0
- package/src/core/db/seed-templates.ts +15 -4
- package/src/core/db/version.ts +3 -1
- package/src/modules/docs/actions/_manifest.generated.ts +0 -3
- package/src/modules/docs/actions/doc-attach.ts +0 -1
- package/src/modules/docs/actions/docs-bindings.ts +2 -5
- package/src/modules/docs/actions/docs-link.ts +1 -2
- package/src/modules/docs/attach.ts +1 -36
- package/src/modules/docs/bound-docs.ts +2 -2
- package/src/modules/docs/brief.ts +0 -2
- package/src/modules/docs/docref.ts +7 -17
- package/src/modules/docs/knowledge-md.ts +1 -1
- package/src/modules/docs/knowledge.ts +48 -45
- package/src/modules/docs/ref-sync.ts +1 -5
- package/src/modules/docs/refs.ts +7 -10
- package/src/modules/docs/service.ts +1 -3
- package/src/modules/localtask/actions/localtask-config.ts +19 -58
- package/src/modules/localtask/actions/localtask-prune.ts +7 -2
- package/src/modules/localtask/repo/open.ts +0 -4
- package/src/modules/localtask/repo/settings.ts +20 -196
- package/src/modules/localtask/task-lifecycle.ts +7 -9
- package/src/modules/localtask/task-templates.ts +4 -4
- package/src/modules/localtask/task-view.ts +4 -0
- package/src/modules/localtask/topics.ts +30 -28
- package/src/modules/promptplug/actions/_manifest.generated.ts +0 -3
- package/src/modules/promptplug/actions/prompt-registry.ts +19 -30
- package/src/modules/promptplug/base.ts +69 -25
- package/src/modules/promptplug/compose.ts +40 -23
- package/src/modules/promptplug/factory.ts +91 -59
- package/src/modules/promptplug/index.ts +25 -11
- package/src/modules/promptplug/plugins/ack.ts +28 -0
- package/src/modules/promptplug/plugins/attachment.ts +237 -19
- package/src/modules/promptplug/plugins/context.ts +124 -30
- package/src/modules/promptplug/plugins/doneguard.ts +33 -0
- package/src/modules/promptplug/plugins/ext.ts +34 -11
- package/src/modules/promptplug/plugins/getloop.ts +29 -8
- package/src/modules/promptplug/plugins/goal-shape.ts +34 -0
- package/src/modules/promptplug/plugins/goalhint.ts +33 -0
- package/src/modules/promptplug/plugins/timecheck.ts +33 -0
- package/src/modules/promptplug/registry.ts +99 -0
- package/src/modules/promptplug/schema-bridge.ts +77 -13
- package/src/modules/repos/actions/board-rekey.ts +1 -1
- package/src/modules/repos/actions/repo-doc-add.ts +2 -3
- package/src/modules/repos/boards/core.ts +1 -13
- package/src/modules/repos/boards/docs.ts +2 -12
- package/src/modules/repos/boards/members.ts +2 -14
- package/src/modules/repos/boards/transfer.ts +2 -11
- package/src/modules/repos/keys.ts +4 -11
- package/src/modules/repos/repo/refs.ts +3 -5
- package/src/modules/repos/repo/repos.ts +12 -13
- package/src/modules/repos/repo/rows.ts +2 -8
- package/src/modules/repos/service/context.ts +0 -2
- package/src/modules/repos/service/crud.ts +1 -4
- package/src/modules/repos/service/store.ts +6 -7
- package/src/modules/repos/transfer/export.ts +3 -8
- package/src/modules/repos/transfer/import.ts +0 -13
- package/src/modules/repos/transfer/layout.ts +2 -2
- package/src/modules/tasktool/attach-template.ts +3 -3
- package/src/modules/tasktool/groupctx.ts +4 -5
- package/src/modules/tasktool/plugins/waitgoal-config.ts +5 -6
- package/src/modules/tasktool/preview.ts +20 -23
- package/src/modules/tasktool/wait.ts +24 -46
- package/src/modules/templates/actions/_manifest.generated.ts +3 -0
- package/src/modules/templates/actions/templates-reorder.ts +28 -0
- package/src/modules/templates/repo/templates.ts +32 -2
- package/src/modules/templates/service.ts +45 -0
- package/src/shared/prompt-blocks.ts +7 -173
- package/src/shared/prompt-plugin.ts +79 -59
- package/src/web/frontend/App.tsx +27 -1
- package/src/web/frontend/api/cli-tree.json +20 -35
- package/src/web/frontend/api/client.generated.ts +22 -32
- package/src/web/frontend/components/Introduction/rail.tsx +2 -2
- package/src/web/frontend/components/Introduction/use-intro.ts +2 -5
- package/src/web/frontend/components/bindings/bind-tags.tsx +1 -3
- package/src/web/frontend/components/list-search.tsx +37 -0
- package/src/web/frontend/components/md/attach-area.tsx +10 -15
- package/src/web/frontend/components/md/live-block.tsx +5 -14
- package/src/web/frontend/components/md/md-panes.tsx +3 -19
- package/src/web/frontend/modules/list-filter.ts +37 -0
- package/src/web/frontend/modules/md/fill-session.ts +36 -0
- package/src/web/frontend/modules/md/manage-session.ts +24 -0
- package/src/web/frontend/modules/md/new-task-from-template.ts +22 -0
- package/src/web/frontend/modules/md/styles/editor.css +5 -12
- package/src/web/frontend/modules/md/styles/shell.css +4 -0
- package/src/web/frontend/modules/md/task-intent.ts +29 -0
- package/src/web/frontend/modules/md/use-templates.ts +8 -0
- package/src/web/frontend/modules/prompts/template-preview.ts +12 -20
- package/src/web/frontend/modules/refs/api.ts +0 -1
- package/src/web/frontend/page/dir/index.tsx +20 -5
- package/src/web/frontend/page/dir/task-actions.ts +14 -0
- package/src/web/frontend/page/dir/task-preview-modal.tsx +1 -1
- package/src/web/frontend/page/dir/task.tsx +19 -0
- package/src/web/frontend/page/doc/api.ts +2 -3
- package/src/web/frontend/page/doc/bindings.tsx +46 -16
- package/src/web/frontend/page/doc/index.tsx +3 -4
- package/src/web/frontend/page/group/index.tsx +65 -117
- package/src/web/frontend/page/refs/index.tsx +27 -3
- package/src/web/frontend/page/refs/style.css +3 -0
- package/src/web/frontend/page/repos/bind-modals.tsx +18 -2
- package/src/web/frontend/page/repos/board-admin.tsx +1 -1
- package/src/web/frontend/page/repos/index.tsx +4 -8
- package/src/web/frontend/page/repos/ref-block.tsx +5 -12
- package/src/web/frontend/page/repos/ref-panel.tsx +3 -4
- package/src/web/frontend/page/repos/repo-form-modal.tsx +1 -8
- package/src/web/frontend/page/repos/repo-table.tsx +4 -29
- package/src/web/frontend/page/repos/use-repos-derive.ts +4 -5
- package/src/web/frontend/page/settings/api.ts +7 -15
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +261 -289
- package/src/web/frontend/page/settings/prompt-vars.ts +56 -0
- package/src/web/frontend/page/settings/style.css +46 -64
- package/src/web/frontend/page/templates/fill.tsx +124 -0
- package/src/web/frontend/page/templates/index.tsx +11 -0
- package/src/web/frontend/page/templates/manage.tsx +218 -0
- package/src/web/frontend/page/templates/style.css +46 -0
- package/src/web/frontend/page/templates/template-list.tsx +58 -54
- package/src/web/frontend/refs/api.ts +0 -2
- package/src/web/frontend/routes/route-eq.ts +22 -0
- package/src/web/frontend/routes/templates.ts +20 -0
- package/src/web/frontend/style.css +1 -0
- package/src/web/frontend/styles/list-search.css +44 -0
- package/src/web/frontend/types.ts +5 -1
- package/src/web/public/assets/{bar-CYWfxHfm.js → bar-j14ON7uZ.js} +1 -1
- package/src/web/public/assets/{composer-launch-Bor4ngrQ.js → composer-launch-DRi9mZE1.js} +1 -1
- package/src/web/public/assets/{composer-panel-C7mNI7EW.js → composer-panel-swmDqlPw.js} +1 -1
- package/src/web/public/assets/dir-DhsB1ZhL.js +3 -0
- package/src/web/public/assets/doc-D4po3sDc.js +6 -0
- package/src/web/public/assets/fill-session-fHxQHFaD.js +1 -0
- package/src/web/public/assets/group-BxmSNzIB.js +1 -0
- package/src/web/public/assets/index-CMjG5NVU.js +2 -0
- package/src/web/public/assets/index-uMjSWNVr.css +1 -0
- package/src/web/public/assets/list-filter-D-x94TvA.js +1 -0
- package/src/web/public/assets/manage-session-CS8UvmUd.js +1 -0
- package/src/web/public/assets/md-history-CZUF_FhN.js +39 -0
- package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +1 -0
- package/src/web/public/assets/refs-TuuoaRs7.js +2 -0
- package/src/web/public/assets/refs-zSA2k_45.css +1 -0
- package/src/web/public/assets/render-template-body-bXdedFig.js +1 -0
- package/src/web/public/assets/repo-form-modal-BD4N37MI.js +1 -0
- package/src/web/public/assets/repos-BPeuX4N9.js +12 -0
- package/src/web/public/assets/settings-CZJaKLZW.js +1 -0
- package/src/web/public/assets/settings-Cc6puKd5.css +1 -0
- package/src/web/public/assets/task-DgbbF5gy.js +11 -0
- package/src/web/public/assets/task-intent-CX5DZccN.js +1 -0
- package/src/web/public/assets/{task-utils-DpnPjZKJ.js → task-utils-bJH1-Cjy.js} +1 -1
- package/src/web/public/assets/templates-CBXlwyof.js +11 -0
- package/src/web/public/assets/templates-plA8R7jJ.css +1 -0
- package/src/web/public/assets/use-rail-drag-ufwy2XZB.js +1 -0
- package/src/web/public/index.html +8 -6
- package/src/modules/docs/actions/doc-attach-note.ts +0 -32
- package/src/modules/promptplug/Template/blockTemplates.json +0 -90
- package/src/modules/promptplug/actions/prompt-order.ts +0 -38
- package/src/modules/promptplug/ensure.ts +0 -57
- package/src/modules/promptplug/keys.ts +0 -9
- package/src/modules/promptplug/plugins/readonly-blocks.ts +0 -75
- package/src/modules/promptplug/template-bundle.ts +0 -59
- package/src/web/frontend/modules/md/template-locks.ts +0 -105
- package/src/web/frontend/page/settings/prompt-editor.tsx +0 -279
- package/src/web/frontend/page/settings/prompt-rail.tsx +0 -170
- package/src/web/public/assets/dir-CcffxXL2.js +0 -3
- package/src/web/public/assets/doc-BxWVzWkw.js +0 -6
- package/src/web/public/assets/group-C5Yu3oJr.js +0 -1
- package/src/web/public/assets/index-BvyZ1MA2.js +0 -2
- package/src/web/public/assets/index-Cp-TtHyA.css +0 -1
- package/src/web/public/assets/md-history-DejKuR12.js +0 -39
- package/src/web/public/assets/refs-DJdKV8_H.css +0 -1
- package/src/web/public/assets/refs-VbDnDTV0.js +0 -2
- package/src/web/public/assets/repo-form-modal-Dkdvu_uN.js +0 -1
- package/src/web/public/assets/repos-CY0eZheu.js +0 -16
- package/src/web/public/assets/settings-AwzLRYUu.css +0 -1
- package/src/web/public/assets/settings-D3T-vgCl.js +0 -1
- package/src/web/public/assets/task-CkCD82h_.js +0 -11
- package/src/web/public/assets/templates-BcuCbT4U.js +0 -10
- package/src/web/public/assets/templates-gNdtaMI2.css +0 -1
- package/src/web/public/assets/use-rail-drag-DMvr8-GE.js +0 -1
|
@@ -346,6 +346,51 @@ export async function updateTemplate({ id, name: rawName, body: rawBody, bodyFil
|
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
/**
|
|
350
|
+
* 重排任务模板顺序(#151):ids 是「期望的完整顺序」(只含 newtask 类目)。
|
|
351
|
+
* 前端 topic 管理页拖完序把可见行 id 按新序传进来;这里按数组下标写 sort_order。
|
|
352
|
+
* 不在 ids 里的同类目行被挪到末尾(保持相对顺序),避免排序与展示不一致。
|
|
353
|
+
*/
|
|
354
|
+
export async function reorderTemplates({ ids }: { ids?: unknown } = {}): Promise<{
|
|
355
|
+
status: string;
|
|
356
|
+
templates: TemplateView[];
|
|
357
|
+
defaultId: string;
|
|
358
|
+
}> {
|
|
359
|
+
const ordered = Array.isArray(ids) ? ids.map((x) => String(x || '').trim()).filter(Boolean) : [];
|
|
360
|
+
if (!ordered.length) throw badInput('需要 ids(模板 id 的有序数组)');
|
|
361
|
+
return repo.txw((conn) => {
|
|
362
|
+
// 校验:全部存在且属于 newtask 类目
|
|
363
|
+
const known = new Map<string, any>();
|
|
364
|
+
for (const r of repo.templates.listRows(conn)) {
|
|
365
|
+
if (r.category === NEWTASK_CATEGORY) known.set(String(r.id), r);
|
|
366
|
+
}
|
|
367
|
+
for (const id of ordered) {
|
|
368
|
+
if (!known.has(id)) throw notFound(`没有 id 为 ${id} 的任务模板`);
|
|
369
|
+
}
|
|
370
|
+
// 只重排传入的这些行:拿它们**自己原来的 sort_order 槽位**(升序)按新顺序
|
|
371
|
+
// 回填。未列出的行(本主题不可见、管理页没显示)保持原位,不被挪到末尾。
|
|
372
|
+
//
|
|
373
|
+
// 槽位去重后仍可能有并列(历史数据:老 nextSortOrder 的 bug 让新模板全是 0),
|
|
374
|
+
// 所以按「严格递增」归一化一遍——否则两条 0 交换等于没换。
|
|
375
|
+
const raw = ordered
|
|
376
|
+
.map((id) => Number(known.get(id)!.sort_order) || 0)
|
|
377
|
+
.sort((a, b) => a - b);
|
|
378
|
+
const slots: number[] = [];
|
|
379
|
+
let prev = Number.NEGATIVE_INFINITY;
|
|
380
|
+
for (const s of raw) {
|
|
381
|
+
const v = s > prev ? s : prev + 1;
|
|
382
|
+
slots.push(v);
|
|
383
|
+
prev = v;
|
|
384
|
+
}
|
|
385
|
+
repo.templates.reorderRows(conn, ordered, nowMs(), slots);
|
|
386
|
+
const templates = repo.templates
|
|
387
|
+
.listRows(conn)
|
|
388
|
+
.filter((r) => r.category === NEWTASK_CATEGORY)
|
|
389
|
+
.map(rowToView);
|
|
390
|
+
return { status: 'ok', templates, defaultId: defaultIdOf(conn) };
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
349
394
|
/** 设默认模板:新建页的起始正文换成它。 */
|
|
350
395
|
export async function setDefaultTemplate({ id }: { id?: unknown } = {}): Promise<{
|
|
351
396
|
status: string;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
//
|
|
1
|
+
// 系统提示词「追加方式」与 XML 包裹的共享定义(前后端共用,零依赖)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// -
|
|
8
|
-
//
|
|
9
|
-
// - 每个区块(context / attachment / timecheck / goalhint / doneguard / ext / ack /
|
|
10
|
-
// getloop)各自有一份独立的模板列表:
|
|
11
|
-
// `blockTemplates[id] = { active, list: [{ id, name, template, builtin }] }`。
|
|
12
|
-
// - 每个区块**始终恰好一条系统内置模板**(id 固定 `builtin`):不可删除、不可改
|
|
13
|
-
// (写路径拒绝改动 builtin——落库后 builtin 是真数据,读路径改写它就会出现
|
|
14
|
-
// 「库里存 A、渲染用 B」)。
|
|
15
|
-
// - normalize 是**纯校验**(§4.1):不合成、不补齐、不折算。缺段 / 缺 builtin /
|
|
16
|
-
// 重复 id / 超限都是事故,抛错;唯一的「修」是 active 指空 → 回落 builtin
|
|
17
|
-
// (数据自愈,不是兼容)。
|
|
18
|
-
// - 模板由 core/instruction-template.ts(Handlebars 4.x)渲染;列表变量是结构化数组,
|
|
19
|
-
// 用 `{{#each}}` 展开;有无用 `{{#if}}` 判断。另有一组内置 helper(比较 / 逻辑 /
|
|
20
|
-
// 数值 / 字符串 / 时间,见该文件的 HELPER_DEFS),失败输出可见的 NaN / false,不抛错。
|
|
3
|
+
// **#152 起这里不再持有任何模板正文,也不再定义「每区块模板列表」。**
|
|
4
|
+
// 模板正文的唯一真相是插件类(modules/promptplug/plugins/*.ts 的 `templates`);
|
|
5
|
+
// 段落清单的唯一真相是注册表(modules/promptplug/registry.ts 的 PLUGIN_CLASSES)。
|
|
6
|
+
// 本文件只剩两件仍然跨端共享的纯数据 / 纯函数:
|
|
7
|
+
// - 追加方式(xml = 每段包独立标签;plain = 按空行直接拼正文);
|
|
8
|
+
// - 把已渲染的段落包进根标签(compose 的最后一步)。
|
|
21
9
|
//
|
|
22
10
|
// 区块标记是给 agent 读的「类 XML」分隔语法,不对正文做实体转义。
|
|
23
11
|
|
|
@@ -45,160 +33,6 @@ export const APPEND_MODES: readonly AppendMode[] = Object.freeze([
|
|
|
45
33
|
export const DEFAULT_APPEND_MODE = 'xml';
|
|
46
34
|
export const XML_ROOT_TAG = 'nx-kv';
|
|
47
35
|
|
|
48
|
-
/** 单个区块模板长度上限(防把整本书塞进设置)。 */
|
|
49
|
-
export const MAX_BLOCK_TEMPLATE_LEN = 8000;
|
|
50
|
-
/** 每个区块的模板条数上限 / 模板名长度上限。 */
|
|
51
|
-
export const MAX_PROMPT_TEMPLATES = 20;
|
|
52
|
-
export const MAX_PROMPT_TEMPLATE_NAME = 60;
|
|
53
|
-
/** 系统内置条目的固定 id / 名称(前后端都靠这个判断「不可删除」)。 */
|
|
54
|
-
export const BUILTIN_TEMPLATE_ID = 'builtin';
|
|
55
|
-
export const BUILTIN_TEMPLATE_NAME = '系统内置';
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 区块 id 清单(顺序 = 插件默认 order 位)。
|
|
59
|
-
*
|
|
60
|
-
* 唯一真相是插件数组(modules/promptplug/factory.ts 的 PLUGIN_IDS + 各插件 id);
|
|
61
|
-
* shared 零依赖拿不到 modules,这里只放**纯数据镜像**,一致性由
|
|
62
|
-
* tests/unit/prompt-registry.test.mjs 对账(PROMPT_BLOCK_IDS ≡ 插件数组 id 序列)。
|
|
63
|
-
*/
|
|
64
|
-
export const PROMPT_BLOCK_IDS: readonly string[] = Object.freeze([
|
|
65
|
-
'context', 'attachment', 'timecheck', 'goalhint', 'doneguard', 'ext', 'ack', 'getloop',
|
|
66
|
-
]);
|
|
67
|
-
|
|
68
|
-
/** 单条区块模板条目。 */
|
|
69
|
-
export interface PromptTemplateItem {
|
|
70
|
-
id: string;
|
|
71
|
-
name: string;
|
|
72
|
-
template: string;
|
|
73
|
-
builtin: boolean;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** 每区块的模板列表:active 指向当前生效条目。 */
|
|
77
|
-
export interface BlockTemplateList {
|
|
78
|
-
active: string;
|
|
79
|
-
list: PromptTemplateItem[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** 归一化后的「每区块模板列表」集合(恒产出全部 PROMPT_BLOCK_IDS 区块)。 */
|
|
83
|
-
export type BlockLists = Record<string, BlockTemplateList>;
|
|
84
|
-
|
|
85
|
-
function badShape(msg: string): Error {
|
|
86
|
-
return new Error(`lt.blockTemplates 形状非法:${msg}`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** 校验一条用户条目;非法返回 null(直接丢弃不报错——保存路径另有白名单校验兜语义)。 */
|
|
90
|
-
function checkItem(raw: unknown, blockId: string): PromptTemplateItem | null {
|
|
91
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
|
|
92
|
-
const rec = raw as Record<string, unknown>;
|
|
93
|
-
const id = String(rec.id ?? '').trim().slice(0, 64);
|
|
94
|
-
if (!id) return null;
|
|
95
|
-
if (id === BUILTIN_TEMPLATE_ID) return null; // builtin 恒由校验单独处理,混进用户区即弃
|
|
96
|
-
const name = String(rec.name ?? '').trim().slice(0, MAX_PROMPT_TEMPLATE_NAME) || '未命名模板';
|
|
97
|
-
const template = String(rec.template ?? '');
|
|
98
|
-
if (template.length > MAX_BLOCK_TEMPLATE_LEN) {
|
|
99
|
-
throw badShape(`「${blockId}」条目 ${id} 的模板超过 ${MAX_BLOCK_TEMPLATE_LEN} 字上限`);
|
|
100
|
-
}
|
|
101
|
-
return { id, name, template, builtin: false };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* 校验「每区块模板列表」(**纯校验,不合成**——方案 §4.1)。
|
|
106
|
-
*
|
|
107
|
-
* 规则:
|
|
108
|
-
* - 输入必须是 `{ [blockId]: { active, list } }`,8 个 id 齐全;缺一个即抛出
|
|
109
|
-
* (说明库没被播种或被人为清空——属事故,不补齐);
|
|
110
|
-
* - 列表里恰好一条 `builtin`(混在用户位置 / 缺失都抛);builtin 的 template
|
|
111
|
-
* 必须非空、≤8000 字;
|
|
112
|
-
* - 用户条目按 id 去重(重复抛)、每块 ≤ `MAX_PROMPT_TEMPLATES` 条(超限抛);
|
|
113
|
-
* - `active` 指向不存在的条目 → 回落 `builtin`(唯一的回落,且不是兼容,是数据自愈)。
|
|
114
|
-
* 未知区块键(如历史 rule)忽略。
|
|
115
|
-
*/
|
|
116
|
-
export function normalizeBlockTemplateLists(raw: unknown): BlockLists {
|
|
117
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
118
|
-
throw badShape('需要 { [blockId]: { active, list } } 对象');
|
|
119
|
-
}
|
|
120
|
-
const src = raw as Record<string, unknown>;
|
|
121
|
-
const out: BlockLists = {};
|
|
122
|
-
for (const blockId of PROMPT_BLOCK_IDS) {
|
|
123
|
-
const br = src[blockId];
|
|
124
|
-
if (!br || typeof br !== 'object' || Array.isArray(br)) {
|
|
125
|
-
throw badShape(`缺区块「${blockId}」(8 段必须齐全,不补齐——先跑 ensurePromptTemplates 落库)`);
|
|
126
|
-
}
|
|
127
|
-
const rec = br as Record<string, unknown>;
|
|
128
|
-
const rawList = rec.list;
|
|
129
|
-
if (!Array.isArray(rawList)) {
|
|
130
|
-
throw badShape(`「${blockId}」缺 list 数组`);
|
|
131
|
-
}
|
|
132
|
-
const builtin = rawList.find(
|
|
133
|
-
(x) => x && typeof x === 'object' && (x as Record<string, unknown>).id === BUILTIN_TEMPLATE_ID,
|
|
134
|
-
) as Record<string, unknown> | undefined;
|
|
135
|
-
if (!builtin) {
|
|
136
|
-
throw badShape(`「${blockId}」缺内置条目 builtin(不可删除)`);
|
|
137
|
-
}
|
|
138
|
-
const builtinTpl = String(builtin.template ?? '');
|
|
139
|
-
if (!builtinTpl.trim()) {
|
|
140
|
-
throw badShape(`「${blockId}」内置模板为空(内置文本来自出厂快照,不允许为空)`);
|
|
141
|
-
}
|
|
142
|
-
if (builtinTpl.length > MAX_BLOCK_TEMPLATE_LEN) {
|
|
143
|
-
throw badShape(`「${blockId}」内置模板超过 ${MAX_BLOCK_TEMPLATE_LEN} 字上限`);
|
|
144
|
-
}
|
|
145
|
-
const list: PromptTemplateItem[] = [
|
|
146
|
-
{
|
|
147
|
-
id: BUILTIN_TEMPLATE_ID,
|
|
148
|
-
name: String(builtin.name ?? '').trim().slice(0, MAX_PROMPT_TEMPLATE_NAME) || BUILTIN_TEMPLATE_NAME,
|
|
149
|
-
template: builtinTpl,
|
|
150
|
-
builtin: true,
|
|
151
|
-
},
|
|
152
|
-
];
|
|
153
|
-
const seen = new Set<string>([BUILTIN_TEMPLATE_ID]);
|
|
154
|
-
for (const rawItem of rawList) {
|
|
155
|
-
if (rawItem && typeof rawItem === 'object' && (rawItem as Record<string, unknown>).builtin === true) continue;
|
|
156
|
-
const t = checkItem(rawItem, blockId);
|
|
157
|
-
if (!t) continue;
|
|
158
|
-
if (seen.has(t.id)) throw badShape(`「${blockId}」条目 id 重复:${t.id}`);
|
|
159
|
-
seen.add(t.id);
|
|
160
|
-
list.push(t);
|
|
161
|
-
if (list.length > MAX_PROMPT_TEMPLATES) {
|
|
162
|
-
throw badShape(`「${blockId}」模板条数超过 ${MAX_PROMPT_TEMPLATES} 上限`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const wanted = String(rec.active ?? '').trim();
|
|
166
|
-
out[blockId] = {
|
|
167
|
-
active: list.some((t) => t.id === wanted) ? wanted : BUILTIN_TEMPLATE_ID,
|
|
168
|
-
list,
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
return out;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** 每区块当前生效的那条模板(渲染链唯一入口)。 */
|
|
175
|
-
export interface ResolvedBlockTemplate {
|
|
176
|
-
id: string;
|
|
177
|
-
name: string;
|
|
178
|
-
template: string;
|
|
179
|
-
builtin: boolean;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* 解析出「每个区块当前生效的那条模板」(渲染链唯一入口)。
|
|
184
|
-
* @param raw `{ [blockId]: { active, list } }`(先过 normalize 校验)
|
|
185
|
-
*/
|
|
186
|
-
export function resolveBlockTemplates(raw: unknown): Record<string, ResolvedBlockTemplate> {
|
|
187
|
-
const lists = normalizeBlockTemplateLists(raw);
|
|
188
|
-
const out: Record<string, ResolvedBlockTemplate> = {};
|
|
189
|
-
for (const blockId of PROMPT_BLOCK_IDS) {
|
|
190
|
-
const b = lists[blockId]!;
|
|
191
|
-
const item = b.list.find((t) => t.id === b.active) ?? b.list[0]!;
|
|
192
|
-
out[blockId] = {
|
|
193
|
-
id: item.id,
|
|
194
|
-
name: item.name,
|
|
195
|
-
template: item.template,
|
|
196
|
-
builtin: item.builtin,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
return out;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
36
|
/** XML 区块段:tag 为标签名,text 为已渲染正文(空 text 由调用方滤掉)。 */
|
|
203
37
|
export interface XmlBlockPart {
|
|
204
38
|
id?: string;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// 本文件声明的 PluginSchema 纯数据后再上注册面)。
|
|
6
6
|
//
|
|
7
7
|
// 五条铁律里的三条落在本层:
|
|
8
|
-
// - 一个插件 = 一段输出 =
|
|
9
|
-
// -
|
|
8
|
+
// - 一个插件 = 一段输出 = 链内一个 order 位 = 一组写回键(assertPluginList 强制);
|
|
9
|
+
// - 顺序只存在类声明(order 字段;#152 起不再落库、不再有顺序数组);
|
|
10
10
|
// - 声明是 UI 的唯一数据源(uiDescriptor 从 schema 派生,不写第二份)。
|
|
11
11
|
|
|
12
12
|
/** 字段种类(UI 控件映射的 kind,见方案 §7)。 */
|
|
@@ -32,108 +32,128 @@ export interface PluginSchema<TData = unknown> {
|
|
|
32
32
|
blank: TData;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/** 单条内置模板(#152:正文进插件类,不再有 JSON 注册表 / DB seed)。 */
|
|
36
|
+
export interface TemplateText {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
text: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 交付时的种子数据(宿主在 run 时传进来的那一份):任务本体 / 工作目录 / 时间目标 /
|
|
44
|
+
* 来源 / 现状 / 名字 / 外部参数。**这不是「共享 ctx」**——它每段都有一份,只读。
|
|
45
|
+
*/
|
|
46
|
+
export const SEED_SEGMENTS: readonly string[] = Object.freeze([
|
|
47
|
+
'task', 'cwd', 'goal', 'source', 'summary', 'name', 'params',
|
|
48
|
+
]);
|
|
49
|
+
|
|
35
50
|
/** 注册面:注册表 / compose / uiDescriptor 只认这一层。 */
|
|
36
51
|
export interface AnyPromptPlugin {
|
|
37
52
|
readonly id: string;
|
|
38
53
|
readonly order: number;
|
|
54
|
+
/** 触发时机 = 链名(#152):get / check / done */
|
|
55
|
+
readonly group: string;
|
|
39
56
|
/** 类 XML 输出标签('nx-kv.context' 等);compose 按它包裹段落 */
|
|
40
57
|
readonly tag: string;
|
|
41
58
|
readonly label: string;
|
|
42
|
-
/**
|
|
43
|
-
readonly
|
|
59
|
+
/** 内置模板列表(至少一条,第一条 = 出厂默认) */
|
|
60
|
+
readonly templates: readonly TemplateText[];
|
|
44
61
|
readonly schema: PluginSchema<unknown>;
|
|
45
62
|
/** 唯一出口:无参 = 文本态(模板原文);'data' = 结构态(数据对象) */
|
|
46
63
|
get(): string;
|
|
47
64
|
get(as: 'data'): Promise<unknown>;
|
|
48
65
|
}
|
|
49
66
|
|
|
50
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* 启动期校验(唯一一道):每条断言挡掉一个真实事故。
|
|
69
|
+
* #152 起顺序只在**链内**要求唯一(跨组同号无意义),链内顺序由 order 决定。
|
|
70
|
+
*
|
|
71
|
+
* #153:**每段只看自己的数据**——模板引用的每个 `a.b` 必须落在
|
|
72
|
+
* 「seed 段 ∪ 本段 dataSchema 声明」里。跨段偷数据(ack 用 repo.name)在启动期
|
|
73
|
+
* 就报错,而不是渲染成空串等你去 preview 里找。
|
|
74
|
+
*/
|
|
51
75
|
export function assertPluginList(list: readonly AnyPromptPlugin[]): void {
|
|
52
76
|
const ids = new Set<string>();
|
|
53
|
-
const orders = new Set<
|
|
54
|
-
const keys = new Map<string, string>();
|
|
77
|
+
const orders = new Set<string>();
|
|
55
78
|
for (const p of list) {
|
|
56
79
|
if (ids.has(p.id)) throw new Error(`插件 id 重复:${p.id}`);
|
|
80
|
+
if (!p.group) throw new Error(`${p.id}: 必须声明 group(get / check / done)`);
|
|
57
81
|
if (!Number.isInteger(p.order) || p.order <= 0) throw new Error(`${p.id}: order 必须是正整数`);
|
|
58
|
-
|
|
82
|
+
const slot = `${p.group}#${p.order}`;
|
|
83
|
+
if (orders.has(slot)) throw new Error(`order 冲突:${p.id} 与同链插件在 ${p.group} 链上都是 ${p.order}`);
|
|
59
84
|
if (!String(p.get() ?? '').trim()) throw new Error(`${p.id}: 模板不能为空(空模板 = 该段永不输出,属配置错误)`);
|
|
60
85
|
if (!p.tag || !/^[A-Za-z][\w.-]*$/.test(p.tag)) throw new Error(`${p.id}: tag 非法:${p.tag}`);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
const { allowedSegments, fieldKeys } = varScopeOf(p.id, p.schema.fields);
|
|
87
|
+
const stray = undeclaredTemplateVars(p.get(), allowedSegments, fieldKeys);
|
|
88
|
+
if (stray.length) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`${p.id}: 模板引用了本段没有的变量 ${stray.join(', ')}` +
|
|
91
|
+
`(每段只能引用 seed(${SEED_SEGMENTS.join(' / ')})与自己的 dataSchema 字段)`,
|
|
92
|
+
);
|
|
67
93
|
}
|
|
68
94
|
ids.add(p.id);
|
|
69
|
-
orders.add(
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** 顺序数组不变量:恰好包含全部插件 id 各一次、无未知 id。 */
|
|
74
|
-
export function assertOrder(plugins: readonly AnyPromptPlugin[], orderIds: readonly string[]): void {
|
|
75
|
-
const all = new Set(plugins.map((p) => p.id));
|
|
76
|
-
const seen = new Set<string>();
|
|
77
|
-
for (const id of orderIds) {
|
|
78
|
-
if (!all.has(id)) throw new Error(`顺序数组含未知插件:${id}`);
|
|
79
|
-
if (seen.has(id)) throw new Error(`顺序数组重复:${id}`);
|
|
80
|
-
seen.add(id);
|
|
81
|
-
}
|
|
82
|
-
if (seen.size !== all.size) {
|
|
83
|
-
const missing = [...all].filter((id) => !seen.has(id)).join(',');
|
|
84
|
-
throw new Error(`顺序数组缺插件:${missing}`);
|
|
95
|
+
orders.add(slot);
|
|
85
96
|
}
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
100
|
+
* 一段的「可见变量域」:seed 段 + 本段 dataSchema 的顶层段;字段键只有本段自己的。
|
|
101
|
+
*
|
|
102
|
+
* 这就是「每段自己提供数据」的机器化表达——不再有全局共享 ctx,
|
|
103
|
+
* 因此也没有「只读段 / 可写段」这回事。
|
|
91
104
|
*/
|
|
92
|
-
export function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
105
|
+
export function varScopeOf(
|
|
106
|
+
id: string,
|
|
107
|
+
fields: readonly FieldDecl[],
|
|
108
|
+
): { allowedSegments: string[]; fieldKeys: string[] } {
|
|
109
|
+
// `attach.list[].kind` 的顶层段是 attach(`[]` 属于目录里的元素记法,不是段名)
|
|
110
|
+
const own = fields.map((f) => f.key.split('.')[0]!.replace(/\[\]$/, ''));
|
|
111
|
+
return {
|
|
112
|
+
allowedSegments: [...new Set([...SEED_SEGMENTS, ...own])],
|
|
113
|
+
fieldKeys: fields.map((f) => f.key),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** 链内顺序:按 order 升序(顺序不再落库,#152 起由类声明决定)。 */
|
|
118
|
+
export function chainOf(plugins: readonly AnyPromptPlugin[], group: string): AnyPromptPlugin[] {
|
|
119
|
+
return plugins.filter((p) => p.group === group).sort((a, b) => a.order - b.order);
|
|
103
120
|
}
|
|
104
121
|
|
|
105
122
|
/** UI 描述符(三端同源:CLI / HTTP / 设置页都消费它)。 */
|
|
106
123
|
export interface PluginUIDescriptor {
|
|
107
124
|
id: string;
|
|
108
|
-
/**
|
|
125
|
+
/** 触发时机(get / check / done)——UI 按它分组展示 */
|
|
126
|
+
group: string;
|
|
127
|
+
/** 链内顺序(类声明的 order;不是存储值) */
|
|
109
128
|
order: number;
|
|
110
129
|
tag: string;
|
|
111
130
|
label: string;
|
|
112
|
-
/** 文本态 →
|
|
131
|
+
/** 文本态 → 当前生效模板正文(#152 起 = 类里 templates[0]) */
|
|
113
132
|
template: string;
|
|
114
|
-
/**
|
|
133
|
+
/** 该插件的全部内置模板(#152:正文进代码,UI 只读展示) */
|
|
134
|
+
templates: readonly TemplateText[];
|
|
135
|
+
/** 插入变量目录(本段可见的全部字段) */
|
|
115
136
|
fields: readonly FieldDecl[];
|
|
116
|
-
/**
|
|
117
|
-
|
|
137
|
+
/** 本段可见的顶层段 = seed ∪ 自己的 dataSchema 顶层(不再有「可写段」概念) */
|
|
138
|
+
varScope: readonly string[];
|
|
118
139
|
}
|
|
119
140
|
|
|
120
|
-
/** 声明是 UI
|
|
121
|
-
export function uiDescriptor(plugins: readonly AnyPromptPlugin[]
|
|
141
|
+
/** 声明是 UI 的唯一数据源:不写第二份字段目录 / 不读顺序数组。 */
|
|
142
|
+
export function uiDescriptor(plugins: readonly AnyPromptPlugin[]): PluginUIDescriptor[] {
|
|
122
143
|
assertPluginList(plugins);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const p = byId.get(id)!;
|
|
127
|
-
return {
|
|
144
|
+
return [...plugins]
|
|
145
|
+
.sort((a, b) => (a.group === b.group ? a.order - b.order : a.group.localeCompare(b.group)))
|
|
146
|
+
.map((p) => ({
|
|
128
147
|
id: p.id,
|
|
129
|
-
|
|
148
|
+
group: p.group,
|
|
149
|
+
order: p.order,
|
|
130
150
|
tag: p.tag,
|
|
131
151
|
label: p.label,
|
|
132
152
|
template: p.get(),
|
|
153
|
+
templates: p.templates,
|
|
133
154
|
fields: p.schema.fields,
|
|
134
|
-
|
|
135
|
-
};
|
|
136
|
-
});
|
|
155
|
+
varScope: varScopeOf(p.id, p.schema.fields).allowedSegments,
|
|
156
|
+
}));
|
|
137
157
|
}
|
|
138
158
|
|
|
139
159
|
/**
|
package/src/web/frontend/App.tsx
CHANGED
|
@@ -46,6 +46,7 @@ import { loadPrefs, updatePrefs } from './prefs.js';
|
|
|
46
46
|
import { nextRepoData } from './repo-data.js';
|
|
47
47
|
import SidebarRescueFab from './components/sidebar/rescue-fab.jsx';
|
|
48
48
|
import { pushRoute } from './components/layout/route-history.js';
|
|
49
|
+
import { sameRoute } from './routes/route-eq.js';
|
|
49
50
|
import type { AppRoute, BoardRow, LocaltasksData, LocalTask, LocalTopic, Prefs, RepoData, RepoRow, SpecCtx } from './types.js';
|
|
50
51
|
import type { AppValue } from './app-context.jsx';
|
|
51
52
|
|
|
@@ -115,6 +116,30 @@ function routeFromHash(): AppRoute {
|
|
|
115
116
|
scope: '',
|
|
116
117
|
};
|
|
117
118
|
}
|
|
119
|
+
// #151:主题级模板管理页(#/templates/manage/<sessionId>)
|
|
120
|
+
if (rest.startsWith('manage/')) {
|
|
121
|
+
return {
|
|
122
|
+
view: 'templates',
|
|
123
|
+
key: '',
|
|
124
|
+
task: '',
|
|
125
|
+
mode: 'manage',
|
|
126
|
+
id: decodeURIComponent(rest.slice(7)),
|
|
127
|
+
topic: '',
|
|
128
|
+
scope: '',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// #151:参数填写中间页(#/templates/fill/<sessionId>,会话在内存里)
|
|
132
|
+
if (rest.startsWith('fill/')) {
|
|
133
|
+
return {
|
|
134
|
+
view: 'templates',
|
|
135
|
+
key: '',
|
|
136
|
+
task: '',
|
|
137
|
+
mode: 'fill',
|
|
138
|
+
id: decodeURIComponent(rest.slice(5)),
|
|
139
|
+
topic: '',
|
|
140
|
+
scope: '',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
118
143
|
if (rest === 'new') {
|
|
119
144
|
return {
|
|
120
145
|
view: 'templates',
|
|
@@ -200,7 +225,8 @@ export default function App() {
|
|
|
200
225
|
// 队列建好了、hash 也写了,两拍后又被弹回 #/group/…。
|
|
201
226
|
setRoute((prev) => {
|
|
202
227
|
const next = routeFromHash();
|
|
203
|
-
|
|
228
|
+
// 全字段比较(见 route-eq.ts):少比 mode/id 会让模板视图内的跳转被判成「没变」
|
|
229
|
+
return sameRoute(prev, next) ? prev : next;
|
|
204
230
|
});
|
|
205
231
|
}, []);
|
|
206
232
|
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
"action": {
|
|
388
388
|
"id": "repo.doc.add",
|
|
389
389
|
"module": "repos",
|
|
390
|
-
"summary": "给项目加一篇介绍文档:--ref <refId> | --path <外部绝对路径>(同 ref 重复添加 =
|
|
390
|
+
"summary": "给项目加一篇介绍文档:--ref <refId> | --path <外部绝对路径>(同 ref 重复添加 = 移到末尾)",
|
|
391
391
|
"usage": "repo doc add",
|
|
392
392
|
"http": "POST /api/repos/docs"
|
|
393
393
|
},
|
|
@@ -816,21 +816,6 @@
|
|
|
816
816
|
],
|
|
817
817
|
"action": null,
|
|
818
818
|
"children": [
|
|
819
|
-
{
|
|
820
|
-
"name": "attach-note",
|
|
821
|
-
"path": [
|
|
822
|
-
"docs",
|
|
823
|
-
"attach-note"
|
|
824
|
-
],
|
|
825
|
-
"action": {
|
|
826
|
-
"id": "doc.attach-note",
|
|
827
|
-
"module": "docs",
|
|
828
|
-
"summary": "改一条附件绑定的说明(desc):--attachment <资源 id> --note <说明>(只动说明,角色/位置不变)",
|
|
829
|
-
"usage": "docs attach-note",
|
|
830
|
-
"http": "PATCH /api/docs/attach-note"
|
|
831
|
-
},
|
|
832
|
-
"children": []
|
|
833
|
-
},
|
|
834
819
|
{
|
|
835
820
|
"name": "attach",
|
|
836
821
|
"path": [
|
|
@@ -1092,7 +1077,7 @@
|
|
|
1092
1077
|
"action": {
|
|
1093
1078
|
"id": "docs.link",
|
|
1094
1079
|
"module": "docs",
|
|
1095
|
-
"summary": "维护组的附加文档列表(--ref <refId> | --path
|
|
1080
|
+
"summary": "维护组的附加文档列表(--ref <refId> | --path <外部路径>;--remove <序号> 移除;--before <序号> 插位;同 ref 重复添加 = 移位)",
|
|
1096
1081
|
"usage": "docs link",
|
|
1097
1082
|
"http": "POST /api/docs/link"
|
|
1098
1083
|
},
|
|
@@ -1343,7 +1328,7 @@
|
|
|
1343
1328
|
"action": {
|
|
1344
1329
|
"id": "localtask.config",
|
|
1345
1330
|
"module": "localtask",
|
|
1346
|
-
"summary": "配置等待超时(秒)/
|
|
1331
|
+
"summary": "配置等待超时(秒)/ 系统上下文追加模式(提示词模板正文固定在插件类里,不再可配)",
|
|
1347
1332
|
"usage": "localtask config",
|
|
1348
1333
|
"http": "PATCH /api/localtasks/setting"
|
|
1349
1334
|
},
|
|
@@ -1493,7 +1478,7 @@
|
|
|
1493
1478
|
"action": {
|
|
1494
1479
|
"id": "localtask.prune",
|
|
1495
1480
|
"module": "localtask",
|
|
1496
|
-
"summary": "
|
|
1481
|
+
"summary": "清理旧脏数据(旧模型无目录主题、空主题;--missing-dir 连目录已不存在的主题一起清;等待中一律保留)",
|
|
1497
1482
|
"usage": "localtask prune",
|
|
1498
1483
|
"http": "POST /api/localtasks/prune"
|
|
1499
1484
|
},
|
|
@@ -1901,6 +1886,21 @@
|
|
|
1901
1886
|
},
|
|
1902
1887
|
"children": []
|
|
1903
1888
|
},
|
|
1889
|
+
{
|
|
1890
|
+
"name": "reorder",
|
|
1891
|
+
"path": [
|
|
1892
|
+
"template",
|
|
1893
|
+
"reorder"
|
|
1894
|
+
],
|
|
1895
|
+
"action": {
|
|
1896
|
+
"id": "templates.reorder",
|
|
1897
|
+
"module": "templates",
|
|
1898
|
+
"summary": "调整任务模板顺序(--ids a,b,c 按新序落库 sort_order;未列出的模板保持原位)",
|
|
1899
|
+
"usage": "template reorder",
|
|
1900
|
+
"http": "PATCH /api/templates/reorder"
|
|
1901
|
+
},
|
|
1902
|
+
"children": []
|
|
1903
|
+
},
|
|
1904
1904
|
{
|
|
1905
1905
|
"name": "update",
|
|
1906
1906
|
"path": [
|
|
@@ -2134,21 +2134,6 @@
|
|
|
2134
2134
|
],
|
|
2135
2135
|
"action": null,
|
|
2136
2136
|
"children": [
|
|
2137
|
-
{
|
|
2138
|
-
"name": "order",
|
|
2139
|
-
"path": [
|
|
2140
|
-
"prompt",
|
|
2141
|
-
"order"
|
|
2142
|
-
],
|
|
2143
|
-
"action": {
|
|
2144
|
-
"id": "prompt.order",
|
|
2145
|
-
"module": "promptplug",
|
|
2146
|
-
"summary": "写提示词插件顺序数组(唯一真相;必须恰好包含全部 8 个插件 id 各一次)",
|
|
2147
|
-
"usage": "prompt order",
|
|
2148
|
-
"http": "PUT /api/prompt/order"
|
|
2149
|
-
},
|
|
2150
|
-
"children": []
|
|
2151
|
-
},
|
|
2152
2137
|
{
|
|
2153
2138
|
"name": "registry",
|
|
2154
2139
|
"path": [
|
|
@@ -2158,7 +2143,7 @@
|
|
|
2158
2143
|
"action": {
|
|
2159
2144
|
"id": "prompt.registry",
|
|
2160
2145
|
"module": "promptplug",
|
|
2161
|
-
"summary": "
|
|
2146
|
+
"summary": "提示词插件注册表:按时机链(get / check / done)列出插件的内置模板 / 变量目录 / 链内顺序",
|
|
2162
2147
|
"usage": "prompt registry",
|
|
2163
2148
|
"http": "GET /api/prompt/registry"
|
|
2164
2149
|
},
|