codex-workflow-v2 2.0.0-alpha.3 → 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 (85) hide show
  1. package/README.md +104 -7
  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 +110 -23
  27. package/dist/src/cli.js.map +1 -1
  28. package/dist/src/contracts.d.ts +319 -1
  29. package/dist/src/delegation.d.ts +8 -0
  30. package/dist/src/delegation.js +155 -0
  31. package/dist/src/delegation.js.map +1 -0
  32. package/dist/src/git.js +2 -1
  33. package/dist/src/git.js.map +1 -1
  34. package/dist/src/index.d.ts +3 -0
  35. package/dist/src/index.js +1 -0
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/reviewer.d.ts +6 -1
  38. package/dist/src/reviewer.js +145 -32
  39. package/dist/src/reviewer.js.map +1 -1
  40. package/dist/src/state/lock.d.ts +1 -0
  41. package/dist/src/state/lock.js +7 -1
  42. package/dist/src/state/lock.js.map +1 -1
  43. package/dist/src/state/store.d.ts +43 -1
  44. package/dist/src/state/store.js +140 -1
  45. package/dist/src/state/store.js.map +1 -1
  46. package/dist/src/ulid.d.ts +1 -1
  47. package/dist/src/ulid.js.map +1 -1
  48. package/dist/src/version.d.ts +1 -1
  49. package/dist/src/version.js +1 -1
  50. package/dist/src/workflow.d.ts +91 -13
  51. package/dist/src/workflow.js +1459 -76
  52. package/dist/src/workflow.js.map +1 -1
  53. package/docs/autonomy-guardrails.md +143 -0
  54. package/docs/decisions.md +30 -0
  55. package/docs/delegated-approval.md +189 -0
  56. package/docs/development-flow.md +53 -2
  57. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +426 -410
  58. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +778 -612
  59. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +526 -452
  60. package/docs/project-memory.md +7 -0
  61. package/docs/release.md +7 -0
  62. package/docs/updating-existing-project.md +141 -4
  63. package/docs/validation-report.md +47 -24
  64. package/package.json +1 -1
  65. package/plugins/codex-workflow-gateway/references/protocol.md +162 -5
  66. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +38 -3
  67. package/references/git-policy.md +5 -2
  68. package/references/state-machine.md +48 -0
  69. package/references/validation-and-review.md +28 -1
  70. package/roles/delivery-coordinator.md +11 -0
  71. package/roles/independent-reviewer.md +3 -0
  72. package/roles/technical-planner.md +7 -0
  73. package/roles/worker.md +4 -0
  74. package/schemas/adoption-posture-event.schema.json +129 -0
  75. package/schemas/authorization-event.schema.json +55 -0
  76. package/schemas/corrective-decision-event.schema.json +55 -0
  77. package/schemas/corrective-plan-audit.schema.json +20 -0
  78. package/schemas/delegation-grant.schema.json +69 -0
  79. package/schemas/milestone-scope-change-event.schema.json +68 -0
  80. package/schemas/milestone-transaction-journal.schema.json +95 -0
  81. package/schemas/plan-risk-audit-event.schema.json +90 -0
  82. package/schemas/remediation-event.schema.json +53 -0
  83. package/schemas/reviewer-attestation-event.schema.json +49 -0
  84. package/schemas/step-review-event.schema.json +74 -0
  85. package/schemas/task-handoff-event.schema.json +116 -0
@@ -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
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/task-handoff-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.6 Task Handoff Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "handoffId",
10
+ "taskId",
11
+ "taskRevision",
12
+ "milestoneId",
13
+ "milestoneDisplayNumber",
14
+ "taskDisplayNumber",
15
+ "briefHash",
16
+ "planHash",
17
+ "knowledgeMapRevision",
18
+ "knowledgeMapHash",
19
+ "expectedNext",
20
+ "delegate",
21
+ "grantId",
22
+ "claimTokenHash",
23
+ "expiresAt",
24
+ "eventType",
25
+ "coordinationLevel",
26
+ "actor",
27
+ "targetActor",
28
+ "machineEvidence",
29
+ "writerLeaseTokenHash",
30
+ "reason",
31
+ "handback",
32
+ "previousEventHash",
33
+ "recordedAt",
34
+ "eventHash"
35
+ ],
36
+ "properties": {
37
+ "eventId": { "type": "string", "minLength": 1 },
38
+ "handoffId": { "type": "string", "pattern": "^THO-[0-9A-HJKMNP-TV-Z]{26}$" },
39
+ "taskId": { "$ref": "#/$defs/taskId" },
40
+ "taskRevision": { "type": "integer", "minimum": 1 },
41
+ "milestoneId": { "type": ["string", "null"], "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
42
+ "milestoneDisplayNumber": { "type": ["integer", "null"], "minimum": 1 },
43
+ "taskDisplayNumber": { "type": ["integer", "null"], "minimum": 1 },
44
+ "briefHash": { "$ref": "#/$defs/hash64" },
45
+ "planHash": { "$ref": "#/$defs/nullableHash64" },
46
+ "knowledgeMapRevision": { "type": ["integer", "null"], "minimum": 1 },
47
+ "knowledgeMapHash": { "$ref": "#/$defs/nullableHash64" },
48
+ "expectedNext": { "type": "string", "minLength": 1 },
49
+ "delegate": { "type": "string", "minLength": 1 },
50
+ "grantId": { "type": ["string", "null"], "minLength": 1 },
51
+ "claimTokenHash": { "$ref": "#/$defs/hash64" },
52
+ "expiresAt": { "type": "string", "format": "date-time" },
53
+ "eventType": { "enum": ["handoff", "claim", "handback"] },
54
+ "coordinationLevel": { "const": "C1" },
55
+ "actor": { "type": "string", "minLength": 1 },
56
+ "targetActor": { "type": ["string", "null"], "minLength": 1 },
57
+ "machineEvidence": {
58
+ "type": "object",
59
+ "additionalProperties": false,
60
+ "required": ["hostname", "pid", "platform", "arch", "nodeVersion"],
61
+ "properties": {
62
+ "hostname": { "type": "string", "minLength": 1 },
63
+ "pid": { "type": "integer", "minimum": 1 },
64
+ "platform": { "type": "string", "minLength": 1 },
65
+ "arch": { "type": "string", "minLength": 1 },
66
+ "nodeVersion": { "type": "string", "minLength": 1 }
67
+ }
68
+ },
69
+ "writerLeaseTokenHash": { "$ref": "#/$defs/nullableHash64" },
70
+ "reason": { "type": "string", "minLength": 1 },
71
+ "handback": {
72
+ "oneOf": [
73
+ { "type": "null" },
74
+ { "$ref": "#/$defs/handback" }
75
+ ]
76
+ },
77
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
78
+ "recordedAt": { "type": "string", "format": "date-time" },
79
+ "eventHash": { "$ref": "#/$defs/hash64" }
80
+ },
81
+ "allOf": [
82
+ {
83
+ "if": {
84
+ "properties": { "eventType": { "const": "handoff" } },
85
+ "required": ["eventType"]
86
+ },
87
+ "then": {
88
+ "properties": {
89
+ "targetActor": { "type": "string", "minLength": 1 }
90
+ }
91
+ }
92
+ }
93
+ ],
94
+ "$defs": {
95
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
96
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
97
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
98
+ ,"handback": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["status", "mergedCommit", "planHash", "resultHash", "evidenceHash", "reviewAttestationHash", "knowledgeMapRevision", "knowledgeMapHash", "limitations", "recommendedNext"],
102
+ "properties": {
103
+ "status": { "enum": ["merged", "cancelled"] },
104
+ "mergedCommit": { "type": ["string", "null"], "pattern": "^[a-f0-9]{40,64}$" },
105
+ "planHash": { "$ref": "#/$defs/nullableHash64" },
106
+ "resultHash": { "$ref": "#/$defs/nullableHash64" },
107
+ "evidenceHash": { "$ref": "#/$defs/nullableHash64" },
108
+ "reviewAttestationHash": { "$ref": "#/$defs/nullableHash64" },
109
+ "knowledgeMapRevision": { "type": ["integer", "null"], "minimum": 1 },
110
+ "knowledgeMapHash": { "$ref": "#/$defs/nullableHash64" },
111
+ "limitations": { "type": "array", "items": { "type": "string" } },
112
+ "recommendedNext": { "type": "string", "minLength": 1 }
113
+ }
114
+ }
115
+ }
116
+ }