@fitlab-ai/agent-infra 0.11.14 → 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.
- package/bin/cli.ts +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/bin/internal-cli.js +6 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +6 -6
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +8 -18
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +1 -1
- package/dist/lib/decide.js +2 -7
- package/dist/lib/internal/cli-route-inventory.js +3 -0
- package/dist/lib/internal/manual-validation.js +8 -16
- package/dist/lib/internal/platform-comment.js +3 -2
- package/dist/lib/internal/task-activity.js +1 -12
- package/dist/lib/internal/task-event.js +1 -12
- package/dist/lib/internal/task-finalization.js +2 -2
- package/dist/lib/internal/task-ledger.js +1 -12
- package/dist/lib/internal/task-operation-registry.js +2 -1
- package/dist/lib/internal/task-qualification.js +6 -15
- package/dist/lib/internal/task-review.js +3 -16
- package/dist/lib/internal/task-short-id.js +2 -1
- package/dist/lib/internal/task-verify.js +1 -11
- package/dist/lib/internal/task-warning.js +1 -12
- package/dist/lib/internal/task-workspace.js +43 -0
- package/dist/lib/merge.js +4 -3
- package/dist/lib/platform/pr-change-report.js +10 -3
- package/dist/lib/platform/pr-summary.js +6 -15
- package/dist/lib/platform/pull-requests.js +3 -15
- package/dist/lib/pr-review/evidence-grading.js +3 -2
- package/dist/lib/process-data/index.js +18 -6
- package/dist/lib/process-data/sources.js +6 -0
- package/dist/lib/run/index.js +3 -2
- package/dist/lib/sandbox/commands/create.js +5 -1
- package/dist/lib/sandbox/commands/enter.js +1 -1
- package/dist/lib/sandbox/commands/list-running.js +2 -1
- package/dist/lib/sandbox/control/client.js +8 -13
- package/dist/lib/sandbox/control/completed-reentry.js +2 -1
- package/dist/lib/sandbox/control/lifecycle.js +2 -21
- package/dist/lib/sandbox/control/task-view.js +4 -2
- package/dist/lib/sandbox/mounts.js +4 -4
- package/dist/lib/sandbox/recovery.js +26 -16
- package/dist/lib/sandbox/removal.js +3 -10
- package/dist/lib/sandbox/task-resolver.js +9 -6
- package/dist/lib/sandbox/workspace-identity.js +36 -20
- package/dist/lib/sandbox/workspace-view.js +29 -22
- package/dist/lib/task/activity-intent.js +2 -12
- package/dist/lib/task/artifact-lifecycle.js +17 -11
- package/dist/lib/task/artifact-operations.js +41 -49
- package/dist/lib/task/capabilities.js +2 -2
- package/dist/lib/task/commands/ls.js +4 -3
- package/dist/lib/task/commands/status.js +1 -1
- package/dist/lib/task/commit-operation.js +6 -6
- package/dist/lib/task/control-authority.js +32 -32
- package/dist/lib/task/create-service.js +2 -4
- package/dist/lib/task/create.js +12 -65
- package/dist/lib/task/delegation-receipts.js +1 -1
- package/dist/lib/task/delivery.js +2 -8
- package/dist/lib/task/events.js +5 -31
- package/dist/lib/task/finalization.js +17 -22
- package/dist/lib/task/lifecycle.js +38 -49
- package/dist/lib/task/local-artifact-finalization.js +1 -2
- package/dist/lib/task/orchestration.js +24 -57
- package/dist/lib/task/platform-operation-recovery.js +1 -2
- package/dist/lib/task/resolve-ref.js +17 -12
- package/dist/lib/task/review-finalization.js +2 -35
- package/dist/lib/task/review-identity.js +3 -1
- package/dist/lib/task/short-id.js +12 -10
- package/dist/lib/task/verification-engine.js +19 -58
- package/dist/lib/task/workspace-root.js +59 -0
- package/dist/lib/task/workspace-snapshot.js +4 -3
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +6 -6
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +8 -34
- package/lib/agent-clients/adapters/codex-orchestration.ts +1 -1
- package/lib/decide.ts +2 -7
- package/lib/internal/cli-route-inventory.ts +2 -0
- package/lib/internal/manual-validation.ts +8 -19
- package/lib/internal/platform-comment.ts +3 -2
- package/lib/internal/task-activity.ts +1 -10
- package/lib/internal/task-event.ts +1 -10
- package/lib/internal/task-finalization.ts +2 -2
- package/lib/internal/task-ledger.ts +1 -10
- package/lib/internal/task-operation-registry.ts +2 -1
- package/lib/internal/task-qualification.ts +5 -11
- package/lib/internal/task-review.ts +3 -14
- package/lib/internal/task-short-id.ts +2 -1
- package/lib/internal/task-verify.ts +1 -9
- package/lib/internal/task-warning.ts +1 -10
- package/lib/internal/task-workspace.ts +39 -0
- package/lib/merge.ts +4 -3
- package/lib/platform/pr-change-report.ts +9 -3
- package/lib/platform/pr-summary.ts +7 -16
- package/lib/platform/pull-requests.ts +3 -24
- package/lib/pr-review/evidence-grading.ts +3 -2
- package/lib/process-data/index.ts +17 -5
- package/lib/process-data/sources.ts +6 -0
- package/lib/run/index.ts +3 -2
- package/lib/sandbox/commands/create.ts +5 -1
- package/lib/sandbox/commands/enter.ts +1 -1
- package/lib/sandbox/commands/list-running.ts +2 -1
- package/lib/sandbox/control/client.ts +7 -12
- package/lib/sandbox/control/completed-reentry.ts +2 -1
- package/lib/sandbox/control/lifecycle.ts +4 -21
- package/lib/sandbox/control/task-view.ts +4 -2
- package/lib/sandbox/mounts.ts +4 -4
- package/lib/sandbox/recovery.ts +26 -18
- package/lib/sandbox/removal.ts +3 -26
- package/lib/sandbox/task-resolver.ts +9 -6
- package/lib/sandbox/workspace-identity.ts +42 -18
- package/lib/sandbox/workspace-view.ts +28 -20
- package/lib/task/activity-intent.ts +3 -17
- package/lib/task/artifact-lifecycle.ts +39 -11
- package/lib/task/artifact-operations.ts +28 -35
- package/lib/task/capabilities.ts +2 -2
- package/lib/task/commands/ls.ts +4 -3
- package/lib/task/commands/status.ts +1 -1
- package/lib/task/commit-operation.ts +5 -6
- package/lib/task/control-authority.ts +29 -35
- package/lib/task/create-service.ts +2 -4
- package/lib/task/create.ts +10 -51
- package/lib/task/delegation-receipts.ts +1 -1
- package/lib/task/delivery.ts +2 -10
- package/lib/task/events.ts +5 -32
- package/lib/task/finalization.ts +16 -24
- package/lib/task/lifecycle.ts +40 -51
- package/lib/task/local-artifact-finalization.ts +1 -4
- package/lib/task/orchestration.ts +31 -80
- package/lib/task/platform-operation-recovery.ts +1 -2
- package/lib/task/resolve-ref.ts +18 -12
- package/lib/task/review-finalization.ts +2 -52
- package/lib/task/review-identity.ts +3 -1
- package/lib/task/short-id.ts +15 -10
- package/lib/task/verification-engine.ts +20 -62
- package/lib/task/workspace-root.ts +78 -0
- package/lib/task/workspace-snapshot.ts +4 -3
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +19 -8
- package/templates/.agents/QUICKSTART.zh-CN.md +19 -8
- package/templates/.agents/README.en.md +10 -15
- package/templates/.agents/README.zh-CN.md +9 -13
- package/templates/.agents/rules/issue-sync.en.md +1 -1
- package/templates/.agents/rules/issue-sync.zh-CN.md +1 -1
- package/templates/.agents/rules/lifecycle-orchestration.en.md +1 -1
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +1 -1
- package/templates/.agents/rules/next-step-output.en.md +2 -2
- package/templates/.agents/rules/next-step-output.zh-CN.md +2 -2
- package/templates/.agents/rules/pr-sync.en.md +1 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
- package/templates/.agents/rules/release-commands.en.md +3 -0
- package/templates/.agents/rules/release-commands.zh-CN.md +3 -0
- package/templates/.agents/rules/task-management.en.md +0 -2
- package/templates/.agents/rules/task-management.zh-CN.md +0 -2
- package/templates/.agents/rules/task-short-id.en.md +2 -2
- package/templates/.agents/rules/task-short-id.zh-CN.md +2 -2
- package/templates/.agents/scripts/task-short-id.js +2 -8
- package/templates/.agents/skills/analyze-task/SKILL.en.md +6 -6
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/analyze-task/config/verify.en.json +0 -1
- package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/archive-tasks/SKILL.en.md +5 -5
- package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +10 -2
- package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/block-task/config/verify.json +0 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -6
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/cancel-task/config/verify.json +0 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/config/verify.en.json +0 -1
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/code-task/reference/output-template.en.md +1 -1
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/SKILL.en.md +1 -1
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/config/verify.json +0 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +2 -2
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +2 -2
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +0 -1
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +17 -9
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +18 -10
- package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +3 -3
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/create-pr/config/verify.json +0 -1
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +13 -3
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +13 -3
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
- package/templates/.agents/skills/create-release-note/SKILL.en.md +2 -2
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/create-task/SKILL.en.md +4 -4
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/create-task/config/verify.json +0 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-codescan/config/verify.json +0 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +3 -3
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/import-dependabot/config/verify.json +0 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/import-issue/config/verify.json +0 -1
- package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/plan-task/config/verify.en.json +0 -1
- package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/restore-task/config/verify.json +0 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/config/verify.en.json +0 -1
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +5 -5
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +5 -5
- package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +4 -4
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +4 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-plan/config/verify.en.json +0 -1
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +5 -5
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +5 -5
- package/templates/.agents/skills/review-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-pr/config/verify.en.json +0 -1
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +1 -1
- package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -5
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/run-manual-validation/config/verify.en.json +0 -1
- package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +0 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +13 -2
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +13 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -0
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/test/SKILL.en.md +0 -3
- package/templates/.agents/skills/test/SKILL.zh-CN.md +0 -3
- package/templates/.agents/skills/test-integration/SKILL.en.md +0 -3
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +0 -3
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +13 -6
- package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +0 -3
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +0 -3
- package/templates/.agents/skills/watch-pr/SKILL.en.md +21 -4
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +22 -5
- package/templates/.agents/skills/watch-pr/config/verify.json +0 -1
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +14 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +15 -1
- package/templates/.agents/templates/handoff.en.md +1 -1
- package/templates/.agents/templates/handoff.zh-CN.md +1 -1
- package/templates/.agents/workflows/bug-fix.en.yaml +1 -1
- package/templates/.agents/workflows/feature-development.en.yaml +1 -1
- package/templates/.agents/workflows/refactoring.en.yaml +1 -1
- package/dist/lib/runtime/agent-runtime.js +0 -33
- package/dist/lib/task/runtime-paths.js +0 -10
- package/dist/lib/task/task-execution-lock.js +0 -250
- package/lib/runtime/agent-runtime.ts +0 -41
- package/lib/task/runtime-paths.ts +0 -12
- 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
|
|
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
|
|
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/internal-cli.js
CHANGED
|
@@ -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
|
-
//
|
|
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 {
|
|
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
|
|
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.
|
|
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 =
|
|
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
|
|
289
|
+
return recoverStartedLifecycle(request, options);
|
|
290
290
|
}
|
|
291
|
-
export {
|
|
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,
|
|
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
|
|
114
|
+
function update(binding, key, mutate) {
|
|
115
115
|
let result = null;
|
|
116
|
-
|
|
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
|
|
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(
|
|
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
|
-
}
|
|
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,
|
|
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.
|
|
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');
|
package/dist/lib/decide.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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 }, {
|
|
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 }, {
|
|
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 }
|
|
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 }, {
|
|
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' }
|
|
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 }
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -3,7 +3,7 @@ import { createDirectHostExecutionContext, dispatchTaskControlOperation, parseTa
|
|
|
3
3
|
import { applyTaskFinalization } from '../task/finalization.js';
|
|
4
4
|
import { detectRepoRoot, resolveTaskRef } from '../task/resolve-ref.js';
|
|
5
5
|
import { resolveSandboxControlTransport } from './task-operation-registry.js';
|
|
6
|
-
import {
|
|
6
|
+
import { validateSandboxControlTaskIdentity } from '../sandbox/control/lifecycle.js';
|
|
7
7
|
import { loadSandboxControlLocation } from '../sandbox/config.js';
|
|
8
8
|
import { serializeTaskFinalizationEnvelope } from '../task/finalization-envelope.js';
|
|
9
9
|
import { verifyTaskEvent } from '../task/verification.js';
|
|
@@ -83,7 +83,7 @@ async function taskFinalization(args = []) {
|
|
|
83
83
|
beforeLifecycle: async (currentTaskId) => {
|
|
84
84
|
if (currentTaskId !== taskId)
|
|
85
85
|
throw new Error('SANDBOX_CONTROL_IDENTITY_MISMATCH');
|
|
86
|
-
|
|
86
|
+
validateSandboxControlTaskIdentity(controlRoot, { taskId, generation, controlRootId, statusDir });
|
|
87
87
|
},
|
|
88
88
|
preflight: (request, options) => verifyTaskEvent({ ...request, event: 'complete-task.hard-preflight' }, options)
|
|
89
89
|
});
|
|
@@ -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
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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, '
|
|
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
|
-
|
|
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
|
-
|
|
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
|