@fitlab-ai/agent-infra 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/README.zh-CN.md +0 -2
- package/dist/bin/internal-cli.js +2 -17
- package/dist/lib/agent-clients/adapter.js +0 -13
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +0 -5
- package/dist/lib/agent-clients/adapters/claude-code-credentials.js +0 -17
- package/dist/lib/agent-clients/adapters/claude-code.js +0 -9
- package/dist/lib/agent-clients/adapters/codex.js +0 -52
- package/dist/lib/agent-clients/adapters/opencode.js +0 -5
- package/dist/lib/agent-clients/adapters/traecli.js +0 -5
- package/dist/lib/agent-clients/config.js +19 -54
- package/dist/lib/agent-clients/registry.js +1 -12
- package/dist/lib/agent-clients/schema.js +0 -18
- package/dist/lib/agent-clients/tokens.js +1 -2
- package/dist/lib/agent-clients/types.js +0 -1
- package/dist/lib/decide.js +2 -0
- package/dist/lib/git/worktree-identity.js +1 -9
- package/dist/lib/internal/agent-client.js +2 -62
- package/dist/lib/internal/cli-route-inventory.js +1 -5
- package/dist/lib/internal/manual-validation.js +18 -10
- package/dist/lib/internal/task-create.js +1 -1
- package/dist/lib/internal/task-event.js +1 -8
- package/dist/lib/internal/task-finalization.js +0 -1
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-operation-registry.js +4 -20
- package/dist/lib/internal/task-review.js +4 -4
- package/dist/lib/platform/comment-safety.js +1 -7
- package/dist/lib/platform/in-label-sync.js +1 -14
- package/dist/lib/platform/issue-comments.js +1 -16
- package/dist/lib/platform/issues.js +1 -1
- package/dist/lib/platform/operation-coordinator.js +4 -2
- package/dist/lib/platform/pr-change-report.js +1 -4
- package/dist/lib/platform/pr-checks.js +2 -8
- package/dist/lib/platform/provider-validation.js +0 -20
- package/dist/lib/platform/pull-requests.js +73 -84
- package/dist/lib/platform/releases.js +1 -43
- package/dist/lib/platform/verification-required.js +0 -2
- package/dist/lib/platform/verification-sync.js +1 -79
- package/dist/lib/process-data/normalize.js +1 -185
- package/dist/lib/process-data/privacy.js +1 -16
- package/dist/lib/process-data/sources.js +2 -279
- package/dist/lib/render.js +0 -12
- package/dist/lib/run/index.js +15 -10
- package/dist/lib/run/skills.js +0 -3
- package/dist/lib/sandbox/commands/create.js +40 -53
- package/dist/lib/sandbox/commands/list-running.js +0 -18
- package/dist/lib/sandbox/commands/start.js +7 -8
- package/dist/lib/sandbox/constants.js +0 -6
- package/dist/lib/sandbox/control/client.js +0 -1
- package/dist/lib/sandbox/control/container-identity.js +1 -16
- package/dist/lib/sandbox/control/executor.js +0 -4
- package/dist/lib/sandbox/control/identity-sentinel.js +0 -7
- package/dist/lib/sandbox/control/lifecycle.js +21 -37
- package/dist/lib/sandbox/control/native-file-lock.js +0 -3
- package/dist/lib/sandbox/control/server.js +18 -38
- package/dist/lib/sandbox/control/state.js +1 -9
- package/dist/lib/sandbox/dockerfile.js +0 -6
- package/dist/lib/sandbox/engine.js +0 -14
- package/dist/lib/sandbox/engines/docker-exact-discovery.js +1 -4
- package/dist/lib/sandbox/engines/wsl2-paths.js +0 -3
- package/dist/lib/sandbox/recovery.js +24 -26
- package/dist/lib/sandbox/removal.js +11 -519
- package/dist/lib/sandbox/task-resolver.js +0 -41
- package/dist/lib/sandbox/tools.js +1 -4
- package/dist/lib/sandbox/workspace-view.js +1 -2
- package/dist/lib/server/display.js +0 -6
- package/dist/lib/task/activity-intent.js +45 -40
- package/dist/lib/task/activity-log.js +9 -16
- package/dist/lib/task/artifact-command.js +1 -1
- package/dist/lib/task/artifact-lifecycle.js +61 -63
- package/dist/lib/task/artifact-name.js +0 -6
- package/dist/lib/task/artifact-operations.js +3 -3
- package/dist/lib/task/capabilities.js +4 -5
- package/dist/lib/task/commands/log.js +0 -6
- package/dist/lib/task/commands/status.js +17 -60
- package/dist/lib/task/commit-operation.js +28 -39
- package/dist/lib/task/completion-facts.js +56 -43
- package/dist/lib/task/control-authority.js +23 -256
- package/dist/lib/task/control-recovery.js +3 -5
- package/dist/lib/task/create.js +2 -4
- package/dist/lib/task/decision-intents.js +8 -9
- package/dist/lib/task/delivery-target.js +1 -40
- package/dist/lib/task/events.js +84 -107
- package/dist/lib/task/finalization.js +44 -8
- package/dist/lib/task/ledger-intents.js +1 -1
- package/dist/lib/task/lifecycle-execution.js +38 -33
- package/dist/lib/task/lifecycle.js +49 -41
- package/dist/lib/task/local-artifact-finalization.js +1 -4
- package/dist/lib/task/manual-validation-evidence.js +1 -37
- package/dist/lib/task/platform-operation-recovery.js +67 -24
- package/dist/lib/task/pr-delivery-fact.js +2 -5
- package/dist/lib/task/qualification-confirmation.js +5 -7
- package/dist/lib/task/resolve-ref.js +1 -25
- package/dist/lib/task/review-command.js +2 -2
- package/dist/lib/task/review-finalization.js +1 -21
- package/dist/lib/task/review-fingerprint.js +0 -4
- package/dist/lib/task/secure-fs.js +0 -56
- package/dist/lib/task/short-id.js +1 -39
- package/dist/lib/task/skill-scope.js +0 -1
- package/dist/lib/task/verification-engine.js +58 -282
- package/dist/lib/task/verification.js +6 -3
- package/dist/lib/task/write.js +11 -1
- package/lib/agent-clients/adapter.ts +0 -76
- package/lib/agent-clients/adapters/antigravity-cli.ts +0 -5
- package/lib/agent-clients/adapters/claude-code-credentials.ts +0 -19
- package/lib/agent-clients/adapters/claude-code.ts +0 -9
- package/lib/agent-clients/adapters/codex.ts +0 -56
- package/lib/agent-clients/adapters/opencode.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +0 -5
- package/lib/agent-clients/config.ts +20 -61
- package/lib/agent-clients/registry.ts +1 -34
- package/lib/agent-clients/schema.ts +0 -18
- package/lib/agent-clients/tokens.ts +1 -2
- package/lib/agent-clients/types.ts +0 -15
- package/lib/decide.ts +1 -0
- package/lib/git/worktree-identity.ts +0 -10
- package/lib/internal/agent-client.ts +2 -70
- package/lib/internal/cli-route-inventory.ts +1 -4
- package/lib/internal/manual-validation.ts +16 -9
- package/lib/internal/task-create.ts +0 -1
- package/lib/internal/task-event.ts +1 -5
- package/lib/internal/task-finalization.ts +0 -1
- package/lib/internal/task-lifecycle.ts +3 -5
- package/lib/internal/task-operation-registry.ts +3 -19
- package/lib/internal/task-review.ts +4 -4
- package/lib/platform/comment-safety.ts +0 -10
- package/lib/platform/github-provider.ts +0 -2
- package/lib/platform/in-label-sync.ts +0 -16
- package/lib/platform/issue-comments.ts +0 -21
- package/lib/platform/issues.ts +0 -2
- package/lib/platform/operation-coordinator.ts +4 -2
- package/lib/platform/pr-change-report.ts +0 -5
- package/lib/platform/pr-checks.ts +1 -10
- package/lib/platform/pr-review.ts +1 -1
- package/lib/platform/provider-bridge.ts +0 -1
- package/lib/platform/provider-loader.ts +1 -5
- package/lib/platform/provider-validation.ts +1 -49
- package/lib/platform/pull-requests.ts +64 -99
- package/lib/platform/releases.ts +1 -40
- package/lib/platform/verification-required.ts +0 -2
- package/lib/platform/verification-sync.ts +0 -94
- package/lib/process-data/normalize.ts +1 -186
- package/lib/process-data/privacy.ts +2 -19
- package/lib/process-data/sources.ts +3 -283
- package/lib/render.ts +0 -15
- package/lib/run/index.ts +13 -7
- package/lib/run/skills.ts +0 -4
- package/lib/sandbox/commands/create.ts +37 -74
- package/lib/sandbox/commands/list-running.ts +0 -19
- package/lib/sandbox/commands/start.ts +7 -10
- package/lib/sandbox/constants.ts +0 -8
- package/lib/sandbox/control/client.ts +0 -1
- package/lib/sandbox/control/container-identity.ts +1 -16
- package/lib/sandbox/control/executor.ts +1 -5
- package/lib/sandbox/control/identity-sentinel.ts +0 -8
- package/lib/sandbox/control/lifecycle.ts +18 -51
- package/lib/sandbox/control/native-file-lock.ts +0 -8
- package/lib/sandbox/control/protocol.ts +0 -2
- package/lib/sandbox/control/server.ts +13 -39
- package/lib/sandbox/control/state.ts +1 -10
- package/lib/sandbox/dockerfile.ts +0 -11
- package/lib/sandbox/engine.ts +0 -17
- package/lib/sandbox/engines/docker-exact-discovery.ts +1 -5
- package/lib/sandbox/engines/wsl2-paths.ts +0 -4
- package/lib/sandbox/recovery.ts +24 -26
- package/lib/sandbox/removal.ts +11 -696
- package/lib/sandbox/shell.ts +1 -1
- package/lib/sandbox/task-resolver.ts +0 -48
- package/lib/sandbox/tools.ts +1 -5
- package/lib/sandbox/workspace-view.ts +2 -4
- package/lib/server/display.ts +0 -14
- package/lib/server/process-control.ts +1 -1
- package/lib/task/activity-intent.ts +36 -44
- package/lib/task/activity-log.ts +9 -22
- package/lib/task/artifact-command.ts +1 -1
- package/lib/task/artifact-lifecycle.ts +58 -67
- package/lib/task/artifact-name.ts +0 -7
- package/lib/task/artifact-operations.ts +3 -3
- package/lib/task/capabilities.ts +5 -6
- package/lib/task/commands/log.ts +0 -7
- package/lib/task/commands/status.ts +14 -79
- package/lib/task/commit-operation.ts +29 -51
- package/lib/task/completion-facts.ts +45 -42
- package/lib/task/control-authority.ts +27 -317
- package/lib/task/control-recovery.ts +2 -5
- package/lib/task/create.ts +2 -5
- package/lib/task/decision-intents.ts +5 -5
- package/lib/task/delivery-target.ts +0 -40
- package/lib/task/events.ts +89 -123
- package/lib/task/finalization.ts +41 -9
- package/lib/task/ledger-intents.ts +1 -1
- package/lib/task/lifecycle-execution.ts +37 -89
- package/lib/task/lifecycle.ts +48 -44
- package/lib/task/local-artifact-finalization.ts +0 -7
- package/lib/task/manual-validation-evidence.ts +1 -47
- package/lib/task/platform-operation-recovery.ts +50 -26
- package/lib/task/pr-delivery-fact.ts +2 -11
- package/lib/task/qualification-confirmation.ts +6 -6
- package/lib/task/resolve-ref.ts +0 -23
- package/lib/task/review-command.ts +2 -2
- package/lib/task/review-finalization.ts +1 -27
- package/lib/task/review-fingerprint.ts +0 -8
- package/lib/task/secure-fs.ts +0 -42
- package/lib/task/short-id.ts +0 -43
- package/lib/task/skill-scope.ts +0 -1
- package/lib/task/verification-engine.ts +56 -287
- package/lib/task/verification.ts +5 -5
- package/lib/task/write.ts +12 -1
- package/package.json +2 -2
- package/templates/.agents/README.en.md +1 -3
- package/templates/.agents/README.zh-CN.md +0 -2
- package/templates/.agents/rules/README.en.md +0 -1
- package/templates/.agents/rules/README.zh-CN.md +0 -1
- package/templates/.agents/rules/commit-and-pr.en.md +1 -1
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.en.md +0 -10
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +0 -10
- package/templates/.agents/rules/pr-sync.en.md +1 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
- package/templates/.agents/rules/task-management.en.md +3 -3
- package/templates/.agents/rules/task-management.zh-CN.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/commit/SKILL.en.md +2 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +6 -6
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +6 -6
- package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -75
- package/templates/.agents/templates/task.en.md +1 -0
- package/templates/.agents/templates/task.zh-CN.md +1 -0
- package/templates/.claude/settings.json +0 -24
- package/templates/.codex/hooks.json +0 -50
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +0 -582
- package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +0 -114
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +0 -237
- package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +0 -443
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +0 -236
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +0 -292
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +0 -267
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +0 -466
- package/dist/lib/internal/task-orchestration.js +0 -71
- package/dist/lib/platform/verification.js +0 -6
- package/dist/lib/run/prompt.js +0 -2
- package/dist/lib/sandbox/engines/authority.js +0 -289
- package/dist/lib/task/delegation-receipts.js +0 -410
- package/dist/lib/task/orchestration.js +0 -1233
- package/dist/lib/task/verification-checks.js +0 -9
- package/dist/lib/task/workspace-snapshot.js +0 -121
- package/dist/lifecycle-build-manifest.json +0 -6
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +0 -688
- package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +0 -147
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +0 -349
- package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +0 -506
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +0 -385
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +0 -41
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +0 -418
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +0 -354
- package/lib/agent-clients/adapters/codex-orchestration.ts +0 -630
- package/lib/internal/task-orchestration.ts +0 -74
- package/lib/platform/verification.ts +0 -11
- package/lib/run/prompt.ts +0 -1
- package/lib/sandbox/engines/authority.ts +0 -365
- package/lib/task/delegation-receipts.ts +0 -547
- package/lib/task/orchestration.ts +0 -1651
- package/lib/task/verification-checks.ts +0 -10
- package/lib/task/workspace-snapshot.ts +0 -144
- package/templates/.agents/hooks/lifecycle-delegation.js +0 -140
- package/templates/.agents/rules/lifecycle-orchestration.en.md +0 -44
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +0 -44
- package/templates/.agents/skills/run-task/SKILL.en.md +0 -29
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +0 -29
- package/templates/.agents/skills/run-task/config/verify.en.json +0 -10
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +0 -10
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +0 -24
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +0 -24
- package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +0 -6
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +0 -6
- package/templates/.claude/commands/run-task.en.md +0 -8
- package/templates/.claude/commands/run-task.zh-CN.md +0 -8
- package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +0 -3
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +0 -3
- package/templates/.opencode/commands/run-task.en.md +0 -11
- package/templates/.opencode/commands/run-task.zh-CN.md +0 -11
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { activityWarnings } from '../task/activity-log.ts';
|
|
5
|
+
import { lifecycleExecutions } from '../task/lifecycle-execution.ts';
|
|
5
6
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
6
7
|
import { prepareAndRenderPrSummaryContent } from '../platform/pr-summary.ts';
|
|
7
8
|
import { applyTaskEvent } from '../task/events.ts';
|
|
@@ -58,15 +59,13 @@ function openManualValidationStarted(taskMdPath: string): { present: boolean; tr
|
|
|
58
59
|
let content: string;
|
|
59
60
|
try { content = fs.readFileSync(taskMdPath, 'utf8'); }
|
|
60
61
|
catch { return { present: false, transactionId: null }; }
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const row = pairEntries(section.entries)
|
|
64
|
-
.filter((item) => item.step === 'Complete Manual Validation' && item.started && !item.done)
|
|
62
|
+
const row = lifecycleExecutions(content)
|
|
63
|
+
.filter((item) => item.family === 'manual-validation')
|
|
65
64
|
.at(-1);
|
|
66
65
|
if (!row) return { present: false, transactionId: null };
|
|
67
66
|
return {
|
|
68
67
|
present: true,
|
|
69
|
-
transactionId:
|
|
68
|
+
transactionId: row.transactionId ?? null
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -120,7 +119,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
120
119
|
transactionResult = { ok: false, error: { code: 'MANUAL_VALIDATION_TRANSACTION_MISSING', message: 'previous failed transaction was archived for a new pull-request head' } };
|
|
121
120
|
}
|
|
122
121
|
if (!transactionResult.ok && transactionResult.error.code !== 'MANUAL_VALIDATION_TRANSACTION_MISSING') return result('failed', transactionResult.error);
|
|
123
|
-
if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true });
|
|
122
|
+
if (transactionResult.ok && transactionResult.value.phase === 'committed') return result('applied', null, { transaction: transactionResult.value, receipt: transactionResult.value.committedReceipt, idempotent: true, warnings: activityWarnings(taskContent) });
|
|
124
123
|
const openStarted = transactionResult.ok ? { present: false, transactionId: null } : openManualValidationStarted(resolved.taskMdPath);
|
|
125
124
|
if (openStarted.present && !openStarted.transactionId) {
|
|
126
125
|
return result('failed', { code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'open manual-validation started event has no recoverable transactionId' });
|
|
@@ -148,11 +147,16 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
148
147
|
});
|
|
149
148
|
let transaction: ManualValidationTransaction;
|
|
150
149
|
const idempotent = transactionResult.ok;
|
|
150
|
+
const warnings: { code: string; message: string }[] = [];
|
|
151
|
+
const currentWarnings = () => warnings.length
|
|
152
|
+
? warnings.filter((warning, index) => warnings.findIndex((item) => item.code === warning.code && item.message === warning.message) === index)
|
|
153
|
+
: activityWarnings(taskContent);
|
|
151
154
|
let startedEventApplied = false;
|
|
152
155
|
if (!transactionResult.ok) {
|
|
153
156
|
transaction = createTransaction();
|
|
154
157
|
const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transactionId, reasonCode: 'user-request', transactionId }, { repoRoot: cwd });
|
|
155
158
|
if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
|
|
159
|
+
warnings.push(...(started.warnings ?? []));
|
|
156
160
|
startedEventApplied = true;
|
|
157
161
|
if (previousTransaction) {
|
|
158
162
|
try { archiveGeneration(resolved.taskDir, previousTransaction, previousTransaction.phase === 'committed'); }
|
|
@@ -171,8 +175,9 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
171
175
|
if (transaction.phase === 'prepared' && !startedEventApplied) {
|
|
172
176
|
const started = applyTaskEvent({ taskRef, event: 'manual-validation.started', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', transactionId: transaction.transactionId }, { repoRoot: cwd });
|
|
173
177
|
if (started.status === 'failed') return result('failed', started.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation started event failed' });
|
|
178
|
+
warnings.push(...(started.warnings ?? []));
|
|
174
179
|
}
|
|
175
|
-
if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent });
|
|
180
|
+
if (prepareOnly) return result('applied', null, { transaction, prepared: true, idempotent, warnings: currentWarnings() });
|
|
176
181
|
const transactionFailure = (failure: { code: string; message: string }): never => {
|
|
177
182
|
throw new Error(`${failure.code}: ${failure.message}`);
|
|
178
183
|
};
|
|
@@ -227,6 +232,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
227
232
|
if (transaction.phase === 'receipt-committed' && !transaction.eventAppended) {
|
|
228
233
|
const completed = applyTaskEvent({ taskRef, event: 'manual-validation.completed', agent, initiator: 'model', requestId: transaction.transactionId, reasonCode: 'user-request', artifact: values.artifact, summaryResult: 'human-confirmed validation and committed receipt', transactionId: transaction.transactionId, receiptDigest: receipt.receiptDigest, prHeadSha: receipt.prHeadSha }, { repoRoot: cwd });
|
|
229
234
|
if (completed.status === 'failed') transactionFailure(completed.error ?? { code: 'MANUAL_VALIDATION_TRANSACTION_FAILED', message: 'manual-validation completion event failed' });
|
|
235
|
+
warnings.push(...(completed.warnings ?? []));
|
|
230
236
|
transitionAndPersist('receipt-committed', { eventAppended: true });
|
|
231
237
|
}
|
|
232
238
|
if (transaction.phase === 'receipt-committed') {
|
|
@@ -240,7 +246,7 @@ async function executeManualValidationTransactionAtResolvedTask(
|
|
|
240
246
|
const postWrite = await summaryCommentState(taskRef, { cwd, client: options.client });
|
|
241
247
|
if (!/^###\s+✅\s+(?:Manual Validation Passed|人工验证已通过)\s*$/mu.test(postWrite.comment?.body ?? '') || postWrite.pullRequest?.head.sha !== receipt.prHeadSha || !manualValidationFinalSummaryProjectionMatches(postWrite.comment?.body ?? '', receipt)) transactionFailure({ code: 'MANUAL_VALIDATION_TRANSACTION_RECOVERY_REQUIRED', message: 'final summary post-write verification failed' });
|
|
242
248
|
transitionAndPersist('committed', { postWriteVerified: true });
|
|
243
|
-
return result('applied', null, { transaction, receipt, idempotent: false });
|
|
249
|
+
return result('applied', null, { transaction, receipt, idempotent: false, warnings: currentWarnings() });
|
|
244
250
|
} catch (error) {
|
|
245
251
|
const message = error instanceof Error ? error.message : String(error);
|
|
246
252
|
if (transaction.phase === 'final-promotion-in-progress') {
|
|
@@ -292,6 +298,7 @@ async function manualValidation(args: string[] = []): Promise<void> {
|
|
|
292
298
|
const format = values.format === 'text' ? 'text' : 'json';
|
|
293
299
|
const output = await executeManualValidationTransaction(taskRef, values, path.resolve(values.cwd ?? process.cwd()));
|
|
294
300
|
process.stdout.write(format === 'json' ? `${JSON.stringify(output)}\n` : `${output.status === 'applied' ? 'Manual validation transaction committed.' : `${output.error?.code}: ${output.error?.message}`}\n`);
|
|
301
|
+
if (format === 'text' && Array.isArray(output.warnings)) for (const warning of output.warnings) process.stderr.write(`${warning.code}: ${warning.message}\n`);
|
|
295
302
|
if (output.status === 'failed') process.exitCode = 1;
|
|
296
303
|
}
|
|
297
304
|
|
|
@@ -4,7 +4,7 @@ import type { TaskEventRequest, Verdict } from '../task/events.ts';
|
|
|
4
4
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
5
5
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
6
6
|
|
|
7
|
-
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--
|
|
7
|
+
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--dry-run]
|
|
8
8
|
|
|
9
9
|
Apply one closed-set task lifecycle event and print a structured JSON result.
|
|
10
10
|
Events: ${eventCatalog.join(', ')}
|
|
@@ -35,10 +35,6 @@ export function parseTaskEventRequest(args: readonly string[]): TaskEventRequest
|
|
|
35
35
|
const seen = new Set<string>();
|
|
36
36
|
for (let index = 2; index < args.length; index += 1) {
|
|
37
37
|
const flag = args[index]!;
|
|
38
|
-
if (flag === '--orchestrated') {
|
|
39
|
-
if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
|
|
40
|
-
seen.add(flag); request.orchestrated = true; continue;
|
|
41
|
-
}
|
|
42
38
|
if (flag === '--dry-run') {
|
|
43
39
|
if (seen.has(flag)) throw new Error(`duplicate option '${flag}'`);
|
|
44
40
|
seen.add(flag); request.dryRun = true; continue;
|
|
@@ -6,12 +6,10 @@ import {
|
|
|
6
6
|
} from '../task/control-authority.ts';
|
|
7
7
|
import { lifecycleIntentCatalog } from '../task/lifecycle.ts';
|
|
8
8
|
import { detectRepoRoot, resolveTaskRef } from '../task/resolve-ref.ts';
|
|
9
|
-
import type { TaskLifecycleResult } from '../task/lifecycle.ts';
|
|
10
|
-
import type { AgentClientLifecycleRecoveryResult as LifecycleRecoveryResult } from '../agent-clients/adapter.ts';
|
|
11
9
|
import { ensureInternalHandlerRoute, internalHandlerRoute } from './cli-route-inventory.ts';
|
|
12
10
|
import { loadSandboxControlLocation } from '../sandbox/config.ts';
|
|
13
11
|
|
|
14
|
-
const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\
|
|
12
|
+
const USAGE = `Usage: agent-infra-internal task-lifecycle <N | TASK-id> <intent> --agent <agent> [intent flags] [--dry-run]\n\nIntents: ${lifecycleIntentCatalog.filter((intent) => intent !== 'complete').join(', ')}\n`;
|
|
15
13
|
|
|
16
14
|
function usageFailure(message: string): void {
|
|
17
15
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'LIFECYCLE_PAYLOAD_INVALID', message } })}\n`);
|
|
@@ -64,9 +62,9 @@ async function taskLifecycle(args: string[] = []): Promise<void> {
|
|
|
64
62
|
const result = await dispatchTaskControlOperation(
|
|
65
63
|
createDirectHostExecutionContext({ repoRoot, ...(controlLocation ?? {}) }),
|
|
66
64
|
operation
|
|
67
|
-
)
|
|
65
|
+
);
|
|
68
66
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
69
|
-
if (result.status === 'failed'
|
|
67
|
+
if (result.status === 'failed') process.exitCode = 1;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
export { taskLifecycle };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
accessSandboxTaskView,
|
|
6
|
-
parseSandboxTaskView,
|
|
7
5
|
taskViewFromStatus,
|
|
8
6
|
type SandboxTaskView,
|
|
9
7
|
type TaskViewAccessEffect
|
|
@@ -14,7 +12,7 @@ import {
|
|
|
14
12
|
PUBLIC_CLI_SELECTOR_ALIASES,
|
|
15
13
|
internalRouteSelector
|
|
16
14
|
} from './cli-route-inventory.ts';
|
|
17
|
-
import { hasSandboxControlMarker,
|
|
15
|
+
import { hasSandboxControlMarker, sandboxTaskMarkerState } from '../sandbox/environment.ts';
|
|
18
16
|
export { resolveSandboxControlTransport } from '../sandbox/environment.ts';
|
|
19
17
|
|
|
20
18
|
export type TaskOperationDispatcher = 'public' | 'internal';
|
|
@@ -54,12 +52,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
|
|
|
54
52
|
descriptor('internal', 'sandbox-control', 'client', 'conditional', 'progress', 'delegated'),
|
|
55
53
|
descriptor('internal', 'agent-client', 'next-steps', 'non-task', 'diagnostic', 'none'),
|
|
56
54
|
descriptor('internal', 'agent-client', 'model-selection', 'non-task', 'diagnostic', 'none'),
|
|
57
|
-
descriptor('internal', 'agent-client', 'launch-carrier', 'non-task', 'diagnostic', 'none'),
|
|
58
|
-
descriptor('internal', 'codex-lifecycle', 'preflight', 'non-task', 'diagnostic', 'none'),
|
|
59
|
-
descriptor('internal', 'codex-lifecycle', 'hook-event', 'conditional', 'progress'),
|
|
60
|
-
descriptor('internal', 'codex-lifecycle', 'resolve-start', 'conditional', 'progress'),
|
|
61
|
-
descriptor('internal', 'codex-lifecycle', 'resolve-stop', 'conditional', 'progress'),
|
|
62
|
-
descriptor('internal', 'codex-lifecycle', 'consume', 'conditional', 'progress'),
|
|
63
55
|
descriptor('internal', 'git-workflow', 'inspect', 'conditional', 'diagnostic'),
|
|
64
56
|
descriptor('internal', 'git-workflow', 'preview-tree', 'conditional', 'diagnostic'),
|
|
65
57
|
descriptor('internal', 'git-workflow', 'snapshot', 'conditional', 'diagnostic'),
|
|
@@ -132,8 +124,6 @@ function internalTaskRoutes(): TaskOperationDescriptor[] {
|
|
|
132
124
|
descriptor('internal', 'task-artifact', 'init', 'task-bound', 'artifact-write'),
|
|
133
125
|
descriptor('internal', 'task-artifact', 'preflight', 'task-bound', 'artifact-write'),
|
|
134
126
|
descriptor('internal', 'task-artifact', 'finalize-local', 'task-bound', 'artifact-write'),
|
|
135
|
-
descriptor('internal', 'task-orchestration', 'status', 'task-bound', 'diagnostic'),
|
|
136
|
-
descriptor('internal', 'task-orchestration', 'progress', 'task-bound', 'progress'),
|
|
137
127
|
descriptor('internal', 'task-review', 'preflight', 'task-bound', 'artifact-write'),
|
|
138
128
|
descriptor('internal', 'task-review', 'finalize-summary', 'task-bound', 'progress'),
|
|
139
129
|
descriptor('internal', 'task-event', 'event', 'task-bound', 'progress'),
|
|
@@ -212,11 +202,11 @@ export const TASK_OPERATION_DESCRIPTORS = Object.freeze([
|
|
|
212
202
|
]);
|
|
213
203
|
|
|
214
204
|
export const INTERNAL_DISPATCHER_ROUTES = Object.freeze([
|
|
215
|
-
'task-create', 'task-qualification', 'sandbox-control', 'agent-client',
|
|
205
|
+
'task-create', 'task-qualification', 'sandbox-control', 'agent-client',
|
|
216
206
|
'git-workflow', 'task-delivery', 'release-workflow', 'platform-release-notes', 'platform-security', 'platform-metadata', 'platform-context',
|
|
217
207
|
'platform-comment', 'platform-issue', 'platform-pr', 'platform-pr-review', 'pr-review-grade',
|
|
218
208
|
'platform-checks', 'task-context', 'task-workspace', 'task-ledger', 'task-warning', 'task-activity', 'task-artifact',
|
|
219
|
-
'task-
|
|
209
|
+
'task-review', 'task-event', 'task-lifecycle',
|
|
220
210
|
'task-finalization', 'task-platform-recovery', 'task-short-id', 'task-snapshot', 'task-verify', 'task-validate', 'manual-validation'
|
|
221
211
|
]);
|
|
222
212
|
export const PUBLIC_DISPATCHER_ROUTES = Object.freeze([
|
|
@@ -271,7 +261,6 @@ export function resolveTaskOperation(
|
|
|
271
261
|
export function resolveDelegatedTaskOperation(args: readonly string[]): TaskOperationDescriptor | null {
|
|
272
262
|
const [operation, ...rest] = args;
|
|
273
263
|
if (operation !== 'client' || !rest[0]) return null;
|
|
274
|
-
if (rest[0] === 'task-orchestration') return null;
|
|
275
264
|
return resolveTaskOperation('internal', rest[0], rest.slice(1));
|
|
276
265
|
}
|
|
277
266
|
|
|
@@ -298,7 +287,6 @@ function explicitTaskRefForOperation(
|
|
|
298
287
|
}
|
|
299
288
|
return command === 'merge' ? null : first(args) || null;
|
|
300
289
|
}
|
|
301
|
-
if (command === 'codex-lifecycle') return optionValue(args, '--task-id') ?? null;
|
|
302
290
|
if (command === 'platform-comment' || command === 'platform-issue') {
|
|
303
291
|
return first(args) === 'list' ? null : args[1] ?? null;
|
|
304
292
|
}
|
|
@@ -449,7 +437,3 @@ export function guardTaskOperation(
|
|
|
449
437
|
}
|
|
450
438
|
return { descriptor: selected, taskView };
|
|
451
439
|
}
|
|
452
|
-
|
|
453
|
-
export function assertTaskViewStatus(value: unknown): SandboxTaskView {
|
|
454
|
-
return parseSandboxTaskView(value);
|
|
455
|
-
}
|
|
@@ -3,7 +3,7 @@ import { finalizeReviewSummary, preflightReviewSummary } from '../task/review-fi
|
|
|
3
3
|
import { resolveTaskRef } from '../task/resolve-ref.ts';
|
|
4
4
|
import { ensureInternalHandlerRoute } from './cli-route-inventory.ts';
|
|
5
5
|
|
|
6
|
-
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--
|
|
6
|
+
const USAGE = 'Usage: agent-infra-internal task-review <task-ref> <preflight|finalize-summary> --stage <analysis|plan|code> --artifact <review-*.md> [--dry-run]\n';
|
|
7
7
|
|
|
8
8
|
function failUsage(message: string): void {
|
|
9
9
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -25,13 +25,13 @@ async function taskReview(args: string[] = []): Promise<void> {
|
|
|
25
25
|
let request;
|
|
26
26
|
try { request = parseReviewCommand(args); }
|
|
27
27
|
catch (error) { failUsage(error instanceof Error ? error.message : String(error)); return; }
|
|
28
|
-
const { stage, artifact, dryRun
|
|
28
|
+
const { stage, artifact, dryRun } = request;
|
|
29
29
|
const operation = args[1]!;
|
|
30
30
|
const resolved = resolveTaskRef(args[0]!);
|
|
31
31
|
if (!resolved.ok) { failUsage(resolved.message); return; }
|
|
32
32
|
const result = operation === 'preflight'
|
|
33
|
-
? preflightReviewSummary({ taskRef: args[0]!, stage, artifact,
|
|
34
|
-
: finalizeReviewSummary({ taskRef: args[0]!, stage, artifact,
|
|
33
|
+
? preflightReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun })
|
|
34
|
+
: finalizeReviewSummary({ taskRef: args[0]!, stage, artifact, dryRun });
|
|
35
35
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
36
36
|
if (result.status === 'failed') process.exitCode = 1;
|
|
37
37
|
}
|
|
@@ -94,14 +94,6 @@ function escapeHtmlText(value: string): string {
|
|
|
94
94
|
return escapeHtml(value);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function escapeHtmlAttribute(value: string): string {
|
|
98
|
-
return escapeHtml(value);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function escapeMarkdownLiteral(value: string): string {
|
|
102
|
-
return value.replace(/[\\`*_{}\[\]()#+.!|<>-]/g, '\\$&');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
97
|
function markerSafe(value: string, markers: readonly RegExp[]): string {
|
|
106
98
|
let result = value;
|
|
107
99
|
for (const marker of markers) {
|
|
@@ -250,9 +242,7 @@ function splitDocumentPlaceholder(value: string, placeholder: string): Sanitizat
|
|
|
250
242
|
|
|
251
243
|
export {
|
|
252
244
|
CONTROL_MARKER_PATTERN,
|
|
253
|
-
escapeHtmlAttribute,
|
|
254
245
|
escapeHtmlText,
|
|
255
|
-
escapeMarkdownLiteral,
|
|
256
246
|
fenceRanges,
|
|
257
247
|
renderSafeCodeFence,
|
|
258
248
|
canonicalizeCommentBody,
|
|
@@ -15,7 +15,6 @@ import type {
|
|
|
15
15
|
ChangeRequestSnapshot,
|
|
16
16
|
CheckLogSnapshot,
|
|
17
17
|
CheckRunSnapshot,
|
|
18
|
-
GitEvidenceSnapshot,
|
|
19
18
|
IssueSnapshot,
|
|
20
19
|
LabelReconciliation,
|
|
21
20
|
MutationReceipt,
|
|
@@ -32,7 +31,6 @@ import type {
|
|
|
32
31
|
ReleaseSnapshot,
|
|
33
32
|
RemoteCommentSnapshot,
|
|
34
33
|
ReviewSnapshot,
|
|
35
|
-
SecurityAlertKind,
|
|
36
34
|
SecurityAlertSnapshot,
|
|
37
35
|
VerificationRemoteFacts
|
|
38
36
|
} from './provider-contract.ts';
|
|
@@ -182,16 +182,6 @@ function flattenPages(value: unknown): unknown[] {
|
|
|
182
182
|
return value.flatMap((page) => Array.isArray(page) ? page : [page]);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
function extractRepositoryLabelNames(value: unknown): string[] {
|
|
186
|
-
return flattenPages(value).flatMap((entry) => {
|
|
187
|
-
if (typeof entry === 'string') return [entry];
|
|
188
|
-
if (entry && typeof entry === 'object' && typeof (entry as { name?: unknown }).name === 'string') {
|
|
189
|
-
return [(entry as { name: string }).name];
|
|
190
|
-
}
|
|
191
|
-
return [];
|
|
192
|
-
}).filter(Boolean).sort();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
185
|
function extractPullRequestFileNames(value: unknown): string[] | null {
|
|
196
186
|
const entries = flattenPages(value);
|
|
197
187
|
if (!Array.isArray(value) || entries.some((entry) => !entry || typeof entry !== 'object')) return null;
|
|
@@ -200,20 +190,14 @@ function extractPullRequestFileNames(value: unknown): string[] | null {
|
|
|
200
190
|
return [...new Set(names as string[])].sort();
|
|
201
191
|
}
|
|
202
192
|
|
|
203
|
-
function resourceSnapshot(kind: InLabelResource['kind'], number: number, labels: readonly string[]): InLabelResource {
|
|
204
|
-
return { kind, number, labels: [...labels].sort() };
|
|
205
|
-
}
|
|
206
|
-
|
|
207
193
|
export {
|
|
208
194
|
extractPullRequestFileNames,
|
|
209
|
-
extractRepositoryLabelNames,
|
|
210
195
|
flattenPages,
|
|
211
196
|
inLabels,
|
|
212
197
|
inLabelMappingDigest,
|
|
213
198
|
labelDelta,
|
|
214
199
|
mergeInLabels,
|
|
215
200
|
planInLabelUpdate,
|
|
216
|
-
resourceSnapshot,
|
|
217
201
|
syncLabelDelta,
|
|
218
202
|
validateInLabelMapping,
|
|
219
203
|
validateRepositoryLabelPayload
|
|
@@ -178,10 +178,6 @@ function renderTaskComment(content: string, taskId: string, _agent: string, lang
|
|
|
178
178
|
return renderTaskCommentResult(content, taskId, language).body;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
function isTaskCommentTooLarge(content: string, taskId = 'TASK-UNKNOWN', _agent = 'codex'): boolean {
|
|
182
|
-
return renderTaskCommentResult(content, taskId).byteLength > COMMENT_BYTE_LIMIT;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
181
|
function taskCommentLanguage(repoRoot: string): string {
|
|
186
182
|
try {
|
|
187
183
|
const config = JSON.parse(fs.readFileSync(path.join(repoRoot, '.agents', '.airc.json'), 'utf8')) as { language?: unknown };
|
|
@@ -409,21 +405,6 @@ function findMarkerComments(comments: RemoteComment[], marker: string): RemoteCo
|
|
|
409
405
|
return comments.filter((comment) => normalizeCommentContent(String(comment.body || '')).split('\n', 1)[0] === marker);
|
|
410
406
|
}
|
|
411
407
|
|
|
412
|
-
function flattenComments(value: unknown): RemoteComment[] {
|
|
413
|
-
if (!Array.isArray(value)) return [];
|
|
414
|
-
const flattened = value.flatMap((entry) => Array.isArray(entry) ? entry : [entry]);
|
|
415
|
-
return flattened.filter((entry): entry is RemoteComment =>
|
|
416
|
-
Boolean(entry && typeof entry === 'object' && (typeof entry.id === 'number' || typeof entry.id === 'string') && typeof entry.body === 'string')
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function listRemoteComments(client: PlatformClient, repo: string, issue: number, cwd: string) {
|
|
421
|
-
const result = client.json<unknown>([
|
|
422
|
-
'api', '--paginate', '--slurp', `repos/${repo}/issues/${issue}/comments?per_page=100`
|
|
423
|
-
], { cwd });
|
|
424
|
-
return result.ok ? { ok: true as const, value: flattenComments(result.value) } : result;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
408
|
function contextFields(context: PlatformResult): Partial<PlatformResult> {
|
|
428
409
|
return {
|
|
429
410
|
platform: context.platform,
|
|
@@ -1060,14 +1041,12 @@ export {
|
|
|
1060
1041
|
chunkArtifactComment,
|
|
1061
1042
|
inspectPlatformCommentOperation,
|
|
1062
1043
|
findMarkerComments,
|
|
1063
|
-
listRemoteComments,
|
|
1064
1044
|
checkPlatformCommentOwner,
|
|
1065
1045
|
listPlatformComments,
|
|
1066
1046
|
normalizeCommentContent,
|
|
1067
1047
|
renderTaskComment,
|
|
1068
1048
|
renderTaskCommentResult,
|
|
1069
1049
|
syncCommentPlan,
|
|
1070
|
-
isTaskCommentTooLarge,
|
|
1071
1050
|
syncPlatformComment,
|
|
1072
1051
|
validateRelatedMarkerSet
|
|
1073
1052
|
};
|
package/lib/platform/issues.ts
CHANGED
|
@@ -37,7 +37,8 @@ async function coordinatePlatformWrite<T extends OperationResult>(input: Coordin
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const boundedPr = input.operation.kind === 'pull-request' && input.operation.dependency === 'required';
|
|
41
|
+
const selection = boundedPr || input.operation.kind === 'issue-metadata' && input.operation.issueMetadata?.state === 'closed'
|
|
41
42
|
? 'all' : input.operation.dependency;
|
|
42
43
|
const drained = input.drain
|
|
43
44
|
? await input.drain(input.operation.taskRef, operationId, input.agent, input.operation.cwd)
|
|
@@ -45,7 +46,8 @@ async function coordinatePlatformWrite<T extends OperationResult>(input: Coordin
|
|
|
45
46
|
agent: input.agent,
|
|
46
47
|
client: input.client,
|
|
47
48
|
cwd: input.operation.cwd,
|
|
48
|
-
excludeId: operationId
|
|
49
|
+
excludeId: operationId,
|
|
50
|
+
...(boundedPr ? { beforeId: operationId } : {})
|
|
49
51
|
});
|
|
50
52
|
if (drained.status !== 'applied' && drained.status !== 'no-op') {
|
|
51
53
|
return input.block(drained.error ? { ...drained.error, retryable: true } : {
|
|
@@ -493,10 +493,6 @@ function buildPrChangeReport(
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
function reportFilePath(taskDir: string): string {
|
|
497
|
-
return path.join(taskDir, REPORT_FILE_NAME);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
496
|
function readPrChangeReport(file: string): ValidationResult<PrChangeReport> {
|
|
501
497
|
try {
|
|
502
498
|
const stat = fs.lstatSync(file);
|
|
@@ -765,7 +761,6 @@ export {
|
|
|
765
761
|
readPrChangeReport,
|
|
766
762
|
renderCanonicalChangeReport,
|
|
767
763
|
replaceCanonicalReportPlaceholder,
|
|
768
|
-
reportFilePath,
|
|
769
764
|
runMechanicalChangeReport,
|
|
770
765
|
taskIntentDigest,
|
|
771
766
|
taskIntentProjection,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
providerError,
|
|
16
16
|
providerOperationContext,
|
|
17
17
|
providerStatus,
|
|
18
|
-
resourceIdentity,
|
|
19
18
|
resourceIdentityNumber,
|
|
20
19
|
unsupportedProviderOperation
|
|
21
20
|
} from './provider-bridge.ts';
|
|
@@ -56,14 +55,6 @@ function classifyPullRequestReadiness(input: {
|
|
|
56
55
|
return { state: 'ready', headSha: input.headSha };
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
function resolveRunCandidate(candidates: RunCandidate[], headSha: string, checkName: string):
|
|
60
|
-
| { status: 'resolved'; runId: number; jobId: number | null }
|
|
61
|
-
| { status: 'missing' | 'ambiguous'; runId: null; jobId: null } {
|
|
62
|
-
const matches = candidates.filter((candidate) => candidate.headSha === headSha && candidate.name === checkName);
|
|
63
|
-
if (matches.length === 1) return { status: 'resolved', runId: matches[0]!.id, jobId: matches[0]!.jobId || null };
|
|
64
|
-
return { status: matches.length === 0 ? 'missing' : 'ambiguous', runId: null, jobId: null };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
58
|
function checksResult(status: PlatformResult['status'], overrides: Partial<ChecksResult> = {}): ChecksResult {
|
|
68
59
|
return {
|
|
69
60
|
...platformResult(status),
|
|
@@ -256,5 +247,5 @@ async function fetchPlatformCheckLogs(taskRef: string, options: SharedOptions &
|
|
|
256
247
|
}
|
|
257
248
|
}
|
|
258
249
|
|
|
259
|
-
export { classifyPullRequestReadiness, classifyRequiredChecks, fetchPlatformCheckLogs, inspectRequiredChecks, inspectPullRequestReadiness, resolvePlatformCheckRun,
|
|
250
|
+
export { classifyPullRequestReadiness, classifyRequiredChecks, fetchPlatformCheckLogs, inspectRequiredChecks, inspectPullRequestReadiness, resolvePlatformCheckRun, watchPullRequestReadiness };
|
|
260
251
|
export type { CheckBucket, CheckSnapshot, ChecksResult, ChecksSnapshot, CheckState, ReadinessSnapshot, ReadinessState, RunCandidate };
|
|
@@ -7,7 +7,7 @@ import { resolvePlatformProviderContext } from './context.ts';
|
|
|
7
7
|
import type { PlatformClient } from './context.ts';
|
|
8
8
|
import { providerErrorRetryable } from './provider-validation.ts';
|
|
9
9
|
import { platformResult } from './types.ts';
|
|
10
|
-
import type {
|
|
10
|
+
import type { PlatformResult } from './types.ts';
|
|
11
11
|
import {
|
|
12
12
|
providerError,
|
|
13
13
|
providerOperationContext,
|
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
isPlatformProviderFactory,
|
|
11
11
|
validatePlatformProvider
|
|
12
12
|
} from './provider-contract.ts';
|
|
13
|
-
import type {
|
|
14
|
-
JsonValue,
|
|
15
|
-
PlatformProvider,
|
|
16
|
-
PlatformProviderFactoryInput
|
|
17
|
-
} from './provider-contract.ts';
|
|
13
|
+
import type { JsonValue, PlatformProviderFactoryInput } from './provider-contract.ts';
|
|
18
14
|
import { createGitHubProvider } from './github-provider.ts';
|
|
19
15
|
import { createNoneProvider } from './none-provider.ts';
|
|
20
16
|
import { wrapProviderOperations } from './provider-validation.ts';
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
import { parseResourceIdentity, serializeResourceIdentity } from './resource-identity.ts';
|
|
2
2
|
import type { ProviderIdentityDeclaration, ResourceIdentityKind } from './resource-identity.ts';
|
|
3
|
-
import type {
|
|
4
|
-
ChangeRequestSnapshot,
|
|
5
|
-
CheckLogSnapshot,
|
|
6
|
-
CheckRunSnapshot,
|
|
7
|
-
GitEvidenceSnapshot,
|
|
8
|
-
LabelDefinition,
|
|
9
|
-
LabelReconciliation,
|
|
10
|
-
IssueSnapshot,
|
|
11
|
-
MilestoneDefinition,
|
|
12
|
-
MilestoneInitialization,
|
|
13
|
-
MilestoneReconciliation,
|
|
14
|
-
MutationReceipt,
|
|
15
|
-
PlatformContextSnapshot,
|
|
16
|
-
ProviderError,
|
|
17
|
-
PlatformProvider,
|
|
18
|
-
ProviderResult,
|
|
19
|
-
ReleaseNoteAuthor,
|
|
20
|
-
ReleaseNoteIssue,
|
|
21
|
-
ReleaseNotesFacts,
|
|
22
|
-
ReleaseSnapshot,
|
|
23
|
-
RemoteCommentSnapshot,
|
|
24
|
-
RepositoryMetadataSnapshot,
|
|
25
|
-
RequiredCheckSnapshot,
|
|
26
|
-
ReviewSnapshot,
|
|
27
|
-
SecurityAlertKind,
|
|
28
|
-
SecurityAlertSnapshot,
|
|
29
|
-
VerificationRemoteFacts
|
|
30
|
-
} from './provider-contract.ts';
|
|
3
|
+
import type { ChangeRequestSnapshot, CheckLogSnapshot, CheckRunSnapshot, GitEvidenceSnapshot, LabelReconciliation, IssueSnapshot, MilestoneInitialization, MilestoneReconciliation, MutationReceipt, PlatformContextSnapshot, ProviderError, PlatformProvider, ReleaseNoteAuthor, ReleaseNoteIssue, ReleaseNotesFacts, ReleaseSnapshot, RemoteCommentSnapshot, RepositoryMetadataSnapshot, RequiredCheckSnapshot, ReviewSnapshot, SecurityAlertKind, SecurityAlertSnapshot, VerificationRemoteFacts } from './provider-contract.ts';
|
|
31
4
|
import type { JsonValue } from './provider-contract.ts';
|
|
32
5
|
import type { PlatformError } from './types.ts';
|
|
33
6
|
|
|
@@ -336,16 +309,6 @@ function validateSecurityAlert(value: unknown): SecurityAlertSnapshot {
|
|
|
336
309
|
};
|
|
337
310
|
}
|
|
338
311
|
|
|
339
|
-
function validateLabelDefinition(value: unknown, label: string): LabelDefinition {
|
|
340
|
-
const item = record(value, label);
|
|
341
|
-
exactKeys(item, ['name', 'color', 'description'], label);
|
|
342
|
-
return {
|
|
343
|
-
name: stringValue(item.name, `${label}.name`),
|
|
344
|
-
color: stringValue(item.color, `${label}.color`),
|
|
345
|
-
description: stringValue(item.description, `${label}.description`, true)
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
312
|
function validateLabelReconciliation(value: unknown): LabelReconciliation {
|
|
350
313
|
const item = record(value, 'label reconciliation');
|
|
351
314
|
exactKeys(item, ['changed', 'created', 'updated', 'removed', 'skipped'], 'label reconciliation');
|
|
@@ -359,17 +322,6 @@ function validateLabelReconciliation(value: unknown): LabelReconciliation {
|
|
|
359
322
|
};
|
|
360
323
|
}
|
|
361
324
|
|
|
362
|
-
function validateMilestoneDefinition(value: unknown, label: string): MilestoneDefinition {
|
|
363
|
-
const item = record(value, label);
|
|
364
|
-
exactKeys(item, ['title', 'description', 'state'], label);
|
|
365
|
-
if (item.state !== 'open' && item.state !== 'closed') throw new Error(`${label}.state is invalid`);
|
|
366
|
-
return {
|
|
367
|
-
title: stringValue(item.title, `${label}.title`),
|
|
368
|
-
description: stringValue(item.description, `${label}.description`, true),
|
|
369
|
-
state: item.state
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
|
|
373
325
|
function validateMilestoneInitialization(value: unknown): MilestoneInitialization {
|
|
374
326
|
const item = record(value, 'milestone initialization');
|
|
375
327
|
exactKeys(item, ['changed', 'created', 'skipped'], 'milestone initialization');
|