@kindgi/api 0.1.3 → 0.1.4-rc.1

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 (222) hide show
  1. package/dist/agent-binding.d.ts +26 -4
  2. package/dist/agent-binding.d.ts.map +1 -1
  3. package/dist/agent-pins.d.ts +48 -0
  4. package/dist/agent-pins.d.ts.map +1 -0
  5. package/dist/agent-pins.js +102 -0
  6. package/dist/agent-pins.js.map +1 -0
  7. package/dist/app.d.ts +22 -0
  8. package/dist/app.d.ts.map +1 -1
  9. package/dist/app.js +27 -3
  10. package/dist/app.js.map +1 -1
  11. package/dist/block-binding.d.ts +132 -0
  12. package/dist/block-binding.d.ts.map +1 -0
  13. package/dist/block-binding.js +4 -0
  14. package/dist/block-binding.js.map +1 -0
  15. package/dist/block-pins.d.ts +22 -0
  16. package/dist/block-pins.d.ts.map +1 -0
  17. package/dist/block-pins.js +112 -0
  18. package/dist/block-pins.js.map +1 -0
  19. package/dist/cost-binding.d.ts +20 -1
  20. package/dist/cost-binding.d.ts.map +1 -1
  21. package/dist/cost-binding.js +4 -0
  22. package/dist/cost-binding.js.map +1 -1
  23. package/dist/deploy-versions.d.ts +60 -0
  24. package/dist/deploy-versions.d.ts.map +1 -0
  25. package/dist/deploy-versions.js +91 -0
  26. package/dist/deploy-versions.js.map +1 -0
  27. package/dist/deployment-binding.d.ts +24 -3
  28. package/dist/deployment-binding.d.ts.map +1 -1
  29. package/dist/derive-agent-version.d.ts +77 -0
  30. package/dist/derive-agent-version.d.ts.map +1 -0
  31. package/dist/derive-agent-version.js +149 -0
  32. package/dist/derive-agent-version.js.map +1 -0
  33. package/dist/errors.d.ts.map +1 -1
  34. package/dist/errors.js +18 -0
  35. package/dist/errors.js.map +1 -1
  36. package/dist/eval-case-binding.d.ts +65 -0
  37. package/dist/eval-case-binding.d.ts.map +1 -0
  38. package/dist/eval-case-binding.js +4 -0
  39. package/dist/eval-case-binding.js.map +1 -0
  40. package/dist/eval-run-binding.d.ts +37 -0
  41. package/dist/eval-run-binding.d.ts.map +1 -1
  42. package/dist/eval-run-binding.js.map +1 -1
  43. package/dist/eval-run-dispatcher.d.ts +41 -3
  44. package/dist/eval-run-dispatcher.d.ts.map +1 -1
  45. package/dist/eval-run-dispatcher.js +21 -15
  46. package/dist/eval-run-dispatcher.js.map +1 -1
  47. package/dist/eval-suite-binding.d.ts +1 -1
  48. package/dist/eval-suite-binding.d.ts.map +1 -1
  49. package/dist/eval-suite-binding.js +2 -0
  50. package/dist/eval-suite-binding.js.map +1 -1
  51. package/dist/flow-binding.d.ts +18 -4
  52. package/dist/flow-binding.d.ts.map +1 -1
  53. package/dist/flow-pins.d.ts +36 -0
  54. package/dist/flow-pins.d.ts.map +1 -0
  55. package/dist/flow-pins.js +81 -0
  56. package/dist/flow-pins.js.map +1 -0
  57. package/dist/guardrail-binding.d.ts +8 -0
  58. package/dist/guardrail-binding.d.ts.map +1 -1
  59. package/dist/handler-binding.d.ts +3 -0
  60. package/dist/handler-binding.d.ts.map +1 -1
  61. package/dist/index.d.ts +18 -6
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +8 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/judged-dispatcher.d.ts +138 -0
  66. package/dist/judged-dispatcher.d.ts.map +1 -0
  67. package/dist/judged-dispatcher.js +308 -0
  68. package/dist/judged-dispatcher.js.map +1 -0
  69. package/dist/judged-items.d.ts +86 -0
  70. package/dist/judged-items.d.ts.map +1 -0
  71. package/dist/judged-items.js +184 -0
  72. package/dist/judged-items.js.map +1 -0
  73. package/dist/judgment-binding.d.ts +316 -0
  74. package/dist/judgment-binding.d.ts.map +1 -0
  75. package/dist/judgment-binding.js +19 -0
  76. package/dist/judgment-binding.js.map +1 -0
  77. package/dist/openapi/generate.d.ts.map +1 -1
  78. package/dist/openapi/generate.js +4 -1
  79. package/dist/openapi/generate.js.map +1 -1
  80. package/dist/openapi/operations.d.ts.map +1 -1
  81. package/dist/openapi/operations.js +482 -13
  82. package/dist/openapi/operations.js.map +1 -1
  83. package/dist/openapi/schemas.d.ts +46 -0
  84. package/dist/openapi/schemas.d.ts.map +1 -1
  85. package/dist/openapi/schemas.js +1350 -175
  86. package/dist/openapi/schemas.js.map +1 -1
  87. package/dist/provider-binding.d.ts +12 -7
  88. package/dist/provider-binding.d.ts.map +1 -1
  89. package/dist/registry-read-only.d.ts +32 -0
  90. package/dist/registry-read-only.d.ts.map +1 -0
  91. package/dist/registry-read-only.js +22 -0
  92. package/dist/registry-read-only.js.map +1 -0
  93. package/dist/routes/agents.d.ts +9 -1
  94. package/dist/routes/agents.d.ts.map +1 -1
  95. package/dist/routes/agents.js +181 -11
  96. package/dist/routes/agents.js.map +1 -1
  97. package/dist/routes/blocks.d.ts +19 -0
  98. package/dist/routes/blocks.d.ts.map +1 -0
  99. package/dist/routes/blocks.js +306 -0
  100. package/dist/routes/blocks.js.map +1 -0
  101. package/dist/routes/cost.d.ts.map +1 -1
  102. package/dist/routes/cost.js +47 -2
  103. package/dist/routes/cost.js.map +1 -1
  104. package/dist/routes/deployments.d.ts +3 -0
  105. package/dist/routes/deployments.d.ts.map +1 -1
  106. package/dist/routes/deployments.js +224 -55
  107. package/dist/routes/deployments.js.map +1 -1
  108. package/dist/routes/eval-comparison.d.ts +15 -0
  109. package/dist/routes/eval-comparison.d.ts.map +1 -0
  110. package/dist/routes/eval-comparison.js +123 -0
  111. package/dist/routes/eval-comparison.js.map +1 -0
  112. package/dist/routes/eval-runs.d.ts +7 -1
  113. package/dist/routes/eval-runs.d.ts.map +1 -1
  114. package/dist/routes/eval-runs.js +42 -3
  115. package/dist/routes/eval-runs.js.map +1 -1
  116. package/dist/routes/eval-versions.d.ts +25 -0
  117. package/dist/routes/eval-versions.d.ts.map +1 -0
  118. package/dist/routes/eval-versions.js +66 -0
  119. package/dist/routes/eval-versions.js.map +1 -0
  120. package/dist/routes/flows.d.ts +13 -1
  121. package/dist/routes/flows.d.ts.map +1 -1
  122. package/dist/routes/flows.js +48 -3
  123. package/dist/routes/flows.js.map +1 -1
  124. package/dist/routes/guardrails.d.ts.map +1 -1
  125. package/dist/routes/guardrails.js +4 -0
  126. package/dist/routes/guardrails.js.map +1 -1
  127. package/dist/routes/hierarchy-errors.d.ts +45 -0
  128. package/dist/routes/hierarchy-errors.d.ts.map +1 -0
  129. package/dist/routes/hierarchy-errors.js +47 -0
  130. package/dist/routes/hierarchy-errors.js.map +1 -0
  131. package/dist/routes/judged-suites.d.ts +20 -0
  132. package/dist/routes/judged-suites.d.ts.map +1 -0
  133. package/dist/routes/judged-suites.js +272 -0
  134. package/dist/routes/judged-suites.js.map +1 -0
  135. package/dist/routes/judgment-context.d.ts +22 -0
  136. package/dist/routes/judgment-context.d.ts.map +1 -0
  137. package/dist/routes/judgment-context.js +88 -0
  138. package/dist/routes/judgment-context.js.map +1 -0
  139. package/dist/routes/judgment-flow-context.d.ts +32 -0
  140. package/dist/routes/judgment-flow-context.d.ts.map +1 -0
  141. package/dist/routes/judgment-flow-context.js +195 -0
  142. package/dist/routes/judgment-flow-context.js.map +1 -0
  143. package/dist/routes/judgments.d.ts +41 -0
  144. package/dist/routes/judgments.d.ts.map +1 -0
  145. package/dist/routes/judgments.js +566 -0
  146. package/dist/routes/judgments.js.map +1 -0
  147. package/dist/routes/orgs.d.ts +5 -2
  148. package/dist/routes/orgs.d.ts.map +1 -1
  149. package/dist/routes/orgs.js +38 -22
  150. package/dist/routes/orgs.js.map +1 -1
  151. package/dist/routes/policies.d.ts.map +1 -1
  152. package/dist/routes/policies.js +12 -1
  153. package/dist/routes/policies.js.map +1 -1
  154. package/dist/routes/projects.d.ts +10 -2
  155. package/dist/routes/projects.d.ts.map +1 -1
  156. package/dist/routes/projects.js +94 -80
  157. package/dist/routes/projects.js.map +1 -1
  158. package/dist/routes/providers.d.ts.map +1 -1
  159. package/dist/routes/providers.js +6 -1
  160. package/dist/routes/providers.js.map +1 -1
  161. package/dist/routes/runs.js +25 -3
  162. package/dist/routes/runs.js.map +1 -1
  163. package/dist/routes/teams.d.ts +6 -2
  164. package/dist/routes/teams.d.ts.map +1 -1
  165. package/dist/routes/teams.js +83 -73
  166. package/dist/routes/teams.js.map +1 -1
  167. package/dist/routes/tools.d.ts.map +1 -1
  168. package/dist/routes/tools.js +4 -0
  169. package/dist/routes/tools.js.map +1 -1
  170. package/dist/tool-binding.d.ts +8 -0
  171. package/dist/tool-binding.d.ts.map +1 -1
  172. package/openapi.json +14253 -10099
  173. package/package.json +21 -21
  174. package/src/agent-binding.ts +28 -4
  175. package/src/agent-pins.ts +147 -0
  176. package/src/app.ts +81 -3
  177. package/src/block-binding.ts +137 -0
  178. package/src/block-pins.ts +148 -0
  179. package/src/cost-binding.ts +21 -1
  180. package/src/deploy-versions.ts +157 -0
  181. package/src/deployment-binding.ts +27 -3
  182. package/src/derive-agent-version.ts +217 -0
  183. package/src/errors.ts +18 -0
  184. package/src/eval-case-binding.ts +71 -0
  185. package/src/eval-run-binding.ts +40 -0
  186. package/src/eval-run-dispatcher.ts +60 -16
  187. package/src/eval-suite-binding.ts +2 -0
  188. package/src/flow-binding.ts +20 -4
  189. package/src/flow-pins.ts +113 -0
  190. package/src/guardrail-binding.ts +9 -0
  191. package/src/handler-binding.ts +3 -0
  192. package/src/index.ts +86 -2
  193. package/src/judged-dispatcher.ts +530 -0
  194. package/src/judged-items.ts +263 -0
  195. package/src/judgment-binding.ts +349 -0
  196. package/src/openapi/generate.ts +7 -1
  197. package/src/openapi/operations.ts +579 -13
  198. package/src/openapi/schemas.ts +1408 -128
  199. package/src/provider-binding.ts +12 -7
  200. package/src/registry-read-only.ts +43 -0
  201. package/src/routes/agents.ts +252 -19
  202. package/src/routes/blocks.ts +387 -0
  203. package/src/routes/cost.ts +55 -1
  204. package/src/routes/deployments.ts +291 -56
  205. package/src/routes/eval-comparison.ts +135 -0
  206. package/src/routes/eval-runs.ts +57 -3
  207. package/src/routes/eval-versions.ts +110 -0
  208. package/src/routes/flows.ts +70 -5
  209. package/src/routes/guardrails.ts +7 -0
  210. package/src/routes/hierarchy-errors.ts +60 -0
  211. package/src/routes/judged-suites.ts +363 -0
  212. package/src/routes/judgment-context.ts +128 -0
  213. package/src/routes/judgment-flow-context.ts +245 -0
  214. package/src/routes/judgments.ts +743 -0
  215. package/src/routes/orgs.ts +44 -27
  216. package/src/routes/policies.ts +19 -0
  217. package/src/routes/projects.ts +118 -96
  218. package/src/routes/providers.ts +5 -0
  219. package/src/routes/runs.ts +29 -3
  220. package/src/routes/teams.ts +104 -90
  221. package/src/routes/tools.ts +7 -0
  222. package/src/tool-binding.ts +9 -0
@@ -168,6 +168,16 @@ export const RunSchema = {
168
168
  description: 'Set on a child run: the node in the parent run that started it.',
169
169
  },
170
170
  agent: { $ref: '#/components/schemas/RunAgent' },
171
+ replayOf: {
172
+ type: 'string',
173
+ format: 'uuid',
174
+ description: 'Set on a replay run (an eval run re-running a past run): the run it replays.',
175
+ },
176
+ evalRunId: {
177
+ type: 'string',
178
+ description: 'Set on a replay run: the eval run that started it.',
179
+ },
180
+ versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
171
181
  publicAccessToken: {
172
182
  type: 'string',
173
183
  description: 'Only in the response to `POST /v1/runs`, when the deployment issues public run tokens: a read-only token for this run (and its descendants) to hand to a browser, for `GET /v1/runs/{runId}/progress` and its stream.',
@@ -839,8 +849,20 @@ export const AgentSchema = {
839
849
  version: { type: 'string', description: 'Semver.' },
840
850
  name: { type: 'string' },
841
851
  description: { type: 'string' },
842
- instructions: { type: 'string' },
852
+ instructions: {
853
+ oneOf: [{ type: 'string', minLength: 1 }, { $ref: '#/components/schemas/PromptRef' }],
854
+ description: 'The system prompt (a Liquid template), or a prompt block by range whose template and parameters are used instead (pinned at publish, `pins.prompts`).',
855
+ },
843
856
  parameters: { type: 'array', items: { $ref: '#/components/schemas/PromptParameter' } },
857
+ settings: {
858
+ type: 'array',
859
+ items: { $ref: '#/components/schemas/BlockRef' },
860
+ description: 'Settings blocks the agent reads, by range: tools read them as `ToolContext.settings[\'<id>\']`, templates as `settings["<id>"]`. Pinned at publish (`pins.settings`).',
861
+ },
862
+ modelSettings: {
863
+ $ref: '#/components/schemas/BlockRef',
864
+ description: "A model-settings block by range: its `temperature` and `maxOutputTokens` go into the turn's model calls. Pinned at publish.",
865
+ },
844
866
  capabilities: { type: 'array', items: { $ref: '#/components/schemas/Capability' } },
845
867
  tools: { type: 'array', items: { $ref: '#/components/schemas/ToolRef' } },
846
868
  retrieval: { type: 'array', items: { $ref: '#/components/schemas/RetrievalIntent' } },
@@ -860,6 +882,94 @@ export const AgentSchema = {
860
882
  tags: { type: 'array', items: { type: 'string' } },
861
883
  output: { $ref: '#/components/schemas/AgentOutputSpec' },
862
884
  toolErrors: { $ref: '#/components/schemas/ToolErrorsSpec' },
885
+ pins: { $ref: '#/components/schemas/AgentPins' },
886
+ derivedFrom: { $ref: '#/components/schemas/VersionDerivation' },
887
+ unregisteredAt: {
888
+ type: 'string',
889
+ format: 'date-time',
890
+ description: 'Present only on an unregistered version (`GET …/versions/{version}` reads those too). Unregister stops a version being chosen, not the pins that hold it: a new run naming it is refused, while a resumed run and a published version that pins it still run it.',
891
+ },
892
+ pinsDigest: {
893
+ type: 'string',
894
+ pattern: '^sha256:[0-9a-f]{64}$',
895
+ description: "Set by the runtime with `pins`: `sha256:<hex>` of the pins' canonical JSON (sorted keys, no whitespace). Two agent versions with the same digest run the same blocks.",
896
+ },
897
+ },
898
+ };
899
+ export const VersionDerivationSchema = {
900
+ description: "Set by the runtime on an agent or flow version a deploy registered in place of the definition's version, which was registered already with other pins or content (versions never change). Never in the publish body.",
901
+ type: 'object',
902
+ additionalProperties: false,
903
+ required: ['version', 'reason'],
904
+ properties: {
905
+ version: { type: 'string', description: 'The version the definition names.' },
906
+ reason: {
907
+ type: 'string',
908
+ enum: ['pins-changed', 'unpinned', 'version-taken', 'edited'],
909
+ description: "`pins-changed`: a block it uses has a new version; `unpinned`: the definition's version was published before pins existed; `version-taken`: the definition's version holds another definition; `edited`: derived from `version` with some data-block pins swapped (`POST /v1/agents/{agentId}/versions`).",
910
+ },
911
+ label: { type: 'string', description: 'For `edited`: a short label for the version.' },
912
+ by: { type: 'string', description: 'For `edited`: who derived it (`user:<id>`).' },
913
+ },
914
+ };
915
+ export const DeriveAgentVersionBodySchema = {
916
+ description: "Derive a new agent version from a pinned one with some data-block pins swapped: an expert's edit reaching an agent with no code change.",
917
+ type: 'object',
918
+ additionalProperties: false,
919
+ required: ['from', 'pins'],
920
+ properties: {
921
+ from: { type: 'string', description: 'The version to derive from (it must be pinned).' },
922
+ pins: { $ref: '#/components/schemas/AgentPinSwaps' },
923
+ label: { type: 'string', description: 'A short label for the new version.' },
924
+ projectId: {
925
+ type: 'string',
926
+ format: 'uuid',
927
+ description: "The agent's project, when the runtime doesn't record it on the version.",
928
+ },
929
+ },
930
+ };
931
+ const PinMapSchema = {
932
+ type: 'object',
933
+ additionalProperties: { type: 'string' },
934
+ };
935
+ export const AgentPinSwapsSchema = {
936
+ description: 'The data-block pins to swap, by block id → exact version. Only blocks the version already references; tool pins come from code.',
937
+ type: 'object',
938
+ additionalProperties: false,
939
+ properties: {
940
+ prompts: { ...PinMapSchema, description: 'Prompt block id → exact version.' },
941
+ settings: { ...PinMapSchema, description: 'Settings block id → exact version.' },
942
+ },
943
+ };
944
+ export const AgentPinsSchema = {
945
+ description: 'The exact block versions an agent version runs: its lockfile. Set by the runtime when the version is published, never in the publish body: each tool range resolves once to the version every run of that agent version uses, so a new tool version reaches the agent only through a new agent version. Absent on a version published before pins existed (its ranges resolve per run).',
946
+ type: 'object',
947
+ additionalProperties: false,
948
+ required: ['tools', 'prompts', 'settings'],
949
+ properties: {
950
+ tools: { ...PinMapSchema, description: 'Tool id → exact version.' },
951
+ prompts: { ...PinMapSchema, description: 'Prompt block id → exact version.' },
952
+ settings: { ...PinMapSchema, description: 'Settings block id → exact version.' },
953
+ },
954
+ };
955
+ export const PromptRefSchema = {
956
+ description: "A prompt block an agent's instructions come from, by id and semver range.",
957
+ type: 'object',
958
+ additionalProperties: false,
959
+ required: ['prompt', 'version'],
960
+ properties: {
961
+ prompt: { type: 'string', description: 'The prompt block id.' },
962
+ version: { type: 'string', description: 'A semver range (`^1.0.0`, `1.2.0`).' },
963
+ },
964
+ };
965
+ export const BlockRefSchema = {
966
+ description: 'A settings block an agent reads, by id and semver range.',
967
+ type: 'object',
968
+ additionalProperties: false,
969
+ required: ['id', 'version'],
970
+ properties: {
971
+ id: { type: 'string', description: 'The settings block id.' },
972
+ version: { type: 'string', description: 'A semver range (`^1.0.0`, `1.2.0`).' },
863
973
  },
864
974
  };
865
975
  export const PublishAgentBodySchema = {
@@ -883,8 +993,20 @@ export const PublishAgentBodySchema = {
883
993
  name: { type: 'string' },
884
994
  description: { type: 'string' },
885
995
  projectId: ContentProjectIdProperty,
886
- instructions: { type: 'string' },
996
+ instructions: {
997
+ oneOf: [{ type: 'string', minLength: 1 }, { $ref: '#/components/schemas/PromptRef' }],
998
+ description: 'The system prompt (a Liquid template), or a prompt block by range whose template and parameters are used instead (pinned at publish, `pins.prompts`).',
999
+ },
887
1000
  parameters: { type: 'array', items: { $ref: '#/components/schemas/PromptParameter' } },
1001
+ settings: {
1002
+ type: 'array',
1003
+ items: { $ref: '#/components/schemas/BlockRef' },
1004
+ description: 'Settings blocks the agent reads, by range: tools read them as `ToolContext.settings[\'<id>\']`, templates as `settings["<id>"]`. Pinned at publish (`pins.settings`).',
1005
+ },
1006
+ modelSettings: {
1007
+ $ref: '#/components/schemas/BlockRef',
1008
+ description: "A model-settings block by range: its `temperature` and `maxOutputTokens` go into the turn's model calls. Pinned at publish.",
1009
+ },
888
1010
  capabilities: { type: 'array', items: { $ref: '#/components/schemas/Capability' } },
889
1011
  tools: { type: 'array', items: { $ref: '#/components/schemas/ToolRef' } },
890
1012
  retrieval: { type: 'array', items: { $ref: '#/components/schemas/RetrievalIntent' } },
@@ -1009,6 +1131,43 @@ export const FlowSchema = {
1009
1131
  edges: { type: 'array', items: { $ref: '#/components/schemas/FlowEdge' } },
1010
1132
  maxParallelism: { type: 'integer', minimum: 1 },
1011
1133
  metadata: { type: 'object', additionalProperties: true },
1134
+ pins: { $ref: '#/components/schemas/FlowPins' },
1135
+ pinsDigest: {
1136
+ type: 'string',
1137
+ pattern: '^sha256:[0-9a-f]{64}$',
1138
+ description: "Set by the runtime with `pins`: `sha256:<hex>` of the pins' canonical JSON (sorted keys, no whitespace).",
1139
+ },
1140
+ derivedFrom: { $ref: '#/components/schemas/VersionDerivation' },
1141
+ unregisteredAt: {
1142
+ type: 'string',
1143
+ format: 'date-time',
1144
+ description: 'Present only on an unregistered version (`GET …/versions/{version}` reads those too). Unregister stops a version being chosen, not the pins that hold it: a new run naming it is refused, while a resumed run and a published version that pins it still run it.',
1145
+ },
1146
+ },
1147
+ };
1148
+ export const FlowPinsSchema = {
1149
+ description: 'The exact tool and agent versions a flow version runs: its lockfile. Set by the runtime when the version is published, never in the publish body: each tool the flow runs, and each agent it runs at no named version, resolves once to its latest version then, which every run of that flow version uses. Absent on a version published before pins existed (it binds the latest versions per run).',
1150
+ type: 'object',
1151
+ additionalProperties: false,
1152
+ required: ['tools', 'agents'],
1153
+ properties: {
1154
+ tools: { ...PinMapSchema, description: 'Tool id → exact version.' },
1155
+ agents: {
1156
+ ...PinMapSchema,
1157
+ description: 'Agent id → exact version, for agent nodes that name no version.',
1158
+ },
1159
+ },
1160
+ };
1161
+ export const FlowVersionOverridesSchema = {
1162
+ description: "Agents and tools a flow runs at other exact versions than the flow version's pins (\"this flow, with `acme.scorer` at 0.4.0\"), without publishing a new flow version: a comparison's flow candidate (`versions` on the start body and the run's `comparison`), and the flow runs that replay it (a run's `versions`). Each id must be an agent or tool the flow uses.",
1163
+ type: 'object',
1164
+ additionalProperties: false,
1165
+ properties: {
1166
+ tools: { ...PinMapSchema, description: 'Tool id → exact version.' },
1167
+ agents: {
1168
+ ...PinMapSchema,
1169
+ description: 'Agent id → exact version, for agent nodes with or without a version of their own.',
1170
+ },
1012
1171
  },
1013
1172
  };
1014
1173
  export const PublishFlowBodySchema = {
@@ -1708,190 +1867,620 @@ export const ObservationCollectionPageSchema = {
1708
1867
  hasMore: { type: 'boolean' },
1709
1868
  },
1710
1869
  };
1711
- // ---------------- memory ----------------
1712
- export const FactScopeSchema = {
1713
- type: 'object',
1714
- additionalProperties: true,
1715
- required: ['tenantId'],
1716
- description: 'Fact scope object. `tenantId` is required; every optional key narrows the fact (`userId`, `orgId`, `projectId`, `threadId`, `sessionId`). Additional keys accepted for forward compatibility.',
1717
- properties: {
1718
- tenantId: { type: 'string' },
1719
- userId: { type: 'string' },
1720
- orgId: { type: 'string' },
1721
- projectId: { type: 'string' },
1722
- threadId: { type: 'string' },
1723
- sessionId: { type: 'string' },
1724
- },
1725
- };
1726
- export const RetentionSchema = {
1727
- type: 'object',
1728
- additionalProperties: false,
1729
- properties: {
1730
- keepUntil: { type: 'string', format: 'date-time' },
1731
- keepDays: { type: 'integer', minimum: 1 },
1732
- legalHold: { type: 'boolean' },
1733
- },
1734
- };
1735
- export const SourceFreshnessSchema = {
1736
- type: 'object',
1737
- additionalProperties: false,
1738
- properties: {
1739
- ttlSeconds: { type: 'integer', minimum: 0 },
1740
- lastVerifiedAt: { type: 'string', format: 'date-time' },
1741
- etag: { type: 'string' },
1742
- sourceVersion: { type: 'string' },
1743
- },
1744
- };
1745
- export const SourceRefreshSchema = {
1746
- type: 'object',
1747
- additionalProperties: false,
1748
- required: ['strategy'],
1749
- properties: {
1750
- strategy: { type: 'string', enum: ['on-read', 'background', 'manual'] },
1751
- handler: { type: 'string' },
1752
- priority: { type: 'integer' },
1753
- },
1754
- };
1755
- export const FactSourceSchema = {
1756
- type: 'object',
1757
- additionalProperties: false,
1758
- required: ['kind', 'freshness', 'refresh'],
1759
- properties: {
1760
- kind: {
1761
- type: 'string',
1762
- enum: ['http-api', 'blob', 'mcp-tool', 'external-db', 'user-input'],
1870
+ // ---------------- judgments + judge classes ----------------
1871
+ export const JudgeClassScopeSchema = {
1872
+ description: 'Where a judge class applies: the whole tenant, one project, or one agent in a project.',
1873
+ oneOf: [
1874
+ {
1875
+ type: 'object',
1876
+ additionalProperties: false,
1877
+ required: ['kind'],
1878
+ properties: { kind: { type: 'string', const: 'tenant' } },
1763
1879
  },
1764
- uri: { type: 'string' },
1765
- freshness: { $ref: '#/components/schemas/SourceFreshness' },
1766
- refresh: { $ref: '#/components/schemas/SourceRefresh' },
1767
- },
1880
+ {
1881
+ type: 'object',
1882
+ additionalProperties: false,
1883
+ required: ['kind', 'projectId'],
1884
+ properties: {
1885
+ kind: { type: 'string', const: 'project' },
1886
+ projectId: { type: 'string', minLength: 1 },
1887
+ },
1888
+ },
1889
+ {
1890
+ type: 'object',
1891
+ additionalProperties: false,
1892
+ required: ['kind', 'projectId', 'agentId'],
1893
+ properties: {
1894
+ kind: { type: 'string', const: 'agent' },
1895
+ projectId: { type: 'string', minLength: 1 },
1896
+ agentId: { type: 'string', minLength: 1 },
1897
+ },
1898
+ },
1899
+ ],
1768
1900
  };
1769
- export const FactSchema = {
1901
+ export const JudgeClassSchema = {
1770
1902
  type: 'object',
1771
1903
  additionalProperties: false,
1772
- required: ['id', 'type', 'scope', 'version', 'createdAt'],
1904
+ required: ['id', 'tenantId', 'scope', 'name', 'weight', 'createdAt', 'updatedAt'],
1773
1905
  properties: {
1774
- id: { type: 'string', description: 'FactId.' },
1775
- type: {
1906
+ id: { type: 'string' },
1907
+ tenantId: { type: 'string' },
1908
+ scope: { $ref: '#/components/schemas/JudgeClassScope' },
1909
+ name: {
1776
1910
  type: 'string',
1777
- description: 'Fact type identifier (pack-defined; a few are framework-standard).',
1911
+ description: 'The deployment\'s own word for the class: "expert", "user", "arbitrator".',
1778
1912
  },
1779
- scope: { $ref: '#/components/schemas/FactScope' },
1780
- version: {
1781
- type: 'integer',
1782
- minimum: 1,
1783
- description: 'Monotonic version within (scope, id). Supersession increments.',
1913
+ weight: {
1914
+ type: 'number',
1915
+ minimum: 0,
1916
+ description: 'How much a judgment of this class counts, relative to the others.',
1784
1917
  },
1918
+ description: { type: 'string' },
1785
1919
  createdAt: { type: 'string', format: 'date-time' },
1786
1920
  updatedAt: { type: 'string', format: 'date-time' },
1787
- content: { description: 'Free-form structured payload.' },
1788
- contentRef: {
1789
- type: 'string',
1790
- description: '`blob://<provider>/<bucket>/<key>` when the payload is stored externally.',
1791
- },
1792
- contentHash: { type: 'string' },
1793
- size: { type: 'integer', minimum: 0 },
1794
- embeddingModel: { type: 'string' },
1795
- retention: { $ref: '#/components/schemas/Retention' },
1796
- source: { $ref: '#/components/schemas/FactSource' },
1797
- causedByLogId: { type: 'array', items: { type: 'string' } },
1798
- supersedes: {
1921
+ unregisteredAt: {
1799
1922
  type: 'string',
1800
- description: 'FactId of the predecessor when this row supersedes another.',
1923
+ format: 'date-time',
1924
+ description: 'Set when the class was retired.',
1801
1925
  },
1802
1926
  },
1803
1927
  };
1804
- export const FactCollectionPageSchema = {
1928
+ export const JudgeClassCollectionPageSchema = {
1805
1929
  type: 'object',
1806
1930
  additionalProperties: false,
1807
1931
  required: ['data', 'hasMore'],
1808
1932
  properties: {
1809
- data: { type: 'array', items: { $ref: '#/components/schemas/Fact' } },
1810
- nextCursor: {
1811
- type: 'string',
1812
- description: 'Opaque cursor for the next page. Absent when `hasMore: false`.',
1813
- },
1933
+ data: { type: 'array', items: { $ref: '#/components/schemas/JudgeClass' } },
1934
+ nextCursor: { type: 'string', description: 'Opaque cursor. Treat as opaque on the client.' },
1814
1935
  hasMore: { type: 'boolean' },
1815
1936
  },
1816
1937
  };
1817
- export const WriteFactBodySchema = {
1818
- description: "Write a fact. `type` selects the retrieval-policy (which indexes populate); `scope.tenantId` MUST match the caller's tenant. Optional `retention` overrides tenant defaults; optional `contentHash` is a caller-supplied idempotence hint (runtime computes its own hash regardless).",
1938
+ export const CreateJudgeClassBodySchema = {
1819
1939
  type: 'object',
1820
1940
  additionalProperties: false,
1821
- required: ['type', 'scope', 'content'],
1941
+ required: ['scope', 'name', 'weight'],
1822
1942
  properties: {
1823
- type: { type: 'string', minLength: 1 },
1824
- scope: { $ref: '#/components/schemas/FactScope' },
1825
- content: { description: 'Free-form structured payload.' },
1826
- retention: { $ref: '#/components/schemas/Retention' },
1827
- contentHash: { type: 'string' },
1943
+ scope: { $ref: '#/components/schemas/JudgeClassScope' },
1944
+ name: { type: 'string', minLength: 1, maxLength: 100 },
1945
+ weight: { type: 'number', minimum: 0 },
1946
+ description: { type: 'string' },
1828
1947
  },
1829
1948
  };
1830
- export const SupersedeFactResultSchema = {
1949
+ export const UpdateJudgeClassBodySchema = {
1831
1950
  type: 'object',
1832
1951
  additionalProperties: false,
1833
- required: ['factId', 'superseded'],
1952
+ minProperties: 1,
1834
1953
  properties: {
1835
- factId: { type: 'string' },
1836
- superseded: { type: 'boolean', const: true },
1954
+ weight: { type: 'number', minimum: 0 },
1955
+ description: { type: 'string' },
1837
1956
  },
1838
1957
  };
1839
- export const RetrieveIntentSchema = {
1840
- description: 'Retrieval intent — mirrors `RetrievalIntent` from `@kindgi/agents`, widened for direct-HTTP use. `mode: "list"` returns a plain scoped list (no query). `mode: "keyword"` runs full-text search. `mode: "semantic"` runs vector similarity search — requires an embedding provider bound on the deployment; if unavailable, the route returns `400 bad-input`. `mode: "both"` unions keyword + semantic results, dedup by fact id.',
1958
+ export const UnregisterJudgeClassResultSchema = {
1841
1959
  type: 'object',
1842
1960
  additionalProperties: false,
1843
- required: ['mode'],
1961
+ required: ['judgeClassId', 'unregistered'],
1844
1962
  properties: {
1845
- mode: { type: 'string', enum: ['list', 'keyword', 'semantic', 'both'] },
1846
- query: {
1847
- type: 'string',
1848
- description: 'Required for `keyword` / `semantic` / `both`; ignored for `list`.',
1849
- },
1850
- type: { type: 'string', minLength: 1 },
1851
- scope: { $ref: '#/components/schemas/FactScope' },
1852
- limit: { type: 'integer', minimum: 1 },
1853
- embeddingModel: { type: 'string' },
1963
+ judgeClassId: { type: 'string' },
1964
+ unregistered: { type: 'boolean', const: true },
1854
1965
  },
1855
1966
  };
1856
- export const RetrieveMemoryBodySchema = RetrieveIntentSchema;
1857
- export const RetrievalHitSchema = {
1967
+ export const JudgedSubjectSchema = {
1858
1968
  type: 'object',
1859
1969
  additionalProperties: false,
1860
- required: ['fact'],
1970
+ required: ['kind', 'id', 'version'],
1971
+ description: 'What a judged run ran: an agent at a version, or a flow at a version.',
1861
1972
  properties: {
1862
- fact: { $ref: '#/components/schemas/Fact' },
1863
- score: {
1864
- type: 'number',
1865
- description: 'Relevance score. Keyword mode returns an implementation-defined rank (higher = better). Semantic mode returns cosine similarity in [-1, 1] (higher = better). Absent for `list` mode.',
1866
- },
1973
+ kind: { type: 'string', enum: ['agent', 'flow'] },
1974
+ id: { type: 'string' },
1975
+ version: { type: 'string' },
1867
1976
  },
1868
1977
  };
1869
- export const RetrieveMemoryResultSchema = {
1978
+ export const JudgedItemSchema = {
1870
1979
  type: 'object',
1871
1980
  additionalProperties: false,
1872
- required: ['results'],
1981
+ required: ['key'],
1982
+ description: "The judged item of a run's output.",
1873
1983
  properties: {
1874
- results: { type: 'array', items: { $ref: '#/components/schemas/RetrievalHit' } },
1984
+ key: { type: 'string', minLength: 1, description: "The caller's stable id for the item." },
1985
+ pointer: {
1986
+ type: 'string',
1987
+ description: 'Where the item is in the run\'s output, as a JSON Pointer (RFC 6901), e.g. `/matches/2`. `""` is the whole output.',
1988
+ },
1989
+ rank: {
1990
+ type: 'integer',
1991
+ minimum: 0,
1992
+ description: "The item's position in a ranked list (0 = first).",
1993
+ },
1875
1994
  },
1876
1995
  };
1877
- export const RevokeTokenResultSchema = {
1996
+ export const JudgmentAssertedBySchema = {
1878
1997
  type: 'object',
1879
1998
  additionalProperties: false,
1880
- required: ['tokenId', 'revoked'],
1999
+ required: ['kind', 'id'],
2000
+ description: 'Who asserted a judgment: the authenticated caller, never a typed name.',
1881
2001
  properties: {
1882
- tokenId: { type: 'string', format: 'uuid' },
1883
- revoked: { type: 'boolean', const: true },
2002
+ kind: { type: 'string', enum: ['user', 'service'] },
2003
+ id: {
2004
+ type: 'string',
2005
+ description: 'A user id, or for a service token its token or session id.',
2006
+ },
1884
2007
  },
1885
2008
  };
1886
- // ---------------- signing keys (the deployment trust list) ----------------
1887
- export const TrustedSigningKeySchema = {
2009
+ export const JudgmentSchema = {
1888
2010
  type: 'object',
1889
2011
  additionalProperties: false,
1890
- required: ['keyId', 'tenantId', 'algorithm', 'publicKey', 'createdAt'],
1891
- description: 'A public key the tenant trusts to sign deployments (`POST /v1/deployments`). A revoked key stays readable, with `revokedAt`, so the deployments it signed can be audited; it verifies no new ones.',
2012
+ required: [
2013
+ 'id',
2014
+ 'tenantId',
2015
+ 'projectId',
2016
+ 'runId',
2017
+ 'subject',
2018
+ 'item',
2019
+ 'verdict',
2020
+ 'assertedBy',
2021
+ 'createdAt',
2022
+ ],
1892
2023
  properties: {
1893
- keyId: { type: 'string', description: 'The signer key id a deployment envelope names.' },
1894
- tenantId: { type: 'string', format: 'uuid' },
2024
+ id: { type: 'string' },
2025
+ tenantId: { type: 'string' },
2026
+ projectId: { type: 'string' },
2027
+ runId: { type: 'string' },
2028
+ subject: { $ref: '#/components/schemas/JudgedSubject' },
2029
+ item: { $ref: '#/components/schemas/JudgedItem' },
2030
+ verdict: { type: 'string', enum: ['yes', 'no'] },
2031
+ reason: { type: 'string' },
2032
+ judgeClassId: {
2033
+ type: 'string',
2034
+ description: 'The judge class the judgment is recorded under. Absent when unclassified (counts with weight 1).',
2035
+ },
2036
+ assertedBy: { $ref: '#/components/schemas/JudgmentAssertedBy' },
2037
+ participantId: {
2038
+ type: 'string',
2039
+ description: "The app's opaque id for its end user who judged, when an app judged on their behalf.",
2040
+ },
2041
+ createdAt: { type: 'string', format: 'date-time' },
2042
+ unregisteredAt: {
2043
+ type: 'string',
2044
+ format: 'date-time',
2045
+ description: 'Set when the judgment was removed or superseded.',
2046
+ },
2047
+ supersededBy: { type: 'string', description: 'The judgment that replaced this one.' },
2048
+ },
2049
+ };
2050
+ export const JudgedRunContextSchema = {
2051
+ type: 'object',
2052
+ additionalProperties: false,
2053
+ description: 'What a judged run needs besides its input to be replayed, captured when it was first judged. For an agent turn: the conversation before it, what its retrievals returned, and the decision at its session approval gate. For a flow run: its tool calls with their results.',
2054
+ properties: {
2055
+ history: {
2056
+ type: 'array',
2057
+ items: {},
2058
+ description: "The conversation's messages before the turn, oldest first (at most the last 200).",
2059
+ },
2060
+ historyTruncated: {
2061
+ type: 'boolean',
2062
+ description: 'Whether older messages were left out of `history`.',
2063
+ },
2064
+ retrieved: { description: "What the turn's retrievals returned." },
2065
+ sessionApproval: {
2066
+ type: 'object',
2067
+ additionalProperties: false,
2068
+ required: ['approved'],
2069
+ description: "The reviewer's decision at the turn's session approval gate, when the turn waited on one. A replay of the turn follows it.",
2070
+ properties: {
2071
+ approved: { type: 'boolean' },
2072
+ rationale: { type: 'string', description: "The reviewer's reason for a rejection." },
2073
+ },
2074
+ },
2075
+ flow: {
2076
+ type: 'object',
2077
+ additionalProperties: false,
2078
+ required: ['calls', 'steps'],
2079
+ description: "For a flow run: what it did, kept at its first judgment so it can be replayed. Every tool call it made with its result (at its tool nodes, in its agent steps' turns and in its sub-flows), at most 500, and its agent steps.",
2080
+ properties: {
2081
+ calls: {
2082
+ type: 'array',
2083
+ items: {
2084
+ type: 'object',
2085
+ additionalProperties: false,
2086
+ required: ['runId', 'toolId'],
2087
+ properties: {
2088
+ runId: {
2089
+ type: 'string',
2090
+ description: "The run that made it: the flow run, a sub-flow's, or an agent step's turn.",
2091
+ },
2092
+ nodeId: {
2093
+ type: 'string',
2094
+ description: 'The tool node that made it, or the agent step whose turn did.',
2095
+ },
2096
+ scope: { type: 'string', description: 'The loop iteration, in a loop body.' },
2097
+ toolId: { type: 'string' },
2098
+ arguments: {},
2099
+ result: {},
2100
+ },
2101
+ },
2102
+ },
2103
+ steps: {
2104
+ type: 'array',
2105
+ items: {
2106
+ type: 'object',
2107
+ additionalProperties: false,
2108
+ required: ['runId', 'agentId', 'agentVersion'],
2109
+ properties: {
2110
+ runId: { type: 'string' },
2111
+ nodeId: { type: 'string' },
2112
+ scope: { type: 'string' },
2113
+ agentId: { type: 'string' },
2114
+ agentVersion: { type: 'string' },
2115
+ retrieved: { description: "What the step's turn retrieved." },
2116
+ },
2117
+ },
2118
+ },
2119
+ truncated: { type: 'boolean', description: 'More calls were made than were kept.' },
2120
+ },
2121
+ },
2122
+ },
2123
+ };
2124
+ export const JudgedRunCopySchema = {
2125
+ type: 'object',
2126
+ additionalProperties: false,
2127
+ required: ['runId', 'subject', 'input', 'output', 'capturedAt'],
2128
+ description: "The stored copy of a judged run's input and output, taken when it was first judged.",
2129
+ properties: {
2130
+ runId: { type: 'string' },
2131
+ subject: { $ref: '#/components/schemas/JudgedSubject' },
2132
+ input: {},
2133
+ context: {
2134
+ $ref: '#/components/schemas/JudgedRunContext',
2135
+ },
2136
+ output: {},
2137
+ capturedAt: { type: 'string', format: 'date-time' },
2138
+ },
2139
+ };
2140
+ export const JudgmentWithCopiesSchema = {
2141
+ description: 'A judgment with the stored copies of what was judged.',
2142
+ allOf: [
2143
+ { $ref: '#/components/schemas/Judgment' },
2144
+ {
2145
+ type: 'object',
2146
+ required: ['run'],
2147
+ properties: {
2148
+ run: { $ref: '#/components/schemas/JudgedRunCopy' },
2149
+ itemValue: {
2150
+ description: "The judged item's value, when the judgment pointed at it.",
2151
+ },
2152
+ },
2153
+ },
2154
+ ],
2155
+ };
2156
+ export const JudgmentCollectionPageSchema = {
2157
+ type: 'object',
2158
+ additionalProperties: false,
2159
+ required: ['data', 'hasMore'],
2160
+ properties: {
2161
+ data: { type: 'array', items: { $ref: '#/components/schemas/Judgment' } },
2162
+ nextCursor: { type: 'string', description: 'Opaque cursor. Treat as opaque on the client.' },
2163
+ hasMore: { type: 'boolean' },
2164
+ },
2165
+ };
2166
+ export const CreateJudgmentBodySchema = {
2167
+ type: 'object',
2168
+ additionalProperties: false,
2169
+ required: ['runId', 'item', 'verdict'],
2170
+ properties: {
2171
+ runId: { type: 'string', minLength: 1 },
2172
+ item: { $ref: '#/components/schemas/JudgedItem' },
2173
+ verdict: { type: 'string', enum: ['yes', 'no'] },
2174
+ reason: { type: 'string', maxLength: 4000 },
2175
+ judgeClassId: {
2176
+ type: 'string',
2177
+ minLength: 1,
2178
+ description: 'Optional. When given it must exist and apply to the run.',
2179
+ },
2180
+ participantId: {
2181
+ type: 'string',
2182
+ minLength: 1,
2183
+ description: "An app's opaque id for its end user, when judging on their behalf.",
2184
+ },
2185
+ },
2186
+ };
2187
+ export const UnregisterJudgmentResultSchema = {
2188
+ type: 'object',
2189
+ additionalProperties: false,
2190
+ required: ['judgmentId', 'unregistered'],
2191
+ properties: {
2192
+ judgmentId: { type: 'string' },
2193
+ unregistered: { type: 'boolean', const: true },
2194
+ },
2195
+ };
2196
+ export const JudgedItemSummarySchema = {
2197
+ type: 'object',
2198
+ additionalProperties: false,
2199
+ required: ['key', 'yes', 'no', 'yesWeight', 'totalWeight', 'reasons'],
2200
+ description: "The judgments of one item of a case's output, summed up.",
2201
+ properties: {
2202
+ key: { type: 'string' },
2203
+ pointer: { type: 'string' },
2204
+ rank: { type: 'integer', minimum: 0 },
2205
+ yes: { type: 'integer', minimum: 0, description: 'How many judgments said yes.' },
2206
+ no: { type: 'integer', minimum: 0, description: 'How many judgments said no.' },
2207
+ yesWeight: {
2208
+ type: 'number',
2209
+ description: 'The weight behind "yes" (an unclassified judgment counts 1).',
2210
+ },
2211
+ totalWeight: { type: 'number', description: 'The weight behind all judgments of the item.' },
2212
+ reasons: {
2213
+ type: 'array',
2214
+ description: 'The reasons given, newest first.',
2215
+ items: {
2216
+ type: 'object',
2217
+ additionalProperties: false,
2218
+ required: ['verdict', 'reason'],
2219
+ properties: {
2220
+ verdict: { type: 'string', enum: ['yes', 'no'] },
2221
+ reason: { type: 'string' },
2222
+ },
2223
+ },
2224
+ },
2225
+ },
2226
+ };
2227
+ export const JudgedEvalCaseSchema = {
2228
+ type: 'object',
2229
+ additionalProperties: false,
2230
+ required: ['caseId', 'subject', 'input', 'output', 'items'],
2231
+ description: "One case of a `judged` eval suite: a copy of a judged run with its items' judgments summed up.",
2232
+ properties: {
2233
+ caseId: { type: 'string', description: "The judged run's id." },
2234
+ subject: { $ref: '#/components/schemas/JudgedSubject' },
2235
+ input: {},
2236
+ context: { $ref: '#/components/schemas/JudgedRunContext' },
2237
+ output: {},
2238
+ items: { type: 'array', items: { $ref: '#/components/schemas/JudgedItemSummary' } },
2239
+ },
2240
+ };
2241
+ export const JudgedEvalCaseCollectionPageSchema = {
2242
+ type: 'object',
2243
+ additionalProperties: false,
2244
+ required: ['data', 'hasMore'],
2245
+ properties: {
2246
+ data: { type: 'array', items: { $ref: '#/components/schemas/JudgedEvalCase' } },
2247
+ nextCursor: { type: 'string', description: 'Opaque cursor. Treat as opaque on the client.' },
2248
+ hasMore: { type: 'boolean' },
2249
+ },
2250
+ };
2251
+ export const BuildJudgedSuiteBodySchema = {
2252
+ type: 'object',
2253
+ additionalProperties: false,
2254
+ required: ['version', 'projectId'],
2255
+ description: 'Name the agent (`agentId`) or the flow (`flowId`) whose judged runs to use.',
2256
+ properties: {
2257
+ version: { type: 'string', description: 'Semver version to publish, e.g. `1.0.0`.' },
2258
+ projectId: { type: 'string', minLength: 1 },
2259
+ agentId: { type: 'string', minLength: 1 },
2260
+ agentVersion: { type: 'string', minLength: 1, description: 'Needs `agentId`.' },
2261
+ flowId: { type: 'string', minLength: 1 },
2262
+ since: {
2263
+ type: 'string',
2264
+ format: 'date-time',
2265
+ description: 'Runs first judged at or after this time.',
2266
+ },
2267
+ until: {
2268
+ type: 'string',
2269
+ format: 'date-time',
2270
+ description: 'Runs first judged before this time.',
2271
+ },
2272
+ judgeClassIds: {
2273
+ type: 'array',
2274
+ items: { type: 'string', minLength: 1 },
2275
+ description: 'Count only judgments recorded under these judge classes.',
2276
+ },
2277
+ minJudgments: {
2278
+ type: 'integer',
2279
+ minimum: 1,
2280
+ description: 'Leave out runs with fewer counted judgments. Default 1.',
2281
+ },
2282
+ description: { type: 'string' },
2283
+ },
2284
+ };
2285
+ export const BuildJudgedSuiteResultSchema = {
2286
+ type: 'object',
2287
+ additionalProperties: false,
2288
+ required: ['suiteId', 'version', 'kind', 'caseCount', 'truncated'],
2289
+ properties: {
2290
+ suiteId: { type: 'string' },
2291
+ version: { type: 'string' },
2292
+ kind: { type: 'string', enum: ['judged'] },
2293
+ caseCount: { type: 'integer', minimum: 0 },
2294
+ truncated: {
2295
+ type: 'boolean',
2296
+ description: 'Whether more judged runs matched than the 1000 cases a set holds.',
2297
+ },
2298
+ },
2299
+ };
2300
+ // ---------------- memory ----------------
2301
+ export const FactScopeSchema = {
2302
+ type: 'object',
2303
+ additionalProperties: true,
2304
+ required: ['tenantId'],
2305
+ description: 'Fact scope object. `tenantId` is required; every optional key narrows the fact (`userId`, `orgId`, `projectId`, `threadId`, `sessionId`). Additional keys accepted for forward compatibility.',
2306
+ properties: {
2307
+ tenantId: { type: 'string' },
2308
+ userId: { type: 'string' },
2309
+ orgId: { type: 'string' },
2310
+ projectId: { type: 'string' },
2311
+ threadId: { type: 'string' },
2312
+ sessionId: { type: 'string' },
2313
+ },
2314
+ };
2315
+ export const RetentionSchema = {
2316
+ type: 'object',
2317
+ additionalProperties: false,
2318
+ properties: {
2319
+ keepUntil: { type: 'string', format: 'date-time' },
2320
+ keepDays: { type: 'integer', minimum: 1 },
2321
+ legalHold: { type: 'boolean' },
2322
+ },
2323
+ };
2324
+ export const SourceFreshnessSchema = {
2325
+ type: 'object',
2326
+ additionalProperties: false,
2327
+ properties: {
2328
+ ttlSeconds: { type: 'integer', minimum: 0 },
2329
+ lastVerifiedAt: { type: 'string', format: 'date-time' },
2330
+ etag: { type: 'string' },
2331
+ sourceVersion: { type: 'string' },
2332
+ },
2333
+ };
2334
+ export const SourceRefreshSchema = {
2335
+ type: 'object',
2336
+ additionalProperties: false,
2337
+ required: ['strategy'],
2338
+ properties: {
2339
+ strategy: { type: 'string', enum: ['on-read', 'background', 'manual'] },
2340
+ handler: { type: 'string' },
2341
+ priority: { type: 'integer' },
2342
+ },
2343
+ };
2344
+ export const FactSourceSchema = {
2345
+ type: 'object',
2346
+ additionalProperties: false,
2347
+ required: ['kind', 'freshness', 'refresh'],
2348
+ properties: {
2349
+ kind: {
2350
+ type: 'string',
2351
+ enum: ['http-api', 'blob', 'mcp-tool', 'external-db', 'user-input'],
2352
+ },
2353
+ uri: { type: 'string' },
2354
+ freshness: { $ref: '#/components/schemas/SourceFreshness' },
2355
+ refresh: { $ref: '#/components/schemas/SourceRefresh' },
2356
+ },
2357
+ };
2358
+ export const FactSchema = {
2359
+ type: 'object',
2360
+ additionalProperties: false,
2361
+ required: ['id', 'type', 'scope', 'version', 'createdAt'],
2362
+ properties: {
2363
+ id: { type: 'string', description: 'FactId.' },
2364
+ type: {
2365
+ type: 'string',
2366
+ description: 'Fact type identifier (pack-defined; a few are framework-standard).',
2367
+ },
2368
+ scope: { $ref: '#/components/schemas/FactScope' },
2369
+ version: {
2370
+ type: 'integer',
2371
+ minimum: 1,
2372
+ description: 'Monotonic version within (scope, id). Supersession increments.',
2373
+ },
2374
+ createdAt: { type: 'string', format: 'date-time' },
2375
+ updatedAt: { type: 'string', format: 'date-time' },
2376
+ content: { description: 'Free-form structured payload.' },
2377
+ contentRef: {
2378
+ type: 'string',
2379
+ description: '`blob://<provider>/<bucket>/<key>` when the payload is stored externally.',
2380
+ },
2381
+ contentHash: { type: 'string' },
2382
+ size: { type: 'integer', minimum: 0 },
2383
+ embeddingModel: { type: 'string' },
2384
+ retention: { $ref: '#/components/schemas/Retention' },
2385
+ source: { $ref: '#/components/schemas/FactSource' },
2386
+ causedByLogId: { type: 'array', items: { type: 'string' } },
2387
+ supersedes: {
2388
+ type: 'string',
2389
+ description: 'FactId of the predecessor when this row supersedes another.',
2390
+ },
2391
+ },
2392
+ };
2393
+ export const FactCollectionPageSchema = {
2394
+ type: 'object',
2395
+ additionalProperties: false,
2396
+ required: ['data', 'hasMore'],
2397
+ properties: {
2398
+ data: { type: 'array', items: { $ref: '#/components/schemas/Fact' } },
2399
+ nextCursor: {
2400
+ type: 'string',
2401
+ description: 'Opaque cursor for the next page. Absent when `hasMore: false`.',
2402
+ },
2403
+ hasMore: { type: 'boolean' },
2404
+ },
2405
+ };
2406
+ export const WriteFactBodySchema = {
2407
+ description: "Write a fact. `type` selects the retrieval-policy (which indexes populate); `scope.tenantId` MUST match the caller's tenant. Optional `retention` overrides tenant defaults; optional `contentHash` is a caller-supplied idempotence hint (runtime computes its own hash regardless).",
2408
+ type: 'object',
2409
+ additionalProperties: false,
2410
+ required: ['type', 'scope', 'content'],
2411
+ properties: {
2412
+ type: { type: 'string', minLength: 1 },
2413
+ scope: { $ref: '#/components/schemas/FactScope' },
2414
+ content: { description: 'Free-form structured payload.' },
2415
+ retention: { $ref: '#/components/schemas/Retention' },
2416
+ contentHash: { type: 'string' },
2417
+ },
2418
+ };
2419
+ export const SupersedeFactResultSchema = {
2420
+ type: 'object',
2421
+ additionalProperties: false,
2422
+ required: ['factId', 'superseded'],
2423
+ properties: {
2424
+ factId: { type: 'string' },
2425
+ superseded: { type: 'boolean', const: true },
2426
+ },
2427
+ };
2428
+ export const RetrieveIntentSchema = {
2429
+ description: 'Retrieval intent — mirrors `RetrievalIntent` from `@kindgi/agents`, widened for direct-HTTP use. `mode: "list"` returns a plain scoped list (no query). `mode: "keyword"` runs full-text search. `mode: "semantic"` runs vector similarity search — requires an embedding provider bound on the deployment; if unavailable, the route returns `400 bad-input`. `mode: "both"` unions keyword + semantic results, dedup by fact id.',
2430
+ type: 'object',
2431
+ additionalProperties: false,
2432
+ required: ['mode'],
2433
+ properties: {
2434
+ mode: { type: 'string', enum: ['list', 'keyword', 'semantic', 'both'] },
2435
+ query: {
2436
+ type: 'string',
2437
+ description: 'Required for `keyword` / `semantic` / `both`; ignored for `list`.',
2438
+ },
2439
+ type: { type: 'string', minLength: 1 },
2440
+ scope: { $ref: '#/components/schemas/FactScope' },
2441
+ limit: { type: 'integer', minimum: 1 },
2442
+ embeddingModel: { type: 'string' },
2443
+ },
2444
+ };
2445
+ export const RetrieveMemoryBodySchema = RetrieveIntentSchema;
2446
+ export const RetrievalHitSchema = {
2447
+ type: 'object',
2448
+ additionalProperties: false,
2449
+ required: ['fact'],
2450
+ properties: {
2451
+ fact: { $ref: '#/components/schemas/Fact' },
2452
+ score: {
2453
+ type: 'number',
2454
+ description: 'Relevance score. Keyword mode returns an implementation-defined rank (higher = better). Semantic mode returns cosine similarity in [-1, 1] (higher = better). Absent for `list` mode.',
2455
+ },
2456
+ },
2457
+ };
2458
+ export const RetrieveMemoryResultSchema = {
2459
+ type: 'object',
2460
+ additionalProperties: false,
2461
+ required: ['results'],
2462
+ properties: {
2463
+ results: { type: 'array', items: { $ref: '#/components/schemas/RetrievalHit' } },
2464
+ },
2465
+ };
2466
+ export const RevokeTokenResultSchema = {
2467
+ type: 'object',
2468
+ additionalProperties: false,
2469
+ required: ['tokenId', 'revoked'],
2470
+ properties: {
2471
+ tokenId: { type: 'string', format: 'uuid' },
2472
+ revoked: { type: 'boolean', const: true },
2473
+ },
2474
+ };
2475
+ // ---------------- signing keys (the deployment trust list) ----------------
2476
+ export const TrustedSigningKeySchema = {
2477
+ type: 'object',
2478
+ additionalProperties: false,
2479
+ required: ['keyId', 'tenantId', 'algorithm', 'publicKey', 'createdAt'],
2480
+ description: 'A public key the tenant trusts to sign deployments (`POST /v1/deployments`). A revoked key stays readable, with `revokedAt`, so the deployments it signed can be audited; it verifies no new ones.',
2481
+ properties: {
2482
+ keyId: { type: 'string', description: 'The signer key id a deployment envelope names.' },
2483
+ tenantId: { type: 'string', format: 'uuid' },
1895
2484
  algorithm: { type: 'string', enum: ['ed25519'] },
1896
2485
  publicKey: {
1897
2486
  type: 'string',
@@ -2663,6 +3252,13 @@ export const ProviderMetadataSchema = {
2663
3252
  type: 'boolean',
2664
3253
  description: "A fallback serves a capability only when no other provider satisfies it (e.g. `kindgi dev`'s scripted `dev-echo`); an agent turn routed to one carries a `fallback-provider` warning. Absent = `false`.",
2665
3254
  },
3255
+ labels: {
3256
+ type: 'object',
3257
+ maxProperties: 32,
3258
+ propertyNames: { pattern: '^[a-z0-9]([a-z0-9._/-]{0,61}[a-z0-9])?$' },
3259
+ additionalProperties: { type: 'string', maxLength: 256 },
3260
+ description: 'Bookkeeping, such as who manages the provider; the router ignores labels. At most 32 keys; a key is 1-63 lowercase letters and digits, with `.`, `-`, `_` or `/` inside; a value is at most 256 characters. The convention key `kindgi.com/managed-by` names the manager (`kindgi-dev`, `kindgi-deploy:<environment>`). Out of bounds: `400 invalid-provider`, reason `invalid-labels`.',
3261
+ },
2666
3262
  },
2667
3263
  };
2668
3264
  export const ProviderCollectionPageSchema = {
@@ -3194,6 +3790,16 @@ export const CostAggregateResultSchema = {
3194
3790
  groups: {
3195
3791
  type: 'array',
3196
3792
  items: { $ref: '#/components/schemas/CostAggregateGroup' },
3793
+ description: 'The most expensive groups first (`totalUsd` descending, ties by key), at most `limit`.',
3794
+ },
3795
+ totalGroups: {
3796
+ type: 'integer',
3797
+ minimum: 0,
3798
+ description: 'How many groups there were before the `limit` cap. Absent from a runtime before 0.1.5.',
3799
+ },
3800
+ truncated: {
3801
+ type: 'boolean',
3802
+ description: '`true` when there were more groups than `limit`: `groups` holds the most expensive ones, and `totalUsd` / `totalRecords` / `tokens` still cover every record. Absent from a runtime before 0.1.5.',
3197
3803
  },
3198
3804
  totalUsd: { type: 'number', minimum: 0 },
3199
3805
  totalRecords: { type: 'integer', minimum: 0 },
@@ -3455,7 +4061,7 @@ export const ReinstatePolicyVersionResultSchema = {
3455
4061
  */
3456
4062
  export const EvalKindSchema = {
3457
4063
  type: 'string',
3458
- enum: ['accuracy', 'pairwise', 'regression', 'human-review', 'benchmark', 'custom'],
4064
+ enum: ['accuracy', 'pairwise', 'regression', 'human-review', 'benchmark', 'custom', 'judged'],
3459
4065
  };
3460
4066
  /**
3461
4067
  * Wire shape for a single evaluation suite. `spec` is a JSON object
@@ -3469,80 +4075,196 @@ export const EvalKindSchema = {
3469
4075
  export const EvalSuiteSchema = {
3470
4076
  type: 'object',
3471
4077
  additionalProperties: false,
3472
- required: ['id', 'tenantId', 'version', 'kind', 'spec'],
4078
+ required: ['id', 'tenantId', 'version', 'kind', 'spec'],
4079
+ properties: {
4080
+ id: { type: 'string', minLength: 1 },
4081
+ tenantId: { type: 'string', format: 'uuid' },
4082
+ version: {
4083
+ type: 'string',
4084
+ pattern: '^\\d+\\.\\d+\\.\\d+$',
4085
+ description: 'Semver — publishing a modified suite produces a new version.',
4086
+ },
4087
+ kind: { $ref: '#/components/schemas/EvalKind' },
4088
+ description: { type: 'string' },
4089
+ spec: {
4090
+ type: 'object',
4091
+ additionalProperties: true,
4092
+ description: 'Kind-specific suite body. For `accuracy`, typically `{ cases: [{ input, expectedOutput }], grader?: { adapterId, config? } }`. For `pairwise`, typically `{ prompts, variantA, variantB }`. For `regression`, typically `{ baseline, cases }`. For `human-review`, typically `{ rubric, reviewerRole }`. For `benchmark`, typically `{ benchmark: { name, version } }`. For `custom`, typically `{ handler: { modulePath, entrypointPath }, cases }`.',
4093
+ },
4094
+ },
4095
+ };
4096
+ export const EvalSuiteCollectionPageSchema = {
4097
+ type: 'object',
4098
+ additionalProperties: false,
4099
+ required: ['data', 'hasMore'],
4100
+ properties: {
4101
+ data: {
4102
+ type: 'array',
4103
+ items: { $ref: '#/components/schemas/EvalSuite' },
4104
+ },
4105
+ nextCursor: { type: 'string' },
4106
+ hasMore: { type: 'boolean' },
4107
+ },
4108
+ };
4109
+ export const PublishEvalSuiteBodySchema = {
4110
+ type: 'object',
4111
+ additionalProperties: false,
4112
+ required: ['id', 'version', 'kind', 'spec', 'projectId'],
4113
+ properties: {
4114
+ id: { type: 'string', minLength: 1 },
4115
+ projectId: ContentProjectIdProperty,
4116
+ tenantId: {
4117
+ type: 'string',
4118
+ format: 'uuid',
4119
+ description: 'Optional. When present, must match the caller tenant (server-derived from the token). Cross-tenant publish is rejected.',
4120
+ },
4121
+ version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
4122
+ kind: { $ref: '#/components/schemas/EvalKind' },
4123
+ description: { type: 'string' },
4124
+ spec: { type: 'object', additionalProperties: true },
4125
+ },
4126
+ };
4127
+ export const PublishEvalSuiteResultSchema = {
4128
+ type: 'object',
4129
+ additionalProperties: false,
4130
+ required: ['suiteId', 'version'],
4131
+ properties: {
4132
+ suiteId: { type: 'string' },
4133
+ version: { type: 'string' },
4134
+ },
4135
+ };
4136
+ export const UnregisterEvalSuiteResultSchema = {
4137
+ type: 'object',
4138
+ additionalProperties: false,
4139
+ required: ['suiteId', 'version', 'unregistered'],
4140
+ properties: {
4141
+ suiteId: { type: 'string' },
4142
+ version: { type: 'string' },
4143
+ unregistered: { type: 'boolean', const: true },
4144
+ },
4145
+ };
4146
+ export const ReinstateEvalSuiteVersionResultSchema = {
4147
+ type: 'object',
4148
+ additionalProperties: false,
4149
+ required: ['suiteId', 'version', 'wasTombstoned'],
4150
+ properties: {
4151
+ suiteId: { type: 'string' },
4152
+ version: { type: 'string' },
4153
+ wasTombstoned: { type: 'boolean' },
4154
+ },
4155
+ };
4156
+ // ---------------- data blocks ----------------
4157
+ export const BlockKindSchema = {
4158
+ type: 'string',
4159
+ enum: ['prompt', 'settings'],
4160
+ description: '`prompt`: a Liquid template an agent renders as its instructions. `settings`: a JSON object tools and templates read.',
4161
+ };
4162
+ export const PromptBlockContentSchema = {
4163
+ type: 'object',
4164
+ additionalProperties: false,
4165
+ required: ['template'],
4166
+ properties: {
4167
+ template: {
4168
+ type: 'string',
4169
+ minLength: 1,
4170
+ description: "Liquid, rendered as an agent's instructions are (same parameters and auto-injected variables).",
4171
+ },
4172
+ parameters: { type: 'array', items: { $ref: '#/components/schemas/PromptParameter' } },
4173
+ },
4174
+ };
4175
+ export const SettingsBlockContentSchema = {
4176
+ type: 'object',
4177
+ additionalProperties: false,
4178
+ required: ['values'],
3473
4179
  properties: {
3474
- id: { type: 'string', minLength: 1 },
3475
- tenantId: { type: 'string', format: 'uuid' },
3476
- version: {
3477
- type: 'string',
3478
- pattern: '^\\d+\\.\\d+\\.\\d+$',
3479
- description: 'Semver — publishing a modified suite produces a new version.',
4180
+ values: {
4181
+ type: 'object',
4182
+ additionalProperties: true,
4183
+ description: 'What tools read (`ToolContext.settings[<block id>]`) and templates read (`settings.<block id>.<key>`).',
3480
4184
  },
3481
- kind: { $ref: '#/components/schemas/EvalKind' },
3482
- description: { type: 'string' },
3483
- spec: {
4185
+ schema: {
3484
4186
  type: 'object',
3485
4187
  additionalProperties: true,
3486
- description: 'Kind-specific suite body. For `accuracy`, typically `{ cases: [{ input, expectedOutput }], grader?: { adapterId, config? } }`. For `pairwise`, typically `{ prompts, variantA, variantB }`. For `regression`, typically `{ baseline, cases }`. For `human-review`, typically `{ rubric, reviewerRole }`. For `benchmark`, typically `{ benchmark: { name, version } }`. For `custom`, typically `{ handler: { modulePath, entrypointPath }, cases }`.',
4188
+ description: "JSON Schema (draft 2020-12) the values must satisfy. A later version's values must satisfy the latest version's schema too.",
3487
4189
  },
3488
4190
  },
3489
4191
  };
3490
- export const EvalSuiteCollectionPageSchema = {
4192
+ export const BlockSchema = {
4193
+ description: 'A data block version: a prompt or settings, versioned like a tool (immutable versions, soft unregister). An agent version pins the block versions it uses when it is published. Belongs to one project and is authorized through it.',
3491
4194
  type: 'object',
3492
4195
  additionalProperties: false,
3493
- required: ['data', 'hasMore'],
4196
+ required: ['id', 'version', 'kind', 'content', 'projectId', 'publishedAt'],
3494
4197
  properties: {
3495
- data: {
3496
- type: 'array',
3497
- items: { $ref: '#/components/schemas/EvalSuite' },
4198
+ id: { type: 'string', description: 'Dotted lowercase id (e.g. `acme.intake-prompt`).' },
4199
+ version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
4200
+ kind: { $ref: '#/components/schemas/BlockKind' },
4201
+ description: { type: 'string' },
4202
+ content: {
4203
+ oneOf: [
4204
+ { $ref: '#/components/schemas/PromptBlockContent' },
4205
+ { $ref: '#/components/schemas/SettingsBlockContent' },
4206
+ ],
4207
+ description: '`PromptBlockContent` for a prompt, `SettingsBlockContent` for settings.',
4208
+ },
4209
+ projectId: { type: 'string', format: 'uuid' },
4210
+ publishedAt: { type: 'string', format: 'date-time' },
4211
+ unregisteredAt: {
4212
+ type: 'string',
4213
+ format: 'date-time',
4214
+ description: 'Present only on an unregistered version; agent versions that pin it still read it.',
3498
4215
  },
4216
+ },
4217
+ };
4218
+ export const BlockCollectionPageSchema = {
4219
+ type: 'object',
4220
+ additionalProperties: false,
4221
+ required: ['data', 'hasMore'],
4222
+ properties: {
4223
+ data: { type: 'array', items: { $ref: '#/components/schemas/Block' } },
3499
4224
  nextCursor: { type: 'string' },
3500
4225
  hasMore: { type: 'boolean' },
3501
4226
  },
3502
4227
  };
3503
- export const PublishEvalSuiteBodySchema = {
4228
+ export const PublishBlockBodySchema = {
3504
4229
  type: 'object',
3505
4230
  additionalProperties: false,
3506
- required: ['id', 'version', 'kind', 'spec', 'projectId'],
4231
+ required: ['projectId', 'id', 'version', 'kind', 'content'],
3507
4232
  properties: {
3508
- id: { type: 'string', minLength: 1 },
3509
4233
  projectId: ContentProjectIdProperty,
3510
- tenantId: {
3511
- type: 'string',
3512
- format: 'uuid',
3513
- description: 'Optional. When present, must match the caller tenant (server-derived from the token). Cross-tenant publish is rejected.',
3514
- },
4234
+ id: { type: 'string', minLength: 1 },
3515
4235
  version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
3516
- kind: { $ref: '#/components/schemas/EvalKind' },
4236
+ kind: { $ref: '#/components/schemas/BlockKind' },
3517
4237
  description: { type: 'string' },
3518
- spec: { type: 'object', additionalProperties: true },
4238
+ content: {
4239
+ oneOf: [
4240
+ { $ref: '#/components/schemas/PromptBlockContent' },
4241
+ { $ref: '#/components/schemas/SettingsBlockContent' },
4242
+ ],
4243
+ },
3519
4244
  },
3520
4245
  };
3521
- export const PublishEvalSuiteResultSchema = {
4246
+ export const PublishBlockResultSchema = {
3522
4247
  type: 'object',
3523
4248
  additionalProperties: false,
3524
- required: ['suiteId', 'version'],
3525
- properties: {
3526
- suiteId: { type: 'string' },
3527
- version: { type: 'string' },
3528
- },
4249
+ required: ['blockId', 'version'],
4250
+ properties: { blockId: { type: 'string' }, version: { type: 'string' } },
3529
4251
  };
3530
- export const UnregisterEvalSuiteResultSchema = {
4252
+ export const UnregisterBlockResultSchema = {
3531
4253
  type: 'object',
3532
4254
  additionalProperties: false,
3533
- required: ['suiteId', 'version', 'unregistered'],
4255
+ required: ['blockId', 'version', 'unregistered'],
3534
4256
  properties: {
3535
- suiteId: { type: 'string' },
4257
+ blockId: { type: 'string' },
3536
4258
  version: { type: 'string' },
3537
4259
  unregistered: { type: 'boolean', const: true },
3538
4260
  },
3539
4261
  };
3540
- export const ReinstateEvalSuiteVersionResultSchema = {
4262
+ export const ReinstateBlockResultSchema = {
3541
4263
  type: 'object',
3542
4264
  additionalProperties: false,
3543
- required: ['suiteId', 'version', 'wasTombstoned'],
4265
+ required: ['blockId', 'version', 'wasTombstoned'],
3544
4266
  properties: {
3545
- suiteId: { type: 'string' },
4267
+ blockId: { type: 'string' },
3546
4268
  version: { type: 'string' },
3547
4269
  wasTombstoned: { type: 'boolean' },
3548
4270
  },
@@ -3575,6 +4297,368 @@ export const EvalRunFlowRefSchema = {
3575
4297
  version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
3576
4298
  },
3577
4299
  };
4300
+ export const EvalBaselineSchema = {
4301
+ description: "What a comparison compares the candidate against: `'recorded'` (each case's recorded output, what was judged), a version (`{ agentId, version }`, replayed under the same rules), or the version live in a scope (`{ live: { projectId?, segments? } }`). Only `'recorded'` runs today; the others are refused when the run starts.",
4302
+ oneOf: [
4303
+ { type: 'string', enum: ['recorded'] },
4304
+ {
4305
+ type: 'object',
4306
+ additionalProperties: false,
4307
+ required: ['agentId', 'version'],
4308
+ properties: { agentId: { type: 'string' }, version: { type: 'string' } },
4309
+ },
4310
+ {
4311
+ type: 'object',
4312
+ additionalProperties: false,
4313
+ required: ['live'],
4314
+ properties: {
4315
+ live: {
4316
+ type: 'object',
4317
+ additionalProperties: false,
4318
+ properties: {
4319
+ projectId: { type: 'string' },
4320
+ segments: { type: 'object', additionalProperties: { type: 'string' } },
4321
+ },
4322
+ },
4323
+ },
4324
+ },
4325
+ ],
4326
+ };
4327
+ export const EvalComparisonSchema = {
4328
+ type: 'object',
4329
+ additionalProperties: false,
4330
+ required: ['baseline', 'reads', 'repetitions', 'k'],
4331
+ description: "A comparison eval run's settings (a `judged` suite).",
4332
+ properties: {
4333
+ baseline: { $ref: '#/components/schemas/EvalBaseline' },
4334
+ reads: {
4335
+ type: 'string',
4336
+ enum: ['recorded', 'live'],
4337
+ description: "Whether replayed reads use the past run's results when it has them (`recorded`), or run live.",
4338
+ },
4339
+ repetitions: { type: 'integer', minimum: 1, maximum: 10 },
4340
+ k: { type: 'integer', minimum: 1, maximum: 100 },
4341
+ versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
4342
+ },
4343
+ };
4344
+ // ---------------- comparison results (a `judged` eval run's `result`) ----------------
4345
+ const nullableNumber = { type: ['number', 'null'] };
4346
+ export const ComparisonMetricSchema = {
4347
+ description: "One metric, the recorded runs beside the candidate. `null` where a side had no judged evidence; `n` / `weight` are the candidate's evidence (cases with judged items, and the judgment weight behind them), `baselineN` / `baselineWeight` the recorded side's.",
4348
+ type: 'object',
4349
+ additionalProperties: false,
4350
+ required: [
4351
+ 'baseline',
4352
+ 'candidate',
4353
+ 'delta',
4354
+ 'n',
4355
+ 'weight',
4356
+ 'baselineN',
4357
+ 'baselineWeight',
4358
+ 'direction',
4359
+ ],
4360
+ properties: {
4361
+ baseline: nullableNumber,
4362
+ candidate: nullableNumber,
4363
+ delta: nullableNumber,
4364
+ n: { type: 'integer', minimum: 0 },
4365
+ weight: { type: 'number', minimum: 0 },
4366
+ baselineN: { type: 'integer', minimum: 0 },
4367
+ baselineWeight: { type: 'number', minimum: 0 },
4368
+ direction: { type: 'string', enum: ['higher'] },
4369
+ k: {
4370
+ type: 'integer',
4371
+ minimum: 1,
4372
+ description: '`weightedPrecisionAtK`: the ranked items it looked at.',
4373
+ },
4374
+ spread: {
4375
+ type: 'number',
4376
+ description: "With more than one repetition: the candidate's max − min across them.",
4377
+ },
4378
+ },
4379
+ };
4380
+ export const ComparisonCandidateSchema = {
4381
+ description: 'What ran on the cases: an agent version, or a flow version (with any versions it swapped in).',
4382
+ oneOf: [
4383
+ {
4384
+ type: 'object',
4385
+ additionalProperties: false,
4386
+ required: ['kind', 'agentId', 'version'],
4387
+ properties: {
4388
+ kind: { type: 'string', enum: ['agent'] },
4389
+ agentId: { type: 'string' },
4390
+ version: { type: 'string' },
4391
+ },
4392
+ },
4393
+ {
4394
+ type: 'object',
4395
+ additionalProperties: false,
4396
+ required: ['kind', 'flowId', 'version'],
4397
+ properties: {
4398
+ kind: { type: 'string', enum: ['flow'] },
4399
+ flowId: { type: 'string' },
4400
+ version: { type: 'string' },
4401
+ versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
4402
+ },
4403
+ },
4404
+ ],
4405
+ };
4406
+ export const JudgedComparisonSummarySchema = {
4407
+ description: 'What a comparison concluded: the candidate beside the recorded runs, the case counts, and the metrics. What a promotion gate reads.',
4408
+ type: 'object',
4409
+ additionalProperties: false,
4410
+ required: [
4411
+ 'evalRunId',
4412
+ 'status',
4413
+ 'completedAt',
4414
+ 'suite',
4415
+ 'candidate',
4416
+ 'baseline',
4417
+ 'scope',
4418
+ 'cases',
4419
+ 'diverged',
4420
+ 'refusedWrites',
4421
+ 'errors',
4422
+ 'stopped',
4423
+ 'reads',
4424
+ 'sampling',
4425
+ 'repetitions',
4426
+ 'metrics',
4427
+ ],
4428
+ properties: {
4429
+ evalRunId: { type: 'string' },
4430
+ status: { type: 'string', enum: ['completed', 'partial', 'failed'] },
4431
+ completedAt: { type: 'string', format: 'date-time' },
4432
+ suite: {
4433
+ type: 'object',
4434
+ additionalProperties: false,
4435
+ required: ['id', 'version'],
4436
+ properties: { id: { type: 'string' }, version: { type: 'string' } },
4437
+ },
4438
+ candidate: { $ref: '#/components/schemas/ComparisonCandidate' },
4439
+ baseline: {
4440
+ description: "What the candidate was compared with: `recorded` (the test set's recorded runs, with the versions that served them), or another version.",
4441
+ oneOf: [
4442
+ {
4443
+ type: 'object',
4444
+ additionalProperties: false,
4445
+ required: ['kind', 'versions'],
4446
+ properties: {
4447
+ kind: { type: 'string', enum: ['recorded'] },
4448
+ versions: {
4449
+ type: 'array',
4450
+ items: {
4451
+ type: 'object',
4452
+ additionalProperties: false,
4453
+ required: ['version', 'cases'],
4454
+ properties: {
4455
+ agentId: { type: 'string' },
4456
+ flowId: { type: 'string' },
4457
+ version: { type: 'string' },
4458
+ cases: { type: 'integer', minimum: 0 },
4459
+ },
4460
+ },
4461
+ },
4462
+ },
4463
+ },
4464
+ {
4465
+ type: 'object',
4466
+ additionalProperties: false,
4467
+ required: ['kind', 'agentId', 'version', 'via'],
4468
+ properties: {
4469
+ kind: { type: 'string', enum: ['version'] },
4470
+ agentId: { type: 'string' },
4471
+ version: { type: 'string' },
4472
+ via: { type: 'string', enum: ['explicit', 'live'] },
4473
+ liveScope: { type: 'object', additionalProperties: true },
4474
+ },
4475
+ },
4476
+ ],
4477
+ },
4478
+ scope: {
4479
+ type: 'object',
4480
+ additionalProperties: false,
4481
+ description: "Where the test set's judgments came from.",
4482
+ properties: { projectId: { type: 'string' } },
4483
+ },
4484
+ cases: { type: 'integer', minimum: 0 },
4485
+ diverged: {
4486
+ type: 'integer',
4487
+ minimum: 0,
4488
+ description: "Cases where a read with no recording ran live under `reads: 'recorded'`.",
4489
+ },
4490
+ refusedWrites: {
4491
+ type: 'integer',
4492
+ minimum: 0,
4493
+ description: 'Tool calls refused across the cases (what the candidate would have done).',
4494
+ },
4495
+ errors: { type: 'integer', minimum: 0, description: 'Cases none of whose repetitions ran.' },
4496
+ stopped: {
4497
+ type: 'integer',
4498
+ minimum: 0,
4499
+ description: "Flow cases that stopped at a write the replay refused: no output to score, so they're left out of the metrics.",
4500
+ },
4501
+ reads: { type: 'string', enum: ['recorded', 'live'] },
4502
+ sampling: {
4503
+ type: 'object',
4504
+ additionalProperties: false,
4505
+ required: ['models'],
4506
+ properties: {
4507
+ models: {
4508
+ type: 'array',
4509
+ description: "The models that answered the candidate's replays, and how many replays each.",
4510
+ items: {
4511
+ type: 'object',
4512
+ additionalProperties: false,
4513
+ required: ['providerId', 'model', 'runs'],
4514
+ properties: {
4515
+ providerId: { type: 'string' },
4516
+ model: { type: 'string' },
4517
+ runs: { type: 'integer', minimum: 0 },
4518
+ },
4519
+ },
4520
+ },
4521
+ },
4522
+ },
4523
+ repetitions: { type: 'integer', minimum: 1 },
4524
+ metrics: {
4525
+ type: 'object',
4526
+ additionalProperties: false,
4527
+ required: ['weightedYesShare', 'judgedCoverage', 'weightedPrecisionAtK'],
4528
+ properties: {
4529
+ weightedYesShare: { $ref: '#/components/schemas/ComparisonMetric' },
4530
+ judgedCoverage: { $ref: '#/components/schemas/ComparisonMetric' },
4531
+ weightedPrecisionAtK: { $ref: '#/components/schemas/ComparisonMetric' },
4532
+ },
4533
+ },
4534
+ },
4535
+ };
4536
+ const outputScore = {
4537
+ type: 'object',
4538
+ additionalProperties: false,
4539
+ required: ['yesWeight', 'totalWeight', 'items', 'judgedItems', 'topK'],
4540
+ description: "An output's score: Σ yesWeight and Σ totalWeight over its judged items, and over those among the first `k` ranked items.",
4541
+ properties: {
4542
+ yesWeight: { type: 'number' },
4543
+ totalWeight: { type: 'number' },
4544
+ items: { type: 'integer', minimum: 0 },
4545
+ judgedItems: { type: 'integer', minimum: 0 },
4546
+ topK: {
4547
+ type: 'object',
4548
+ additionalProperties: false,
4549
+ required: ['yesWeight', 'totalWeight'],
4550
+ properties: { yesWeight: { type: 'number' }, totalWeight: { type: 'number' } },
4551
+ },
4552
+ },
4553
+ };
4554
+ export const ComparisonCaseResultSchema = {
4555
+ description: "One case of a comparison: its replay runs, the scores, the items kept, dropped and new, the tool calls, and why it didn't run when it didn't.",
4556
+ type: 'object',
4557
+ additionalProperties: false,
4558
+ required: [
4559
+ 'caseId',
4560
+ 'runIds',
4561
+ 'baseline',
4562
+ 'candidate',
4563
+ 'diverged',
4564
+ 'refusedWrites',
4565
+ 'noContext',
4566
+ 'approvalSkipped',
4567
+ ],
4568
+ properties: {
4569
+ caseId: { type: 'string' },
4570
+ runIds: {
4571
+ type: 'array',
4572
+ items: { type: 'string' },
4573
+ description: "The candidate's replay runs, one per repetition.",
4574
+ },
4575
+ baseline: outputScore,
4576
+ candidate: { type: 'array', items: outputScore, description: 'One per repetition that ran.' },
4577
+ changes: {
4578
+ type: 'object',
4579
+ additionalProperties: false,
4580
+ required: ['kept', 'dropped', 'new'],
4581
+ description: "The first repetition's items against the judged ones.",
4582
+ properties: {
4583
+ kept: {
4584
+ type: 'array',
4585
+ items: {
4586
+ type: 'object',
4587
+ additionalProperties: false,
4588
+ required: ['key'],
4589
+ properties: {
4590
+ key: { type: 'string' },
4591
+ rankBefore: { type: 'integer' },
4592
+ rank: { type: 'integer' },
4593
+ },
4594
+ },
4595
+ },
4596
+ dropped: {
4597
+ type: 'array',
4598
+ items: {
4599
+ type: 'object',
4600
+ additionalProperties: false,
4601
+ required: ['key'],
4602
+ properties: { key: { type: 'string' }, rankBefore: { type: 'integer' } },
4603
+ },
4604
+ },
4605
+ new: {
4606
+ type: 'array',
4607
+ items: {
4608
+ type: 'object',
4609
+ additionalProperties: false,
4610
+ required: ['key', 'pointer'],
4611
+ properties: {
4612
+ key: { type: 'string' },
4613
+ pointer: { type: 'string' },
4614
+ rank: { type: 'integer' },
4615
+ },
4616
+ },
4617
+ },
4618
+ },
4619
+ },
4620
+ tools: {
4621
+ type: 'array',
4622
+ description: "The first repetition's tool calls, and what happened to each.",
4623
+ items: {
4624
+ type: 'object',
4625
+ additionalProperties: false,
4626
+ required: ['step', 'callId', 'toolId', 'toolVersion', 'arguments', 'source'],
4627
+ properties: {
4628
+ step: { type: 'integer', minimum: 0 },
4629
+ callId: { type: 'string' },
4630
+ toolId: { type: 'string' },
4631
+ toolVersion: { type: 'string' },
4632
+ arguments: {},
4633
+ source: { type: 'string', enum: ['live', 'recorded', 'refused'] },
4634
+ reason: { type: 'string' },
4635
+ },
4636
+ },
4637
+ },
4638
+ diverged: { type: 'boolean' },
4639
+ refusedWrites: { type: 'integer', minimum: 0 },
4640
+ noContext: { type: 'boolean' },
4641
+ approvalSkipped: { type: 'boolean' },
4642
+ error: { type: 'string' },
4643
+ stopped: {
4644
+ type: 'object',
4645
+ additionalProperties: false,
4646
+ required: ['toolId', 'arguments'],
4647
+ description: 'Set when the replay stopped at a refused write: what it would have done.',
4648
+ properties: { toolId: { type: 'string' }, arguments: {}, reason: { type: 'string' } },
4649
+ },
4650
+ },
4651
+ };
4652
+ export const JudgedComparisonResultSchema = {
4653
+ description: "A comparison's `result` (a `judged` eval run's): the summary and each case. `EvalRun.result` stays an open object, since each kind has its own; the clients read it as this (TS `comparisonOf(run)`, Python `comparison_of(run)`).",
4654
+ type: 'object',
4655
+ additionalProperties: false,
4656
+ required: ['summary', 'perCase'],
4657
+ properties: {
4658
+ summary: { $ref: '#/components/schemas/JudgedComparisonSummary' },
4659
+ perCase: { type: 'array', items: { $ref: '#/components/schemas/ComparisonCaseResult' } },
4660
+ },
4661
+ };
3578
4662
  export const EvalRunSchema = {
3579
4663
  type: 'object',
3580
4664
  additionalProperties: false,
@@ -3603,10 +4687,11 @@ export const EvalRunSchema = {
3603
4687
  result: {
3604
4688
  type: 'object',
3605
4689
  additionalProperties: true,
3606
- description: 'Kind-specific opaque JSON. For `accuracy`, contains `{ passCount, totalCount, meanScore, perCase[] }`. Other kinds define their own shapes as their dispatchers ship.',
4690
+ description: 'Kind-specific opaque JSON. For `accuracy`, contains `{ passCount, totalCount, meanScore, perCase[] }`. For `judged` (a comparison), `{ summary, perCase[] }`: the summary has the baseline (the versions behind the recorded runs) and the candidate (`{ kind: "agent", agentId, version }` or `{ kind: "flow", flowId, version, versions? }`), the case counts (`cases`, `diverged`, `refusedWrites`, `errors`, and `stopped`: flow cases that stopped at a write the replay refused, left out of the metrics), the models that answered, and `metrics` (`weightedYesShare`, `judgedCoverage`, `weightedPrecisionAtK`, each `{ baseline, candidate, delta, n, weight, baselineN, baselineWeight, direction, k?, spread? }`); each case has its replay runs, the scores, the items kept, dropped and new, the tool calls with what happened to each, and `stopped` (what it would have done) when it stopped. Other kinds define their own shapes as their dispatchers ship.',
3607
4691
  },
3608
4692
  error: { type: 'string' },
3609
4693
  correlationId: { type: 'string' },
4694
+ comparison: { $ref: '#/components/schemas/EvalComparison' },
3610
4695
  },
3611
4696
  };
3612
4697
  export const EvalRunCollectionPageSchema = {
@@ -3629,8 +4714,13 @@ export const StartEvalRunBodySchema = {
3629
4714
  flowRef: { $ref: '#/components/schemas/EvalRunFlowRef' },
3630
4715
  dryRun: { type: 'boolean' },
3631
4716
  correlationId: { type: 'string' },
4717
+ baseline: { $ref: '#/components/schemas/EvalBaseline' },
4718
+ reads: { type: 'string', enum: ['recorded', 'live'] },
4719
+ repetitions: { type: 'integer', minimum: 1, maximum: 10 },
4720
+ k: { type: 'integer', minimum: 1, maximum: 100 },
4721
+ versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
3632
4722
  },
3633
- description: 'Exactly one of `agentRef` or `flowRef` MUST be supplied. `dryRun: true` returns a plan preview without invoking the subject.',
4723
+ description: "Exactly one of `agentRef` or `flowRef` MUST be supplied. `dryRun: true` returns a plan preview without invoking the subject. For a `judged` suite (a test set), the run is a comparison: `agentRef` or `flowRef` with its `version` is the candidate, replayed on each case without doing anything the past run didn't (a flow stops at a write the replay refuses); `baseline` (default `'recorded'`), `reads` (default `recorded`), `repetitions` (default 1) and `k` (default 10) set how. With `flowRef`, `versions` runs the flow with some of its agents or tools at other versions; an id the flow doesn't use, or a version that isn't published, is refused (`400 validation-failed`, each under `details.issues`).",
3634
4724
  };
3635
4725
  export const StartEvalRunResultSchema = {
3636
4726
  type: 'object',
@@ -3883,6 +4973,45 @@ const DeployedPrimitiveSchema = {
3883
4973
  version: { type: 'string', description: 'Absent for guardrails, which have no version.' },
3884
4974
  },
3885
4975
  };
4976
+ const DeployedVersionSchema = {
4977
+ type: 'object',
4978
+ additionalProperties: false,
4979
+ required: ['id', 'version'],
4980
+ properties: {
4981
+ id: { type: 'string' },
4982
+ version: { type: 'string', description: 'The version the agent is registered as.' },
4983
+ authoredVersion: {
4984
+ type: 'string',
4985
+ description: "The version the agent's or flow's definition names, present when it differs from `version`: that version was registered already with other pins or content, and versions never change, so the deploy registered the next free version in its line (or an earlier deploy did).",
4986
+ },
4987
+ reason: {
4988
+ type: 'string',
4989
+ enum: ['pins-changed', 'unpinned', 'version-taken'],
4990
+ description: 'Why `version` differs from `authoredVersion`: `pins-changed` (a tool or agent it uses has a new version), `unpinned` (`authoredVersion` was published before pins existed), `version-taken` (`authoredVersion` is registered with other content).',
4991
+ },
4992
+ newVersion: {
4993
+ type: 'boolean',
4994
+ description: '`true`: this deploy registered `version`; `false`: an earlier deploy did.',
4995
+ },
4996
+ pinChanges: {
4997
+ type: 'array',
4998
+ description: "For `pins-changed`: the pins that differ from `authoredVersion`'s.",
4999
+ items: { $ref: '#/components/schemas/PinChange' },
5000
+ },
5001
+ },
5002
+ };
5003
+ export const PinChangeSchema = {
5004
+ description: 'One pin that differs between two versions of an agent or a flow.',
5005
+ type: 'object',
5006
+ additionalProperties: false,
5007
+ required: ['kind', 'id'],
5008
+ properties: {
5009
+ kind: { type: 'string', enum: ['tool', 'prompt', 'setting', 'agent'] },
5010
+ id: { type: 'string' },
5011
+ from: { type: 'string', description: "The earlier version's pin; absent when it had none." },
5012
+ to: { type: 'string', description: "The later version's pin; absent when it has none." },
5013
+ },
5014
+ };
3886
5015
  /**
3887
5016
  * Exactly what a deployment shipped. Versions are immutable, so this
3888
5017
  * says which code the deployment made live.
@@ -3894,8 +5023,8 @@ export const DeploymentContentsSchema = {
3894
5023
  properties: {
3895
5024
  tools: { type: 'array', items: DeployedPrimitiveSchema },
3896
5025
  guardrails: { type: 'array', items: DeployedPrimitiveSchema },
3897
- agents: { type: 'array', items: DeployedPrimitiveSchema },
3898
- flows: { type: 'array', items: DeployedPrimitiveSchema },
5026
+ agents: { type: 'array', items: DeployedVersionSchema },
5027
+ flows: { type: 'array', items: DeployedVersionSchema },
3899
5028
  },
3900
5029
  };
3901
5030
  /**
@@ -5708,6 +6837,27 @@ export const COMPONENT_SCHEMAS = [
5708
6837
  ['ObservationStatus', ObservationStatusSchema],
5709
6838
  ['Observation', ObservationSchema],
5710
6839
  ['ObservationCollectionPage', ObservationCollectionPageSchema],
6840
+ ['JudgeClassScope', JudgeClassScopeSchema],
6841
+ ['JudgeClass', JudgeClassSchema],
6842
+ ['JudgeClassCollectionPage', JudgeClassCollectionPageSchema],
6843
+ ['CreateJudgeClassBody', CreateJudgeClassBodySchema],
6844
+ ['UpdateJudgeClassBody', UpdateJudgeClassBodySchema],
6845
+ ['UnregisterJudgeClassResult', UnregisterJudgeClassResultSchema],
6846
+ ['JudgedSubject', JudgedSubjectSchema],
6847
+ ['JudgedItem', JudgedItemSchema],
6848
+ ['JudgmentAssertedBy', JudgmentAssertedBySchema],
6849
+ ['Judgment', JudgmentSchema],
6850
+ ['JudgedRunContext', JudgedRunContextSchema],
6851
+ ['JudgedRunCopy', JudgedRunCopySchema],
6852
+ ['JudgmentWithCopies', JudgmentWithCopiesSchema],
6853
+ ['JudgmentCollectionPage', JudgmentCollectionPageSchema],
6854
+ ['CreateJudgmentBody', CreateJudgmentBodySchema],
6855
+ ['UnregisterJudgmentResult', UnregisterJudgmentResultSchema],
6856
+ ['JudgedItemSummary', JudgedItemSummarySchema],
6857
+ ['JudgedEvalCase', JudgedEvalCaseSchema],
6858
+ ['JudgedEvalCaseCollectionPage', JudgedEvalCaseCollectionPageSchema],
6859
+ ['BuildJudgedSuiteBody', BuildJudgedSuiteBodySchema],
6860
+ ['BuildJudgedSuiteResult', BuildJudgedSuiteResultSchema],
5711
6861
  ['PromptParameter', PromptParameterSchema],
5712
6862
  ['RetrievalIntent', RetrievalIntentSchema],
5713
6863
  ['ConversationPolicy', ConversationPolicySchema],
@@ -5717,6 +6867,15 @@ export const COMPONENT_SCHEMAS = [
5717
6867
  ['AgentOutputSpec', AgentOutputSpecSchema],
5718
6868
  ['ToolErrorsSpec', ToolErrorsSpecSchema],
5719
6869
  ['Agent', AgentSchema],
6870
+ ['AgentPins', AgentPinsSchema],
6871
+ ['PromptRef', PromptRefSchema],
6872
+ ['BlockRef', BlockRefSchema],
6873
+ ['PinChange', PinChangeSchema],
6874
+ ['VersionDerivation', VersionDerivationSchema],
6875
+ ['DeriveAgentVersionBody', DeriveAgentVersionBodySchema],
6876
+ ['AgentPinSwaps', AgentPinSwapsSchema],
6877
+ ['FlowPins', FlowPinsSchema],
6878
+ ['FlowVersionOverrides', FlowVersionOverridesSchema],
5720
6879
  ['PublishAgentBody', PublishAgentBodySchema],
5721
6880
  ['PublishAgentResult', PublishAgentResultSchema],
5722
6881
  ['UnregisterAgentResult', UnregisterAgentResultSchema],
@@ -5866,9 +7025,25 @@ export const COMPONENT_SCHEMAS = [
5866
7025
  ['PublishEvalSuiteResult', PublishEvalSuiteResultSchema],
5867
7026
  ['UnregisterEvalSuiteResult', UnregisterEvalSuiteResultSchema],
5868
7027
  ['ReinstateEvalSuiteVersionResult', ReinstateEvalSuiteVersionResultSchema],
7028
+ ['BlockKind', BlockKindSchema],
7029
+ ['PromptBlockContent', PromptBlockContentSchema],
7030
+ ['SettingsBlockContent', SettingsBlockContentSchema],
7031
+ ['Block', BlockSchema],
7032
+ ['BlockCollectionPage', BlockCollectionPageSchema],
7033
+ ['PublishBlockBody', PublishBlockBodySchema],
7034
+ ['PublishBlockResult', PublishBlockResultSchema],
7035
+ ['UnregisterBlockResult', UnregisterBlockResultSchema],
7036
+ ['ReinstateBlockResult', ReinstateBlockResultSchema],
5869
7037
  ['EvalRunStatus', EvalRunStatusSchema],
5870
7038
  ['EvalRunAgentRef', EvalRunAgentRefSchema],
5871
7039
  ['EvalRunFlowRef', EvalRunFlowRefSchema],
7040
+ ['EvalBaseline', EvalBaselineSchema],
7041
+ ['EvalComparison', EvalComparisonSchema],
7042
+ ['ComparisonMetric', ComparisonMetricSchema],
7043
+ ['ComparisonCandidate', ComparisonCandidateSchema],
7044
+ ['JudgedComparisonSummary', JudgedComparisonSummarySchema],
7045
+ ['ComparisonCaseResult', ComparisonCaseResultSchema],
7046
+ ['JudgedComparisonResult', JudgedComparisonResultSchema],
5872
7047
  ['EvalRun', EvalRunSchema],
5873
7048
  ['EvalRunCollectionPage', EvalRunCollectionPageSchema],
5874
7049
  ['StartEvalRunBody', StartEvalRunBodySchema],