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
|
@@ -1,52 +1,30 @@
|
|
|
1
|
-
// 本机设置仓储:settings 表的 lt.* 键(超时 /
|
|
1
|
+
// 本机设置仓储:settings 表的 lt.* 键(超时 / 追加模式)。
|
|
2
2
|
//
|
|
3
3
|
// 为什么走 k/v 而不是宽表:这些键会持续增加,加键零迁移(schema G2 的取舍)。
|
|
4
|
-
// value 一律 JSON 文本('240' / '
|
|
4
|
+
// value 一律 JSON 文本('240' / '"xml"'),读写都在这里序列化。
|
|
5
5
|
// 凭据(token/baseUrl/email/userId/groupId)**绝不进这张表** —— 它们留在 config.json。
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
// -
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// - 全局只有 `lt.appendMode`(xml / plain)对所有区块整体生效。
|
|
13
|
-
// - 没有落库行 = 事故,抛错(ensure 恒先于本文件的任何读取执行)。
|
|
7
|
+
// 提示词模板模型(#152 重构):
|
|
8
|
+
// - **模板正文的唯一真相是插件类**(modules/promptplug/plugins/*.ts 的 `templates`)。
|
|
9
|
+
// 没有 JSON 注册表、没有 DB seed、没有「每区块 active + list」这套落库模型,
|
|
10
|
+
// 也没有从库里派生出来的镜像——要用正文就读插件类(activeTemplateOf)。
|
|
11
|
+
// - 因此本文件只剩两个真正可写的键:`lt.timeoutSec` 与 `lt.appendMode`。
|
|
14
12
|
import { db, txw } from './open.js';
|
|
15
13
|
import { nowMs } from '../../../core/db/time.js';
|
|
16
|
-
import { badInput } from '../../../core/errors.js';
|
|
17
|
-
import { validateTemplate } from '../../../core/instruction-template.js';
|
|
18
14
|
import {
|
|
19
15
|
DEFAULT_TIMEOUT_SEC,
|
|
20
16
|
MAX_TIMEOUT_SEC,
|
|
21
17
|
clampTimeoutSec,
|
|
22
18
|
} from '../store-io.js';
|
|
23
|
-
import {
|
|
24
|
-
clampAckPromptList,
|
|
25
|
-
clampDeliveryTemplate,
|
|
26
|
-
clampAttachTemplate,
|
|
27
|
-
clampAppendMode,
|
|
28
|
-
} from '../task-templates.js';
|
|
29
|
-
import {
|
|
30
|
-
BUILTIN_TEMPLATE_ID,
|
|
31
|
-
MAX_BLOCK_TEMPLATE_LEN,
|
|
32
|
-
PROMPT_BLOCK_IDS,
|
|
33
|
-
normalizeBlockTemplateLists,
|
|
34
|
-
resolveBlockTemplates,
|
|
35
|
-
} from '../../../shared/prompt-blocks.js';
|
|
36
|
-
import type { BlockLists, BlockTemplateList } from '../../../shared/prompt-blocks.js';
|
|
19
|
+
import { clampAppendMode } from '../task-templates.js';
|
|
37
20
|
import type { DbApi } from '../../../core/db/driver.js';
|
|
38
|
-
import {
|
|
39
|
-
import { globalTemplateVarScope, blockLabelOf } from '../../promptplug/index.js';
|
|
21
|
+
import { activeTemplateOf } from '../../promptplug/index.js';
|
|
40
22
|
|
|
41
23
|
const KEYS = {
|
|
42
24
|
timeoutSec: 'lt.timeoutSec',
|
|
43
25
|
appendMode: 'lt.appendMode',
|
|
44
|
-
blockTemplates: 'lt.blockTemplates',
|
|
45
26
|
};
|
|
46
27
|
|
|
47
|
-
/** 命令行便捷写入使用的固定条目 id(不影响用户自己新建的模板)。 */
|
|
48
|
-
const CLI_ENTRY_ID = 'cli';
|
|
49
|
-
|
|
50
28
|
function readSetting(conn: DbApi, key: string): any {
|
|
51
29
|
const row = conn.get('SELECT value FROM settings WHERE key = :k', { k: key });
|
|
52
30
|
if (!row) return undefined;
|
|
@@ -65,194 +43,44 @@ function writeSetting(conn: DbApi, key: string, value: unknown): void {
|
|
|
65
43
|
);
|
|
66
44
|
}
|
|
67
45
|
|
|
68
|
-
/**
|
|
69
|
-
function joinEntries(list?: string[]): string {
|
|
70
|
-
return (list || []).join('\n\n');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** 一条模板 → 旧版「多条」视图(按空行拆分;供旧 CLI/面板字段兼容)。 */
|
|
46
|
+
/** 一条模板 → 「多条」视图(按空行拆分;旧 CLI 字段兼容用)。 */
|
|
74
47
|
function splitEntries(template: unknown): string[] {
|
|
75
48
|
const s = String(template ?? '').trim();
|
|
76
49
|
return s ? s.split(/\n{2,}/).map((x) => x.trim()).filter(Boolean) : [];
|
|
77
50
|
}
|
|
78
51
|
|
|
79
|
-
|
|
80
|
-
const s = String(v ?? '').trim();
|
|
81
|
-
return s.length > MAX_BLOCK_TEMPLATE_LEN ? s.slice(0, MAX_BLOCK_TEMPLATE_LEN) : s;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 读「每区块模板列表 + 全局追加模式」(**纯读 + 纯校验**)。
|
|
86
|
-
* `lt.blockTemplates` 恒存在(open.ts 的 ensurePromptTemplates 首启落库);
|
|
87
|
-
* 没有行 / 校验不过都是事故,抛错——不合成、不补齐(方案 §4.1)。
|
|
88
|
-
*/
|
|
89
|
-
function readBlockState(conn: DbApi): { lists: BlockLists; appendMode: string } {
|
|
90
|
-
const stored = readSetting(conn, KEYS.blockTemplates);
|
|
91
|
-
return {
|
|
92
|
-
lists: normalizeBlockTemplateLists(stored),
|
|
93
|
-
appendMode: clampAppendMode(readSetting(conn, KEYS.appendMode)),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** 当前生效模板 → 旧版派生字段(仅用于 CLI/旧面板视图兼容,不是读写模型)。 */
|
|
98
|
-
function derivedOf(lists: BlockLists): { ackPrompt: string[]; deliveryTemplate: string; attachTemplate: string } {
|
|
99
|
-
const active = resolveBlockTemplates(lists);
|
|
100
|
-
return {
|
|
101
|
-
// 旧视图的「多条」字段按当前生效模板拆分(内置模板也如实反映)
|
|
102
|
-
ackPrompt: splitEntries(active.ack!.template),
|
|
103
|
-
deliveryTemplate: active.context!.builtin ? '' : active.context!.template,
|
|
104
|
-
attachTemplate: active.attachment!.builtin ? '' : active.attachment!.template,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** 读全部 lt.* 设置(校验不过即抛——落库行被人为写坏是事故)。 */
|
|
52
|
+
/** 读全部 lt.* 设置。 */
|
|
109
53
|
export function getLtSettings(): Record<string, any> {
|
|
110
54
|
const conn = db();
|
|
111
|
-
const { lists, appendMode } = readBlockState(conn);
|
|
112
55
|
return {
|
|
113
56
|
timeoutSec: clampTimeoutSec(readSetting(conn, KEYS.timeoutSec)),
|
|
114
|
-
appendMode,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 保存前的模板校验(方案 §4.2,三道):
|
|
122
|
-
* 1. 语法错误**拒绝保存**并指出模板 / 区块 / 出错位置(渲染期不再回落);
|
|
123
|
-
* 2. 当前生效(active)模板为空 → 拒绝——空模板在运行期是配置错误(S1 起
|
|
124
|
-
* compose 的 assertPluginList 直接抛),不许「保存成功、领取时整次失败」;
|
|
125
|
-
* 3. 变量白名单:全局段集 + 点路径全路径命中 fields 并集(落地裁决见方案 §4.2 补记;
|
|
126
|
-
* `params` 动态键放行,`{{#each}}` 块内放行但 each 目标必须已声明)。
|
|
127
|
-
*/
|
|
128
|
-
function assertBlockTemplatesValid(lists: BlockLists): void {
|
|
129
|
-
const scope = globalTemplateVarScope();
|
|
130
|
-
for (const blockId of PROMPT_BLOCK_IDS) {
|
|
131
|
-
const b = lists[blockId]!;
|
|
132
|
-
const label = blockLabelOf(blockId);
|
|
133
|
-
for (const item of b.list) {
|
|
134
|
-
if (!item.template) continue; // 非 active 的空条目合法(不渲染,仅存档)
|
|
135
|
-
const r = validateTemplate(item.template);
|
|
136
|
-
if (!r.ok) {
|
|
137
|
-
throw badInput(
|
|
138
|
-
`提示词模板「${item.name}」的「${label}」区块语法错误:${r.error}`
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// 生效模板的空 / 变量白名单
|
|
143
|
-
const active = b.list.find((x) => x.id === b.active);
|
|
144
|
-
if (active && !active.template.trim()) {
|
|
145
|
-
throw badInput(`「${label}」区块当前生效的模板「${active.name}」是空的:换回内置或改成有内容的模板后再保存`);
|
|
146
|
-
}
|
|
147
|
-
if (active && active.template) {
|
|
148
|
-
const undeclared = undeclaredTemplateVars(active.template, scope.allowedSegments, scope.fieldKeys);
|
|
149
|
-
if (undeclared.length) {
|
|
150
|
-
throw badInput(
|
|
151
|
-
`「${label}」区块的生效模板「${active.name}」引用了未声明的变量:${undeclared.join('、')}。可用变量见设置页「插入变量」目录`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* 命令行便捷入口:把一条模板写入某区块的固定条目(`cli`)并设为生效;
|
|
160
|
-
* 空模板 = 恢复内置(保留用户其它条目,只把 active 指回 builtin)。
|
|
161
|
-
* 内置条目恒在(normalize 校验保证),直接从现值取——不再按代码重建。
|
|
162
|
-
*/
|
|
163
|
-
function setCustomActive(lists: BlockLists, blockId: string, template: unknown, { name = '命令行' }: { name?: string } = {}): void {
|
|
164
|
-
const b = lists[blockId]; // normalize 保证全部区块存在
|
|
165
|
-
if (!b) throw badInput(`未知提示词区块:${blockId}`);
|
|
166
|
-
const builtin = b.list.find((x) => x.id === BUILTIN_TEMPLATE_ID);
|
|
167
|
-
if (!builtin) throw badInput(`「${blockLabelOf(blockId)}」区块缺内置条目(落库行被写坏)`);
|
|
168
|
-
const t = clampTemplate(template);
|
|
169
|
-
if (!t) {
|
|
170
|
-
lists[blockId] = { active: BUILTIN_TEMPLATE_ID, list: b.list };
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const rest = b.list.filter((x) => x.id !== BUILTIN_TEMPLATE_ID && x.id !== CLI_ENTRY_ID);
|
|
174
|
-
lists[blockId] = {
|
|
175
|
-
active: CLI_ENTRY_ID,
|
|
176
|
-
list: [builtin, { id: CLI_ENTRY_ID, name, template: t, builtin: false }, ...rest],
|
|
57
|
+
appendMode: clampAppendMode(readSetting(conn, KEYS.appendMode)),
|
|
58
|
+
// 旧视图字段:ack 段落正文来自 ack 插件类的内置模板,仍按「多条」形态给出,
|
|
59
|
+
// 让老 CLI 的 localtask config 输出不必断代(#152:只是回显,不可写)。
|
|
60
|
+
ackPrompt: splitEntries(activeTemplateOf('ack')),
|
|
177
61
|
};
|
|
178
62
|
}
|
|
179
63
|
|
|
180
|
-
/** setLtSettings 的 patch
|
|
64
|
+
/** setLtSettings 的 patch 形状(#152:模板不再可写,只留两个键)。 */
|
|
181
65
|
export interface LtSettingsPatch {
|
|
182
66
|
timeoutSec?: unknown;
|
|
183
67
|
appendMode?: unknown;
|
|
184
|
-
blockTemplates?: unknown;
|
|
185
|
-
ackPrompt?: unknown;
|
|
186
|
-
deliveryTemplate?: unknown;
|
|
187
|
-
attachTemplate?: unknown;
|
|
188
68
|
}
|
|
189
69
|
|
|
190
|
-
/** 写部分设置(只改传入项;校验沿用 store-io
|
|
70
|
+
/** 写部分设置(只改传入项;校验沿用 store-io 的 clamp)。 */
|
|
191
71
|
export function setLtSettings(patch: LtSettingsPatch = {}): Record<string, any> {
|
|
192
72
|
return txw((conn) => {
|
|
193
73
|
if (patch.timeoutSec !== undefined) {
|
|
194
74
|
writeSetting(conn, KEYS.timeoutSec, clampTimeoutSec(patch.timeoutSec));
|
|
195
75
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
patch.blockTemplates !== undefined ||
|
|
199
|
-
patch.appendMode !== undefined ||
|
|
200
|
-
patch.ackPrompt !== undefined ||
|
|
201
|
-
patch.deliveryTemplate !== undefined ||
|
|
202
|
-
patch.attachTemplate !== undefined;
|
|
203
|
-
if (!touches) return getLtSettings();
|
|
204
|
-
|
|
205
|
-
const current = readBlockState(conn);
|
|
206
|
-
let lists = current.lists;
|
|
207
|
-
|
|
208
|
-
// 新模型:按区块合并(只传某个区块时不动其它区块的列表),整体过纯校验。
|
|
209
|
-
// 历史 rule 键已下线:patch 里带 rule 直接忽略(§11 不做旧配置兼容)。
|
|
210
|
-
if (patch.blockTemplates !== undefined) {
|
|
211
|
-
const raw = patch.blockTemplates as Record<string, any> | undefined;
|
|
212
|
-
const merged = { ...lists };
|
|
213
|
-
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
214
|
-
for (const blockId of PROMPT_BLOCK_IDS) {
|
|
215
|
-
if (raw[blockId] !== undefined) merged[blockId] = raw[blockId];
|
|
216
|
-
}
|
|
217
|
-
// 内置不可改(§4.2 第 1 道):被 patch 的区块里,builtin 条目一律替换回
|
|
218
|
-
// 库内现值(含 name / template / 位置)——落库后 builtin 是真数据,
|
|
219
|
-
// 客户端传什么都不生效;patch 缺 builtin 条目时补回。
|
|
220
|
-
for (const blockId of PROMPT_BLOCK_IDS) {
|
|
221
|
-
const next = merged[blockId];
|
|
222
|
-
const cur = lists[blockId];
|
|
223
|
-
if (raw[blockId] === undefined || !next || !cur) continue;
|
|
224
|
-
const curBuiltin = cur.list.find((x) => x.id === BUILTIN_TEMPLATE_ID)!;
|
|
225
|
-
const rest = (Array.isArray(next.list) ? next.list : []).filter(
|
|
226
|
-
(x: any) => x && x.id !== BUILTIN_TEMPLATE_ID && x.builtin !== true,
|
|
227
|
-
);
|
|
228
|
-
merged[blockId] = { ...next, list: [curBuiltin, ...rest] };
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
lists = normalizeBlockTemplateLists(merged);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// CLI 便捷入口:写入对应区块的 `cli` 条目并启用(空 = 恢复内置)。
|
|
235
|
-
if (patch.ackPrompt !== undefined) {
|
|
236
|
-
setCustomActive(lists, 'ack', joinEntries(clampAckPromptList(patch.ackPrompt)));
|
|
76
|
+
if (patch.appendMode !== undefined) {
|
|
77
|
+
writeSetting(conn, KEYS.appendMode, clampAppendMode(patch.appendMode));
|
|
237
78
|
}
|
|
238
|
-
if (patch.deliveryTemplate !== undefined) {
|
|
239
|
-
setCustomActive(lists, 'context', clampDeliveryTemplate(patch.deliveryTemplate));
|
|
240
|
-
}
|
|
241
|
-
if (patch.attachTemplate !== undefined) {
|
|
242
|
-
setCustomActive(lists, 'attachment', clampAttachTemplate(patch.attachTemplate));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
assertBlockTemplatesValid(lists);
|
|
246
|
-
|
|
247
|
-
const appendMode =
|
|
248
|
-
patch.appendMode !== undefined ? clampAppendMode(patch.appendMode) : current.appendMode;
|
|
249
|
-
writeSetting(conn, KEYS.blockTemplates, lists);
|
|
250
|
-
writeSetting(conn, KEYS.appendMode, appendMode);
|
|
251
79
|
return getLtSettings();
|
|
252
80
|
});
|
|
253
81
|
}
|
|
254
82
|
|
|
255
|
-
/** 面板/CLI
|
|
83
|
+
/** 面板/CLI 的设置视图(派生兼容字段在这里补齐)。 */
|
|
256
84
|
export function settingsView(): Record<string, any> {
|
|
257
85
|
const s = getLtSettings();
|
|
258
86
|
return {
|
|
@@ -260,13 +88,9 @@ export function settingsView(): Record<string, any> {
|
|
|
260
88
|
recommendedSec: DEFAULT_TIMEOUT_SEC,
|
|
261
89
|
maxSec: MAX_TIMEOUT_SEC,
|
|
262
90
|
ackPromptList: s.ackPrompt,
|
|
263
|
-
deliveryTemplate: s.deliveryTemplate,
|
|
264
|
-
attachTemplate: s.attachTemplate,
|
|
265
91
|
appendMode: s.appendMode,
|
|
266
|
-
blockTemplates: s.blockTemplates,
|
|
267
92
|
};
|
|
268
93
|
}
|
|
269
94
|
|
|
270
95
|
export { DEFAULT_TIMEOUT_SEC, MAX_TIMEOUT_SEC } from '../store-io.js';
|
|
271
96
|
export { DEFAULT_ACK_PROMPT } from '../task-templates.js';
|
|
272
|
-
export type { BlockTemplateList };
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// 业务值而不是抛错)、reopenTask(用户修改反馈 → **就地重开原任务**,历史进 history 链)。
|
|
4
4
|
import { badInput, notFound } from '../../core/errors.js';
|
|
5
5
|
import { formatDuration, renderInstruction } from '../../core/instruction-template.js';
|
|
6
|
-
import {
|
|
7
|
-
import { getLtSettings } from './repo/settings.js';
|
|
6
|
+
import { activeTemplateOf } from '../promptplug/index.js';
|
|
8
7
|
import { taskGoalTemplateCtx } from '../tasktool/plugins/goal-template.js';
|
|
9
8
|
import { preserveFrontmatter } from '../../shared/frontmatter.js';
|
|
10
9
|
import {
|
|
@@ -33,14 +32,13 @@ interface SupersederRef {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
|
-
* 「未到点就想 done」的拦截提示(#90
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* 「未到点就想 done」的拦截提示(#90):模板是 doneguard 插件类的内置正文
|
|
36
|
+
* (#152 起不再从 settings 解析;与其余系统段同一套 Handlebars 引擎与 ctx)。
|
|
37
|
+
* 渲染失败退回 '',调用方仍用内置 hint,门禁本身的业务结果不受模板影响。
|
|
39
38
|
*/
|
|
40
39
|
function renderDoneGuard({ taskId, taskText, goalKey, st }: { taskId: number; taskText: string; goalKey: string; st: any }): string {
|
|
41
40
|
try {
|
|
42
|
-
const
|
|
43
|
-
const tpl = resolveBlockTemplates(s && s.blockTemplates).doneguard!.template;
|
|
41
|
+
const tpl = activeTemplateOf('doneguard');
|
|
44
42
|
const goal = st.goal || {};
|
|
45
43
|
const ctx = taskGoalTemplateCtx({
|
|
46
44
|
taskId,
|
|
@@ -355,8 +353,8 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
355
353
|
const { taskGoalState, recordTaskCheck } = await import('../tasktool/taskgoal.js');
|
|
356
354
|
const st = await taskGoalState({ topicKey: key, taskId: want });
|
|
357
355
|
if (st.hasGoal && !st.reached) {
|
|
358
|
-
// 「未到点就想 done
|
|
359
|
-
//
|
|
356
|
+
// 「未到点就想 done」的拦截提示(#90):模板与其它区块同源,是 doneguard
|
|
357
|
+
// 插件类的内置正文(#152);渲染失败退回内置 hint,不挡业务结果。
|
|
360
358
|
const guard = renderDoneGuard({
|
|
361
359
|
taskId: want,
|
|
362
360
|
taskText: task.text,
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 默认 ack:完成任务就调用 localtask done 回填结果(任务 51 的职责合并决定)。
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* #152 起模板正文的唯一真相是插件类——ack 段的正文在
|
|
9
|
+
* modules/promptplug/plugins/ack.ts 的 BUILTIN;这里保留一份同文常量
|
|
10
|
+
* 只为兼容旧引用(设置视图的「多条」形态回显)。改文案请改插件类。
|
|
11
11
|
*/
|
|
12
12
|
export const DEFAULT_ACK_PROMPT =
|
|
13
13
|
'完成之后必须调用 nx-kv localtask done --id {{task.id}} --summary "<完成总结>" 汇报结果。';
|
|
@@ -71,7 +71,7 @@ export function joinAckPrompt(v: unknown): string {
|
|
|
71
71
|
// ─── 系统上下文追加模式 + XML 区块配置(settings 两键)───────────────
|
|
72
72
|
//
|
|
73
73
|
// appendMode:'xml'(默认,每段包独立标签)| 'plain'(改造前按空行直拼)。
|
|
74
|
-
//
|
|
74
|
+
// 每个区块的模板正文在插件类里(modules/promptplug/plugins/*.ts),不再有落库模型。
|
|
75
75
|
export const APPEND_MODE_IDS = Object.freeze(APPEND_MODES.map((m) => m.id));
|
|
76
76
|
|
|
77
77
|
/** 归一化追加模式:缺省/非法 → xml(默认足够清晰)。 */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// (#54 自 service.js 拆出)任务行/主题的只读视图与队列内关系原语:
|
|
2
2
|
// normalizeTask(含 ready 徽标)、topicView、跨队列依赖解析器(foreignResolver)、
|
|
3
3
|
// 队列内关系清单(queueRelationsOf)与搬家(relocateTask)。
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
4
5
|
import { badInput, notFound } from '../../core/errors.js';
|
|
5
6
|
import { sanitizeTaskGoal } from '../tasktool/taskgoal.js';
|
|
6
7
|
import { normalizeBlockBy, isReadyToClaim } from './dag.js';
|
|
@@ -319,6 +320,9 @@ export function topicView(t: any, repoCtx: any = null, readyOpts: ReadyOpts = {}
|
|
|
319
320
|
return {
|
|
320
321
|
key: t.key,
|
|
321
322
|
cwd: t.cwd || '',
|
|
323
|
+
// 目录还在不在:临时目录被删 / 外接盘未挂载 / 测试残留都会让 cwd 失效。
|
|
324
|
+
// UI 与 prune --missing-dir 都靠它判断「这条主题是幽灵还是真的」。
|
|
325
|
+
cwdExists: t.isGlobal ? true : !!t.cwd && existsSync(String(t.cwd)),
|
|
322
326
|
name: t.name || '',
|
|
323
327
|
summary: t.summary || '',
|
|
324
328
|
// 提交方(add --summary)留下的补充说明:与 agent 的「当前现状」分开存,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
// T03:存储切到 repo/(SQLite)。本文件不再直接读写任何存储形状 ——
|
|
5
5
|
// 读走 repo.topics 的 JSON 形态投影,写走窄方法(一个动作一个事务)。
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
6
7
|
import { badInput } from '../../core/errors.js';
|
|
7
8
|
import { normalizeCwd } from './paths.js';
|
|
8
9
|
import { normalizeSummary } from './store-io.js';
|
|
@@ -86,13 +87,19 @@ export async function getSettings(): Promise<Record<string, any>> {
|
|
|
86
87
|
// 清理旧脏数据:只动「非等待中」的主题——
|
|
87
88
|
// 1) 旧模型迁移来的无 cwd 主题(“旧数据,无目录”);
|
|
88
89
|
// 2) 空主题(没有任何任务);
|
|
89
|
-
// 3) allFinished
|
|
90
|
+
// 3) allFinished 时,连同「已全部领取、无待领」的主题一起清;
|
|
91
|
+
// 4) missingDir 时,清「cwd 已不存在且没有待领任务」的主题
|
|
92
|
+
// (删掉的临时目录 / 测试残留;外接盘没挂载也会命中,所以必须显式开)。
|
|
90
93
|
// 等待中的主题与全局主题一律保留;dryRun 只报告不改动。
|
|
91
94
|
//
|
|
92
95
|
// **僵尸等待标志不算"等待中"**:wait 被强杀后残留的 waiting:true 会让主题
|
|
93
96
|
// 永远躲过清理(gs-ac 就这么卡住的)。用 isLiveWaiting 判定——截止已过 = 没人
|
|
94
97
|
// 在等 = 可以清。
|
|
95
|
-
export async function pruneTopics({
|
|
98
|
+
export async function pruneTopics({
|
|
99
|
+
allFinished = false,
|
|
100
|
+
dryRun = false,
|
|
101
|
+
missingDir = false,
|
|
102
|
+
}: { allFinished?: boolean; dryRun?: boolean; missingDir?: boolean } = {}): Promise<Record<string, any>> {
|
|
96
103
|
openStore();
|
|
97
104
|
const removed: Array<{ key: string; name: string; cwd: string; reason: string }> = [];
|
|
98
105
|
for (const t of topicsRepo.listTopics()) {
|
|
@@ -104,8 +111,15 @@ export async function pruneTopics({ allFinished = false, dryRun = false }: { all
|
|
|
104
111
|
const isLegacy = !t.cwd;
|
|
105
112
|
const isEmpty = tasks.length === 0;
|
|
106
113
|
const isFinished = allFinished && tasks.length > 0 && !hasPending;
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
const cwdGone = missingDir && !!t.cwd && !hasPending && !existsSync(String(t.cwd));
|
|
115
|
+
if (isLegacy || isEmpty || isFinished || cwdGone) {
|
|
116
|
+
const reason = isLegacy
|
|
117
|
+
? '旧模型无目录'
|
|
118
|
+
: isEmpty
|
|
119
|
+
? '空主题'
|
|
120
|
+
: cwdGone
|
|
121
|
+
? '目录已不存在'
|
|
122
|
+
: '已完成无待领';
|
|
109
123
|
removed.push({ key: t.key, name: t.name || t.key, cwd: t.cwd || '', reason });
|
|
110
124
|
}
|
|
111
125
|
}
|
|
@@ -115,33 +129,25 @@ export async function pruneTopics({ allFinished = false, dryRun = false }: { all
|
|
|
115
129
|
return { status: 'ok', dryRun: !!dryRun, count: removed.length, removed };
|
|
116
130
|
}
|
|
117
131
|
|
|
118
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* updateSettings 的入参(全部可选)。
|
|
134
|
+
*
|
|
135
|
+
* #152 起只剩两个真正可写的键:提示词模板正文的唯一真相搬到了插件类
|
|
136
|
+
* (modules/promptplug/plugins/*.ts 的 `templates`),DB 不再存模板,
|
|
137
|
+
* 因此 ackPrompt / deliveryTemplate / attachTemplate / blockTemplates 四个
|
|
138
|
+
* 写入通道一并删除(旧值也不再读取)。
|
|
139
|
+
*/
|
|
119
140
|
export interface UpdateSettingsInput {
|
|
120
141
|
timeoutSec?: unknown;
|
|
121
|
-
ackPrompt?: unknown;
|
|
122
|
-
deliveryTemplate?: unknown;
|
|
123
|
-
attachTemplate?: unknown;
|
|
124
142
|
appendMode?: unknown;
|
|
125
|
-
blockTemplates?: unknown;
|
|
126
143
|
}
|
|
127
144
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
// 传 '' / [] 恢复内置、不传保持不变。
|
|
131
|
-
//
|
|
132
|
-
// blockTemplates:每区块独立模板列表 `{ [blockId]: { active, list } }`
|
|
133
|
-
// (结构见 shared/prompt-blocks.js 的 normalizeBlockTemplateLists)。
|
|
134
|
-
export async function updateSettings({ timeoutSec, ackPrompt, deliveryTemplate, attachTemplate, appendMode, blockTemplates }: UpdateSettingsInput = {}): Promise<Record<string, any>> {
|
|
145
|
+
// 配置等待超时(页面可调)。超时推荐 180=3 分钟、最大 600=10 分钟。
|
|
146
|
+
export async function updateSettings({ timeoutSec, appendMode }: UpdateSettingsInput = {}): Promise<Record<string, any>> {
|
|
135
147
|
const hasTimeout = timeoutSec !== undefined && timeoutSec !== null;
|
|
136
|
-
const hasAck = ackPrompt !== undefined;
|
|
137
|
-
const hasDelivery = deliveryTemplate !== undefined;
|
|
138
|
-
const hasAttach = attachTemplate !== undefined;
|
|
139
148
|
const hasAppend = appendMode !== undefined;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
throw badInput(
|
|
143
|
-
'请至少指定一项:--timeout <秒>,或 --ack "<ack 提示词>",或 --append-mode,或 --block-templates "JSON 对象"'
|
|
144
|
-
);
|
|
149
|
+
if (!hasTimeout && !hasAppend) {
|
|
150
|
+
throw badInput('请至少指定一项:--timeout <秒>,或 --append-mode <xml|plain>');
|
|
145
151
|
}
|
|
146
152
|
if (hasTimeout) {
|
|
147
153
|
const n = Number(timeoutSec);
|
|
@@ -152,11 +158,7 @@ export async function updateSettings({ timeoutSec, ackPrompt, deliveryTemplate,
|
|
|
152
158
|
openStore();
|
|
153
159
|
settingsRepo.setLtSettings({
|
|
154
160
|
timeoutSec: hasTimeout ? timeoutSec : undefined,
|
|
155
|
-
ackPrompt: hasAck ? ackPrompt : undefined,
|
|
156
|
-
deliveryTemplate: hasDelivery ? deliveryTemplate : undefined,
|
|
157
|
-
attachTemplate: hasAttach ? attachTemplate : undefined,
|
|
158
161
|
appendMode: hasAppend ? appendMode : undefined,
|
|
159
|
-
blockTemplates: hasBlocks ? blockTemplates : undefined,
|
|
160
162
|
});
|
|
161
163
|
return settingsRepo.settingsView();
|
|
162
164
|
}
|
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import type { ActionBase } from '../../../runtime/action-base.js';
|
|
8
8
|
import type { Container } from '../../../runtime/container.js';
|
|
9
|
-
import { PromptOrderAction } from './prompt-order.js';
|
|
10
9
|
import { PromptRegistryAction } from './prompt-registry.js';
|
|
11
10
|
|
|
12
11
|
/** 本模块的全部 action 类(容器按这个顺序建实例)。 */
|
|
13
12
|
export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
14
|
-
PromptOrderAction,
|
|
15
13
|
PromptRegistryAction,
|
|
16
14
|
];
|
|
17
15
|
|
|
18
16
|
// 再导出类本身:前端 apiclient 的返回类型从这里 type-only 引用(实现即契约)。
|
|
19
|
-
export { PromptOrderAction };
|
|
20
17
|
export { PromptRegistryAction };
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
// prompt.registry ——
|
|
1
|
+
// prompt.registry —— 注册表外露:三端同源的唯一出口(#152 起**只读派生**)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// 真相是插件类本身(registry.ts 的 PLUGIN_CLASSES):id / 时机链 / 顺序 / 内置模板 /
|
|
4
|
+
// 变量目录全部从类声明派生。没有 JSON 注册表、没有 DB seed、也没有「顺序数组」——
|
|
5
|
+
// 顺序 = 链内 order。
|
|
6
6
|
//
|
|
7
|
-
// deps 全空:uiDescriptor 只读文本态(get()
|
|
8
|
-
// 结构态
|
|
7
|
+
// deps 全空:uiDescriptor 只读文本态(get())与声明面(fields/varScope/templates),
|
|
8
|
+
// 结构态 buildData() 永不被调用——不需要宿主取数。
|
|
9
9
|
import { action } from '../../../runtime/action-decorator.js';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
12
|
-
import { getDb } from '../../../core/db/index.js';
|
|
13
|
-
import { readSettingRaw } from '../../../core/db/settings.js';
|
|
14
|
-
import { resolveBlockTemplates } from '../../../shared/prompt-blocks.js';
|
|
15
12
|
import { uiDescriptor } from '../../../shared/prompt-plugin.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { ensurePromptTemplates } from '../ensure.js';
|
|
19
|
-
import { LT_BLOCK_TEMPLATES, PROMPT_ORDER_KEY } from '../keys.js';
|
|
13
|
+
import { buildAllPlugins } from '../factory.js';
|
|
14
|
+
import { allPluginIds, assertRegistry, groupIndex } from '../registry.js';
|
|
20
15
|
|
|
21
16
|
/** prompt.registry 的入参契约(无参)。 */
|
|
22
17
|
const input = z.object({});
|
|
@@ -26,26 +21,20 @@ export class PromptRegistryAction extends ActionBase<typeof input> {
|
|
|
26
21
|
id: 'prompt.registry',
|
|
27
22
|
cli: ['prompt', 'registry'],
|
|
28
23
|
http: ['GET', '/api/prompt/registry'],
|
|
29
|
-
summary: '
|
|
24
|
+
summary: '提示词插件注册表:按时机链(get / check / done)列出插件的内置模板 / 变量目录 / 链内顺序',
|
|
30
25
|
input,
|
|
31
26
|
render: (d: any) =>
|
|
32
|
-
d.plugins.map((p: any) =>
|
|
27
|
+
d.plugins.map((p: any) => `[${p.group}] ${p.order} ${p.id}(${p.label})`).join(';'),
|
|
33
28
|
})
|
|
34
29
|
override async run(_ctx: ActionInput<this['_input']>) {
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const plugins = buildDeliveryPlugins(resolved as any, {
|
|
45
|
-
groupCtx: null, attach: null, queueInfo: null, loopText: '', waitMinutes: 0,
|
|
46
|
-
});
|
|
47
|
-
const orderIds = readSettingRaw(conn, PROMPT_ORDER_KEY);
|
|
48
|
-
const pluginsDesc = uiDescriptor(plugins, Array.isArray(orderIds) ? orderIds : PLUGIN_IDS);
|
|
49
|
-
return { plugins: pluginsDesc };
|
|
30
|
+
assertRegistry();
|
|
31
|
+
// uiDescriptor 会按 group 名字母序排(check / done / get);对外的 plugins 数组
|
|
32
|
+
// 统一改用「时机声明序 + 链内 order」——与 groups 索引、CLI 渲染顺序逐项同序,
|
|
33
|
+
// 前端左轨直接按它铺开就不会出现「导航顺序 ≠ 实际输出顺序」。
|
|
34
|
+
const order = allPluginIds();
|
|
35
|
+
const plugins = uiDescriptor(buildAllPlugins()).sort(
|
|
36
|
+
(a, b) => order.indexOf(a.id) - order.indexOf(b.id),
|
|
37
|
+
);
|
|
38
|
+
return { groups: groupIndex(), plugins };
|
|
50
39
|
}
|
|
51
40
|
}
|