@fitlab-ai/agent-infra 0.11.15 → 0.12.0

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 (253) hide show
  1. package/bin/cli.ts +1 -1
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/internal-cli.js +6 -1
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +6 -6
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +8 -18
  6. package/dist/lib/agent-clients/adapters/codex-orchestration.js +1 -1
  7. package/dist/lib/decide.js +2 -7
  8. package/dist/lib/internal/cli-route-inventory.js +3 -0
  9. package/dist/lib/internal/manual-validation.js +8 -16
  10. package/dist/lib/internal/platform-comment.js +3 -2
  11. package/dist/lib/internal/task-activity.js +1 -12
  12. package/dist/lib/internal/task-event.js +1 -12
  13. package/dist/lib/internal/task-ledger.js +1 -12
  14. package/dist/lib/internal/task-operation-registry.js +2 -1
  15. package/dist/lib/internal/task-qualification.js +6 -15
  16. package/dist/lib/internal/task-review.js +3 -16
  17. package/dist/lib/internal/task-short-id.js +2 -1
  18. package/dist/lib/internal/task-verify.js +1 -11
  19. package/dist/lib/internal/task-warning.js +1 -12
  20. package/dist/lib/internal/task-workspace.js +43 -0
  21. package/dist/lib/merge.js +4 -3
  22. package/dist/lib/platform/pr-summary.js +6 -15
  23. package/dist/lib/platform/pull-requests.js +3 -15
  24. package/dist/lib/pr-review/evidence-grading.js +3 -2
  25. package/dist/lib/process-data/index.js +5 -4
  26. package/dist/lib/process-data/sources.js +6 -0
  27. package/dist/lib/run/index.js +3 -2
  28. package/dist/lib/sandbox/commands/create.js +5 -1
  29. package/dist/lib/sandbox/commands/enter.js +1 -1
  30. package/dist/lib/sandbox/commands/list-running.js +2 -1
  31. package/dist/lib/sandbox/control/client.js +8 -13
  32. package/dist/lib/sandbox/control/completed-reentry.js +2 -1
  33. package/dist/lib/sandbox/control/task-view.js +4 -2
  34. package/dist/lib/sandbox/mounts.js +4 -4
  35. package/dist/lib/sandbox/recovery.js +26 -16
  36. package/dist/lib/sandbox/removal.js +3 -10
  37. package/dist/lib/sandbox/task-resolver.js +9 -6
  38. package/dist/lib/sandbox/workspace-identity.js +6 -5
  39. package/dist/lib/sandbox/workspace-view.js +29 -22
  40. package/dist/lib/task/activity-intent.js +2 -12
  41. package/dist/lib/task/artifact-lifecycle.js +17 -11
  42. package/dist/lib/task/artifact-operations.js +41 -49
  43. package/dist/lib/task/capabilities.js +2 -2
  44. package/dist/lib/task/commands/ls.js +4 -3
  45. package/dist/lib/task/commands/status.js +1 -1
  46. package/dist/lib/task/commit-operation.js +6 -6
  47. package/dist/lib/task/control-authority.js +32 -32
  48. package/dist/lib/task/create-service.js +2 -4
  49. package/dist/lib/task/create.js +12 -65
  50. package/dist/lib/task/delegation-receipts.js +1 -1
  51. package/dist/lib/task/delivery.js +2 -8
  52. package/dist/lib/task/events.js +5 -31
  53. package/dist/lib/task/finalization.js +17 -22
  54. package/dist/lib/task/lifecycle.js +9 -48
  55. package/dist/lib/task/local-artifact-finalization.js +1 -2
  56. package/dist/lib/task/orchestration.js +24 -57
  57. package/dist/lib/task/platform-operation-recovery.js +1 -2
  58. package/dist/lib/task/resolve-ref.js +17 -12
  59. package/dist/lib/task/review-finalization.js +2 -35
  60. package/dist/lib/task/review-identity.js +3 -1
  61. package/dist/lib/task/short-id.js +10 -8
  62. package/dist/lib/task/verification-engine.js +19 -58
  63. package/dist/lib/task/workspace-root.js +59 -0
  64. package/dist/lib/task/workspace-snapshot.js +4 -3
  65. package/dist/lifecycle-build-manifest.json +3 -3
  66. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +6 -6
  67. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +8 -34
  68. package/lib/agent-clients/adapters/codex-orchestration.ts +1 -1
  69. package/lib/decide.ts +2 -7
  70. package/lib/internal/cli-route-inventory.ts +2 -0
  71. package/lib/internal/manual-validation.ts +8 -19
  72. package/lib/internal/platform-comment.ts +3 -2
  73. package/lib/internal/task-activity.ts +1 -10
  74. package/lib/internal/task-event.ts +1 -10
  75. package/lib/internal/task-ledger.ts +1 -10
  76. package/lib/internal/task-operation-registry.ts +2 -1
  77. package/lib/internal/task-qualification.ts +5 -11
  78. package/lib/internal/task-review.ts +3 -14
  79. package/lib/internal/task-short-id.ts +2 -1
  80. package/lib/internal/task-verify.ts +1 -9
  81. package/lib/internal/task-warning.ts +1 -10
  82. package/lib/internal/task-workspace.ts +39 -0
  83. package/lib/merge.ts +4 -3
  84. package/lib/platform/pr-summary.ts +7 -16
  85. package/lib/platform/pull-requests.ts +3 -24
  86. package/lib/pr-review/evidence-grading.ts +3 -2
  87. package/lib/process-data/index.ts +4 -3
  88. package/lib/process-data/sources.ts +6 -0
  89. package/lib/run/index.ts +3 -2
  90. package/lib/sandbox/commands/create.ts +5 -1
  91. package/lib/sandbox/commands/enter.ts +1 -1
  92. package/lib/sandbox/commands/list-running.ts +2 -1
  93. package/lib/sandbox/control/client.ts +7 -12
  94. package/lib/sandbox/control/completed-reentry.ts +2 -1
  95. package/lib/sandbox/control/task-view.ts +4 -2
  96. package/lib/sandbox/mounts.ts +4 -4
  97. package/lib/sandbox/recovery.ts +26 -18
  98. package/lib/sandbox/removal.ts +3 -26
  99. package/lib/sandbox/task-resolver.ts +9 -6
  100. package/lib/sandbox/workspace-identity.ts +6 -5
  101. package/lib/sandbox/workspace-view.ts +28 -20
  102. package/lib/task/activity-intent.ts +3 -17
  103. package/lib/task/artifact-lifecycle.ts +39 -11
  104. package/lib/task/artifact-operations.ts +28 -35
  105. package/lib/task/capabilities.ts +2 -2
  106. package/lib/task/commands/ls.ts +4 -3
  107. package/lib/task/commands/status.ts +1 -1
  108. package/lib/task/commit-operation.ts +5 -6
  109. package/lib/task/control-authority.ts +29 -35
  110. package/lib/task/create-service.ts +2 -4
  111. package/lib/task/create.ts +10 -51
  112. package/lib/task/delegation-receipts.ts +1 -1
  113. package/lib/task/delivery.ts +2 -10
  114. package/lib/task/events.ts +5 -32
  115. package/lib/task/finalization.ts +16 -24
  116. package/lib/task/lifecycle.ts +9 -50
  117. package/lib/task/local-artifact-finalization.ts +1 -4
  118. package/lib/task/orchestration.ts +31 -80
  119. package/lib/task/platform-operation-recovery.ts +1 -2
  120. package/lib/task/resolve-ref.ts +18 -12
  121. package/lib/task/review-finalization.ts +2 -52
  122. package/lib/task/review-identity.ts +3 -1
  123. package/lib/task/short-id.ts +10 -8
  124. package/lib/task/verification-engine.ts +20 -62
  125. package/lib/task/workspace-root.ts +78 -0
  126. package/lib/task/workspace-snapshot.ts +4 -3
  127. package/package.json +1 -1
  128. package/templates/.agents/QUICKSTART.en.md +19 -8
  129. package/templates/.agents/QUICKSTART.zh-CN.md +19 -8
  130. package/templates/.agents/README.en.md +10 -15
  131. package/templates/.agents/README.zh-CN.md +9 -13
  132. package/templates/.agents/rules/issue-sync.en.md +1 -1
  133. package/templates/.agents/rules/issue-sync.zh-CN.md +1 -1
  134. package/templates/.agents/rules/lifecycle-orchestration.en.md +1 -1
  135. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +1 -1
  136. package/templates/.agents/rules/next-step-output.en.md +2 -2
  137. package/templates/.agents/rules/next-step-output.zh-CN.md +2 -2
  138. package/templates/.agents/rules/pr-sync.en.md +1 -1
  139. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
  140. package/templates/.agents/rules/release-commands.en.md +3 -0
  141. package/templates/.agents/rules/release-commands.zh-CN.md +3 -0
  142. package/templates/.agents/rules/task-management.en.md +0 -2
  143. package/templates/.agents/rules/task-management.zh-CN.md +0 -2
  144. package/templates/.agents/rules/task-short-id.en.md +2 -2
  145. package/templates/.agents/rules/task-short-id.zh-CN.md +2 -2
  146. package/templates/.agents/scripts/task-short-id.js +2 -8
  147. package/templates/.agents/skills/analyze-task/SKILL.en.md +6 -6
  148. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
  149. package/templates/.agents/skills/analyze-task/config/verify.en.json +0 -1
  150. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +0 -1
  151. package/templates/.agents/skills/archive-tasks/SKILL.en.md +5 -5
  152. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +5 -5
  153. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +10 -2
  154. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  155. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +5 -5
  156. package/templates/.agents/skills/block-task/config/verify.json +0 -1
  157. package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -6
  158. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -6
  159. package/templates/.agents/skills/cancel-task/config/verify.json +0 -1
  160. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  161. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
  162. package/templates/.agents/skills/code-task/config/verify.en.json +0 -1
  163. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +0 -1
  164. package/templates/.agents/skills/code-task/reference/output-template.en.md +1 -1
  165. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +1 -1
  166. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  167. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  168. package/templates/.agents/skills/commit/config/verify.json +0 -1
  169. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +2 -2
  170. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +2 -2
  171. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  172. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  173. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +2 -2
  174. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +2 -2
  175. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +0 -1
  176. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +0 -1
  177. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  178. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  179. package/templates/.agents/skills/complete-task/SKILL.en.md +7 -7
  180. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +8 -8
  181. package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
  182. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
  183. package/templates/.agents/skills/create-pr/SKILL.en.md +3 -3
  184. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +3 -3
  185. package/templates/.agents/skills/create-pr/config/verify.json +0 -1
  186. package/templates/.agents/skills/create-pr/reference/change-report.en.md +1 -1
  187. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +1 -1
  188. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
  189. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
  190. package/templates/.agents/skills/create-release-note/SKILL.en.md +2 -2
  191. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +2 -2
  192. package/templates/.agents/skills/create-task/SKILL.en.md +4 -4
  193. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -4
  194. package/templates/.agents/skills/create-task/config/verify.json +0 -1
  195. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  196. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  197. package/templates/.agents/skills/import-codescan/config/verify.json +0 -1
  198. package/templates/.agents/skills/import-dependabot/SKILL.en.md +3 -3
  199. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
  200. package/templates/.agents/skills/import-dependabot/config/verify.json +0 -1
  201. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  202. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  203. package/templates/.agents/skills/import-issue/config/verify.json +0 -1
  204. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
  205. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
  206. package/templates/.agents/skills/plan-task/config/verify.en.json +0 -1
  207. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +0 -1
  208. package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
  209. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +3 -3
  210. package/templates/.agents/skills/restore-task/config/verify.json +0 -1
  211. package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
  212. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
  213. package/templates/.agents/skills/review-analysis/config/verify.en.json +0 -1
  214. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +0 -1
  215. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +5 -5
  216. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +5 -5
  217. package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
  218. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
  219. package/templates/.agents/skills/review-code/reference/output-templates.en.md +4 -4
  220. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +4 -4
  221. package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
  222. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
  223. package/templates/.agents/skills/review-plan/config/verify.en.json +0 -1
  224. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +0 -1
  225. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +5 -5
  226. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +5 -5
  227. package/templates/.agents/skills/review-pr/SKILL.en.md +2 -2
  228. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +2 -2
  229. package/templates/.agents/skills/review-pr/config/verify.en.json +0 -1
  230. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +0 -1
  231. package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +1 -1
  232. package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +1 -1
  233. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +0 -1
  234. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +0 -1
  235. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  236. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  237. package/templates/.agents/skills/test/SKILL.en.md +0 -3
  238. package/templates/.agents/skills/test/SKILL.zh-CN.md +0 -3
  239. package/templates/.agents/skills/test-integration/SKILL.en.md +0 -3
  240. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +0 -3
  241. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +13 -6
  242. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +0 -3
  243. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +0 -3
  244. package/templates/.agents/skills/watch-pr/SKILL.en.md +3 -3
  245. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +3 -3
  246. package/templates/.agents/skills/watch-pr/config/verify.json +0 -1
  247. package/templates/.agents/templates/handoff.en.md +1 -1
  248. package/templates/.agents/templates/handoff.zh-CN.md +1 -1
  249. package/templates/.agents/workflows/bug-fix.en.yaml +1 -1
  250. package/templates/.agents/workflows/feature-development.en.yaml +1 -1
  251. package/templates/.agents/workflows/refactoring.en.yaml +1 -1
  252. package/dist/lib/task/task-execution-lock.js +0 -250
  253. package/lib/task/task-execution-lock.ts +0 -320
package/bin/cli.ts CHANGED
@@ -31,7 +31,7 @@ Commands:
31
31
  run Schedule a lifecycle skill in the task sandbox tmux session
32
32
  sandbox, s Manage Docker-based AI sandboxes
33
33
  server Run the local AI collaboration daemon (start/stop/status/logs)
34
- task, t Read-only views of .agents/workspace tasks
34
+ task, t Read-only views of project task workspaces
35
35
  sync Update seed files and sync file registry for an existing project
36
36
  update Update the agent-infra CLI itself
37
37
  version Show version
package/dist/bin/cli.js CHANGED
@@ -31,7 +31,7 @@ Commands:
31
31
  run Schedule a lifecycle skill in the task sandbox tmux session
32
32
  sandbox, s Manage Docker-based AI sandboxes
33
33
  server Run the local AI collaboration daemon (start/stop/status/logs)
34
- task, t Read-only views of .agents/workspace tasks
34
+ task, t Read-only views of project task workspaces
35
35
  sync Update seed files and sync file registry for an existing project
36
36
  update Update the agent-infra CLI itself
37
37
  version Show version
@@ -60,7 +60,7 @@ if (!taskViewGuardFailed && !markerlessHelp && (taskControlCommand || taskWorkfl
60
60
  }
61
61
  case 'direct-host':
62
62
  // The host CLI is the direct-host authority. Domain handlers retain their
63
- // task locks, atomic writes, and operation-specific recovery facts.
63
+ // atomic writes and operation-specific recovery facts.
64
64
  break;
65
65
  case 'sandbox-local': {
66
66
  break;
@@ -185,6 +185,11 @@ if (!controlRouted && !taskViewGuardFailed && internalRouteRegistered)
185
185
  taskContext(process.argv.slice(3));
186
186
  break;
187
187
  }
188
+ case 'task-workspace': {
189
+ const { taskWorkspace } = await import('../lib/internal/task-workspace.js');
190
+ taskWorkspace(process.argv.slice(3));
191
+ break;
192
+ }
188
193
  case 'task-ledger': {
189
194
  const { taskLedger } = await import('../lib/internal/task-ledger.js');
190
195
  await taskLedger(process.argv.slice(3));
@@ -6,7 +6,7 @@ import { locateActivityLog, pairEntries, appendActivityEntry } from '../../../ta
6
6
  import { captureTaskWriteMetadata, writeTask } from '../../../task/write.js';
7
7
  import { parseTypedTaskFrontmatter } from '../../../task/frontmatter.js';
8
8
  import { resolveTaskRef } from '../../../task/resolve-ref.js';
9
- import { recoverActivatedOrchestrationDelegationUnderLock, readRun } from '../../../task/orchestration.js';
9
+ import { recoverActivatedOrchestrationDelegation, readRun } from '../../../task/orchestration.js';
10
10
  const ACTIONS = {
11
11
  analysis: 'Analyze Task',
12
12
  'review-analysis': 'Review Analysis',
@@ -175,7 +175,7 @@ function appendRecoveryLog(request, taskId, section, candidate, repoRoot, writer
175
175
  taskId, receiptId: candidate.receipt.id, childId: candidate.receipt.childId
176
176
  });
177
177
  }
178
- function recoverStartedLifecycleUnderLock(request, options = {}) {
178
+ function recoverStartedLifecycle(request, options = {}) {
179
179
  if (!request || request.intent !== 'recover-started' || request.auto !== true || normalizeAgentToken(request.agent) !== 'codex') {
180
180
  return failure(request, 'conflict', 'RECOVERY_PAYLOAD_INVALID', 'automatic recovery requires a task and the Codex agent');
181
181
  }
@@ -259,7 +259,7 @@ function consumeRecoveryEvidence(request, taskId, repoRoot, pending, options) {
259
259
  let consumed = stored;
260
260
  if (stored.consumer === null) {
261
261
  try {
262
- consumed = store.consumeWithinTaskLock(pending.childId, pending.id, stored.state.startEvidence?.hookDefinitionHash, {
262
+ consumed = store.consume(pending.childId, pending.id, stored.state.startEvidence?.hookDefinitionHash, {
263
263
  taskId: pending.taskId, runId: pending.runId, receiptId: pending.id
264
264
  });
265
265
  }
@@ -272,7 +272,7 @@ function consumeRecoveryEvidence(request, taskId, repoRoot, pending, options) {
272
272
  : { result: failure(request, 'owner-unknown', 'RECOVERY_EVIDENCE_INVALID', 'consumed stop evidence has no timestamp', { taskId, receiptId: pending.id, childId: pending.childId }) };
273
273
  }
274
274
  function finishActiveRecovery(request, taskId, section, repoRoot, pending, row, options) {
275
- const recovered = recoverActivatedOrchestrationDelegationUnderLock(taskId, {
275
+ const recovered = recoverActivatedOrchestrationDelegation(taskId, {
276
276
  receiptId: pending.id,
277
277
  stage: pending.stage,
278
278
  round: pending.round,
@@ -286,7 +286,7 @@ function finishActiveRecovery(request, taskId, section, repoRoot, pending, row,
286
286
  return appendRecoveryLog(request, taskId, section, { receipt: recovered.run.receipts.at(-1), row }, repoRoot, options.writeTask ?? writeTask);
287
287
  }
288
288
  function recoverStartedLifecycleFromAdapter(request, options = {}) {
289
- return recoverStartedLifecycleUnderLock(request, options);
289
+ return recoverStartedLifecycle(request, options);
290
290
  }
291
- export { recoverStartedLifecycleFromAdapter, recoverStartedLifecycleUnderLock };
291
+ export { recoverStartedLifecycle, recoverStartedLifecycleFromAdapter };
292
292
  //# sourceMappingURL=recovery.js.map
@@ -1,6 +1,6 @@
1
1
  import crypto from 'node:crypto';
2
2
  import path from 'node:path';
3
- import { mutateDelegationAdapterEvidence, mutateDelegationAdapterEvidenceWithinTaskLock, readRun } from '../../../task/orchestration.js';
3
+ import { mutateDelegationAdapterEvidence, readRun } from '../../../task/orchestration.js';
4
4
  import { resolveTaskRef } from '../../../task/resolve-ref.js';
5
5
  import { createCodexLifecycleState, expireCodexLifecycleState, reduceCodexLifecycleEvent } from './evidence.js';
6
6
  function readCodexLifecycleActivationEvidence(receipt) {
@@ -111,10 +111,9 @@ function createCodexLifecycleStore(options) {
111
111
  }
112
112
  return matches[0];
113
113
  }
114
- function update(binding, key, mutate, taskLockHeld = false) {
114
+ function update(binding, key, mutate) {
115
115
  let result = null;
116
- const updateState = taskLockHeld ? mutateDelegationAdapterEvidenceWithinTaskLock : mutateDelegationAdapterEvidence;
117
- updateState(options.taskId, binding.receiptId, 'codex', (value) => {
116
+ mutateDelegationAdapterEvidence(options.taskId, binding.receiptId, 'codex', (value) => {
118
117
  const currentState = storedEvidence(value);
119
118
  const current = currentState.records[key] ?? null;
120
119
  result = mutate(current);
@@ -215,7 +214,7 @@ function createCodexLifecycleStore(options) {
215
214
  throw new Error(`Codex lifecycle child '${childThreadId}' was not found uniquely`);
216
215
  return matches[0];
217
216
  }
218
- function consumeWithLockMode(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding, taskLockHeld) {
217
+ function consume(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding) {
219
218
  if (!consumer.trim())
220
219
  throw new Error('Codex lifecycle consumer is required');
221
220
  const current = read(childThreadId);
@@ -223,11 +222,8 @@ function createCodexLifecycleStore(options) {
223
222
  if (!binding)
224
223
  throw new Error('Codex lifecycle task receipt binding is missing');
225
224
  const spawn = current.state.spawn;
226
- if (!spawn) {
227
- throw new Error(taskLockHeld
228
- ? 'Codex lifecycle task receipt binding is missing'
229
- : 'Codex lifecycle spawn evidence is missing');
230
- }
225
+ if (!spawn)
226
+ throw new Error('Codex lifecycle spawn evidence is missing');
231
227
  const key = recordKey(spawn.sessionId, spawn.turnId, spawn.toolUseId);
232
228
  return update(binding, key, (latest) => {
233
229
  if (!latest || expectedTaskBinding && JSON.stringify(latest.taskBinding) !== JSON.stringify(expectedTaskBinding)) {
@@ -244,13 +240,7 @@ function createCodexLifecycleStore(options) {
244
240
  if (latest.consumer)
245
241
  return latest;
246
242
  return Object.freeze({ ...latest, revision: latest.revision + 1, consumer, consumedAt: now(), updatedAt: now() });
247
- }, taskLockHeld);
248
- }
249
- function consume(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding) {
250
- return consumeWithLockMode(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding, false);
251
- }
252
- function consumeWithinTaskLock(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding) {
253
- return consumeWithLockMode(childThreadId, consumer, expectedHookDefinitionHash, expectedTaskBinding, true);
243
+ });
254
244
  }
255
245
  function expireBefore(cutoff) {
256
246
  let changed = 0;
@@ -271,7 +261,7 @@ function createCodexLifecycleStore(options) {
271
261
  }
272
262
  return changed;
273
263
  }
274
- return Object.freeze({ taskId: options.taskId, root: path.join(taskDir, '.runtime'), apply, applyToSpawn, consume, consumeWithinTaskLock, expireBefore, findByParent, findByTaskBinding, read });
264
+ return Object.freeze({ taskId: options.taskId, root: path.join(taskDir, '.runtime'), apply, applyToSpawn, consume, expireBefore, findByParent, findByTaskBinding, read });
275
265
  }
276
266
  export { createCodexLifecycleStore, hasActiveCodexLifecycleEvidence, readCodexLifecycleActivationEvidence };
277
267
  //# sourceMappingURL=store.js.map
@@ -347,7 +347,7 @@ async function sealCodexOrchestrationDelegation(childThreadId, options = {}) {
347
347
  }
348
348
  return sealMatchingOrchestrationDelegation('codex', { nativeAgent: record.state.startEvidence.nativeAgent, childId: childThreadId }, coreOptions(options), () => {
349
349
  try {
350
- const consumed = store.consumeWithinTaskLock(childThreadId, current.receipt.id, existing.state.spawn?.hookDefinitionHash, existing.taskBinding ?? undefined);
350
+ const consumed = store.consume(childThreadId, current.receipt.id, existing.state.spawn?.hookDefinitionHash, existing.taskBinding ?? undefined);
351
351
  return consumed.consumer === current.receipt.id && consumed.consumedAt
352
352
  ? null
353
353
  : bridgeFailure('ORCHESTRATION_CODEX_RECONCILIATION_FAILED', 'Codex lifecycle evidence was not consumed by the active receipt');
@@ -3,7 +3,6 @@ import { parseTaskScope } from './task/command-options.js';
3
3
  import { applyHumanDecision } from './task/decision-intents.js';
4
4
  import { canonicalTimestamp } from './task/write.js';
5
5
  import { resolveTaskContext } from './task/resolve-ref.js';
6
- import { TaskExecutionLockError, withTaskExecutionLock } from './task/task-execution-lock.js';
7
6
  function parseDecisionParts(parts) {
8
7
  const decision = [];
9
8
  let needsImplementation;
@@ -81,17 +80,13 @@ export async function decide(args, options = {}) {
81
80
  repoRoot: resolved.repoRoot,
82
81
  metadataProvider: () => ({ timestamp: now, agentInfraVersion: options.version ?? VERSION })
83
82
  };
84
- let result;
85
- const execute = async () => applyHumanDecision(request, writeOptions);
86
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
83
+ const result = await applyHumanDecision(request, writeOptions);
87
84
  if (result.error)
88
85
  throw new Error(result.error.message);
89
86
  return 0;
90
87
  }
91
88
  catch (error) {
92
- const message = error instanceof TaskExecutionLockError
93
- ? `${error.code}: ${error.message}`
94
- : error instanceof Error ? error.message : String(error);
89
+ const message = error instanceof Error ? error.message : String(error);
95
90
  process.stderr.write(`Error: ${message}\n`);
96
91
  return 1;
97
92
  }
@@ -49,6 +49,7 @@ export const INTERNAL_HANDLER_ROUTE_SELECTORS = Object.freeze({
49
49
  'pr-review-grade': ['decide', 'resolve-host', 'verify-artifact'],
50
50
  'platform-checks': ['inspect', 'watch', 'resolve-run', 'logs'],
51
51
  'task-context': ['resolve'],
52
+ 'task-workspace': ['resolve'],
52
53
  'task-ledger': ['decision-next-id', 'stage-status', 'finding-upsert', 'finding-respond', 'finding-review', 'decision-upsert', 'rework-intent-upsert', 'rework-intent-rebuild'],
53
54
  'task-warning': ['list', 'add', 'set-status'],
54
55
  'task-activity': ['pr-review-inspect', 'pr-review-start', 'pr-review-complete', 'pr-review-terminate'],
@@ -115,6 +116,8 @@ export function internalRouteSelector(command, args) {
115
116
  return args[1] ?? '';
116
117
  if (command === 'task-context')
117
118
  return first(args);
119
+ if (command === 'task-workspace')
120
+ return first(args);
118
121
  return first(args);
119
122
  }
120
123
  export function isInternalHandlerRoute(command, args) {
@@ -3,7 +3,6 @@ import path from 'node:path';
3
3
  import { locateActivityLog, pairEntries } from '../task/activity-log.js';
4
4
  import { resolveTaskRef } from '../task/resolve-ref.js';
5
5
  import { applyTaskEvent } from '../task/events.js';
6
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
7
6
  import { normalizeAgentToken } from '../agent-clients/tokens.js';
8
7
  import { MANUAL_VALIDATION_RECEIPT_PLACEHOLDER, createManualValidationReceipt, manualValidationFinalSummaryDigest, manualValidationFinalSummaryProjectionMatches, readManualValidationReceipt, writeManualValidationReceiptAtomic } from '../task/manual-validation-receipt.js';
9
8
  import { archiveManualValidationGeneration, createManualValidationTransaction, readManualValidationTransaction, retryManualValidationTransaction, summaryPreimageDigest, transitionManualValidationTransaction, validateManualValidationGenerationArchive, writeManualValidationTransactionAtomic } from '../task/manual-validation-transaction.js';
@@ -77,16 +76,9 @@ async function executeManualValidationTransaction(taskRef, values, cwd, options
77
76
  const resolved = resolveTaskRef(taskRef, { repoRoot: cwd });
78
77
  if (!resolved.ok)
79
78
  return result('failed', { code: resolved.code, message: resolved.message });
80
- try {
81
- return await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `manual-validation:${taskRef}`, () => executeManualValidationTransactionLocked(taskRef, values, cwd, resolved, agent, primaryResult, prepareOnly, options));
82
- }
83
- catch (error) {
84
- if (error instanceof TaskExecutionLockError)
85
- return result('failed', { code: error.code, message: error.message });
86
- throw error;
87
- }
79
+ return executeManualValidationTransactionAtResolvedTask(taskRef, values, cwd, resolved, agent, primaryResult, prepareOnly, options);
88
80
  }
89
- async function executeManualValidationTransactionLocked(taskRef, values, cwd, resolved, agent, primaryResult, prepareOnly, options) {
81
+ async function executeManualValidationTransactionAtResolvedTask(taskRef, values, cwd, resolved, agent, primaryResult, prepareOnly, options) {
90
82
  const artifactPath = path.resolve(resolved.taskDir, values.artifact);
91
83
  if (!prepareOnly && !fs.existsSync(artifactPath))
92
84
  return result('failed', { code: 'MANUAL_VALIDATION_ARTIFACT_MISSING', message: `manual-validation artifact is missing: ${values.artifact}` });
@@ -151,7 +143,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
151
143
  let startedEventApplied = false;
152
144
  if (!transactionResult.ok) {
153
145
  transaction = createTransaction();
154
- const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transactionId, reasonCode: 'user-request', transactionId }, { lockAlreadyHeld: true, repoRoot: cwd });
146
+ const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transactionId, reasonCode: 'user-request', transactionId }, { repoRoot: cwd });
155
147
  if (started.status === 'failed')
156
148
  return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
157
149
  startedEventApplied = true;
@@ -176,7 +168,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
176
168
  }
177
169
  }
178
170
  if (transaction.phase === 'prepared' && !startedEventApplied) {
179
- const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', transactionId: transaction.transactionId }, { lockAlreadyHeld: true, repoRoot: cwd });
171
+ const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', transactionId: transaction.transactionId }, { repoRoot: cwd });
180
172
  if (started.status === 'failed')
181
173
  return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
182
174
  }
@@ -196,7 +188,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
196
188
  if (transaction.phase === 'prepared') {
197
189
  const staged = await syncPullRequestSummary(taskRef, {
198
190
  cwd, client: options.client, agent, body: pendingBody, changeReportFile: path.resolve(cwd, values.changeReportFile), primaryResult: primaryResult, strict: true,
199
- manualValidation: { phase: 'pending', transactionId: transaction.transactionId }, lockAlreadyHeld: true
191
+ manualValidation: { phase: 'pending', transactionId: transaction.transactionId }
200
192
  });
201
193
  if (!['applied', 'no-op'].includes(staged.status))
202
194
  transactionFailure(staged.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'pending summary staging failed' });
@@ -235,7 +227,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
235
227
  transitionAndPersist('receipt-committed', { committedReceipt: receipt.receiptDigest });
236
228
  }
237
229
  if (transaction.phase === 'receipt-committed' && !transaction.eventAppended) {
238
- 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 }, { lockAlreadyHeld: true, repoRoot: cwd });
230
+ 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 });
239
231
  if (completed.status === 'failed')
240
232
  transactionFailure(completed.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation completion event failed' });
241
233
  transitionAndPersist('receipt-committed', { eventAppended: true });
@@ -245,7 +237,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
245
237
  }
246
238
  const promoted = await syncPullRequestSummary(taskRef, {
247
239
  cwd, client: options.client, agent, body: manualSummaryBody(finalBodyWithoutReceipt, 'final'), changeReportFile: path.resolve(cwd, values.changeReportFile), primaryResult, strict: true,
248
- manualValidation: { phase: 'final', transactionId: transaction.transactionId, receiptDigest: receipt.receiptDigest, prHeadSha: receipt.prHeadSha, authority: 'coordinator' }, lockAlreadyHeld: true
240
+ manualValidation: { phase: 'final', transactionId: transaction.transactionId, receiptDigest: receipt.receiptDigest, prHeadSha: receipt.prHeadSha, authority: 'coordinator' }
249
241
  });
250
242
  if (!['applied', 'no-op'].includes(promoted.status))
251
243
  transactionFailure(promoted.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'final summary promotion failed' });
@@ -261,7 +253,7 @@ async function executeManualValidationTransactionLocked(taskRef, values, cwd, re
261
253
  try {
262
254
  await syncPullRequestSummary(taskRef, {
263
255
  cwd, client: options.client, agent, body: pendingBody, changeReportFile: path.resolve(cwd, values.changeReportFile), primaryResult: primaryResult, strict: true,
264
- manualValidation: { phase: 'pending', transactionId: transaction.transactionId }, lockAlreadyHeld: true
256
+ manualValidation: { phase: 'pending', transactionId: transaction.transactionId }
265
257
  });
266
258
  }
267
259
  catch {
@@ -1,5 +1,6 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { resolveProjectTaskWorkspaceRoot } from '../task/workspace-root.js';
3
4
  import { createHash, randomUUID } from 'node:crypto';
4
5
  import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
5
6
  import { checkPlatformCommentOwner, listPlatformComments, syncPlatformComment } from '../platform/issue-comments.js';
@@ -115,14 +116,14 @@ async function platformComment(args = []) {
115
116
  return;
116
117
  }
117
118
  const outputPath = path.resolve(cwd, output);
118
- const workspaceDir = path.resolve(cwd, '.agents', 'workspace');
119
+ const workspaceDir = resolveProjectTaskWorkspaceRoot(cwd);
119
120
  const stagingDir = path.dirname(outputPath);
120
121
  const stagingParent = fs.existsSync(stagingDir) ? path.dirname(fs.realpathSync(stagingDir)) : '';
121
122
  const realWorkspace = fs.existsSync(workspaceDir) ? fs.realpathSync(workspaceDir) : '';
122
123
  if (path.basename(outputPath) !== 'task.md' || stagingParent !== realWorkspace
123
124
  || !path.basename(stagingDir).startsWith('.restore-staging-') || !fs.existsSync(stagingDir)
124
125
  || !fs.lstatSync(stagingDir).isDirectory() || fs.existsSync(outputPath)) {
125
- fail('recover output must be a new task.md inside an existing .agents/workspace/.restore-staging-* directory');
126
+ fail('recover output must be a new task.md inside an existing task-workspace/.restore-staging-* directory');
126
127
  return;
127
128
  }
128
129
  const listed = await listPlatformComments(issue, cwd);
@@ -1,6 +1,5 @@
1
1
  import { applyPrReviewActivityIntent, inspectPrReviewActivity } from '../task/activity-intent.js';
2
2
  import { resolveTaskRef } from '../task/resolve-ref.js';
3
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
4
3
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
5
4
  const USAGE = `Usage: agent-infra-internal task-activity <task-ref> pr-review-inspect
6
5
  agent-infra-internal task-activity <task-ref> pr-review-start --agent <agent> --artifact <canonical.md> --head <40hex> [--dry-run]
@@ -112,17 +111,7 @@ async function taskActivity(args = []) {
112
111
  usageFailure(resolved.message);
113
112
  return;
114
113
  }
115
- let result;
116
- try {
117
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-activity.${kind}`, async () => applyPrReviewActivityIntent(values, { lockAlreadyHeld: true }));
118
- }
119
- catch (error) {
120
- if (!(error instanceof TaskExecutionLockError))
121
- throw error;
122
- process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
123
- process.exitCode = 1;
124
- return;
125
- }
114
+ const result = await applyPrReviewActivityIntent(values);
126
115
  process.stdout.write(`${JSON.stringify(result)}\n`);
127
116
  if (result.status === 'failed')
128
117
  process.exitCode = 1;
@@ -1,7 +1,6 @@
1
1
  import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
2
2
  import { applyTaskEvent, eventCatalog } from '../task/events.js';
3
3
  import { resolveTaskRef } from '../task/resolve-ref.js';
4
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
5
4
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
6
5
  const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--orchestrated] [--dry-run]
7
6
 
@@ -93,17 +92,7 @@ async function taskEvent(args = []) {
93
92
  process.exitCode = 1;
94
93
  return;
95
94
  }
96
- let result;
97
- try {
98
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-event.${request.event}`, async () => applyTaskEvent(request, { lockAlreadyHeld: true }));
99
- }
100
- catch (error) {
101
- if (!(error instanceof TaskExecutionLockError))
102
- throw error;
103
- process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
104
- process.exitCode = 1;
105
- return;
106
- }
95
+ const result = await applyTaskEvent(request);
107
96
  process.stdout.write(`${JSON.stringify(result)}\n`);
108
97
  if (result.status === 'failed')
109
98
  process.exitCode = 1;
@@ -2,7 +2,6 @@ import fs from 'node:fs';
2
2
  import { applyLedgerIntent } from '../task/ledger-intents.js';
3
3
  import { LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, isReviewStage, parseLedgerDocument, summarizeLedgerStage, validateLedgerRows } from '../task/ledger.js';
4
4
  import { resolveTaskRef } from '../task/resolve-ref.js';
5
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
6
5
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
7
6
  const USAGE = `Usage: agent-infra-internal task-ledger <task-ref> <intent> [intent flags] [--dry-run]\n\nIntents: finding-upsert, finding-respond, finding-review, decision-next-id, decision-upsert, rework-intent-upsert, rework-intent-rebuild, stage-status\n`;
8
7
  const FLAGS = {
@@ -148,17 +147,7 @@ async function taskLedger(args = []) {
148
147
  usageFailure(lockResolved.message);
149
148
  return;
150
149
  }
151
- let result;
152
- try {
153
- result = await withTaskExecutionLock(lockResolved.repoRoot, lockResolved.taskId, `task-ledger.${kind}`, async () => applyLedgerIntent(values));
154
- }
155
- catch (error) {
156
- if (!(error instanceof TaskExecutionLockError))
157
- throw error;
158
- process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
159
- process.exitCode = 1;
160
- return;
161
- }
150
+ const result = await applyLedgerIntent(values);
162
151
  process.stdout.write(`${JSON.stringify(result)}\n`);
163
152
  if (result.status === 'failed')
164
153
  process.exitCode = 1;
@@ -77,6 +77,7 @@ function internalTaskRoutes() {
77
77
  descriptor('internal', 'platform-checks', 'resolve-run', 'conditional', 'diagnostic'),
78
78
  descriptor('internal', 'platform-checks', 'logs', 'conditional', 'diagnostic'),
79
79
  descriptor('internal', 'task-context', 'resolve', 'task-bound', 'diagnostic'),
80
+ descriptor('internal', 'task-workspace', 'resolve', 'non-task', 'diagnostic', 'none'),
80
81
  descriptor('internal', 'task-ledger', 'decision-next-id', 'task-bound', 'diagnostic'),
81
82
  descriptor('internal', 'task-ledger', 'stage-status', 'task-bound', 'diagnostic'),
82
83
  descriptor('internal', 'task-ledger', 'finding-upsert', 'task-bound', 'progress'),
@@ -176,7 +177,7 @@ export const INTERNAL_DISPATCHER_ROUTES = Object.freeze([
176
177
  'task-create', 'task-qualification', 'sandbox-control', 'agent-client', 'codex-lifecycle',
177
178
  'git-workflow', 'task-delivery', 'release-workflow', 'platform-release-notes', 'platform-security', 'platform-metadata', 'platform-context',
178
179
  'platform-comment', 'platform-issue', 'platform-pr', 'platform-pr-review', 'pr-review-grade',
179
- 'platform-checks', 'task-context', 'task-ledger', 'task-warning', 'task-activity', 'task-artifact',
180
+ 'platform-checks', 'task-context', 'task-workspace', 'task-ledger', 'task-warning', 'task-activity', 'task-artifact',
180
181
  'task-orchestration', 'task-review', 'task-event', 'task-lifecycle',
181
182
  'task-finalization', 'task-platform-recovery', 'task-short-id', 'task-snapshot', 'task-verify', 'task-validate', 'manual-validation'
182
183
  ]);
@@ -2,7 +2,6 @@ import fs from 'node:fs';
2
2
  import { applyQualificationConfirmation } from '../task/qualification-confirmation.js';
3
3
  import { applyQualificationProposal } from '../task/qualification-intents.js';
4
4
  import { resolveTaskRef } from '../task/resolve-ref.js';
5
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
6
5
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
7
6
  const USAGE = `Usage: agent-infra-internal task-qualification <task-ref> <proposal|confirm|supersede|revoke> --input <json-file> [--dry-run]\n`;
8
7
  function fail(message, code = 'QUALIFICATION_PROPOSAL_INVALID') {
@@ -71,20 +70,12 @@ async function taskQualification(args = []) {
71
70
  fail(resolved.message, resolved.code);
72
71
  return;
73
72
  }
74
- try {
75
- const result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-qualification.${operation}`, () => operation === 'proposal'
76
- ? applyQualificationProposal({ ...payload, taskRef: resolved.taskId, dryRun }, { repoRoot: resolved.repoRoot })
77
- : applyQualificationConfirmation({ ...payload, taskRef: resolved.taskId, operation, dryRun }, { repoRoot: resolved.repoRoot }));
78
- process.stdout.write(`${JSON.stringify(result)}\n`);
79
- if (result.status === 'failed')
80
- process.exitCode = 1;
81
- }
82
- catch (error) {
83
- if (error instanceof TaskExecutionLockError)
84
- fail(`${error.code}: ${error.message}`, error.code);
85
- else
86
- throw error;
87
- }
73
+ const result = await (operation === 'proposal'
74
+ ? applyQualificationProposal({ ...payload, taskRef: resolved.taskId, dryRun }, { repoRoot: resolved.repoRoot })
75
+ : applyQualificationConfirmation({ ...payload, taskRef: resolved.taskId, operation, dryRun }, { repoRoot: resolved.repoRoot }));
76
+ process.stdout.write(`${JSON.stringify(result)}\n`);
77
+ if (result.status === 'failed')
78
+ process.exitCode = 1;
88
79
  }
89
80
  export { taskQualification };
90
81
  //# sourceMappingURL=task-qualification.js.map
@@ -1,7 +1,6 @@
1
1
  import { parseReviewCommand } from '../task/review-command.js';
2
2
  import { finalizeReviewSummary, preflightReviewSummary } from '../task/review-finalization.js';
3
3
  import { resolveTaskRef } from '../task/resolve-ref.js';
4
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
5
4
  import { ensureInternalHandlerRoute } from './cli-route-inventory.js';
6
5
  const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--orchestrated] [--dry-run]\n';
7
6
  function failUsage(message) {
@@ -36,21 +35,9 @@ async function taskReview(args = []) {
36
35
  failUsage(resolved.message);
37
36
  return;
38
37
  }
39
- let result;
40
- try {
41
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-review.${operation}`, async () => {
42
- return operation === 'preflight'
43
- ? preflightReviewSummary({ taskRef: args[0], stage, artifact, orchestrated, dryRun }, { lockAlreadyHeld: true })
44
- : finalizeReviewSummary({ taskRef: args[0], stage, artifact, orchestrated, dryRun }, { lockAlreadyHeld: true });
45
- });
46
- }
47
- catch (error) {
48
- if (!(error instanceof TaskExecutionLockError))
49
- throw error;
50
- process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
51
- process.exitCode = 1;
52
- return;
53
- }
38
+ const result = operation === 'preflight'
39
+ ? preflightReviewSummary({ taskRef: args[0], stage, artifact, orchestrated, dryRun })
40
+ : finalizeReviewSummary({ taskRef: args[0], stage, artifact, orchestrated, dryRun });
54
41
  process.stdout.write(`${JSON.stringify(result)}\n`);
55
42
  if (result.status === 'failed')
56
43
  process.exitCode = 1;
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { detectRepoRoot } from '../task/resolve-ref.js';
3
+ import { resolveProjectTaskWorkspaceRoot } from '../task/workspace-root.js';
3
4
  import { configuredShortIdLength, executeShortIdCommand } from '../task/short-id.js';
4
5
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
5
6
  const USAGE = `Usage: agent-infra-internal task-short-id <alloc|release|resolve|list> [argument] [--active-dir <path>] [--short-id-length <N>] [--verify]\n`;
@@ -75,7 +76,7 @@ function taskShortId(args = []) {
75
76
  repoRoot = detectRepoRoot();
76
77
  }
77
78
  catch { /* custom active-dir mode */ }
78
- const resolvedActiveDir = activeDir ?? (repoRoot ? path.join(repoRoot, '.agents', 'workspace', 'active') : null);
79
+ const resolvedActiveDir = activeDir ?? (repoRoot ? path.join(resolveProjectTaskWorkspaceRoot(repoRoot), 'active') : null);
79
80
  if (!resolvedActiveDir) {
80
81
  failure('cannot determine active task directory');
81
82
  return;
@@ -1,6 +1,5 @@
1
1
  import { renderTaskVerification, verifyTaskEvent } from '../task/verification.js';
2
2
  import { resolveTaskRef } from '../task/resolve-ref.js';
3
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
4
3
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
5
4
  const USAGE = 'Usage: agent-infra-internal task-verify <N | TASK-id> <verification-event> [--artifact <canonical.md>] [--format json|text]\n';
6
5
  function fail(message) {
@@ -55,16 +54,7 @@ async function taskVerify(args = []) {
55
54
  fail(resolved.message);
56
55
  return;
57
56
  }
58
- let result;
59
- try {
60
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-verify.${event}`, async () => verifyTaskEvent({ taskRef, event, ...(artifact ? { artifact } : {}) }));
61
- }
62
- catch (error) {
63
- if (!(error instanceof TaskExecutionLockError))
64
- throw error;
65
- fail(`${error.code}: ${error.message}`);
66
- return;
67
- }
57
+ const result = await verifyTaskEvent({ taskRef, event, ...(artifact ? { artifact } : {}) });
68
58
  process.stdout.write(format === 'text' ? renderTaskVerification(result) : `${JSON.stringify(result)}\n`);
69
59
  process.exitCode = result.status === 'pass' ? 0 : result.status === 'blocked' ? 2 : 1;
70
60
  }
@@ -1,6 +1,5 @@
1
1
  import { applyWorkflowWarningIntent } from '../task/workflow-warning-intents.js';
2
2
  import { resolveTaskRef } from '../task/resolve-ref.js';
3
- import { TaskExecutionLockError, withTaskExecutionLock } from '../task/task-execution-lock.js';
4
3
  import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
5
4
  const USAGE = `Usage: agent-infra-internal task-warning <task-ref> <add|set-status|list> [intent flags] [--dry-run]\n`;
6
5
  const FLAGS = {
@@ -79,17 +78,7 @@ async function taskWarning(args = []) {
79
78
  usageFailure(resolved.message);
80
79
  return;
81
80
  }
82
- let result;
83
- try {
84
- result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-warning.${kind}`, async () => applyWorkflowWarningIntent(values));
85
- }
86
- catch (error) {
87
- if (!(error instanceof TaskExecutionLockError))
88
- throw error;
89
- process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: error.code, message: error.message } })}\n`);
90
- process.exitCode = 1;
91
- return;
92
- }
81
+ const result = await applyWorkflowWarningIntent(values);
93
82
  process.stdout.write(`${JSON.stringify(result)}\n`);
94
83
  if (result.status === 'failed')
95
84
  process.exitCode = 1;
@@ -0,0 +1,43 @@
1
+ import { detectRepoRoot } from '../task/resolve-ref.js';
2
+ import { resolveProjectTaskWorkspaceLayout } from '../task/workspace-root.js';
3
+ import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.js';
4
+ const USAGE = `Usage: agent-infra-internal task-workspace resolve [--boundary host|container]\n`;
5
+ function fail(code, message) {
6
+ process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code, message } })}\n`);
7
+ process.exitCode = 1;
8
+ }
9
+ function taskWorkspace(args = []) {
10
+ if (!ensureInternalHandlerRoute('task-workspace', args))
11
+ return;
12
+ const operation = args[0] ?? '';
13
+ if (operation === '--help' || operation === '-h') {
14
+ process.stdout.write(USAGE);
15
+ return;
16
+ }
17
+ if (!internalHandlerRoute('task-workspace', 'resolve', operation)) {
18
+ fail('TASK_WORKSPACE_PAYLOAD_INVALID', "operation must be 'resolve'");
19
+ return;
20
+ }
21
+ let boundary = 'host';
22
+ const options = args.slice(1);
23
+ if (options.length !== 0) {
24
+ if (options.length !== 2 || options[0] !== '--boundary') {
25
+ fail('TASK_WORKSPACE_PAYLOAD_INVALID', 'invalid or duplicate task-workspace option');
26
+ return;
27
+ }
28
+ boundary = options[1];
29
+ }
30
+ if (boundary !== 'host' && boundary !== 'container') {
31
+ fail('TASK_WORKSPACE_PAYLOAD_INVALID', 'resolve accepts only --boundary host|container');
32
+ return;
33
+ }
34
+ try {
35
+ const layout = resolveProjectTaskWorkspaceLayout(detectRepoRoot(), boundary);
36
+ process.stdout.write(`${JSON.stringify({ status: 'resolved', changed: false, projectKey: layout.projectKey, boundary: layout.boundary, root: layout.root, error: null })}\n`);
37
+ }
38
+ catch (error) {
39
+ fail('TASK_WORKSPACE_OPERATION_FAILED', error instanceof Error ? error.message : String(error));
40
+ }
41
+ }
42
+ export { taskWorkspace };
43
+ //# sourceMappingURL=task-workspace.js.map