@aiwg/cli 2026.9.20 → 2026.9.21

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 (272) hide show
  1. package/agentic/code/providers/capability-matrix.yaml +58 -6
  2. package/agentic/code/providers/model-capabilities.v1.json +34 -0
  3. package/agentic/code/providers/model-catalog.v1.json +55 -13
  4. package/bin/aiwg.mjs +2 -0
  5. package/dist/src/api/index.d.ts +1 -0
  6. package/dist/src/api/index.js +1 -0
  7. package/dist/src/artifacts/enrichment/cli.js +1 -1
  8. package/dist/src/artifacts/views/cli.js +1 -1
  9. package/dist/src/audit/operator-decision.js +10 -0
  10. package/dist/src/auth/credential-store.js +127 -27
  11. package/dist/src/catalog/builtin-models.json +272 -40
  12. package/dist/src/catalog/cli.js +1 -1
  13. package/dist/src/catalog/cli.mjs +1 -1
  14. package/dist/src/cli/handlers/effect.js +872 -0
  15. package/dist/src/cli/handlers/help.js +2 -0
  16. package/dist/src/cli/handlers/index.js +4 -2
  17. package/dist/src/cli/handlers/models.js +41 -10
  18. package/dist/src/cli/handlers/ralph.js +1 -1
  19. package/dist/src/cli/handlers/sessions.js +113 -37
  20. package/dist/src/cli/handlers/subcommands.js +31 -0
  21. package/dist/src/cli/handlers/use.js +46 -9
  22. package/dist/src/cli/handlers/utilities.js +10 -0
  23. package/dist/src/cli/handlers/workspace.js +3 -1
  24. package/dist/src/cli/scope-resolver.js +112 -9
  25. package/dist/src/cli/services/deployment-verification.js +5 -0
  26. package/dist/src/config/aiwg-config.js +3 -0
  27. package/dist/src/decision/acceptance-rollout.js +93 -0
  28. package/dist/src/decision/acceptance.js +175 -0
  29. package/dist/src/decision/adapters/jev.js +234 -13
  30. package/dist/src/decision/adapters/llm-subagent.js +60 -12
  31. package/dist/src/decision/admission.js +550 -0
  32. package/dist/src/decision/batch-benchmark.js +47 -0
  33. package/dist/src/decision/batch-receipts/accounting.js +75 -0
  34. package/dist/src/decision/batch-receipts/export.js +40 -0
  35. package/dist/src/decision/batch-receipts/index.js +9 -0
  36. package/dist/src/decision/batch-receipts/protection.js +40 -0
  37. package/dist/src/decision/batch-receipts/receipt.js +44 -0
  38. package/dist/src/decision/batch-receipts/result-store.js +341 -0
  39. package/dist/src/decision/batch-receipts/store.js +362 -0
  40. package/dist/src/decision/batch-receipts/types.js +2 -0
  41. package/dist/src/decision/batch-receipts/validate.js +127 -0
  42. package/dist/src/decision/batch.js +68 -0
  43. package/dist/src/decision/calibration/index.js +4 -0
  44. package/dist/src/decision/calibration/receipts.js +130 -0
  45. package/dist/src/decision/calibration/registry.js +258 -0
  46. package/dist/src/decision/calibration/types.js +2 -0
  47. package/dist/src/decision/compile-cache/benchmark.js +62 -0
  48. package/dist/src/decision/compile-cache/compatibility.js +65 -0
  49. package/dist/src/decision/compile-cache/file-store.js +280 -0
  50. package/dist/src/decision/compile-cache/identity.js +26 -0
  51. package/dist/src/decision/compile-cache/index.js +9 -0
  52. package/dist/src/decision/compile-cache/prefix.js +21 -0
  53. package/dist/src/decision/compile-cache/records.js +86 -0
  54. package/dist/src/decision/compile-cache/runtime.js +68 -0
  55. package/dist/src/decision/compile-cache/store.js +108 -0
  56. package/dist/src/decision/compile-cache/types.js +2 -0
  57. package/dist/src/decision/context-plan.js +234 -0
  58. package/dist/src/decision/context-qualification.js +60 -0
  59. package/dist/src/decision/ensemble/aggregate.js +215 -0
  60. package/dist/src/decision/ensemble/contract.js +316 -0
  61. package/dist/src/decision/ensemble/drift.js +51 -0
  62. package/dist/src/decision/ensemble/index.js +6 -0
  63. package/dist/src/decision/ensemble/report.js +71 -0
  64. package/dist/src/decision/ensemble/types.js +2 -0
  65. package/dist/src/decision/evaluate.js +1024 -78
  66. package/dist/src/decision/file-lifecycle-store.js +168 -0
  67. package/dist/src/decision/graph-beam.js +40 -0
  68. package/dist/src/decision/graph-budget.js +110 -0
  69. package/dist/src/decision/graph-decision-bridge.js +93 -0
  70. package/dist/src/decision/graph-evidence.js +123 -0
  71. package/dist/src/decision/graph-flow-adapter.js +56 -0
  72. package/dist/src/decision/graph-flow.js +105 -0
  73. package/dist/src/decision/graph-parallel.js +79 -0
  74. package/dist/src/decision/graph-patterns.js +20 -0
  75. package/dist/src/decision/graph-run-store.js +66 -0
  76. package/dist/src/decision/graph-run.js +166 -0
  77. package/dist/src/decision/graph-skill-bridge.js +91 -0
  78. package/dist/src/decision/graph-templates.js +56 -0
  79. package/dist/src/decision/graph.js +115 -0
  80. package/dist/src/decision/index.js +35 -0
  81. package/dist/src/decision/job-accounting.js +93 -0
  82. package/dist/src/decision/job-contract.js +186 -0
  83. package/dist/src/decision/job-effects.js +95 -0
  84. package/dist/src/decision/job-evaluate.js +80 -0
  85. package/dist/src/decision/job-gateway.js +121 -0
  86. package/dist/src/decision/job-http.js +194 -0
  87. package/dist/src/decision/job-payload-store.js +258 -0
  88. package/dist/src/decision/job-poll-limiter.js +92 -0
  89. package/dist/src/decision/job-quota.js +158 -0
  90. package/dist/src/decision/job-runtime.js +240 -0
  91. package/dist/src/decision/job-scheduler.js +26 -0
  92. package/dist/src/decision/job-service.js +117 -0
  93. package/dist/src/decision/job-store.js +264 -0
  94. package/dist/src/decision/job-worker.js +141 -0
  95. package/dist/src/decision/lifecycle.js +148 -0
  96. package/dist/src/decision/patterns/artifacts.js +173 -0
  97. package/dist/src/decision/patterns/catalog.js +108 -0
  98. package/dist/src/decision/patterns/durable-review.js +237 -0
  99. package/dist/src/decision/patterns/index.js +8 -0
  100. package/dist/src/decision/patterns/playground.js +401 -0
  101. package/dist/src/decision/patterns/recorded.js +43 -0
  102. package/dist/src/decision/patterns/specs.js +174 -0
  103. package/dist/src/decision/patterns/types.js +2 -0
  104. package/dist/src/decision/portable-secrets.js +53 -0
  105. package/dist/src/decision/projection.js +210 -0
  106. package/dist/src/decision/qualification/capture.js +67 -0
  107. package/dist/src/decision/qualification/drift.js +68 -0
  108. package/dist/src/decision/qualification/gate-evidence.js +172 -0
  109. package/dist/src/decision/qualification/gates.js +83 -0
  110. package/dist/src/decision/qualification/index.js +12 -0
  111. package/dist/src/decision/qualification/load.js +275 -0
  112. package/dist/src/decision/qualification/manifest.js +37 -0
  113. package/dist/src/decision/qualification/privacy.js +41 -0
  114. package/dist/src/decision/qualification/quality.js +213 -0
  115. package/dist/src/decision/qualification/release.js +116 -0
  116. package/dist/src/decision/qualification/runner.js +408 -0
  117. package/dist/src/decision/qualification/types.js +2 -0
  118. package/dist/src/decision/receipts.js +30 -7
  119. package/dist/src/decision/result-cache/index.js +6 -0
  120. package/dist/src/decision/result-cache/integrity.js +28 -0
  121. package/dist/src/decision/result-cache/key.js +28 -0
  122. package/dist/src/decision/result-cache/service.js +92 -0
  123. package/dist/src/decision/result-cache/store.js +327 -0
  124. package/dist/src/decision/result-cache/types.js +3 -0
  125. package/dist/src/decision/review/authorization.js +110 -0
  126. package/dist/src/decision/review/effect-ledger-adapter.js +321 -0
  127. package/dist/src/decision/review/index.js +12 -0
  128. package/dist/src/decision/review/migrate.js +34 -0
  129. package/dist/src/decision/review/operator-audit.js +59 -0
  130. package/dist/src/decision/review/recovery-adapters.js +252 -0
  131. package/dist/src/decision/review/recovery.js +33 -0
  132. package/dist/src/decision/review/service.js +498 -0
  133. package/dist/src/decision/review/store.js +219 -0
  134. package/dist/src/decision/review/types.js +2 -0
  135. package/dist/src/decision/review/validate.js +205 -0
  136. package/dist/src/decision/scheduler.js +115 -0
  137. package/dist/src/decision/telemetry/context.js +42 -0
  138. package/dist/src/decision/telemetry/debug-sidecar.js +152 -0
  139. package/dist/src/decision/telemetry/exporter.js +77 -0
  140. package/dist/src/decision/telemetry/file-debug-backend.js +112 -0
  141. package/dist/src/decision/telemetry/index.js +13 -0
  142. package/dist/src/decision/telemetry/mapping.js +146 -0
  143. package/dist/src/decision/telemetry/metrics.js +164 -0
  144. package/dist/src/decision/telemetry/otlp-http.js +183 -0
  145. package/dist/src/decision/telemetry/redaction.js +93 -0
  146. package/dist/src/decision/telemetry/retention.js +109 -0
  147. package/dist/src/decision/telemetry/runtime.js +310 -0
  148. package/dist/src/decision/telemetry/trace.js +158 -0
  149. package/dist/src/decision/telemetry/types.js +3 -0
  150. package/dist/src/decision/validate.js +135 -5
  151. package/dist/src/effects/checkpoint-sinks.js +94 -0
  152. package/dist/src/effects/checkpoint.js +76 -0
  153. package/dist/src/effects/decision-links.js +54 -0
  154. package/dist/src/effects/errors.js +48 -0
  155. package/dist/src/effects/identity.js +178 -0
  156. package/dist/src/effects/index.js +25 -0
  157. package/dist/src/effects/keyring.js +160 -0
  158. package/dist/src/effects/keys.js +130 -0
  159. package/dist/src/effects/ledger.js +435 -0
  160. package/dist/src/effects/lifecycle.js +110 -0
  161. package/dist/src/effects/lock-recovery.js +269 -0
  162. package/dist/src/effects/reader.js +103 -0
  163. package/dist/src/effects/records.js +114 -0
  164. package/dist/src/effects/redaction.js +51 -0
  165. package/dist/src/effects/schema.js +73 -0
  166. package/dist/src/effects/store.js +239 -0
  167. package/dist/src/effects/types.js +49 -0
  168. package/dist/src/effects/verifiers/decision.js +168 -0
  169. package/dist/src/effects/verifiers/file.js +106 -0
  170. package/dist/src/effects/verifiers/git.js +206 -0
  171. package/dist/src/effects/verifiers/index.js +90 -0
  172. package/dist/src/effects/verifiers/registry.js +148 -0
  173. package/dist/src/effects/verifiers/review.js +123 -0
  174. package/dist/src/effects/verifiers/tracker.js +299 -0
  175. package/dist/src/effects/verifiers/types.js +21 -0
  176. package/dist/src/effects/verify.js +295 -0
  177. package/dist/src/evidence/bundle.js +2 -0
  178. package/dist/src/extensions/commands/definitions.js +28 -0
  179. package/dist/src/extensions/manifest.js +1 -0
  180. package/dist/src/marketplace/provenance.js +25 -27
  181. package/dist/src/mcp/cli.mjs +11 -1
  182. package/dist/src/mcp/grok-build-config.mjs +189 -0
  183. package/dist/src/mcp/registry.js +21 -1
  184. package/dist/src/mcp/registry.mjs +20 -1
  185. package/dist/src/models/grok-build-models.js +356 -0
  186. package/dist/src/models/index.js +1 -0
  187. package/dist/src/models/model-capabilities.v1.json +34 -0
  188. package/dist/src/models/model-catalog.v1.json +55 -13
  189. package/dist/src/models/model-discovery.js +41 -5
  190. package/dist/src/models/provider-policy.js +3 -2
  191. package/dist/src/plugin/skill-command-translator.js +1 -0
  192. package/dist/src/providers/capability-matrix.yaml +58 -6
  193. package/dist/src/providers/grok-build-acp.js +192 -0
  194. package/dist/src/providers/grok-build-dispatch.js +251 -0
  195. package/dist/src/providers/grok-build-headless.js +170 -0
  196. package/dist/src/providers/muse-paths.js +105 -0
  197. package/dist/src/providers/provider-definitions.js +93 -7
  198. package/dist/src/providers/provider-definitions.mjs +21 -1
  199. package/dist/src/providers/provider-inventory.js +3 -0
  200. package/dist/src/security/artifact-attestation.js +4 -8
  201. package/dist/src/security/signing.js +119 -0
  202. package/dist/src/sessions/adapters/grok-build.js +187 -0
  203. package/dist/src/sessions/adapters/muse.js +412 -0
  204. package/dist/src/sessions/contracts.js +1 -1
  205. package/dist/src/sessions/grok-build-cli.js +196 -0
  206. package/dist/src/sessions/index.js +3 -0
  207. package/dist/src/sessions/workspace-discovery.js +9 -5
  208. package/dist/src/skills/deployer.js +33 -5
  209. package/dist/src/smiths/context-pipeline/claude-hook.js +2 -0
  210. package/dist/src/smiths/context-pipeline/context-file-safety.js +18 -0
  211. package/dist/src/smiths/context-pipeline/finalization.js +1 -32
  212. package/dist/src/smiths/context-pipeline/generator.js +12 -0
  213. package/dist/src/smiths/context-pipeline/index.js +1 -1
  214. package/dist/src/smiths/context-pipeline/managed-hook.js +2 -0
  215. package/dist/src/smiths/context-pipeline/muse-bridge.js +50 -0
  216. package/dist/src/smiths/context-pipeline/provider-policy.js +5 -0
  217. package/dist/src/smiths/context-pipeline/workspace-context.js +22 -16
  218. package/dist/src/smiths/hook-bridge/grok-build-translator.js +64 -0
  219. package/dist/src/smiths/hook-bridge/index.js +3 -0
  220. package/dist/src/smiths/hook-bridge/shim.js +2 -0
  221. package/dist/src/smiths/hook-bridge/types.js +5 -0
  222. package/dist/src/smiths/skillsmith/collision-detector.js +1 -0
  223. package/dist/src/storage/protected-files.js +102 -0
  224. package/dist/src/tracker/forge-http.js +371 -0
  225. package/dist/src/tracker/project-inputs.js +41 -0
  226. package/package.json +2 -1
  227. package/schemas/decision/BatchReceipt.v1.schema.json +50 -0
  228. package/schemas/decision/CalibrationArtifact.v1.schema.json +76 -0
  229. package/schemas/decision/CalibrationCompatibility.v1.schema.json +18 -0
  230. package/schemas/decision/CalibrationGovernanceReceipt.v1.schema.json +44 -0
  231. package/schemas/decision/DecisionAdmissionEvidence.v1.schema.json +43 -0
  232. package/schemas/decision/DecisionBinding.schema.json +309 -0
  233. package/schemas/decision/DecisionBinding.v1alpha2.schema.json +369 -0
  234. package/schemas/decision/DecisionCacheTelemetry.v1.schema.json +20 -0
  235. package/schemas/decision/DecisionChampionChallenger.v1.schema.json +100 -0
  236. package/schemas/decision/DecisionCompileCacheEntry.v1.schema.json +35 -0
  237. package/schemas/decision/DecisionCompileCacheIdentity.v1.schema.json +26 -0
  238. package/schemas/decision/DecisionCompileCacheTombstone.v1.schema.json +31 -0
  239. package/schemas/decision/DecisionContextEvidence.v1.schema.json +136 -0
  240. package/schemas/decision/DecisionDefinition.schema.json +159 -0
  241. package/schemas/decision/DecisionDefinition.v1alpha2.schema.json +203 -0
  242. package/schemas/decision/DecisionDriftResponse.v1.schema.json +55 -0
  243. package/schemas/decision/DecisionEnsembleAggregate.v1.schema.json +86 -0
  244. package/schemas/decision/DecisionEnsembleIntegrityReport.v1.schema.json +64 -0
  245. package/schemas/decision/DecisionEnsemblePolicy.v1.schema.json +130 -0
  246. package/schemas/decision/DecisionGraph.v1.schema.json +77 -0
  247. package/schemas/decision/DecisionJob.v1.schema.json +71 -0
  248. package/schemas/decision/DecisionLifecyclePolicy.v1.schema.json +52 -0
  249. package/schemas/decision/DecisionProjectionPolicy.v1.schema.json +65 -0
  250. package/schemas/decision/DecisionProviderPrefixCompatibility.v1.schema.json +45 -0
  251. package/schemas/decision/DecisionProviderPrefixEvidence.v1.schema.json +17 -0
  252. package/schemas/decision/DecisionProviderPrefixIdentity.v1.schema.json +36 -0
  253. package/schemas/decision/DecisionResult.schema.json +524 -0
  254. package/schemas/decision/DecisionResult.v1alpha2.schema.json +619 -0
  255. package/schemas/decision/DecisionResultCacheEntry.v1.schema.json +53 -0
  256. package/schemas/decision/DecisionReview.schema.json +29 -0
  257. package/schemas/decision/DecisionRuleset.schema.json +313 -0
  258. package/schemas/decision/DecisionRuleset.v1alpha2.schema.json +313 -0
  259. package/schemas/decision/DecisionTelemetryTrace.v1.schema.json +95 -0
  260. package/schemas/decision/RulesetResult.schema.json +721 -0
  261. package/schemas/decision/RulesetResult.v1alpha2.schema.json +891 -0
  262. package/schemas/security/pr-evidence-receipt.v1.schema.json +77 -0
  263. package/schemas/security/threat-assessment-report.v1.schema.json +71 -1
  264. package/tools/agents/deploy-agents.mjs +21 -6
  265. package/tools/agents/providers/base.mjs +7 -4
  266. package/tools/agents/providers/codex.mjs +1 -1
  267. package/tools/agents/providers/grok-build.d.mts +7 -0
  268. package/tools/agents/providers/grok-build.mjs +249 -9
  269. package/tools/agents/providers/model-role.mjs +6 -3
  270. package/tools/agents/providers/muse-hooks.mjs +785 -0
  271. package/tools/agents/providers/muse-paths.mjs +112 -0
  272. package/tools/agents/providers/muse.mjs +336 -0
@@ -0,0 +1,136 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/DecisionContextEvidence.v1.schema.json",
4
+ "title": "Decision Context Evidence v1",
5
+ "description": "Body-free D06 context plan and estimate-versus-actual usage. Only identifiers, digests and token counts are permitted; authorized state and question bodies are excluded by construction.",
6
+ "type": "object",
7
+ "properties": {
8
+ "plan": { "$ref": "#/$defs/plan" },
9
+ "actualUsage": { "type": "array", "items": { "$ref": "#/$defs/usage" } }
10
+ },
11
+ "required": ["plan", "actualUsage"],
12
+ "additionalProperties": false,
13
+ "$defs": {
14
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
15
+ "tokens": { "type": "integer", "minimum": 0 },
16
+ "identity": {
17
+ "type": "object",
18
+ "properties": {
19
+ "id": { "type": "string", "minLength": 1 },
20
+ "version": { "type": "string", "minLength": 1 }
21
+ },
22
+ "required": ["id", "version"],
23
+ "additionalProperties": false
24
+ },
25
+ "questionIds": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "uniqueItems": true,
29
+ "items": { "type": "string", "minLength": 1 }
30
+ },
31
+ "plan": {
32
+ "type": "object",
33
+ "properties": {
34
+ "schemaVersion": { "const": "decision-context-plan/v1" },
35
+ "planDigest": { "$ref": "#/$defs/digest" },
36
+ "assumptionsDigest": { "$ref": "#/$defs/digest" },
37
+ "inputDigest": { "$ref": "#/$defs/digest" },
38
+ "subject": { "type": "string", "minLength": 1 },
39
+ "authorizationDigest": { "$ref": "#/$defs/digest" },
40
+ "incompleteContext": { "type": "boolean" },
41
+ "automaticActionAllowed": { "type": "boolean" },
42
+ "estimator": { "$ref": "#/$defs/identity" },
43
+ "providerProfile": {
44
+ "type": "object",
45
+ "properties": {
46
+ "id": { "type": "string", "minLength": 1 },
47
+ "version": { "type": "string", "minLength": 1 },
48
+ "digest": { "$ref": "#/$defs/digest" }
49
+ },
50
+ "required": ["id", "version", "digest"],
51
+ "additionalProperties": false
52
+ },
53
+ "limits": {
54
+ "type": "object",
55
+ "properties": {
56
+ "documentedAggregateTokens": { "type": "integer", "minimum": 1 },
57
+ "documentedStateAndLongestQuestionTokens": { "type": "integer", "minimum": 1 },
58
+ "safetyMarginBps": { "type": "integer", "minimum": 0, "maximum": 9999 },
59
+ "effectiveAggregateTokens": { "$ref": "#/$defs/tokens" },
60
+ "effectiveStateAndLongestQuestionTokens": { "$ref": "#/$defs/tokens" }
61
+ },
62
+ "required": ["documentedAggregateTokens", "documentedStateAndLongestQuestionTokens", "safetyMarginBps",
63
+ "effectiveAggregateTokens", "effectiveStateAndLongestQuestionTokens"],
64
+ "additionalProperties": false
65
+ },
66
+ "rawEstimate": {
67
+ "type": "object",
68
+ "properties": {
69
+ "stateTokens": { "$ref": "#/$defs/tokens" },
70
+ "allQuestionTokens": { "$ref": "#/$defs/tokens" },
71
+ "longestQuestionTokens": { "$ref": "#/$defs/tokens" },
72
+ "aggregateTokens": { "$ref": "#/$defs/tokens" },
73
+ "stateAndLongestQuestionTokens": { "$ref": "#/$defs/tokens" }
74
+ },
75
+ "required": ["stateTokens", "allQuestionTokens", "longestQuestionTokens", "aggregateTokens",
76
+ "stateAndLongestQuestionTokens"],
77
+ "additionalProperties": false
78
+ },
79
+ "partitions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/partition" } }
80
+ },
81
+ "required": ["schemaVersion", "planDigest", "assumptionsDigest", "inputDigest", "subject", "authorizationDigest",
82
+ "incompleteContext", "automaticActionAllowed", "estimator", "providerProfile", "limits", "rawEstimate", "partitions"],
83
+ "additionalProperties": false
84
+ },
85
+ "partition": {
86
+ "type": "object",
87
+ "properties": {
88
+ "id": { "type": "string", "minLength": 1 },
89
+ "wave": { "type": "integer", "minimum": 0 },
90
+ "compatibilityKey": { "type": "string", "minLength": 1 },
91
+ "subject": { "type": "string", "minLength": 1 },
92
+ "stateDigest": { "$ref": "#/$defs/digest" },
93
+ "questionIds": { "$ref": "#/$defs/questionIds" },
94
+ "questionDigests": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/digest" } },
95
+ "questionDependencies": {
96
+ "type": "object",
97
+ "additionalProperties": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
98
+ },
99
+ "estimate": {
100
+ "type": "object",
101
+ "properties": {
102
+ "stateTokens": { "$ref": "#/$defs/tokens" },
103
+ "questionTokens": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/tokens" } },
104
+ "longestQuestionTokens": { "$ref": "#/$defs/tokens" },
105
+ "aggregateTokens": { "$ref": "#/$defs/tokens" },
106
+ "stateAndLongestQuestionTokens": { "$ref": "#/$defs/tokens" }
107
+ },
108
+ "required": ["stateTokens", "questionTokens", "longestQuestionTokens", "aggregateTokens", "stateAndLongestQuestionTokens"],
109
+ "additionalProperties": false
110
+ },
111
+ "reason": { "enum": ["fits-original-group", "aggregate-limit-partition", "dependency-wave"] }
112
+ },
113
+ "required": ["id", "wave", "compatibilityKey", "subject", "stateDigest", "questionIds", "questionDigests",
114
+ "questionDependencies", "estimate", "reason"],
115
+ "additionalProperties": false
116
+ },
117
+ "usage": {
118
+ "type": "object",
119
+ "properties": {
120
+ "schemaVersion": { "const": "decision-context-usage/v1" },
121
+ "planDigest": { "$ref": "#/$defs/digest" },
122
+ "partitionId": { "type": "string", "minLength": 1 },
123
+ "questionIds": { "$ref": "#/$defs/questionIds" },
124
+ "estimator": { "$ref": "#/$defs/identity" },
125
+ "providerProfile": { "$ref": "#/$defs/identity" },
126
+ "estimatedInputTokens": { "$ref": "#/$defs/tokens" },
127
+ "actualInputTokens": { "$ref": "#/$defs/tokens" },
128
+ "estimationErrorTokens": { "type": "integer" },
129
+ "estimationErrorBps": { "type": ["integer", "null"] }
130
+ },
131
+ "required": ["schemaVersion", "planDigest", "partitionId", "questionIds", "estimator", "providerProfile",
132
+ "estimatedInputTokens", "actualInputTokens", "estimationErrorTokens", "estimationErrorBps"],
133
+ "additionalProperties": false
134
+ }
135
+ }
136
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/DecisionDefinition.v1alpha1.schema.json",
4
+ "type": "object",
5
+ "properties": {
6
+ "apiVersion": {
7
+ "const": "decision.aiwg.io/v1alpha1"
8
+ },
9
+ "kind": {
10
+ "const": "DecisionDefinition"
11
+ },
12
+ "metadata": {
13
+ "type": "object",
14
+ "properties": {
15
+ "id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "version": {
20
+ "type": "string",
21
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
22
+ },
23
+ "description": {
24
+ "type": "string",
25
+ "minLength": 1
26
+ }
27
+ },
28
+ "required": [
29
+ "id",
30
+ "version",
31
+ "description"
32
+ ],
33
+ "additionalProperties": false
34
+ },
35
+ "spec": {
36
+ "type": "object",
37
+ "properties": {
38
+ "purpose": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "inputSchema": {
43
+ "type": "object"
44
+ },
45
+ "question": {
46
+ "type": "string",
47
+ "minLength": 1
48
+ },
49
+ "answer": {
50
+ "oneOf": [
51
+ {
52
+ "type": "object",
53
+ "properties": {
54
+ "kind": {
55
+ "const": "choice"
56
+ },
57
+ "options": {
58
+ "type": "array",
59
+ "items": {
60
+ "type": "object",
61
+ "properties": {
62
+ "id": {
63
+ "type": "string",
64
+ "minLength": 1
65
+ },
66
+ "description": {
67
+ "type": "string",
68
+ "minLength": 1
69
+ }
70
+ },
71
+ "required": [
72
+ "id",
73
+ "description"
74
+ ],
75
+ "additionalProperties": false
76
+ },
77
+ "minItems": 2,
78
+ "maxItems": 255
79
+ }
80
+ },
81
+ "required": [
82
+ "kind",
83
+ "options"
84
+ ],
85
+ "additionalProperties": false
86
+ },
87
+ {
88
+ "type": "object",
89
+ "properties": {
90
+ "kind": {
91
+ "const": "ordinal-score"
92
+ },
93
+ "levels": {
94
+ "type": "array",
95
+ "items": {
96
+ "type": "string",
97
+ "minLength": 1
98
+ },
99
+ "minItems": 2,
100
+ "maxItems": 10
101
+ }
102
+ },
103
+ "required": [
104
+ "kind",
105
+ "levels"
106
+ ],
107
+ "additionalProperties": false
108
+ },
109
+ {
110
+ "type": "object",
111
+ "properties": {
112
+ "kind": {
113
+ "const": "truth-probability"
114
+ },
115
+ "trueDescription": {
116
+ "type": "string",
117
+ "minLength": 1
118
+ },
119
+ "falseDescription": {
120
+ "type": "string",
121
+ "minLength": 1
122
+ }
123
+ },
124
+ "required": [
125
+ "kind",
126
+ "trueDescription",
127
+ "falseDescription"
128
+ ],
129
+ "additionalProperties": false
130
+ }
131
+ ]
132
+ },
133
+ "requiredCapabilities": {
134
+ "type": "array",
135
+ "items": {
136
+ "type": "string",
137
+ "minLength": 1
138
+ },
139
+ "minItems": 0
140
+ }
141
+ },
142
+ "required": [
143
+ "purpose",
144
+ "inputSchema",
145
+ "question",
146
+ "answer",
147
+ "requiredCapabilities"
148
+ ],
149
+ "additionalProperties": false
150
+ }
151
+ },
152
+ "required": [
153
+ "apiVersion",
154
+ "kind",
155
+ "metadata",
156
+ "spec"
157
+ ],
158
+ "additionalProperties": false
159
+ }
@@ -0,0 +1,203 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/DecisionDefinition.v1alpha2.schema.json",
4
+ "type": "object",
5
+ "properties": {
6
+ "apiVersion": {
7
+ "const": "decision.aiwg.io/v1alpha2"
8
+ },
9
+ "kind": {
10
+ "const": "DecisionDefinition"
11
+ },
12
+ "metadata": {
13
+ "type": "object",
14
+ "properties": {
15
+ "id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "version": {
20
+ "type": "string",
21
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
22
+ },
23
+ "description": {
24
+ "type": "string",
25
+ "minLength": 1
26
+ }
27
+ },
28
+ "required": [
29
+ "id",
30
+ "version",
31
+ "description"
32
+ ],
33
+ "additionalProperties": false
34
+ },
35
+ "spec": {
36
+ "type": "object",
37
+ "properties": {
38
+ "purpose": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "inputSchema": {
43
+ "type": "object"
44
+ },
45
+ "question": {
46
+ "oneOf": [
47
+ {
48
+ "type": "string",
49
+ "minLength": 1
50
+ },
51
+ {
52
+ "type": "object",
53
+ "additionalProperties": {
54
+ "$ref": "#/$defs/entry"
55
+ },
56
+ "minProperties": 1
57
+ },
58
+ {
59
+ "type": "array",
60
+ "items": {
61
+ "$ref": "#/$defs/entry"
62
+ },
63
+ "minItems": 1
64
+ }
65
+ ]
66
+ },
67
+ "answer": {
68
+ "oneOf": [
69
+ {
70
+ "type": "object",
71
+ "properties": {
72
+ "kind": {
73
+ "const": "choice"
74
+ },
75
+ "options": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "object",
79
+ "properties": {
80
+ "id": {
81
+ "type": "string",
82
+ "minLength": 1
83
+ },
84
+ "description": {
85
+ "$ref": "#/$defs/entry"
86
+ }
87
+ },
88
+ "required": [
89
+ "id",
90
+ "description"
91
+ ],
92
+ "additionalProperties": false
93
+ },
94
+ "minItems": 2,
95
+ "maxItems": 255
96
+ }
97
+ },
98
+ "required": [
99
+ "kind",
100
+ "options"
101
+ ],
102
+ "additionalProperties": false
103
+ },
104
+ {
105
+ "type": "object",
106
+ "properties": {
107
+ "kind": {
108
+ "const": "ordinal-score"
109
+ },
110
+ "levels": {
111
+ "type": "array",
112
+ "items": {
113
+ "$ref": "#/$defs/entry"
114
+ },
115
+ "minItems": 2,
116
+ "maxItems": 10
117
+ }
118
+ },
119
+ "required": [
120
+ "kind",
121
+ "levels"
122
+ ],
123
+ "additionalProperties": false
124
+ },
125
+ {
126
+ "type": "object",
127
+ "properties": {
128
+ "kind": {
129
+ "const": "truth-probability"
130
+ },
131
+ "trueDescription": {
132
+ "$ref": "#/$defs/entry"
133
+ },
134
+ "falseDescription": {
135
+ "$ref": "#/$defs/entry"
136
+ }
137
+ },
138
+ "required": [
139
+ "kind",
140
+ "trueDescription",
141
+ "falseDescription"
142
+ ],
143
+ "additionalProperties": false
144
+ }
145
+ ]
146
+ },
147
+ "requiredCapabilities": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string",
151
+ "minLength": 1
152
+ },
153
+ "minItems": 0
154
+ }
155
+ },
156
+ "required": [
157
+ "purpose",
158
+ "inputSchema",
159
+ "question",
160
+ "answer",
161
+ "requiredCapabilities"
162
+ ],
163
+ "additionalProperties": false
164
+ }
165
+ },
166
+ "required": [
167
+ "apiVersion",
168
+ "kind",
169
+ "metadata",
170
+ "spec"
171
+ ],
172
+ "additionalProperties": false,
173
+ "$defs": {
174
+ "entry": {
175
+ "anyOf": [
176
+ {
177
+ "type": "string"
178
+ },
179
+ {
180
+ "type": "number"
181
+ },
182
+ {
183
+ "type": "boolean"
184
+ },
185
+ {
186
+ "type": "null"
187
+ },
188
+ {
189
+ "type": "array",
190
+ "items": {
191
+ "$ref": "#/$defs/entry"
192
+ }
193
+ },
194
+ {
195
+ "type": "object",
196
+ "additionalProperties": {
197
+ "$ref": "#/$defs/entry"
198
+ }
199
+ }
200
+ ]
201
+ }
202
+ }
203
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/DecisionDriftResponse.v1.schema.json",
4
+ "title": "Decision Drift Response",
5
+ "description": "D17 contract mapping each declared drift signal to exactly one configured safe response. Consumes D09 AliasDriftEvent records; this schema does not execute responses.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "id", "version", "alias", "thresholds", "window", "rules", "insufficientSamplesResponse"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "decision-drift-response/v1" },
11
+ "id": { "$ref": "#/$defs/name" },
12
+ "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
13
+ "alias": { "$ref": "#/$defs/name" },
14
+ "thresholds": {
15
+ "type": "object", "additionalProperties": false, "required": ["version", "digest", "registeredAt"],
16
+ "properties": {
17
+ "version": { "$ref": "#/$defs/name" },
18
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
19
+ "registeredAt": { "type": "string", "format": "date-time" }
20
+ }
21
+ },
22
+ "window": {
23
+ "type": "object", "additionalProperties": false, "required": ["kind", "size", "minimumSamples"],
24
+ "properties": {
25
+ "kind": { "enum": ["observations", "duration-ms"] },
26
+ "size": { "type": "integer", "minimum": 1 },
27
+ "minimumSamples": { "type": "integer", "minimum": 1 }
28
+ }
29
+ },
30
+ "rules": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/rule" } },
31
+ "insufficientSamplesResponse": { "$ref": "#/$defs/response" }
32
+ },
33
+ "$defs": {
34
+ "name": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$" },
35
+ "response": { "enum": ["alert", "reduce-coverage", "route-to-review", "disable-challenger", "restore-champion", "require-recertification"] },
36
+ "rule": {
37
+ "type": "object", "additionalProperties": false, "required": ["id", "source", "metric", "thresholdBps", "response"],
38
+ "properties": {
39
+ "id": { "$ref": "#/$defs/name" },
40
+ "source": { "enum": ["alias-drift", "output-distribution", "label-drift"] },
41
+ "metric": { "enum": ["identity-change", "jensen-shannon-v1", "population-stability-index-v1", "label-error-rate-delta-v1", "calibration-error-delta-v1"] },
42
+ "thresholdBps": { "type": ["integer", "null"], "minimum": 0, "maximum": 1000000 },
43
+ "response": { "$ref": "#/$defs/response" }
44
+ },
45
+ "allOf": [
46
+ { "if": { "properties": { "source": { "const": "alias-drift" } } },
47
+ "then": { "properties": { "metric": { "const": "identity-change" }, "thresholdBps": { "type": "null" } } } },
48
+ { "if": { "properties": { "source": { "const": "output-distribution" } } },
49
+ "then": { "properties": { "metric": { "enum": ["jensen-shannon-v1", "population-stability-index-v1"] }, "thresholdBps": { "type": "integer" } } } },
50
+ { "if": { "properties": { "source": { "const": "label-drift" } } },
51
+ "then": { "properties": { "metric": { "enum": ["label-error-rate-delta-v1", "calibration-error-delta-v1"] }, "thresholdBps": { "type": "integer" } } } }
52
+ ]
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/DecisionEnsembleAggregate.v1.schema.json",
4
+ "title": "Decision Ensemble Aggregate",
5
+ "description": "Derived D17 aggregate over recorded member results. Agreement is a stability signal: this record has no calibrated or correctness value and its correctness gate is never satisfied by agreement alone.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "policy", "primitive", "algorithm", "semantics", "provenance", "members", "counts", "outcome", "statistics", "disagreement", "warnings", "correctnessGate", "digest"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "decision-ensemble-aggregate/v1" },
11
+ "policy": {
12
+ "type": "object", "additionalProperties": false, "required": ["id", "version", "digest"],
13
+ "properties": { "id": { "type": "string", "minLength": 1 }, "version": { "type": "string", "minLength": 1 }, "digest": { "$ref": "#/$defs/digest" } }
14
+ },
15
+ "primitive": { "enum": ["choice", "truth-probability", "ordinal-score"] },
16
+ "algorithm": { "$ref": "#/$defs/versionedId" },
17
+ "semantics": { "const": "stability-signal-not-correctness" },
18
+ "provenance": { "const": "derived" },
19
+ "members": {
20
+ "type": "array", "minItems": 1,
21
+ "items": {
22
+ "type": "object", "additionalProperties": false, "required": ["memberId", "sampleIndex", "status", "resultDigest", "value"],
23
+ "properties": {
24
+ "memberId": { "type": "string", "minLength": 1 },
25
+ "sampleIndex": { "type": "integer", "minimum": 0 },
26
+ "status": { "enum": ["succeeded", "failed", "abstained"] },
27
+ "resultDigest": { "$ref": "#/$defs/digest" },
28
+ "value": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "null" }] }
29
+ }
30
+ }
31
+ },
32
+ "counts": {
33
+ "type": "object", "additionalProperties": false, "required": ["declared", "succeeded", "failed", "abstained"],
34
+ "properties": {
35
+ "declared": { "type": "integer", "minimum": 1 }, "succeeded": { "type": "integer", "minimum": 0 },
36
+ "failed": { "type": "integer", "minimum": 0 }, "abstained": { "type": "integer", "minimum": 0 }
37
+ }
38
+ },
39
+ "outcome": {
40
+ "type": "object", "additionalProperties": false, "required": ["disposition", "value", "reason", "tie", "tieRule"],
41
+ "properties": {
42
+ "disposition": { "enum": ["accept", "defer", "review"] },
43
+ "value": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "null" }] },
44
+ "reason": { "enum": ["aggregated", "tie", "disagreement-exceeded", "insufficient-members"] },
45
+ "tie": { "type": "boolean" },
46
+ "tieRule": { "enum": ["lowest-canonical-value", "defer", "review", null] }
47
+ }
48
+ },
49
+ "statistics": {
50
+ "type": "object", "additionalProperties": false, "required": ["votes", "meanProbability", "meanDistribution", "meanScore", "medianScore", "dispersion"],
51
+ "properties": {
52
+ "votes": { "anyOf": [{ "type": "null" }, { "type": "object", "additionalProperties": { "type": "integer", "minimum": 0 } }] },
53
+ "meanProbability": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
54
+ "meanDistribution": { "anyOf": [{ "type": "null" }, { "type": "object", "additionalProperties": { "type": "number", "minimum": 0, "maximum": 1 } }] },
55
+ "meanScore": { "type": ["number", "null"], "minimum": 0 },
56
+ "medianScore": { "type": ["number", "null"], "minimum": 0 },
57
+ "dispersion": { "type": ["number", "null"], "minimum": 0 }
58
+ }
59
+ },
60
+ "disagreement": {
61
+ "type": "object", "additionalProperties": false, "required": ["metric", "valueBps", "thresholdBps", "exceeded"],
62
+ "properties": {
63
+ "metric": { "$ref": "#/$defs/versionedId" },
64
+ "valueBps": { "type": "integer", "minimum": 0, "maximum": 10000 },
65
+ "thresholdBps": { "type": "integer", "minimum": 0, "maximum": 10000 },
66
+ "exceeded": { "type": "boolean" }
67
+ }
68
+ },
69
+ "warnings": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
70
+ "correctnessGate": {
71
+ "type": "object", "additionalProperties": false, "required": ["status", "reason"],
72
+ "properties": {
73
+ "status": { "const": "not-satisfied" },
74
+ "reason": { "const": "agreement-is-not-correctness-evidence" }
75
+ }
76
+ },
77
+ "digest": { "$ref": "#/$defs/digest" }
78
+ },
79
+ "$defs": {
80
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
81
+ "versionedId": {
82
+ "type": "object", "additionalProperties": false, "required": ["id", "version"],
83
+ "properties": { "id": { "type": "string", "pattern": "^[a-z0-9-]+-v[0-9]+$" }, "version": { "type": "string", "pattern": "^v[0-9]+$" } }
84
+ }
85
+ }
86
+ }