@aiwg/cli 2026.9.20 → 2026.9.24

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 (275) 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/cli.js +23 -18
  8. package/dist/src/artifacts/enrichment/cli.js +1 -1
  9. package/dist/src/artifacts/fortemi-core-query-adapter.js +6 -2
  10. package/dist/src/artifacts/query-engine.js +14 -4
  11. package/dist/src/artifacts/views/cli.js +1 -1
  12. package/dist/src/audit/operator-decision.js +10 -0
  13. package/dist/src/auth/credential-store.js +127 -27
  14. package/dist/src/catalog/builtin-models.json +272 -40
  15. package/dist/src/catalog/cli.js +1 -1
  16. package/dist/src/catalog/cli.mjs +1 -1
  17. package/dist/src/cli/handlers/effect.js +872 -0
  18. package/dist/src/cli/handlers/help.js +2 -0
  19. package/dist/src/cli/handlers/index.js +4 -2
  20. package/dist/src/cli/handlers/models.js +41 -10
  21. package/dist/src/cli/handlers/ralph.js +1 -1
  22. package/dist/src/cli/handlers/sessions.js +113 -37
  23. package/dist/src/cli/handlers/subcommands.js +31 -0
  24. package/dist/src/cli/handlers/use.js +46 -9
  25. package/dist/src/cli/handlers/utilities.js +10 -0
  26. package/dist/src/cli/handlers/workspace.js +3 -1
  27. package/dist/src/cli/scope-resolver.js +112 -9
  28. package/dist/src/cli/services/deployment-verification.js +5 -0
  29. package/dist/src/config/aiwg-config.js +3 -0
  30. package/dist/src/decision/acceptance-rollout.js +93 -0
  31. package/dist/src/decision/acceptance.js +175 -0
  32. package/dist/src/decision/adapters/jev.js +234 -13
  33. package/dist/src/decision/adapters/llm-subagent.js +60 -12
  34. package/dist/src/decision/admission.js +550 -0
  35. package/dist/src/decision/batch-benchmark.js +47 -0
  36. package/dist/src/decision/batch-receipts/accounting.js +75 -0
  37. package/dist/src/decision/batch-receipts/export.js +40 -0
  38. package/dist/src/decision/batch-receipts/index.js +9 -0
  39. package/dist/src/decision/batch-receipts/protection.js +40 -0
  40. package/dist/src/decision/batch-receipts/receipt.js +44 -0
  41. package/dist/src/decision/batch-receipts/result-store.js +341 -0
  42. package/dist/src/decision/batch-receipts/store.js +362 -0
  43. package/dist/src/decision/batch-receipts/types.js +2 -0
  44. package/dist/src/decision/batch-receipts/validate.js +127 -0
  45. package/dist/src/decision/batch.js +68 -0
  46. package/dist/src/decision/calibration/index.js +4 -0
  47. package/dist/src/decision/calibration/receipts.js +130 -0
  48. package/dist/src/decision/calibration/registry.js +258 -0
  49. package/dist/src/decision/calibration/types.js +2 -0
  50. package/dist/src/decision/compile-cache/benchmark.js +62 -0
  51. package/dist/src/decision/compile-cache/compatibility.js +65 -0
  52. package/dist/src/decision/compile-cache/file-store.js +280 -0
  53. package/dist/src/decision/compile-cache/identity.js +26 -0
  54. package/dist/src/decision/compile-cache/index.js +9 -0
  55. package/dist/src/decision/compile-cache/prefix.js +21 -0
  56. package/dist/src/decision/compile-cache/records.js +86 -0
  57. package/dist/src/decision/compile-cache/runtime.js +68 -0
  58. package/dist/src/decision/compile-cache/store.js +108 -0
  59. package/dist/src/decision/compile-cache/types.js +2 -0
  60. package/dist/src/decision/context-plan.js +234 -0
  61. package/dist/src/decision/context-qualification.js +60 -0
  62. package/dist/src/decision/ensemble/aggregate.js +215 -0
  63. package/dist/src/decision/ensemble/contract.js +316 -0
  64. package/dist/src/decision/ensemble/drift.js +51 -0
  65. package/dist/src/decision/ensemble/index.js +6 -0
  66. package/dist/src/decision/ensemble/report.js +71 -0
  67. package/dist/src/decision/ensemble/types.js +2 -0
  68. package/dist/src/decision/evaluate.js +1024 -78
  69. package/dist/src/decision/file-lifecycle-store.js +168 -0
  70. package/dist/src/decision/graph-beam.js +40 -0
  71. package/dist/src/decision/graph-budget.js +110 -0
  72. package/dist/src/decision/graph-decision-bridge.js +93 -0
  73. package/dist/src/decision/graph-evidence.js +123 -0
  74. package/dist/src/decision/graph-flow-adapter.js +56 -0
  75. package/dist/src/decision/graph-flow.js +105 -0
  76. package/dist/src/decision/graph-parallel.js +79 -0
  77. package/dist/src/decision/graph-patterns.js +20 -0
  78. package/dist/src/decision/graph-run-store.js +66 -0
  79. package/dist/src/decision/graph-run.js +166 -0
  80. package/dist/src/decision/graph-skill-bridge.js +91 -0
  81. package/dist/src/decision/graph-templates.js +56 -0
  82. package/dist/src/decision/graph.js +115 -0
  83. package/dist/src/decision/index.js +35 -0
  84. package/dist/src/decision/job-accounting.js +93 -0
  85. package/dist/src/decision/job-contract.js +186 -0
  86. package/dist/src/decision/job-effects.js +95 -0
  87. package/dist/src/decision/job-evaluate.js +80 -0
  88. package/dist/src/decision/job-gateway.js +121 -0
  89. package/dist/src/decision/job-http.js +194 -0
  90. package/dist/src/decision/job-payload-store.js +258 -0
  91. package/dist/src/decision/job-poll-limiter.js +92 -0
  92. package/dist/src/decision/job-quota.js +158 -0
  93. package/dist/src/decision/job-runtime.js +240 -0
  94. package/dist/src/decision/job-scheduler.js +26 -0
  95. package/dist/src/decision/job-service.js +117 -0
  96. package/dist/src/decision/job-store.js +264 -0
  97. package/dist/src/decision/job-worker.js +141 -0
  98. package/dist/src/decision/lifecycle.js +148 -0
  99. package/dist/src/decision/patterns/artifacts.js +173 -0
  100. package/dist/src/decision/patterns/catalog.js +108 -0
  101. package/dist/src/decision/patterns/durable-review.js +237 -0
  102. package/dist/src/decision/patterns/index.js +8 -0
  103. package/dist/src/decision/patterns/playground.js +401 -0
  104. package/dist/src/decision/patterns/recorded.js +43 -0
  105. package/dist/src/decision/patterns/specs.js +174 -0
  106. package/dist/src/decision/patterns/types.js +2 -0
  107. package/dist/src/decision/portable-secrets.js +53 -0
  108. package/dist/src/decision/projection.js +210 -0
  109. package/dist/src/decision/qualification/capture.js +67 -0
  110. package/dist/src/decision/qualification/drift.js +68 -0
  111. package/dist/src/decision/qualification/gate-evidence.js +172 -0
  112. package/dist/src/decision/qualification/gates.js +83 -0
  113. package/dist/src/decision/qualification/index.js +12 -0
  114. package/dist/src/decision/qualification/load.js +282 -0
  115. package/dist/src/decision/qualification/manifest.js +37 -0
  116. package/dist/src/decision/qualification/privacy.js +41 -0
  117. package/dist/src/decision/qualification/quality.js +213 -0
  118. package/dist/src/decision/qualification/release.js +116 -0
  119. package/dist/src/decision/qualification/runner.js +408 -0
  120. package/dist/src/decision/qualification/types.js +2 -0
  121. package/dist/src/decision/receipts.js +30 -7
  122. package/dist/src/decision/result-cache/index.js +6 -0
  123. package/dist/src/decision/result-cache/integrity.js +28 -0
  124. package/dist/src/decision/result-cache/key.js +28 -0
  125. package/dist/src/decision/result-cache/service.js +92 -0
  126. package/dist/src/decision/result-cache/store.js +327 -0
  127. package/dist/src/decision/result-cache/types.js +3 -0
  128. package/dist/src/decision/review/authorization.js +110 -0
  129. package/dist/src/decision/review/effect-ledger-adapter.js +321 -0
  130. package/dist/src/decision/review/index.js +12 -0
  131. package/dist/src/decision/review/migrate.js +34 -0
  132. package/dist/src/decision/review/operator-audit.js +59 -0
  133. package/dist/src/decision/review/recovery-adapters.js +252 -0
  134. package/dist/src/decision/review/recovery.js +33 -0
  135. package/dist/src/decision/review/service.js +498 -0
  136. package/dist/src/decision/review/store.js +219 -0
  137. package/dist/src/decision/review/types.js +2 -0
  138. package/dist/src/decision/review/validate.js +205 -0
  139. package/dist/src/decision/scheduler.js +115 -0
  140. package/dist/src/decision/telemetry/context.js +42 -0
  141. package/dist/src/decision/telemetry/debug-sidecar.js +152 -0
  142. package/dist/src/decision/telemetry/exporter.js +77 -0
  143. package/dist/src/decision/telemetry/file-debug-backend.js +112 -0
  144. package/dist/src/decision/telemetry/index.js +13 -0
  145. package/dist/src/decision/telemetry/mapping.js +146 -0
  146. package/dist/src/decision/telemetry/metrics.js +164 -0
  147. package/dist/src/decision/telemetry/otlp-http.js +183 -0
  148. package/dist/src/decision/telemetry/redaction.js +93 -0
  149. package/dist/src/decision/telemetry/retention.js +109 -0
  150. package/dist/src/decision/telemetry/runtime.js +310 -0
  151. package/dist/src/decision/telemetry/trace.js +158 -0
  152. package/dist/src/decision/telemetry/types.js +3 -0
  153. package/dist/src/decision/validate.js +135 -5
  154. package/dist/src/effects/checkpoint-sinks.js +94 -0
  155. package/dist/src/effects/checkpoint.js +76 -0
  156. package/dist/src/effects/decision-links.js +54 -0
  157. package/dist/src/effects/errors.js +48 -0
  158. package/dist/src/effects/identity.js +178 -0
  159. package/dist/src/effects/index.js +25 -0
  160. package/dist/src/effects/keyring.js +160 -0
  161. package/dist/src/effects/keys.js +130 -0
  162. package/dist/src/effects/ledger.js +435 -0
  163. package/dist/src/effects/lifecycle.js +110 -0
  164. package/dist/src/effects/lock-recovery.js +269 -0
  165. package/dist/src/effects/reader.js +103 -0
  166. package/dist/src/effects/records.js +114 -0
  167. package/dist/src/effects/redaction.js +51 -0
  168. package/dist/src/effects/schema.js +73 -0
  169. package/dist/src/effects/store.js +239 -0
  170. package/dist/src/effects/types.js +49 -0
  171. package/dist/src/effects/verifiers/decision.js +168 -0
  172. package/dist/src/effects/verifiers/file.js +106 -0
  173. package/dist/src/effects/verifiers/git.js +206 -0
  174. package/dist/src/effects/verifiers/index.js +90 -0
  175. package/dist/src/effects/verifiers/registry.js +148 -0
  176. package/dist/src/effects/verifiers/review.js +123 -0
  177. package/dist/src/effects/verifiers/tracker.js +299 -0
  178. package/dist/src/effects/verifiers/types.js +21 -0
  179. package/dist/src/effects/verify.js +295 -0
  180. package/dist/src/evidence/bundle.js +2 -0
  181. package/dist/src/extensions/commands/definitions.js +28 -0
  182. package/dist/src/extensions/manifest.js +1 -0
  183. package/dist/src/marketplace/provenance.js +25 -27
  184. package/dist/src/mcp/cli.mjs +11 -1
  185. package/dist/src/mcp/grok-build-config.mjs +189 -0
  186. package/dist/src/mcp/registry.js +21 -1
  187. package/dist/src/mcp/registry.mjs +20 -1
  188. package/dist/src/models/grok-build-models.js +356 -0
  189. package/dist/src/models/index.js +1 -0
  190. package/dist/src/models/model-capabilities.v1.json +34 -0
  191. package/dist/src/models/model-catalog.v1.json +55 -13
  192. package/dist/src/models/model-discovery.js +41 -5
  193. package/dist/src/models/provider-policy.js +3 -2
  194. package/dist/src/plugin/skill-command-translator.js +1 -0
  195. package/dist/src/providers/capability-matrix.yaml +58 -6
  196. package/dist/src/providers/grok-build-acp.js +192 -0
  197. package/dist/src/providers/grok-build-dispatch.js +251 -0
  198. package/dist/src/providers/grok-build-headless.js +170 -0
  199. package/dist/src/providers/muse-paths.js +105 -0
  200. package/dist/src/providers/provider-definitions.js +93 -7
  201. package/dist/src/providers/provider-definitions.mjs +21 -1
  202. package/dist/src/providers/provider-inventory.js +3 -0
  203. package/dist/src/security/artifact-attestation.js +4 -8
  204. package/dist/src/security/signing.js +119 -0
  205. package/dist/src/sessions/adapters/grok-build.js +187 -0
  206. package/dist/src/sessions/adapters/muse.js +412 -0
  207. package/dist/src/sessions/contracts.js +1 -1
  208. package/dist/src/sessions/grok-build-cli.js +196 -0
  209. package/dist/src/sessions/index.js +3 -0
  210. package/dist/src/sessions/workspace-discovery.js +9 -5
  211. package/dist/src/skills/deployer.js +33 -5
  212. package/dist/src/smiths/context-pipeline/claude-hook.js +2 -0
  213. package/dist/src/smiths/context-pipeline/context-file-safety.js +18 -0
  214. package/dist/src/smiths/context-pipeline/finalization.js +1 -32
  215. package/dist/src/smiths/context-pipeline/generator.js +12 -0
  216. package/dist/src/smiths/context-pipeline/index.js +1 -1
  217. package/dist/src/smiths/context-pipeline/managed-hook.js +2 -0
  218. package/dist/src/smiths/context-pipeline/muse-bridge.js +50 -0
  219. package/dist/src/smiths/context-pipeline/provider-policy.js +5 -0
  220. package/dist/src/smiths/context-pipeline/workspace-context.js +22 -16
  221. package/dist/src/smiths/hook-bridge/grok-build-translator.js +64 -0
  222. package/dist/src/smiths/hook-bridge/index.js +3 -0
  223. package/dist/src/smiths/hook-bridge/shim.js +2 -0
  224. package/dist/src/smiths/hook-bridge/types.js +5 -0
  225. package/dist/src/smiths/skillsmith/collision-detector.js +1 -0
  226. package/dist/src/storage/protected-files.js +102 -0
  227. package/dist/src/tracker/forge-http.js +371 -0
  228. package/dist/src/tracker/project-inputs.js +41 -0
  229. package/package.json +2 -1
  230. package/schemas/decision/BatchReceipt.v1.schema.json +50 -0
  231. package/schemas/decision/CalibrationArtifact.v1.schema.json +76 -0
  232. package/schemas/decision/CalibrationCompatibility.v1.schema.json +18 -0
  233. package/schemas/decision/CalibrationGovernanceReceipt.v1.schema.json +44 -0
  234. package/schemas/decision/DecisionAdmissionEvidence.v1.schema.json +43 -0
  235. package/schemas/decision/DecisionBinding.schema.json +309 -0
  236. package/schemas/decision/DecisionBinding.v1alpha2.schema.json +369 -0
  237. package/schemas/decision/DecisionCacheTelemetry.v1.schema.json +20 -0
  238. package/schemas/decision/DecisionChampionChallenger.v1.schema.json +100 -0
  239. package/schemas/decision/DecisionCompileCacheEntry.v1.schema.json +35 -0
  240. package/schemas/decision/DecisionCompileCacheIdentity.v1.schema.json +26 -0
  241. package/schemas/decision/DecisionCompileCacheTombstone.v1.schema.json +31 -0
  242. package/schemas/decision/DecisionContextEvidence.v1.schema.json +136 -0
  243. package/schemas/decision/DecisionDefinition.schema.json +159 -0
  244. package/schemas/decision/DecisionDefinition.v1alpha2.schema.json +203 -0
  245. package/schemas/decision/DecisionDriftResponse.v1.schema.json +55 -0
  246. package/schemas/decision/DecisionEnsembleAggregate.v1.schema.json +86 -0
  247. package/schemas/decision/DecisionEnsembleIntegrityReport.v1.schema.json +64 -0
  248. package/schemas/decision/DecisionEnsemblePolicy.v1.schema.json +130 -0
  249. package/schemas/decision/DecisionGraph.v1.schema.json +77 -0
  250. package/schemas/decision/DecisionJob.v1.schema.json +71 -0
  251. package/schemas/decision/DecisionLifecyclePolicy.v1.schema.json +52 -0
  252. package/schemas/decision/DecisionProjectionPolicy.v1.schema.json +65 -0
  253. package/schemas/decision/DecisionProviderPrefixCompatibility.v1.schema.json +45 -0
  254. package/schemas/decision/DecisionProviderPrefixEvidence.v1.schema.json +17 -0
  255. package/schemas/decision/DecisionProviderPrefixIdentity.v1.schema.json +36 -0
  256. package/schemas/decision/DecisionResult.schema.json +524 -0
  257. package/schemas/decision/DecisionResult.v1alpha2.schema.json +619 -0
  258. package/schemas/decision/DecisionResultCacheEntry.v1.schema.json +53 -0
  259. package/schemas/decision/DecisionReview.schema.json +29 -0
  260. package/schemas/decision/DecisionRuleset.schema.json +313 -0
  261. package/schemas/decision/DecisionRuleset.v1alpha2.schema.json +313 -0
  262. package/schemas/decision/DecisionTelemetryTrace.v1.schema.json +95 -0
  263. package/schemas/decision/RulesetResult.schema.json +721 -0
  264. package/schemas/decision/RulesetResult.v1alpha2.schema.json +891 -0
  265. package/schemas/security/pr-evidence-receipt.v1.schema.json +77 -0
  266. package/schemas/security/threat-assessment-report.v1.schema.json +71 -1
  267. package/tools/agents/deploy-agents.mjs +21 -6
  268. package/tools/agents/providers/base.mjs +7 -4
  269. package/tools/agents/providers/codex.mjs +1 -1
  270. package/tools/agents/providers/grok-build.d.mts +7 -0
  271. package/tools/agents/providers/grok-build.mjs +249 -9
  272. package/tools/agents/providers/model-role.mjs +6 -3
  273. package/tools/agents/providers/muse-hooks.mjs +785 -0
  274. package/tools/agents/providers/muse-paths.mjs +112 -0
  275. package/tools/agents/providers/muse.mjs +336 -0
@@ -0,0 +1,891 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aiwg.io/schemas/decision/RulesetResult.v1alpha2.schema.json",
4
+ "$defs": {
5
+ "acceptanceEvidence": {
6
+ "type": "object",
7
+ "properties": {
8
+ "policyVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
9
+ "uncertaintyProfile": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] },
10
+ "disposition": { "enum": ["act", "review", "reject", "fallback"] },
11
+ "matchedRule": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] },
12
+ "fallbackTarget": { "type": "string", "minLength": 1 },
13
+ "reason": { "enum": ["matched", "default", "missing-evidence", "invalid-evidence", "tie", "calibration-required"] },
14
+ "values": {
15
+ "type": "object",
16
+ "propertyNames": { "enum": ["yes-probability", "selected-probability", "native-confidence", "top-two-margin", "entropy", "concentration", "expected-score", "dispersion", "calibrated-risk"] },
17
+ "additionalProperties": {
18
+ "type": "object",
19
+ "properties": {
20
+ "value": { "type": "number" },
21
+ "normalizedBps": { "type": "number", "minimum": 0, "maximum": 10000 },
22
+ "provenance": { "enum": ["provider-value", "provider-confidence", "provider-distribution", "derived", "calibrated"] },
23
+ "calibrationRef": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] }
24
+ },
25
+ "required": ["value", "normalizedBps", "provenance", "calibrationRef"],
26
+ "additionalProperties": false
27
+ }
28
+ }
29
+ },
30
+ "required": ["policyVersion", "uncertaintyProfile", "disposition", "matchedRule", "reason", "values"],
31
+ "additionalProperties": false
32
+ },
33
+ "resultCacheCallerReceipt": {
34
+ "description": "D15 caller-level result-cache receipt. Historical evaluation attempts in a hit belong to the source invocation.",
35
+ "type": "object",
36
+ "properties": {
37
+ "disposition": { "enum": ["cache-hit", "cache-miss-fill", "bypass"] },
38
+ "callerInvocationId": { "type": "string", "minLength": 1 },
39
+ "sourceInvocationId": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] },
40
+ "sourceReceiptId": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] },
41
+ "originalEvaluatedAtEpochMs": { "anyOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }] },
42
+ "cacheEntryId": { "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }] },
43
+ "createdAtEpochMs": { "type": "integer", "minimum": 0 },
44
+ "providerAttempted": { "type": "boolean" }
45
+ },
46
+ "required": ["disposition", "callerInvocationId", "sourceInvocationId", "sourceReceiptId", "originalEvaluatedAtEpochMs", "cacheEntryId", "createdAtEpochMs", "providerAttempted"],
47
+ "additionalProperties": false,
48
+ "allOf": [
49
+ {
50
+ "if": { "properties": { "disposition": { "const": "cache-hit" } } },
51
+ "then": {
52
+ "properties": {
53
+ "providerAttempted": { "const": false },
54
+ "sourceInvocationId": { "type": "string" },
55
+ "sourceReceiptId": { "type": "string" },
56
+ "originalEvaluatedAtEpochMs": { "type": "integer" },
57
+ "cacheEntryId": { "type": "string" }
58
+ }
59
+ }
60
+ },
61
+ {
62
+ "if": { "properties": { "disposition": { "const": "bypass" } } },
63
+ "then": { "properties": { "providerAttempted": { "const": true }, "cacheEntryId": { "type": "null" } } }
64
+ }
65
+ ]
66
+ }
67
+ },
68
+ "type": "object",
69
+ "properties": {
70
+ "apiVersion": {
71
+ "const": "decision.aiwg.io/v1alpha2"
72
+ },
73
+ "kind": {
74
+ "const": "RulesetResult"
75
+ },
76
+ "metadata": {
77
+ "type": "object",
78
+ "properties": {
79
+ "id": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ },
83
+ "version": {
84
+ "type": "string",
85
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
86
+ },
87
+ "description": {
88
+ "type": "string",
89
+ "minLength": 1
90
+ }
91
+ },
92
+ "required": [
93
+ "id",
94
+ "version",
95
+ "description"
96
+ ],
97
+ "additionalProperties": false
98
+ },
99
+ "spec": {
100
+ "type": "object",
101
+ "properties": {
102
+ "ruleset": {
103
+ "type": "object",
104
+ "properties": {
105
+ "id": {
106
+ "type": "string",
107
+ "minLength": 1
108
+ },
109
+ "version": {
110
+ "type": "string",
111
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
112
+ },
113
+ "digest": {
114
+ "type": "string",
115
+ "pattern": "^sha256:[0-9a-f]{64}$"
116
+ }
117
+ },
118
+ "required": [
119
+ "id",
120
+ "version",
121
+ "digest"
122
+ ],
123
+ "additionalProperties": false
124
+ },
125
+ "binding": {
126
+ "type": "object",
127
+ "properties": {
128
+ "id": {
129
+ "type": "string",
130
+ "minLength": 1
131
+ },
132
+ "version": {
133
+ "type": "string",
134
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
135
+ },
136
+ "digest": {
137
+ "type": "string",
138
+ "pattern": "^sha256:[0-9a-f]{64}$"
139
+ }
140
+ },
141
+ "required": [
142
+ "id",
143
+ "version",
144
+ "digest"
145
+ ],
146
+ "additionalProperties": false
147
+ },
148
+ "runId": {
149
+ "type": "string",
150
+ "minLength": 1
151
+ },
152
+ "invocationId": {
153
+ "type": "string",
154
+ "minLength": 1
155
+ },
156
+ "status": {
157
+ "enum": [
158
+ "completed",
159
+ "defaulted",
160
+ "review",
161
+ "error",
162
+ "cancelled"
163
+ ]
164
+ },
165
+ "reason": {
166
+ "enum": [
167
+ "none",
168
+ "invalid-input",
169
+ "invalid-definition",
170
+ "digest-mismatch",
171
+ "unauthorized",
172
+ "data-boundary-denied",
173
+ "unsupported-capability",
174
+ "executor-unavailable",
175
+ "invalid-output",
176
+ "low-confidence",
177
+ "missing-confidence",
178
+ "confidence-profile-mismatch",
179
+ "insufficient-information",
180
+ "timeout",
181
+ "network-transient",
182
+ "rate-limited",
183
+ "overloaded",
184
+ "service-error",
185
+ "authentication",
186
+ "invalid-request",
187
+ "budget-exhausted",
188
+ "cancelled",
189
+ "persistence-error",
190
+ "replay-mismatch",
191
+ "execution-uncertain",
192
+ "batch-record-unavailable",
193
+ "no-match",
194
+ "conflicting-outcomes",
195
+ "evaluation-failed",
196
+ "context-plan-stale",
197
+ "context-unqualified"
198
+ ]
199
+ },
200
+ "outcome": {},
201
+ "matchedRules": {
202
+ "type": "array",
203
+ "items": {
204
+ "type": "string",
205
+ "minLength": 1
206
+ },
207
+ "minItems": 0
208
+ },
209
+ "context": {
210
+ "$ref": "DecisionContextEvidence.v1.schema.json"
211
+ },
212
+ "cache": {
213
+ "$ref": "#/$defs/resultCacheCallerReceipt"
214
+ },
215
+ "projection": {
216
+ "description": "Present only when the host explicitly dispatched unprojected input (D10 opt-out).",
217
+ "type": "object",
218
+ "properties": {
219
+ "mode": { "const": "unprojected-local" },
220
+ "authority": { "const": "host" }
221
+ },
222
+ "required": ["mode", "authority"],
223
+ "additionalProperties": false
224
+ },
225
+ "contextFailure": {
226
+ "type": "object",
227
+ "description": "Body-free D06 context preflight rejection diagnostic.",
228
+ "properties": {
229
+ "schemaVersion": { "const": "decision-context-failure/v1" },
230
+ "reason": {
231
+ "enum": [
232
+ "invalid-input",
233
+ "invalid-profile",
234
+ "estimator-profile-mismatch",
235
+ "oversized-state",
236
+ "oversized-question",
237
+ "dependency-error",
238
+ "stale-plan",
239
+ "rollout-unqualified"
240
+ ]
241
+ },
242
+ "plannedDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
243
+ "currentDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
244
+ },
245
+ "required": ["schemaVersion", "reason"],
246
+ "additionalProperties": false
247
+ },
248
+ "evaluations": {
249
+ "type": "object",
250
+ "additionalProperties": {
251
+ "type": "object",
252
+ "properties": {
253
+ "apiVersion": {
254
+ "const": "decision.aiwg.io/v1alpha2"
255
+ },
256
+ "kind": {
257
+ "const": "DecisionResult"
258
+ },
259
+ "metadata": {
260
+ "type": "object",
261
+ "properties": {
262
+ "id": {
263
+ "type": "string",
264
+ "minLength": 1
265
+ },
266
+ "version": {
267
+ "type": "string",
268
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
269
+ },
270
+ "description": {
271
+ "type": "string",
272
+ "minLength": 1
273
+ }
274
+ },
275
+ "required": [
276
+ "id",
277
+ "version",
278
+ "description"
279
+ ],
280
+ "additionalProperties": false
281
+ },
282
+ "spec": {
283
+ "type": "object",
284
+ "properties": {
285
+ "decision": {
286
+ "type": "object",
287
+ "properties": {
288
+ "id": {
289
+ "type": "string",
290
+ "minLength": 1
291
+ },
292
+ "version": {
293
+ "type": "string",
294
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
295
+ },
296
+ "digest": {
297
+ "type": "string",
298
+ "pattern": "^sha256:[0-9a-f]{64}$"
299
+ }
300
+ },
301
+ "required": [
302
+ "id",
303
+ "version",
304
+ "digest"
305
+ ],
306
+ "additionalProperties": false
307
+ },
308
+ "ruleset": {
309
+ "type": "object",
310
+ "properties": {
311
+ "id": {
312
+ "type": "string",
313
+ "minLength": 1
314
+ },
315
+ "version": {
316
+ "type": "string",
317
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
318
+ },
319
+ "digest": {
320
+ "type": "string",
321
+ "pattern": "^sha256:[0-9a-f]{64}$"
322
+ }
323
+ },
324
+ "required": [
325
+ "id",
326
+ "version",
327
+ "digest"
328
+ ],
329
+ "additionalProperties": false
330
+ },
331
+ "binding": {
332
+ "type": "object",
333
+ "properties": {
334
+ "id": {
335
+ "type": "string",
336
+ "minLength": 1
337
+ },
338
+ "version": {
339
+ "type": "string",
340
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
341
+ },
342
+ "digest": {
343
+ "type": "string",
344
+ "pattern": "^sha256:[0-9a-f]{64}$"
345
+ }
346
+ },
347
+ "required": [
348
+ "id",
349
+ "version",
350
+ "digest"
351
+ ],
352
+ "additionalProperties": false
353
+ },
354
+ "alias": {
355
+ "type": "string",
356
+ "minLength": 1
357
+ },
358
+ "runId": {
359
+ "type": "string",
360
+ "minLength": 1
361
+ },
362
+ "invocationId": {
363
+ "type": "string",
364
+ "minLength": 1
365
+ },
366
+ "status": {
367
+ "enum": [
368
+ "success",
369
+ "abstained",
370
+ "error",
371
+ "unsupported",
372
+ "cancelled"
373
+ ]
374
+ },
375
+ "value": {
376
+ "anyOf": [
377
+ {
378
+ "type": "number"
379
+ },
380
+ {
381
+ "type": "string"
382
+ }
383
+ ]
384
+ },
385
+ "reason": {
386
+ "enum": [
387
+ "none",
388
+ "invalid-input",
389
+ "invalid-definition",
390
+ "digest-mismatch",
391
+ "unauthorized",
392
+ "data-boundary-denied",
393
+ "unsupported-capability",
394
+ "executor-unavailable",
395
+ "invalid-output",
396
+ "low-confidence",
397
+ "missing-confidence",
398
+ "confidence-profile-mismatch",
399
+ "insufficient-information",
400
+ "timeout",
401
+ "network-transient",
402
+ "rate-limited",
403
+ "overloaded",
404
+ "service-error",
405
+ "authentication",
406
+ "invalid-request",
407
+ "budget-exhausted",
408
+ "cancelled",
409
+ "persistence-error",
410
+ "replay-mismatch",
411
+ "execution-uncertain",
412
+ "batch-record-unavailable",
413
+ "no-match",
414
+ "conflicting-outcomes",
415
+ "evaluation-failed"
416
+ ]
417
+ },
418
+ "uncertainty": {
419
+ "anyOf": [
420
+ {
421
+ "type": "object",
422
+ "properties": {
423
+ "source": {
424
+ "enum": [
425
+ "provider",
426
+ "model-self-report",
427
+ "derived"
428
+ ]
429
+ },
430
+ "profile": {
431
+ "type": "string",
432
+ "minLength": 1
433
+ },
434
+ "calibration": {
435
+ "enum": [
436
+ "vendor-claimed",
437
+ "uncalibrated",
438
+ "measured"
439
+ ]
440
+ },
441
+ "confidence": {
442
+ "anyOf": [
443
+ {
444
+ "type": "number",
445
+ "minimum": 0,
446
+ "maximum": 1
447
+ },
448
+ {
449
+ "type": "null"
450
+ }
451
+ ]
452
+ },
453
+ "distribution": {
454
+ "anyOf": [
455
+ {
456
+ "type": "object",
457
+ "minProperties": 2,
458
+ "additionalProperties": {
459
+ "type": "number",
460
+ "minimum": 0,
461
+ "maximum": 1
462
+ }
463
+ },
464
+ {
465
+ "type": "null"
466
+ }
467
+ ]
468
+ },
469
+ "calibrationRef": {
470
+ "anyOf": [
471
+ {
472
+ "type": "string",
473
+ "minLength": 1
474
+ },
475
+ {
476
+ "type": "null"
477
+ }
478
+ ]
479
+ },
480
+ "calibratedRisk": {
481
+ "type": "object",
482
+ "properties": {
483
+ "value": { "type": "number", "minimum": 0, "maximum": 1 },
484
+ "calibrationRef": { "type": "string", "minLength": 1 }
485
+ },
486
+ "required": ["value", "calibrationRef"],
487
+ "additionalProperties": false
488
+ }
489
+ },
490
+ "required": [
491
+ "source",
492
+ "profile",
493
+ "calibration",
494
+ "confidence",
495
+ "distribution",
496
+ "calibrationRef"
497
+ ],
498
+ "additionalProperties": false
499
+ },
500
+ {
501
+ "type": "null"
502
+ }
503
+ ]
504
+ },
505
+ "acceptance": {
506
+ "$ref": "#/$defs/acceptanceEvidence"
507
+ },
508
+ "attempts": {
509
+ "type": "array",
510
+ "items": {
511
+ "type": "object",
512
+ "properties": {
513
+ "ordinal": {
514
+ "type": "integer",
515
+ "minimum": 1
516
+ },
517
+ "adapter": {
518
+ "type": "string",
519
+ "minLength": 1
520
+ },
521
+ "adapterVersion": {
522
+ "type": "string",
523
+ "minLength": 1
524
+ },
525
+ "requestedModel": {
526
+ "type": "string",
527
+ "minLength": 1
528
+ },
529
+ "actualModel": {
530
+ "anyOf": [
531
+ {
532
+ "type": "string",
533
+ "minLength": 1
534
+ },
535
+ {
536
+ "type": "null"
537
+ }
538
+ ]
539
+ },
540
+ "subagent": {
541
+ "anyOf": [
542
+ {
543
+ "type": "object",
544
+ "properties": {
545
+ "id": {
546
+ "type": "string",
547
+ "minLength": 1
548
+ },
549
+ "version": {
550
+ "type": "string",
551
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
552
+ },
553
+ "digest": {
554
+ "type": "string",
555
+ "pattern": "^sha256:[0-9a-f]{64}$"
556
+ }
557
+ },
558
+ "required": [
559
+ "id",
560
+ "version",
561
+ "digest"
562
+ ],
563
+ "additionalProperties": false
564
+ },
565
+ {
566
+ "type": "null"
567
+ }
568
+ ]
569
+ },
570
+ "status": {
571
+ "enum": [
572
+ "success",
573
+ "abstained",
574
+ "error",
575
+ "unsupported",
576
+ "cancelled"
577
+ ]
578
+ },
579
+ "reason": {
580
+ "enum": [
581
+ "none",
582
+ "invalid-input",
583
+ "invalid-definition",
584
+ "digest-mismatch",
585
+ "unauthorized",
586
+ "data-boundary-denied",
587
+ "unsupported-capability",
588
+ "executor-unavailable",
589
+ "invalid-output",
590
+ "low-confidence",
591
+ "missing-confidence",
592
+ "confidence-profile-mismatch",
593
+ "insufficient-information",
594
+ "timeout",
595
+ "network-transient",
596
+ "rate-limited",
597
+ "overloaded",
598
+ "service-error",
599
+ "authentication",
600
+ "invalid-request",
601
+ "budget-exhausted",
602
+ "cancelled",
603
+ "persistence-error",
604
+ "replay-mismatch",
605
+ "execution-uncertain",
606
+ "batch-record-unavailable",
607
+ "no-match",
608
+ "conflicting-outcomes",
609
+ "evaluation-failed"
610
+ ]
611
+ },
612
+ "durationMs": {
613
+ "type": "integer",
614
+ "minimum": 0,
615
+ "maximum": 9007199254740991
616
+ },
617
+ "usage": {
618
+ "type": "object",
619
+ "properties": {
620
+ "inputTokens": {
621
+ "anyOf": [
622
+ {
623
+ "type": "integer",
624
+ "minimum": 0,
625
+ "maximum": 9007199254740991
626
+ },
627
+ {
628
+ "type": "null"
629
+ }
630
+ ]
631
+ },
632
+ "outputTokens": {
633
+ "anyOf": [
634
+ {
635
+ "type": "integer",
636
+ "minimum": 0,
637
+ "maximum": 9007199254740991
638
+ },
639
+ {
640
+ "type": "null"
641
+ }
642
+ ]
643
+ },
644
+ "costUsd": {
645
+ "anyOf": [
646
+ {
647
+ "type": "number",
648
+ "minimum": 0
649
+ },
650
+ {
651
+ "type": "null"
652
+ }
653
+ ]
654
+ }
655
+ },
656
+ "required": [
657
+ "inputTokens",
658
+ "outputTokens",
659
+ "costUsd"
660
+ ],
661
+ "additionalProperties": false
662
+ },
663
+ "requestId": {
664
+ "anyOf": [
665
+ {
666
+ "type": "string",
667
+ "minLength": 1
668
+ },
669
+ {
670
+ "type": "null"
671
+ }
672
+ ]
673
+ },
674
+ "requestIdSource": {
675
+ "enum": [
676
+ "typesafe",
677
+ "legacy",
678
+ "body"
679
+ ]
680
+ },
681
+ "httpStatus": {
682
+ "type": "integer",
683
+ "minimum": 100,
684
+ "maximum": 599
685
+ },
686
+ "retryDelayMs": {
687
+ "type": "integer",
688
+ "minimum": 0
689
+ },
690
+ "termination": {
691
+ "enum": [
692
+ "caller-cancelled",
693
+ "target-timeout",
694
+ "total-deadline",
695
+ "backend-cancelled"
696
+ ]
697
+ },
698
+ "remoteExecution": {
699
+ "const": "unknown"
700
+ },
701
+ "admission": {
702
+ "$ref": "DecisionAdmissionEvidence.v1.schema.json"
703
+ },
704
+ "providerPrefix": {
705
+ "$ref": "DecisionProviderPrefixEvidence.v1.schema.json"
706
+ },
707
+ "batch": {
708
+ "type": "object",
709
+ "properties": {
710
+ "mode": { "enum": ["native", "single"] },
711
+ "groupId": { "type": "string", "pattern": "^(batch|single)_[0-9a-f]{24}$" },
712
+ "questionId": { "type": "string", "pattern": "^q_[0-9a-f]{24}$" },
713
+ "degradationReason": { "enum": ["disabled", "unsupported", "ineligible"] }
714
+ },
715
+ "required": ["mode", "groupId", "questionId"],
716
+ "additionalProperties": false
717
+ }
718
+ },
719
+ "required": [
720
+ "ordinal",
721
+ "adapter",
722
+ "adapterVersion",
723
+ "requestedModel",
724
+ "actualModel",
725
+ "subagent",
726
+ "status",
727
+ "reason",
728
+ "durationMs",
729
+ "usage",
730
+ "requestId"
731
+ ],
732
+ "additionalProperties": false
733
+ },
734
+ "minItems": 0
735
+ },
736
+ "calibrationCompatibility": {
737
+ "type": "object",
738
+ "required": ["schemaVersion", "pinId", "runId", "requestedAlias", "actualModel", "aliasRevision", "artifactId", "artifactDigest", "state", "action", "reasons", "decidedAt"],
739
+ "properties": {
740
+ "schemaVersion": { "const": "decision-calibration-compatibility/v1" },
741
+ "pinId": { "type": "string", "minLength": 1 },
742
+ "runId": { "type": "string", "minLength": 1 },
743
+ "requestedAlias": { "type": "string", "minLength": 1 },
744
+ "actualModel": { "type": "string", "minLength": 1 },
745
+ "aliasRevision": { "type": ["integer", "null"], "minimum": 1 },
746
+ "artifactId": { "type": ["string", "null"] },
747
+ "artifactDigest": { "anyOf": [{ "type": "null" }, { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }] },
748
+ "state": { "enum": ["exact", "approved-compatible", "shadow-required", "incompatible", "unknown"] },
749
+ "action": { "enum": ["allow", "fail", "defer", "shadow", "require-approval"] },
750
+ "reasons": { "type": "array", "items": { "type": "string", "minLength": 1 } },
751
+ "decidedAt": { "type": "string", "format": "date-time" }
752
+ },
753
+ "additionalProperties": false
754
+ },
755
+ "batchResult": {
756
+ "type": "object",
757
+ "properties": {
758
+ "schemaVersion": { "const": "decision-batch-result-ref/v1" },
759
+ "batchId": { "type": "string", "minLength": 1 },
760
+ "receiptRevision": { "type": "integer", "minimum": 1 },
761
+ "questionId": { "type": "string", "minLength": 1 },
762
+ "answerId": { "type": "string", "minLength": 1 }
763
+ },
764
+ "required": ["schemaVersion", "batchId", "receiptRevision", "questionId", "answerId"],
765
+ "additionalProperties": false
766
+ },
767
+ "context": {
768
+ "$ref": "DecisionContextEvidence.v1.schema.json"
769
+ }
770
+ },
771
+ "required": [
772
+ "decision",
773
+ "ruleset",
774
+ "binding",
775
+ "alias",
776
+ "runId",
777
+ "invocationId",
778
+ "status",
779
+ "reason",
780
+ "uncertainty",
781
+ "attempts"
782
+ ],
783
+ "additionalProperties": false,
784
+ "allOf": [
785
+ {
786
+ "if": {
787
+ "properties": {
788
+ "status": {
789
+ "const": "success"
790
+ }
791
+ }
792
+ },
793
+ "then": {
794
+ "required": [
795
+ "value"
796
+ ],
797
+ "properties": {
798
+ "value": {},
799
+ "reason": {
800
+ "const": "none"
801
+ },
802
+ "attempts": {
803
+ "type": "array",
804
+ "minItems": 1
805
+ }
806
+ }
807
+ },
808
+ "else": {
809
+ "not": {
810
+ "properties": {
811
+ "value": {}
812
+ },
813
+ "required": [
814
+ "value"
815
+ ]
816
+ },
817
+ "properties": {
818
+ "reason": {
819
+ "not": {
820
+ "const": "none"
821
+ }
822
+ }
823
+ }
824
+ }
825
+ }
826
+ ]
827
+ }
828
+ },
829
+ "required": [
830
+ "apiVersion",
831
+ "kind",
832
+ "metadata",
833
+ "spec"
834
+ ],
835
+ "additionalProperties": false
836
+ }
837
+ }
838
+ },
839
+ "required": [
840
+ "ruleset",
841
+ "binding",
842
+ "runId",
843
+ "invocationId",
844
+ "status",
845
+ "reason",
846
+ "matchedRules",
847
+ "evaluations"
848
+ ],
849
+ "additionalProperties": false,
850
+ "allOf": [
851
+ {
852
+ "$comment": "An incomplete-context downgrade (D06/D10) is review with reason insufficient-information and no outcome.",
853
+ "if": {
854
+ "anyOf": [
855
+ { "properties": { "status": { "enum": ["completed", "defaulted"] } } },
856
+ {
857
+ "properties": { "status": { "const": "review" } },
858
+ "not": { "properties": { "reason": { "const": "insufficient-information" } }, "required": ["reason"] }
859
+ }
860
+ ]
861
+ },
862
+ "then": {
863
+ "properties": {
864
+ "outcome": {}
865
+ },
866
+ "required": [
867
+ "outcome"
868
+ ]
869
+ },
870
+ "else": {
871
+ "not": {
872
+ "properties": {
873
+ "outcome": {}
874
+ },
875
+ "required": [
876
+ "outcome"
877
+ ]
878
+ }
879
+ }
880
+ }
881
+ ]
882
+ }
883
+ },
884
+ "required": [
885
+ "apiVersion",
886
+ "kind",
887
+ "metadata",
888
+ "spec"
889
+ ],
890
+ "additionalProperties": false
891
+ }