codex-workflow-v2 2.0.0-beta.2 → 2.0.0-beta.4

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 (128) hide show
  1. package/README.md +35 -2
  2. package/dist/src/alpha6/adoption.js +13 -3
  3. package/dist/src/alpha6/adoption.js.map +1 -1
  4. package/dist/src/alpha6/handoff.d.ts +21 -0
  5. package/dist/src/alpha6/handoff.js +100 -19
  6. package/dist/src/alpha6/handoff.js.map +1 -1
  7. package/dist/src/alpha6/milestone.d.ts +2 -0
  8. package/dist/src/alpha6/milestone.js +15 -0
  9. package/dist/src/alpha6/milestone.js.map +1 -1
  10. package/dist/src/alpha6/plan-risk.d.ts +1 -0
  11. package/dist/src/alpha6/plan-risk.js +6 -0
  12. package/dist/src/alpha6/plan-risk.js.map +1 -1
  13. package/dist/src/cli.js +188 -65
  14. package/dist/src/cli.js.map +1 -1
  15. package/dist/src/contracts.d.ts +111 -5
  16. package/dist/src/contracts.js +1 -1
  17. package/dist/src/credential-output.d.ts +10 -0
  18. package/dist/src/credential-output.js +73 -0
  19. package/dist/src/credential-output.js.map +1 -0
  20. package/dist/src/errors.d.ts +1 -1
  21. package/dist/src/errors.js.map +1 -1
  22. package/dist/src/index.d.ts +1 -1
  23. package/dist/src/index.js +1 -1
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/lifecycle/canonical-hash.d.ts +6 -0
  26. package/dist/src/lifecycle/canonical-hash.js +24 -0
  27. package/dist/src/lifecycle/canonical-hash.js.map +1 -0
  28. package/dist/src/lifecycle/catalog.d.ts +26 -0
  29. package/dist/src/lifecycle/catalog.js +208 -0
  30. package/dist/src/lifecycle/catalog.js.map +1 -0
  31. package/dist/src/lifecycle/compiler-inspection.d.ts +48 -0
  32. package/dist/src/lifecycle/compiler-inspection.js +29 -0
  33. package/dist/src/lifecycle/compiler-inspection.js.map +1 -0
  34. package/dist/src/lifecycle/core-static-readiness.d.ts +6 -0
  35. package/dist/src/lifecycle/core-static-readiness.js +130 -0
  36. package/dist/src/lifecycle/core-static-readiness.js.map +1 -0
  37. package/dist/src/lifecycle/corrective-replan-authority.d.ts +53 -0
  38. package/dist/src/lifecycle/corrective-replan-authority.js +139 -0
  39. package/dist/src/lifecycle/corrective-replan-authority.js.map +1 -0
  40. package/dist/src/lifecycle/corrective-replan-binding-manifest.d.ts +21 -0
  41. package/dist/src/lifecycle/corrective-replan-binding-manifest.js +35 -0
  42. package/dist/src/lifecycle/corrective-replan-binding-manifest.js.map +1 -0
  43. package/dist/src/lifecycle/corrective-replan-credential-core.d.ts +86 -0
  44. package/dist/src/lifecycle/corrective-replan-credential-core.js +534 -0
  45. package/dist/src/lifecycle/corrective-replan-credential-core.js.map +1 -0
  46. package/dist/src/lifecycle/corrective-replan-credential-schema.d.ts +17 -0
  47. package/dist/src/lifecycle/corrective-replan-credential-schema.js +44 -0
  48. package/dist/src/lifecycle/corrective-replan-credential-schema.js.map +1 -0
  49. package/dist/src/lifecycle/corrective-replan-credentials.d.ts +47 -0
  50. package/dist/src/lifecycle/corrective-replan-credentials.js +103 -0
  51. package/dist/src/lifecycle/corrective-replan-credentials.js.map +1 -0
  52. package/dist/src/lifecycle/corrective-replan.d.ts +64 -0
  53. package/dist/src/lifecycle/corrective-replan.js +548 -0
  54. package/dist/src/lifecycle/corrective-replan.js.map +1 -0
  55. package/dist/src/lifecycle/evaluator.d.ts +2 -0
  56. package/dist/src/lifecycle/evaluator.js +35 -0
  57. package/dist/src/lifecycle/evaluator.js.map +1 -0
  58. package/dist/src/lifecycle/fingerprint.d.ts +31 -0
  59. package/dist/src/lifecycle/fingerprint.js +388 -0
  60. package/dist/src/lifecycle/fingerprint.js.map +1 -0
  61. package/dist/src/lifecycle/immutable.d.ts +1 -0
  62. package/dist/src/lifecycle/immutable.js +10 -0
  63. package/dist/src/lifecycle/immutable.js.map +1 -0
  64. package/dist/src/lifecycle/implementation-table.d.ts +29 -0
  65. package/dist/src/lifecycle/implementation-table.js +87 -0
  66. package/dist/src/lifecycle/implementation-table.js.map +1 -0
  67. package/dist/src/lifecycle/index.d.ts +4 -0
  68. package/dist/src/lifecycle/index.js +5 -0
  69. package/dist/src/lifecycle/index.js.map +1 -0
  70. package/dist/src/lifecycle/schema-artifact.d.ts +12 -0
  71. package/dist/src/lifecycle/schema-artifact.js +214 -0
  72. package/dist/src/lifecycle/schema-artifact.js.map +1 -0
  73. package/dist/src/lifecycle/semantic-registry.d.ts +6 -0
  74. package/dist/src/lifecycle/semantic-registry.js +489 -0
  75. package/dist/src/lifecycle/semantic-registry.js.map +1 -0
  76. package/dist/src/lifecycle/types.d.ts +718 -0
  77. package/dist/src/lifecycle/types.js +4 -0
  78. package/dist/src/lifecycle/types.js.map +1 -0
  79. package/dist/src/observation.d.ts +20 -0
  80. package/dist/src/observation.js +171 -0
  81. package/dist/src/observation.js.map +1 -0
  82. package/dist/src/state/corrective-replan-executor.d.ts +64 -0
  83. package/dist/src/state/corrective-replan-executor.js +598 -0
  84. package/dist/src/state/corrective-replan-executor.js.map +1 -0
  85. package/dist/src/state/corrective-replan-public-schema.d.ts +3 -0
  86. package/dist/src/state/corrective-replan-public-schema.js +43 -0
  87. package/dist/src/state/corrective-replan-public-schema.js.map +1 -0
  88. package/dist/src/state/corrective-replan-public.d.ts +95 -0
  89. package/dist/src/state/corrective-replan-public.js +618 -0
  90. package/dist/src/state/corrective-replan-public.js.map +1 -0
  91. package/dist/src/state/corrective-replan-transaction.d.ts +158 -0
  92. package/dist/src/state/corrective-replan-transaction.js +723 -0
  93. package/dist/src/state/corrective-replan-transaction.js.map +1 -0
  94. package/dist/src/state/corrective-yield-executor.d.ts +31 -0
  95. package/dist/src/state/corrective-yield-executor.js +236 -0
  96. package/dist/src/state/corrective-yield-executor.js.map +1 -0
  97. package/dist/src/state/corrective-yield-transaction.d.ts +97 -0
  98. package/dist/src/state/corrective-yield-transaction.js +591 -0
  99. package/dist/src/state/corrective-yield-transaction.js.map +1 -0
  100. package/dist/src/state/lock.d.ts +75 -3
  101. package/dist/src/state/lock.js +582 -30
  102. package/dist/src/state/lock.js.map +1 -1
  103. package/dist/src/state/store.d.ts +3 -0
  104. package/dist/src/state/store.js +65 -12
  105. package/dist/src/state/store.js.map +1 -1
  106. package/dist/src/transition-core.d.ts +67 -0
  107. package/dist/src/transition-core.js +318 -0
  108. package/dist/src/transition-core.js.map +1 -0
  109. package/dist/src/version.d.ts +1 -1
  110. package/dist/src/version.js +1 -1
  111. package/dist/src/workflow.d.ts +34 -22
  112. package/dist/src/workflow.js +486 -141
  113. package/dist/src/workflow.js.map +1 -1
  114. package/docs/lifecycle/state-machine-stabilization.md +641 -0
  115. package/docs/release.md +4 -2
  116. package/docs/updating-existing-project.md +9 -0
  117. package/package.json +4 -1
  118. package/schemas/adoption-posture-event.schema.json +1 -1
  119. package/schemas/context-envelope.schema.json +1 -1
  120. package/schemas/corrective-replan-credentials.private.schema.json +98 -0
  121. package/schemas/corrective-replan-execution-event.private.schema.json +53 -0
  122. package/schemas/corrective-replan-public.schema.json +142 -0
  123. package/schemas/corrective-replan-task-transaction.private.schema.json +151 -0
  124. package/schemas/corrective-yield-task-transaction.private.schema.json +98 -0
  125. package/schemas/remediation-event.schema.json +11 -1
  126. package/schemas/task-handoff-event.schema.json +1 -1
  127. package/schemas/transition-definition.schema.json +2609 -0
  128. package/schemas/transition-payloads.schema.json +140 -0
package/docs/release.md CHANGED
@@ -22,10 +22,10 @@ The downstream smoke packs the actual tarball, installs it into an empty tempora
22
22
  runs the packaged CLI handshake, and proves installation created none of `.codex`, `.tasks`,
23
23
  `.increments`, or `.memory-bank` in that project.
24
24
 
25
- For beta.2, the release gate also relies on `npm run release:check` to fail if:
25
+ For beta.4, the release gate also relies on `npm run release:check` to fail if:
26
26
 
27
27
  - canonical entity schema 2 shapes drift;
28
- - protocol 1 compatibility is no longer additive;
28
+ - protocol 2 is not the active public contract, or intact protocol-1 adoption evidence stops being readable through the bounded compatibility window;
29
29
  - the delegated transition allow-list expands;
30
30
  - schema-2 adoption is presented as `state migrate` instead of posture sidecars;
31
31
  - alpha.7 rescue, Milestone autonomy (including guarded content refresh), derived actor, or
@@ -33,6 +33,8 @@ For beta.2, the release gate also relies on `npm run release:check` to fail if:
33
33
  - terminal Task replacement, project-level transaction recovery, secret-safe lock diagnostics,
34
34
  version/base diagnostics, or serialized maintainer validation are missing.
35
35
  - truthful initial-assembly navigation capability is absent from the packaged surface.
36
+ - corrective-yield/replan protocol-v2 commands, closed schemas, Human gate, retained journals,
37
+ explicit recovery, or dual-readback capabilities are absent from the packaged surface.
36
38
 
37
39
  The separate lifecycle transcript validator fails if the real-agent log contains a mutation that
38
40
  bypasses failed `status`/`next`, an unadvertised or failed mutation, an unresolved syntax-only
@@ -80,6 +80,15 @@ plugin за пределами workspace. Это ожидаемая границ
80
80
  8. `update preflight` до изменения подтвердил чистую lifecycle-границу.
81
81
  9. Для alpha.6 существующий schema 2 проект либо уже имеет `adoption-posture.jsonl`,
82
82
  либо `next`/`status` требуют `state adoption-prepare` и затем `state adoption-apply`.
83
+ 10. При переходе с protocol v1 на v2 неизменённый и криптографически целостный adoption sidecar
84
+ остаётся читаемым как legacy evidence. Runtime не переписывает его автоматически; неизвестная
85
+ версия или смешанная protocol-цепочка считаются повреждением state.
86
+
87
+ Protocol v2 меняет navigation/CLI corrective-replan и lifecycle epoch, но не Task state schema.
88
+ До обновления не должно быть `in_progress` Step, writer lease, Core Task operation mutex или
89
+ незавершённого corrective Task journal. Такие состояния требуют штатного completion/repair старой
90
+ версией; переносить или удалять journal вручную нельзя. Старые grants/receipts не получают authority
91
+ в epoch 2 — новый corrective replan всегда проходит новый prepare/human-gate/execute цикл.
83
92
 
84
93
  Изменение `projectId`, исчезновение сущностей или ошибка unsupported state schema — причина
85
94
  остановиться. Не соглашайтесь на «починку» удалением state. Агент должен вернуть dependency к
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-workflow-v2",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "Requirements-first Codex development workflow with local state and explicit Git ownership.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,6 +48,9 @@
48
48
  "release:check": "node scripts/release-check.mjs",
49
49
  "publish:release": "node scripts/publish.mjs"
50
50
  },
51
+ "dependencies": {
52
+ "ajv": "8.20.0"
53
+ },
51
54
  "devDependencies": {
52
55
  "@types/node": "24.10.1",
53
56
  "typescript": "5.9.3"
@@ -30,7 +30,7 @@
30
30
  "eventType": { "enum": ["project-registration", "adoption-apply"] },
31
31
  "actor": { "type": ["string", "null"], "minLength": 1 },
32
32
  "packageVersion": { "type": "string", "minLength": 1 },
33
- "protocolVersion": { "const": 1 },
33
+ "protocolVersion": { "enum": [1, 2] },
34
34
  "stateSchemaVersion": { "const": 2 },
35
35
  "adoptionBoundaryAt": { "type": "string", "format": "date-time" },
36
36
  "baselineDigestHash": { "$ref": "#/$defs/hash64" },
@@ -25,7 +25,7 @@
25
25
  "knowledgeSources"
26
26
  ],
27
27
  "properties": {
28
- "protocolVersion": { "const": 1 },
28
+ "protocolVersion": { "const": 2 },
29
29
  "packageVersion": { "type": "string" },
30
30
  "role": {
31
31
  "enum": ["scope-lead", "technical-planner", "delivery-coordinator", "worker", "independent-reviewer"]
@@ -0,0 +1,98 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "codex-workflow://schemas/private/corrective-replan-credentials/v1",
4
+ "$defs": {
5
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
6
+ "id": { "type": "string", "minLength": 1, "maxLength": 256 },
7
+ "time": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
8
+ "ref": {
9
+ "type": "object", "additionalProperties": false,
10
+ "required": ["id", "version"],
11
+ "properties": { "id": { "$ref": "#/$defs/id" }, "version": { "const": 1 } }
12
+ },
13
+ "bindingValues": {
14
+ "type": "object", "additionalProperties": false,
15
+ "required": ["transitionId", "runtimeFingerprint", "catalogHash", "lifecycleEpoch", "taskId", "revision", "currentPlanHash", "briefHash", "knowledgeRevision", "knowledgeHash", "gitHead", "guardedStepId", "correctiveDecisionEventId", "correctiveDecisionHash", "attemptCount", "remediationTailHash", "candidatePlanHash", "candidateStepSetHash", "planAuthorIdentityHash", "planValidationHash", "planValidatorIdentityHash", "riskAuditHash", "riskAuditorIdentityHash", "actorIdentityHash", "actorRole", "humanPrincipalIdentityHash", "capabilityId", "capabilityVersion"],
16
+ "properties": {
17
+ "transitionId": { "const": "task.plan.corrective-replan" },
18
+ "runtimeFingerprint": { "$ref": "#/$defs/hash" }, "catalogHash": { "$ref": "#/$defs/hash" },
19
+ "lifecycleEpoch": { "const": 2 }, "taskId": { "$ref": "#/$defs/id" },
20
+ "revision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "currentPlanHash": { "$ref": "#/$defs/hash" },
21
+ "briefHash": { "$ref": "#/$defs/hash" }, "knowledgeRevision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
22
+ "knowledgeHash": { "$ref": "#/$defs/hash" }, "gitHead": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
23
+ "guardedStepId": { "$ref": "#/$defs/id" }, "correctiveDecisionEventId": { "$ref": "#/$defs/id" },
24
+ "correctiveDecisionHash": { "$ref": "#/$defs/hash" }, "attemptCount": { "type": "integer", "minimum": 2, "maximum": 9007199254740991 },
25
+ "remediationTailHash": { "$ref": "#/$defs/hash" }, "candidatePlanHash": { "$ref": "#/$defs/hash" },
26
+ "candidateStepSetHash": { "$ref": "#/$defs/hash" }, "planAuthorIdentityHash": { "$ref": "#/$defs/hash" },
27
+ "planValidationHash": { "$ref": "#/$defs/hash" }, "planValidatorIdentityHash": { "$ref": "#/$defs/hash" },
28
+ "riskAuditHash": { "$ref": "#/$defs/hash" }, "riskAuditorIdentityHash": { "$ref": "#/$defs/hash" },
29
+ "actorIdentityHash": { "$ref": "#/$defs/hash" }, "actorRole": { "enum": ["delivery-coordinator", "technical-planner"] },
30
+ "humanPrincipalIdentityHash": { "$ref": "#/$defs/hash" }, "capabilityId": { "const": "capability.task.corrective-replan" },
31
+ "capabilityVersion": { "const": 1 }
32
+ }
33
+ },
34
+ "correctiveReplanBindingV1": {
35
+ "type": "object", "additionalProperties": false,
36
+ "required": ["schemaVersion", "manifestRef", "manifestSha256", "values", "capability", "bindingSha256"],
37
+ "properties": {
38
+ "schemaVersion": { "const": 1 },
39
+ "manifestRef": { "$ref": "#/$defs/ref" }, "manifestSha256": { "$ref": "#/$defs/hash" },
40
+ "values": { "$ref": "#/$defs/bindingValues" },
41
+ "capability": {
42
+ "type": "object", "additionalProperties": false,
43
+ "required": ["id", "version", "issuer", "source", "scope", "delegation"],
44
+ "properties": {
45
+ "id": { "const": "capability.task.corrective-replan" }, "version": { "const": 1 },
46
+ "issuer": { "type": "object", "additionalProperties": false, "required": ["kind", "identityHash"], "properties": { "kind": { "const": "human" }, "identityHash": { "$ref": "#/$defs/hash" } } },
47
+ "source": { "const": "human-confirmation" },
48
+ "scope": { "type": "object", "additionalProperties": false, "required": ["transitionId", "taskId", "candidatePlanHash", "manifestSha256"], "properties": { "transitionId": { "const": "task.plan.corrective-replan" }, "taskId": { "$ref": "#/$defs/id" }, "candidatePlanHash": { "$ref": "#/$defs/hash" }, "manifestSha256": { "$ref": "#/$defs/hash" } } },
49
+ "delegation": { "const": "forbidden" }
50
+ }
51
+ },
52
+ "bindingSha256": { "$ref": "#/$defs/hash" }
53
+ }
54
+ },
55
+ "validationSource": {
56
+ "type": "object", "additionalProperties": false,
57
+ "required": ["taskId", "revision", "currentPlanHash", "briefHash", "knowledgeRevision", "knowledgeHash", "gitHead", "guardedStepId", "correctiveDecisionHash", "remediationTailHash"],
58
+ "properties": { "taskId": { "$ref": "#/$defs/id" }, "revision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "currentPlanHash": { "$ref": "#/$defs/hash" }, "briefHash": { "$ref": "#/$defs/hash" }, "knowledgeRevision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "knowledgeHash": { "$ref": "#/$defs/hash" }, "gitHead": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" }, "guardedStepId": { "$ref": "#/$defs/id" }, "correctiveDecisionHash": { "$ref": "#/$defs/hash" }, "remediationTailHash": { "$ref": "#/$defs/hash" } }
59
+ },
60
+ "passedCoverage": { "type": "object", "additionalProperties": false, "required": ["sourceHash", "coverageHash", "passed"], "properties": { "sourceHash": { "$ref": "#/$defs/hash" }, "coverageHash": { "$ref": "#/$defs/hash" }, "passed": { "const": true } } },
61
+ "finding": { "type": "object", "additionalProperties": false, "required": ["findingId", "severity", "requirementRef", "evidenceHash"], "properties": { "findingId": { "$ref": "#/$defs/id" }, "severity": { "enum": ["low", "medium", "high"] }, "requirementRef": { "$ref": "#/$defs/id" }, "evidenceHash": { "$ref": "#/$defs/hash" } } },
62
+ "disposition": { "type": "object", "additionalProperties": false, "required": ["findingId", "decision", "evidenceHash"], "properties": { "findingId": { "$ref": "#/$defs/id" }, "decision": { "enum": ["resolved", "accepted-documented-limitation"] }, "evidenceHash": { "$ref": "#/$defs/hash" } } },
63
+ "planValidationAttestationV1": {
64
+ "type": "object", "additionalProperties": false,
65
+ "required": ["schemaVersion", "attestationId", "bindingSha256", "source", "candidate", "requirements", "acceptance", "architecture", "planAuthor", "plannerContext", "validator", "validatorContext", "freshContext", "passed", "findings", "dispositions", "validatedAtMs", "expiresAtMs", "attestationHash"],
66
+ "properties": {
67
+ "schemaVersion": { "const": 1 }, "attestationId": { "$ref": "#/$defs/id" }, "bindingSha256": { "$ref": "#/$defs/hash" }, "source": { "$ref": "#/$defs/validationSource" },
68
+ "candidate": { "type": "object", "additionalProperties": false, "required": ["planHash", "stepSetHash"], "properties": { "planHash": { "$ref": "#/$defs/hash" }, "stepSetHash": { "$ref": "#/$defs/hash" } } },
69
+ "requirements": { "$ref": "#/$defs/passedCoverage" }, "acceptance": { "$ref": "#/$defs/passedCoverage" },
70
+ "architecture": { "type": "object", "additionalProperties": false, "required": ["sourceHash", "compatibilityHash", "passed"], "properties": { "sourceHash": { "$ref": "#/$defs/hash" }, "compatibilityHash": { "$ref": "#/$defs/hash" }, "passed": { "const": true } } },
71
+ "planAuthor": { "type": "object", "additionalProperties": false, "required": ["identityHash"], "properties": { "identityHash": { "$ref": "#/$defs/hash" } } },
72
+ "plannerContext": { "$ref": "#/$defs/context" }, "validator": { "type": "object", "additionalProperties": false, "required": ["identityHash"], "properties": { "identityHash": { "$ref": "#/$defs/hash" } } }, "validatorContext": { "$ref": "#/$defs/context" },
73
+ "freshContext": { "type": "object", "additionalProperties": false, "required": ["sourceSnapshotHash", "plannerContextHash", "validatorContextHash", "passed"], "properties": { "sourceSnapshotHash": { "$ref": "#/$defs/hash" }, "plannerContextHash": { "$ref": "#/$defs/hash" }, "validatorContextHash": { "$ref": "#/$defs/hash" }, "passed": { "const": true } } },
74
+ "passed": { "const": true }, "findings": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/finding" } }, "dispositions": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/disposition" } },
75
+ "validatedAtMs": { "$ref": "#/$defs/time" }, "expiresAtMs": { "$ref": "#/$defs/time" }, "attestationHash": { "$ref": "#/$defs/hash" }
76
+ }
77
+ },
78
+ "context": { "type": "object", "additionalProperties": false, "required": ["contextHash", "capturedAtMs"], "properties": { "contextHash": { "$ref": "#/$defs/hash" }, "capturedAtMs": { "$ref": "#/$defs/time" } } },
79
+ "humanConfirmationInputV1": { "type": "object", "additionalProperties": false, "required": ["kind", "version", "challengeId", "confirmationCode"], "properties": { "kind": { "const": "corrective-replan-human-confirmation" }, "version": { "const": 1 }, "challengeId": { "$ref": "#/$defs/id" }, "confirmationCode": { "type": "string", "pattern": "^[0-9]{6}$" } } },
80
+ "receiptValidation": { "type": "object", "additionalProperties": false, "required": ["attestationId", "attestationHash", "planValidationHash", "snapshotBindingHash", "planAuthorIdentityHash", "planValidatorIdentityHash", "findingsHash", "dispositionsHash", "validatedAtMs", "expiresAtMs"], "properties": { "attestationId": { "$ref": "#/$defs/id" }, "attestationHash": { "$ref": "#/$defs/hash" }, "planValidationHash": { "$ref": "#/$defs/hash" }, "snapshotBindingHash": { "$ref": "#/$defs/hash" }, "planAuthorIdentityHash": { "$ref": "#/$defs/hash" }, "planValidatorIdentityHash": { "$ref": "#/$defs/hash" }, "findingsHash": { "$ref": "#/$defs/hash" }, "dispositionsHash": { "$ref": "#/$defs/hash" }, "validatedAtMs": { "$ref": "#/$defs/time" }, "expiresAtMs": { "$ref": "#/$defs/time" } } },
81
+ "correctiveReplanReceiptV1": {
82
+ "type": "object", "additionalProperties": false,
83
+ "required": ["schemaVersion", "receiptId", "domain", "binding", "validation", "audit", "human", "supersession", "issuedAtMs", "expiresAtMs", "domainHash", "receiptHash"],
84
+ "properties": {
85
+ "schemaVersion": { "const": 1 }, "receiptId": { "$ref": "#/$defs/id" }, "domain": { "const": "codex-workflow/corrective-replan-receipt/v1" }, "binding": { "$ref": "#/$defs/correctiveReplanBindingV1" }, "validation": { "$ref": "#/$defs/receiptValidation" },
86
+ "audit": { "type": "object", "additionalProperties": false, "required": ["riskAuditHash", "riskAuditorIdentityHash"], "properties": { "riskAuditHash": { "$ref": "#/$defs/hash" }, "riskAuditorIdentityHash": { "$ref": "#/$defs/hash" } } },
87
+ "human": { "type": "object", "additionalProperties": false, "required": ["challengeId", "challengeHash", "humanPrincipalIdentityHash", "confirmedAtMs"], "properties": { "challengeId": { "$ref": "#/$defs/id" }, "challengeHash": { "$ref": "#/$defs/hash" }, "humanPrincipalIdentityHash": { "$ref": "#/$defs/hash" }, "confirmedAtMs": { "$ref": "#/$defs/time" } } },
88
+ "supersession": { "type": "object", "additionalProperties": false, "required": ["priorGrantHash", "disposition"], "properties": { "priorGrantHash": { "$ref": "#/$defs/hash" }, "disposition": { "const": "superseded" } } },
89
+ "issuedAtMs": { "$ref": "#/$defs/time" }, "expiresAtMs": { "$ref": "#/$defs/time" }, "domainHash": { "$ref": "#/$defs/hash" }, "receiptHash": { "$ref": "#/$defs/hash" }
90
+ }
91
+ },
92
+ "storedPlanValidationEventV1": {
93
+ "type": "object", "additionalProperties": false,
94
+ "required": ["schemaVersion", "eventId", "previousEventHash", "taskId", "candidatePlanHash", "attestationId", "attestationHash", "receiptId", "receiptHash", "receiptDomainHash", "challengeId", "challengeHash", "recordedAt", "recordedAtMs", "eventHash"],
95
+ "properties": { "schemaVersion": { "const": 1 }, "eventId": { "$ref": "#/$defs/id" }, "previousEventHash": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/hash" }] }, "taskId": { "$ref": "#/$defs/id" }, "candidatePlanHash": { "$ref": "#/$defs/hash" }, "attestationId": { "$ref": "#/$defs/id" }, "attestationHash": { "$ref": "#/$defs/hash" }, "receiptId": { "$ref": "#/$defs/id" }, "receiptHash": { "$ref": "#/$defs/hash" }, "receiptDomainHash": { "$ref": "#/$defs/hash" }, "challengeId": { "$ref": "#/$defs/id" }, "challengeHash": { "$ref": "#/$defs/hash" }, "recordedAt": { "type": "string", "format": "date-time" }, "recordedAtMs": { "$ref": "#/$defs/time" }, "eventHash": { "$ref": "#/$defs/hash" } }
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "codex-workflow://schemas/private/corrective-replan-execution-event/v1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schemaVersion", "kind", "eventId", "previousEventHash", "recordedAt", "taskId", "taskRevision",
8
+ "taskStatus", "transitionId", "executionKeyHash", "runtimeFingerprint", "catalogHash", "lifecycleEpoch",
9
+ "bindingManifest", "bindingSha256", "receiptId", "receiptHash", "receiptDomainHash", "candidatePlanHash",
10
+ "planValidationEventHash", "planRiskAuditEventHash", "actorIdentityHash", "humanPrincipalIdentityHash",
11
+ "priorGrantHash", "taskStateSha256", "planBytesSha256", "eventHash"
12
+ ],
13
+ "properties": {
14
+ "schemaVersion": { "const": 1 },
15
+ "kind": { "const": "corrective-replan-execution-recorded" },
16
+ "eventId": { "type": "string", "pattern": "^CRE-[a-f0-9]{64}$" },
17
+ "previousEventHash": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/hash" }] },
18
+ "recordedAt": { "type": "string", "format": "date-time" },
19
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
20
+ "taskRevision": { "type": "integer", "minimum": 2, "maximum": 9007199254740991 },
21
+ "taskStatus": { "const": "awaiting_execution_authorization" },
22
+ "transitionId": { "const": "task.plan.corrective-replan" },
23
+ "executionKeyHash": { "$ref": "#/$defs/hash" },
24
+ "runtimeFingerprint": { "$ref": "#/$defs/hash" },
25
+ "catalogHash": { "$ref": "#/$defs/hash" },
26
+ "lifecycleEpoch": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
27
+ "bindingManifest": {
28
+ "type": "object", "additionalProperties": false,
29
+ "required": ["id", "version", "manifestSha256"],
30
+ "properties": {
31
+ "id": { "const": "binding-manifest.corrective-replan.exact-v1" },
32
+ "version": { "const": 1 },
33
+ "manifestSha256": { "$ref": "#/$defs/hash" }
34
+ }
35
+ },
36
+ "bindingSha256": { "$ref": "#/$defs/hash" },
37
+ "receiptId": { "type": "string", "minLength": 1, "maxLength": 256 },
38
+ "receiptHash": { "$ref": "#/$defs/hash" },
39
+ "receiptDomainHash": { "$ref": "#/$defs/hash" },
40
+ "candidatePlanHash": { "$ref": "#/$defs/hash" },
41
+ "planValidationEventHash": { "$ref": "#/$defs/hash" },
42
+ "planRiskAuditEventHash": { "$ref": "#/$defs/hash" },
43
+ "actorIdentityHash": { "$ref": "#/$defs/hash" },
44
+ "humanPrincipalIdentityHash": { "$ref": "#/$defs/hash" },
45
+ "priorGrantHash": { "$ref": "#/$defs/hash" },
46
+ "taskStateSha256": { "$ref": "#/$defs/hash" },
47
+ "planBytesSha256": { "$ref": "#/$defs/hash" },
48
+ "eventHash": { "$ref": "#/$defs/hash" }
49
+ },
50
+ "$defs": {
51
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
52
+ }
53
+ }
@@ -0,0 +1,142 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "codex-workflow://schemas/public/corrective-replan/v2",
4
+ "$defs": {
5
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
6
+ "id": { "type": "string", "minLength": 1, "maxLength": 256 },
7
+ "time": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
8
+ "candidateV1": {
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "required": ["plan", "validation", "riskAudit", "authority"],
12
+ "properties": {
13
+ "plan": { "$ref": "https://codex-workflow.local/schemas/transition-payloads.schema.json#/$defs/taskPlanInput" },
14
+ "validation": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["validatorContextHash", "findings", "dispositions"],
18
+ "properties": {
19
+ "validatorContextHash": { "$ref": "#/$defs/hash" },
20
+ "findings": {
21
+ "type": "array",
22
+ "maxItems": 128,
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["findingId", "severity", "requirementRef", "evidenceHash"],
27
+ "properties": {
28
+ "findingId": { "$ref": "#/$defs/id" },
29
+ "severity": { "enum": ["low", "medium", "high"] },
30
+ "requirementRef": { "$ref": "#/$defs/id" },
31
+ "evidenceHash": { "$ref": "#/$defs/hash" }
32
+ }
33
+ }
34
+ },
35
+ "dispositions": {
36
+ "type": "array",
37
+ "maxItems": 128,
38
+ "items": {
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "required": ["findingId", "decision", "evidenceHash"],
42
+ "properties": {
43
+ "findingId": { "$ref": "#/$defs/id" },
44
+ "decision": { "enum": ["resolved", "accepted-documented-limitation"] },
45
+ "evidenceHash": { "$ref": "#/$defs/hash" }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "riskAudit": { "$ref": "https://codex-workflow.local/schemas/transition-payloads.schema.json#/$defs/planRiskAuditInput" },
52
+ "authority": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["planAuthorIdentityHash", "planValidatorIdentityHash", "riskAuditorIdentityHash", "actorIdentityHash", "actorRole", "humanPrincipalIdentityHash"],
56
+ "properties": {
57
+ "planAuthorIdentityHash": { "$ref": "#/$defs/hash" },
58
+ "planValidatorIdentityHash": { "$ref": "#/$defs/hash" },
59
+ "riskAuditorIdentityHash": { "$ref": "#/$defs/hash" },
60
+ "actorIdentityHash": { "$ref": "#/$defs/hash" },
61
+ "actorRole": { "enum": ["delivery-coordinator", "technical-planner"] },
62
+ "humanPrincipalIdentityHash": { "$ref": "#/$defs/hash" }
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "humanGateV1": {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["kind", "version", "taskId", "preparedAtMs", "expiresAtMs", "candidatePlanHash", "bindingSha256", "attestationId", "attestationHash", "challengeId", "runtimeFingerprint", "catalogHash", "lifecycleEpoch", "preparationSha256"],
71
+ "properties": {
72
+ "kind": { "const": "corrective-replan-human-gate" },
73
+ "version": { "const": 1 },
74
+ "taskId": { "$ref": "#/$defs/id" },
75
+ "preparedAtMs": { "$ref": "#/$defs/time" },
76
+ "expiresAtMs": { "$ref": "#/$defs/time" },
77
+ "candidatePlanHash": { "$ref": "#/$defs/hash" },
78
+ "bindingSha256": { "$ref": "#/$defs/hash" },
79
+ "attestationId": { "$ref": "#/$defs/id" },
80
+ "attestationHash": { "$ref": "#/$defs/hash" },
81
+ "challengeId": { "$ref": "#/$defs/id" },
82
+ "runtimeFingerprint": { "$ref": "#/$defs/hash" },
83
+ "catalogHash": { "$ref": "#/$defs/hash" },
84
+ "lifecycleEpoch": { "const": 2 },
85
+ "preparationSha256": { "$ref": "#/$defs/hash" }
86
+ }
87
+ },
88
+ "humanGateResultV1": {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": ["kind", "gate", "delivery"],
92
+ "properties": {
93
+ "kind": { "const": "corrective-replan-human-gate-result" },
94
+ "gate": { "$ref": "#/$defs/humanGateV1" },
95
+ "delivery": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["kind", "version", "challengeId", "confirmationCode", "expiresAtMs"],
99
+ "properties": {
100
+ "kind": { "const": "corrective-replan-human-challenge-delivery" },
101
+ "version": { "const": 1 },
102
+ "challengeId": { "$ref": "#/$defs/id" },
103
+ "confirmationCode": { "type": "string", "pattern": "^[0-9]{6}$" },
104
+ "expiresAtMs": { "$ref": "#/$defs/time" }
105
+ }
106
+ }
107
+ }
108
+ },
109
+ "credentialV1": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["kind", "version", "gate", "receipt", "planValidationEvent"],
113
+ "properties": {
114
+ "kind": { "const": "corrective-replan-public-credential" },
115
+ "version": { "const": 1 },
116
+ "gate": { "$ref": "#/$defs/humanGateV1" },
117
+ "receipt": { "$ref": "codex-workflow://schemas/private/corrective-replan-credentials/v1#/$defs/correctiveReplanReceiptV1" },
118
+ "planValidationEvent": { "$ref": "codex-workflow://schemas/private/corrective-replan-credentials/v1#/$defs/storedPlanValidationEventV1" }
119
+ }
120
+ },
121
+ "executionResultV1": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["kind", "disposition", "taskId", "transactionId", "resultSha256"],
125
+ "properties": {
126
+ "kind": { "const": "corrective-replan-execution-result" },
127
+ "disposition": { "enum": ["executed", "recovered", "replayed"] },
128
+ "taskId": { "$ref": "#/$defs/id" },
129
+ "transactionId": { "$ref": "#/$defs/hash" },
130
+ "resultSha256": { "$ref": "#/$defs/hash" }
131
+ }
132
+ },
133
+ "responseV2": {
134
+ "oneOf": [
135
+ { "$ref": "#/$defs/humanGateResultV1" },
136
+ { "$ref": "#/$defs/credentialV1" },
137
+ { "$ref": "#/$defs/executionResultV1" }
138
+ ]
139
+ }
140
+ },
141
+ "$ref": "#/$defs/responseV2"
142
+ }
@@ -0,0 +1,151 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "codex-workflow://schemas/private/corrective-replan-task-transaction/v1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schemaVersion", "kind", "transactionId", "projectId", "taskId", "transitionId",
8
+ "executionKeyHash", "runtimeFingerprint", "catalogHash", "lifecycleEpoch", "bindingManifest",
9
+ "bindingSha256", "receiptHash", "actorIdentityHash", "humanPrincipalIdentityHash", "admittedAt",
10
+ "intentSha256", "phase", "phaseRevision", "nextTargetOrdinal", "targets", "phaseHistory", "completedResult",
11
+ "updatedAt"
12
+ ],
13
+ "properties": {
14
+ "schemaVersion": { "const": 1 },
15
+ "kind": { "const": "corrective-replan-task-transaction" },
16
+ "transactionId": { "$ref": "#/$defs/hash" },
17
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
18
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
19
+ "transitionId": { "const": "task.plan.corrective-replan" },
20
+ "executionKeyHash": { "$ref": "#/$defs/hash" },
21
+ "runtimeFingerprint": { "$ref": "#/$defs/hash" },
22
+ "catalogHash": { "$ref": "#/$defs/hash" },
23
+ "lifecycleEpoch": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
24
+ "bindingManifest": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["id", "version", "manifestSha256"],
28
+ "properties": {
29
+ "id": { "const": "binding-manifest.corrective-replan.exact-v1" },
30
+ "version": { "const": 1 },
31
+ "manifestSha256": { "$ref": "#/$defs/hash" }
32
+ }
33
+ },
34
+ "bindingSha256": { "$ref": "#/$defs/hash" },
35
+ "receiptHash": { "$ref": "#/$defs/hash" },
36
+ "actorIdentityHash": { "$ref": "#/$defs/hash" },
37
+ "humanPrincipalIdentityHash": { "$ref": "#/$defs/hash" },
38
+ "admittedAt": { "$ref": "#/$defs/time" },
39
+ "intentSha256": { "$ref": "#/$defs/hash" },
40
+ "phase": { "enum": ["intent", "applying", "published-pending-readback", "completed"] },
41
+ "phaseRevision": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
42
+ "nextTargetOrdinal": { "type": "integer", "minimum": 0, "maximum": 5 },
43
+ "targets": {
44
+ "type": "array",
45
+ "minItems": 5,
46
+ "maxItems": 5,
47
+ "items": { "$ref": "#/$defs/target" }
48
+ },
49
+ "phaseHistory": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "maxItems": 64,
53
+ "items": { "$ref": "#/$defs/phaseEntry" }
54
+ },
55
+ "completedResult": {
56
+ "oneOf": [
57
+ { "type": "null" },
58
+ {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "required": ["resultSha256"],
62
+ "properties": { "resultSha256": { "$ref": "#/$defs/hash" } }
63
+ }
64
+ ]
65
+ },
66
+ "updatedAt": { "$ref": "#/$defs/time" }
67
+ },
68
+ "$defs": {
69
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
70
+ "time": { "type": "string", "format": "date-time" },
71
+ "snapshot": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["exists", "contentSha256", "byteLength", "contentPath"],
75
+ "properties": {
76
+ "exists": { "type": "boolean" },
77
+ "contentSha256": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/hash" }] },
78
+ "byteLength": { "type": "integer", "minimum": 0, "maximum": 268435456 },
79
+ "contentPath": { "oneOf": [{ "type": "null" }, { "type": "string", "pattern": "^preimages/[0-4]\\.bin$" }] }
80
+ }
81
+ },
82
+ "postimage": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["contentSha256", "byteLength", "contentPath"],
86
+ "properties": {
87
+ "contentSha256": { "$ref": "#/$defs/hash" },
88
+ "byteLength": { "type": "integer", "minimum": 1, "maximum": 268435456 },
89
+ "contentPath": { "type": "string", "pattern": "^targets/[0-4]\\.bin$" }
90
+ }
91
+ },
92
+ "sidecarAnchors": {
93
+ "oneOf": [
94
+ { "type": "null" },
95
+ {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["previousEventHash", "resultEventHash", "previousLineCount", "resultLineCount"],
99
+ "properties": {
100
+ "previousEventHash": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/hash" }] },
101
+ "resultEventHash": { "$ref": "#/$defs/hash" },
102
+ "previousLineCount": { "type": "integer", "minimum": 0 },
103
+ "resultLineCount": { "type": "integer", "minimum": 1 }
104
+ }
105
+ }
106
+ ]
107
+ },
108
+ "taskCas": {
109
+ "oneOf": [
110
+ { "type": "null" },
111
+ {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["expectedRevision", "resultRevision"],
115
+ "properties": {
116
+ "expectedRevision": { "type": "integer", "minimum": 1 },
117
+ "resultRevision": { "type": "integer", "minimum": 2 }
118
+ }
119
+ }
120
+ ]
121
+ },
122
+ "target": {
123
+ "type": "object",
124
+ "additionalProperties": false,
125
+ "required": ["targetId", "ordinal", "relativePath", "writeMode", "preimage", "postimage", "sidecarAnchors", "taskCas"],
126
+ "properties": {
127
+ "targetId": { "enum": ["task-state", "plan", "plan-validation", "plan-risk-audit", "execution-evidence"] },
128
+ "ordinal": { "type": "integer", "minimum": 0, "maximum": 4 },
129
+ "relativePath": { "enum": ["state.json", "plan.md", "plan-validations.jsonl", "plan-risk-audits.jsonl", "corrective-replan-executions.jsonl"] },
130
+ "writeMode": { "enum": ["replace-exact", "append-exact"] },
131
+ "preimage": { "$ref": "#/$defs/snapshot" },
132
+ "postimage": { "$ref": "#/$defs/postimage" },
133
+ "sidecarAnchors": { "$ref": "#/$defs/sidecarAnchors" },
134
+ "taskCas": { "$ref": "#/$defs/taskCas" }
135
+ }
136
+ },
137
+ "phaseEntry": {
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": ["sequence", "phase", "nextTargetOrdinal", "recordedAt", "previousEntryHash", "entryHash"],
141
+ "properties": {
142
+ "sequence": { "type": "integer", "minimum": 0, "maximum": 63 },
143
+ "phase": { "enum": ["intent", "applying", "published-pending-readback", "completed"] },
144
+ "nextTargetOrdinal": { "type": "integer", "minimum": 0, "maximum": 5 },
145
+ "recordedAt": { "$ref": "#/$defs/time" },
146
+ "previousEntryHash": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/hash" }] },
147
+ "entryHash": { "$ref": "#/$defs/hash" }
148
+ }
149
+ }
150
+ }
151
+ }