@fitlab-ai/agent-infra 0.9.12 → 0.9.13

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 (239) hide show
  1. package/README.md +11 -11
  2. package/README.zh-CN.md +11 -11
  3. package/dist/bin/internal-cli.js +24 -19
  4. package/dist/lib/agent-clients/next-steps.js +6 -1
  5. package/dist/lib/decide.js +3 -3
  6. package/dist/lib/internal/platform-checks.js +3 -3
  7. package/dist/lib/internal/platform-comment.js +9 -9
  8. package/dist/lib/internal/platform-context.js +2 -2
  9. package/dist/lib/internal/platform-issue.js +8 -9
  10. package/dist/lib/internal/platform-pr-review.js +10 -10
  11. package/dist/lib/internal/platform-pr.js +63 -24
  12. package/dist/lib/internal/platform-release-notes.js +3 -3
  13. package/dist/lib/internal/pr-review-grade.js +11 -9
  14. package/dist/lib/internal/release-workflow.js +4 -4
  15. package/dist/lib/internal/sandbox-control.js +30 -4
  16. package/dist/lib/internal/task-activity.js +3 -3
  17. package/dist/lib/internal/task-artifact.js +76 -24
  18. package/dist/lib/internal/task-create.js +2 -2
  19. package/dist/lib/internal/task-event.js +6 -3
  20. package/dist/lib/internal/task-finalization.js +2 -2
  21. package/dist/lib/internal/task-invalidation.js +60 -0
  22. package/dist/lib/internal/task-ledger.js +9 -6
  23. package/dist/lib/internal/task-lifecycle.js +2 -2
  24. package/dist/lib/internal/task-override.js +4 -4
  25. package/dist/lib/internal/task-review.js +3 -3
  26. package/dist/lib/internal/task-verify.js +6 -6
  27. package/dist/lib/internal/task-warning.js +3 -3
  28. package/dist/lib/platform/adapters.js +1 -3
  29. package/dist/lib/platform/change-request-git-evidence.js +27 -7
  30. package/dist/lib/platform/completion-backfill.js +6 -5
  31. package/dist/lib/platform/context.js +70 -130
  32. package/dist/lib/platform/github-client.js +1 -1
  33. package/dist/lib/platform/github-provider.js +903 -0
  34. package/dist/lib/platform/in-label-sync.js +143 -0
  35. package/dist/lib/platform/issue-comments.js +94 -41
  36. package/dist/lib/platform/issues.js +335 -189
  37. package/dist/lib/platform/metadata-labels.js +6 -2
  38. package/dist/lib/platform/none-provider.js +28 -0
  39. package/dist/lib/platform/pr-change-report.js +551 -0
  40. package/dist/lib/platform/pr-checks.js +119 -104
  41. package/dist/lib/platform/pr-review.js +88 -72
  42. package/dist/lib/platform/pr-summary.js +520 -50
  43. package/dist/lib/platform/provider-bridge.js +45 -0
  44. package/dist/lib/platform/provider-contract.d.ts +487 -0
  45. package/dist/lib/platform/provider-contract.js +95 -0
  46. package/dist/lib/platform/provider-loader.js +251 -0
  47. package/dist/lib/platform/provider-validation.js +504 -0
  48. package/dist/lib/platform/pull-request-metadata.js +8 -6
  49. package/dist/lib/platform/pull-requests.js +783 -537
  50. package/dist/lib/platform/release-notes.js +78 -55
  51. package/dist/lib/platform/releases.js +79 -50
  52. package/dist/lib/platform/resource-identity.d.ts +26 -0
  53. package/dist/lib/platform/resource-identity.js +92 -0
  54. package/dist/lib/platform/task-identities.js +31 -0
  55. package/dist/lib/platform/verification-required.js +11 -12
  56. package/dist/lib/platform/verification-sync.js +112 -238
  57. package/dist/lib/pr-review/evidence-grading.js +19 -6
  58. package/dist/lib/run/index.js +63 -23
  59. package/dist/lib/sandbox/control/client.js +96 -15
  60. package/dist/lib/sandbox/control/executor.js +3 -3
  61. package/dist/lib/sandbox/control/protocol.js +77 -0
  62. package/dist/lib/sandbox/control/server.js +398 -25
  63. package/dist/lib/sandbox/control/state.js +204 -1
  64. package/dist/lib/server/protocol.js +38 -1
  65. package/dist/lib/task/activity-log.js +8 -1
  66. package/dist/lib/task/artifact-lifecycle.js +33 -5
  67. package/dist/lib/task/capabilities.js +239 -0
  68. package/dist/lib/task/commands/status.js +32 -0
  69. package/dist/lib/task/commit-operation.js +12 -1
  70. package/dist/lib/task/control-authority.js +8 -5
  71. package/dist/lib/task/create-service.js +8 -8
  72. package/dist/lib/task/current-contract.js +5 -1
  73. package/dist/lib/task/decision-details.js +1 -1
  74. package/dist/lib/task/events.js +297 -17
  75. package/dist/lib/task/finalization.js +37 -13
  76. package/dist/lib/task/human-override.js +58 -36
  77. package/dist/lib/task/invalidation-command.js +86 -0
  78. package/dist/lib/task/invalidation.js +260 -0
  79. package/dist/lib/task/ledger-intents.js +37 -0
  80. package/dist/lib/task/local-artifact-finalization.js +374 -0
  81. package/dist/lib/task/orchestration.js +49 -93
  82. package/dist/lib/task/pr-delivery-fact.js +102 -101
  83. package/dist/lib/task/review-fingerprint.js +24 -2
  84. package/dist/lib/task/rework-intent.js +138 -0
  85. package/dist/lib/task/skill-scope.js +23 -0
  86. package/dist/lib/task/task-execution-lock.js +27 -17
  87. package/dist/lib/task/verification-engine.js +43 -16
  88. package/dist/lib/task/verification.js +3 -3
  89. package/dist/lib/task/workflow-warning-intents.js +1 -1
  90. package/dist/lib/task/write.js +11 -0
  91. package/dist/lib/version.js +11 -1
  92. package/dist/lifecycle-build-manifest.json +3 -3
  93. package/lib/agent-clients/next-steps.ts +6 -1
  94. package/lib/decide.ts +3 -3
  95. package/lib/init.ts +1 -1
  96. package/lib/internal/platform-checks.ts +3 -3
  97. package/lib/internal/platform-comment.ts +8 -8
  98. package/lib/internal/platform-context.ts +2 -2
  99. package/lib/internal/platform-issue.ts +7 -8
  100. package/lib/internal/platform-pr-review.ts +9 -9
  101. package/lib/internal/platform-pr.ts +47 -22
  102. package/lib/internal/platform-release-notes.ts +3 -3
  103. package/lib/internal/pr-review-grade.ts +10 -8
  104. package/lib/internal/release-workflow.ts +4 -4
  105. package/lib/internal/sandbox-control.ts +27 -3
  106. package/lib/internal/task-activity.ts +3 -3
  107. package/lib/internal/task-artifact.ts +65 -22
  108. package/lib/internal/task-create.ts +2 -2
  109. package/lib/internal/task-event.ts +6 -3
  110. package/lib/internal/task-finalization.ts +3 -3
  111. package/lib/internal/task-invalidation.ts +39 -0
  112. package/lib/internal/task-ledger.ts +11 -8
  113. package/lib/internal/task-lifecycle.ts +2 -2
  114. package/lib/internal/task-override.ts +6 -6
  115. package/lib/internal/task-review.ts +3 -3
  116. package/lib/internal/task-verify.ts +6 -6
  117. package/lib/internal/task-warning.ts +3 -3
  118. package/lib/platform/adapters.ts +3 -2
  119. package/lib/platform/change-request-git-evidence.ts +36 -9
  120. package/lib/platform/completion-backfill.ts +9 -8
  121. package/lib/platform/context.ts +97 -134
  122. package/lib/platform/github-client.ts +2 -2
  123. package/lib/platform/github-provider.ts +910 -0
  124. package/lib/platform/in-label-sync.ts +208 -0
  125. package/lib/platform/issue-comments.ts +97 -47
  126. package/lib/platform/issues.ts +344 -174
  127. package/lib/platform/metadata-labels.ts +5 -2
  128. package/lib/platform/none-provider.ts +35 -0
  129. package/lib/platform/pr-change-report.ts +645 -0
  130. package/lib/platform/pr-checks.ts +126 -106
  131. package/lib/platform/pr-review.ts +88 -85
  132. package/lib/platform/pr-summary.ts +560 -53
  133. package/lib/platform/provider-bridge.ts +82 -0
  134. package/lib/platform/provider-contract.ts +536 -0
  135. package/lib/platform/provider-loader.ts +307 -0
  136. package/lib/platform/provider-validation.ts +529 -0
  137. package/lib/platform/pull-request-metadata.ts +10 -7
  138. package/lib/platform/pull-requests.ts +826 -543
  139. package/lib/platform/release-notes.ts +76 -59
  140. package/lib/platform/releases.ts +77 -43
  141. package/lib/platform/resource-identity.ts +121 -0
  142. package/lib/platform/task-identities.ts +40 -0
  143. package/lib/platform/types.ts +4 -2
  144. package/lib/platform/verification-required.ts +11 -13
  145. package/lib/platform/verification-sync.ts +112 -292
  146. package/lib/pr-review/evidence-grading.ts +25 -8
  147. package/lib/run/index.ts +57 -22
  148. package/lib/sandbox/control/client.ts +105 -15
  149. package/lib/sandbox/control/executor.ts +4 -4
  150. package/lib/sandbox/control/protocol.ts +113 -0
  151. package/lib/sandbox/control/server.ts +431 -23
  152. package/lib/sandbox/control/state.ts +251 -1
  153. package/lib/server/protocol.ts +36 -1
  154. package/lib/task/activity-log.ts +8 -0
  155. package/lib/task/artifact-lifecycle.ts +32 -6
  156. package/lib/task/capabilities.ts +262 -0
  157. package/lib/task/commands/status.ts +38 -0
  158. package/lib/task/commit-operation.ts +12 -1
  159. package/lib/task/control-authority.ts +11 -8
  160. package/lib/task/create-service.ts +8 -8
  161. package/lib/task/current-contract.ts +6 -1
  162. package/lib/task/decision-details.ts +6 -2
  163. package/lib/task/events.ts +296 -16
  164. package/lib/task/finalization.ts +50 -14
  165. package/lib/task/human-override.ts +70 -46
  166. package/lib/task/invalidation-command.ts +86 -0
  167. package/lib/task/invalidation.ts +332 -0
  168. package/lib/task/ledger-intents.ts +35 -1
  169. package/lib/task/local-artifact-finalization.ts +563 -0
  170. package/lib/task/orchestration.ts +52 -85
  171. package/lib/task/pr-delivery-fact.ts +131 -148
  172. package/lib/task/review-fingerprint.ts +23 -2
  173. package/lib/task/rework-intent.ts +165 -0
  174. package/lib/task/skill-scope.ts +24 -0
  175. package/lib/task/task-execution-lock.ts +23 -14
  176. package/lib/task/verification-engine.ts +52 -17
  177. package/lib/task/verification.ts +4 -4
  178. package/lib/task/workflow-warning-intents.ts +1 -1
  179. package/lib/task/write.ts +19 -0
  180. package/lib/update.ts +1 -1
  181. package/lib/version.ts +15 -1
  182. package/package.json +7 -1
  183. package/templates/.agents/rules/README.en.md +1 -1
  184. package/templates/.agents/rules/README.zh-CN.md +1 -1
  185. package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
  186. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  187. package/templates/.agents/rules/issue-sync.en.md +2 -0
  188. package/templates/.agents/rules/issue-sync.zh-CN.md +2 -0
  189. package/templates/.agents/rules/local-artifact-repair.en.md +9 -2
  190. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +9 -2
  191. package/templates/.agents/rules/pr-sync.en.md +10 -4
  192. package/templates/.agents/rules/pr-sync.zh-CN.md +17 -4
  193. package/templates/.agents/rules/task-short-id.en.md +1 -4
  194. package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
  195. package/templates/.agents/skills/analyze-task/SKILL.en.md +13 -3
  196. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -3
  197. package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
  198. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
  199. package/templates/.agents/skills/code-task/SKILL.en.md +27 -8
  200. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +29 -10
  201. package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
  202. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
  203. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
  204. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
  205. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +3 -3
  206. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +3 -3
  207. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -3
  208. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -3
  209. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +4 -3
  210. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +4 -3
  211. package/templates/.agents/skills/complete-task/SKILL.en.md +21 -3
  212. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +20 -3
  213. package/templates/.agents/skills/create-pr/SKILL.en.md +7 -6
  214. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -7
  215. package/templates/.agents/skills/create-pr/config/verify.json +1 -0
  216. package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
  217. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
  218. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
  219. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
  220. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  221. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  222. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
  223. package/templates/.agents/skills/plan-task/SKILL.en.md +13 -3
  224. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +10 -3
  225. package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
  226. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
  227. package/templates/.agents/skills/review-code/SKILL.en.md +4 -4
  228. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +4 -4
  229. package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
  230. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
  231. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +4 -2
  232. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +4 -2
  233. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  234. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  235. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
  236. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
  237. package/templates/.agents/templates/task.en.md +18 -1
  238. package/templates/.agents/templates/task.zh-CN.md +18 -1
  239. package/templates/.github/workflows/pr-label.yml +7 -26
package/README.md CHANGED
@@ -55,10 +55,10 @@ Once initialized, open the project in your AI TUI and install the latest skills:
55
55
 
56
56
  ```bash
57
57
  /import-issue 42 # AI reads the issue, creates a task, extracts requirements
58
- /analyze-task <task-id> # AI scans the codebase, finds the root cause, writes analysis.md
59
- /review-analysis <task-id> # An isolated reviewer checks the analysis
60
- /plan-task <task-id> # AI proposes a fix plan
61
- /review-plan <task-id> # A fresh isolated reviewer checks the plan
58
+ /analyze-task --task <task-id> # AI scans the codebase, finds the root cause, writes analysis.md
59
+ /review-analysis --task <task-id> # An isolated reviewer checks the analysis
60
+ /plan-task --task <task-id> # AI proposes a fix plan
61
+ /review-plan --task <task-id> # A fresh isolated reviewer checks the plan
62
62
  ```
63
63
 
64
64
  > **You review the plan and reply in natural language:**
@@ -71,12 +71,12 @@ Just fix it at the application layer in LoginService.
71
71
  > AI re-runs `/plan-task` to update the plan accordingly and confirms.
72
72
 
73
73
  ```bash
74
- /code-task <task-id> # AI writes the fix, tests it, and creates a local checkpoint commit
75
- /review-code <task-id> # A fresh isolated reviewer reports one minor finding
76
- /code-task <task-id> # AI fixes the minor issue, re-validates, and creates a new checkpoint
77
- /review-code <task-id> # The reviewer approves the current checkpoint
78
- /create-pr <task-id> # The reviewed branch is published to its task-bound target; PR links issue #42
79
- /complete-task <task-id> # task archived
74
+ /code-task --task <task-id> # AI writes the fix, tests it, and creates a local checkpoint commit
75
+ /review-code --task <task-id> # A fresh isolated reviewer reports one minor finding
76
+ /code-task --task <task-id> # AI fixes the minor issue, re-validates, and creates a new checkpoint
77
+ /review-code --task <task-id> # The reviewer approves the current checkpoint
78
+ /create-pr --task <task-id> # The reviewed branch is published to its task-bound target; PR links issue #42
79
+ /complete-task --task <task-id> # task archived
80
80
  ```
81
81
 
82
82
  **11 commands. 1 natural-language correction. From issue to merged PR.** That is the entire SOP — programming can have a standard operating procedure too.
@@ -192,7 +192,7 @@ The most-used lifecycle commands, in delivery order. The command prefix varies b
192
192
  | `code-task` → `review-code` | Implement and test; `code-task` creates a local checkpoint, then a structured review checks that checkpoint |
193
193
  | `create-pr` → `complete-task` | Publish the approved checkpoint to the task-bound target branch, then archive after merge and final gates |
194
194
 
195
- Start with one atomic role policy, for example: `$run-task 42 --executor-model <id> --executor-reasoning-effort <value> --reviewer-model <id> --reviewer-reasoning-effort <value>`. Both roles may use the same model. With no explicit policy, `run-task` reads the current Agent Client's optional `agentClients[].orchestration`; if neither source is complete, it shows the host model-selection guidance before creating any run. Re-entry uses the persisted run policy. Finish or clear active runs before upgrading agent-infra; unsupported disk state fails closed without rewriting.
195
+ Start with one atomic role policy, for example: `$run-task --task 42 --executor-model <id> --executor-reasoning-effort <value> --reviewer-model <id> --reviewer-reasoning-effort <value>`. Both roles may use the same model. With no explicit policy, `run-task` reads the current Agent Client's optional `agentClients[].orchestration`; if neither source is complete, it shows the host model-selection guidance before creating any run. Re-entry uses the persisted run policy. Finish or clear active runs before upgrading agent-infra; unsupported disk state fails closed without rewriting.
196
196
 
197
197
  See the full catalog — task status, release, security, and project-maintenance skills — in [Built-in AI Skills](./docs/en/skills.md).
198
198
 
package/README.zh-CN.md CHANGED
@@ -54,10 +54,10 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
54
54
 
55
55
  ```bash
56
56
  /import-issue 42 # AI 读取 Issue,创建任务,提取需求
57
- /analyze-task <task-id> # AI 扫描代码库,定位根因,输出 analysis.md
58
- /review-analysis <task-id> # 隔离 reviewer 审查分析产物
59
- /plan-task <task-id> # AI 提出修复方案
60
- /review-plan <task-id> # fresh 隔离 reviewer 审查方案
57
+ /analyze-task --task <task-id> # AI 扫描代码库,定位根因,输出 analysis.md
58
+ /review-analysis --task <task-id> # 隔离 reviewer 审查分析产物
59
+ /plan-task --task <task-id> # AI 提出修复方案
60
+ /review-plan --task <task-id> # fresh 隔离 reviewer 审查方案
61
61
  ```
62
62
 
63
63
  > **你审查方案后用自然语言回复:**
@@ -70,12 +70,12 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
70
70
  > AI 按你的要求重跑 `/plan-task` 更新方案并确认。
71
71
 
72
72
  ```bash
73
- /code-task <task-id> # AI 编写修复代码、测试,并创建本地 checkpoint commit
74
- /review-code <task-id> # fresh 隔离 reviewer 报告一个次要问题
75
- /code-task <task-id> # AI 修复次要问题、重新验证,并创建新的 checkpoint
76
- /review-code <task-id> # reviewer 审查并通过当前 checkpoint
77
- /create-pr <task-id> # 将已审查分支发布到任务绑定目标分支;PR 自动关联 Issue #42
78
- /complete-task <task-id> # 任务归档
73
+ /code-task --task <task-id> # AI 编写修复代码、测试,并创建本地 checkpoint commit
74
+ /review-code --task <task-id> # fresh 隔离 reviewer 报告一个次要问题
75
+ /code-task --task <task-id> # AI 修复次要问题、重新验证,并创建新的 checkpoint
76
+ /review-code --task <task-id> # reviewer 审查并通过当前 checkpoint
77
+ /create-pr --task <task-id> # 将已审查分支发布到任务绑定目标分支;PR 自动关联 Issue #42
78
+ /complete-task --task <task-id> # 任务归档
79
79
  ```
80
80
 
81
81
  **11 条命令,1 次自然语言纠正,从 Issue 到合并 PR。** 这就是完整的 SOP —— 编程也可以有标准作业流程。
@@ -191,7 +191,7 @@ ai agent-client configure
191
191
  | `code-task` → `review-code` | 实现并测试;`code-task` 创建本地 checkpoint,再由结构化审查检视该 checkpoint |
192
192
  | `create-pr` → `complete-task` | 将已通过审查的 checkpoint 发布到任务绑定目标分支,并在合并和最终门禁通过后归档 |
193
193
 
194
- 启动时可提供原子角色策略,例如:`$run-task 42 --executor-model <id> --executor-reasoning-effort <值> --reviewer-model <id> --reviewer-reasoning-effort <值>`。两个角色可以使用同一模型。完全没有显式策略时,`run-task` 读取当前 Agent Client 可选的 `agentClients[].orchestration`;两个来源都不完整时,会在创建任何 run 前展示宿主模型选择指引。重入使用已持久化的 run 策略。升级 agent-infra 前必须完成或清空 active run;不受支持的磁盘状态会失败关闭且不改写。
194
+ 启动时可提供原子角色策略,例如:`$run-task --task 42 --executor-model <id> --executor-reasoning-effort <值> --reviewer-model <id> --reviewer-reasoning-effort <值>`。两个角色可以使用同一模型。完全没有显式策略时,`run-task` 读取当前 Agent Client 可选的 `agentClients[].orchestration`;两个来源都不完整时,会在创建任何 run 前展示宿主模型选择指引。重入使用已持久化的 run 策略。升级 agent-infra 前必须完成或清空 active run;不受支持的磁盘状态会失败关闭且不改写。
195
195
 
196
196
  完整清单(任务状态、发布、安全、项目维护等 skill)见 [内置 AI Skills](./docs/zh-CN/skills.md)。
197
197
 
@@ -45,12 +45,12 @@ if (taskControlCommand) {
45
45
  }
46
46
  case 'task-lifecycle': {
47
47
  const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
48
- taskLifecycle(process.argv.slice(3));
48
+ await taskLifecycle(process.argv.slice(3));
49
49
  break;
50
50
  }
51
51
  case 'task-finalization': {
52
52
  const { taskFinalization } = await import('../lib/internal/task-finalization.js');
53
- taskFinalization(process.argv.slice(3));
53
+ await taskFinalization(process.argv.slice(3));
54
54
  break;
55
55
  }
56
56
  }
@@ -60,7 +60,7 @@ else
60
60
  switch (command) {
61
61
  case 'task-create': {
62
62
  const { taskCreate } = await import('../lib/internal/task-create.js');
63
- taskCreate(process.argv.slice(3));
63
+ await taskCreate(process.argv.slice(3));
64
64
  break;
65
65
  }
66
66
  case 'sandbox-control': {
@@ -100,37 +100,37 @@ else
100
100
  }
101
101
  case 'platform-release-notes': {
102
102
  const { platformReleaseNotes } = await import('../lib/internal/platform-release-notes.js');
103
- platformReleaseNotes(process.argv.slice(3));
103
+ await platformReleaseNotes(process.argv.slice(3));
104
104
  break;
105
105
  }
106
106
  case 'platform-context': {
107
107
  const { platformContext } = await import('../lib/internal/platform-context.js');
108
- platformContext(process.argv.slice(3));
108
+ await platformContext(process.argv.slice(3));
109
109
  break;
110
110
  }
111
111
  case 'platform-comment': {
112
112
  const { platformComment } = await import('../lib/internal/platform-comment.js');
113
- platformComment(process.argv.slice(3));
113
+ await platformComment(process.argv.slice(3));
114
114
  break;
115
115
  }
116
116
  case 'platform-issue': {
117
117
  const { platformIssue } = await import('../lib/internal/platform-issue.js');
118
- platformIssue(process.argv.slice(3));
118
+ await platformIssue(process.argv.slice(3));
119
119
  break;
120
120
  }
121
121
  case 'platform-pr': {
122
122
  const { platformPr } = await import('../lib/internal/platform-pr.js');
123
- platformPr(process.argv.slice(3));
123
+ await platformPr(process.argv.slice(3));
124
124
  break;
125
125
  }
126
126
  case 'platform-pr-review': {
127
127
  const { platformPrReview } = await import('../lib/internal/platform-pr-review.js');
128
- platformPrReview(process.argv.slice(3));
128
+ await platformPrReview(process.argv.slice(3));
129
129
  break;
130
130
  }
131
131
  case 'pr-review-grade': {
132
132
  const { prReviewGrade } = await import('../lib/internal/pr-review-grade.js');
133
- prReviewGrade(process.argv.slice(3));
133
+ await prReviewGrade(process.argv.slice(3));
134
134
  break;
135
135
  }
136
136
  case 'platform-checks': {
@@ -145,17 +145,17 @@ else
145
145
  }
146
146
  case 'task-ledger': {
147
147
  const { taskLedger } = await import('../lib/internal/task-ledger.js');
148
- taskLedger(process.argv.slice(3));
148
+ await taskLedger(process.argv.slice(3));
149
149
  break;
150
150
  }
151
151
  case 'task-warning': {
152
152
  const { taskWarning } = await import('../lib/internal/task-warning.js');
153
- taskWarning(process.argv.slice(3));
153
+ await taskWarning(process.argv.slice(3));
154
154
  break;
155
155
  }
156
156
  case 'task-activity': {
157
157
  const { taskActivity } = await import('../lib/internal/task-activity.js');
158
- taskActivity(process.argv.slice(3));
158
+ await taskActivity(process.argv.slice(3));
159
159
  break;
160
160
  }
161
161
  case 'task-artifact': {
@@ -170,27 +170,32 @@ else
170
170
  }
171
171
  case 'task-review': {
172
172
  const { taskReview } = await import('../lib/internal/task-review.js');
173
- taskReview(process.argv.slice(3));
173
+ await taskReview(process.argv.slice(3));
174
174
  break;
175
175
  }
176
176
  case 'task-event': {
177
177
  const { taskEvent } = await import('../lib/internal/task-event.js');
178
- taskEvent(process.argv.slice(3));
178
+ await taskEvent(process.argv.slice(3));
179
+ break;
180
+ }
181
+ case 'task-invalidation': {
182
+ const { taskInvalidation } = await import('../lib/internal/task-invalidation.js');
183
+ taskInvalidation(process.argv.slice(3));
179
184
  break;
180
185
  }
181
186
  case 'task-lifecycle': {
182
187
  const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
183
- taskLifecycle(process.argv.slice(3));
188
+ await taskLifecycle(process.argv.slice(3));
184
189
  break;
185
190
  }
186
191
  case 'task-finalization': {
187
192
  const { taskFinalization } = await import('../lib/internal/task-finalization.js');
188
- taskFinalization(process.argv.slice(3));
193
+ await taskFinalization(process.argv.slice(3));
189
194
  break;
190
195
  }
191
196
  case 'task-override': {
192
197
  const { taskOverride } = await import('../lib/internal/task-override.js');
193
- taskOverride(process.argv.slice(3));
198
+ await taskOverride(process.argv.slice(3));
194
199
  break;
195
200
  }
196
201
  case 'task-short-id': {
@@ -205,7 +210,7 @@ else
205
210
  }
206
211
  case 'task-verify': {
207
212
  const { taskVerify } = await import('../lib/internal/task-verify.js');
208
- taskVerify(process.argv.slice(3));
213
+ await taskVerify(process.argv.slice(3));
209
214
  break;
210
215
  }
211
216
  case 'task-validate': {
@@ -1,6 +1,7 @@
1
1
  import { listEnabledAgentClientAdapters } from './registry.js';
2
2
  import { renderAgentClientInvocation } from './invocation.js';
3
3
  import semver from 'semver';
4
+ import { isTaskScopeSkill } from '../task/skill-scope.js';
4
5
  const SAFE_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
5
6
  const SAFE_TASK_REF = /^(?:\d+|TASK-\d{8}-\d{6})$/;
6
7
  function requireSafeName(value, field) {
@@ -19,7 +20,11 @@ function renderNextStepCommands(input) {
19
20
  throw new Error('Invalid version');
20
21
  }
21
22
  const args = [
22
- ...(input.taskRef === undefined ? [] : [input.taskRef]),
23
+ ...(input.taskRef === undefined
24
+ ? []
25
+ : isTaskScopeSkill(input.skillName)
26
+ ? ['--task', input.taskRef]
27
+ : [input.taskRef]),
23
28
  ...(input.version === undefined ? [] : [input.version])
24
29
  ];
25
30
  const builtins = listEnabledAgentClientAdapters(input.state).map((adapter) => Object.freeze({
@@ -94,13 +94,13 @@ export async function decide(args, options = {}) {
94
94
  metadataProvider: () => ({ timestamp: now, agentInfraVersion: options.version ?? VERSION })
95
95
  };
96
96
  let result;
97
- const execute = () => {
97
+ const execute = async () => {
98
98
  let current = applyHumanDecision(request, writeOptions);
99
99
  if (current.status !== 'failed' || !parsedDecision.overrideTicket)
100
100
  return current;
101
101
  if (!parsedDecision.overrideTarget || !parsedDecision.overrideScope)
102
102
  throw new Error('override ticket requires --override-target and --override-scope');
103
- const consumed = consumeHumanOverride({
103
+ const consumed = await consumeHumanOverride({
104
104
  taskRef: resolved.taskId,
105
105
  ticketId: parsedDecision.overrideTicket,
106
106
  failureId: failureId('decision-intent', current.error?.code ?? 'TASK_STATE_MISMATCH'),
@@ -120,7 +120,7 @@ export async function decide(args, options = {}) {
120
120
  throw new Error(consumed.error.message);
121
121
  return current;
122
122
  };
123
- result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
123
+ result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
124
124
  if (result.error)
125
125
  throw new Error(result.error.message);
126
126
  return 0;
@@ -76,7 +76,7 @@ async function platformChecks(args = []) {
76
76
  return;
77
77
  }
78
78
  if (operation === 'inspect') {
79
- finish(inspectPullRequestReadiness(taskRef, { cwd }));
79
+ finish(await inspectPullRequestReadiness(taskRef, { cwd }));
80
80
  return;
81
81
  }
82
82
  if (operation === 'resolve-run') {
@@ -84,7 +84,7 @@ async function platformChecks(args = []) {
84
84
  fail('resolve-run requires --check-name');
85
85
  return;
86
86
  }
87
- finish(resolvePlatformCheckRun(taskRef, { cwd, checkName: values.checkName, detailsUrl: values.detailsUrl }));
87
+ finish(await resolvePlatformCheckRun(taskRef, { cwd, checkName: values.checkName, detailsUrl: values.detailsUrl }));
88
88
  return;
89
89
  }
90
90
  if (operation === 'logs') {
@@ -94,7 +94,7 @@ async function platformChecks(args = []) {
94
94
  fail('logs requires a positive --run and optional positive --job');
95
95
  return;
96
96
  }
97
- finish(fetchPlatformCheckLogs(taskRef, { cwd, run, job: job || undefined }));
97
+ finish(await fetchPlatformCheckLogs(taskRef, { cwd, run, job: job || undefined }));
98
98
  return;
99
99
  }
100
100
  const intervalSeconds = positive(values.intervalSeconds);
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
4
4
  import { checkPlatformCommentOwner, listPlatformComments, syncPlatformComment } from '../platform/issue-comments.js';
5
5
  import { backfillCompletionComments } from '../platform/completion-backfill.js';
6
- const USAGE = `Usage: agent-infra-internal platform-comment list --issue <N> [--cwd <path>]
6
+ const USAGE = `Usage: agent-infra-internal platform-comment list --issue <token> [--cwd <path>]
7
7
  agent-infra-internal platform-comment owner <task-ref> [--cwd <path>]
8
8
  agent-infra-internal platform-comment backfill <task-ref> --agent <agent> [--cwd <path>]
9
9
  agent-infra-internal platform-comment sync <task-ref> --kind <kind> --agent <agent> [--artifact <file>] [--body-file <path|->] [--status-label <label>] [--backfill] [--cwd <path>]
@@ -47,7 +47,7 @@ function readBodyFile(value, cwd) {
47
47
  return fs.readFileSync(0, 'utf8');
48
48
  return fs.readFileSync(path.resolve(cwd, value), 'utf8');
49
49
  }
50
- function platformComment(args = []) {
50
+ async function platformComment(args = []) {
51
51
  if (args[0] === '--help' || args[0] === '-h') {
52
52
  process.stdout.write(USAGE);
53
53
  return;
@@ -70,9 +70,9 @@ function platformComment(args = []) {
70
70
  }
71
71
  const cwd = path.resolve(typeof parsed.values.cwd === 'string' ? parsed.values.cwd : process.cwd());
72
72
  if (operation === 'list') {
73
- const issue = Number(parsed.values.issue);
74
- if (!Number.isInteger(issue) || issue <= 0) {
75
- fail('list requires a positive --issue');
73
+ const issue = parsed.values.issue;
74
+ if (typeof issue !== 'string' || !issue) {
75
+ fail('list requires --issue <token>');
76
76
  return;
77
77
  }
78
78
  const unexpected = Object.keys(parsed.values).find((key) => !['issue', 'cwd'].includes(key));
@@ -80,7 +80,7 @@ function platformComment(args = []) {
80
80
  fail(`list does not accept '--${unexpected}'`);
81
81
  return;
82
82
  }
83
- finish(listPlatformComments(issue, cwd));
83
+ finish(await listPlatformComments(issue, cwd));
84
84
  return;
85
85
  }
86
86
  if (operation === 'owner') {
@@ -89,7 +89,7 @@ function platformComment(args = []) {
89
89
  fail(`owner does not accept '--${unexpected}'`);
90
90
  return;
91
91
  }
92
- finish(checkPlatformCommentOwner(taskRef, { cwd }));
92
+ finish(await checkPlatformCommentOwner(taskRef, { cwd }));
93
93
  return;
94
94
  }
95
95
  if (operation === 'backfill') {
@@ -108,7 +108,7 @@ function platformComment(args = []) {
108
108
  fail(`invalid --agent '${agent}': ${AGENT_USAGE_HINT}`);
109
109
  return;
110
110
  }
111
- finish(backfillCompletionComments(taskRef, { cwd, agent: normalizedAgent }));
111
+ finish(await backfillCompletionComments(taskRef, { cwd, agent: normalizedAgent }));
112
112
  return;
113
113
  }
114
114
  const kind = parsed.values.kind;
@@ -143,7 +143,7 @@ function platformComment(args = []) {
143
143
  fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
144
144
  return;
145
145
  }
146
- finish(syncPlatformComment(taskRef, {
146
+ finish(await syncPlatformComment(taskRef, {
147
147
  kind: kind,
148
148
  agent: normalizedAgent,
149
149
  artifact: typeof parsed.values.artifact === 'string' ? parsed.values.artifact : undefined,
@@ -6,7 +6,7 @@ function fail(message) {
6
6
  process.stderr.write(USAGE);
7
7
  process.exitCode = 1;
8
8
  }
9
- function platformContext(args = []) {
9
+ async function platformContext(args = []) {
10
10
  if (args[0] === '--help' || args[0] === '-h') {
11
11
  process.stdout.write(USAGE);
12
12
  return;
@@ -35,7 +35,7 @@ function platformContext(args = []) {
35
35
  seen.add(flag);
36
36
  cwd = path.resolve(value);
37
37
  }
38
- const result = resolvePlatformContext({ cwd });
38
+ const result = await resolvePlatformContext({ cwd });
39
39
  process.stdout.write(`${JSON.stringify(result)}\n`);
40
40
  if (result.status === 'failed')
41
41
  process.exitCode = 1;
@@ -3,7 +3,7 @@ import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.j
3
3
  import { bindPlatformIssue, createPlatformIssue, inspectPlatformIssue, syncPlatformIssue } from '../platform/issues.js';
4
4
  const USAGE = `Usage: agent-infra-internal platform-issue inspect <task-ref> [--cwd <path>]
5
5
  agent-infra-internal platform-issue create <task-ref> --agent <agent> [--dry-run] [--cwd <path>]
6
- agent-infra-internal platform-issue bind <task-ref> --issue <N> --agent <agent> [--dry-run] [--cwd <path>]
6
+ agent-infra-internal platform-issue bind <task-ref> --issue <token> --agent <agent> [--dry-run] [--cwd <path>]
7
7
  agent-infra-internal platform-issue sync <task-ref> --agent <agent> [--status <suffix|none>] [--assignees current|none] [--milestone initial|specific|none] [--issue-type] [--fields] [--requirements] [--in-labels from-diff|none] [--base <branch>] [--state open|closed] [--close-reason completed|not_planned] [--dry-run] [--cwd <path>]
8
8
  `;
9
9
  const BOOLEAN_FLAGS = new Set(['--dry-run', '--issue-type', '--fields', '--requirements']);
@@ -54,7 +54,7 @@ function oneOf(values, name, allowed) {
54
54
  throw new Error(`--${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)} must be one of ${allowed.join('|')}`);
55
55
  return value;
56
56
  }
57
- function platformIssue(args = []) {
57
+ async function platformIssue(args = []) {
58
58
  if (args[0] === '--help' || args[0] === '-h') {
59
59
  process.stdout.write(USAGE);
60
60
  return;
@@ -86,7 +86,7 @@ function platformIssue(args = []) {
86
86
  return;
87
87
  }
88
88
  if (operation === 'inspect') {
89
- finish(inspectPlatformIssue(taskRef, { cwd }));
89
+ finish(await inspectPlatformIssue(taskRef, { cwd }));
90
90
  return;
91
91
  }
92
92
  if (typeof values.agent !== 'string' || !values.agent) {
@@ -100,16 +100,15 @@ function platformIssue(args = []) {
100
100
  }
101
101
  values.agent = agent;
102
102
  if (operation === 'create') {
103
- finish(createPlatformIssue(taskRef, { cwd, agent: values.agent, dryRun: values.dryRun === true }));
103
+ finish(await createPlatformIssue(taskRef, { cwd, agent: values.agent, dryRun: values.dryRun === true }));
104
104
  return;
105
105
  }
106
106
  if (operation === 'bind') {
107
- const issue = Number(values.issue);
108
- if (!Number.isInteger(issue) || issue <= 0) {
109
- fail('bind requires a positive --issue');
107
+ if (typeof values.issue !== 'string' || !values.issue) {
108
+ fail('bind requires --issue <token>');
110
109
  return;
111
110
  }
112
- finish(bindPlatformIssue(taskRef, { cwd, agent: values.agent, issue, dryRun: values.dryRun === true }));
111
+ finish(await bindPlatformIssue(taskRef, { cwd, agent: values.agent, issue: values.issue, dryRun: values.dryRun === true }));
113
112
  return;
114
113
  }
115
114
  try {
@@ -127,7 +126,7 @@ function platformIssue(args = []) {
127
126
  const desiredKeys = ['status', 'assignees', 'milestone', 'issueType', 'fields', 'requirements', 'inLabels', 'state'];
128
127
  if (!desiredKeys.some((name) => values[name] !== undefined))
129
128
  throw new Error('sync requires at least one desired-state option');
130
- finish(syncPlatformIssue(taskRef, {
129
+ finish(await syncPlatformIssue(taskRef, {
131
130
  cwd, agent: values.agent, dryRun: values.dryRun === true,
132
131
  status: typeof values.status === 'string' ? values.status : undefined,
133
132
  assignees: assignees,
@@ -2,9 +2,9 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { inspectPlatformPullRequestByNumber } from '../platform/pull-requests.js';
4
4
  import { listPrReviews, publishPrReview } from '../platform/pr-review.js';
5
- const USAGE = `Usage: agent-infra-internal platform-pr-review inspect --pr <N> [--cwd <path>]
6
- agent-infra-internal platform-pr-review list --pr <N> [--cwd <path>]
7
- agent-infra-internal platform-pr-review publish --pr <N> --scope <taskId|pr{N}> --round <N> --commit <sha> --event <COMMENT|APPROVE|REQUEST_CHANGES> --body-file <path|-> [--dry-run] [--cwd <path>]
5
+ const USAGE = `Usage: agent-infra-internal platform-pr-review inspect --pr <token> [--cwd <path>]
6
+ agent-infra-internal platform-pr-review list --pr <token> [--cwd <path>]
7
+ agent-infra-internal platform-pr-review publish --pr <token> --scope <taskId|pr{N}> --round <N> --commit <sha> --event <COMMENT|APPROVE|REQUEST_CHANGES> --body-file <path|-> [--dry-run] [--cwd <path>]
8
8
  `;
9
9
  const BOOLEAN_FLAGS = new Set(['--dry-run']);
10
10
  const VALUE_FLAGS = new Set(['--cwd', '--pr', '--scope', '--round', '--commit', '--event', '--body-file']);
@@ -47,7 +47,7 @@ function parse(args, start) {
47
47
  function readBodyFile(value, cwd) {
48
48
  return value === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(cwd, value), 'utf8');
49
49
  }
50
- function platformPrReview(args = []) {
50
+ async function platformPrReview(args = []) {
51
51
  if (args[0] === '--help' || args[0] === '-h') {
52
52
  process.stdout.write(USAGE);
53
53
  return;
@@ -74,17 +74,17 @@ function platformPrReview(args = []) {
74
74
  fail(`${operation} does not accept --${unexpected}`);
75
75
  return;
76
76
  }
77
- const pr = Number(values.pr);
78
- if (!Number.isInteger(pr) || pr <= 0) {
79
- fail(`${operation} requires a positive --pr`);
77
+ const pr = values.pr;
78
+ if (typeof pr !== 'string' || !pr) {
79
+ fail(`${operation} requires --pr <token>`);
80
80
  return;
81
81
  }
82
82
  if (operation === 'inspect') {
83
- finish(inspectPlatformPullRequestByNumber(pr, { cwd }));
83
+ finish(await inspectPlatformPullRequestByNumber(pr, { cwd }));
84
84
  return;
85
85
  }
86
86
  if (operation === 'list') {
87
- finish(listPrReviews(pr, { cwd }));
87
+ finish(await listPrReviews(pr, { cwd }));
88
88
  return;
89
89
  }
90
90
  const scope = typeof values.scope === 'string' ? values.scope : '';
@@ -119,7 +119,7 @@ function platformPrReview(args = []) {
119
119
  fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
120
120
  return;
121
121
  }
122
- finish(publishPrReview({
122
+ finish(await publishPrReview({
123
123
  cwd,
124
124
  prNumber: pr,
125
125
  identity: { scope, round, commitSha: commit },