codex-workflow-v2 2.0.0-beta.10 → 2.0.0-beta.12

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.
Files changed (78) hide show
  1. package/README.md +47 -13
  2. package/dist/src/alpha6/handoff.d.ts +4 -3
  3. package/dist/src/alpha6/handoff.js +58 -3
  4. package/dist/src/alpha6/handoff.js.map +1 -1
  5. package/dist/src/alpha6/mechanical-feasibility.d.ts +7 -0
  6. package/dist/src/alpha6/mechanical-feasibility.js +303 -0
  7. package/dist/src/alpha6/mechanical-feasibility.js.map +1 -0
  8. package/dist/src/alpha6/milestone.d.ts +25 -2
  9. package/dist/src/alpha6/milestone.js +359 -32
  10. package/dist/src/alpha6/milestone.js.map +1 -1
  11. package/dist/src/alpha6/plan-integrity.d.ts +14 -0
  12. package/dist/src/alpha6/plan-integrity.js +127 -0
  13. package/dist/src/alpha6/plan-integrity.js.map +1 -0
  14. package/dist/src/alpha6/remediation.d.ts +3 -2
  15. package/dist/src/alpha6/remediation.js +168 -55
  16. package/dist/src/alpha6/remediation.js.map +1 -1
  17. package/dist/src/alpha6/review.d.ts +5 -0
  18. package/dist/src/alpha6/review.js +110 -2
  19. package/dist/src/alpha6/review.js.map +1 -1
  20. package/dist/src/cli.js +14 -2
  21. package/dist/src/cli.js.map +1 -1
  22. package/dist/src/contracts.d.ts +82 -1
  23. package/dist/src/git.d.ts +1 -1
  24. package/dist/src/git.js +8 -1
  25. package/dist/src/git.js.map +1 -1
  26. package/dist/src/index.d.ts +1 -0
  27. package/dist/src/index.js +1 -0
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/lifecycle/corrective-replan.js +8 -3
  30. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  31. package/dist/src/reviewer.d.ts +26 -0
  32. package/dist/src/reviewer.js +54 -1
  33. package/dist/src/reviewer.js.map +1 -1
  34. package/dist/src/version.d.ts +1 -1
  35. package/dist/src/version.js +1 -1
  36. package/dist/src/workflow.d.ts +5 -0
  37. package/dist/src/workflow.js +449 -148
  38. package/dist/src/workflow.js.map +1 -1
  39. package/docs/autonomy-guardrails.md +42 -33
  40. package/docs/beta11-plan-integrity-recovery-brief.md +38 -0
  41. package/docs/decisions.md +5 -4
  42. package/docs/delegated-approval.md +5 -4
  43. package/docs/development-flow.md +38 -12
  44. package/docs/lifecycle/state-machine-stabilization.md +2 -2
  45. package/docs/pdf/README.md +24 -0
  46. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  47. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  48. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  49. package/docs/pdf/requirements.txt +1 -0
  50. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +235 -0
  51. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +334 -0
  52. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +414 -0
  53. package/docs/problem-briefs/01-pre-implementation-integrity.md +478 -0
  54. package/docs/problem-briefs/02-minimal-step-integrity.md +411 -0
  55. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +358 -0
  56. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +566 -0
  57. package/docs/problem-briefs/BRIEF-TEMPLATE.md +56 -0
  58. package/docs/problem-briefs/README.md +120 -0
  59. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +90 -0
  60. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +246 -0
  61. package/docs/release.md +17 -6
  62. package/docs/split-required-recovery.md +19 -26
  63. package/docs/validation-report.md +83 -70
  64. package/package.json +5 -1
  65. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
  66. package/plugins/codex-workflow-gateway/references/protocol.md +31 -9
  67. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +23 -6
  68. package/references/state-machine.md +18 -13
  69. package/references/validation-and-review.md +11 -4
  70. package/schemas/authorization-event.schema.json +64 -1
  71. package/schemas/corrective-decision-event.schema.json +48 -3
  72. package/schemas/milestone-scope-change-event.schema.json +6 -1
  73. package/schemas/milestone.schema.json +6 -1
  74. package/schemas/review-result.schema.json +17 -1
  75. package/schemas/step-review-event.schema.json +15 -0
  76. package/schemas/task-handoff-event.schema.json +18 -2
  77. package/scripts/generate-pdf-docs.py +513 -0
  78. package/scripts/run-pdf-docs.mjs +62 -0
@@ -0,0 +1,303 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { pathAllowed } from '../domain/validation.js';
3
+ import { WorkflowError } from '../errors.js';
4
+ import { currentBranch, gitIsAncestor, headCommit, runGit } from '../repository.js';
5
+ import { canonicalJsonStringify, sha256Hex } from './store-sidecars.js';
6
+ export const MECHANICAL_FEASIBILITY_ANALYZERS = [
7
+ { analyzerId: 'wf2.root-npm-script', analyzerVersion: 1 },
8
+ { analyzerId: 'wf2.exact-output-path', analyzerVersion: 1 },
9
+ { analyzerId: 'wf2.exact-predecessor-path', analyzerVersion: 1 },
10
+ ];
11
+ const ROOT_NPM_SCRIPT = /^npm run ([A-Za-z0-9][A-Za-z0-9:_-]*)$/;
12
+ const EXACT_PATH = /^path:([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*)$/;
13
+ export function mechanicalFeasibilityAnalyzerSetHash() {
14
+ return sha256Hex(canonicalJsonStringify({ analyzers: MECHANICAL_FEASIBILITY_ANALYZERS }));
15
+ }
16
+ export function mechanicalFeasibilityAnalyzerInputHash(task) {
17
+ return sha256Hex(canonicalJsonStringify({
18
+ steps: task.steps.map((step) => ({
19
+ id: step.id,
20
+ dependencies: step.dependencies,
21
+ expectedOutputs: step.expectedOutputs,
22
+ allowedWrites: step.allowedWrites,
23
+ checks: step.checks,
24
+ })),
25
+ }));
26
+ }
27
+ export function hashMechanicalFeasibilityEvidence(evidence) {
28
+ return sha256Hex(canonicalJsonStringify(evidence));
29
+ }
30
+ export function evaluateMechanicalFeasibility(repositoryRoot, task, briefHash, planHash) {
31
+ const source = selectEvaluationSource(repositoryRoot, task);
32
+ const packageJson = readGitPath(repositoryRoot, source.evaluatedHead, 'package.json');
33
+ const manifest = parseRootManifest(packageJson);
34
+ const byId = new Map(task.steps.map((step) => [step.id, step]));
35
+ const findings = [];
36
+ for (const step of task.steps) {
37
+ const predecessorIds = transitivePredecessorIds(step.id, byId);
38
+ const manifestWriters = [step.id, ...predecessorIds]
39
+ .filter((stepId) => pathAllowed('package.json', requireStep(byId, stepId).allowedWrites))
40
+ .sort();
41
+ for (const check of step.checks) {
42
+ const match = ROOT_NPM_SCRIPT.exec(check);
43
+ if (!match) {
44
+ findings.push(finding('wf2.root-npm-script', 'unverified', step.id, check, 'Check is outside the exact root npm grammar.', 'UNSUPPORTED_CHECK_SYNTAX'));
45
+ continue;
46
+ }
47
+ const script = match[1];
48
+ if (manifest.scripts.has(script)) {
49
+ findings.push(finding('wf2.root-npm-script', 'pass', step.id, check, `Root package.json at ${source.evaluatedHead} declares script ${script}.`, 'ROOT_NPM_SCRIPT_PRESENT'));
50
+ continue;
51
+ }
52
+ if (manifestWriters.length > 0) {
53
+ findings.push(finding('wf2.root-npm-script', 'unverified', step.id, check, `Script ${script} is absent at ${source.evaluatedHead}; package.json is writable by ${manifestWriters.join(', ')}.`, 'ROOT_NPM_SCRIPT_MAY_BE_CREATED'));
54
+ continue;
55
+ }
56
+ findings.push(finding('wf2.root-npm-script', 'blocked', step.id, check, manifest.state === 'valid'
57
+ ? `Script ${script} is absent from root package.json at ${source.evaluatedHead}, and no responsible Step may write package.json.`
58
+ : `Root package.json is ${manifest.state} at ${source.evaluatedHead}, and no responsible Step may write package.json.`, manifest.state === 'valid' ? 'ROOT_NPM_SCRIPT_MISSING' : `ROOT_PACKAGE_JSON_${manifest.state.toUpperCase()}`));
59
+ }
60
+ for (const output of step.expectedOutputs) {
61
+ const relativePath = decodeExactPath(output);
62
+ if (relativePath === null) {
63
+ findings.push(finding('wf2.exact-output-path', 'unverified', step.id, output, 'Expected output is outside the exact path:<repository-relative POSIX path> grammar.', 'UNSUPPORTED_OUTPUT_SYNTAX'));
64
+ continue;
65
+ }
66
+ if (gitPathExists(repositoryRoot, source.evaluatedHead, relativePath)) {
67
+ findings.push(finding('wf2.exact-output-path', 'pass', step.id, output, `${relativePath} exists at ${source.evaluatedHead}.`, 'EXACT_OUTPUT_PRESENT'));
68
+ continue;
69
+ }
70
+ if (pathAllowed(relativePath, step.allowedWrites)) {
71
+ findings.push(finding('wf2.exact-output-path', 'pass', step.id, output, `${step.id} may write absent exact output ${relativePath}.`, 'EXACT_OUTPUT_WRITABLE'));
72
+ continue;
73
+ }
74
+ const providers = predecessorIds
75
+ .filter((predecessorId) => {
76
+ const predecessor = requireStep(byId, predecessorId);
77
+ return predecessor.expectedOutputs.some((candidate) => decodeExactPath(candidate) === relativePath)
78
+ && pathAllowed(relativePath, predecessor.allowedWrites);
79
+ })
80
+ .sort();
81
+ if (providers.length > 0) {
82
+ findings.push(finding('wf2.exact-predecessor-path', 'pass', step.id, output, `Transitive declared predecessor ${providers.join(', ')} owns and may write ${relativePath}.`, 'EXACT_PREDECESSOR_OUTPUT_AVAILABLE'));
83
+ continue;
84
+ }
85
+ findings.push(finding('wf2.exact-output-path', 'blocked', step.id, output, `${relativePath} is absent at ${source.evaluatedHead}, outside ${step.id} write bounds, and has no exact writable declared predecessor.`, 'EXACT_OUTPUT_UNSATISFIABLE'));
86
+ }
87
+ }
88
+ findings.sort(compareFindings);
89
+ return {
90
+ schemaVersion: 1,
91
+ taskId: task.id,
92
+ evaluatedTaskRevision: task.revision,
93
+ briefHash,
94
+ planHash,
95
+ ...source,
96
+ analyzerSetHash: mechanicalFeasibilityAnalyzerSetHash(),
97
+ analyzerInputHash: mechanicalFeasibilityAnalyzerInputHash(task),
98
+ analyzers: MECHANICAL_FEASIBILITY_ANALYZERS.map((analyzer) => ({ ...analyzer })),
99
+ findings,
100
+ decision: findings.some((candidate) => candidate.result === 'blocked') ? 'blocked' : 'clear',
101
+ };
102
+ }
103
+ export function assertMechanicalFeasibilityFresh(repositoryRoot, task, evidence, briefHash, planHash) {
104
+ assertEvidenceShape(evidence, task.id);
105
+ const currentAnalyzerSetHash = mechanicalFeasibilityAnalyzerSetHash();
106
+ const currentAnalyzerInputHash = mechanicalFeasibilityAnalyzerInputHash(task);
107
+ if (evidence.taskId !== task.id
108
+ || evidence.briefHash !== briefHash
109
+ || evidence.planHash !== planHash
110
+ || evidence.analyzerSetHash !== currentAnalyzerSetHash
111
+ || evidence.analyzerInputHash !== currentAnalyzerInputHash) {
112
+ throw new WorkflowError('TRANSITION_BLOCKED', 'Mechanical-feasibility authorization binding is stale.', {
113
+ taskId: task.id,
114
+ authorizedBriefHash: evidence.briefHash,
115
+ currentBriefHash: briefHash,
116
+ authorizedPlanHash: evidence.planHash,
117
+ currentPlanHash: planHash,
118
+ authorizedAnalyzerSetHash: evidence.analyzerSetHash,
119
+ currentAnalyzerSetHash,
120
+ authorizedAnalyzerInputHash: evidence.analyzerInputHash,
121
+ currentAnalyzerInputHash,
122
+ requiredAction: 'Record a fresh execution authorization.',
123
+ });
124
+ }
125
+ if (evidence.decision !== 'clear' || evidence.findings.some((findingValue) => findingValue.result === 'blocked')) {
126
+ throw new WorkflowError('STATE_CORRUPT', 'Approved mechanical-feasibility evidence is not clear.', {
127
+ taskId: task.id,
128
+ decision: evidence.decision,
129
+ });
130
+ }
131
+ if (task.baseCommit === null) {
132
+ const currentBaseHead = runGit(repositoryRoot, ['rev-parse', task.baseBranch]);
133
+ if (evidence.sourceKind !== 'pre-start-base'
134
+ || evidence.sourceBranch !== task.baseBranch
135
+ || evidence.baseCommit !== null
136
+ || evidence.evaluatedHead !== currentBaseHead) {
137
+ throw staleSourceError(task, evidence, currentBaseHead);
138
+ }
139
+ return;
140
+ }
141
+ if (!task.taskBranch) {
142
+ throw new WorkflowError('STATE_CORRUPT', `Started Task ${task.id} has no Task branch.`);
143
+ }
144
+ const branch = currentBranch(repositoryRoot);
145
+ if (branch !== task.taskBranch) {
146
+ throw new WorkflowError('GIT_PRECONDITION_FAILED', 'Mechanical-feasibility freshness requires the owned Task branch.', {
147
+ taskId: task.id,
148
+ expectedBranch: task.taskBranch,
149
+ currentBranch: branch,
150
+ });
151
+ }
152
+ const currentTaskHead = headCommit(repositoryRoot);
153
+ let sourceMatches = false;
154
+ if (evidence.sourceKind === 'pre-start-base') {
155
+ sourceMatches = evidence.sourceBranch === task.baseBranch
156
+ && evidence.baseCommit === null
157
+ && task.baseCommit === evidence.evaluatedHead;
158
+ }
159
+ else if (evidence.sourceKind === 'corrective-task-workspace') {
160
+ sourceMatches = evidence.sourceBranch === task.taskBranch
161
+ && evidence.baseCommit === task.baseCommit;
162
+ }
163
+ if (!sourceMatches || !gitIsAncestor(repositoryRoot, evidence.evaluatedHead, currentTaskHead)) {
164
+ throw staleSourceError(task, evidence, currentTaskHead);
165
+ }
166
+ }
167
+ function selectEvaluationSource(repositoryRoot, task) {
168
+ if (task.baseCommit === null) {
169
+ return {
170
+ sourceKind: 'pre-start-base',
171
+ sourceBranch: task.baseBranch,
172
+ evaluatedHead: runGit(repositoryRoot, ['rev-parse', task.baseBranch]),
173
+ baseCommit: null,
174
+ };
175
+ }
176
+ if (!task.taskBranch) {
177
+ throw new WorkflowError('STATE_CORRUPT', `Started Task ${task.id} has no Task branch.`);
178
+ }
179
+ const branch = currentBranch(repositoryRoot);
180
+ if (branch !== task.taskBranch) {
181
+ throw new WorkflowError('GIT_PRECONDITION_FAILED', 'Mechanical feasibility must be evaluated in the owned Task workspace.', {
182
+ taskId: task.id,
183
+ expectedBranch: task.taskBranch,
184
+ currentBranch: branch,
185
+ });
186
+ }
187
+ return {
188
+ sourceKind: 'corrective-task-workspace',
189
+ sourceBranch: task.taskBranch,
190
+ evaluatedHead: headCommit(repositoryRoot),
191
+ baseCommit: task.baseCommit,
192
+ };
193
+ }
194
+ function parseRootManifest(content) {
195
+ if (content === null)
196
+ return { state: 'missing', scripts: new Set() };
197
+ try {
198
+ const parsed = JSON.parse(content);
199
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
200
+ return { state: 'invalid', scripts: new Set() };
201
+ }
202
+ const scriptsValue = parsed.scripts;
203
+ if (!scriptsValue || typeof scriptsValue !== 'object' || Array.isArray(scriptsValue)) {
204
+ return { state: 'valid', scripts: new Set() };
205
+ }
206
+ return {
207
+ state: 'valid',
208
+ scripts: new Set(Object.entries(scriptsValue)
209
+ .filter(([, value]) => typeof value === 'string')
210
+ .map(([name]) => name)),
211
+ };
212
+ }
213
+ catch {
214
+ return { state: 'invalid', scripts: new Set() };
215
+ }
216
+ }
217
+ function decodeExactPath(subject) {
218
+ const match = EXACT_PATH.exec(subject);
219
+ if (!match)
220
+ return null;
221
+ const relativePath = match[1];
222
+ const segments = relativePath.split('/');
223
+ if (segments.some((segment) => segment === '.' || segment === '..'))
224
+ return null;
225
+ return relativePath;
226
+ }
227
+ function transitivePredecessorIds(stepId, byId) {
228
+ const found = new Set();
229
+ const visit = (candidateId) => {
230
+ const candidate = requireStep(byId, candidateId);
231
+ for (const dependencyId of candidate.dependencies) {
232
+ if (found.has(dependencyId))
233
+ continue;
234
+ requireStep(byId, dependencyId);
235
+ found.add(dependencyId);
236
+ visit(dependencyId);
237
+ }
238
+ };
239
+ visit(stepId);
240
+ return [...found].sort();
241
+ }
242
+ function requireStep(byId, stepId) {
243
+ const step = byId.get(stepId);
244
+ if (!step)
245
+ throw new WorkflowError('STATE_CORRUPT', `Mechanical-feasibility input references missing Step ${stepId}.`);
246
+ return step;
247
+ }
248
+ function finding(analyzerId, result, stepId, subject, evidence, reasonCode) {
249
+ return { analyzerId, analyzerVersion: 1, result, stepId, subject, evidence, reasonCode };
250
+ }
251
+ function compareFindings(left, right) {
252
+ return left.stepId.localeCompare(right.stepId)
253
+ || left.analyzerId.localeCompare(right.analyzerId)
254
+ || left.subject.localeCompare(right.subject)
255
+ || left.result.localeCompare(right.result);
256
+ }
257
+ function readGitPath(repositoryRoot, commit, relativePath) {
258
+ const result = spawnSync('git', ['-C', repositoryRoot, 'show', `${commit}:${relativePath}`], { encoding: 'utf8' });
259
+ if (result.status === 0)
260
+ return result.stdout;
261
+ if (result.status === 128)
262
+ return null;
263
+ throw new WorkflowError('COMMAND_FAILED', `Unable to read ${relativePath} at ${commit}.`, {
264
+ stderr: result.stderr.trim(),
265
+ exitCode: result.status,
266
+ });
267
+ }
268
+ function gitPathExists(repositoryRoot, commit, relativePath) {
269
+ const result = spawnSync('git', ['-C', repositoryRoot, 'cat-file', '-e', `${commit}:${relativePath}`], { encoding: 'utf8' });
270
+ if (result.status === 0)
271
+ return true;
272
+ if (result.status === 128)
273
+ return false;
274
+ throw new WorkflowError('COMMAND_FAILED', `Unable to inspect ${relativePath} at ${commit}.`, {
275
+ stderr: result.stderr.trim(),
276
+ exitCode: result.status,
277
+ });
278
+ }
279
+ function assertEvidenceShape(evidence, taskId) {
280
+ const analyzersCanonical = canonicalJsonStringify(evidence.analyzers);
281
+ const currentAnalyzersCanonical = canonicalJsonStringify(MECHANICAL_FEASIBILITY_ANALYZERS);
282
+ const sortedFindings = [...evidence.findings].sort(compareFindings);
283
+ if (evidence.schemaVersion !== 1
284
+ || analyzersCanonical !== currentAnalyzersCanonical
285
+ || canonicalJsonStringify(evidence.findings) !== canonicalJsonStringify(sortedFindings)) {
286
+ throw new WorkflowError('STATE_CORRUPT', 'Mechanical-feasibility evidence shape or canonical order is invalid.', {
287
+ taskId,
288
+ });
289
+ }
290
+ }
291
+ function staleSourceError(task, evidence, currentHead) {
292
+ return new WorkflowError('TRANSITION_BLOCKED', 'Mechanical-feasibility evaluation source is stale.', {
293
+ taskId: task.id,
294
+ sourceKind: evidence.sourceKind,
295
+ sourceBranch: evidence.sourceBranch,
296
+ evaluatedHead: evidence.evaluatedHead,
297
+ currentHead,
298
+ authorizedBaseCommit: evidence.baseCommit,
299
+ currentBaseCommit: task.baseCommit,
300
+ requiredAction: 'Record a fresh execution authorization.',
301
+ });
302
+ }
303
+ //# sourceMappingURL=mechanical-feasibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mechanical-feasibility.js","sourceRoot":"","sources":["../../../src/alpha6/mechanical-feasibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,CAAC,MAAM,gCAAgC,GAA6C;IACxF,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC,EAAE;IACzD,EAAE,UAAU,EAAE,uBAAuB,EAAE,eAAe,EAAE,CAAC,EAAE;IAC3D,EAAE,UAAU,EAAE,4BAA4B,EAAE,eAAe,EAAE,CAAC,EAAE;CACxD,CAAC;AAEX,MAAM,eAAe,GAAG,wCAAwC,CAAC;AACjE,MAAM,UAAU,GAAG,gDAAgD,CAAC;AASpE,MAAM,UAAU,oCAAoC;IAClD,OAAO,SAAS,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,gCAAgC,EAAE,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,IAAe;IACpE,OAAO,SAAS,CAAC,sBAAsB,CAAC;QACtC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM;SAC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C,iBAAiB,EAAE,IAAI,CAAC,UAAU;QAClC,cAAc,EAAE,yCAAyC;KAC1D,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { AuthorizationEvent, MilestoneMembership, MilestonePlanInput, MilestoneScopeSnapshot, MilestoneState, TaskState } from '../contracts.js';
1
+ import type { AuthorizationEvent, MilestoneMembership, MilestonePlanInput, MilestonePlanMembershipInput, MilestoneScopeSnapshot, MilestoneState, TaskState } from '../contracts.js';
2
2
  import type { FileStateStore } from '../state/store.js';
3
3
  type ReadTask = (taskId: string) => TaskState;
4
4
  type ListTasks = () => TaskState[];
@@ -14,10 +14,21 @@ export interface NormalizedMilestonePlan {
14
14
  outcome: string;
15
15
  successSignal: string;
16
16
  acceptance: string[];
17
- memberships: MilestoneMembership[];
17
+ memberships: MilestonePlanMembershipInput[];
18
18
  checks: string[];
19
19
  taskIds: string[];
20
20
  }
21
+ export interface MilestoneTaskDependencyAssessment {
22
+ dependencyState: 'canonical' | 'legacy-unknown';
23
+ dependsOnTaskIds: string[];
24
+ unsatisfiedPredecessors: Array<{
25
+ taskId: string;
26
+ disposition: MilestoneMembership['disposition'] | 'missing';
27
+ status: TaskState['status'] | 'missing';
28
+ }>;
29
+ runnable: boolean;
30
+ blockReason: string | null;
31
+ }
21
32
  export interface PreparedMilestoneScopeChange {
22
33
  milestoneId: string;
23
34
  expectedRevision: number;
@@ -50,6 +61,9 @@ export declare function prepareMilestoneScopeChangeBundle(options: {
50
61
  readTask: ReadTask;
51
62
  }): PreparedMilestoneScopeChangeBundle;
52
63
  export declare function normalizeMilestonePlan(plan: MilestonePlanInput): NormalizedMilestonePlan;
64
+ export declare function assessMilestoneTaskDependencies(milestone: MilestoneState, taskId: string, readTask: ReadTask): MilestoneTaskDependencyAssessment;
65
+ export declare function assertMilestoneDependenciesDeclared(milestone: MilestoneState): void;
66
+ export declare function assertMilestoneTaskRunnable(milestone: MilestoneState, taskId: string, readTask: ReadTask): MilestoneTaskDependencyAssessment;
53
67
  export declare function readMilestoneWithIntegrity(store: FileStateStore, projectId: string, milestoneId: string, readTask: ReadTask, listTasks?: ListTasks): MilestoneState;
54
68
  /** Read-only integrity validation for observation APIs. Pending journals must be assessed first. */
55
69
  export declare function inspectMilestoneWithIntegrity(store: FileStateStore, projectId: string, milestoneId: string, readTask: ReadTask, listTasks?: ListTasks): MilestoneState;
@@ -78,4 +92,13 @@ export declare function applyMilestoneScopeChangeTransaction(options: {
78
92
  now: Date;
79
93
  readTask: ReadTask;
80
94
  }): MilestoneState;
95
+ export declare function applyInitialMilestonePlanTransaction(options: {
96
+ store: FileStateStore;
97
+ milestone: MilestoneState;
98
+ expectedRevision: number;
99
+ normalizedPlan: NormalizedMilestonePlan;
100
+ now: Date;
101
+ readTask: ReadTask;
102
+ listTasks?: ListTasks;
103
+ }): MilestoneState;
81
104
  export {};