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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,65 @@
2
2
 
3
3
  本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
4
4
 
5
+ ## [0.65.3] - 2026-11-19 五域制目录重组:删除引擎门,领取/交付/目标各归其位(#237)
6
+
7
+ ### Changed
8
+
9
+ - **五域制目录重组**(#237,承接 #236 的方案):`tasktool` 目录消失,内容按动词域归位——
10
+ - **claim**(新域):领取域——`localtask.claim` / `localtask.wait` / `localtask.preview`
11
+ 三个 action + `get.ts` / `wait.ts`(阻塞窗口)/ `params.ts` / `panel-escort.ts` /
12
+ `waitgoal-config.ts`(持续 get 配置)
13
+ - **delivery**(新域):交付域——`host.ts`(宿主取数)/ `assemble.ts`(组装核,原
14
+ `promptplug/delivery.ts`)/ 附件四件 / 组上下文 / 人读排版 / 预览
15
+ - **goals**(新域):目标域——三族目标插件(timegoal / taskgoal / blockgoal)+ 存储与
16
+ 运行时 + `timegoal` CLI 命令族
17
+ - **localtask**:保持队列本体语义,吸收派任务编排(`add.ts` / `update.ts` /
18
+ `group-store.ts` / `support.ts`);**claim / wait / preview 三个 action 迁出**
19
+ - **promptplug**:回归纯引擎(八段插件 / 注册表 / 模板存储 / 渲染),不再 import 其他模块
20
+ - **引擎门删除**(#237):`tasktool/facade/`(submit / get / wait 三门)+ 消费钩子
21
+ (`plugins/runtime.ts` 的 `runGetHooks` / `plugins/waitgoal.ts` 的 pull-poll)一并删除——
22
+ 它们无 CLI 无 HTTP、只有测试在用;**领取的唯一入口收敛为 `localtask.claim`**。
23
+ 冻结布局治理文档(`core/workflow/layout.ts` / `edges.ts`)同步删除。
24
+ - **对外零感知**:CLI 路径、HTTP 路由、action id、交付渲染字节(golden)四样全部未变——
25
+ 契约指纹 `f132179e14f836c8` 不变,golden 基线零改动;本次只动「文件住在哪」。
26
+ - 手册校准:dev-nxkv 的 A02 / A03 / A08 / B01 / B03 路径与模块名同步到新结构。
27
+
28
+ ## [0.65.2] - 2026-11-19 getloop 残留预渲染链清理(#230 审计)
29
+
30
+ ### Changed
31
+
32
+ - **getloop 段模板清理**(#230,审计裁决「没删干净的残留」):#182 下线仓库级 template
33
+ 口子时,`getLoopInstruction → getLoopTpl → loopText Supply → data.getloop.text` 这条
34
+ 预渲染管道没拆——预渲染上下文缺 `getloop` 键,产出的 `text` 是残缺副本(分钟子句被
35
+ 丢),插件内置模板也从不消费它;同一段文案存在三份(两个别名常量 + BUILTIN)。
36
+ 已整条删除:getloop 插件改收 `enabled` 开关 Supply,`dataSchema` 去掉 `text` 字段
37
+ (变量目录与 `prompt.registry` 同步收窄),文案唯一真相 = 插件内置模板。
38
+ **交付渲染输出逐字节不变**(golden 仅 ctx 基线重生成,`.txt` 正文基线零变化)。
39
+ - 契约与 Dart 包按流程重新生成(`pnpm gen:dart`,变量目录变化同步)。
40
+
41
+ ### Removed
42
+
43
+ - `tasktool/plugins/waitgoal-config.ts` 的 `DEFAULT_GETLOOP_INSTRUCTION` /
44
+ `DEFAULT_GET_LOOP_TEMPLATE` 常量与 `getLoopInstruction()`(随预渲染链一并删除;
45
+ 外部取文案请读 getloop 插件类内置模板)。
46
+
47
+ ## [0.65.1] - 2026-11-19 交付组装收编 promptplug(#227 重构)
48
+
49
+ ### Changed
50
+
51
+ - **交付组装收编 promptplug**(#227):`buildTaskDelivery` 的组装下半段(seed 构造 /
52
+ 平面扩展键保护 / getloop 预渲染 / get+check+done 三链合并 / coversBody 判定)从
53
+ `tasktool/wait.ts` 收编为 `promptplug/delivery.ts` 的 `assembleDelivery()`;宿主取数
54
+ (附件标注 / timegoal 起表 / 组上下文 / 队列余量)留在新文件 `tasktool/delivery.ts`,
55
+ `wait.ts` 只剩阻塞编排(跨进程轮询 / goal 到点收尾 / 面板随行)。边界从此可查:
56
+ **promptplug 管模板正文 + 变量 + 组装 + 渲染,tasktool 管取数 + 阻塞**。
57
+ 交付输出**逐字节不变**(prompt-golden 等 1106 项单测 + smoke 96/96 全绿钉住)。
58
+ - **任务级 timegoal 提示词模板归位**(#227):`goal-template.ts` 从 `tasktool/plugins/`
59
+ 迁为 `promptplug/plugins/goal-prompt.ts`——模板正文归提示词模板体系;领取路径
60
+ (taskgoal-store)与 check 路径(timegoal-task-store)改从 promptplug 取用,
61
+ 依赖方向单一(tasktool → promptplug),不再依赖「模板夹在两个互相 import 的
62
+ store 之间」来防环。
63
+
5
64
  ## [0.65.0] - 2026-11-19 提示词三段化 / 段模板管理 / check 历史警告
6
65
 
7
66
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx-kv",
3
- "version": "0.65.0",
3
+ "version": "0.65.3",
4
4
  "description": "nx-kv — 本机任务队列(localtask)+ 文档库 + 仓库登记:serve 驱动 CLI 与 Web 面板,同源同构,附带可安装 skill 供 agent 提交 / 领取 / 阻塞接收任务",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,44 +17,7 @@
17
17
  import type { DbApi } from './driver.js';
18
18
 
19
19
  /**
20
- * 插槽的**统一写法**(#218):`{{content}}`。
21
- *
22
- * 为什么不许自定义名字:#217 的锁定判定靠「模板里有槽位就把它当可编辑出口」,
23
- * 名字各写各的(`{{问题}}` / `{{任务}}` / `{{需求}}`)时,一眼看不出哪段是插槽,
24
- * 也没法在文案里给用户一个固定说法。所以对用户只认一个名字 —— 一个模板可以有
25
- * 多个 `{{content}}`,它们共享同一个值(模板正文里重复出现同一段内容时用得上)。
26
- *
27
- * 渲染层仍按 `{{名字}}` 通用解析(老模板不至于一升级就失效),但出厂文本、
28
- * 新建骨架、面板文案一律只出现 `content`。
29
- */
30
- export const SLOT_NAME = 'content';
31
-
32
- /** 内置模板的槽位默认值:提示文字,不是空串(空块看不出该写什么)。 */
33
- const CONTENT_HINT = '(把你要问这个仓库的问题写在这里)';
34
-
35
- /** 模板正文里有没有插槽(含 `{{content}}` 或任何 `{{名字}}`)。 */
36
- function hasSlot(body: string): boolean {
37
- return /\{\{\s*[^}{\s][^{}]*?\s*\}\}/.test(String(body || ''));
38
- }
39
-
40
- /**
41
- * 出厂正文「被当成普通正文保存过一次」的样子:插槽已经渲染成默认值。
42
- *
43
- * #217 的模板编辑器曾经把正文渲染后再给用户编辑(保存即把 `{{content}}`
44
- * 写成提示文字),库里因此留下一批「没有插槽的内置模板」。#218 修了编辑器,
45
- * 同时用这个形态做**自愈判据**:body 与它逐字相同 = 用户没改过内容,可以安全
46
- * 恢复成带插槽的出厂文本;差一个字都不动(T06:内置不被代码覆盖用户编辑)。
47
- */
48
- function renderedFactoryBody(t: { body: string; vars?: Readonly<Record<string, unknown>> }): string {
49
- const vals = t.vars || {};
50
- return String(t.body || '').replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g, (_all, name) => {
51
- const v = vals[String(name).trim()];
52
- return v === undefined || v === null ? '' : String(v);
53
- });
54
- }
55
-
56
- /**
57
- * 内置「ref 生成」任务模板的正文(#137;#218 起插槽统一 `{{content}}`)。
20
+ * 内置「ref 生成」任务模板的正文(#137)。
58
21
  *
59
22
  * 它是**新任务正文骨架**:用户在这个仓库里提一个问题 → agent 按正文里的
60
23
  * 「零知识起步 SOP」走一遍 → 这轮问答被归档成一篇 ref,挂进该仓库的文档列表。
@@ -64,7 +27,6 @@ function renderedFactoryBody(t: { body: string; vars?: Readonly<Record<string, u
64
27
  */
65
28
  export const NEWTASK_REF_BODY = `## 本轮问题
66
29
 
67
- {{content}}
68
30
 
69
31
  ---
70
32
 
@@ -142,10 +104,7 @@ export const BUILTIN_TEMPLATES = Object.freeze([
142
104
  slot: 'suffix',
143
105
  body: NEWTASK_REF_BODY,
144
106
  varsSchema: [],
145
- // 槽位默认值 = 用户看到的「填这里」提示:渲染后任务里不是空块,点进去改成自己的问题即可。
146
- // 默认值是**提示文字**而不是空串,是因为 #217 之后这块在编辑器里是「可编辑插槽」——
147
- // 空块看不出该写什么。
148
- vars: { [SLOT_NAME]: CONTENT_HINT },
107
+ vars: {},
149
108
  isDefault: 1,
150
109
  },
151
110
  {
@@ -244,48 +203,5 @@ export function seedBuiltinTemplates(conn: DbApi, atMs: number): number {
244
203
  }
245
204
  );
246
205
  }
247
- // ③ 出厂正文自愈(#218):插槽被旧编辑器吃掉的 builtin 行恢复成带 {{content}} 的出厂文本
248
- healRenderedBuiltinBodies(conn, atMs);
249
206
  return BUILTIN_TEMPLATES.length;
250
207
  }
251
-
252
- /**
253
- * 出厂正文自愈(#218;seedBuiltinTemplates 的第 ③ 步,独立导出以便单测)。
254
- *
255
- * 两条判据,都只碰 `builtin = 1` 的行(用户自建模板 builtin=0,一律不动):
256
- *
257
- * ① **逐字相等**:body === 「出厂文本按默认值渲染后的样子」。
258
- * 旧编辑器「先渲染再编辑、保存回库」的产物,插槽变了提示文字。
259
- * ② **渲染残留**:库里这行一个插槽都没有,**但还留着出厂的提示文字**
260
- * (`{{content}}` 被替换成的「(把你要问这个仓库的问题写在这里)」)。
261
- * 跨了几个版本之后 ① 对不上(出厂文本本身改过),但症状一样:正文里再也
262
- * 检不出槽位,「新建任务」永远进不了参数填写页(#153 验收反馈)。
263
- * 只认「提示文字还在」这一种残留——用户手写的正文里没有这句提示,
264
- * 照旧按 T06 不动。
265
- *
266
- * 返回被恢复的模板 id(正常库上是空数组,幂等)。
267
- */
268
- export function healRenderedBuiltinBodies(conn: DbApi, atMs: number): string[] {
269
- const healed: string[] = [];
270
- for (const t of BUILTIN_TEMPLATES) {
271
- if (!hasSlot(t.body)) continue;
272
- const eaten = renderedFactoryBody(t);
273
- if (eaten === t.body) continue;
274
- const row = conn.get('SELECT body, builtin FROM templates WHERE id = :id', { id: t.id }) as
275
- | { body?: string; builtin?: number }
276
- | undefined;
277
- if (!row || !Number(row.builtin)) continue;
278
- const cur = String(row.body || '');
279
- const rendered = cur === eaten;
280
- // 跨版本的渲染残留:没有插槽,但出厂提示文字还在(= 旧编辑器把插槽渲染成了提示)
281
- const staleRender = !hasSlot(cur) && cur.includes(CONTENT_HINT);
282
- if (!rendered && !staleRender) continue;
283
- conn.run(
284
- `UPDATE templates SET body = :body, vars = :vars, updated_at = :at
285
- WHERE id = :id AND builtin = 1`,
286
- { id: t.id, body: t.body, vars: JSON.stringify(t.vars || {}), at: atMs },
287
- );
288
- healed.push(t.id);
289
- }
290
- return healed;
291
- }
@@ -1,7 +1,7 @@
1
1
  // settings 表的裸 k/v 读写(value 一律 JSON 文本)。
2
2
  //
3
3
  // 为什么在 core:settings 表的消费方横跨多个域 —— core/config.js(偏好 4 项,
4
- // 凭据绝不进库)与 tasktool 的队列级 timegoal(goal 是"按键取值"的运行时状态,
4
+ // 凭据绝不进库)与 goals 域的队列级 timegoal(goal 是"按键取值"的运行时状态,
5
5
  // 不参与任何关系查询)都要经这里读写。core 不得 import modules(分层规则),
6
6
  // 所以裸访问器落在 core,域语义(clamp / 白名单 / 键名)留在各自的模块里。
7
7
  //
@@ -30,7 +30,7 @@
30
30
  // - 保存模板时先 `validateTemplate()` 编译校验,语法错误**拒绝保存**(见
31
31
  // localtask/repo/settings),让用户当场看到错在哪;
32
32
  // - 渲染时若仍遇到坏模板(老版本存进去的 / 直接改库的),由调用方回落该区块
33
- // 的**内置模板**并把告警写进 `renderWarnings`(见 tasktool/system-blocks)。
33
+ // 的**内置模板**并把告警写进 `renderWarnings`(见 promptplug/compose.ts)。
34
34
  // 选择回落而不是阻断领取:一条坏模板不该让整个队列停摆,但问题必须在
35
35
  // CLI 返回载荷 / 面板预览里可见。
36
36
  //
@@ -43,7 +43,7 @@ export function assertPluginSpec(spec: PluginSpec | null | undefined): PluginSpe
43
43
  return { name, scope, config: spec.config && typeof spec.config === 'object' ? spec.config : {} };
44
44
  }
45
45
 
46
- // 内置登记(实现落在 tasktool/plugins;此处只登记元数据)
46
+ // 内置登记(实现落在 goals/plugins;此处只登记元数据)
47
47
  registerPluginMeta(BUILTIN_GOALS.blockgoal, 'control');
48
48
  registerPluginMeta(BUILTIN_GOALS.waitgoal, 'node');
49
49
  registerPluginMeta(BUILTIN_GOALS.timegoal, 'workflow');
@@ -1,9 +1,9 @@
1
- // workflow 契约(#34 阶段 0)—— 冻结类型,尚未接线到 localtask / tasktool。
1
+ // workflow 契约(#34 阶段 0)—— 冻结类型;#237 引擎门(facade)已删除,仅剩写路径底座在用。
2
2
  //
3
3
  // 对照参考方案(Node+TS DAG 动态工作流)在 nx-kv 上的映射:
4
4
  // workflowId → 主题 key(cwd 归一化 / repos key;全局 '__GLOBAL__')
5
- // submit(init) → localtask add / tasktool submitTask(只入队,不构造全图)
6
- // get(id,node?) → tasktool get / wait(AsyncIterable ≈ 单次或 waitgoal 长轮询)
5
+ // submit(init) → localtask add(只入队,不构造全图)
6
+ // get(id,node?) → 引擎门(#237 已删除;现役领取走 localtask.claim)
7
7
  // Node → localtask 一条任务(id 数字;状态用 status+completedAt)
8
8
  // Edge / blockBy → task.blockBy[] + task.blocksFollowing(闸门)
9
9
  // blockgoal → scope=control;onSchedule 决定后继是否 ready(见 localtask/dag.js)
@@ -20,7 +20,7 @@
20
20
  //
21
21
  // 工程约束(相对参考方案的刻意偏离):
22
22
  // - 仓库保持 JS ESM + JSDoc,不上平行 TypeScript 引擎
23
- // - 契约落在 core/;业务仍在 modules/localtask + modules/tasktool
23
+ // - 契约落在 core/;业务仍在 modules/localtask + modules/claim + modules/delivery + modules/goals(四域分工)
24
24
  // - 存储沿用本机 JSON 主题快照;RedisAdapter 属阶段 6,不挡主线
25
25
  // - 目标目录规范见同目录 layout.js(禁止平行 src/{facade,store,mutator,…})
26
26
 
@@ -0,0 +1,23 @@
1
+ // AUTO-GENERATED —— 由 scripts/gen-actions.mjs 生成,勿手改。
2
+ //
3
+ // 收录本目录下所有继承 ActionBase 的类。**加一条 action = 新建一个文件 +
4
+ // 跑 `pnpm gen`**;模块的 index.ts 不需要改。
5
+ // 新鲜度由 tests/unit/action-registry.test.mjs 对账。
6
+
7
+ import type { ActionBase } from '../../../runtime/action-base.js';
8
+ import type { Container } from '../../../runtime/container.js';
9
+ import { LocaltaskClaimAction } from './localtask-claim.js';
10
+ import { LocaltaskPreviewAction } from './localtask-preview.js';
11
+ import { LocaltaskWaitAction } from './localtask-wait.js';
12
+
13
+ /** 本模块的全部 action 类(容器按这个顺序建实例)。 */
14
+ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
15
+ LocaltaskClaimAction,
16
+ LocaltaskPreviewAction,
17
+ LocaltaskWaitAction,
18
+ ];
19
+
20
+ // 再导出类本身:前端 apiclient 的返回类型从这里 type-only 引用(实现即契约)。
21
+ export { LocaltaskClaimAction };
22
+ export { LocaltaskPreviewAction };
23
+ export { LocaltaskWaitAction };
@@ -4,8 +4,8 @@
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
5
  import { z } from 'zod';
6
6
  import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
7
- import { renderWait as _renderWait } from '../action-render.js';
8
- import { claimView } from '../contract-views.js';
7
+ import { renderWait as _renderWait } from '../../localtask/action-render.js';
8
+ import { claimView } from '../../localtask/contract-views.js';
9
9
  const renderWait: any = _renderWait;
10
10
 
11
11
  /** localtask.claim 的入参契约(CLI 与 HTTP 共用同一份)。 */
@@ -28,8 +28,8 @@ export class LocaltaskClaimAction extends ActionBase<typeof input> {
28
28
  })
29
29
  override async run(ctx: ActionInput<this['_input']>, meta: ActionRunMeta = {}) {
30
30
 
31
- const { getTask } = await (import('../../tasktool/get.js') as any);
32
- const { parseParams } = await (import('../../tasktool/params.js') as any);
31
+ const { getTask } = await (import('../get.js') as any);
32
+ const { parseParams } = await (import('../params.js') as any);
33
33
  // HTTP:不阻塞、不开浏览器(面板/脚本调用不该挂住请求,也不该弹窗)
34
34
  const viaHttp: any = !!(meta && meta.transport === 'http');
35
35
  const r: any = await getTask({
@@ -4,9 +4,9 @@
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
5
  import { z } from 'zod';
6
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
- import * as serviceNs from '../service.js';
7
+ import * as serviceNs from '../../localtask/service.js';
8
8
  import { badInput as _badInput } from '../../../core/errors.js';
9
- import { renderPreview as _renderPreview } from '../action-render.js';
9
+ import { renderPreview as _renderPreview } from '../../localtask/action-render.js';
10
10
  const service: any = serviceNs;
11
11
  const badInput: any = _badInput;
12
12
  const renderPreview: any = _renderPreview;
@@ -31,8 +31,8 @@ export class LocaltaskPreviewAction extends ActionBase<typeof input> {
31
31
  })
32
32
  override async run(ctx: ActionInput<this['_input']>) {
33
33
 
34
- const { previewTaskDelivery } = await (import('../../tasktool/preview.js') as any);
35
- const { parseParams } = await (import('../../tasktool/params.js') as any);
34
+ const { previewTaskDelivery } = await (import('../../delivery/preview.js') as any);
35
+ const { parseParams } = await (import('../params.js') as any);
36
36
  const draftText: any = ctx.text === undefined || ctx.text === null ? '' : String(ctx.text);
37
37
  if (!draftText.trim() && (ctx.id === undefined || ctx.id === null)) {
38
38
  throw badInput('需要 --id <任务编号>(预览库存任务)或 --text <正文>(预览草稿)');
@@ -4,7 +4,7 @@
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
5
  import { z } from 'zod';
6
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
- import { renderWait as _renderWait } from '../action-render.js';
7
+ import { renderWait as _renderWait } from '../../localtask/action-render.js';
8
8
  const renderWait: any = _renderWait;
9
9
 
10
10
  /** localtask.wait 的入参契约(CLI 与 HTTP 共用同一份)。 */
@@ -27,9 +27,9 @@ export class LocaltaskWaitAction extends ActionBase<typeof input> {
27
27
  })
28
28
  override async run(ctx: ActionInput<this['_input']>) {
29
29
 
30
- // wait 编排已迁 tasktool/wait.js(任务工具语义归 tasktool;命令名不变)
31
- const { waitForTask } = await (import('../../tasktool/wait.js') as any);
32
- const { parseParams } = await (import('../../tasktool/params.js') as any);
30
+ // wait 编排已迁 claim/wait.ts(领取语义归 claim 域;命令名不变)
31
+ const { waitForTask } = await (import('../wait.js') as any);
32
+ const { parseParams } = await (import('../params.js') as any);
33
33
  return waitForTask({
34
34
  cwd: ctx.cwd,
35
35
  timeoutSec: ctx.timeout,
@@ -1,4 +1,4 @@
1
- // tasktool/get.js —— 「领取任务」(localtask 的 get / waitgoal 语义)。
1
+ // claim/get.ts —— 「领取任务」(localtask 的 get / waitgoal 语义)。
2
2
  //
3
3
  // 默认(项目未开启「持续 get」):**直接 get**——队列有任务立即领;
4
4
  // 没有立即空手而回(instant,不阻塞),agent 按「暂时没活」收尾本轮。
@@ -13,7 +13,7 @@
13
13
  // 唯一合法出口是 timeout);get = 「领活」(kv-localget 的语义,项目开启持续
14
14
  // get 后由系统负责把循环指令带进交付文本,agent 不用自己记)。
15
15
  import { waitForTask } from './wait.js';
16
- import { getLoopForCwd, getLoopInstruction, type GetLoopState } from './getloop.js';
16
+ import { getLoopForCwd, type GetLoopState } from './waitgoal-config.js';
17
17
 
18
18
  export interface GetTaskOptions {
19
19
  cwd?: string;
@@ -44,7 +44,7 @@ export async function getTask({ cwd, timeoutSec, open = true, params, instant }:
44
44
  open,
45
45
  instant: instant === undefined ? (explicitWait ? false : !loop.enabled || minutes <= 0) : !!instant,
46
46
  params: params || {}, // 外部参数(平面扩展)进交付模板
47
- getLoopTpl: getLoopInstruction(loop),
47
+ getLoopEnabled: !!loop.enabled,
48
48
  getLoopWaitMinutes: minutes,
49
49
  });
50
50
  if (r.status !== 'ok' || !r.task) return r;
@@ -0,0 +1,25 @@
1
+ // claim 模块(模板形态):任务系统的核心动词——领取。
2
+ //
3
+ // 领取链在这里闭环:claim action(CLI `localtask get` / HTTP `/api/localtasks/claim`)
4
+ // → getTask → waitForTask(阻塞窗口)→ 交付组装(delivery 域的 host + promptplug 的 assemble)。
5
+ // 持续 get(waitgoal)配置也在本域:项目级开关 + 阻塞分钟数。
6
+ import { ModuleBase } from '../../runtime/types/module.js';
7
+ import { zodActionsOf, type ZodBoundAction } from '../../runtime/action-decorator.js';
8
+ import { container, type Container } from '../../runtime/container.js';
9
+ import { ACTIONS } from './actions/_manifest.generated.js';
10
+
11
+ export class ClaimModule extends ModuleBase {
12
+ override readonly id = 'claim';
13
+ override readonly title = "任务领取(= CLI `localtask get` / HTTP claim;等待与持续 get 在此闭环)";
14
+ override readonly order = 21;
15
+
16
+ override readonly actions: readonly ZodBoundAction[];
17
+
18
+ constructor(c: Container = container) {
19
+ super();
20
+ this.actions = ACTIONS.flatMap((Cls) => zodActionsOf(c.create(Cls)));
21
+ }
22
+ }
23
+
24
+ export const claimModule = new ClaimModule();
25
+ export default claimModule;
@@ -1,4 +1,4 @@
1
- // tasktool/panel-escort.js —— wait 阻塞期间的**面板随行**(从 wait.js 整体迁入)。
1
+ // claim/panel-escort.ts —— wait 阻塞期间的**面板随行**(从 wait.js 整体迁入)。
2
2
  //
3
3
  // 职责单一:这里的代码全部是「帮用户把面板窗口伺候好」——确保主面板在跑、
4
4
  // 算深链、探测活动标签、必要时重开窗口(带节流/冷却/上限的防风暴)。
@@ -27,7 +27,7 @@ export function deepLinkUrl(key: unknown, port: unknown): string {
27
27
  return `${panelOrigin(port)}/${page}`;
28
28
  }
29
29
 
30
- // 本仓库/已安装包的 CLI 入口(src/modules/tasktool/ 上三级到包根)。
30
+ // 本仓库/已安装包的 CLI 入口(src/modules/delivery/ 上三级到包根)。
31
31
  function binCliPath(): string {
32
32
  return fileURLToPath(new URL('../../../bin/kv.mjs', import.meta.url));
33
33
  }
@@ -1,4 +1,4 @@
1
- // tasktool/params.js —— **外部参数(平面扩展)**的解析(任务 #62)。
1
+ // claim/params.ts —— **外部参数(平面扩展)**的解析(任务 #62)。
2
2
  //
3
3
  // 领取任务的引擎(get / wait)支持往交付模板的 ctx 里塞**任意**外部参数:
4
4
  // nx-kv localtask wait --cwd "<dir>" --param lane=payment --param retry=2