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

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 (62) hide show
  1. package/README.md +65 -5
  2. package/dist/src/alpha6/downstream-proof.d.ts +68 -0
  3. package/dist/src/alpha6/downstream-proof.js +604 -0
  4. package/dist/src/alpha6/downstream-proof.js.map +1 -0
  5. package/dist/src/alpha6/milestone.d.ts +6 -2
  6. package/dist/src/alpha6/milestone.js +164 -10
  7. package/dist/src/alpha6/milestone.js.map +1 -1
  8. package/dist/src/alpha6/plan-risk.js +2 -2
  9. package/dist/src/alpha6/plan-risk.js.map +1 -1
  10. package/dist/src/alpha6/remediation.d.ts +8 -3
  11. package/dist/src/alpha6/remediation.js +374 -9
  12. package/dist/src/alpha6/remediation.js.map +1 -1
  13. package/dist/src/alpha6/review.d.ts +6 -0
  14. package/dist/src/alpha6/review.js +12 -0
  15. package/dist/src/alpha6/review.js.map +1 -1
  16. package/dist/src/alpha7/corrective-recovery.d.ts +8 -1
  17. package/dist/src/alpha7/corrective-recovery.js +406 -26
  18. package/dist/src/alpha7/corrective-recovery.js.map +1 -1
  19. package/dist/src/cli.js +135 -5
  20. package/dist/src/cli.js.map +1 -1
  21. package/dist/src/contracts.d.ts +154 -3
  22. package/dist/src/dependency-provenance.d.ts +9 -2
  23. package/dist/src/dependency-provenance.js +70 -8
  24. package/dist/src/dependency-provenance.js.map +1 -1
  25. package/dist/src/git.d.ts +1 -1
  26. package/dist/src/git.js +6 -2
  27. package/dist/src/git.js.map +1 -1
  28. package/dist/src/historical-step-provenance.d.ts +20 -0
  29. package/dist/src/historical-step-provenance.js +111 -0
  30. package/dist/src/historical-step-provenance.js.map +1 -0
  31. package/dist/src/state/corrective-replan-executor.js +5 -0
  32. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  33. package/dist/src/version.d.ts +1 -1
  34. package/dist/src/version.js +1 -1
  35. package/dist/src/version.js.map +1 -1
  36. package/dist/src/workflow.d.ts +40 -2
  37. package/dist/src/workflow.js +1440 -65
  38. package/dist/src/workflow.js.map +1 -1
  39. package/docs/autonomy-guardrails.md +91 -1
  40. package/docs/decisions.md +14 -0
  41. package/docs/delegated-approval.md +6 -1
  42. package/docs/development-flow.md +60 -5
  43. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  44. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  45. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  46. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +97 -7
  47. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +68 -9
  48. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +150 -33
  49. package/docs/release.md +51 -8
  50. package/docs/updating-existing-project.md +155 -2
  51. package/docs/validation-report.md +101 -94
  52. package/package.json +7 -2
  53. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
  54. package/plugins/codex-workflow-gateway/references/protocol.md +69 -1
  55. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +156 -1
  56. package/schemas/authorization-event.schema.json +8 -1
  57. package/schemas/downstream-proof-invalidation-event.schema.json +71 -0
  58. package/schemas/downstream-proof-replan-recovery-event.schema.json +61 -0
  59. package/schemas/milestone-scope-change-event.schema.json +25 -1
  60. package/schemas/stop-escalate-override-event.schema.json +45 -0
  61. package/schemas/task.schema.json +104 -0
  62. package/scripts/generate-pdf-docs.py +13 -2
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/downstream-proof-invalidation-event.schema.json",
4
+ "title": "Codex Workflow V2 Downstream Proof Invalidation Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "previousTaskRevision",
11
+ "resultTaskRevision",
12
+ "planHash",
13
+ "activeStepId",
14
+ "invalidatedSteps",
15
+ "dirtyFiles",
16
+ "preservedHeadCommit",
17
+ "actor",
18
+ "reason",
19
+ "packageVersion",
20
+ "previousEventHash",
21
+ "recordedAt",
22
+ "eventHash"
23
+ ],
24
+ "properties": {
25
+ "eventId": { "type": "string", "pattern": "^DPI-[0-9A-HJKMNP-TV-Z]{26}$" },
26
+ "taskId": { "$ref": "#/$defs/taskId" },
27
+ "previousTaskRevision": { "type": "integer", "minimum": 1 },
28
+ "resultTaskRevision": { "type": "integer", "minimum": 2 },
29
+ "planHash": { "$ref": "#/$defs/hash64" },
30
+ "activeStepId": { "$ref": "#/$defs/stepId" },
31
+ "invalidatedSteps": {
32
+ "type": "array",
33
+ "minItems": 1,
34
+ "items": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["stepId", "evidenceCommit", "triggerFiles"],
38
+ "properties": {
39
+ "stepId": { "$ref": "#/$defs/stepId" },
40
+ "evidenceCommit": { "$ref": "#/$defs/gitHash" },
41
+ "triggerFiles": {
42
+ "type": "array",
43
+ "uniqueItems": true,
44
+ "items": { "type": "string", "minLength": 1 }
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "dirtyFiles": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "uniqueItems": true,
53
+ "items": { "type": "string", "minLength": 1 }
54
+ },
55
+ "dirtyWorktreeHash": { "$ref": "#/$defs/hash64" },
56
+ "preservedHeadCommit": { "$ref": "#/$defs/gitHash" },
57
+ "actor": { "type": "string", "minLength": 1 },
58
+ "reason": { "type": "string", "minLength": 1 },
59
+ "packageVersion": { "type": "string", "minLength": 1 },
60
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
61
+ "recordedAt": { "type": "string", "format": "date-time" },
62
+ "eventHash": { "$ref": "#/$defs/hash64" }
63
+ },
64
+ "$defs": {
65
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
66
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
67
+ "gitHash": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
68
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
69
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
70
+ }
71
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/downstream-proof-replan-recovery-event.schema.json",
4
+ "title": "Codex Workflow V2 Downstream Proof Replan Recovery Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "previousTaskRevision",
11
+ "resultTaskRevision",
12
+ "invalidationEventId",
13
+ "invalidationPlanHash",
14
+ "reboundPlanHash",
15
+ "knowledgeRebindRecordedAt",
16
+ "dirtyFiles",
17
+ "dirtyWorktreeHash",
18
+ "preservedHeadCommit",
19
+ "dependencyRecoveryCommit",
20
+ "actor",
21
+ "reason",
22
+ "packageVersion",
23
+ "previousEventHash",
24
+ "recordedAt",
25
+ "eventHash"
26
+ ],
27
+ "properties": {
28
+ "eventId": { "type": "string", "pattern": "^DPR-[0-9A-HJKMNP-TV-Z]{26}$" },
29
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
30
+ "previousTaskRevision": { "type": "integer", "minimum": 1 },
31
+ "resultTaskRevision": { "type": "integer", "minimum": 2 },
32
+ "invalidationEventId": { "type": "string", "pattern": "^DPI-[0-9A-HJKMNP-TV-Z]{26}$" },
33
+ "invalidationPlanHash": { "$ref": "#/$defs/hash64" },
34
+ "reboundPlanHash": { "$ref": "#/$defs/hash64" },
35
+ "knowledgeRebindRecordedAt": { "type": "string", "format": "date-time" },
36
+ "dirtyFiles": {
37
+ "type": "array",
38
+ "minItems": 1,
39
+ "uniqueItems": true,
40
+ "items": { "type": "string", "minLength": 1 }
41
+ },
42
+ "dirtyWorktreeHash": { "$ref": "#/$defs/hash64" },
43
+ "preservedHeadCommit": { "$ref": "#/$defs/gitHash" },
44
+ "dependencyRecoveryCommit": {
45
+ "anyOf": [
46
+ { "$ref": "#/$defs/gitHash" },
47
+ { "type": "null" }
48
+ ]
49
+ },
50
+ "actor": { "type": "string", "minLength": 1 },
51
+ "reason": { "type": "string", "minLength": 1 },
52
+ "packageVersion": { "type": "string", "minLength": 1 },
53
+ "previousEventHash": { "anyOf": [{ "$ref": "#/$defs/hash64" }, { "type": "null" }] },
54
+ "recordedAt": { "type": "string", "format": "date-time" },
55
+ "eventHash": { "$ref": "#/$defs/hash64" }
56
+ },
57
+ "$defs": {
58
+ "gitHash": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
59
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
60
+ }
61
+ }
@@ -32,8 +32,9 @@
32
32
  "after": { "$ref": "#/$defs/scopeSnapshot" },
33
33
  "actor": { "type": "string", "minLength": 1 },
34
34
  "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
35
- "authorizationMode": { "enum": ["human", "milestone-autonomy"] },
35
+ "authorizationMode": { "enum": ["human", "milestone-autonomy", "audited-remediation"] },
36
36
  "autonomyContractEventHash": { "$ref": "#/$defs/nullableHash64" },
37
+ "remediationEvidence": { "$ref": "#/$defs/remediationEvidence" },
37
38
  "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
38
39
  "recordedAt": { "type": "string", "format": "date-time" },
39
40
  "eventHash": { "$ref": "#/$defs/hash64" }
@@ -43,6 +44,29 @@
43
44
  "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
44
45
  "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
45
46
  "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
47
+ "remediationEvidence": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": [
51
+ "blockedTaskId", "blockedTaskRevision", "blockedBriefHash", "blockedPlanHash",
52
+ "planRiskAuditEventId", "planRiskAuditEventHash", "remediationTaskId", "predecessorTaskIds"
53
+ ],
54
+ "properties": {
55
+ "blockedTaskId": { "$ref": "#/$defs/taskId" },
56
+ "blockedTaskRevision": { "type": "integer", "minimum": 1 },
57
+ "blockedBriefHash": { "$ref": "#/$defs/hash64" },
58
+ "blockedPlanHash": { "$ref": "#/$defs/hash64" },
59
+ "planRiskAuditEventId": { "type": "string", "minLength": 1 },
60
+ "planRiskAuditEventHash": { "$ref": "#/$defs/hash64" },
61
+ "remediationTaskId": { "$ref": "#/$defs/taskId" },
62
+ "predecessorTaskIds": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "uniqueItems": true,
66
+ "items": { "$ref": "#/$defs/taskId" }
67
+ }
68
+ }
69
+ },
46
70
  "membership": {
47
71
  "type": "object",
48
72
  "additionalProperties": false,
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/stop-escalate-override-event.schema.json",
4
+ "title": "Codex Workflow V2 Stop-Escalate Override Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId", "taskId", "taskRevision", "stepId", "stopDecisionEventId",
9
+ "stopDecisionEventHash", "priorContinueDecisionEventId", "priorContinueDecisionEventHash",
10
+ "triggeringAttemptCount", "coveredEventIds", "planHash", "headCommit", "actor", "reason",
11
+ "packageVersion", "confirmationCodeBindingHash", "policy", "previousEventHash", "recordedAt", "eventHash"
12
+ ],
13
+ "properties": {
14
+ "eventId": { "type": "string", "pattern": "^SOO-[0-9A-HJKMNP-TV-Z]{26}$" },
15
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
16
+ "taskRevision": { "type": "integer", "minimum": 1 },
17
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
18
+ "stopDecisionEventId": { "type": "string", "pattern": "^CRD-[0-9A-HJKMNP-TV-Z]{26}$" },
19
+ "stopDecisionEventHash": { "$ref": "#/$defs/hash64" },
20
+ "priorContinueDecisionEventId": { "type": "string", "pattern": "^CRD-[0-9A-HJKMNP-TV-Z]{26}$" },
21
+ "priorContinueDecisionEventHash": { "$ref": "#/$defs/hash64" },
22
+ "triggeringAttemptCount": { "const": 4 },
23
+ "coveredEventIds": {
24
+ "type": "array",
25
+ "minItems": 3,
26
+ "maxItems": 3,
27
+ "uniqueItems": true,
28
+ "items": { "type": "string", "pattern": "^RME-[0-9A-HJKMNP-TV-Z]{26}$" }
29
+ },
30
+ "planHash": { "$ref": "#/$defs/hash64" },
31
+ "headCommit": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
32
+ "actor": { "type": "string", "minLength": 1 },
33
+ "reason": { "type": "string", "minLength": 1 },
34
+ "packageVersion": { "type": "string", "minLength": 1 },
35
+ "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
36
+ "policy": { "const": "beta11-attempt4-stop-compatibility-v1" },
37
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
38
+ "recordedAt": { "type": "string", "format": "date-time" },
39
+ "eventHash": { "$ref": "#/$defs/hash64" }
40
+ },
41
+ "$defs": {
42
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
43
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
44
+ }
45
+ }
@@ -55,6 +55,38 @@
55
55
  },
56
56
  "replacementForTaskId": { "type": ["string", "null"], "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
57
57
  "replacedByTaskId": { "type": ["string", "null"], "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
58
+ "invalidatedStepCommits": {
59
+ "type": "array",
60
+ "uniqueItems": true,
61
+ "items": { "type": "string", "pattern": "^[a-f0-9]{40}$" }
62
+ },
63
+ "historicalStepProvenanceRecoveries": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "object",
67
+ "required": [
68
+ "commitSha",
69
+ "actor",
70
+ "reason",
71
+ "recordedAt",
72
+ "sourceFinalAcceptanceRecordedAt",
73
+ "sourcePlanHash",
74
+ "sourceResultHash",
75
+ "sourceEvidenceHash"
76
+ ],
77
+ "properties": {
78
+ "commitSha": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
79
+ "actor": { "type": "string", "minLength": 1 },
80
+ "reason": { "type": "string", "minLength": 1 },
81
+ "recordedAt": { "type": "string", "format": "date-time" },
82
+ "sourceFinalAcceptanceRecordedAt": { "type": "string", "format": "date-time" },
83
+ "sourcePlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
84
+ "sourceResultHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
85
+ "sourceEvidenceHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
86
+ },
87
+ "additionalProperties": false
88
+ }
89
+ },
58
90
  "dependencyProvenanceRecoveries": {
59
91
  "type": "array",
60
92
  "items": {
@@ -73,6 +105,78 @@
73
105
  "type": "array",
74
106
  "uniqueItems": true,
75
107
  "items": { "type": "string", "pattern": "^[a-f0-9]{40}$" }
108
+ },
109
+ "activeDownstreamProof": {
110
+ "type": "object",
111
+ "required": ["activeStepId", "planHash", "dirtyFiles", "dirtyWorktreeHash", "invalidatedStepIds"],
112
+ "properties": {
113
+ "activeStepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
114
+ "planHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
115
+ "dirtyFiles": {
116
+ "type": "array",
117
+ "minItems": 1,
118
+ "uniqueItems": true,
119
+ "items": { "type": "string", "minLength": 1 }
120
+ },
121
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
122
+ "invalidatedStepIds": {
123
+ "type": "array",
124
+ "minItems": 1,
125
+ "uniqueItems": true,
126
+ "items": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" }
127
+ }
128
+ },
129
+ "additionalProperties": false
130
+ },
131
+ "downstreamProofReplan": {
132
+ "type": "object",
133
+ "required": [
134
+ "invalidationEventId",
135
+ "activeStepId",
136
+ "sourcePlanHash",
137
+ "reboundPlanHash",
138
+ "knowledgeRebindRecordedAt",
139
+ "dirtyFiles",
140
+ "dirtyWorktreeHash",
141
+ "invalidatedStepIds"
142
+ ],
143
+ "properties": {
144
+ "invalidationEventId": { "type": "string", "pattern": "^DPI-[0-9A-HJKMNP-TV-Z]{26}$" },
145
+ "activeStepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
146
+ "sourcePlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
147
+ "reboundPlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
148
+ "knowledgeRebindRecordedAt": { "type": "string", "format": "date-time" },
149
+ "dirtyFiles": {
150
+ "type": "array",
151
+ "minItems": 1,
152
+ "uniqueItems": true,
153
+ "items": { "type": "string", "minLength": 1 }
154
+ },
155
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
156
+ "invalidatedStepIds": {
157
+ "type": "array",
158
+ "minItems": 1,
159
+ "uniqueItems": true,
160
+ "items": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" }
161
+ }
162
+ },
163
+ "additionalProperties": false
164
+ },
165
+ "historicalStepProvenance": {
166
+ "type": "object",
167
+ "required": ["activeStepId", "planHash", "dirtyFiles", "dirtyWorktreeHash", "retainedCommitSha"],
168
+ "properties": {
169
+ "activeStepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
170
+ "planHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
171
+ "dirtyFiles": {
172
+ "type": "array",
173
+ "uniqueItems": true,
174
+ "items": { "type": "string", "minLength": 1 }
175
+ },
176
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
177
+ "retainedCommitSha": { "type": "string", "pattern": "^[a-f0-9]{40}$" }
178
+ },
179
+ "additionalProperties": false
76
180
  }
77
181
  },
78
182
  "additionalProperties": false
@@ -200,6 +200,14 @@ def styles() -> dict[str, ParagraphStyle]:
200
200
  leading=10.3,
201
201
  textColor=TEXT,
202
202
  ),
203
+ "table_header": ParagraphStyle(
204
+ "TableHeader",
205
+ parent=base["BodyText"],
206
+ fontName="WorkflowBold",
207
+ fontSize=7.7,
208
+ leading=10.3,
209
+ textColor=colors.white,
210
+ ),
203
211
  "code": ParagraphStyle(
204
212
  "Code",
205
213
  parent=base["BodyText"],
@@ -316,8 +324,11 @@ def markdown_story(lines: list[str], style: dict[str, ParagraphStyle]) -> list:
316
324
  column_count = max(len(row) for row in rows)
317
325
  normalized = [row + [""] * (column_count - len(row)) for row in rows]
318
326
  rendered = [
319
- [Paragraph(inline_markup(cell), style["small"]) for cell in row]
320
- for row in normalized
327
+ [
328
+ Paragraph(inline_markup(cell), style["table_header"] if row_index == 0 else style["small"])
329
+ for cell in row
330
+ ]
331
+ for row_index, row in enumerate(normalized)
321
332
  ]
322
333
  table = LongTable(rendered, colWidths=table_widths(column_count), repeatRows=1)
323
334
  table.setStyle(TableStyle([