@fitlab-ai/agent-infra 0.9.14 → 0.9.15

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 (250) hide show
  1. package/README.md +10 -0
  2. package/README.zh-CN.md +10 -0
  3. package/bin/internal-cli.sh +45 -0
  4. package/dist/bin/internal-cli.js +93 -30
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +165 -27
  6. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +3 -2
  7. package/dist/lib/defaults.json +103 -103
  8. package/dist/lib/fs/durable-write.js +37 -0
  9. package/dist/lib/fs/file-lock.js +111 -0
  10. package/dist/lib/host-control/audit.js +19 -0
  11. package/dist/lib/host-control/client.js +142 -0
  12. package/dist/lib/host-control/command.js +49 -0
  13. package/dist/lib/host-control/path.js +160 -0
  14. package/dist/lib/host-control/secure-fs.js +140 -0
  15. package/dist/lib/host-control/server.js +159 -0
  16. package/dist/lib/host-control/service.js +112 -0
  17. package/dist/lib/init.js +11 -2
  18. package/dist/lib/internal/cli-route-inventory.js +3 -1
  19. package/dist/lib/internal/codex-lifecycle.js +6 -6
  20. package/dist/lib/internal/demo-promotion.js +322 -0
  21. package/dist/lib/internal/demo-transcript.js +454 -0
  22. package/dist/lib/internal/host-control.js +28 -0
  23. package/dist/lib/internal/manual-validation.js +322 -0
  24. package/dist/lib/internal/platform-pr.js +18 -4
  25. package/dist/lib/internal/release-workflow.js +63 -84
  26. package/dist/lib/internal/sandbox-control.js +149 -2
  27. package/dist/lib/internal/task-artifact.js +15 -262
  28. package/dist/lib/internal/task-create.js +6 -5
  29. package/dist/lib/internal/task-event.js +37 -37
  30. package/dist/lib/internal/task-operation-registry.js +101 -3
  31. package/dist/lib/internal/task-review.js +8 -53
  32. package/dist/lib/internal/task-validate.js +30 -10
  33. package/dist/lib/owned-path.js +33 -0
  34. package/dist/lib/platform/check-status.js +11 -0
  35. package/dist/lib/platform/comment-safety.js +4 -1
  36. package/dist/lib/platform/completion-backfill.js +1 -1
  37. package/dist/lib/platform/github-data.js +241 -0
  38. package/dist/lib/platform/github-provider.js +15 -20
  39. package/dist/lib/platform/issue-comments.js +2 -2
  40. package/dist/lib/platform/issues.js +1 -179
  41. package/dist/lib/platform/pr-checks.js +12 -65
  42. package/dist/lib/platform/pr-summary.js +55 -3
  43. package/dist/lib/platform/pull-requests.js +2 -105
  44. package/dist/lib/platform/snapshots.js +2 -0
  45. package/dist/lib/platform/verification-sync.js +127 -142
  46. package/dist/lib/release/workflow.js +1 -1
  47. package/dist/lib/sandbox/commands/create.js +7 -2
  48. package/dist/lib/sandbox/commands/rm.js +3 -1514
  49. package/dist/lib/sandbox/control/audit.js +203 -0
  50. package/dist/lib/sandbox/control/client.js +93 -54
  51. package/dist/lib/sandbox/control/executor.js +129 -65
  52. package/dist/lib/sandbox/control/finalization-response.js +27 -0
  53. package/dist/lib/sandbox/control/identity-sentinel.js +107 -0
  54. package/dist/lib/sandbox/control/lifecycle.js +36 -2
  55. package/dist/lib/sandbox/control/native-file-lock.js +6 -98
  56. package/dist/lib/sandbox/control/protocol.js +55 -4
  57. package/dist/lib/sandbox/control/server.js +491 -120
  58. package/dist/lib/sandbox/control/state.js +58 -0
  59. package/dist/lib/sandbox/control/task-workflow.js +74 -0
  60. package/dist/lib/sandbox/control/workflow-executor.js +99 -0
  61. package/dist/lib/sandbox/index.js +2 -2
  62. package/dist/lib/sandbox/recovery.js +28 -4
  63. package/dist/lib/sandbox/removal.js +1717 -0
  64. package/dist/lib/sandbox/task-cleanup.js +217 -0
  65. package/dist/lib/sandbox/workspace-view.js +13 -14
  66. package/dist/lib/task/activity-intent.js +2 -1
  67. package/dist/lib/task/activity-log.js +30 -24
  68. package/dist/lib/task/artifact-command.js +101 -0
  69. package/dist/lib/task/artifact-lifecycle.js +30 -28
  70. package/dist/lib/task/artifact-name.js +36 -0
  71. package/dist/lib/task/artifact-operations.js +23 -69
  72. package/dist/lib/task/artifact-receipts.js +3 -15
  73. package/dist/lib/task/artifact-repair-intent.js +87 -16
  74. package/dist/lib/task/artifact-schema.js +6 -14
  75. package/dist/lib/task/capabilities.js +12 -19
  76. package/dist/lib/task/codex-orchestration.js +71 -25
  77. package/dist/lib/task/commit-identity.js +28 -0
  78. package/dist/lib/task/commit-operation.js +2 -16
  79. package/dist/lib/task/control-authority.js +371 -5
  80. package/dist/lib/task/control-recovery.js +128 -0
  81. package/dist/lib/task/create.js +62 -9
  82. package/dist/lib/task/decision-details.js +2 -46
  83. package/dist/lib/task/events.js +120 -9
  84. package/dist/lib/task/finalization-state.js +9 -0
  85. package/dist/lib/task/human-override.js +3 -6
  86. package/dist/lib/task/implementation-inputs.js +3 -3
  87. package/dist/lib/task/intermediate-cleanup.js +383 -0
  88. package/dist/lib/task/invalidation.js +18 -65
  89. package/dist/lib/task/ledger-intents.js +7 -22
  90. package/dist/lib/task/ledger.js +1 -3
  91. package/dist/lib/task/lifecycle.js +19 -1
  92. package/dist/lib/task/local-artifact-finalization.js +132 -157
  93. package/dist/lib/task/manual-validation-completion.js +26 -0
  94. package/dist/lib/task/manual-validation-evidence.js +130 -0
  95. package/dist/lib/task/manual-validation-receipt.js +101 -0
  96. package/dist/lib/task/manual-validation-shared.js +40 -0
  97. package/dist/lib/task/manual-validation-transaction.js +243 -0
  98. package/dist/lib/task/markdown.js +47 -0
  99. package/dist/lib/task/orchestration.js +14 -17
  100. package/dist/lib/task/qualification-audit.js +20 -34
  101. package/dist/lib/task/review-artifacts.js +2 -18
  102. package/dist/lib/task/review-command.js +25 -0
  103. package/dist/lib/task/review-finalization.js +125 -193
  104. package/dist/lib/task/review-fingerprint.js +2 -2
  105. package/dist/lib/task/sections.js +34 -56
  106. package/dist/lib/task/verification-engine.js +116 -323
  107. package/dist/lib/task/verification.js +1 -1
  108. package/dist/lib/task/workflow-command.js +17 -0
  109. package/dist/lib/task/workflow-warning-intents.js +0 -16
  110. package/dist/lib/task/workflow-warnings.js +28 -2
  111. package/dist/lib/update.js +2 -0
  112. package/dist/lifecycle-build-manifest.json +3 -3
  113. package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +223 -33
  114. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +3 -2
  115. package/lib/fs/durable-write.ts +29 -0
  116. package/lib/fs/file-lock.ts +113 -0
  117. package/lib/host-control/audit.ts +22 -0
  118. package/lib/host-control/client.ts +172 -0
  119. package/lib/host-control/command.ts +60 -0
  120. package/lib/host-control/path.ts +167 -0
  121. package/lib/host-control/secure-fs.ts +135 -0
  122. package/lib/host-control/server.ts +180 -0
  123. package/lib/host-control/service.ts +133 -0
  124. package/lib/init.ts +15 -2
  125. package/lib/internal/cli-route-inventory.ts +3 -1
  126. package/lib/internal/codex-lifecycle.ts +6 -6
  127. package/lib/internal/demo-promotion.ts +354 -0
  128. package/lib/internal/demo-transcript.ts +419 -0
  129. package/lib/internal/host-control.ts +28 -0
  130. package/lib/internal/manual-validation.ts +306 -0
  131. package/lib/internal/platform-pr.ts +15 -4
  132. package/lib/internal/release-workflow.ts +74 -82
  133. package/lib/internal/sandbox-control.ts +162 -1
  134. package/lib/internal/task-artifact.ts +13 -216
  135. package/lib/internal/task-create.ts +5 -5
  136. package/lib/internal/task-event.ts +20 -11
  137. package/lib/internal/task-operation-registry.ts +111 -3
  138. package/lib/internal/task-review.ts +6 -51
  139. package/lib/internal/task-validate.ts +26 -10
  140. package/lib/owned-path.ts +26 -0
  141. package/lib/platform/check-status.ts +9 -0
  142. package/lib/platform/comment-safety.ts +5 -0
  143. package/lib/platform/completion-backfill.ts +1 -1
  144. package/lib/platform/github-data.ts +322 -0
  145. package/lib/platform/github-provider.ts +15 -20
  146. package/lib/platform/issue-comments.ts +3 -4
  147. package/lib/platform/issues.ts +4 -245
  148. package/lib/platform/pr-checks.ts +13 -77
  149. package/lib/platform/pr-summary.ts +61 -5
  150. package/lib/platform/pull-requests.ts +3 -170
  151. package/lib/platform/snapshots.ts +53 -0
  152. package/lib/platform/verification-sync.ts +145 -155
  153. package/lib/release/workflow.ts +3 -3
  154. package/lib/sandbox/commands/create.ts +7 -6
  155. package/lib/sandbox/commands/rm.ts +3 -1909
  156. package/lib/sandbox/control/audit.ts +253 -0
  157. package/lib/sandbox/control/client.ts +109 -66
  158. package/lib/sandbox/control/executor.ts +134 -74
  159. package/lib/sandbox/control/finalization-response.ts +29 -0
  160. package/lib/sandbox/control/identity-sentinel.ts +137 -0
  161. package/lib/sandbox/control/lifecycle.ts +45 -3
  162. package/lib/sandbox/control/native-file-lock.ts +6 -107
  163. package/lib/sandbox/control/protocol.ts +75 -6
  164. package/lib/sandbox/control/server.ts +538 -123
  165. package/lib/sandbox/control/state.ts +78 -0
  166. package/lib/sandbox/control/task-workflow.ts +95 -0
  167. package/lib/sandbox/control/workflow-executor.ts +102 -0
  168. package/lib/sandbox/index.ts +2 -2
  169. package/lib/sandbox/recovery.ts +28 -5
  170. package/lib/sandbox/removal.ts +2144 -0
  171. package/lib/sandbox/task-cleanup.ts +209 -0
  172. package/lib/sandbox/workspace-view.ts +17 -15
  173. package/lib/task/activity-intent.ts +2 -2
  174. package/lib/task/activity-log.ts +27 -19
  175. package/lib/task/artifact-command.ts +104 -0
  176. package/lib/task/artifact-lifecycle.ts +31 -26
  177. package/lib/task/artifact-name.ts +55 -0
  178. package/lib/task/artifact-operations.ts +22 -68
  179. package/lib/task/artifact-receipts.ts +3 -14
  180. package/lib/task/artifact-repair-intent.ts +99 -18
  181. package/lib/task/artifact-schema.ts +5 -34
  182. package/lib/task/capabilities.ts +13 -22
  183. package/lib/task/codex-orchestration.ts +85 -24
  184. package/lib/task/commit-identity.ts +31 -0
  185. package/lib/task/commit-operation.ts +2 -16
  186. package/lib/task/control-authority.ts +502 -5
  187. package/lib/task/control-recovery.ts +174 -0
  188. package/lib/task/create.ts +63 -8
  189. package/lib/task/decision-details.ts +3 -71
  190. package/lib/task/events.ts +131 -10
  191. package/lib/task/finalization-state.ts +11 -0
  192. package/lib/task/human-override.ts +3 -8
  193. package/lib/task/implementation-inputs.ts +3 -3
  194. package/lib/task/intermediate-cleanup.ts +455 -0
  195. package/lib/task/invalidation.ts +18 -62
  196. package/lib/task/ledger-intents.ts +7 -24
  197. package/lib/task/ledger.ts +1 -3
  198. package/lib/task/lifecycle.ts +17 -1
  199. package/lib/task/local-artifact-finalization.ts +148 -182
  200. package/lib/task/manual-validation-completion.ts +40 -0
  201. package/lib/task/manual-validation-evidence.ts +209 -0
  202. package/lib/task/manual-validation-receipt.ts +152 -0
  203. package/lib/task/manual-validation-shared.ts +50 -0
  204. package/lib/task/manual-validation-transaction.ts +304 -0
  205. package/lib/task/markdown.ts +70 -0
  206. package/lib/task/orchestration.ts +19 -19
  207. package/lib/task/qualification-audit.ts +22 -33
  208. package/lib/task/review-artifacts.ts +1 -20
  209. package/lib/task/review-command.ts +23 -0
  210. package/lib/task/review-finalization.ts +131 -259
  211. package/lib/task/review-fingerprint.ts +2 -2
  212. package/lib/task/sections.ts +33 -54
  213. package/lib/task/verification-engine.ts +110 -366
  214. package/lib/task/verification-types.ts +17 -0
  215. package/lib/task/verification.ts +1 -1
  216. package/lib/task/workflow-command.ts +18 -0
  217. package/lib/task/workflow-warning-intents.ts +0 -13
  218. package/lib/task/workflow-warnings.ts +21 -2
  219. package/lib/update.ts +6 -0
  220. package/package.json +6 -6
  221. package/templates/.agents/hooks/lifecycle-delegation.js +6 -6
  222. package/templates/.agents/rules/testing-discipline.en.md +2 -0
  223. package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -0
  224. package/templates/.agents/scripts/package.json +3 -0
  225. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +32 -20
  226. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +32 -20
  227. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  228. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  229. package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +2 -0
  230. package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +2 -0
  231. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +16 -7
  232. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +16 -7
  233. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  234. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  235. package/templates/.agents/skills/release/SKILL.en.md +7 -3
  236. package/templates/.agents/skills/release/SKILL.zh-CN.md +7 -3
  237. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +20 -3
  238. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +20 -3
  239. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +4 -1
  240. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +4 -1
  241. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -0
  242. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -0
  243. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  244. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  245. package/templates/.agents/skills/test/SKILL.en.md +17 -6
  246. package/templates/.agents/skills/test/SKILL.zh-CN.md +17 -6
  247. package/templates/.claude/commands/run-manual-validation.en.md +1 -1
  248. package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
  249. package/dist/lib/platform/adapters.js +0 -56
  250. package/lib/platform/adapters.ts +0 -197
@@ -1,3 +1,20 @@
1
+ import type fs from 'node:fs';
2
+
3
+ export type VerificationShared = {
4
+ repoRoot: string;
5
+ loadTask: (taskDir: string) => { ok: true; content: string; metadata: Record<string, string> } | { ok: false; message: string };
6
+ getCheckedRequirements: (content: string) => string[];
7
+ normalizeContent: (text: unknown) => string;
8
+ isBlank: (value: unknown) => boolean;
9
+ escapeRegExp: (value: string) => string;
10
+ passResult: (type: string, message: string, warnings?: string[]) => VerificationCheckResult;
11
+ failResult: (type: string, message: string, failType?: string) => VerificationCheckResult;
12
+ blockedResult: (type: string, message: string, failType?: string) => VerificationCheckResult;
13
+ safeStat: (filePath: string) => fs.Stats | null;
14
+ parseIssueNumber: (value: unknown) => number | null;
15
+ parsePrNumber: (value: unknown) => number | null;
16
+ };
17
+
1
18
  type VerificationStatus = 'pass' | 'fail' | 'blocked';
2
19
  type VerificationCheckResult = {
3
20
  type: string;
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  // checks are provided by typed domain modules without a stdout protocol.
4
4
  import { verifyInProcess } from './verification-engine.ts';
5
5
 
6
- import { parseArtifactName } from './artifact-lifecycle.ts';
6
+ import { parseArtifactName } from './artifact-name.ts';
7
7
  import type { ArtifactFamily } from './artifact-lifecycle.ts';
8
8
  import { resolveTaskRef } from './resolve-ref.ts';
9
9
  import type { TaskWorkspaceState } from './resolve-ref.ts';
@@ -0,0 +1,18 @@
1
+ export const TASK_WORKFLOW_COMMANDS = Object.freeze({
2
+ 'artifact-inspect': ['task-artifact', 'inspect'],
3
+ 'artifact-init': ['task-artifact', 'init'],
4
+ 'artifact-repair': ['task-artifact', 'repair'],
5
+ 'artifact-finalize-local': ['task-artifact', 'finalize-local'],
6
+ 'review-finalize-summary': ['task-review', 'finalize-summary'],
7
+ event: ['task-event', null],
8
+ 'ledger-finding-response': ['task-ledger', 'finding-respond'],
9
+ 'ledger-finding-review': ['task-ledger', 'finding-review'],
10
+ 'ledger-finding-upsert': ['task-ledger', 'finding-upsert'],
11
+ 'decision-next-id': ['task-ledger', 'decision-next-id'],
12
+ 'decision-upsert': ['task-ledger', 'decision-upsert'],
13
+ 'invalidation-reconcile': ['task-invalidation', 'reconcile'],
14
+ 'warning-add': ['task-warning', 'add']
15
+ } as const);
16
+ export type TaskWorkflowOperation = keyof typeof TASK_WORKFLOW_COMMANDS;
17
+ export const TASK_WORKFLOW_OPERATIONS = Object.freeze(Object.keys(TASK_WORKFLOW_COMMANDS) as TaskWorkflowOperation[]);
18
+ export type WorkflowCommand = typeof TASK_WORKFLOW_COMMANDS[TaskWorkflowOperation][0];
@@ -52,17 +52,6 @@ function nextWarningId(rows: readonly WorkflowWarning[]): string {
52
52
  return `WW-${max + 1}`;
53
53
  }
54
54
 
55
- function validateRows(rows: readonly WorkflowWarning[]): { code: string; message: string } | null {
56
- const ids = new Set<string>();
57
- for (const row of rows) {
58
- if (!/^WW-[1-9]\d*$/.test(row.id)) return { code: 'WARNING_ID_INVALID', message: `warning id '${row.id}' is invalid` };
59
- if (ids.has(row.id)) return { code: 'WARNING_DUPLICATE_ID', message: `duplicate warning id '${row.id}'` };
60
- ids.add(row.id);
61
- if (!WORKFLOW_WARNING_SEVERITIES.has(row.severity) || !WORKFLOW_WARNING_STATUSES.has(row.status)) return { code: 'WARNING_DOCUMENT_INVALID', message: `warning '${row.id}' has invalid severity or status` };
62
- }
63
- return null;
64
- }
65
-
66
55
  function sectionMutation(content: string): TaskMutation[] {
67
56
  if (/^##\s+(工作流告警|Workflow Warnings)\s*$/m.test(content)) return [];
68
57
  const english = /^##\s+Activity Log\s*$/m.test(content);
@@ -98,8 +87,6 @@ function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: Task
98
87
  const code = error && typeof error === 'object' && 'code' in error ? String(error.code) : 'WARNING_DOCUMENT_INVALID';
99
88
  return failed(intent, code, error instanceof Error ? error.message : String(error), resolved.taskId);
100
89
  }
101
- const invalid = validateRows(rows);
102
- if (invalid) return failed(intent, invalid.code, invalid.message, resolved.taskId);
103
90
  if (intent.kind === 'list') {
104
91
  if (intent.status && !WORKFLOW_WARNING_STATUSES.has(intent.status)) return failed(intent, 'WARNING_PAYLOAD_INVALID', 'warning status is invalid', resolved.taskId);
105
92
  const warnings = rows.filter((row) => !intent.status || row.status === intent.status);
@@ -4,6 +4,7 @@ const WORKFLOW_WARNING_HEADINGS = ['工作流告警', 'Workflow Warnings'];
4
4
  const WORKFLOW_WARNING_STATUSES = new Set(['open', 'resolved', 'ignored']);
5
5
  const WORKFLOW_WARNING_SEVERITIES = new Set(['IMPORTANT', 'ACTION_REQUIRED']);
6
6
  const WORKFLOW_WARNING_COLUMNS = ['id', 'time', 'step', 'severity', 'code', 'status', 'target', 'message', 'action', 'resolved_at', 'resolution'] as const;
7
+ const WARNING_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[+-]\d{2}:\d{2})?$/;
7
8
 
8
9
  type WorkflowWarning = {
9
10
  id: string;
@@ -19,14 +20,32 @@ type WorkflowWarning = {
19
20
  resolution: string;
20
21
  };
21
22
 
22
- /** Parses workflow warning rows and fails closed on malformed table structure. */
23
+ /** Parses warning structure and lifecycle fields using one contract for all readers. */
23
24
  function parseWorkflowWarnings(content: string): WorkflowWarning[] {
24
25
  const table = parseTable(content, { sectionAliases: WORKFLOW_WARNING_HEADINGS, columns: WORKFLOW_WARNING_COLUMNS });
25
- return table?.rows.map(({ values }) => ({
26
+ const warnings = table?.rows.map(({ values }) => ({
26
27
  id: values.id!, time: values.time!, step: values.step!, severity: values.severity!,
27
28
  code: values.code!, status: values.status!, target: values.target!, message: values.message!,
28
29
  action: values.action!, resolvedAt: values.resolved_at!, resolution: values.resolution!
29
30
  })) ?? [];
31
+ const errors: { code: string; message: string }[] = [];
32
+ const invalid = (message: string, code = 'WARNING_DOCUMENT_INVALID') => errors.push({ code, message });
33
+ for (const warning of warnings) {
34
+ const { id, time, severity, status, action, resolvedAt, resolution } = warning;
35
+ if (!/^WW-[1-9]\d*$/.test(id)) invalid(`${id || '(empty id)'}: invalid id`, 'WARNING_ID_INVALID');
36
+ if (!WARNING_TIME_PATTERN.test(time)) invalid(`${id}: invalid time '${time}'`);
37
+ for (const field of ['step', 'code', 'target', 'message'] as const) {
38
+ if (!warning[field].trim()) invalid(`${id}: ${field} is required`);
39
+ }
40
+ if (!WORKFLOW_WARNING_SEVERITIES.has(severity)) invalid(`${id}: illegal severity '${severity}'`);
41
+ if (!WORKFLOW_WARNING_STATUSES.has(status)) invalid(`${id}: illegal status '${status}'`);
42
+ if (status === 'open' && !action.trim()) invalid(`${id}: open warning requires action`);
43
+ if ((status === 'resolved' || status === 'ignored') && (!resolvedAt.trim() || !resolution.trim())) {
44
+ invalid(`${id}: ${status} warning requires resolved_at and resolution`);
45
+ }
46
+ }
47
+ if (errors.length) throw Object.assign(new Error(errors.map((error) => error.message).join('; ')), { code: errors[0]!.code });
48
+ return warnings;
30
49
  }
31
50
 
32
51
  function getOpenWorkflowWarnings(content: string): WorkflowWarning[] {
package/lib/update.ts CHANGED
@@ -119,6 +119,12 @@ async function cmdSync(): Promise<void> {
119
119
  replacements
120
120
  );
121
121
  ok('Updated .agents/scripts/lib/agent-infra-package.js');
122
+ renderFile(
123
+ path.join(templateDir, '.agents', 'scripts', 'package.json'),
124
+ path.join('.agents', 'scripts', 'package.json'),
125
+ replacements
126
+ );
127
+ ok('Updated .agents/scripts/package.json');
122
128
  const added = {
123
129
  managed: workflowPlan.projectAssets.registry.managed.filter(
124
130
  (entry) => !currentRegistry.managed.includes(entry)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,12 +26,13 @@
26
26
  "bin": {
27
27
  "agent-infra": "./dist/bin/cli.js",
28
28
  "ai": "./dist/bin/cli.js",
29
- "agent-infra-internal": "./dist/bin/internal-cli.js"
29
+ "agent-infra-internal": "./bin/internal-cli.sh"
30
30
  },
31
31
  "files": [
32
32
  "dist/",
33
33
  "!dist/**/*.map",
34
34
  "bin/cli.ts",
35
+ "bin/internal-cli.sh",
35
36
  "lib/",
36
37
  "runtime/",
37
38
  "templates/"
@@ -54,7 +55,7 @@
54
55
  "@clack/prompts": "1.7.0",
55
56
  "@larksuiteoapi/node-sdk": "^1.68.0",
56
57
  "cross-spawn": "^7.0.6",
57
- "fs-ext-extra-prebuilt": "2.2.13",
58
+ "fs-native-extensions": "1.5.1",
58
59
  "picocolors": "1.1.1",
59
60
  "semver": "^7.8.1",
60
61
  "smol-toml": "^1.6.1",
@@ -67,6 +68,8 @@
67
68
  "typecheck": "tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.jschecks.json --noEmit",
68
69
  "test:smoke": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\"",
69
70
  "test:smoke:fast": "node scripts/run-tests.js --skip-build \"tests/unit/**/*.test.ts\"",
71
+ "test:platform-smoke": "node scripts/run-tests.js \"tests/integration/platform-smoke/**/*.test.ts\"",
72
+ "test:platform-smoke:fast": "node scripts/run-tests.js --skip-build \"tests/integration/platform-smoke/**/*.test.ts\"",
70
73
  "test:core": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\" \"tests/integration/**/*.test.ts\"",
71
74
  "test:integration": "node scripts/run-tests.js \"tests/integration/**/*.test.ts\" \"tests/e2e/**/*.test.ts\"",
72
75
  "check": "npm run typecheck && npm test",
@@ -85,8 +88,5 @@
85
88
  },
86
89
  "overrides": {
87
90
  "axios": "1.18.1"
88
- },
89
- "allowScripts": {
90
- "fs-ext-extra-prebuilt@2.2.13": true
91
91
  }
92
92
  }
@@ -16,7 +16,7 @@ function internalCliInvocation(args) {
16
16
  return { command: 'agent-infra-internal', commandArgs: args, shell: process.platform === 'win32' };
17
17
  }
18
18
 
19
- function findCapabilityToken(value, depth = 0) {
19
+ function findCapabilityRef(value, depth = 0) {
20
20
  if (depth > 5 || value == null) return '';
21
21
  if (typeof value === 'string') {
22
22
  const match = /agent-infra-codex-capability:([A-Za-z0-9_-]{20,})/.exec(value);
@@ -24,14 +24,14 @@ function findCapabilityToken(value, depth = 0) {
24
24
  }
25
25
  if (Array.isArray(value)) {
26
26
  for (const entry of value) {
27
- const found = findCapabilityToken(entry, depth + 1);
27
+ const found = findCapabilityRef(entry, depth + 1);
28
28
  if (found) return found;
29
29
  }
30
30
  return '';
31
31
  }
32
32
  if (typeof value === 'object') {
33
33
  for (const entry of Object.values(value)) {
34
- const found = findCapabilityToken(entry, depth + 1);
34
+ const found = findCapabilityRef(entry, depth + 1);
35
35
  if (found) return found;
36
36
  }
37
37
  }
@@ -77,11 +77,11 @@ process.stdin.on('end', () => {
77
77
  process.exit(1);
78
78
  }
79
79
  const managedAgent = /^agent-infra-lifecycle-(executor|reviewer)$/.test(String(nativeAgent || ''));
80
- const capabilityToken = hook === 'post-tool' ? findCapabilityToken(toolResponse) : '';
80
+ const capabilityRef = hook === 'post-tool' ? findCapabilityRef(toolResponse) : '';
81
81
  const parentReconcile = hook === 'post-tool'
82
82
  && toolName === 'collaborationwait_agent'
83
83
  && toolResponse.timed_out !== true;
84
- if (!managedAgent && !parentReconcile && !capabilityToken) process.exit(0);
84
+ if (!managedAgent && !parentReconcile && !capabilityRef) process.exit(0);
85
85
  const hookDefinitionHash = createHash('sha256').update(readFileSync(codexHooks)).digest('hex');
86
86
  const normalized = {
87
87
  sessionId: String(event.session_id || ''),
@@ -96,7 +96,7 @@ process.stdin.on('end', () => {
96
96
  taskName: String(toolInput.task_name || ''),
97
97
  transcriptPath: String(event.transcript_path || '')
98
98
  };
99
- if (capabilityToken) normalized.capabilityToken = capabilityToken;
99
+ if (capabilityRef) normalized.capabilityRef = capabilityRef;
100
100
  const args = ['codex-lifecycle', 'hook-event', '--event', hook, '--bridge', 'true'];
101
101
  try {
102
102
  const { command, commandArgs, shell } = internalCliInvocation(args);
@@ -43,6 +43,8 @@ This mirrors "Goal-Driven Execution" in AGENTS.md: define a verifiable success c
43
43
 
44
44
  Complete each item below for this repository. Record the chosen behavior and its boundaries so contributors can select and validate tests consistently.
45
45
 
46
+ When a project uses a cross-platform smoke boundary, keep real CLI, git, shell, environment-forwarding, and process-lifecycle tests outside the unit tier. Document which operating systems execute that boundary and keep structural tier checks separate from line coverage.
47
+
46
48
  ### 1. Test commands
47
49
 
48
50
  > TODO: Document the complete test command and any faster commands used during development.
@@ -43,6 +43,8 @@ assert.match(content, /^name: code-task$/m); // 正向断言已足够
43
43
 
44
44
  请为本仓库填写以下各项,记录选定行为及其边界,以便贡献者一致地选择并验证测试。
45
45
 
46
+ 如果项目使用跨平台 smoke 边界,应将真实 CLI、git、shell、环境透传和进程生命周期测试放在 unit 层之外;记录该边界运行的操作系统,并将测试层级结构检查与代码行覆盖率分开。
47
+
46
48
  ### 1. 测试命令
47
49
 
48
50
  > TODO: 记录完整测试命令,以及开发期间使用的可选快速命令。
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -9,7 +9,7 @@ description: >
9
9
  # Complete Manual Validation
10
10
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
- Lifecycle events require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` or `validation-rerun`. Reuse the same values for started and completed.
12
+ The transaction coordinator appends lifecycle events and the final PR summary state. The maintainer's validation summary and PR manual-validation comment are the human-validation authority; the transaction receipt provides state-transition and recovery consistency.
13
13
 
14
14
 
15
15
  ## Boundary / Critical Rules
@@ -20,7 +20,7 @@ Before generating the validation completion report, read `.agents/rules/evidence
20
20
 
21
21
  - This skill closes the manual-validation status in an existing PR summary comment; it does not create a parallel ordinary validation comment.
22
22
  - It must write `manual-validation.md` or `manual-validation-r{N}.md` so later PR summary refreshes can reuse the validation result.
23
- - If the `sync-pr` summary comment is missing, fail instead of creating a partial fallback summary.
23
+ - If the `sync-pr` summary comment is missing, fail instead of creating a partial fallback summary; before the receipt, completion log, and final summary are all committed, the remote summary may only be pending/non-pass.
24
24
  - Before generating manual-validation artifact Markdown that will be synced to an Issue, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints; Issue sync remains transparent and does not parse or rewrite the body.
25
25
  - After this skill runs, update `task.md` immediately.
26
26
 
@@ -42,10 +42,6 @@ agent-infra-internal task-snapshot {task-id} --format text
42
42
 
43
43
  > Resolve the task reference, then confirm that the task is in a state or directory supported by this skill and that `task.md` exists; if it cannot be located, handle it as a missing task and stop.
44
44
 
45
- ## Step Start: Write the started Marker
46
-
47
- After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} manual-validation.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}` and record the returned `artifactContext`.
48
-
49
45
  ## Steps
50
46
 
51
47
  ### 1. Parse Arguments
@@ -70,33 +66,49 @@ Stop if the task is missing, the validation summary is missing, or no valid PR c
70
66
 
71
67
  ### 3. Resolve the Artifact Context
72
68
 
73
- Run `agent-infra-internal task-artifact {task-id} inspect --family manual-validation`. Continue only for `ready`; take the round and `{manual-validation-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. Then run the started event and verify the returned identity.
69
+ Run `agent-infra-internal task-artifact {task-id} inspect --family manual-validation`. Continue only for `ready`; take the round and `{manual-validation-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. The transaction coordinator owns the started event.
70
+
71
+ ### 4. Register Manual Validation Start
72
+
73
+ Before creating any manual-validation artifact, obtain the canonical summary body from `platform-pr summary-context`, then call the transaction coordinator in prepare mode:
74
74
 
75
- ### 4. Update the PR Summary
75
+ ```bash
76
+ agent-infra-internal manual-validation transaction {task-id} --prepare \
77
+ --artifact {manual-validation-artifact} \
78
+ --summary-file {summary-body-file} --agent {standard-agent-token}
79
+ ```
80
+
81
+ Prepare must idempotently record `manual-validation.started` before writing the prepared transaction; on failure, stop without creating the artifact.
82
+
83
+ ### 5. Create the Manual Validation Artifact
84
+
85
+ Before this step, read `reference/report-template.md`. After `started` is recorded, create `{manual-validation-artifact}` and record the state check, validation verdict, validation scope, validation details, and expected PR summary synchronization result; the transaction coordinator validates and commits this artifact in the next step.
86
+
87
+ ### 6. Update the PR Summary
76
88
 
77
89
  Before this step, read:
78
90
  - `.agents/rules/issue-sync.md`
79
91
  - `.agents/rules/pr-sync.md`
80
92
  - `reference/summary-update.md`
81
93
 
82
- Follow `reference/summary-update.md` to validate the PR binding, obtain canonical inputs from `platform-pr summary-context`, and update the manual-validation section through `platform-pr summary-sync` to `### ✅ Manual Validation Passed`.
94
+ Follow `reference/summary-update.md` to validate the PR binding, obtain canonical inputs from `platform-pr summary-context`, and call the transaction coordinator once:
83
95
 
84
- ### 5. Create the Manual Validation Artifact
96
+ ```bash
97
+ agent-infra-internal manual-validation transaction {task-id} \
98
+ --artifact {manual-validation-artifact} \
99
+ --summary-file {summary-body-file} --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
100
+ --agent {standard-agent-token} --result no_op
101
+ ```
85
102
 
86
- Before this step, read `reference/report-template.md`. Create `{manual-validation-artifact}` and record:
87
- - State check
88
- - Validation verdict
89
- - Validation scope
90
- - Validation details
91
- - PR summary sync result
103
+ The coordinator owns pending summary, receipt, completion log, final promotion, and post-write verification; it internally uses the controlled `agent-infra-internal task-event {task-id}` route. Do not call final `summary-sync` or `manual-validation.completed` separately. Raw evidence files from other hosts are not required.
92
104
 
93
- ### 6. Update task.md
105
+ ### 7. Update task.md
94
106
 
95
- Run `agent-infra-internal task-event {task-id} manual-validation.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {manual-validation-artifact} --summary-result "{summary-result}"`. The core keeps `current_step` unchanged while atomically recording the implementation-notes link, metadata, and done log.
107
+ After the transaction coordinator succeeds, the core has atomically recorded `manual-validation.completed` with the same transaction/receipt/head identity. Do not append the Activity Log manually.
96
108
 
97
109
  If the task has a valid `issue_number`, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`, then `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {manual-validation-artifact} --agent {standard-agent-token}`.
98
110
 
99
- ### 7. Verification Gate
111
+ ### 8. Verification Gate
100
112
 
101
113
  Run:
102
114
 
@@ -109,7 +121,7 @@ Handle the result:
109
121
  - Exit code 1 -> fix the reported problem and rerun
110
122
  - Exit code 2 -> stop and report that manual intervention is required
111
123
 
112
- ### 8. Tell the User
124
+ ### 9. Tell the User
113
125
 
114
126
  Report:
115
127
  - Artifact path
@@ -9,7 +9,7 @@ description: >
9
9
  # 完成人工验证
10
10
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
- 生命周期事件必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request` 或 `validation-rerun`;started 与 completed 使用同一组值。
12
+ 事务协调器统一追加 lifecycle 事件和 PR 摘要最终状态。维护者提供的验证说明和 PR 摘要留言就是人工验证依据;事务回执负责保证状态转换和恢复一致性。
13
13
 
14
14
 
15
15
  ## 行为边界 / 关键规则
@@ -20,7 +20,7 @@ description: >
20
20
 
21
21
  - 本技能用于收尾已有 PR 摘要评论中的人工校验状态,不创建并行的普通验证留言。
22
22
  - 必须写入 `manual-validation.md` 或 `manual-validation-r{N}.md`,让后续 PR 摘要刷新可复用人工验证结果。
23
- - 找不到 `sync-pr` 摘要评论时失败,不创建部分摘要兜底。
23
+ - 找不到 `sync-pr` 摘要评论时失败,不创建部分摘要兜底;receipt、通过日志和 final summary 未全部提交前,远端只允许 pending/non-pass 状态。
24
24
  - 生成会同步到 Issue 的人工验证 artifact Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;Issue 同步保持透明,不解析或改写正文。
25
25
  - 执行本技能后必须立即更新 `task.md`。
26
26
 
@@ -42,10 +42,6 @@ agent-infra-internal task-snapshot {task-id} --format text
42
42
 
43
43
  > 解析任务引用,并确认任务位于本技能支持的状态或目录且存在 `task.md`;无法定位时按未找到任务处理并停止。
44
44
 
45
- ## 步骤开始:声明 started 事件
46
-
47
- 确认前置条件和产物上下文后、本轮第一个产出动作之前执行 `agent-infra-internal task-event {task-id} manual-validation.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}`,并以返回的 `artifactContext` 记录本轮身份。
48
-
49
45
  ## 执行步骤
50
46
 
51
47
  ### 1. 解析入参
@@ -70,33 +66,49 @@ complete-manual-validation [--task <ref> | -t <ref>] [{pr-ref}] {verification-su
70
66
 
71
67
  ### 3. 解析产物上下文
72
68
 
73
- 运行 `agent-infra-internal task-artifact {task-id} inspect --family manual-validation`。仅当结果为 `ready` 时继续;从 `next.round` / `next.name` 取得本轮 round 与 `{manual-validation-artifact}`。不得自行扫描轮次或拼装文件名。随后执行 started 事件并复核返回身份。
69
+ 运行 `agent-infra-internal task-artifact {task-id} inspect --family manual-validation`。仅当结果为 `ready` 时继续;从 `next.round` / `next.name` 取得本轮 round 与 `{manual-validation-artifact}`。不得自行扫描轮次或拼装文件名。事务协调器负责 started 事件。
70
+
71
+ ### 4. 登记人工验证开始
72
+
73
+ 在创建任何人工验证 artifact 前,先从 `platform-pr summary-context` 取得 canonical 摘要正文,然后调用事务协调器的 prepare 模式:
74
74
 
75
- ### 4. 更新 PR 摘要
75
+ ```bash
76
+ agent-infra-internal manual-validation transaction {task-id} --prepare \
77
+ --artifact {manual-validation-artifact} \
78
+ --summary-file {summary-body-file} --agent {standard-agent-token}
79
+ ```
80
+
81
+ prepare 必须先幂等登记 `manual-validation.started`,再写入 prepared transaction;失败时停止,不创建 artifact。
82
+
83
+ ### 5. 创建人工验证产物
84
+
85
+ 执行此步骤前,先读取 `reference/report-template.md`。在 started 已登记后创建 `{manual-validation-artifact}`,记录状态核对、验证结论、验证范围、验证详情和预期 PR 摘要同步结果;事务协调器将在后续步骤校验并提交这份 artifact。
86
+
87
+ ### 6. 更新 PR 摘要
76
88
 
77
89
  执行此步骤前,先读取:
78
90
  - `.agents/rules/issue-sync.md`
79
91
  - `.agents/rules/pr-sync.md`
80
92
  - `reference/summary-update.md`
81
93
 
82
- 按 `reference/summary-update.md` 校验 PR 绑定,从 `platform-pr summary-context` 取得 canonical 输入,并通过 `platform-pr summary-sync` 把人工校验段更新为 `### ✅ 人工验证已通过`。
94
+ 按 `reference/summary-update.md` 校验 PR 绑定,从 `platform-pr summary-context` 取得 canonical 输入,并调用一次 transaction coordinator:
83
95
 
84
- ### 5. 创建人工验证产物
96
+ ```bash
97
+ agent-infra-internal manual-validation transaction {task-id} \
98
+ --artifact {manual-validation-artifact} \
99
+ --summary-file {summary-body-file} --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
100
+ --agent {standard-agent-token} --result no_op
101
+ ```
85
102
 
86
- 执行此步骤前,先读取 `reference/report-template.md`。创建 `{manual-validation-artifact}`,记录:
87
- - 状态核对
88
- - 验证结论
89
- - 验证范围
90
- - 验证详情
91
- - PR 摘要同步结果
103
+ coordinator 负责 pending summary、receipt、通过日志、final promotion 和 post-write verification;内部受控调用 `agent-infra-internal task-event {task-id}`,不要分别调用 final `summary-sync` 或 `manual-validation.completed`。不要求调用方提供其他主机上的原始 evidence 文件。
92
104
 
93
- ### 6. 更新 task.md
105
+ ### 7. 更新 task.md
94
106
 
95
- 执行 `agent-infra-internal task-event {task-id} manual-validation.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {manual-validation-artifact} --summary-result "{summary-result}"`,由核心在保持 `current_step` 不变的同时原子登记实现备注链接、时间/版本和完成日志。
107
+ transaction coordinator 成功后,核心已使用同一 transaction/receipt/head identity 原子登记 `manual-validation.completed`;不要手工补写 Activity Log。
96
108
 
97
109
  如任务存在有效 `issue_number`,调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`,再调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {manual-validation-artifact} --agent {standard-agent-token}`。
98
110
 
99
- ### 7. 完成校验
111
+ ### 8. 完成校验
100
112
 
101
113
  运行完成校验:
102
114
 
@@ -109,7 +121,7 @@ agent-infra-internal task-verify {task-id} manual-validation.completed --artifac
109
121
  - 退出码 1 -> 修复问题后重新运行
110
122
  - 退出码 2 -> 停止并告知需要人工介入
111
123
 
112
- ### 8. 告知用户
124
+ ### 9. 告知用户
113
125
 
114
126
  输出:
115
127
  - 产物路径
@@ -37,7 +37,7 @@
37
37
  "when": "pr_fact_bound",
38
38
  "expected_pr_comment_marker_key": "prSummary",
39
39
  "expected_pr_comment_required_patterns": [
40
- "^### ✅ Manual Validation Passed$"
40
+ "^### ✅ (?:人工验证已通过|Manual Validation Passed)$"
41
41
  ],
42
42
  "verify_task_comment_content": true,
43
43
  "verify_issue_type": true,
@@ -37,7 +37,7 @@
37
37
  "when": "pr_fact_bound",
38
38
  "expected_pr_comment_marker_key": "prSummary",
39
39
  "expected_pr_comment_required_patterns": [
40
- "^### ✅ 人工验证已通过$"
40
+ "^### ✅ (?:人工验证已通过|Manual Validation Passed)$"
41
41
  ],
42
42
  "verify_task_comment_content": true,
43
43
  "verify_issue_type": true,
@@ -7,6 +7,7 @@ Read this file before creating `manual-validation.md` / `manual-validation-r{N}.
7
7
 
8
8
  - **Validation Round**: Round {N}
9
9
  - **Artifact File**: `manual-validation.md`
10
+ - **Human Validation Basis**: Maintainer's PR validation comment and validation summary
10
11
 
11
12
  ## State Check
12
13
 
@@ -39,6 +40,7 @@ $ tail .agents/workspace/active/{task-id}/task.md
39
40
  - Result: {summary-result}
40
41
  - Summary comment: {comment-id or URL}
41
42
  - Updated status: `### ✅ Manual Validation Passed`
43
+ - Transaction: `{transaction-id}`; receipt=`{receipt-digest}`; head=`{pr-head-sha}`
42
44
  ````
43
45
 
44
46
  ## Filling Rules
@@ -7,6 +7,7 @@
7
7
 
8
8
  - **验证轮次**:Round {N}
9
9
  - **产物文件**:`manual-validation.md`
10
+ - **人工验证依据**:维护者提供的 PR 验证留言和验证说明
10
11
 
11
12
  ## 状态核对
12
13
 
@@ -39,6 +40,7 @@ $ tail .agents/workspace/active/{task-id}/task.md
39
40
  - 结果:{summary-result}
40
41
  - 摘要评论:{comment-id 或 URL}
41
42
  - 更新状态:`### ✅ 人工验证已通过`
43
+ - Transaction:`{transaction-id}`;receipt=`{receipt-digest}`;head=`{pr-head-sha}`
42
44
  ````
43
45
 
44
46
  ## 填写规则
@@ -4,14 +4,23 @@ Run only for a valid `{task-id}` whose task.md binds a verified `pr_delivery_fac
4
4
 
5
5
  Follow `.agents/rules/pr-sync.md` for the shared summary structure and failure semantics.
6
6
 
7
- 1. After the canonical `manual-validation*` artifact is written, run `agent-infra-internal platform-pr summary-context {task-id}`.
8
- 2. Rebuild the summary from canonical inputs and render `### ✅ Manual Validation Passed` with the validation time and explanation.
9
- 3. Write the plain body with exactly one `<!-- canonical-pr-change-report -->` placeholder to a temporary file and run:
7
+ 1. Run `agent-infra-internal platform-pr summary-context {task-id}` to obtain the canonical summary body; the maintainer's PR validation comment and validation summary are the human-validation authority.
8
+ 2. Before creating the canonical `manual-validation*` artifact, call the transaction coordinator in prepare mode to record `started` before writing the prepared transaction:
10
9
 
11
10
  ```bash
12
- agent-infra-internal platform-pr summary-sync {task-id} \
13
- --agent {standard-agent-token} --body-file {summary-body-file} \
14
- --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result no_op
11
+ agent-infra-internal manual-validation transaction {task-id} --prepare \
12
+ --artifact {manual-validation-artifact} \
13
+ --summary-file {summary-body-file} --agent {standard-agent-token}
15
14
  ```
16
15
 
17
- The core owns the rendered report, marker/authoritative PR-head wrapping, pagination, and in-place reconciliation. If context says no manual validation is required, stop without marking it passed.
16
+ 3. After prepare succeeds, write the canonical `manual-validation*` artifact, write the pending plain body with exactly one `<!-- canonical-pr-change-report -->` placeholder to a temporary file, and run the transaction coordinator:
17
+
18
+ ```bash
19
+ agent-infra-internal manual-validation transaction {task-id} \
20
+ --artifact {manual-validation-artifact} \
21
+ --summary-file {summary-body-file} \
22
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
23
+ --agent {standard-agent-token} --result no_op
24
+ ```
25
+
26
+ The core owns the rendered report, marker/authoritative PR-head wrapping, pagination, pending-first ordering, receipt, completion log, final promotion, and in-place reconciliation. Before the receipt and completion log exist, the summary must not contain `### ✅ Manual Validation Passed`. If context says no manual validation is required, stop without marking it passed.
@@ -4,16 +4,25 @@
4
4
 
5
5
  摘要结构与失败语义统一遵循 `.agents/rules/pr-sync.md`。
6
6
 
7
- 1. 在 canonical `manual-validation*` artifact 落盘后,调用 `agent-infra-internal platform-pr summary-context {task-id}`。
8
- 2. 从返回的最新产物重新聚合摘要,将人工校验段渲染为 `### ✅ 人工验证已通过`,写明验证时间和说明。
9
- 3. 把只含一次 `<!-- canonical-pr-change-report -->` 的纯正文写入临时文件,调用:
7
+ 1. 调用 `agent-infra-internal platform-pr summary-context {task-id}`,取得 canonical 摘要正文;维护者提供的 PR 人工验证留言和验证说明作为完成人工校验依据。
8
+ 2. 在创建 canonical `manual-validation*` artifact 前,调用 transaction coordinator 的 prepare 模式,先登记 started,再写 prepared transaction:
10
9
 
11
10
  ```bash
12
- agent-infra-internal platform-pr summary-sync {task-id} \
13
- --agent {standard-agent-token} --body-file {summary-body-file} \
14
- --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json --result no_op
11
+ agent-infra-internal manual-validation transaction {task-id} --prepare \
12
+ --artifact {manual-validation-artifact} \
13
+ --summary-file {summary-body-file} --agent {standard-agent-token}
15
14
  ```
16
15
 
17
- marker、报告段、权威 PR head、分页查找和原地更新由 core 负责。若当前 context 表明无需人工校验,则停止并返回 `summary failed: no manual validation required`,不误标通过。
16
+ 3. prepare 成功后写入 canonical `manual-validation*` artifact,并把只含一次 `<!-- canonical-pr-change-report -->` 的 pending 正文写入临时文件,调用 transaction coordinator:
17
+
18
+ ```bash
19
+ agent-infra-internal manual-validation transaction {task-id} \
20
+ --artifact {manual-validation-artifact} \
21
+ --summary-file {summary-body-file} \
22
+ --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
23
+ --agent {standard-agent-token} --result no_op
24
+ ```
25
+
26
+ marker、报告段、权威 PR head、分页查找、pending-first 顺序、receipt、通过日志和 final promotion 由 core 负责。若当前 context 表明无需人工校验,则停止并返回 `summary failed: no manual validation required`,不误标通过。receipt/log 前不得出现 `### ✅ 人工验证已通过`。
18
27
 
19
28
  结果回传:`summary updated`、`summary skipped (no diff)` 或 `summary failed: <reason>`。
@@ -104,7 +104,7 @@ Run /create-pr --task {task-ref} first, then complete; --skip-pr is not accepted
104
104
  Before lifecycle, verify only the hard gates:
105
105
  - [ ] Task identity, active state, concurrency locks, and local atomic lifecycle operations are available
106
106
  - [ ] Required-PR delivery is satisfied when `prFlow=required`
107
- - [ ] Other business evidence (workflow, review, commit, tests, disagreement ledger, manual validation, and platform sync) is recorded or can be checked after lifecycle
107
+ - [ ] Other business evidence (workflow, review, commit, tests, disagreement ledger, manual validation, and platform sync) is recorded or can be checked after lifecycle; manual validation requires a committed transaction, receipt, current artifact digest, and an identity-bearing completion log
108
108
 
109
109
  > **⚠️ Prerequisite Branch Check — you must decide whether to continue or stop before proceeding:**
110
110
  >
@@ -103,7 +103,7 @@ agent-infra-internal platform-pr resolve-external {task-id} --agent {standard-ag
103
103
  生命周期前只验证硬门禁:
104
104
  - [ ] task 身份、active 状态、并发锁和本地原子生命周期操作可用
105
105
  - [ ] `prFlow=required` 时已满足 required-PR delivery
106
- - [ ] 其余业务证据(工作流、审查、提交、测试、分歧账本、人工校验和平台同步)已记录或可在生命周期后校验
106
+ - [ ] 其余业务证据(工作流、审查、提交、测试、分歧账本、人工校验和平台同步)已记录或可在生命周期后校验;人工验证只能由 committed transaction、receipt、当前 artifact 摘要和带 identity 的通过日志满足
107
107
 
108
108
  > **⚠️ 前置条件分支判断 — 你必须先判断“继续”还是“停止”:**
109
109
  >