@kindgi/api 0.0.0-bootstrap.0 → 0.1.0

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 (505) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +216 -1
  3. package/dist/adapter-binding.d.ts +177 -0
  4. package/dist/adapter-binding.d.ts.map +1 -0
  5. package/dist/adapter-binding.js +12 -0
  6. package/dist/adapter-binding.js.map +1 -0
  7. package/dist/agent-binding.d.ts +207 -0
  8. package/dist/agent-binding.d.ts.map +1 -0
  9. package/dist/agent-binding.js +4 -0
  10. package/dist/agent-binding.js.map +1 -0
  11. package/dist/app.d.ts +770 -0
  12. package/dist/app.d.ts.map +1 -0
  13. package/dist/app.js +396 -0
  14. package/dist/app.js.map +1 -0
  15. package/dist/capability-binding.d.ts +76 -0
  16. package/dist/capability-binding.d.ts.map +1 -0
  17. package/dist/capability-binding.js +4 -0
  18. package/dist/capability-binding.js.map +1 -0
  19. package/dist/cost-binding.d.ts +175 -0
  20. package/dist/cost-binding.d.ts.map +1 -0
  21. package/dist/cost-binding.js +13 -0
  22. package/dist/cost-binding.js.map +1 -0
  23. package/dist/deployment-binding.d.ts +201 -0
  24. package/dist/deployment-binding.d.ts.map +1 -0
  25. package/dist/deployment-binding.js +4 -0
  26. package/dist/deployment-binding.js.map +1 -0
  27. package/dist/env-binding.d.ts +132 -0
  28. package/dist/env-binding.d.ts.map +1 -0
  29. package/dist/env-binding.js +4 -0
  30. package/dist/env-binding.js.map +1 -0
  31. package/dist/errors.d.ts +37 -0
  32. package/dist/errors.d.ts.map +1 -0
  33. package/dist/errors.js +264 -0
  34. package/dist/errors.js.map +1 -0
  35. package/dist/eval-run-binding.d.ts +196 -0
  36. package/dist/eval-run-binding.d.ts.map +1 -0
  37. package/dist/eval-run-binding.js +16 -0
  38. package/dist/eval-run-binding.js.map +1 -0
  39. package/dist/eval-run-dispatcher.d.ts +131 -0
  40. package/dist/eval-run-dispatcher.d.ts.map +1 -0
  41. package/dist/eval-run-dispatcher.js +368 -0
  42. package/dist/eval-run-dispatcher.js.map +1 -0
  43. package/dist/eval-suite-binding.d.ts +227 -0
  44. package/dist/eval-suite-binding.d.ts.map +1 -0
  45. package/dist/eval-suite-binding.js +24 -0
  46. package/dist/eval-suite-binding.js.map +1 -0
  47. package/dist/event-bus-binding.d.ts +107 -0
  48. package/dist/event-bus-binding.d.ts.map +1 -0
  49. package/dist/event-bus-binding.js +5 -0
  50. package/dist/event-bus-binding.js.map +1 -0
  51. package/dist/flow-binding.d.ts +194 -0
  52. package/dist/flow-binding.d.ts.map +1 -0
  53. package/dist/flow-binding.js +4 -0
  54. package/dist/flow-binding.js.map +1 -0
  55. package/dist/guardrail-binding.d.ts +138 -0
  56. package/dist/guardrail-binding.d.ts.map +1 -0
  57. package/dist/guardrail-binding.js +4 -0
  58. package/dist/guardrail-binding.js.map +1 -0
  59. package/dist/handler-binding.d.ts +126 -0
  60. package/dist/handler-binding.d.ts.map +1 -0
  61. package/dist/handler-binding.js +4 -0
  62. package/dist/handler-binding.js.map +1 -0
  63. package/dist/hitl-binding.d.ts +115 -0
  64. package/dist/hitl-binding.d.ts.map +1 -0
  65. package/dist/hitl-binding.js +4 -0
  66. package/dist/hitl-binding.js.map +1 -0
  67. package/dist/identity-directory-binding.d.ts +116 -0
  68. package/dist/identity-directory-binding.d.ts.map +1 -0
  69. package/dist/identity-directory-binding.js +4 -0
  70. package/dist/identity-directory-binding.js.map +1 -0
  71. package/dist/identity-provider-binding.d.ts +184 -0
  72. package/dist/identity-provider-binding.d.ts.map +1 -0
  73. package/dist/identity-provider-binding.js +4 -0
  74. package/dist/identity-provider-binding.js.map +1 -0
  75. package/dist/image-registry-binding.d.ts +165 -0
  76. package/dist/image-registry-binding.d.ts.map +1 -0
  77. package/dist/image-registry-binding.js +4 -0
  78. package/dist/image-registry-binding.js.map +1 -0
  79. package/dist/index.d.ts +72 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +26 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/key-management-binding.d.ts +101 -0
  84. package/dist/key-management-binding.d.ts.map +1 -0
  85. package/dist/key-management-binding.js +4 -0
  86. package/dist/key-management-binding.js.map +1 -0
  87. package/dist/mcp-endpoint-binding.d.ts +312 -0
  88. package/dist/mcp-endpoint-binding.d.ts.map +1 -0
  89. package/dist/mcp-endpoint-binding.js +12 -0
  90. package/dist/mcp-endpoint-binding.js.map +1 -0
  91. package/dist/memory-binding.d.ts +209 -0
  92. package/dist/memory-binding.d.ts.map +1 -0
  93. package/dist/memory-binding.js +4 -0
  94. package/dist/memory-binding.js.map +1 -0
  95. package/dist/middleware/auth.d.ts +168 -0
  96. package/dist/middleware/auth.d.ts.map +1 -0
  97. package/dist/middleware/auth.js +247 -0
  98. package/dist/middleware/auth.js.map +1 -0
  99. package/dist/middleware/authorize.d.ts +26 -0
  100. package/dist/middleware/authorize.d.ts.map +1 -0
  101. package/dist/middleware/authorize.js +65 -0
  102. package/dist/middleware/authorize.js.map +1 -0
  103. package/dist/middleware/error-mapper.d.ts +13 -0
  104. package/dist/middleware/error-mapper.d.ts.map +1 -0
  105. package/dist/middleware/error-mapper.js +32 -0
  106. package/dist/middleware/error-mapper.js.map +1 -0
  107. package/dist/middleware/idempotency.d.ts +43 -0
  108. package/dist/middleware/idempotency.d.ts.map +1 -0
  109. package/dist/middleware/idempotency.js +118 -0
  110. package/dist/middleware/idempotency.js.map +1 -0
  111. package/dist/middleware/principal.d.ts +4 -0
  112. package/dist/middleware/principal.d.ts.map +1 -0
  113. package/dist/middleware/principal.js +42 -0
  114. package/dist/middleware/principal.js.map +1 -0
  115. package/dist/middleware/public-run-routes.d.ts +16 -0
  116. package/dist/middleware/public-run-routes.d.ts.map +1 -0
  117. package/dist/middleware/public-run-routes.js +43 -0
  118. package/dist/middleware/public-run-routes.js.map +1 -0
  119. package/dist/middleware/request-id.d.ts +14 -0
  120. package/dist/middleware/request-id.d.ts.map +1 -0
  121. package/dist/middleware/request-id.js +24 -0
  122. package/dist/middleware/request-id.js.map +1 -0
  123. package/dist/middleware/sigv4-verify.d.ts +64 -0
  124. package/dist/middleware/sigv4-verify.d.ts.map +1 -0
  125. package/dist/middleware/sigv4-verify.js +286 -0
  126. package/dist/middleware/sigv4-verify.js.map +1 -0
  127. package/dist/middleware/sigv4.d.ts +25 -0
  128. package/dist/middleware/sigv4.d.ts.map +1 -0
  129. package/dist/middleware/sigv4.js +120 -0
  130. package/dist/middleware/sigv4.js.map +1 -0
  131. package/dist/openapi/generate.d.ts +15 -0
  132. package/dist/openapi/generate.d.ts.map +1 -0
  133. package/dist/openapi/generate.js +241 -0
  134. package/dist/openapi/generate.js.map +1 -0
  135. package/dist/openapi/operations.d.ts +70 -0
  136. package/dist/openapi/operations.d.ts.map +1 -0
  137. package/dist/openapi/operations.js +5051 -0
  138. package/dist/openapi/operations.js.map +1 -0
  139. package/dist/openapi/schemas.d.ts +590 -0
  140. package/dist/openapi/schemas.d.ts.map +1 -0
  141. package/dist/openapi/schemas.js +5820 -0
  142. package/dist/openapi/schemas.js.map +1 -0
  143. package/dist/provenance-binding.d.ts +116 -0
  144. package/dist/provenance-binding.d.ts.map +1 -0
  145. package/dist/provenance-binding.js +31 -0
  146. package/dist/provenance-binding.js.map +1 -0
  147. package/dist/provider-binding.d.ts +174 -0
  148. package/dist/provider-binding.d.ts.map +1 -0
  149. package/dist/provider-binding.js +4 -0
  150. package/dist/provider-binding.js.map +1 -0
  151. package/dist/public-run-token.d.ts +97 -0
  152. package/dist/public-run-token.d.ts.map +1 -0
  153. package/dist/public-run-token.js +167 -0
  154. package/dist/public-run-token.js.map +1 -0
  155. package/dist/retention-binding.d.ts +69 -0
  156. package/dist/retention-binding.d.ts.map +1 -0
  157. package/dist/retention-binding.js +4 -0
  158. package/dist/retention-binding.js.map +1 -0
  159. package/dist/reviewer-binding.d.ts +84 -0
  160. package/dist/reviewer-binding.d.ts.map +1 -0
  161. package/dist/reviewer-binding.js +4 -0
  162. package/dist/reviewer-binding.js.map +1 -0
  163. package/dist/rotation-status-store.d.ts +96 -0
  164. package/dist/rotation-status-store.d.ts.map +1 -0
  165. package/dist/rotation-status-store.js +106 -0
  166. package/dist/rotation-status-store.js.map +1 -0
  167. package/dist/routes/adapters.d.ts +29 -0
  168. package/dist/routes/adapters.d.ts.map +1 -0
  169. package/dist/routes/adapters.js +230 -0
  170. package/dist/routes/adapters.js.map +1 -0
  171. package/dist/routes/agents.d.ts +17 -0
  172. package/dist/routes/agents.d.ts.map +1 -0
  173. package/dist/routes/agents.js +342 -0
  174. package/dist/routes/agents.js.map +1 -0
  175. package/dist/routes/approvals.d.ts +37 -0
  176. package/dist/routes/approvals.d.ts.map +1 -0
  177. package/dist/routes/approvals.js +551 -0
  178. package/dist/routes/approvals.js.map +1 -0
  179. package/dist/routes/artifacts.d.ts +25 -0
  180. package/dist/routes/artifacts.d.ts.map +1 -0
  181. package/dist/routes/artifacts.js +265 -0
  182. package/dist/routes/artifacts.js.map +1 -0
  183. package/dist/routes/audit.d.ts +6 -0
  184. package/dist/routes/audit.d.ts.map +1 -0
  185. package/dist/routes/audit.js +162 -0
  186. package/dist/routes/audit.js.map +1 -0
  187. package/dist/routes/auth.d.ts +47 -0
  188. package/dist/routes/auth.d.ts.map +1 -0
  189. package/dist/routes/auth.js +630 -0
  190. package/dist/routes/auth.js.map +1 -0
  191. package/dist/routes/capabilities.d.ts +14 -0
  192. package/dist/routes/capabilities.d.ts.map +1 -0
  193. package/dist/routes/capabilities.js +62 -0
  194. package/dist/routes/capabilities.js.map +1 -0
  195. package/dist/routes/compliance.d.ts +37 -0
  196. package/dist/routes/compliance.d.ts.map +1 -0
  197. package/dist/routes/compliance.js +321 -0
  198. package/dist/routes/compliance.js.map +1 -0
  199. package/dist/routes/conversations.d.ts +13 -0
  200. package/dist/routes/conversations.d.ts.map +1 -0
  201. package/dist/routes/conversations.js +295 -0
  202. package/dist/routes/conversations.js.map +1 -0
  203. package/dist/routes/cost.d.ts +24 -0
  204. package/dist/routes/cost.d.ts.map +1 -0
  205. package/dist/routes/cost.js +243 -0
  206. package/dist/routes/cost.js.map +1 -0
  207. package/dist/routes/deployments.d.ts +122 -0
  208. package/dist/routes/deployments.d.ts.map +1 -0
  209. package/dist/routes/deployments.js +1036 -0
  210. package/dist/routes/deployments.js.map +1 -0
  211. package/dist/routes/env.d.ts +62 -0
  212. package/dist/routes/env.d.ts.map +1 -0
  213. package/dist/routes/env.js +311 -0
  214. package/dist/routes/env.js.map +1 -0
  215. package/dist/routes/eval-runs.d.ts +28 -0
  216. package/dist/routes/eval-runs.d.ts.map +1 -0
  217. package/dist/routes/eval-runs.js +479 -0
  218. package/dist/routes/eval-runs.js.map +1 -0
  219. package/dist/routes/eval-suites.d.ts +24 -0
  220. package/dist/routes/eval-suites.d.ts.map +1 -0
  221. package/dist/routes/eval-suites.js +381 -0
  222. package/dist/routes/eval-suites.js.map +1 -0
  223. package/dist/routes/event-triggers.d.ts +12 -0
  224. package/dist/routes/event-triggers.d.ts.map +1 -0
  225. package/dist/routes/event-triggers.js +218 -0
  226. package/dist/routes/event-triggers.js.map +1 -0
  227. package/dist/routes/flows.d.ts +23 -0
  228. package/dist/routes/flows.d.ts.map +1 -0
  229. package/dist/routes/flows.js +344 -0
  230. package/dist/routes/flows.js.map +1 -0
  231. package/dist/routes/guardrails.d.ts +33 -0
  232. package/dist/routes/guardrails.d.ts.map +1 -0
  233. package/dist/routes/guardrails.js +236 -0
  234. package/dist/routes/guardrails.js.map +1 -0
  235. package/dist/routes/identity.d.ts +39 -0
  236. package/dist/routes/identity.d.ts.map +1 -0
  237. package/dist/routes/identity.js +138 -0
  238. package/dist/routes/identity.js.map +1 -0
  239. package/dist/routes/mcp.d.ts +23 -0
  240. package/dist/routes/mcp.d.ts.map +1 -0
  241. package/dist/routes/mcp.js +727 -0
  242. package/dist/routes/mcp.js.map +1 -0
  243. package/dist/routes/memory.d.ts +16 -0
  244. package/dist/routes/memory.d.ts.map +1 -0
  245. package/dist/routes/memory.js +353 -0
  246. package/dist/routes/memory.js.map +1 -0
  247. package/dist/routes/observations.d.ts +19 -0
  248. package/dist/routes/observations.d.ts.map +1 -0
  249. package/dist/routes/observations.js +135 -0
  250. package/dist/routes/observations.js.map +1 -0
  251. package/dist/routes/orgs.d.ts +24 -0
  252. package/dist/routes/orgs.d.ts.map +1 -0
  253. package/dist/routes/orgs.js +208 -0
  254. package/dist/routes/orgs.js.map +1 -0
  255. package/dist/routes/pagination.d.ts +18 -0
  256. package/dist/routes/pagination.d.ts.map +1 -0
  257. package/dist/routes/pagination.js +35 -0
  258. package/dist/routes/pagination.js.map +1 -0
  259. package/dist/routes/policies.d.ts +23 -0
  260. package/dist/routes/policies.d.ts.map +1 -0
  261. package/dist/routes/policies.js +314 -0
  262. package/dist/routes/policies.js.map +1 -0
  263. package/dist/routes/projects.d.ts +45 -0
  264. package/dist/routes/projects.d.ts.map +1 -0
  265. package/dist/routes/projects.js +485 -0
  266. package/dist/routes/projects.js.map +1 -0
  267. package/dist/routes/proposals.d.ts +24 -0
  268. package/dist/routes/proposals.d.ts.map +1 -0
  269. package/dist/routes/proposals.js +581 -0
  270. package/dist/routes/proposals.js.map +1 -0
  271. package/dist/routes/provenance.d.ts +34 -0
  272. package/dist/routes/provenance.d.ts.map +1 -0
  273. package/dist/routes/provenance.js +274 -0
  274. package/dist/routes/provenance.js.map +1 -0
  275. package/dist/routes/providers.d.ts +32 -0
  276. package/dist/routes/providers.d.ts.map +1 -0
  277. package/dist/routes/providers.js +490 -0
  278. package/dist/routes/providers.js.map +1 -0
  279. package/dist/routes/public-run-tokens.d.ts +17 -0
  280. package/dist/routes/public-run-tokens.d.ts.map +1 -0
  281. package/dist/routes/public-run-tokens.js +69 -0
  282. package/dist/routes/public-run-tokens.js.map +1 -0
  283. package/dist/routes/retention.d.ts +19 -0
  284. package/dist/routes/retention.d.ts.map +1 -0
  285. package/dist/routes/retention.js +152 -0
  286. package/dist/routes/retention.js.map +1 -0
  287. package/dist/routes/reviewers.d.ts +5 -0
  288. package/dist/routes/reviewers.d.ts.map +1 -0
  289. package/dist/routes/reviewers.js +161 -0
  290. package/dist/routes/reviewers.js.map +1 -0
  291. package/dist/routes/runs.d.ts +34 -0
  292. package/dist/routes/runs.d.ts.map +1 -0
  293. package/dist/routes/runs.js +773 -0
  294. package/dist/routes/runs.js.map +1 -0
  295. package/dist/routes/s3.d.ts +31 -0
  296. package/dist/routes/s3.d.ts.map +1 -0
  297. package/dist/routes/s3.js +433 -0
  298. package/dist/routes/s3.js.map +1 -0
  299. package/dist/routes/schedules.d.ts +20 -0
  300. package/dist/routes/schedules.d.ts.map +1 -0
  301. package/dist/routes/schedules.js +234 -0
  302. package/dist/routes/schedules.js.map +1 -0
  303. package/dist/routes/scope-params.d.ts +57 -0
  304. package/dist/routes/scope-params.d.ts.map +1 -0
  305. package/dist/routes/scope-params.js +105 -0
  306. package/dist/routes/scope-params.js.map +1 -0
  307. package/dist/routes/secret-ref.d.ts +20 -0
  308. package/dist/routes/secret-ref.d.ts.map +1 -0
  309. package/dist/routes/secret-ref.js +42 -0
  310. package/dist/routes/secret-ref.js.map +1 -0
  311. package/dist/routes/secrets.d.ts +53 -0
  312. package/dist/routes/secrets.d.ts.map +1 -0
  313. package/dist/routes/secrets.js +715 -0
  314. package/dist/routes/secrets.js.map +1 -0
  315. package/dist/routes/signing-keys.d.ts +23 -0
  316. package/dist/routes/signing-keys.d.ts.map +1 -0
  317. package/dist/routes/signing-keys.js +212 -0
  318. package/dist/routes/signing-keys.js.map +1 -0
  319. package/dist/routes/sse.d.ts +58 -0
  320. package/dist/routes/sse.d.ts.map +1 -0
  321. package/dist/routes/sse.js +92 -0
  322. package/dist/routes/sse.js.map +1 -0
  323. package/dist/routes/teams.d.ts +30 -0
  324. package/dist/routes/teams.d.ts.map +1 -0
  325. package/dist/routes/teams.js +443 -0
  326. package/dist/routes/teams.js.map +1 -0
  327. package/dist/routes/tenant.d.ts +57 -0
  328. package/dist/routes/tenant.d.ts.map +1 -0
  329. package/dist/routes/tenant.js +352 -0
  330. package/dist/routes/tenant.js.map +1 -0
  331. package/dist/routes/tokens.d.ts +14 -0
  332. package/dist/routes/tokens.d.ts.map +1 -0
  333. package/dist/routes/tokens.js +231 -0
  334. package/dist/routes/tokens.js.map +1 -0
  335. package/dist/routes/tools.d.ts +33 -0
  336. package/dist/routes/tools.d.ts.map +1 -0
  337. package/dist/routes/tools.js +380 -0
  338. package/dist/routes/tools.js.map +1 -0
  339. package/dist/routes/webhook-endpoints.d.ts +10 -0
  340. package/dist/routes/webhook-endpoints.d.ts.map +1 -0
  341. package/dist/routes/webhook-endpoints.js +407 -0
  342. package/dist/routes/webhook-endpoints.js.map +1 -0
  343. package/dist/routes/webhooks.d.ts +21 -0
  344. package/dist/routes/webhooks.d.ts.map +1 -0
  345. package/dist/routes/webhooks.js +228 -0
  346. package/dist/routes/webhooks.js.map +1 -0
  347. package/dist/s3-credential-binding.d.ts +54 -0
  348. package/dist/s3-credential-binding.d.ts.map +1 -0
  349. package/dist/s3-credential-binding.js +4 -0
  350. package/dist/s3-credential-binding.js.map +1 -0
  351. package/dist/secrets-binding.d.ts +281 -0
  352. package/dist/secrets-binding.d.ts.map +1 -0
  353. package/dist/secrets-binding.js +10 -0
  354. package/dist/secrets-binding.js.map +1 -0
  355. package/dist/secrets-provider-binding.d.ts +164 -0
  356. package/dist/secrets-provider-binding.d.ts.map +1 -0
  357. package/dist/secrets-provider-binding.js +4 -0
  358. package/dist/secrets-provider-binding.js.map +1 -0
  359. package/dist/session-store-binding.d.ts +148 -0
  360. package/dist/session-store-binding.d.ts.map +1 -0
  361. package/dist/session-store-binding.js +4 -0
  362. package/dist/session-store-binding.js.map +1 -0
  363. package/dist/signing-key-binding.d.ts +210 -0
  364. package/dist/signing-key-binding.d.ts.map +1 -0
  365. package/dist/signing-key-binding.js +4 -0
  366. package/dist/signing-key-binding.js.map +1 -0
  367. package/dist/state-store-binding.d.ts +53 -0
  368. package/dist/state-store-binding.d.ts.map +1 -0
  369. package/dist/state-store-binding.js +38 -0
  370. package/dist/state-store-binding.js.map +1 -0
  371. package/dist/supervisor-binding.d.ts +526 -0
  372. package/dist/supervisor-binding.d.ts.map +1 -0
  373. package/dist/supervisor-binding.js +4 -0
  374. package/dist/supervisor-binding.js.map +1 -0
  375. package/dist/tenant-host-access.d.ts +41 -0
  376. package/dist/tenant-host-access.d.ts.map +1 -0
  377. package/dist/tenant-host-access.js +42 -0
  378. package/dist/tenant-host-access.js.map +1 -0
  379. package/dist/token-admin.d.ts +99 -0
  380. package/dist/token-admin.d.ts.map +1 -0
  381. package/dist/token-admin.js +4 -0
  382. package/dist/token-admin.js.map +1 -0
  383. package/dist/tool-binding.d.ts +247 -0
  384. package/dist/tool-binding.d.ts.map +1 -0
  385. package/dist/tool-binding.js +4 -0
  386. package/dist/tool-binding.js.map +1 -0
  387. package/dist/trigger-binding.d.ts +13 -0
  388. package/dist/trigger-binding.d.ts.map +1 -0
  389. package/dist/trigger-binding.js +4 -0
  390. package/dist/trigger-binding.js.map +1 -0
  391. package/dist/types.d.ts +71 -0
  392. package/dist/types.d.ts.map +1 -0
  393. package/dist/types.js +4 -0
  394. package/dist/types.js.map +1 -0
  395. package/dist/webhook-endpoint-binding.d.ts +230 -0
  396. package/dist/webhook-endpoint-binding.d.ts.map +1 -0
  397. package/dist/webhook-endpoint-binding.js +12 -0
  398. package/dist/webhook-endpoint-binding.js.map +1 -0
  399. package/dist/xml.d.ts +79 -0
  400. package/dist/xml.d.ts.map +1 -0
  401. package/dist/xml.js +115 -0
  402. package/dist/xml.js.map +1 -0
  403. package/openapi.json +29659 -0
  404. package/package.json +76 -4
  405. package/scripts/emit-openapi.mjs +44 -0
  406. package/src/adapter-binding.ts +204 -0
  407. package/src/agent-binding.ts +231 -0
  408. package/src/app.ts +1285 -0
  409. package/src/capability-binding.ts +83 -0
  410. package/src/cost-binding.ts +213 -0
  411. package/src/deployment-binding.ts +225 -0
  412. package/src/env-binding.ts +140 -0
  413. package/src/errors.ts +291 -0
  414. package/src/eval-run-binding.ts +209 -0
  415. package/src/eval-run-dispatcher.ts +497 -0
  416. package/src/eval-suite-binding.ts +257 -0
  417. package/src/event-bus-binding.ts +127 -0
  418. package/src/flow-binding.ts +213 -0
  419. package/src/guardrail-binding.ts +151 -0
  420. package/src/handler-binding.ts +132 -0
  421. package/src/hitl-binding.ts +172 -0
  422. package/src/identity-directory-binding.ts +128 -0
  423. package/src/identity-provider-binding.ts +203 -0
  424. package/src/image-registry-binding.ts +193 -0
  425. package/src/index.ts +606 -0
  426. package/src/key-management-binding.ts +91 -0
  427. package/src/mcp-endpoint-binding.ts +311 -0
  428. package/src/memory-binding.ts +239 -0
  429. package/src/middleware/auth.ts +437 -0
  430. package/src/middleware/authorize.ts +125 -0
  431. package/src/middleware/error-mapper.ts +37 -0
  432. package/src/middleware/idempotency.ts +160 -0
  433. package/src/middleware/principal.ts +64 -0
  434. package/src/middleware/public-run-routes.ts +50 -0
  435. package/src/middleware/request-id.ts +28 -0
  436. package/src/middleware/sigv4-verify.ts +374 -0
  437. package/src/middleware/sigv4.ts +165 -0
  438. package/src/openapi/generate.ts +307 -0
  439. package/src/openapi/operations.ts +5445 -0
  440. package/src/openapi/schemas.ts +6363 -0
  441. package/src/provenance-binding.ts +169 -0
  442. package/src/provider-binding.ts +196 -0
  443. package/src/public-run-token.ts +263 -0
  444. package/src/retention-binding.ts +78 -0
  445. package/src/reviewer-binding.ts +99 -0
  446. package/src/rotation-status-store.ts +209 -0
  447. package/src/routes/adapters.ts +319 -0
  448. package/src/routes/agents.ts +424 -0
  449. package/src/routes/approvals.ts +759 -0
  450. package/src/routes/artifacts.ts +317 -0
  451. package/src/routes/audit.ts +219 -0
  452. package/src/routes/auth.ts +806 -0
  453. package/src/routes/capabilities.ts +79 -0
  454. package/src/routes/compliance.ts +482 -0
  455. package/src/routes/conversations.ts +369 -0
  456. package/src/routes/cost.ts +327 -0
  457. package/src/routes/deployments.ts +1493 -0
  458. package/src/routes/env.ts +429 -0
  459. package/src/routes/eval-runs.ts +631 -0
  460. package/src/routes/eval-suites.ts +490 -0
  461. package/src/routes/event-triggers.ts +283 -0
  462. package/src/routes/flows.ts +423 -0
  463. package/src/routes/guardrails.ts +320 -0
  464. package/src/routes/identity.ts +203 -0
  465. package/src/routes/mcp.ts +940 -0
  466. package/src/routes/memory.ts +430 -0
  467. package/src/routes/observations.ts +175 -0
  468. package/src/routes/orgs.ts +273 -0
  469. package/src/routes/pagination.ts +51 -0
  470. package/src/routes/policies.ts +413 -0
  471. package/src/routes/projects.ts +634 -0
  472. package/src/routes/proposals.ts +719 -0
  473. package/src/routes/provenance.ts +406 -0
  474. package/src/routes/providers.ts +624 -0
  475. package/src/routes/public-run-tokens.ts +104 -0
  476. package/src/routes/retention.ts +193 -0
  477. package/src/routes/reviewers.ts +209 -0
  478. package/src/routes/runs.ts +981 -0
  479. package/src/routes/s3.ts +519 -0
  480. package/src/routes/schedules.ts +300 -0
  481. package/src/routes/scope-params.ts +133 -0
  482. package/src/routes/secret-ref.ts +52 -0
  483. package/src/routes/secrets.ts +975 -0
  484. package/src/routes/signing-keys.ts +259 -0
  485. package/src/routes/sse.ts +148 -0
  486. package/src/routes/teams.ts +584 -0
  487. package/src/routes/tenant.ts +530 -0
  488. package/src/routes/tokens.ts +285 -0
  489. package/src/routes/tools.ts +491 -0
  490. package/src/routes/webhook-endpoints.ts +534 -0
  491. package/src/routes/webhooks.ts +296 -0
  492. package/src/s3-credential-binding.ts +58 -0
  493. package/src/secrets-binding.ts +308 -0
  494. package/src/secrets-provider-binding.ts +167 -0
  495. package/src/session-store-binding.ts +163 -0
  496. package/src/signing-key-binding.ts +235 -0
  497. package/src/state-store-binding.ts +84 -0
  498. package/src/supervisor-binding.ts +554 -0
  499. package/src/tenant-host-access.ts +62 -0
  500. package/src/token-admin.ts +104 -0
  501. package/src/tool-binding.ts +274 -0
  502. package/src/trigger-binding.ts +38 -0
  503. package/src/types.ts +74 -0
  504. package/src/webhook-endpoint-binding.ts +246 -0
  505. package/src/xml.ts +196 -0
@@ -0,0 +1,83 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { CapabilityKind, Feature } from '@kindgi/capabilities';
5
+ import type { Cursor, TenantId } from '@kindgi/types';
6
+
7
+ /**
8
+ * Caller-plugged surface for the capability catalog — part of the admin
9
+ * control plane.
10
+ *
11
+ * Capabilities are **read-only** over HTTP. They are framework-declared
12
+ * (see `@kindgi/specs/capability.schema.json` + the `FEATURES` enum from
13
+ * `@kindgi/capabilities`) and deployment-extensible at boot time via
14
+ * this binding — never tenant-created via the API. Deployments that
15
+ * expose custom capability kinds (embedding, gpu-compute, sandbox-exec,
16
+ * browser-session, ...) plug a binding that also lists their extensions.
17
+ *
18
+ * Cursors are opaque — the binding chooses its encoding. The API layer
19
+ * only validates round-trip as a string; it never inspects the payload.
20
+ */
21
+ export interface CapabilityRegistryBinding {
22
+ /**
23
+ * Cursor-paginated list of capability descriptors. Optional
24
+ * `featureFilter` is a prefix match on `descriptor.feature` — matches
25
+ * the `?feature=` filter shape on the route.
26
+ */
27
+ list(input: CapabilityListInput): Promise<CapabilityPage>;
28
+ /**
29
+ * Fetch a capability descriptor by its id, or `null` when unknown.
30
+ * The route surfaces `null` as `404 capability-not-found`.
31
+ */
32
+ get(input: CapabilityGetInput): Promise<CapabilityDescriptor | null>;
33
+ }
34
+
35
+ /**
36
+ * Wire shape returned by the capability routes. Lean by design — the
37
+ * runtime `Capability` (`@kindgi/capabilities.Capability`) is a
38
+ * declarative query shape (needs / prefer / budget) that agents attach
39
+ * to their spec; that's a different concept from a descriptor entry in
40
+ * the *catalog* of features a deployment supports. The catalog entry
41
+ * carries the identifier + human description + the optional params
42
+ * schema pointer.
43
+ *
44
+ * `id` is caller-chosen — for example `feature:<feature>`
45
+ * (e.g. `feature:tool-use`); deployments that extend
46
+ * the catalog with non-LLM capability kinds may pick other conventions
47
+ * (`kind:embedding`, `kind:sandbox-exec`, ...).
48
+ */
49
+ export interface CapabilityDescriptor {
50
+ readonly id: string;
51
+ readonly feature: Feature | string;
52
+ readonly description: string;
53
+ /**
54
+ * Kind of resource the capability targets. Optional — absent value
55
+ * defaults to `'llm-inference'`. Adapters for non-LLM kinds set this
56
+ * explicitly so the catalog can be filtered by kind downstream.
57
+ */
58
+ readonly kind?: CapabilityKind;
59
+ /**
60
+ * Optional JSON Schema shape describing the parameters an agent may
61
+ * carry alongside `{ feature }` in a `Requirement`. Opaque to the API
62
+ * layer — the SDK surfaces it for tooling / doc generation.
63
+ */
64
+ readonly paramsSchema?: Readonly<Record<string, unknown>>;
65
+ }
66
+
67
+ export interface CapabilityListInput {
68
+ readonly tenantId: TenantId;
69
+ readonly limit: number;
70
+ readonly cursor?: Cursor;
71
+ /** Prefix match on `CapabilityDescriptor.feature`. */
72
+ readonly featureFilter?: string;
73
+ }
74
+
75
+ export interface CapabilityGetInput {
76
+ readonly tenantId: TenantId;
77
+ readonly capabilityId: string;
78
+ }
79
+
80
+ export interface CapabilityPage {
81
+ readonly data: readonly CapabilityDescriptor[];
82
+ readonly nextCursor?: Cursor;
83
+ }
@@ -0,0 +1,213 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { Scope } from '@kindgi/platform';
5
+ import type { Cursor, TenantId, Timestamp } from '@kindgi/types';
6
+
7
+ /**
8
+ * Caller-plugged surface for the cost readback plane — part of the
9
+ * admin control plane. Read-only: tenants + operators
10
+ * inspect what they've spent across model calls, tool invocations,
11
+ * storage, and sandbox usage. Instrumentation (how records get recorded)
12
+ * lives at the agent / tool / sandbox layers — this surface only reads.
13
+ *
14
+ * The runtime substrate is the cost tracker — usage records carrying
15
+ * `resourceKind`, `providerId`, `runId`, `quantity`, `unit`, `costUsd`,
16
+ * `metrics` and `attributes`, plus a `recordedAt` timestamp. But the wire
17
+ * vocabulary differs enough (`category` instead of `resourceKind`;
18
+ * first-class `agentId` / `conversationId` filters that live in
19
+ * `attributes` at storage time; multi-dim `groupBy` that needs
20
+ * storage-side rollups) that a caller-plugged binding is cleaner than
21
+ * direct storage access — each deployment maps wire fields to whatever
22
+ * storage shape it uses. Trivial in-memory implementations are fine for
23
+ * dev + tests; production implementations run the aggregate rollups in
24
+ * their store.
25
+ *
26
+ * Every method is tenant-scoped. Cursors are opaque — the binding
27
+ * chooses its encoding. The API layer only validates round-trip as a
28
+ * string; it never inspects the payload.
29
+ *
30
+ * Budgets are NOT part of this interface.
31
+ */
32
+ export interface CostBinding {
33
+ /**
34
+ * Cursor-paginated list of cost records. Sort order is fixed:
35
+ * `occurredAt desc, id desc`. Filters compose (all AND).
36
+ */
37
+ listRecords(input: CostListRecordsInput): Promise<CostRecordPage>;
38
+ /**
39
+ * Fetch a record by id, or `null` when unknown. The route surfaces
40
+ * `null` as `404 cost-record-not-found`.
41
+ */
42
+ getRecord(input: CostGetRecordInput): Promise<CostRecord | null>;
43
+ /**
44
+ * Multi-dimensional aggregate rollup. `groupBy` may combine any
45
+ * subset of `agentId | runId | category | providerId | day | month
46
+ * | tenant | conversationId`; the binding returns one group per
47
+ * distinct key tuple within the required `from`..`to` window.
48
+ */
49
+ aggregate(input: CostAggregateInput): Promise<CostAggregateResult>;
50
+ }
51
+
52
+ // -------- listRecords --------
53
+
54
+ export interface CostListRecordsInput {
55
+ readonly tenantId: TenantId;
56
+ readonly limit: number;
57
+ readonly cursor?: Cursor;
58
+ readonly filter: CostRecordFilter;
59
+ /**
60
+ * Narrow the list to a specific scope. Absent = no scope narrow
61
+ * (return every row in the tenant the caller can see — admin/audit
62
+ * default).
63
+ *
64
+ * Content-scoped semantics (this binding — cost records attribute
65
+ * to the project whose run produced them):
66
+ * - `{ kind: 'project', projectId }` — rows in that project.
67
+ * - `{ kind: 'org', orgId }` — rows in every project belonging to
68
+ * that org.
69
+ * - `{ kind: 'tenant', tenantId }` — every row in the tenant.
70
+ *
71
+ * Content rows always belong to a project, so `inherit` has no
72
+ * effect here.
73
+ */
74
+ readonly scope?: Scope;
75
+ /**
76
+ * `false` = literal-at-this-scope only (admin/audit view).
77
+ * `true` (default) = inheritance walk (user-facing view).
78
+ * No-op for content-scoped bindings (rows only exist at
79
+ * project-level — there is no upward hierarchy to walk). Kept for
80
+ * uniformity: scope-aware bindings share one filter shape.
81
+ */
82
+ readonly inherit?: boolean;
83
+ }
84
+
85
+ export interface CostRecordFilter {
86
+ readonly runId?: string;
87
+ readonly agentId?: string;
88
+ readonly conversationId?: string;
89
+ /**
90
+ * Wire vocabulary for the resource dimension — maps to the runtime's
91
+ * `resourceKind` (`llm.inference`, `tool.invocation`, `storage.write`,
92
+ * `sandbox.exec`, ...). Exact-match; free-form string so deployments
93
+ * can extend without a schema change.
94
+ */
95
+ readonly category?: string;
96
+ readonly providerId?: string;
97
+ readonly from?: Date;
98
+ readonly to?: Date;
99
+ }
100
+
101
+ export interface CostRecordPage {
102
+ readonly data: readonly CostRecord[];
103
+ readonly nextCursor?: Cursor;
104
+ }
105
+
106
+ // -------- getRecord --------
107
+
108
+ export interface CostGetRecordInput {
109
+ readonly tenantId: TenantId;
110
+ readonly recordId: string;
111
+ }
112
+
113
+ // -------- aggregate --------
114
+
115
+ /**
116
+ * Group dimensions the binding may aggregate over. `day` / `month` are
117
+ * time bucketing on `occurredAt` (UTC calendar day / month). Every call
118
+ * is tenant-scoped, so `tenant` always resolves to the caller's tenant
119
+ * id.
120
+ */
121
+ export type CostGroupDimension =
122
+ | 'agentId'
123
+ | 'runId'
124
+ | 'category'
125
+ | 'providerId'
126
+ | 'day'
127
+ | 'month'
128
+ | 'tenant'
129
+ | 'conversationId';
130
+
131
+ export const COST_GROUP_DIMENSIONS: readonly CostGroupDimension[] = [
132
+ 'agentId',
133
+ 'runId',
134
+ 'category',
135
+ 'providerId',
136
+ 'day',
137
+ 'month',
138
+ 'tenant',
139
+ 'conversationId',
140
+ ];
141
+
142
+ export interface CostAggregateInput {
143
+ readonly tenantId: TenantId;
144
+ readonly groupBy: readonly CostGroupDimension[];
145
+ readonly from: Date;
146
+ readonly to: Date;
147
+ readonly filter?: CostRecordFilter;
148
+ /**
149
+ * Narrow the aggregate to a specific scope. Same semantics as
150
+ * `CostListRecordsInput.scope` — content-scoped; an org scope covers
151
+ * the org's projects. Lets `/v1/cost/aggregate` accept the same
152
+ * `?scopeKind + ?scopeId` triplet as `/v1/cost/records`. Without
153
+ * this, an aggregate call after a scoped list would drop the scope
154
+ * silently. `inherit` is a documented no-op for this content-scoped
155
+ * binding.
156
+ */
157
+ readonly scope?: Scope;
158
+ /**
159
+ * `false` = literal-at-this-scope only. `true` (default) = inheritance
160
+ * walk. No-op for content-scoped bindings; passed through for wire
161
+ * shape uniformity.
162
+ */
163
+ readonly inherit?: boolean;
164
+ }
165
+
166
+ /**
167
+ * One row of the aggregate result. `key` maps every requested `groupBy`
168
+ * dimension to its value for this group — `null` when the underlying
169
+ * records had no value for that dimension (e.g. records with no
170
+ * `agentId` when grouping by `agentId`). Downstream consumers treat
171
+ * `null` as a distinct group ("unattributed").
172
+ */
173
+ export interface CostAggregateGroup {
174
+ readonly key: Readonly<Record<string, string | null>>;
175
+ readonly count: number;
176
+ readonly totalUsd: number;
177
+ }
178
+
179
+ export interface CostAggregateResult {
180
+ readonly groups: readonly CostAggregateGroup[];
181
+ readonly totalUsd: number;
182
+ readonly totalRecords: number;
183
+ readonly timeRange: {
184
+ readonly from: Timestamp;
185
+ readonly to: Timestamp;
186
+ };
187
+ }
188
+
189
+ // -------- CostRecord (wire) --------
190
+
191
+ /**
192
+ * Wire shape for a single cost record. Corresponds 1:1 to a usage
193
+ * record in the runtime's cost tracker, flattened for the wire
194
+ * (`resourceKind` renamed to `category`; `attributes.agentId`
195
+ * / `attributes.conversationId` lifted to top-level fields when
196
+ * present). The binding decides how to reshape the runtime row — this
197
+ * type just describes what the route hands back.
198
+ */
199
+ export interface CostRecord {
200
+ readonly id: string;
201
+ readonly tenantId: TenantId;
202
+ readonly category: string;
203
+ readonly providerId?: string;
204
+ readonly runId?: string;
205
+ readonly agentId?: string;
206
+ readonly conversationId?: string;
207
+ readonly quantity: number;
208
+ readonly unit: string;
209
+ readonly costUsd?: number;
210
+ readonly occurredAt: Timestamp;
211
+ readonly metrics?: Readonly<Record<string, unknown>>;
212
+ readonly attributes?: Readonly<Record<string, unknown>>;
213
+ }
@@ -0,0 +1,225 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { Cursor, SigningKeyId, TenantId } from '@kindgi/types';
5
+
6
+ /**
7
+ * Caller-plugged surface for the deployment ledger — the audit anchor
8
+ * row written by `POST /v1/deployments`. Mirrors the
9
+ * caller-plugged pattern of `BlobStorageBinding` /
10
+ * `PolicyRegistryBinding`: the API package does NOT own deployment
11
+ * storage. Deployments plug their own store (a database, or in-memory for
12
+ * tests) through this interface.
13
+ *
14
+ * Semantics:
15
+ * - A deployment is the append-only record of a signed image landing
16
+ * at the API. Its `imageDigest` (extracted from `imageRef`) is the
17
+ * idempotency key — re-registering the same digest returns the
18
+ * existing record with no new `artifactVersion`.
19
+ * - The full signature envelope (`signerKeyId`, `signerPublicKey`,
20
+ * `signature`, canonical `indexHash`) is persisted so regulators
21
+ * can re-verify offline against the immutable image bytes.
22
+ * - Primitive counts (`tools` / `guardrails` / `agents` / `flows`)
23
+ * are captured for at-a-glance rendering; the full manifest set
24
+ * lives at `imageRef@sha256:…/app/index.json`.
25
+ *
26
+ * Every method is tenant-scoped: callers pass `tenantId` explicitly so
27
+ * multi-tenant deployments can partition storage without exposing the
28
+ * scoping inside the API package.
29
+ *
30
+ * Cursors are opaque — the binding chooses its encoding. The API layer
31
+ * only validates that a cursor round-trips as a string.
32
+ *
33
+ * ## Seam only
34
+ *
35
+ * This file defines the seam the `packages/api/src/routes/deployments.ts`
36
+ * route calls; no implementation is bundled.
37
+ */
38
+ export interface DeploymentBinding {
39
+ /**
40
+ * Persist a signed deployment record. The API route checks the signer
41
+ * against the trust list (`SigningKeyBinding.isTrusted`), verifies the
42
+ * Ed25519 signature, verifies image pullability
43
+ * (`ImageRegistryBinding.head`), and validates every primitive in the
44
+ * index before calling — the binding receives a well-formed input.
45
+ *
46
+ * Idempotent per `imageDigest`: when the same digest is re-registered
47
+ * under the same tenant the binding MUST return
48
+ * `{ kind: 'already-registered', deployment }` with the existing row
49
+ * (existing `artifactVersion` — the issuer-supplied value the row
50
+ * originally pinned). Different digest → new row with the caller's
51
+ * newly-supplied `artifactVersion` persisted verbatim.
52
+ */
53
+ register(input: DeploymentRegisterInput): Promise<DeploymentRegisterOutcome>;
54
+ /**
55
+ * Fetch a deployment by its server-allocated id. `null` when unknown
56
+ * to the tenant. The route surfaces `null` as `404
57
+ * deployment-not-found`.
58
+ */
59
+ get(input: DeploymentGetInput): Promise<Deployment | null>;
60
+ /**
61
+ * Fetch a deployment by its `imageDigest` (the sha256 of the pinned
62
+ * OCI image). Used for the idempotency check on `register` and for
63
+ * cross-referencing image identity from the sandbox layer at
64
+ * dispatch. `null` when no record exists.
65
+ */
66
+ getByImageDigest(input: DeploymentGetByImageDigestInput): Promise<Deployment | null>;
67
+ /**
68
+ * Cursor-paginated list, sorted by `activatedAt` descending
69
+ * (binding-defined tie-break, e.g. `deploymentId` desc). Filters
70
+ * compose as AND.
71
+ */
72
+ list(input: DeploymentListInput): Promise<DeploymentPage>;
73
+ }
74
+
75
+ // -------------------- record --------------------
76
+
77
+ /**
78
+ * Wire shape for a deployment record. Immutable once written — every
79
+ * field is set atomically at `register` time.
80
+ *
81
+ * `signerPublicKey` is retained alongside `signerKeyId` so offline audit
82
+ * can re-verify without hitting the tenant's trust list; the trust-list
83
+ * check happens at `register` time inside the route (via
84
+ * `SigningKeyBinding.isTrusted`).
85
+ */
86
+ export interface Deployment {
87
+ readonly deploymentId: string;
88
+ readonly tenantId: TenantId;
89
+ /** Full digest-pinned image reference, e.g. `registry.example.com/acme/pack@sha256:…`. */
90
+ readonly imageRef: string;
91
+ /** `sha256` hex-encoded digest extracted from `imageRef` (idempotency key). */
92
+ readonly imageDigest: string;
93
+ /**
94
+ * Issuer-supplied `YYYYMMDD.N` — matches the value inside the signed
95
+ * envelope. Bindings persist it verbatim; the
96
+ * signature is only offline-verifiable if the same bytes round-trip.
97
+ */
98
+ readonly artifactVersion: string;
99
+ /** `sha256` of the canonicalised `index.json` extracted from the image. */
100
+ readonly indexHash: string;
101
+ /** Which key signed the deploy. Cross-checked against `SigningKeyBinding`. */
102
+ readonly signerKeyId: SigningKeyId;
103
+ /** Retained for offline audit. Base64 of the raw public-key bytes. */
104
+ readonly signerPublicKey: string;
105
+ /** Base64 of the Ed25519 signature over the canonicalised envelope. */
106
+ readonly signature: string;
107
+ /** Issuer-supplied timestamp inside the signed envelope. ISO-8601. */
108
+ readonly publishedAt: string;
109
+ /** Server-side ledger timestamp — when `register` returned OK. ISO-8601. */
110
+ readonly activatedAt: string;
111
+ /**
112
+ * Counts of primitives in the deployment's `index.json`. Not
113
+ * authoritative — the image is. Populated for cheap admin rendering.
114
+ */
115
+ readonly primitives: DeploymentPrimitiveCounts;
116
+ /**
117
+ * Exactly what the deployment shipped: each primitive's id and, for
118
+ * the versioned ones, its version. Versions are immutable, so this is
119
+ * enough to know which code a deployment made live.
120
+ */
121
+ readonly contents: DeploymentContents;
122
+ }
123
+
124
+ /** A primitive a deployment shipped. Guardrails have no version. */
125
+ export interface DeployedPrimitive {
126
+ readonly id: string;
127
+ readonly version?: string;
128
+ }
129
+
130
+ export interface DeploymentContents {
131
+ readonly tools: readonly DeployedPrimitive[];
132
+ readonly guardrails: readonly DeployedPrimitive[];
133
+ readonly agents: readonly DeployedPrimitive[];
134
+ readonly flows: readonly DeployedPrimitive[];
135
+ }
136
+
137
+ export interface DeploymentPrimitiveCounts {
138
+ readonly tools: number;
139
+ readonly guardrails: number;
140
+ readonly agents: number;
141
+ readonly flows: number;
142
+ }
143
+
144
+ // -------------------- register --------------------
145
+
146
+ /**
147
+ * Everything the ledger needs to persist a signed deployment. The route
148
+ * assembles this from the request body + verified sig envelope; the
149
+ * binding does not re-verify the signature (that's the route's job).
150
+ */
151
+ export interface DeploymentRegisterInput {
152
+ readonly tenantId: TenantId;
153
+ readonly imageRef: string;
154
+ readonly imageDigest: string;
155
+ /**
156
+ * Issuer-supplied `YYYYMMDD.N`. Part of the canonical signed envelope
157
+ * — persisted verbatim so offline verification
158
+ * can reproduce the exact bytes.
159
+ */
160
+ readonly artifactVersion: string;
161
+ readonly indexHash: string;
162
+ readonly signerKeyId: SigningKeyId;
163
+ readonly signerPublicKey: string;
164
+ readonly signature: string;
165
+ readonly publishedAt: string;
166
+ readonly primitives: DeploymentPrimitiveCounts;
167
+ readonly contents: DeploymentContents;
168
+ }
169
+
170
+ export type DeploymentRegisterOutcome =
171
+ | {
172
+ readonly kind: 'ok';
173
+ readonly deployment: Deployment;
174
+ }
175
+ | {
176
+ /**
177
+ * Same `imageDigest` was already registered for this tenant. The
178
+ * binding returns the existing row unchanged; the route surfaces
179
+ * as `200 OK` (idempotent replay), NOT `409`.
180
+ */
181
+ readonly kind: 'already-registered';
182
+ readonly deployment: Deployment;
183
+ }
184
+ | {
185
+ /** Any other write failure — persistence error, invalid input. */
186
+ readonly kind: 'error';
187
+ readonly code: string;
188
+ readonly message: string;
189
+ };
190
+
191
+ // -------------------- get --------------------
192
+
193
+ export interface DeploymentGetInput {
194
+ readonly tenantId: TenantId;
195
+ readonly deploymentId: string;
196
+ }
197
+
198
+ export interface DeploymentGetByImageDigestInput {
199
+ readonly tenantId: TenantId;
200
+ readonly imageDigest: string;
201
+ }
202
+
203
+ // -------------------- list --------------------
204
+
205
+ export interface DeploymentListInput {
206
+ readonly tenantId: TenantId;
207
+ readonly limit: number;
208
+ readonly cursor?: Cursor;
209
+ /**
210
+ * Optional prefix filter on `Deployment.imageRef`. Useful for
211
+ * `registry.example.com/acme/support-pack@sha256:` matches within a
212
+ * multi-image tenant.
213
+ */
214
+ readonly imageRefPrefix?: string;
215
+ /**
216
+ * Restrict to a specific signing key. Useful for revocation audits —
217
+ * "which deploys did the compromised key sign?"
218
+ */
219
+ readonly signerKeyId?: SigningKeyId;
220
+ }
221
+
222
+ export interface DeploymentPage {
223
+ readonly data: readonly Deployment[];
224
+ readonly nextCursor?: Cursor;
225
+ }
@@ -0,0 +1,140 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { TupleEnqueueHook } from '@kindgi/authz';
5
+ import type { Scope } from '@kindgi/platform';
6
+ import type { Cursor, EnvName, Result } from '@kindgi/types';
7
+
8
+ import type { ResolveContext } from './secrets-binding.js';
9
+
10
+ export type { ResolveContext } from './secrets-binding.js';
11
+
12
+ /**
13
+ * Caller-plugged env store — non-sensitive per-env values. Same
14
+ * `(scope, envName, name)` structural key as `SecretBinding`, same
15
+ * discriminated `Scope` primitive from `@kindgi/platform`.
16
+ * Emits `env-resolved` compliance-evidence events on every `resolve`
17
+ * — symmetric with secrets, gives operators the same debugging
18
+ * superpower ("what did this run see for its env at start?").
19
+ *
20
+ * What differs from `SecretBinding`:
21
+ * - `value` returns on the wire (env is non-sensitive by
22
+ * definition); no capability gate on read.
23
+ * - Revision counter, not version-with-rotation-ceremony. Overwrite
24
+ * bumps `revision`; there's no revoke, no hard-delete, no
25
+ * rotation-workflow-with-async-completion.
26
+ * - No encryption at rest.
27
+ *
28
+ * Env-safety: cross-env reads are refused. Same structural rule as
29
+ * secrets.
30
+ */
31
+ export interface EnvBinding {
32
+ /** Cursor-paginated list. Returns `value` for every entry. */
33
+ list(input: EnvListInput): Promise<EnvListPage>;
34
+
35
+ /** Fetch a single entry. `null` when unknown. */
36
+ get(input: EnvGetInput): Promise<EnvRecord | null>;
37
+
38
+ /**
39
+ * Resolve at dispatch time. Same `ResolveContext` as secrets. Emits
40
+ * `env-resolved` compliance-evidence event on every call.
41
+ */
42
+ resolve(input: EnvResolveInput): Promise<Result<EnvResolveOutcome, EnvError>>;
43
+
44
+ /**
45
+ * Write / overwrite an env value. Every write bumps `revision`.
46
+ * `ifRevision` provides optimistic concurrency guard.
47
+ */
48
+ set(input: EnvSetInput): Promise<EnvSetOutcome>;
49
+
50
+ /**
51
+ * Idempotent delete. Returns `{ deleted: false }` on unknown key.
52
+ * No soft-delete — env is a plain overwrite-shaped store; delete
53
+ * means gone.
54
+ */
55
+ delete(input: EnvDeleteInput): Promise<EnvDeleteOutcome>;
56
+ }
57
+
58
+ export interface EnvRecord {
59
+ readonly scope: Scope;
60
+ readonly envName: EnvName;
61
+ readonly name: string;
62
+ readonly value: string;
63
+ readonly revision: number;
64
+ readonly createdAt: string;
65
+ readonly updatedAt: string;
66
+ readonly tags?: Readonly<Record<string, string>>;
67
+ }
68
+
69
+ export interface EnvListInput {
70
+ readonly scope: Scope;
71
+ readonly envName: EnvName;
72
+ readonly limit: number;
73
+ readonly cursor?: Cursor;
74
+ readonly namePrefix?: string;
75
+ readonly tagFilter?: Readonly<Record<string, string>>;
76
+ }
77
+
78
+ export interface EnvListPage {
79
+ readonly data: readonly EnvRecord[];
80
+ readonly nextCursor?: Cursor;
81
+ }
82
+
83
+ export interface EnvGetInput {
84
+ readonly scope: Scope;
85
+ readonly envName: EnvName;
86
+ readonly name: string;
87
+ }
88
+
89
+ export interface EnvResolveInput {
90
+ readonly scope: Scope;
91
+ readonly envName: EnvName;
92
+ readonly name: string;
93
+ readonly resolveContext: ResolveContext;
94
+ }
95
+
96
+ export interface EnvResolveOutcome {
97
+ readonly name: string;
98
+ readonly value: string;
99
+ readonly revision: number;
100
+ }
101
+
102
+ export interface EnvSetInput {
103
+ readonly scope: Scope;
104
+ readonly envName: EnvName;
105
+ readonly name: string;
106
+ readonly value: string;
107
+ readonly tags?: Readonly<Record<string, string>>;
108
+ readonly ifRevision?: number;
109
+ /**
110
+ * REQUIRED. Called inside the binding's write tx on FRESH insert
111
+ * (new env-var identity). Receives the new entry's id as the FGA
112
+ * subject id. Not invoked on revision-update (identity already exists).
113
+ * See `AgentPublishInput.enqueueTuples` for the design rationale.
114
+ */
115
+ readonly enqueueTuples: TupleEnqueueHook;
116
+ }
117
+
118
+ export type EnvSetOutcome =
119
+ | { readonly kind: 'ok'; readonly record: EnvRecord }
120
+ | { readonly kind: 'revision-conflict'; readonly currentRevision: number }
121
+ | { readonly kind: 'error'; readonly code: string; readonly message: string };
122
+
123
+ export interface EnvDeleteInput {
124
+ readonly scope: Scope;
125
+ readonly envName: EnvName;
126
+ readonly name: string;
127
+ }
128
+
129
+ export interface EnvDeleteOutcome {
130
+ readonly deleted: boolean;
131
+ }
132
+
133
+ export type EnvError =
134
+ | { readonly code: 'env-not-found'; readonly message: string; readonly name: string }
135
+ | {
136
+ readonly code: 'env-write-conflict';
137
+ readonly message: string;
138
+ readonly currentRevision: number;
139
+ }
140
+ | { readonly code: 'env-store-error'; readonly message: string; readonly cause?: unknown };