@kindgi/api 0.1.4 → 0.1.5

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 (516) hide show
  1. package/dist/agent-binding.d.ts +13 -0
  2. package/dist/agent-binding.d.ts.map +1 -1
  3. package/dist/agent-pins.d.ts.map +1 -1
  4. package/dist/agent-pins.js +18 -2
  5. package/dist/agent-pins.js.map +1 -1
  6. package/dist/app.d.ts +110 -17
  7. package/dist/app.d.ts.map +1 -1
  8. package/dist/app.js +163 -35
  9. package/dist/app.js.map +1 -1
  10. package/dist/block-publish.d.ts +56 -0
  11. package/dist/block-publish.d.ts.map +1 -0
  12. package/dist/block-publish.js +132 -0
  13. package/dist/block-publish.js.map +1 -0
  14. package/dist/caller.d.ts +24 -0
  15. package/dist/caller.d.ts.map +1 -0
  16. package/dist/caller.js +47 -0
  17. package/dist/caller.js.map +1 -0
  18. package/dist/capability-binding.d.ts +11 -0
  19. package/dist/capability-binding.d.ts.map +1 -1
  20. package/dist/cost-binding.d.ts +19 -0
  21. package/dist/cost-binding.d.ts.map +1 -1
  22. package/dist/cost-binding.js.map +1 -1
  23. package/dist/derive-agent-version.d.ts +7 -0
  24. package/dist/derive-agent-version.d.ts.map +1 -1
  25. package/dist/derive-agent-version.js +4 -0
  26. package/dist/derive-agent-version.js.map +1 -1
  27. package/dist/errors.d.ts.map +1 -1
  28. package/dist/errors.js +75 -7
  29. package/dist/errors.js.map +1 -1
  30. package/dist/eval-case-binding.d.ts +16 -4
  31. package/dist/eval-case-binding.d.ts.map +1 -1
  32. package/dist/eval-run-binding.d.ts +31 -0
  33. package/dist/eval-run-binding.d.ts.map +1 -1
  34. package/dist/eval-run-dispatcher.d.ts +7 -0
  35. package/dist/eval-run-dispatcher.d.ts.map +1 -1
  36. package/dist/eval-run-dispatcher.js.map +1 -1
  37. package/dist/eval-sample.d.ts +11 -0
  38. package/dist/eval-sample.d.ts.map +1 -0
  39. package/dist/eval-sample.js +34 -0
  40. package/dist/eval-sample.js.map +1 -0
  41. package/dist/eval-suite-binding.d.ts +13 -0
  42. package/dist/eval-suite-binding.d.ts.map +1 -1
  43. package/dist/eval-suite-binding.js.map +1 -1
  44. package/dist/flow-binding.d.ts +18 -0
  45. package/dist/flow-binding.d.ts.map +1 -1
  46. package/dist/flow-pins.d.ts.map +1 -1
  47. package/dist/flow-pins.js +18 -2
  48. package/dist/flow-pins.js.map +1 -1
  49. package/dist/gate.d.ts.map +1 -1
  50. package/dist/gate.js +25 -0
  51. package/dist/gate.js.map +1 -1
  52. package/dist/handler-binding.d.ts +32 -0
  53. package/dist/handler-binding.d.ts.map +1 -1
  54. package/dist/hitl-binding.d.ts +23 -0
  55. package/dist/hitl-binding.d.ts.map +1 -1
  56. package/dist/identity-directory-binding.d.ts +82 -4
  57. package/dist/identity-directory-binding.d.ts.map +1 -1
  58. package/dist/identity-provider-binding.d.ts +197 -17
  59. package/dist/identity-provider-binding.d.ts.map +1 -1
  60. package/dist/improvement-pass-binding.d.ts +196 -0
  61. package/dist/improvement-pass-binding.d.ts.map +1 -0
  62. package/dist/improvement-pass-binding.js +9 -0
  63. package/dist/improvement-pass-binding.js.map +1 -0
  64. package/dist/index.d.ts +35 -17
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +11 -3
  67. package/dist/index.js.map +1 -1
  68. package/dist/judged-dispatcher.d.ts +25 -4
  69. package/dist/judged-dispatcher.d.ts.map +1 -1
  70. package/dist/judged-dispatcher.js +43 -6
  71. package/dist/judged-dispatcher.js.map +1 -1
  72. package/dist/judgment-binding.d.ts +25 -1
  73. package/dist/judgment-binding.d.ts.map +1 -1
  74. package/dist/mcp-endpoint-binding.d.ts +7 -0
  75. package/dist/mcp-endpoint-binding.d.ts.map +1 -1
  76. package/dist/memory-binding.d.ts +124 -17
  77. package/dist/memory-binding.d.ts.map +1 -1
  78. package/dist/memory-erasure-binding.d.ts +145 -0
  79. package/dist/memory-erasure-binding.d.ts.map +1 -0
  80. package/dist/memory-erasure-binding.js +4 -0
  81. package/dist/memory-erasure-binding.js.map +1 -0
  82. package/dist/middleware/auth.d.ts +66 -13
  83. package/dist/middleware/auth.d.ts.map +1 -1
  84. package/dist/middleware/auth.js +150 -50
  85. package/dist/middleware/auth.js.map +1 -1
  86. package/dist/middleware/authorize.d.ts +9 -0
  87. package/dist/middleware/authorize.d.ts.map +1 -1
  88. package/dist/middleware/authorize.js +122 -4
  89. package/dist/middleware/authorize.js.map +1 -1
  90. package/dist/middleware/error-mapper.d.ts +5 -0
  91. package/dist/middleware/error-mapper.d.ts.map +1 -1
  92. package/dist/middleware/error-mapper.js +14 -1
  93. package/dist/middleware/error-mapper.js.map +1 -1
  94. package/dist/middleware/idempotency.d.ts +70 -5
  95. package/dist/middleware/idempotency.d.ts.map +1 -1
  96. package/dist/middleware/idempotency.js +174 -41
  97. package/dist/middleware/idempotency.js.map +1 -1
  98. package/dist/middleware/key-project.d.ts +17 -0
  99. package/dist/middleware/key-project.d.ts.map +1 -0
  100. package/dist/middleware/key-project.js +75 -0
  101. package/dist/middleware/key-project.js.map +1 -0
  102. package/dist/middleware/principal.d.ts.map +1 -1
  103. package/dist/middleware/principal.js +9 -5
  104. package/dist/middleware/principal.js.map +1 -1
  105. package/dist/middleware/project-ref.d.ts.map +1 -1
  106. package/dist/middleware/project-ref.js +3 -0
  107. package/dist/middleware/project-ref.js.map +1 -1
  108. package/dist/openapi/generate.d.ts.map +1 -1
  109. package/dist/openapi/generate.js +5 -2
  110. package/dist/openapi/generate.js.map +1 -1
  111. package/dist/openapi/operations.d.ts.map +1 -1
  112. package/dist/openapi/operations.js +919 -140
  113. package/dist/openapi/operations.js.map +1 -1
  114. package/dist/openapi/schemas.d.ts +90 -13
  115. package/dist/openapi/schemas.d.ts.map +1 -1
  116. package/dist/openapi/schemas.js +2081 -359
  117. package/dist/openapi/schemas.js.map +1 -1
  118. package/dist/person-grants-binding.d.ts +77 -0
  119. package/dist/person-grants-binding.d.ts.map +1 -0
  120. package/dist/person-grants-binding.js +4 -0
  121. package/dist/person-grants-binding.js.map +1 -0
  122. package/dist/proposal-service.d.ts +121 -0
  123. package/dist/proposal-service.d.ts.map +1 -0
  124. package/dist/proposal-service.js +447 -0
  125. package/dist/proposal-service.js.map +1 -0
  126. package/dist/proposal-status.d.ts +60 -0
  127. package/dist/proposal-status.d.ts.map +1 -0
  128. package/dist/proposal-status.js +109 -0
  129. package/dist/proposal-status.js.map +1 -0
  130. package/dist/provider-binding.d.ts +10 -0
  131. package/dist/provider-binding.d.ts.map +1 -1
  132. package/dist/publish-refused.d.ts +28 -3
  133. package/dist/publish-refused.d.ts.map +1 -1
  134. package/dist/publish-refused.js +24 -3
  135. package/dist/publish-refused.js.map +1 -1
  136. package/dist/routes/adapters.d.ts +2 -1
  137. package/dist/routes/adapters.d.ts.map +1 -1
  138. package/dist/routes/adapters.js +3 -1
  139. package/dist/routes/adapters.js.map +1 -1
  140. package/dist/routes/agent-releases.d.ts +55 -3
  141. package/dist/routes/agent-releases.d.ts.map +1 -1
  142. package/dist/routes/agent-releases.js +85 -55
  143. package/dist/routes/agent-releases.js.map +1 -1
  144. package/dist/routes/agents.d.ts +12 -1
  145. package/dist/routes/agents.d.ts.map +1 -1
  146. package/dist/routes/agents.js +100 -2
  147. package/dist/routes/agents.js.map +1 -1
  148. package/dist/routes/approvals.d.ts +15 -3
  149. package/dist/routes/approvals.d.ts.map +1 -1
  150. package/dist/routes/approvals.js +133 -122
  151. package/dist/routes/approvals.js.map +1 -1
  152. package/dist/routes/artifacts.d.ts +25 -3
  153. package/dist/routes/artifacts.d.ts.map +1 -1
  154. package/dist/routes/artifacts.js +116 -7
  155. package/dist/routes/artifacts.js.map +1 -1
  156. package/dist/routes/auth.d.ts +25 -1
  157. package/dist/routes/auth.d.ts.map +1 -1
  158. package/dist/routes/auth.js +655 -281
  159. package/dist/routes/auth.js.map +1 -1
  160. package/dist/routes/blocks.d.ts.map +1 -1
  161. package/dist/routes/blocks.js +2 -42
  162. package/dist/routes/blocks.js.map +1 -1
  163. package/dist/routes/capabilities.d.ts +2 -1
  164. package/dist/routes/capabilities.d.ts.map +1 -1
  165. package/dist/routes/capabilities.js +6 -1
  166. package/dist/routes/capabilities.js.map +1 -1
  167. package/dist/routes/compliance.d.ts +9 -10
  168. package/dist/routes/compliance.d.ts.map +1 -1
  169. package/dist/routes/compliance.js +42 -61
  170. package/dist/routes/compliance.js.map +1 -1
  171. package/dist/routes/conversations.d.ts +8 -1
  172. package/dist/routes/conversations.d.ts.map +1 -1
  173. package/dist/routes/conversations.js +87 -8
  174. package/dist/routes/conversations.js.map +1 -1
  175. package/dist/routes/cost.d.ts +12 -1
  176. package/dist/routes/cost.d.ts.map +1 -1
  177. package/dist/routes/cost.js +74 -3
  178. package/dist/routes/cost.js.map +1 -1
  179. package/dist/routes/denied.d.ts +11 -0
  180. package/dist/routes/denied.d.ts.map +1 -0
  181. package/dist/routes/denied.js +17 -0
  182. package/dist/routes/denied.js.map +1 -0
  183. package/dist/routes/deployments.d.ts +10 -1
  184. package/dist/routes/deployments.d.ts.map +1 -1
  185. package/dist/routes/deployments.js +171 -13
  186. package/dist/routes/deployments.js.map +1 -1
  187. package/dist/routes/eval-comparison.d.ts.map +1 -1
  188. package/dist/routes/eval-comparison.js +69 -1
  189. package/dist/routes/eval-comparison.js.map +1 -1
  190. package/dist/routes/eval-overrides.d.ts +18 -0
  191. package/dist/routes/eval-overrides.d.ts.map +1 -0
  192. package/dist/routes/eval-overrides.js +81 -0
  193. package/dist/routes/eval-overrides.js.map +1 -0
  194. package/dist/routes/eval-runs.d.ts +10 -1
  195. package/dist/routes/eval-runs.d.ts.map +1 -1
  196. package/dist/routes/eval-runs.js +66 -7
  197. package/dist/routes/eval-runs.js.map +1 -1
  198. package/dist/routes/eval-suites.d.ts.map +1 -1
  199. package/dist/routes/eval-suites.js +28 -2
  200. package/dist/routes/eval-suites.js.map +1 -1
  201. package/dist/routes/event-triggers.d.ts +5 -1
  202. package/dist/routes/event-triggers.d.ts.map +1 -1
  203. package/dist/routes/event-triggers.js +26 -3
  204. package/dist/routes/event-triggers.js.map +1 -1
  205. package/dist/routes/export-signing-keys.d.ts +12 -0
  206. package/dist/routes/export-signing-keys.d.ts.map +1 -0
  207. package/dist/routes/export-signing-keys.js +24 -0
  208. package/dist/routes/export-signing-keys.js.map +1 -0
  209. package/dist/routes/flows.d.ts.map +1 -1
  210. package/dist/routes/flows.js +9 -1
  211. package/dist/routes/flows.js.map +1 -1
  212. package/dist/routes/gate-policies.d.ts +4 -1
  213. package/dist/routes/gate-policies.d.ts.map +1 -1
  214. package/dist/routes/gate-policies.js +29 -5
  215. package/dist/routes/gate-policies.js.map +1 -1
  216. package/dist/routes/guardrails.d.ts +16 -14
  217. package/dist/routes/guardrails.d.ts.map +1 -1
  218. package/dist/routes/guardrails.js +39 -3
  219. package/dist/routes/guardrails.js.map +1 -1
  220. package/dist/routes/identity.d.ts +20 -4
  221. package/dist/routes/identity.d.ts.map +1 -1
  222. package/dist/routes/identity.js +246 -6
  223. package/dist/routes/identity.js.map +1 -1
  224. package/dist/routes/improvement-passes.d.ts +52 -0
  225. package/dist/routes/improvement-passes.d.ts.map +1 -0
  226. package/dist/routes/improvement-passes.js +449 -0
  227. package/dist/routes/improvement-passes.js.map +1 -0
  228. package/dist/routes/judged-suites.d.ts +50 -0
  229. package/dist/routes/judged-suites.d.ts.map +1 -1
  230. package/dist/routes/judged-suites.js +66 -27
  231. package/dist/routes/judged-suites.js.map +1 -1
  232. package/dist/routes/judgment-context.d.ts +18 -2
  233. package/dist/routes/judgment-context.d.ts.map +1 -1
  234. package/dist/routes/judgment-context.js +63 -5
  235. package/dist/routes/judgment-context.js.map +1 -1
  236. package/dist/routes/judgment-flow-context.d.ts.map +1 -1
  237. package/dist/routes/judgment-flow-context.js +14 -2
  238. package/dist/routes/judgment-flow-context.js.map +1 -1
  239. package/dist/routes/judgments.d.ts.map +1 -1
  240. package/dist/routes/judgments.js +8 -1
  241. package/dist/routes/judgments.js.map +1 -1
  242. package/dist/routes/mcp.d.ts.map +1 -1
  243. package/dist/routes/mcp.js +26 -1
  244. package/dist/routes/mcp.js.map +1 -1
  245. package/dist/routes/memory-access.d.ts +43 -0
  246. package/dist/routes/memory-access.d.ts.map +1 -0
  247. package/dist/routes/memory-access.js +114 -0
  248. package/dist/routes/memory-access.js.map +1 -0
  249. package/dist/routes/memory-erasures.d.ts +25 -0
  250. package/dist/routes/memory-erasures.d.ts.map +1 -0
  251. package/dist/routes/memory-erasures.js +214 -0
  252. package/dist/routes/memory-erasures.js.map +1 -0
  253. package/dist/routes/memory-parse.d.ts +38 -0
  254. package/dist/routes/memory-parse.d.ts.map +1 -0
  255. package/dist/routes/memory-parse.js +199 -0
  256. package/dist/routes/memory-parse.js.map +1 -0
  257. package/dist/routes/memory.d.ts +9 -4
  258. package/dist/routes/memory.d.ts.map +1 -1
  259. package/dist/routes/memory.js +226 -234
  260. package/dist/routes/memory.js.map +1 -1
  261. package/dist/routes/observations.d.ts +4 -1
  262. package/dist/routes/observations.d.ts.map +1 -1
  263. package/dist/routes/observations.js +8 -2
  264. package/dist/routes/observations.js.map +1 -1
  265. package/dist/routes/pagination.d.ts +7 -0
  266. package/dist/routes/pagination.d.ts.map +1 -1
  267. package/dist/routes/pagination.js +10 -0
  268. package/dist/routes/pagination.js.map +1 -1
  269. package/dist/routes/policies.d.ts +2 -1
  270. package/dist/routes/policies.d.ts.map +1 -1
  271. package/dist/routes/policies.js +3 -1
  272. package/dist/routes/policies.js.map +1 -1
  273. package/dist/routes/project-mismatch.d.ts +22 -0
  274. package/dist/routes/project-mismatch.d.ts.map +1 -0
  275. package/dist/routes/project-mismatch.js +34 -0
  276. package/dist/routes/project-mismatch.js.map +1 -0
  277. package/dist/routes/projects.d.ts +15 -4
  278. package/dist/routes/projects.d.ts.map +1 -1
  279. package/dist/routes/projects.js +100 -9
  280. package/dist/routes/projects.js.map +1 -1
  281. package/dist/routes/proposals.d.ts +25 -17
  282. package/dist/routes/proposals.d.ts.map +1 -1
  283. package/dist/routes/proposals.js +340 -507
  284. package/dist/routes/proposals.js.map +1 -1
  285. package/dist/routes/provenance.d.ts +17 -3
  286. package/dist/routes/provenance.d.ts.map +1 -1
  287. package/dist/routes/provenance.js +79 -103
  288. package/dist/routes/provenance.js.map +1 -1
  289. package/dist/routes/providers.d.ts +17 -1
  290. package/dist/routes/providers.d.ts.map +1 -1
  291. package/dist/routes/providers.js +110 -3
  292. package/dist/routes/providers.js.map +1 -1
  293. package/dist/routes/public-run-tokens.d.ts.map +1 -1
  294. package/dist/routes/public-run-tokens.js +3 -0
  295. package/dist/routes/public-run-tokens.js.map +1 -1
  296. package/dist/routes/readable-projects.d.ts +26 -0
  297. package/dist/routes/readable-projects.d.ts.map +1 -0
  298. package/dist/routes/readable-projects.js +39 -0
  299. package/dist/routes/readable-projects.js.map +1 -0
  300. package/dist/routes/runs.d.ts +10 -0
  301. package/dist/routes/runs.d.ts.map +1 -1
  302. package/dist/routes/runs.js +92 -42
  303. package/dist/routes/runs.js.map +1 -1
  304. package/dist/routes/schedules.d.ts +21 -13
  305. package/dist/routes/schedules.d.ts.map +1 -1
  306. package/dist/routes/schedules.js +416 -55
  307. package/dist/routes/schedules.js.map +1 -1
  308. package/dist/routes/segments.d.ts +2 -0
  309. package/dist/routes/segments.d.ts.map +1 -1
  310. package/dist/routes/segments.js +5 -0
  311. package/dist/routes/segments.js.map +1 -1
  312. package/dist/routes/service-accounts.d.ts +17 -0
  313. package/dist/routes/service-accounts.d.ts.map +1 -0
  314. package/dist/routes/service-accounts.js +212 -0
  315. package/dist/routes/service-accounts.js.map +1 -0
  316. package/dist/routes/sign-in-options.d.ts +50 -0
  317. package/dist/routes/sign-in-options.d.ts.map +1 -0
  318. package/dist/routes/sign-in-options.js +98 -0
  319. package/dist/routes/sign-in-options.js.map +1 -0
  320. package/dist/routes/signing-keys.d.ts +2 -1
  321. package/dist/routes/signing-keys.d.ts.map +1 -1
  322. package/dist/routes/signing-keys.js +3 -1
  323. package/dist/routes/signing-keys.js.map +1 -1
  324. package/dist/routes/tenant-access.d.ts +13 -0
  325. package/dist/routes/tenant-access.d.ts.map +1 -0
  326. package/dist/routes/tenant-access.js +26 -0
  327. package/dist/routes/tenant-access.js.map +1 -0
  328. package/dist/routes/tenant.d.ts.map +1 -1
  329. package/dist/routes/tenant.js +4 -0
  330. package/dist/routes/tenant.js.map +1 -1
  331. package/dist/routes/token-sign-in.d.ts +36 -0
  332. package/dist/routes/token-sign-in.d.ts.map +1 -0
  333. package/dist/routes/token-sign-in.js +101 -0
  334. package/dist/routes/token-sign-in.js.map +1 -0
  335. package/dist/routes/tokens.d.ts +15 -5
  336. package/dist/routes/tokens.d.ts.map +1 -1
  337. package/dist/routes/tokens.js +162 -43
  338. package/dist/routes/tokens.js.map +1 -1
  339. package/dist/routes/tools.d.ts.map +1 -1
  340. package/dist/routes/tools.js +9 -1
  341. package/dist/routes/tools.js.map +1 -1
  342. package/dist/routes/trigger-access.d.ts +29 -0
  343. package/dist/routes/trigger-access.d.ts.map +1 -0
  344. package/dist/routes/trigger-access.js +33 -0
  345. package/dist/routes/trigger-access.js.map +1 -0
  346. package/dist/routes/webhook-endpoints.d.ts +2 -1
  347. package/dist/routes/webhook-endpoints.d.ts.map +1 -1
  348. package/dist/routes/webhook-endpoints.js +11 -3
  349. package/dist/routes/webhook-endpoints.js.map +1 -1
  350. package/dist/routes/webhooks.d.ts +5 -1
  351. package/dist/routes/webhooks.d.ts.map +1 -1
  352. package/dist/routes/webhooks.js +25 -2
  353. package/dist/routes/webhooks.js.map +1 -1
  354. package/dist/run-failure.d.ts +21 -0
  355. package/dist/run-failure.d.ts.map +1 -0
  356. package/dist/run-failure.js +29 -0
  357. package/dist/run-failure.js.map +1 -0
  358. package/dist/service-account-binding.d.ts +108 -0
  359. package/dist/service-account-binding.d.ts.map +1 -0
  360. package/dist/service-account-binding.js +4 -0
  361. package/dist/service-account-binding.js.map +1 -0
  362. package/dist/session-store-binding.d.ts +61 -13
  363. package/dist/session-store-binding.d.ts.map +1 -1
  364. package/dist/signed-export.d.ts +89 -0
  365. package/dist/signed-export.d.ts.map +1 -0
  366. package/dist/signed-export.js +149 -0
  367. package/dist/signed-export.js.map +1 -0
  368. package/dist/supervisor-binding.d.ts +186 -413
  369. package/dist/supervisor-binding.d.ts.map +1 -1
  370. package/dist/testing/app-bindings.d.ts +33 -0
  371. package/dist/testing/app-bindings.d.ts.map +1 -0
  372. package/dist/testing/app-bindings.js +112 -0
  373. package/dist/testing/app-bindings.js.map +1 -0
  374. package/dist/testing/index.d.ts +11 -0
  375. package/dist/testing/index.d.ts.map +1 -0
  376. package/dist/testing/index.js +13 -0
  377. package/dist/testing/index.js.map +1 -0
  378. package/dist/testing/stub-binding.d.ts +34 -0
  379. package/dist/testing/stub-binding.d.ts.map +1 -0
  380. package/dist/testing/stub-binding.js +42 -0
  381. package/dist/testing/stub-binding.js.map +1 -0
  382. package/dist/testing/trigger-registry.d.ts +21 -0
  383. package/dist/testing/trigger-registry.d.ts.map +1 -0
  384. package/dist/testing/trigger-registry.js +206 -0
  385. package/dist/testing/trigger-registry.js.map +1 -0
  386. package/dist/token-admin.d.ts +46 -8
  387. package/dist/token-admin.d.ts.map +1 -1
  388. package/dist/token-admin.js.map +1 -1
  389. package/dist/tool-binding.d.ts +13 -0
  390. package/dist/tool-binding.d.ts.map +1 -1
  391. package/dist/trigger-binding.d.ts +2 -2
  392. package/dist/trigger-binding.d.ts.map +1 -1
  393. package/dist/trigger-binding.js +1 -1
  394. package/dist/trigger-binding.js.map +1 -1
  395. package/dist/types.d.ts +16 -0
  396. package/dist/types.d.ts.map +1 -1
  397. package/dist/webhook-endpoint-binding.d.ts +19 -3
  398. package/dist/webhook-endpoint-binding.d.ts.map +1 -1
  399. package/dist/webhook-endpoint-binding.js +1 -1
  400. package/dist/webhook-endpoint-binding.js.map +1 -1
  401. package/openapi.json +15387 -8789
  402. package/package.json +26 -22
  403. package/src/agent-binding.ts +14 -0
  404. package/src/agent-pins.ts +18 -2
  405. package/src/app.ts +366 -80
  406. package/src/block-publish.ts +181 -0
  407. package/src/caller.ts +62 -0
  408. package/src/capability-binding.ts +12 -0
  409. package/src/cost-binding.ts +19 -0
  410. package/src/derive-agent-version.ts +9 -1
  411. package/src/errors.ts +75 -7
  412. package/src/eval-case-binding.ts +17 -1
  413. package/src/eval-run-binding.ts +31 -0
  414. package/src/eval-run-dispatcher.ts +7 -0
  415. package/src/eval-sample.ts +42 -0
  416. package/src/eval-suite-binding.ts +14 -0
  417. package/src/flow-binding.ts +19 -0
  418. package/src/flow-pins.ts +18 -2
  419. package/src/gate.ts +26 -0
  420. package/src/handler-binding.ts +36 -1
  421. package/src/hitl-binding.ts +24 -0
  422. package/src/identity-directory-binding.ts +85 -4
  423. package/src/identity-provider-binding.ts +216 -21
  424. package/src/improvement-pass-binding.ts +193 -0
  425. package/src/index.ts +153 -31
  426. package/src/judged-dispatcher.ts +78 -11
  427. package/src/judgment-binding.ts +25 -1
  428. package/src/mcp-endpoint-binding.ts +7 -0
  429. package/src/memory-binding.ts +121 -17
  430. package/src/memory-erasure-binding.ts +156 -0
  431. package/src/middleware/auth.ts +228 -62
  432. package/src/middleware/authorize.ts +155 -3
  433. package/src/middleware/error-mapper.ts +15 -1
  434. package/src/middleware/idempotency.ts +230 -43
  435. package/src/middleware/key-project.ts +86 -0
  436. package/src/middleware/principal.ts +9 -5
  437. package/src/middleware/project-ref.ts +3 -0
  438. package/src/openapi/generate.ts +11 -2
  439. package/src/openapi/operations.ts +1060 -143
  440. package/src/openapi/schemas.ts +2387 -469
  441. package/src/person-grants-binding.ts +76 -0
  442. package/src/proposal-service.ts +640 -0
  443. package/src/proposal-status.ts +176 -0
  444. package/src/provider-binding.ts +10 -0
  445. package/src/publish-refused.ts +56 -9
  446. package/src/routes/adapters.ts +4 -0
  447. package/src/routes/agent-releases.ts +121 -69
  448. package/src/routes/agents.ts +128 -1
  449. package/src/routes/approvals.ts +164 -154
  450. package/src/routes/artifacts.ts +181 -11
  451. package/src/routes/auth.ts +804 -336
  452. package/src/routes/blocks.ts +2 -53
  453. package/src/routes/capabilities.ts +10 -1
  454. package/src/routes/compliance.ts +60 -99
  455. package/src/routes/conversations.ts +101 -7
  456. package/src/routes/cost.ts +110 -4
  457. package/src/routes/denied.ts +28 -0
  458. package/src/routes/deployments.ts +210 -17
  459. package/src/routes/eval-comparison.ts +81 -2
  460. package/src/routes/eval-overrides.ts +108 -0
  461. package/src/routes/eval-runs.ts +89 -6
  462. package/src/routes/eval-suites.ts +32 -2
  463. package/src/routes/event-triggers.ts +27 -3
  464. package/src/routes/export-signing-keys.ts +31 -0
  465. package/src/routes/flows.ts +12 -1
  466. package/src/routes/gate-policies.ts +37 -6
  467. package/src/routes/guardrails.ts +61 -2
  468. package/src/routes/identity.ts +328 -10
  469. package/src/routes/improvement-passes.ts +541 -0
  470. package/src/routes/judged-suites.ts +113 -43
  471. package/src/routes/judgment-context.ts +76 -5
  472. package/src/routes/judgment-flow-context.ts +16 -2
  473. package/src/routes/judgments.ts +17 -3
  474. package/src/routes/mcp.ts +29 -1
  475. package/src/routes/memory-access.ts +160 -0
  476. package/src/routes/memory-erasures.ts +240 -0
  477. package/src/routes/memory-parse.ts +250 -0
  478. package/src/routes/memory.ts +244 -286
  479. package/src/routes/observations.ts +15 -2
  480. package/src/routes/pagination.ts +12 -0
  481. package/src/routes/policies.ts +7 -1
  482. package/src/routes/project-mismatch.ts +56 -0
  483. package/src/routes/projects.ts +107 -13
  484. package/src/routes/proposals.ts +370 -611
  485. package/src/routes/provenance.ts +99 -133
  486. package/src/routes/providers.ts +142 -3
  487. package/src/routes/public-run-tokens.ts +3 -0
  488. package/src/routes/readable-projects.ts +66 -0
  489. package/src/routes/runs.ts +119 -39
  490. package/src/routes/schedules.ts +472 -60
  491. package/src/routes/segments.ts +11 -0
  492. package/src/routes/service-accounts.ts +262 -0
  493. package/src/routes/sign-in-options.ts +168 -0
  494. package/src/routes/signing-keys.ts +7 -1
  495. package/src/routes/tenant-access.ts +37 -0
  496. package/src/routes/tenant.ts +6 -0
  497. package/src/routes/token-sign-in.ts +161 -0
  498. package/src/routes/tokens.ts +172 -46
  499. package/src/routes/tools.ts +12 -1
  500. package/src/routes/trigger-access.ts +72 -0
  501. package/src/routes/webhook-endpoints.ts +15 -3
  502. package/src/routes/webhooks.ts +26 -2
  503. package/src/run-failure.ts +42 -0
  504. package/src/service-account-binding.ts +113 -0
  505. package/src/session-store-binding.ts +65 -13
  506. package/src/signed-export.ts +250 -0
  507. package/src/supervisor-binding.ts +169 -409
  508. package/src/testing/app-bindings.ts +142 -0
  509. package/src/testing/index.ts +21 -0
  510. package/src/testing/stub-binding.ts +53 -0
  511. package/src/testing/trigger-registry.ts +259 -0
  512. package/src/token-admin.ts +40 -8
  513. package/src/tool-binding.ts +14 -0
  514. package/src/trigger-binding.ts +8 -1
  515. package/src/types.ts +16 -0
  516. package/src/webhook-endpoint-binding.ts +18 -3
@@ -145,6 +145,29 @@ export const RunAgentSchema = {
145
145
  },
146
146
  },
147
147
  };
148
+ /**
149
+ * The trigger that started a run. A component of its own, so generated
150
+ * clients name it `RunTrigger`.
151
+ */
152
+ export const RunTriggerSchema = {
153
+ type: 'object',
154
+ additionalProperties: false,
155
+ required: ['triggerId', 'kind', 'fireId'],
156
+ description: 'Set on a run a trigger started (a schedule, an event trigger or an inbound webhook): the trigger and the fire that started it. Absent on other runs.',
157
+ properties: {
158
+ triggerId: { type: 'string', format: 'uuid' },
159
+ kind: { type: 'string', enum: ['schedule', 'event', 'webhook'] },
160
+ fireId: {
161
+ type: 'string',
162
+ description: "The fire that started the run: one entry of the trigger's fire history.",
163
+ },
164
+ scheduledFor: {
165
+ type: 'string',
166
+ format: 'date-time',
167
+ description: "A schedule's fire: the occurrence the run is for.",
168
+ },
169
+ },
170
+ };
148
171
  export const ScopeSegmentSchema = {
149
172
  type: 'object',
150
173
  additionalProperties: false,
@@ -517,6 +540,19 @@ export const UnpinBodySchema = {
517
540
  reason: { type: 'string', maxLength: 2000 },
518
541
  },
519
542
  };
543
+ export const RunFailureSchema = {
544
+ type: 'object',
545
+ additionalProperties: false,
546
+ required: ['code', 'message'],
547
+ description: "Why a failed run failed; present only on a `failed` run. An agent turn's failure carries its own code (`budget-exceeded`, `capability-routing-failed`, `model-invocation-failed`, …); any other failure is `run-failed`, with the run's failure message.",
548
+ properties: {
549
+ code: { type: 'string' },
550
+ message: { type: 'string' },
551
+ cause: {
552
+ description: "What the error came from, when it says: e.g. for `capability-routing-failed`, the router's `capability-unsatisfiable` with its reasons, by provider.",
553
+ },
554
+ },
555
+ };
520
556
  export const RunSchema = {
521
557
  type: 'object',
522
558
  additionalProperties: false,
@@ -541,10 +577,19 @@ export const RunSchema = {
541
577
  createdAt: { type: 'string', format: 'date-time' },
542
578
  updatedAt: { type: 'string', format: 'date-time' },
543
579
  completedAt: { type: 'string', format: 'date-time' },
544
- failureMessage: { type: 'string' },
580
+ failureMessage: {
581
+ type: 'string',
582
+ description: 'The failure as the runtime recorded it. Read `failure` instead: an agent turn records its typed error here in an internal form.',
583
+ },
584
+ failure: { $ref: '#/components/schemas/RunFailure' },
545
585
  output: {
546
586
  description: "The run's output once it completed. Present on single-run responses; on lists only with `?include=output`.",
547
587
  },
588
+ contentErasedAt: {
589
+ type: 'string',
590
+ format: 'date-time',
591
+ description: "When an erasure cleared the run's content (its input, output, failure message and journal payloads): a person's words were erased. Structure (status, times, ids) stays.",
592
+ },
548
593
  parentRunId: {
549
594
  type: 'string',
550
595
  format: 'uuid',
@@ -555,6 +600,7 @@ export const RunSchema = {
555
600
  description: 'Set on a child run: the node in the parent run that started it.',
556
601
  },
557
602
  agent: { $ref: '#/components/schemas/RunAgent' },
603
+ trigger: { $ref: '#/components/schemas/RunTrigger' },
558
604
  replayOf: {
559
605
  type: 'string',
560
606
  format: 'uuid',
@@ -803,7 +849,17 @@ export const RunProgressEventSchema = {
803
849
  const ApiTokenRoleSchema = {
804
850
  type: 'string',
805
851
  enum: ['admin', 'member'],
806
- description: "The key's role in its tenant: `admin` administers the tenant (and manages keys); `member` belongs to it and administers nothing.",
852
+ description: "The most the key may do, under its principal's grants: an `admin` key may administer the tenant when its principal is a tenant admin; a `member` key takes no admin action on the tenant, whoever it's for; below it, its principal's roles hold (a project admin's member key administers that project).",
853
+ };
854
+ export const ApiKeyPrincipalSchema = {
855
+ type: 'object',
856
+ additionalProperties: false,
857
+ required: ['kind', 'id'],
858
+ description: 'Whom an API key acts for: a person, or a service account.',
859
+ properties: {
860
+ kind: { type: 'string', enum: ['user', 'service-account'] },
861
+ id: { type: 'string', minLength: 1, description: 'The user id, or the service account id.' },
862
+ },
807
863
  };
808
864
  const ApiTokenCapabilitiesSchema = {
809
865
  type: 'array',
@@ -813,10 +869,12 @@ const ApiTokenCapabilitiesSchema = {
813
869
  export const MintTokenBodySchema = {
814
870
  type: 'object',
815
871
  additionalProperties: false,
872
+ description: 'A new API key. `for` is whom it acts for: the caller by default; only a tenant admin mints for someone else.',
816
873
  properties: {
874
+ for: { $ref: '#/components/schemas/ApiKeyPrincipal' },
817
875
  role: {
818
876
  ...ApiTokenRoleSchema,
819
- description: `${ApiTokenRoleSchema.description} Default \`member\`.`,
877
+ description: `${ApiTokenRoleSchema.description} Default \`member\`; \`admin\` needs a tenant admin minting it.`,
820
878
  },
821
879
  capabilities: {
822
880
  ...ApiTokenCapabilitiesSchema,
@@ -824,23 +882,32 @@ export const MintTokenBodySchema = {
824
882
  },
825
883
  label: { type: 'string', description: 'Optional human-readable label.' },
826
884
  expiresAt: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp.' },
827
- projectId: { type: 'string', format: 'uuid' },
885
+ projectId: {
886
+ type: 'string',
887
+ format: 'uuid',
888
+ description: 'Limit the key to this project: a request naming another project is refused (`key-project-mismatch`). A key limited to a project mints only keys limited to it.',
889
+ },
828
890
  },
829
891
  };
830
892
  export const ApiTokenSchema = {
831
893
  type: 'object',
832
894
  additionalProperties: false,
833
- description: 'An API key: a service account in its tenant. Never includes the secret.',
895
+ description: 'An API key. Never includes the secret. `principal` is whom it acts for; absent on a key that is a service account of its own (`service_account:<tokenId>`), as keys minted before principals are.',
834
896
  required: ['tokenId', 'role', 'capabilities', 'createdAt'],
835
897
  properties: {
836
898
  tokenId: { type: 'string', format: 'uuid' },
899
+ principal: { $ref: '#/components/schemas/ApiKeyPrincipal' },
837
900
  role: ApiTokenRoleSchema,
838
901
  capabilities: ApiTokenCapabilitiesSchema,
839
902
  label: { type: 'string' },
840
- projectId: { type: 'string', format: 'uuid' },
903
+ projectId: {
904
+ type: 'string',
905
+ format: 'uuid',
906
+ description: 'The project the key is limited to.',
907
+ },
841
908
  createdBy: {
842
909
  type: 'string',
843
- description: 'Who minted it: `user:<id>` or `service_account:<tokenId>`.',
910
+ description: 'Who minted it: `user:<id>` or `service_account:<id>`.',
844
911
  },
845
912
  createdAt: { type: 'string', format: 'date-time' },
846
913
  expiresAt: { type: 'string', format: 'date-time' },
@@ -882,6 +949,119 @@ export const ApiTokenPageSchema = {
882
949
  hasMore: { type: 'boolean' },
883
950
  },
884
951
  };
952
+ // ---------------- service accounts ----------------
953
+ export const ServiceAccountGrantTenantAdminSchema = {
954
+ type: 'object',
955
+ additionalProperties: false,
956
+ required: ['kind'],
957
+ description: 'Tenant admin.',
958
+ properties: { kind: { type: 'string', enum: ['tenant-admin'] } },
959
+ };
960
+ export const ServiceAccountGrantTenantMemberSchema = {
961
+ type: 'object',
962
+ additionalProperties: false,
963
+ required: ['kind'],
964
+ description: "Tenant member: read the tenant's settings (providers, policies, adapters, signing keys, deployments), not its projects. A service account has it only when granted; a person has it from being added.",
965
+ properties: { kind: { type: 'string', enum: ['tenant-member'] } },
966
+ };
967
+ export const ServiceAccountGrantProjectSchema = {
968
+ type: 'object',
969
+ additionalProperties: false,
970
+ required: ['kind', 'projectId', 'role'],
971
+ description: "A role on one project; it replaces the account's role there.",
972
+ properties: {
973
+ kind: { type: 'string', enum: ['project'] },
974
+ projectId: { type: 'string', format: 'uuid' },
975
+ role: { $ref: '#/components/schemas/ProjectRole' },
976
+ },
977
+ };
978
+ export const ServiceAccountGrantSchema = {
979
+ description: "What a service account may do: tenant admin, tenant member (read the tenant's settings), or a role on one project.",
980
+ oneOf: [
981
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantAdmin' },
982
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantMember' },
983
+ { $ref: '#/components/schemas/ServiceAccountGrantProject' },
984
+ ],
985
+ discriminator: { propertyName: 'kind' },
986
+ };
987
+ export const ServiceAccountGrantBodySchema = {
988
+ description: 'The grant to add: tenant admin, tenant member, or a role on one project.',
989
+ oneOf: [
990
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantAdmin' },
991
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantMember' },
992
+ { $ref: '#/components/schemas/ServiceAccountGrantProject' },
993
+ ],
994
+ discriminator: { propertyName: 'kind' },
995
+ };
996
+ export const ServiceAccountUngrantProjectSchema = {
997
+ type: 'object',
998
+ additionalProperties: false,
999
+ required: ['kind', 'projectId'],
1000
+ description: 'Whatever role the account has on one project.',
1001
+ properties: {
1002
+ kind: { type: 'string', enum: ['project'] },
1003
+ projectId: { type: 'string', format: 'uuid' },
1004
+ },
1005
+ };
1006
+ export const ServiceAccountUngrantBodySchema = {
1007
+ description: 'The grant to remove: tenant admin, tenant member, or the role on a project.',
1008
+ oneOf: [
1009
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantAdmin' },
1010
+ { $ref: '#/components/schemas/ServiceAccountGrantTenantMember' },
1011
+ { $ref: '#/components/schemas/ServiceAccountUngrantProject' },
1012
+ ],
1013
+ discriminator: { propertyName: 'kind' },
1014
+ };
1015
+ export const ServiceAccountSchema = {
1016
+ type: 'object',
1017
+ additionalProperties: false,
1018
+ description: 'A named, non-human principal (`service_account:<id>`) for an app, a pipeline or a schedule. It acts through API keys minted for it.',
1019
+ required: ['serviceAccountId', 'name', 'grants', 'createdAt'],
1020
+ properties: {
1021
+ serviceAccountId: { type: 'string' },
1022
+ name: { type: 'string', description: "Unique among the tenant's active accounts." },
1023
+ description: { type: 'string' },
1024
+ grants: { type: 'array', items: { $ref: '#/components/schemas/ServiceAccountGrant' } },
1025
+ createdBy: {
1026
+ type: 'string',
1027
+ description: 'Who created it: `user:<id>` or `service_account:<id>`.',
1028
+ },
1029
+ createdAt: { type: 'string', format: 'date-time' },
1030
+ unregisteredAt: {
1031
+ type: 'string',
1032
+ format: 'date-time',
1033
+ description: 'Set once unregistered: it has no grants, and its keys no longer work.',
1034
+ },
1035
+ },
1036
+ };
1037
+ export const ServiceAccountPageSchema = {
1038
+ type: 'object',
1039
+ additionalProperties: false,
1040
+ required: ['data', 'hasMore'],
1041
+ properties: {
1042
+ data: { type: 'array', items: { $ref: '#/components/schemas/ServiceAccount' } },
1043
+ hasMore: { type: 'boolean' },
1044
+ nextCursor: { type: 'string' },
1045
+ },
1046
+ };
1047
+ export const CreateServiceAccountBodySchema = {
1048
+ type: 'object',
1049
+ additionalProperties: false,
1050
+ required: ['name'],
1051
+ properties: {
1052
+ name: {
1053
+ type: 'string',
1054
+ pattern: '^[a-z0-9][a-z0-9-]{0,62}$',
1055
+ description: 'Lowercase letters, digits and hyphens, e.g. `acme-ci`.',
1056
+ },
1057
+ description: { type: 'string', maxLength: 500 },
1058
+ grants: {
1059
+ type: 'array',
1060
+ items: { $ref: '#/components/schemas/ServiceAccountGrant' },
1061
+ description: 'Written before the account is returned, so its first key works at once.',
1062
+ },
1063
+ },
1064
+ };
885
1065
  // ---------------- HITL (approvals) ----------------
886
1066
  export const ReviewerRoleSchema = {
887
1067
  type: 'string',
@@ -1054,67 +1234,131 @@ export const UnregisterReviewerResultSchema = {
1054
1234
  unregistered: { type: 'boolean', const: true },
1055
1235
  },
1056
1236
  };
1057
- export const ExportAuditBundleBodySchema = {
1058
- description: "Body for `POST /v1/approvals/{approvalId}/audit-bundle`. `signingKeyId` selects the Ed25519 key from the deployment's `signingKey` binding. `includeMessages` optionally hydrates conversation messages tied to the approval's run.",
1237
+ // ---------------- signed exports: one envelope ----------------
1238
+ const SIGNING_KEY_ID_PROPERTY = {
1239
+ type: 'string',
1240
+ minLength: 1,
1241
+ description: "Optional: sign with this key, one of `GET /v1/export-signing-keys`. Leave it out to sign with the deployment's active key. A key the deployment doesn't sign with is `404 signing-key-not-found`.",
1242
+ };
1243
+ /**
1244
+ * The envelope every signed export answers (an audit bundle, a run's
1245
+ * provenance, compliance evidence): the same fields, so one verifier
1246
+ * reads all three. Only the subject field differs.
1247
+ */
1248
+ function signedExportEnvelope(input) {
1249
+ const [subjectKey, subjectSchema] = input.subject;
1250
+ return {
1251
+ description: input.description,
1252
+ type: 'object',
1253
+ additionalProperties: false,
1254
+ required: [
1255
+ subjectKey,
1256
+ 'bundle',
1257
+ 'bundleSchemaVersion',
1258
+ 'algorithm',
1259
+ 'signingKeyId',
1260
+ 'signature',
1261
+ 'publicKey',
1262
+ 'canonicalization',
1263
+ 'exportedAt',
1264
+ ],
1265
+ properties: {
1266
+ [subjectKey]: subjectSchema,
1267
+ kind: {
1268
+ type: 'string',
1269
+ const: input.kind,
1270
+ description: 'Which export this is: `audit-bundle`, `provenance` or `compliance`. Absent from older servers.',
1271
+ },
1272
+ bundle: {
1273
+ type: 'string',
1274
+ description: 'Base64 of the exact bytes that were signed: the body, as sorted-key JSON with no whitespace. Verify these bytes; nothing needs re-serializing.',
1275
+ },
1276
+ bundleSchemaVersion: { type: 'string', description: input.versionDescription },
1277
+ algorithm: {
1278
+ type: 'string',
1279
+ enum: ['ed25519', 'ecdsa-p256-sha256'],
1280
+ description: "The signing key's algorithm. `ecdsa-p256-sha256` signatures are IEEE P1363 `r‖s`. A verifier refuses an algorithm it doesn't know.",
1281
+ },
1282
+ signingKeyId: {
1283
+ type: 'string',
1284
+ description: 'The key that signed it: one of `GET /v1/export-signing-keys`.',
1285
+ },
1286
+ signature: {
1287
+ type: 'string',
1288
+ description: "Base64 of the 64-byte signature over the `bundle` bytes: Ed25519's, or ECDSA P-256's as IEEE P1363 `r‖s`.",
1289
+ },
1290
+ publicKey: {
1291
+ type: 'string',
1292
+ description: "The signing key's public half, PEM SPKI. On its own it only proves the bytes weren't changed; check it against `GET /v1/export-signing-keys` (or a key you pinned) to know who signed them.",
1293
+ },
1294
+ canonicalization: {
1295
+ type: 'string',
1296
+ const: 'sorted-key-json',
1297
+ description: 'Sorted-key JSON, no whitespace (`canonicalize` in `@kindgi/schema`).',
1298
+ },
1299
+ exportedAt: {
1300
+ type: 'string',
1301
+ format: 'date-time',
1302
+ description: "When it was signed: the same instant as the signed body's `exportedAt`.",
1303
+ },
1304
+ },
1305
+ };
1306
+ }
1307
+ export const ExportSigningKeySchema = {
1308
+ description: 'A public key this deployment signs exports with.',
1059
1309
  type: 'object',
1060
1310
  additionalProperties: false,
1061
- required: ['signingKeyId'],
1311
+ required: ['keyId', 'algorithm', 'publicKeyPem', 'fingerprint', 'active'],
1062
1312
  properties: {
1063
- signingKeyId: {
1313
+ keyId: {
1064
1314
  type: 'string',
1065
- minLength: 1,
1066
- description: 'The `SigningKeyId` the deployment plugs into its `signingKey` binding. Server looks up the private key via `signingKey.getPrivateKey(signingKeyId)` — 404 if unknown.',
1315
+ description: 'Derived from the public key (`ex_` and 16 base64url characters), so the same key keeps its id.',
1067
1316
  },
1068
- includeMessages: {
1069
- type: 'boolean',
1070
- description: "When true, hydrates conversation messages tied to the approval's run (agent turns pin `runId === conversationId`). Empty array for non-agent runs — field always present when requested.",
1071
- default: false,
1317
+ algorithm: {
1318
+ type: 'string',
1319
+ enum: ['ed25519', 'ecdsa-p256-sha256'],
1320
+ description: 'An Ed25519 key signs `ed25519`; an EC P-256 key (a KMS without Ed25519) signs `ecdsa-p256-sha256`.',
1321
+ },
1322
+ publicKeyPem: { type: 'string', description: 'PEM SPKI.' },
1323
+ fingerprint: {
1324
+ type: 'string',
1325
+ pattern: '^sha256:[0-9a-f]{64}$',
1326
+ description: '`sha256:` and the hex SHA-256 of the raw public key: to pin it, or compare by eye.',
1072
1327
  },
1328
+ active: { type: 'boolean', description: 'Whether new exports are signed with it.' },
1073
1329
  },
1074
1330
  };
1075
- export const ExportAuditBundleResultSchema = {
1076
- description: 'Signed exportable audit bundle. Same envelope shape as `ExportProvenanceResult` — clients can reuse the same `verifyEd25519` wrapper for both. `bundle` is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace). Bundle body: `{ bundleVersion, approvalId, tenantId, subjectKind, subjectRef, requiredRole, status, decision, decidedAt?, evidence: { guardrailResults?, messages? }, createdAt, exportedAt }`.',
1331
+ export const ExportSigningKeyListSchema = {
1077
1332
  type: 'object',
1078
1333
  additionalProperties: false,
1079
- required: [
1080
- 'approvalId',
1081
- 'bundle',
1082
- 'bundleSchemaVersion',
1083
- 'algorithm',
1084
- 'signingKeyId',
1085
- 'signature',
1086
- 'publicKey',
1087
- 'canonicalization',
1088
- 'exportedAt',
1089
- ],
1334
+ required: ['data'],
1090
1335
  properties: {
1091
- approvalId: { type: 'string', format: 'uuid' },
1092
- bundle: {
1093
- type: 'string',
1094
- description: 'Base64-encoded canonical JSON of the bundle body.',
1095
- },
1096
- bundleSchemaVersion: {
1097
- type: 'integer',
1098
- description: 'Integer schema version for the bundle body shape. Currently `1`.',
1099
- },
1100
- algorithm: { type: 'string', const: 'ed25519' },
1101
- signingKeyId: { type: 'string' },
1102
- signature: {
1103
- type: 'string',
1104
- description: 'Base64-encoded Ed25519 signature over `bundle` (after base64-decode).',
1105
- },
1106
- publicKey: {
1107
- type: 'string',
1108
- description: 'PEM-encoded Ed25519 public key (DER SPKI envelope). Pass into `parsePublicKeyPem` for verification.',
1336
+ data: {
1337
+ type: 'array',
1338
+ items: { $ref: '#/components/schemas/ExportSigningKey' },
1339
+ description: "Active first. Empty when the deployment doesn't sign exports.",
1109
1340
  },
1110
- canonicalization: {
1111
- type: 'string',
1112
- const: 'sorted-key-json',
1113
- description: 'Canonicalization algorithm — sorted-key JSON, no whitespace. Same algorithm as `canonicalize`.',
1341
+ },
1342
+ };
1343
+ export const ExportAuditBundleBodySchema = {
1344
+ description: "Body for `POST /v1/approvals/{approvalId}/audit-bundle`, optional: no body signs with the active key. `includeMessages` adds the conversation messages of the approval's run.",
1345
+ type: 'object',
1346
+ additionalProperties: false,
1347
+ properties: {
1348
+ signingKeyId: SIGNING_KEY_ID_PROPERTY,
1349
+ includeMessages: {
1350
+ type: 'boolean',
1351
+ description: "When true, hydrates conversation messages tied to the approval's run (agent turns pin `runId === conversationId`). Empty array for non-agent runs — field always present when requested.",
1352
+ default: false,
1114
1353
  },
1115
- exportedAt: { type: 'string', format: 'date-time' },
1116
1354
  },
1117
1355
  };
1356
+ export const ExportAuditBundleResultSchema = signedExportEnvelope({
1357
+ description: "A decided approval's signed audit bundle. Body: `{ bundleSchemaVersion, approvalId, tenantId, subjectKind, subjectRef, requiredRole, status, createdAt, decidedAt?, decision, evidence: { guardrailResults?, messages? }, exportedAt }`.",
1358
+ kind: 'audit-bundle',
1359
+ subject: ['approvalId', { type: 'string', format: 'uuid' }],
1360
+ versionDescription: "The body's version, semver. `2.0.0`: a string like the other exports' (it was the integer `1`), named `bundleSchemaVersion` in the body too, with `exportedAt` signed once.",
1361
+ });
1118
1362
  export const CompleteApprovalResultSchema = {
1119
1363
  type: 'object',
1120
1364
  additionalProperties: false,
@@ -1172,12 +1416,74 @@ export const PromptParameterSchema = {
1172
1416
  export const RetrievalIntentSchema = {
1173
1417
  type: 'object',
1174
1418
  additionalProperties: false,
1175
- required: ['types', 'scope'],
1419
+ required: ['scope'],
1176
1420
  properties: {
1177
- types: { type: 'array', items: { type: 'string' }, minItems: 1 },
1178
- scope: { type: 'string', enum: ['same-conversation', 'same-project', 'tenant'] },
1421
+ source: {
1422
+ type: 'string',
1423
+ enum: ['facts', 'conversations'],
1424
+ description: "What it reads: facts (the default), or messages of this agent's earlier conversations, quoted in the turn's `<memory>` block as earlier conversation, never as turns.",
1425
+ },
1426
+ types: {
1427
+ type: 'array',
1428
+ items: { type: 'string' },
1429
+ minItems: 1,
1430
+ description: 'The fact types it retrieves: required for facts; not used for conversations.',
1431
+ },
1432
+ roles: {
1433
+ type: 'array',
1434
+ items: { type: 'string', enum: ['user', 'agent'] },
1435
+ minItems: 1,
1436
+ uniqueItems: true,
1437
+ description: "For conversations: whose messages it recalls. Default `['user']`, the people's own words. Adding `agent` recalls the agent's earlier answers too, which can carry its mistakes: they are quoted as unverified earlier answers, and publishing warns `recall-agent-answers`.",
1438
+ },
1439
+ scope: {
1440
+ type: 'string',
1441
+ enum: ['same-conversation', 'same-user', 'same-segment', 'same-project', 'tenant'],
1442
+ description: "What the intent selects within what the run may see. Facts: this conversation's; the run's end user's only (`same-user`: none when the run names no `participantId`); the run's project's (none without a project); or every fact of the type it may see (`tenant`). Conversations: this end user's other conversations with the agent (`same-user`: none when the run names no `participantId`); this conversation's messages older than the history window (`same-conversation`); conversations in the run's segment path (`same-segment`) or its project (`same-project`), whoever had them: those two quote other people's conversations, so publishing warns and their messages are marked as another person's. `same-segment` is for conversations only, `tenant` for facts only.",
1443
+ },
1179
1444
  limit: { type: 'integer', minimum: 1 },
1180
- mode: { type: 'string', enum: ['keyword', 'semantic', 'both'] },
1445
+ mode: {
1446
+ type: 'string',
1447
+ enum: ['keyword', 'semantic', 'both'],
1448
+ description: "With the user's message as the query: full-text, by meaning (fails the turn with `semantic-unavailable` on a runtime without embeddings), or both fused by rank (without embeddings, the keyword half). Absent: the newest facts.",
1449
+ },
1450
+ },
1451
+ };
1452
+ export const AgentMemoryPolicySchema = {
1453
+ type: 'object',
1454
+ additionalProperties: false,
1455
+ description: 'How the agent uses what it retrieves.',
1456
+ properties: {
1457
+ instructionTypes: {
1458
+ type: 'array',
1459
+ items: { type: 'string', minLength: 1 },
1460
+ description: "Fact types that are instructions for this agent: a retrieved, verified fact of one of these types goes into the system message under 'Policies (verified)'. Default: none.",
1461
+ },
1462
+ remember: {
1463
+ type: 'object',
1464
+ additionalProperties: false,
1465
+ required: ['types', 'scope'],
1466
+ description: 'Lets the agent remember: its turns offer the built-in tool `kindgi_remember` (built-in tools are `kindgi_<verb>`; an agent cannot list one in `tools`, and a published tool cannot use the prefix). The model picks the type, the text (up to 2,000 characters), an optional slot `key` and when it stops being true; the scope comes from here and the run. Every remembered fact is `unverified`, attributed to the agent version and the call that wrote it, and expires after `keepDays` unless a person verifies it. A person approves it before any read sees it when the scope is wider than one person (`same-project`, `tenant`) or the text reads like an instruction.',
1467
+ properties: {
1468
+ types: {
1469
+ type: 'array',
1470
+ minItems: 1,
1471
+ items: { type: 'string', minLength: 1 },
1472
+ description: 'The fact types it may write.',
1473
+ },
1474
+ scope: {
1475
+ type: 'string',
1476
+ enum: ['same-user', 'same-conversation', 'same-project', 'tenant'],
1477
+ description: "Where its facts go: the conversation's end user (else the user the run acts for), the conversation, the run's project, or the tenant. Each but `tenant` includes the run's project.",
1478
+ },
1479
+ keepDays: {
1480
+ type: 'integer',
1481
+ minimum: 1,
1482
+ maximum: 3650,
1483
+ description: 'Days an unverified fact is kept. Default 30.',
1484
+ },
1485
+ },
1486
+ },
1181
1487
  },
1182
1488
  };
1183
1489
  export const ConversationPolicySchema = {
@@ -1299,6 +1605,7 @@ export const AgentSchema = {
1299
1605
  capabilities: { type: 'array', items: { $ref: '#/components/schemas/Capability' } },
1300
1606
  tools: { type: 'array', items: { $ref: '#/components/schemas/ToolRef' } },
1301
1607
  retrieval: { type: 'array', items: { $ref: '#/components/schemas/RetrievalIntent' } },
1608
+ memory: { $ref: '#/components/schemas/AgentMemoryPolicy' },
1302
1609
  guardrails: { type: 'array', items: { type: 'string' } },
1303
1610
  preferredProvider: {
1304
1611
  type: 'string',
@@ -1343,6 +1650,10 @@ export const VersionDerivationSchema = {
1343
1650
  },
1344
1651
  label: { type: 'string', description: 'For `edited`: a short label for the version.' },
1345
1652
  by: { type: 'string', description: 'For `edited`: who derived it (`user:<id>`).' },
1653
+ proposalId: {
1654
+ type: 'string',
1655
+ description: 'For `edited`: the improvement proposal it was derived for. Such a version serves no scope until a promotion makes it live.',
1656
+ },
1346
1657
  },
1347
1658
  };
1348
1659
  export const DeriveAgentVersionBodySchema = {
@@ -1443,6 +1754,7 @@ export const PublishAgentBodySchema = {
1443
1754
  capabilities: { type: 'array', items: { $ref: '#/components/schemas/Capability' } },
1444
1755
  tools: { type: 'array', items: { $ref: '#/components/schemas/ToolRef' } },
1445
1756
  retrieval: { type: 'array', items: { $ref: '#/components/schemas/RetrievalIntent' } },
1757
+ memory: { $ref: '#/components/schemas/AgentMemoryPolicy' },
1446
1758
  guardrails: { type: 'array', items: { type: 'string' } },
1447
1759
  preferredProvider: {
1448
1760
  type: 'string',
@@ -1468,6 +1780,16 @@ export const PublishAgentResultSchema = {
1468
1780
  properties: {
1469
1781
  agentId: { type: 'string' },
1470
1782
  version: { type: 'string' },
1783
+ warnings: {
1784
+ type: 'array',
1785
+ description: "What the agent should know about this deployment before its first turn, e.g. `semantic-unavailable` (a retrieval intent searches by meaning and the deployment has no embeddings), `remember-unavailable` (the agent remembers and the deployment cannot store agent memories), `recall-other-people` (an intent recalls conversations in the run's segment or project, whoever had them) or `recall-unavailable` (the deployment cannot recall earlier conversations).",
1786
+ items: {
1787
+ type: 'object',
1788
+ additionalProperties: false,
1789
+ required: ['code', 'message'],
1790
+ properties: { code: { type: 'string' }, message: { type: 'string' } },
1791
+ },
1792
+ },
1471
1793
  },
1472
1794
  };
1473
1795
  export const UnregisterAgentResultSchema = {
@@ -2138,6 +2460,11 @@ export const ConversationSchema = {
2138
2460
  status: ConversationStatusSchema,
2139
2461
  openedAt: { type: 'string', format: 'date-time' },
2140
2462
  closedAt: { type: 'string', format: 'date-time' },
2463
+ unregisteredAt: {
2464
+ type: 'string',
2465
+ format: 'date-time',
2466
+ description: 'When it was unregistered (`POST /v1/conversations/{conversationId}/unregister`). Only the unregister call returns it: reads no longer do.',
2467
+ },
2141
2468
  turnCount: { type: 'integer', minimum: 0 },
2142
2469
  lastMessageAt: { type: 'string', format: 'date-time' },
2143
2470
  metadata: { type: 'object', additionalProperties: true },
@@ -2520,7 +2847,7 @@ export const JudgmentSchema = {
2520
2847
  export const JudgedRunContextSchema = {
2521
2848
  type: 'object',
2522
2849
  additionalProperties: false,
2523
- 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.',
2850
+ 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. For both: the env values its tools were sent.',
2524
2851
  properties: {
2525
2852
  history: {
2526
2853
  type: 'array',
@@ -2532,6 +2859,9 @@ export const JudgedRunContextSchema = {
2532
2859
  description: 'Whether older messages were left out of `history`.',
2533
2860
  },
2534
2861
  retrieved: { description: "What the turn's retrievals returned." },
2862
+ recalled: {
2863
+ description: 'Messages of earlier conversations the turn recalled (intents over conversations), as quoted to the model.',
2864
+ },
2535
2865
  sessionApproval: {
2536
2866
  type: 'object',
2537
2867
  additionalProperties: false,
@@ -2583,12 +2913,20 @@ export const JudgedRunContextSchema = {
2583
2913
  agentId: { type: 'string' },
2584
2914
  agentVersion: { type: 'string' },
2585
2915
  retrieved: { description: "What the step's turn retrieved." },
2916
+ recalled: {
2917
+ description: "Messages of earlier conversations the step's turn recalled.",
2918
+ },
2586
2919
  },
2587
2920
  },
2588
2921
  },
2589
2922
  truncated: { type: 'boolean', description: 'More calls were made than were kept.' },
2590
2923
  },
2591
2924
  },
2925
+ toolEnv: {
2926
+ type: 'object',
2927
+ additionalProperties: { type: 'object', additionalProperties: { type: 'string' } },
2928
+ description: "The env values each tool's calls were sent (`needsSpec.env`), by tool id: its first call's, as the run recorded them. A replay sends them to a read-only tool it runs live, so the tool reads the config the run saw, not today's. Absent for a run from before env was recorded.",
2929
+ },
2592
2930
  },
2593
2931
  };
2594
2932
  export const JudgedRunCopySchema = {
@@ -2604,6 +2942,11 @@ export const JudgedRunCopySchema = {
2604
2942
  $ref: '#/components/schemas/JudgedRunContext',
2605
2943
  },
2606
2944
  output: {},
2945
+ segments: {
2946
+ type: 'array',
2947
+ items: { $ref: '#/components/schemas/ScopeSegment' },
2948
+ description: 'The segment path the run was started with (empty: none). Absent for runs judged before it was recorded.',
2949
+ },
2607
2950
  capturedAt: { type: 'string', format: 'date-time' },
2608
2951
  },
2609
2952
  };
@@ -2696,6 +3039,12 @@ export const JudgedItemSummarySchema = {
2696
3039
  properties: {
2697
3040
  verdict: { type: 'string', enum: ['yes', 'no'] },
2698
3041
  reason: { type: 'string' },
3042
+ judgeClassId: { type: 'string', description: "The judgment's class, when it had one." },
3043
+ restricted: {
3044
+ type: 'boolean',
3045
+ enum: [true],
3046
+ description: 'Set when the judgment was recorded while its class was restricted (`Judgment.restricted`).',
3047
+ },
2699
3048
  },
2700
3049
  },
2701
3050
  },
@@ -2713,6 +3062,11 @@ export const JudgedEvalCaseSchema = {
2713
3062
  context: { $ref: '#/components/schemas/JudgedRunContext' },
2714
3063
  output: {},
2715
3064
  items: { type: 'array', items: { $ref: '#/components/schemas/JudgedItemSummary' } },
3065
+ erased: {
3066
+ type: 'boolean',
3067
+ const: true,
3068
+ description: "An erasure cleared this case (a person's words were erased): `input` and `output` are null, `items` empty, and eval runs leave it out (counted as `erased`).",
3069
+ },
2716
3070
  },
2717
3071
  };
2718
3072
  export const JudgedEvalCaseCollectionPageSchema = {
@@ -2756,6 +3110,11 @@ export const BuildJudgedSuiteBodySchema = {
2756
3110
  minimum: 1,
2757
3111
  description: 'Leave out runs with fewer counted judgments. Default 1.',
2758
3112
  },
3113
+ segments: {
3114
+ type: 'array',
3115
+ items: { $ref: '#/components/schemas/ScopeSegment' },
3116
+ description: "Only runs started in this segment path or below it, coarse to fine (e.g. `company=acme`). A run judged before its segments were recorded with its judgments is in no segment, so it's left out.",
3117
+ },
2759
3118
  description: { type: 'string' },
2760
3119
  },
2761
3120
  };
@@ -2779,7 +3138,7 @@ export const FactScopeSchema = {
2779
3138
  type: 'object',
2780
3139
  additionalProperties: true,
2781
3140
  required: ['tenantId'],
2782
- description: 'Fact scope object. `tenantId` is required; every optional key narrows the fact (`userId`, `orgId`, `projectId`, `threadId`, `sessionId`). Additional keys accepted for forward compatibility.',
3141
+ description: 'Fact scope object. `tenantId` is required; every optional key narrows the fact (`userId`, `orgId`, `projectId`, `threadId`, `sessionId`, `participantId`). A fact is readable by whoever has every container it names. Additional keys accepted for forward compatibility.',
2783
3142
  properties: {
2784
3143
  tenantId: { type: 'string' },
2785
3144
  userId: { type: 'string' },
@@ -2787,6 +3146,43 @@ export const FactScopeSchema = {
2787
3146
  projectId: { type: 'string' },
2788
3147
  threadId: { type: 'string' },
2789
3148
  sessionId: { type: 'string' },
3149
+ participantId: {
3150
+ type: 'string',
3151
+ minLength: 1,
3152
+ description: "An app's end user, by the app's own id: a fact private to that participant's runs. Needs `projectId`.",
3153
+ },
3154
+ },
3155
+ };
3156
+ export const FactSubjectSchema = {
3157
+ description: 'Whom a fact is about: what access and erasure requests by person find.',
3158
+ type: 'object',
3159
+ additionalProperties: false,
3160
+ required: ['kind', 'id'],
3161
+ properties: {
3162
+ kind: { type: 'string', enum: ['participant', 'user', 'external'] },
3163
+ id: { type: 'string', minLength: 1 },
3164
+ },
3165
+ };
3166
+ export const FactAttributionSchema = {
3167
+ description: 'Who asserted a fact, set by the server from the writer.',
3168
+ type: 'object',
3169
+ additionalProperties: false,
3170
+ required: ['kind', 'id'],
3171
+ properties: {
3172
+ kind: { type: 'string', enum: ['user', 'service', 'agent'] },
3173
+ id: { type: 'string' },
3174
+ agentVersion: { type: 'string' },
3175
+ },
3176
+ };
3177
+ export const FactGeneratedBySchema = {
3178
+ description: 'The run step that wrote a fact, for one an agent wrote.',
3179
+ type: 'object',
3180
+ additionalProperties: false,
3181
+ required: ['runId'],
3182
+ properties: {
3183
+ runId: { type: 'string' },
3184
+ stepId: { type: 'string' },
3185
+ toolCallId: { type: 'string' },
2790
3186
  },
2791
3187
  };
2792
3188
  export const RetentionSchema = {
@@ -2837,16 +3233,23 @@ export const FactSchema = {
2837
3233
  additionalProperties: false,
2838
3234
  required: ['id', 'type', 'scope', 'version', 'createdAt'],
2839
3235
  properties: {
2840
- id: { type: 'string', description: 'FactId.' },
2841
- type: {
3236
+ id: {
2842
3237
  type: 'string',
2843
- description: 'Fact type identifier (pack-defined; a few are framework-standard).',
3238
+ description: 'The fact id, kept across revisions (for a fact never superseded, also its one revision id).',
3239
+ },
3240
+ revisionId: {
3241
+ type: 'string',
3242
+ description: "This revision's own id; absent where it equals `id`.",
3243
+ },
3244
+ type: {
3245
+ type: 'string',
3246
+ description: 'Fact type identifier (pack-defined; a few are framework-standard).',
2844
3247
  },
2845
3248
  scope: { $ref: '#/components/schemas/FactScope' },
2846
3249
  version: {
2847
3250
  type: 'integer',
2848
3251
  minimum: 1,
2849
- description: 'Monotonic version within (scope, id). Supersession increments.',
3252
+ description: 'The revision number within the fact: 1, then one more per supersede or verify.',
2850
3253
  },
2851
3254
  createdAt: { type: 'string', format: 'date-time' },
2852
3255
  updatedAt: { type: 'string', format: 'date-time' },
@@ -2863,7 +3266,60 @@ export const FactSchema = {
2863
3266
  causedByLogId: { type: 'array', items: { type: 'string' } },
2864
3267
  supersedes: {
2865
3268
  type: 'string',
2866
- description: 'FactId of the predecessor when this row supersedes another.',
3269
+ description: 'The revision this one replaced.',
3270
+ },
3271
+ trust: {
3272
+ type: 'string',
3273
+ enum: ['verified', 'asserted', 'unverified'],
3274
+ description: '`verified`: a person with the right checked it. `asserted`: an app or a person wrote it. `unverified`: an agent remembered it during a conversation. Absent on facts from before trust was recorded: `asserted`.',
3275
+ },
3276
+ verifiedBy: { type: 'string' },
3277
+ verifiedAt: { type: 'string', format: 'date-time' },
3278
+ attributedTo: { $ref: '#/components/schemas/FactAttribution' },
3279
+ generatedBy: { $ref: '#/components/schemas/FactGeneratedBy' },
3280
+ subjects: { type: 'array', items: { $ref: '#/components/schemas/FactSubject' } },
3281
+ validFrom: {
3282
+ type: 'string',
3283
+ format: 'date-time',
3284
+ description: 'When the fact starts being true in the world; absent: always.',
3285
+ },
3286
+ validUntil: {
3287
+ type: 'string',
3288
+ format: 'date-time',
3289
+ description: 'When the fact stops being true in the world; absent: still true.',
3290
+ },
3291
+ observedAt: { type: 'string', format: 'date-time', description: 'When it was said or seen.' },
3292
+ invalidatedAt: {
3293
+ type: 'string',
3294
+ format: 'date-time',
3295
+ description: 'When this revision stopped being current; absent: it is current.',
3296
+ },
3297
+ invalidatedBy: { type: 'string', description: '`user:<id>` or `service:<id>`.' },
3298
+ invalidationReason: {
3299
+ type: 'string',
3300
+ enum: ['superseded', 'deleted', 'erased', 'expired'],
3301
+ },
3302
+ review: {
3303
+ type: 'string',
3304
+ enum: ['pending'],
3305
+ description: '`pending` while a person must approve it: a pending fact is never retrieved.',
3306
+ },
3307
+ expiresAt: {
3308
+ type: 'string',
3309
+ format: 'date-time',
3310
+ description: "When this revision stops being readable: from its retention (`keepUntil`, or `keepDays` from the fact's first write), or an agent-remembered fact's unverified window. No read returns it after; absent: it doesn't expire.",
3311
+ },
3312
+ },
3313
+ };
3314
+ export const FactRevisionListSchema = {
3315
+ type: 'object',
3316
+ additionalProperties: false,
3317
+ required: ['data'],
3318
+ properties: {
3319
+ data: {
3320
+ type: 'array',
3321
+ items: { $ref: '#/components/schemas/Fact' },
3322
+ description: 'Every revision, newest first.',
2867
3323
  },
2868
3324
  },
2869
3325
  };
@@ -2881,7 +3337,7 @@ export const FactCollectionPageSchema = {
2881
3337
  },
2882
3338
  };
2883
3339
  export const WriteFactBodySchema = {
2884
- 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).",
3340
+ 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). `subjects` names whom it is about; `validFrom`/`validUntil` when it is true in the world; `observedAt` when it was said or seen.",
2885
3341
  type: 'object',
2886
3342
  additionalProperties: false,
2887
3343
  required: ['type', 'scope', 'content'],
@@ -2891,19 +3347,44 @@ export const WriteFactBodySchema = {
2891
3347
  content: { description: 'Free-form structured payload.' },
2892
3348
  retention: { $ref: '#/components/schemas/Retention' },
2893
3349
  contentHash: { type: 'string' },
3350
+ subjects: {
3351
+ type: 'array',
3352
+ maxItems: 20,
3353
+ items: { $ref: '#/components/schemas/FactSubject' },
3354
+ },
3355
+ validFrom: { type: 'string', format: 'date-time' },
3356
+ validUntil: { type: 'string', format: 'date-time' },
3357
+ observedAt: { type: 'string', format: 'date-time' },
2894
3358
  },
2895
3359
  };
2896
- export const SupersedeFactResultSchema = {
3360
+ export const SupersedeFactBodySchema = {
3361
+ description: "The fact's next revision: new `content`, and optionally new `retention`, `subjects` and times (absent ones keep their current values). Its scope and type stay. `expectVersion`: only if the current revision is still this one.",
2897
3362
  type: 'object',
2898
3363
  additionalProperties: false,
2899
- required: ['factId', 'superseded'],
3364
+ required: ['content'],
2900
3365
  properties: {
2901
- factId: { type: 'string' },
2902
- superseded: { type: 'boolean', const: true },
3366
+ content: { description: 'Free-form structured payload.' },
3367
+ expectVersion: { type: 'integer', minimum: 1 },
3368
+ retention: { $ref: '#/components/schemas/Retention' },
3369
+ subjects: {
3370
+ type: 'array',
3371
+ maxItems: 20,
3372
+ items: { $ref: '#/components/schemas/FactSubject' },
3373
+ },
3374
+ validFrom: { type: 'string', format: 'date-time' },
3375
+ validUntil: { type: 'string', format: 'date-time' },
3376
+ observedAt: { type: 'string', format: 'date-time' },
3377
+ },
3378
+ };
3379
+ export const VerifyFactBodySchema = {
3380
+ type: 'object',
3381
+ additionalProperties: false,
3382
+ properties: {
3383
+ expectVersion: { type: 'integer', minimum: 1 },
2903
3384
  },
2904
3385
  };
2905
3386
  export const RetrieveIntentSchema = {
2906
- 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.',
3387
+ description: 'Retrieval intent — mirrors `RetrievalIntent` from `@kindgi/agents`, widened for direct-HTTP use. `mode: "list"` returns a plain scoped list (no query), newest first. `mode: "keyword"` runs full-text search. `mode: "semantic"` searches by meaning — it needs embeddings on the deployment; without them the route answers `422 semantic-unavailable`. `mode: "both"` runs both and fuses them by rank (reciprocal rank fusion), as `semantic` needing embeddings.',
2907
3388
  type: 'object',
2908
3389
  additionalProperties: false,
2909
3390
  required: ['mode'],
@@ -2928,7 +3409,7 @@ export const RetrievalHitSchema = {
2928
3409
  fact: { $ref: '#/components/schemas/Fact' },
2929
3410
  score: {
2930
3411
  type: 'number',
2931
- 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.',
3412
+ description: 'Relevance score. Keyword mode returns an implementation-defined rank (higher = better). Semantic mode returns cosine similarity in [-1, 1] (higher = better). Both: the fused rank score, `Σ 1/(60 + rank)` (higher = better). Absent for `list` mode.',
2932
3413
  },
2933
3414
  },
2934
3415
  };
@@ -2940,6 +3421,246 @@ export const RetrieveMemoryResultSchema = {
2940
3421
  results: { type: 'array', items: { $ref: '#/components/schemas/RetrievalHit' } },
2941
3422
  },
2942
3423
  };
3424
+ // ---------------- memory erasures ----------------
3425
+ const ErasureSelectorKindSchema = {
3426
+ type: 'string',
3427
+ enum: ['fact', 'participant', 'external', 'conversation'],
3428
+ };
3429
+ const ErasureStatusSchema = {
3430
+ type: 'string',
3431
+ enum: ['pending', 'running', 'waiting-on-run', 'completed', 'failed'],
3432
+ description: "`waiting-on-run`: a turn of the person's sits in a flow that serves other people; the erasure waits for it (`waitingOn`) until its deadline, then cancels it.",
3433
+ };
3434
+ /** Erase one fact. */
3435
+ export const MemoryErasureFactSelectorSchema = {
3436
+ type: 'object',
3437
+ additionalProperties: false,
3438
+ required: ['factId'],
3439
+ description: 'One fact.',
3440
+ properties: { factId: { type: 'string', minLength: 1, maxLength: 256 } },
3441
+ };
3442
+ /** Erase a person's words. */
3443
+ export const MemoryErasureSubjectSelectorSchema = {
3444
+ type: 'object',
3445
+ additionalProperties: false,
3446
+ required: ['subject'],
3447
+ description: "A person: an app's end user (`participant`), or an `external` subject facts name. Erasing a Kindgi user isn't offered.",
3448
+ properties: {
3449
+ subject: {
3450
+ type: 'object',
3451
+ additionalProperties: false,
3452
+ required: ['kind', 'id'],
3453
+ properties: {
3454
+ kind: { type: 'string', enum: ['participant', 'external'] },
3455
+ id: { type: 'string', minLength: 1, maxLength: 256 },
3456
+ },
3457
+ },
3458
+ },
3459
+ };
3460
+ /** Erase one conversation. */
3461
+ export const MemoryErasureConversationSelectorSchema = {
3462
+ type: 'object',
3463
+ additionalProperties: false,
3464
+ required: ['conversationId'],
3465
+ description: 'One conversation.',
3466
+ properties: { conversationId: { type: 'string', minLength: 1, maxLength: 256 } },
3467
+ };
3468
+ const MEMORY_ERASURE_SELECTORS = [
3469
+ { $ref: '#/components/schemas/MemoryErasureFactSelector' },
3470
+ { $ref: '#/components/schemas/MemoryErasureSubjectSelector' },
3471
+ { $ref: '#/components/schemas/MemoryErasureConversationSelector' },
3472
+ ];
3473
+ /** Whose words to erase: exactly one of a fact, a person or a conversation. */
3474
+ export const MemoryErasureSelectorSchema = {
3475
+ description: "Whose words to erase: one fact (`factId`), a person (`subject`: an app's end user `participant`, or an `external` subject facts name), or one conversation (`conversationId`).",
3476
+ oneOf: MEMORY_ERASURE_SELECTORS,
3477
+ };
3478
+ // Its own schema, used only as the request body: `MemoryErasure` names
3479
+ // `MemoryErasureSelector` too, and a union other schemas name gets inlined
3480
+ // away by the Python generator (as `RegisterIdentityProviderBody`).
3481
+ export const CreateMemoryErasureBodySchema = {
3482
+ description: "Whose words to erase: one fact (`factId`), a person (`subject`: an app's end user `participant`, or an `external` subject facts name), or one conversation (`conversationId`).",
3483
+ oneOf: MEMORY_ERASURE_SELECTORS,
3484
+ };
3485
+ export const MemoryErasureSchema = {
3486
+ type: 'object',
3487
+ additionalProperties: false,
3488
+ required: [
3489
+ 'id',
3490
+ 'selectorKind',
3491
+ 'status',
3492
+ 'phase',
3493
+ 'requestedBy',
3494
+ 'matchable',
3495
+ 'counts',
3496
+ 'attempts',
3497
+ 'createdAt',
3498
+ ],
3499
+ properties: {
3500
+ id: { type: 'string', format: 'uuid' },
3501
+ selectorKind: ErasureSelectorKindSchema,
3502
+ selector: {
3503
+ $ref: '#/components/schemas/MemoryErasureSelector',
3504
+ description: 'Only while it runs: a completed or failed erasure keeps no identifier.',
3505
+ },
3506
+ status: ErasureStatusSchema,
3507
+ phase: {
3508
+ type: 'string',
3509
+ enum: ['seed', 'expand', 'settle', 'erase', 'done'],
3510
+ description: "Where a running erasure is: `seed`, `expand`, `settle` (the person's unfinished runs end, or it waits for them, before anything is cleared), `erase`, then `done`.",
3511
+ },
3512
+ requestedBy: { type: 'string', description: '`user:<id>` or `service:<id>`.' },
3513
+ matchable: {
3514
+ type: 'boolean',
3515
+ description: 'A replay after a backup restore can find this person again: a keyed hash was kept.',
3516
+ },
3517
+ counts: {
3518
+ type: 'object',
3519
+ additionalProperties: { type: 'integer', minimum: 0 },
3520
+ description: 'What each store cleared or deleted, by store.',
3521
+ },
3522
+ attempts: { type: 'integer', minimum: 0, description: 'Failed attempts so far.' },
3523
+ lastError: {
3524
+ type: 'string',
3525
+ description: "The last failure's code, or `not-yet:<reason>` while it waits. Never content.",
3526
+ },
3527
+ waitingOn: {
3528
+ type: 'object',
3529
+ additionalProperties: false,
3530
+ required: ['runId'],
3531
+ properties: {
3532
+ runId: { type: 'string', format: 'uuid' },
3533
+ until: { type: 'string', format: 'date-time' },
3534
+ },
3535
+ description: 'The run it waits (or waited) for, and until when; kept as the record of the wait.',
3536
+ },
3537
+ forced: { type: 'boolean', const: true, description: 'A tenant admin said not to wait.' },
3538
+ settleRoundsCapped: {
3539
+ type: 'boolean',
3540
+ const: true,
3541
+ description: "Runs of the person's kept appearing, round after round: the erasure went on to erase after its last round rather than wait any longer. Absent: it didn't.",
3542
+ },
3543
+ createdAt: { type: 'string', format: 'date-time' },
3544
+ startedAt: { type: 'string', format: 'date-time' },
3545
+ completedAt: { type: 'string', format: 'date-time' },
3546
+ replayedAt: { type: 'string', format: 'date-time' },
3547
+ },
3548
+ };
3549
+ export const ResumeMemoryErasureBodySchema = {
3550
+ type: 'object',
3551
+ additionalProperties: false,
3552
+ properties: {
3553
+ force: {
3554
+ type: 'boolean',
3555
+ description: "Stop waiting for a run in a flow that serves other people: it's cancelled, and the erasure goes on.",
3556
+ },
3557
+ },
3558
+ };
3559
+ export const MemoryErasureCreatedSchema = {
3560
+ allOf: [
3561
+ { $ref: '#/components/schemas/MemoryErasure' },
3562
+ {
3563
+ type: 'object',
3564
+ properties: {
3565
+ warnings: {
3566
+ type: 'array',
3567
+ items: {
3568
+ type: 'object',
3569
+ additionalProperties: false,
3570
+ required: ['code', 'message'],
3571
+ properties: {
3572
+ code: {
3573
+ type: 'string',
3574
+ enum: ['erasure-unmatchable'],
3575
+ description: "`erasure-unmatchable`: this deployment has no erasure ledger key (`KINDGI_ERASURE_LEDGER_KEY`), so a replay after a restore can't find this person.",
3576
+ },
3577
+ message: { type: 'string' },
3578
+ },
3579
+ },
3580
+ },
3581
+ },
3582
+ },
3583
+ ],
3584
+ };
3585
+ export const MemoryErasurePageSchema = {
3586
+ type: 'object',
3587
+ additionalProperties: false,
3588
+ required: ['data', 'hasMore'],
3589
+ properties: {
3590
+ data: { type: 'array', items: { $ref: '#/components/schemas/MemoryErasure' } },
3591
+ hasMore: { type: 'boolean' },
3592
+ nextCursor: { type: 'string' },
3593
+ },
3594
+ };
3595
+ export const MemoryErasureLedgerEntrySchema = {
3596
+ type: 'object',
3597
+ additionalProperties: false,
3598
+ required: ['id', 'selectorKind', 'requestedBy', 'status', 'createdAt'],
3599
+ properties: {
3600
+ id: { type: 'string', format: 'uuid' },
3601
+ selectorKind: ErasureSelectorKindSchema,
3602
+ selectorHmac: {
3603
+ type: 'string',
3604
+ pattern: '^[0-9a-f]{64}$',
3605
+ description: "HMAC-SHA256 of the selector under the tenant's ledger key; absent without one.",
3606
+ },
3607
+ keyId: { type: 'string', description: 'Which ledger key made `selectorHmac`.' },
3608
+ requestedBy: { type: 'string' },
3609
+ status: ErasureStatusSchema,
3610
+ createdAt: { type: 'string', format: 'date-time' },
3611
+ completedAt: { type: 'string', format: 'date-time' },
3612
+ },
3613
+ };
3614
+ export const MemoryErasureLedgerSchema = {
3615
+ type: 'object',
3616
+ additionalProperties: false,
3617
+ required: ['data'],
3618
+ properties: {
3619
+ data: { type: 'array', items: { $ref: '#/components/schemas/MemoryErasureLedgerEntry' } },
3620
+ },
3621
+ };
3622
+ export const ReplayMemoryErasuresBodySchema = {
3623
+ type: 'object',
3624
+ additionalProperties: false,
3625
+ required: ['erasures'],
3626
+ properties: {
3627
+ erasures: {
3628
+ type: 'array',
3629
+ maxItems: 10_000,
3630
+ items: { $ref: '#/components/schemas/MemoryErasureLedgerEntry' },
3631
+ description: 'The ledger as `GET /v1/memory/erasures/export` gave it.',
3632
+ },
3633
+ },
3634
+ };
3635
+ export const ReplayMemoryErasuresResultSchema = {
3636
+ type: 'object',
3637
+ additionalProperties: false,
3638
+ required: ['replayed', 'restored', 'unmatched'],
3639
+ properties: {
3640
+ replayed: {
3641
+ type: 'array',
3642
+ items: { type: 'string', format: 'uuid' },
3643
+ description: 'Found in the tenant again: run again.',
3644
+ },
3645
+ restored: {
3646
+ type: 'array',
3647
+ items: { type: 'string', format: 'uuid' },
3648
+ description: 'Put back in the ledger; nothing in the tenant matches.',
3649
+ },
3650
+ unmatched: {
3651
+ type: 'array',
3652
+ items: {
3653
+ type: 'object',
3654
+ additionalProperties: false,
3655
+ required: ['id', 'reason'],
3656
+ properties: {
3657
+ id: { type: 'string', format: 'uuid' },
3658
+ reason: { type: 'string', enum: ['no-keyed-hash', 'unknown-key'] },
3659
+ },
3660
+ },
3661
+ },
3662
+ },
3663
+ };
2943
3664
  export const RevokeTokenResultSchema = {
2944
3665
  type: 'object',
2945
3666
  additionalProperties: false,
@@ -3016,248 +3737,476 @@ export const RevokeSigningKeyResultSchema = {
3016
3737
  },
3017
3738
  },
3018
3739
  };
3019
- // ---------------- supervisor (fix proposals) ----------------
3740
+ // ---------------- improvement proposals ----------------
3020
3741
  export const ProposalTierSchema = {
3021
3742
  type: 'string',
3022
- enum: ['prompt', 'retrieval', 'tool-config'],
3743
+ enum: ['settings-block', 'prompt-block'],
3744
+ description: 'What a proposal changes: a settings block (new values) or a prompt block (a new template) the agent version pins.',
3023
3745
  };
3024
3746
  export const FixProposalStatusSchema = {
3025
3747
  type: 'string',
3026
3748
  enum: [
3027
3749
  'draft',
3028
- 'dry-running',
3029
- 'dry-run-passed',
3030
- 'dry-run-failed',
3031
- 'proposed-for-review',
3032
- 'approved',
3750
+ 'evaluating',
3751
+ 'evaluated',
3752
+ 'not-better',
3753
+ 'evaluation-failed',
3754
+ 'in-review',
3755
+ 'promoted',
3756
+ 'refused',
3033
3757
  'rejected',
3034
- 'applied',
3758
+ 'expired',
3759
+ 'superseded',
3035
3760
  'rolled-back',
3036
3761
  'withdrawn',
3037
3762
  ],
3763
+ description: "Where a proposal stands, from its comparison and its promotion (never stored). `draft`: not evaluated yet. `evaluating`: its comparison is queued or running. `evaluated`: the candidate beat the recorded outputs on the objective metric by more than the noise (the spread, with more than one repetition). `not-better`: it didn't. `evaluation-failed`: the comparison failed or was cancelled. `in-review`: requested; the gate passed and an approval is open. `promoted`: live for the scope (`promotion.liveNow` says whether it still serves it). `refused`: the gate refused it. `rejected`: the reviewer rejected it. `expired`: the approval expired undecided. `superseded`: approved after the scope's live version or policy changed. `rolled-back`: rolled back through the proposal. `withdrawn`: withdrawn.",
3038
3764
  };
3039
- export const PatternRefSchema = {
3765
+ export const ProposalChangeSchema = {
3040
3766
  type: 'object',
3041
3767
  additionalProperties: false,
3042
- required: ['kind', 'key', 'count', 'firstSeenAt', 'lastSeenAt', 'sampleConversations'],
3768
+ required: ['blockId', 'fromVersion', 'content'],
3043
3769
  properties: {
3044
- kind: {
3770
+ blockId: { type: 'string', description: 'The data block the change is to.' },
3771
+ fromVersion: {
3045
3772
  type: 'string',
3046
- enum: ['guardrail-violation', 'tool-error', 'budget-exceeded', 'model-error', 'aborted'],
3773
+ description: "The block version the agent version pins: what's being changed.",
3047
3774
  },
3048
- key: { type: 'string' },
3049
- count: { type: 'integer', minimum: 1 },
3050
- firstSeenAt: { type: 'string', format: 'date-time' },
3051
- lastSeenAt: { type: 'string', format: 'date-time' },
3052
- sampleConversations: {
3053
- type: 'array',
3054
- items: { type: 'string', format: 'uuid' },
3775
+ content: {
3776
+ type: 'object',
3777
+ description: 'The new content: `{ values }` for a settings block (its schema carries over), `{ template }` for a prompt block (its parameters carry over).',
3778
+ additionalProperties: false,
3779
+ properties: {
3780
+ values: { type: 'object', additionalProperties: true },
3781
+ template: { type: 'string' },
3782
+ },
3055
3783
  },
3056
3784
  },
3057
3785
  };
3058
- export const ProposedChangeSchema = {
3059
- description: 'Polymorphic change payload. Shape depends on the sibling `tier` on the proposal (prompt / retrieval / tool-config).',
3786
+ export const ProposalDrafterSchema = {
3060
3787
  type: 'object',
3061
- additionalProperties: true,
3788
+ additionalProperties: false,
3789
+ required: ['kind'],
3790
+ description: "Who wrote the proposal: a person, or one of the runtime's drafters.",
3791
+ properties: {
3792
+ kind: { type: 'string', enum: ['person', 'settings-optimizer', 'prompt-drafter'] },
3793
+ by: { type: 'string', description: 'For a person: `user:<id>` (or `service:<id>`).' },
3794
+ version: { type: 'string', description: "For a drafter: the drafter's version." },
3795
+ model: {
3796
+ type: 'object',
3797
+ additionalProperties: false,
3798
+ required: ['providerId', 'model'],
3799
+ description: 'For a drafter that used a model: which.',
3800
+ properties: { providerId: { type: 'string' }, model: { type: 'string' } },
3801
+ },
3802
+ passId: {
3803
+ type: 'string',
3804
+ description: 'For a drafter: the improvement pass that drafted it (`GET /v1/improvement-passes/{passId}`).',
3805
+ },
3806
+ },
3062
3807
  };
3063
- export const FixProposalSchema = {
3808
+ export const ProposalCandidateSchema = {
3064
3809
  type: 'object',
3065
3810
  additionalProperties: false,
3066
- required: [
3067
- 'id',
3068
- 'tenantId',
3069
- 'supervisorId',
3070
- 'agentId',
3071
- 'agentVersion',
3072
- 'tier',
3073
- 'change',
3074
- 'patternRefs',
3075
- 'hypothesis',
3076
- 'proposerRuleId',
3077
- 'status',
3078
- 'fingerprint',
3079
- 'createdAt',
3080
- 'updatedAt',
3081
- ],
3811
+ required: ['agentVersion', 'blockVersion', 'pinsDigest'],
3812
+ description: 'The versions evaluating the proposal published. They serve no scope until a promotion makes the agent version live.',
3082
3813
  properties: {
3083
- id: { type: 'string', format: 'uuid', description: 'FixProposalId.' },
3084
- tenantId: { type: 'string', format: 'uuid' },
3085
- supervisorId: { type: 'string' },
3086
- agentId: { type: 'string' },
3087
- agentVersion: { type: 'string', description: 'Semver of the baseline agent version.' },
3088
- tier: ProposalTierSchema,
3089
- change: ProposedChangeSchema,
3090
- patternRefs: {
3091
- type: 'array',
3092
- items: { $ref: '#/components/schemas/PatternRef' },
3093
- },
3094
- hypothesis: { type: 'string' },
3095
- proposerRuleId: { type: 'string' },
3096
- status: FixProposalStatusSchema,
3097
- fingerprint: {
3814
+ agentVersion: {
3098
3815
  type: 'string',
3099
- description: 'sha256(tier + agentId + agentVersion + canonical(change)). Dedup key.',
3816
+ description: 'The derived agent version (its `derivedFrom.proposalId` names the proposal).',
3100
3817
  },
3101
- resolutionReason: { type: 'string' },
3102
- reviewApprovalId: {
3818
+ blockVersion: {
3103
3819
  type: 'string',
3104
- format: 'uuid',
3105
- description: 'HITL approval id created when the proposal was submitted for review.',
3820
+ description: "The block version published from the proposal's content.",
3106
3821
  },
3107
- appliedVersion: {
3822
+ pinsDigest: { type: 'string' },
3823
+ },
3824
+ };
3825
+ export const ProposalEvaluationSchema = {
3826
+ type: 'object',
3827
+ additionalProperties: false,
3828
+ required: ['evalRunId', 'suiteId', 'objective', 'startedAt'],
3829
+ description: "The comparison the proposal was evaluated with, and what it found on the objective metric (the full summary is the eval run's).",
3830
+ properties: {
3831
+ evalRunId: { type: 'string', format: 'uuid' },
3832
+ suiteId: { type: 'string', description: 'The test set (a judged eval suite).' },
3833
+ objective: { type: 'string', enum: ['weightedYesShare', 'weightedPrecisionAtK'] },
3834
+ startedAt: { type: 'string', format: 'date-time' },
3835
+ runStatus: {
3108
3836
  type: 'string',
3109
- description: 'Semver of the new agent version the proposal materialized as. Present on `applied` and `rolled-back` proposals.',
3837
+ enum: ['pending', 'running', 'completed', 'failed', 'cancelled'],
3838
+ description: "The eval run's status. Absent when the run can't be read.",
3110
3839
  },
3111
- appliedAt: { type: 'string', format: 'date-time' },
3112
- rolledBackAt: { type: 'string', format: 'date-time' },
3113
- createdAt: { type: 'string', format: 'date-time' },
3114
- updatedAt: { type: 'string', format: 'date-time' },
3115
- resolvedAt: { type: 'string', format: 'date-time' },
3840
+ baseline: {
3841
+ type: ['number', 'null'],
3842
+ description: "The recorded outputs' score; `null` without judged evidence.",
3843
+ },
3844
+ candidate: { type: ['number', 'null'], description: "The candidate's score." },
3845
+ delta: { type: ['number', 'null'] },
3846
+ spread: {
3847
+ type: 'number',
3848
+ description: "With more than one repetition: the candidate's max − min, the noise a delta must beat.",
3849
+ },
3850
+ cases: { type: 'integer' },
3851
+ better: { type: 'boolean', description: 'Set once the comparison finished.' },
3116
3852
  },
3117
3853
  };
3118
- export const FixProposalCollectionPageSchema = {
3854
+ export const ProposalPromotionSchema = {
3119
3855
  type: 'object',
3120
3856
  additionalProperties: false,
3121
- required: ['data', 'hasMore'],
3857
+ required: ['id', 'status'],
3858
+ description: "The promotion the proposal's request made.",
3122
3859
  properties: {
3123
- data: { type: 'array', items: { $ref: '#/components/schemas/FixProposal' } },
3124
- nextCursor: {
3860
+ id: { type: 'string' },
3861
+ status: {
3125
3862
  type: 'string',
3126
- description: 'Opaque cursor for the next page. Absent when `hasMore: false`.',
3863
+ enum: ['promoted', 'pending-approval', 'refused', 'superseded', 'rejected', 'expired'],
3864
+ },
3865
+ approvalId: { type: 'string', description: 'The approval a request in review waits on.' },
3866
+ liveNow: {
3867
+ type: 'boolean',
3868
+ description: 'For a promoted proposal: whether its version still serves the scope.',
3127
3869
  },
3128
- hasMore: { type: 'boolean' },
3129
3870
  },
3130
3871
  };
3131
- export const DraftProposalBodySchema = {
3132
- description: 'Draft a fix proposal for `(agentId, agentVersion)`. The supervisor context comes from the `X-Supervisor-Id` header; the caller supplies the target agent + change payload + supporting evidence. Duplicate proposals (same `(supervisor, fingerprint)` in a non-terminal state) short-circuit to the pre-existing row and set `X-Proposal-Deduped: true` on the response.',
3872
+ export const FixProposalSchema = {
3133
3873
  type: 'object',
3134
3874
  additionalProperties: false,
3875
+ description: 'An improvement proposal: a change to one data block an agent version pins, for one live scope, taken through the same comparison, gate and promotion as any other version.',
3135
3876
  required: [
3877
+ 'id',
3136
3878
  'agentId',
3137
- 'agentVersion',
3879
+ 'fromVersion',
3880
+ 'scope',
3138
3881
  'tier',
3139
3882
  'change',
3140
- 'patternRefs',
3141
3883
  'hypothesis',
3142
- 'proposerRuleId',
3884
+ 'drafter',
3885
+ 'status',
3886
+ 'createdAt',
3887
+ 'updatedAt',
3143
3888
  ],
3144
3889
  properties: {
3890
+ id: { type: 'string', format: 'uuid' },
3145
3891
  agentId: { type: 'string' },
3146
- agentVersion: { type: 'string' },
3147
- tier: ProposalTierSchema,
3148
- change: ProposedChangeSchema,
3149
- patternRefs: {
3150
- type: 'array',
3151
- items: { $ref: '#/components/schemas/PatternRef' },
3152
- },
3153
- hypothesis: { type: 'string', minLength: 1 },
3154
- proposerRuleId: { type: 'string', minLength: 1 },
3155
- },
3156
- };
3157
- export const PassCriterionSchema = {
3158
- description: 'How the dry-run judges whether the candidate is good enough to submit for review. Two kinds: `min-pass-rate` (candidate pass rate ≥ threshold) or `strict-improvement` (candidate pass rate exceeds baseline by ≥ delta).',
3159
- oneOf: [
3160
- {
3892
+ fromVersion: { type: 'string', description: 'The agent version the change applies to.' },
3893
+ scope: { $ref: '#/components/schemas/LiveScope' },
3894
+ tier: { $ref: '#/components/schemas/ProposalTier' },
3895
+ change: { $ref: '#/components/schemas/ProposalChange' },
3896
+ hypothesis: { type: 'string', description: 'What the change should improve, and why.' },
3897
+ evidence: {
3898
+ type: 'object',
3899
+ additionalProperties: false,
3900
+ properties: { judgmentIds: { type: 'array', items: { type: 'string' } } },
3901
+ },
3902
+ drafter: { $ref: '#/components/schemas/ProposalDrafter' },
3903
+ status: { $ref: '#/components/schemas/FixProposalStatus' },
3904
+ candidate: { $ref: '#/components/schemas/ProposalCandidate' },
3905
+ evaluation: { $ref: '#/components/schemas/ProposalEvaluation' },
3906
+ promotion: { $ref: '#/components/schemas/ProposalPromotion' },
3907
+ rolledBack: {
3161
3908
  type: 'object',
3162
3909
  additionalProperties: false,
3163
- required: ['kind', 'minPassRate'],
3910
+ required: ['at', 'promotionId', 'by'],
3164
3911
  properties: {
3165
- kind: { type: 'string', const: 'min-pass-rate' },
3166
- minPassRate: { type: 'number', minimum: 0, maximum: 1 },
3912
+ at: { type: 'string', format: 'date-time' },
3913
+ promotionId: { type: 'string', description: "The rollback's own promotion row." },
3914
+ by: { type: 'string' },
3915
+ reason: { type: 'string' },
3167
3916
  },
3168
3917
  },
3169
- {
3918
+ withdrawn: {
3170
3919
  type: 'object',
3171
3920
  additionalProperties: false,
3172
- required: ['kind', 'baselinePassRate', 'minDelta'],
3921
+ required: ['at', 'by', 'reason'],
3173
3922
  properties: {
3174
- kind: { type: 'string', const: 'strict-improvement' },
3175
- baselinePassRate: { type: 'number', minimum: 0, maximum: 1 },
3176
- minDelta: { type: 'number' },
3923
+ at: { type: 'string', format: 'date-time' },
3924
+ by: { type: 'string' },
3925
+ reason: { type: 'string' },
3177
3926
  },
3178
3927
  },
3179
- ],
3928
+ createdAt: { type: 'string', format: 'date-time' },
3929
+ updatedAt: { type: 'string', format: 'date-time' },
3930
+ },
3180
3931
  };
3181
- export const DryRunProposalBodySchema = {
3932
+ export const FixProposalCollectionPageSchema = {
3182
3933
  type: 'object',
3183
3934
  additionalProperties: false,
3184
- required: ['datasetId', 'datasetVersion', 'criterion'],
3935
+ required: ['data', 'hasMore'],
3185
3936
  properties: {
3186
- datasetId: { type: 'string', minLength: 1 },
3187
- datasetVersion: { type: 'string', minLength: 1 },
3188
- criterion: PassCriterionSchema,
3937
+ data: { type: 'array', items: { $ref: '#/components/schemas/FixProposal' } },
3938
+ hasMore: { type: 'boolean' },
3939
+ nextCursor: { type: 'string' },
3189
3940
  },
3190
3941
  };
3191
- export const DryRunProposalResultSchema = {
3942
+ export const ImprovementBudgetSchema = {
3192
3943
  type: 'object',
3193
3944
  additionalProperties: false,
3194
- required: ['proposal', 'passed'],
3945
+ required: ['maxCostUsd', 'maxCandidates'],
3195
3946
  properties: {
3196
- proposal: { $ref: '#/components/schemas/FixProposal' },
3197
- passed: {
3198
- type: 'boolean',
3199
- description: 'True when the candidate met the criterion — proposal moves to `dry-run-passed`. False → `dry-run-failed` (still a legitimate response, not an error).',
3947
+ maxCostUsd: {
3948
+ type: 'number',
3949
+ exclusiveMinimum: 0,
3950
+ maximum: 100,
3951
+ description: "The most the pass's comparisons may cost, in US dollars.",
3952
+ },
3953
+ maxCandidates: {
3954
+ type: 'integer',
3955
+ minimum: 1,
3956
+ maximum: 200,
3957
+ description: 'The most candidates it compares.',
3200
3958
  },
3201
3959
  },
3202
3960
  };
3203
- export const SubmitReviewProposalBodySchema = {
3204
- description: 'Body is optional — omit to accept every default. `requiredRole` overrides the auto-derivation (meta-fixes → senior). `expiresAt` sets the HITL approval deadline.',
3961
+ export const ImprovementPassOutcomeSchema = {
3205
3962
  type: 'object',
3206
3963
  additionalProperties: false,
3964
+ required: ['kind'],
3965
+ description: "What a finished pass found. `proposed`: its best candidate beat the current values on the test set's hold-out part, so it wrote an improvement proposal (`proposalId`) for a reviewer to decide. `nothing-found`: no candidate beat them by more than the noise, or within the budget (`reason`; `holdOut` has the best candidate's numbers when one got that far). `failed`: `message` says why.",
3207
3966
  properties: {
3208
- requiredRole: { $ref: '#/components/schemas/ReviewerRole' },
3209
- expiresAt: { type: 'string', format: 'date-time' },
3967
+ kind: { type: 'string', enum: ['proposed', 'nothing-found', 'failed'] },
3968
+ proposalId: { type: 'string', format: 'uuid' },
3969
+ reason: { type: 'string' },
3970
+ holdOut: {
3971
+ type: 'object',
3972
+ additionalProperties: false,
3973
+ required: ['baseline', 'candidate', 'delta'],
3974
+ properties: {
3975
+ baseline: { type: ['number', 'null'] },
3976
+ candidate: { type: ['number', 'null'] },
3977
+ delta: { type: ['number', 'null'] },
3978
+ spread: { type: 'number' },
3979
+ },
3980
+ },
3981
+ message: { type: 'string' },
3210
3982
  },
3211
3983
  };
3212
- export const SubmitReviewProposalResultSchema = {
3984
+ export const ImprovementPassSchema = {
3213
3985
  type: 'object',
3214
3986
  additionalProperties: false,
3215
- required: ['proposal', 'approvalId', 'metaFix'],
3987
+ description: "An improvement pass: the runtime looking for better values for an agent version's tunable settings (`x-kindgi-tunable`) on a test set, within a budget. Its best candidate becomes an improvement proposal.",
3988
+ required: [
3989
+ 'id',
3990
+ 'agentId',
3991
+ 'fromVersion',
3992
+ 'scope',
3993
+ 'suiteId',
3994
+ 'tiers',
3995
+ 'objective',
3996
+ 'budget',
3997
+ 'requestedBy',
3998
+ 'status',
3999
+ 'candidatesEvaluated',
4000
+ 'costUsd',
4001
+ 'createdAt',
4002
+ 'updatedAt',
4003
+ ],
3216
4004
  properties: {
3217
- proposal: { $ref: '#/components/schemas/FixProposal' },
3218
- approvalId: { type: 'string', format: 'uuid' },
3219
- metaFix: {
3220
- type: 'boolean',
3221
- description: "True when the proposal targets one of the supervisor's own agent ids — reviewer role auto-bumps to `senior` unless overridden.",
4005
+ id: { type: 'string', format: 'uuid' },
4006
+ agentId: { type: 'string' },
4007
+ fromVersion: { type: 'string', description: 'The version whose settings it tunes.' },
4008
+ scope: { $ref: '#/components/schemas/LiveScope' },
4009
+ suiteId: { type: 'string', description: 'The test set it searches and proves on.' },
4010
+ tiers: { type: 'array', items: { type: 'string', enum: ['settings', 'prompt'] } },
4011
+ objective: { type: 'string', enum: ['weightedYesShare', 'weightedPrecisionAtK'] },
4012
+ classWeights: {
4013
+ type: 'string',
4014
+ enum: ['as-recorded', 'restricted-only'],
4015
+ description: 'Which judgments its comparisons count. Absent from older servers: `restricted-only`.',
4016
+ },
4017
+ model: {
4018
+ type: 'object',
4019
+ additionalProperties: false,
4020
+ required: ['providerId', 'model'],
4021
+ description: 'For a prompt pass: the provider and model that drafts the templates.',
4022
+ properties: { providerId: { type: 'string' }, model: { type: 'string' } },
4023
+ },
4024
+ candidates: {
4025
+ type: 'integer',
4026
+ minimum: 1,
4027
+ maximum: 5,
4028
+ description: 'For a prompt pass: how many templates it drafts.',
4029
+ },
4030
+ budget: { $ref: '#/components/schemas/ImprovementBudget' },
4031
+ requestedBy: { type: 'string' },
4032
+ status: { type: 'string', enum: ['running', 'completed', 'failed', 'cancelled'] },
4033
+ candidatesEvaluated: { type: 'integer', minimum: 0 },
4034
+ costUsd: { type: 'string', description: 'What its comparisons have cost so far (US dollars).' },
4035
+ outcome: { $ref: '#/components/schemas/ImprovementPassOutcome' },
4036
+ comparisons: {
4037
+ type: 'array',
4038
+ description: 'Its comparisons so far, each an eval run to open: `reference` (the version as it is, on the search part), each `candidate` (the block and the values it changed, on the search part), and the `proof` (the proposal, on the hold-out part). Absent from older servers.',
4039
+ items: {
4040
+ type: 'object',
4041
+ additionalProperties: false,
4042
+ required: ['role', 'part'],
4043
+ properties: {
4044
+ evalRunId: { type: 'string', format: 'uuid' },
4045
+ role: { type: 'string', enum: ['reference', 'candidate', 'proof'] },
4046
+ part: { type: 'string', enum: ['search', 'hold-out'] },
4047
+ blockId: { type: 'string' },
4048
+ changed: { type: 'object', additionalProperties: true },
4049
+ score: { type: ['number', 'null'] },
4050
+ failed: { type: 'string' },
4051
+ refused: {
4052
+ type: 'array',
4053
+ description: "For a drafted template that was never compared: why the check refused it (what it reads or names that the agent doesn't have, or its size).",
4054
+ items: {
4055
+ type: 'object',
4056
+ additionalProperties: false,
4057
+ required: ['path', 'message'],
4058
+ properties: { path: { type: 'string' }, message: { type: 'string' } },
4059
+ },
4060
+ },
4061
+ hypothesis: {
4062
+ type: 'string',
4063
+ description: 'For a drafted template: what the drafter meant it to change.',
4064
+ },
4065
+ },
4066
+ },
4067
+ },
4068
+ trigger: {
4069
+ type: 'object',
4070
+ additionalProperties: false,
4071
+ required: ['triggerId', 'fireId'],
4072
+ description: 'The improve schedule and fire that started it (`GET /v1/schedules/{triggerId}/fires`); absent for a pass a person started.',
4073
+ properties: { triggerId: { type: 'string' }, fireId: { type: 'string' } },
3222
4074
  },
4075
+ createdAt: { type: 'string', format: 'date-time' },
4076
+ updatedAt: { type: 'string', format: 'date-time' },
4077
+ finishedAt: { type: 'string', format: 'date-time' },
3223
4078
  },
3224
4079
  };
3225
- export const ApplyProposalBodySchema = {
3226
- description: 'Body is optional. `newVersion` overrides the auto-derived patch bump of the baseline; omit to let the runtime bump `1.0.0 → 1.0.1`.',
4080
+ export const ImprovementPassCollectionPageSchema = {
3227
4081
  type: 'object',
3228
4082
  additionalProperties: false,
4083
+ required: ['data', 'hasMore'],
3229
4084
  properties: {
3230
- newVersion: {
4085
+ data: { type: 'array', items: { $ref: '#/components/schemas/ImprovementPass' } },
4086
+ hasMore: { type: 'boolean' },
4087
+ nextCursor: { type: 'string' },
4088
+ },
4089
+ };
4090
+ export const ImproveBodySchema = {
4091
+ type: 'object',
4092
+ additionalProperties: false,
4093
+ required: ['agentId', 'scope', 'suiteId'],
4094
+ description: 'Start an improvement pass.',
4095
+ properties: {
4096
+ agentId: { type: 'string' },
4097
+ fromVersion: {
4098
+ type: 'string',
4099
+ description: 'The version whose settings it tunes. Default: the one serving `scope`.',
4100
+ },
4101
+ scope: { $ref: '#/components/schemas/LiveScope' },
4102
+ suiteId: {
3231
4103
  type: 'string',
3232
- description: 'Semver, strictly greater than the baseline.',
4104
+ description: 'The test set (a judged eval suite). The pass splits it into a search part and a hold-out part, and proves its best candidate on the hold-out part.',
4105
+ },
4106
+ tiers: {
4107
+ type: 'array',
4108
+ items: { type: 'string', enum: ['settings', 'prompt'] },
4109
+ minItems: 1,
4110
+ maxItems: 1,
4111
+ default: ['settings'],
4112
+ description: "`['settings']`: values for the tunable settings keys. `['prompt']`: a model drafts templates for the prompt block (needs `model`); a template that reads or names anything the agent doesn't have is refused, and a drafted proposal always waits for a reviewer.",
4113
+ },
4114
+ model: {
4115
+ type: 'object',
4116
+ additionalProperties: false,
4117
+ required: ['providerId', 'model'],
4118
+ description: "For a prompt pass: the tenant's provider and model that drafts the templates.",
4119
+ properties: { providerId: { type: 'string' }, model: { type: 'string' } },
4120
+ },
4121
+ candidates: {
4122
+ type: 'integer',
4123
+ minimum: 1,
4124
+ maximum: 5,
4125
+ default: 3,
4126
+ description: 'For a prompt pass: how many templates it drafts.',
4127
+ },
4128
+ classWeights: {
4129
+ type: 'string',
4130
+ enum: ['as-recorded', 'restricted-only'],
4131
+ default: 'restricted-only',
4132
+ description: 'Which judgments the pass learns from: by default only those recorded under a restricted (trusted) judge class.',
4133
+ },
4134
+ objective: {
4135
+ type: 'string',
4136
+ enum: ['weightedYesShare', 'weightedPrecisionAtK'],
4137
+ default: 'weightedYesShare',
4138
+ },
4139
+ budget: {
4140
+ type: 'object',
4141
+ additionalProperties: false,
4142
+ description: 'Default: $5 and 30 candidates.',
4143
+ properties: {
4144
+ maxCostUsd: { type: 'number', exclusiveMinimum: 0, maximum: 100 },
4145
+ maxCandidates: { type: 'integer', minimum: 1, maximum: 200 },
4146
+ },
3233
4147
  },
3234
4148
  },
3235
4149
  };
3236
- export const ApplyProposalResultSchema = {
4150
+ export const CreateProposalBodySchema = {
4151
+ description: 'A hand-written proposal: new content for a data block that `fromVersion` pins, for a live scope. The same change from the same version for the same scope is one proposal (answered with `X-Proposal-Deduped: true`).',
3237
4152
  type: 'object',
3238
4153
  additionalProperties: false,
3239
- required: ['proposalId', 'appliedVersion', 'appliedAt'],
4154
+ required: ['agentId', 'fromVersion', 'scope', 'tier', 'change', 'hypothesis'],
3240
4155
  properties: {
3241
- proposalId: { type: 'string', format: 'uuid' },
3242
- appliedVersion: { type: 'string' },
3243
- appliedAt: { type: 'string', format: 'date-time' },
4156
+ agentId: { type: 'string' },
4157
+ fromVersion: { type: 'string', description: 'The agent version the change applies to.' },
4158
+ scope: { $ref: '#/components/schemas/LiveScope' },
4159
+ tier: { $ref: '#/components/schemas/ProposalTier' },
4160
+ change: {
4161
+ type: 'object',
4162
+ additionalProperties: false,
4163
+ required: ['blockId', 'content'],
4164
+ properties: {
4165
+ blockId: { type: 'string', description: "A block `fromVersion` pins, of the tier's kind." },
4166
+ content: {
4167
+ type: 'object',
4168
+ description: '`{ values }` for a settings block (they must satisfy its schema), `{ template }` for a prompt block.',
4169
+ additionalProperties: false,
4170
+ properties: {
4171
+ values: { type: 'object', additionalProperties: true },
4172
+ template: { type: 'string' },
4173
+ },
4174
+ },
4175
+ },
4176
+ },
4177
+ hypothesis: { type: 'string', minLength: 1, maxLength: 2000 },
4178
+ evidence: {
4179
+ type: 'object',
4180
+ additionalProperties: false,
4181
+ properties: { judgmentIds: { type: 'array', items: { type: 'string' } } },
4182
+ },
3244
4183
  },
3245
4184
  };
3246
- export const RollbackProposalBodySchema = {
4185
+ export const EvaluateProposalBodySchema = {
4186
+ description: "Compare the proposal's candidate on a test set. The first evaluation publishes the block version and derives the agent version (both serve nowhere until promoted).",
3247
4187
  type: 'object',
3248
4188
  additionalProperties: false,
3249
- required: ['reason'],
4189
+ required: ['suiteId'],
3250
4190
  properties: {
3251
- reason: { type: 'string', minLength: 1 },
4191
+ suiteId: { type: 'string', description: 'The test set: a judged eval suite.' },
4192
+ objective: {
4193
+ type: 'string',
4194
+ enum: ['weightedYesShare', 'weightedPrecisionAtK'],
4195
+ default: 'weightedYesShare',
4196
+ description: 'The metric that says whether the candidate is better.',
4197
+ },
4198
+ reads: { type: 'string', enum: ['recorded', 'live'] },
4199
+ repetitions: { type: 'integer', minimum: 1, maximum: 10 },
4200
+ k: { type: 'integer', minimum: 1, maximum: 100 },
4201
+ classWeights: { type: 'string', enum: ['as-recorded', 'restricted-only'] },
4202
+ sample: { $ref: '#/components/schemas/EvalSample' },
3252
4203
  },
3253
4204
  };
3254
- export const RollbackProposalResultSchema = {
4205
+ export const ProposalReasonBodySchema = {
3255
4206
  type: 'object',
3256
4207
  additionalProperties: false,
3257
- required: ['proposalId', 'rolledBackAt'],
3258
4208
  properties: {
3259
- proposalId: { type: 'string', format: 'uuid' },
3260
- rolledBackAt: { type: 'string', format: 'date-time' },
4209
+ reason: { type: 'string', minLength: 1, maxLength: 2000 },
3261
4210
  },
3262
4211
  };
3263
4212
  export const WithdrawProposalBodySchema = {
@@ -3265,7 +4214,7 @@ export const WithdrawProposalBodySchema = {
3265
4214
  additionalProperties: false,
3266
4215
  required: ['reason'],
3267
4216
  properties: {
3268
- reason: { type: 'string', minLength: 1 },
4217
+ reason: { type: 'string', minLength: 1, maxLength: 2000 },
3269
4218
  },
3270
4219
  };
3271
4220
  // ---------------- provenance ----------------
@@ -3422,15 +4371,11 @@ export const ProvenanceCollectionPageSchema = {
3422
4371
  },
3423
4372
  };
3424
4373
  export const ExportProvenanceBodySchema = {
4374
+ description: 'Optional: no body signs with the active key.',
3425
4375
  type: 'object',
3426
4376
  additionalProperties: false,
3427
- required: ['signingKeyId'],
3428
4377
  properties: {
3429
- signingKeyId: {
3430
- type: 'string',
3431
- minLength: 1,
3432
- description: 'The `SigningKeyId` the deployment plugs into its `signingKey` binding. Server looks up the private key via `signingKey.getPrivateKey(signingKeyId)` — 404 if unknown.',
3433
- },
4378
+ signingKeyId: SIGNING_KEY_ID_PROPERTY,
3434
4379
  includeMessages: {
3435
4380
  type: 'boolean',
3436
4381
  description: 'When true, hydrates conversation messages tied to the run (agent turns pin `runId === conversationId`). Non-agent runs return an empty `messages: []` — the field is still present on the bundle for shape stability.',
@@ -3438,49 +4383,12 @@ export const ExportProvenanceBodySchema = {
3438
4383
  },
3439
4384
  },
3440
4385
  };
3441
- export const ExportProvenanceResultSchema = {
3442
- description: 'Signed exportable bundle. `bundle` is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace); verifiers can pass those bytes directly to `verifyEd25519`. The bundle body itself includes `bundleSchemaVersion`, `runId`, `tenantId`, `dag: { nodes, edges }`, `messages?` (if requested), `callUsage?` (the usage of the model calls, from the cost ledger), etc. See `canonicalization` for the deterministic serialization algorithm.',
3443
- type: 'object',
3444
- additionalProperties: false,
3445
- required: [
3446
- 'runId',
3447
- 'bundle',
3448
- 'bundleSchemaVersion',
3449
- 'algorithm',
3450
- 'signingKeyId',
3451
- 'signature',
3452
- 'publicKey',
3453
- 'canonicalization',
3454
- 'exportedAt',
3455
- ],
3456
- properties: {
3457
- runId: { type: 'string', format: 'uuid' },
3458
- bundle: {
3459
- type: 'string',
3460
- description: 'Base64-encoded canonical JSON of the bundle body.',
3461
- },
3462
- bundleSchemaVersion: {
3463
- type: 'string',
3464
- description: "Semver for the shape of the bundle body. Currently `1.1.0`, which adds `callUsage`: each model call's usage from the cost ledger, by call id, as it stood when signed.",
3465
- },
3466
- algorithm: { type: 'string', const: 'ed25519' },
3467
- signingKeyId: { type: 'string' },
3468
- signature: {
3469
- type: 'string',
3470
- description: 'Base64-encoded Ed25519 signature bytes over `bundle` (after base64-decode).',
3471
- },
3472
- publicKey: {
3473
- type: 'string',
3474
- description: 'PEM-encoded Ed25519 public key (DER SPKI envelope). Callers can pass this straight into `parsePublicKeyPem` for verification.',
3475
- },
3476
- canonicalization: {
3477
- type: 'string',
3478
- const: 'sorted-key-json',
3479
- description: 'Canonicalization algorithm — sorted-key JSON, no whitespace. Same algorithm as `canonicalize`.',
3480
- },
3481
- exportedAt: { type: 'string', format: 'date-time' },
3482
- },
3483
- };
4386
+ export const ExportProvenanceResultSchema = signedExportEnvelope({
4387
+ description: "A run's signed provenance. Body: `{ bundleSchemaVersion, provenanceId, runId, tenantId, version, createdAt, flowRef?, dag: { nodes, edges }, messages?, callUsage?, exportedAt }`; `callUsage` is each model call's usage from the cost ledger, as it stood when signed.",
4388
+ kind: 'provenance',
4389
+ subject: ['runId', { type: 'string', format: 'uuid' }],
4390
+ versionDescription: "The body's version, semver. `1.2.0` adds `exportedAt` to the signed body; `1.1.0` added `callUsage`.",
4391
+ });
3484
4392
  // ---------------- registry (exported to the generator) ----------------
3485
4393
  /**
3486
4394
  * Named schemas surfaced under `components.schemas` in the emitted
@@ -3516,6 +4424,14 @@ export const BlobMetaSchema = {
3516
4424
  format: 'uuid',
3517
4425
  description: 'Optional back-ref to the RunId that produced this blob.',
3518
4426
  },
4427
+ projectId: {
4428
+ type: 'string',
4429
+ description: "The project the artifact belongs to: its owner run's, else the upload's `projectId`, else the tenant's default project. Reading it needs `read` there; deleting it, `write`. Absent on blobs stored before projects were recorded.",
4430
+ },
4431
+ createdBy: {
4432
+ type: 'string',
4433
+ description: 'Who uploaded it: `user:<id>` or `service_account:<id>`.',
4434
+ },
3519
4435
  createdAt: { type: 'string', format: 'date-time' },
3520
4436
  },
3521
4437
  };
@@ -3542,6 +4458,10 @@ export const UploadArtifactBodySchema = {
3542
4458
  description: 'JSON-encoded `Record<string, string>` — parsed server-side.',
3543
4459
  },
3544
4460
  ownerRunId: { type: 'string', format: 'uuid' },
4461
+ projectId: {
4462
+ type: 'string',
4463
+ description: "The project it belongs to, when there's no `ownerRunId` (with one, the run's project, and this must agree). Default: the tenant's default project.",
4464
+ },
3545
4465
  expectedHash: {
3546
4466
  type: 'string',
3547
4467
  pattern: '^[0-9a-f]{64}$',
@@ -3615,6 +4535,21 @@ export const CapabilityDescriptorSchema = {
3615
4535
  additionalProperties: true,
3616
4536
  description: 'Optional JSON Schema fragment describing the parameters an agent may attach to `{ feature, params }` in a `Requirement`.',
3617
4537
  },
4538
+ providers: {
4539
+ type: 'array',
4540
+ items: { $ref: '#/components/schemas/CapabilityProvider' },
4541
+ description: "The tenant's registered providers with a model that has the feature, and those models. Absent from servers that don't read the provider registry; `[]` when no provider of the tenant has one.",
4542
+ },
4543
+ },
4544
+ };
4545
+ export const CapabilityProviderSchema = {
4546
+ type: 'object',
4547
+ additionalProperties: false,
4548
+ required: ['providerId', 'models'],
4549
+ description: 'A provider of the tenant with a model that has the feature.',
4550
+ properties: {
4551
+ providerId: { type: 'string' },
4552
+ models: { type: 'array', items: { type: 'string' }, description: 'Its models that have it.' },
3618
4553
  },
3619
4554
  };
3620
4555
  export const CapabilityCollectionPageSchema = {
@@ -3814,6 +4749,10 @@ export const RegisterProviderBodySchema = {
3814
4749
  },
3815
4750
  description: "The adapter's connection settings: flat, non-secret values (a cloud project, a base URL). Each adapter documents its keys. Credentials go in `secret_ref`, never here.",
3816
4751
  },
4752
+ send_traceparent: {
4753
+ type: 'boolean',
4754
+ description: "Send each model call's W3C `traceparent` to this provider, as a request header, so its request logs can be matched to the run. Ids only, never content. Default `false`: nothing about a run's trace leaves the deployment unless a registration opts in. The runtime enforces it; an older runtime ignores the field and sends none.",
4755
+ },
3817
4756
  },
3818
4757
  };
3819
4758
  export const RegisterProviderResultSchema = {
@@ -3833,6 +4772,42 @@ export const UnregisterProviderResultSchema = {
3833
4772
  unregistered: { type: 'boolean', const: true },
3834
4773
  },
3835
4774
  };
4775
+ /**
4776
+ * One thing an adapter's check finds wrong with a provider registration,
4777
+ * in the shape of the API's validation issues.
4778
+ */
4779
+ export const AdapterConfigProblemSchema = {
4780
+ type: 'object',
4781
+ additionalProperties: false,
4782
+ required: ['path', 'message'],
4783
+ properties: {
4784
+ path: {
4785
+ type: 'string',
4786
+ description: 'The setting at fault, as a JSON pointer into the registration: `/adapter_config/<key>`, `/secret_ref`, `/metadata/region`, `/metadata/models/<i>/name`, or `/adapter_id` (an adapter this runtime does not have).',
4787
+ },
4788
+ message: {
4789
+ type: 'string',
4790
+ description: "What's wrong with that setting and what it takes (e.g. `adapter_config.api must be one of responses, chat-completions.`). The error's `message` names the provider and its adapter.",
4791
+ },
4792
+ },
4793
+ };
4794
+ export const ProviderCheckResultSchema = {
4795
+ type: 'object',
4796
+ additionalProperties: false,
4797
+ required: ['providerId', 'adapterId', 'checked', 'issues'],
4798
+ properties: {
4799
+ providerId: { type: 'string' },
4800
+ adapterId: { type: 'string' },
4801
+ checked: {
4802
+ type: 'boolean',
4803
+ description: "False when this runtime has no check for the provider's adapter; `issues` is then empty.",
4804
+ },
4805
+ issues: {
4806
+ type: 'array',
4807
+ items: { $ref: '#/components/schemas/AdapterConfigProblem' },
4808
+ },
4809
+ },
4810
+ };
3836
4811
  export const ProviderCapabilitiesResultSchema = {
3837
4812
  type: 'object',
3838
4813
  additionalProperties: false,
@@ -3937,6 +4912,10 @@ export const MCPEndpointSchema = {
3937
4912
  additionalProperties: true,
3938
4913
  description: 'Optional caller-defined metadata bag.',
3939
4914
  },
4915
+ sendTraceparent: {
4916
+ type: 'boolean',
4917
+ description: "Send the W3C `traceparent` of the run calling a tool to this endpoint, as a request header, so the server's logs can be matched to the run. Ids only, never content. Default `false`. HTTP transports only: `true` on a `stdio` endpoint is refused (`invalid-mcp-endpoint`, reason `invalid-send-traceparent`). An older runtime ignores it and sends none.",
4918
+ },
3940
4919
  },
3941
4920
  };
3942
4921
  export const MCPEndpointCollectionPageSchema = {
@@ -4564,6 +5543,7 @@ export const ReinstatePolicyVersionResultSchema = {
4564
5543
  export const RetentionDomainSchema = {
4565
5544
  type: 'string',
4566
5545
  enum: [...RETENTION_DOMAINS],
5546
+ description: "The kind of record a retention policy covers. `*` covers every domain without a policy of its own, except `memory` and `conversation`: they hold people's words, so only a policy naming them purges them.",
4567
5547
  };
4568
5548
  /**
4569
5549
  * A domain more than one retention policy covers. Publishing refuses a
@@ -4996,6 +5976,39 @@ export const EvalBaselineSchema = {
4996
5976
  },
4997
5977
  ],
4998
5978
  };
5979
+ export const EvalOverridesSchema = {
5980
+ type: 'object',
5981
+ additionalProperties: false,
5982
+ description: "For an agent candidate: block content its replays run instead of the version's pinned content (an improvement pass's search). `settings`: values by settings block id, each a block the version pins, satisfying its schema. `prompts`: a template for the prompt block the version pins, which reads and names only what the agent has (its parameters, the variables the current template reads, the settings blocks it pins, its tools' and blocks' ids) and is at most twice as long. Anything else is `400 validation-failed`. A comparison with overrides can't gate a promotion.",
5983
+ properties: {
5984
+ settings: {
5985
+ type: 'object',
5986
+ maxProperties: 20,
5987
+ additionalProperties: { type: 'object', additionalProperties: true },
5988
+ },
5989
+ prompts: {
5990
+ type: 'object',
5991
+ maxProperties: 1,
5992
+ additionalProperties: {
5993
+ type: 'object',
5994
+ additionalProperties: false,
5995
+ required: ['template'],
5996
+ properties: { template: { type: 'string' } },
5997
+ },
5998
+ },
5999
+ },
6000
+ };
6001
+ export const EvalSampleSchema = {
6002
+ type: 'object',
6003
+ additionalProperties: false,
6004
+ required: ['part', 'seed', 'holdOutShare'],
6005
+ description: 'Only part of the test set\'s cases: split once into a hold-out part (about `holdOutShare` of them) and a search part (the rest), stratified by judgment (the cases with a "no" and the others are split on their own, a stratum of two or more giving each part at least one), in the order of a hash of each case id and `seed`. The same seed always splits the same test set the same way. A promotion gate refuses a comparison on the search part (`comparison.sample`).',
6006
+ properties: {
6007
+ part: { type: 'string', enum: ['search', 'hold-out'] },
6008
+ seed: { type: 'string', minLength: 1, maxLength: 200 },
6009
+ holdOutShare: { type: 'number', minimum: 0.1, maximum: 0.9 },
6010
+ },
6011
+ };
4999
6012
  export const EvalComparisonSchema = {
5000
6013
  type: 'object',
5001
6014
  additionalProperties: false,
@@ -5016,6 +6029,8 @@ export const EvalComparisonSchema = {
5016
6029
  enum: ['as-recorded', 'restricted-only'],
5017
6030
  description: "Which judgments count: each at its class's weight (`as-recorded`, the default), or only those recorded while their class was restricted (`Judgment.restricted`), the others weighing 0 (`restricted-only`).",
5018
6031
  },
6032
+ overrides: { $ref: '#/components/schemas/EvalOverrides' },
6033
+ sample: { $ref: '#/components/schemas/EvalSample' },
5019
6034
  },
5020
6035
  };
5021
6036
  // ---------------- comparison results (a `judged` eval run's `result`) ----------------
@@ -5069,6 +6084,15 @@ export const ComparisonCandidateSchema = {
5069
6084
  type: 'string',
5070
6085
  description: "The version's pinsDigest: what it ran, as a promotion gate checks. Absent for a version published before pins, and from a comparison recorded before it.",
5071
6086
  },
6087
+ overrides: {
6088
+ type: 'object',
6089
+ additionalProperties: false,
6090
+ description: "The blocks whose content the replays replaced (`overrides`): no published version ran, so it can't gate a promotion. Absent otherwise.",
6091
+ properties: {
6092
+ settings: { type: 'array', items: { type: 'string' } },
6093
+ prompts: { type: 'array', items: { type: 'string' } },
6094
+ },
6095
+ },
5072
6096
  },
5073
6097
  },
5074
6098
  {
@@ -5174,6 +6198,11 @@ export const JudgedComparisonSummarySchema = {
5174
6198
  description: 'Tool calls refused across the cases (what the candidate would have done).',
5175
6199
  },
5176
6200
  errors: { type: 'integer', minimum: 0, description: 'Cases none of whose repetitions ran.' },
6201
+ erased: {
6202
+ type: 'integer',
6203
+ minimum: 1,
6204
+ description: "Cases an erasure cleared (a person's words were erased): left out of the run and the metrics. Absent: none.",
6205
+ },
5177
6206
  stopped: {
5178
6207
  type: 'integer',
5179
6208
  minimum: 0,
@@ -5185,6 +6214,10 @@ export const JudgedComparisonSummarySchema = {
5185
6214
  enum: ['as-recorded', 'restricted-only'],
5186
6215
  description: 'Which judgments counted. Absent from a comparison recorded before restricted classes: `as-recorded`.',
5187
6216
  },
6217
+ sample: {
6218
+ $ref: '#/components/schemas/EvalSample',
6219
+ description: 'The part of the test set it ran. Absent: every case.',
6220
+ },
5188
6221
  sampling: {
5189
6222
  type: 'object',
5190
6223
  additionalProperties: false,
@@ -5317,6 +6350,10 @@ export const ComparisonCaseResultSchema = {
5317
6350
  toolVersion: { type: 'string' },
5318
6351
  arguments: {},
5319
6352
  source: { type: 'string', enum: ['live', 'recorded', 'refused'] },
6353
+ recomputed: {
6354
+ type: 'boolean',
6355
+ description: "With `source: 'live'`: the call ran again from the same arguments because the compared version pins other settings, and the tool reads from nowhere, so it didn't diverge. Absent from older servers, and otherwise.",
6356
+ },
5320
6357
  reason: { type: 'string' },
5321
6358
  },
5322
6359
  },
@@ -5410,6 +6447,8 @@ export const StartEvalRunBodySchema = {
5410
6447
  enum: ['as-recorded', 'restricted-only'],
5411
6448
  description: "Which judgments count: each at its class's weight (`as-recorded`, the default), or only those recorded while their class was restricted (`Judgment.restricted`), the others weighing 0 (`restricted-only`).",
5412
6449
  },
6450
+ overrides: { $ref: '#/components/schemas/EvalOverrides' },
6451
+ sample: { $ref: '#/components/schemas/EvalSample' },
5413
6452
  },
5414
6453
  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`).",
5415
6454
  };
@@ -5425,7 +6464,8 @@ export const StartEvalRunResultSchema = {
5425
6464
  // ---------------- auth ----------------
5426
6465
  export const IdentityProviderKindSchema = {
5427
6466
  type: 'string',
5428
- enum: ['oauth2', 'oidc'],
6467
+ enum: ['oauth2', 'oidc', 'saml'],
6468
+ description: "`oidc`: an OpenID Connect identity provider people sign in with (Okta, Entra ID, Google, Keycloak…); its endpoints come from its discovery document. `saml`: a SAML 2.0 identity provider people sign in with. `oauth2`: a plain OAuth 2.0 provider that isn't OpenID Connect (e.g. GitHub), with its endpoints given; pick `oidc` for any provider that speaks OpenID Connect.",
5429
6469
  };
5430
6470
  export const ClaimMappingScopesSpecSchema = {
5431
6471
  description: 'Claim path + optional delimiter for extracting Kindgi OAuth scopes from provider claims. When absent, scopes come from the token response `scope` field instead.',
@@ -5449,8 +6489,129 @@ export const ClaimMappingSpecSchema = {
5449
6489
  metadata: { type: 'array', items: { type: 'string', minLength: 1 } },
5450
6490
  },
5451
6491
  };
5452
- export const IdentityProviderConfigSchema = {
5453
- description: 'OAuth 2.0 / OIDC provider configuration registered on a tenant. `clientSecretRef` is a REFERENCE resolved server-side (env-var key, secrets-manager path, KMS handle) — the plaintext client secret never crosses the wire.',
6492
+ const IDENTITY_PROVIDER_BASE_PROPERTIES = {
6493
+ providerId: { type: 'string', minLength: 1 },
6494
+ displayName: {
6495
+ type: 'string',
6496
+ minLength: 1,
6497
+ description: 'The name a sign-in page shows ("Sign in with …"). Default: `providerId`.',
6498
+ },
6499
+ domains: {
6500
+ type: 'array',
6501
+ items: { type: 'string', minLength: 1 },
6502
+ description: 'The email domains whose people sign in with this provider (lowercase, e.g. `acme.com`): how an email-first sign-in page finds it.',
6503
+ },
6504
+ join: {
6505
+ type: 'string',
6506
+ enum: ['invite', 'domain'],
6507
+ description: 'Who may sign in the first time: `invite` (default) only people a tenant admin added; `domain` also anyone from one of `domains`, once the deployment has verified them.',
6508
+ },
6509
+ signIn: { $ref: '#/components/schemas/IdentityProviderSignIn' },
6510
+ metadata: { type: 'object', additionalProperties: true },
6511
+ };
6512
+ const CLIENT_SECRET_REF = {
6513
+ type: 'string',
6514
+ minLength: 1,
6515
+ description: 'Opaque reference resolved server-side. Never a plaintext secret.',
6516
+ };
6517
+ const ALLOWED_REDIRECT_URIS = {
6518
+ type: 'array',
6519
+ items: { type: 'string', minLength: 1 },
6520
+ description: 'OAuth 2.1 BCP redirect-URI allowlist. Exact-string match required at /v1/auth/login. Absent/empty means no redirect-URI allowlist check (pass-through).',
6521
+ };
6522
+ export const IdentityProviderSignInSchema = {
6523
+ description: 'What to give the identity provider so it can send people back: set by the deployment on what it returns, ignored on registration. OIDC / OAuth 2.0: `redirectUri`. SAML: `spEntityId`, `acsUrl`, `spMetadataUrl`.',
6524
+ oneOf: [
6525
+ {
6526
+ type: 'object',
6527
+ additionalProperties: false,
6528
+ required: ['redirectUri'],
6529
+ properties: { redirectUri: { type: 'string', format: 'uri' } },
6530
+ },
6531
+ {
6532
+ type: 'object',
6533
+ additionalProperties: false,
6534
+ required: ['spEntityId', 'acsUrl', 'spMetadataUrl'],
6535
+ properties: {
6536
+ spEntityId: { type: 'string', minLength: 1 },
6537
+ acsUrl: { type: 'string', format: 'uri' },
6538
+ spMetadataUrl: { type: 'string', format: 'uri' },
6539
+ },
6540
+ },
6541
+ ],
6542
+ };
6543
+ export const OidcIdentityProviderConfigSchema = {
6544
+ description: "An OpenID Connect identity provider people sign in with. The endpoints come from the issuer's discovery document when absent, and are returned once the deployment has them.",
6545
+ type: 'object',
6546
+ additionalProperties: false,
6547
+ required: ['providerId', 'kind', 'issuer', 'clientId', 'clientSecretRef'],
6548
+ properties: {
6549
+ ...IDENTITY_PROVIDER_BASE_PROPERTIES,
6550
+ kind: { type: 'string', const: 'oidc' },
6551
+ issuer: { type: 'string', format: 'uri' },
6552
+ clientId: { type: 'string', minLength: 1 },
6553
+ clientSecretRef: CLIENT_SECRET_REF,
6554
+ scopes: {
6555
+ type: 'array',
6556
+ items: { type: 'string' },
6557
+ description: 'Default `openid email profile`.',
6558
+ },
6559
+ authorizationEndpoint: { type: 'string', format: 'uri' },
6560
+ tokenEndpoint: { type: 'string', format: 'uri' },
6561
+ userinfoEndpoint: { type: 'string', format: 'uri' },
6562
+ jwksEndpoint: { type: 'string', format: 'uri' },
6563
+ allowedRedirectUris: ALLOWED_REDIRECT_URIS,
6564
+ claimMapping: { $ref: '#/components/schemas/ClaimMappingSpec' },
6565
+ },
6566
+ };
6567
+ export const SamlIdentityProviderConfigSchema = {
6568
+ description: 'A SAML 2.0 identity provider people sign in with: its metadata XML, or its entity ID, single sign-on URL and signing certificates. Keys are given as references, never as keys.',
6569
+ type: 'object',
6570
+ additionalProperties: false,
6571
+ required: ['providerId', 'kind'],
6572
+ properties: {
6573
+ ...IDENTITY_PROVIDER_BASE_PROPERTIES,
6574
+ kind: { type: 'string', const: 'saml' },
6575
+ idpMetadataXml: { type: 'string', minLength: 1 },
6576
+ idpEntityId: { type: 'string', minLength: 1 },
6577
+ idpSsoUrl: {
6578
+ type: 'string',
6579
+ format: 'uri',
6580
+ description: "The IdP's single sign-on URL (HTTP-Redirect binding).",
6581
+ },
6582
+ idpCertificates: {
6583
+ type: 'array',
6584
+ items: { type: 'string', minLength: 1 },
6585
+ description: "The IdP's signing certificates (PEM); several during a rollover.",
6586
+ },
6587
+ spSigningKeyRef: {
6588
+ type: 'string',
6589
+ minLength: 1,
6590
+ description: "Opaque reference to the service provider's signing key, for IdPs that require signed AuthnRequests. Never a plaintext key.",
6591
+ },
6592
+ spDecryptionKeyRef: {
6593
+ type: 'string',
6594
+ minLength: 1,
6595
+ description: 'Opaque reference to the key that decrypts encrypted assertions. Never a plaintext key.',
6596
+ },
6597
+ wantAssertionsSigned: {
6598
+ type: 'boolean',
6599
+ description: 'Require signed assertions. Default `true`.',
6600
+ },
6601
+ attributeMapping: {
6602
+ type: 'object',
6603
+ additionalProperties: false,
6604
+ description: 'Assertion attribute names. Defaults: `userId` = the NameID, `email` = `email`.',
6605
+ properties: {
6606
+ userId: { type: 'string', minLength: 1 },
6607
+ email: { type: 'string', minLength: 1 },
6608
+ displayName: { type: 'string', minLength: 1 },
6609
+ },
6610
+ },
6611
+ },
6612
+ };
6613
+ export const OAuth2IdentityProviderConfigSchema = {
6614
+ description: "A plain OAuth 2.0 provider that isn't OpenID Connect (e.g. GitHub), run by this API's own OAuth flow (`/v1/auth/login` + callback). For a provider that speaks OpenID Connect, use `oidc`.",
5454
6615
  type: 'object',
5455
6616
  additionalProperties: false,
5456
6617
  required: [
@@ -5463,54 +6624,245 @@ export const IdentityProviderConfigSchema = {
5463
6624
  'scopes',
5464
6625
  ],
5465
6626
  properties: {
5466
- providerId: { type: 'string', minLength: 1 },
5467
- kind: IdentityProviderKindSchema,
6627
+ ...IDENTITY_PROVIDER_BASE_PROPERTIES,
6628
+ kind: { type: 'string', const: 'oauth2' },
5468
6629
  clientId: { type: 'string', minLength: 1 },
5469
- clientSecretRef: {
5470
- type: 'string',
5471
- minLength: 1,
5472
- description: 'Opaque reference resolved server-side. Never a plaintext secret.',
5473
- },
6630
+ clientSecretRef: CLIENT_SECRET_REF,
5474
6631
  authorizationEndpoint: { type: 'string', format: 'uri' },
5475
6632
  tokenEndpoint: { type: 'string', format: 'uri' },
5476
6633
  userinfoEndpoint: { type: 'string', format: 'uri' },
5477
6634
  scopes: { type: 'array', items: { type: 'string' } },
5478
- allowedRedirectUris: {
5479
- type: 'array',
5480
- items: { type: 'string', minLength: 1 },
5481
- description: 'OAuth 2.1 BCP redirect-URI allowlist. Exact-string match required at /v1/auth/login. Absent/empty means no redirect-URI allowlist check (pass-through).',
5482
- },
6635
+ allowedRedirectUris: ALLOWED_REDIRECT_URIS,
5483
6636
  claimMapping: { $ref: '#/components/schemas/ClaimMappingSpec' },
5484
- metadata: { type: 'object', additionalProperties: true },
5485
6637
  },
5486
6638
  };
5487
- export const IdentityProviderCollectionPageSchema = {
6639
+ export const IdentityProviderConfigSchema = {
6640
+ description: 'An identity provider registered on a tenant, one shape per `kind` (narrow on `kind` before reading kind-specific fields). Secrets are always REFERENCES resolved server-side (`clientSecretRef`, `spSigningKeyRef`, `spDecryptionKeyRef`); a plaintext secret never crosses the wire, and a `clientSecret` field is refused.',
6641
+ oneOf: [
6642
+ { $ref: '#/components/schemas/OidcIdentityProviderConfig' },
6643
+ { $ref: '#/components/schemas/SamlIdentityProviderConfig' },
6644
+ { $ref: '#/components/schemas/OAuth2IdentityProviderConfig' },
6645
+ ],
6646
+ discriminator: {
6647
+ propertyName: 'kind',
6648
+ mapping: {
6649
+ oidc: '#/components/schemas/OidcIdentityProviderConfig',
6650
+ saml: '#/components/schemas/SamlIdentityProviderConfig',
6651
+ oauth2: '#/components/schemas/OAuth2IdentityProviderConfig',
6652
+ },
6653
+ },
6654
+ };
6655
+ // Its own schema, used only as the request body: a union that other
6656
+ // schemas also name gets inlined away by the Python generator, so a body
6657
+ // naming `IdentityProviderConfig` would fail at call time (the same as
6658
+ // `ServiceAccountGrantBody`).
6659
+ export const RegisterIdentityProviderBodySchema = {
6660
+ description: 'The identity provider to register, one shape per `kind`: `oidc`, `saml` or `oauth2`. Secrets by reference only (`clientSecretRef`, `spSigningKeyRef`, `spDecryptionKeyRef`); a `clientSecret` field is refused.',
6661
+ oneOf: [
6662
+ { $ref: '#/components/schemas/OidcIdentityProviderConfig' },
6663
+ { $ref: '#/components/schemas/SamlIdentityProviderConfig' },
6664
+ { $ref: '#/components/schemas/OAuth2IdentityProviderConfig' },
6665
+ ],
6666
+ discriminator: {
6667
+ propertyName: 'kind',
6668
+ mapping: {
6669
+ oidc: '#/components/schemas/OidcIdentityProviderConfig',
6670
+ saml: '#/components/schemas/SamlIdentityProviderConfig',
6671
+ oauth2: '#/components/schemas/OAuth2IdentityProviderConfig',
6672
+ },
6673
+ },
6674
+ };
6675
+ // Its own schema too, used only as the answer (see `RegisterIdentityProviderBody`).
6676
+ export const GetIdentityProviderResultSchema = {
6677
+ description: 'An identity provider as stored, one shape per `kind`, with `signIn` when the deployment sets it. Secrets appear only as references.',
6678
+ oneOf: [
6679
+ { $ref: '#/components/schemas/OidcIdentityProviderConfig' },
6680
+ { $ref: '#/components/schemas/SamlIdentityProviderConfig' },
6681
+ { $ref: '#/components/schemas/OAuth2IdentityProviderConfig' },
6682
+ ],
6683
+ discriminator: {
6684
+ propertyName: 'kind',
6685
+ mapping: {
6686
+ oidc: '#/components/schemas/OidcIdentityProviderConfig',
6687
+ saml: '#/components/schemas/SamlIdentityProviderConfig',
6688
+ oauth2: '#/components/schemas/OAuth2IdentityProviderConfig',
6689
+ },
6690
+ },
6691
+ };
6692
+ export const IdentityProviderCollectionPageSchema = {
6693
+ type: 'object',
6694
+ additionalProperties: false,
6695
+ required: ['data'],
6696
+ properties: {
6697
+ data: { type: 'array', items: { $ref: '#/components/schemas/IdentityProviderConfig' } },
6698
+ hasMore: {
6699
+ type: 'boolean',
6700
+ description: 'Always `false`: the list comes whole. Absent from older servers.',
6701
+ },
6702
+ },
6703
+ };
6704
+ export const SignInOptionSchema = {
6705
+ description: 'One way to sign in, as a sign-in page shows it.',
6706
+ type: 'object',
6707
+ additionalProperties: false,
6708
+ required: ['providerId', 'displayName', 'signInUrl'],
6709
+ properties: {
6710
+ providerId: { type: 'string', minLength: 1 },
6711
+ displayName: { type: 'string', minLength: 1, description: '"Sign in with …".' },
6712
+ signInUrl: {
6713
+ type: 'string',
6714
+ description: 'Where the browser goes to start signing in with this provider.',
6715
+ },
6716
+ owner: {
6717
+ type: 'string',
6718
+ enum: ['tenant', 'deployment'],
6719
+ description: 'Whose it is: a workspace\'s own identity provider (`tenant`), or one the deployment offers everyone it has added ("Continue with Google", `deployment`). A sign-in page shows a workspace\'s own first. Absent: `tenant`.',
6720
+ },
6721
+ },
6722
+ };
6723
+ export const SignInOptionsSchema = {
6724
+ type: 'object',
6725
+ additionalProperties: false,
6726
+ required: ['data'],
6727
+ properties: {
6728
+ data: { type: 'array', items: { $ref: '#/components/schemas/SignInOption' } },
6729
+ methods: {
6730
+ type: 'object',
6731
+ additionalProperties: false,
6732
+ required: ['identityProviders', 'apiToken'],
6733
+ description: 'The ways in this deployment allows, for a sign-in page to show. Absent from older servers.',
6734
+ properties: {
6735
+ identityProviders: {
6736
+ type: 'boolean',
6737
+ description: "Sign-in with an organization's identity provider (email first).",
6738
+ },
6739
+ apiToken: {
6740
+ type: 'boolean',
6741
+ description: 'Sign-in to the console with an API token (`POST /v1/auth/token-sign-in`).',
6742
+ },
6743
+ emailLink: {
6744
+ type: 'object',
6745
+ additionalProperties: false,
6746
+ description: 'Present when the deployment emails sign-in links: a sign-in page offers "Email me a sign-in link". With `captchaSiteKey`, the request needs a Cloudflare Turnstile token (`x-captcha-response`).',
6747
+ properties: {
6748
+ captchaSiteKey: { type: 'string', minLength: 1 },
6749
+ },
6750
+ },
6751
+ },
6752
+ },
6753
+ },
6754
+ };
6755
+ export const TokenSignInResultSchema = {
6756
+ type: 'object',
6757
+ additionalProperties: false,
6758
+ required: ['userId', 'expiresAt'],
6759
+ properties: {
6760
+ userId: { type: 'string', minLength: 1, description: 'The person now signed in.' },
6761
+ expiresAt: {
6762
+ type: 'string',
6763
+ format: 'date-time',
6764
+ description: "When the session ends at the latest: its lifetime, or the key's expiry if sooner.",
6765
+ },
6766
+ },
6767
+ };
6768
+ export const RegisterIdentityProviderResultSchema = {
6769
+ type: 'object',
6770
+ additionalProperties: false,
6771
+ required: ['providerId'],
6772
+ properties: {
6773
+ providerId: { type: 'string', minLength: 1 },
6774
+ provider: {
6775
+ $ref: '#/components/schemas/IdentityProviderConfig',
6776
+ description: 'The provider as stored: discovered endpoints, and `signIn` (what to give the identity provider). Absent from older servers.',
6777
+ },
6778
+ },
6779
+ };
6780
+ export const UnregisterIdentityProviderResultSchema = {
6781
+ type: 'object',
6782
+ additionalProperties: false,
6783
+ required: ['providerId', 'unregistered'],
6784
+ properties: {
6785
+ providerId: { type: 'string', minLength: 1 },
6786
+ unregistered: { type: 'boolean', const: true },
6787
+ },
6788
+ };
6789
+ const NULLABLE_STRING = { type: ['string', 'null'], minLength: 1 };
6790
+ const NULLABLE_URI = { type: ['string', 'null'], format: 'uri' };
6791
+ const NULLABLE_STRINGS = {
6792
+ oneOf: [{ type: 'array', items: { type: 'string', minLength: 1 } }, { type: 'null' }],
6793
+ };
6794
+ export const UpdateIdentityProviderBodySchema = {
6795
+ description: "Changes to a registered identity provider: a field given replaces the stored one, `null` removes an optional one, and anything not given stays. The result must still be a whole provider of its `kind` (the fields `IdentityProviderConfig` requires for it), checked as a registration is. `providerId` and `kind` can't change; `signIn` is the deployment's and is ignored. A new `issuer` drops the endpoints discovered from the old one.",
5488
6796
  type: 'object',
5489
6797
  additionalProperties: false,
5490
- required: ['data'],
6798
+ minProperties: 1,
5491
6799
  properties: {
5492
- data: { type: 'array', items: { $ref: '#/components/schemas/IdentityProviderConfig' } },
5493
- hasMore: {
5494
- type: 'boolean',
5495
- description: 'Always `false`: the list comes whole. Absent from older servers.',
6800
+ providerId: { type: 'string', minLength: 1, description: 'Must match the path when given.' },
6801
+ kind: { $ref: '#/components/schemas/IdentityProviderKind' },
6802
+ displayName: NULLABLE_STRING,
6803
+ domains: NULLABLE_STRINGS,
6804
+ join: { oneOf: [{ type: 'string', enum: ['invite', 'domain'] }, { type: 'null' }] },
6805
+ metadata: { oneOf: [{ type: 'object', additionalProperties: true }, { type: 'null' }] },
6806
+ issuer: { type: 'string', format: 'uri' },
6807
+ clientId: { type: 'string', minLength: 1 },
6808
+ clientSecretRef: CLIENT_SECRET_REF,
6809
+ scopes: { oneOf: [{ type: 'array', items: { type: 'string' } }, { type: 'null' }] },
6810
+ authorizationEndpoint: NULLABLE_URI,
6811
+ tokenEndpoint: NULLABLE_URI,
6812
+ userinfoEndpoint: NULLABLE_URI,
6813
+ jwksEndpoint: NULLABLE_URI,
6814
+ allowedRedirectUris: NULLABLE_STRINGS,
6815
+ claimMapping: {
6816
+ oneOf: [{ $ref: '#/components/schemas/ClaimMappingSpec' }, { type: 'null' }],
6817
+ },
6818
+ idpMetadataXml: NULLABLE_STRING,
6819
+ idpEntityId: NULLABLE_STRING,
6820
+ idpSsoUrl: NULLABLE_URI,
6821
+ idpCertificates: NULLABLE_STRINGS,
6822
+ spSigningKeyRef: NULLABLE_STRING,
6823
+ spDecryptionKeyRef: NULLABLE_STRING,
6824
+ wantAssertionsSigned: { type: ['boolean', 'null'] },
6825
+ attributeMapping: {
6826
+ oneOf: [
6827
+ {
6828
+ type: 'object',
6829
+ additionalProperties: false,
6830
+ properties: {
6831
+ userId: { type: 'string', minLength: 1 },
6832
+ email: { type: 'string', minLength: 1 },
6833
+ displayName: { type: 'string', minLength: 1 },
6834
+ },
6835
+ },
6836
+ { type: 'null' },
6837
+ ],
5496
6838
  },
5497
6839
  },
5498
6840
  };
5499
- export const RegisterIdentityProviderResultSchema = {
6841
+ export const UpdateIdentityProviderResultSchema = {
5500
6842
  type: 'object',
5501
6843
  additionalProperties: false,
5502
- required: ['providerId'],
6844
+ required: ['providerId', 'provider'],
5503
6845
  properties: {
5504
6846
  providerId: { type: 'string', minLength: 1 },
6847
+ provider: {
6848
+ $ref: '#/components/schemas/IdentityProviderConfig',
6849
+ description: 'The provider as stored now; its `signIn` is unchanged.',
6850
+ },
5505
6851
  },
5506
6852
  };
5507
- export const UnregisterIdentityProviderResultSchema = {
6853
+ export const IdentityProviderSignInUrlsSchema = {
6854
+ description: "What to give the identity provider so it can send people back, for a provider under this `providerId`: the same before it's registered, after, and after an unregister and a new registration, so the identity provider's side can be set up first. Not secrets: they're in every sign-in's browser redirects.",
5508
6855
  type: 'object',
5509
6856
  additionalProperties: false,
5510
- required: ['providerId', 'unregistered'],
6857
+ required: ['providerId', 'kind', 'signIn', 'registered'],
5511
6858
  properties: {
5512
6859
  providerId: { type: 'string', minLength: 1 },
5513
- unregistered: { type: 'boolean', const: true },
6860
+ kind: { $ref: '#/components/schemas/IdentityProviderKind' },
6861
+ signIn: { $ref: '#/components/schemas/IdentityProviderSignIn' },
6862
+ registered: {
6863
+ type: 'boolean',
6864
+ description: 'Whether a provider is registered under this `providerId` now.',
6865
+ },
5514
6866
  },
5515
6867
  };
5516
6868
  export const LoginBodySchema = {
@@ -5552,7 +6904,7 @@ export const CallbackResultSchema = {
5552
6904
  properties: {
5553
6905
  sessionToken: {
5554
6906
  type: 'string',
5555
- description: 'Opaque framework-issued session token (`kgi_sk_<sessionId>`). Send as `Authorization: Bearer <sessionToken>` on subsequent requests. The underlying provider access-token never leaves the server.',
6907
+ description: 'Opaque session token (`kgi_sk_…`), shown once: the server keeps only a hash of it. Never parse it. Send as `Authorization: Bearer <sessionToken>` on subsequent requests. The underlying provider access-token never leaves the server.',
5556
6908
  },
5557
6909
  sessionId: { type: 'string' },
5558
6910
  expiresAt: { type: 'string', format: 'date-time' },
@@ -5569,7 +6921,7 @@ export const LogoutResultSchema = {
5569
6921
  },
5570
6922
  };
5571
6923
  export const WhoamiResultSchema = {
5572
- description: "Introspection of the caller's current authentication context. Always carries `tenantId` and `scopes` (empty for static bearer tokens), plus `userId` when the token carries one; session-token callers additionally see `sessionId`, `providerId`, and `expiresAt`. `user` is the caller's directory record, present when the deployment wires an identity directory and it knows the `userId`. `reviewerRole` is set when the caller is a reviewer — its token carries a reviewer role, or its user is a registered reviewer — so clients can gate reviewer-only UI (the approvals surface) without a second round trip.",
6924
+ description: "Introspection of the caller's current authentication context. Always carries `tenantId` and `scopes` (empty for static bearer tokens), plus `userId` when the token carries one; `principal` says whom the caller acts as, and an API key adds `tokenId`, its `role` and the `projectId` it is limited to; session-token callers additionally see `sessionId`, `providerId`, and `expiresAt`. `user` is the caller's directory record, present when the deployment wires an identity directory and it knows the `userId`. `reviewerRole` is set when the caller is a reviewer — its token carries a reviewer role, or its user is a registered reviewer — so clients can gate reviewer-only UI (the approvals surface) without a second round trip.",
5573
6925
  type: 'object',
5574
6926
  additionalProperties: false,
5575
6927
  required: ['tenantId', 'scopes'],
@@ -5582,6 +6934,20 @@ export const WhoamiResultSchema = {
5582
6934
  expiresAt: { type: 'string', format: 'date-time' },
5583
6935
  reviewerRole: ReviewerRoleSchema,
5584
6936
  user: { $ref: '#/components/schemas/UserRecord' },
6937
+ principal: { $ref: '#/components/schemas/ApiKeyPrincipal' },
6938
+ tokenId: { type: 'string', description: "The caller's API key, when it is one." },
6939
+ role: {
6940
+ ...ApiTokenRoleSchema,
6941
+ description: "The caller's API key role, when the key has one.",
6942
+ },
6943
+ projectId: {
6944
+ type: 'string',
6945
+ description: "The project the caller's API key is limited to, when it is.",
6946
+ },
6947
+ tenantAdmin: {
6948
+ type: 'boolean',
6949
+ description: 'Whether the caller is a tenant admin, decided as the admin routes decide it: `admin` on the tenant when the runtime authorizes, otherwise the `tenant-admin` scope of a full key (never a `member` key or one limited to a project). A console shows its admin pages by it. Absent from older servers: read `scopes`.',
6950
+ },
5585
6951
  },
5586
6952
  };
5587
6953
  export const UserRecordSchema = {
@@ -5596,9 +6962,97 @@ export const UserRecordSchema = {
5596
6962
  displayName: { type: 'string' },
5597
6963
  createdAt: { type: 'string', format: 'date-time' },
5598
6964
  lastActiveAt: { type: 'string', format: 'date-time' },
6965
+ unregisteredAt: {
6966
+ type: 'string',
6967
+ format: 'date-time',
6968
+ description: 'When they were removed from the tenant (`POST /v1/identity/users/{userId}/unregister`); absent while they are here.',
6969
+ },
5599
6970
  metadata: { type: 'object', additionalProperties: true },
5600
6971
  },
5601
6972
  };
6973
+ export const UnregisterUserResultSchema = {
6974
+ description: 'A removed person, and what removing them took away (each 0 when they were already removed).',
6975
+ type: 'object',
6976
+ additionalProperties: false,
6977
+ required: ['user', 'keysRevoked', 'sessionsRevoked', 'grantsRemoved'],
6978
+ properties: {
6979
+ user: { $ref: '#/components/schemas/UserRecord' },
6980
+ keysRevoked: { type: 'integer', minimum: 0 },
6981
+ sessionsRevoked: { type: 'integer', minimum: 0 },
6982
+ grantsRemoved: { type: 'integer', minimum: 0 },
6983
+ },
6984
+ };
6985
+ export const CreateUserBodySchema = {
6986
+ type: 'object',
6987
+ additionalProperties: false,
6988
+ required: ['displayName'],
6989
+ properties: {
6990
+ displayName: { type: 'string', minLength: 1, maxLength: 200 },
6991
+ primaryEmail: { type: 'string', description: "Unique among the tenant's people." },
6992
+ },
6993
+ };
6994
+ export const PersonGrantsSchema = {
6995
+ type: 'object',
6996
+ additionalProperties: false,
6997
+ description: "What a person may do, as granted directly: tenant admin, a role on a project (its memberships), a role in a team, and the reviewer roster. What a team's or an org's grants imply is not expanded.",
6998
+ required: ['userId', 'projects', 'teams'],
6999
+ properties: {
7000
+ userId: { type: 'string' },
7001
+ tenantAdmin: {
7002
+ type: 'boolean',
7003
+ description: 'Whether the person is a tenant admin. Absent when the runtime has no authorization store: nothing grants it then.',
7004
+ },
7005
+ tenantMember: {
7006
+ type: 'boolean',
7007
+ description: "Whether the person is a tenant member: they read the tenant's settings (providers, policies, adapters, signing keys, deployments), not its projects. A person is one from being added. Absent when the runtime has no authorization store, or doesn't report it.",
7008
+ },
7009
+ projects: {
7010
+ type: 'array',
7011
+ description: 'Direct project memberships.',
7012
+ items: { $ref: '#/components/schemas/PersonProjectRole' },
7013
+ },
7014
+ teams: {
7015
+ type: 'array',
7016
+ description: 'Team memberships.',
7017
+ items: { $ref: '#/components/schemas/PersonTeamRole' },
7018
+ },
7019
+ reviewer: { $ref: '#/components/schemas/PersonReviewerRole' },
7020
+ },
7021
+ };
7022
+ export const PersonProjectRoleSchema = {
7023
+ type: 'object',
7024
+ additionalProperties: false,
7025
+ required: ['projectId', 'role'],
7026
+ description: "A person's direct role on a project.",
7027
+ properties: {
7028
+ projectId: { type: 'string' },
7029
+ role: { $ref: '#/components/schemas/ProjectRole' },
7030
+ },
7031
+ };
7032
+ export const PersonTeamRoleSchema = {
7033
+ type: 'object',
7034
+ additionalProperties: false,
7035
+ required: ['teamId', 'role'],
7036
+ description: "A person's role in a team.",
7037
+ properties: {
7038
+ teamId: { type: 'string' },
7039
+ role: { $ref: '#/components/schemas/TeamRole' },
7040
+ },
7041
+ };
7042
+ export const PersonReviewerRoleSchema = {
7043
+ type: 'object',
7044
+ additionalProperties: false,
7045
+ required: ['role'],
7046
+ description: "A person's active entry on the reviewer roster.",
7047
+ properties: { role: { $ref: '#/components/schemas/ReviewerRole' } },
7048
+ };
7049
+ export const PersonGrantBodySchema = {
7050
+ type: 'object',
7051
+ additionalProperties: false,
7052
+ required: ['kind'],
7053
+ description: "The grant to give or take: tenant admin. A person's project and team roles have their own membership routes.",
7054
+ properties: { kind: { type: 'string', enum: ['tenant-admin'] } },
7055
+ };
5602
7056
  export const UserCollectionPageSchema = {
5603
7057
  type: 'object',
5604
7058
  additionalProperties: false,
@@ -6061,58 +7515,20 @@ export const ExportComplianceEvidenceFilterSchema = {
6061
7515
  },
6062
7516
  };
6063
7517
  export const ExportComplianceEvidenceBodySchema = {
7518
+ description: 'Optional: no body exports every exportable kind, signed with the active key.',
6064
7519
  type: 'object',
6065
7520
  additionalProperties: false,
6066
- required: ['signingKeyId'],
6067
7521
  properties: {
6068
- signingKeyId: {
6069
- type: 'string',
6070
- minLength: 1,
6071
- description: 'The `SigningKeyId` the deployment plugs into its `signingKey` binding. Server looks up the private key via `signingKey.getPrivateKey(signingKeyId)` — 404 `signing-key-not-found` if unknown.',
6072
- },
7522
+ signingKeyId: SIGNING_KEY_ID_PROPERTY,
6073
7523
  filter: ExportComplianceEvidenceFilterSchema,
6074
7524
  },
6075
7525
  };
6076
- export const SignedComplianceEvidenceBundleSchema = {
6077
- description: 'Signed exportable bundle. `bundle` is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace); verifiers can pass those bytes directly to `verifyEd25519`. Bundle body: `{ bundleSchemaVersion, tenantId, filter, records, recordCount, exportedAt }`. Envelope shape identical to `ExportProvenanceResult` + audit-bundle — verifiers reuse one `verifyEd25519` wrapper across all three surfaces.',
6078
- type: 'object',
6079
- additionalProperties: false,
6080
- required: [
6081
- 'bundleSchemaVersion',
6082
- 'tenantId',
6083
- 'bundle',
6084
- 'algorithm',
6085
- 'signingKeyId',
6086
- 'signature',
6087
- 'publicKey',
6088
- 'canonicalization',
6089
- 'exportedAt',
6090
- ],
6091
- properties: {
6092
- bundleSchemaVersion: { type: 'string', const: '1.0.0' },
6093
- tenantId: { type: 'string', format: 'uuid' },
6094
- bundle: {
6095
- type: 'string',
6096
- description: 'Base64-encoded canonical JSON of the bundle body.',
6097
- },
6098
- algorithm: { type: 'string', const: 'ed25519' },
6099
- signingKeyId: { type: 'string' },
6100
- signature: {
6101
- type: 'string',
6102
- description: 'Base64-encoded Ed25519 signature bytes over `bundle` (after base64-decode).',
6103
- },
6104
- publicKey: {
6105
- type: 'string',
6106
- description: 'PEM-encoded Ed25519 public key (DER SPKI envelope). Callers can pass this straight into `parsePublicKeyPem` for verification.',
6107
- },
6108
- canonicalization: {
6109
- type: 'string',
6110
- const: 'sorted-key-json',
6111
- description: 'Canonicalization algorithm — sorted-key JSON, no whitespace. Same algorithm as `canonicalize`.',
6112
- },
6113
- exportedAt: { type: 'string', format: 'date-time' },
6114
- },
6115
- };
7526
+ export const SignedComplianceEvidenceBundleSchema = signedExportEnvelope({
7527
+ description: 'Signed compliance evidence. Body: `{ bundleSchemaVersion, tenantId, filter, records, recordCount, exportedAt }`.',
7528
+ kind: 'compliance',
7529
+ subject: ['tenantId', { type: 'string', format: 'uuid' }],
7530
+ versionDescription: "The body's version, semver: `1.0.0`.",
7531
+ });
6116
7532
  // ---------------- platform hierarchy ----------------
6117
7533
  /**
6118
7534
  * `Org` — optional structural subdivision within a tenant. Small tenants ignore Orgs entirely.
@@ -6354,11 +7770,17 @@ export const ProjectMembershipCollectionPageSchema = {
6354
7770
  },
6355
7771
  };
6356
7772
  export const AddProjectMembershipBodySchema = {
7773
+ description: 'Exactly one of `userId` and `email` names the person.',
6357
7774
  type: 'object',
6358
7775
  additionalProperties: false,
6359
- required: ['userId', 'role'],
7776
+ required: ['role'],
6360
7777
  properties: {
6361
7778
  userId: { type: 'string', minLength: 1 },
7779
+ email: {
7780
+ type: 'string',
7781
+ minLength: 1,
7782
+ description: "The person's email, as the tenant has it.",
7783
+ },
6362
7784
  role: { $ref: '#/components/schemas/ProjectRole' },
6363
7785
  },
6364
7786
  };
@@ -6900,11 +8322,10 @@ export const TriggerStatusSchema = {
6900
8322
  export const ScheduleRecordSchema = {
6901
8323
  type: 'object',
6902
8324
  additionalProperties: false,
8325
+ description: 'A schedule: what it runs (a flow at a version, or an agent), when (a cron expression in a timezone), as whom (its owner), and what it does after a gap or while a run is still going.',
6903
8326
  required: [
6904
8327
  'scheduleId',
6905
8328
  'triggerId',
6906
- 'flowId',
6907
- 'flowVersion',
6908
8329
  'cronExpression',
6909
8330
  'label',
6910
8331
  'status',
@@ -6919,8 +8340,31 @@ export const ScheduleRecordSchema = {
6919
8340
  description: 'Domain-friendly alias for `triggerId` — the trigger id (a UUID). Use interchangeably in admin URLs.',
6920
8341
  },
6921
8342
  triggerId: { type: 'string' },
6922
- flowId: { type: 'string', minLength: 1 },
8343
+ flowId: {
8344
+ type: 'string',
8345
+ minLength: 1,
8346
+ description: 'A schedule that runs a flow: the flow, at `flowVersion`.',
8347
+ },
6923
8348
  flowVersion: { type: 'string', minLength: 1 },
8349
+ agentId: {
8350
+ type: 'string',
8351
+ minLength: 1,
8352
+ description: "A schedule that runs an agent: the agent, at `agentVersion`, else its version live for the schedule's project (else the latest), as a run that names none.",
8353
+ },
8354
+ agentVersion: { type: 'string', minLength: 1 },
8355
+ improve: {
8356
+ $ref: '#/components/schemas/ImproveScheduleTarget',
8357
+ description: 'A schedule that starts improvement passes: on this agent, for this scope, when enough new trusted "no" judgments have come in (`input`: the threshold, the monthly cap and the pass options).',
8358
+ },
8359
+ projectId: {
8360
+ type: 'string',
8361
+ format: 'uuid',
8362
+ description: "The schedule's project: its runs are this project's.",
8363
+ },
8364
+ owner: {
8365
+ $ref: '#/components/schemas/TriggerOwner',
8366
+ description: 'Who its runs act as: whoever registered it, until an admin takes it over (`POST …/owner`). Checked again at every fire.',
8367
+ },
6924
8368
  cronExpression: {
6925
8369
  type: 'string',
6926
8370
  minLength: 1,
@@ -6931,20 +8375,158 @@ export const ScheduleRecordSchema = {
6931
8375
  description: 'IANA timezone (e.g. `UTC`, `America/New_York`). Absent → `UTC`.',
6932
8376
  },
6933
8377
  input: {
6934
- description: 'Static input handed to the flow on every fire. Absent → `{}`.',
8378
+ description: 'Static input handed to the run on every fire. Absent → `{}`.',
8379
+ },
8380
+ catchUp: {
8381
+ type: 'string',
8382
+ enum: ['latest', 'skip'],
8383
+ description: 'After a gap (the runtime was down, or a fire is later than `startingDeadlineSeconds`): `latest` runs once, for the latest missed occurrence, and its fire says how many it missed; `skip` drops the missed occurrences. Never a run per missed occurrence.',
8384
+ },
8385
+ overlap: {
8386
+ type: 'string',
8387
+ enum: ['skip', 'allow'],
8388
+ description: 'When an occurrence comes while the previous run of this schedule is still running: `skip` records the fire as skipped; `allow` starts another run.',
8389
+ },
8390
+ startingDeadlineSeconds: {
8391
+ type: 'integer',
8392
+ minimum: 1,
8393
+ description: 'How late a fire may start and still count as on time; past it, `catchUp` applies.',
6935
8394
  },
6936
8395
  label: { type: ['string', 'null'] },
6937
8396
  status: { $ref: '#/components/schemas/TriggerStatus' },
8397
+ statusReason: {
8398
+ type: 'string',
8399
+ description: 'Why the runtime paused it: repeated fires that were refused (the owner lost access) or failed. Skipped fires (an overlap, an erasure in progress) never count.',
8400
+ },
6938
8401
  nextFireAt: {
6939
8402
  type: ['string', 'null'],
6940
8403
  format: 'date-time',
6941
8404
  description: 'Wall-clock time of the next scheduled fire. `null` on paused rows if the cron scheduler never re-armed.',
6942
8405
  },
8406
+ upcoming: {
8407
+ type: 'array',
8408
+ items: { type: 'string', format: 'date-time' },
8409
+ description: 'The next occurrences, when the request asked for them (`?upcoming=N`).',
8410
+ },
6943
8411
  lastFiredAt: { type: ['string', 'null'], format: 'date-time' },
6944
8412
  createdAt: { type: 'string', format: 'date-time' },
6945
8413
  updatedAt: { type: 'string', format: 'date-time' },
6946
8414
  },
6947
8415
  };
8416
+ export const TriggerOwnerSchema = {
8417
+ type: 'object',
8418
+ additionalProperties: false,
8419
+ required: ['kind', 'id'],
8420
+ properties: {
8421
+ kind: { type: 'string', enum: ['user', 'service'] },
8422
+ id: { type: 'string' },
8423
+ },
8424
+ };
8425
+ export const ImproveScheduleTargetSchema = {
8426
+ type: 'object',
8427
+ additionalProperties: false,
8428
+ required: ['agentId', 'scope'],
8429
+ description: 'What an improve schedule works on: the agent, and the live scope its passes propose for and count judgments in.',
8430
+ properties: {
8431
+ agentId: { type: 'string', minLength: 1 },
8432
+ scope: { $ref: '#/components/schemas/LiveScope' },
8433
+ },
8434
+ };
8435
+ export const ImproveScheduleInputSchema = {
8436
+ type: 'object',
8437
+ additionalProperties: false,
8438
+ description: 'An improve schedule\'s `config.input`. Each fire counts the trusted "no" judgments (recorded under a restricted judge class) on the agent\'s runs in the scope since its last pass. When there are enough, across enough runs and judges, it starts a pass on a fresh test set of those runs; otherwise the fire is `skipped`, saying which count was short. A pass that proposes asks for the review at once.',
8439
+ properties: {
8440
+ tiers: { type: 'array', items: { type: 'string', enum: ['settings', 'prompt'] } },
8441
+ objective: { type: 'string', enum: ['weightedYesShare', 'weightedPrecisionAtK'] },
8442
+ classWeights: { type: 'string', enum: ['restricted-only', 'as-recorded'] },
8443
+ model: {
8444
+ type: 'object',
8445
+ additionalProperties: false,
8446
+ required: ['providerId', 'model'],
8447
+ properties: { providerId: { type: 'string' }, model: { type: 'string' } },
8448
+ },
8449
+ candidates: { type: 'integer', minimum: 1, maximum: 5 },
8450
+ budget: {
8451
+ type: 'object',
8452
+ additionalProperties: false,
8453
+ description: "Each pass's budget (default $5 and 30 candidates), never more than what's left of the month's cap.",
8454
+ properties: {
8455
+ maxCostUsd: { type: 'number', exclusiveMinimum: 0, maximum: 100 },
8456
+ maxCandidates: { type: 'integer', minimum: 1, maximum: 200 },
8457
+ },
8458
+ },
8459
+ threshold: {
8460
+ type: 'object',
8461
+ additionalProperties: false,
8462
+ description: 'Default 5 judgments, across 3 runs, from 2 judges.',
8463
+ properties: {
8464
+ judgments: { type: 'integer', minimum: 1, maximum: 1000 },
8465
+ runs: { type: 'integer', minimum: 1, maximum: 1000 },
8466
+ judges: { type: 'integer', minimum: 1, maximum: 1000 },
8467
+ },
8468
+ },
8469
+ monthlyCapUsd: {
8470
+ type: 'number',
8471
+ exclusiveMinimum: 0,
8472
+ maximum: 1000,
8473
+ description: 'The most its passes may cost in a calendar month (UTC). Default 20.',
8474
+ },
8475
+ },
8476
+ };
8477
+ export const ScheduleFireSchema = {
8478
+ type: 'object',
8479
+ additionalProperties: false,
8480
+ description: 'One fire of a schedule (an occurrence, or a `run-now`) and what came of it. `pending` while its run is being started.',
8481
+ required: ['fireId', 'scheduleId', 'triggerId', 'firedAt', 'outcome'],
8482
+ properties: {
8483
+ fireId: { type: 'string' },
8484
+ scheduleId: { type: 'string' },
8485
+ triggerId: { type: 'string' },
8486
+ scheduledFor: {
8487
+ type: 'string',
8488
+ format: 'date-time',
8489
+ description: 'The occurrence it is for; absent on a `run-now` fire.',
8490
+ },
8491
+ firedAt: { type: 'string', format: 'date-time' },
8492
+ outcome: {
8493
+ type: 'string',
8494
+ enum: [
8495
+ 'pending',
8496
+ 'started',
8497
+ 'skipped-overlap',
8498
+ 'skipped-erasure',
8499
+ 'skipped',
8500
+ 'refused',
8501
+ 'failed',
8502
+ ],
8503
+ description: "`skipped-overlap`: the previous fire's run was still going (`overlap: skip`). `skipped-erasure`: the person the fire acts for is being erased, so no new run starts for them until the erasure completes. `skipped`: what an improve schedule waits for wasn't there (its threshold, or its monthly cap), as `detail` says. None of the skipped outcomes counts toward the auto-pause; `refused` and `failed` do.",
8504
+ },
8505
+ runId: { type: 'string', format: 'uuid', description: 'The run it started.' },
8506
+ passId: {
8507
+ type: 'string',
8508
+ format: 'uuid',
8509
+ description: 'The improvement pass it started (an improve schedule).',
8510
+ },
8511
+ detail: { type: 'string', description: 'Why it was refused, skipped or failed.' },
8512
+ missedCount: {
8513
+ type: 'integer',
8514
+ minimum: 1,
8515
+ description: 'Occurrences this fire stood in for after a gap (`catchUp: latest`).',
8516
+ },
8517
+ manual: { type: 'boolean', description: 'A `run-now` fire, outside the schedule.' },
8518
+ },
8519
+ };
8520
+ export const ScheduleFirePageSchema = {
8521
+ type: 'object',
8522
+ additionalProperties: false,
8523
+ required: ['data', 'hasMore'],
8524
+ properties: {
8525
+ data: { type: 'array', items: { $ref: '#/components/schemas/ScheduleFire' } },
8526
+ hasMore: { type: 'boolean' },
8527
+ nextCursor: { type: 'string' },
8528
+ },
8529
+ };
6948
8530
  export const ScheduleCollectionPageSchema = {
6949
8531
  type: 'object',
6950
8532
  additionalProperties: false,
@@ -6958,10 +8540,26 @@ export const ScheduleCollectionPageSchema = {
6958
8540
  export const RegisterScheduleBodySchema = {
6959
8541
  type: 'object',
6960
8542
  additionalProperties: false,
6961
- required: ['flowId', 'flowVersion', 'config'],
8543
+ description: 'Name what it runs: `flowId` with `flowVersion`, `agentId` (with an optional `agentVersion`), or `improve` (improvement passes). Registering needs `write` on the project and `execute` on what it runs (`publish` on the agent for `improve`); its runs act as the caller.',
8544
+ required: ['config'],
6962
8545
  properties: {
6963
- flowId: { type: 'string', minLength: 1 },
8546
+ flowId: { type: 'string', minLength: 1, description: 'Run a flow (with `flowVersion`).' },
6964
8547
  flowVersion: { type: 'string', minLength: 1 },
8548
+ agentId: {
8549
+ type: 'string',
8550
+ minLength: 1,
8551
+ description: 'Run an agent (instead of a flow): at `agentVersion`, else its live version.',
8552
+ },
8553
+ agentVersion: { type: 'string', minLength: 1 },
8554
+ improve: {
8555
+ $ref: '#/components/schemas/ImproveScheduleTarget',
8556
+ description: 'Start an improvement pass instead of a run (instead of `flowId` or `agentId`). Its `config.input` is the pass options; registering needs `publish` on the agent.',
8557
+ },
8558
+ projectId: {
8559
+ type: 'string',
8560
+ format: 'uuid',
8561
+ description: "The schedule's project. Absent → the tenant's default project.",
8562
+ },
6965
8563
  config: {
6966
8564
  type: 'object',
6967
8565
  additionalProperties: false,
@@ -6969,30 +8567,62 @@ export const RegisterScheduleBodySchema = {
6969
8567
  properties: {
6970
8568
  cronExpression: { type: 'string', minLength: 1 },
6971
8569
  timezone: { type: 'string' },
6972
- input: {},
8570
+ input: {
8571
+ description: "What each run gets. An agent schedule's runs take the agent payload, `{ userMessage, parameters? }`, so it needs `userMessage`; a flow's take the flow's input. An improve schedule's is `ImproveScheduleInput`, kept with its defaults applied.",
8572
+ },
6973
8573
  },
6974
8574
  },
8575
+ catchUp: { type: 'string', enum: ['latest', 'skip'], description: 'Default `latest`.' },
8576
+ overlap: { type: 'string', enum: ['skip', 'allow'], description: 'Default `skip`.' },
8577
+ startingDeadlineSeconds: {
8578
+ type: 'integer',
8579
+ minimum: 1,
8580
+ maximum: 86400,
8581
+ description: 'Default 600.',
8582
+ },
6975
8583
  label: { type: 'string' },
6976
8584
  },
6977
8585
  };
6978
8586
  export const PatchScheduleBodySchema = {
6979
8587
  type: 'object',
6980
8588
  additionalProperties: false,
8589
+ description: 'Change what it runs (the target fields, as at registration, which also needs `execute` on the new target), when, or its policies.',
6981
8590
  properties: {
8591
+ flowId: { type: 'string', minLength: 1, description: 'Run a flow (with `flowVersion`).' },
8592
+ flowVersion: { type: 'string', minLength: 1 },
8593
+ agentId: {
8594
+ type: 'string',
8595
+ minLength: 1,
8596
+ description: 'Run an agent (instead of a flow): at `agentVersion`, else its live version.',
8597
+ },
8598
+ agentVersion: { type: 'string', minLength: 1 },
8599
+ improve: {
8600
+ $ref: '#/components/schemas/ImproveScheduleTarget',
8601
+ description: 'Start an improvement pass instead of a run (instead of `flowId` or `agentId`). Its `config.input` is the pass options; registering needs `publish` on the agent.',
8602
+ },
6982
8603
  config: {
6983
8604
  type: 'object',
6984
8605
  additionalProperties: false,
6985
8606
  properties: {
6986
8607
  cronExpression: { type: 'string' },
6987
8608
  timezone: { type: 'string' },
6988
- input: {},
8609
+ input: {
8610
+ description: "What each run gets. An agent schedule's runs take the agent payload, `{ userMessage, parameters? }`, so it needs `userMessage`; a flow's take the flow's input. An improve schedule's is `ImproveScheduleInput`, kept with its defaults applied.",
8611
+ },
6989
8612
  },
6990
8613
  },
8614
+ catchUp: { type: 'string', enum: ['latest', 'skip'], description: 'Default `latest`.' },
8615
+ overlap: { type: 'string', enum: ['skip', 'allow'], description: 'Default `skip`.' },
8616
+ startingDeadlineSeconds: {
8617
+ type: 'integer',
8618
+ minimum: 1,
8619
+ maximum: 86400,
8620
+ description: 'Default 600.',
8621
+ },
6991
8622
  label: {
6992
8623
  type: ['string', 'null'],
6993
8624
  description: '`null` clears the label; omit to leave unchanged.',
6994
8625
  },
6995
- flowVersion: { type: 'string' },
6996
8626
  },
6997
8627
  };
6998
8628
  // ---------- event triggers (event kind) ----------
@@ -7199,7 +8829,7 @@ export const WebhookTriggerUnregisterResultSchema = {
7199
8829
  // ---------- outbound webhook endpoints ----------
7200
8830
  export const WebhookEventTypeSchema = {
7201
8831
  type: 'string',
7202
- enum: ['run.finished'],
8832
+ enum: ['run.finished', 'improvement-pass.finished'],
7203
8833
  description: 'An event type an endpoint can subscribe to.',
7204
8834
  };
7205
8835
  export const WebhookEndpointFilterSchema = {
@@ -7387,6 +9017,31 @@ export const RunFinishedEventSchema = {
7387
9017
  },
7388
9018
  },
7389
9019
  };
9020
+ export const ImprovementPassFinishedEventSchema = {
9021
+ type: 'object',
9022
+ additionalProperties: false,
9023
+ required: ['id', 'type', 'createdAt', 'data'],
9024
+ description: 'An improvement pass ended (`completed`, `failed` or `cancelled`): one a person started, or one an `improve` schedule did. Its outcome names the proposal it wrote, if it wrote one.',
9025
+ properties: {
9026
+ id: {
9027
+ type: 'string',
9028
+ description: 'Event id, also sent as the `webhook-id` header; the same on every retry.',
9029
+ },
9030
+ type: { type: 'string', const: 'improvement-pass.finished' },
9031
+ createdAt: { type: 'string', format: 'date-time' },
9032
+ data: {
9033
+ type: 'object',
9034
+ additionalProperties: false,
9035
+ required: ['pass'],
9036
+ properties: {
9037
+ pass: {
9038
+ $ref: '#/components/schemas/ImprovementPass',
9039
+ description: 'The pass, as `GET /v1/improvement-passes/{passId}` shows it.',
9040
+ },
9041
+ },
9042
+ },
9043
+ },
9044
+ };
7390
9045
  export const WebhookTestEventSchema = {
7391
9046
  type: 'object',
7392
9047
  additionalProperties: false,
@@ -7407,12 +9062,14 @@ export const WebhookEventSchema = {
7407
9062
  description: 'The JSON body of every webhook request.',
7408
9063
  oneOf: [
7409
9064
  { $ref: '#/components/schemas/RunFinishedEvent' },
9065
+ { $ref: '#/components/schemas/ImprovementPassFinishedEvent' },
7410
9066
  { $ref: '#/components/schemas/WebhookTestEvent' },
7411
9067
  ],
7412
9068
  discriminator: {
7413
9069
  propertyName: 'type',
7414
9070
  mapping: {
7415
9071
  'run.finished': '#/components/schemas/RunFinishedEvent',
9072
+ 'improvement-pass.finished': '#/components/schemas/ImprovementPassFinishedEvent',
7416
9073
  'webhook.test': '#/components/schemas/WebhookTestEvent',
7417
9074
  },
7418
9075
  },
@@ -7503,6 +9160,7 @@ export const COMPONENT_SCHEMAS = [
7503
9160
  ['HealthResult', HealthResultSchema],
7504
9161
  ['RunStatus', RunStatusSchema],
7505
9162
  ['RunAgent', RunAgentSchema],
9163
+ ['RunTrigger', RunTriggerSchema],
7506
9164
  ['ScopeSegment', ScopeSegmentSchema],
7507
9165
  ['LiveScopeTenant', LiveScopeTenantSchema],
7508
9166
  ['LiveScopeOrg', LiveScopeOrgSchema],
@@ -7527,6 +9185,7 @@ export const COMPONENT_SCHEMAS = [
7527
9185
  ['RollbackBody', RollbackBodySchema],
7528
9186
  ['UnpinBody', UnpinBodySchema],
7529
9187
  ['Run', RunSchema],
9188
+ ['RunFailure', RunFailureSchema],
7530
9189
  ['StartRunOptions', StartRunOptionsSchema],
7531
9190
  ['StartRunBody', StartRunBodySchema],
7532
9191
  ['ResumeRunBody', ResumeRunBodySchema],
@@ -7541,6 +9200,17 @@ export const COMPONENT_SCHEMAS = [
7541
9200
  ['MintTokenResult', MintTokenResultSchema],
7542
9201
  ['ApiToken', ApiTokenSchema],
7543
9202
  ['ApiTokenPage', ApiTokenPageSchema],
9203
+ ['ApiKeyPrincipal', ApiKeyPrincipalSchema],
9204
+ ['ServiceAccountGrantTenantAdmin', ServiceAccountGrantTenantAdminSchema],
9205
+ ['ServiceAccountGrantTenantMember', ServiceAccountGrantTenantMemberSchema],
9206
+ ['ServiceAccountGrantProject', ServiceAccountGrantProjectSchema],
9207
+ ['ServiceAccountGrant', ServiceAccountGrantSchema],
9208
+ ['ServiceAccountGrantBody', ServiceAccountGrantBodySchema],
9209
+ ['ServiceAccountUngrantProject', ServiceAccountUngrantProjectSchema],
9210
+ ['ServiceAccountUngrantBody', ServiceAccountUngrantBodySchema],
9211
+ ['ServiceAccount', ServiceAccountSchema],
9212
+ ['ServiceAccountPage', ServiceAccountPageSchema],
9213
+ ['CreateServiceAccountBody', CreateServiceAccountBodySchema],
7544
9214
  ['RevokeTokenResult', RevokeTokenResultSchema],
7545
9215
  ['TrustedSigningKey', TrustedSigningKeySchema],
7546
9216
  ['TrustSigningKeyBody', TrustSigningKeyBodySchema],
@@ -7562,6 +9232,8 @@ export const COMPONENT_SCHEMAS = [
7562
9232
  ['ReviewerCollectionPage', ReviewerCollectionPageSchema],
7563
9233
  ['RegisterReviewerBody', RegisterReviewerBodySchema],
7564
9234
  ['UnregisterReviewerResult', UnregisterReviewerResultSchema],
9235
+ ['ExportSigningKey', ExportSigningKeySchema],
9236
+ ['ExportSigningKeyList', ExportSigningKeyListSchema],
7565
9237
  ['ExportAuditBundleBody', ExportAuditBundleBodySchema],
7566
9238
  ['ExportAuditBundleResult', ExportAuditBundleResultSchema],
7567
9239
  ['ObservationStatus', ObservationStatusSchema],
@@ -7591,6 +9263,7 @@ export const COMPONENT_SCHEMAS = [
7591
9263
  ['BuildJudgedSuiteResult', BuildJudgedSuiteResultSchema],
7592
9264
  ['PromptParameter', PromptParameterSchema],
7593
9265
  ['RetrievalIntent', RetrievalIntentSchema],
9266
+ ['AgentMemoryPolicy', AgentMemoryPolicySchema],
7594
9267
  ['ConversationPolicy', ConversationPolicySchema],
7595
9268
  ['TurnBudget', TurnBudgetSchema],
7596
9269
  ['Capability', CapabilitySchema],
@@ -7659,30 +9332,49 @@ export const COMPONENT_SCHEMAS = [
7659
9332
  ['SourceFreshness', SourceFreshnessSchema],
7660
9333
  ['SourceRefresh', SourceRefreshSchema],
7661
9334
  ['FactSource', FactSourceSchema],
9335
+ ['FactSubject', FactSubjectSchema],
9336
+ ['FactAttribution', FactAttributionSchema],
9337
+ ['FactGeneratedBy', FactGeneratedBySchema],
7662
9338
  ['Fact', FactSchema],
7663
9339
  ['FactCollectionPage', FactCollectionPageSchema],
7664
9340
  ['WriteFactBody', WriteFactBodySchema],
7665
- ['SupersedeFactResult', SupersedeFactResultSchema],
9341
+ ['SupersedeFactBody', SupersedeFactBodySchema],
9342
+ ['VerifyFactBody', VerifyFactBodySchema],
9343
+ ['FactRevisionList', FactRevisionListSchema],
7666
9344
  ['RetrieveIntent', RetrieveIntentSchema],
7667
9345
  ['RetrieveMemoryBody', RetrieveMemoryBodySchema],
7668
9346
  ['RetrievalHit', RetrievalHitSchema],
7669
9347
  ['RetrieveMemoryResult', RetrieveMemoryResultSchema],
9348
+ ['MemoryErasureFactSelector', MemoryErasureFactSelectorSchema],
9349
+ ['MemoryErasureSubjectSelector', MemoryErasureSubjectSelectorSchema],
9350
+ ['MemoryErasureConversationSelector', MemoryErasureConversationSelectorSchema],
9351
+ ['MemoryErasureSelector', MemoryErasureSelectorSchema],
9352
+ ['CreateMemoryErasureBody', CreateMemoryErasureBodySchema],
9353
+ ['MemoryErasure', MemoryErasureSchema],
9354
+ ['MemoryErasureCreated', MemoryErasureCreatedSchema],
9355
+ ['MemoryErasurePage', MemoryErasurePageSchema],
9356
+ ['MemoryErasureLedgerEntry', MemoryErasureLedgerEntrySchema],
9357
+ ['MemoryErasureLedger', MemoryErasureLedgerSchema],
9358
+ ['ReplayMemoryErasuresBody', ReplayMemoryErasuresBodySchema],
9359
+ ['ResumeMemoryErasureBody', ResumeMemoryErasureBodySchema],
9360
+ ['ReplayMemoryErasuresResult', ReplayMemoryErasuresResultSchema],
7670
9361
  ['ProposalTier', ProposalTierSchema],
7671
9362
  ['FixProposalStatus', FixProposalStatusSchema],
7672
- ['PatternRef', PatternRefSchema],
7673
- ['ProposedChange', ProposedChangeSchema],
9363
+ ['ProposalChange', ProposalChangeSchema],
9364
+ ['ProposalDrafter', ProposalDrafterSchema],
9365
+ ['ProposalCandidate', ProposalCandidateSchema],
9366
+ ['ProposalEvaluation', ProposalEvaluationSchema],
9367
+ ['ProposalPromotion', ProposalPromotionSchema],
7674
9368
  ['FixProposal', FixProposalSchema],
7675
9369
  ['FixProposalCollectionPage', FixProposalCollectionPageSchema],
7676
- ['PassCriterion', PassCriterionSchema],
7677
- ['DraftProposalBody', DraftProposalBodySchema],
7678
- ['DryRunProposalBody', DryRunProposalBodySchema],
7679
- ['DryRunProposalResult', DryRunProposalResultSchema],
7680
- ['SubmitReviewProposalBody', SubmitReviewProposalBodySchema],
7681
- ['SubmitReviewProposalResult', SubmitReviewProposalResultSchema],
7682
- ['ApplyProposalBody', ApplyProposalBodySchema],
7683
- ['ApplyProposalResult', ApplyProposalResultSchema],
7684
- ['RollbackProposalBody', RollbackProposalBodySchema],
7685
- ['RollbackProposalResult', RollbackProposalResultSchema],
9370
+ ['ImprovementBudget', ImprovementBudgetSchema],
9371
+ ['ImprovementPassOutcome', ImprovementPassOutcomeSchema],
9372
+ ['ImprovementPass', ImprovementPassSchema],
9373
+ ['ImprovementPassCollectionPage', ImprovementPassCollectionPageSchema],
9374
+ ['ImproveBody', ImproveBodySchema],
9375
+ ['CreateProposalBody', CreateProposalBodySchema],
9376
+ ['EvaluateProposalBody', EvaluateProposalBodySchema],
9377
+ ['ProposalReasonBody', ProposalReasonBodySchema],
7686
9378
  ['WithdrawProposalBody', WithdrawProposalBodySchema],
7687
9379
  ['ProvenanceNodeKind', ProvenanceNodeKindSchema],
7688
9380
  ['ProvenanceEdgeKind', ProvenanceEdgeKindSchema],
@@ -7701,6 +9393,7 @@ export const COMPONENT_SCHEMAS = [
7701
9393
  ['DeleteArtifactResult', DeleteArtifactResultSchema],
7702
9394
  ['Feature', FeatureSchema],
7703
9395
  ['CapabilityDescriptor', CapabilityDescriptorSchema],
9396
+ ['CapabilityProvider', CapabilityProviderSchema],
7704
9397
  ['CapabilityCollectionPage', CapabilityCollectionPageSchema],
7705
9398
  ['ModelThinking', ModelThinkingSchema],
7706
9399
  ['ProviderCost', ProviderCostSchema],
@@ -7711,6 +9404,8 @@ export const COMPONENT_SCHEMAS = [
7711
9404
  ['RegisterProviderResult', RegisterProviderResultSchema],
7712
9405
  ['UnregisterProviderResult', UnregisterProviderResultSchema],
7713
9406
  ['ProviderCapabilitiesResult', ProviderCapabilitiesResultSchema],
9407
+ ['AdapterConfigProblem', AdapterConfigProblemSchema],
9408
+ ['ProviderCheckResult', ProviderCheckResultSchema],
7714
9409
  ['MCPTransport', MCPTransportSchema],
7715
9410
  ['MCPEndpoint', MCPEndpointSchema],
7716
9411
  ['MCPEndpointSecretRef', MCPEndpointSecretRefSchema],
@@ -7777,6 +9472,8 @@ export const COMPONENT_SCHEMAS = [
7777
9472
  ['EvalRunAgentRef', EvalRunAgentRefSchema],
7778
9473
  ['EvalRunFlowRef', EvalRunFlowRefSchema],
7779
9474
  ['EvalBaseline', EvalBaselineSchema],
9475
+ ['EvalOverrides', EvalOverridesSchema],
9476
+ ['EvalSample', EvalSampleSchema],
7780
9477
  ['EvalComparison', EvalComparisonSchema],
7781
9478
  ['ComparisonMetric', ComparisonMetricSchema],
7782
9479
  ['ComparisonCandidate', ComparisonCandidateSchema],
@@ -7790,10 +9487,22 @@ export const COMPONENT_SCHEMAS = [
7790
9487
  ['IdentityProviderKind', IdentityProviderKindSchema],
7791
9488
  ['ClaimMappingScopesSpec', ClaimMappingScopesSpecSchema],
7792
9489
  ['ClaimMappingSpec', ClaimMappingSpecSchema],
9490
+ ['IdentityProviderSignIn', IdentityProviderSignInSchema],
9491
+ ['OidcIdentityProviderConfig', OidcIdentityProviderConfigSchema],
9492
+ ['SamlIdentityProviderConfig', SamlIdentityProviderConfigSchema],
9493
+ ['OAuth2IdentityProviderConfig', OAuth2IdentityProviderConfigSchema],
7793
9494
  ['IdentityProviderConfig', IdentityProviderConfigSchema],
9495
+ ['RegisterIdentityProviderBody', RegisterIdentityProviderBodySchema],
9496
+ ['GetIdentityProviderResult', GetIdentityProviderResultSchema],
7794
9497
  ['IdentityProviderCollectionPage', IdentityProviderCollectionPageSchema],
9498
+ ['SignInOption', SignInOptionSchema],
9499
+ ['SignInOptions', SignInOptionsSchema],
9500
+ ['TokenSignInResult', TokenSignInResultSchema],
7795
9501
  ['RegisterIdentityProviderResult', RegisterIdentityProviderResultSchema],
7796
9502
  ['UnregisterIdentityProviderResult', UnregisterIdentityProviderResultSchema],
9503
+ ['UpdateIdentityProviderBody', UpdateIdentityProviderBodySchema],
9504
+ ['UpdateIdentityProviderResult', UpdateIdentityProviderResultSchema],
9505
+ ['IdentityProviderSignInUrls', IdentityProviderSignInUrlsSchema],
7797
9506
  ['LoginBody', LoginBodySchema],
7798
9507
  ['AuthorizationResponse', AuthorizationResponseSchema],
7799
9508
  ['CallbackBody', CallbackBodySchema],
@@ -7802,6 +9511,13 @@ export const COMPONENT_SCHEMAS = [
7802
9511
  ['LogoutResult', LogoutResultSchema],
7803
9512
  ['WhoamiResult', WhoamiResultSchema],
7804
9513
  ['UserRecord', UserRecordSchema],
9514
+ ['UnregisterUserResult', UnregisterUserResultSchema],
9515
+ ['CreateUserBody', CreateUserBodySchema],
9516
+ ['PersonGrants', PersonGrantsSchema],
9517
+ ['PersonProjectRole', PersonProjectRoleSchema],
9518
+ ['PersonTeamRole', PersonTeamRoleSchema],
9519
+ ['PersonReviewerRole', PersonReviewerRoleSchema],
9520
+ ['PersonGrantBody', PersonGrantBodySchema],
7805
9521
  ['UserCollectionPage', UserCollectionPageSchema],
7806
9522
  ['IdentitySessionSummary', IdentitySessionSummarySchema],
7807
9523
  ['IdentitySessionCollectionPage', IdentitySessionCollectionPageSchema],
@@ -7889,6 +9605,9 @@ export const COMPONENT_SCHEMAS = [
7889
9605
  // Trigger surface.
7890
9606
  ['TriggerStatus', TriggerStatusSchema],
7891
9607
  ['ScheduleRecord', ScheduleRecordSchema],
9608
+ ['TriggerOwner', TriggerOwnerSchema],
9609
+ ['ScheduleFire', ScheduleFireSchema],
9610
+ ['ScheduleFirePage', ScheduleFirePageSchema],
7892
9611
  ['ScheduleCollectionPage', ScheduleCollectionPageSchema],
7893
9612
  ['RegisterScheduleBody', RegisterScheduleBodySchema],
7894
9613
  ['PatchScheduleBody', PatchScheduleBodySchema],
@@ -7916,6 +9635,9 @@ export const COMPONENT_SCHEMAS = [
7916
9635
  ['RunTreeUsage', RunTreeUsageSchema],
7917
9636
  ['FinishedRun', FinishedRunSchema],
7918
9637
  ['RunFinishedEvent', RunFinishedEventSchema],
9638
+ ['ImprovementPassFinishedEvent', ImprovementPassFinishedEventSchema],
9639
+ ['ImproveScheduleTarget', ImproveScheduleTargetSchema],
9640
+ ['ImproveScheduleInput', ImproveScheduleInputSchema],
7919
9641
  ['WebhookTestEvent', WebhookTestEventSchema],
7920
9642
  ['WebhookEvent', WebhookEventSchema],
7921
9643
  ['WebhookDeliveryStatus', WebhookDeliveryStatusSchema],