codex-workflow-v2 2.0.0-alpha.4 → 2.0.0-alpha.6

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 (76) hide show
  1. package/README.md +86 -10
  2. package/dist/src/alpha6/adoption.d.ts +55 -0
  3. package/dist/src/alpha6/adoption.js +920 -0
  4. package/dist/src/alpha6/adoption.js.map +1 -0
  5. package/dist/src/alpha6/handoff.d.ts +39 -0
  6. package/dist/src/alpha6/handoff.js +975 -0
  7. package/dist/src/alpha6/handoff.js.map +1 -0
  8. package/dist/src/alpha6/journal.d.ts +30 -0
  9. package/dist/src/alpha6/journal.js +369 -0
  10. package/dist/src/alpha6/journal.js.map +1 -0
  11. package/dist/src/alpha6/milestone.d.ts +49 -0
  12. package/dist/src/alpha6/milestone.js +1049 -0
  13. package/dist/src/alpha6/milestone.js.map +1 -0
  14. package/dist/src/alpha6/plan-risk.d.ts +32 -0
  15. package/dist/src/alpha6/plan-risk.js +847 -0
  16. package/dist/src/alpha6/plan-risk.js.map +1 -0
  17. package/dist/src/alpha6/remediation.d.ts +20 -0
  18. package/dist/src/alpha6/remediation.js +748 -0
  19. package/dist/src/alpha6/remediation.js.map +1 -0
  20. package/dist/src/alpha6/review.d.ts +46 -0
  21. package/dist/src/alpha6/review.js +785 -0
  22. package/dist/src/alpha6/review.js.map +1 -0
  23. package/dist/src/alpha6/store-sidecars.d.ts +35 -0
  24. package/dist/src/alpha6/store-sidecars.js +281 -0
  25. package/dist/src/alpha6/store-sidecars.js.map +1 -0
  26. package/dist/src/cli.js +88 -19
  27. package/dist/src/cli.js.map +1 -1
  28. package/dist/src/contracts.d.ts +259 -0
  29. package/dist/src/git.js +2 -1
  30. package/dist/src/git.js.map +1 -1
  31. package/dist/src/index.d.ts +2 -0
  32. package/dist/src/reviewer.d.ts +6 -1
  33. package/dist/src/reviewer.js +145 -32
  34. package/dist/src/reviewer.js.map +1 -1
  35. package/dist/src/state/lock.d.ts +1 -0
  36. package/dist/src/state/lock.js +7 -1
  37. package/dist/src/state/lock.js.map +1 -1
  38. package/dist/src/state/store.d.ts +39 -1
  39. package/dist/src/state/store.js +127 -1
  40. package/dist/src/state/store.js.map +1 -1
  41. package/dist/src/version.d.ts +1 -1
  42. package/dist/src/version.js +1 -1
  43. package/dist/src/workflow.d.ts +78 -8
  44. package/dist/src/workflow.js +1312 -74
  45. package/dist/src/workflow.js.map +1 -1
  46. package/docs/autonomy-guardrails.md +143 -0
  47. package/docs/decisions.md +23 -0
  48. package/docs/delegated-approval.md +30 -5
  49. package/docs/development-flow.md +40 -1
  50. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +155 -136
  51. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +236 -223
  52. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +225 -206
  53. package/docs/project-memory.md +7 -0
  54. package/docs/release.md +7 -0
  55. package/docs/updating-existing-project.md +53 -5
  56. package/docs/validation-report.md +47 -34
  57. package/package.json +1 -1
  58. package/plugins/codex-workflow-gateway/references/protocol.md +150 -6
  59. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +16 -1
  60. package/references/git-policy.md +5 -2
  61. package/references/state-machine.md +36 -0
  62. package/references/validation-and-review.md +28 -1
  63. package/roles/delivery-coordinator.md +11 -0
  64. package/roles/independent-reviewer.md +3 -0
  65. package/roles/technical-planner.md +7 -0
  66. package/roles/worker.md +4 -0
  67. package/schemas/adoption-posture-event.schema.json +129 -0
  68. package/schemas/corrective-decision-event.schema.json +55 -0
  69. package/schemas/corrective-plan-audit.schema.json +20 -0
  70. package/schemas/milestone-scope-change-event.schema.json +68 -0
  71. package/schemas/milestone-transaction-journal.schema.json +95 -0
  72. package/schemas/plan-risk-audit-event.schema.json +90 -0
  73. package/schemas/remediation-event.schema.json +53 -0
  74. package/schemas/reviewer-attestation-event.schema.json +49 -0
  75. package/schemas/step-review-event.schema.json +74 -0
  76. package/schemas/task-handoff-event.schema.json +116 -0
@@ -0,0 +1,129 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/adoption-posture-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Adoption Posture Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "projectId",
10
+ "eventType",
11
+ "actor",
12
+ "packageVersion",
13
+ "protocolVersion",
14
+ "stateSchemaVersion",
15
+ "adoptionBoundaryAt",
16
+ "baselineDigestHash",
17
+ "sidecarBaselineHash",
18
+ "confirmationCodeBindingHash",
19
+ "repositoryIdentity",
20
+ "terminalMilestones",
21
+ "terminalTasks",
22
+ "activeTasks",
23
+ "previousEventHash",
24
+ "recordedAt",
25
+ "eventHash"
26
+ ],
27
+ "properties": {
28
+ "eventId": { "type": "string", "minLength": 1 },
29
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
30
+ "eventType": { "enum": ["project-registration", "adoption-apply"] },
31
+ "actor": { "type": ["string", "null"], "minLength": 1 },
32
+ "packageVersion": { "type": "string", "minLength": 1 },
33
+ "protocolVersion": { "const": 1 },
34
+ "stateSchemaVersion": { "const": 2 },
35
+ "adoptionBoundaryAt": { "type": "string", "format": "date-time" },
36
+ "baselineDigestHash": { "$ref": "#/$defs/hash64" },
37
+ "sidecarBaselineHash": { "$ref": "#/$defs/hash64" },
38
+ "confirmationCodeBindingHash": { "$ref": "#/$defs/nullableHash64" },
39
+ "repositoryIdentity": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["repositoryRoot", "gitCommonDir"],
43
+ "properties": {
44
+ "repositoryRoot": { "type": "string", "minLength": 1 },
45
+ "gitCommonDir": { "type": "string", "minLength": 1 }
46
+ }
47
+ },
48
+ "terminalMilestones": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": ["milestoneId", "revision", "status"],
54
+ "properties": {
55
+ "milestoneId": { "$ref": "#/$defs/milestoneId" },
56
+ "revision": { "type": "integer", "minimum": 1 },
57
+ "status": { "enum": ["accepted", "cancelled"] }
58
+ }
59
+ }
60
+ },
61
+ "terminalTasks": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["taskId", "revision", "status"],
67
+ "properties": {
68
+ "taskId": { "$ref": "#/$defs/taskId" },
69
+ "revision": { "type": "integer", "minimum": 1 },
70
+ "status": { "enum": ["merged", "cancelled"] }
71
+ }
72
+ }
73
+ },
74
+ "activeTasks": {
75
+ "type": "array",
76
+ "items": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["taskId", "taskRevision", "status", "completedSteps", "remainingStepIds"],
80
+ "properties": {
81
+ "taskId": { "$ref": "#/$defs/taskId" },
82
+ "taskRevision": { "type": "integer", "minimum": 1 },
83
+ "status": {
84
+ "enum": [
85
+ "planning",
86
+ "awaiting_execution_authorization",
87
+ "ready",
88
+ "in_progress",
89
+ "validating",
90
+ "needs_fix",
91
+ "awaiting_final_acceptance",
92
+ "merging",
93
+ "ready_to_merge",
94
+ "blocked"
95
+ ]
96
+ },
97
+ "completedSteps": {
98
+ "type": "array",
99
+ "items": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": ["stepId", "status", "evidenceHash"],
103
+ "properties": {
104
+ "stepId": { "$ref": "#/$defs/stepId" },
105
+ "status": { "enum": ["completed", "skipped"] },
106
+ "evidenceHash": { "$ref": "#/$defs/nullableHash64" }
107
+ }
108
+ }
109
+ },
110
+ "remainingStepIds": {
111
+ "type": "array",
112
+ "uniqueItems": true,
113
+ "items": { "$ref": "#/$defs/stepId" }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
119
+ "recordedAt": { "type": "string", "format": "date-time" },
120
+ "eventHash": { "$ref": "#/$defs/hash64" }
121
+ },
122
+ "$defs": {
123
+ "milestoneId": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
124
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
125
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
126
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
127
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
128
+ }
129
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/corrective-decision-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Corrective Decision Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "stepId",
11
+ "triggeringAttemptCount",
12
+ "decision",
13
+ "auditor",
14
+ "coveredFindingIds",
15
+ "coveredEventIds",
16
+ "planHash",
17
+ "previousEventHash",
18
+ "recordedAt",
19
+ "eventHash"
20
+ ],
21
+ "properties": {
22
+ "eventId": { "type": "string", "minLength": 1 },
23
+ "taskId": { "$ref": "#/$defs/taskId" },
24
+ "stepId": { "$ref": "#/$defs/stepId" },
25
+ "triggeringAttemptCount": { "type": "integer", "minimum": 3 },
26
+ "decision": {
27
+ "enum": ["continue-fix", "replan-required", "split-required", "stop-escalate"]
28
+ },
29
+ "auditor": { "type": "string", "minLength": 1 },
30
+ "coveredFindingIds": {
31
+ "type": "array",
32
+ "uniqueItems": true,
33
+ "items": { "type": "string", "minLength": 1 }
34
+ },
35
+ "coveredEventIds": {
36
+ "type": "array",
37
+ "uniqueItems": true,
38
+ "items": { "type": "string", "minLength": 1 }
39
+ },
40
+ "planHash": { "$ref": "#/$defs/hash64" },
41
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
42
+ "recordedAt": { "type": "string", "format": "date-time" },
43
+ "eventHash": { "$ref": "#/$defs/hash64" }
44
+ },
45
+ "anyOf": [
46
+ { "properties": { "coveredFindingIds": { "minItems": 1 } } },
47
+ { "properties": { "coveredEventIds": { "minItems": 1 } } }
48
+ ],
49
+ "$defs": {
50
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
51
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
52
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
53
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
54
+ }
55
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/corrective-plan-audit.schema.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["auditor", "summary", "decision", "reviewedFindingIds"],
7
+ "properties": {
8
+ "auditor": { "type": "string", "minLength": 1 },
9
+ "summary": { "type": "string", "minLength": 1 },
10
+ "decision": {
11
+ "enum": ["continue-fix", "replan-required", "split-required", "stop-escalate"]
12
+ },
13
+ "reviewedFindingIds": {
14
+ "type": "array",
15
+ "minItems": 1,
16
+ "uniqueItems": true,
17
+ "items": { "type": "string", "minLength": 1 }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/milestone-scope-change-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Milestone Scope Change Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "milestoneId",
10
+ "previousMilestoneRevision",
11
+ "previousPlanHash",
12
+ "previousMembershipRevision",
13
+ "candidatePlanHash",
14
+ "candidateMembershipRevision",
15
+ "before",
16
+ "after",
17
+ "actor",
18
+ "confirmationCodeBindingHash",
19
+ "previousEventHash",
20
+ "recordedAt",
21
+ "eventHash"
22
+ ],
23
+ "properties": {
24
+ "eventId": { "type": "string", "minLength": 1 },
25
+ "milestoneId": { "$ref": "#/$defs/milestoneId" },
26
+ "previousMilestoneRevision": { "type": "integer", "minimum": 1 },
27
+ "previousPlanHash": { "$ref": "#/$defs/nullableHash64" },
28
+ "previousMembershipRevision": { "type": "integer", "minimum": 0 },
29
+ "candidatePlanHash": { "$ref": "#/$defs/hash64" },
30
+ "candidateMembershipRevision": { "type": "integer", "minimum": 0 },
31
+ "before": { "$ref": "#/$defs/scopeSnapshot" },
32
+ "after": { "$ref": "#/$defs/scopeSnapshot" },
33
+ "actor": { "type": "string", "minLength": 1 },
34
+ "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
35
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
36
+ "recordedAt": { "type": "string", "format": "date-time" },
37
+ "eventHash": { "$ref": "#/$defs/hash64" }
38
+ },
39
+ "$defs": {
40
+ "milestoneId": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
41
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
42
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
43
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
44
+ "membership": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["taskId", "disposition", "reason"],
48
+ "properties": {
49
+ "taskId": { "$ref": "#/$defs/taskId" },
50
+ "disposition": { "enum": ["required", "waived", "cancelled"] },
51
+ "reason": { "type": "string" }
52
+ }
53
+ },
54
+ "scopeSnapshot": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["outcome", "successSignal", "acceptance", "checks", "taskIds", "memberships"],
58
+ "properties": {
59
+ "outcome": { "type": "string" },
60
+ "successSignal": { "type": "string" },
61
+ "acceptance": { "type": "array", "items": { "type": "string", "minLength": 1 } },
62
+ "checks": { "type": "array", "items": { "type": "string", "minLength": 1 } },
63
+ "taskIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/taskId" } },
64
+ "memberships": { "type": "array", "items": { "$ref": "#/$defs/membership" } }
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/milestone-transaction-journal.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Milestone Transaction Journal",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "transactionId",
9
+ "milestoneId",
10
+ "expectedMilestoneRevision",
11
+ "actor",
12
+ "confirmationCodeBindingHash",
13
+ "phase",
14
+ "targetFiles",
15
+ "preparedAt",
16
+ "updatedAt"
17
+ ],
18
+ "properties": {
19
+ "transactionId": { "type": "string", "minLength": 1 },
20
+ "milestoneId": { "$ref": "#/$defs/milestoneId" },
21
+ "expectedMilestoneRevision": { "type": "integer", "minimum": 1 },
22
+ "actor": { "type": "string", "minLength": 1 },
23
+ "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
24
+ "phase": { "enum": ["prepared", "applying", "applied", "rolled_back"] },
25
+ "targetFiles": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "items": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["path", "preimage", "staged"],
32
+ "properties": {
33
+ "path": { "type": "string", "minLength": 1 },
34
+ "preimage": { "$ref": "#/$defs/fileSnapshot" },
35
+ "staged": { "$ref": "#/$defs/fileSnapshot" }
36
+ }
37
+ }
38
+ },
39
+ "preparedAt": { "type": "string", "format": "date-time" },
40
+ "updatedAt": { "type": "string", "format": "date-time" }
41
+ },
42
+ "$defs": {
43
+ "milestoneId": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
44
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
45
+ "fileSnapshot": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["exists", "contentHash", "contentBase64", "contentPath"],
49
+ "properties": {
50
+ "exists": { "type": "boolean" },
51
+ "contentHash": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
52
+ "contentBase64": { "type": ["string", "null"], "minLength": 1 },
53
+ "contentPath": { "type": ["string", "null"], "minLength": 1 }
54
+ },
55
+ "allOf": [
56
+ {
57
+ "if": {
58
+ "properties": { "exists": { "const": true } },
59
+ "required": ["exists"]
60
+ },
61
+ "then": {
62
+ "properties": {
63
+ "contentHash": { "$ref": "#/$defs/hash64" }
64
+ },
65
+ "anyOf": [
66
+ {
67
+ "properties": {
68
+ "contentBase64": { "type": "string", "minLength": 1 }
69
+ }
70
+ },
71
+ {
72
+ "properties": {
73
+ "contentPath": { "type": "string", "minLength": 1 }
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "if": {
81
+ "properties": { "exists": { "const": false } },
82
+ "required": ["exists"]
83
+ },
84
+ "then": {
85
+ "properties": {
86
+ "contentHash": { "const": null },
87
+ "contentBase64": { "const": null },
88
+ "contentPath": { "const": null }
89
+ }
90
+ }
91
+ }
92
+ ]
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/plan-risk-audit-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Plan Risk Audit Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "taskRevision",
11
+ "briefHash",
12
+ "planHash",
13
+ "knowledgeMapRevision",
14
+ "knowledgeMapHash",
15
+ "planner",
16
+ "auditor",
17
+ "summary",
18
+ "decision",
19
+ "splitRationale",
20
+ "stepClassifications",
21
+ "previousEventHash",
22
+ "recordedAt",
23
+ "eventHash"
24
+ ],
25
+ "properties": {
26
+ "eventId": { "type": "string", "minLength": 1 },
27
+ "taskId": { "$ref": "#/$defs/taskId" },
28
+ "taskRevision": { "type": "integer", "minimum": 1 },
29
+ "briefHash": { "$ref": "#/$defs/hash64" },
30
+ "planHash": { "$ref": "#/$defs/hash64" },
31
+ "knowledgeMapRevision": { "type": "integer", "minimum": 1 },
32
+ "knowledgeMapHash": { "$ref": "#/$defs/hash64" },
33
+ "planner": { "type": "string", "minLength": 1 },
34
+ "auditor": { "type": "string", "minLength": 1 },
35
+ "summary": { "type": "string", "minLength": 1 },
36
+ "decision": { "enum": ["approved", "approved-with-rationale", "split-required", "stop-escalate"] },
37
+ "splitRationale": { "type": ["string", "null"], "minLength": 1 },
38
+ "stepClassifications": {
39
+ "type": "array",
40
+ "minItems": 1,
41
+ "items": { "$ref": "#/$defs/stepClassification" }
42
+ },
43
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
44
+ "recordedAt": { "type": "string", "format": "date-time" },
45
+ "eventHash": { "$ref": "#/$defs/hash64" }
46
+ },
47
+ "$defs": {
48
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
49
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
50
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
51
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
52
+ "guardedRiskCategory": {
53
+ "enum": ["migration", "concurrency", "restart-replay", "crash-window", "external-provider", "runtime-composition", "security-boundary", "auth-secrets", "irreversible-execution"]
54
+ },
55
+ "stepClassification": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["stepId", "categories", "reviewRequired", "failureModes", "requiredEvidence"],
59
+ "properties": {
60
+ "stepId": { "$ref": "#/$defs/stepId" },
61
+ "categories": {
62
+ "type": "array",
63
+ "uniqueItems": true,
64
+ "items": { "$ref": "#/$defs/guardedRiskCategory" }
65
+ },
66
+ "reviewRequired": { "type": "boolean" },
67
+ "failureModes": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
68
+ "requiredEvidence": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
69
+ },
70
+ "oneOf": [
71
+ {
72
+ "properties": {
73
+ "categories": { "maxItems": 0 },
74
+ "reviewRequired": { "const": false },
75
+ "failureModes": { "maxItems": 0 },
76
+ "requiredEvidence": { "maxItems": 0 }
77
+ }
78
+ },
79
+ {
80
+ "properties": {
81
+ "categories": { "minItems": 1 },
82
+ "reviewRequired": { "const": true },
83
+ "failureModes": { "minItems": 1 },
84
+ "requiredEvidence": { "minItems": 1 }
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/remediation-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Remediation Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "stepId",
11
+ "guardedCategory",
12
+ "failureKind",
13
+ "failureEvidence",
14
+ "attemptOrdinal",
15
+ "mode",
16
+ "previousEventHash",
17
+ "recordedAt",
18
+ "eventHash"
19
+ ],
20
+ "properties": {
21
+ "eventId": { "type": "string", "minLength": 1 },
22
+ "taskId": { "$ref": "#/$defs/taskId" },
23
+ "stepId": { "$ref": "#/$defs/stepId" },
24
+ "guardedCategory": { "$ref": "#/$defs/guardedRiskCategory" },
25
+ "failureKind": { "enum": ["checks-failed", "review-failed", "review-unverified"] },
26
+ "failureEvidence": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["completionCommit", "checksHash", "reviewEventHash", "reviewerAttestationHash"],
30
+ "properties": {
31
+ "completionCommit": { "$ref": "#/$defs/gitHash" },
32
+ "checksHash": { "$ref": "#/$defs/hash64" },
33
+ "reviewEventHash": { "$ref": "#/$defs/nullableHash64" },
34
+ "reviewerAttestationHash": { "$ref": "#/$defs/nullableHash64" }
35
+ }
36
+ },
37
+ "attemptOrdinal": { "type": "integer", "minimum": 1 },
38
+ "mode": { "enum": ["ordinary", "corrective"] },
39
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
40
+ "recordedAt": { "type": "string", "format": "date-time" },
41
+ "eventHash": { "$ref": "#/$defs/hash64" }
42
+ },
43
+ "$defs": {
44
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
45
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
46
+ "guardedRiskCategory": {
47
+ "enum": ["migration", "concurrency", "restart-replay", "crash-window", "external-provider"]
48
+ },
49
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
50
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
51
+ "gitHash": { "type": "string", "pattern": "^[a-f0-9]{40,64}$" }
52
+ }
53
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/reviewer-attestation-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Reviewer Attestation Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "stepId",
11
+ "reviewer",
12
+ "isolationResult",
13
+ "outputHash",
14
+ "reviewedCommit",
15
+ "reviewEventHash",
16
+ "planHash",
17
+ "evidenceHash",
18
+ "previousEventHash",
19
+ "recordedAt",
20
+ "eventHash"
21
+ ],
22
+ "properties": {
23
+ "eventId": { "type": "string", "minLength": 1 },
24
+ "taskId": { "$ref": "#/$defs/taskId" },
25
+ "stepId": {
26
+ "oneOf": [
27
+ { "$ref": "#/$defs/stepId" },
28
+ { "const": "TASK_FINAL" }
29
+ ]
30
+ },
31
+ "reviewer": { "type": "string", "minLength": 1 },
32
+ "isolationResult": { "enum": ["verified", "unverified"] },
33
+ "outputHash": { "$ref": "#/$defs/hash64" },
34
+ "reviewedCommit": { "$ref": "#/$defs/gitHash" },
35
+ "reviewEventHash": { "$ref": "#/$defs/hash64" },
36
+ "planHash": { "$ref": "#/$defs/hash64" },
37
+ "evidenceHash": { "$ref": "#/$defs/nullableHash64" },
38
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
39
+ "recordedAt": { "type": "string", "format": "date-time" },
40
+ "eventHash": { "$ref": "#/$defs/hash64" }
41
+ },
42
+ "$defs": {
43
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
44
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
45
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
46
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
47
+ "gitHash": { "type": "string", "pattern": "^[a-f0-9]{40,64}$" }
48
+ }
49
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/step-review-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Step Review Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "taskId",
10
+ "taskRevision",
11
+ "stepId",
12
+ "stepDefinitionHash",
13
+ "completionCommit",
14
+ "checksHash",
15
+ "planHash",
16
+ "evidenceHash",
17
+ "eventType",
18
+ "decision",
19
+ "reviewerAttestationHash",
20
+ "previousEventHash",
21
+ "recordedAt",
22
+ "eventHash"
23
+ ],
24
+ "properties": {
25
+ "eventId": { "type": "string", "minLength": 1 },
26
+ "taskId": { "$ref": "#/$defs/taskId" },
27
+ "taskRevision": { "type": "integer", "minimum": 1 },
28
+ "stepId": { "$ref": "#/$defs/stepId" },
29
+ "stepDefinitionHash": { "$ref": "#/$defs/hash64" },
30
+ "completionCommit": { "$ref": "#/$defs/gitHash" },
31
+ "checksHash": { "$ref": "#/$defs/hash64" },
32
+ "planHash": { "$ref": "#/$defs/hash64" },
33
+ "evidenceHash": { "$ref": "#/$defs/nullableHash64" },
34
+ "eventType": { "enum": ["pending", "review-recorded", "attestation-verified"] },
35
+ "decision": { "enum": ["pending", "passed", "failed", "unverified"] },
36
+ "reviewerAttestationHash": { "$ref": "#/$defs/nullableHash64" },
37
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
38
+ "recordedAt": { "type": "string", "format": "date-time" },
39
+ "eventHash": { "$ref": "#/$defs/hash64" }
40
+ },
41
+ "allOf": [
42
+ {
43
+ "if": {
44
+ "properties": { "eventType": { "const": "pending" } },
45
+ "required": ["eventType"]
46
+ },
47
+ "then": {
48
+ "properties": {
49
+ "decision": { "const": "pending" },
50
+ "reviewerAttestationHash": { "const": null }
51
+ }
52
+ }
53
+ },
54
+ {
55
+ "if": {
56
+ "properties": { "eventType": { "const": "attestation-verified" } },
57
+ "required": ["eventType"]
58
+ },
59
+ "then": {
60
+ "properties": {
61
+ "decision": { "enum": ["passed", "failed", "unverified"] },
62
+ "reviewerAttestationHash": { "$ref": "#/$defs/hash64" }
63
+ }
64
+ }
65
+ }
66
+ ],
67
+ "$defs": {
68
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
69
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
70
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
71
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
72
+ "gitHash": { "type": "string", "pattern": "^[a-f0-9]{40,64}$" }
73
+ }
74
+ }