@fitlab-ai/agent-infra 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +18 -10
- 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 +1 -16
- 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 +1 -4
- package/dist/lib/platform/pr-checks.js +2 -8
- 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/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 +11 -519
- 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 +44 -8
- 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 +67 -24
- 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 +16 -9
- 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 +0 -21
- package/lib/platform/issues.ts +0 -2
- package/lib/platform/operation-coordinator.ts +4 -2
- package/lib/platform/pr-change-report.ts +0 -5
- package/lib/platform/pr-checks.ts +1 -10
- package/lib/platform/pr-review.ts +1 -1
- 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/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 +11 -696
- 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 +41 -9
- 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 +50 -26
- 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 +1 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
- 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/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/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
|
@@ -70,30 +70,6 @@ function findTaskMd(workspaceRoot, taskId) {
|
|
|
70
70
|
const archived = findInArchive(workspaceRoot, taskId);
|
|
71
71
|
return archived ? { taskMdPath: archived, state: 'archive' } : null;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Enumerate every task directory under the flat workspace states
|
|
75
|
-
* (active / blocked / completed) — archive is intentionally excluded so a
|
|
76
|
-
* full-tree scan never pulls in cold data. Ordered by state, then task id
|
|
77
|
-
* ascending, giving callers a deterministic traversal.
|
|
78
|
-
*/
|
|
79
|
-
function enumerateTaskDirs(repoRoot) {
|
|
80
|
-
const out = [];
|
|
81
|
-
const workspaceRoot = taskRoot(repoRoot);
|
|
82
|
-
for (const sub of FLAT_WORKSPACE_DIRS) {
|
|
83
|
-
const base = path.join(workspaceRoot, sub);
|
|
84
|
-
if (!fs.existsSync(base))
|
|
85
|
-
continue;
|
|
86
|
-
for (const entry of fs.readdirSync(base).sort()) {
|
|
87
|
-
if (!TASK_ID_RE.test(entry))
|
|
88
|
-
continue;
|
|
89
|
-
const taskDir = path.join(base, entry);
|
|
90
|
-
if (!fs.existsSync(path.join(taskDir, 'task.md')))
|
|
91
|
-
continue;
|
|
92
|
-
out.push({ taskId: entry, taskDir });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return out;
|
|
96
|
-
}
|
|
97
73
|
/**
|
|
98
74
|
* Enumerate every task directory, including the cold YYYY/MM/DD archive.
|
|
99
75
|
* Invalid directory names, symlinks and entries without task.md are ignored;
|
|
@@ -316,5 +292,5 @@ function resolveTaskContext(taskRef, options = {}) {
|
|
|
316
292
|
const match = matches[0];
|
|
317
293
|
return { ok: true, repoRoot, ...match, state: 'active' };
|
|
318
294
|
}
|
|
319
|
-
export { resolveTaskRef, resolveTaskContext, detectRepoRoot,
|
|
295
|
+
export { resolveTaskRef, resolveTaskContext, detectRepoRoot, enumerateAllTaskDirs, locateHotTaskDirs, TASK_ID_RE };
|
|
320
296
|
//# sourceMappingURL=resolve-ref.js.map
|
|
@@ -3,7 +3,7 @@ export function parseReviewCommand(args) {
|
|
|
3
3
|
throw new Error('task ref and a supported review operation are required');
|
|
4
4
|
const values = {};
|
|
5
5
|
const flags = {
|
|
6
|
-
'--stage': 'stage', '--artifact': 'artifact', '--
|
|
6
|
+
'--stage': 'stage', '--artifact': 'artifact', '--dry-run': 'dryRun'
|
|
7
7
|
};
|
|
8
8
|
for (let index = 2; index < args.length; index += 1) {
|
|
9
9
|
const flag = args[index];
|
|
@@ -12,7 +12,7 @@ export function parseReviewCommand(args) {
|
|
|
12
12
|
const key = flags[flag];
|
|
13
13
|
if (Object.hasOwn(values, key))
|
|
14
14
|
throw new Error(`duplicate option '${flag}'`);
|
|
15
|
-
const value = flag === '--
|
|
15
|
+
const value = flag === '--dry-run' ? true : args[++index];
|
|
16
16
|
if (!value || typeof value === 'string' && value.startsWith('--'))
|
|
17
17
|
throw new Error(`option '${flag}' requires a value`);
|
|
18
18
|
values[key] = value;
|
|
@@ -7,7 +7,6 @@ import { LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, parseLedge
|
|
|
7
7
|
import { finalizeReviewSummaryContent } from './review-artifacts.js';
|
|
8
8
|
import { inspectDecisionDetailDuplicates } from './decision-details.js';
|
|
9
9
|
import { resolveTaskRef } from './resolve-ref.js';
|
|
10
|
-
import { validateLifecycleExecution } from './lifecycle-execution.js';
|
|
11
10
|
import { getArtifactSchema } from './artifact-schema.js';
|
|
12
11
|
import { validateQualificationAudit } from './qualification-audit.js';
|
|
13
12
|
import { canonicalSemanticDigest, inspectArtifactContract, sha256Content } from './artifact-operations.js';
|
|
@@ -74,13 +73,6 @@ function preflightReviewSummary(request, options = {}) {
|
|
|
74
73
|
catch (error) {
|
|
75
74
|
return preflightFailed(request, 'REVIEW_ARTIFACT_NOT_REGULAR', String(error), resolved.taskId);
|
|
76
75
|
}
|
|
77
|
-
const execution = validateLifecycleExecution(request.taskRef, {
|
|
78
|
-
mode: request.orchestrated ? 'orchestrated' : 'standalone',
|
|
79
|
-
identity: { stage: spec.family, round: parsed.round, artifact: request.artifact, role: 'reviewer' },
|
|
80
|
-
dryRun: request.dryRun
|
|
81
|
-
}, { repoRoot: options.repoRoot });
|
|
82
|
-
if (!execution.ok)
|
|
83
|
-
return preflightFailed(request, 'REVIEW_PROVENANCE_INVALID', `${execution.error?.code ?? 'ORCHESTRATION_PROVENANCE_MISMATCH'}: ${execution.error?.message ?? 'orchestration provenance validation failed'}`, resolved.taskId);
|
|
84
76
|
const artifactSha256 = sha256Content(content);
|
|
85
77
|
const semanticDigest = canonicalSemanticDigest(content);
|
|
86
78
|
const detail = inspectDecisionDetailDuplicates(content);
|
|
@@ -140,15 +132,6 @@ function prepareReviewSummaryCandidate(request, artifactContent, options = {}) {
|
|
|
140
132
|
}
|
|
141
133
|
const artifactSha256 = sha256Content(artifactContent);
|
|
142
134
|
const semanticDigest = canonicalSemanticDigest(artifactContent);
|
|
143
|
-
const digests = { artifactSha256, semanticDigest };
|
|
144
|
-
const execution = validateLifecycleExecution(request.taskRef, {
|
|
145
|
-
mode: request.orchestrated ? 'orchestrated' : 'standalone',
|
|
146
|
-
identity: { stage: spec.family, round: parsed.round, artifact: request.artifact, role: 'reviewer' },
|
|
147
|
-
dryRun: request.dryRun
|
|
148
|
-
}, { repoRoot: options.repoRoot });
|
|
149
|
-
if (!execution.ok) {
|
|
150
|
-
return reject('REVIEW_PROVENANCE_INVALID', `${execution.error?.code ?? 'ORCHESTRATION_PROVENANCE_MISMATCH'}: ${execution.error?.message ?? 'orchestration provenance validation failed'}`);
|
|
151
|
-
}
|
|
152
135
|
try {
|
|
153
136
|
const ledger = parseLedgerDocument(taskContent);
|
|
154
137
|
if (!ledger.present)
|
|
@@ -194,9 +177,6 @@ function prepareReviewSummaryCandidate(request, artifactContent, options = {}) {
|
|
|
194
177
|
},
|
|
195
178
|
};
|
|
196
179
|
}
|
|
197
|
-
function commitReviewSummaryProvenance(prepared, repoRoot, options = {}) {
|
|
198
|
-
return prepared.result;
|
|
199
|
-
}
|
|
200
180
|
function replaceCurrentArtifactAtomically(file, content) {
|
|
201
181
|
const temporary = path.join(path.dirname(file), `.${path.basename(file)}.${process.pid}.${randomUUID()}.tmp`);
|
|
202
182
|
try {
|
|
@@ -250,5 +230,5 @@ function finalizeReviewSummary(request, options = {}) {
|
|
|
250
230
|
return failed(request, 'REVIEW_RECOVERY_COMMIT_FAILED', `cannot update current review artifact: ${error instanceof Error ? error.message : String(error)}`, resolved.taskId);
|
|
251
231
|
}
|
|
252
232
|
}
|
|
253
|
-
export { finalizeReviewSummary, preflightReviewSummary, prepareReviewSummaryCandidate
|
|
233
|
+
export { finalizeReviewSummary, preflightReviewSummary, prepareReviewSummaryCandidate };
|
|
254
234
|
//# sourceMappingURL=review-finalization.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { inspectArtifactDirectory } from "./artifact-lifecycle.js";
|
|
4
|
-
const REVIEWED_TREE_RE = /^[a-f0-9]{40,64}$/;
|
|
5
|
-
export function parseReviewedGitTree(value) {
|
|
6
|
-
return REVIEWED_TREE_RE.test(value) ? value : null;
|
|
7
|
-
}
|
|
8
4
|
// Paths excluded from the post-review coverage gate. Fail-closed: the gate
|
|
9
5
|
// covers ALL tracked changes by default. This default denylist is EMPTY —
|
|
10
6
|
// projects opt into exclusions explicitly via review.post_review_exclude_globs.
|
|
@@ -2,7 +2,6 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
const NO_FOLLOW = fs.constants.O_NOFOLLOW ?? 0;
|
|
5
|
-
const DIRECTORY = fs.constants.O_DIRECTORY ?? 0;
|
|
6
5
|
export class SecureFileError extends Error {
|
|
7
6
|
code;
|
|
8
7
|
constructor(code, message) {
|
|
@@ -30,9 +29,6 @@ function assertNoSymlinkAncestors(candidate) {
|
|
|
30
29
|
current = parent;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
export async function readStableFile(candidate, options) {
|
|
34
|
-
return readStableFileSync(candidate, options);
|
|
35
|
-
}
|
|
36
32
|
export function readStableFileSync(candidate, options) {
|
|
37
33
|
if (!path.isAbsolute(candidate))
|
|
38
34
|
conflict('candidate path must be absolute and terminal');
|
|
@@ -74,56 +70,4 @@ export function readStableFileSync(candidate, options) {
|
|
|
74
70
|
fs.closeSync(descriptor);
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
|
-
export async function writeAtomicFile(target, bytes, mode = 0o600, expectedSha256) {
|
|
78
|
-
const parent = path.dirname(target);
|
|
79
|
-
let current = path.resolve(parent);
|
|
80
|
-
while (true) {
|
|
81
|
-
let stat;
|
|
82
|
-
try {
|
|
83
|
-
stat = await fs.promises.lstat(current);
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
throw new SecureFileError('TASK_ARTIFACT_WRITE_CONFLICT', 'authoritative parent directory is missing');
|
|
87
|
-
}
|
|
88
|
-
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
89
|
-
throw new SecureFileError('TASK_ARTIFACT_WRITE_CONFLICT', 'authoritative parent directory is not a real directory');
|
|
90
|
-
const next = path.dirname(current);
|
|
91
|
-
if (next === current)
|
|
92
|
-
break;
|
|
93
|
-
current = next;
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
const existing = await fs.promises.lstat(target);
|
|
97
|
-
if (existing.isSymbolicLink() || !existing.isFile())
|
|
98
|
-
throw new SecureFileError('TASK_ARTIFACT_WRITE_CONFLICT', 'authoritative target is not a regular file');
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
if (error.code !== 'ENOENT')
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
const temporary = path.join(parent, `.${path.basename(target)}.${process.pid}.${Date.now()}.tmp`);
|
|
105
|
-
let handle;
|
|
106
|
-
try {
|
|
107
|
-
handle = await fs.promises.open(temporary, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL, mode);
|
|
108
|
-
await handle.writeFile(bytes);
|
|
109
|
-
await handle.sync();
|
|
110
|
-
await handle.chmod(mode);
|
|
111
|
-
await handle.close();
|
|
112
|
-
handle = undefined;
|
|
113
|
-
if (expectedSha256 !== undefined)
|
|
114
|
-
readStableFileSync(target, { maxBytes: 1024 * 1024, expectedSha256 });
|
|
115
|
-
fs.renameSync(temporary, target);
|
|
116
|
-
const directory = await fs.promises.open(parent, fs.constants.O_RDONLY | DIRECTORY);
|
|
117
|
-
try {
|
|
118
|
-
await directory.sync();
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
await directory.close();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
125
|
-
await handle?.close().catch(() => undefined);
|
|
126
|
-
await fs.promises.rm(temporary, { force: true }).catch(() => undefined);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
73
|
//# sourceMappingURL=secure-fs.js.map
|
|
@@ -343,16 +343,6 @@ function readRegistry(repoRoot) {
|
|
|
343
343
|
return null;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
function readBranchFromTaskMd(repoRoot, taskId) {
|
|
347
|
-
const taskMdPath = path.join(resolveProjectTaskWorkspaceRoot(repoRoot), 'active', taskId, 'task.md');
|
|
348
|
-
if (!fs.existsSync(taskMdPath))
|
|
349
|
-
return null;
|
|
350
|
-
const content = fs.readFileSync(taskMdPath, 'utf8');
|
|
351
|
-
const m = content.match(/^branch:\s*(.+)$/m);
|
|
352
|
-
if (!m || !m[1])
|
|
353
|
-
return null;
|
|
354
|
-
return m[1].trim().replace(/^(["'])(.*)\1$/, '$2');
|
|
355
|
-
}
|
|
356
346
|
function loadShortIdByTaskId(repoRoot) {
|
|
357
347
|
const registry = readRegistry(repoRoot);
|
|
358
348
|
const map = new Map();
|
|
@@ -421,33 +411,5 @@ function inspectShortIdRegistry(repoRoot, shortIdLength = configuredShortIdLengt
|
|
|
421
411
|
};
|
|
422
412
|
}
|
|
423
413
|
}
|
|
424
|
-
|
|
425
|
-
* Resolve a branch to its active-task short id (`NN`), or `null` when no
|
|
426
|
-
* active task is bound to that branch.
|
|
427
|
-
*
|
|
428
|
-
* Two-state semantics: this only consults the active registry
|
|
429
|
-
* (`active/.short-ids.json`) plus each `active/{taskId}/task.md`. Tasks moved
|
|
430
|
-
* to completed/blocked/cancelled/archive have already released their short id,
|
|
431
|
-
* so their branches return `null` — in `ai sandbox ls` that surfaces as `-`,
|
|
432
|
-
* meaning the sandbox is free to remove.
|
|
433
|
-
*/
|
|
434
|
-
function lookupShortIdByBranch(branch, repoRoot, _opts) {
|
|
435
|
-
const registry = readRegistry(repoRoot);
|
|
436
|
-
if (!registry)
|
|
437
|
-
return null;
|
|
438
|
-
const matches = [];
|
|
439
|
-
for (const [key, taskId] of Object.entries(registry.ids)) {
|
|
440
|
-
const taskBranch = readBranchFromTaskMd(repoRoot, taskId);
|
|
441
|
-
if (taskBranch && taskBranch === branch) {
|
|
442
|
-
matches.push(key);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (matches.length === 0)
|
|
446
|
-
return null;
|
|
447
|
-
if (matches.length > 1) {
|
|
448
|
-
process.stderr.write(`Warning: branch '${branch}' is bound to multiple active tasks: ${matches.join(', ')}; using ${matches[0]}\n`);
|
|
449
|
-
}
|
|
450
|
-
return matches[0];
|
|
451
|
-
}
|
|
452
|
-
export { normalizeShortIdInput, isRemovedHashShortIdInput, resolveShortIdReadOnly, lookupShortIdByBranch, loadShortIdByTaskId, inspectShortIdRegistry, configuredShortIdLength, mutateShortIdRegistry, releaseStaleShortIdRegistry, executeShortIdCommand };
|
|
414
|
+
export { normalizeShortIdInput, isRemovedHashShortIdInput, resolveShortIdReadOnly, loadShortIdByTaskId, inspectShortIdRegistry, configuredShortIdLength, mutateShortIdRegistry, releaseStaleShortIdRegistry, executeShortIdCommand };
|
|
453
415
|
//# sourceMappingURL=short-id.js.map
|