@kontextmind/kxm 0.6.0

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 (227) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.kxm/README.md +14 -0
  3. package/.kxm/assets/README.md +5 -0
  4. package/.kxm/assets/retrospectives/README.md +5 -0
  5. package/.kxm/config/README.md +5 -0
  6. package/.kxm/config/agents.json +43 -0
  7. package/.kxm/config/env.example +56 -0
  8. package/.kxm/config/update.example.yaml +9 -0
  9. package/.kxm/config/workflows/fix.json +160 -0
  10. package/.kxm/config/workflows/jira-development.json +116 -0
  11. package/.kxm/config/workflows/provenance-quorum.json +150 -0
  12. package/.kxm/config/workflows/v04-dogfood.json +72 -0
  13. package/CHANGELOG.md +465 -0
  14. package/LICENSE +21 -0
  15. package/README.md +306 -0
  16. package/SECURITY.md +72 -0
  17. package/docs/README.md +48 -0
  18. package/docs/agent-communication-envelopes-and-gates.md +553 -0
  19. package/docs/architecture.md +242 -0
  20. package/docs/assignment-runner.md +241 -0
  21. package/docs/configuration.md +361 -0
  22. package/docs/continuous-improvement.md +114 -0
  23. package/docs/getting-started.md +253 -0
  24. package/docs/kxm-handbook.md +1090 -0
  25. package/docs/operations.md +205 -0
  26. package/docs/provenance-gates.md +291 -0
  27. package/docs/skills.md +45 -0
  28. package/docs/templates/README.md +95 -0
  29. package/docs/templates/adr.md +88 -0
  30. package/docs/templates/architecture.md +120 -0
  31. package/docs/templates/bug-fix.md +109 -0
  32. package/docs/templates/feature.md +108 -0
  33. package/docs/templates/handoff.md +72 -0
  34. package/docs/templates/postmortem.md +77 -0
  35. package/docs/templates/research.md +100 -0
  36. package/docs/templates/review.md +85 -0
  37. package/docs/templates/runbook.md +73 -0
  38. package/docs/templates/test-plan.md +87 -0
  39. package/docs/templates/test-report.md +72 -0
  40. package/docs/test-matrix.md +121 -0
  41. package/docs/troubleshooting.md +249 -0
  42. package/docs/vnext/README.md +62 -0
  43. package/docs/vnext/architecture.md +185 -0
  44. package/docs/vnext/effects-and-recovery.md +172 -0
  45. package/docs/vnext/lifecycles.md +235 -0
  46. package/docs/vnext/migration.md +220 -0
  47. package/docs/vnext/routing.md +184 -0
  48. package/docs/vnext/synchronization.md +172 -0
  49. package/docs/vnext/terminology.md +240 -0
  50. package/docs/vnext/validation.md +335 -0
  51. package/docs/webhook-workflows.md +240 -0
  52. package/docs/workflow-guide.md +1150 -0
  53. package/examples/README.md +102 -0
  54. package/examples/provenance-workflow.json +40 -0
  55. package/examples/requester.ts +30 -0
  56. package/examples/reviewer-agent.ts +29 -0
  57. package/examples/roundtrip.ts +46 -0
  58. package/examples/vnext/.kxm/agents/coordinator.yaml +16 -0
  59. package/examples/vnext/.kxm/agents/critic-1.yaml +16 -0
  60. package/examples/vnext/.kxm/agents/critic-2.yaml +15 -0
  61. package/examples/vnext/.kxm/agents/critic-3.yaml +15 -0
  62. package/examples/vnext/.kxm/agents/implementer.yaml +15 -0
  63. package/examples/vnext/.kxm/agents/planner.yaml +13 -0
  64. package/examples/vnext/.kxm/agents/reproducer.yaml +15 -0
  65. package/examples/vnext/.kxm/agents/reviewer.yaml +15 -0
  66. package/examples/vnext/.kxm/gates.yaml +8 -0
  67. package/examples/vnext/.kxm/models/critic-claude.yaml +11 -0
  68. package/examples/vnext/.kxm/models/critic-gemini.yaml +11 -0
  69. package/examples/vnext/.kxm/models/critic-grok.yaml +12 -0
  70. package/examples/vnext/.kxm/models/implementation.yaml +14 -0
  71. package/examples/vnext/.kxm/models/primary.yaml +17 -0
  72. package/examples/vnext/.kxm/prices.yaml +111 -0
  73. package/examples/vnext/.kxm/project/env.yaml +7 -0
  74. package/examples/vnext/.kxm/project.yaml +32 -0
  75. package/examples/vnext/.kxm/repo/repo.yaml +8 -0
  76. package/examples/vnext/.kxm/workflows/default.yaml +92 -0
  77. package/examples/vnext/.kxm/workflows/fix.yaml +376 -0
  78. package/examples/vnext/.kxm/workflows/improve.yaml +57 -0
  79. package/examples/vnext/README.md +53 -0
  80. package/examples/vnext/records/assignment-result-recorded.json +63 -0
  81. package/examples/vnext/records/assignment-result.json +46 -0
  82. package/examples/vnext/records/context-candidate.json +42 -0
  83. package/examples/vnext/records/delivery-manifest.json +66 -0
  84. package/examples/vnext/records/effect-uncertainty-resolved-sync.json +67 -0
  85. package/examples/vnext/records/effect-uncertainty-resolved.json +62 -0
  86. package/examples/vnext/records/run-created.json +54 -0
  87. package/examples/vnext/records/sync-event.json +65 -0
  88. package/examples/vnext/repositories/api/.kxm/repo/env.yaml +7 -0
  89. package/examples/vnext/repositories/api/.kxm/repo/repo.yaml +8 -0
  90. package/examples/vnext/repositories/web/.kxm/repo/repo.yaml +8 -0
  91. package/examples/workflow-signal.ts +63 -0
  92. package/package.json +129 -0
  93. package/plugins/kxm/.claude-plugin/plugin.json +73 -0
  94. package/plugins/kxm/.mcp.json +19 -0
  95. package/plugins/kxm/README.md +93 -0
  96. package/plugins/kxm/dist/cli.js +42853 -0
  97. package/plugins/kxm/dist/client.js +416 -0
  98. package/plugins/kxm/dist/core.js +1823 -0
  99. package/plugins/kxm/dist/extension.js +3797 -0
  100. package/plugins/kxm/dist/mcp-server.js +17104 -0
  101. package/plugins/kxm/dist/runtime.js +23361 -0
  102. package/plugins/kxm/dist/server.js +13640 -0
  103. package/plugins/kxm/dist/vnext-runtime-supervisor.js +21109 -0
  104. package/plugins/kxm/package.json +12 -0
  105. package/plugins/kxm/skills/kxm/SKILL.md +97 -0
  106. package/plugins/kxm/skills/kxm/references/protocol.md +103 -0
  107. package/plugins/kxm/skills/kxm-session/SKILL.md +53 -0
  108. package/plugins/kxm/src/arbiter.ts +355 -0
  109. package/plugins/kxm/src/artifacts-exist.ts +62 -0
  110. package/plugins/kxm/src/autocomplete.ts +236 -0
  111. package/plugins/kxm/src/cli.ts +3707 -0
  112. package/plugins/kxm/src/client.ts +614 -0
  113. package/plugins/kxm/src/commands.ts +1063 -0
  114. package/plugins/kxm/src/config.ts +290 -0
  115. package/plugins/kxm/src/context/providers.ts +101 -0
  116. package/plugins/kxm/src/context-packet.ts +332 -0
  117. package/plugins/kxm/src/context.ts +499 -0
  118. package/plugins/kxm/src/core.ts +6 -0
  119. package/plugins/kxm/src/database.ts +563 -0
  120. package/plugins/kxm/src/diagnostics.ts +184 -0
  121. package/plugins/kxm/src/envelope.ts +118 -0
  122. package/plugins/kxm/src/extension.ts +895 -0
  123. package/plugins/kxm/src/external-effects.ts +299 -0
  124. package/plugins/kxm/src/github-watch.ts +255 -0
  125. package/plugins/kxm/src/hub-binding.ts +160 -0
  126. package/plugins/kxm/src/hub.ts +2502 -0
  127. package/plugins/kxm/src/improve.ts +383 -0
  128. package/plugins/kxm/src/inbox.ts +10 -0
  129. package/plugins/kxm/src/kxm-install-kind.ts +113 -0
  130. package/plugins/kxm/src/kxm-update-config.ts +39 -0
  131. package/plugins/kxm/src/kxm-update.ts +238 -0
  132. package/plugins/kxm/src/local-snapshot.ts +406 -0
  133. package/plugins/kxm/src/logger.ts +198 -0
  134. package/plugins/kxm/src/mcp-server.ts +143 -0
  135. package/plugins/kxm/src/memory.ts +385 -0
  136. package/plugins/kxm/src/nous-pi.ts +287 -0
  137. package/plugins/kxm/src/nous-provider.ts +729 -0
  138. package/plugins/kxm/src/price-calc.ts +87 -0
  139. package/plugins/kxm/src/prices.ts +121 -0
  140. package/plugins/kxm/src/protocol.ts +172 -0
  141. package/plugins/kxm/src/recovery.ts +211 -0
  142. package/plugins/kxm/src/redact.ts +26 -0
  143. package/plugins/kxm/src/retrospective.ts +400 -0
  144. package/plugins/kxm/src/routing.ts +830 -0
  145. package/plugins/kxm/src/runtime.ts +9 -0
  146. package/plugins/kxm/src/server.ts +117 -0
  147. package/plugins/kxm/src/session-work.ts +571 -0
  148. package/plugins/kxm/src/session.ts +184 -0
  149. package/plugins/kxm/src/skills.ts +535 -0
  150. package/plugins/kxm/src/state.ts +326 -0
  151. package/plugins/kxm/src/store.ts +637 -0
  152. package/plugins/kxm/src/studio-layout.ts +268 -0
  153. package/plugins/kxm/src/suggest.ts +162 -0
  154. package/plugins/kxm/src/task-manager.ts +244 -0
  155. package/plugins/kxm/src/telemetry.ts +116 -0
  156. package/plugins/kxm/src/tui.ts +1046 -0
  157. package/plugins/kxm/src/vnext-bindings.ts +403 -0
  158. package/plugins/kxm/src/vnext-config.ts +1646 -0
  159. package/plugins/kxm/src/vnext-engine-artifacts.ts +86 -0
  160. package/plugins/kxm/src/vnext-engine-command.ts +533 -0
  161. package/plugins/kxm/src/vnext-engine-compile.ts +722 -0
  162. package/plugins/kxm/src/vnext-engine-evidence.ts +273 -0
  163. package/plugins/kxm/src/vnext-engine-fold.ts +1400 -0
  164. package/plugins/kxm/src/vnext-engine-gate-records.ts +583 -0
  165. package/plugins/kxm/src/vnext-engine-plan.ts +717 -0
  166. package/plugins/kxm/src/vnext-engine.ts +2458 -0
  167. package/plugins/kxm/src/vnext-gate-hash.ts +10 -0
  168. package/plugins/kxm/src/vnext-harness.ts +1142 -0
  169. package/plugins/kxm/src/vnext-init.ts +430 -0
  170. package/plugins/kxm/src/vnext-migrate.ts +1848 -0
  171. package/plugins/kxm/src/vnext-oneshot-producer.ts +424 -0
  172. package/plugins/kxm/src/vnext-permission.ts +936 -0
  173. package/plugins/kxm/src/vnext-pi-producer.ts +628 -0
  174. package/plugins/kxm/src/vnext-repair.ts +1094 -0
  175. package/plugins/kxm/src/vnext-runtime-owner.ts +320 -0
  176. package/plugins/kxm/src/vnext-runtime-store.ts +1560 -0
  177. package/plugins/kxm/src/vnext-runtime-supervisor.ts +586 -0
  178. package/plugins/kxm/src/vnext-runtime.ts +663 -0
  179. package/plugins/kxm/src/vnext-template.ts +247 -0
  180. package/plugins/kxm/src/wiki.ts +313 -0
  181. package/plugins/kxm/src/workflow.ts +1548 -0
  182. package/schemas/vnext/README.md +46 -0
  183. package/schemas/vnext/agent.schema.json +40 -0
  184. package/schemas/vnext/assignment-result.schema.json +66 -0
  185. package/schemas/vnext/backup-manifest.schema.json +89 -0
  186. package/schemas/vnext/candidate.schema.json +109 -0
  187. package/schemas/vnext/common.schema.json +422 -0
  188. package/schemas/vnext/context-candidate.schema.json +76 -0
  189. package/schemas/vnext/context-packet.schema.json +192 -0
  190. package/schemas/vnext/delivery-manifest.schema.json +159 -0
  191. package/schemas/vnext/environment.schema.json +66 -0
  192. package/schemas/vnext/gate-registry.schema.json +109 -0
  193. package/schemas/vnext/handoff-manifest.schema.json +146 -0
  194. package/schemas/vnext/init-operation.schema.json +61 -0
  195. package/schemas/vnext/local-repository-bindings.schema.json +30 -0
  196. package/schemas/vnext/memory-record.schema.json +45 -0
  197. package/schemas/vnext/migration-decision.schema.json +26 -0
  198. package/schemas/vnext/migration-plan.schema.json +123 -0
  199. package/schemas/vnext/migration-receipt.schema.json +52 -0
  200. package/schemas/vnext/model.schema.json +42 -0
  201. package/schemas/vnext/permission-diff.schema.json +57 -0
  202. package/schemas/vnext/prices.schema.json +115 -0
  203. package/schemas/vnext/project.schema.json +85 -0
  204. package/schemas/vnext/repository.schema.json +24 -0
  205. package/schemas/vnext/run-event.schema.json +460 -0
  206. package/schemas/vnext/session-brief.schema.json +153 -0
  207. package/schemas/vnext/sync-event.schema.json +234 -0
  208. package/schemas/vnext/template-provenance.schema.json +38 -0
  209. package/schemas/vnext/workflow.schema.json +248 -0
  210. package/scripts/assignment-run.d.mts +354 -0
  211. package/scripts/assignment-run.mjs +4451 -0
  212. package/scripts/build-runtime.mjs +56 -0
  213. package/scripts/check-generated.mjs +77 -0
  214. package/scripts/check-versions.mjs +34 -0
  215. package/scripts/emit-codex-artifacts.d.mts +9 -0
  216. package/scripts/emit-codex-artifacts.mjs +91 -0
  217. package/scripts/harness-run.d.mts +83 -0
  218. package/scripts/harness-run.mjs +2095 -0
  219. package/scripts/kxm-hub.mjs +105 -0
  220. package/scripts/kxm-publish-npm.mjs +327 -0
  221. package/scripts/kxm-release-github.mjs +472 -0
  222. package/scripts/kxm-runtime-supervisor.mjs +7 -0
  223. package/scripts/kxm-worker.mjs +1127 -0
  224. package/scripts/kxm.mjs +27 -0
  225. package/scripts/roster-policy.d.mts +20 -0
  226. package/scripts/roster-policy.mjs +161 -0
  227. package/scripts/smoke-multi-pi.mjs +479 -0
@@ -0,0 +1,192 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/context-packet.schema.json",
4
+ "title": "KXM formal context packet v2",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "packetId",
9
+ "project",
10
+ "generatedAt",
11
+ "targetRole",
12
+ "task",
13
+ "acceptanceCriteria",
14
+ "plan",
15
+ "predecessors",
16
+ "environment",
17
+ "budget"
18
+ ],
19
+ "properties": {
20
+ "schema": {
21
+ "const": "kxm.context-packet.v2"
22
+ },
23
+ "packetId": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "maxLength": 128
27
+ },
28
+ "project": {
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "maxLength": 128
32
+ },
33
+ "generatedAt": {
34
+ "$ref": "common.schema.json#/$defs/timestamp"
35
+ },
36
+ "targetRole": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "maxLength": 64
40
+ },
41
+ "task": {
42
+ "type": "object",
43
+ "required": [
44
+ "taskId",
45
+ "stepId",
46
+ "stepAttempt",
47
+ "objective",
48
+ "allowedOutcomes",
49
+ "permissionCeiling"
50
+ ],
51
+ "properties": {
52
+ "taskId": { "type": "string", "minLength": 1, "maxLength": 128 },
53
+ "stepId": { "type": "string", "minLength": 1, "maxLength": 64 },
54
+ "stepAttempt": { "type": "integer", "minimum": 1 },
55
+ "objective": { "type": "string", "minLength": 1, "maxLength": 4000 },
56
+ "allowedOutcomes": {
57
+ "type": "array",
58
+ "items": { "type": "string", "minLength": 1, "maxLength": 64 }
59
+ },
60
+ "permissionCeiling": {
61
+ "enum": ["read-only", "edit", "admin"]
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "acceptanceCriteria": {
67
+ "type": "array",
68
+ "items": {
69
+ "type": "object",
70
+ "required": ["id", "description", "verificationKind", "required"],
71
+ "properties": {
72
+ "id": { "type": "string", "minLength": 1, "maxLength": 64 },
73
+ "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
74
+ "verificationKind": {
75
+ "enum": ["gate", "witness", "critic", "human"]
76
+ },
77
+ "targetRef": { "type": "string", "maxLength": 256 },
78
+ "required": { "type": "boolean" }
79
+ },
80
+ "additionalProperties": false
81
+ }
82
+ },
83
+ "plan": {
84
+ "type": "object",
85
+ "required": ["planHash", "activeStepIndex", "totalSteps", "settledDecisions"],
86
+ "properties": {
87
+ "planHash": { "type": "string", "minLength": 1, "maxLength": 128 },
88
+ "activeStepIndex": { "type": "integer", "minimum": 0 },
89
+ "totalSteps": { "type": "integer", "minimum": 1 },
90
+ "settledDecisions": {
91
+ "type": "array",
92
+ "items": { "type": "string", "maxLength": 500 }
93
+ }
94
+ },
95
+ "additionalProperties": false
96
+ },
97
+ "predecessors": {
98
+ "type": "array",
99
+ "items": {
100
+ "type": "object",
101
+ "required": ["stepId", "role", "status", "summary", "settledAt", "artifacts", "decisions"],
102
+ "properties": {
103
+ "stepId": { "type": "string", "minLength": 1, "maxLength": 64 },
104
+ "role": { "type": "string", "minLength": 1, "maxLength": 64 },
105
+ "status": {
106
+ "enum": ["passed", "warning", "failed", "settled"]
107
+ },
108
+ "summary": { "type": "string", "maxLength": 4000 },
109
+ "settledAt": { "$ref": "common.schema.json#/$defs/timestamp" },
110
+ "artifacts": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "object",
114
+ "required": ["name", "kind", "artifactRef"],
115
+ "properties": {
116
+ "name": { "type": "string", "maxLength": 256 },
117
+ "kind": { "enum": ["patch", "report", "log", "plan", "repro_script", "doc"] },
118
+ "artifactRef": { "type": "string", "maxLength": 256 },
119
+ "contentSnippet": { "type": "string", "maxLength": 8000 }
120
+ },
121
+ "additionalProperties": false
122
+ }
123
+ },
124
+ "decisions": {
125
+ "type": "array",
126
+ "items": { "type": "string", "maxLength": 500 }
127
+ }
128
+ },
129
+ "additionalProperties": false
130
+ }
131
+ },
132
+ "environment": {
133
+ "type": "object",
134
+ "required": [
135
+ "sharedDefaults",
136
+ "projectKnowledge",
137
+ "currentState",
138
+ "contradictions",
139
+ "activeSkills"
140
+ ],
141
+ "properties": {
142
+ "sharedDefaults": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "object",
146
+ "required": ["id", "summary"],
147
+ "properties": {
148
+ "id": { "type": "string" },
149
+ "summary": { "type": "string" }
150
+ },
151
+ "additionalProperties": false
152
+ }
153
+ },
154
+ "projectKnowledge": {
155
+ "type": "array",
156
+ "items": { "type": "object" }
157
+ },
158
+ "currentState": {
159
+ "type": "array",
160
+ "items": { "type": "object" }
161
+ },
162
+ "contradictions": {
163
+ "type": "array",
164
+ "items": { "type": "object" }
165
+ },
166
+ "activeSkills": {
167
+ "type": "array",
168
+ "items": { "type": "object" }
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ },
173
+ "budget": {
174
+ "type": "object",
175
+ "required": ["allocatedTokens", "estimatedTokens", "unresolvedGaps", "provenanceSummary"],
176
+ "properties": {
177
+ "allocatedTokens": { "type": "integer", "minimum": 1 },
178
+ "estimatedTokens": { "type": "integer", "minimum": 0 },
179
+ "unresolvedGaps": {
180
+ "type": "array",
181
+ "items": { "type": "string" }
182
+ },
183
+ "provenanceSummary": {
184
+ "type": "object",
185
+ "additionalProperties": { "type": "integer" }
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ }
190
+ },
191
+ "additionalProperties": false
192
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/delivery-manifest.schema.json",
4
+ "title": "KXM non-atomic multi-repository delivery manifest",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "projectId",
9
+ "runId",
10
+ "createdAt",
11
+ "configRevision",
12
+ "atomic",
13
+ "status",
14
+ "repositories"
15
+ ],
16
+ "properties": {
17
+ "schema": { "const": "kxm.delivery-manifest.v1" },
18
+ "projectId": { "$ref": "common.schema.json#/$defs/opaqueId" },
19
+ "runId": { "$ref": "common.schema.json#/$defs/opaqueId" },
20
+ "createdAt": { "$ref": "common.schema.json#/$defs/timestamp" },
21
+ "updatedAt": { "$ref": "common.schema.json#/$defs/timestamp" },
22
+ "configRevision": { "$ref": "common.schema.json#/$defs/sha256" },
23
+ "atomic": { "const": false },
24
+ "status": { "enum": ["planned", "preparing", "delivering", "completed", "partial", "blocked_uncertain", "failed", "cancelled"] },
25
+ "repositories": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "maxItems": 64,
29
+ "items": { "$ref": "#/$defs/repositoryDelivery" }
30
+ },
31
+ "dependencies": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "object",
35
+ "required": ["before", "after"],
36
+ "properties": {
37
+ "before": { "$ref": "common.schema.json#/$defs/identifier" },
38
+ "after": { "$ref": "common.schema.json#/$defs/identifier" },
39
+ "reason": { "type": "string", "minLength": 1, "maxLength": 1000 }
40
+ },
41
+ "additionalProperties": false
42
+ },
43
+ "maxItems": 128
44
+ },
45
+ "summary": { "type": "string", "maxLength": 4000 }
46
+ },
47
+ "allOf": [
48
+ {
49
+ "if": { "properties": { "status": { "const": "completed" } }, "required": ["status"] },
50
+ "then": {
51
+ "properties": {
52
+ "repositories": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "object",
56
+ "properties": { "status": { "const": "delivered" } },
57
+ "required": ["status", "receipts"]
58
+ }
59
+ }
60
+ }
61
+ }
62
+ },
63
+ {
64
+ "if": { "properties": { "status": { "const": "partial" } }, "required": ["status"] },
65
+ "then": {
66
+ "properties": {
67
+ "repositories": {
68
+ "type": "array",
69
+ "allOf": [
70
+ { "contains": { "type": "object", "properties": { "status": { "const": "delivered" } }, "required": ["status"] } },
71
+ { "contains": { "type": "object", "properties": { "status": { "enum": ["failed", "blocked_uncertain", "cancelled"] } }, "required": ["status"] } }
72
+ ]
73
+ }
74
+ }
75
+ }
76
+ },
77
+ {
78
+ "if": { "properties": { "status": { "const": "cancelled" } }, "required": ["status"] },
79
+ "then": {
80
+ "properties": {
81
+ "repositories": {
82
+ "type": "array",
83
+ "not": {
84
+ "contains": { "type": "object", "properties": { "status": { "const": "delivered" } }, "required": ["status"] }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ {
91
+ "if": { "properties": { "status": { "const": "failed" } }, "required": ["status"] },
92
+ "then": {
93
+ "properties": {
94
+ "repositories": {
95
+ "type": "array",
96
+ "contains": { "type": "object", "properties": { "status": { "const": "failed" } }, "required": ["status"] },
97
+ "not": {
98
+ "contains": { "type": "object", "properties": { "status": { "const": "delivered" } }, "required": ["status"] }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ },
104
+ {
105
+ "if": { "properties": { "status": { "const": "blocked_uncertain" } }, "required": ["status"] },
106
+ "then": {
107
+ "properties": {
108
+ "repositories": {
109
+ "type": "array",
110
+ "contains": { "type": "object", "properties": { "status": { "const": "blocked_uncertain" } }, "required": ["status"] },
111
+ "not": {
112
+ "contains": { "type": "object", "properties": { "status": { "const": "delivered" } }, "required": ["status"] }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ],
119
+ "additionalProperties": false,
120
+ "$defs": {
121
+ "repositoryDelivery": {
122
+ "type": "object",
123
+ "required": ["repositoryId", "baseCommit", "contentSnapshotHash", "status", "effect"],
124
+ "properties": {
125
+ "repositoryId": { "$ref": "common.schema.json#/$defs/identifier" },
126
+ "baseCommit": { "$ref": "common.schema.json#/$defs/gitCommit" },
127
+ "contentSnapshotHash": { "$ref": "common.schema.json#/$defs/sha256" },
128
+ "outputCommit": { "$ref": "common.schema.json#/$defs/gitCommit" },
129
+ "status": { "enum": ["pending", "prepared", "delivering", "delivered", "failed", "blocked_uncertain", "cancelled"] },
130
+ "effect": { "$ref": "common.schema.json#/$defs/effectPolicy" },
131
+ "target": {
132
+ "type": "object",
133
+ "required": ["kind"],
134
+ "properties": {
135
+ "kind": { "enum": ["local-commit", "branch", "pull-request", "artifact", "deployment"] },
136
+ "ref": { "type": "string", "minLength": 1, "maxLength": 512 }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "receipts": {
141
+ "type": "array",
142
+ "items": { "$ref": "common.schema.json#/$defs/receipt" },
143
+ "maxItems": 32
144
+ },
145
+ "error": { "$ref": "common.schema.json#/$defs/errorSummary" }
146
+ },
147
+ "allOf": [
148
+ {
149
+ "if": { "properties": { "status": { "const": "delivered" } }, "required": ["status"] },
150
+ "then": {
151
+ "properties": { "receipts": { "type": "array", "minItems": 1 } },
152
+ "required": ["receipts"]
153
+ }
154
+ }
155
+ ],
156
+ "additionalProperties": false
157
+ }
158
+ }
159
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/environment.schema.json",
4
+ "title": "KXM portable environment overrides",
5
+ "type": "object",
6
+ "required": ["schema"],
7
+ "properties": {
8
+ "schema": { "const": "kxm.environment.v1" },
9
+ "values": {
10
+ "type": "object",
11
+ "propertyNames": {
12
+ "type": "string",
13
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
14
+ "maxLength": 128,
15
+ "not": {
16
+ "pattern": "(?:SECRET|TOKEN|PASSWORD|PASSWD|PRIVATE_KEY|API_KEY|CREDENTIAL|DATABASE_URL|CONNECTION_STRING)"
17
+ }
18
+ },
19
+ "additionalProperties": {
20
+ "oneOf": [
21
+ { "type": "string", "maxLength": 4096 },
22
+ { "type": "number" },
23
+ { "type": "boolean" }
24
+ ]
25
+ },
26
+ "maxProperties": 256
27
+ },
28
+ "secrets": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["name", "ref"],
33
+ "properties": {
34
+ "name": {
35
+ "type": "string",
36
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
37
+ "maxLength": 128
38
+ },
39
+ "ref": { "$ref": "common.schema.json#/$defs/identifier" },
40
+ "required": { "type": "boolean", "default": true }
41
+ },
42
+ "additionalProperties": false
43
+ },
44
+ "maxItems": 128
45
+ },
46
+ "path": {
47
+ "type": "object",
48
+ "properties": {
49
+ "prepend": {
50
+ "type": "array",
51
+ "items": { "$ref": "common.schema.json#/$defs/relativePath" },
52
+ "uniqueItems": true,
53
+ "maxItems": 32
54
+ },
55
+ "append": {
56
+ "type": "array",
57
+ "items": { "$ref": "common.schema.json#/$defs/relativePath" },
58
+ "uniqueItems": true,
59
+ "maxItems": 32
60
+ }
61
+ },
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "additionalProperties": false
66
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/gate-registry.schema.json",
4
+ "title": "KXM gate registry",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "gates"
9
+ ],
10
+ "properties": {
11
+ "schema": {
12
+ "const": "kxm.gate-registry.v1"
13
+ },
14
+ "gates": {
15
+ "type": "object",
16
+ "minProperties": 1,
17
+ "maxProperties": 64,
18
+ "propertyNames": {
19
+ "$ref": "common.schema.json#/$defs/identifier"
20
+ },
21
+ "additionalProperties": {
22
+ "oneOf": [
23
+ {
24
+ "$ref": "#/$defs/command"
25
+ },
26
+ {
27
+ "$ref": "#/$defs/artifactsExist"
28
+ },
29
+ {
30
+ "$ref": "#/$defs/reserved"
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ },
36
+ "additionalProperties": false,
37
+ "$defs": {
38
+ "command": {
39
+ "type": "object",
40
+ "required": [
41
+ "kind",
42
+ "argv",
43
+ "timeoutMs"
44
+ ],
45
+ "properties": {
46
+ "kind": {
47
+ "const": "command"
48
+ },
49
+ "argv": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "maxItems": 64,
53
+ "items": {
54
+ "type": "string",
55
+ "minLength": 1,
56
+ "maxLength": 4096,
57
+ "pattern": "^[^\\u0000]+$"
58
+ }
59
+ },
60
+ "timeoutMs": {
61
+ "type": "integer",
62
+ "minimum": 1,
63
+ "maximum": 2147483647
64
+ },
65
+ "cwd": {
66
+ "const": "control"
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ },
71
+ "artifactsExist": {
72
+ "type": "object",
73
+ "required": [
74
+ "kind",
75
+ "paths"
76
+ ],
77
+ "properties": {
78
+ "kind": {
79
+ "const": "artifacts-exist"
80
+ },
81
+ "paths": {
82
+ "type": "array",
83
+ "minItems": 1,
84
+ "maxItems": 64,
85
+ "uniqueItems": true,
86
+ "items": {
87
+ "$ref": "common.schema.json#/$defs/relativePath",
88
+ "not": {
89
+ "const": "."
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "additionalProperties": false
95
+ },
96
+ "reserved": {
97
+ "type": "object",
98
+ "required": [
99
+ "kind"
100
+ ],
101
+ "properties": {
102
+ "kind": {
103
+ "const": "reserved"
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/handoff-manifest.schema.json",
4
+ "title": "KXM structured handoff manifest v1",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "handoffId",
9
+ "taskId",
10
+ "workflowRunId",
11
+ "source",
12
+ "target",
13
+ "intent",
14
+ "status",
15
+ "baseCommit",
16
+ "deliverables",
17
+ "verificationEvidence",
18
+ "createdAt"
19
+ ],
20
+ "properties": {
21
+ "schema": {
22
+ "const": "kxm.handoff-manifest.v1"
23
+ },
24
+ "handoffId": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "maxLength": 128
28
+ },
29
+ "taskId": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 128
33
+ },
34
+ "workflowRunId": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "maxLength": 128
38
+ },
39
+ "reworkOf": {
40
+ "type": ["string", "null"]
41
+ },
42
+ "source": {
43
+ "type": "object",
44
+ "required": ["role", "agentId", "harness", "stepId", "attemptId"],
45
+ "properties": {
46
+ "role": { "type": "string", "minLength": 1, "maxLength": 64 },
47
+ "agentId": { "type": "string", "minLength": 1, "maxLength": 64 },
48
+ "harness": { "type": "string", "minLength": 1, "maxLength": 64 },
49
+ "model": { "type": "string", "maxLength": 128 },
50
+ "stepId": { "type": "string", "minLength": 1, "maxLength": 64 },
51
+ "attemptId": { "type": "string", "minLength": 1, "maxLength": 128 }
52
+ },
53
+ "additionalProperties": false
54
+ },
55
+ "target": {
56
+ "type": "object",
57
+ "required": ["role", "permission"],
58
+ "properties": {
59
+ "role": { "type": "string", "minLength": 1, "maxLength": 64 },
60
+ "permission": {
61
+ "enum": ["read-only", "edit", "admin"]
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "intent": {
67
+ "enum": ["request_review", "dispatch_fix", "request_approval", "complete_workflow"]
68
+ },
69
+ "status": {
70
+ "enum": ["pending", "accepted", "rejected", "superseded"]
71
+ },
72
+ "baseCommit": {
73
+ "type": "string",
74
+ "maxLength": 64
75
+ },
76
+ "candidateTreeHash": {
77
+ "type": "string",
78
+ "maxLength": 64
79
+ },
80
+ "deliverables": {
81
+ "type": "object",
82
+ "required": ["patches", "reports", "artifacts"],
83
+ "properties": {
84
+ "patches": {
85
+ "type": "array",
86
+ "items": { "type": "string" }
87
+ },
88
+ "reports": {
89
+ "type": "array",
90
+ "items": { "type": "string" }
91
+ },
92
+ "artifacts": {
93
+ "type": "array",
94
+ "items": {
95
+ "type": "object",
96
+ "required": ["name", "artifactRef"],
97
+ "properties": {
98
+ "name": { "type": "string" },
99
+ "artifactRef": { "type": "string" }
100
+ },
101
+ "additionalProperties": false
102
+ }
103
+ }
104
+ },
105
+ "additionalProperties": false
106
+ },
107
+ "verificationEvidence": {
108
+ "type": "object",
109
+ "required": ["witnessExitCode", "witnessPassed", "criticVerdicts"],
110
+ "properties": {
111
+ "witnessExitCode": { "type": "integer" },
112
+ "witnessPassed": { "type": "boolean" },
113
+ "criticVerdicts": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "object",
117
+ "required": ["critic", "verdict"],
118
+ "properties": {
119
+ "critic": { "type": "string" },
120
+ "verdict": { "enum": ["PASS", "FAIL", "WARN", "UNKNOWN"] },
121
+ "summary": { "type": "string" }
122
+ },
123
+ "additionalProperties": false
124
+ }
125
+ }
126
+ },
127
+ "additionalProperties": false
128
+ },
129
+ "openQuestions": {
130
+ "type": "array",
131
+ "items": { "type": "string" }
132
+ },
133
+ "suggestedNextStep": {
134
+ "type": "object",
135
+ "properties": {
136
+ "stepId": { "type": "string" },
137
+ "action": { "type": "string" }
138
+ },
139
+ "additionalProperties": false
140
+ },
141
+ "createdAt": {
142
+ "$ref": "common.schema.json#/$defs/timestamp"
143
+ }
144
+ },
145
+ "additionalProperties": false
146
+ }