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,198 @@
|
|
|
1
|
+
import { existsSync, readdirSync, realpathSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type {
|
|
4
|
+
AdoptionPostureEvent,
|
|
5
|
+
ObservationReasonCode,
|
|
6
|
+
ObservedMilestoneTransaction,
|
|
7
|
+
ObservedProjectTransaction,
|
|
8
|
+
PublicWriterLease,
|
|
9
|
+
ProjectRecord,
|
|
10
|
+
WorkflowObservation,
|
|
11
|
+
WriterLease,
|
|
12
|
+
} from './contracts.js';
|
|
13
|
+
import { readCurrentAdoptionPosture } from './alpha6/adoption.js';
|
|
14
|
+
import { listMilestoneTransactionJournals } from './alpha6/journal.js';
|
|
15
|
+
import { assertNoSymlinkPathComponents } from './alpha6/store-sidecars.js';
|
|
16
|
+
import { listProjectTransactions } from './beta1/project-transaction.js';
|
|
17
|
+
import type { RepositoryIdentity } from './repository.js';
|
|
18
|
+
import {
|
|
19
|
+
listCoreTaskOperationMutexes,
|
|
20
|
+
listWriterLeases,
|
|
21
|
+
toPublicCoreTaskOperation,
|
|
22
|
+
toPublicWriterLease,
|
|
23
|
+
} from './state/lock.js';
|
|
24
|
+
import { inspectCorrectiveReplanTaskTransactions } from './state/corrective-replan-transaction.js';
|
|
25
|
+
import { inspectCorrectiveYieldTaskTransactions } from './state/corrective-yield-transaction.js';
|
|
26
|
+
import type { FileStateStore } from './state/store.js';
|
|
27
|
+
|
|
28
|
+
export interface WorkflowObservationBoundary {
|
|
29
|
+
identity: RepositoryIdentity;
|
|
30
|
+
project: ProjectRecord | null;
|
|
31
|
+
currentAdoptionPosture: AdoptionPostureEvent | null;
|
|
32
|
+
leases: WriterLease[];
|
|
33
|
+
observation: WorkflowObservation;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Reads only the persistence boundary needed to decide whether a coherent lifecycle snapshot can
|
|
38
|
+
* be loaded. It deliberately does not register a project, recover a journal, initialize adoption,
|
|
39
|
+
* or construct a WriterLockManager.
|
|
40
|
+
*/
|
|
41
|
+
export function inspectWorkflowObservationBoundary(options: {
|
|
42
|
+
store: FileStateStore;
|
|
43
|
+
identity: RepositoryIdentity;
|
|
44
|
+
now: Date;
|
|
45
|
+
}): WorkflowObservationBoundary {
|
|
46
|
+
const { store, identity, now } = options;
|
|
47
|
+
const projectRoot = store.projectRoot(identity.projectId);
|
|
48
|
+
const projectFile = path.join(projectRoot, 'project.json');
|
|
49
|
+
const lockRoot = store.lockRoot(identity.projectId);
|
|
50
|
+
const stateRootPresent = existsSync(store.root);
|
|
51
|
+
const projectRootPresent = existsSync(projectRoot);
|
|
52
|
+
const lockRootPresent = existsSync(lockRoot);
|
|
53
|
+
const missingRegistration = !existsSync(projectFile);
|
|
54
|
+
const pendingProjectTransactions = observeProjectTransactions(projectRoot, identity.projectId);
|
|
55
|
+
const pendingMilestoneTransactions = observeMilestoneTransactions(store, identity.projectId);
|
|
56
|
+
const replanTransactions = inspectCorrectiveReplanTaskTransactions(projectRoot, store.root);
|
|
57
|
+
const yieldTransactions = inspectCorrectiveYieldTaskTransactions(projectRoot, store.root);
|
|
58
|
+
const taskTransactions = {
|
|
59
|
+
pending: [...replanTransactions.pending, ...yieldTransactions.pending]
|
|
60
|
+
.sort((left, right) => left.taskId.localeCompare(right.taskId) || left.transactionId.localeCompare(right.transactionId)),
|
|
61
|
+
corrupt: [...replanTransactions.corrupt, ...yieldTransactions.corrupt]
|
|
62
|
+
.sort((left, right) => left.taskId.localeCompare(right.taskId) || left.transactionId.localeCompare(right.transactionId)),
|
|
63
|
+
};
|
|
64
|
+
const pendingTaskTransitionIds = [...new Set(taskTransactions.pending.map((transaction) => transaction.transitionId))];
|
|
65
|
+
const mixedPendingTaskTransitions = pendingTaskTransitionIds.length > 1;
|
|
66
|
+
const leases = listWriterLeases(lockRoot);
|
|
67
|
+
const coreTaskOperations = listCoreTaskOperationMutexes(lockRoot, store.root)
|
|
68
|
+
.map((mutex) => toPublicCoreTaskOperation(mutex, now));
|
|
69
|
+
const orphanCoreTaskOperations = coreTaskOperations.filter((operation) => !taskTransactions.pending.some(
|
|
70
|
+
(transaction) => transaction.taskId === operation.entityId && transaction.transactionId === operation.operationId,
|
|
71
|
+
));
|
|
72
|
+
|
|
73
|
+
const project = !missingRegistration && pendingProjectTransactions.length === 0
|
|
74
|
+
? store.readProject(identity.projectId)
|
|
75
|
+
: null;
|
|
76
|
+
const repositoryRootBound = project?.repositoryRoots.includes(identity.repositoryRoot) ?? false;
|
|
77
|
+
const adoptionAssessed = pendingProjectTransactions.length === 0
|
|
78
|
+
&& pendingMilestoneTransactions.length === 0
|
|
79
|
+
&& taskTransactions.pending.length === 0
|
|
80
|
+
&& taskTransactions.corrupt.length === 0
|
|
81
|
+
&& orphanCoreTaskOperations.length === 0;
|
|
82
|
+
const currentAdoptionPosture = adoptionAssessed && stateRootPresent
|
|
83
|
+
? readCurrentAdoptionPosture(store, identity.projectId)
|
|
84
|
+
: null;
|
|
85
|
+
const missingAdoption = adoptionAssessed && currentAdoptionPosture === null;
|
|
86
|
+
const observedLeases = leases.map((lease) => toPublicWriterLease(lease, now));
|
|
87
|
+
const activeLeases = observedLeases.filter((lease) => !lease.stale);
|
|
88
|
+
const staleLeases = observedLeases.filter((lease) => lease.stale);
|
|
89
|
+
|
|
90
|
+
const reasonCodes: ObservationReasonCode[] = [];
|
|
91
|
+
if (missingRegistration) reasonCodes.push('PROJECT_REGISTRATION_MISSING');
|
|
92
|
+
if (project && !repositoryRootBound) reasonCodes.push('PROJECT_REPOSITORY_ROOT_UNBOUND');
|
|
93
|
+
if (pendingProjectTransactions.length > 0) reasonCodes.push('PROJECT_RECOVERY_REQUIRED');
|
|
94
|
+
if (pendingMilestoneTransactions.length > 0) reasonCodes.push('MILESTONE_RECOVERY_REQUIRED');
|
|
95
|
+
if (taskTransactions.pending.length > 0) reasonCodes.push('TASK_RECOVERY_REQUIRED');
|
|
96
|
+
if (taskTransactions.corrupt.length > 0) reasonCodes.push('TASK_TRANSACTION_INTEGRITY_FAILED');
|
|
97
|
+
if (orphanCoreTaskOperations.some((operation) => !operation.stale)) reasonCodes.push('TASK_OPERATION_IN_PROGRESS');
|
|
98
|
+
if (orphanCoreTaskOperations.some((operation) => operation.stale)) reasonCodes.push('STALE_TASK_OPERATION');
|
|
99
|
+
if (activeLeases.length > 0) reasonCodes.push('ACTIVE_WRITER_LEASE');
|
|
100
|
+
if (staleLeases.length > 0) reasonCodes.push('STALE_WRITER_LEASE');
|
|
101
|
+
if (missingAdoption) reasonCodes.push('ADOPTION_MISSING');
|
|
102
|
+
|
|
103
|
+
const blocked = missingRegistration
|
|
104
|
+
|| (project !== null && !repositoryRootBound)
|
|
105
|
+
|| pendingProjectTransactions.length > 0
|
|
106
|
+
|| taskTransactions.corrupt.length > 0
|
|
107
|
+
|| mixedPendingTaskTransitions
|
|
108
|
+
|| orphanCoreTaskOperations.length > 0;
|
|
109
|
+
const repairable = taskTransactions.pending.length > 0
|
|
110
|
+
|| pendingMilestoneTransactions.length > 0;
|
|
111
|
+
const kind: WorkflowObservation['kind'] = blocked ? 'blocked' : repairable ? 'repair' : 'assessment';
|
|
112
|
+
const repair = kind !== 'repair'
|
|
113
|
+
? null
|
|
114
|
+
: taskTransactions.pending.length > 0
|
|
115
|
+
? {
|
|
116
|
+
command: pendingTaskTransitionIds[0] === 'task.coordination.corrective-yield'
|
|
117
|
+
? 'task corrective-yield-recover' as const
|
|
118
|
+
: 'task corrective-replan-recover' as const,
|
|
119
|
+
cataloged: false as const,
|
|
120
|
+
available: true as const,
|
|
121
|
+
projectId: identity.projectId,
|
|
122
|
+
taskIds: [...new Set(taskTransactions.pending.map((transaction) => transaction.taskId))].sort(),
|
|
123
|
+
transactionIds: taskTransactions.pending.map((transaction) => transaction.transactionId).sort(),
|
|
124
|
+
}
|
|
125
|
+
: pendingMilestoneTransactions.length > 0
|
|
126
|
+
? {
|
|
127
|
+
command: 'milestone recover' as const,
|
|
128
|
+
cataloged: false as const,
|
|
129
|
+
projectId: identity.projectId,
|
|
130
|
+
milestoneIds: [...new Set(pendingMilestoneTransactions.map((transaction) => transaction.milestoneId))].sort(),
|
|
131
|
+
transactionIds: pendingMilestoneTransactions.map((transaction) => transaction.transactionId).sort(),
|
|
132
|
+
}
|
|
133
|
+
: {
|
|
134
|
+
command: 'locks repair' as const,
|
|
135
|
+
cataloged: false as const,
|
|
136
|
+
projectId: identity.projectId,
|
|
137
|
+
entityIds: staleLeases.map((lease) => lease.entityId).sort(),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
identity,
|
|
142
|
+
project,
|
|
143
|
+
currentAdoptionPosture,
|
|
144
|
+
leases,
|
|
145
|
+
observation: {
|
|
146
|
+
kind,
|
|
147
|
+
reasonCodes,
|
|
148
|
+
stateRootPresent,
|
|
149
|
+
projectRootPresent,
|
|
150
|
+
lockRootPresent,
|
|
151
|
+
missingRegistration,
|
|
152
|
+
repositoryRootBound,
|
|
153
|
+
adoptionAssessed,
|
|
154
|
+
missingAdoption,
|
|
155
|
+
pendingProjectTransactions,
|
|
156
|
+
pendingMilestoneTransactions,
|
|
157
|
+
pendingTaskTransactions: taskTransactions.pending,
|
|
158
|
+
corruptTaskTransactions: taskTransactions.corrupt,
|
|
159
|
+
coreTaskOperations,
|
|
160
|
+
leases: observedLeases,
|
|
161
|
+
availableRepairTransitionId: null,
|
|
162
|
+
repair,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function observeProjectTransactions(projectRoot: string, projectId: string): ObservedProjectTransaction[] {
|
|
168
|
+
return listProjectTransactions(projectRoot, projectId)
|
|
169
|
+
.map((transaction) => ({ ...transaction }))
|
|
170
|
+
.sort((left, right) => left.preparedAt.localeCompare(right.preparedAt)
|
|
171
|
+
|| left.transactionId.localeCompare(right.transactionId));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function observeMilestoneTransactions(
|
|
175
|
+
store: FileStateStore,
|
|
176
|
+
projectId: string,
|
|
177
|
+
): ObservedMilestoneTransaction[] {
|
|
178
|
+
const milestonesRoot = path.join(store.projectRoot(projectId), 'milestones');
|
|
179
|
+
if (!existsSync(milestonesRoot)) return [];
|
|
180
|
+
assertNoSymlinkPathComponents(milestonesRoot, {
|
|
181
|
+
label: 'Milestones observation root',
|
|
182
|
+
requireLeaf: true,
|
|
183
|
+
trustedRoot: store.root,
|
|
184
|
+
});
|
|
185
|
+
return readdirSync(milestonesRoot, { withFileTypes: true })
|
|
186
|
+
.filter((entry) => entry.isDirectory())
|
|
187
|
+
.flatMap((entry) => listMilestoneTransactionJournals(realpathSync(path.join(milestonesRoot, entry.name)), {
|
|
188
|
+
expectedMilestoneId: entry.name,
|
|
189
|
+
}).map((journal) => ({
|
|
190
|
+
milestoneId: journal.milestoneId,
|
|
191
|
+
transactionId: journal.transactionId,
|
|
192
|
+
phase: journal.phase,
|
|
193
|
+
preparedAt: journal.preparedAt,
|
|
194
|
+
updatedAt: journal.updatedAt,
|
|
195
|
+
})))
|
|
196
|
+
.sort((left, right) => left.preparedAt.localeCompare(right.preparedAt)
|
|
197
|
+
|| left.transactionId.localeCompare(right.transactionId));
|
|
198
|
+
}
|