nx-kv 0.64.0 → 0.65.2

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 (151) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/assets/nx-kv/SKILL.md +5 -2
  3. package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +6 -0
  4. package/assets/nx-kv/references/A04-/344/273/223/345/272/223/344/270/216/351/241/271/347/233/256/347/273/204.md +79 -6
  5. package/assets/nx-kv/templates/ref-main-doc.md +46 -0
  6. package/package.json +1 -1
  7. package/src/core/db/seed-templates.ts +2 -86
  8. package/src/modules/localtask/task-lifecycle.ts +1 -1
  9. package/src/modules/promptplug/actions/_manifest.generated.ts +9 -0
  10. package/src/modules/promptplug/actions/prompt-registry.ts +4 -1
  11. package/src/modules/promptplug/actions/prompt-template-activate.ts +31 -0
  12. package/src/modules/promptplug/actions/prompt-template-delete.ts +30 -0
  13. package/src/modules/promptplug/actions/prompt-template-save.ts +52 -0
  14. package/src/modules/promptplug/delivery.ts +151 -0
  15. package/src/modules/promptplug/factory.ts +16 -8
  16. package/src/modules/promptplug/index.ts +3 -1
  17. package/src/modules/promptplug/plugins/doneguard.ts +3 -0
  18. package/src/modules/promptplug/plugins/getloop.ts +8 -7
  19. package/src/modules/{tasktool/plugins/goal-template.ts → promptplug/plugins/goal-prompt.ts} +57 -4
  20. package/src/modules/promptplug/plugins/goal-shape.ts +17 -0
  21. package/src/modules/promptplug/plugins/goalhint.ts +22 -9
  22. package/src/modules/promptplug/plugins/timecheck.ts +25 -14
  23. package/src/modules/promptplug/registry.ts +3 -3
  24. package/src/modules/promptplug/template-store.ts +145 -0
  25. package/src/modules/tasktool/delivery.ts +231 -0
  26. package/src/modules/tasktool/get.ts +2 -2
  27. package/src/modules/tasktool/plugins/taskgoal-store.ts +28 -22
  28. package/src/modules/tasktool/plugins/timegoal-task-store.ts +70 -5
  29. package/src/modules/tasktool/plugins/waitgoal-config.ts +1 -25
  30. package/src/modules/tasktool/plugins/waitgoal.ts +0 -4
  31. package/src/modules/tasktool/preview.ts +3 -4
  32. package/src/modules/tasktool/wait.ts +16 -284
  33. package/src/modules/templates/actions/templates-default.ts +2 -5
  34. package/src/modules/templates/actions/templates-update.ts +1 -3
  35. package/src/modules/templates/service.ts +11 -13
  36. package/src/modules/templates/support.ts +0 -15
  37. package/src/web/frontend/App.tsx +0 -12
  38. package/src/web/frontend/api/cli-tree.json +58 -0
  39. package/src/web/frontend/api/client.generated.ts +32 -2
  40. package/src/web/frontend/components/doc/doc-head.tsx +13 -4
  41. package/src/web/frontend/components/icons.tsx +9 -199
  42. package/src/web/frontend/components/md/live-block.tsx +1 -5
  43. package/src/web/frontend/components/md/md-panes-root.tsx +0 -4
  44. package/src/web/frontend/components/md/md-panes.tsx +1 -11
  45. package/src/web/frontend/components/md/tool-bar.tsx +9 -0
  46. package/src/web/frontend/components/sidebar/index.tsx +13 -2
  47. package/src/web/frontend/components/sidebar/model.ts +3 -0
  48. package/src/web/frontend/components/tool-acts/bar.tsx +40 -29
  49. package/src/web/frontend/components/tool-acts/layout-panel.tsx +7 -3
  50. package/src/web/frontend/components/tool-acts/modules.ts +53 -51
  51. package/src/web/frontend/components/tool-acts/style.css +7 -3
  52. package/src/web/frontend/modules/md/styles/docs.css +0 -7
  53. package/src/web/frontend/modules/md/styles/editor.css +0 -17
  54. package/src/web/frontend/modules/md/styles/shell.css +3 -0
  55. package/src/web/frontend/modules/md/use-templates.ts +3 -13
  56. package/src/web/frontend/page/dir/index.tsx +3 -15
  57. package/src/web/frontend/page/dir/task-actions.ts +1 -16
  58. package/src/web/frontend/page/dir/task.tsx +2 -16
  59. package/src/web/frontend/page/group/index.tsx +6 -19
  60. package/src/web/frontend/page/repos/branch-persist.ts +32 -0
  61. package/src/web/frontend/page/repos/icons.tsx +47 -229
  62. package/src/web/frontend/page/repos/index.tsx +12 -8
  63. package/src/web/frontend/page/repos/repo-table.tsx +24 -3
  64. package/src/web/frontend/page/settings/api.ts +20 -0
  65. package/src/web/frontend/page/settings/index.tsx +1 -1
  66. package/src/web/frontend/page/settings/prompt-template-editor.tsx +180 -0
  67. package/src/web/frontend/page/settings/prompt-templates-section.tsx +39 -34
  68. package/src/web/frontend/page/settings/style.css +30 -0
  69. package/src/web/frontend/page/templates/index.tsx +5 -54
  70. package/src/web/frontend/page/templates/manage.tsx +1 -5
  71. package/src/web/frontend/page/templates/style.css +1 -43
  72. package/src/web/frontend/page/templates/template-list.tsx +7 -15
  73. package/src/web/frontend/routes/route-eq.ts +2 -3
  74. package/src/web/frontend/routes/static.ts +2 -2
  75. package/src/web/frontend/routes/templates.ts +0 -10
  76. package/src/web/frontend/styles/repos.css +22 -0
  77. package/src/web/frontend/styles-v2/shell.css +7 -0
  78. package/src/web/frontend/svghub/catalog-act.ts +168 -0
  79. package/src/web/frontend/svghub/catalog-doc.ts +102 -0
  80. package/src/web/frontend/svghub/catalog-nav.ts +192 -0
  81. package/src/web/frontend/svghub/catalog-repo.ts +102 -0
  82. package/src/web/frontend/svghub/catalog-state.ts +70 -0
  83. package/src/web/frontend/svghub/icon.tsx +95 -0
  84. package/src/web/frontend/svghub/index.ts +66 -0
  85. package/src/web/frontend/svghub/serialize.ts +39 -0
  86. package/src/web/frontend/svghub/types.ts +67 -0
  87. package/src/web/frontend/types.ts +2 -1
  88. package/src/web/public/assets/app-context-BqCBcDsx.js +1 -0
  89. package/src/web/public/assets/bar-Dc5Tq1eE.js +1 -0
  90. package/src/web/public/assets/{button-BEWXOABr.js → button-3JlUeln_.js} +1 -1
  91. package/src/web/public/assets/{composer-launch-DRi9mZE1.js → composer-launch-fp2IzGzQ.js} +1 -1
  92. package/src/web/public/assets/{composer-panel-swmDqlPw.js → composer-panel-Dh681iO6.js} +1 -1
  93. package/src/web/public/assets/dag-DnaU0I_z.js +1 -0
  94. package/src/web/public/assets/dir-d16q1GLe.js +3 -0
  95. package/src/web/public/assets/doc-DRSKD0Re.js +6 -0
  96. package/src/web/public/assets/group-Dc3ZgW24.js +1 -0
  97. package/src/web/public/assets/index-BIVxGd6t.css +1 -0
  98. package/src/web/public/assets/index-Bg0m8gbJ.js +2 -0
  99. package/src/web/public/assets/{list-filter-D-x94TvA.js → list-filter-CWxiOSg_.js} +1 -1
  100. package/src/web/public/assets/md-history-CLIs9Dr0.css +1 -0
  101. package/src/web/public/assets/md-history-DNtgaIdH.js +39 -0
  102. package/src/web/public/assets/{member-picker-Cvbv24IK.js → member-picker-BZgE3HGb.js} +1 -1
  103. package/src/web/public/assets/model-CtG2jIDv.js +2 -0
  104. package/src/web/public/assets/{overview-CctJfO3D.js → overview-C68QpcT9.js} +1 -1
  105. package/src/web/public/assets/popup-DZ2Khv2c.js +1 -0
  106. package/src/web/public/assets/progress-CEmAFxo9.js +3 -0
  107. package/src/web/public/assets/refs-TzxZYy7T.js +2 -0
  108. package/src/web/public/assets/repo-form-modal-Dg3hJWUV.js +1 -0
  109. package/src/web/public/assets/repos-uNqSR5YB.js +12 -0
  110. package/src/web/public/assets/{route-crumb-BcDPd7Ht.js → route-crumb-C4DgkJ8G.js} +1 -1
  111. package/src/web/public/assets/{settings-Cc6puKd5.css → settings-BWHjNegB.css} +1 -1
  112. package/src/web/public/assets/settings-BzIllshQ.js +1 -0
  113. package/src/web/public/assets/{status-tag-BD_0iWMB.js → status-tag-8cLH8hl9.js} +1 -1
  114. package/src/web/public/assets/task-DuFOXLPC.js +11 -0
  115. package/src/web/public/assets/{task-row-CQgzQmzu.js → task-row-CRjuAfKW.js} +1 -1
  116. package/src/web/public/assets/{task-utils-bJH1-Cjy.js → task-utils-DAPxKm4c.js} +1 -1
  117. package/src/web/public/assets/templates-CwYDIBYn.css +1 -0
  118. package/src/web/public/assets/templates-DNiGvmdq.js +10 -0
  119. package/src/web/public/assets/{use-rail-drag-ufwy2XZB.js → use-rail-drag-DxIYcszo.js} +1 -1
  120. package/src/web/public/assets/{workspace-D3jbcTwf.js → workspace-DojQ3RP4.js} +2 -2
  121. package/src/web/public/index.html +15 -16
  122. package/src/web/frontend/modules/md/fill-session.ts +0 -36
  123. package/src/web/frontend/modules/md/new-task-from-template.ts +0 -22
  124. package/src/web/frontend/modules/md/task-intent.ts +0 -29
  125. package/src/web/frontend/modules/prompts/render-template-body.ts +0 -14
  126. package/src/web/frontend/modules/prompts/template-preview.ts +0 -62
  127. package/src/web/frontend/page/templates/fill.tsx +0 -124
  128. package/src/web/public/assets/app-context-DDQnrPSP.js +0 -1
  129. package/src/web/public/assets/bar-j14ON7uZ.js +0 -1
  130. package/src/web/public/assets/dag-BzdFYMml.js +0 -1
  131. package/src/web/public/assets/dir-DhsB1ZhL.js +0 -3
  132. package/src/web/public/assets/doc-D4po3sDc.js +0 -6
  133. package/src/web/public/assets/fill-session-fHxQHFaD.js +0 -1
  134. package/src/web/public/assets/group-BxmSNzIB.js +0 -1
  135. package/src/web/public/assets/index-CMjG5NVU.js +0 -2
  136. package/src/web/public/assets/index-uMjSWNVr.css +0 -1
  137. package/src/web/public/assets/md-history-1h2zairf.css +0 -1
  138. package/src/web/public/assets/md-history-CZUF_FhN.js +0 -39
  139. package/src/web/public/assets/model-Cc2EoUQp.js +0 -2
  140. package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +0 -1
  141. package/src/web/public/assets/popup-D8KWI6-Q.js +0 -1
  142. package/src/web/public/assets/progress-CawQRCQf.js +0 -3
  143. package/src/web/public/assets/refs-TuuoaRs7.js +0 -2
  144. package/src/web/public/assets/render-template-body-bXdedFig.js +0 -1
  145. package/src/web/public/assets/repo-form-modal-BD4N37MI.js +0 -1
  146. package/src/web/public/assets/repos-BPeuX4N9.js +0 -12
  147. package/src/web/public/assets/settings-CZJaKLZW.js +0 -1
  148. package/src/web/public/assets/task-DgbbF5gy.js +0 -11
  149. package/src/web/public/assets/task-intent-CX5DZccN.js +0 -1
  150. package/src/web/public/assets/templates-CBXlwyof.js +0 -11
  151. package/src/web/public/assets/templates-plA8R7jJ.css +0 -1
@@ -1,16 +1,14 @@
1
- // 设置面板「提示词模板」(#152 重做:从「可编辑模板库」变成「只读注册表」)。
1
+ // 设置面板「提示词模板」(#161:只读注册表 + 用户层模板管理)。
2
2
  //
3
- // 为什么要改:模板正文的唯一真相搬进了插件类
4
- // (modules/promptplug/plugins/*.ts 的 `templates`)——DB 不再存模板、没有 JSON
5
- // 注册表、没有 ensure seed。于是「新增 / 复制 / 改名 / 删除 / 拖拽排序 / 保存」
6
- // 这一整套编辑动作全部失去意义:它们改的是一个已经不存在的存储层。
3
+ // 结构(#152 定型):出厂正文 = 插件类里的 `templates`(代码即出厂真相);
4
+ // #161 在其上叠加**用户层**(template-store,JSON):每段可复制出多条模板、
5
+ // 启用哪条自己挑、编辑保存走后端变量白名单校验。编辑器在 prompt-template-editor.tsx。
7
6
  //
8
- // 现在这一页回答三个问题(且只回答这三个):
9
- // 1. 有哪些时机(get / check / done)、每个时机依次有哪些段 —— 来自注册表 groups;
10
- // 2. 每一段现在用的正文是什么 —— 类里 templates[0],只读展示 + 一键复制;
11
- // 3. 这一段能吃哪些变量 —— 注册表 fields(声明即文档,不写第二份)。
12
- //
13
- // 唯一还能写的全局开关是「系统提示词追加方式」(appendMode,xml / plain)。
7
+ // 这一页回答四个问题:
8
+ // 1. 有哪些时机(get / check / done)、每个时机依次有哪些段 —— 注册表 groups;
9
+ // 2. 每一段当前用的正文 —— 启用模板(builtin 或用户条目),可编辑可复制;
10
+ // 3. 这一段能吃哪些变量 —— 注册表 fields(声明即文档,不写第二份);
11
+ // 4. 真实领取的输出长什么样 —— 交付预览(含 timegoal check 链的同源效果)。
14
12
  import { useEffect, useState } from 'react';
15
13
  import { Button } from '../../components/button/index.js';
16
14
  import { useToast } from '../../components/toast/index.jsx';
@@ -22,6 +20,7 @@ import {
22
20
  } from './api.js';
23
21
  import { APPEND_MODES } from '../../../../shared/prompt-blocks.js';
24
22
  import { varGroupsOf } from './prompt-vars.js';
23
+ import PromptTemplateEditor, { type SegmentTemplates } from './prompt-template-editor.js';
25
24
 
26
25
  /** 注册表里的一段(= 一个插件的声明面;/api/prompt/registry 的 plugins 项)。 */
27
26
  export interface PluginDesc {
@@ -71,6 +70,23 @@ export default function PromptTemplatesSection() {
71
70
  const [preview, setPreview] = useState<PreviewResult | null>(null);
72
71
  const [previewOpen, setPreviewOpen] = useState(false);
73
72
  const [varQuery, setVarQuery] = useState('');
73
+ const [segTemplates, setSegTemplates] = useState<Record<string, SegmentTemplates>>({});
74
+
75
+ const loadRegistry = (onReady: (r: any) => void) => {
76
+ getPromptRegistry()
77
+ .then((r) => {
78
+ const list: PluginDesc[] = Array.isArray(r?.plugins) ? r.plugins : [];
79
+ setPlugins(list);
80
+ setGroups((r?.groups as Record<string, string[]>) || {});
81
+ setSegTemplates(
82
+ (r?.segmentTemplates && typeof r.segmentTemplates === 'object'
83
+ ? (r.segmentTemplates as Record<string, SegmentTemplates>)
84
+ : {}) || {},
85
+ );
86
+ onReady(r);
87
+ })
88
+ .catch((e) => toast('读取失败:' + ((e as Error).message || e)));
89
+ };
74
90
 
75
91
  useEffect(() => {
76
92
  let alive = true;
@@ -80,6 +96,11 @@ export default function PromptTemplatesSection() {
80
96
  const list: PluginDesc[] = Array.isArray(r?.plugins) ? r.plugins : [];
81
97
  setPlugins(list);
82
98
  setGroups((r?.groups as Record<string, string[]>) || {});
99
+ setSegTemplates(
100
+ (r?.segmentTemplates && typeof r.segmentTemplates === 'object'
101
+ ? (r.segmentTemplates as Record<string, SegmentTemplates>)
102
+ : {}) || {},
103
+ );
83
104
  const mode = s?.settings?.appendMode === 'plain' ? 'plain' : 'xml';
84
105
  setAppendMode(mode);
85
106
  // 默认选中 get 链首段(agent 最常看到的那一段)
@@ -116,15 +137,6 @@ export default function PromptTemplatesSection() {
116
137
  }
117
138
  };
118
139
 
119
- const copyText = async (text: string, what: string) => {
120
- try {
121
- await navigator.clipboard.writeText(text);
122
- toast(`已复制${what}`);
123
- } catch {
124
- toast('复制失败(剪贴板不可用)');
125
- }
126
- };
127
-
128
140
  const runPreview = async () => {
129
141
  if (busy) return;
130
142
  setBusy(true);
@@ -231,17 +243,12 @@ export default function PromptTemplatesSection() {
231
243
  </span>
232
244
  </div>
233
245
 
234
- <div className='ppt-ro-note'>
235
- 正文是插件类里的内置模板(<code>modules/promptplug/plugins</code>),不再存库、不可在此编辑;
236
- 改文案请改代码。
237
- </div>
238
-
239
- <textarea
240
- className='ppt-tpl-area'
241
- value={selected.template}
242
- readOnly
243
- spellCheck={false}
244
- aria-label={`${selected.label} 的内置模板`}
246
+ <PromptTemplateEditor
247
+ segment={selected.id}
248
+ label={selected.label}
249
+ builtinText={selected.template}
250
+ seg={segTemplates[selected.id]}
251
+ onChanged={() => loadRegistry(() => toast('注册表已刷新'))}
245
252
  />
246
253
 
247
254
  {selected.fields.length > 0 && (
@@ -287,9 +294,7 @@ export default function PromptTemplatesSection() {
287
294
  )}
288
295
 
289
296
  <div className='ppt-actions'>
290
- <Button variant='secondary' disabled={busy} onClick={() => void copyText(selected.template, '模板正文')}>
291
- 复制正文
292
- </Button>
297
+ <span className='setp-note'>模板改动即时生效(交付与 timegoal check 同源)。</span>
293
298
  <span className='spacer' />
294
299
  <Button
295
300
  variant='secondary'
@@ -342,6 +342,36 @@
342
342
  background:var(--paper,#fff);color:var(--ink,#16181C);cursor:default;
343
343
  }
344
344
  .ppt-var-key{flex:none}
345
+ /* #161 段模板管理条:模板选择 / 名称 / 动作按钮 */
346
+ .ppt-tpl-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px}
347
+ .ppt-tpl-select{
348
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;max-width:220px;
349
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
350
+ }
351
+ .ppt-tpl-name{
352
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;width:150px;
353
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
354
+ }
355
+ /* #161 段模板管理条:模板选择 / 名称 / 动作按钮 */
356
+ .ppt-tpl-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px}
357
+ .ppt-tpl-select{
358
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;max-width:220px;
359
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
360
+ }
361
+ .ppt-tpl-name{
362
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;width:150px;
363
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
364
+ }
365
+ /* #161 段模板管理条:模板选择 / 名称 / 动作按钮 */
366
+ .ppt-tpl-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px}
367
+ .ppt-tpl-select{
368
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;max-width:220px;
369
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
370
+ }
371
+ .ppt-tpl-name{
372
+ font:400 12px/1.6 system-ui,sans-serif;padding:4px 8px;width:150px;
373
+ border:1px solid var(--line,#E4E2DC);border-radius:6px;background:var(--paper,#fff);color:var(--ink,#16181C);
374
+ }
345
375
  .ppt-var-desc{
346
376
  font-family:system-ui,sans-serif;font-size:10.5px;color:var(--faint,#8A8578);
347
377
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px;
@@ -2,7 +2,6 @@
2
2
  // #/templates/new、#/templates/edit/<id> = 全屏模板编辑器(MdPanes)。
3
3
  // config: { mode:'edit'|'new', id?, name?, scope?, topic? }
4
4
  import RouteBreadcrumb from '../../components/layout/route-crumb.jsx';
5
- import { renderTemplatePreview } from '../../modules/prompts/template-preview.js';
6
5
  import { renderMarkdownHtml } from '../../modules/md/md-parse.js';
7
6
  import { useMemo, useRef, useState } from 'react';
8
7
  import { Actions } from 'flexlayout-react';
@@ -12,10 +11,8 @@ import { useApp } from '../../app-context.jsx';
12
11
  import { MdPanes } from '../../components/md/md-panes.jsx';
13
12
  import type { EditorApi } from '../../components/md/md-panes-helpers.js';
14
13
  import { clearHistory, pushHistory, redoHistory, undoHistory } from '../../modules/md/md-history.js';
15
- import { liveBodyBlocks } from '../../modules/md/md-blocks.js';
16
14
  import { popRoute } from '../../components/layout/route-history.js';
17
15
  import TemplateListPanel from './template-list.jsx';
18
- import TemplateFillPanel from './fill.jsx';
19
16
  import TemplateManagePanel from './manage.jsx';
20
17
  import '../../modules/md/style.css';
21
18
  import './style.css';
@@ -28,31 +25,12 @@ interface TemplateDraft {
28
25
 
29
26
  const HIST_KEY = (id?: string | null) => `tpl:${id || 'new'}`;
30
27
 
31
- /** 块级插槽正则:与 templateSlots / 渲染层同一套 `{{名字}}` 口径。 */
32
- const SLOT_RE = /\{\{\s*[^}{\s][^{}]*?\s*\}\}/;
33
-
34
28
  /**
35
- * 哪些块是插槽块(#218):编辑器里给这些块挂「插槽」徽标(绿线 + 徽标,
36
- * 与任务编辑器同一套视觉语言)。编辑的是模板本身,全部块都可编辑 ——
37
- * 徽标只回答「任务里哪段可填」,不产生只读。
38
- */
39
- function slotBlocksOf(body: string): Set<number> {
40
- const out = new Set<number>();
41
- liveBodyBlocks(body).forEach((b, i) => {
42
- if (SLOT_RE.test(b)) out.add(i);
43
- });
44
- return out;
45
- }
46
-
47
- /**
48
- * 新建模板的默认正文(#218):给一段**含 `{{content}}` 的骨架**。
49
- *
50
- * 空白的编辑器会逼用户自己猜插槽语法,猜出来的名字五花八门(`{{问题}}` /
51
- * `{{需求}}`)—— 而插槽只有 `content` 这一个名字,默认骨架直接把它摆出来。
29
+ * 新建模板的默认正文:一段可直接改写的 Markdown 骨架。
30
+ * 模板只负责内容与样式,正式内容在任务编辑页自行填写;留白不够就在模板里多留空行。
52
31
  */
53
32
  const NEW_TEMPLATE_BODY = `## 背景
54
33
 
55
- {{content}}
56
34
 
57
35
  ## 验收
58
36
  - [ ] …
@@ -64,8 +42,6 @@ interface TemplateEditorViewProps {
64
42
  templateId: string;
65
43
  initialName: string;
66
44
  initialBody: string;
67
- /** 槽位默认值:只用于右侧预览,**不进输入框**(输入框里必须是 `{{content}}` 源码)。 */
68
- initialValues?: Record<string, unknown> | null;
69
45
  isNew: boolean;
70
46
  onSave: (v: TemplateDraft) => void | Promise<void>;
71
47
  onClose: () => void;
@@ -76,7 +52,6 @@ function TemplateEditorView({
76
52
  templateId,
77
53
  initialName,
78
54
  initialBody,
79
- initialValues,
80
55
  isNew,
81
56
  onSave,
82
57
  onClose,
@@ -92,19 +67,12 @@ function TemplateEditorView({
92
67
  const histRef = useRef<Map<string, unknown>>(new Map());
93
68
  const histId = HIST_KEY(isNew ? 'new' : templateId);
94
69
 
95
- // 预览 = **渲染后**的样子(空插槽显示〔content〕)。
96
- // 左边输入框里是模板源码(`{{content}}` 原样可见),两栏各司其职:
97
- // 编辑的是模板,不是一篇填好的任务正文 —— 旧行为(输入框也渲染)会让保存把
98
- // `{{content}}` 写成提示文字,插槽就此消失(#218)。
70
+ // 预览 = 正文的 Markdown 渲染;模板就是内容本身,没有插槽/渲染替换层。
99
71
  const previewHtml = useMemo(
100
- () => renderMarkdownHtml(renderTemplatePreview(body || '', initialValues)),
101
- [body, initialValues],
72
+ () => renderMarkdownHtml(body || ''),
73
+ [body],
102
74
  );
103
75
 
104
- // 插槽块标记(#218):随正文实时更新,编辑器里一眼看到「任务里哪段可填」
105
- const slotBlocks = useMemo(() => slotBlocksOf(body || ''), [body]);
106
- const slotCount = slotBlocks.size;
107
-
108
76
  const mark = (nextName: string, nextBody: string, kind = 'typing') => {
109
77
  pushHistory(histRef.current, histId, { title: name, body }, kind);
110
78
  setName(nextName);
@@ -173,14 +141,6 @@ function TemplateEditorView({
173
141
  </button>
174
142
  ))}
175
143
  </div>
176
- <span
177
- className={'tpl-slot-hint' + (slotCount ? '' : ' is-none')}
178
- title="插槽只有这一个名字;可以出现多次,共用同一个值"
179
- >
180
- {slotCount
181
- ? <>插槽 <b>{slotCount}</b> 处 · <code>{'{{content}}'}</code> 可填,其余只读</>
182
- : <>还没有插槽 —— 正文里写 <code>{'{{content}}'}</code>,那段在任务里就可填</>}
183
- </span>
184
144
  </div>
185
145
  <div className="mdw-actions" role="group" aria-label="模板操作">
186
146
  <button type="button" className="btn ghost sm" disabled={busy} onClick={onClose}>
@@ -197,7 +157,6 @@ function TemplateEditorView({
197
157
  title={name}
198
158
  body={body}
199
159
  previewHtml={previewHtml}
200
- tplSlotBlocks={slotBlocks}
201
160
  onTitle={onTitle}
202
161
  onBody={onBody}
203
162
  docKey={histId}
@@ -230,10 +189,6 @@ export default function TemplatePanel({ config, model, tabId }: TemplatePanelPro
230
189
  const isNew = mode === 'new';
231
190
  const templateId = cfg.id || '';
232
191
 
233
- // #151:参数填写中间页(带槽位模板 → 新建任务前的参数页)
234
- if (mode === 'fill') {
235
- return <TemplateFillPanel config={cfg} />;
236
- }
237
192
  // #151:主题级模板管理页(从「新建任务」下拉的「管理模板…」进入)
238
193
  if (mode === 'manage') {
239
194
  return <TemplateManagePanel config={cfg} />;
@@ -310,10 +265,7 @@ export default function TemplatePanel({ config, model, tabId }: TemplatePanelPro
310
265
 
311
266
  // 走到这里 existing 必定存在(上面的守卫已排除「编辑态但找不到」)
312
267
  const initialName = isNew ? (cfg.name || '') : existing?.name ?? '';
313
- // **原文**而不是渲染结果(#218):模板编辑的是骨架,`{{content}}` 必须原样可见,
314
- // 否则保存一次就把插槽写成提示文字。渲染只发生在右侧预览。
315
268
  const initialBody = isNew ? NEW_TEMPLATE_BODY : existing?.body ?? '';
316
- const initialValues = isNew ? null : existing?.values ?? null;
317
269
 
318
270
  return (
319
271
  <TemplateEditorView
@@ -321,7 +273,6 @@ export default function TemplatePanel({ config, model, tabId }: TemplatePanelPro
321
273
  templateId={templateId}
322
274
  initialName={initialName}
323
275
  initialBody={initialBody}
324
- initialValues={initialValues}
325
276
  isNew={isNew}
326
277
  busy={busy}
327
278
  onSave={saveEditing}
@@ -12,7 +12,6 @@ import { ListSearch } from '../../components/list-search.jsx';
12
12
  import { filterByKeyword } from '../../modules/list-filter.js';
13
13
  import { useTemplatesFor } from '../../modules/md/use-templates.js';
14
14
  import { getManageSession } from '../../modules/md/manage-session.js';
15
- import { templateSlots } from '../../modules/prompts/template-preview.js';
16
15
  import type { PromptTemplate, TemplatesApi } from '../../types.js';
17
16
  import ScopeChips from './scope-chips.jsx';
18
17
  import './style.css';
@@ -42,7 +41,6 @@ export default function TemplateManagePanel({ config }: ManagePanelProps) {
42
41
  t.name,
43
42
  t.body,
44
43
  (t.scope || []).join(' '),
45
- templateSlots(t.body).join(' '),
46
44
  ]);
47
45
 
48
46
  const act = async (fn: () => Promise<unknown>, ok?: string) => {
@@ -107,7 +105,7 @@ export default function TemplateManagePanel({ config }: ManagePanelProps) {
107
105
  <ListSearch
108
106
  value={q}
109
107
  onChange={setQ}
110
- placeholder="搜索名称 / 正文 / 槽位 / 可见范围…"
108
+ placeholder="搜索名称 / 正文 / 可见范围…"
111
109
  title="过滤本主题模板"
112
110
  count={shown.length}
113
111
  className="wide"
@@ -120,7 +118,6 @@ export default function TemplateManagePanel({ config }: ManagePanelProps) {
120
118
  <div className="tpl-mng-list">
121
119
  {shown.map((t: PromptTemplate) => {
122
120
  const isDefault = t.id === tpl?.defaultId;
123
- const slots = templateSlots(t.body);
124
121
  return (
125
122
  <div
126
123
  key={t.id}
@@ -153,7 +150,6 @@ export default function TemplateManagePanel({ config }: ManagePanelProps) {
153
150
  <span className="tpl-mng-name">{t.name}</span>
154
151
  {isDefault && <span className="tpl-badge">默认</span>}
155
152
  {t.builtin && <span className="tpl-badge soft">内置</span>}
156
- {slots.length > 0 && <span className="tpl-badge soft">槽位 {slots.length}</span>}
157
153
  </div>
158
154
  {(t.scope || []).length > 0 && !scopeOpenId && (
159
155
  <div className="tpl-mng-scope-sum muted">可见:{(t.scope || []).join(' / ')}</div>
@@ -2,22 +2,6 @@
2
2
  外壳复用 .rp-page / .page-head(与仓库管理页同一套头部口径),这里只补卡片与预览。 */
3
3
  .tpl-page{display:flex;flex-direction:column;gap:12px}
4
4
  .tpl-head-note{margin:2px 0 0;font-size:12px}
5
- .tpl-head-note code,
6
- .tpl-slot-hint code{
7
- font:400 11.5px ui-monospace,Consolas,monospace;padding:0 4px;border-radius:4px;
8
- background:var(--soft,#F1F0EC);border:1px solid var(--line,#E4E2DC);
9
- }
10
- /* 模板编辑器工具栏里的插槽提示(#218):有插槽=绿色强调,没有=灰提示 */
11
- .tpl-slot-hint{
12
- font-size:11px;margin-left:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
13
- color:var(--mdw-accent,#2F6F5E);
14
- }
15
- .tpl-slot-hint b{font-weight:600}
16
- .tpl-slot-hint.is-none{color:var(--mid,#8A8578)}
17
- /* 模板编辑器里插槽徽标常显:任务编辑器 hover 才显示(那边插槽是少数),
18
- 模板里「哪里是插槽」恰恰是主角——徽标与绿条一直可见 */
19
- .mdw-tpl-edpage .mdw-lp-slot{opacity:1}
20
- .mdw-tpl-edpage .mdw-lp-block.is-slot{box-shadow:inset 3px 0 0 var(--mdw-accent-line,#B7D4C8)}
21
5
  /* #149:模板列表关键词过滤框 */
22
6
  .tpl-search{padding:2px 0 8px}
23
7
  .tpl-list{display:flex;flex-direction:column;gap:8px;min-width:0}
@@ -35,13 +19,6 @@
35
19
  border:1px solid var(--mdw-accent-line,#B7D4C8);
36
20
  }
37
21
  .tpl-badge.soft{background:var(--soft,#F1F0EC);color:var(--mid,#8A8578);border-color:var(--line,#E4E2DC)}
38
- /* 槽位徽标(#218):与「默认/内置」徽章同一套 chip 语言,绿色 = 可填插槽 */
39
- .tpl-card-slots{
40
- font-size:10.5px;padding:0 6px;border-radius:999px;line-height:1.7;
41
- background:var(--mdw-accent-soft,#E8F2EE);color:var(--mdw-accent,#2F6F5E);
42
- border:1px solid var(--mdw-accent-line,#B7D4C8);
43
- max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
44
- }
45
22
  /* 全局 .grow 有 max-width:340px(推右会停在半路)——卡片里要真推到右缘 */
46
23
  .tpl-card-grow{flex:1 1 auto;min-width:0;max-width:none}
47
24
  .tpl-card-acts{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}
@@ -63,24 +40,6 @@
63
40
  background:var(--soft,#F1F0EC);border:1px solid var(--line,#E4E2DC);
64
41
  }
65
42
 
66
- /* ── #151 参数填写中间页 ───────────────────────────────────────────── */
67
- .tpl-fill-page{gap:12px}
68
- .tpl-fill-page .page-head h2{display:flex;align-items:center;gap:7px}
69
- .tpl-fill-body{
70
- display:flex;flex-direction:column;gap:14px;min-width:0;max-width:720px;
71
- padding:14px;border:1px solid var(--line,#E4E2DC);border-radius:10px;background:var(--paper,#fff);
72
- }
73
- .tpl-fill-field{display:flex;flex-direction:column;gap:6px;min-width:0}
74
- .tpl-fill-label{font-size:12px;font-weight:600;color:var(--ink-2,#4B515A)}
75
- .tpl-fill-input{
76
- width:100%;resize:vertical;min-height:84px;padding:8px 10px;box-sizing:border-box;
77
- font:400 12.5px/1.6 inherit;color:var(--ink,#222);background:var(--paper,#fff);
78
- border:1px solid var(--line,#E4E2DC);border-radius:8px;
79
- }
80
- .tpl-fill-input:focus{outline:none;border-color:var(--mdw-accent-line,#B7D4C8)}
81
- .tpl-fill-empty{padding:8px 0}
82
- .tpl-fill-foot{display:flex;gap:8px;justify-content:flex-end;max-width:720px}
83
-
84
43
  /* ── #151 主题级模板管理页 ─────────────────────────────────────────── */
85
44
  .tpl-mng-page{gap:12px}
86
45
  .tpl-mng-page .page-head h2{display:flex;align-items:center;gap:7px}
@@ -101,8 +60,7 @@
101
60
  .tpl-mng-acts{display:flex;align-items:center;gap:2px}
102
61
  .tpl-mng-scope{grid-column:1/-1;padding-top:8px;border-top:1px dashed var(--line,#E4E2DC)}
103
62
 
104
- /* #151 图标化:徽标/图标按钮的轻状态 */
105
- .tpl-badge.slot{display:inline-flex;align-items:center;gap:3px}
63
+ /* #151 图标化:图标按钮的轻状态 */
106
64
  .tpl-card .iconbtn.is-on{background:var(--mdw-accent-soft,#E8F2EE);color:var(--mdw-accent,#2F6F5E)}
107
65
  .tpl-page .page-head h2,
108
66
  .tpl-mng-page .page-head h2{display:flex;align-items:center;gap:7px}
@@ -1,8 +1,8 @@
1
1
  // 任务模板列表(#217:从「设置 → 任务模板」搬到侧边栏入口,在主内容区显示)。
2
2
  //
3
- // #151 重做:图标优先、文字收敛。操作从五个纯文字按钮改成图标按钮,头部去掉
4
- // 大段插槽说明,卡片只留「名称 / 一行摘要 / 徽标 / 图标操作」,预览与可见域
5
- // 按需展开。数据面不变:/api/templates(App 层 useTemplates 已持有一份)+ scope。
3
+ // #151 重做:图标优先、文字收敛。操作从五个纯文字按钮改成图标按钮,卡片只留
4
+ // 「名称 / 一行摘要 / 徽标 / 图标操作」,预览与可见域按需展开。数据面不变:
5
+ // /api/templates(App 层 useTemplates 已持有一份)+ scope。
6
6
  import { useState } from 'react';
7
7
  import { useApp } from '../../app-context.jsx';
8
8
  import { Button } from '../../components/button/index.jsx';
@@ -12,12 +12,11 @@ import { useToast } from '../../components/toast/index.jsx';
12
12
  import { renderMarkdownHtml } from '../../modules/md/md-parse.js';
13
13
  import { ListSearch } from '../../components/list-search.jsx';
14
14
  import { filterByKeyword } from '../../modules/list-filter.js';
15
- import { renderTemplatePreview, templateSlots } from '../../modules/prompts/template-preview.js';
16
15
  import type { PromptTemplate, TemplatesApi } from '../../types.js';
17
16
  import ScopeChips from './scope-chips.jsx';
18
17
  import './style.css';
19
18
 
20
- /** 正文摘要:前两行可读内容(剥掉 markdown 标记,插槽显示成〔content〕)。 */
19
+ /** 正文摘要:前两行可读内容(剥掉 markdown 标记)。 */
21
20
  function summaryOf(body: string): string {
22
21
  const lines = String(body || '')
23
22
  .split('\n')
@@ -26,8 +25,7 @@ function summaryOf(body: string): string {
26
25
  .replace(/^#{1,6}\s+/, '')
27
26
  .replace(/^[-*+]\s+\[[ x]\]\s*/i, '')
28
27
  .replace(/^[-*+]\s+/, '')
29
- .replace(/^>\s?/, '')
30
- .replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g, '〔$1〕'),
28
+ .replace(/^>\s?/, ''),
31
29
  )
32
30
  .filter(Boolean)
33
31
  .slice(0, 2);
@@ -85,7 +83,7 @@ export default function TemplateListPanel() {
85
83
  <div className="page-head">
86
84
  <div className="title-block">
87
85
  <h2><Icon name="list" size={16} /> 任务模板</h2>
88
- <p className="muted tpl-head-note">新建任务时的正文骨架;带 <code>{'{{content}}'}</code> 的段落可在填写页填值。</p>
86
+ <p className="muted tpl-head-note">新建任务时的正文骨架;正式内容在编辑页自行填写。</p>
89
87
  </div>
90
88
  <div className="acts">
91
89
  <Button variant="primary" small disabled={busy} onClick={() => go('#/templates/new')}>
@@ -113,18 +111,12 @@ export default function TemplateListPanel() {
113
111
  const isDefault = t.id === tpl.defaultId;
114
112
  const scopeOpen = scopeOpenId === t.id;
115
113
  const previewOpen = previewId === t.id;
116
- const slots = templateSlots(t.body);
117
114
  return (
118
115
  <div key={t.id} className={'tpl-card' + (isDefault ? ' is-default' : '')}>
119
116
  <div className="tpl-card-head">
120
117
  <span className="tpl-card-name">{t.name}</span>
121
118
  {isDefault && <span className="tpl-badge">默认</span>}
122
119
  {t.builtin && <span className="tpl-badge soft">内置</span>}
123
- {slots.length > 0 && (
124
- <span className="tpl-badge slot" title={slots.join('、')}>
125
- <Icon name="list" size={11} /> {slots.length}
126
- </span>
127
- )}
128
120
  <span className="grow tpl-card-grow" />
129
121
  <div className="tpl-card-acts">
130
122
  <button
@@ -186,7 +178,7 @@ export default function TemplateListPanel() {
186
178
  <div className="tpl-preview">
187
179
  <div
188
180
  className="tpl-preview-body mdw-lp-view"
189
- dangerouslySetInnerHTML={{ __html: renderMarkdownHtml(renderTemplatePreview(t.body, t.values)) }}
181
+ dangerouslySetInnerHTML={{ __html: renderMarkdownHtml(t.body) }}
190
182
  />
191
183
  </div>
192
184
  )}
@@ -1,9 +1,8 @@
1
1
  // 路由「是否同一个位置」的相等判定(纯函数,App 的 onNavigate 用)。
2
2
  //
3
3
  // 为什么单独成文件:App.tsx 卡在 600 行门禁边缘,而这个判定值得写清——
4
- // **必须比较全部字段**。曾经只比 view/key/task,于是 `#/templates` →
5
- // `#/templates/fill/<id>` 被判成「没变」,setRoute 直接丢掉新路由,
6
- // 参数填写中间页永远不出现(#153 验收反馈)。
4
+ // **必须比较全部字段**。曾经只比 view/key/task,于是同一视图内带不同 mode/id
5
+ // 的跳转被判成「没变」,setRoute 直接丢掉新路由,目标面板永远不出现(#153 验收反馈)。
7
6
  import type { AppRoute } from '../types.js';
8
7
 
9
8
  /** 两个路由是否指向同一个位置(字段级全比较;缺省一律按空串等价)。 */
@@ -1,7 +1,7 @@
1
- // 两个「单例页」视图:仓库管理 / 全部目录总览。
1
+ // 「单例页」视图:仓库管理 / 全部目录总览。
2
2
  //
3
3
  // 它们没有参数(地址就是身份),所以两个方向都只有一行;合在一个文件里是刻意的——
4
- // 各自单独开文件反而看不出「这两者同构」。
4
+ // 各自单独开文件反而看不出「这几者同构」。
5
5
  import type { AppRoute, SpecCtx } from '../types.js';
6
6
  import { definePage, type RoutePage } from './types.js';
7
7
 
@@ -26,13 +26,6 @@ export const templatesPage = definePage({
26
26
  name: '管理模板',
27
27
  };
28
28
  }
29
- // #151:参数填写中间页(sessionId 只在内存里,config 只需 id)
30
- if (route.mode === 'fill' && route.id) {
31
- return {
32
- panel: { component: 'templates', config: { mode: 'fill', id: String(route.id) } },
33
- name: '填写模板参数',
34
- };
35
- }
36
29
  if (route.mode === 'new') {
37
30
  const scope = String(route.scope || '')
38
31
  .split(',')
@@ -67,9 +60,6 @@ export const templatesPage = definePage({
67
60
  if (mode === 'manage' && cfg.id) {
68
61
  return `#/templates/manage/${encodeURIComponent(cfg.id)}`;
69
62
  }
70
- if (mode === 'fill' && cfg.id) {
71
- return `#/templates/fill/${encodeURIComponent(cfg.id)}`;
72
- }
73
63
  if (mode === 'new') {
74
64
  const parts: string[] = [];
75
65
  if (cfg.topic) parts.push(`topic=${encodeURIComponent(cfg.topic)}`);
@@ -317,6 +317,28 @@
317
317
  .rp-ref-cell-name strong { font-size: 14px; }
318
318
  .rp-ref-cell-remote { font-size: 12px; }
319
319
  .rp-refs-none { font-size: 12px; }
320
+ /* #162 所在组列(main / default 视图):组 chip,点击跳到该组分支 */
321
+ .rp-boards { white-space: normal; }
322
+ .rp-board-chip {
323
+ display: inline-flex; align-items: center;
324
+ margin: 1px 4px 1px 0; padding: 1px 8px;
325
+ border: 1px solid var(--line, #E4E2DC); border-radius: 999px;
326
+ background: var(--soft-2, #F1F0EC);
327
+ font: 600 11px/1.6 system-ui, sans-serif; color: var(--ink-2, #454A52);
328
+ cursor: pointer;
329
+ }
330
+ .rp-board-chip:hover { border-color: var(--mdw-accent-line, #B7D4C8); color: var(--mdw-accent, #2F6F5E); }
331
+ /* #162 所在组列(main / default 视图):组 chip,点击跳到该组分支 */
332
+ .rp-boards { white-space: normal; }
333
+ .rp-board-chip {
334
+ display: inline-flex; align-items: center;
335
+ margin: 1px 4px 1px 0; padding: 1px 8px;
336
+ border: 1px solid var(--line, #E4E2DC); border-radius: 999px;
337
+ background: var(--soft-2, #F1F0EC);
338
+ font: 600 11px/1.6 system-ui, sans-serif; color: var(--ink-2, #454A52);
339
+ cursor: pointer;
340
+ }
341
+ .rp-board-chip:hover { border-color: var(--mdw-accent-line, #B7D4C8); color: var(--mdw-accent, #2F6F5E); }
320
342
  .rp-context { font-size: 13px; padding: 10px 14px; }
321
343
  .rp-context-desc { font-size: 12.5px; }
322
344
  .rp-ref-mounted { font-size: 13px; padding: 12px 14px; }
@@ -204,6 +204,13 @@ body.nx-side-is-closed .flexlayout__tabset:has(.nx-side-closed-host) .flexlayout
204
204
  --flexlayout-color-mini-scroll-indicator: var(--soft-2);
205
205
  --flexlayout-color-mini-scroll-indicator-hovered: var(--mid);
206
206
  --flexlayout-color-shadow: rgba(20, 22, 26, .16);
207
+ /* 拖拽分隔条:可视线条收窄到 2px(horz=宽 / vert=高);命中区沿用 active-size
208
+ (默认 8px,库用 ::before 居中覆盖细线)不动,保证细线仍好抓。
209
+ hover / 拖拽用浅一档的青绿(#2F6F5E 提亮:HSL 165°/36%/45%)——
210
+ 验收反馈深墨绿偏闷,同色相提亮后更清爽;只作用分隔条,不动全局强调色。 */
211
+ --flexlayout-splitter-size: 2px;
212
+ --flexlayout-color-splitter-hover: #4A9B83;
213
+ --flexlayout-color-splitter-drag: #4A9B83;
207
214
  }
208
215
  /* 页签条:让选中页签跟面板内容有一条清晰的分界 */
209
216
  .flexlayout__tab { font-weight: 600; }