@fitlab-ai/agent-infra 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +0 -2
  2. package/README.zh-CN.md +0 -2
  3. package/dist/bin/internal-cli.js +2 -17
  4. package/dist/lib/agent-clients/adapter.js +0 -13
  5. package/dist/lib/agent-clients/adapters/antigravity-cli.js +0 -5
  6. package/dist/lib/agent-clients/adapters/claude-code-credentials.js +0 -17
  7. package/dist/lib/agent-clients/adapters/claude-code.js +0 -9
  8. package/dist/lib/agent-clients/adapters/codex.js +0 -52
  9. package/dist/lib/agent-clients/adapters/opencode.js +0 -5
  10. package/dist/lib/agent-clients/adapters/traecli.js +0 -5
  11. package/dist/lib/agent-clients/config.js +19 -54
  12. package/dist/lib/agent-clients/registry.js +1 -12
  13. package/dist/lib/agent-clients/schema.js +0 -18
  14. package/dist/lib/agent-clients/tokens.js +1 -2
  15. package/dist/lib/agent-clients/types.js +0 -1
  16. package/dist/lib/decide.js +2 -0
  17. package/dist/lib/git/worktree-identity.js +1 -9
  18. package/dist/lib/internal/agent-client.js +2 -62
  19. package/dist/lib/internal/cli-route-inventory.js +1 -5
  20. package/dist/lib/internal/manual-validation.js +18 -10
  21. package/dist/lib/internal/task-create.js +1 -1
  22. package/dist/lib/internal/task-event.js +1 -8
  23. package/dist/lib/internal/task-finalization.js +0 -1
  24. package/dist/lib/internal/task-lifecycle.js +2 -2
  25. package/dist/lib/internal/task-operation-registry.js +4 -20
  26. package/dist/lib/internal/task-review.js +4 -4
  27. package/dist/lib/platform/comment-safety.js +1 -7
  28. package/dist/lib/platform/in-label-sync.js +1 -14
  29. package/dist/lib/platform/issue-comments.js +1 -16
  30. package/dist/lib/platform/issues.js +1 -1
  31. package/dist/lib/platform/operation-coordinator.js +4 -2
  32. package/dist/lib/platform/pr-change-report.js +1 -4
  33. package/dist/lib/platform/pr-checks.js +2 -8
  34. package/dist/lib/platform/provider-validation.js +0 -20
  35. package/dist/lib/platform/pull-requests.js +73 -84
  36. package/dist/lib/platform/releases.js +1 -43
  37. package/dist/lib/platform/verification-required.js +0 -2
  38. package/dist/lib/platform/verification-sync.js +1 -79
  39. package/dist/lib/process-data/normalize.js +1 -185
  40. package/dist/lib/process-data/privacy.js +1 -16
  41. package/dist/lib/process-data/sources.js +2 -279
  42. package/dist/lib/render.js +0 -12
  43. package/dist/lib/run/index.js +15 -10
  44. package/dist/lib/run/skills.js +0 -3
  45. package/dist/lib/sandbox/commands/create.js +40 -53
  46. package/dist/lib/sandbox/commands/list-running.js +0 -18
  47. package/dist/lib/sandbox/commands/start.js +7 -8
  48. package/dist/lib/sandbox/constants.js +0 -6
  49. package/dist/lib/sandbox/control/client.js +0 -1
  50. package/dist/lib/sandbox/control/container-identity.js +1 -16
  51. package/dist/lib/sandbox/control/executor.js +0 -4
  52. package/dist/lib/sandbox/control/identity-sentinel.js +0 -7
  53. package/dist/lib/sandbox/control/lifecycle.js +21 -37
  54. package/dist/lib/sandbox/control/native-file-lock.js +0 -3
  55. package/dist/lib/sandbox/control/server.js +18 -38
  56. package/dist/lib/sandbox/control/state.js +1 -9
  57. package/dist/lib/sandbox/dockerfile.js +0 -6
  58. package/dist/lib/sandbox/engine.js +0 -14
  59. package/dist/lib/sandbox/engines/docker-exact-discovery.js +1 -4
  60. package/dist/lib/sandbox/engines/wsl2-paths.js +0 -3
  61. package/dist/lib/sandbox/recovery.js +24 -26
  62. package/dist/lib/sandbox/removal.js +11 -519
  63. package/dist/lib/sandbox/task-resolver.js +0 -41
  64. package/dist/lib/sandbox/tools.js +1 -4
  65. package/dist/lib/sandbox/workspace-view.js +1 -2
  66. package/dist/lib/server/display.js +0 -6
  67. package/dist/lib/task/activity-intent.js +45 -40
  68. package/dist/lib/task/activity-log.js +9 -16
  69. package/dist/lib/task/artifact-command.js +1 -1
  70. package/dist/lib/task/artifact-lifecycle.js +61 -63
  71. package/dist/lib/task/artifact-name.js +0 -6
  72. package/dist/lib/task/artifact-operations.js +3 -3
  73. package/dist/lib/task/capabilities.js +4 -5
  74. package/dist/lib/task/commands/log.js +0 -6
  75. package/dist/lib/task/commands/status.js +17 -60
  76. package/dist/lib/task/commit-operation.js +28 -39
  77. package/dist/lib/task/completion-facts.js +56 -43
  78. package/dist/lib/task/control-authority.js +23 -256
  79. package/dist/lib/task/control-recovery.js +3 -5
  80. package/dist/lib/task/create.js +2 -4
  81. package/dist/lib/task/decision-intents.js +8 -9
  82. package/dist/lib/task/delivery-target.js +1 -40
  83. package/dist/lib/task/events.js +84 -107
  84. package/dist/lib/task/finalization.js +44 -8
  85. package/dist/lib/task/ledger-intents.js +1 -1
  86. package/dist/lib/task/lifecycle-execution.js +38 -33
  87. package/dist/lib/task/lifecycle.js +49 -41
  88. package/dist/lib/task/local-artifact-finalization.js +1 -4
  89. package/dist/lib/task/manual-validation-evidence.js +1 -37
  90. package/dist/lib/task/platform-operation-recovery.js +67 -24
  91. package/dist/lib/task/pr-delivery-fact.js +2 -5
  92. package/dist/lib/task/qualification-confirmation.js +5 -7
  93. package/dist/lib/task/resolve-ref.js +1 -25
  94. package/dist/lib/task/review-command.js +2 -2
  95. package/dist/lib/task/review-finalization.js +1 -21
  96. package/dist/lib/task/review-fingerprint.js +0 -4
  97. package/dist/lib/task/secure-fs.js +0 -56
  98. package/dist/lib/task/short-id.js +1 -39
  99. package/dist/lib/task/skill-scope.js +0 -1
  100. package/dist/lib/task/verification-engine.js +58 -282
  101. package/dist/lib/task/verification.js +6 -3
  102. package/dist/lib/task/write.js +11 -1
  103. package/lib/agent-clients/adapter.ts +0 -76
  104. package/lib/agent-clients/adapters/antigravity-cli.ts +0 -5
  105. package/lib/agent-clients/adapters/claude-code-credentials.ts +0 -19
  106. package/lib/agent-clients/adapters/claude-code.ts +0 -9
  107. package/lib/agent-clients/adapters/codex.ts +0 -56
  108. package/lib/agent-clients/adapters/opencode.ts +0 -5
  109. package/lib/agent-clients/adapters/traecli.ts +0 -5
  110. package/lib/agent-clients/config.ts +20 -61
  111. package/lib/agent-clients/registry.ts +1 -34
  112. package/lib/agent-clients/schema.ts +0 -18
  113. package/lib/agent-clients/tokens.ts +1 -2
  114. package/lib/agent-clients/types.ts +0 -15
  115. package/lib/decide.ts +1 -0
  116. package/lib/git/worktree-identity.ts +0 -10
  117. package/lib/internal/agent-client.ts +2 -70
  118. package/lib/internal/cli-route-inventory.ts +1 -4
  119. package/lib/internal/manual-validation.ts +16 -9
  120. package/lib/internal/task-create.ts +0 -1
  121. package/lib/internal/task-event.ts +1 -5
  122. package/lib/internal/task-finalization.ts +0 -1
  123. package/lib/internal/task-lifecycle.ts +3 -5
  124. package/lib/internal/task-operation-registry.ts +3 -19
  125. package/lib/internal/task-review.ts +4 -4
  126. package/lib/platform/comment-safety.ts +0 -10
  127. package/lib/platform/github-provider.ts +0 -2
  128. package/lib/platform/in-label-sync.ts +0 -16
  129. package/lib/platform/issue-comments.ts +0 -21
  130. package/lib/platform/issues.ts +0 -2
  131. package/lib/platform/operation-coordinator.ts +4 -2
  132. package/lib/platform/pr-change-report.ts +0 -5
  133. package/lib/platform/pr-checks.ts +1 -10
  134. package/lib/platform/pr-review.ts +1 -1
  135. package/lib/platform/provider-bridge.ts +0 -1
  136. package/lib/platform/provider-loader.ts +1 -5
  137. package/lib/platform/provider-validation.ts +1 -49
  138. package/lib/platform/pull-requests.ts +64 -99
  139. package/lib/platform/releases.ts +1 -40
  140. package/lib/platform/verification-required.ts +0 -2
  141. package/lib/platform/verification-sync.ts +0 -94
  142. package/lib/process-data/normalize.ts +1 -186
  143. package/lib/process-data/privacy.ts +2 -19
  144. package/lib/process-data/sources.ts +3 -283
  145. package/lib/render.ts +0 -15
  146. package/lib/run/index.ts +13 -7
  147. package/lib/run/skills.ts +0 -4
  148. package/lib/sandbox/commands/create.ts +37 -74
  149. package/lib/sandbox/commands/list-running.ts +0 -19
  150. package/lib/sandbox/commands/start.ts +7 -10
  151. package/lib/sandbox/constants.ts +0 -8
  152. package/lib/sandbox/control/client.ts +0 -1
  153. package/lib/sandbox/control/container-identity.ts +1 -16
  154. package/lib/sandbox/control/executor.ts +1 -5
  155. package/lib/sandbox/control/identity-sentinel.ts +0 -8
  156. package/lib/sandbox/control/lifecycle.ts +18 -51
  157. package/lib/sandbox/control/native-file-lock.ts +0 -8
  158. package/lib/sandbox/control/protocol.ts +0 -2
  159. package/lib/sandbox/control/server.ts +13 -39
  160. package/lib/sandbox/control/state.ts +1 -10
  161. package/lib/sandbox/dockerfile.ts +0 -11
  162. package/lib/sandbox/engine.ts +0 -17
  163. package/lib/sandbox/engines/docker-exact-discovery.ts +1 -5
  164. package/lib/sandbox/engines/wsl2-paths.ts +0 -4
  165. package/lib/sandbox/recovery.ts +24 -26
  166. package/lib/sandbox/removal.ts +11 -696
  167. package/lib/sandbox/shell.ts +1 -1
  168. package/lib/sandbox/task-resolver.ts +0 -48
  169. package/lib/sandbox/tools.ts +1 -5
  170. package/lib/sandbox/workspace-view.ts +2 -4
  171. package/lib/server/display.ts +0 -14
  172. package/lib/server/process-control.ts +1 -1
  173. package/lib/task/activity-intent.ts +36 -44
  174. package/lib/task/activity-log.ts +9 -22
  175. package/lib/task/artifact-command.ts +1 -1
  176. package/lib/task/artifact-lifecycle.ts +58 -67
  177. package/lib/task/artifact-name.ts +0 -7
  178. package/lib/task/artifact-operations.ts +3 -3
  179. package/lib/task/capabilities.ts +5 -6
  180. package/lib/task/commands/log.ts +0 -7
  181. package/lib/task/commands/status.ts +14 -79
  182. package/lib/task/commit-operation.ts +29 -51
  183. package/lib/task/completion-facts.ts +45 -42
  184. package/lib/task/control-authority.ts +27 -317
  185. package/lib/task/control-recovery.ts +2 -5
  186. package/lib/task/create.ts +2 -5
  187. package/lib/task/decision-intents.ts +5 -5
  188. package/lib/task/delivery-target.ts +0 -40
  189. package/lib/task/events.ts +89 -123
  190. package/lib/task/finalization.ts +41 -9
  191. package/lib/task/ledger-intents.ts +1 -1
  192. package/lib/task/lifecycle-execution.ts +37 -89
  193. package/lib/task/lifecycle.ts +48 -44
  194. package/lib/task/local-artifact-finalization.ts +0 -7
  195. package/lib/task/manual-validation-evidence.ts +1 -47
  196. package/lib/task/platform-operation-recovery.ts +50 -26
  197. package/lib/task/pr-delivery-fact.ts +2 -11
  198. package/lib/task/qualification-confirmation.ts +6 -6
  199. package/lib/task/resolve-ref.ts +0 -23
  200. package/lib/task/review-command.ts +2 -2
  201. package/lib/task/review-finalization.ts +1 -27
  202. package/lib/task/review-fingerprint.ts +0 -8
  203. package/lib/task/secure-fs.ts +0 -42
  204. package/lib/task/short-id.ts +0 -43
  205. package/lib/task/skill-scope.ts +0 -1
  206. package/lib/task/verification-engine.ts +56 -287
  207. package/lib/task/verification.ts +5 -5
  208. package/lib/task/write.ts +12 -1
  209. package/package.json +2 -2
  210. package/templates/.agents/README.en.md +1 -3
  211. package/templates/.agents/README.zh-CN.md +0 -2
  212. package/templates/.agents/rules/README.en.md +0 -1
  213. package/templates/.agents/rules/README.zh-CN.md +0 -1
  214. package/templates/.agents/rules/commit-and-pr.en.md +1 -1
  215. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -1
  216. package/templates/.agents/rules/no-mid-flow-questions.en.md +0 -10
  217. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +0 -10
  218. package/templates/.agents/rules/pr-sync.en.md +1 -1
  219. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
  220. package/templates/.agents/rules/task-management.en.md +3 -3
  221. package/templates/.agents/rules/task-management.zh-CN.md +3 -3
  222. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  223. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  224. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  225. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  226. package/templates/.agents/skills/code-task/SKILL.en.md +2 -2
  227. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -4
  228. package/templates/.agents/skills/commit/SKILL.en.md +2 -2
  229. package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
  230. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +6 -6
  231. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +6 -6
  232. package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
  233. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
  234. package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
  235. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
  236. package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
  237. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
  238. package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
  239. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
  240. package/templates/.agents/skills/review-pr/SKILL.en.md +4 -4
  241. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +4 -4
  242. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
  243. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
  244. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -75
  245. package/templates/.agents/templates/task.en.md +1 -0
  246. package/templates/.agents/templates/task.zh-CN.md +1 -0
  247. package/templates/.claude/settings.json +0 -24
  248. package/templates/.codex/hooks.json +0 -50
  249. package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +0 -582
  250. package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +0 -114
  251. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +0 -237
  252. package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +0 -443
  253. package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +0 -236
  254. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +0 -292
  255. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +0 -267
  256. package/dist/lib/agent-clients/adapters/codex-orchestration.js +0 -466
  257. package/dist/lib/internal/task-orchestration.js +0 -71
  258. package/dist/lib/platform/verification.js +0 -6
  259. package/dist/lib/run/prompt.js +0 -2
  260. package/dist/lib/sandbox/engines/authority.js +0 -289
  261. package/dist/lib/task/delegation-receipts.js +0 -410
  262. package/dist/lib/task/orchestration.js +0 -1233
  263. package/dist/lib/task/verification-checks.js +0 -9
  264. package/dist/lib/task/workspace-snapshot.js +0 -121
  265. package/dist/lifecycle-build-manifest.json +0 -6
  266. package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +0 -688
  267. package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +0 -147
  268. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +0 -349
  269. package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +0 -506
  270. package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +0 -385
  271. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +0 -41
  272. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +0 -418
  273. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +0 -354
  274. package/lib/agent-clients/adapters/codex-orchestration.ts +0 -630
  275. package/lib/internal/task-orchestration.ts +0 -74
  276. package/lib/platform/verification.ts +0 -11
  277. package/lib/run/prompt.ts +0 -1
  278. package/lib/sandbox/engines/authority.ts +0 -365
  279. package/lib/task/delegation-receipts.ts +0 -547
  280. package/lib/task/orchestration.ts +0 -1651
  281. package/lib/task/verification-checks.ts +0 -10
  282. package/lib/task/workspace-snapshot.ts +0 -144
  283. package/templates/.agents/hooks/lifecycle-delegation.js +0 -140
  284. package/templates/.agents/rules/lifecycle-orchestration.en.md +0 -44
  285. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +0 -44
  286. package/templates/.agents/skills/run-task/SKILL.en.md +0 -29
  287. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +0 -29
  288. package/templates/.agents/skills/run-task/config/verify.en.json +0 -10
  289. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +0 -10
  290. package/templates/.agents/skills/run-task/reference/host-validation.en.md +0 -24
  291. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +0 -24
  292. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +0 -6
  293. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +0 -6
  294. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +0 -6
  295. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +0 -6
  296. package/templates/.claude/commands/run-task.en.md +0 -8
  297. package/templates/.claude/commands/run-task.zh-CN.md +0 -8
  298. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +0 -3
  299. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +0 -3
  300. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +0 -3
  301. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +0 -3
  302. package/templates/.opencode/commands/run-task.en.md +0 -11
  303. package/templates/.opencode/commands/run-task.zh-CN.md +0 -11
@@ -1,7 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
- import { locateActivityLog, pairEntries } from '../task/activity-log.ts';
4
+ import { activityWarnings } from '../task/activity-log.ts';
5
+ import { lifecycleExecutions } from '../task/lifecycle-execution.ts';
5
6
  import { resolveTaskRef } from '../task/resolve-ref.ts';
6
7
  import { prepareAndRenderPrSummaryContent } from '../platform/pr-summary.ts';
7
8
  import { applyTaskEvent } from '../task/events.ts';
@@ -58,15 +59,13 @@ function openManualValidationStarted(taskMdPath: string): { present: boolean; tr
58
59
  let content: string;
59
60
  try { content = fs.readFileSync(taskMdPath, 'utf8'); }
60
61
  catch { return { present: false, transactionId: null }; }
61
- const section = locateActivityLog(content);
62
- if (!section) return { present: false, transactionId: null };
63
- const row = pairEntries(section.entries)
64
- .filter((item) => item.step === 'Complete Manual Validation' && item.started && !item.done)
62
+ const row = lifecycleExecutions(content)
63
+ .filter((item) => item.family === 'manual-validation')
65
64
  .at(-1);
66
65
  if (!row) return { present: false, transactionId: null };
67
66
  return {
68
67
  present: true,
69
- transactionId: /(?:^|;\s*)transaction=([A-Za-z0-9][A-Za-z0-9._-]{0,127})(?:;|$)/u.exec(row.note)?.[1] ?? null
68
+ transactionId: row.transactionId ?? null
70
69
  };
71
70
  }
72
71
 
@@ -120,7 +119,7 @@ async function executeManualValidationTransactionAtResolvedTask(
120
119
  transactionResult = { ok: false, error: { code: 'MANUAL_VALIDATION_TRANSACTION_MISSING', message: 'previous failed transaction was archived for a new pull-request head' } };
121
120
  }
122
121
  if (!transactionResult.ok && transactionResult.error.code !== 'MANUAL_VALIDATION_TRANSACTION_MISSING') return result('failed', transactionResult.error);
123
- if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true });
122
+ if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true, warnings: activityWarnings(taskContent) });
124
123
  const openStarted = transactionResult.ok ? { present: false, transactionId: null } : openManualValidationStarted(resolved.taskMdPath);
125
124
  if (openStarted.present && !openStarted.transactionId) {
126
125
  return result('failed', { code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'open manual-validation started event has no recoverable transactionId' });
@@ -148,11 +147,16 @@ async function executeManualValidationTransactionAtResolvedTask(
148
147
  });
149
148
  let transaction: ManualValidationTransaction;
150
149
  const idempotent = transactionResult.ok;
150
+ const warnings: { code: string; message: string }[] = [];
151
+ const currentWarnings = () => warnings.length
152
+ ? warnings.filter((warning, index) => warnings.findIndex((item) => item.code === warning.code && item.message === warning.message) === index)
153
+ : activityWarnings(taskContent);
151
154
  let startedEventApplied = false;
152
155
  if (!transactionResult.ok) {
153
156
  transaction = createTransaction();
154
157
  const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transactionId, reasonCode: 'user-request', transactionId }, { repoRoot: cwd });
155
158
  if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
159
+ warnings.push(...(started.warnings ?? []));
156
160
  startedEventApplied = true;
157
161
  if (previousTransaction) {
158
162
  try { archiveGeneration(resolved.taskDir, previousTransaction, previousTransaction.phase === 'committed'); }
@@ -171,8 +175,9 @@ async function executeManualValidationTransactionAtResolvedTask(
171
175
  if (transaction.phase === 'prepared' && !startedEventApplied) {
172
176
  const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', transactionId: transaction.transactionId }, { repoRoot: cwd });
173
177
  if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
178
+ warnings.push(...(started.warnings ?? []));
174
179
  }
175
- if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent });
180
+ if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent, warnings: currentWarnings() });
176
181
  const transactionFailure = (failure: { code: string; message: string }): never => {
177
182
  throw new Error(`${failure.code}: ${failure.message}`);
178
183
  };
@@ -227,6 +232,7 @@ async function executeManualValidationTransactionAtResolvedTask(
227
232
  if (transaction.phase === 'receipt-committed' && !transaction.eventAppended) {
228
233
  const completed = applyTaskEvent({ taskRef, event: 'manual-validation.completed', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', artifact: values.artifact, summaryResult: 'human-confirmed validation and committed receipt', transactionId: transaction.transactionId, receiptDigest: receipt.receiptDigest, prHeadSha: receipt.prHeadSha }, { repoRoot: cwd });
229
234
  if (completed.status === 'failed') transactionFailure(completed.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation completion event failed' });
235
+ warnings.push(...(completed.warnings ?? []));
230
236
  transitionAndPersist('receipt-committed', { eventAppended: true });
231
237
  }
232
238
  if (transaction.phase === 'receipt-committed') {
@@ -240,7 +246,7 @@ async function executeManualValidationTransactionAtResolvedTask(
240
246
  const postWrite = await summaryCommentState(taskRef, { cwd, client: options.client });
241
247
  if (!/^###\s+✅\s+(?:Manual Validation Passed|人工验证已通过)\s*$/mu.test(postWrite.comment?.body ?? '') || postWrite.pullRequest?.head.sha !== receipt.prHeadSha || !manualValidationFinalSummaryProjectionMatches(postWrite.comment?.body ?? '', receipt)) transactionFailure({ code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'final summary post-write verification failed' });
242
248
  transitionAndPersist('committed', { postWriteVerified: true });
243
- return result('applied', null, { transaction, receipt, idempotent: false });
249
+ return result('applied', null, { transaction, receipt, idempotent: false, warnings: currentWarnings() });
244
250
  } catch (error) {
245
251
  const message = error instanceof Error ? error.message : String(error);
246
252
  if (transaction.phase === 'final-promotion-in-progress') {
@@ -292,6 +298,7 @@ async function manualValidation(args: string[] = []): Promise<void> {
292
298
  const format = values.format === 'text' ? 'text' : 'json';
293
299
  const output = await executeManualValidationTransaction(taskRef, values, path.resolve(values.cwd ?? process.cwd()));
294
300
  process.stdout.write(format === 'json' ? `${JSON.stringify(output)}\n` : `${output.status === 'applied' ? 'Manual validation transaction committed.' : `${output.error?.code}: ${output.error?.message}`}\n`);
301
+ if (format === 'text' && Array.isArray(output.warnings)) for (const warning of output.warnings) process.stderr.write(`${warning.code}: ${warning.message}\n`);
295
302
  if (output.status === 'failed') process.exitCode = 1;
296
303
  }
297
304
 
@@ -11,7 +11,6 @@ import { validateTaskCreateCandidate, type TaskCreateCandidateV1 } from '../task
11
11
  import {
12
12
  createTask,
13
13
  parseTaskCreateResult,
14
- projectTaskCreateResult,
15
14
  taskCreateExitCode,
16
15
  taskCreateFailure,
17
16
  type TaskCreateControl,
@@ -4,7 +4,7 @@ import type { TaskEventRequest, Verdict } from '../task/events.ts';
4
4
  import { resolveTaskRef } from '../task/resolve-ref.ts';
5
5
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
6
6
 
7
- const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--orchestrated] [--dry-run]
7
+ const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--dry-run]
8
8
 
9
9
  Apply one closed-set task lifecycle event and print a structured JSON result.
10
10
  Events: ${eventCatalog.join(', ')}
@@ -35,10 +35,6 @@ export function parseTaskEventRequest(args: readonly string[]): TaskEventRequest
35
35
  const seen = new Set<string>();
36
36
  for (let index = 2; index < args.length; index += 1) {
37
37
  const flag = args[index]!;
38
- if (flag === '--orchestrated') {
39
- if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
40
- seen.add(flag); request.orchestrated = true; continue;
41
- }
42
38
  if (flag === '--dry-run') {
43
39
  if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
44
40
  seen.add(flag); request.dryRun = true; continue;
@@ -1,4 +1,3 @@
1
- import path from 'node:path';
2
1
  import {
3
2
  createDirectHostExecutionContext,
4
3
  dispatchTaskControlOperation,
@@ -6,12 +6,10 @@ import {
6
6
  } from '../task/control-authority.ts';
7
7
  import { lifecycleIntentCatalog } from '../task/lifecycle.ts';
8
8
  import { detectRepoRoot, resolveTaskRef } from '../task/resolve-ref.ts';
9
- import type { TaskLifecycleResult } from '../task/lifecycle.ts';
10
- import type { AgentClientLifecycleRecoveryResult as LifecycleRecoveryResult } from '../agent-clients/adapter.ts';
11
9
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
12
10
  import { loadSandboxControlLocation } from '../sandbox/config.ts';
13
11
 
14
- const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\nrecover-started: --auto\n`;
12
+ const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\n`;
15
13
 
16
14
  function usageFailure(message: string): void {
17
15
  process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'LIFECYCLE_PAYLOAD_INVALID', message } })}\n`);
@@ -64,9 +62,9 @@ async function taskLifecycle(args: string[] = []): Promise<void> {
64
62
  const result = await dispatchTaskControlOperation(
65
63
  createDirectHostExecutionContext({ repoRoot, ...(controlLocation ?? {}) }),
66
64
  operation
67
- ) as TaskLifecycleResult | LifecycleRecoveryResult;
65
+ );
68
66
  process.stdout.write(`${JSON.stringify(result)}\n`);
69
- if (result.status === 'failed' || result.status === 'owner-unknown' || result.status === 'conflict') process.exitCode = 1;
67
+ if (result.status === 'failed') process.exitCode = 1;
70
68
  }
71
69
 
72
70
  export { taskLifecycle };
@@ -1,9 +1,7 @@
1
1
  import fs from 'node:fs';
2
- import path from 'node:path';
3
2
 
4
3
  import {
5
4
  accessSandboxTaskView,
6
- parseSandboxTaskView,
7
5
  taskViewFromStatus,
8
6
  type SandboxTaskView,
9
7
  type TaskViewAccessEffect
@@ -14,7 +12,7 @@ import {
14
12
  PUBLIC_CLI_SELECTOR_ALIASES,
15
13
  internalRouteSelector
16
14
  } from './cli-route-inventory.ts';
17
- import { hasSandboxControlMarker, resolveSandboxControlTransport, sandboxTaskMarkerState } from '../sandbox/environment.ts';
15
+ import { hasSandboxControlMarker, sandboxTaskMarkerState } from '../sandbox/environment.ts';
18
16
  export { resolveSandboxControlTransport } from '../sandbox/environment.ts';
19
17
 
20
18
  export type TaskOperationDispatcher = 'public' | 'internal';
@@ -54,12 +52,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
54
52
  descriptor('internal', 'sandbox-control', 'client', 'conditional', 'progress', 'delegated'),
55
53
  descriptor('internal', 'agent-client', 'next-steps', 'non-task', 'diagnostic', 'none'),
56
54
  descriptor('internal', 'agent-client', 'model-selection', 'non-task', 'diagnostic', 'none'),
57
- descriptor('internal', 'agent-client', 'launch-carrier', 'non-task', 'diagnostic', 'none'),
58
- descriptor('internal', 'codex-lifecycle', 'preflight', 'non-task', 'diagnostic', 'none'),
59
- descriptor('internal', 'codex-lifecycle', 'hook-event', 'conditional', 'progress'),
60
- descriptor('internal', 'codex-lifecycle', 'resolve-start', 'conditional', 'progress'),
61
- descriptor('internal', 'codex-lifecycle', 'resolve-stop', 'conditional', 'progress'),
62
- descriptor('internal', 'codex-lifecycle', 'consume', 'conditional', 'progress'),
63
55
  descriptor('internal', 'git-workflow', 'inspect', 'conditional', 'diagnostic'),
64
56
  descriptor('internal', 'git-workflow', 'preview-tree', 'conditional', 'diagnostic'),
65
57
  descriptor('internal', 'git-workflow', 'snapshot', 'conditional', 'diagnostic'),
@@ -132,8 +124,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
132
124
  descriptor('internal', 'task-artifact', 'init', 'task-bound', 'artifact-write'),
133
125
  descriptor('internal', 'task-artifact', 'preflight', 'task-bound', 'artifact-write'),
134
126
  descriptor('internal', 'task-artifact', 'finalize-local', 'task-bound', 'artifact-write'),
135
- descriptor('internal', 'task-orchestration', 'status', 'task-bound', 'diagnostic'),
136
- descriptor('internal', 'task-orchestration', 'progress', 'task-bound', 'progress'),
137
127
  descriptor('internal', 'task-review', 'preflight', 'task-bound', 'artifact-write'),
138
128
  descriptor('internal', 'task-review', 'finalize-summary', 'task-bound', 'progress'),
139
129
  descriptor('internal', 'task-event', 'event', 'task-bound', 'progress'),
@@ -212,11 +202,11 @@ export const TASK_OPERATION_DESCRIPTORS = Object.freeze([
212
202
  ]);
213
203
 
214
204
  export const INTERNAL_DISPATCHER_ROUTES = Object.freeze([
215
- 'task-create', 'task-qualification', 'sandbox-control', 'agent-client', 'codex-lifecycle',
205
+ 'task-create', 'task-qualification', 'sandbox-control', 'agent-client',
216
206
  'git-workflow', 'task-delivery', 'release-workflow', 'platform-release-notes', 'platform-security', 'platform-metadata', 'platform-context',
217
207
  'platform-comment', 'platform-issue', 'platform-pr', 'platform-pr-review', 'pr-review-grade',
218
208
  'platform-checks', 'task-context', 'task-workspace', 'task-ledger', 'task-warning', 'task-activity', 'task-artifact',
219
- 'task-orchestration', 'task-review', 'task-event', 'task-lifecycle',
209
+ 'task-review', 'task-event', 'task-lifecycle',
220
210
  'task-finalization', 'task-platform-recovery', 'task-short-id', 'task-snapshot', 'task-verify', 'task-validate', 'manual-validation'
221
211
  ]);
222
212
  export const PUBLIC_DISPATCHER_ROUTES = Object.freeze([
@@ -271,7 +261,6 @@ export function resolveTaskOperation(
271
261
  export function resolveDelegatedTaskOperation(args: readonly string[]): TaskOperationDescriptor | null {
272
262
  const [operation, ...rest] = args;
273
263
  if (operation !== 'client' || !rest[0]) return null;
274
- if (rest[0] === 'task-orchestration') return null;
275
264
  return resolveTaskOperation('internal', rest[0], rest.slice(1));
276
265
  }
277
266
 
@@ -298,7 +287,6 @@ function explicitTaskRefForOperation(
298
287
  }
299
288
  return command === 'merge' ? null : first(args) || null;
300
289
  }
301
- if (command === 'codex-lifecycle') return optionValue(args, '--task-id') ?? null;
302
290
  if (command === 'platform-comment' || command === 'platform-issue') {
303
291
  return first(args) === 'list' ? null : args[1] ?? null;
304
292
  }
@@ -449,7 +437,3 @@ export function guardTaskOperation(
449
437
  }
450
438
  return { descriptor: selected, taskView };
451
439
  }
452
-
453
- export function assertTaskViewStatus(value: unknown): SandboxTaskView {
454
- return parseSandboxTaskView(value);
455
- }
@@ -3,7 +3,7 @@ import { finalizeReviewSummary, preflightReviewSummary } from '../task/review-fi
3
3
  import { resolveTaskRef } from '../task/resolve-ref.ts';
4
4
  import { ensureInternalHandlerRoute } from './cli-route-inventory.ts';
5
5
 
6
- const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--orchestrated] [--dry-run]\n';
6
+ const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--dry-run]\n';
7
7
 
8
8
  function failUsage(message: string): void {
9
9
  process.stdout.write(`${JSON.stringify({
@@ -25,13 +25,13 @@ async function taskReview(args: string[] = []): Promise<void> {
25
25
  let request;
26
26
  try { request = parseReviewCommand(args); }
27
27
  catch (error) { failUsage(error instanceof Error ? error.message : String(error)); return; }
28
- const { stage, artifact, dryRun, orchestrated } = request;
28
+ const { stage, artifact, dryRun } = request;
29
29
  const operation = args[1]!;
30
30
  const resolved = resolveTaskRef(args[0]!);
31
31
  if (!resolved.ok) { failUsage(resolved.message); return; }
32
32
  const result = operation === 'preflight'
33
- ? preflightReviewSummary({ taskRef: args[0]!, stage, artifact, orchestrated, dryRun })
34
- : finalizeReviewSummary({ taskRef: args[0]!, stage, artifact, orchestrated, dryRun });
33
+ ? preflightReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun })
34
+ : finalizeReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun });
35
35
  process.stdout.write(`${JSON.stringify(result)}\n`);
36
36
  if (result.status === 'failed') process.exitCode = 1;
37
37
  }
@@ -94,14 +94,6 @@ function escapeHtmlText(value: string): string {
94
94
  return escapeHtml(value);
95
95
  }
96
96
 
97
- function escapeHtmlAttribute(value: string): string {
98
- return escapeHtml(value);
99
- }
100
-
101
- function escapeMarkdownLiteral(value: string): string {
102
- return value.replace(/[\\`*_{}\[\]()#+.!|<>-]/g, '\\$&');
103
- }
104
-
105
97
  function markerSafe(value: string, markers: readonly RegExp[]): string {
106
98
  let result = value;
107
99
  for (const marker of markers) {
@@ -250,9 +242,7 @@ function splitDocumentPlaceholder(value: string, placeholder: string): Sanitizat
250
242
 
251
243
  export {
252
244
  CONTROL_MARKER_PATTERN,
253
- escapeHtmlAttribute,
254
245
  escapeHtmlText,
255
- escapeMarkdownLiteral,
256
246
  fenceRanges,
257
247
  renderSafeCodeFence,
258
248
  canonicalizeCommentBody,
@@ -15,7 +15,6 @@ import type {
15
15
  ChangeRequestSnapshot,
16
16
  CheckLogSnapshot,
17
17
  CheckRunSnapshot,
18
- GitEvidenceSnapshot,
19
18
  IssueSnapshot,
20
19
  LabelReconciliation,
21
20
  MutationReceipt,
@@ -32,7 +31,6 @@ import type {
32
31
  ReleaseSnapshot,
33
32
  RemoteCommentSnapshot,
34
33
  ReviewSnapshot,
35
- SecurityAlertKind,
36
34
  SecurityAlertSnapshot,
37
35
  VerificationRemoteFacts
38
36
  } from './provider-contract.ts';
@@ -182,16 +182,6 @@ function flattenPages(value: unknown): unknown[] {
182
182
  return value.flatMap((page) => Array.isArray(page) ? page : [page]);
183
183
  }
184
184
 
185
- function extractRepositoryLabelNames(value: unknown): string[] {
186
- return flattenPages(value).flatMap((entry) => {
187
- if (typeof entry === 'string') return [entry];
188
- if (entry && typeof entry === 'object' && typeof (entry as { name?: unknown }).name === 'string') {
189
- return [(entry as { name: string }).name];
190
- }
191
- return [];
192
- }).filter(Boolean).sort();
193
- }
194
-
195
185
  function extractPullRequestFileNames(value: unknown): string[] | null {
196
186
  const entries = flattenPages(value);
197
187
  if (!Array.isArray(value) || entries.some((entry) => !entry || typeof entry !== 'object')) return null;
@@ -200,20 +190,14 @@ function extractPullRequestFileNames(value: unknown): string[] | null {
200
190
  return [...new Set(names as string[])].sort();
201
191
  }
202
192
 
203
- function resourceSnapshot(kind: InLabelResource['kind'], number: number, labels: readonly string[]): InLabelResource {
204
- return { kind, number, labels: [...labels].sort() };
205
- }
206
-
207
193
  export {
208
194
  extractPullRequestFileNames,
209
- extractRepositoryLabelNames,
210
195
  flattenPages,
211
196
  inLabels,
212
197
  inLabelMappingDigest,
213
198
  labelDelta,
214
199
  mergeInLabels,
215
200
  planInLabelUpdate,
216
- resourceSnapshot,
217
201
  syncLabelDelta,
218
202
  validateInLabelMapping,
219
203
  validateRepositoryLabelPayload
@@ -178,10 +178,6 @@ function renderTaskComment(content: string, taskId: string, _agent: string, lang
178
178
  return renderTaskCommentResult(content, taskId, language).body;
179
179
  }
180
180
 
181
- function isTaskCommentTooLarge(content: string, taskId = 'TASK-UNKNOWN', _agent = 'codex'): boolean {
182
- return renderTaskCommentResult(content, taskId).byteLength > COMMENT_BYTE_LIMIT;
183
- }
184
-
185
181
  function taskCommentLanguage(repoRoot: string): string {
186
182
  try {
187
183
  const config = JSON.parse(fs.readFileSync(path.join(repoRoot, '.agents', '.airc.json'), 'utf8')) as { language?: unknown };
@@ -409,21 +405,6 @@ function findMarkerComments(comments: RemoteComment[], marker: string): RemoteCo
409
405
  return comments.filter((comment) => normalizeCommentContent(String(comment.body || '')).split('\n', 1)[0] === marker);
410
406
  }
411
407
 
412
- function flattenComments(value: unknown): RemoteComment[] {
413
- if (!Array.isArray(value)) return [];
414
- const flattened = value.flatMap((entry) => Array.isArray(entry) ? entry : [entry]);
415
- return flattened.filter((entry): entry is RemoteComment =>
416
- Boolean(entry && typeof entry === 'object' && (typeof entry.id === 'number' || typeof entry.id === 'string') && typeof entry.body === 'string')
417
- );
418
- }
419
-
420
- function listRemoteComments(client: PlatformClient, repo: string, issue: number, cwd: string) {
421
- const result = client.json<unknown>([
422
- 'api', '--paginate', '--slurp', `repos/${repo}/issues/${issue}/comments?per_page=100`
423
- ], { cwd });
424
- return result.ok ? { ok: true as const, value: flattenComments(result.value) } : result;
425
- }
426
-
427
408
  function contextFields(context: PlatformResult): Partial<PlatformResult> {
428
409
  return {
429
410
  platform: context.platform,
@@ -1060,14 +1041,12 @@ export {
1060
1041
  chunkArtifactComment,
1061
1042
  inspectPlatformCommentOperation,
1062
1043
  findMarkerComments,
1063
- listRemoteComments,
1064
1044
  checkPlatformCommentOwner,
1065
1045
  listPlatformComments,
1066
1046
  normalizeCommentContent,
1067
1047
  renderTaskComment,
1068
1048
  renderTaskCommentResult,
1069
1049
  syncCommentPlan,
1070
- isTaskCommentTooLarge,
1071
1050
  syncPlatformComment,
1072
1051
  validateRelatedMarkerSet
1073
1052
  };
@@ -27,9 +27,7 @@ import {
27
27
  labelDelta,
28
28
  inLabelMappingDigest,
29
29
  planInLabelUpdate,
30
- syncLabelDelta,
31
30
  validateInLabelMapping,
32
- validateRepositoryLabelPayload
33
31
  } from './in-label-sync.ts';
34
32
  import {
35
33
  providerError,
@@ -37,7 +37,8 @@ async function coordinatePlatformWrite<T extends OperationResult>(input: Coordin
37
37
  });
38
38
  }
39
39
 
40
- const selection = input.operation.kind === 'issue-metadata' && input.operation.issueMetadata?.state === 'closed'
40
+ const boundedPr = input.operation.kind === 'pull-request' && input.operation.dependency === 'required';
41
+ const selection = boundedPr || input.operation.kind === 'issue-metadata' && input.operation.issueMetadata?.state === 'closed'
41
42
  ? 'all' : input.operation.dependency;
42
43
  const drained = input.drain
43
44
  ? await input.drain(input.operation.taskRef, operationId, input.agent, input.operation.cwd)
@@ -45,7 +46,8 @@ async function coordinatePlatformWrite<T extends OperationResult>(input: Coordin
45
46
  agent: input.agent,
46
47
  client: input.client,
47
48
  cwd: input.operation.cwd,
48
- excludeId: operationId
49
+ excludeId: operationId,
50
+ ...(boundedPr ? { beforeId: operationId } : {})
49
51
  });
50
52
  if (drained.status !== 'applied' && drained.status !== 'no-op') {
51
53
  return input.block(drained.error ? { ...drained.error, retryable: true } : {
@@ -493,10 +493,6 @@ function buildPrChangeReport(
493
493
  });
494
494
  }
495
495
 
496
- function reportFilePath(taskDir: string): string {
497
- return path.join(taskDir, REPORT_FILE_NAME);
498
- }
499
-
500
496
  function readPrChangeReport(file: string): ValidationResult<PrChangeReport> {
501
497
  try {
502
498
  const stat = fs.lstatSync(file);
@@ -765,7 +761,6 @@ export {
765
761
  readPrChangeReport,
766
762
  renderCanonicalChangeReport,
767
763
  replaceCanonicalReportPlaceholder,
768
- reportFilePath,
769
764
  runMechanicalChangeReport,
770
765
  taskIntentDigest,
771
766
  taskIntentProjection,
@@ -15,7 +15,6 @@ import {
15
15
  providerError,
16
16
  providerOperationContext,
17
17
  providerStatus,
18
- resourceIdentity,
19
18
  resourceIdentityNumber,
20
19
  unsupportedProviderOperation
21
20
  } from './provider-bridge.ts';
@@ -56,14 +55,6 @@ function classifyPullRequestReadiness(input: {
56
55
  return { state: 'ready', headSha: input.headSha };
57
56
  }
58
57
 
59
- function resolveRunCandidate(candidates: RunCandidate[], headSha: string, checkName: string):
60
- | { status: 'resolved'; runId: number; jobId: number | null }
61
- | { status: 'missing' | 'ambiguous'; runId: null; jobId: null } {
62
- const matches = candidates.filter((candidate) => candidate.headSha === headSha && candidate.name === checkName);
63
- if (matches.length === 1) return { status: 'resolved', runId: matches[0]!.id, jobId: matches[0]!.jobId || null };
64
- return { status: matches.length === 0 ? 'missing' : 'ambiguous', runId: null, jobId: null };
65
- }
66
-
67
58
  function checksResult(status: PlatformResult['status'], overrides: Partial<ChecksResult> = {}): ChecksResult {
68
59
  return {
69
60
  ...platformResult(status),
@@ -256,5 +247,5 @@ async function fetchPlatformCheckLogs(taskRef: string, options: SharedOptions &
256
247
  }
257
248
  }
258
249
 
259
- export { classifyPullRequestReadiness, classifyRequiredChecks, fetchPlatformCheckLogs, inspectRequiredChecks, inspectPullRequestReadiness, resolvePlatformCheckRun, resolveRunCandidate, watchPullRequestReadiness };
250
+ export { classifyPullRequestReadiness, classifyRequiredChecks, fetchPlatformCheckLogs, inspectRequiredChecks, inspectPullRequestReadiness, resolvePlatformCheckRun, watchPullRequestReadiness };
260
251
  export type { CheckBucket, CheckSnapshot, ChecksResult, ChecksSnapshot, CheckState, ReadinessSnapshot, ReadinessState, RunCandidate };
@@ -7,7 +7,7 @@ import { resolvePlatformProviderContext } from './context.ts';
7
7
  import type { PlatformClient } from './context.ts';
8
8
  import { providerErrorRetryable } from './provider-validation.ts';
9
9
  import { platformResult } from './types.ts';
10
- import type { PlatformOperation, PlatformResult } from './types.ts';
10
+ import type { PlatformResult } from './types.ts';
11
11
  import {
12
12
  providerError,
13
13
  providerOperationContext,
@@ -4,7 +4,6 @@ import type {
4
4
  ProviderError,
5
5
  ProviderOperationContext,
6
6
  PlatformProvider,
7
- ProviderResult,
8
7
  ResourceIdentity
9
8
  } from './provider-contract.ts';
10
9
  import {
@@ -10,11 +10,7 @@ import {
10
10
  isPlatformProviderFactory,
11
11
  validatePlatformProvider
12
12
  } from './provider-contract.ts';
13
- import type {
14
- JsonValue,
15
- PlatformProvider,
16
- PlatformProviderFactoryInput
17
- } from './provider-contract.ts';
13
+ import type { JsonValue, PlatformProviderFactoryInput } from './provider-contract.ts';
18
14
  import { createGitHubProvider } from './github-provider.ts';
19
15
  import { createNoneProvider } from './none-provider.ts';
20
16
  import { wrapProviderOperations } from './provider-validation.ts';
@@ -1,33 +1,6 @@
1
1
  import { parseResourceIdentity, serializeResourceIdentity } from './resource-identity.ts';
2
2
  import type { ProviderIdentityDeclaration, ResourceIdentityKind } from './resource-identity.ts';
3
- import type {
4
- ChangeRequestSnapshot,
5
- CheckLogSnapshot,
6
- CheckRunSnapshot,
7
- GitEvidenceSnapshot,
8
- LabelDefinition,
9
- LabelReconciliation,
10
- IssueSnapshot,
11
- MilestoneDefinition,
12
- MilestoneInitialization,
13
- MilestoneReconciliation,
14
- MutationReceipt,
15
- PlatformContextSnapshot,
16
- ProviderError,
17
- PlatformProvider,
18
- ProviderResult,
19
- ReleaseNoteAuthor,
20
- ReleaseNoteIssue,
21
- ReleaseNotesFacts,
22
- ReleaseSnapshot,
23
- RemoteCommentSnapshot,
24
- RepositoryMetadataSnapshot,
25
- RequiredCheckSnapshot,
26
- ReviewSnapshot,
27
- SecurityAlertKind,
28
- SecurityAlertSnapshot,
29
- VerificationRemoteFacts
30
- } from './provider-contract.ts';
3
+ import type { ChangeRequestSnapshot, CheckLogSnapshot, CheckRunSnapshot, GitEvidenceSnapshot, LabelReconciliation, IssueSnapshot, MilestoneInitialization, MilestoneReconciliation, MutationReceipt, PlatformContextSnapshot, ProviderError, PlatformProvider, ReleaseNoteAuthor, ReleaseNoteIssue, ReleaseNotesFacts, ReleaseSnapshot, RemoteCommentSnapshot, RepositoryMetadataSnapshot, RequiredCheckSnapshot, ReviewSnapshot, SecurityAlertKind, SecurityAlertSnapshot, VerificationRemoteFacts } from './provider-contract.ts';
31
4
  import type { JsonValue } from './provider-contract.ts';
32
5
  import type { PlatformError } from './types.ts';
33
6
 
@@ -336,16 +309,6 @@ function validateSecurityAlert(value: unknown): SecurityAlertSnapshot {
336
309
  };
337
310
  }
338
311
 
339
- function validateLabelDefinition(value: unknown, label: string): LabelDefinition {
340
- const item = record(value, label);
341
- exactKeys(item, ['name', 'color', 'description'], label);
342
- return {
343
- name: stringValue(item.name, `${label}.name`),
344
- color: stringValue(item.color, `${label}.color`),
345
- description: stringValue(item.description, `${label}.description`, true)
346
- };
347
- }
348
-
349
312
  function validateLabelReconciliation(value: unknown): LabelReconciliation {
350
313
  const item = record(value, 'label reconciliation');
351
314
  exactKeys(item, ['changed', 'created', 'updated', 'removed', 'skipped'], 'label reconciliation');
@@ -359,17 +322,6 @@ function validateLabelReconciliation(value: unknown): LabelReconciliation {
359
322
  };
360
323
  }
361
324
 
362
- function validateMilestoneDefinition(value: unknown, label: string): MilestoneDefinition {
363
- const item = record(value, label);
364
- exactKeys(item, ['title', 'description', 'state'], label);
365
- if (item.state !== 'open' && item.state !== 'closed') throw new Error(`${label}.state is invalid`);
366
- return {
367
- title: stringValue(item.title, `${label}.title`),
368
- description: stringValue(item.description, `${label}.description`, true),
369
- state: item.state
370
- };
371
- }
372
-
373
325
  function validateMilestoneInitialization(value: unknown): MilestoneInitialization {
374
326
  const item = record(value, 'milestone initialization');
375
327
  exactKeys(item, ['changed', 'created', 'skipped'], 'milestone initialization');