@fitlab-ai/agent-infra 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/README.zh-CN.md +0 -2
- package/dist/bin/internal-cli.js +2 -17
- package/dist/lib/agent-clients/adapter.js +0 -13
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +0 -5
- package/dist/lib/agent-clients/adapters/claude-code-credentials.js +0 -17
- package/dist/lib/agent-clients/adapters/claude-code.js +0 -9
- package/dist/lib/agent-clients/adapters/codex.js +0 -52
- package/dist/lib/agent-clients/adapters/opencode.js +0 -5
- package/dist/lib/agent-clients/adapters/traecli.js +0 -5
- package/dist/lib/agent-clients/config.js +19 -54
- package/dist/lib/agent-clients/registry.js +1 -12
- package/dist/lib/agent-clients/schema.js +0 -18
- package/dist/lib/agent-clients/tokens.js +1 -2
- package/dist/lib/agent-clients/types.js +0 -1
- package/dist/lib/decide.js +2 -0
- package/dist/lib/git/worktree-identity.js +1 -9
- package/dist/lib/internal/agent-client.js +2 -62
- package/dist/lib/internal/cli-route-inventory.js +1 -5
- package/dist/lib/internal/manual-validation.js +29 -27
- package/dist/lib/internal/platform-comment.js +56 -7
- package/dist/lib/internal/task-create.js +1 -1
- package/dist/lib/internal/task-event.js +1 -8
- package/dist/lib/internal/task-finalization.js +0 -1
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-operation-registry.js +4 -20
- package/dist/lib/internal/task-review.js +4 -4
- package/dist/lib/platform/comment-safety.js +1 -7
- package/dist/lib/platform/in-label-sync.js +1 -14
- package/dist/lib/platform/issue-comments.js +373 -282
- package/dist/lib/platform/issue-summary-content.js +112 -0
- package/dist/lib/platform/issues.js +1 -1
- package/dist/lib/platform/operation-coordinator.js +4 -2
- package/dist/lib/platform/pr-change-report.js +176 -30
- package/dist/lib/platform/pr-checks.js +2 -8
- package/dist/lib/platform/pr-summary-content.js +54 -0
- package/dist/lib/platform/pr-summary.js +318 -284
- package/dist/lib/platform/provider-validation.js +0 -20
- package/dist/lib/platform/pull-requests.js +73 -84
- package/dist/lib/platform/releases.js +1 -43
- package/dist/lib/platform/summary-content-pipeline.js +18 -0
- package/dist/lib/platform/verification-required.js +0 -2
- package/dist/lib/platform/verification-sync.js +1 -79
- package/dist/lib/process-data/normalize.js +1 -185
- package/dist/lib/process-data/privacy.js +1 -16
- package/dist/lib/process-data/sources.js +2 -279
- package/dist/lib/render.js +0 -12
- package/dist/lib/run/index.js +15 -10
- package/dist/lib/run/skills.js +0 -3
- package/dist/lib/sandbox/commands/create.js +40 -53
- package/dist/lib/sandbox/commands/list-running.js +0 -18
- package/dist/lib/sandbox/commands/start.js +7 -8
- package/dist/lib/sandbox/constants.js +0 -6
- package/dist/lib/sandbox/control/client.js +0 -1
- package/dist/lib/sandbox/control/container-identity.js +1 -16
- package/dist/lib/sandbox/control/executor.js +0 -4
- package/dist/lib/sandbox/control/identity-sentinel.js +0 -7
- package/dist/lib/sandbox/control/lifecycle.js +21 -37
- package/dist/lib/sandbox/control/native-file-lock.js +0 -3
- package/dist/lib/sandbox/control/server.js +18 -38
- package/dist/lib/sandbox/control/state.js +1 -9
- package/dist/lib/sandbox/dockerfile.js +0 -6
- package/dist/lib/sandbox/engine.js +0 -14
- package/dist/lib/sandbox/engines/docker-exact-discovery.js +1 -4
- package/dist/lib/sandbox/engines/wsl2-paths.js +0 -3
- package/dist/lib/sandbox/recovery.js +24 -26
- package/dist/lib/sandbox/removal.js +67 -518
- package/dist/lib/sandbox/task-resolver.js +0 -41
- package/dist/lib/sandbox/tools.js +1 -4
- package/dist/lib/sandbox/workspace-view.js +1 -2
- package/dist/lib/server/display.js +0 -6
- package/dist/lib/task/activity-intent.js +45 -40
- package/dist/lib/task/activity-log.js +9 -16
- package/dist/lib/task/artifact-command.js +1 -1
- package/dist/lib/task/artifact-lifecycle.js +61 -63
- package/dist/lib/task/artifact-name.js +0 -6
- package/dist/lib/task/artifact-operations.js +3 -3
- package/dist/lib/task/capabilities.js +4 -5
- package/dist/lib/task/commands/log.js +0 -6
- package/dist/lib/task/commands/status.js +17 -60
- package/dist/lib/task/commit-operation.js +28 -39
- package/dist/lib/task/completion-facts.js +56 -43
- package/dist/lib/task/control-authority.js +23 -256
- package/dist/lib/task/control-recovery.js +3 -5
- package/dist/lib/task/create.js +2 -4
- package/dist/lib/task/decision-intents.js +8 -9
- package/dist/lib/task/delivery-target.js +1 -40
- package/dist/lib/task/events.js +84 -107
- package/dist/lib/task/finalization.js +60 -15
- package/dist/lib/task/ledger-intents.js +1 -1
- package/dist/lib/task/lifecycle-execution.js +38 -33
- package/dist/lib/task/lifecycle.js +49 -41
- package/dist/lib/task/local-artifact-finalization.js +1 -4
- package/dist/lib/task/manual-validation-evidence.js +1 -37
- package/dist/lib/task/platform-operation-recovery.js +151 -108
- package/dist/lib/task/pr-delivery-fact.js +2 -5
- package/dist/lib/task/qualification-confirmation.js +5 -7
- package/dist/lib/task/resolve-ref.js +1 -25
- package/dist/lib/task/review-command.js +2 -2
- package/dist/lib/task/review-finalization.js +1 -21
- package/dist/lib/task/review-fingerprint.js +0 -4
- package/dist/lib/task/secure-fs.js +0 -56
- package/dist/lib/task/short-id.js +1 -39
- package/dist/lib/task/skill-scope.js +0 -1
- package/dist/lib/task/verification-engine.js +58 -282
- package/dist/lib/task/verification.js +6 -3
- package/dist/lib/task/write.js +11 -1
- package/lib/agent-clients/adapter.ts +0 -76
- package/lib/agent-clients/adapters/antigravity-cli.ts +0 -5
- package/lib/agent-clients/adapters/claude-code-credentials.ts +0 -19
- package/lib/agent-clients/adapters/claude-code.ts +0 -9
- package/lib/agent-clients/adapters/codex.ts +0 -56
- package/lib/agent-clients/adapters/opencode.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +0 -5
- package/lib/agent-clients/config.ts +20 -61
- package/lib/agent-clients/registry.ts +1 -34
- package/lib/agent-clients/schema.ts +0 -18
- package/lib/agent-clients/tokens.ts +1 -2
- package/lib/agent-clients/types.ts +0 -15
- package/lib/decide.ts +1 -0
- package/lib/git/worktree-identity.ts +0 -10
- package/lib/internal/agent-client.ts +2 -70
- package/lib/internal/cli-route-inventory.ts +1 -4
- package/lib/internal/manual-validation.ts +28 -27
- package/lib/internal/platform-comment.ts +46 -4
- package/lib/internal/task-create.ts +0 -1
- package/lib/internal/task-event.ts +1 -5
- package/lib/internal/task-finalization.ts +0 -1
- package/lib/internal/task-lifecycle.ts +3 -5
- package/lib/internal/task-operation-registry.ts +3 -19
- package/lib/internal/task-review.ts +4 -4
- package/lib/platform/comment-safety.ts +0 -10
- package/lib/platform/github-provider.ts +0 -2
- package/lib/platform/in-label-sync.ts +0 -16
- package/lib/platform/issue-comments.ts +478 -301
- package/lib/platform/issue-summary-content.ts +132 -0
- package/lib/platform/issues.ts +0 -2
- package/lib/platform/operation-coordinator.ts +4 -2
- package/lib/platform/pr-change-report.ts +165 -25
- package/lib/platform/pr-checks.ts +1 -10
- package/lib/platform/pr-review.ts +1 -1
- package/lib/platform/pr-summary-content.ts +60 -0
- package/lib/platform/pr-summary.ts +364 -257
- package/lib/platform/provider-bridge.ts +0 -1
- package/lib/platform/provider-loader.ts +1 -5
- package/lib/platform/provider-validation.ts +1 -49
- package/lib/platform/pull-requests.ts +64 -99
- package/lib/platform/releases.ts +1 -40
- package/lib/platform/summary-content-pipeline.ts +23 -0
- package/lib/platform/verification-required.ts +0 -2
- package/lib/platform/verification-sync.ts +0 -94
- package/lib/process-data/normalize.ts +1 -186
- package/lib/process-data/privacy.ts +2 -19
- package/lib/process-data/sources.ts +3 -283
- package/lib/render.ts +0 -15
- package/lib/run/index.ts +13 -7
- package/lib/run/skills.ts +0 -4
- package/lib/sandbox/commands/create.ts +37 -74
- package/lib/sandbox/commands/list-running.ts +0 -19
- package/lib/sandbox/commands/start.ts +7 -10
- package/lib/sandbox/constants.ts +0 -8
- package/lib/sandbox/control/client.ts +0 -1
- package/lib/sandbox/control/container-identity.ts +1 -16
- package/lib/sandbox/control/executor.ts +1 -5
- package/lib/sandbox/control/identity-sentinel.ts +0 -8
- package/lib/sandbox/control/lifecycle.ts +18 -51
- package/lib/sandbox/control/native-file-lock.ts +0 -8
- package/lib/sandbox/control/protocol.ts +0 -2
- package/lib/sandbox/control/server.ts +13 -39
- package/lib/sandbox/control/state.ts +1 -10
- package/lib/sandbox/dockerfile.ts +0 -11
- package/lib/sandbox/engine.ts +0 -17
- package/lib/sandbox/engines/docker-exact-discovery.ts +1 -5
- package/lib/sandbox/engines/wsl2-paths.ts +0 -4
- package/lib/sandbox/recovery.ts +24 -26
- package/lib/sandbox/removal.ts +58 -687
- package/lib/sandbox/shell.ts +1 -1
- package/lib/sandbox/task-resolver.ts +0 -48
- package/lib/sandbox/tools.ts +1 -5
- package/lib/sandbox/workspace-view.ts +2 -4
- package/lib/server/display.ts +0 -14
- package/lib/server/process-control.ts +1 -1
- package/lib/task/activity-intent.ts +36 -44
- package/lib/task/activity-log.ts +9 -22
- package/lib/task/artifact-command.ts +1 -1
- package/lib/task/artifact-lifecycle.ts +58 -67
- package/lib/task/artifact-name.ts +0 -7
- package/lib/task/artifact-operations.ts +3 -3
- package/lib/task/capabilities.ts +5 -6
- package/lib/task/commands/log.ts +0 -7
- package/lib/task/commands/status.ts +14 -79
- package/lib/task/commit-operation.ts +29 -51
- package/lib/task/completion-facts.ts +45 -42
- package/lib/task/control-authority.ts +27 -317
- package/lib/task/control-recovery.ts +2 -5
- package/lib/task/create.ts +2 -5
- package/lib/task/decision-intents.ts +5 -5
- package/lib/task/delivery-target.ts +0 -40
- package/lib/task/events.ts +89 -123
- package/lib/task/finalization.ts +52 -15
- package/lib/task/ledger-intents.ts +1 -1
- package/lib/task/lifecycle-execution.ts +37 -89
- package/lib/task/lifecycle.ts +48 -44
- package/lib/task/local-artifact-finalization.ts +0 -7
- package/lib/task/manual-validation-evidence.ts +1 -47
- package/lib/task/platform-operation-recovery.ts +117 -104
- package/lib/task/pr-delivery-fact.ts +2 -11
- package/lib/task/qualification-confirmation.ts +6 -6
- package/lib/task/resolve-ref.ts +0 -23
- package/lib/task/review-command.ts +2 -2
- package/lib/task/review-finalization.ts +1 -27
- package/lib/task/review-fingerprint.ts +0 -8
- package/lib/task/secure-fs.ts +0 -42
- package/lib/task/short-id.ts +0 -43
- package/lib/task/skill-scope.ts +0 -1
- package/lib/task/verification-engine.ts +56 -287
- package/lib/task/verification.ts +5 -5
- package/lib/task/write.ts +12 -1
- package/package.json +2 -2
- package/templates/.agents/README.en.md +1 -3
- package/templates/.agents/README.zh-CN.md +0 -2
- package/templates/.agents/rules/README.en.md +0 -1
- package/templates/.agents/rules/README.zh-CN.md +0 -1
- package/templates/.agents/rules/commit-and-pr.en.md +1 -1
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.en.md +0 -10
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +0 -10
- package/templates/.agents/rules/pr-sync.en.md +4 -2
- package/templates/.agents/rules/pr-sync.zh-CN.md +6 -9
- package/templates/.agents/rules/task-management.en.md +3 -3
- package/templates/.agents/rules/task-management.zh-CN.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/commit/SKILL.en.md +2 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +6 -6
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +6 -6
- 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/reference/summary-update.en.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-task/SKILL.en.md +10 -25
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +11 -26
- package/templates/.agents/skills/create-pr/SKILL.en.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -2
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -2
- package/templates/.agents/skills/create-task/SKILL.en.md +0 -18
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +0 -18
- package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -75
- package/templates/.agents/skills/watch-pr/SKILL.en.md +1 -1
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +3 -3
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +3 -3
- package/templates/.agents/templates/task.en.md +1 -0
- package/templates/.agents/templates/task.zh-CN.md +1 -0
- package/templates/.claude/settings.json +0 -24
- package/templates/.codex/hooks.json +0 -50
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +0 -582
- package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +0 -114
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +0 -237
- package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +0 -443
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +0 -236
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +0 -292
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +0 -267
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +0 -466
- package/dist/lib/internal/task-orchestration.js +0 -71
- package/dist/lib/platform/verification.js +0 -6
- package/dist/lib/run/prompt.js +0 -2
- package/dist/lib/sandbox/engines/authority.js +0 -289
- package/dist/lib/task/delegation-receipts.js +0 -410
- package/dist/lib/task/orchestration.js +0 -1233
- package/dist/lib/task/verification-checks.js +0 -9
- package/dist/lib/task/workspace-snapshot.js +0 -121
- package/dist/lifecycle-build-manifest.json +0 -6
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +0 -688
- package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +0 -147
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +0 -349
- package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +0 -506
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +0 -385
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +0 -41
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +0 -418
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +0 -354
- package/lib/agent-clients/adapters/codex-orchestration.ts +0 -630
- package/lib/internal/task-orchestration.ts +0 -74
- package/lib/platform/verification.ts +0 -11
- package/lib/run/prompt.ts +0 -1
- package/lib/sandbox/engines/authority.ts +0 -365
- package/lib/task/delegation-receipts.ts +0 -547
- package/lib/task/orchestration.ts +0 -1651
- package/lib/task/verification-checks.ts +0 -10
- package/lib/task/workspace-snapshot.ts +0 -144
- package/templates/.agents/hooks/lifecycle-delegation.js +0 -140
- package/templates/.agents/rules/lifecycle-orchestration.en.md +0 -44
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +0 -44
- package/templates/.agents/skills/run-task/SKILL.en.md +0 -29
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +0 -29
- package/templates/.agents/skills/run-task/config/verify.en.json +0 -10
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +0 -10
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +0 -24
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +0 -24
- package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +0 -6
- package/templates/.claude/commands/run-task.en.md +0 -8
- package/templates/.claude/commands/run-task.zh-CN.md +0 -8
- package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +0 -3
- package/templates/.opencode/commands/run-task.en.md +0 -11
- package/templates/.opencode/commands/run-task.zh-CN.md +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { appendActivityEntry, locateActivityLog } from './activity-log.js';
|
|
4
|
+
import { activityWarnings, appendActivityEntry, locateActivityLog } from './activity-log.js';
|
|
5
5
|
import { artifactFamilyCatalog, inspectArtifactDirectory } from './artifact-lifecycle.js';
|
|
6
6
|
import { parseArtifactName } from './artifact-name.js';
|
|
7
7
|
import { parseTypedTaskFrontmatter, updateTaskFrontmatter } from './frontmatter.js';
|
|
@@ -15,7 +15,7 @@ import { taskIssueIdentity } from '../platform/task-identities.js';
|
|
|
15
15
|
import { resourceIdentityEquals } from '../platform/resource-identity.js';
|
|
16
16
|
import { resolveProjectTaskWorkspaceRoot } from './workspace-root.js';
|
|
17
17
|
const lifecycleIntentCatalog = [
|
|
18
|
-
'block', 'activate', 'cancel', 'complete', 'close-codescan', 'close-dependabot', 'restore'
|
|
18
|
+
'block', 'activate', 'cancel', 'complete', 'close-codescan', 'close-dependabot', 'restore'
|
|
19
19
|
];
|
|
20
20
|
const lifecycleFailureCatalog = [
|
|
21
21
|
'LIFECYCLE_DIRECTORY_TRANSFER_FAILED',
|
|
@@ -82,9 +82,6 @@ function failed(request, error, extra = {}) {
|
|
|
82
82
|
error, ...extra
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
export function taskLifecycleFailure(request, error, taskId = null) {
|
|
86
|
-
return failed(request, error, { taskId });
|
|
87
|
-
}
|
|
88
85
|
function normalizedRequest(request) {
|
|
89
86
|
if (!request || typeof request !== 'object' || !lifecycleIntentCatalog.includes(request.intent)) {
|
|
90
87
|
return { code: 'LIFECYCLE_PAYLOAD_INVALID', message: 'intent is not in the lifecycle catalog' };
|
|
@@ -300,26 +297,11 @@ function taskBoundControlMoveSafety(request, controlRoot, options, taskId, repoR
|
|
|
300
297
|
}
|
|
301
298
|
return null;
|
|
302
299
|
}
|
|
303
|
-
function
|
|
304
|
-
const orchestrationPath = path.join(sourcePath, '.runtime', 'orchestration.json');
|
|
305
|
-
if (!pathExists(orchestrationPath))
|
|
306
|
-
return null;
|
|
307
|
-
try {
|
|
308
|
-
const run = JSON.parse(fs.readFileSync(orchestrationPath, 'utf8'));
|
|
309
|
-
if (run.status === 'running' || run.pendingDelegation !== null && run.pendingDelegation !== undefined) {
|
|
310
|
-
return { code: 'LIFECYCLE_RUNTIME_MOVE_UNSAFE', message: 'task orchestration has an active or pending delegation; settle it before moving the task directory' };
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
catch {
|
|
314
|
-
return { code: 'LIFECYCLE_RUNTIME_MOVE_UNSAFE', message: 'task orchestration state is unreadable; refusing to move the task directory' };
|
|
315
|
-
}
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
function runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot, sourcePath, validateControlManifestIdentity) {
|
|
300
|
+
function runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot, validateControlManifestIdentity) {
|
|
319
301
|
if (!movingTaskDirectory)
|
|
320
302
|
return null;
|
|
321
303
|
const controlSafety = taskBoundControlMoveSafety(request, options.controlRoot, options, taskId, repoRoot, validateControlManifestIdentity);
|
|
322
|
-
return controlSafety
|
|
304
|
+
return controlSafety;
|
|
323
305
|
}
|
|
324
306
|
function targetContainsTask(targetPath, taskId, request) {
|
|
325
307
|
try {
|
|
@@ -356,16 +338,26 @@ function actionAndNote(request, restoredFiles = 0) {
|
|
|
356
338
|
return { action: 'Close Codescan', note: `Code Scanning alert #${request.alertNumber} dismissed: ${request.reason}` };
|
|
357
339
|
if (request.intent === 'close-dependabot')
|
|
358
340
|
return { action: 'Close Dependabot', note: `Dependabot alert #${request.alertNumber} dismissed: ${request.reason}` };
|
|
359
|
-
if (request.intent === 'recover-started')
|
|
360
|
-
return { action: 'Recover Started', note: 'automatic recovery' };
|
|
361
341
|
return { action: 'Restore Task', note: `Restored ${restoredFiles} files from Issue #${request.issueNumber}` };
|
|
362
342
|
}
|
|
343
|
+
function completionKeys(content) {
|
|
344
|
+
const value = parseTypedTaskFrontmatter(content).lifecycle_transition;
|
|
345
|
+
if (value === undefined)
|
|
346
|
+
return [];
|
|
347
|
+
if (typeof value !== 'string')
|
|
348
|
+
throw new Error('invalid lifecycle transition');
|
|
349
|
+
const state = JSON.parse(value);
|
|
350
|
+
if (!state || typeof state !== 'object' || !('completedKeys' in state) || !Array.isArray(state.completedKeys))
|
|
351
|
+
throw new Error('invalid lifecycle transition');
|
|
352
|
+
return state.completedKeys.map((key) => {
|
|
353
|
+
if (!key || typeof key !== 'object' || !('action' in key) || typeof key.action !== 'string' || !('agent' in key) || typeof key.agent !== 'string' || !('note' in key) || typeof key.note !== 'string')
|
|
354
|
+
throw new Error('invalid lifecycle completion identity');
|
|
355
|
+
return key;
|
|
356
|
+
});
|
|
357
|
+
}
|
|
363
358
|
function matchingCompletion(content, request, restoredFiles = 0) {
|
|
364
|
-
const section = locateActivityLog(content);
|
|
365
|
-
if (!section)
|
|
366
|
-
return false;
|
|
367
359
|
const identity = actionAndNote(request, restoredFiles);
|
|
368
|
-
return
|
|
360
|
+
return completionKeys(content).some((entry) => entry.action === identity.action && entry.agent === request.agent && entry.note === identity.note);
|
|
369
361
|
}
|
|
370
362
|
function validateRestoreStaging(request, repoRoot, taskId) {
|
|
371
363
|
let workspace;
|
|
@@ -424,13 +416,17 @@ function validateRestoreStaging(request, repoRoot, taskId) {
|
|
|
424
416
|
}
|
|
425
417
|
return { stagingDir, fileCount: entries.filter((entry) => !entry.name.startsWith('.')).length };
|
|
426
418
|
}
|
|
427
|
-
function
|
|
428
|
-
const section = locateActivityLog(content) ?? (
|
|
419
|
+
function lifecycleActivityMutation(content, request, metadata, identity, allowMissing) {
|
|
420
|
+
const section = locateActivityLog(content) ?? (allowMissing ? { heading: 'Activity Log', body: '', entries: [] } : null);
|
|
429
421
|
if (!section)
|
|
430
|
-
return
|
|
431
|
-
const identity = actionAndNote(request, restoredFiles);
|
|
422
|
+
return [];
|
|
432
423
|
let body = appendActivityEntry(section, { time: metadata.timestamp, step: `${identity.action} [started]`, agent: request.agent, note: 'started' });
|
|
433
424
|
body = appendActivityEntry({ ...section, body }, { time: metadata.timestamp, step: identity.action, agent: request.agent, note: identity.note });
|
|
425
|
+
return [{ kind: 'section', aliases: ['活动日志', 'Activity Log'], heading: section.heading, body }];
|
|
426
|
+
}
|
|
427
|
+
function mutationsFor(request, content, metadata, restoredFiles, allowMissingActivityLog = false) {
|
|
428
|
+
const identity = actionAndNote(request, restoredFiles);
|
|
429
|
+
const activityMutation = lifecycleActivityMutation(content, request, metadata, identity, allowMissingActivityLog);
|
|
434
430
|
const set = {};
|
|
435
431
|
const remove = [];
|
|
436
432
|
if (request.intent === 'block') {
|
|
@@ -458,9 +454,13 @@ function mutationsFor(request, content, metadata, restoredFiles, allowMissingAct
|
|
|
458
454
|
if (frontmatter.target_date === '')
|
|
459
455
|
set.target_date = metadata.timestamp.slice(0, 10);
|
|
460
456
|
}
|
|
457
|
+
const completedKeys = completionKeys(content);
|
|
458
|
+
if (!matchingCompletion(content, request, restoredFiles))
|
|
459
|
+
completedKeys.push({ ...identity, agent: request.agent });
|
|
460
|
+
set.lifecycle_transition = JSON.stringify({ completedKeys });
|
|
461
461
|
const mutations = [
|
|
462
462
|
{ kind: 'frontmatter', set, remove: [...new Set(remove)] },
|
|
463
|
-
|
|
463
|
+
...activityMutation
|
|
464
464
|
];
|
|
465
465
|
if (request.intent === 'block') {
|
|
466
466
|
mutations.splice(1, 0, {
|
|
@@ -595,9 +595,6 @@ export function inspectTaskLifecycleProgress(repoRoot, taskId, agent) {
|
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
function applyTaskLifecycle(requestInput, options = {}) {
|
|
598
|
-
if (requestInput.intent === 'recover-started') {
|
|
599
|
-
return failed(requestInput, { code: 'LIFECYCLE_RECOVERY_REQUIRES_AUTHORITY', message: 'recover-started must be dispatched through task control authority' });
|
|
600
|
-
}
|
|
601
598
|
const normalized = normalizedRequest(requestInput);
|
|
602
599
|
if ('code' in normalized)
|
|
603
600
|
return failed(requestInput, normalized);
|
|
@@ -674,7 +671,7 @@ function applyTaskLifecycle(requestInput, options = {}) {
|
|
|
674
671
|
&& !(request.intent === 'complete' && targetContainsTask(targetPath, taskId, request))) {
|
|
675
672
|
return failed(request, { code: 'LIFECYCLE_TARGET_CONFLICT', message: `target directory already exists: ${targetPath}` }, { taskId, sourceState, targetState: spec.target, sourcePath, targetPath });
|
|
676
673
|
}
|
|
677
|
-
const moveSafety = runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot,
|
|
674
|
+
const moveSafety = runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot, true);
|
|
678
675
|
if (moveSafety)
|
|
679
676
|
return failed(request, moveSafety, { taskId, sourceState, targetState: spec.target, sourcePath, targetPath });
|
|
680
677
|
const content = io.readFileSync(currentTaskFile);
|
|
@@ -687,8 +684,6 @@ function applyTaskLifecycle(requestInput, options = {}) {
|
|
|
687
684
|
}
|
|
688
685
|
if (frontmatter.id !== taskId)
|
|
689
686
|
return failed(request, { code: 'LIFECYCLE_IDENTITY_INVALID', message: 'task.md id does not match its lifecycle task id' }, { taskId, sourceState, targetState: spec.target, sourcePath, targetPath });
|
|
690
|
-
if (!locateActivityLog(content))
|
|
691
|
-
return failed(request, { code: 'LIFECYCLE_LOG_MISSING', message: 'task has no unique Activity Log section' }, { taskId, sourceState, targetState: spec.target, sourcePath, targetPath });
|
|
692
687
|
if (spec.target === 'active') {
|
|
693
688
|
const contract = validateCurrentTaskContract(content);
|
|
694
689
|
if (!contract.ok)
|
|
@@ -832,7 +827,7 @@ function applyTaskLifecycle(requestInput, options = {}) {
|
|
|
832
827
|
if (fs.existsSync(targetPath) && !fs.existsSync(path.join(sourcePath, 'task.md')))
|
|
833
828
|
completed.add('directory-moved');
|
|
834
829
|
if (!completed.has('directory-moved')) {
|
|
835
|
-
const moveSafety = runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot,
|
|
830
|
+
const moveSafety = runtimeMoveSafety(request, movingTaskDirectory, options, taskId, repoRoot, false);
|
|
836
831
|
if (moveSafety)
|
|
837
832
|
return failed(request, moveSafety, { taskId, sourceState, targetState: spec.target, sourcePath, targetPath, journalPath, completedSteps: [...completed], changed: completed.size > 0, timestamp: journal.metadata.timestamp, agentInfraVersion: journal.metadata.agentInfraVersion });
|
|
838
833
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
@@ -967,5 +962,18 @@ function applyTaskLifecycle(requestInput, options = {}) {
|
|
|
967
962
|
journalPath, completedSteps: [...completed], pendingSteps: []
|
|
968
963
|
};
|
|
969
964
|
}
|
|
970
|
-
|
|
965
|
+
function applyTaskLifecycleWithWarnings(request, options = {}) {
|
|
966
|
+
const resolved = resolveTaskRef(request.taskRef, { repoRoot: options.repoRoot });
|
|
967
|
+
const taskFile = resolved.ok ? resolved.taskMdPath : request.intent === 'restore' ? path.join(request.stagingDir, 'task.md') : null;
|
|
968
|
+
let warnings = [];
|
|
969
|
+
if (taskFile) {
|
|
970
|
+
try {
|
|
971
|
+
warnings = activityWarnings(fs.readFileSync(taskFile, 'utf8'));
|
|
972
|
+
}
|
|
973
|
+
catch { /* The lifecycle operation reports its own read failure. */ }
|
|
974
|
+
}
|
|
975
|
+
const result = applyTaskLifecycle(request, options);
|
|
976
|
+
return result.status === 'failed' || !warnings.length ? result : { ...result, warnings };
|
|
977
|
+
}
|
|
978
|
+
export { lifecycleIntentCatalog, lifecycleFailureCatalog, lifecycleProducerCatalog, applyTaskLifecycleWithWarnings as applyTaskLifecycle, previewTaskCompletion };
|
|
971
979
|
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -113,9 +113,6 @@ function prepareLocalArtifact(request, candidate) {
|
|
|
113
113
|
repoRoot: resolved.repoRoot
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function commitLocalArtifactProvenance(prepared) {
|
|
117
|
-
return prepared.result;
|
|
118
|
-
}
|
|
119
116
|
function finalizeLocalArtifact(request) {
|
|
120
117
|
return prepareLocalArtifact(request).result;
|
|
121
118
|
}
|
|
@@ -124,5 +121,5 @@ function preflightLocalArtifact(request) {
|
|
|
124
121
|
const prepared = prepareLocalArtifact(request);
|
|
125
122
|
return prepared.result;
|
|
126
123
|
}
|
|
127
|
-
export { LOCAL_ARTIFACT_REQUIRED_SECTIONS, finalizeLocalArtifact, preflightLocalArtifact, prepareLocalArtifact,
|
|
124
|
+
export { LOCAL_ARTIFACT_REQUIRED_SECTIONS, finalizeLocalArtifact, preflightLocalArtifact, prepareLocalArtifact, canonicalSemanticDigest as semanticDigest, sha256Content, validateLocalArtifact };
|
|
128
125
|
//# sourceMappingURL=local-artifact-finalization.js.map
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
1
|
import { MANUAL_VALIDATION_SHA40 as SHA40, MANUAL_VALIDATION_TASK_ID as TASK_ID, exactKeys, isRecord, validTimestamp } from './manual-validation-shared.js';
|
|
4
2
|
const MANUAL_VALIDATION_EVIDENCE_SCHEMA = 'agent-infra/branch-only-validation-evidence';
|
|
5
3
|
const MANUAL_VALIDATION_EVIDENCE_VERSION = 1;
|
|
@@ -92,39 +90,5 @@ function manualValidationEvidenceSummary(evidence) {
|
|
|
92
90
|
cleanup: evidence.result.cleanup
|
|
93
91
|
};
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
const shape = validateShape(value);
|
|
97
|
-
if (!shape.ok)
|
|
98
|
-
return shape;
|
|
99
|
-
const evidence = shape.value;
|
|
100
|
-
if (evidence.result.exitCode !== 0 || evidence.result.signal !== null || evidence.result.cleanup !== 'completed') {
|
|
101
|
-
return { ok: false, error: { code: 'MANUAL_VALIDATION_EVIDENCE_UNSUCCESSFUL', message: 'validation must exit 0 without a signal and complete cleanup' } };
|
|
102
|
-
}
|
|
103
|
-
if (expected) {
|
|
104
|
-
if (evidence.taskId !== expected.taskId || evidence.branch !== expected.branch) {
|
|
105
|
-
return { ok: false, error: { code: 'MANUAL_VALIDATION_EVIDENCE_IDENTITY_MISMATCH', message: 'evidence task or branch does not match the expected identity' } };
|
|
106
|
-
}
|
|
107
|
-
if (expected.commit !== undefined && evidence.commit !== expected.commit) {
|
|
108
|
-
return { ok: false, error: { code: 'MANUAL_VALIDATION_EVIDENCE_STALE', message: 'evidence commit does not match the current head' } };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return shape;
|
|
112
|
-
}
|
|
113
|
-
function readManualValidationEvidence(file, expected) {
|
|
114
|
-
let parsed;
|
|
115
|
-
try {
|
|
116
|
-
parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
const code = error.code === 'ENOENT'
|
|
120
|
-
? 'MANUAL_VALIDATION_EVIDENCE_MISSING'
|
|
121
|
-
: 'MANUAL_VALIDATION_EVIDENCE_INVALID';
|
|
122
|
-
return { ok: false, error: { code, message: error instanceof Error ? error.message : String(error) } };
|
|
123
|
-
}
|
|
124
|
-
return validateManualValidationEvidence(parsed, expected);
|
|
125
|
-
}
|
|
126
|
-
function manualValidationEvidenceDigest(evidence) {
|
|
127
|
-
return createHash('sha256').update(JSON.stringify(evidence), 'utf8').digest('hex');
|
|
128
|
-
}
|
|
129
|
-
export { MANUAL_VALIDATION_EVIDENCE_SCHEMA, MANUAL_VALIDATION_EVIDENCE_VERSION, createManualValidationEvidence, manualValidationEvidenceSummary, manualValidationEvidenceDigest, readManualValidationEvidence, validateManualValidationEvidence };
|
|
93
|
+
export { MANUAL_VALIDATION_EVIDENCE_SCHEMA, MANUAL_VALIDATION_EVIDENCE_VERSION, createManualValidationEvidence, manualValidationEvidenceSummary };
|
|
130
94
|
//# sourceMappingURL=manual-validation-evidence.js.map
|