codex-workflow-v2 2.0.0-beta.13.14 → 2.0.0-beta.13.16
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 +17 -0
- package/dist/reviewer-runtime-build.json +20 -8
- package/dist/src/alpha6/captured-check-evidence.d.ts +49 -0
- package/dist/src/alpha6/captured-check-evidence.js +146 -0
- package/dist/src/alpha6/captured-check-evidence.js.map +1 -0
- package/dist/src/alpha6/corrective-decision-boundary.d.ts +4 -0
- package/dist/src/alpha6/corrective-decision-boundary.js +47 -0
- package/dist/src/alpha6/corrective-decision-boundary.js.map +1 -0
- package/dist/src/alpha6/root-cause-replan-carryover.d.ts +3 -1
- package/dist/src/alpha6/root-cause-replan-carryover.js +4 -0
- package/dist/src/alpha6/root-cause-replan-carryover.js.map +1 -1
- package/dist/src/contracts.d.ts +5 -1
- package/dist/src/dependency-provenance.js +10 -0
- package/dist/src/dependency-provenance.js.map +1 -1
- package/dist/src/graph.js +25 -3
- package/dist/src/graph.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflow-blocker-route.d.ts +8 -0
- package/dist/src/workflow-blocker-route.js +106 -0
- package/dist/src/workflow-blocker-route.js.map +1 -0
- package/dist/src/workflow.d.ts +1 -0
- package/dist/src/workflow.js +139 -19
- package/dist/src/workflow.js.map +1 -1
- package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
- package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
- package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
- package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +1 -1
- package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +2 -2
- package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +2 -2
- package/docs/release.md +49 -0
- package/package.json +2 -1
- package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
- package/plugins/codex-workflow-gateway/references/chat-dispatch.md +40 -11
- package/plugins/codex-workflow-gateway/references/codebase-memory-routing.md +55 -0
- package/plugins/codex-workflow-gateway/scripts/chat-dispatch.mjs +7 -1
- package/plugins/codex-workflow-gateway/scripts/chat-model-policy.mjs +10 -8
- package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +23 -5
- package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +78 -12
- package/src/alpha6/adoption.ts +1105 -0
- package/src/alpha6/captured-check-evidence.ts +126 -0
- package/src/alpha6/check-support-anchor.ts +128 -0
- package/src/alpha6/component-owner.ts +168 -0
- package/src/alpha6/corrective-decision-boundary.ts +39 -0
- package/src/alpha6/downstream-proof.ts +732 -0
- package/src/alpha6/failed-step-planning-recovery.ts +88 -0
- package/src/alpha6/handoff.ts +1443 -0
- package/src/alpha6/journal.ts +473 -0
- package/src/alpha6/literal-test-invocation.ts +84 -0
- package/src/alpha6/mechanical-feasibility.ts +488 -0
- package/src/alpha6/milestone.ts +2182 -0
- package/src/alpha6/npm-check-contract.ts +47 -0
- package/src/alpha6/plan-integrity-update.ts +20 -0
- package/src/alpha6/plan-integrity.ts +298 -0
- package/src/alpha6/plan-risk.ts +1480 -0
- package/src/alpha6/preexecution-replan.ts +187 -0
- package/src/alpha6/remediation-cause.ts +98 -0
- package/src/alpha6/remediation.ts +2965 -0
- package/src/alpha6/review.ts +1198 -0
- package/src/alpha6/root-cause-replan-carryover.ts +471 -0
- package/src/alpha6/store-sidecars.ts +335 -0
- package/src/alpha7/autonomy.ts +411 -0
- package/src/alpha7/corrective-recovery.ts +1332 -0
- package/src/artifacts.ts +130 -0
- package/src/beta1/project-transaction.ts +351 -0
- package/src/change-explanation.ts +153 -0
- package/src/cli-actions.ts +119 -0
- package/src/cli.ts +1583 -0
- package/src/contracts.ts +1510 -0
- package/src/credential-output.ts +89 -0
- package/src/credential-transport.ts +215 -0
- package/src/delegation.ts +190 -0
- package/src/dependency-provenance.ts +538 -0
- package/src/diagnostics.ts +93 -0
- package/src/domain/completed-step-carryover.ts +76 -0
- package/src/domain/discovery.ts +27 -0
- package/src/domain/plan-semantics.ts +58 -0
- package/src/domain/validation.ts +177 -0
- package/src/errors.ts +23 -0
- package/src/fs-utils.ts +61 -0
- package/src/gateway-handshake.ts +103 -0
- package/src/git.ts +158 -0
- package/src/graph.ts +342 -0
- package/src/historical-step-provenance.ts +136 -0
- package/src/index.ts +21 -0
- package/src/lifecycle/canonical-hash.ts +28 -0
- package/src/lifecycle/catalog.ts +202 -0
- package/src/lifecycle/compiler-inspection.ts +29 -0
- package/src/lifecycle/core-static-readiness.ts +132 -0
- package/src/lifecycle/corrective-replan-authority.ts +136 -0
- package/src/lifecycle/corrective-replan-binding-manifest.ts +51 -0
- package/src/lifecycle/corrective-replan-credential-core.ts +408 -0
- package/src/lifecycle/corrective-replan-credential-schema.ts +54 -0
- package/src/lifecycle/corrective-replan-credentials.ts +48 -0
- package/src/lifecycle/corrective-replan.ts +843 -0
- package/src/lifecycle/evaluator.ts +48 -0
- package/src/lifecycle/fingerprint.ts +488 -0
- package/src/lifecycle/immutable.ts +8 -0
- package/src/lifecycle/implementation-table.ts +118 -0
- package/src/lifecycle/index.ts +8 -0
- package/src/lifecycle/schema-artifact.ts +263 -0
- package/src/lifecycle/semantic-registry.ts +572 -0
- package/src/lifecycle/types.ts +838 -0
- package/src/memory.ts +273 -0
- package/src/migration.ts +161 -0
- package/src/navigation-actions.ts +70 -0
- package/src/observation.ts +198 -0
- package/src/observed-routes.ts +661 -0
- package/src/operational-contract.ts +125 -0
- package/src/pending-review-update.ts +191 -0
- package/src/repository.ts +99 -0
- package/src/reviewer.ts +1876 -0
- package/src/state/corrective-replan-executor.ts +818 -0
- package/src/state/corrective-replan-public-schema.ts +83 -0
- package/src/state/corrective-replan-public.ts +908 -0
- package/src/state/corrective-replan-transaction.ts +947 -0
- package/src/state/corrective-yield-executor.ts +327 -0
- package/src/state/corrective-yield-transaction.ts +728 -0
- package/src/state/lock.ts +880 -0
- package/src/state/store.ts +567 -0
- package/src/transition-core.ts +330 -0
- package/src/ulid.ts +24 -0
- package/src/version.ts +2 -0
- package/src/workflow-blocker-route.ts +109 -0
- package/src/workflow.ts +11436 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { TaskState } from '../contracts.js';
|
|
4
|
+
import type { FileStateStore } from '../state/store.js';
|
|
5
|
+
import { WorkflowError } from '../errors.js';
|
|
6
|
+
import { hashKnowledgeMap } from '../memory.js';
|
|
7
|
+
import { canonicalJsonStringify, sha256Hex } from './store-sidecars.js';
|
|
8
|
+
import { readCurrentPlanRiskAudit, readCurrentPlanningObstructionAudit, readPlanRiskAuditEvents } from './plan-risk.js';
|
|
9
|
+
import { assertKnowledgeBindingOnlyPlanChange } from '../alpha7/corrective-recovery.js';
|
|
10
|
+
|
|
11
|
+
/** A stopped rebound Plan is evidence for repair, never execution authority. */
|
|
12
|
+
export function readFailedStepPlanningRecovery(store: FileStateStore, task: TaskState) {
|
|
13
|
+
if (task.status !== 'awaiting_execution_authorization' || !task.planHash
|
|
14
|
+
|| task.workspaceOwner === null || !task.steps.some(step => step.status === 'failed')
|
|
15
|
+
|| task.steps.some(step => step.status === 'in_progress')) return null;
|
|
16
|
+
const current = readCurrentPlanningObstructionAudit(store, task);
|
|
17
|
+
if (!current || current.audit.decision !== 'stop-escalate') return null;
|
|
18
|
+
const fail = (message: string): never => { throw new WorkflowError('TRANSITION_BLOCKED', message, { taskId: task.id }); };
|
|
19
|
+
const map = store.readKnowledgeMap(task.projectId);
|
|
20
|
+
if (map.status !== 'active' || map.revision !== task.knowledgeMapRevision || hashKnowledgeMap(map) !== task.knowledgeMapHash)
|
|
21
|
+
fail('Planning recovery requires the current active Knowledge binding.');
|
|
22
|
+
const audits = readPlanRiskAuditEvents(store, task);
|
|
23
|
+
const root = store.taskRoot(task.projectId, task.id);
|
|
24
|
+
let hash = task.planHash;
|
|
25
|
+
let knowledgeRevision = task.knowledgeMapRevision;
|
|
26
|
+
let knowledgeHash = task.knowledgeMapHash;
|
|
27
|
+
const visited = new Set<string>();
|
|
28
|
+
const plan = (h: string) => {
|
|
29
|
+
const text = readFileSync(h === task.planHash ? path.join(root, 'plan.md') : path.join(root, '.versions', `plan.md.${h}`), 'utf8');
|
|
30
|
+
if (sha256Hex(text) !== h) fail('Planning recovery Plan artifact hash mismatch.');
|
|
31
|
+
return text;
|
|
32
|
+
};
|
|
33
|
+
while (!visited.has(hash)) {
|
|
34
|
+
visited.add(hash);
|
|
35
|
+
const links = task.knowledgeRebinds.filter(record => record.reboundPlanHash === hash);
|
|
36
|
+
if (links.length !== 1) return fail('Planning recovery requires an unambiguous Knowledge rebind chain.');
|
|
37
|
+
const link = links[0]!;
|
|
38
|
+
if (link.toKnowledgeMapRevision !== knowledgeRevision || link.toKnowledgeMapHash !== knowledgeHash
|
|
39
|
+
|| !link.previousPlanHash) fail('Planning recovery Knowledge rebind endpoints are stale.');
|
|
40
|
+
const before = plan(link.previousPlanHash), after = plan(hash);
|
|
41
|
+
assertKnowledgeBindingOnlyPlanChange(before, after);
|
|
42
|
+
if (!before.includes(`- Knowledge map: revision ${link.fromKnowledgeMapRevision}, hash ${link.fromKnowledgeMapHash}\n`)
|
|
43
|
+
|| !after.includes(`- Knowledge map: revision ${link.toKnowledgeMapRevision}, hash ${link.toKnowledgeMapHash}\n`))
|
|
44
|
+
fail('Planning recovery artifact Knowledge endpoints differ from the recorded rebind.');
|
|
45
|
+
hash = link.previousPlanHash;
|
|
46
|
+
knowledgeRevision = link.fromKnowledgeMapRevision;
|
|
47
|
+
knowledgeHash = link.fromKnowledgeMapHash;
|
|
48
|
+
const baseline = audits.filter(a => a.planHash === hash && a.briefHash === task.briefHash
|
|
49
|
+
&& a.knowledgeMapRevision === knowledgeRevision && a.knowledgeMapHash === knowledgeHash
|
|
50
|
+
&& ['approved', 'approved-with-rationale'].includes(a.decision)
|
|
51
|
+
&& audits.indexOf(a) < audits.findIndex(event => event.eventHash === current.audit.eventHash)
|
|
52
|
+
&& task.authorizations.some(grant => grant.kind === 'execution' && grant.decision === 'superseded'
|
|
53
|
+
&& grant.planHash === a.planHash && grant.briefHash === a.briefHash
|
|
54
|
+
&& Date.parse(grant.recordedAt) >= Date.parse(a.recordedAt))).at(-1);
|
|
55
|
+
if (!baseline) continue;
|
|
56
|
+
// A negative audit may append an observed counterexample without erasing the
|
|
57
|
+
// historical proof. Prefix preservation is NOT proof of semantic strengthening:
|
|
58
|
+
// both audits remain planning evidence, and replacement requires its own gates.
|
|
59
|
+
const obstructionClassifications = structuredClone(current.audit.stepClassifications);
|
|
60
|
+
for (const [stepIndex, classification] of obstructionClassifications.entries()) {
|
|
61
|
+
const original = baseline.stepClassifications[stepIndex];
|
|
62
|
+
if (!original) return fail('Planning recovery must preserve the approved Step classification ordering.');
|
|
63
|
+
const proofs = classification.proofObligations ?? [], originalProofs = original.proofObligations ?? [];
|
|
64
|
+
if (proofs.length !== originalProofs.length)
|
|
65
|
+
fail('Planning recovery must preserve the approved proof tuple count and ordering.');
|
|
66
|
+
for (const [proofIndex, proof] of proofs.entries()) {
|
|
67
|
+
const originalProof = originalProofs[proofIndex]!;
|
|
68
|
+
for (const field of ['counterexample', 'expectedResult'] as const) {
|
|
69
|
+
if (!proof[field].startsWith(originalProof[field]))
|
|
70
|
+
fail('Planning recovery cannot truncate or replace historical proof narratives.');
|
|
71
|
+
proof[field] = originalProof[field];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (canonicalJsonStringify(baseline.stepClassifications) !== canonicalJsonStringify(obstructionClassifications))
|
|
76
|
+
fail('Planning recovery must preserve the approved risk classifications and proof tuples.');
|
|
77
|
+
const grants = task.authorizations.filter(a => a.kind === 'execution' && a.decision === 'superseded'
|
|
78
|
+
&& a.planHash === baseline.planHash && a.briefHash === baseline.briefHash
|
|
79
|
+
&& Date.parse(a.recordedAt) >= Date.parse(baseline.recordedAt));
|
|
80
|
+
if (grants.length !== 1) fail('Planning recovery requires one historical superseded Plan authorization.');
|
|
81
|
+
return { current, baseline, priorAuthorization: grants[0]!, authority: 'planning-only' as const };
|
|
82
|
+
}
|
|
83
|
+
return fail('Planning recovery Knowledge rebind chain contains a cycle.');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function readCorrectivePlanningAudit(store: FileStateStore, task: TaskState) {
|
|
87
|
+
return readFailedStepPlanningRecovery(store, task)?.current ?? readCurrentPlanRiskAudit(store, task);
|
|
88
|
+
}
|