@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
@@ -84,6 +84,20 @@ const RunAgentIdQueryParam = {
84
84
  description: "Only this agent's turns, at any version. Turns that ran before Kindgi 0.1.3 don't name their agent and aren't matched.",
85
85
  schema: { type: 'string', minLength: 1 },
86
86
  };
87
+ const RunReplaysQueryParam = {
88
+ name: 'replays',
89
+ in: 'query',
90
+ required: false,
91
+ description: 'Replay runs (an eval run re-running a past run). `exclude` (default) leaves them out; `include` lists them with the other runs; `only` lists just them.',
92
+ schema: { type: 'string', enum: ['exclude', 'include', 'only'], default: 'exclude' },
93
+ };
94
+ const RunEvalRunIdQueryParam = {
95
+ name: 'evalRunId',
96
+ in: 'query',
97
+ required: false,
98
+ description: 'Only the replay runs of this eval run. Implies replays are included; cannot be combined with `replays=exclude`.',
99
+ schema: { type: 'string', minLength: 1 },
100
+ };
87
101
  const RunIncludeQueryParam = {
88
102
  name: 'include',
89
103
  in: 'query',
@@ -427,6 +441,13 @@ const CostGroupByQueryParam = {
427
441
  description: "Comma-separated list of dimensions to aggregate over. Each value must be one of `agentId | runId | category | providerId | day | month | tenant | conversationId | model | servedModel | projectId | orgId | rootRunId | flowId`. `model` is the model actually called; `servedModel` the exact version the vendor reported; `orgId` the org of the record's project. Duplicates collapse.",
428
442
  schema: { type: 'string' },
429
443
  };
444
+ const CostAggregateLimitQueryParam = {
445
+ name: 'limit',
446
+ in: 'query',
447
+ required: false,
448
+ description: 'The most groups to return: the most expensive ones (`groups` is ordered by `totalUsd`, highest first). 1 to 10000, default 1000. When there were more, `truncated` is `true` and `totalGroups` says how many; the totals still cover every record.',
449
+ schema: { type: 'integer', minimum: 1, maximum: 10000, default: 1000 },
450
+ };
430
451
  const CostModelQueryParam = {
431
452
  name: 'model',
432
453
  in: 'query',
@@ -611,7 +632,7 @@ const EvalSuiteKindFilterQueryParam = {
611
632
  name: 'kind',
612
633
  in: 'query',
613
634
  required: false,
614
- description: 'Filter to eval suites of a single kind. Values: `accuracy | pairwise | regression | human-review | benchmark | custom`.',
635
+ description: 'Filter to eval suites of a single kind. Values: `accuracy | pairwise | regression | human-review | benchmark | custom | judged`.',
615
636
  schema: { $ref: '#/components/schemas/EvalKind' },
616
637
  };
617
638
  const EvalSuiteNameFilterQueryParam = {
@@ -621,6 +642,34 @@ const EvalSuiteNameFilterQueryParam = {
621
642
  description: 'Prefix match on `EvalSuite.id`. Dotted namespaces are the natural filter shape.',
622
643
  schema: { type: 'string' },
623
644
  };
645
+ const BlockIdPathParam = {
646
+ name: 'blockId',
647
+ in: 'path',
648
+ required: true,
649
+ description: 'Block id: dotted lowercase (e.g. `acme.intake-prompt`).',
650
+ schema: { type: 'string', minLength: 1 },
651
+ };
652
+ const BlockVersionPathParam = {
653
+ name: 'version',
654
+ in: 'path',
655
+ required: true,
656
+ description: 'Exact block version (`major.minor.patch`).',
657
+ schema: { type: 'string', minLength: 1 },
658
+ };
659
+ const BlockKindFilterQueryParam = {
660
+ name: 'kind',
661
+ in: 'query',
662
+ required: false,
663
+ description: 'Only blocks of this kind: `prompt` or `settings`.',
664
+ schema: { $ref: '#/components/schemas/BlockKind' },
665
+ };
666
+ const BlockNameFilterQueryParam = {
667
+ name: 'name',
668
+ in: 'query',
669
+ required: false,
670
+ description: 'Prefix match on the block id.',
671
+ schema: { type: 'string' },
672
+ };
624
673
  // Admin plane — eval-run data plane.
625
674
  const EvalRunIdPathParam = {
626
675
  name: 'runId',
@@ -723,6 +772,55 @@ const SecretNamePathParam = {
723
772
  description: 'Secret name (opaque string within the tenant + envName).',
724
773
  schema: { type: 'string', minLength: 1 },
725
774
  };
775
+ // ---------------- judgments + judge classes: parameters ----------------
776
+ const JudgmentIdPathParam = {
777
+ name: 'judgmentId',
778
+ in: 'path',
779
+ required: true,
780
+ description: 'Judgment id.',
781
+ schema: { type: 'string', minLength: 1 },
782
+ };
783
+ const JudgeClassIdPathParam = {
784
+ name: 'judgeClassId',
785
+ in: 'path',
786
+ required: true,
787
+ description: 'Judge class id.',
788
+ schema: { type: 'string', minLength: 1 },
789
+ };
790
+ const judgmentQuery = (name, description, schema) => ({
791
+ name,
792
+ in: 'query',
793
+ required: false,
794
+ description,
795
+ schema,
796
+ });
797
+ const JudgmentListQueryParams = [
798
+ judgmentQuery('runId', 'Only judgments of this run.', { type: 'string', minLength: 1 }),
799
+ judgmentQuery('agentId', 'Only judgments of runs of this agent.', {
800
+ type: 'string',
801
+ minLength: 1,
802
+ }),
803
+ judgmentQuery('agentVersion', 'Only judgments of runs of this agent version. Needs `agentId`.', {
804
+ type: 'string',
805
+ minLength: 1,
806
+ }),
807
+ judgmentQuery('flowId', 'Only judgments of runs of this flow.', { type: 'string', minLength: 1 }),
808
+ judgmentQuery('verdict', 'Only judgments with this verdict.', {
809
+ type: 'string',
810
+ enum: ['yes', 'no'],
811
+ }),
812
+ judgmentQuery('judgeClassId', 'Only judgments recorded under this judge class.', {
813
+ type: 'string',
814
+ minLength: 1,
815
+ }),
816
+ judgmentQuery('participantId', "Only judgments made for this app end user's opaque id.", {
817
+ type: 'string',
818
+ minLength: 1,
819
+ }),
820
+ ];
821
+ const JudgeClassScopeKindQueryParam = judgmentQuery('scopeKind', 'Only classes of this scope kind. `project` and `agent` need `projectId`; `agent` also needs `agentId`.', { type: 'string', enum: ['tenant', 'project', 'agent'] });
822
+ const JudgeClassProjectIdQueryParam = judgmentQuery('projectId', 'Project of the scope, for `scopeKind=project|agent`.', { type: 'string', minLength: 1 });
823
+ const JudgeClassAgentIdQueryParam = judgmentQuery('agentId', 'Agent of the scope, for `scopeKind=agent`.', { type: 'string', minLength: 1 });
726
824
  // ---------------- shared responses ----------------
727
825
  const ErrorResponse = (description) => ({
728
826
  description,
@@ -810,6 +908,8 @@ export const OPERATIONS = [
810
908
  ParentRunIdQueryParam,
811
909
  TopLevelQueryParam,
812
910
  RunAgentIdQueryParam,
911
+ RunReplaysQueryParam,
912
+ RunEvalRunIdQueryParam,
813
913
  RunIncludeQueryParam,
814
914
  ],
815
915
  responses: {
@@ -1317,6 +1417,29 @@ export const OPERATIONS = [
1317
1417
  '404': ErrorResponse('No agent with that id under this tenant.'),
1318
1418
  },
1319
1419
  },
1420
+ {
1421
+ method: 'post',
1422
+ honoPath: '/v1/agents/:agentId/versions',
1423
+ openapiPath: '/v1/agents/{agentId}/versions',
1424
+ operationId: 'agents.deriveVersion',
1425
+ summary: 'Derive an agent version with data-block pins swapped',
1426
+ description: "An expert's edit, without a code change: a new agent version that is `from`'s bag with some prompt or settings pins swapped (`derivedFrom: { version, reason: 'edited', label, by }`), numbered the next free patch after the agent's highest version. Only blocks `from` already references swap, to a published, active version of the right kind (model settings for the model-settings block); tool pins come from code. Needs `publish` on the agent.",
1427
+ tags: ['agents'],
1428
+ security: 'bearer',
1429
+ parameters: [AgentIdPathParam, IdempotencyKeyParam],
1430
+ requestBody: { required: true, schema: ref('DeriveAgentVersionBody') },
1431
+ responses: {
1432
+ '200': {
1433
+ description: 'An active version already holds this definition and these pins (the same swap derived before, or a deploy that registered it): that version, unchanged.',
1434
+ schema: ref('Agent'),
1435
+ },
1436
+ '201': { description: 'The derived agent version.', schema: ref('Agent') },
1437
+ ...CommonMutationErrors,
1438
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1439
+ '400': ErrorResponse("`validation-failed`: `from` has no pins, a swap names a block it doesn't reference, or a version that isn't published, active or the right kind (see `details.issues`)."),
1440
+ '404': ErrorResponse('`agent-not-found`: no agent at `from`.'),
1441
+ },
1442
+ },
1320
1443
  {
1321
1444
  method: 'get',
1322
1445
  honoPath: '/v1/agents/:agentId/versions/:version',
@@ -1347,7 +1470,7 @@ export const OPERATIONS = [
1347
1470
  '201': { description: 'Agent published.', schema: ref('PublishAgentResult') },
1348
1471
  ...CommonMutationErrors,
1349
1472
  '400': ErrorResponse('Validation failed (see `details.issues`).'),
1350
- '409': ErrorResponse('Agent already registered at that (id, version).'),
1473
+ '409': ErrorResponse("Agent already registered at that (id, version). Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1351
1474
  },
1352
1475
  },
1353
1476
  {
@@ -1362,6 +1485,7 @@ export const OPERATIONS = [
1362
1485
  responses: {
1363
1486
  '200': { description: 'Unregistered.', schema: ref('UnregisterAgentResult') },
1364
1487
  ...CommonMutationErrors,
1488
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1365
1489
  '404': ErrorResponse('No agent at that (id, version) under this tenant.'),
1366
1490
  },
1367
1491
  },
@@ -1378,6 +1502,7 @@ export const OPERATIONS = [
1378
1502
  responses: {
1379
1503
  '200': { description: 'Reinstated.', schema: ref('ReinstateAgentVersionResult') },
1380
1504
  ...CommonMutationErrors,
1505
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1381
1506
  '404': ErrorResponse('No agent at that (id, version) under this tenant.'),
1382
1507
  },
1383
1508
  },
@@ -1466,7 +1591,7 @@ export const OPERATIONS = [
1466
1591
  '201': { description: 'Flow published.', schema: ref('PublishFlowResult') },
1467
1592
  ...CommonMutationErrors,
1468
1593
  '400': ErrorResponse('Validation failed (see `details.issues`).'),
1469
- '409': ErrorResponse('Flow already registered at that (id, version).'),
1594
+ '409': ErrorResponse("Flow already registered at that (id, version). Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1470
1595
  },
1471
1596
  },
1472
1597
  {
@@ -1481,6 +1606,7 @@ export const OPERATIONS = [
1481
1606
  responses: {
1482
1607
  '200': { description: 'Unregistered.', schema: ref('UnregisterFlowResult') },
1483
1608
  ...CommonMutationErrors,
1609
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1484
1610
  '404': ErrorResponse('No flow at that (id, version) under this tenant.'),
1485
1611
  },
1486
1612
  },
@@ -1497,6 +1623,7 @@ export const OPERATIONS = [
1497
1623
  responses: {
1498
1624
  '200': { description: 'Reinstated.', schema: ref('ReinstateFlowVersionResult') },
1499
1625
  ...CommonMutationErrors,
1626
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1500
1627
  '404': ErrorResponse('No flow at that (id, version) under this tenant.'),
1501
1628
  },
1502
1629
  },
@@ -1587,7 +1714,7 @@ export const OPERATIONS = [
1587
1714
  '201': { description: 'Tool registered.', schema: ref('RegisterToolResult') },
1588
1715
  ...CommonMutationErrors,
1589
1716
  '400': ErrorResponse('Validation failed (see `details.issues`).'),
1590
- '409': ErrorResponse('Tool already registered at that id.'),
1717
+ '409': ErrorResponse("Tool already registered at that id. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1591
1718
  },
1592
1719
  },
1593
1720
  {
@@ -1602,6 +1729,7 @@ export const OPERATIONS = [
1602
1729
  responses: {
1603
1730
  '200': { description: 'Unregistered.', schema: ref('UnregisterToolResult') },
1604
1731
  ...CommonMutationErrors,
1732
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1605
1733
  '404': ErrorResponse('No tool at that (id, version) under this tenant.'),
1606
1734
  },
1607
1735
  },
@@ -1618,6 +1746,7 @@ export const OPERATIONS = [
1618
1746
  responses: {
1619
1747
  '200': { description: 'Reinstated.', schema: ref('ReinstateToolVersionResult') },
1620
1748
  ...CommonMutationErrors,
1749
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1621
1750
  '404': ErrorResponse('No tool at that (id, version) under this tenant.'),
1622
1751
  },
1623
1752
  },
@@ -1675,7 +1804,7 @@ export const OPERATIONS = [
1675
1804
  '201': { description: 'Guardrail registered.', schema: ref('RegisterGuardrailResult') },
1676
1805
  ...CommonMutationErrors,
1677
1806
  '400': ErrorResponse('Validation failed (see `details.issues`).'),
1678
- '409': ErrorResponse('Guardrail already registered at that id.'),
1807
+ '409': ErrorResponse("Guardrail already registered at that id. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1679
1808
  },
1680
1809
  },
1681
1810
  {
@@ -1690,6 +1819,7 @@ export const OPERATIONS = [
1690
1819
  responses: {
1691
1820
  '200': { description: 'Unregistered.', schema: ref('UnregisterGuardrailResult') },
1692
1821
  ...CommonMutationErrors,
1822
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
1693
1823
  '404': ErrorResponse('No guardrail with that id under this tenant.'),
1694
1824
  },
1695
1825
  },
@@ -2347,7 +2477,7 @@ export const OPERATIONS = [
2347
2477
  openapiPath: '/v1/providers',
2348
2478
  operationId: 'providers.register',
2349
2479
  summary: 'Register a model provider',
2350
- description: 'Body is a full `ProviderMetadata`. Server validates shape: provider-level `id` + `region` non-empty; `models[]` non-empty with unique `name` per entry; per-model `contextWindow` positive integer; per-model `features` against the closed enum; per-model `cost` non-negative; optional per-model `p95LatencyMs` / `maxOutputTokens` well-shaped — same rules as `@kindgi/capabilities.createProviderRegistry`. Secrets (API keys, endpoints) are NOT part of the wire shape; deployments store them inside the binding.',
2480
+ description: 'Body is a full `ProviderMetadata`. Server validates shape: provider-level `id` + `region` non-empty; `models[]` non-empty with unique `name` per entry; per-model `contextWindow` positive integer; per-model `features` against the closed enum; per-model `cost` non-negative; optional per-model `p95LatencyMs` / `maxOutputTokens` well-shaped; optional `labels` within their limits — same rules as `@kindgi/capabilities.createProviderRegistry`. Secrets (API keys, endpoints) are NOT part of the wire shape; deployments store them inside the binding.',
2351
2481
  tags: ['providers'],
2352
2482
  security: 'bearer',
2353
2483
  parameters: [IdempotencyKeyParam],
@@ -2365,13 +2495,181 @@ export const OPERATIONS = [
2365
2495
  openapiPath: '/v1/providers/{providerId}/unregister',
2366
2496
  operationId: 'providers.unregister',
2367
2497
  summary: 'Unregister a model provider',
2498
+ description: 'A tombstone, not an erase: from then on the provider is gone from list, get and capabilities, and the router never picks it. Its id is free to register again. A retention policy on the `provider` domain purges the row.',
2368
2499
  tags: ['providers'],
2369
2500
  security: 'bearer',
2370
2501
  parameters: [ProviderIdPathParam, IdempotencyKeyParam],
2371
2502
  responses: {
2372
2503
  '200': { description: 'Unregistered.', schema: ref('UnregisterProviderResult') },
2373
2504
  ...CommonMutationErrors,
2374
- '404': ErrorResponse('No provider with that id under this tenant.'),
2505
+ '404': ErrorResponse('No provider with that id under this tenant, or already unregistered.'),
2506
+ },
2507
+ },
2508
+ // ---------- judgments ----------
2509
+ {
2510
+ method: 'post',
2511
+ honoPath: '/v1/judgments',
2512
+ openapiPath: '/v1/judgments',
2513
+ operationId: 'judgments.create',
2514
+ summary: "Judge an item of a run's output",
2515
+ description: "Records yes or no, with an optional reason, about one item of a finished run's output, optionally under a judge class that applies to the run's project or agent (unclassified judgments count with weight 1). `item.pointer` (a JSON Pointer) must resolve in the run's output; its value is kept as `itemValue`. The first judgment of a run also stores a copy of the run's input and output. `assertedBy` is the authenticated caller, never the body. Judging again as the same caller for the same run, item key and `participantId` supersedes the earlier judgment. Needs `judge` on the run.",
2516
+ tags: ['judgments'],
2517
+ security: 'bearer',
2518
+ parameters: [IdempotencyKeyParam],
2519
+ requestBody: { required: true, schema: ref('CreateJudgmentBody') },
2520
+ responses: {
2521
+ '201': { description: 'Judgment recorded.', schema: ref('Judgment') },
2522
+ ...CommonMutationErrors,
2523
+ '400': ErrorResponse('Malformed body, or `item-not-found` (the pointer resolves to nothing in the output), or `judge-class-not-applicable`.'),
2524
+ '403': ErrorResponse('`permission-denied`: not allowed to judge this run.'),
2525
+ '404': ErrorResponse('`run-not-found`.'),
2526
+ '409': ErrorResponse('`run-not-finished`: the run has no output to judge yet.'),
2527
+ },
2528
+ },
2529
+ {
2530
+ method: 'get',
2531
+ honoPath: '/v1/judgments',
2532
+ openapiPath: '/v1/judgments',
2533
+ operationId: 'judgments.list',
2534
+ summary: 'List judgments',
2535
+ description: 'Live judgments (not removed or superseded), newest first, cursor-paginated. Filter by run, agent (and version), flow, verdict, judge class or participant; `?scopeKind + ?scopeId` narrow to a project.',
2536
+ tags: ['judgments'],
2537
+ security: 'bearer',
2538
+ parameters: [
2539
+ LimitQueryParam,
2540
+ CursorQueryParam,
2541
+ ...JudgmentListQueryParams,
2542
+ ScopeKindQueryParam,
2543
+ ScopeIdQueryParam,
2544
+ ],
2545
+ responses: {
2546
+ '200': { description: 'Page of judgments.', schema: ref('JudgmentCollectionPage') },
2547
+ ...CommonAuthErrors,
2548
+ '400': ErrorResponse('Malformed query parameter.'),
2549
+ },
2550
+ },
2551
+ {
2552
+ method: 'get',
2553
+ honoPath: '/v1/judgments/:judgmentId',
2554
+ openapiPath: '/v1/judgments/{judgmentId}',
2555
+ operationId: 'judgments.get',
2556
+ summary: 'Fetch a judgment with its copies',
2557
+ description: "Returns the judgment (live or not) with the stored copy of the run's input and output and, when the judgment pointed at an item, its value.",
2558
+ tags: ['judgments'],
2559
+ security: 'bearer',
2560
+ parameters: [JudgmentIdPathParam],
2561
+ responses: {
2562
+ '200': { description: 'Judgment with copies.', schema: ref('JudgmentWithCopies') },
2563
+ ...CommonAuthErrors,
2564
+ '404': ErrorResponse('No judgment with that id under this tenant.'),
2565
+ },
2566
+ },
2567
+ {
2568
+ method: 'post',
2569
+ honoPath: '/v1/judgments/:judgmentId/unregister',
2570
+ openapiPath: '/v1/judgments/{judgmentId}/unregister',
2571
+ operationId: 'judgments.unregister',
2572
+ summary: 'Remove a judgment',
2573
+ description: 'Soft delete: the judgment stops listing; retention policy decides when it is purged.',
2574
+ tags: ['judgments'],
2575
+ security: 'bearer',
2576
+ parameters: [JudgmentIdPathParam, IdempotencyKeyParam],
2577
+ responses: {
2578
+ '200': { description: 'Removed.', schema: ref('UnregisterJudgmentResult') },
2579
+ ...CommonMutationErrors,
2580
+ '403': ErrorResponse('`permission-denied`.'),
2581
+ '404': ErrorResponse('No live judgment with that id under this tenant.'),
2582
+ },
2583
+ },
2584
+ // ---------- judge classes ----------
2585
+ {
2586
+ method: 'post',
2587
+ honoPath: '/v1/judge-classes',
2588
+ openapiPath: '/v1/judge-classes',
2589
+ operationId: 'judgeClasses.create',
2590
+ summary: 'Create a judge class',
2591
+ description: 'A named kind of judge with a weight, scoped to the tenant, a project, or an agent in a project. Names are unique among the live classes of a scope. Needs `admin` on the tenant (tenant scope) or the project.',
2592
+ tags: ['judge-classes'],
2593
+ security: 'bearer',
2594
+ parameters: [IdempotencyKeyParam],
2595
+ requestBody: { required: true, schema: ref('CreateJudgeClassBody') },
2596
+ responses: {
2597
+ '201': { description: 'Judge class created.', schema: ref('JudgeClass') },
2598
+ ...CommonMutationErrors,
2599
+ '403': ErrorResponse('`permission-denied`.'),
2600
+ '409': ErrorResponse('`judge-class-name-taken`, or an idempotency conflict.'),
2601
+ },
2602
+ },
2603
+ {
2604
+ method: 'get',
2605
+ honoPath: '/v1/judge-classes',
2606
+ openapiPath: '/v1/judge-classes',
2607
+ operationId: 'judgeClasses.list',
2608
+ summary: 'List judge classes',
2609
+ description: 'Live classes, newest first, cursor-paginated. `?scopeKind=tenant|project|agent` (with `projectId` / `agentId`) narrows to one scope.',
2610
+ tags: ['judge-classes'],
2611
+ security: 'bearer',
2612
+ parameters: [
2613
+ LimitQueryParam,
2614
+ CursorQueryParam,
2615
+ JudgeClassScopeKindQueryParam,
2616
+ JudgeClassProjectIdQueryParam,
2617
+ JudgeClassAgentIdQueryParam,
2618
+ ],
2619
+ responses: {
2620
+ '200': { description: 'Page of judge classes.', schema: ref('JudgeClassCollectionPage') },
2621
+ ...CommonAuthErrors,
2622
+ '400': ErrorResponse('Malformed scope parameters.'),
2623
+ },
2624
+ },
2625
+ {
2626
+ method: 'get',
2627
+ honoPath: '/v1/judge-classes/:judgeClassId',
2628
+ openapiPath: '/v1/judge-classes/{judgeClassId}',
2629
+ operationId: 'judgeClasses.get',
2630
+ summary: 'Fetch a judge class',
2631
+ description: 'Also returns a retired class (`unregisteredAt` set): judgments keep naming theirs.',
2632
+ tags: ['judge-classes'],
2633
+ security: 'bearer',
2634
+ parameters: [JudgeClassIdPathParam],
2635
+ responses: {
2636
+ '200': { description: 'Judge class.', schema: ref('JudgeClass') },
2637
+ ...CommonAuthErrors,
2638
+ '404': ErrorResponse('No judge class with that id under this tenant.'),
2639
+ },
2640
+ },
2641
+ {
2642
+ method: 'patch',
2643
+ honoPath: '/v1/judge-classes/:judgeClassId',
2644
+ openapiPath: '/v1/judge-classes/{judgeClassId}',
2645
+ operationId: 'judgeClasses.update',
2646
+ summary: "Change a judge class's weight or description",
2647
+ tags: ['judge-classes'],
2648
+ security: 'bearer',
2649
+ parameters: [JudgeClassIdPathParam, IdempotencyKeyParam],
2650
+ requestBody: { required: true, schema: ref('UpdateJudgeClassBody') },
2651
+ responses: {
2652
+ '200': { description: 'Updated judge class.', schema: ref('JudgeClass') },
2653
+ ...CommonMutationErrors,
2654
+ '403': ErrorResponse('`permission-denied`.'),
2655
+ '404': ErrorResponse('No live judge class with that id under this tenant.'),
2656
+ },
2657
+ },
2658
+ {
2659
+ method: 'post',
2660
+ honoPath: '/v1/judge-classes/:judgeClassId/unregister',
2661
+ openapiPath: '/v1/judge-classes/{judgeClassId}/unregister',
2662
+ operationId: 'judgeClasses.unregister',
2663
+ summary: 'Retire a judge class',
2664
+ description: 'No new judgments may name it; existing judgments keep it.',
2665
+ tags: ['judge-classes'],
2666
+ security: 'bearer',
2667
+ parameters: [JudgeClassIdPathParam, IdempotencyKeyParam],
2668
+ responses: {
2669
+ '200': { description: 'Retired.', schema: ref('UnregisterJudgeClassResult') },
2670
+ ...CommonMutationErrors,
2671
+ '403': ErrorResponse('`permission-denied`.'),
2672
+ '404': ErrorResponse('No live judge class with that id under this tenant.'),
2375
2673
  },
2376
2674
  },
2377
2675
  // ---------- mcp (interop plane) ----------
@@ -2578,11 +2876,12 @@ export const OPERATIONS = [
2578
2876
  openapiPath: '/v1/cost/aggregate',
2579
2877
  operationId: 'cost.aggregate',
2580
2878
  summary: 'Aggregate cost across a time window',
2581
- description: "Primary consumer path for dashboards. `groupBy` is required (comma-separated dimensions from the closed set); time range is required (both `from` and `to`, or both omitted for the default last-30-days window echoed back in `timeRange`). Filters compose on top of the time window. `?scopeKind + ?scopeId` narrow the aggregate to a scope: `org` covers every project in the org, so one call sums an org's spend. Each group, and the total, carries its cost and its token sums (`tokens`). `inherit` has no effect on cost records, which always belong to a project.",
2879
+ description: "Primary consumer path for dashboards. `groupBy` is required (comma-separated dimensions from the closed set); time range is required (both `from` and `to`, or both omitted for the default last-30-days window echoed back in `timeRange`). Filters compose on top of the time window. `?scopeKind + ?scopeId` narrow the aggregate to a scope: `org` covers every project in the org, so one call sums an org's spend. Each group, and the total, carries its cost and its token sums (`tokens`). `groups` is ordered by `totalUsd`, highest first (ties by key), and capped at `limit` (default 1000): `truncated` and `totalGroups` say when there were more, and the totals still cover every record. For every record, page through `/v1/cost/records`. `inherit` has no effect on cost records, which always belong to a project.",
2582
2880
  tags: ['cost'],
2583
2881
  security: 'bearer',
2584
2882
  parameters: [
2585
2883
  CostGroupByQueryParam,
2884
+ CostAggregateLimitQueryParam,
2586
2885
  CostFromQueryParam,
2587
2886
  CostToQueryParam,
2588
2887
  CostCategoryQueryParam,
@@ -2757,7 +3056,7 @@ export const OPERATIONS = [
2757
3056
  openapiPath: '/v1/policies',
2758
3057
  operationId: 'policies.publish',
2759
3058
  summary: 'Publish a policy',
2760
- description: "Body is a full `Policy` — the server validates top-level shape (id, tenantId, semver version, kind ∈ closed enum, spec is an object). Deeper `spec` validation is the runtime consumer's responsibility per kind. Re-publishing an existing `(policyId, version)` returns `409 policy-already-registered`. Idempotency-Key applies (retries with the same key replay the original 201).",
3059
+ description: "Body is a full `Policy` — the server validates top-level shape (id, tenantId, semver version, kind ∈ closed enum, spec is an object). Deeper `spec` validation is the runtime consumer's responsibility per kind. Re-publishing an existing `(policyId, version)` returns `409 policy-already-registered`. A known kind that no runtime consumer applies yet (`access-control`, `adapter-allowlist`, `rate-limit`, `compliance`) is refused with `400 kind-not-applied` (`details.appliedKinds` lists the ones that are): publishing it would change nothing. Idempotency-Key applies (retries with the same key replay the original 201).",
2761
3060
  tags: ['policies'],
2762
3061
  security: 'bearer',
2763
3062
  parameters: [IdempotencyKeyParam],
@@ -2765,7 +3064,7 @@ export const OPERATIONS = [
2765
3064
  responses: {
2766
3065
  '201': { description: 'Policy published.', schema: ref('PublishPolicyResult') },
2767
3066
  ...CommonMutationErrors,
2768
- '400': ErrorResponse('Validation failed (see `details.issues`).'),
3067
+ '400': ErrorResponse('Validation failed (see `details.issues`), or `kind-not-applied`: no runtime consumer applies that kind yet.'),
2769
3068
  '409': ErrorResponse('Policy already registered at that (id, version).'),
2770
3069
  },
2771
3070
  },
@@ -2892,6 +3191,47 @@ export const OPERATIONS = [
2892
3191
  '409': ErrorResponse('Eval suite already registered at that (id, version).'),
2893
3192
  },
2894
3193
  },
3194
+ {
3195
+ method: 'post',
3196
+ honoPath: '/v1/eval-suites/:suiteId/versions/from-judgments',
3197
+ openapiPath: '/v1/eval-suites/{suiteId}/versions/from-judgments',
3198
+ operationId: 'evalSuites.buildFromJudgments',
3199
+ summary: 'Build a test set from judgments',
3200
+ description: "Publishes a `judged` eval suite version whose cases are copies of judged runs of one agent (optionally one version) or flow, newest first, at most 1000. Each case holds the run's input, what the turn read (`context`), the judged output, and each item's judgments summed up: yes and no counts, the weight behind yes and behind all judgments (an unclassified judgment counts 1), and the reasons. `judgeClassIds` counts only judgments of those classes; `minJudgments` leaves out runs with fewer. Needs `admin` on the project.",
3201
+ tags: ['eval-suites'],
3202
+ security: 'bearer',
3203
+ parameters: [EvalSuiteIdPathParam, IdempotencyKeyParam],
3204
+ requestBody: { required: true, schema: ref('BuildJudgedSuiteBody') },
3205
+ responses: {
3206
+ '201': { description: 'Version published.', schema: ref('BuildJudgedSuiteResult') },
3207
+ ...CommonMutationErrors,
3208
+ '400': ErrorResponse('Malformed body.'),
3209
+ '403': ErrorResponse('`permission-denied`.'),
3210
+ '409': ErrorResponse('Eval suite already registered at that (id, version).'),
3211
+ '501': ErrorResponse('`test-sets-not-supported`: this deployment cannot build test sets.'),
3212
+ },
3213
+ },
3214
+ {
3215
+ method: 'get',
3216
+ honoPath: '/v1/eval-suites/:suiteId/versions/:version/cases',
3217
+ openapiPath: '/v1/eval-suites/{suiteId}/versions/{version}/cases',
3218
+ operationId: 'evalSuites.listCases',
3219
+ summary: 'List the cases of a judged eval suite version',
3220
+ description: 'Cursor-paginated, in the order the cases were stored (newest judged run first).',
3221
+ tags: ['eval-suites'],
3222
+ security: 'bearer',
3223
+ parameters: [
3224
+ EvalSuiteIdPathParam,
3225
+ EvalSuiteVersionPathParam,
3226
+ LimitQueryParam,
3227
+ CursorQueryParam,
3228
+ ],
3229
+ responses: {
3230
+ '200': { description: 'Page of cases.', schema: ref('JudgedEvalCaseCollectionPage') },
3231
+ ...CommonAuthErrors,
3232
+ '404': ErrorResponse('No eval suite with that id.'),
3233
+ },
3234
+ },
2895
3235
  {
2896
3236
  method: 'post',
2897
3237
  honoPath: '/v1/eval-suites/:suiteId/versions/:version/unregister',
@@ -2924,6 +3264,129 @@ export const OPERATIONS = [
2924
3264
  },
2925
3265
  },
2926
3266
  // ---------- eval runs (data plane) ----------
3267
+ {
3268
+ method: 'get',
3269
+ honoPath: '/v1/blocks',
3270
+ openapiPath: '/v1/blocks',
3271
+ operationId: 'blocks.list',
3272
+ summary: 'List data blocks (latest version of each)',
3273
+ description: 'Cursor-paginated. Only the blocks of projects the caller can read. `?kind=` narrows to prompts or settings, `?name=` is a prefix match on the id, and `?scopeKind=` + `?scopeId=` narrow to a project or an org, as the other lists do.',
3274
+ tags: ['blocks'],
3275
+ security: 'bearer',
3276
+ parameters: [
3277
+ LimitQueryParam,
3278
+ CursorQueryParam,
3279
+ BlockKindFilterQueryParam,
3280
+ BlockNameFilterQueryParam,
3281
+ ScopeKindQueryParam,
3282
+ ScopeIdQueryParam,
3283
+ ],
3284
+ responses: {
3285
+ '200': { description: 'Page of blocks.', schema: ref('BlockCollectionPage') },
3286
+ ...CommonAuthErrors,
3287
+ '400': ErrorResponse('Malformed query parameter: an unknown `kind`, or `scope-invalid` for a malformed scope.'),
3288
+ },
3289
+ },
3290
+ {
3291
+ method: 'get',
3292
+ honoPath: '/v1/blocks/:blockId',
3293
+ openapiPath: '/v1/blocks/{blockId}',
3294
+ operationId: 'blocks.get',
3295
+ summary: 'Fetch a data block (latest version)',
3296
+ tags: ['blocks'],
3297
+ security: 'bearer',
3298
+ parameters: [BlockIdPathParam],
3299
+ responses: {
3300
+ '200': { description: 'Latest active version.', schema: ref('Block') },
3301
+ ...CommonAuthErrors,
3302
+ '404': ErrorResponse("`block-not-found`: no such block, or one in a project the caller can't read."),
3303
+ },
3304
+ },
3305
+ {
3306
+ method: 'get',
3307
+ honoPath: '/v1/blocks/:blockId/versions',
3308
+ openapiPath: '/v1/blocks/{blockId}/versions',
3309
+ operationId: 'blocks.versions.list',
3310
+ summary: 'List versions of a data block',
3311
+ description: 'Newest published first. `?includeTombstoned=true` includes unregistered versions, each with `unregisteredAt`.',
3312
+ tags: ['blocks'],
3313
+ security: 'bearer',
3314
+ parameters: [BlockIdPathParam, LimitQueryParam, CursorQueryParam, IncludeTombstonedQueryParam],
3315
+ responses: {
3316
+ '200': { description: 'Page of versions.', schema: ref('BlockCollectionPage') },
3317
+ ...CommonAuthErrors,
3318
+ '404': ErrorResponse('`block-not-found`.'),
3319
+ },
3320
+ },
3321
+ {
3322
+ method: 'get',
3323
+ honoPath: '/v1/blocks/:blockId/versions/:version',
3324
+ openapiPath: '/v1/blocks/{blockId}/versions/{version}',
3325
+ operationId: 'blocks.versions.get',
3326
+ summary: 'Fetch a specific data block version',
3327
+ description: 'An unregistered version is returned too, with `unregisteredAt`.',
3328
+ tags: ['blocks'],
3329
+ security: 'bearer',
3330
+ parameters: [BlockIdPathParam, BlockVersionPathParam],
3331
+ responses: {
3332
+ '200': { description: 'The block at that version.', schema: ref('Block') },
3333
+ ...CommonAuthErrors,
3334
+ '404': ErrorResponse('`block-not-found`.'),
3335
+ },
3336
+ },
3337
+ {
3338
+ method: 'post',
3339
+ honoPath: '/v1/blocks',
3340
+ openapiPath: '/v1/blocks',
3341
+ operationId: 'blocks.publish',
3342
+ summary: 'Publish a data block version',
3343
+ description: "Needs `write` on the project. A prompt's template must parse as Liquid; a settings block's `values` must satisfy its `schema` and the latest version's. A taken version is `409 block-already-registered` (versions never change); a block keeps its kind, and its versions stay in its first version's project (`409 block-project-mismatch`). Idempotency-Key applies.",
3344
+ tags: ['blocks'],
3345
+ security: 'bearer',
3346
+ parameters: [IdempotencyKeyParam],
3347
+ requestBody: { required: true, schema: ref('PublishBlockBody') },
3348
+ responses: {
3349
+ '201': { description: 'Published.', schema: ref('PublishBlockResult') },
3350
+ ...CommonMutationErrors,
3351
+ '400': ErrorResponse('`validation-failed` (see `details.issues`), or an unknown `projectId`.'),
3352
+ '403': ErrorResponse('`permission-denied`: no `write` on the project.'),
3353
+ '409': ErrorResponse('`block-already-registered` or `block-project-mismatch`.'),
3354
+ },
3355
+ },
3356
+ {
3357
+ method: 'post',
3358
+ honoPath: '/v1/blocks/:blockId/versions/:version/unregister',
3359
+ openapiPath: '/v1/blocks/{blockId}/versions/{version}/unregister',
3360
+ operationId: 'blocks.versions.unregister',
3361
+ summary: 'Unregister a data block version',
3362
+ description: 'Soft: no range picks it any more, but the agent versions that pin it keep running it, and GET still reads it. Needs `write` on the project.',
3363
+ tags: ['blocks'],
3364
+ security: 'bearer',
3365
+ parameters: [BlockIdPathParam, BlockVersionPathParam, IdempotencyKeyParam],
3366
+ responses: {
3367
+ '200': { description: 'Unregistered.', schema: ref('UnregisterBlockResult') },
3368
+ ...CommonMutationErrors,
3369
+ '403': ErrorResponse('`permission-denied`: no `write` on the project.'),
3370
+ '404': ErrorResponse('`block-not-found`, or already unregistered.'),
3371
+ },
3372
+ },
3373
+ {
3374
+ method: 'post',
3375
+ honoPath: '/v1/blocks/:blockId/versions/:version/reinstate',
3376
+ openapiPath: '/v1/blocks/{blockId}/versions/{version}/reinstate',
3377
+ operationId: 'blocks.versions.reinstate',
3378
+ summary: 'Reinstate an unregistered data block version',
3379
+ description: 'Unchanged, as published. Idempotent. Needs `write` on the project.',
3380
+ tags: ['blocks'],
3381
+ security: 'bearer',
3382
+ parameters: [BlockIdPathParam, BlockVersionPathParam, IdempotencyKeyParam],
3383
+ responses: {
3384
+ '200': { description: 'Reinstated.', schema: ref('ReinstateBlockResult') },
3385
+ ...CommonMutationErrors,
3386
+ '403': ErrorResponse('`permission-denied`: no `write` on the project.'),
3387
+ '404': ErrorResponse('`block-not-found`.'),
3388
+ },
3389
+ },
2927
3390
  {
2928
3391
  method: 'post',
2929
3392
  honoPath: '/v1/eval-suites/:suiteId/runs',
@@ -3283,6 +3746,7 @@ export const OPERATIONS = [
3283
3746
  schema: ref('DeploymentRecord'),
3284
3747
  },
3285
3748
  ...CommonMutationErrors,
3749
+ '409': ErrorResponse("Idempotency-Key was reused with a different body, or resource-state conflict. Or `registry-read-only`: this registry takes no writes (under `kindgi dev`, the pack's files are the source); the message says what to do instead."),
3286
3750
  '400': ErrorResponse('Signature invalid, image unverifiable, or deployment-validation-failed with per-primitive `details[]`.'),
3287
3751
  '403': ErrorResponse("Signer key not on the tenant's trust list."),
3288
3752
  },
@@ -3699,7 +4163,7 @@ export const OPERATIONS = [
3699
4163
  openapiPath: '/v1/orgs/{orgId}',
3700
4164
  operationId: 'orgs.delete',
3701
4165
  summary: 'Delete an org (idempotent)',
3702
- description: 'Idempotent — deleting an unknown or already-deleted org returns 204 per the binding contract.',
4166
+ description: "A tombstone, not an erase: from then on the org is gone from get and list, and its slug is free for a new org. Its projects and teams stay, without an org; when one of those projects has the slug of a project that has none, nothing is deleted: `409 slug-conflict` names the slugs (rename or move those projects first). In the Kindgi runtime, the org's own secrets and secret mappings are deleted with it, for good, and its own environments and MCP endpoints are unregistered. A retention policy on the `org` domain purges the org's row. Idempotent: deleting an unknown or already-deleted org returns 204.",
3703
4167
  tags: ['orgs'],
3704
4168
  security: 'bearer',
3705
4169
  parameters: [
@@ -3715,6 +4179,7 @@ export const OPERATIONS = [
3715
4179
  responses: {
3716
4180
  '204': { description: 'Deleted (or already absent). No body.' },
3717
4181
  ...CommonAuthErrors,
4182
+ '409': ErrorResponse("slug-conflict: the org's projects would leave it with slugs that projects without an org already have."),
3718
4183
  },
3719
4184
  },
3720
4185
  // ---------- teams ----------
@@ -3764,6 +4229,7 @@ export const OPERATIONS = [
3764
4229
  responses: {
3765
4230
  '201': { description: 'Team created.', schema: ref('CreateResourceResult') },
3766
4231
  ...CommonMutationErrors,
4232
+ '404': ErrorResponse('org-not-found: `orgId` names no org of the tenant (it never existed, or it was deleted).'),
3767
4233
  },
3768
4234
  },
3769
4235
  {
@@ -3811,7 +4277,7 @@ export const OPERATIONS = [
3811
4277
  responses: {
3812
4278
  '204': { description: 'Updated. No body.' },
3813
4279
  ...CommonMutationErrors,
3814
- '404': ErrorResponse('No team with that id under this tenant.'),
4280
+ '404': ErrorResponse('team-not-found: no team with that id under this tenant; or org-not-found: `orgId` names no org of the tenant (it never existed, or it was deleted).'),
3815
4281
  },
3816
4282
  },
3817
4283
  {
@@ -4009,6 +4475,7 @@ export const OPERATIONS = [
4009
4475
  openapiPath: '/v1/projects',
4010
4476
  operationId: 'projects.create',
4011
4477
  summary: 'Create a project',
4478
+ description: "A project's slug is unique within its org, and a project without an org's among the tenant's projects without one: two orgs may each have a project with the same slug. A taken slug answers `409 slug-conflict`; a second Default, `409 project-default-already-exists`.",
4012
4479
  tags: ['projects'],
4013
4480
  security: 'bearer',
4014
4481
  parameters: [IdempotencyKeyParam],
@@ -4016,6 +4483,7 @@ export const OPERATIONS = [
4016
4483
  responses: {
4017
4484
  '201': { description: 'Project created.', schema: ref('CreateResourceResult') },
4018
4485
  ...CommonMutationErrors,
4486
+ '404': ErrorResponse('org-not-found: `orgId` names no org of the tenant (it never existed, or it was deleted).'),
4019
4487
  },
4020
4488
  },
4021
4489
  {
@@ -4047,6 +4515,7 @@ export const OPERATIONS = [
4047
4515
  openapiPath: '/v1/projects/{projectId}',
4048
4516
  operationId: 'projects.update',
4049
4517
  summary: 'Partially update a project',
4518
+ description: 'A new `slug`, or a move to another org (`orgId`, or `null` for none), answers `409 slug-conflict` when the slug is taken where the project ends up.',
4050
4519
  tags: ['projects'],
4051
4520
  security: 'bearer',
4052
4521
  parameters: [
@@ -4063,7 +4532,7 @@ export const OPERATIONS = [
4063
4532
  responses: {
4064
4533
  '204': { description: 'Updated. No body.' },
4065
4534
  ...CommonMutationErrors,
4066
- '404': ErrorResponse('No project with that id under this tenant.'),
4535
+ '404': ErrorResponse('project-not-found: no project with that id under this tenant; or org-not-found: `orgId` names no org of the tenant (it never existed, or it was deleted).'),
4067
4536
  },
4068
4537
  },
4069
4538
  {