@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
|
@@ -9,7 +9,8 @@ import { parseTaskFrontmatter, extractTitle } from '../frontmatter.js';
|
|
|
9
9
|
import { loadShortIdByTaskId } from '../short-id.js';
|
|
10
10
|
import { getOpenWorkflowWarnings, formatWorkflowWarningSummary } from '../workflow-warnings.js';
|
|
11
11
|
import { parseActivityLog, pairEntries, startedBackedRows } from '../activity-log.js';
|
|
12
|
-
import {
|
|
12
|
+
import { lifecycleExecutions } from '../lifecycle-execution.js';
|
|
13
|
+
import { parseTypedTaskFrontmatter } from '../frontmatter.js';
|
|
13
14
|
import { statusCard } from '../../server/display.js';
|
|
14
15
|
import { buildLifecycleFacts, recommendNext } from '../capabilities.js';
|
|
15
16
|
const USAGE = `Usage: ai task status [--task <ref> | -t <ref>]
|
|
@@ -151,6 +152,18 @@ function parseActivityTime(value) {
|
|
|
151
152
|
const epoch = Date.parse(value.replace(' ', 'T'));
|
|
152
153
|
return Number.isFinite(epoch) ? epoch : Number.NaN;
|
|
153
154
|
}
|
|
155
|
+
function collectStructuredWorkflow(content, now) {
|
|
156
|
+
try {
|
|
157
|
+
const current = lifecycleExecutions(content).filter((row) => row.family !== 'other').at(-1);
|
|
158
|
+
if (!current)
|
|
159
|
+
return { state: 'idle', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
160
|
+
const started = parseActivityTime(current.startedAt);
|
|
161
|
+
return { state: 'in-progress', step: current.family, agent: current.agent, startedAt: current.startedAt, doneAt: DASH, stale: Number.isFinite(started) ? (now.getTime() - started > STALE_MS ? 'yes' : 'no') : 'unknown' };
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return { state: 'unknown', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
154
167
|
function collectWorkflow(content, now = new Date()) {
|
|
155
168
|
const parsed = parseActivityLog(content);
|
|
156
169
|
if (!parsed.sectionFound || parsed.entries.length === 0) {
|
|
@@ -264,38 +277,6 @@ function collectRuntime(taskDir, workflow, run) {
|
|
|
264
277
|
log: record.log_file
|
|
265
278
|
};
|
|
266
279
|
}
|
|
267
|
-
function pendingDelegationInfo(receipt) {
|
|
268
|
-
if (!receipt)
|
|
269
|
-
return null;
|
|
270
|
-
return {
|
|
271
|
-
id: receipt.id,
|
|
272
|
-
role: receipt.role,
|
|
273
|
-
stage: receipt.stage,
|
|
274
|
-
round: receipt.round,
|
|
275
|
-
artifact: receipt.artifact,
|
|
276
|
-
client: receipt.client,
|
|
277
|
-
status: receipt.status
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function collectOrchestration(taskDir) {
|
|
281
|
-
const run = readRun(taskDir);
|
|
282
|
-
if (!run) {
|
|
283
|
-
return {
|
|
284
|
-
status: 'absent',
|
|
285
|
-
runId: DASH,
|
|
286
|
-
nextStage: DASH,
|
|
287
|
-
pause: null,
|
|
288
|
-
pendingDelegation: null
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
return {
|
|
292
|
-
status: run.status,
|
|
293
|
-
runId: run.runId,
|
|
294
|
-
nextStage: run.nextStage ?? DASH,
|
|
295
|
-
pause: run.pause,
|
|
296
|
-
pendingDelegation: pendingDelegationInfo(run.pendingDelegation)
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
280
|
// Indent each label/value pair by two spaces and pad labels to a common width so
|
|
300
281
|
// every section reads as an aligned "key value" block.
|
|
301
282
|
function renderPairs(rows) {
|
|
@@ -323,21 +304,6 @@ function renderStatus(model) {
|
|
|
323
304
|
['action', model.recommendation ?? DASH],
|
|
324
305
|
['reason', model.recommendationReason ?? DASH]
|
|
325
306
|
]));
|
|
326
|
-
lines.push('', 'Orchestration', ...renderPairs([
|
|
327
|
-
['status', model.orchestration.status],
|
|
328
|
-
['run_id', model.orchestration.runId],
|
|
329
|
-
['next_stage', model.orchestration.nextStage],
|
|
330
|
-
['pause_code', model.orchestration.pause?.code ?? DASH],
|
|
331
|
-
['pause_message', model.orchestration.pause?.message ?? DASH],
|
|
332
|
-
['recoverable', model.orchestration.pause ? String(model.orchestration.pause.recoverable) : DASH],
|
|
333
|
-
['pending_id', model.orchestration.pendingDelegation?.id ?? DASH],
|
|
334
|
-
['pending_role', model.orchestration.pendingDelegation?.role ?? DASH],
|
|
335
|
-
['pending_stage', model.orchestration.pendingDelegation?.stage ?? DASH],
|
|
336
|
-
['pending_round', model.orchestration.pendingDelegation ? String(model.orchestration.pendingDelegation.round) : DASH],
|
|
337
|
-
['pending_artifact', model.orchestration.pendingDelegation?.artifact ?? DASH],
|
|
338
|
-
['pending_client', model.orchestration.pendingDelegation?.client ?? DASH],
|
|
339
|
-
['pending_status', model.orchestration.pendingDelegation?.status ?? DASH]
|
|
340
|
-
]));
|
|
341
307
|
lines.push('', 'Workflow', ...renderPairs([
|
|
342
308
|
['state', model.workflow.state],
|
|
343
309
|
['step', model.workflow.step],
|
|
@@ -367,12 +333,6 @@ function renderStatus(model) {
|
|
|
367
333
|
return lines;
|
|
368
334
|
}
|
|
369
335
|
function modelTone(model) {
|
|
370
|
-
if (model.orchestration.status === 'paused')
|
|
371
|
-
return 'warning';
|
|
372
|
-
if (model.orchestration.status === 'running')
|
|
373
|
-
return 'running';
|
|
374
|
-
if (model.orchestration.status === 'completed')
|
|
375
|
-
return 'success';
|
|
376
336
|
if (model.workflow.state === 'in-progress')
|
|
377
337
|
return model.workflow.stale === 'yes' ? 'warning' : 'running';
|
|
378
338
|
if (model.metadata.some(([key, value]) => key === 'status' && value === 'completed'))
|
|
@@ -387,7 +347,8 @@ function buildFromResolved(input) {
|
|
|
387
347
|
const fm = parseTaskFrontmatter(content);
|
|
388
348
|
const run = input.run ?? makeRunner(input.repoRoot);
|
|
389
349
|
const artifacts = enumerateArtifacts(input.taskDir);
|
|
390
|
-
const workflow =
|
|
350
|
+
const workflow = parseTypedTaskFrontmatter(content).lifecycle_execution !== undefined
|
|
351
|
+
? collectStructuredWorkflow(content, input.now ?? new Date()) : collectWorkflow(content, input.now);
|
|
391
352
|
const facts = buildLifecycleFacts(input.taskDir, content, fm.status ?? 'active', false, input.repoRoot);
|
|
392
353
|
const next = facts.ok ? recommendNext(facts.facts) : null;
|
|
393
354
|
const recommendation = next?.action ?? DASH;
|
|
@@ -400,7 +361,6 @@ function buildFromResolved(input) {
|
|
|
400
361
|
artifacts: { count: artifacts.length, groups: groupArtifacts(artifacts) },
|
|
401
362
|
workflow,
|
|
402
363
|
runtime: collectRuntime(input.taskDir, workflow, run),
|
|
403
|
-
orchestration: collectOrchestration(input.taskDir),
|
|
404
364
|
recommendation,
|
|
405
365
|
recommendationReason: next?.reasonCode ?? 'TASK_CAPABILITY_FACTS_INVALID',
|
|
406
366
|
lifecyclePath: facts.ok && facts.facts.pathState?.status === 'valid' ? facts.facts.pathState.decision.path : facts.ok ? facts.facts.pathState?.status ?? DASH : DASH,
|
|
@@ -426,9 +386,6 @@ function buildStatusModel(refOrInput, options = {}) {
|
|
|
426
386
|
}
|
|
427
387
|
function statusModelToDisplay(model) {
|
|
428
388
|
return statusCard(`Task ${model.taskId} (${model.shortId})`, modelTone(model), [
|
|
429
|
-
['orchestration', model.orchestration.status],
|
|
430
|
-
['run', model.orchestration.runId],
|
|
431
|
-
['next', model.orchestration.nextStage],
|
|
432
389
|
['workflow', model.workflow.state],
|
|
433
390
|
['step', model.workflow.step],
|
|
434
391
|
['runtime', model.runtime.status],
|
|
@@ -463,5 +420,5 @@ function status(args = []) {
|
|
|
463
420
|
process.stdout.write(`${line}\n`);
|
|
464
421
|
}
|
|
465
422
|
}
|
|
466
|
-
export { status, makeRunner, buildStatusModel, collectMetadata, groupArtifacts, collectGit, collectWorkflow, collectRuntime,
|
|
423
|
+
export { status, makeRunner, buildStatusModel, collectMetadata, groupArtifacts, collectGit, collectWorkflow, collectRuntime, renderStatus, statusModelToDisplay, METADATA_KEYS };
|
|
467
424
|
//# sourceMappingURL=status.js.map
|
|
@@ -7,12 +7,12 @@ import { checkpointCommitMatches } from './commit-identity.js';
|
|
|
7
7
|
import { resolveTaskContext, resolveTaskRef } from './resolve-ref.js';
|
|
8
8
|
import { commitPushDecision } from './commit-policy.js';
|
|
9
9
|
import { mergeOperationWarnings } from './operation-outcome.js';
|
|
10
|
-
import { appendActivityEntry, locateActivityLog } from './activity-log.js';
|
|
10
|
+
import { activityWarnings, appendActivityEntry, locateActivityLog } from './activity-log.js';
|
|
11
11
|
import { captureTaskWriteMetadata, writeTask } from './write.js';
|
|
12
12
|
import { checkpointIntentDigest, readCheckpointIntent, removeCheckpointIntent, sameCheckpointIntent, updateCheckpointIntent, writeCheckpointIntent } from './commit-intent.js';
|
|
13
13
|
const HEAD_REF = /^refs\/heads\/(.+)$/;
|
|
14
14
|
function isCommitExecutionMode(value) {
|
|
15
|
-
return value === 'direct'
|
|
15
|
+
return value === 'direct';
|
|
16
16
|
}
|
|
17
17
|
function gitText(repoRoot, args) {
|
|
18
18
|
return execFileSync('git', [...args], {
|
|
@@ -117,50 +117,43 @@ function validateCommon(input, branch) {
|
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
// Log presentation only; checkpoint identity and recovery never depend on this projection.
|
|
121
|
+
function commitLogProjection(activity, timestamp, agent, commitNote) {
|
|
122
|
+
if (!activity)
|
|
123
|
+
return [];
|
|
124
|
+
let lastCommit = -1;
|
|
125
|
+
for (const [index, entry] of activity.entries.entries()) {
|
|
126
|
+
if (entry.step === 'Commit' && entry.note === commitNote)
|
|
127
|
+
lastCommit = index;
|
|
128
|
+
}
|
|
129
|
+
const reviewedAfter = activity.entries.slice(lastCommit + 1).some((entry) => /^Review Code \(Round \d+\)$/.test(entry.step));
|
|
130
|
+
if (lastCommit >= 0 && !reviewedAfter)
|
|
131
|
+
return [];
|
|
132
|
+
return [{ kind: 'section', aliases: ['活动日志', 'Activity Log'], heading: activity.heading,
|
|
133
|
+
body: appendActivityEntry(activity, { time: timestamp, step: 'Commit', agent, note: commitNote }) }];
|
|
134
|
+
}
|
|
135
|
+
function syncTaskCommit(input, task, committedHead, writeOptions = {}) {
|
|
121
136
|
let content;
|
|
122
137
|
try {
|
|
123
138
|
content = fs.readFileSync(task.taskMdPath, 'utf8');
|
|
124
139
|
const activity = locateActivityLog(content);
|
|
125
|
-
if (!activity)
|
|
126
|
-
return warning('TASK_STATUS_SYNC_FAILED', 'task has no unique Activity Log section', true, 'task', task.taskId, 'ACTION_REQUIRED');
|
|
127
140
|
const metadata = captureTaskWriteMetadata();
|
|
128
141
|
const commitNote = gitText(task.repoRoot, ['show', '-s', '--format=%h %s', committedHead]);
|
|
129
|
-
|
|
130
|
-
for (let index = activity.entries.length - 1; index >= 0; index -= 1) {
|
|
131
|
-
const entry = activity.entries[index];
|
|
132
|
-
if (entry.step === 'Commit' && entry.note === commitNote) {
|
|
133
|
-
matchingCommitIndex = index;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const reviewedAfterCommit = matchingCommitIndex >= 0 && activity.entries
|
|
138
|
-
.slice(matchingCommitIndex + 1)
|
|
139
|
-
.some((entry) => /^Review Code \(Round \d+\)$/.test(entry.step));
|
|
140
|
-
const alreadyLogged = matchingCommitIndex >= 0 && !reviewedAfterCommit;
|
|
141
|
-
const mutations = [];
|
|
142
|
-
if (!alreadyLogged)
|
|
143
|
-
mutations.push({
|
|
144
|
-
kind: 'section',
|
|
145
|
-
aliases: ['活动日志', 'Activity Log'],
|
|
146
|
-
heading: activity.heading,
|
|
147
|
-
body: appendActivityEntry(activity, { time: metadata.timestamp, step: 'Commit', agent: input.agent, note: commitNote })
|
|
148
|
-
});
|
|
142
|
+
const mutations = commitLogProjection(activity, metadata.timestamp, input.agent, commitNote);
|
|
149
143
|
const frontmatter = {
|
|
150
144
|
assigned_to: input.agent,
|
|
151
145
|
checkpoint_commit: committedHead
|
|
152
146
|
};
|
|
153
147
|
mutations.push({ kind: 'frontmatter', set: frontmatter });
|
|
154
|
-
if (mutations.length === 0)
|
|
155
|
-
return null;
|
|
156
148
|
const written = writeTask({
|
|
157
149
|
taskRef: task.taskId,
|
|
158
150
|
expectedState: 'active',
|
|
159
151
|
mutations
|
|
160
|
-
}, { repoRoot: task.repoRoot, metadataProvider: () => metadata });
|
|
152
|
+
}, { ...writeOptions, repoRoot: task.repoRoot, metadataProvider: () => metadata });
|
|
161
153
|
if (written.status === 'failed')
|
|
162
154
|
return warning('TASK_STATUS_SYNC_FAILED', written.error.message, true, 'task', task.taskId, 'ACTION_REQUIRED');
|
|
163
|
-
|
|
155
|
+
const logWarning = activityWarnings(content)[0];
|
|
156
|
+
return logWarning ? warning(logWarning.code, logWarning.message, true, 'task', task.taskId, 'IMPORTANT') : null;
|
|
164
157
|
}
|
|
165
158
|
catch (error) {
|
|
166
159
|
return warning('TASK_STATUS_SYNC_FAILED', error instanceof Error ? error.message : String(error), true, 'task', task.taskId, 'ACTION_REQUIRED');
|
|
@@ -183,12 +176,10 @@ function checkpointIdentity(input, task, delivery) {
|
|
|
183
176
|
function checkpointTimestamp() {
|
|
184
177
|
return new Date().toISOString();
|
|
185
178
|
}
|
|
186
|
-
function executeCommitOperationCore(input, task, mode) {
|
|
179
|
+
function executeCommitOperationCore(input, task, mode, writeOptions) {
|
|
187
180
|
const inspected = inspectGitWorkflow(input.cwd);
|
|
188
181
|
if (!inspected.snapshot)
|
|
189
182
|
return failure(input, mode, task?.taskId ?? null, 'GIT_INSPECT_FAILED', 'Unable to inspect Git repository');
|
|
190
|
-
if (mode === 'orchestrated')
|
|
191
|
-
return failure(input, mode, task?.taskId ?? null, 'ORCHESTRATED_COMMIT_REMOVED', 'Orchestrated commit is no longer a lifecycle stage; use local checkpoint delivery from code-task', 'blocked', inspected.snapshot);
|
|
192
183
|
const branch = inspected.snapshot.branch;
|
|
193
184
|
const commonError = validateCommon(input, branch);
|
|
194
185
|
if (commonError)
|
|
@@ -380,13 +371,13 @@ function executeCommitOperationCore(input, task, mode) {
|
|
|
380
371
|
}
|
|
381
372
|
if (task && (committed.status === 'applied' || committed.status === 'no-op')) {
|
|
382
373
|
const committedHead = checkpointCommittedHead ?? committed.snapshot?.head ?? gitText(task.repoRoot, ['rev-parse', 'HEAD']);
|
|
383
|
-
const taskWarning = syncTaskCommit(input, task, committedHead);
|
|
374
|
+
const taskWarning = syncTaskCommit(input, task, committedHead, writeOptions);
|
|
384
375
|
if (taskWarning) {
|
|
385
376
|
warnings.push(taskWarning);
|
|
386
377
|
status = 'applied';
|
|
387
378
|
result = 'committed_with_warnings';
|
|
388
379
|
}
|
|
389
|
-
if (delivery.mode === 'local' &&
|
|
380
|
+
if (delivery.mode === 'local' && taskWarning?.code !== 'TASK_STATUS_SYNC_FAILED' && pendingIntent && checkpointCommittedHead) {
|
|
390
381
|
const synced = updateCheckpointIntent(pendingIntent, {
|
|
391
382
|
state: 'synced', committedHead: checkpointCommittedHead, updatedAt: checkpointTimestamp()
|
|
392
383
|
});
|
|
@@ -406,7 +397,7 @@ function executeCommitOperationCore(input, task, mode) {
|
|
|
406
397
|
error: null
|
|
407
398
|
};
|
|
408
399
|
}
|
|
409
|
-
function executeCommitOperation(input) {
|
|
400
|
+
function executeCommitOperation(input, writeOptions = {}) {
|
|
410
401
|
if (input.mode !== undefined && !isCommitExecutionMode(input.mode))
|
|
411
402
|
return {
|
|
412
403
|
status: 'blocked',
|
|
@@ -417,7 +408,7 @@ function executeCommitOperation(input) {
|
|
|
417
408
|
warnings: [],
|
|
418
409
|
snapshot: null,
|
|
419
410
|
operations: [],
|
|
420
|
-
error: { code: 'COMMIT_MODE_INVALID', message: 'commit mode must be direct
|
|
411
|
+
error: { code: 'COMMIT_MODE_INVALID', message: 'commit mode must be direct' }
|
|
421
412
|
};
|
|
422
413
|
const mode = input.mode ?? 'direct';
|
|
423
414
|
let normalizedInput;
|
|
@@ -431,10 +422,8 @@ function executeCommitOperation(input) {
|
|
|
431
422
|
if (resolved.kind === 'error')
|
|
432
423
|
return resolved.result;
|
|
433
424
|
const task = resolved.kind === 'bound' ? resolved.task : null;
|
|
434
|
-
if (mode === 'orchestrated' && !task)
|
|
435
|
-
return failure(normalizedInput, mode, null, 'ORCHESTRATION_TASK_REQUIRED', 'orchestrated commit requires a task context', 'blocked');
|
|
436
425
|
try {
|
|
437
|
-
return executeCommitOperationCore(normalizedInput, task, mode);
|
|
426
|
+
return executeCommitOperationCore(normalizedInput, task, mode, writeOptions);
|
|
438
427
|
}
|
|
439
428
|
catch (error) {
|
|
440
429
|
const code = 'COMMIT_OPERATION_FAILED';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
import { canonicalSemanticDigest } from './artifact-operations.js';
|
|
3
|
-
import { inspectActivityLog, pairEntries } from './activity-log.js';
|
|
4
4
|
import { parseTypedTaskFrontmatter } from './frontmatter.js';
|
|
5
5
|
import { parseArtifactName } from './artifact-name.js';
|
|
6
6
|
import { sha256File } from './artifact-receipts.js';
|
|
@@ -23,56 +23,69 @@ export function parseCompletionFacts(value) {
|
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function completionEvent(family) {
|
|
27
|
+
if (family === 'validation-run')
|
|
28
|
+
return 'validation-run.completed';
|
|
29
|
+
if (family === 'analysis')
|
|
30
|
+
return 'analyze.completed';
|
|
31
|
+
if (family === 'review-analysis')
|
|
32
|
+
return 'review-analysis.completed';
|
|
33
|
+
if (family === 'plan')
|
|
34
|
+
return 'plan.completed';
|
|
35
|
+
if (family === 'review-plan')
|
|
36
|
+
return 'review-plan.completed';
|
|
37
|
+
if (family === 'code')
|
|
38
|
+
return 'code.completed';
|
|
39
|
+
if (family === 'review-code')
|
|
40
|
+
return 'review-code.completed';
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
/** Validates an artifact's own completion fact and output evidence. */
|
|
44
|
+
export function hasValidArtifactCompletion(taskContent, taskDir, artifact, event) {
|
|
27
45
|
try {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const content = fs.readFileSync(artifactPath, 'utf8');
|
|
31
|
-
const outputSha256 = sha256File(artifactPath);
|
|
32
|
-
const semanticDigest = canonicalSemanticDigest(content);
|
|
33
|
-
return parseCompletionFacts(frontmatter.completion_facts).some((fact) => fact.event === event && fact.output === output
|
|
34
|
-
&& fact.outputSha256 === outputSha256 && fact.semanticDigest === semanticDigest
|
|
35
|
-
&& fact.requestId.length > 0);
|
|
46
|
+
const fact = findCompletionFact(taskContent, artifact, event);
|
|
47
|
+
return Boolean(fact && validateOutput(taskDir, artifact, fact));
|
|
36
48
|
}
|
|
37
49
|
catch {
|
|
38
50
|
return false;
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
/** Distinguishes an invalidated completion fact from a round that has never completed. */
|
|
54
|
+
export function hasArtifactCompletionRecord(taskContent, artifact, event) {
|
|
55
|
+
try {
|
|
56
|
+
const raw = parseTypedTaskFrontmatter(taskContent).completion_facts;
|
|
57
|
+
if (raw === undefined)
|
|
58
|
+
return false;
|
|
59
|
+
if (typeof raw !== 'string')
|
|
60
|
+
return true;
|
|
61
|
+
if (raw.trim() === '')
|
|
62
|
+
return false;
|
|
63
|
+
const parsed = JSON.parse(raw);
|
|
64
|
+
if (!Array.isArray(parsed))
|
|
65
|
+
return true;
|
|
66
|
+
return parsed.some((fact) => fact && typeof fact === 'object' && !Array.isArray(fact)
|
|
67
|
+
&& fact.event === event
|
|
68
|
+
&& fact.output === artifact);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
43
73
|
}
|
|
44
|
-
|
|
45
|
-
export function artifactCompletionOrder(taskContent, artifact, event) {
|
|
74
|
+
function findCompletionFact(taskContent, artifact, event) {
|
|
46
75
|
const identity = parseArtifactName(artifact);
|
|
47
|
-
if (!identity)
|
|
76
|
+
if (!identity || completionEvent(identity.family) !== event)
|
|
48
77
|
return null;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
: family === 'code' ? 'Code Task' : 'Review Code';
|
|
62
|
-
const { section, invalidEntries } = inspectActivityLog(taskContent);
|
|
63
|
-
if (!section || invalidEntries.length > 0)
|
|
64
|
-
return null;
|
|
65
|
-
const ordered = section.entries.map((entry, sourceOrder) => ({ entry, sourceOrder }))
|
|
66
|
-
.sort((left, right) => Date.parse(left.entry.time.replace(' ', 'T')) - Date.parse(right.entry.time.replace(' ', 'T')) || left.sourceOrder - right.sourceOrder);
|
|
67
|
-
const entries = ordered.map(({ entry }) => entry);
|
|
68
|
-
const roundPattern = new RegExp(`^${action} \\(Round ${identity.round}(?:, [^)]+)?\\)$`);
|
|
69
|
-
const row = pairEntries(entries).find((candidate) => candidate.started !== ''
|
|
70
|
-
&& candidate.done !== '' && roundPattern.test(candidate.step)
|
|
71
|
-
&& candidate.note.includes(`→ ${artifact}`));
|
|
72
|
-
if (!row)
|
|
73
|
-
return null;
|
|
74
|
-
const doneIndex = ordered.findIndex(({ entry }) => entry.time === row.done
|
|
75
|
-
&& entry.step === row.step && entry.note === row.note);
|
|
76
|
-
return doneIndex < 0 ? null : doneIndex;
|
|
78
|
+
const fact = parseCompletionFacts(parseTypedTaskFrontmatter(taskContent).completion_facts)
|
|
79
|
+
.find((candidate) => candidate.event === event && candidate.output === artifact);
|
|
80
|
+
return fact && fact.requestId.length > 0 ? fact : null;
|
|
81
|
+
}
|
|
82
|
+
function validateOutput(taskDir, artifact, fact) {
|
|
83
|
+
const outputPath = path.join(taskDir, artifact);
|
|
84
|
+
const stat = fs.lstatSync(outputPath);
|
|
85
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
86
|
+
return false;
|
|
87
|
+
const content = fs.readFileSync(outputPath, 'utf8');
|
|
88
|
+
return sha256File(outputPath) === fact.outputSha256
|
|
89
|
+
&& canonicalSemanticDigest(content) === fact.semanticDigest;
|
|
77
90
|
}
|
|
78
91
|
//# sourceMappingURL=completion-facts.js.map
|