nx-kv 0.65.0 → 0.65.3
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 +59 -0
- package/package.json +1 -1
- package/src/core/db/seed-templates.ts +2 -86
- package/src/core/db/settings.ts +1 -1
- package/src/core/instruction-template.ts +1 -1
- package/src/core/workflow/plugin-registry.ts +1 -1
- package/src/core/workflow/types.ts +4 -4
- package/src/modules/claim/actions/_manifest.generated.ts +23 -0
- package/src/modules/{localtask → claim}/actions/localtask-claim.ts +4 -4
- package/src/modules/{localtask → claim}/actions/localtask-preview.ts +4 -4
- package/src/modules/{localtask → claim}/actions/localtask-wait.ts +4 -4
- package/src/modules/{tasktool → claim}/get.ts +3 -3
- package/src/modules/claim/index.ts +25 -0
- package/src/modules/{tasktool → claim}/panel-escort.ts +2 -2
- package/src/modules/{tasktool → claim}/params.ts +1 -1
- package/src/modules/claim/wait.ts +305 -0
- package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +4 -28
- package/src/modules/delivery/assemble.ts +151 -0
- package/src/modules/{tasktool → delivery}/attach-resource.ts +2 -2
- package/src/modules/{tasktool → delivery}/attach-template.ts +1 -1
- package/src/modules/{tasktool → delivery}/attach.ts +1 -1
- package/src/modules/{tasktool → delivery}/delivery-text.ts +2 -2
- package/src/modules/{tasktool → delivery}/doc-inline.ts +1 -1
- package/src/modules/{tasktool → delivery}/groupctx.ts +1 -1
- package/src/modules/delivery/host.ts +231 -0
- package/src/modules/delivery/index.ts +18 -0
- package/src/modules/{tasktool → delivery}/preview.ts +5 -6
- package/src/modules/{tasktool → goals}/actions/timegoal-check.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-clear.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-list.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-log.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-set.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-show.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-update.ts +1 -1
- package/src/modules/goals/index.ts +25 -0
- package/src/modules/{tasktool → goals}/plugins/discover.ts +3 -3
- package/src/modules/{tasktool → goals}/plugins/index.ts +0 -2
- package/src/modules/{tasktool → goals}/plugins/taskgoal-store.ts +3 -3
- package/src/modules/{tasktool → goals}/plugins/timegoal-task-store.ts +2 -2
- package/src/modules/localtask/action-render.ts +1 -1
- package/src/modules/localtask/actions/_manifest.generated.ts +0 -9
- package/src/modules/localtask/actions/localtask-add.ts +2 -2
- package/src/modules/localtask/actions/localtask-attach-note.ts +1 -1
- package/src/modules/localtask/actions/localtask-attach.ts +1 -1
- package/src/modules/localtask/actions/localtask-attachments.ts +1 -1
- package/src/modules/localtask/actions/localtask-detach.ts +1 -1
- package/src/modules/localtask/actions/localtask-get.ts +1 -1
- package/src/modules/localtask/actions/localtask-reopen.ts +1 -1
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +1 -1
- package/src/modules/localtask/actions/localtask-update.ts +2 -2
- package/src/modules/{tasktool → localtask}/add.ts +3 -3
- package/src/modules/localtask/engine.ts +1 -1
- package/src/modules/{tasktool → localtask}/group-store.ts +2 -2
- package/src/modules/localtask/mutator/index.ts +1 -1
- package/src/modules/localtask/panel-presence.ts +2 -2
- package/src/modules/localtask/scheduler/state-drive.ts +1 -1
- package/src/modules/{tasktool → localtask}/support.ts +1 -1
- package/src/modules/localtask/task-lifecycle.ts +5 -5
- package/src/modules/localtask/task-ops.ts +1 -1
- package/src/modules/localtask/task-templates.ts +1 -1
- package/src/modules/localtask/task-view.ts +1 -1
- package/src/modules/{tasktool → localtask}/update.ts +1 -1
- package/src/modules/localtask/waiters.ts +1 -1
- package/src/modules/localtask/writes.ts +1 -1
- package/src/modules/promptplug/factory.ts +5 -5
- package/src/modules/promptplug/index.ts +5 -5
- package/src/modules/promptplug/plugins/attachment.ts +1 -1
- package/src/modules/promptplug/plugins/context.ts +1 -1
- package/src/modules/promptplug/plugins/getloop.ts +8 -7
- package/src/modules/{tasktool/plugins/goal-template.ts → promptplug/plugins/goal-prompt.ts} +4 -3
- package/src/modules/repos/service/crud.ts +1 -1
- package/src/modules/templates/actions/templates-default.ts +2 -5
- package/src/modules/templates/actions/templates-update.ts +1 -3
- package/src/modules/templates/service.ts +11 -13
- package/src/modules/templates/support.ts +0 -15
- package/src/runtime/registry.ts +6 -2
- package/src/web/frontend/App.tsx +0 -12
- package/src/web/frontend/api/cli-tree.json +138 -138
- package/src/web/frontend/api/client.generated.ts +90 -88
- package/src/web/frontend/components/md/live-block.tsx +1 -5
- package/src/web/frontend/components/md/md-panes-root.tsx +0 -4
- package/src/web/frontend/components/md/md-panes.tsx +1 -11
- package/src/web/frontend/modules/md/styles/docs.css +0 -7
- package/src/web/frontend/modules/md/styles/editor.css +0 -17
- package/src/web/frontend/modules/md/use-templates.ts +3 -13
- package/src/web/frontend/page/dir/index.tsx +3 -15
- package/src/web/frontend/page/dir/task-actions.ts +1 -16
- package/src/web/frontend/page/dir/task.tsx +2 -16
- package/src/web/frontend/page/group/index.tsx +6 -19
- package/src/web/frontend/page/settings/index.tsx +1 -1
- package/src/web/frontend/page/templates/index.tsx +5 -54
- package/src/web/frontend/page/templates/manage.tsx +1 -5
- package/src/web/frontend/page/templates/style.css +1 -43
- package/src/web/frontend/page/templates/template-list.tsx +7 -15
- package/src/web/frontend/routes/route-eq.ts +2 -3
- package/src/web/frontend/routes/templates.ts +0 -10
- package/src/web/frontend/styles-v2/shell.css +7 -0
- package/src/web/frontend/types.ts +2 -1
- package/src/web/public/assets/{bar-csH6ZW39.js → bar-Dc5Tq1eE.js} +1 -1
- package/src/web/public/assets/{composer-launch-Ba9cBxhb.js → composer-launch-fp2IzGzQ.js} +1 -1
- package/src/web/public/assets/{composer-panel-7SHKllt5.js → composer-panel-Dh681iO6.js} +1 -1
- package/src/web/public/assets/dir-d16q1GLe.js +3 -0
- package/src/web/public/assets/{doc-BmGb9F-k.js → doc-DRSKD0Re.js} +1 -1
- package/src/web/public/assets/group-Dc3ZgW24.js +1 -0
- package/src/web/public/assets/{index-D1wpt-oL.css → index-BIVxGd6t.css} +1 -1
- package/src/web/public/assets/index-Bg0m8gbJ.js +2 -0
- package/src/web/public/assets/{md-history-DVI47hu4.js → md-history-DNtgaIdH.js} +6 -6
- package/src/web/public/assets/{refs-P8HrKv4T.js → refs-TzxZYy7T.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-BiBZ63DZ.js → repo-form-modal-Dg3hJWUV.js} +1 -1
- package/src/web/public/assets/{repos-B9D8q6U7.js → repos-uNqSR5YB.js} +1 -1
- package/src/web/public/assets/task-DuFOXLPC.js +11 -0
- package/src/web/public/assets/{task-utils-DPGXUIOk.js → task-utils-DAPxKm4c.js} +1 -1
- package/src/web/public/assets/templates-CwYDIBYn.css +1 -0
- package/src/web/public/assets/templates-DNiGvmdq.js +10 -0
- package/src/web/public/assets/{use-rail-drag-TGx8CLcY.js → use-rail-drag-DxIYcszo.js} +1 -1
- package/src/web/public/index.html +6 -7
- package/src/core/workflow/edges.ts +0 -28
- package/src/core/workflow/layout.ts +0 -118
- package/src/modules/tasktool/facade/get.ts +0 -54
- package/src/modules/tasktool/facade/index.ts +0 -4
- package/src/modules/tasktool/facade/submit.ts +0 -61
- package/src/modules/tasktool/facade/wait.ts +0 -3
- package/src/modules/tasktool/getloop.ts +0 -2
- package/src/modules/tasktool/index.ts +0 -24
- package/src/modules/tasktool/plugins/runtime.ts +0 -73
- package/src/modules/tasktool/plugins/waitgoal.ts +0 -75
- package/src/modules/tasktool/wait.ts +0 -572
- package/src/web/frontend/modules/md/fill-session.ts +0 -36
- package/src/web/frontend/modules/md/new-task-from-template.ts +0 -22
- package/src/web/frontend/modules/md/task-intent.ts +0 -29
- package/src/web/frontend/modules/prompts/render-template-body.ts +0 -14
- package/src/web/frontend/modules/prompts/template-preview.ts +0 -62
- package/src/web/frontend/page/templates/fill.tsx +0 -126
- package/src/web/public/assets/dir-D5AImCiy.js +0 -3
- package/src/web/public/assets/fill-session-fHxQHFaD.js +0 -1
- package/src/web/public/assets/group-CTktws14.js +0 -1
- package/src/web/public/assets/index-Byb7MFTl.js +0 -2
- package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +0 -1
- package/src/web/public/assets/render-template-body-bXdedFig.js +0 -1
- package/src/web/public/assets/task-BBk0TQZi.js +0 -11
- package/src/web/public/assets/task-intent-CX5DZccN.js +0 -1
- package/src/web/public/assets/templates-BN9i9-6c.js +0 -11
- package/src/web/public/assets/templates-plA8R7jJ.css +0 -1
- /package/src/modules/{tasktool → goals}/actions/_manifest.generated.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-prune.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/base.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/blockgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/container.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/taskgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal-core-store.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal-cwd-store.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal-store.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/taskgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/timegoal.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// localtask/add.ts —— 「派任务」的编排(从 localtask/index.js 的 action run 整体迁入)。
|
|
2
2
|
//
|
|
3
|
-
// 边界(与 get.js
|
|
3
|
+
// 边界(与 claim/get.js 同一条分工:localtask = 队列本体 + 派任务编排):
|
|
4
4
|
// 队列读写、落盘、唤醒注册表都在 localtask/service.js;这里只做**编排**——
|
|
5
5
|
// 落点与 frontmatter 的统一解析 → 任务级 timegoal 声明归一 → 委托 service.addTask
|
|
6
6
|
// 入队(有 wait 在等则即时投递)。
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//(认得出归属就补介绍引用、落点跟到项目队列)。
|
|
14
14
|
//
|
|
15
15
|
// 至此三个任务动词(领 get / 等 wait / 派 add)同构:action 层一律一行委托,
|
|
16
|
-
//
|
|
16
|
+
// 编排住在本域(add.js / update.js),队列本体只有 service.js 一处。
|
|
17
17
|
import { badInput } from '../../core/errors.js';
|
|
18
18
|
import { addTask, normalizeCwd } from '../localtask/service.js';
|
|
19
19
|
import { applyGroupFields, parseFrontmatter } from '../../shared/frontmatter.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// 主题队列上的引擎装配:SnapshotStore(topic) + bus + mutator + scheduler
|
|
2
|
-
import '../
|
|
2
|
+
import '../goals/plugins/index.js'; // IoC:加载即注册全部 goal
|
|
3
3
|
import { createEventBus } from './bus/index.js';
|
|
4
4
|
import { createDagMutator } from './mutator/index.js';
|
|
5
5
|
import type { DagMutator } from './mutator/index.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// localtask/group-store.ts —— 仓库/看板登记的**归一化视图**(board + repos)。
|
|
2
2
|
//
|
|
3
3
|
// 派任务(add.js)与改任务(update.js)共用一份落点判定:`--project/--board` 要
|
|
4
4
|
// 解析成「项目登记的路径」才能定落点,而 repos 模块在**模块互依禁列**里
|
|
5
|
-
//(localtask
|
|
5
|
+
//(localtask 不能静态引它)→ 动态 import(add.js 既有惯例)。
|
|
6
6
|
//
|
|
7
7
|
// 输入是 raw repos store,输出喂给 board-target.js 的 resolveGroupTarget:
|
|
8
8
|
// boards[i] = { id, name, key, memberKeys: string[] } ← 成员键(不是 repoIds)
|
|
@@ -98,7 +98,7 @@ export function createDagMutator({ store, bus }: DagMutatorDeps): DagMutator {
|
|
|
98
98
|
async bindPlugin(workflowId: string, target: DagMutatorTargetInput, spec: any): Promise<WorkflowSnapshot> {
|
|
99
99
|
// target: { workflow: true } | { nodeId }
|
|
100
100
|
// 动态加载 plugins 桶 → IoC 自注册;再调 onBind 规范化 config
|
|
101
|
-
const { getPlugin } = await import('../../
|
|
101
|
+
const { getPlugin } = await import('../../goals/plugins/index.js');
|
|
102
102
|
return mutate(workflowId, (draft) => {
|
|
103
103
|
const ctx = { snapshot: Object.freeze(structuredClone(draft)) };
|
|
104
104
|
if (target?.workflow) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (#54 自 service.js 拆出)面板 presence 观测与注册表:SSE 连接计数(含心跳剔除)、
|
|
2
2
|
// 常驻主面板发现(APP_DIR/panels.json 登记)、逐端口活性探测、窗口重开节流判据
|
|
3
|
-
// shouldReopenWindow(panel-guard 与
|
|
3
|
+
// shouldReopenWindow(panel-guard 与 claim/panel-escort 用)。
|
|
4
4
|
import http from 'node:http';
|
|
5
5
|
import { readFileSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
@@ -321,7 +321,7 @@ export function readPanelRegistry(): PanelRegistryEntry[] {
|
|
|
321
321
|
return readAllPanels();
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
// 复查节奏与重开上限(REVIEW_MS 已随 wait 编排迁往
|
|
324
|
+
// 复查节奏与重开上限(REVIEW_MS 已随 wait 编排迁往 claim/wait.ts)。
|
|
325
325
|
const REOPEN_COOLDOWN_MS = 20_000;
|
|
326
326
|
// 一次 wait 最多开 3 个窗口:够救「手滑关掉」,又不至于在浏览器拦截脚本时刷屏。
|
|
327
327
|
const MAX_WINDOW_OPENS = 3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNodeReady } from '../../../core/workflow/readiness.js';
|
|
2
2
|
import type { WfGraph } from '../../../core/workflow/readiness.js';
|
|
3
|
-
import { isBarrierOpen } from '../../
|
|
3
|
+
import { isBarrierOpen } from '../../goals/plugins/blockgoal.js';
|
|
4
4
|
import type { WorkflowSnapshot } from '../../../core/workflow/types.js';
|
|
5
5
|
|
|
6
6
|
/** driveReadyStates 的出站形状。 */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { badInput, notFound } from '../../core/errors.js';
|
|
5
5
|
import { formatDuration, renderInstruction } from '../../core/instruction-template.js';
|
|
6
6
|
import { activeTemplateOf } from '../promptplug/index.js';
|
|
7
|
-
import { taskGoalTemplateCtx } from '../
|
|
7
|
+
import { taskGoalTemplateCtx } from '../promptplug/plugins/goal-prompt.js';
|
|
8
8
|
import { preserveFrontmatter } from '../../shared/frontmatter.js';
|
|
9
9
|
import {
|
|
10
10
|
FEEDBACK_HEADING,
|
|
@@ -349,8 +349,8 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
349
349
|
}
|
|
350
350
|
let goal: Record<string, any> | null = null;
|
|
351
351
|
if (task.timegoal) {
|
|
352
|
-
// 门禁:查任务级 goal。动态 import——
|
|
353
|
-
const { taskGoalState, recordTaskCheck } = await import('../
|
|
352
|
+
// 门禁:查任务级 goal。动态 import——claim/wait.ts 静态引用本模块,这里走动态避免环。
|
|
353
|
+
const { taskGoalState, recordTaskCheck } = await import('../goals/taskgoal.js');
|
|
354
354
|
const st = await taskGoalState({ topicKey: key, taskId: want });
|
|
355
355
|
if (st.hasGoal && !st.reached) {
|
|
356
356
|
// 「未到点就想 done」的拦截提示(#90):模板与其它区块同源,是 doneguard
|
|
@@ -455,5 +455,5 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
455
455
|
// 那不是"到点自动取消",那是把目录焊死了。这种情况该由 agent 自己的
|
|
456
456
|
// `timegoal check`(reached:true)去处理。
|
|
457
457
|
//
|
|
458
|
-
// (goal 探针与目标上下文已随 wait 编排迁往
|
|
459
|
-
//
|
|
458
|
+
// (goal 探针与目标上下文已随 wait 编排迁往 claim/wait.ts——任务工具语义归
|
|
459
|
+
// goals 域,队列本体不再依赖 timegoal 模块。)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// 全局池 FIFO 投递 + ignoredCwd 如实回带)、updateTask(正文/时间目标/DAG 依赖/改归属搬家)。
|
|
3
3
|
import { badInput, notFound } from '../../core/errors.js';
|
|
4
4
|
import { parseFrontmatter, preserveFrontmatter } from '../../shared/frontmatter.js';
|
|
5
|
-
import { sanitizeTaskGoal } from '../
|
|
5
|
+
import { sanitizeTaskGoal } from '../goals/taskgoal.js';
|
|
6
6
|
import { normalizeBlockBy, isReadyToClaim } from './dag.js';
|
|
7
7
|
import { MAX_TEXT, normalizeSummary, normalizeText } from './store-io.js';
|
|
8
8
|
import { openLocaltaskStore as openStore, topics as topicsRepo, tasks as tasksRepo, links as linksRepo, txw as tx, db } from './repo/index.js';
|
|
@@ -31,7 +31,7 @@ export function clampDeliveryTemplate(v: unknown): string {
|
|
|
31
31
|
// ─── 附件段提示词(settings.attachTemplate,任务 #82)──────────────────
|
|
32
32
|
//
|
|
33
33
|
// 交付里的〔附件〕段(附件清单 + 本地路径 + 拉取 SOP)原先硬编码在
|
|
34
|
-
//
|
|
34
|
+
// delivery/attach.ts 的 attachmentInstruction。模板化后:
|
|
35
35
|
// - 空串 = 用内置默认(**不是关掉**——附件段带本地路径,关掉 agent 就找不到文件);
|
|
36
36
|
// - 新语法:{{task.id}} {{task.text}} {{attach.count}}、
|
|
37
37
|
// `{{#each attach.list}}`(按 kind 分支的结构化清单 + 各类型子对象);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// 队列内关系清单(queueRelationsOf)与搬家(relocateTask)。
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { badInput, notFound } from '../../core/errors.js';
|
|
6
|
-
import { sanitizeTaskGoal } from '../
|
|
6
|
+
import { sanitizeTaskGoal } from '../goals/taskgoal.js';
|
|
7
7
|
import { normalizeBlockBy, isReadyToClaim } from './dag.js';
|
|
8
8
|
import { isGlobalKey, topicKeyFor, resolveTaskKey } from './paths.js';
|
|
9
9
|
import { parseStampMs, stampNow } from './store-io.js';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// ─── 进程内 waiter:key -> { resolve(task), summary, by } ───────────────
|
|
9
9
|
//
|
|
10
10
|
// 注册表**留在 localtask**(addTask 的唤醒路径要认领它),但注册/取走以 API 导出——
|
|
11
|
-
// wait/get 的阻塞编排住在
|
|
11
|
+
// wait/get 的阻塞编排住在 claim/wait.ts,通过这组 API 挂钩,不碰队列内部。
|
|
12
12
|
|
|
13
13
|
/** 主题级 waiter 条目(resolve 回调收 JSON 形态任务)。 */
|
|
14
14
|
export interface TopicWaiterEntry {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 日常 DAG 写路径 —— 一律经 Mutator(单一写入口),再投影回主题任务行。
|
|
2
2
|
// 跨队列依赖("topicKey:id")只落在任务行 blockBy,不进本 topic 引擎节点图。
|
|
3
|
-
import '../
|
|
3
|
+
import '../goals/plugins/index.js';
|
|
4
4
|
import { createTopicEngine } from './engine.js';
|
|
5
5
|
import { normalizeBlockBy, parseDepRef } from '../../core/workflow/readiness.js';
|
|
6
6
|
import { isGateNode } from '../../core/workflow/types.js';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
//
|
|
3
3
|
// 单独成文件的原因:actions/ 下的 action 经 _manifest.generated.ts 被 index.ts
|
|
4
4
|
// 装配,若 action 反向 import index.js 就形成 TDZ 回环——工厂是 actions 与
|
|
5
|
-
//
|
|
5
|
+
// delivery 共同的依赖终点,不含任何装配代码。
|
|
6
6
|
//
|
|
7
|
-
// 依赖方向(设计内):
|
|
7
|
+
// 依赖方向(设计内):delivery 是唯一消费方——领域取数(readGroupContext /
|
|
8
8
|
// attachTemplateCtx / pendingQueueInfo / getloop 指令渲染)由宿主完成,以 `Supply`
|
|
9
9
|
// 形式交给插件;插件在自己的 buildData() 里 await supplied() 后只做变换。
|
|
10
10
|
// promptplug 不 import 其他模块。
|
|
@@ -32,7 +32,7 @@ export interface DeliveryPluginDeps {
|
|
|
32
32
|
groupCtx: Supply<unknown>;
|
|
33
33
|
attach: Supply<unknown>;
|
|
34
34
|
queueInfo: Supply<{ topic: string; count: number; list: { id: number; title: string }[] } | null>;
|
|
35
|
-
|
|
35
|
+
enabled: Supply<boolean>;
|
|
36
36
|
waitMinutes: Supply<number>;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ export const EMPTY_DEPS: DeliveryPluginDeps = {
|
|
|
41
41
|
groupCtx: null,
|
|
42
42
|
attach: null,
|
|
43
43
|
queueInfo: null,
|
|
44
|
-
|
|
44
|
+
enabled: false,
|
|
45
45
|
waitMinutes: 0,
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -66,7 +66,7 @@ export function buildPlugins(
|
|
|
66
66
|
new ExtPlugin(text('ext'), { queueInfo: d.queueInfo }),
|
|
67
67
|
new AckPlugin(text('ack')),
|
|
68
68
|
new TimegoalPlugin(text('timegoal')),
|
|
69
|
-
new GetloopPlugin(text('getloop'), {
|
|
69
|
+
new GetloopPlugin(text('getloop'), { enabled: d.enabled, waitMinutes: d.waitMinutes }),
|
|
70
70
|
];
|
|
71
71
|
case 'check':
|
|
72
72
|
// #161 三段化:check 链只有这一个段(进度 + 每轮检查提醒)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// promptplug 装配:模块元信息 + action 清单装配。
|
|
2
2
|
//
|
|
3
3
|
// 插件工厂 / 注册表 / 字段目录在 factory.ts + registry.ts(actions 经 manifest 引
|
|
4
|
-
// 工厂,不能回环引本文件)。依赖方向(设计内):
|
|
4
|
+
// 工厂,不能回环引本文件)。依赖方向(设计内):delivery 是唯一消费方——宿主完成
|
|
5
5
|
// 领域取数,以 Supply 形式注入插件;插件在自己的 buildData() 里变换。
|
|
6
|
-
// promptplug 不 import
|
|
6
|
+
// promptplug 不 import 其他模块(delivery.ts 的交付组装同样只收宿主取好的数据)。
|
|
7
7
|
import { ModuleBase } from '../../runtime/types/module.js';
|
|
8
8
|
import { zodActionsOf, type ZodBoundAction } from '../../runtime/action-decorator.js';
|
|
9
9
|
import { container, type Container } from '../../runtime/container.js';
|
|
10
10
|
import { ACTIONS } from './actions/_manifest.generated.js';
|
|
11
11
|
|
|
12
|
-
// 装配无关的公开面(
|
|
12
|
+
// 装配无关的公开面(delivery / settings.ts 从这里拿)
|
|
13
13
|
export {
|
|
14
14
|
activeTemplateOf,
|
|
15
15
|
blockLabelOf,
|
|
@@ -37,8 +37,8 @@ export { compose } from './compose.js';
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* 提示词插件模块:注册表外露(prompt.registry)。
|
|
40
|
-
* 业务面(compose / buildPlugins)由
|
|
41
|
-
* (
|
|
40
|
+
* 业务面(compose / buildPlugins)由 delivery 域直接消费——这是设计内依赖
|
|
41
|
+
* (delivery → promptplug)。本模块不 import 任何其他模块(组装核已迁到 delivery/assemble.ts)。
|
|
42
42
|
*/
|
|
43
43
|
export class PromptplugModule extends ModuleBase {
|
|
44
44
|
override readonly id = 'promptplug';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// attachment 插件(order 20):附件识别。
|
|
2
2
|
//
|
|
3
|
-
// 数据变换(attachTemplateCtx)留在
|
|
3
|
+
// 数据变换(attachTemplateCtx)留在 delivery/attach-template.ts —— 它依赖
|
|
4
4
|
// attach-resource 的标注工具链(kind 归一 / 可读性探测 / 取用命令),随插件搬会
|
|
5
5
|
// 牵动三处引用。插件消费宿主标注后的 attach 对象,**schema 逐字对齐它的真实形状**。
|
|
6
6
|
//
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// context 插件(order 10):组 / 项目上下文。
|
|
2
|
-
// data() 搬自
|
|
2
|
+
// data() 搬自 delivery/assemble.ts 的 deliveryCtxOf(原文件随 S1 删除),
|
|
3
3
|
// 口径注释一并迁入——#81 空壳组过滤、#104 已登记无介绍可见、参考仓库去重并集。
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { PromptPlugin, supplied, type Supply, type TemplateText } from '../base.js';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// getloop 插件(order 80):持续 get。
|
|
2
|
-
// deps.
|
|
3
|
-
//
|
|
2
|
+
// deps.enabled 是宿主从 waitgoal 配置(repos.json repo.getLoop)读出的开关;
|
|
3
|
+
// 关 → 整段不出。#230 清理:原「宿主预渲染 loopText → data.getloop.text」链路
|
|
4
|
+
// 已删——#182 起项目级 template 口子下线,文案唯一真相就是本类的内置模板
|
|
5
|
+
// (预渲染上下文缺 getloop 键,产出的 text 是残缺副本,BUILTIN 也从不消费它)。
|
|
4
6
|
import { z } from 'zod';
|
|
5
7
|
import { PromptPlugin, supplied, type Supply, type TemplateText } from '../base.js';
|
|
6
8
|
|
|
7
9
|
const schema = z.strictObject({
|
|
8
10
|
getloop: z
|
|
9
11
|
.looseObject({
|
|
10
|
-
text: z.string().describe('「继续 get」的整段指令(宿主已渲染好的文本)'),
|
|
11
12
|
waitMinutes: z.number().describe('没活时每次阻塞的分钟数(0 = 不阻塞)'),
|
|
12
13
|
})
|
|
13
14
|
.nullable()
|
|
@@ -20,7 +21,7 @@ const schema = z.strictObject({
|
|
|
20
21
|
.describe('当前任务(seed,宿主传入)'),
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
/** 内置模板(#152
|
|
24
|
+
/** 内置模板(#152:正文进代码;#230 起它就是「继续 get」文案的唯一真相)。 */
|
|
24
25
|
const BUILTIN: TemplateText = {
|
|
25
26
|
id: 'builtin',
|
|
26
27
|
name: '系统内置',
|
|
@@ -38,13 +39,13 @@ export class GetloopPlugin extends PromptPlugin<typeof schema> {
|
|
|
38
39
|
readonly dataSchema = schema;
|
|
39
40
|
readonly templates = [BUILTIN];
|
|
40
41
|
|
|
41
|
-
constructor(template: string, private readonly deps: {
|
|
42
|
+
constructor(template: string, private readonly deps: { enabled: Supply<boolean>; waitMinutes: Supply<number> }) {
|
|
42
43
|
super(template);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
protected async buildData() {
|
|
46
|
-
const
|
|
47
|
+
const enabled = !!(await supplied(this.deps.enabled));
|
|
47
48
|
const waitMinutes = Number(await supplied(this.deps.waitMinutes)) || 0;
|
|
48
|
-
return { getloop:
|
|
49
|
+
return { getloop: enabled ? { waitMinutes } : null };
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// 任务级 timegoal 的提示词模板(任务 #87)——**领取交付**与**每轮 check** 的同源代码。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// 为什么在 promptplug(#227 重构):模板正文归提示词模板体系(出厂正文 / 兜底文案
|
|
4
|
+
// 都在 promptplug/plugins/ 下);taskgoal-store(领取路径)与 timegoal-task-store
|
|
5
|
+
// (check 路径)作为 goals 域宿主从这里取用——依赖方向单一(goals → promptplug),
|
|
6
|
+
// 两边变量口径永远一致,也不再依赖「模板夹在两个互相 import 的 store 之间」来防环。
|
|
6
7
|
//
|
|
7
8
|
// goals.prompt 落库的是**模板原文**(占位符保留),渲染发生在:
|
|
8
9
|
// - 领取交付:用「领取那一刻」的 ctx(输出与改造前逐字一致);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 仓库登记 CRUD:清单、登记、更新、删除、单条查询、key 定位。
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { badInput, notFound, conflict } from '../../../core/errors.js';
|
|
4
|
-
import { sanitizeGetLoop } from '../../
|
|
4
|
+
import { sanitizeGetLoop } from '../../claim/waitgoal-config.js';
|
|
5
5
|
import repoLayer from '../repo/index.js';
|
|
6
6
|
import { loadStore, mutateStore } from './store.js';
|
|
7
7
|
import {
|
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { } from 'node:path';
|
|
9
|
-
import {
|
|
9
|
+
import { parseScope } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
|
|
12
12
|
/** templates.default 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -14,7 +14,6 @@ const input = z.object({
|
|
|
14
14
|
id: z.string(),
|
|
15
15
|
name: z.string().optional().describe("新名字(配合 --body/--scope 时改默认模板本身)"),
|
|
16
16
|
body: z.string().optional().describe("新正文(配合时改默认模板本身)"),
|
|
17
|
-
values: z.unknown().optional().describe("槽位值 JSON(CLI 传 JSON 串;HTTP 可直接给对象)"),
|
|
18
17
|
scope: z.unknown().optional().describe("可见域(#128):* / topic:<key> / repo:<key> / group:<key>,JSON 数组或逗号短写"),
|
|
19
18
|
});
|
|
20
19
|
|
|
@@ -31,14 +30,12 @@ export class TemplatesDefaultAction extends ActionBase<typeof input> {
|
|
|
31
30
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
32
31
|
|
|
33
32
|
if (
|
|
34
|
-
ctx.body !== undefined || ctx.name !== undefined ||
|
|
35
|
-
ctx.values !== undefined || ctx.scope !== undefined
|
|
33
|
+
ctx.body !== undefined || ctx.name !== undefined || ctx.scope !== undefined
|
|
36
34
|
) {
|
|
37
35
|
return service.updateTemplate({
|
|
38
36
|
id: ctx.id || 'default',
|
|
39
37
|
name: ctx.name,
|
|
40
38
|
body: ctx.body,
|
|
41
|
-
values: parseValues(ctx.values),
|
|
42
39
|
scope: parseScope(ctx.scope),
|
|
43
40
|
});
|
|
44
41
|
}
|
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { } from 'node:path';
|
|
9
|
-
import { parseScope
|
|
9
|
+
import { parseScope } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
|
|
12
12
|
/** templates.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -17,7 +17,6 @@ const input = z.object({
|
|
|
17
17
|
bodyFile: z.string().optional().describe("从文件读新正文(--body 优先);`-` = 读标准输入"),
|
|
18
18
|
'body-file': z.string().optional().describe("同 --bodyFile(连字符写法)"),
|
|
19
19
|
scope: z.unknown().optional().describe("可见域(#128):* / topic:<key> / repo:<key> / group:<key>,JSON 数组或逗号短写(不传保持不变)"),
|
|
20
|
-
values: z.string().optional().describe("槽位值 JSON(形如 {\"背景\":\"要做的事\"})——老模板正文里的 {{槽位名}} 处填这段文字(新模板直接写正文即可)"),
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
export class TemplatesUpdateAction extends ActionBase<typeof input> {
|
|
@@ -38,7 +37,6 @@ export class TemplatesUpdateAction extends ActionBase<typeof input> {
|
|
|
38
37
|
body: ctx.body,
|
|
39
38
|
bodyFile: opts && opts.transport === 'http' ? undefined : (ctx.bodyFile ?? ctx['body-file']),
|
|
40
39
|
scope: parseScope(ctx.scope),
|
|
41
|
-
values: parseValues(ctx.values),
|
|
42
40
|
});
|
|
43
41
|
|
|
44
42
|
}
|
|
@@ -6,15 +6,14 @@
|
|
|
6
6
|
//
|
|
7
7
|
// 内置模板(`builtin=1`,由 core/db/seed-templates 在开库时 INSERT OR IGNORE
|
|
8
8
|
// seed,永远在场):**不可删,可编辑**。T06 起骨架也可改 —— 用户改了
|
|
9
|
-
// builtin 的 body
|
|
9
|
+
// builtin 的 body 改后重启原样保留(seed 是 OR IGNORE,绝不覆盖用户编辑)。
|
|
10
10
|
// #137:出厂正文只有**一份**(core/db/seed-templates 的 NEWTASK_REF_BODY,
|
|
11
11
|
// 即新建任务模板「ref 生成」);前端不再自带第二份副本(漂移的根源)。
|
|
12
12
|
//
|
|
13
13
|
// ── 与 schema 列的映射 ────────────────────────────────────────────────
|
|
14
14
|
// 旧 JSON 字段 → 列
|
|
15
|
-
// values
|
|
16
|
-
//
|
|
17
|
-
// vars 填值,声明里不放默认值)
|
|
15
|
+
// values(旧数据对象) → vars(JSON;**列名换了**,对外视图仍叫 values ——
|
|
16
|
+
// DB 兼容列,插槽机制移除后恒为空对象)
|
|
18
17
|
// builtin → builtin 列
|
|
19
18
|
// defaultId → 同类目 `is_default=1` 的那行(ux_templates_default
|
|
20
19
|
// 保证每类目最多一个默认;**没有**另落 settings 键 ——
|
|
@@ -66,9 +65,9 @@ const NEWTASK_CATEGORY = 'newtask';
|
|
|
66
65
|
|
|
67
66
|
const repo = repoLayer;
|
|
68
67
|
|
|
69
|
-
// #137:内置只有一份出厂文本(新建任务模板「ref
|
|
70
|
-
// 槽位默认值不再需要(出厂文本里没有 {{槽位}} 标记)。
|
|
68
|
+
// #137:内置只有一份出厂文本(新建任务模板「ref 生成」)。空正文兜底用它。
|
|
71
69
|
export const BUILTIN_BODY = NEWTASK_REF_BODY;
|
|
70
|
+
/** DB vars 列兼容位:始终空对象(模板已无插槽机制)。 */
|
|
72
71
|
export const BUILTIN_VALUES: Record<string, string> = {};
|
|
73
72
|
|
|
74
73
|
// ─── 视图:行 ⇄ 旧 JSON 形状(调用方消费的是 values/builtin 这些旧字段)──
|
|
@@ -178,9 +177,8 @@ function normalizeBody(raw: unknown): string {
|
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* 正文里当 {{名字}},名字太长就没法当占位符用了。
|
|
180
|
+
* 归一化模板的 vars(DB 兼容字段,对外仍叫 values);仅留字符串、逐条截断。
|
|
181
|
+
* 插槽机制已移除,调用方不再传值,此处只保证写库形状合法。
|
|
184
182
|
*/
|
|
185
183
|
export function normalizeValues(raw: unknown, base: any = {}): Record<string, string> {
|
|
186
184
|
const out: Record<string, string> = { ...base };
|
|
@@ -261,7 +259,7 @@ export async function addTemplate({
|
|
|
261
259
|
id: 't_' + crypto.randomBytes(5).toString('hex'),
|
|
262
260
|
name,
|
|
263
261
|
body,
|
|
264
|
-
//
|
|
262
|
+
// DB vars 列兼容:无调用方传值,写空对象
|
|
265
263
|
values: normalizeValues(values),
|
|
266
264
|
};
|
|
267
265
|
repo.templates.insertIfAbsent(conn, {
|
|
@@ -318,7 +316,7 @@ export async function removeTemplate({ id }: { id?: unknown } = {}): Promise<{
|
|
|
318
316
|
});
|
|
319
317
|
}
|
|
320
318
|
|
|
321
|
-
/** 编辑模板(改名 / 改正文 /
|
|
319
|
+
/** 编辑模板(改名 / 改正文 / 改可见域;只改传入的字段)。 */
|
|
322
320
|
export async function updateTemplate({ id, name: rawName, body: rawBody, bodyFile, values, scope: rawScope }: {
|
|
323
321
|
id?: unknown;
|
|
324
322
|
name?: unknown;
|
|
@@ -338,8 +336,8 @@ export async function updateTemplate({ id, name: rawName, body: rawBody, bodyFil
|
|
|
338
336
|
if (bodyIn !== undefined) patch.body = normalizeBody(bodyIn);
|
|
339
337
|
if (rawScope !== undefined) patch.scope = normalizeScope(rawScope, { strict: true });
|
|
340
338
|
if (values !== undefined) {
|
|
341
|
-
//
|
|
342
|
-
patch.vars = normalizeValues(values,
|
|
339
|
+
// DB vars 列兼容写入;插槽机制已移除,无调用方传值
|
|
340
|
+
patch.vars = normalizeValues(values, BUILTIN_VALUES);
|
|
343
341
|
}
|
|
344
342
|
repo.templates.updateRow(conn, want, patch, nowMs());
|
|
345
343
|
return { status: 'ok', template: rowToView(repo.templates.getRow(want, conn)) };
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// 参数与返回值暂用宽松类型(迁移期),服务层类型化推进时逐个收紧。
|
|
4
4
|
import { topicKeyOf } from '../../core/topic-key.js';
|
|
5
5
|
import { resolve as resolvePath } from 'node:path';
|
|
6
|
-
import { badInput } from '../../core/errors.js';
|
|
7
6
|
|
|
8
7
|
export const renderList: any = (d: any) => {
|
|
9
8
|
const lines: any = [`模板 ${d.templates.length} 个(默认: ${d.defaultId})`];
|
|
@@ -31,17 +30,3 @@ export function topicFromCwd(raw: any) {
|
|
|
31
30
|
if (!s) return undefined;
|
|
32
31
|
return topicKeyOf(resolvePath(s), '');
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
export function parseValues(raw: any) {
|
|
36
|
-
if (raw === undefined || raw === null) return undefined;
|
|
37
|
-
if (typeof raw === 'object') return raw;
|
|
38
|
-
const s: any = String(raw).trim();
|
|
39
|
-
if (!s) return undefined;
|
|
40
|
-
try {
|
|
41
|
-
const v: any = JSON.parse(s);
|
|
42
|
-
if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('不是对象');
|
|
43
|
-
return v;
|
|
44
|
-
} catch (e: any) {
|
|
45
|
-
throw badInput(`--values 要传 JSON 对象(形如 {"背景":"要做的事"}):${e.message || e}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/runtime/registry.ts
CHANGED
|
@@ -28,7 +28,9 @@ import { readFileSync } from 'node:fs';
|
|
|
28
28
|
import systemModule from '../modules/system/index.js';
|
|
29
29
|
import setting from '../modules/setting/index.js';
|
|
30
30
|
import localtask from '../modules/localtask/index.js';
|
|
31
|
-
import
|
|
31
|
+
import claim from '../modules/claim/index.js';
|
|
32
|
+
import delivery from '../modules/delivery/index.js';
|
|
33
|
+
import goals from '../modules/goals/index.js';
|
|
32
34
|
import repos from '../modules/repos/index.js';
|
|
33
35
|
import docs from '../modules/docs/index.js';
|
|
34
36
|
import file from '../modules/file/index.js';
|
|
@@ -41,7 +43,9 @@ const MODULE_LIST: readonly AnyModule[] = [
|
|
|
41
43
|
systemModule,
|
|
42
44
|
setting,
|
|
43
45
|
localtask,
|
|
44
|
-
|
|
46
|
+
claim,
|
|
47
|
+
delivery,
|
|
48
|
+
goals,
|
|
45
49
|
repos,
|
|
46
50
|
docs,
|
|
47
51
|
file,
|
package/src/web/frontend/App.tsx
CHANGED
|
@@ -128,18 +128,6 @@ function routeFromHash(): AppRoute {
|
|
|
128
128
|
scope: '',
|
|
129
129
|
};
|
|
130
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
|
-
}
|
|
143
131
|
if (rest === 'new') {
|
|
144
132
|
return {
|
|
145
133
|
view: 'templates',
|