nx-kv 0.65.2 → 0.65.4

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 (176) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +15 -37
  3. package/assets/nx-kv/QUICKSTART.md +110 -0
  4. package/assets/nx-kv/references/A05-/344/273/273/345/212/241/351/223/276/344/270/216/345/217/215/351/246/210/346/261/207/346/200/273.md +1 -1
  5. package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +1 -2
  6. package/package.json +1 -1
  7. package/src/core/config.ts +23 -0
  8. package/src/core/db/settings.ts +1 -1
  9. package/src/core/instruction-template.ts +2 -2
  10. package/src/core/workflow/plugin-registry.ts +1 -1
  11. package/src/core/workflow/project.ts +1 -1
  12. package/src/core/workflow/types.ts +4 -4
  13. package/src/modules/claim/actions/_manifest.generated.ts +20 -0
  14. package/src/modules/{localtask → claim}/actions/localtask-claim.ts +5 -5
  15. package/src/modules/{localtask → claim}/actions/localtask-preview.ts +4 -4
  16. package/src/modules/{promptplug/delivery.ts → claim/assemble.ts} +6 -6
  17. package/src/modules/{tasktool → claim}/get.ts +5 -6
  18. package/src/modules/{tasktool → claim}/groupctx.ts +4 -7
  19. package/src/modules/{tasktool/delivery.ts → claim/host.ts} +7 -7
  20. package/src/modules/claim/index.ts +25 -0
  21. package/src/modules/{tasktool → claim}/panel-escort.ts +2 -2
  22. package/src/modules/{tasktool → claim}/params.ts +3 -3
  23. package/src/modules/{tasktool → claim}/preview.ts +5 -5
  24. package/src/modules/{tasktool → claim}/wait.ts +17 -17
  25. package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +3 -24
  26. package/src/modules/docs/actions/_manifest.generated.ts +12 -0
  27. package/src/modules/{repos → docs}/actions/repo-doc-add.ts +3 -2
  28. package/src/modules/{repos → docs}/actions/repo-doc-list.ts +3 -2
  29. package/src/modules/{repos → docs}/actions/repo-doc-remove.ts +3 -2
  30. package/src/modules/{repos → docs}/actions/repo-knowledge.ts +3 -2
  31. package/src/modules/docs/knowledge.ts +8 -16
  32. package/src/modules/goals/index.ts +25 -0
  33. package/src/modules/{tasktool → goals}/plugins/discover.ts +3 -3
  34. package/src/modules/{tasktool → goals}/plugins/index.ts +0 -2
  35. package/src/modules/{tasktool → goals}/plugins/taskgoal-store.ts +2 -2
  36. package/src/modules/{tasktool → goals}/plugins/timegoal-cwd-store.ts +1 -1
  37. package/src/modules/{tasktool → goals}/plugins/timegoal-store.ts +3 -3
  38. package/src/modules/{tasktool → goals}/plugins/timegoal-task-store.ts +2 -2
  39. package/src/modules/{tasktool → goals}/support.ts +3 -1
  40. package/src/modules/localtask/actions/_manifest.generated.ts +0 -9
  41. package/src/modules/localtask/actions/localtask-add.ts +4 -4
  42. package/src/modules/localtask/actions/localtask-attach-note.ts +1 -1
  43. package/src/modules/localtask/actions/localtask-attach.ts +1 -1
  44. package/src/modules/localtask/actions/localtask-attachments.ts +2 -2
  45. package/src/modules/localtask/actions/localtask-cancel.ts +1 -1
  46. package/src/modules/localtask/actions/localtask-chain.ts +1 -1
  47. package/src/modules/localtask/actions/localtask-detach.ts +2 -2
  48. package/src/modules/localtask/actions/localtask-done.ts +1 -1
  49. package/src/modules/localtask/actions/localtask-get.ts +3 -3
  50. package/src/modules/localtask/actions/localtask-list.ts +1 -1
  51. package/src/modules/localtask/actions/localtask-reopen.ts +5 -5
  52. package/src/modules/localtask/actions/localtask-timegoalLog.ts +1 -1
  53. package/src/modules/localtask/actions/localtask-topic-removeMany.ts +1 -1
  54. package/src/modules/localtask/actions/localtask-update.ts +3 -3
  55. package/src/modules/localtask/{bus → infra/bus}/index.ts +1 -1
  56. package/src/modules/localtask/{engine.ts → infra/engine.ts} +1 -1
  57. package/src/modules/localtask/{events.ts → infra/events.ts} +3 -3
  58. package/src/modules/localtask/{mutator → infra/mutator}/index.ts +2 -2
  59. package/src/modules/localtask/{mutator → infra/mutator}/validate.ts +4 -4
  60. package/src/modules/localtask/{repo → infra/repo}/goals.ts +2 -2
  61. package/src/modules/localtask/{repo → infra/repo}/index.ts +1 -1
  62. package/src/modules/localtask/{repo → infra/repo}/links.ts +2 -2
  63. package/src/modules/localtask/{repo → infra/repo}/open.ts +4 -4
  64. package/src/modules/localtask/{repo → infra/repo}/presence.ts +1 -1
  65. package/src/modules/localtask/{repo → infra/repo}/rows.ts +1 -1
  66. package/src/modules/localtask/{repo → infra/repo}/settings.ts +5 -5
  67. package/src/modules/localtask/{repo → infra/repo}/snapshot.ts +9 -7
  68. package/src/modules/localtask/{repo → infra/repo}/tasks.ts +82 -4
  69. package/src/modules/localtask/{repo → infra/repo}/topics.ts +3 -3
  70. package/src/modules/localtask/{repo-ctx.ts → infra/repo-ctx.ts} +1 -1
  71. package/src/modules/localtask/{scheduler → infra/scheduler}/index.ts +1 -1
  72. package/src/modules/localtask/{scheduler → infra/scheduler}/state-drive.ts +4 -4
  73. package/src/modules/localtask/{store → infra/store}/file-adapter.ts +2 -2
  74. package/src/modules/localtask/{store → infra/store}/index.ts +4 -4
  75. package/src/modules/localtask/{store → infra/store}/memory-adapter.ts +2 -2
  76. package/src/modules/localtask/{store-io.ts → infra/store-io.ts} +1 -1
  77. package/src/modules/localtask/{writes.ts → infra/writes.ts} +3 -3
  78. package/src/modules/{tasktool → localtask/lifecycle}/add.ts +8 -8
  79. package/src/modules/localtask/{deletion.ts → lifecycle/deletion.ts} +4 -4
  80. package/src/modules/localtask/{task-lifecycle.ts → lifecycle/task-lifecycle.ts} +18 -19
  81. package/src/modules/localtask/{task-ops.ts → lifecycle/task-ops.ts} +14 -14
  82. package/src/modules/localtask/{task-remove.ts → lifecycle/task-remove.ts} +4 -4
  83. package/src/modules/localtask/{task-templates.ts → lifecycle/task-templates.ts} +2 -2
  84. package/src/modules/localtask/{task-view.ts → lifecycle/task-view.ts} +14 -13
  85. package/src/modules/localtask/{topics.ts → lifecycle/topics.ts} +7 -7
  86. package/src/modules/{tasktool → localtask/lifecycle}/update.ts +6 -6
  87. package/src/modules/{tasktool → localtask/ops}/attach-resource.ts +4 -4
  88. package/src/modules/{tasktool → localtask/ops}/attach-template.ts +3 -3
  89. package/src/modules/{tasktool → localtask/ops}/attach.ts +11 -11
  90. package/src/modules/localtask/{board-target.ts → ops/board-target.ts} +1 -1
  91. package/src/modules/{tasktool → localtask/ops}/doc-inline.ts +3 -3
  92. package/src/modules/{tasktool → localtask/ops}/group-store.ts +3 -3
  93. package/src/modules/localtask/service.ts +16 -16
  94. package/src/modules/localtask/{action-render.ts → ui/action-render.ts} +2 -2
  95. package/src/modules/localtask/{panel-guard.ts → ui/panel-guard.ts} +1 -1
  96. package/src/modules/localtask/{panel-presence.ts → ui/panel-presence.ts} +7 -7
  97. package/src/modules/localtask/waiters.ts +2 -2
  98. package/src/modules/localtask/waiting.ts +1 -1
  99. package/src/modules/promptplug/factory.ts +2 -2
  100. package/src/modules/promptplug/index.ts +5 -7
  101. package/src/modules/promptplug/plugins/attachment.ts +1 -1
  102. package/src/modules/promptplug/plugins/context.ts +9 -20
  103. package/src/modules/promptplug/plugins/goal-prompt.ts +1 -1
  104. package/src/modules/repos/actions/_manifest.generated.ts +0 -12
  105. package/src/modules/repos/service/crud.ts +1 -1
  106. package/src/runtime/cli.ts +1 -1
  107. package/src/runtime/registry.ts +4 -2
  108. package/src/{modules/tasktool → shared}/delivery-text.ts +5 -4
  109. package/src/shared/feedback-text.ts +80 -20
  110. package/src/shared/task-status.ts +42 -0
  111. package/src/web/frontend/api/cli-tree.json +202 -217
  112. package/src/web/frontend/api/client.generated.ts +141 -139
  113. package/src/web/frontend/modules/board/ack-nodes.ts +10 -13
  114. package/src/web/frontend/modules/board/reopen-text.ts +5 -0
  115. package/src/web/frontend/modules/md/styles/editor.css +8 -0
  116. package/src/web/public/assets/{bar-Dc5Tq1eE.js → bar-kaVB6FAa.js} +1 -1
  117. package/src/web/public/assets/{board-view-BVennxTs.js → board-view-Cwot54HC.js} +1 -1
  118. package/src/web/public/assets/{composer-launch-fp2IzGzQ.js → composer-launch-BMTU-BD9.js} +1 -1
  119. package/src/web/public/assets/{composer-panel-Dh681iO6.js → composer-panel-BF6gjNXv.js} +1 -1
  120. package/src/web/public/assets/{dag-DnaU0I_z.js → dag-BRE33yI8.js} +1 -1
  121. package/src/web/public/assets/dir-B0IW4NIn.js +3 -0
  122. package/src/web/public/assets/{doc-DRSKD0Re.js → doc-DsRb-4WT.js} +1 -1
  123. package/src/web/public/assets/frontmatter-Bcseml1q.js +2 -0
  124. package/src/web/public/assets/{group-Dc3ZgW24.js → group-CS8VP6z0.js} +1 -1
  125. package/src/web/public/assets/{index-Bg0m8gbJ.js → index-BT2y9cTX.js} +2 -2
  126. package/src/web/public/assets/{index-BIVxGd6t.css → index-DSAamoav.css} +1 -1
  127. package/src/web/public/assets/{md-history-DNtgaIdH.js → md-history-CJ1N9-Jf.js} +1 -1
  128. package/src/web/public/assets/{md-parse-C9Vd6ejP.js → md-parse-DAYCREP1.js} +1 -1
  129. package/src/web/public/assets/{model-CtG2jIDv.js → model-TD5kGXzR.js} +1 -1
  130. package/src/web/public/assets/{overview-C68QpcT9.js → overview-Bsq58sDd.js} +1 -1
  131. package/src/web/public/assets/{progress-CEmAFxo9.js → progress-B4DfpsyS.js} +1 -1
  132. package/src/web/public/assets/{refs-TzxZYy7T.js → refs-DIiA_49Z.js} +1 -1
  133. package/src/web/public/assets/{repo-form-modal-Dg3hJWUV.js → repo-form-modal-DChK4NSX.js} +1 -1
  134. package/src/web/public/assets/{repos-uNqSR5YB.js → repos-PGFYkUgf.js} +1 -1
  135. package/src/web/public/assets/{route-crumb-C4DgkJ8G.js → route-crumb-SiMi2C_T.js} +1 -1
  136. package/src/web/public/assets/{status-tag-8cLH8hl9.js → status-tag-C9YVBvQh.js} +1 -1
  137. package/src/web/public/assets/task-BL5uxmJh.js +11 -0
  138. package/src/web/public/assets/{task-row-CRjuAfKW.js → task-row-cE7qblNK.js} +1 -1
  139. package/src/web/public/assets/{task-utils-DAPxKm4c.js → task-utils-cBR6Gj_c.js} +8 -7
  140. package/src/web/public/assets/{templates-DNiGvmdq.js → templates-Cfn3Xmsf.js} +3 -3
  141. package/src/web/public/assets/{use-rail-drag-DxIYcszo.js → use-rail-drag-Boxl7pOG.js} +1 -1
  142. package/src/web/public/index.html +11 -11
  143. package/src/core/workflow/edges.ts +0 -28
  144. package/src/core/workflow/layout.ts +0 -118
  145. package/src/modules/localtask/actions/localtask-wait.ts +0 -41
  146. package/src/modules/tasktool/facade/get.ts +0 -54
  147. package/src/modules/tasktool/facade/index.ts +0 -4
  148. package/src/modules/tasktool/facade/submit.ts +0 -61
  149. package/src/modules/tasktool/facade/wait.ts +0 -3
  150. package/src/modules/tasktool/getloop.ts +0 -2
  151. package/src/modules/tasktool/index.ts +0 -24
  152. package/src/modules/tasktool/plugins/runtime.ts +0 -73
  153. package/src/modules/tasktool/plugins/waitgoal.ts +0 -71
  154. package/src/web/public/assets/dir-d16q1GLe.js +0 -3
  155. package/src/web/public/assets/frontmatter-CN6IlxWU.js +0 -2
  156. package/src/web/public/assets/task-DuFOXLPC.js +0 -11
  157. /package/src/modules/{tasktool → goals}/actions/_manifest.generated.ts +0 -0
  158. /package/src/modules/{tasktool → goals}/actions/timegoal-check.ts +0 -0
  159. /package/src/modules/{tasktool → goals}/actions/timegoal-clear.ts +0 -0
  160. /package/src/modules/{tasktool → goals}/actions/timegoal-list.ts +0 -0
  161. /package/src/modules/{tasktool → goals}/actions/timegoal-log.ts +0 -0
  162. /package/src/modules/{tasktool → goals}/actions/timegoal-prune.ts +0 -0
  163. /package/src/modules/{tasktool → goals}/actions/timegoal-set.ts +0 -0
  164. /package/src/modules/{tasktool → goals}/actions/timegoal-show.ts +0 -0
  165. /package/src/modules/{tasktool → goals}/actions/timegoal-update.ts +0 -0
  166. /package/src/modules/{tasktool → goals}/plugins/base.ts +0 -0
  167. /package/src/modules/{tasktool → goals}/plugins/blockgoal.ts +0 -0
  168. /package/src/modules/{tasktool → goals}/plugins/container.ts +0 -0
  169. /package/src/modules/{tasktool → goals}/plugins/taskgoal.ts +0 -0
  170. /package/src/modules/{tasktool → goals}/plugins/timegoal-core-store.ts +0 -0
  171. /package/src/modules/{tasktool → goals}/plugins/timegoal.ts +0 -0
  172. /package/src/modules/{tasktool → goals}/taskgoal.ts +0 -0
  173. /package/src/modules/{tasktool → goals}/timegoal.ts +0 -0
  174. /package/src/modules/localtask/{store → infra/store}/topic-adapter.ts +0 -0
  175. /package/src/modules/localtask/{action-flags.ts → ui/action-flags.ts} +0 -0
  176. /package/src/modules/localtask/{contract-views.ts → ui/contract-views.ts} +0 -0
@@ -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
+ // get 的阻塞编排住在 claim/wait.ts,通过这组 API 挂钩,不碰队列内部。
12
12
 
13
13
  /** 主题级 waiter 条目(resolve 回调收 JSON 形态任务)。 */
14
14
  export interface TopicWaiterEntry {
@@ -20,7 +20,7 @@ export interface TopicWaiterEntry {
20
20
 
21
21
  const waiters = new Map<string, TopicWaiterEntry>();
22
22
 
23
- /** wait/get 编排侧:登记「本目录有阻塞中的 waiter」(同 key 旧登记被覆盖)。 */
23
+ /** get 编排侧:登记「本目录有阻塞中的 waiter」(同 key 旧登记被覆盖)。 */
24
24
  export function registerTopicWaiter(key: string, entry: TopicWaiterEntry): void {
25
25
  waiters.set(key, entry);
26
26
  }
@@ -6,7 +6,7 @@
6
6
  // finally 不会执行,waiting:true 会永久残留;独立成表后残留只污染这张小表,
7
7
  // 整表清空即可,不会让队列本身看起来像有人在等。
8
8
  import { isGlobalKey, GLOBAL_NAME, resolveTopicKey } from './paths.js';
9
- import { openLocaltaskStore as openStore, presence as presenceRepo, topics as topicsRepo, txw as tx } from './repo/index.js';
9
+ import { openLocaltaskStore as openStore, presence as presenceRepo, topics as topicsRepo, txw as tx } from './infra/repo/index.js';
10
10
 
11
11
  // 在库里把某主题置为等待/结束,并刷新现状。
12
12
  // waitingSince 是「等待起点」,面板据此显示「已等多久」——waitingUntil(截止时刻)
@@ -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
+ // claim 共同的依赖终点,不含任何装配代码。
6
6
  //
7
- // 依赖方向(设计内):tasktool 是唯一消费方——领域取数(readGroupContext /
7
+ // 依赖方向(设计内):claim 是唯一消费方——领域取数(readGroupContext /
8
8
  // attachTemplateCtx / pendingQueueInfo / getloop 指令渲染)由宿主完成,以 `Supply`
9
9
  // 形式交给插件;插件在自己的 buildData() 里 await supplied() 后只做变换。
10
10
  // promptplug 不 import 其他模块。
@@ -1,15 +1,15 @@
1
1
  // promptplug 装配:模块元信息 + action 清单装配。
2
2
  //
3
3
  // 插件工厂 / 注册表 / 字段目录在 factory.ts + registry.ts(actions 经 manifest 引
4
- // 工厂,不能回环引本文件)。依赖方向(设计内):tasktool 是唯一消费方——宿主完成
4
+ // 工厂,不能回环引本文件)。依赖方向(设计内):claim 是唯一消费方——宿主完成
5
5
  // 领域取数,以 Supply 形式注入插件;插件在自己的 buildData() 里变换。
6
- // promptplug 不 import 其他模块(delivery.ts 的交付组装同样只收宿主取好的数据)。
6
+ // promptplug 不 import 其他模块(claim/host.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
+ // 装配无关的公开面(claim / settings.ts 从这里拿)
13
13
  export {
14
14
  activeTemplateOf,
15
15
  blockLabelOf,
@@ -34,13 +34,11 @@ export {
34
34
  export { PLUGIN_GROUPS } from './base.js';
35
35
  export type { PluginGroup, TemplateText } from './base.js';
36
36
  export { compose } from './compose.js';
37
- export { assembleDelivery, flatParamsOf, DELIVERY_SEGMENTS } from './delivery.js';
38
- export type { AssembledDelivery, DeliveryHostData } from './delivery.js';
39
37
 
40
38
  /**
41
39
  * 提示词插件模块:注册表外露(prompt.registry)。
42
- * 业务面(compose / buildPlugins)由 tasktool 直接消费——这是设计内依赖
43
- * (tasktool → promptplug)。
40
+ * 业务面(compose / buildPlugins)由 claim 域直接消费——这是设计内依赖
41
+ * (claim → promptplug)。本模块不 import 任何其他模块(组装核已迁到 claim/assemble.ts)。
44
42
  */
45
43
  export class PromptplugModule extends ModuleBase {
46
44
  override readonly id = 'promptplug';
@@ -1,6 +1,6 @@
1
1
  // attachment 插件(order 20):附件识别。
2
2
  //
3
- // 数据变换(attachTemplateCtx)留在 tasktool/attach-template.ts —— 它依赖
3
+ // 数据变换(attachTemplateCtx)留在 localtask/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() 搬自 claim/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';
@@ -22,9 +22,7 @@ const refRepoShape = z.looseObject({
22
22
 
23
23
  const peerShape = z.looseObject({
24
24
  name: z.string().describe('成员仓库名'),
25
- note: z.string().describe('组内描述:它在组里的角色与配合关系'),
26
25
  path: z.string().describe('本地绝对路径'),
27
- hasNote: z.boolean().describe('是否写了组内描述'),
28
26
  });
29
27
 
30
28
  const repoShape = z.looseObject({
@@ -48,9 +46,7 @@ const groupShape = z.looseObject({
48
46
  introPath: z.string().describe('组介绍文档路径(本地 md;没有为空串)'),
49
47
  introRefId: z.string().describe('组介绍文档 id(docs get --ref 用)'),
50
48
  introDesc: z.string().describe('组介绍的一句话描述'),
51
- note: z.string().describe('组内描述:本项目在组里的位置(角色 / 协作关系)'),
52
- position: z.string().describe('= note(旧字段名,新模板用 note)'),
53
- peers: z.array(peerShape).describe('组内成员(name / note / path)'),
49
+ peers: z.array(peerShape).describe('组内成员(name / path)'),
54
50
  peerCount: z.number().describe('组内成员数'),
55
51
  docs: z.array(docItemShape).describe('组文档清单'),
56
52
  docCount: z.number().describe('组文档数'),
@@ -85,13 +81,11 @@ function docItems(links: any) {
85
81
  }));
86
82
  }
87
83
 
88
- /** 组内成员 → 结构化数组({{name}} / {{note}} / {{path}}——#163:路径方便直接访问)。 */
84
+ /** 组内成员 → 结构化数组({{name}} / {{path}}——#163:路径方便直接访问)。 */
89
85
  function peerItems(peers: any) {
90
86
  return (peers || []).map((p: any) => ({
91
87
  name: p.name || '',
92
- note: p.note || '',
93
88
  path: p.path || '',
94
- hasNote: !!p.note,
95
89
  }));
96
90
  }
97
91
 
@@ -105,16 +99,16 @@ function refRepoItems(list: any) {
105
99
  }
106
100
 
107
101
  /**
108
- * 组有没有值得交付的内容:定位 / 介绍 / 位置 / 参考文件 / 有描述的成员,任一即可。
109
- * 纯「成员名单(全员无描述)」不算——那只会喷出一排空标签(#81)。
102
+ * 组有没有值得交付的内容:定位 / 介绍 / 组文档 / 参考仓库,任一即可。
103
+ * 纯「成员名单」不算——那只会喷出一排空标签(#81)。
104
+ * (组内描述 note 已随模板上下文清理移除,不再参与判定。)
110
105
  */
111
106
  function groupHasContent(g: any): boolean {
112
107
  if (!g) return false;
113
- if (g.desc || g.note) return true;
108
+ if (g.desc) return true;
114
109
  if (g.intro && g.intro.body) return true;
115
110
  if (g.docLinks && g.docLinks.length) return true;
116
- if (g.refRepos && g.refRepos.length) return true;
117
- return (g.peers || []).some((p: any) => p.note);
111
+ return !!(g.refRepos && g.refRepos.length);
118
112
  }
119
113
 
120
114
  export function deliveryCtxOf(groupCtx: any) {
@@ -168,8 +162,6 @@ export function deliveryCtxOf(groupCtx: any) {
168
162
  introPath: (g.intro && g.intro.path) || '',
169
163
  introRefId: (g.intro && g.intro.refId) || '',
170
164
  introDesc: (g.intro && (g.intro.desc || g.intro.title)) || '',
171
- note: g.note || '',
172
- position: g.note || '',
173
165
  peers,
174
166
  peerCount: peers.length,
175
167
  docs: gdocs,
@@ -212,9 +204,6 @@ const BUILTIN: TemplateText = {
212
204
  {{#if group.desc}}
213
205
  组定位:{{group.desc}}
214
206
  {{/if}}
215
- {{#if group.note}}
216
- 本项目在组里的位置:{{group.note}}
217
- {{/if}}
218
207
  {{#if group.introRefId}}
219
208
  组介绍:{{#if group.introDesc}}{{group.introDesc}}{{else}}(无描述){{/if}}
220
209
  取用:nx-kv docs get --ref {{group.introRefId}}
@@ -222,7 +211,7 @@ const BUILTIN: TemplateText = {
222
211
  {{#if group.peers}}
223
212
  组内成员:
224
213
  {{#each group.peers}}
225
- - {{name}}:{{#if note}}{{note}}{{else}}(无组内描述){{/if}}{{#if path}}({{path}}){{/if}}
214
+ - {{name}}{{#if path}}({{path}}){{/if}}
226
215
  {{/each}}
227
216
  {{/if}}
228
217
  {{#if group.docs}}
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // 为什么在 promptplug(#227 重构):模板正文归提示词模板体系(出厂正文 / 兜底文案
4
4
  // 都在 promptplug/plugins/ 下);taskgoal-store(领取路径)与 timegoal-task-store
5
- // (check 路径)作为 tasktool 宿主从这里取用——依赖方向单一(tasktool → promptplug),
5
+ // (check 路径)作为 goals 域宿主从这里取用——依赖方向单一(goals → promptplug),
6
6
  // 两边变量口径永远一致,也不再依赖「模板夹在两个互相 import 的 store 之间」来防环。
7
7
  //
8
8
  // goals.prompt 落库的是**模板原文**(占位符保留),渲染发生在:
@@ -23,9 +23,6 @@ import { RepoBindTopicsAction } from './repo-bind-topics.js';
23
23
  import { RepoBindAction } from './repo-bind.js';
24
24
  import { RepoCloneAction } from './repo-clone.js';
25
25
  import { RepoDetectAction } from './repo-detect.js';
26
- import { RepoDocAddAction } from './repo-doc-add.js';
27
- import { RepoDocListAction } from './repo-doc-list.js';
28
- import { RepoDocRemoveAction } from './repo-doc-remove.js';
29
26
  import { RepoExportAction } from './repo-export.js';
30
27
  import { RepoGetAction } from './repo-get.js';
31
28
  import { RepoImportDiffAction } from './repo-import-diff.js';
@@ -33,7 +30,6 @@ import { RepoImportAction } from './repo-import.js';
33
30
  import { RepoKeyMigrateAction } from './repo-key-migrate.js';
34
31
  import { RepoKeyRefreshAction } from './repo-key-refresh.js';
35
32
  import { RepoKeySetAction } from './repo-key-set.js';
36
- import { RepoKnowledgeAction } from './repo-knowledge.js';
37
33
  import { RepoListAction } from './repo-list.js';
38
34
  import { RepoOpenAction } from './repo-open.js';
39
35
  import { RepoRefAddAction } from './repo-ref-add.js';
@@ -69,9 +65,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
69
65
  RepoBindAction,
70
66
  RepoCloneAction,
71
67
  RepoDetectAction,
72
- RepoDocAddAction,
73
- RepoDocListAction,
74
- RepoDocRemoveAction,
75
68
  RepoExportAction,
76
69
  RepoGetAction,
77
70
  RepoImportDiffAction,
@@ -79,7 +72,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
79
72
  RepoKeyMigrateAction,
80
73
  RepoKeyRefreshAction,
81
74
  RepoKeySetAction,
82
- RepoKnowledgeAction,
83
75
  RepoListAction,
84
76
  RepoOpenAction,
85
77
  RepoRefAddAction,
@@ -115,9 +107,6 @@ export { RepoBindTopicsAction };
115
107
  export { RepoBindAction };
116
108
  export { RepoCloneAction };
117
109
  export { RepoDetectAction };
118
- export { RepoDocAddAction };
119
- export { RepoDocListAction };
120
- export { RepoDocRemoveAction };
121
110
  export { RepoExportAction };
122
111
  export { RepoGetAction };
123
112
  export { RepoImportDiffAction };
@@ -125,7 +114,6 @@ export { RepoImportAction };
125
114
  export { RepoKeyMigrateAction };
126
115
  export { RepoKeyRefreshAction };
127
116
  export { RepoKeySetAction };
128
- export { RepoKnowledgeAction };
129
117
  export { RepoListAction };
130
118
  export { RepoOpenAction };
131
119
  export { RepoRefAddAction };
@@ -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 '../../../core/config.js';
5
5
  import repoLayer from '../repo/index.js';
6
6
  import { loadStore, mutateStore } from './store.js';
7
7
  import {
@@ -347,7 +347,7 @@ function fail(err: unknown, json: boolean): void {
347
347
 
348
348
  async function cmdServe(ctx: ServeCtx): Promise<void> {
349
349
  const { startServer } = await import('./server.js');
350
- const { startPanelIdleGuard } = await import('../modules/localtask/panel-guard.js');
350
+ const { startPanelIdleGuard } = await import('../modules/localtask/ui/panel-guard.js');
351
351
  const { registerPanel, unregisterPanel, notePanelRequest } = await import(
352
352
  '../modules/localtask/service.js'
353
353
  );
@@ -28,7 +28,8 @@ 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 goals from '../modules/goals/index.js';
32
33
  import repos from '../modules/repos/index.js';
33
34
  import docs from '../modules/docs/index.js';
34
35
  import file from '../modules/file/index.js';
@@ -41,7 +42,8 @@ const MODULE_LIST: readonly AnyModule[] = [
41
42
  systemModule,
42
43
  setting,
43
44
  localtask,
44
- tasktool,
45
+ claim,
46
+ goals,
45
47
  repos,
46
48
  docs,
47
49
  file,
@@ -1,8 +1,9 @@
1
- // tasktool/delivery-text.js —— 交付载荷的人读正文(**唯一出处**)。
1
+ // shared/delivery-text.ts —— 交付载荷的人读正文(**唯一出处**)。
2
+ // 同构纯函数:CLI 与面板、claim 与 localtask 共用同一份排版——所见即所得。
2
3
  //
3
4
  // 谁会用到:
4
- // - CLI `localtask get/wait` 的人读输出(localtask/index.js 的 renderWait)
5
- // - CLI `localtask preview` 与面板「预览提示词」(tasktool/preview.js)
5
+ // - CLI `localtask get` 的人读输出(localtask/action-render.ts 的 renderWait)
6
+ // - CLI `localtask preview` 与面板「预览提示词」(claim/preview.ts)
6
7
  //
7
8
  // 为什么单独抽出来:预览的全部价值在于「所见即所得」——如果面板自己拼一遍排版,
8
9
  // 迟早与 CLI 漂移,用户看到的就不是 agent 收到的那一份。同一份代码 = 同一份文本。
@@ -10,7 +11,7 @@
10
11
  // 排版口径:instruction 自包含正文(模板含 {{task.text}},服务端给出 coversBody)
11
12
  // 时直接替掉正文块(否则正文会出现两遍);否则「正文 + ── 收尾指令 ──」两段。
12
13
  // 正文交给阅读方前统一做「倒序聚焦 + 历史精简」重排(#157,shared/feedback-text.js)。
13
- import { reorderRoundsForDelivery } from '../../shared/feedback-text.js';
14
+ import { reorderRoundsForDelivery } from './feedback-text.js';
14
15
 
15
16
  /** 交付载荷(取任务/等待返回值里与人读排版相关的部分) */
16
17
  export interface DeliveryPayload {
@@ -85,9 +85,73 @@ export const ACK_CALLOUT_TYPE = 'NOTE';
85
85
  /** 验收反馈 callout 类型 */
86
86
  export const FEEDBACK_CALLOUT_TYPE = 'WARNING';
87
87
 
88
- const ACK_TITLE_RE = /完成总结/;
88
+ // ─── 语义判据统一(#混用治理)─────────────────────────────────────────
89
+ //
90
+ // 此前重排 / 定位轨 / 去重都靠**标题文本**(完成总结 / 验收反馈)判定语义,
91
+ // callout 的 `[!NOTE]` / `[!WARNING]` 只是给渲染器看的装饰。于是「琥珀色警告
92
+ // 块在结构上被当成上轮总结」这类分叉无人能拦。现在收口到一处:
93
+ // 类型为主判据(NOTE=完成总结 / WARNING=验收反馈),标题文本只在类型不认识
94
+ // 时回退(兼容自定义类型与历史手工正文)。视觉色块与结构语义由同一常量决定。
95
+
96
+ /** 一轮 callout 的语义角色:summary=上轮完成总结 / feedback=验收反馈 */
97
+ export type CalloutRole = 'summary' | 'feedback';
98
+
99
+ /** callout 首行的解析结果 */
100
+ export interface CalloutHead {
101
+ /** 类型标记(大写归一,如 NOTE / WARNING / TIP) */
102
+ type: string;
103
+ /** 类型标记后的标题文本 */
104
+ title: string;
105
+ /** 标题里的「第 N 轮」,没有为 0 */
106
+ round: number;
107
+ }
108
+
89
109
  const ROUND_NUM_RE = /第\s*(\d+)\s*轮/;
90
- const CALLOUT_TITLE_RE = /^>\s*\[![A-Za-z][\w-]*\][ \t]*(.*)$/;
110
+ const CALLOUT_HEAD_RE = /^>\s*\[!([A-Za-z][\w-]*)\][ \t]*(.*)$/;
111
+ const SUMMARY_TITLE_RE = /完成总结/;
112
+ const FEEDBACK_TITLE_RE = /反馈/;
113
+
114
+ const ROLE_OF_TYPE: Record<string, CalloutRole> = {
115
+ [ACK_CALLOUT_TYPE.toUpperCase()]: 'summary',
116
+ [FEEDBACK_CALLOUT_TYPE.toUpperCase()]: 'feedback',
117
+ };
118
+
119
+ /** 解析 callout 首行 → { type, title, round };不是 callout 返回 null */
120
+ export function parseCalloutHead(line: unknown): CalloutHead | null {
121
+ const m = String(line ?? '').match(CALLOUT_HEAD_RE);
122
+ if (!m) return null;
123
+ const title = String(m[2] ?? '').trim();
124
+ const r = title.match(ROUND_NUM_RE);
125
+ return {
126
+ type: String(m[1] ?? '').toUpperCase(),
127
+ title,
128
+ round: r ? (Number(r[1]) || 0) : 0,
129
+ };
130
+ }
131
+
132
+ function roleOfTitle(title: string): CalloutRole | null {
133
+ if (SUMMARY_TITLE_RE.test(title)) return 'summary';
134
+ if (FEEDBACK_TITLE_RE.test(title)) return 'feedback';
135
+ return null;
136
+ }
137
+
138
+ /** 语义角色:类型为主判据,标题文本为回退(类型不认识时才看标题) */
139
+ export function calloutRoleOf(head: CalloutHead | null | undefined): CalloutRole | null {
140
+ if (!head) return null;
141
+ return ROLE_OF_TYPE[head.type] ?? roleOfTitle(head.title);
142
+ }
143
+
144
+ /**
145
+ * 类型与标题语义是否冲突(守卫用):正常正文恒为 false。
146
+ * 冲突时 calloutRoleOf 以类型为准——渲染色块与结构语义保持一致,
147
+ * 不会被「写着 WARNING 却是完成总结」这类正文悄悄带偏。
148
+ */
149
+ export function calloutTypeTitleConflict(head: CalloutHead | null | undefined): boolean {
150
+ if (!head) return false;
151
+ const byType = ROLE_OF_TYPE[head.type];
152
+ const byTitle = roleOfTitle(head.title);
153
+ return !!byType && !!byTitle && byType !== byTitle;
154
+ }
91
155
 
92
156
  /** ack callout 标题:`第 N 轮 · 完成总结` */
93
157
  export function ackCalloutTitle(round: unknown): string {
@@ -124,19 +188,18 @@ export function feedbackCalloutSection({ round, quote, feedback, bold = false }:
124
188
  return `> [!${FEEDBACK_CALLOUT_TYPE}] ${feedbackCalloutTitle(round)}\n${calloutBody(inner)}`;
125
189
  }
126
190
 
127
- /** 正文里已有多少轮 ack:旧段名各算一轮;callout 标题带轮次号时取最大号(防手工删段后编号回退) */
191
+ /** 正文里已有多少轮 ack:旧段名各算一轮;callout 以类型判角色,标题带轮次号时取最大号(防手工删段后编号回退) */
128
192
  export function countAckRounds(base: unknown): number {
129
193
  const text = String(base ?? '');
130
194
  let n = 0;
131
195
  let max = 0;
132
196
  const legacy = text.match(/^## 上一轮完成总结\s*$/gm);
133
197
  n += legacy ? legacy.length : 0;
134
- for (const m of text.matchAll(/^>\s*\[![A-Za-z][\w-]*\][ \t]*(.*)$/gm)) {
135
- const title = String(m[1] ?? '');
136
- if (!ACK_TITLE_RE.test(title)) continue;
198
+ for (const line of text.split('\n')) {
199
+ const head = parseCalloutHead(line);
200
+ if (!head || calloutRoleOf(head) !== 'summary') continue;
137
201
  n += 1;
138
- const r = title.match(ROUND_NUM_RE);
139
- if (r) max = Math.max(max, Number(r[1]));
202
+ if (head.round) max = Math.max(max, head.round);
140
203
  }
141
204
  return Math.max(n, max);
142
205
  }
@@ -154,9 +217,8 @@ export function bodyHasAck(base: unknown, ack: unknown): boolean {
154
217
  if (b.includes(`${ACK_SUMMARY_HEADING}\n\n${a}`)) return true;
155
218
  const lines = b.split('\n');
156
219
  for (let i = 0; i < lines.length; i++) {
157
- const line = lines[i] ?? '';
158
- const m = line.match(CALLOUT_TITLE_RE);
159
- if (!m || !ACK_TITLE_RE.test(String(m[1] ?? ''))) continue;
220
+ const head = parseCalloutHead(lines[i] ?? '');
221
+ if (!head || calloutRoleOf(head) !== 'summary') continue;
160
222
  const body: string[] = [];
161
223
  for (let j = i + 1; j < lines.length && (lines[j] ?? '').startsWith('>'); j++) {
162
224
  body.push((lines[j] ?? '').replace(/^>[ \t]?/, ''));
@@ -196,8 +258,6 @@ export function appendAckFeedback({ base, ack, quote, feedback, bold = true, rou
196
258
  //
197
259
  // 纯函数、零依赖;无轮次段时原样返回(老任务 / 单轮任务零影响)。
198
260
 
199
- const DELIVERY_ROUND_RE = /^>\s*\[![A-Za-z][\w-]*\][^\n]*第\s*(\d+)\s*轮[^\n]*(完成总结|验收反馈)/;
200
-
201
261
  const truncLine = (s: unknown, n = 60): string => {
202
262
  const t = String(s || '').trim();
203
263
  return t.length > n ? `${t.slice(0, n)}…` : t;
@@ -207,7 +267,7 @@ const truncLine = (s: unknown, n = 60): string => {
207
267
  function firstContentLine(block: unknown): string {
208
268
  const line = String(block || '')
209
269
  .split('\n')
210
- .filter((l) => l.trim() && !CALLOUT_TITLE_RE.test(l))
270
+ .filter((l) => l.trim() && !parseCalloutHead(l))
211
271
  .map((l) => l.replace(/^>\s?/, '').replace(/\*\*/g, '').trim())
212
272
  .find((l) => l);
213
273
  return line || '';
@@ -225,13 +285,13 @@ export function reorderRoundsForDelivery(body: unknown): string {
225
285
  const rounds = new Map<number, RoundBlocks>(); // n → { ack, fb }
226
286
  const plain: string[] = [];
227
287
  for (const b of blocks) {
228
- const m = b.match(DELIVERY_ROUND_RE);
229
- if (m) {
230
- const n = Number(m[1]);
231
- const r: RoundBlocks = rounds.get(n) || {};
232
- if (m[2] === '完成总结') r.ack = b;
288
+ const head = parseCalloutHead(String(b).split('\n')[0]);
289
+ const role = calloutRoleOf(head);
290
+ if (head && head.round && role) {
291
+ const r: RoundBlocks = rounds.get(head.round) || {};
292
+ if (role === 'summary') r.ack = b;
233
293
  else r.fb = b;
234
- rounds.set(n, r);
294
+ rounds.set(head.round, r);
235
295
  continue;
236
296
  }
237
297
  plain.push(b);
@@ -118,3 +118,45 @@ export function isTerminal(t?: TaskRowLike | null): boolean {
118
118
  export function isOpenTask(t?: TaskRowLike | null): boolean {
119
119
  return isLive(t) && (t?.status === TASK_STATUS.PENDING || t?.status === TASK_STATUS.CLAIMED);
120
120
  }
121
+
122
+ // ─── 跃迁表(声明式状态机)─────────────────────────────────────────────
123
+ //
124
+ // 上面的词表回答「是什么」,这张表回答「**能从哪到哪**」。每条边都对应一个
125
+ // 实际写入口的守卫(2026-11-19 收敛时逐条从代码反推):
126
+ //
127
+ // pending → claimed repo.claimTask(原子 WHERE)+ repo.alignClaimedFromSnapshot
128
+ // pending → done repo.closeOpenTask(用户面板收口,done 分支)
129
+ // pending → cancelled repo.tombstoneAsCancelled / closeOpenTask(cancel 分支)
130
+ // pending → plan repo.switchPlanStatus(#126 双向之一)
131
+ // plan → pending repo.switchPlanStatus(#126 双向之一)
132
+ // plan → claimed repo.alignClaimedFromSnapshot(外部 DAG 说在跑;罕见但口径允许)
133
+ // plan → cancelled repo.tombstoneAsCancelled(非终态一律定格)
134
+ // claimed → done repo.completeTask / closeOpenTask(done 分支)
135
+ // claimed → cancelled repo.tombstoneAsCancelled / closeOpenTask(cancel 分支)
136
+ // done / cancelled 终态,无出边。reopen / 搬家是「派生新号」,不改旧行状态。
137
+ //
138
+ // 性质:**只声明不强制**。真正的并发安全由 repo/tasks.ts 里带 WHERE 守卫的
139
+ // 原子 UPDATE 保证——状态机在业务层替代不了 SQL 的原子性,做成运行时强制
140
+ // 只会变成第二道守卫、第二真值源。这张表的用途:
141
+ // 1. 新增状态时一眼看到影响面(要补哪些边、改哪些守卫);
142
+ // 2. 作单测靶子(终态无出边、每条边都有归属入口、未知状态一律挡);
143
+ // 3. 读代码时它是「合法流转」的单一出处,不用再翻五个函数拼全景。
144
+
145
+ export const TASK_TRANSITIONS: Readonly<Record<string, readonly string[]>> = Object.freeze({
146
+ [TASK_STATUS.PENDING]: Object.freeze([
147
+ TASK_STATUS.CLAIMED,
148
+ TASK_STATUS.DONE,
149
+ TASK_STATUS.CANCELLED,
150
+ TASK_STATUS.PLAN,
151
+ ]),
152
+ [TASK_STATUS.PLAN]: Object.freeze([TASK_STATUS.PENDING, TASK_STATUS.CLAIMED, TASK_STATUS.CANCELLED]),
153
+ [TASK_STATUS.CLAIMED]: Object.freeze([TASK_STATUS.DONE, TASK_STATUS.CANCELLED]),
154
+ [TASK_STATUS.DONE]: Object.freeze([]),
155
+ [TASK_STATUS.CANCELLED]: Object.freeze([]),
156
+ });
157
+
158
+ /** from 能否一步转到 to。未知状态一律 false(宁可挡住也不放行——同正判定哲学)。 */
159
+ export function canTransition(from: unknown, to: unknown): boolean {
160
+ const edges = TASK_TRANSITIONS[String(from)];
161
+ return !!edges && edges.includes(String(to));
162
+ }