nx-kv 0.66.2 → 0.66.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 (95) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +1 -1
  3. package/package.json +1 -1
  4. package/src/core/attachmentdb/ids.ts +14 -1
  5. package/src/core/attachmentdb/query.ts +0 -38
  6. package/src/core/attachmentdb/repo.ts +98 -0
  7. package/src/core/attachmentdb.ts +5 -1
  8. package/src/core/db/migrations/index.ts +2 -0
  9. package/src/core/db/migrations/v15.sql +88 -0
  10. package/src/core/db/version.ts +4 -1
  11. package/src/modules/claim/assemble.ts +0 -5
  12. package/src/modules/claim/host.ts +1 -3
  13. package/src/modules/claim/preview.ts +0 -1
  14. package/src/modules/docs/actions/docs-detach.ts +1 -2
  15. package/src/modules/docs/attach.ts +3 -17
  16. package/src/modules/docs/render.ts +4 -13
  17. package/src/modules/localtask/actions/localtask-attach.ts +4 -2
  18. package/src/modules/localtask/actions/localtask-config.ts +2 -11
  19. package/src/modules/localtask/actions/localtask-detach.ts +1 -3
  20. package/src/modules/localtask/infra/repo/settings.ts +1 -9
  21. package/src/modules/localtask/lifecycle/task-templates.ts +0 -13
  22. package/src/modules/localtask/lifecycle/topics.ts +3 -6
  23. package/src/modules/localtask/ops/attach-resource.ts +46 -4
  24. package/src/modules/localtask/ops/attach-template.ts +73 -3
  25. package/src/modules/localtask/ops/attach.ts +45 -18
  26. package/src/modules/localtask/ui/action-render.ts +3 -12
  27. package/src/modules/promptplug/compose.ts +1 -3
  28. package/src/modules/promptplug/plugins/attachment.ts +56 -6
  29. package/src/modules/promptplug/plugins/context.ts +11 -2
  30. package/src/modules/promptplug/template-store.ts +25 -3
  31. package/src/shared/prompt-blocks.ts +2 -23
  32. package/src/web/frontend/api/cli-tree.json +4 -4
  33. package/src/web/frontend/api/client.generated.ts +8 -8
  34. package/src/web/frontend/api/tasks.ts +117 -0
  35. package/src/web/frontend/components/Introduction/index.tsx +50 -3
  36. package/src/web/frontend/components/Introduction/style.css +6 -0
  37. package/src/web/frontend/components/Introduction/use-intro.ts +25 -0
  38. package/src/web/frontend/components/md/attachments/attach-area.tsx +9 -11
  39. package/src/web/frontend/components/md/attachments/attach-common.ts +12 -5
  40. package/src/web/frontend/components/md/attachments/attach-modal.tsx +54 -9
  41. package/src/web/frontend/components/md/attachments/attach-repo-pick.tsx +48 -0
  42. package/src/web/frontend/components/sidebar/task-children.tsx +14 -11
  43. package/src/web/frontend/{page/dir → components/task-panel}/dag-editor.tsx +1 -1
  44. package/src/web/frontend/components/task-panel/task-ops.ts +299 -0
  45. package/src/web/frontend/components/task-panel/task-page.tsx +495 -0
  46. package/src/web/frontend/components/tool-acts/modules.ts +3 -0
  47. package/src/web/frontend/page/dir/api.ts +4 -108
  48. package/src/web/frontend/page/dir/index.tsx +148 -331
  49. package/src/web/frontend/page/dir/task-board-section.tsx +3 -0
  50. package/src/web/frontend/page/dir/task-dock-panel.tsx +1 -1
  51. package/src/web/frontend/page/dir/task.tsx +1 -1
  52. package/src/web/frontend/page/doc/doc-dock.tsx +1 -1
  53. package/src/web/frontend/page/group/api.ts +3 -21
  54. package/src/web/frontend/page/group/group-project-memo.ts +41 -0
  55. package/src/web/frontend/page/group/index.tsx +287 -426
  56. package/src/web/frontend/page/settings/api.ts +1 -2
  57. package/src/web/frontend/page/settings/prompt-templates-section.tsx +12 -44
  58. package/src/web/public/assets/{bar-Dy_QDX2h.js → bar-D7cWe7Kp.js} +1 -1
  59. package/src/web/public/assets/{composer-launch-B7DH53Yf.js → composer-launch--nJGFG35.js} +1 -1
  60. package/src/web/public/assets/{composer-panel-Cj1J16r-.js → composer-panel-Dhivt7UJ.js} +1 -1
  61. package/src/web/public/assets/{dag-DXRPHVl8.js → dag-DUhHxgTk.js} +1 -1
  62. package/src/web/public/assets/dir-CkYGYT9e.js +1 -0
  63. package/src/web/public/assets/doc-DgYKv2wo.css +1 -0
  64. package/src/web/public/assets/doc-QBHQi1EV.js +6 -0
  65. package/src/web/public/assets/group-CfJxWA7V.js +1 -0
  66. package/src/web/public/assets/group-project-memo-G-O6sPRw.js +1 -0
  67. package/src/web/public/assets/index-ByAPGidL.js +3 -0
  68. package/src/web/public/assets/{list-filter-CWxiOSg_.js → list-search-B2S2g8kn.js} +1 -1
  69. package/src/web/public/assets/md-history-DdM6P9Gq.js +47 -0
  70. package/src/web/public/assets/{progress-MPse2JLQ.js → progress-BVpSy-uF.js} +1 -1
  71. package/src/web/public/assets/refs-CCZgGPlL.js +2 -0
  72. package/src/web/public/assets/reopen-text-BC9a8KOp.js +13 -0
  73. package/src/web/public/assets/{repo-form-modal-CNLYR12c.js → repo-form-modal-D8WabN0R.js} +1 -1
  74. package/src/web/public/assets/{repos-BGx-yAXd.js → repos-V5xb5Kz-.js} +9 -9
  75. package/src/web/public/assets/settings-CAOSCF3E.js +1 -0
  76. package/src/web/public/assets/task-BwWlNP0i.js +13 -0
  77. package/src/web/public/assets/task-ops-DZgza5eZ.js +2 -0
  78. package/src/web/public/assets/task-utils--WIpAwUx.js +1 -0
  79. package/src/web/public/assets/{templates-Co1Qb1aA.js → templates-6ClSnYJN.js} +3 -3
  80. package/src/web/public/assets/{tool-bar-D5wLBLRl.js → tool-bar-BYdfBQeo.js} +1 -1
  81. package/src/web/public/assets/use-rail-drag-BMXJ48je.js +1 -0
  82. package/src/web/public/index.html +8 -8
  83. package/src/web/frontend/page/dir/landing.tsx +0 -553
  84. package/src/web/public/assets/dir-_M1ciSxM.js +0 -3
  85. package/src/web/public/assets/doc-Iuxssa-b.css +0 -1
  86. package/src/web/public/assets/doc-_iteSM2X.js +0 -6
  87. package/src/web/public/assets/get-loop-modal-DlAfqJMz.js +0 -2
  88. package/src/web/public/assets/group-CH8qe-eg.js +0 -1
  89. package/src/web/public/assets/index-Cui4IuGj.js +0 -3
  90. package/src/web/public/assets/md-history-Bj790fdn.js +0 -46
  91. package/src/web/public/assets/refs-DiIPoqnJ.js +0 -2
  92. package/src/web/public/assets/settings-Pt4YgGdY.js +0 -1
  93. package/src/web/public/assets/task-DOIIpQ4X.js +0 -13
  94. package/src/web/public/assets/task-utils-CJfMODCP.js +0 -13
  95. package/src/web/public/assets/use-rail-drag-CNOHXWng.js +0 -1
@@ -13,7 +13,6 @@ const input = z.object({
13
13
  cwd: z.string().optional(),
14
14
  key: z.string().optional(),
15
15
  attachment: z.string().describe("资源 id(见 localtask attachments)"),
16
- purge: z.boolean().optional().describe("连资源行与本机字节一起删(仍被其他任务/文档引用时拒绝删)"),
17
16
  });
18
17
 
19
18
  export class LocaltaskDetachAction extends ActionBase<typeof input> {
@@ -21,7 +20,7 @@ export class LocaltaskDetachAction extends ActionBase<typeof input> {
21
20
  id: 'localtask.detach',
22
21
  cli: ['localtask', 'detach'],
23
22
  http: ['DELETE', '/api/localtasks/attach'],
24
- summary: '解除任务与附件的关系(默认只解除关系,资源进孤儿池);--purge 在无人引用时连资源行与本机字节一起删',
23
+ summary: '解除任务与附件的关系(#189:只解除关联,资源进孤儿池;清理走库级 GC,不在这里删资源)',
25
24
  input,
26
25
  render: renderDetach,
27
26
  })
@@ -33,7 +32,6 @@ export class LocaltaskDetachAction extends ActionBase<typeof input> {
33
32
  cwd: ctx.cwd,
34
33
  key: ctx.key,
35
34
  attachment: ctx.attachment,
36
- purge: ctx.purge,
37
35
  });
38
36
 
39
37
  }
@@ -11,7 +11,7 @@
11
11
  // - #238 补上了**用户层**的落库(用户在设置页加/改/启用的那几条):那是 promptplug
12
12
  // 自己的键(settings 表,一段一个 `prompt.tpl.<段>`),由 template-store.ts 读写,
13
13
  // 与本文件的 lt.* 无关。
14
- // - 因此本文件只剩两个真正可写的键:`lt.timeoutSec` 与 `lt.appendMode`。
14
+ // - 因此本文件只剩一个真正可写的键:`lt.timeoutSec`(#186 起 appendMode 已删除,只保留 XML)。
15
15
  import { db, txw } from './open.js';
16
16
  import { nowMs } from '../../../../core/db/time.js';
17
17
  import {
@@ -19,13 +19,11 @@ import {
19
19
  MAX_TIMEOUT_SEC,
20
20
  clampTimeoutSec,
21
21
  } from '../store-io.js';
22
- import { clampAppendMode } from '../../lifecycle/task-templates.js';
23
22
  import type { DbApi } from '../../../../core/db/driver.js';
24
23
  import { activeTemplateOf } from '../../../promptplug/index.js';
25
24
 
26
25
  const KEYS = {
27
26
  timeoutSec: 'lt.timeoutSec',
28
- appendMode: 'lt.appendMode',
29
27
  };
30
28
 
31
29
  function readSetting(conn: DbApi, key: string): any {
@@ -57,7 +55,6 @@ export function getLtSettings(): Record<string, any> {
57
55
  const conn = db();
58
56
  return {
59
57
  timeoutSec: clampTimeoutSec(readSetting(conn, KEYS.timeoutSec)),
60
- appendMode: clampAppendMode(readSetting(conn, KEYS.appendMode)),
61
58
  // 旧视图字段:ack 段落正文来自 ack 插件类的内置模板,仍按「多条」形态给出,
62
59
  // 让老 CLI 的 localtask config 输出不必断代(#152:只是回显,不可写)。
63
60
  ackPrompt: splitEntries(activeTemplateOf('ack')),
@@ -67,7 +64,6 @@ export function getLtSettings(): Record<string, any> {
67
64
  /** setLtSettings 的 patch 形状(#152:模板不再可写,只留两个键)。 */
68
65
  export interface LtSettingsPatch {
69
66
  timeoutSec?: unknown;
70
- appendMode?: unknown;
71
67
  }
72
68
 
73
69
  /** 写部分设置(只改传入项;校验沿用 store-io 的 clamp)。 */
@@ -76,9 +72,6 @@ export function setLtSettings(patch: LtSettingsPatch = {}): Record<string, any>
76
72
  if (patch.timeoutSec !== undefined) {
77
73
  writeSetting(conn, KEYS.timeoutSec, clampTimeoutSec(patch.timeoutSec));
78
74
  }
79
- if (patch.appendMode !== undefined) {
80
- writeSetting(conn, KEYS.appendMode, clampAppendMode(patch.appendMode));
81
- }
82
75
  return getLtSettings();
83
76
  });
84
77
  }
@@ -91,7 +84,6 @@ export function settingsView(): Record<string, any> {
91
84
  recommendedSec: DEFAULT_TIMEOUT_SEC,
92
85
  maxSec: MAX_TIMEOUT_SEC,
93
86
  ackPromptList: s.ackPrompt,
94
- appendMode: s.appendMode,
95
87
  };
96
88
  }
97
89
 
@@ -13,8 +13,6 @@ export const DEFAULT_ACK_PROMPT =
13
13
  '完成之后必须调用 nx-kv localtask done --id {{task.id}} --summary "<完成总结>" 汇报结果。';
14
14
 
15
15
  import {
16
- DEFAULT_APPEND_MODE,
17
- APPEND_MODES,
18
16
  } from '../../../shared/prompt-blocks.js';
19
17
 
20
18
  /** 交付上下文模板(任务 #62)的长度上限——防把整本书塞进设置。 */
@@ -68,14 +66,3 @@ export function joinAckPrompt(v: unknown): string {
68
66
  return clampAckPromptList(v).join('\n\n');
69
67
  }
70
68
 
71
- // ─── 系统上下文追加模式 + XML 区块配置(settings 两键)───────────────
72
- //
73
- // appendMode:'xml'(默认,每段包独立标签)| 'plain'(改造前按空行直拼)。
74
- // 每个区块的模板正文在插件类里(modules/promptplug/plugins/*.ts),不再有落库模型。
75
- export const APPEND_MODE_IDS = Object.freeze(APPEND_MODES.map((m) => m.id));
76
-
77
- /** 归一化追加模式:缺省/非法 → xml(默认足够清晰)。 */
78
- export function clampAppendMode(v: unknown): string {
79
- const s = String(v ?? '').trim();
80
- return APPEND_MODE_IDS.includes(s) ? s : DEFAULT_APPEND_MODE;
81
- }
@@ -139,15 +139,13 @@ export async function pruneTopics({
139
139
  */
140
140
  export interface UpdateSettingsInput {
141
141
  timeoutSec?: unknown;
142
- appendMode?: unknown;
143
142
  }
144
143
 
145
144
  // 配置等待超时(页面可调)。超时推荐 180=3 分钟、最大 600=10 分钟。
146
- export async function updateSettings({ timeoutSec, appendMode }: UpdateSettingsInput = {}): Promise<Record<string, any>> {
145
+ export async function updateSettings({ timeoutSec }: UpdateSettingsInput = {}): Promise<Record<string, any>> {
147
146
  const hasTimeout = timeoutSec !== undefined && timeoutSec !== null;
148
- const hasAppend = appendMode !== undefined;
149
- if (!hasTimeout && !hasAppend) {
150
- throw badInput('请至少指定一项:--timeout <秒>,或 --append-mode <xml|plain>');
147
+ if (!hasTimeout) {
148
+ throw badInput('请指定 --timeout <秒>(追加模式已固定为 XML,不再可配)');
151
149
  }
152
150
  if (hasTimeout) {
153
151
  const n = Number(timeoutSec);
@@ -158,7 +156,6 @@ export async function updateSettings({ timeoutSec, appendMode }: UpdateSettingsI
158
156
  openStore();
159
157
  settingsRepo.setLtSettings({
160
158
  timeoutSec: hasTimeout ? timeoutSec : undefined,
161
- appendMode: hasAppend ? appendMode : undefined,
162
159
  });
163
160
  return settingsRepo.settingsView();
164
161
  }
@@ -11,7 +11,7 @@ import { existsSync } from 'node:fs';
11
11
  import { isImageName } from '../../../core/filekind.js';
12
12
  import { stripFrontmatter } from '../../../shared/frontmatter.js';
13
13
 
14
- const KIND_LABEL: Record<string, string> = { file: '附件', url: '链接', task: '任务', ref: '文档', mdfile: 'md', folder: '文件夹' };
14
+ const KIND_LABEL: Record<string, string> = { file: '附件', url: '链接', task: '任务', ref: '文档', mdfile: 'md', folder: '文件夹', repo: '仓库' };
15
15
  const IMAGE_LABEL = '图片';
16
16
  export const ORIGIN_LABEL = { inline: '正文内嵌', area: '附件区' };
17
17
  export const STATUS_LABEL: Record<string, string> = { pending: '待领取', claimed: '进行中', done: '已完成', cancelled: '已作废' };
@@ -30,10 +30,10 @@ function metaOf(row: any): Record<string, any> {
30
30
  }
31
31
  }
32
32
 
33
- /** 资源类型归一:image / 空 / 其它未知值 → file;url/task/ref/mdfile 原样。 */
33
+ /** 资源类型归一:image / 空 / 其它未知值 → file;url/task/ref/mdfile/folder/repo 原样。 */
34
34
  function baseKind(row: any): string {
35
35
  const k = String((row && row.kind) || '');
36
- return k === 'url' || k === 'task' || k === 'ref' || k === 'mdfile' || k === 'folder' ? k : 'file';
36
+ return k === 'url' || k === 'task' || k === 'ref' || k === 'mdfile' || k === 'folder' || k === 'repo' ? k : 'file';
37
37
  }
38
38
 
39
39
  export function kindLabelOf(kind: unknown, isImage: unknown): string {
@@ -205,7 +205,7 @@ export function resourceOf(row: any, lookups: ResourceLookups = {}): any {
205
205
  areaLabel: ORIGIN_LABEL[origin],
206
206
  storage: kind === 'file' ? String(row.storage || '')
207
207
  : kind === 'url' ? 'url'
208
- : kind === 'mdfile' || kind === 'folder' ? 'external' : 'internal',
208
+ : kind === 'mdfile' || kind === 'folder' || kind === 'repo' ? 'external' : 'internal',
209
209
  synced: kind !== 'file',
210
210
  localPath: '',
211
211
  targetKind: String(row.targetKind || ''),
@@ -281,6 +281,48 @@ export function resourceOf(row: any, lookups: ResourceLookups = {}): any {
281
281
  };
282
282
  }
283
283
 
284
+ if (kind === 'repo') {
285
+ // #184:参考仓库附件——登记指针,字节留在原 checkout(不 clone / 不复制)。
286
+ // 元数据(key/type/desc/docs)在登记时写进 meta;localPath 的 exists 按盘上现况判定。
287
+ const repoKey = String(meta.repoKey || row.targetKey || '');
288
+ const repoName = String(meta.name || row.name || repoKey);
289
+ const repoDesc = String(meta.desc || '');
290
+ const repoType = String(meta.repoType || '');
291
+ const localPath = String(meta.localPath || row.absPath || row.abs_path || '');
292
+ const exists = !!localPath && existsSync(localPath);
293
+ const missing = !exists || (row.missingAt !== null && row.missingAt !== undefined);
294
+ const branch = String(meta.branch || '');
295
+ const docs = Array.isArray(meta.docs) ? meta.docs.map((x: unknown) => String(x || '')).filter(Boolean) : [];
296
+ const getCmd = `nx-kv repo get --id ${repoKey}`;
297
+ const docCmd = `nx-kv repo doc list --id ${repoKey}`;
298
+ const typeLabel = repoType === 'ref' ? '参考仓库' : repoType === 'dev' ? '开发仓库' : '仓库';
299
+ const locator = `${repoName}(${typeLabel}${localPath ? ` · ${localPath}` : ''})`;
300
+ return {
301
+ ...base,
302
+ name: repoName,
303
+ repoKey,
304
+ repoName,
305
+ repoDesc,
306
+ repoType,
307
+ typeLabel,
308
+ localPath,
309
+ exists,
310
+ missing,
311
+ branch,
312
+ docs,
313
+ docCount: docs.length,
314
+ getCmd,
315
+ docCmd,
316
+ target: localPath || repoKey,
317
+ needsSync: false,
318
+ cmd: getCmd,
319
+ locator,
320
+ usage: missing
321
+ ? `这是${typeLabel}附件 ${repoKey},但本地 checkout 不可访问(${localPath || '路径为空'}):先 ${getCmd} 确认登记信息,再按 gitRepoRoot 重新 checkout`
322
+ : `这是${typeLabel}附件 ${repoKey}(不是副本,字节就在 ${localPath}):先用 ${getCmd} 确认元数据,实现前必须读该仓库源码(关键文件用 Read 打开 ${localPath});已整理文档用 ${docCmd} 列出后用 nx-kv docs get --ref <refId> 读取`,
323
+ };
324
+ }
325
+
284
326
  if (kind === 'folder') {
285
327
  // 本地文件夹指针:库里只有 abs_path,目录内容不入库;交付只给路径让 agent 自己列目录。
286
328
  const absPath = String(row.absPath || row.abs_path || meta.absPath || '');
@@ -14,12 +14,18 @@ import { hostOfUrl, kindLabelOf, ORIGIN_LABEL, sizeTextOf, STATUS_LABEL } from '
14
14
  */
15
15
  export const DEFAULT_ATTACH_TEMPLATE = [
16
16
  '{{#if attach}}',
17
- '〔附件〕本任务包含 {{attach.count}} 个附件(正文内嵌 {{attach.inlineCount}} · 附件区 {{attach.areaCount}})。请先识别附件内容(图片先看图、文档先读内容、文件夹先列目录)再开始处理,不要跳过附件。',
17
+ '〔附件〕本任务包含 {{attach.count}} 个附件(正文内嵌 {{attach.inlineCount}} · 附件区 {{attach.areaCount}})。{{#if attach.hasMandatory}}其中 {{attach.mandatoryCount}} 个是**系统内部资源**(任务 / 文档 / 仓库)——它们必须被实际访问:任务先读正文、文档先读全文、仓库先读源码并确认元数据;**未访问不得直接开始实现或交付**。{{else}}请先识别附件内容(图片先看图、文档先读内容、文件夹先列目录)再开始处理,不要跳过附件。{{/if}}',
18
18
  '',
19
19
  '附件清单:',
20
20
  '{{#each attach.list}}',
21
- ' - [{{originLabel}}] {{kindLabel}} {{name}}{{#if sizeText}}({{sizeText}}){{/if}}:{{#if file}}{{#if file.exists}}{{file.localPath}}{{else}}未同步到本地(fileId {{file.fileId}}){{/if}}{{/if}}{{#if url}}{{url.href}}{{/if}}{{#if task}}{{#if task.resolved}}#{{task.seq}} {{task.title}} · 地址 {{task.address}}({{task.statusLabel}}){{else}}地址 {{task.address}}({{task.statusLabel}}){{/if}}{{/if}}{{#if ref}}{{ref.title}}{{/if}}{{#if mdfile}}{{mdfile.absPath}}{{#if mdfile.missing}}(源文件已不在){{/if}}{{/if}}{{#if folder}}{{folder.absPath}}{{#if folder.missing}}(目录已不在){{/if}}{{/if}}{{#if note}} # {{note}}{{/if}}',
21
+ ' - [{{originLabel}}] {{kindLabel}} {{name}}{{#if sizeText}}({{sizeText}}){{/if}}:{{#if file}}{{#if file.exists}}{{file.localPath}}{{else}}未同步到本地(fileId {{file.fileId}}){{/if}}{{/if}}{{#if url}}{{url.href}}{{/if}}{{#if task}}{{#if task.resolved}}#{{task.seq}} {{task.title}} · 地址 {{task.address}}({{task.statusLabel}}){{else}}地址 {{task.address}}({{task.statusLabel}}){{/if}}{{/if}}{{#if ref}}{{ref.title}}{{/if}}{{#if mdfile}}{{mdfile.absPath}}{{#if mdfile.missing}}(源文件已不在){{/if}}{{/if}}{{#if folder}}{{folder.absPath}}{{#if folder.missing}}(目录已不在){{/if}}{{/if}}{{#if repo}}{{repo.typeLabel}} {{repo.key}}{{#if repo.localPath}} · {{repo.localPath}}{{/if}}{{#if repo.missing}}(checkout 已不在){{/if}}{{/if}}{{#if mandatory}}〔必须访问〕{{/if}}{{#if note}} # {{note}}{{/if}}',
22
22
  '{{/each}}',
23
+ '{{#if attach.hasMandatory}}',
24
+ '必须访问(内部资源,逐条执行,不得跳过):',
25
+ '{{#each attach.list}}{{#if mandatory}}',
26
+ ' - {{kindLabel}}《{{name}}》:{{access}}',
27
+ '{{/if}}{{/each}}',
28
+ '{{/if}}',
23
29
  '',
24
30
  '取用方式:',
25
31
  '{{#each attach.list}}',
@@ -58,7 +64,7 @@ export const DEFAULT_ATTACH_TEMPLATE = [
58
64
  * seq / showCmd / refId / target / area / areaLabel。
59
65
  */
60
66
  function ctxItemOf(a: any): any {
61
- const kind = ['url', 'task', 'ref', 'mdfile', 'folder'].includes(a.kind) ? a.kind : 'file';
67
+ const kind = ['url', 'task', 'ref', 'mdfile', 'folder', 'repo'].includes(a.kind) ? a.kind : 'file';
62
68
  const isImage = kind === 'file' && (a.isImage === undefined ? isImageName(a.name, a.mime) : !!a.isImage);
63
69
  const role = String(a.role || '');
64
70
  const origin =
@@ -85,6 +91,9 @@ function ctxItemOf(a: any): any {
85
91
  needsSync: !!a.needsSync,
86
92
  // 边上的说明(desc,#162):清单行用 {{#if note}} 透出,agent 据此决定是否深入
87
93
  note: String(a.note || ''),
94
+ // #184:内部资源(task / ref / repo)强制访问;外部资源(file/url/mdfile/folder)不强制
95
+ mandatory: false,
96
+ access: '',
88
97
  // 兼容旧字段
89
98
  area: origin,
90
99
  areaLabel: a.areaLabel || ORIGIN_LABEL[origin],
@@ -157,12 +166,63 @@ function ctxItemOf(a: any): any {
157
166
  ...task,
158
167
  task,
159
168
  usage: String(a.usage || `这是任务引用而不是副本(地址 ${task.address}):用 ${showCmd} 读取最新正文`),
169
+ // #184:任务是系统内部资源——必须先读正文再干活
170
+ mandatory: true,
171
+ access: `必须先读这条任务的最新正文:${showCmd}(读完再开始实现,不得只凭标题猜内容)`,
160
172
  cmd: String(a.cmd !== undefined ? a.cmd : showCmd),
161
173
  locator: String(a.locator || `#${seq} ${title}${task.topicName || topicKey ? ` · ${task.topicName || topicKey}` : ''}`),
162
174
  needsSync: false,
163
175
  };
164
176
  }
165
177
 
178
+ if (kind === 'repo') {
179
+ // #184:参考仓库附件——登记指针(字节在原 checkout),模板里强制「实现必须参考该仓库源码」
180
+ const repoKey = String(a.repoKey || a.targetKey || '');
181
+ const repoName = String(a.repoName || a.name || repoKey);
182
+ const repoDesc = String(a.repoDesc || a.desc || '');
183
+ const repoType = String(a.repoType || '');
184
+ const localPath = String(a.localPath || a.absPath || '');
185
+ const exists = a.exists === undefined ? !!localPath : !!a.exists;
186
+ const missing = a.missing === undefined ? !exists : !!a.missing;
187
+ const branch = String(a.branch || '');
188
+ const docs = Array.isArray(a.docs) ? a.docs.map((x: unknown) => String(x || '')).filter(Boolean) : [];
189
+ const getCmd = String(a.getCmd || `nx-kv repo get --id ${repoKey}`);
190
+ const docCmd = String(a.docCmd || `nx-kv repo doc list --id ${repoKey}`);
191
+ const typeLabel = repoType === 'ref' ? '参考仓库' : repoType === 'dev' ? '开发仓库' : '仓库';
192
+ const repo = { key: repoKey, name: repoName, desc: repoDesc, repoType, typeLabel, localPath, exists, missing, branch, docs, docCount: docs.length, getCmd, docCmd, cmd: getCmd };
193
+ const usage = String(a.usage || (missing
194
+ ? `这是${typeLabel}附件 ${repoKey},但本地 checkout 不可访问(${localPath || '路径为空'}):先 ${getCmd} 确认登记信息`
195
+ : `这是${typeLabel}附件 ${repoKey}(不是副本,字节就在 ${localPath}):先用 ${getCmd} 确认元数据,再读源码`));
196
+ return {
197
+ ...item,
198
+ name: repoName,
199
+ repoKey,
200
+ repoName,
201
+ repoDesc,
202
+ repoType,
203
+ typeLabel,
204
+ localPath,
205
+ path: localPath,
206
+ exists,
207
+ missing,
208
+ branch,
209
+ docs,
210
+ docCount: docs.length,
211
+ getCmd,
212
+ docCmd,
213
+ repo,
214
+ usage,
215
+ // #184:仓库是系统内部资源——实现必须参考源码,禁止臆测
216
+ mandatory: true,
217
+ access: missing
218
+ ? `${typeLabel} ${repoKey} 的本地 checkout 不在(${localPath || '路径为空'}):先 ${getCmd} 确认登记,再按 gitRepoRoot 重新 checkout 后才能参考源码`
219
+ : `实现必须参考该仓库源码(路径 ${localPath}),禁止凭记忆臆测 API / 文件结构:先 ${getCmd} 确认仓库元数据,再列 ${localPath} 结构、用 Read 读关键文件;已整理文档用 ${docCmd} 列出后用 nx-kv docs get --ref <refId> 读取`,
220
+ cmd: String(a.cmd !== undefined ? a.cmd : getCmd),
221
+ locator: String(a.locator || `${repoName}(${typeLabel}${localPath ? ` · ${localPath}` : ''})`),
222
+ needsSync: false,
223
+ };
224
+ }
225
+
166
226
  if (kind === 'folder') {
167
227
  const absPath = String(a.absPath || a.localPath || '');
168
228
  const exists = a.exists === undefined ? !!absPath : !!a.exists;
@@ -250,6 +310,13 @@ function ctxItemOf(a: any): any {
250
310
  ...ref,
251
311
  ref,
252
312
  usage,
313
+ // #184:文档是系统内部资源——必须先读全文(已内联时指向「文档原文」段)
314
+ mandatory: true,
315
+ access: content
316
+ ? `文档全文已内联在本清单末尾的「文档原文」段${truncated ? `(有截断,完整版用 ${readCmd})` : ''}:先读完再实现`
317
+ : readCmd
318
+ ? `必须先读文档全文:${readCmd}(读完再开始实现)`
319
+ : '必须先定位并读取该文档(refId 缺失):先用 nx-kv docs list 找到它',
253
320
  cmd: String(a.cmd !== undefined ? a.cmd : readCmd),
254
321
  locator: String(a.locator || title),
255
322
  needsSync: false,
@@ -273,6 +340,9 @@ export function attachTemplateCtx(attachments: unknown): Record<string, any> {
273
340
  areaCount: items.filter((a) => a.origin === 'area').length,
274
341
  hasInline: items.some((a) => a.origin !== 'area'),
275
342
  hasArea: items.some((a) => a.origin === 'area'),
343
+ // #184:内部资源(任务 / 文档 / 仓库)数量——模板据此决定是否输出「必须访问」段
344
+ mandatoryCount: items.filter((a) => a.mandatory).length,
345
+ hasMandatory: items.some((a) => a.mandatory),
276
346
  // 结构化数组:模板用循环组织清单,不再由服务端拼多行字符串。
277
347
  list: items,
278
348
  },
@@ -26,9 +26,7 @@ import { contentTypeOf, isImageName } from '../../../core/filekind.js';
26
26
  import { localIndex as localStoreIndex, localResolve, localUpload } from '../../../core/localatt.js';
27
27
  import { getDb } from '../../../core/db/index.js';
28
28
  import { tx } from '../../../core/db/tx.js';
29
- import { attachmentsRootFromEnv } from '../../../core/paths.js';
30
29
  import {
31
- deleteAttachment,
32
30
  ensureRefAttachment,
33
31
  ensureTaskAttachment,
34
32
  ensureUrlAttachment,
@@ -37,6 +35,7 @@ import {
37
35
  readMdfile,
38
36
  registerMdfile,
39
37
  registerFolder,
38
+ registerRepoAttachment,
40
39
  resolveRefId,
41
40
  unlinkAttachment,
42
41
  updateAttachmentNote,
@@ -170,6 +169,8 @@ export interface AttachToTaskOptions {
170
169
  mdfile?: unknown;
171
170
  /** 本地文件夹(kind=folder:只登记路径指针,不复制目录内容) */
172
171
  folder?: unknown;
172
+ /** #184 参考仓库(kind=repo):已登记仓库的 key / 路径 / 名称;只登记指针 */
173
+ repo?: unknown;
173
174
  note?: unknown;
174
175
  noEmbed?: unknown;
175
176
  inline?: unknown;
@@ -197,7 +198,7 @@ export interface AttachToTaskOptions {
197
198
  * --folder <目录> 本地文件夹(kind=folder,nxkv://folder/<attId>;只登记路径,不复制目录内容)
198
199
  */
199
200
  export async function attachToTask({
200
- id, cwd, key, path, fileId, name, kind, url, task, ref, mdfile, folder, note, noEmbed, inline,
201
+ id, cwd, key, path, fileId, name, kind, url, task, ref, mdfile, folder, repo, note, noEmbed, inline,
201
202
  }: AttachToTaskOptions = {}): Promise<Record<string, any>> {
202
203
  const cur = await service.getTask({ id, cwd, key }); // 存在性与参数校验都在队列本体
203
204
  const topicKey = cur.key || key || '';
@@ -336,11 +337,45 @@ export async function attachToTask({
336
337
  displayName = displayName || rec.name;
337
338
  resolvedKind = 'folder';
338
339
  markdown = `[${displayName}](nxkv://folder/${rec.id})`;
340
+ } else if (repo) {
341
+ // #184 参考仓库:必须是**已登记**仓库(key / 路径 / 名称都能定位);未登记直接报错,
342
+ // 不许静默退化成 folder(repo 带 key / type / 文档语义,folder 只是任意目录)。
343
+ const { getRepo } = await import('../../repos/service.js');
344
+ const { listRepoDocs } = await import('../../docs/refs.js');
345
+ let info: any = null;
346
+ try {
347
+ info = await getRepo(repo);
348
+ } catch {
349
+ throw badInput(`仓库未登记或不存在: ${String(repo)}——先 nx-kv repo list 确认,或 nx-kv repo add 登记`);
350
+ }
351
+ let docs: string[] = [];
352
+ try {
353
+ const dv: any = await listRepoDocs(String(info.path || info.key || repo));
354
+ docs = [dv?.main?.refId, ...((dv?.extras || []).map((x: any) => x?.refId))].filter(Boolean) as string[];
355
+ } catch {
356
+ docs = []; // 文档列表读不到不影响挂仓库
357
+ }
358
+ const rec = tx(
359
+ (conn) => registerRepoAttachment(conn, {
360
+ key: info.key || info.id || String(repo),
361
+ name: info.name || '',
362
+ desc: info.desc || '',
363
+ repoType: info.type || '',
364
+ localPath: info.path || '',
365
+ branch: info.branch || '',
366
+ docs,
367
+ }),
368
+ { db, mode: 'IMMEDIATE' }
369
+ );
370
+ attachmentId = rec.id;
371
+ displayName = displayName || rec.name;
372
+ resolvedKind = 'repo';
373
+ markdown = `[${displayName}](nxkv://repo/${rec.id})`;
339
374
  }
340
375
 
341
376
  if (!attachmentId) {
342
377
  throw badInput(
343
- '需要 --path <本机文件>、--fileId <已有附件>、--url <链接>、--task <编号>、--ref <文档>、--mdfile <本地 md> 或 --folder <本地目录> 之一'
378
+ '需要 --path <本机文件>、--fileId <已有附件>、--url <链接>、--task <编号>、--ref <文档>、--mdfile <本地 md>、--folder <本地目录> 或 --repo <已登记仓库> 之一'
344
379
  );
345
380
  }
346
381
  const wantInline = !!inline;
@@ -425,8 +460,8 @@ export interface ListTaskAttachmentsOptions {
425
460
  */
426
461
  export async function listTaskAttachments({ id, cwd, key }: ListTaskAttachmentsOptions = {}): Promise<Record<string, any>> {
427
462
  const cur = await service.getTask({ id, cwd, key });
428
- const store = await localStoreIndex();
429
463
  const rows = listTaskAttachmentsBySeq(getDb(), { topicKey: (cur.key || key) as string, seq: cur.id });
464
+ const store = await localStoreIndex();
430
465
  const attachments = annotateFileRows(rows, targetLookupsOf(getDb(), rows), store);
431
466
  await annotateRefTitles(attachments);
432
467
 
@@ -491,31 +526,26 @@ export interface DetachTaskAttachmentOptions {
491
526
  /**
492
527
  * 解除任务与一条资源的关系(CLI `localtask detach`)。
493
528
  *
494
- * --only-unlink(默认):只删 task_attach 边,资源与字节保留(可能进孤儿池);
495
- * --purge :先解除关系,再在「没有任何任务/文档还在用」时删资源行与字节。
529
+ * #189:**只有一种行为**——只删 task_attach 边,资源行与字节一律保留(进孤儿池,
530
+ * 可被重新挂载)。资源清理统一交给库级 GC(`file prune`),这里不做任何删除。
496
531
  *
497
532
  * 关系表是权威:解除后这条资源不再出现在任务附件清单里,但正文里若仍有内嵌,
498
533
  * 下次正文同步会把 inline 边重新写回来(这是正文明示的引用,不算丢)。
499
534
  */
500
- export async function detachTaskAttachment({ id, cwd, key, attachment, purge }: DetachTaskAttachmentOptions = {}): Promise<Record<string, any>> {
535
+ export async function detachTaskAttachment({ id, cwd, key, attachment }: DetachTaskAttachmentOptions = {}): Promise<Record<string, any>> {
501
536
  const cur = await service.getTask({ id, cwd, key });
502
537
  const topicKey = cur.key || key || '';
503
538
  const attId = String(attachment || '').trim();
504
539
  if (!attId) throw badInput('需要 --attachment <资源 id>(见 localtask attachments 输出)');
505
540
  const db = getDb();
506
- const store = await localStoreIndex();
507
541
  let deleted = 0;
508
- let purgeResult: any = null;
509
542
  tx(
510
543
  (conn) => {
511
544
  const gid = taskGlobalIdOf(conn, { topicKey, seq: cur.id });
512
545
  if (!gid) throw badInput(`任务 #${cur.id} 已不存在`);
546
+ // #189:移除附件 = **只解除关联**。资源行与字节一律不动(各 kind 的删除语义
547
+ // 不一致,逐个维护会出 bug);需要清理时走库级 GC(孤儿池 + 到期回收)。
513
548
  deleted = unlinkAttachment(conn, { host: 'task', hostId: gid, attachmentId: attId });
514
- if (purge && deleted) {
515
- purgeResult = deleteAttachment(conn, attId, {
516
- attachmentsRoot: attachmentsRootFromEnv() || store.dir,
517
- });
518
- }
519
549
  },
520
550
  { db, mode: 'IMMEDIATE' }
521
551
  );
@@ -526,8 +556,5 @@ export async function detachTaskAttachment({ id, cwd, key, attachment, purge }:
526
556
  task: { id: cur.id },
527
557
  attachment: attId,
528
558
  unlinked: deleted,
529
- purged: !!(purgeResult && purgeResult.removed),
530
- purgeReason: purgeResult ? purgeResult.reason || '' : '',
531
- bytesRemoved: !!(purgeResult && purgeResult.bytesRemoved),
532
559
  };
533
560
  }
@@ -63,19 +63,10 @@ export function renderTaskAttachments(d: RenderInput): string {
63
63
  }
64
64
 
65
65
  export function renderDetach(d: RenderInput): string {
66
- const head = d.unlinked
67
- ? `已解除主题「${d.name}」#${d.task.id} 与附件 ${d.attachment} 的关系`
66
+ // #189:只解除关联——不删资源行与字节(清理交给库级 GC),没有 purge 尾巴可报。
67
+ return d.unlinked
68
+ ? `已解除主题「${d.name}」#${d.task.id} 与附件 ${d.attachment} 的关系(资源留在孤儿池)`
68
69
  : `主题「${d.name}」#${d.task.id} 本来就没有引用附件 ${d.attachment}`;
69
- const tail = d.purged
70
- ? ';资源已删除(含本机字节)'
71
- : d.purgeReason === 'in-use'
72
- ? ';资源仍被其他任务/文档引用,未删字节'
73
- : d.purgeReason === 'file-locked'
74
- ? ';文件被占用,未删字节(关系已解除)'
75
- : d.purgeReason === 'not-found'
76
- ? ';资源行不存在'
77
- : '';
78
- return head + tail;
79
70
  }
80
71
 
81
72
  export function renderAdd(d: RenderInput): string {
@@ -52,7 +52,6 @@ export interface ComposeOptions {
52
52
  groups?: readonly string[];
53
53
  /** compose 的种子数据:task / cwd / goal / source / summary / name / params */
54
54
  seed?: Record<string, unknown>;
55
- mode?: 'xml' | 'plain';
56
55
  trace?: RenderTraceEntry[];
57
56
  /** trace 的段名映射(traceId / label / 生效模板名)——真实领取不传,预览传 */
58
57
  segments?: SegmentMeta[];
@@ -63,7 +62,7 @@ export interface ComposeOptions {
63
62
  * 返回 ''(无可输出段落)时调用方省略 instruction。
64
63
  */
65
64
  export async function compose(opts: ComposeOptions): Promise<string> {
66
- const { plugins, group, groups, seed = {}, mode = 'xml', trace, segments } = opts;
65
+ const { plugins, group, groups, seed = {}, trace, segments } = opts;
67
66
  const wanted = groups && groups.length ? groups : group ? [group] : [];
68
67
  if (!wanted.length) throw new Error('compose: 必须指定 group 或 groups');
69
68
  const chain =
@@ -98,6 +97,5 @@ export async function compose(opts: ComposeOptions): Promise<string> {
98
97
  });
99
98
  }
100
99
  }
101
- if (mode === 'plain') return parts.map((p) => p.text).join('\n\n').trim();
102
100
  return wrapXmlBlocks(parts);
103
101
  }
@@ -22,13 +22,13 @@ import { z } from 'zod';
22
22
  import { PromptPlugin, supplied, type Supply, type TemplateText } from '../base.js';
23
23
 
24
24
  /** 附件 kind(与 attach-resource.ts 的 baseKind 归一结果一致)。 */
25
- export const ATTACH_KINDS = ['file', 'url', 'task', 'ref', 'mdfile', 'folder'] as const;
25
+ export const ATTACH_KINDS = ['file', 'url', 'task', 'ref', 'mdfile', 'folder', 'repo'] as const;
26
26
  /** 来源:正文内嵌 / 附件区(关系表 role 决定)。 */
27
27
  export const ATTACH_ORIGINS = ['inline', 'area'] as const;
28
28
 
29
29
  const kind = z.enum(ATTACH_KINDS);
30
30
  /** 每条附件的类型说明(union 各分支共用同一句,去重后目录里能看到完整枚举)。 */
31
- const KIND_DESC = '附件类型:file / url / task / ref / mdfile / folder(决定子对象形状与取用命令)';
31
+ const KIND_DESC = '附件类型:file / url / task / ref / mdfile / folder / repo(决定子对象形状与取用命令)';
32
32
  const origin = z.enum(ATTACH_ORIGINS);
33
33
 
34
34
  /**
@@ -58,6 +58,8 @@ const baseItem = {
58
58
  locator: z.string().describe('定位串(清单行末尾展示的「在哪」)'),
59
59
  needsSync: z.boolean().describe('是否需要额外同步(本机模型恒 false)'),
60
60
  note: z.string().describe('边上的说明(attach --note 的落点)'),
61
+ mandatory: z.boolean().describe('#184:是否内部资源(task / ref / repo)——模板据此输出「必须访问」'),
62
+ access: z.string().describe('#184:可执行的访问说明(内部资源强制访问用的具体命令)'),
61
63
  target: z.string(),
62
64
  targetKind: z.string(),
63
65
  targetKey: z.string(),
@@ -186,10 +188,50 @@ const folderItem = z.looseObject({
186
188
  }).describe('目录视图:{{#if folder}}{{folder.absPath}}{{/if}}'),
187
189
  });
188
190
 
191
+ /**
192
+ * kind=repo:参考仓库附件(#184)。登记指针,字节在原 checkout。
193
+ * **实现必须参考该仓库源码**:先 repo.getCmd 确认元数据,再列 repo.localPath、Read 关键文件;
194
+ * 已整理文档用 repo.docCmd 列出后 docs get --ref 读取。
195
+ */
196
+ const repoItem = z.looseObject({
197
+ ...baseItem,
198
+ kind: z.literal('repo').describe(KIND_DESC),
199
+ repoKey: z.string().describe('仓库 key(如 github.com/org/name)'),
200
+ repoName: z.string().describe('仓库名'),
201
+ repoDesc: z.string().describe('仓库一句话描述'),
202
+ repoType: z.string().describe('ref(参考仓库)/ dev(开发仓库)'),
203
+ typeLabel: z.string().describe('类型中文名:参考仓库 / 开发仓库 / 仓库'),
204
+ localPath: z.string().describe('checkout 的绝对路径(读源码从这里开始)'),
205
+ path: z.string().describe('= localPath(旧写法)'),
206
+ exists: z.boolean().describe('checkout 目录是否还在盘上'),
207
+ missing: z.boolean().describe('checkout 不可用(目录不在或被标记缺失)'),
208
+ branch: z.string().describe('当前分支(取不到为空串)'),
209
+ docs: z.array(z.string()).describe('该仓库已整理的文档 refId 列表'),
210
+ docCount: z.number().describe('已整理文档数'),
211
+ getCmd: z.string().describe('确认仓库元数据的命令:nx-kv repo get --id <key>'),
212
+ docCmd: z.string().describe('列出仓库文档的命令:nx-kv repo doc list --id <key>'),
213
+ repo: z.looseObject({
214
+ key: z.string(),
215
+ name: z.string(),
216
+ desc: z.string(),
217
+ repoType: z.string(),
218
+ typeLabel: z.string(),
219
+ localPath: z.string(),
220
+ exists: z.boolean(),
221
+ missing: z.boolean(),
222
+ branch: z.string(),
223
+ docs: z.array(z.string()),
224
+ docCount: z.number(),
225
+ getCmd: z.string(),
226
+ docCmd: z.string(),
227
+ cmd: z.string().describe('= getCmd(模板里写 {{repo.cmd}} 确认元数据)'),
228
+ }).describe('仓库视图:{{repo.localPath}} 读源码、{{repo.cmd}} 确认元数据'),
229
+ });
230
+
189
231
  /** 一条附件:kind 决定形状(discriminatedUnion 给的是「kind 与字段必须自洽」这道闸)。 */
190
232
  const attachItem = z
191
- .discriminatedUnion('kind', [fileItem, urlItem, taskItem, refItem, mdfileItem, folderItem])
192
- .describe('附件条目:file / url / task / ref / mdfile / folder,各有自己的子对象与取用命令');
233
+ .discriminatedUnion('kind', [fileItem, urlItem, taskItem, refItem, mdfileItem, folderItem, repoItem])
234
+ .describe('附件条目:file / url / task / ref / mdfile / folder / repo,各有自己的子对象与取用命令');
193
235
 
194
236
  const schema = z.strictObject({
195
237
  // strictObject 只钉顶层段键(attach);attach 由宿主构造,段内形状见上。
@@ -200,6 +242,8 @@ const schema = z.strictObject({
200
242
  areaCount: z.number().describe('附件区数量'),
201
243
  hasInline: z.boolean(),
202
244
  hasArea: z.boolean(),
245
+ mandatoryCount: z.number().describe('#184:内部资源(任务 / 文档 / 仓库)数量'),
246
+ hasMandatory: z.boolean().describe('#184:是否存在必须访问的内部资源'),
203
247
  list: z.array(attachItem).describe('结构化清单:模板用 {{#each attach.list}} 展开'),
204
248
  })
205
249
  .nullable(),
@@ -210,12 +254,18 @@ const BUILTIN: TemplateText = {
210
254
  id: 'builtin',
211
255
  name: '系统内置',
212
256
  text: `{{#if attach}}
213
- 〔附件〕本任务包含 {{attach.count}} 个附件(正文内嵌 {{attach.inlineCount}} · 附件区 {{attach.areaCount}})。请先识别附件内容(图片先看图、文档先读内容、文件夹先列目录)再开始处理,不要跳过附件。
257
+ 〔附件〕本任务包含 {{attach.count}} 个附件(正文内嵌 {{attach.inlineCount}} · 附件区 {{attach.areaCount}})。{{#if attach.hasMandatory}}其中 {{attach.mandatoryCount}} 个是**系统内部资源**(任务 / 文档 / 仓库)——它们必须被实际访问:任务先读正文、文档先读全文、仓库先读源码并确认元数据;**未访问不得直接开始实现或交付**。{{else}}请先识别附件内容(图片先看图、文档先读内容、文件夹先列目录)再开始处理,不要跳过附件。{{/if}}
214
258
 
215
259
  附件清单:
216
260
  {{#each attach.list}}
217
- - [{{originLabel}}] {{kindLabel}} {{name}}{{#if sizeText}}({{sizeText}}){{/if}}:{{#if file}}{{#if file.exists}}{{file.localPath}}{{else}}未同步到本地(fileId {{file.fileId}}){{/if}}{{/if}}{{#if url}}{{url.href}}{{/if}}{{#if task}}{{#if task.resolved}}#{{task.seq}} {{task.title}} · 地址 {{task.address}}({{task.statusLabel}}){{else}}地址 {{task.address}}({{task.statusLabel}}){{/if}}{{/if}}{{#if ref}}{{ref.title}}{{/if}}{{#if mdfile}}{{mdfile.absPath}}{{#if mdfile.missing}}(源文件已不在){{/if}}{{/if}}{{#if folder}}{{folder.absPath}}{{#if folder.missing}}(目录已不在){{/if}}{{/if}}{{#if note}} # {{note}}{{/if}}
261
+ - [{{originLabel}}] {{kindLabel}} {{name}}{{#if sizeText}}({{sizeText}}){{/if}}:{{#if file}}{{#if file.exists}}{{file.localPath}}{{else}}未同步到本地(fileId {{file.fileId}}){{/if}}{{/if}}{{#if url}}{{url.href}}{{/if}}{{#if task}}{{#if task.resolved}}#{{task.seq}} {{task.title}} · 地址 {{task.address}}({{task.statusLabel}}){{else}}地址 {{task.address}}({{task.statusLabel}}){{/if}}{{/if}}{{#if ref}}{{ref.title}}{{/if}}{{#if mdfile}}{{mdfile.absPath}}{{#if mdfile.missing}}(源文件已不在){{/if}}{{/if}}{{#if folder}}{{folder.absPath}}{{#if folder.missing}}(目录已不在){{/if}}{{/if}}{{#if repo}}{{repo.typeLabel}} {{repo.key}}{{#if repo.localPath}} · {{repo.localPath}}{{/if}}{{#if repo.missing}}(checkout 已不在){{/if}}{{/if}}{{#if mandatory}}〔必须访问〕{{/if}}{{#if note}} # {{note}}{{/if}}
218
262
  {{/each}}
263
+ {{#if attach.hasMandatory}}
264
+ 必须访问(内部资源,逐条执行,不得跳过):
265
+ {{#each attach.list}}{{#if mandatory}}
266
+ - {{kindLabel}}《{{name}}》:{{access}}
267
+ {{/if}}{{/each}}
268
+ {{/if}}
219
269
 
220
270
  取用方式:
221
271
  {{#each attach.list}}