@fitlab-ai/agent-infra 0.11.4 → 0.11.5
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/bin/internal-cli.js +0 -5
- package/dist/lib/decide.js +4 -41
- package/dist/lib/git/branch-worktree.js +45 -0
- package/dist/lib/internal/cli-route-inventory.js +0 -3
- package/dist/lib/internal/task-activity.js +7 -40
- package/dist/lib/internal/task-event.js +4 -37
- package/dist/lib/internal/task-finalization.js +9 -2
- package/dist/lib/internal/task-ledger.js +5 -43
- package/dist/lib/internal/task-lifecycle.js +1 -1
- package/dist/lib/internal/task-operation-registry.js +1 -4
- package/dist/lib/internal/task-review.js +5 -37
- package/dist/lib/internal/task-verify.js +3 -47
- package/dist/lib/internal/task-warning.js +4 -40
- package/dist/lib/platform/pr-summary.js +4 -23
- package/dist/lib/platform/verification-sync.js +12 -49
- package/dist/lib/sandbox/control/client.js +4 -1
- package/dist/lib/sandbox/control/executor.js +12 -4
- package/dist/lib/sandbox/control/protocol.js +2 -1
- package/dist/lib/sandbox/removal.js +15 -8
- package/dist/lib/task/activity-intent.js +1 -2
- package/dist/lib/task/artifact-operations.js +36 -2
- package/dist/lib/task/artifact-schema.js +7 -7
- package/dist/lib/task/control-authority.js +9 -166
- package/dist/lib/task/decision-intents.js +2 -4
- package/dist/lib/task/events.js +7 -28
- package/dist/lib/task/finalization-handoff.js +92 -0
- package/dist/lib/task/finalization.js +123 -12
- package/dist/lib/task/intermediate-cleanup.js +9 -148
- package/dist/lib/task/ledger-intents.js +3 -6
- package/dist/lib/task/lifecycle.js +50 -11
- package/dist/lib/task/local-artifact-finalization.js +13 -28
- package/dist/lib/task/review-command.js +1 -2
- package/dist/lib/task/review-finalization.js +1 -2
- package/dist/lib/task/snapshot.js +6 -6
- package/dist/lib/task/verification-engine.js +16 -11
- package/dist/lib/task/verification.js +1 -13
- package/dist/lib/task/workflow-warning-intents.js +2 -4
- package/dist/lib/task/write.js +1 -2
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/decide.ts +5 -35
- package/lib/git/branch-worktree.ts +41 -0
- package/lib/internal/cli-route-inventory.ts +0 -2
- package/lib/internal/task-activity.ts +6 -34
- package/lib/internal/task-event.ts +4 -37
- package/lib/internal/task-finalization.ts +9 -2
- package/lib/internal/task-ledger.ts +5 -38
- package/lib/internal/task-lifecycle.ts +2 -2
- package/lib/internal/task-operation-registry.ts +1 -4
- package/lib/internal/task-review.ts +5 -31
- package/lib/internal/task-verify.ts +3 -39
- package/lib/internal/task-warning.ts +3 -32
- package/lib/platform/pr-summary.ts +4 -25
- package/lib/platform/verification-sync.ts +13 -53
- package/lib/sandbox/control/client.ts +5 -1
- package/lib/sandbox/control/executor.ts +13 -4
- package/lib/sandbox/control/protocol.ts +3 -2
- package/lib/sandbox/removal.ts +23 -7
- package/lib/task/activity-intent.ts +1 -2
- package/lib/task/artifact-operations.ts +58 -2
- package/lib/task/artifact-schema.ts +9 -7
- package/lib/task/control-authority.ts +14 -188
- package/lib/task/decision-intents.ts +2 -4
- package/lib/task/events.ts +8 -27
- package/lib/task/finalization-handoff.ts +104 -0
- package/lib/task/finalization.ts +120 -12
- package/lib/task/intermediate-cleanup.ts +9 -125
- package/lib/task/ledger-intents.ts +3 -6
- package/lib/task/lifecycle.ts +45 -13
- package/lib/task/local-artifact-finalization.ts +16 -35
- package/lib/task/review-command.ts +2 -5
- package/lib/task/review-finalization.ts +1 -4
- package/lib/task/snapshot.ts +6 -6
- package/lib/task/verification-engine.ts +20 -10
- package/lib/task/verification.ts +1 -15
- package/lib/task/workflow-warning-intents.ts +2 -4
- package/lib/task/write.ts +1 -4
- package/package.json +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.en.md +11 -2
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -2
- package/templates/.agents/skills/code-task/reference/report-template.en.md +6 -6
- package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +6 -6
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +2 -2
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +2 -2
- package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +1 -3
- package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +1 -3
- 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/review-analysis/reference/report-template.en.md +3 -3
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/reference/report-template.en.md +3 -3
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +3 -3
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-pr/config/verify.en.json +3 -1
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +3 -1
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +3 -3
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/config/verify.en.json +2 -2
- package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +2 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
- package/dist/lib/internal/task-override.js +0 -138
- package/dist/lib/task/artifact-recovery.js +0 -476
- package/dist/lib/task/artifact-repair-intent.js +0 -181
- package/dist/lib/task/guard-override.js +0 -31
- package/dist/lib/task/human-override.js +0 -1259
- package/lib/internal/task-override.ts +0 -144
- package/lib/task/artifact-recovery.ts +0 -572
- package/lib/task/artifact-repair-intent.ts +0 -227
- package/lib/task/guard-override.ts +0 -50
- package/lib/task/human-override.ts +0 -1522
|
@@ -12,8 +12,6 @@ import { resolveTaskRef } from './resolve-ref.ts';
|
|
|
12
12
|
import { validateLifecycleExecution } from './lifecycle-execution.ts';
|
|
13
13
|
import { TaskExecutionLockError, withTaskExecutionLock } from './task-execution-lock.ts';
|
|
14
14
|
import type { ResolveTaskRefErrorCode } from './resolve-ref.ts';
|
|
15
|
-
import { allowsManualOverride } from './guard-override.ts';
|
|
16
|
-
import type { ManualOverrideCapability } from './guard-override.ts';
|
|
17
15
|
import { getArtifactSchema } from './artifact-schema.ts';
|
|
18
16
|
import { canonicalSemanticDigest, inspectArtifactContract, sha256Content } from './artifact-operations.ts';
|
|
19
17
|
|
|
@@ -70,7 +68,6 @@ type ReviewFileSystem = {
|
|
|
70
68
|
type ReviewFinalizationOptions = {
|
|
71
69
|
repoRoot?: string;
|
|
72
70
|
fileSystem?: Partial<ReviewFileSystem>;
|
|
73
|
-
manualOverride?: ManualOverrideCapability;
|
|
74
71
|
lockAlreadyHeld?: boolean;
|
|
75
72
|
};
|
|
76
73
|
|
|
@@ -224,7 +221,7 @@ function prepareReviewSummaryCandidate(
|
|
|
224
221
|
const resolved = resolveTaskRef(request.taskRef, { repoRoot: options.repoRoot });
|
|
225
222
|
taskId = resolved.taskId ?? null;
|
|
226
223
|
if (!resolved.ok) return reject(resolved.code, resolved.message);
|
|
227
|
-
if (resolved.state !== 'active'
|
|
224
|
+
if (resolved.state !== 'active') {
|
|
228
225
|
return reject('TASK_STATE_MISMATCH', `task ${taskId} is ${resolved.state}, expected active`);
|
|
229
226
|
}
|
|
230
227
|
const parsed = parseArtifactName(request.artifact);
|
package/lib/task/snapshot.ts
CHANGED
|
@@ -97,22 +97,22 @@ function collectTaskSnapshot(taskRef: string, options: SnapshotOptions = {}): Ta
|
|
|
97
97
|
const observations: SnapshotObservation[] = [];
|
|
98
98
|
try {
|
|
99
99
|
const output = stripOneTrailingNewline((options.gitStatus ?? defaultGitStatus)(resolved.repoRoot));
|
|
100
|
-
observations.push({ name: 'git', status: 'ready', command: '
|
|
100
|
+
observations.push({ name: 'git', status: 'ready', command: 'git status --short --untracked-files=all', output, error: null });
|
|
101
101
|
} catch (error) {
|
|
102
|
-
return failedSnapshot(resolved, taskRef, observations, 'git', '
|
|
102
|
+
return failedSnapshot(resolved, taskRef, observations, 'git', 'git status --short --untracked-files=all', 'SNAPSHOT_GIT_FAILED', error);
|
|
103
103
|
}
|
|
104
104
|
try {
|
|
105
105
|
const entries = (options.readDirectory ?? ((dir) => fs.readdirSync(dir, { withFileTypes: true })))(resolved.taskDir);
|
|
106
106
|
const output = renderDirectory(entries, resolved.taskDir, options.lstat ?? fs.lstatSync);
|
|
107
|
-
observations.push({ name: 'task-directory', status: 'ready', command:
|
|
107
|
+
observations.push({ name: 'task-directory', status: 'ready', command: `fs.readdirSync ${taskDirPath}/`, output, error: null });
|
|
108
108
|
} catch (error) {
|
|
109
|
-
return failedSnapshot(resolved, taskRef, observations, 'task-directory',
|
|
109
|
+
return failedSnapshot(resolved, taskRef, observations, 'task-directory', `fs.readdirSync ${taskDirPath}/`, 'SNAPSHOT_DIRECTORY_READ_FAILED', error);
|
|
110
110
|
}
|
|
111
111
|
try {
|
|
112
112
|
const content = (options.readTask ?? ((file) => fs.readFileSync(file, 'utf8')))(resolved.taskMdPath);
|
|
113
|
-
observations.push({ name: 'task-tail', status: 'ready', command:
|
|
113
|
+
observations.push({ name: 'task-tail', status: 'ready', command: `fs.readFileSync ${taskPath} (last 10 lines)`, output: renderTail(content), error: null });
|
|
114
114
|
} catch (error) {
|
|
115
|
-
return failedSnapshot(resolved, taskRef, observations, 'task-tail',
|
|
115
|
+
return failedSnapshot(resolved, taskRef, observations, 'task-tail', `fs.readFileSync ${taskPath} (last 10 lines)`, 'SNAPSHOT_TASK_READ_FAILED', error);
|
|
116
116
|
}
|
|
117
117
|
return {
|
|
118
118
|
status: 'ready', changed: false, requestRef: taskRef, taskId: resolved.taskId,
|
|
@@ -23,6 +23,7 @@ import { inspectPlatformPullRequest } from "../platform/pull-requests.ts";
|
|
|
23
23
|
import { resolveMaterializedReviewedHeadRelation } from "../platform/change-request-git-evidence.ts";
|
|
24
24
|
import { resolveReviewedHeadRelation } from "../platform/merged-pr-equivalence.ts";
|
|
25
25
|
import { resolveLocalReviewedCommitRelation } from "../git/reviewed-commit-equivalence.ts";
|
|
26
|
+
import { resolveBranchWorktree } from "../git/branch-worktree.ts";
|
|
26
27
|
import { parseTypedTaskFrontmatter } from "./frontmatter.ts";
|
|
27
28
|
import { LEDGER_TERMINAL, LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, parseLedgerDocument, summarizeLedgerStage, validateLedgerRows } from "./ledger.ts";
|
|
28
29
|
import type { LedgerRow } from "./ledger.ts";
|
|
@@ -570,6 +571,23 @@ function checkArtifact({ taskDir, config, artifactFile, skillName }: any): any {
|
|
|
570
571
|
}
|
|
571
572
|
}
|
|
572
573
|
|
|
574
|
+
const stateCheckPatterns = config.state_check_patterns || [];
|
|
575
|
+
if (stateCheckPatterns.length > 0) {
|
|
576
|
+
const scanned = scanVisibleMarkdown(content);
|
|
577
|
+
const stateCheckHeading = scanned.headings.find((heading) => (
|
|
578
|
+
heading.level === 2 && (heading.text === "状态核对" || heading.text === "State Check")
|
|
579
|
+
));
|
|
580
|
+
const nextHeading = stateCheckHeading && scanned.headings.find((heading) => (
|
|
581
|
+
heading.start > stateCheckHeading.start && heading.level <= 2
|
|
582
|
+
));
|
|
583
|
+
const stateCheckBody = stateCheckHeading ? content.slice(stateCheckHeading.end, nextHeading?.start ?? content.length) : "";
|
|
584
|
+
for (const pattern of stateCheckPatterns) {
|
|
585
|
+
if (!new RegExp(pattern, "m").test(stateCheckBody)) {
|
|
586
|
+
return failResult("artifact", `${path.basename(artifactPath)} state-check section is missing required command: ${pattern}`);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
573
591
|
return passResult(
|
|
574
592
|
"artifact",
|
|
575
593
|
`${path.basename(artifactPath)} passed (${requiredSections.length} sections)`
|
|
@@ -1251,16 +1269,8 @@ function checkReviewFact({ taskDir, artifactFile, repositoryRoot }: any): any {
|
|
|
1251
1269
|
|
|
1252
1270
|
function reviewWorktreeForTask(repositoryRoot: string, branch: string): string | null {
|
|
1253
1271
|
if (!branch) return null;
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
encoding: "utf8",
|
|
1257
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
1258
|
-
}).trim().split(/\r?\n\r?\n/);
|
|
1259
|
-
for (const record of records) {
|
|
1260
|
-
const worktree = /^worktree (.+)$/m.exec(record)?.[1];
|
|
1261
|
-
const branchRef = /^branch (.+)$/m.exec(record)?.[1];
|
|
1262
|
-
if (worktree && branchRef === expectedRef) return worktree;
|
|
1263
|
-
}
|
|
1272
|
+
const worktree = resolveBranchWorktree(repositoryRoot, branch);
|
|
1273
|
+
if (worktree) return worktree;
|
|
1264
1274
|
throw new Error(`Task branch '${branch}' is not checked out in a registered worktree`);
|
|
1265
1275
|
}
|
|
1266
1276
|
|
package/lib/task/verification.ts
CHANGED
|
@@ -7,8 +7,6 @@ import { parseArtifactName } from './artifact-name.ts';
|
|
|
7
7
|
import type { ArtifactFamily } from './artifact-lifecycle.ts';
|
|
8
8
|
import { resolveTaskRef } from './resolve-ref.ts';
|
|
9
9
|
import type { TaskWorkspaceState } from './resolve-ref.ts';
|
|
10
|
-
import { allowsManualOverride } from './guard-override.ts';
|
|
11
|
-
import type { ManualOverrideCapability } from './guard-override.ts';
|
|
12
10
|
|
|
13
11
|
type VerificationEvent =
|
|
14
12
|
| 'analyze.awaiting-input' | 'analyze.completed'
|
|
@@ -50,7 +48,6 @@ type TaskVerificationResult = {
|
|
|
50
48
|
type VerificationOptions = {
|
|
51
49
|
repoRoot?: string;
|
|
52
50
|
engine?: (input: Parameters<typeof verifyInProcess>[0]) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
53
|
-
manualOverride?: ManualOverrideCapability;
|
|
54
51
|
};
|
|
55
52
|
|
|
56
53
|
const gate = (skill: string, expectedState: VerificationSpec['expectedState'], artifactFamily?: ArtifactFamily): VerificationSpec => ({
|
|
@@ -98,7 +95,7 @@ async function verifyTaskEvent(request: { taskRef: string; event: string; artifa
|
|
|
98
95
|
const resolved = resolveTaskRef(request.taskRef, { repoRoot: options.repoRoot });
|
|
99
96
|
if (!resolved.ok) return failure(request, resolved.code, resolved.message, { taskId: resolved.taskId, skill: spec.skill, mode: spec.mode });
|
|
100
97
|
const identity = { taskId: resolved.taskId, taskDir: resolved.taskDir, taskState: resolved.state, skill: spec.skill, mode: spec.mode } as const;
|
|
101
|
-
if (resolved.state !== spec.expectedState
|
|
98
|
+
if (resolved.state !== spec.expectedState) {
|
|
102
99
|
return failure(request, 'VERIFY_TASK_STATE_MISMATCH', `event '${request.event}' requires workspace '${spec.expectedState}', received '${resolved.state}'`, identity);
|
|
103
100
|
}
|
|
104
101
|
if (spec.artifactFamily) {
|
|
@@ -116,22 +113,11 @@ async function verifyTaskEvent(request: { taskRef: string; event: string; artifa
|
|
|
116
113
|
if (spec.mode === 'gate') {
|
|
117
114
|
const payload = await engine({ mode: 'gate', skillName: spec.skill, taskDir: resolved.taskDir, artifactFile: request.artifact, checks: [], repositoryRoot: resolved.repoRoot });
|
|
118
115
|
const status = payload.gate as 'pass' | 'fail' | 'blocked';
|
|
119
|
-
if (status !== 'pass' && allowsManualOverride(options.manualOverride, 'verification-engine', status === 'blocked' ? 'CHECK_BLOCKED' : 'CHECK_FAILED')) {
|
|
120
|
-
invocations.push({ status: 'pass', exitCode: 0, payload: { ...payload, gate: 'pass', humanOverride: 'human-approved', originalGate: status } });
|
|
121
|
-
return {
|
|
122
|
-
status: 'pass', changed: false, event: request.event, requestRef: request.taskRef,
|
|
123
|
-
...identity, artifact: request.artifact ?? null, invocations, error: null
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
116
|
invocations.push({ status, exitCode: ({ pass: 0, fail: 1, blocked: 2 } as const)[status], payload });
|
|
127
117
|
} else {
|
|
128
118
|
for (const check of spec.checks ?? []) {
|
|
129
119
|
const payload = await engine({ mode: 'checks', skillName: spec.skill, taskDir: resolved.taskDir, artifactFile: request.artifact, checks: [check], repositoryRoot: resolved.repoRoot });
|
|
130
120
|
const status = (payload.effectiveStatus ?? payload.status) as 'pass' | 'fail' | 'blocked';
|
|
131
|
-
if (status !== 'pass' && allowsManualOverride(options.manualOverride, 'verification-engine', status === 'blocked' ? 'CHECK_BLOCKED' : 'CHECK_FAILED')) {
|
|
132
|
-
invocations.push({ status: 'pass', exitCode: 0, payload: { ...payload, status: 'pass', humanOverride: 'human-approved', originalStatus: status } });
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
121
|
invocations.push({ status, exitCode: ({ pass: 0, fail: 1, blocked: 2 } as const)[status], payload });
|
|
136
122
|
if (status !== 'pass') break;
|
|
137
123
|
}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
import type { WorkflowWarning } from './workflow-warnings.ts';
|
|
13
13
|
import { captureTaskWriteMetadata, writeTask } from './write.ts';
|
|
14
14
|
import type { TaskMutation, TaskOperationSummary, TaskWriteOptions } from './write.ts';
|
|
15
|
-
import { allowsManualOverride } from './guard-override.ts';
|
|
16
15
|
import { retryHintForWarning, type OperationWarning } from './operation-outcome.ts';
|
|
17
16
|
|
|
18
17
|
type WarningSeverity = 'IMPORTANT' | 'ACTION_REQUIRED';
|
|
@@ -77,8 +76,7 @@ function rowMutation(row: WorkflowWarning): TaskMutation {
|
|
|
77
76
|
function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: TaskWriteOptions = {}): WorkflowWarningIntentResult {
|
|
78
77
|
const resolved = resolveTaskRef(intent.taskRef, { repoRoot: options.repoRoot });
|
|
79
78
|
if (!resolved.ok) return failed(intent, resolved.code, resolved.message, resolved.taskId);
|
|
80
|
-
|
|
81
|
-
if (resolved.state !== 'active' && !stateOverride) return failed(intent, 'TASK_STATE_MISMATCH', `task ${resolved.taskId} is ${resolved.state}, expected active`, resolved.taskId);
|
|
79
|
+
if (resolved.state !== 'active') return failed(intent, 'TASK_STATE_MISMATCH', `task ${resolved.taskId} is ${resolved.state}, expected active`, resolved.taskId);
|
|
82
80
|
let content: string;
|
|
83
81
|
let rows: WorkflowWarning[];
|
|
84
82
|
try {
|
|
@@ -122,7 +120,7 @@ function applyWorkflowWarningIntent(intent: WorkflowWarningIntent, options: Task
|
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
const writeResult = writeTask({
|
|
125
|
-
taskRef: intent.taskRef, expectedState:
|
|
123
|
+
taskRef: intent.taskRef, expectedState: 'active', mutations: [...sectionMutation(content), rowMutation(after)], dryRun: intent.dryRun
|
|
126
124
|
}, {
|
|
127
125
|
...options,
|
|
128
126
|
taskLocation: { repoRoot: resolved.repoRoot, taskId: resolved.taskId, taskMdPath: resolved.taskMdPath, state: resolved.state },
|
package/lib/task/write.ts
CHANGED
|
@@ -12,8 +12,6 @@ import type {
|
|
|
12
12
|
ResolveTaskRefErrorCode,
|
|
13
13
|
TaskWorkspaceState
|
|
14
14
|
} from './resolve-ref.ts';
|
|
15
|
-
import { allowsManualOverride } from './guard-override.ts';
|
|
16
|
-
import type { ManualOverrideCapability } from './guard-override.ts';
|
|
17
15
|
import { mutateTableRow, upsertSection } from './sections.ts';
|
|
18
16
|
import { validateCurrentTaskContract } from './current-contract.ts';
|
|
19
17
|
import { invalidationBlocks, parseInvalidationDocument } from './invalidation.ts';
|
|
@@ -163,7 +161,6 @@ type TaskWriteOptions = {
|
|
|
163
161
|
metadataProvider?: () => TaskWriteMetadata;
|
|
164
162
|
randomSuffix?: () => string;
|
|
165
163
|
fileSystem?: Partial<TaskFileSystem>;
|
|
166
|
-
manualOverride?: ManualOverrideCapability;
|
|
167
164
|
invalidationContext?: 'standard' | 'source-completion' | 'reconcile';
|
|
168
165
|
};
|
|
169
166
|
|
|
@@ -250,7 +247,7 @@ function writeTask(request: TaskWriteRequest, options: TaskWriteOptions = {}): T
|
|
|
250
247
|
taskMdPath: resolved.taskMdPath,
|
|
251
248
|
actualState: resolved.state
|
|
252
249
|
};
|
|
253
|
-
if (resolved.state !== request.expectedState
|
|
250
|
+
if (resolved.state !== request.expectedState) {
|
|
254
251
|
return failure(
|
|
255
252
|
request,
|
|
256
253
|
identity,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitlab-ai/agent-infra",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
|
|
|
15
15
|
|
|
16
16
|
### Flow decision
|
|
17
17
|
|
|
18
|
-
The analysis artifact must record
|
|
18
|
+
The analysis artifact must record `Path`, `Basis`, `Unmet Higher-path Conditions`, and `Upgrade Triggers` exactly once each, with non-empty values, in `## Flow Decision`. The path is streamlined, standard, or full; file count, module count, and speculative risk cannot upgrade it by themselves. The analysis `finalize-local` reuses the lifecycle-path parser to validate this decision; directly repair the formal artifact and rerun it for missing, duplicate, or invalid values.
|
|
19
19
|
|
|
20
20
|
### Persisted Report Evidence
|
|
21
21
|
|
|
@@ -160,7 +160,7 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
|
|
|
160
160
|
|
|
161
161
|
## State Check
|
|
162
162
|
|
|
163
|
-
> Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts
|
|
163
|
+
> Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
|
|
164
164
|
|
|
165
165
|
## Requirement Source
|
|
166
166
|
|
|
@@ -187,6 +187,15 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
|
|
|
187
187
|
## Dependencies
|
|
188
188
|
- {Required dependencies and coordination with other modules}
|
|
189
189
|
|
|
190
|
+
<!-- lifecycle-path-decision-template:start -->
|
|
191
|
+
## Flow Decision
|
|
192
|
+
|
|
193
|
+
- **Path**: {lifecycle-path}
|
|
194
|
+
- **Basis**: {Factual basis for selecting the current path}
|
|
195
|
+
- **Unmet Higher-path Conditions**: {Factual conditions for the higher path that are not met; for full, state that no higher path exists}
|
|
196
|
+
- **Upgrade Triggers**: {Factual triggers that require reassessing the path}
|
|
197
|
+
<!-- lifecycle-path-decision-template:end -->
|
|
198
|
+
|
|
190
199
|
## Assumptions
|
|
191
200
|
|
|
192
201
|
> If this analysis depends on assumptions, list them here; omit this section if there are none.
|
|
@@ -15,7 +15,7 @@ description: >
|
|
|
15
15
|
|
|
16
16
|
### 流程裁定
|
|
17
17
|
|
|
18
|
-
分析产物必须在 `## 流程裁定`
|
|
18
|
+
分析产物必须在 `## 流程裁定` 中记录 `本任务路径`、`判定依据`、`未满足的更高路径条件` 和 `升级触发条件` 四个字段,每个字段恰好一次且非空。路径仅可为精简、标准或完整;文件数、模块数和推测性风险不能单独升级路径。analysis 的 `finalize-local` 会复用生命周期路径解析器校验该决定;缺失、重复或无效值必须直接修复正式产物后重跑。
|
|
19
19
|
|
|
20
20
|
### 持久化报告证据
|
|
21
21
|
|
|
@@ -163,7 +163,7 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
|
|
|
163
163
|
|
|
164
164
|
## 状态核对
|
|
165
165
|
|
|
166
|
-
> 记录第 0
|
|
166
|
+
> 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
|
|
167
167
|
|
|
168
168
|
## 需求来源
|
|
169
169
|
|
|
@@ -190,6 +190,15 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
|
|
|
190
190
|
## 依赖关系
|
|
191
191
|
- {需要的依赖和与其他模块的协调}
|
|
192
192
|
|
|
193
|
+
<!-- lifecycle-path-decision-template:start -->
|
|
194
|
+
## 流程裁定
|
|
195
|
+
|
|
196
|
+
- **本任务路径**:{lifecycle-path}
|
|
197
|
+
- **判定依据**:{选择当前路径的事实依据}
|
|
198
|
+
- **未满足的更高路径条件**:{当前未满足的更高路径条件;完整路径写不存在更高路径的事实}
|
|
199
|
+
- **升级触发条件**:{未来需要重新评估路径的事实触发条件}
|
|
200
|
+
<!-- lifecycle-path-decision-template:end -->
|
|
201
|
+
|
|
193
202
|
## 资格审计
|
|
194
203
|
|
|
195
204
|
> 按 `.agents/rules/decision-qualification.md` 填写约束依赖、候选资格、分类结果、上游关系、依赖快照五张表;没有 artifact 上游时保留空表头,不虚构关系。
|
|
@@ -102,25 +102,25 @@ Use this structure when creating `code.md` or `code-r{N}.md`.
|
|
|
102
102
|
|
|
103
103
|
## State Check
|
|
104
104
|
|
|
105
|
-
> Record the state-check command, task/artifact scope, key result, and uncovered parts
|
|
105
|
+
> Record the state-check command, task/artifact scope, key result, and uncovered parts.
|
|
106
106
|
> Follow `.agents/rules/evidence-reporting.md`: record task/artifact scope, key result, and uncovered parts; do not paste complete successful stdout.
|
|
107
107
|
|
|
108
|
-
Record at least one actually executed
|
|
108
|
+
Record at least one actually executed command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
|
|
109
109
|
|
|
110
110
|
```text
|
|
111
|
-
|
|
111
|
+
agent-infra-internal task-snapshot {task-id} --format text
|
|
112
112
|
{task state, implementation-artifact scope, and uncovered-area summary}
|
|
113
|
-
|
|
113
|
+
agent-infra-internal task-artifact {task-id} inspect --family code
|
|
114
114
|
{code artifact, upstream input, and next-step summary}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
## Raw Evidence
|
|
118
118
|
|
|
119
|
-
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with
|
|
119
|
+
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
|
|
120
120
|
|
|
121
121
|
- Claim: {verified claim}
|
|
122
122
|
```text
|
|
123
|
-
|
|
123
|
+
{command}
|
|
124
124
|
{result summary or decisive excerpt}
|
|
125
125
|
```
|
|
126
126
|
|
|
@@ -102,25 +102,25 @@
|
|
|
102
102
|
|
|
103
103
|
## 状态核对
|
|
104
104
|
|
|
105
|
-
>
|
|
105
|
+
> 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分。
|
|
106
106
|
> 按 `.agents/rules/evidence-reporting.md` 同时记录任务/产物范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
必须记录至少一条实际执行的命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
|
|
109
109
|
|
|
110
110
|
```text
|
|
111
|
-
|
|
111
|
+
agent-infra-internal task-snapshot {task-id} --format text
|
|
112
112
|
{任务状态、实现产物范围和未覆盖项摘要}
|
|
113
|
-
|
|
113
|
+
agent-infra-internal task-artifact {task-id} inspect --family code
|
|
114
114
|
{code artifact、上游输入和下一步摘要}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
## 证据原文
|
|
118
118
|
|
|
119
|
-
> 遵循 `.agents/rules/evidence-reporting.md
|
|
119
|
+
> 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
|
|
120
120
|
|
|
121
121
|
- 断言:{verified claim}
|
|
122
122
|
```text
|
|
123
|
-
|
|
123
|
+
{command}
|
|
124
124
|
{result summary or decisive excerpt}
|
|
125
125
|
```
|
|
126
126
|
|
|
@@ -12,9 +12,7 @@ Read this file before creating `manual-validation.md` / `manual-validation-r{N}.
|
|
|
12
12
|
## State Check
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
|
|
16
|
-
$ ls -la .agents/workspace/active/{task-id}/
|
|
17
|
-
$ tail .agents/workspace/active/{task-id}/task.md
|
|
15
|
+
agent-infra-internal task-snapshot {task-id} --format text
|
|
18
16
|
```
|
|
19
17
|
> Follow `.agents/rules/evidence-reporting.md`: record task scope, key result, and uncovered parts; do not paste the complete directory listing or task tail for normal success.
|
|
20
18
|
|
package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md
CHANGED
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
## 状态核对
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
|
|
16
|
-
$ ls -la .agents/workspace/active/{task-id}/
|
|
17
|
-
$ tail .agents/workspace/active/{task-id}/task.md
|
|
15
|
+
agent-infra-internal task-snapshot {task-id} --format text
|
|
18
16
|
```
|
|
19
17
|
> 按 `.agents/rules/evidence-reporting.md` 记录任务范围、关键结果和未覆盖部分;正常成功不粘贴完整目录清单或 task tail。
|
|
20
18
|
|
|
@@ -147,16 +147,16 @@ Use this template when writing `review-analysis.md` or `review-analysis-r{N}.md`
|
|
|
147
147
|
|
|
148
148
|
## State Check
|
|
149
149
|
|
|
150
|
-
> Record the state-check command, review scope, key result, and uncovered parts
|
|
150
|
+
> Record the state-check command, review scope, key result, and uncovered parts.
|
|
151
151
|
> Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
|
|
152
152
|
|
|
153
153
|
## Raw Evidence
|
|
154
154
|
|
|
155
|
-
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with
|
|
155
|
+
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
|
|
156
156
|
|
|
157
157
|
- Claim: {verified claim}
|
|
158
158
|
```text
|
|
159
|
-
|
|
159
|
+
{command}
|
|
160
160
|
{result summary or decisive excerpt}
|
|
161
161
|
```
|
|
162
162
|
|
|
@@ -147,16 +147,16 @@
|
|
|
147
147
|
|
|
148
148
|
## 状态核对
|
|
149
149
|
|
|
150
|
-
>
|
|
150
|
+
> 记录状态核对命令、审查范围、关键结果和未覆盖部分。
|
|
151
151
|
> 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
|
|
152
152
|
|
|
153
153
|
## 证据原文
|
|
154
154
|
|
|
155
|
-
> 遵循 `.agents/rules/evidence-reporting.md
|
|
155
|
+
> 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
|
|
156
156
|
|
|
157
157
|
- 断言:{verified claim}
|
|
158
158
|
```text
|
|
159
|
-
|
|
159
|
+
{command}
|
|
160
160
|
{result summary or decisive excerpt}
|
|
161
161
|
```
|
|
162
162
|
|
|
@@ -153,16 +153,16 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
|
|
|
153
153
|
|
|
154
154
|
## State Check
|
|
155
155
|
|
|
156
|
-
> Record the state-check command, review scope, key result, and uncovered parts
|
|
156
|
+
> Record the state-check command, review scope, key result, and uncovered parts.
|
|
157
157
|
> Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
|
|
158
158
|
|
|
159
159
|
## Raw Evidence
|
|
160
160
|
|
|
161
|
-
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with
|
|
161
|
+
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require reproducible evidence, exact location, and a decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
|
|
162
162
|
|
|
163
163
|
- Claim: {verified claim}
|
|
164
164
|
```text
|
|
165
|
-
|
|
165
|
+
{command}
|
|
166
166
|
{result summary or decisive excerpt}
|
|
167
167
|
```
|
|
168
168
|
|
|
@@ -153,16 +153,16 @@
|
|
|
153
153
|
|
|
154
154
|
## 状态核对
|
|
155
155
|
|
|
156
|
-
>
|
|
156
|
+
> 记录状态核对命令、审查范围、关键结果和未覆盖部分。
|
|
157
157
|
> 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
|
|
158
158
|
|
|
159
159
|
## 证据原文
|
|
160
160
|
|
|
161
|
-
> 遵循 `.agents/rules/evidence-reporting.md
|
|
161
|
+
> 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现证据、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
|
|
162
162
|
|
|
163
163
|
- 断言:{verified claim}
|
|
164
164
|
```text
|
|
165
|
-
|
|
165
|
+
{command}
|
|
166
166
|
{result summary or decisive excerpt}
|
|
167
167
|
```
|
|
168
168
|
|
|
@@ -157,16 +157,16 @@ Use this template when writing `review-plan.md` or `review-plan-r{N}.md`.
|
|
|
157
157
|
|
|
158
158
|
## State Check
|
|
159
159
|
|
|
160
|
-
> Record the state-check command, review scope, key result, and uncovered parts
|
|
160
|
+
> Record the state-check command, review scope, key result, and uncovered parts.
|
|
161
161
|
> Follow `.agents/rules/evidence-reporting.md`: record review scope, key result, and uncovered parts; do not paste complete successful stdout.
|
|
162
162
|
|
|
163
163
|
## Raw Evidence
|
|
164
164
|
|
|
165
|
-
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with
|
|
165
|
+
> Follow `.agents/rules/evidence-reporting.md`: pair each claim with an executable command and proportionate result summary; Blockers, failures, blocking conditions, or disputes require a reproducible command, exact location, and decisive excerpt; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
|
|
166
166
|
|
|
167
167
|
- Claim: {verified claim}
|
|
168
168
|
```text
|
|
169
|
-
|
|
169
|
+
{command}
|
|
170
170
|
{result summary or decisive excerpt}
|
|
171
171
|
```
|
|
172
172
|
|
|
@@ -157,16 +157,16 @@
|
|
|
157
157
|
|
|
158
158
|
## 状态核对
|
|
159
159
|
|
|
160
|
-
>
|
|
160
|
+
> 记录状态核对命令、审查范围、关键结果和未覆盖部分。
|
|
161
161
|
> 按 `.agents/rules/evidence-reporting.md` 同时记录审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
|
|
162
162
|
|
|
163
163
|
## 证据原文
|
|
164
164
|
|
|
165
|
-
> 遵循 `.agents/rules/evidence-reporting.md
|
|
165
|
+
> 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;Blocker、失败、阻塞或争议必须保留可复现命令、准确位置和决定性摘录;无法复现的判断须降级或移入「自我质疑」。
|
|
166
166
|
|
|
167
167
|
- 断言:{verified claim}
|
|
168
168
|
```text
|
|
169
|
-
|
|
169
|
+
{command}
|
|
170
170
|
{result summary or decisive excerpt}
|
|
171
171
|
```
|
|
172
172
|
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
"State Check",
|
|
13
13
|
"Evidence"
|
|
14
14
|
],
|
|
15
|
+
"state_check_patterns": [
|
|
16
|
+
"agent-infra-internal[ \\t]+task-snapshot\\b"
|
|
17
|
+
],
|
|
15
18
|
"required_patterns": [
|
|
16
|
-
"^\\$ ",
|
|
17
19
|
"^- \\*\\*Reviewed Head SHA\\*\\*[::]\\s*[0-9a-f]{40}\\s*$",
|
|
18
20
|
"^- \\*\\*Review Mode\\*\\*[::]\\s*(?:verify|audit|reconstruct)\\s*$",
|
|
19
21
|
"^- \\*\\*Evidence Scenario\\*\\*[::]\\s*S[123]\\s*$",
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
"状态核对",
|
|
13
13
|
"证据原文"
|
|
14
14
|
],
|
|
15
|
+
"state_check_patterns": [
|
|
16
|
+
"agent-infra-internal[ \\t]+task-snapshot\\b"
|
|
17
|
+
],
|
|
15
18
|
"required_patterns": [
|
|
16
|
-
"^\\$ ",
|
|
17
19
|
"^- \\*\\*被审 head SHA\\*\\*[::]\\s*[0-9a-f]{40}\\s*$",
|
|
18
20
|
"^- \\*\\*审查模式\\*\\*[::]\\s*(?:verify|audit|reconstruct)\\s*$",
|
|
19
21
|
"^- \\*\\*证据场景\\*\\*[::]\\s*S[123]\\s*$",
|
|
@@ -11,7 +11,7 @@ Use the following structure when creating `pr-review.md` or `pr-review-r{N}.md`.
|
|
|
11
11
|
|
|
12
12
|
## State Check
|
|
13
13
|
|
|
14
|
-
> Record the state-check command, PR/head, review scope, key result, and uncovered parts
|
|
14
|
+
> Record the state-check command, PR/head, review scope, key result, and uncovered parts.
|
|
15
15
|
> Follow `.agents/rules/evidence-reporting.md`: record PR, head, review scope, key result, and uncovered parts; do not paste complete successful stdout.
|
|
16
16
|
|
|
17
17
|
## Identity
|
|
@@ -77,10 +77,10 @@ Land the following in order before the line-level findings, without impersonatin
|
|
|
77
77
|
|
|
78
78
|
## Evidence
|
|
79
79
|
|
|
80
|
-
> Follow `.agents/rules/evidence-reporting.md`: pair every assertion with
|
|
80
|
+
> Follow `.agents/rules/evidence-reporting.md`: pair every assertion with an executable command and proportionate result summary; formal Review, failures, blocking conditions, or disputes retain exact identity and decisive excerpts.
|
|
81
81
|
|
|
82
82
|
- Assertion: {verified claim}
|
|
83
83
|
```text
|
|
84
|
-
|
|
84
|
+
{command}
|
|
85
85
|
{result summary or decisive excerpt}
|
|
86
86
|
```
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
## 状态核对
|
|
13
13
|
|
|
14
|
-
> 记录状态核对命令、PR/head
|
|
14
|
+
> 记录状态核对命令、PR/head、审查范围、关键结果和未覆盖部分。
|
|
15
15
|
> 按 `.agents/rules/evidence-reporting.md` 同时记录 PR、head、审查范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
|
|
16
16
|
|
|
17
17
|
## 身份信息
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
|
|
78
78
|
## 证据原文
|
|
79
79
|
|
|
80
|
-
> 遵循 `.agents/rules/evidence-reporting.md
|
|
80
|
+
> 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对可执行命令和相称结果摘要;正式 Review、失败、阻塞或争议保留准确身份和决定性摘录。
|
|
81
81
|
|
|
82
82
|
- 断言:{verified claim}
|
|
83
83
|
```text
|
|
84
|
-
|
|
84
|
+
{command}
|
|
85
85
|
{result summary or decisive excerpt}
|
|
86
86
|
```
|