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.
Files changed (155) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/package.json +1 -1
  3. package/src/core/db/seed-templates.ts +2 -86
  4. package/src/core/db/settings.ts +1 -1
  5. package/src/core/instruction-template.ts +1 -1
  6. package/src/core/workflow/plugin-registry.ts +1 -1
  7. package/src/core/workflow/types.ts +4 -4
  8. package/src/modules/claim/actions/_manifest.generated.ts +23 -0
  9. package/src/modules/{localtask → claim}/actions/localtask-claim.ts +4 -4
  10. package/src/modules/{localtask → claim}/actions/localtask-preview.ts +4 -4
  11. package/src/modules/{localtask → claim}/actions/localtask-wait.ts +4 -4
  12. package/src/modules/{tasktool → claim}/get.ts +3 -3
  13. package/src/modules/claim/index.ts +25 -0
  14. package/src/modules/{tasktool → claim}/panel-escort.ts +2 -2
  15. package/src/modules/{tasktool → claim}/params.ts +1 -1
  16. package/src/modules/claim/wait.ts +305 -0
  17. package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +4 -28
  18. package/src/modules/delivery/assemble.ts +151 -0
  19. package/src/modules/{tasktool → delivery}/attach-resource.ts +2 -2
  20. package/src/modules/{tasktool → delivery}/attach-template.ts +1 -1
  21. package/src/modules/{tasktool → delivery}/attach.ts +1 -1
  22. package/src/modules/{tasktool → delivery}/delivery-text.ts +2 -2
  23. package/src/modules/{tasktool → delivery}/doc-inline.ts +1 -1
  24. package/src/modules/{tasktool → delivery}/groupctx.ts +1 -1
  25. package/src/modules/delivery/host.ts +231 -0
  26. package/src/modules/delivery/index.ts +18 -0
  27. package/src/modules/{tasktool → delivery}/preview.ts +5 -6
  28. package/src/modules/{tasktool → goals}/actions/timegoal-check.ts +1 -1
  29. package/src/modules/{tasktool → goals}/actions/timegoal-clear.ts +1 -1
  30. package/src/modules/{tasktool → goals}/actions/timegoal-list.ts +1 -1
  31. package/src/modules/{tasktool → goals}/actions/timegoal-log.ts +1 -1
  32. package/src/modules/{tasktool → goals}/actions/timegoal-set.ts +1 -1
  33. package/src/modules/{tasktool → goals}/actions/timegoal-show.ts +1 -1
  34. package/src/modules/{tasktool → goals}/actions/timegoal-update.ts +1 -1
  35. package/src/modules/goals/index.ts +25 -0
  36. package/src/modules/{tasktool → goals}/plugins/discover.ts +3 -3
  37. package/src/modules/{tasktool → goals}/plugins/index.ts +0 -2
  38. package/src/modules/{tasktool → goals}/plugins/taskgoal-store.ts +3 -3
  39. package/src/modules/{tasktool → goals}/plugins/timegoal-task-store.ts +2 -2
  40. package/src/modules/localtask/action-render.ts +1 -1
  41. package/src/modules/localtask/actions/_manifest.generated.ts +0 -9
  42. package/src/modules/localtask/actions/localtask-add.ts +2 -2
  43. package/src/modules/localtask/actions/localtask-attach-note.ts +1 -1
  44. package/src/modules/localtask/actions/localtask-attach.ts +1 -1
  45. package/src/modules/localtask/actions/localtask-attachments.ts +1 -1
  46. package/src/modules/localtask/actions/localtask-detach.ts +1 -1
  47. package/src/modules/localtask/actions/localtask-get.ts +1 -1
  48. package/src/modules/localtask/actions/localtask-reopen.ts +1 -1
  49. package/src/modules/localtask/actions/localtask-timegoalLog.ts +1 -1
  50. package/src/modules/localtask/actions/localtask-update.ts +2 -2
  51. package/src/modules/{tasktool → localtask}/add.ts +3 -3
  52. package/src/modules/localtask/engine.ts +1 -1
  53. package/src/modules/{tasktool → localtask}/group-store.ts +2 -2
  54. package/src/modules/localtask/mutator/index.ts +1 -1
  55. package/src/modules/localtask/panel-presence.ts +2 -2
  56. package/src/modules/localtask/scheduler/state-drive.ts +1 -1
  57. package/src/modules/{tasktool → localtask}/support.ts +1 -1
  58. package/src/modules/localtask/task-lifecycle.ts +5 -5
  59. package/src/modules/localtask/task-ops.ts +1 -1
  60. package/src/modules/localtask/task-templates.ts +1 -1
  61. package/src/modules/localtask/task-view.ts +1 -1
  62. package/src/modules/{tasktool → localtask}/update.ts +1 -1
  63. package/src/modules/localtask/waiters.ts +1 -1
  64. package/src/modules/localtask/writes.ts +1 -1
  65. package/src/modules/promptplug/factory.ts +5 -5
  66. package/src/modules/promptplug/index.ts +5 -5
  67. package/src/modules/promptplug/plugins/attachment.ts +1 -1
  68. package/src/modules/promptplug/plugins/context.ts +1 -1
  69. package/src/modules/promptplug/plugins/getloop.ts +8 -7
  70. package/src/modules/{tasktool/plugins/goal-template.ts → promptplug/plugins/goal-prompt.ts} +4 -3
  71. package/src/modules/repos/service/crud.ts +1 -1
  72. package/src/modules/templates/actions/templates-default.ts +2 -5
  73. package/src/modules/templates/actions/templates-update.ts +1 -3
  74. package/src/modules/templates/service.ts +11 -13
  75. package/src/modules/templates/support.ts +0 -15
  76. package/src/runtime/registry.ts +6 -2
  77. package/src/web/frontend/App.tsx +0 -12
  78. package/src/web/frontend/api/cli-tree.json +138 -138
  79. package/src/web/frontend/api/client.generated.ts +90 -88
  80. package/src/web/frontend/components/md/live-block.tsx +1 -5
  81. package/src/web/frontend/components/md/md-panes-root.tsx +0 -4
  82. package/src/web/frontend/components/md/md-panes.tsx +1 -11
  83. package/src/web/frontend/modules/md/styles/docs.css +0 -7
  84. package/src/web/frontend/modules/md/styles/editor.css +0 -17
  85. package/src/web/frontend/modules/md/use-templates.ts +3 -13
  86. package/src/web/frontend/page/dir/index.tsx +3 -15
  87. package/src/web/frontend/page/dir/task-actions.ts +1 -16
  88. package/src/web/frontend/page/dir/task.tsx +2 -16
  89. package/src/web/frontend/page/group/index.tsx +6 -19
  90. package/src/web/frontend/page/settings/index.tsx +1 -1
  91. package/src/web/frontend/page/templates/index.tsx +5 -54
  92. package/src/web/frontend/page/templates/manage.tsx +1 -5
  93. package/src/web/frontend/page/templates/style.css +1 -43
  94. package/src/web/frontend/page/templates/template-list.tsx +7 -15
  95. package/src/web/frontend/routes/route-eq.ts +2 -3
  96. package/src/web/frontend/routes/templates.ts +0 -10
  97. package/src/web/frontend/styles-v2/shell.css +7 -0
  98. package/src/web/frontend/types.ts +2 -1
  99. package/src/web/public/assets/{bar-csH6ZW39.js → bar-Dc5Tq1eE.js} +1 -1
  100. package/src/web/public/assets/{composer-launch-Ba9cBxhb.js → composer-launch-fp2IzGzQ.js} +1 -1
  101. package/src/web/public/assets/{composer-panel-7SHKllt5.js → composer-panel-Dh681iO6.js} +1 -1
  102. package/src/web/public/assets/dir-d16q1GLe.js +3 -0
  103. package/src/web/public/assets/{doc-BmGb9F-k.js → doc-DRSKD0Re.js} +1 -1
  104. package/src/web/public/assets/group-Dc3ZgW24.js +1 -0
  105. package/src/web/public/assets/{index-D1wpt-oL.css → index-BIVxGd6t.css} +1 -1
  106. package/src/web/public/assets/index-Bg0m8gbJ.js +2 -0
  107. package/src/web/public/assets/{md-history-DVI47hu4.js → md-history-DNtgaIdH.js} +6 -6
  108. package/src/web/public/assets/{refs-P8HrKv4T.js → refs-TzxZYy7T.js} +1 -1
  109. package/src/web/public/assets/{repo-form-modal-BiBZ63DZ.js → repo-form-modal-Dg3hJWUV.js} +1 -1
  110. package/src/web/public/assets/{repos-B9D8q6U7.js → repos-uNqSR5YB.js} +1 -1
  111. package/src/web/public/assets/task-DuFOXLPC.js +11 -0
  112. package/src/web/public/assets/{task-utils-DPGXUIOk.js → task-utils-DAPxKm4c.js} +1 -1
  113. package/src/web/public/assets/templates-CwYDIBYn.css +1 -0
  114. package/src/web/public/assets/templates-DNiGvmdq.js +10 -0
  115. package/src/web/public/assets/{use-rail-drag-TGx8CLcY.js → use-rail-drag-DxIYcszo.js} +1 -1
  116. package/src/web/public/index.html +6 -7
  117. package/src/core/workflow/edges.ts +0 -28
  118. package/src/core/workflow/layout.ts +0 -118
  119. package/src/modules/tasktool/facade/get.ts +0 -54
  120. package/src/modules/tasktool/facade/index.ts +0 -4
  121. package/src/modules/tasktool/facade/submit.ts +0 -61
  122. package/src/modules/tasktool/facade/wait.ts +0 -3
  123. package/src/modules/tasktool/getloop.ts +0 -2
  124. package/src/modules/tasktool/index.ts +0 -24
  125. package/src/modules/tasktool/plugins/runtime.ts +0 -73
  126. package/src/modules/tasktool/plugins/waitgoal.ts +0 -75
  127. package/src/modules/tasktool/wait.ts +0 -572
  128. package/src/web/frontend/modules/md/fill-session.ts +0 -36
  129. package/src/web/frontend/modules/md/new-task-from-template.ts +0 -22
  130. package/src/web/frontend/modules/md/task-intent.ts +0 -29
  131. package/src/web/frontend/modules/prompts/render-template-body.ts +0 -14
  132. package/src/web/frontend/modules/prompts/template-preview.ts +0 -62
  133. package/src/web/frontend/page/templates/fill.tsx +0 -126
  134. package/src/web/public/assets/dir-D5AImCiy.js +0 -3
  135. package/src/web/public/assets/fill-session-fHxQHFaD.js +0 -1
  136. package/src/web/public/assets/group-CTktws14.js +0 -1
  137. package/src/web/public/assets/index-Byb7MFTl.js +0 -2
  138. package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +0 -1
  139. package/src/web/public/assets/render-template-body-bXdedFig.js +0 -1
  140. package/src/web/public/assets/task-BBk0TQZi.js +0 -11
  141. package/src/web/public/assets/task-intent-CX5DZccN.js +0 -1
  142. package/src/web/public/assets/templates-BN9i9-6c.js +0 -11
  143. package/src/web/public/assets/templates-plA8R7jJ.css +0 -1
  144. /package/src/modules/{tasktool → goals}/actions/_manifest.generated.ts +0 -0
  145. /package/src/modules/{tasktool → goals}/actions/timegoal-prune.ts +0 -0
  146. /package/src/modules/{tasktool → goals}/plugins/base.ts +0 -0
  147. /package/src/modules/{tasktool → goals}/plugins/blockgoal.ts +0 -0
  148. /package/src/modules/{tasktool → goals}/plugins/container.ts +0 -0
  149. /package/src/modules/{tasktool → goals}/plugins/taskgoal.ts +0 -0
  150. /package/src/modules/{tasktool → goals}/plugins/timegoal-core-store.ts +0 -0
  151. /package/src/modules/{tasktool → goals}/plugins/timegoal-cwd-store.ts +0 -0
  152. /package/src/modules/{tasktool → goals}/plugins/timegoal-store.ts +0 -0
  153. /package/src/modules/{tasktool → goals}/plugins/timegoal.ts +0 -0
  154. /package/src/modules/{tasktool → goals}/taskgoal.ts +0 -0
  155. /package/src/modules/{tasktool → goals}/timegoal.ts +0 -0
@@ -1,6 +1,6 @@
1
- // tasktool/add.js —— 「派任务」的编排(从 localtask/index.js 的 action run 整体迁入)。
1
+ // localtask/add.ts —— 「派任务」的编排(从 localtask/index.js 的 action run 整体迁入)。
2
2
  //
3
- // 边界(与 get.js / wait.js 同一条分工:tasktool = 任务工具语义,localtask = 队列本体):
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
- // 编排住在 tasktool/<动词>.js,队列本体只有 service.js 一处。
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 '../tasktool/plugins/index.js'; // IoC:加载即注册全部 goal
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
- // tasktool/group-store.js —— 仓库/看板登记的**归一化视图**(board + repos)。
1
+ // localtask/group-store.ts —— 仓库/看板登记的**归一化视图**(board + repos)。
2
2
  //
3
3
  // 派任务(add.js)与改任务(update.js)共用一份落点判定:`--project/--board` 要
4
4
  // 解析成「项目登记的路径」才能定落点,而 repos 模块在**模块互依禁列**里
5
- //(localtask/tasktool 不能静态引它)→ 动态 import(add.js 既有惯例)。
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('../../tasktool/plugins/index.js');
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 与 tasktool/panel-escort 用)。
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 编排迁往 tasktool/wait.js)。
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 '../../tasktool/plugins/blockgoal.js';
3
+ import { isBarrierOpen } from '../../goals/plugins/blockgoal.js';
4
4
  import type { WorkflowSnapshot } from '../../../core/workflow/types.js';
5
5
 
6
6
  /** driveReadyStates 的出站形状。 */
@@ -1,4 +1,4 @@
1
- // tasktool 模块的辅助函数/常量(legacy 形态里与 action 表同文件,迁来时一并搬到这里)。
1
+ // localtask 模块的辅助函数/常量(legacy 形态里与 action 表同文件,迁来时一并搬到这里)。
2
2
  //
3
3
  // 参数与返回值暂用宽松类型(迁移期),服务层类型化推进时逐个收紧。
4
4
  export function renderSet(d: any) {
@@ -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 '../tasktool/plugins/goal-template.js';
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——tasktool/wait.js 静态引用本模块,这里走动态避免环。
353
- const { taskGoalState, recordTaskCheck } = await import('../tasktool/taskgoal.js');
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 编排迁往 tasktool/wait.js——任务工具语义归
459
- // tasktool,队列本体不再依赖 timegoal 模块。)
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 '../tasktool/taskgoal.js';
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
- // tasktool/attach.js 的 attachmentInstruction。模板化后:
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 '../tasktool/taskgoal.js';
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';
@@ -1,4 +1,4 @@
1
- // tasktool/update.js —— 「改任务」的编排:改正文 + **改归属项目即搬家**。
1
+ // localtask/update.ts —— 「改任务」的编排:改正文 + **改归属项目即搬家**。
2
2
  //
3
3
  // 派任务(add.js 的 submitTask)有一条铁律:**归属决定落点**——`--project X` 的任务
4
4
  // 落进 X 的登记路径队列。但这条规则此前只在提交那一刻生效:用户提交后发现归属填错、
@@ -8,7 +8,7 @@
8
8
  // ─── 进程内 waiter:key -> { resolve(task), summary, by } ───────────────
9
9
  //
10
10
  // 注册表**留在 localtask**(addTask 的唤醒路径要认领它),但注册/取走以 API 导出——
11
- // wait/get 的阻塞编排住在 tasktool/wait.js,通过这组 API 挂钩,不碰队列内部。
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 '../tasktool/plugins/index.js';
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
- // tasktool 共同的依赖终点,不含任何装配代码。
5
+ // delivery 共同的依赖终点,不含任何装配代码。
6
6
  //
7
- // 依赖方向(设计内):tasktool 是唯一消费方——领域取数(readGroupContext /
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
- loopText: Supply<string>;
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
- loopText: '',
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'), { loopText: d.loopText, waitMinutes: d.waitMinutes }),
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
- // 工厂,不能回环引本文件)。依赖方向(设计内):tasktool 是唯一消费方——宿主完成
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
- // 装配无关的公开面(tasktool / settings.ts 从这里拿)
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)由 tasktool 直接消费——这是设计内依赖
41
- * (tasktool → promptplug)。
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)留在 tasktool/attach-template.ts —— 它依赖
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() 搬自 tasktool/delivery-template.ts 的 deliveryCtxOf(原文件随 S1 删除),
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.loopText 是宿主先把「项目级收尾指令模板」渲染好的文本(wait.ts 保留这一步
3
- // 与其 renderWarnings 告警口径);waitMinutes=0 时模板闸门 {{#if (gt …)}} 收口。
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: { loopText: Supply<string>; waitMinutes: Supply<number> }) {
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 text = String(await supplied(this.deps.loopText) || '').trim();
47
+ const enabled = !!(await supplied(this.deps.enabled));
47
48
  const waitMinutes = Number(await supplied(this.deps.waitMinutes)) || 0;
48
- return { getloop: text ? { text, waitMinutes } : null };
49
+ return { getloop: enabled ? { waitMinutes } : null };
49
50
  }
50
51
  }
@@ -1,8 +1,9 @@
1
1
  // 任务级 timegoal 的提示词模板(任务 #87)——**领取交付**与**每轮 check** 的同源代码。
2
2
  //
3
- // 为什么单独一个文件:领取路径(taskgoal-store)与 check 路径(timegoal-task-store)
4
- // 都要渲染同一份模板;而这两个模块在 timegoal-store 里已经互相 import,把模板
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 '../../tasktool/getloop.js';
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 { parseValues, parseScope } from '../support.js';
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, parseValues } from '../support.js';
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 / 槽位后重启原样保留(seed 是 OR IGNORE,绝不覆盖用户编辑)。
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(槽位值对象) → vars(JSON;**列名换了**,对外视图仍叫 values ——
16
- // 调用方与测试一行不改;vars_schema 声明「有哪些变量」,
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
- * 归一化模板的槽位值(values):{ 槽位名: 文字 }。
182
- * 只留字符串值、逐条截断(单槽 ≤2000 字)、槽位名限长 40——槽位名要出现在
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
- // 内置模板:槽位未给的项回落出厂默认(渲染时的兜底语义与 JSON 时代一致)
342
- patch.vars = normalizeValues(values, row.builtin ? BUILTIN_VALUES : rowToView(row).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
- }
@@ -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 tasktool from '../modules/tasktool/index.js';
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
- tasktool,
46
+ claim,
47
+ delivery,
48
+ goals,
45
49
  repos,
46
50
  docs,
47
51
  file,
@@ -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',