@fitlab-ai/agent-infra 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +17 -8
  2. package/README.zh-CN.md +17 -8
  3. package/dist/bin/internal-cli.js +1 -1
  4. package/dist/lib/internal/cli-route-inventory.js +1 -1
  5. package/dist/lib/internal/task-artifact.js +1 -1
  6. package/dist/lib/internal/task-finalization.js +41 -1
  7. package/dist/lib/internal/task-ledger.js +13 -5
  8. package/dist/lib/internal/task-operation-registry.js +1 -0
  9. package/dist/lib/platform/completion-backfill.js +63 -17
  10. package/dist/lib/sandbox/control/server.js +26 -143
  11. package/dist/lib/sandbox/task-cleanup.js +13 -20
  12. package/dist/lib/task/artifact-command.js +11 -4
  13. package/dist/lib/task/artifact-lifecycle.js +217 -85
  14. package/dist/lib/task/artifact-operations.js +1 -26
  15. package/dist/lib/task/artifact-receipts.js +4 -1
  16. package/dist/lib/task/artifact-schema.js +1 -0
  17. package/dist/lib/task/artifact-selection.js +25 -0
  18. package/dist/lib/task/capabilities.js +158 -39
  19. package/dist/lib/task/commands/status.js +9 -2
  20. package/dist/lib/task/control-authority.js +3 -2
  21. package/dist/lib/task/decision-intents.js +12 -0
  22. package/dist/lib/task/delivery.js +1 -43
  23. package/dist/lib/task/events.js +80 -64
  24. package/dist/lib/task/finalization.js +301 -143
  25. package/dist/lib/task/ledger-intents.js +157 -15
  26. package/dist/lib/task/lifecycle-path.js +75 -0
  27. package/dist/lib/task/lifecycle.js +10 -0
  28. package/dist/lib/task/local-artifact-finalization.js +1 -20
  29. package/dist/lib/task/orchestration.js +17 -7
  30. package/dist/lib/task/review-finalization.js +3 -16
  31. package/dist/lib/task/rework-intent.js +70 -4
  32. package/dist/lib/task/verification-engine.js +20 -30
  33. package/dist/lib/task/verification.js +1 -0
  34. package/dist/lib/task/workflow-warning-intents.js +21 -6
  35. package/dist/lib/task/workspace-snapshot.js +7 -2
  36. package/dist/lifecycle-build-manifest.json +3 -3
  37. package/lib/internal/cli-route-inventory.ts +1 -1
  38. package/lib/internal/task-artifact.ts +1 -1
  39. package/lib/internal/task-finalization.ts +40 -1
  40. package/lib/internal/task-ledger.ts +12 -5
  41. package/lib/internal/task-operation-registry.ts +1 -0
  42. package/lib/platform/completion-backfill.ts +78 -16
  43. package/lib/sandbox/control/server.ts +21 -146
  44. package/lib/sandbox/task-cleanup.ts +12 -20
  45. package/lib/task/artifact-command.ts +14 -4
  46. package/lib/task/artifact-lifecycle.ts +236 -85
  47. package/lib/task/artifact-operations.ts +1 -26
  48. package/lib/task/artifact-receipts.ts +4 -1
  49. package/lib/task/artifact-schema.ts +1 -0
  50. package/lib/task/artifact-selection.ts +53 -0
  51. package/lib/task/capabilities.ts +154 -40
  52. package/lib/task/commands/status.ts +11 -2
  53. package/lib/task/control-authority.ts +3 -1
  54. package/lib/task/decision-intents.ts +9 -0
  55. package/lib/task/delivery.ts +1 -40
  56. package/lib/task/events.ts +82 -64
  57. package/lib/task/finalization.ts +269 -111
  58. package/lib/task/ledger-intents.ts +155 -15
  59. package/lib/task/lifecycle-path.ts +98 -0
  60. package/lib/task/lifecycle.ts +13 -0
  61. package/lib/task/local-artifact-finalization.ts +2 -25
  62. package/lib/task/orchestration.ts +26 -8
  63. package/lib/task/review-finalization.ts +3 -16
  64. package/lib/task/rework-intent.ts +75 -5
  65. package/lib/task/verification-engine.ts +19 -30
  66. package/lib/task/verification.ts +2 -1
  67. package/lib/task/workflow-warning-intents.ts +18 -6
  68. package/lib/task/workspace-snapshot.ts +3 -2
  69. package/package.json +1 -1
  70. package/templates/.agents/rules/review-handshake.en.md +4 -4
  71. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
  72. package/templates/.agents/skills/analyze-task/SKILL.en.md +11 -4
  73. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -4
  74. package/templates/.agents/skills/code-task/SKILL.en.md +14 -8
  75. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +18 -13
  76. package/templates/.agents/skills/code-task/reference/code-rules.en.md +2 -2
  77. package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +2 -2
  78. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +4 -4
  79. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +4 -4
  80. package/templates/.agents/skills/code-task/reference/report-template.en.md +1 -1
  81. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +1 -1
  82. package/templates/.agents/skills/complete-task/SKILL.en.md +2 -2
  83. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +2 -2
  84. package/templates/.agents/skills/plan-task/SKILL.en.md +13 -10
  85. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +13 -10
  86. package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -1
  87. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -1
  88. package/templates/.agents/skills/review-code/SKILL.en.md +5 -1
  89. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -1
  90. package/templates/.agents/skills/review-plan/SKILL.en.md +5 -1
  91. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -1
  92. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +18 -2
  93. package/templates/.agents/templates/task.en.md +2 -2
  94. package/templates/.agents/templates/task.zh-CN.md +2 -2
  95. package/templates/.agents/workflows/bug-fix.en.yaml +11 -6
  96. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +11 -6
  97. package/templates/.agents/workflows/feature-development.en.yaml +11 -6
  98. package/templates/.agents/workflows/feature-development.zh-CN.yaml +11 -6
  99. package/templates/.agents/workflows/refactoring.en.yaml +11 -6
  100. package/templates/.agents/workflows/refactoring.zh-CN.yaml +11 -6
  101. package/dist/lib/sandbox/control/finalization-response.js +0 -33
  102. package/lib/sandbox/control/finalization-response.ts +0 -35
@@ -9,6 +9,11 @@
9
9
  name: bug-fix
10
10
  description: Workflow for diagnosing and fixing a defect.
11
11
 
12
+ lifecycle_paths:
13
+ streamlined: [analysis, code, code-review]
14
+ standard: [analysis, design, code, code-review]
15
+ full: [analysis, analysis-review, design, design-review, code, code-review]
16
+
12
17
  steps:
13
18
  - name: analysis
14
19
  description: Reproduce the defect, identify the root cause, and define the fix scope.
@@ -29,7 +34,7 @@ steps:
29
34
  outputs:
30
35
  - name: analysis
31
36
  pattern: "analysis.md | analysis-r{N}.md"
32
- rule: "Scan existing analysis artifacts; create analysis.md for round 1 and analysis-r{N}.md for later revisions (N = current highest round + 1)"
37
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
33
38
  outputs:
34
39
  - Root-cause analysis
35
40
  - Affected files list
@@ -56,7 +61,7 @@ steps:
56
61
  outputs:
57
62
  - name: review-analysis
58
63
  pattern: "review-analysis.md | review-analysis-r{N}.md"
59
- rule: "Scan existing requirement-analysis review artifacts; create review-analysis.md for round 1 and review-analysis-r{N}.md for later rounds (N = current highest round + 1)"
64
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
60
65
  outputs:
61
66
  - Requirement analysis review report
62
67
  - Findings to fix, if any
@@ -84,7 +89,7 @@ steps:
84
89
  outputs:
85
90
  - name: plan
86
91
  pattern: "plan.md | plan-r{N}.md"
87
- rule: "Scan existing plan artifacts; create plan.md for round 1 and plan-r{N}.md for later revisions (N = current highest round + 1)"
92
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
88
93
  outputs:
89
94
  - Fix plan
90
95
  - Regression test list
@@ -110,7 +115,7 @@ steps:
110
115
  outputs:
111
116
  - name: review-plan
112
117
  pattern: "review-plan.md | review-plan-r{N}.md"
113
- rule: "Scan existing plan review artifacts; create review-plan.md for round 1 and review-plan-r{N}.md for later rounds (N = current highest round + 1)"
118
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
114
119
  outputs:
115
120
  - Plan review report
116
121
  - Findings to fix, if any
@@ -146,7 +151,7 @@ steps:
146
151
  outputs:
147
152
  - name: code
148
153
  pattern: "code.md | code-r{N}.md"
149
- rule: "Scan existing code artifacts; create code.md for round 1 and code-r{N}.md for later fixes or reimplementation (N = current highest round + 1)"
154
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
150
155
  outputs:
151
156
  - Bug-fix branch with implementation or fixes
152
157
  - Regression test files
@@ -173,7 +178,7 @@ steps:
173
178
  outputs:
174
179
  - name: review-code
175
180
  pattern: "review-code.md | review-code-r{N}.md"
176
- rule: "Scan existing code review artifacts; create review-code.md for round 1 and review-code-r{N}.md for later rounds (N = current highest round + 1)"
181
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
177
182
  outputs:
178
183
  - Code review report
179
184
  - Findings list, if any
@@ -8,6 +8,11 @@
8
8
  name: bug-fix
9
9
  description: 诊断和修复缺陷的工作流。
10
10
 
11
+ lifecycle_paths:
12
+ streamlined: [analysis, code, code-review]
13
+ standard: [analysis, design, code, code-review]
14
+ full: [analysis, analysis-review, design, design-review, code, code-review]
15
+
11
16
  steps:
12
17
  - name: analysis
13
18
  description: 复现缺陷,识别根本原因,确定修复范围。
@@ -28,7 +33,7 @@ steps:
28
33
  outputs:
29
34
  - name: analysis
30
35
  pattern: "analysis.md | analysis-r{N}.md"
31
- rule: "扫描现有分析产物;首轮创建 analysis.md,后续修订创建 analysis-r{N}.md(N = 当前最高轮次 + 1)"
36
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
32
37
  outputs:
33
38
  - 根因分析
34
39
  - 受影响文件列表
@@ -55,7 +60,7 @@ steps:
55
60
  outputs:
56
61
  - name: review-analysis
57
62
  pattern: "review-analysis.md | review-analysis-r{N}.md"
58
- rule: "扫描现有需求分析审查产物;首轮创建 review-analysis.md,后续轮次创建 review-analysis-r{N}.md(N = 当前最高轮次 + 1)"
63
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
59
64
  outputs:
60
65
  - 需求分析审查报告
61
66
  - 待修正问题列表(如有)
@@ -83,7 +88,7 @@ steps:
83
88
  outputs:
84
89
  - name: plan
85
90
  pattern: "plan.md | plan-r{N}.md"
86
- rule: "扫描现有方案产物;首轮创建 plan.md,后续修订创建 plan-r{N}.md(N = 当前最高轮次 + 1)"
91
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
87
92
  outputs:
88
93
  - 任务文件中记录的修复方案
89
94
  - 待添加的测试用例列表
@@ -109,7 +114,7 @@ steps:
109
114
  outputs:
110
115
  - name: review-plan
111
116
  pattern: "review-plan.md | review-plan-r{N}.md"
112
- rule: "扫描现有方案审查产物;首轮创建 review-plan.md,后续轮次创建 review-plan-r{N}.md(N = 当前最高轮次 + 1)"
117
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
113
118
  outputs:
114
119
  - 技术方案审查报告
115
120
  - 待修正问题列表(如有)
@@ -145,7 +150,7 @@ steps:
145
150
  outputs:
146
151
  - name: code
147
152
  pattern: "code.md | code-r{N}.md"
148
- rule: "扫描现有实现产物;首轮创建 code.md,后续修复或重实现创建 code-r{N}.md(N = 当前最高轮次 + 1)"
153
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
149
154
  outputs:
150
155
  - 包含实现或修复的缺陷修复分支
151
156
  - 回归测试文件
@@ -172,7 +177,7 @@ steps:
172
177
  outputs:
173
178
  - name: review-code
174
179
  pattern: "review-code.md | review-code-r{N}.md"
175
- rule: "扫描现有代码审查产物;首轮创建 review-code.md,后续轮次创建 review-code-r{N}.md(N = 当前最高轮次 + 1)"
180
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
176
181
  outputs:
177
182
  - 代码审查报告
178
183
  - 问题列表(如有)
@@ -9,6 +9,11 @@
9
9
  name: feature-development
10
10
  description: End-to-end workflow for developing a new feature.
11
11
 
12
+ lifecycle_paths:
13
+ streamlined: [analysis, code, code-review]
14
+ standard: [analysis, design, code, code-review]
15
+ full: [analysis, analysis-review, design, design-review, code, code-review]
16
+
12
17
  steps:
13
18
  - name: analysis
14
19
  description: Analyze feature requirements, explore the codebase, and identify affected areas.
@@ -27,7 +32,7 @@ steps:
27
32
  outputs:
28
33
  - name: analysis
29
34
  pattern: "analysis.md | analysis-r{N}.md"
30
- rule: "Scan existing analysis artifacts; create analysis.md for round 1 and analysis-r{N}.md for later revisions (N = current highest round + 1)"
35
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
31
36
  outputs:
32
37
  - Requirement analysis report
33
38
  - Affected files list
@@ -54,7 +59,7 @@ steps:
54
59
  outputs:
55
60
  - name: review-analysis
56
61
  pattern: "review-analysis.md | review-analysis-r{N}.md"
57
- rule: "Scan existing requirement-analysis review artifacts; create review-analysis.md for round 1 and review-analysis-r{N}.md for later rounds (N = current highest round + 1)"
62
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
58
63
  outputs:
59
64
  - Requirement analysis review report
60
65
  - Findings to fix, if any
@@ -83,7 +88,7 @@ steps:
83
88
  outputs:
84
89
  - name: plan
85
90
  pattern: "plan.md | plan-r{N}.md"
86
- rule: "Scan existing plan artifacts; create plan.md for round 1 and plan-r{N}.md for later revisions (N = current highest round + 1)"
91
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
87
92
  outputs:
88
93
  - Technical plan
89
94
  - Interface definitions
@@ -110,7 +115,7 @@ steps:
110
115
  outputs:
111
116
  - name: review-plan
112
117
  pattern: "review-plan.md | review-plan-r{N}.md"
113
- rule: "Scan existing plan review artifacts; create review-plan.md for round 1 and review-plan-r{N}.md for later rounds (N = current highest round + 1)"
118
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
114
119
  outputs:
115
120
  - Plan review report
116
121
  - Findings to fix, if any
@@ -146,7 +151,7 @@ steps:
146
151
  outputs:
147
152
  - name: code
148
153
  pattern: "code.md | code-r{N}.md"
149
- rule: "Scan existing code artifacts; create code.md for round 1 and code-r{N}.md for later fixes or reimplementation (N = current highest round + 1)"
154
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
150
155
  outputs:
151
156
  - Feature branch with implementation or fixes
152
157
  - Test files
@@ -173,7 +178,7 @@ steps:
173
178
  outputs:
174
179
  - name: review-code
175
180
  pattern: "review-code.md | review-code-r{N}.md"
176
- rule: "Scan existing code review artifacts; create review-code.md for round 1 and review-code-r{N}.md for later rounds (N = current highest round + 1)"
181
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
177
182
  outputs:
178
183
  - Code review report
179
184
  - Findings to fix
@@ -8,6 +8,11 @@
8
8
  name: feature-development
9
9
  description: 开发新功能的端到端工作流。
10
10
 
11
+ lifecycle_paths:
12
+ streamlined: [analysis, code, code-review]
13
+ standard: [analysis, design, code, code-review]
14
+ full: [analysis, analysis-review, design, design-review, code, code-review]
15
+
11
16
  steps:
12
17
  - name: analysis
13
18
  description: 分析功能需求,探索代码库,识别受影响的区域。
@@ -26,7 +31,7 @@ steps:
26
31
  outputs:
27
32
  - name: analysis
28
33
  pattern: "analysis.md | analysis-r{N}.md"
29
- rule: "扫描现有分析产物;首轮创建 analysis.md,后续修订创建 analysis-r{N}.md(N = 当前最高轮次 + 1)"
34
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
30
35
  outputs:
31
36
  - 需求分析报告
32
37
  - 受影响文件列表
@@ -53,7 +58,7 @@ steps:
53
58
  outputs:
54
59
  - name: review-analysis
55
60
  pattern: "review-analysis.md | review-analysis-r{N}.md"
56
- rule: "扫描现有需求分析审查产物;首轮创建 review-analysis.md,后续轮次创建 review-analysis-r{N}.md(N = 当前最高轮次 + 1)"
61
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
57
62
  outputs:
58
63
  - 需求分析审查报告
59
64
  - 待修正问题列表(如有)
@@ -82,7 +87,7 @@ steps:
82
87
  outputs:
83
88
  - name: plan
84
89
  pattern: "plan.md | plan-r{N}.md"
85
- rule: "扫描现有方案产物;首轮创建 plan.md,后续修订创建 plan-r{N}.md(N = 当前最高轮次 + 1)"
90
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
86
91
  outputs:
87
92
  - 技术方案
88
93
  - 接口定义
@@ -109,7 +114,7 @@ steps:
109
114
  outputs:
110
115
  - name: review-plan
111
116
  pattern: "review-plan.md | review-plan-r{N}.md"
112
- rule: "扫描现有方案审查产物;首轮创建 review-plan.md,后续轮次创建 review-plan-r{N}.md(N = 当前最高轮次 + 1)"
117
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
113
118
  outputs:
114
119
  - 技术方案审查报告
115
120
  - 待修正问题列表(如有)
@@ -145,7 +150,7 @@ steps:
145
150
  outputs:
146
151
  - name: code
147
152
  pattern: "code.md | code-r{N}.md"
148
- rule: "扫描现有实现产物;首轮创建 code.md,后续修复或重实现创建 code-r{N}.md(N = 当前最高轮次 + 1)"
153
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
149
154
  outputs:
150
155
  - 包含实现或修复的功能分支
151
156
  - 测试文件
@@ -172,7 +177,7 @@ steps:
172
177
  outputs:
173
178
  - name: review-code
174
179
  pattern: "review-code.md | review-code-r{N}.md"
175
- rule: "扫描现有代码审查产物;首轮创建 review-code.md,后续轮次创建 review-code-r{N}.md(N = 当前最高轮次 + 1)"
180
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
176
181
  outputs:
177
182
  - 代码审查报告
178
183
  - 待修复问题列表
@@ -9,6 +9,11 @@
9
9
  name: refactoring
10
10
  description: Safe and structured workflow for code refactoring.
11
11
 
12
+ lifecycle_paths:
13
+ streamlined: [analysis, code, code-review]
14
+ standard: [analysis, design, code, code-review]
15
+ full: [analysis, analysis-review, design, design-review, code, code-review]
16
+
12
17
  steps:
13
18
  - name: analysis
14
19
  description: Analyze the current code and define the refactoring scope.
@@ -28,7 +33,7 @@ steps:
28
33
  outputs:
29
34
  - name: analysis
30
35
  pattern: "analysis.md | analysis-r{N}.md"
31
- rule: "Scan existing analysis artifacts; create analysis.md for round 1 and analysis-r{N}.md for later revisions (N = current highest round + 1)"
36
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
32
37
  outputs:
33
38
  - Scope analysis with dependency map
34
39
  - Risk assessment
@@ -55,7 +60,7 @@ steps:
55
60
  outputs:
56
61
  - name: review-analysis
57
62
  pattern: "review-analysis.md | review-analysis-r{N}.md"
58
- rule: "Scan existing requirement-analysis review artifacts; create review-analysis.md for round 1 and review-analysis-r{N}.md for later rounds (N = current highest round + 1)"
63
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
59
64
  outputs:
60
65
  - Requirement analysis review report
61
66
  - Findings to fix, if any
@@ -84,7 +89,7 @@ steps:
84
89
  outputs:
85
90
  - name: plan
86
91
  pattern: "plan.md | plan-r{N}.md"
87
- rule: "Scan existing plan artifacts; create plan.md for round 1 and plan-r{N}.md for later revisions (N = current highest round + 1)"
92
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
88
93
  outputs:
89
94
  - Incremental refactoring plan
90
95
  - Prerequisite test list
@@ -111,7 +116,7 @@ steps:
111
116
  outputs:
112
117
  - name: review-plan
113
118
  pattern: "review-plan.md | review-plan-r{N}.md"
114
- rule: "Scan existing plan review artifacts; create review-plan.md for round 1 and review-plan-r{N}.md for later rounds (N = current highest round + 1)"
119
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
115
120
  outputs:
116
121
  - Plan review report
117
122
  - Findings to fix, if any
@@ -148,7 +153,7 @@ steps:
148
153
  outputs:
149
154
  - name: code
150
155
  pattern: "code.md | code-r{N}.md"
151
- rule: "Scan existing code artifacts; create code.md for round 1 and code-r{N}.md for later fixes or reimplementation (N = current highest round + 1)"
156
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
152
157
  outputs:
153
158
  - Refactoring branch with implementation or fixes
154
159
  - Updated or new test files
@@ -177,7 +182,7 @@ steps:
177
182
  outputs:
178
183
  - name: review-code
179
184
  pattern: "review-code.md | review-code-r{N}.md"
180
- rule: "Scan existing code review artifacts; create review-code.md for round 1 and review-code-r{N}.md for later rounds (N = current highest round + 1)"
185
+ rule: "Let the task-artifact selector decide: reuse a completed artifact when inputs and substantive results match; create the next round only for new inputs, rework evidence, or result changes"
181
186
  outputs:
182
187
  - Code review report
183
188
  - Findings list, if any
@@ -8,6 +8,11 @@
8
8
  name: refactoring
9
9
  description: 安全且结构化的代码重构工作流。
10
10
 
11
+ lifecycle_paths:
12
+ streamlined: [analysis, code, code-review]
13
+ standard: [analysis, design, code, code-review]
14
+ full: [analysis, analysis-review, design, design-review, code, code-review]
15
+
11
16
  steps:
12
17
  - name: analysis
13
18
  description: 分析当前代码并确定重构范围。
@@ -27,7 +32,7 @@ steps:
27
32
  outputs:
28
33
  - name: analysis
29
34
  pattern: "analysis.md | analysis-r{N}.md"
30
- rule: "扫描现有分析产物;首轮创建 analysis.md,后续修订创建 analysis-r{N}.md(N = 当前最高轮次 + 1)"
35
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
31
36
  outputs:
32
37
  - 包含依赖关系图的范围分析
33
38
  - 风险评估
@@ -54,7 +59,7 @@ steps:
54
59
  outputs:
55
60
  - name: review-analysis
56
61
  pattern: "review-analysis.md | review-analysis-r{N}.md"
57
- rule: "扫描现有需求分析审查产物;首轮创建 review-analysis.md,后续轮次创建 review-analysis-r{N}.md(N = 当前最高轮次 + 1)"
62
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
58
63
  outputs:
59
64
  - 需求分析审查报告
60
65
  - 待修正问题列表(如有)
@@ -83,7 +88,7 @@ steps:
83
88
  outputs:
84
89
  - name: plan
85
90
  pattern: "plan.md | plan-r{N}.md"
86
- rule: "扫描现有方案产物;首轮创建 plan.md,后续修订创建 plan-r{N}.md(N = 当前最高轮次 + 1)"
91
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
87
92
  outputs:
88
93
  - 包含增量步骤的重构计划
89
94
  - 前置测试列表
@@ -110,7 +115,7 @@ steps:
110
115
  outputs:
111
116
  - name: review-plan
112
117
  pattern: "review-plan.md | review-plan-r{N}.md"
113
- rule: "扫描现有方案审查产物;首轮创建 review-plan.md,后续轮次创建 review-plan-r{N}.md(N = 当前最高轮次 + 1)"
118
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
114
119
  outputs:
115
120
  - 技术方案审查报告
116
121
  - 待修正问题列表(如有)
@@ -147,7 +152,7 @@ steps:
147
152
  outputs:
148
153
  - name: code
149
154
  pattern: "code.md | code-r{N}.md"
150
- rule: "扫描现有实现产物;首轮创建 code.md,后续修复或重实现创建 code-r{N}.md(N = 当前最高轮次 + 1)"
155
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
151
156
  outputs:
152
157
  - 包含变更的重构分支
153
158
  - 更新或新增的测试文件
@@ -176,7 +181,7 @@ steps:
176
181
  outputs:
177
182
  - name: review-code
178
183
  pattern: "review-code.md | review-code-r{N}.md"
179
- rule: "扫描现有代码审查产物;首轮创建 review-code.md,后续轮次创建 review-code-r{N}.md(N = 当前最高轮次 + 1)"
184
+ rule: "由 task-artifact 选择器决定:输入与实质结果未变化时复用已完成产物;仅在新输入、新返工证据或结果变化时创建下一轮"
180
185
  outputs:
181
186
  - 代码审查报告
182
187
  - 问题列表(如有)
@@ -1,33 +0,0 @@
1
- export function finalizationTerminalResponse(taskId, requestId, receipt) {
2
- const pendingSteps = [
3
- receipt.taskComment === 'pending' ? 'task-comment' : null,
4
- receipt.verification === 'pending' ? 'verification' : null,
5
- receipt.summary === 'pending' ? 'summary' : null
6
- ].filter((step) => step !== null);
7
- const completedSteps = [
8
- 'lifecycle', receipt.taskComment === 'pending' ? null : 'task-comment',
9
- receipt.verification === 'pending' ? null : 'verification', receipt.summary === 'pending' ? null : 'summary'
10
- ]
11
- .filter((step) => step !== null);
12
- const warnings = receipt.warnings
13
- .filter((warning) => warning.status === 'open')
14
- .map(({ status: _status, resolvedAt: _resolvedAt, ...warning }) => warning);
15
- const result = {
16
- status: 'completed', changed: false, taskId,
17
- backfill: { status: 'no-op', changed: false, error: null },
18
- lifecycle: { status: 'no-op', changed: false, error: null },
19
- taskComment: receipt.taskComment === 'pending' ? null : { status: 'no-op', changed: false, error: null },
20
- verification: receipt.verification === 'pending' ? null : { status: 'no-op', changed: false, error: null },
21
- summary: receipt.summary === 'pending' ? null : { status: 'no-op', changed: false, error: null },
22
- completedSteps, pendingSteps,
23
- result: pendingSteps.length > 0 || receipt.warningProjection === 'pending' || warnings.length > 0
24
- ? 'completed_with_warnings' : 'completed',
25
- warnings, error: null
26
- };
27
- return {
28
- version: 2, id: requestId, phase: 'completed', exitCode: 0,
29
- stdout: `${JSON.stringify({ version: 1, status: 'completed', changed: false, accepted: true, result, error: null })}\n`,
30
- stderr: '', error: null
31
- };
32
- }
33
- //# sourceMappingURL=finalization-response.js.map
@@ -1,35 +0,0 @@
1
- import type { TaskFinalizationReceipt } from '../../task/finalization.ts';
2
- import type { SandboxControlResponse } from './protocol.ts';
3
-
4
- export function finalizationTerminalResponse(taskId: string, requestId: string, receipt: TaskFinalizationReceipt): SandboxControlResponse {
5
- const pendingSteps = [
6
- receipt.taskComment === 'pending' ? 'task-comment' : null,
7
- receipt.verification === 'pending' ? 'verification' : null,
8
- receipt.summary === 'pending' ? 'summary' : null
9
- ].filter((step): step is string => step !== null);
10
- const completedSteps = [
11
- 'lifecycle', receipt.taskComment === 'pending' ? null : 'task-comment',
12
- receipt.verification === 'pending' ? null : 'verification', receipt.summary === 'pending' ? null : 'summary'
13
- ]
14
- .filter((step): step is string => step !== null);
15
- const warnings = receipt.warnings
16
- .filter((warning) => warning.status === 'open')
17
- .map(({ status: _status, resolvedAt: _resolvedAt, ...warning }) => warning);
18
- const result = {
19
- status: 'completed', changed: false, taskId,
20
- backfill: { status: 'no-op', changed: false, error: null },
21
- lifecycle: { status: 'no-op', changed: false, error: null },
22
- taskComment: receipt.taskComment === 'pending' ? null : { status: 'no-op', changed: false, error: null },
23
- verification: receipt.verification === 'pending' ? null : { status: 'no-op', changed: false, error: null },
24
- summary: receipt.summary === 'pending' ? null : { status: 'no-op', changed: false, error: null },
25
- completedSteps, pendingSteps,
26
- result: pendingSteps.length > 0 || receipt.warningProjection === 'pending' || warnings.length > 0
27
- ? 'completed_with_warnings' : 'completed',
28
- warnings, error: null
29
- };
30
- return {
31
- version: 2, id: requestId, phase: 'completed', exitCode: 0,
32
- stdout: `${JSON.stringify({ version: 1, status: 'completed', changed: false, accepted: true, result, error: null })}\n`,
33
- stderr: '', error: null
34
- };
35
- }