@fitlab-ai/agent-infra 0.9.15 → 0.10.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/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +6 -2
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +43 -3
- package/dist/lib/fs/durable-write.js +2 -0
- package/dist/lib/internal/cli-route-inventory.js +1 -1
- package/dist/lib/internal/manual-validation.js +17 -8
- package/dist/lib/internal/task-artifact.js +1 -1
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-operation-registry.js +0 -1
- package/dist/lib/internal/task-review.js +4 -4
- package/dist/lib/platform/issue-comments.js +16 -10
- package/dist/lib/platform/issues.js +1 -1
- package/dist/lib/platform/pr-change-report.js +5 -4
- package/dist/lib/platform/pr-summary.js +64 -32
- package/dist/lib/platform/pull-requests.js +3 -3
- package/dist/lib/platform/task-identities.js +2 -9
- package/dist/lib/platform/verification-sync.js +6 -2
- package/dist/lib/pr-review/evidence-grading.js +4 -8
- package/dist/lib/sandbox/commands/rm.js +21 -2
- package/dist/lib/sandbox/control/server.js +29 -9
- package/dist/lib/sandbox/control/state.js +7 -1
- package/dist/lib/sandbox/control/workflow-executor.js +4 -14
- package/dist/lib/sandbox/index.js +1 -2
- package/dist/lib/sandbox/removal.js +116 -1011
- package/dist/lib/sandbox/workspace-identity.js +17 -1
- package/dist/lib/task/artifact-command.js +6 -28
- package/dist/lib/task/artifact-operations.js +16 -230
- package/dist/lib/task/artifact-recovery.js +430 -0
- package/dist/lib/task/artifact-repair-intent.js +73 -39
- package/dist/lib/task/commit-operation.js +31 -4
- package/dist/lib/task/control-authority.js +38 -7
- package/dist/lib/task/control-recovery.js +14 -2
- package/dist/lib/task/create-service.js +1 -8
- package/dist/lib/task/delegation-receipts.js +64 -3
- package/dist/lib/task/events.js +164 -22
- package/dist/lib/task/human-override.js +5 -8
- package/dist/lib/task/intermediate-cleanup.js +66 -8
- package/dist/lib/task/lifecycle-recovery.js +549 -0
- package/dist/lib/task/lifecycle.js +12 -3
- package/dist/lib/task/local-artifact-finalization.js +148 -123
- package/dist/lib/task/manual-validation-receipt.js +5 -1
- package/dist/lib/task/orchestration.js +52 -2
- package/dist/lib/task/pr-delivery-fact.js +12 -56
- package/dist/lib/task/recovery-warning.js +19 -0
- package/dist/lib/task/review-command.js +1 -0
- package/dist/lib/task/review-finalization.js +104 -77
- package/dist/lib/task/short-id.js +15 -7
- package/dist/lib/task/task-execution-lock.js +1 -1
- package/dist/lib/task/verification-engine.js +3 -14
- package/dist/lib/task/workflow-command.js +0 -1
- package/dist/lib/version.js +1 -11
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +7 -2
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +55 -3
- package/lib/fs/durable-write.ts +1 -0
- package/lib/internal/cli-route-inventory.ts +1 -1
- package/lib/internal/manual-validation.ts +17 -8
- package/lib/internal/task-artifact.ts +1 -1
- package/lib/internal/task-lifecycle.ts +4 -3
- package/lib/internal/task-operation-registry.ts +0 -1
- package/lib/internal/task-review.ts +4 -4
- package/lib/platform/issue-comments.ts +18 -10
- package/lib/platform/issues.ts +1 -1
- package/lib/platform/pr-change-report.ts +7 -5
- package/lib/platform/pr-summary.ts +64 -32
- package/lib/platform/pull-requests.ts +3 -3
- package/lib/platform/task-identities.ts +3 -14
- package/lib/platform/verification-sync.ts +6 -2
- package/lib/pr-review/evidence-grading.ts +4 -9
- package/lib/sandbox/commands/rm.ts +34 -2
- package/lib/sandbox/control/protocol.ts +5 -0
- package/lib/sandbox/control/server.ts +30 -10
- package/lib/sandbox/control/state.ts +9 -1
- package/lib/sandbox/control/workflow-executor.ts +4 -14
- package/lib/sandbox/index.ts +1 -2
- package/lib/sandbox/removal.ts +126 -1128
- package/lib/sandbox/workspace-identity.ts +19 -3
- package/lib/task/artifact-command.ts +8 -27
- package/lib/task/artifact-operations.ts +21 -251
- package/lib/task/artifact-recovery.ts +519 -0
- package/lib/task/artifact-repair-intent.ts +99 -51
- package/lib/task/commit-operation.ts +35 -4
- package/lib/task/control-authority.ts +47 -14
- package/lib/task/control-recovery.ts +13 -1
- package/lib/task/create-service.ts +1 -10
- package/lib/task/delegation-receipts.ts +73 -2
- package/lib/task/events.ts +187 -23
- package/lib/task/human-override.ts +5 -8
- package/lib/task/intermediate-cleanup.ts +50 -12
- package/lib/task/lifecycle-recovery.ts +691 -0
- package/lib/task/lifecycle.ts +13 -4
- package/lib/task/local-artifact-finalization.ts +176 -132
- package/lib/task/manual-validation-receipt.ts +5 -1
- package/lib/task/orchestration.ts +65 -0
- package/lib/task/pr-delivery-fact.ts +15 -62
- package/lib/task/recovery-warning.ts +21 -0
- package/lib/task/review-command.ts +1 -0
- package/lib/task/review-finalization.ts +106 -87
- package/lib/task/short-id.ts +27 -5
- package/lib/task/task-execution-lock.ts +1 -1
- package/lib/task/verification-engine.ts +3 -17
- package/lib/task/verification-types.ts +0 -2
- package/lib/task/workflow-command.ts +0 -1
- package/lib/version.ts +1 -15
- package/package.json +1 -1
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +4 -2
- package/templates/.agents/rules/issue-sync.zh-CN.md +4 -3
- package/templates/.agents/rules/local-artifact-repair.en.md +46 -39
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +43 -36
- 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 +1 -1
- package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/block-task/config/verify.json +1 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +7 -7
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/code-task/config/verify.en.json +1 -1
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-task/config/verify.en.json +2 -2
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -2
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +1 -1
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/create-pr/config/verify.json +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +2 -2
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +2 -2
- package/templates/.agents/skills/create-task/SKILL.en.md +5 -5
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/create-task/config/verify.json +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +8 -8
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +8 -8
- package/templates/.agents/skills/import-issue/config/verify.json +2 -2
- package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/plan-task/config/verify.en.json +1 -1
- package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/restore-task/config/verify.json +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +7 -7
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +6 -6
- 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/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-code/reference/report-template.en.md +12 -12
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +12 -12
- package/templates/.agents/skills/review-plan/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +7 -7
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +7 -7
- package/templates/.agents/skills/review-pr/config/verify.en.json +1 -1
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +3 -3
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/config/verify.en.json +1 -1
- package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +1 -1
- 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/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/import-issue.en.md +1 -1
- package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
- package/templates/.claude/commands/restore-task.en.md +1 -1
- package/templates/.claude/commands/restore-task.zh-CN.md +1 -1
|
@@ -407,10 +407,7 @@ function resourceForSnapshot(policy, options, frontmatter) {
|
|
|
407
407
|
if (policy.producerId === 'platform.issue') {
|
|
408
408
|
const identity = options.probeIssueNumber !== undefined
|
|
409
409
|
? resourceIdentity(options.probeIssueNumber)
|
|
410
|
-
: taskIssueIdentity((frontmatter || {}))
|
|
411
|
-
const number = toPositiveInteger(frontmatter?.issue_number);
|
|
412
|
-
return number === null ? null : resourceIdentity(number);
|
|
413
|
-
})();
|
|
410
|
+
: taskIssueIdentity((frontmatter || {}));
|
|
414
411
|
return identity ? { kind: 'issue', identity, number: resourceIdentityNumber(identity) } : null;
|
|
415
412
|
}
|
|
416
413
|
if (policy.producerId === 'platform.pull-request') {
|
|
@@ -481,11 +478,11 @@ async function probePlatformFailure(taskRef, policy, resolved, options) {
|
|
|
481
478
|
}
|
|
482
479
|
const issueIdentity = options.probeIssueNumber !== undefined
|
|
483
480
|
? resourceIdentity(options.probeIssueNumber)
|
|
484
|
-
: taskIssueIdentity(frontmatter)
|
|
485
|
-
const number = toPositiveInteger(frontmatter.issue_number);
|
|
486
|
-
return number === null ? null : resourceIdentity(number);
|
|
487
|
-
})();
|
|
481
|
+
: taskIssueIdentity(frontmatter);
|
|
488
482
|
const fact = readPrDeliveryFact(frontmatter);
|
|
483
|
+
if (fact.status === 'invalid') {
|
|
484
|
+
return error(fact.error.code, fact.error.message);
|
|
485
|
+
}
|
|
489
486
|
const pullRequestIdentity = options.probePullRequestNumber !== undefined
|
|
490
487
|
? resourceIdentity(options.probePullRequestNumber)
|
|
491
488
|
: fact.status === 'valid' && fact.fact.state === 'bound' ? fact.fact.identity.resource : null;
|
|
@@ -7,11 +7,12 @@ import { checkpointCommitMatches } from './commit-identity.js';
|
|
|
7
7
|
import { readCheckpointIntent } from './commit-intent.js';
|
|
8
8
|
import { parseTaskFrontmatter } from './frontmatter.js';
|
|
9
9
|
import { readTaskFinalizationReceipt } from './finalization.js';
|
|
10
|
-
import {
|
|
10
|
+
import { semanticDigest, sha256Content } from './local-artifact-finalization.js';
|
|
11
|
+
import { artifactRecoveryRoot, readArtifactRecoveryIntent } from './artifact-repair-intent.js';
|
|
11
12
|
import { parseArtifactName } from './artifact-name.js';
|
|
12
13
|
import { enumerateAllTaskDirs } from './resolve-ref.js';
|
|
13
14
|
const TASK_ID_RE = /^TASK-\d{8}-\d{6}$/;
|
|
14
|
-
const LOCAL_INTENT_RE = /^(TASK-\d{8}-\d{6})-(analysis|plan|code)-(.+\.md)\.json$/;
|
|
15
|
+
const LOCAL_INTENT_RE = /^(TASK-\d{8}-\d{6})-(analysis|review-analysis|plan|review-plan|code|review-code)-(.+\.md)\.json$/;
|
|
15
16
|
const COMMIT_INTENT_RE = /^(TASK-\d{8}-\d{6})\.json$/;
|
|
16
17
|
const AUXILIARY_ROOTS = [
|
|
17
18
|
'.local-artifact-finalization-intents',
|
|
@@ -110,7 +111,7 @@ function localIntentCandidate(repoRoot, task, filePath, taskId, family, artifact
|
|
|
110
111
|
}
|
|
111
112
|
let intent;
|
|
112
113
|
try {
|
|
113
|
-
intent =
|
|
114
|
+
intent = readArtifactRecoveryIntent(repoRoot, taskId, family, artifact);
|
|
114
115
|
}
|
|
115
116
|
catch {
|
|
116
117
|
return item('LFAI-CONSUMED', taskId, filePath, 'protected', 'LFAI_SCHEMA_INVALID', identity);
|
|
@@ -129,7 +130,7 @@ function localIntentCandidate(repoRoot, task, filePath, taskId, family, artifact
|
|
|
129
130
|
catch {
|
|
130
131
|
return item('LFAI-CONSUMED', taskId, filePath, 'protected', 'ARTIFACT_UNREADABLE', identity);
|
|
131
132
|
}
|
|
132
|
-
if (intent.
|
|
133
|
+
if (intent.finalArtifactSha256 !== sha256Content(content) || intent.finalSemanticDigest !== semanticDigest(content)) {
|
|
133
134
|
return item('LFAI-CONSUMED', taskId, filePath, 'protected', 'ARTIFACT_DIGEST_MISMATCH', identity);
|
|
134
135
|
}
|
|
135
136
|
const receiptReason = receiptGate(repoRoot, task, options);
|
|
@@ -254,7 +255,60 @@ function scanIntermediateCleanup(repoRoot, options = {}) {
|
|
|
254
255
|
const candidates = scanInternal(repoRoot, options);
|
|
255
256
|
return buildIntermediateCleanupReport(candidates, true);
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function cleanupConsumedRecoveryFiles(repoRoot, task, candidate) {
|
|
259
|
+
if (candidate.kind !== 'LFAI-CONSUMED' || !candidate.taskId)
|
|
260
|
+
return true;
|
|
261
|
+
if (!task)
|
|
262
|
+
return false;
|
|
263
|
+
const match = LOCAL_INTENT_RE.exec(path.basename(candidate.path));
|
|
264
|
+
if (!match)
|
|
265
|
+
return false;
|
|
266
|
+
let intent;
|
|
267
|
+
try {
|
|
268
|
+
intent = readArtifactRecoveryIntent(repoRoot, candidate.taskId, match[2], match[3]);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
if (!intent || intent.state !== 'consumed')
|
|
274
|
+
return false;
|
|
275
|
+
const recovery = artifactRecoveryRoot(task.taskDir, intent.recoveryOperationId);
|
|
276
|
+
let stat = null;
|
|
277
|
+
try {
|
|
278
|
+
stat = fs.lstatSync(recovery);
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
if (errorCode(error) === 'ENOENT')
|
|
282
|
+
return true;
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
286
|
+
return false;
|
|
287
|
+
let entries;
|
|
288
|
+
try {
|
|
289
|
+
entries = fs.readdirSync(recovery, { withFileTypes: true });
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
for (const entry of entries) {
|
|
295
|
+
if (entry.isSymbolicLink() || !entry.isFile() || !['baseline.md', 'candidate.md', 'final.md', 'publish.md'].includes(entry.name))
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
for (const entry of entries)
|
|
300
|
+
fs.unlinkSync(path.join(recovery, entry.name));
|
|
301
|
+
fs.rmdirSync(recovery);
|
|
302
|
+
const recoveryRoot = path.dirname(recovery);
|
|
303
|
+
if (fs.readdirSync(recoveryRoot).length === 0)
|
|
304
|
+
fs.rmdirSync(recoveryRoot);
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
return errorCode(error) === 'ENOENT';
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function removeCandidate(repoRoot, candidate, task) {
|
|
258
312
|
if (candidate.disposition !== 'planned')
|
|
259
313
|
return candidate;
|
|
260
314
|
const root = candidate.kind === 'EMPTY-AUX-PARENT'
|
|
@@ -279,6 +333,9 @@ function removeCandidate(candidate) {
|
|
|
279
333
|
return { ...candidate, disposition: 'protected', reason: 'PATH_IDENTITY_CHANGED' };
|
|
280
334
|
if (!sameFileIdentity(expected, actual))
|
|
281
335
|
return { ...candidate, disposition: 'protected', reason: 'PATH_IDENTITY_CHANGED' };
|
|
336
|
+
if (!cleanupConsumedRecoveryFiles(repoRoot, task, candidate)) {
|
|
337
|
+
return { ...candidate, disposition: 'protected', reason: 'RECOVERY_STAGING_NOT_SAFE_TO_REMOVE' };
|
|
338
|
+
}
|
|
282
339
|
try {
|
|
283
340
|
if (candidate.kind === 'EMPTY-AUX-PARENT') {
|
|
284
341
|
if (fs.readdirSync(candidate.path).length !== 0)
|
|
@@ -317,6 +374,7 @@ function cleanupIntermediateUnderRemovalCoordinator(repoRoot, options = {}) {
|
|
|
317
374
|
indexes.push(index);
|
|
318
375
|
byTask.set(candidate.taskId, indexes);
|
|
319
376
|
}
|
|
377
|
+
const tasks = inspectTaskRecords(repoRoot, new Set(byTask.keys()));
|
|
320
378
|
for (const taskId of [...byTask.keys()].sort()) {
|
|
321
379
|
const execute = () => {
|
|
322
380
|
const refreshed = scanIntermediateCleanup(repoRoot, {
|
|
@@ -330,7 +388,7 @@ function cleanupIntermediateUnderRemovalCoordinator(repoRoot, options = {}) {
|
|
|
330
388
|
continue;
|
|
331
389
|
const current = refreshedByKey.get(intermediateCleanupKey(initialCandidate));
|
|
332
390
|
items[index] = current
|
|
333
|
-
? removeCandidate(current)
|
|
391
|
+
? removeCandidate(repoRoot, current, tasks.get(taskId))
|
|
334
392
|
: { ...initialCandidate, disposition: 'protected', reason: 'CANDIDATE_NO_LONGER_ELIGIBLE' };
|
|
335
393
|
}
|
|
336
394
|
};
|
|
@@ -351,14 +409,14 @@ function cleanupIntermediateUnderRemovalCoordinator(repoRoot, options = {}) {
|
|
|
351
409
|
for (const [index, candidate] of items.entries()) {
|
|
352
410
|
if (candidate.taskId || candidate.disposition !== 'planned')
|
|
353
411
|
continue;
|
|
354
|
-
items[index] = removeCandidate(candidate);
|
|
412
|
+
items[index] = removeCandidate(repoRoot, candidate);
|
|
355
413
|
}
|
|
356
414
|
const knownPaths = new Set(items.map((candidate) => intermediateCleanupKey(candidate)));
|
|
357
415
|
for (const candidate of scanIntermediateCleanup(repoRoot, scanOptions).items) {
|
|
358
416
|
if (candidate.kind !== 'EMPTY-AUX-PARENT' || candidate.disposition !== 'planned'
|
|
359
417
|
|| knownPaths.has(intermediateCleanupKey(candidate)))
|
|
360
418
|
continue;
|
|
361
|
-
items.push(removeCandidate(candidate));
|
|
419
|
+
items.push(removeCandidate(repoRoot, candidate));
|
|
362
420
|
}
|
|
363
421
|
return buildIntermediateCleanupReport(items);
|
|
364
422
|
}
|