@kindgi/api 0.0.0-bootstrap.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +397 -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 +268 -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 +20 -0
  104. package/dist/middleware/error-mapper.d.ts.map +1 -0
  105. package/dist/middleware/error-mapper.js +34 -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 +5050 -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 +705 -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 +29649 -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 +1286 -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 +295 -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 +40 -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 +5444 -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 +892 -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
package/package.json CHANGED
@@ -1,7 +1,79 @@
1
1
  {
2
2
  "name": "@kindgi/api",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "Placeholder so a trusted publisher can be attached. Releases are published from https://github.com/kindgi/kindgi-sdk with provenance; use 0.1.0 or later.",
3
+ "version": "0.1.1",
4
+ "description": "REST + SSE HTTP surface for Kindgi™. createApp assembles a Hono app serving the /v1/* REST API (bearer or session-token auth; OpenAPI 3.1 document at /v1/openapi.json) and an optional S3-compatible /s3/* surface (SigV4), over caller-plugged bindings for the runtime (runs, agents, flows, HITL, supervisor) and for storage. Route conventions: docs/API-ROUTE-CONVENTIONS.md.",
5
5
  "license": "Apache-2.0",
6
- "repository": { "type": "git", "url": "git+https://github.com/kindgi/kindgi-sdk.git" }
7
- }
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kindgi/kindgi-sdk.git",
9
+ "directory": "packages/api"
10
+ },
11
+ "homepage": "https://github.com/kindgi/kindgi-sdk/tree/main/packages/api#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/kindgi/kindgi-sdk/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./openapi.json": "./openapi.json",
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "src",
29
+ "scripts",
30
+ "README.md",
31
+ "openapi.json"
32
+ ],
33
+ "dependencies": {
34
+ "@kindgi/agents": "0.1.1",
35
+ "@kindgi/audit-events": "0.1.1",
36
+ "@kindgi/compliance": "0.1.1",
37
+ "@kindgi/authz": "0.1.1",
38
+ "@kindgi/blob-binding": "0.1.1",
39
+ "@kindgi/capabilities": "0.1.1",
40
+ "@kindgi/crypto": "0.1.1",
41
+ "@kindgi/flow": "0.1.1",
42
+ "@kindgi/guardrails": "0.1.1",
43
+ "@kindgi/memory": "0.1.1",
44
+ "@kindgi/platform": "0.1.1",
45
+ "@kindgi/provenance": "0.1.1",
46
+ "@kindgi/runtime": "0.1.1",
47
+ "@kindgi/policy-contract": "0.1.1",
48
+ "@kindgi/schema": "0.1.1",
49
+ "@kindgi/tools": "0.1.1",
50
+ "@kindgi/types": "0.1.1",
51
+ "@scalar/hono-api-reference": "^0.12.2",
52
+ "drizzle-orm": "^0.36.4",
53
+ "hono": "^4.6.14"
54
+ },
55
+ "devDependencies": {
56
+ "@kindgi/audit-events-inmemory": "0.1.1",
57
+ "@kindgi/specs": "0.1.1",
58
+ "@kindgi/testing": "0.1.1",
59
+ "@types/aws4": "^1.11.6",
60
+ "@types/node": "^22.10.5",
61
+ "aws4": "^1.13.2",
62
+ "typescript": "^5.7.3",
63
+ "vitest": "^2.1.8"
64
+ },
65
+ "engines": {
66
+ "node": ">=22.0.0"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "provenance": true
71
+ },
72
+ "scripts": {
73
+ "build": "tsc -p tsconfig.build.json",
74
+ "typecheck": "tsc --noEmit",
75
+ "test": "vitest run",
76
+ "gen:openapi": "tsc -p tsconfig.build.json && node scripts/emit-openapi.mjs",
77
+ "clean": "rm -rf dist *.tsbuildinfo"
78
+ }
79
+ }
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // Copyright (C) 2026 Kindgi Inc.
4
+
5
+ // Emits `openapi.json` (this package's root) from the built `@kindgi/api`
6
+ // route + schema registry. The file ships with the package and is exported
7
+ // as `@kindgi/api/openapi.json` — SDK codegen and other consumers resolve
8
+ // it by package name, never by repo path. Kept as a pure `.mjs` script (no
9
+ // tsx dep) — mirrors `@kindgi/specs`' `scripts/validate.mjs`.
10
+ //
11
+ // Usage: `pnpm --filter @kindgi/api gen:openapi`.
12
+ // The npm script builds first so the imported dist is always fresh.
13
+ // `tests/openapi-artifact.test.ts` fails when the committed file is stale.
14
+
15
+ import { existsSync } from 'node:fs';
16
+ import { writeFile } from 'node:fs/promises';
17
+ import { dirname, join, resolve } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+
20
+ const __dirname = dirname(fileURLToPath(import.meta.url));
21
+ const PACKAGE_ROOT = resolve(__dirname, '..');
22
+ const DIST_ENTRY = join(PACKAGE_ROOT, 'dist', 'index.js');
23
+ const OUTPUT_PATH = join(PACKAGE_ROOT, 'openapi.json');
24
+
25
+ if (!existsSync(DIST_ENTRY)) {
26
+ console.error(
27
+ `error: expected built entry at ${DIST_ENTRY}. Run \`pnpm --filter @kindgi/api build\` first, or use \`pnpm --filter @kindgi/api gen:openapi\` which chains both.`,
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ const { generateOpenApiDocument } = await import(DIST_ENTRY);
33
+ const doc = generateOpenApiDocument();
34
+
35
+ await writeFile(OUTPUT_PATH, `${JSON.stringify(doc, null, 2)}\n`, 'utf8');
36
+
37
+ const pathCount = Object.keys(doc.paths).length;
38
+ const opCount = Object.values(doc.paths).reduce(
39
+ (sum, methods) => sum + Object.keys(methods).length,
40
+ 0,
41
+ );
42
+ console.log(
43
+ `wrote ${OUTPUT_PATH} — ${pathCount} paths, ${opCount} operations, ${Object.keys(doc.components.schemas).length} schemas`,
44
+ );
@@ -0,0 +1,204 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { Cursor, TenantId } from '@kindgi/types';
5
+
6
+ /**
7
+ * Caller-plugged surface for the adapter catalog — part of the admin
8
+ * control plane. Read-only + smoke-test-only
9
+ * over HTTP: tenants + operators see every adapter the deployment
10
+ * wired at boot time and probe each one for liveness.
11
+ *
12
+ * Adapters are the concrete bridges the runtime uses to talk to
13
+ * outside systems: model providers, embedding providers, blob storage,
14
+ * sandbox providers, eval judges. Each adapter package
15
+ * (the filesystem blob adapter, the inprocess sandbox adapter,
16
+ * `@kindgi/adapter-model-in-process`, `@kindgi/adapter-model-openai-compat`,
17
+ * the local embedding adapter, the AJV eval-judge adapter, ...)
18
+ * exports a factory + optional metadata; the deployment aggregates the
19
+ * ones it actually wired into an `AdapterRegistryBinding`.
20
+ *
21
+ * ## Why read-only + test-only
22
+ *
23
+ * Adapter lifecycle (register / unregister / reconfigure) is a
24
+ * **deployment concern**, not a runtime one. The runtime learns about
25
+ * adapters at `CreateAppInput` time; if a deployment wants to change
26
+ * what's wired it restarts the process with different config. This
27
+ * mirrors the pattern used elsewhere in the framework where lifecycle
28
+ * state is deployment-owned (bucket allocation in S3, key store for
29
+ * signing). HTTP-driven adapter reconfigure would require the runtime
30
+ * to accept live reconfiguration, which it does not.
31
+ *
32
+ * ## Wire shape discipline
33
+ *
34
+ * `AdapterInfo.config` is REDACTED — no secrets on the wire. A binding
35
+ * MAY expose non-sensitive routing hints (`{ region: 'us-east-1' }`)
36
+ * but MUST NOT surface API keys, endpoints, credentials, or any
37
+ * material that could be used to impersonate the adapter. The binding
38
+ * is authoritative on what counts as safe to expose per adapter kind.
39
+ *
40
+ * ## Probe semantics
41
+ *
42
+ * `test(...)` runs a kind-specific smoke probe against the adapter.
43
+ * Probe failures return an `AdapterTestOutcome` with `ok: false` — not
44
+ * an error. A failed probe is a valid observation about the adapter's
45
+ * state, not a server error. The route surfaces `AdapterTestOutcome`
46
+ * as HTTP 200 either way; a 5xx would indicate the probe machinery
47
+ * itself broke (which is legitimately a server error).
48
+ *
49
+ * ### Default probes by adapter kind
50
+ *
51
+ * - `blob`: write 32 random bytes → read back → verify hash → delete.
52
+ * - `sandbox`: create a context-isolated (or `none`) sandbox → run
53
+ * `1 + 1 === 2` → verify result → destroy.
54
+ * - `model` / `model-provider`: minimal completion with
55
+ * `[{ role: 'user', content: 'ping' }]` and `maxTokens: 1` — verify
56
+ * the provider returns a well-shaped response.
57
+ * - `embedding`: embed the string `'ping'` — verify the vector length
58
+ * matches the advertised dimension.
59
+ * - `eval-judge`: run a trivial pass-through eval — verify success.
60
+ *
61
+ * Adapter authors MAY accept a caller-supplied `input` on `test(...)`
62
+ * for more elaborate probes; when absent the binding falls back to
63
+ * the default above.
64
+ *
65
+ * Every method is tenant-scoped. Cursors are opaque — the binding
66
+ * chooses its encoding. The API layer only validates round-trip as a
67
+ * string; it never inspects the payload.
68
+ */
69
+ export interface AdapterRegistryBinding {
70
+ /**
71
+ * Cursor-paginated list of adapters the deployment has wired.
72
+ * Optional filters narrow to a specific `kind` or `status`.
73
+ */
74
+ list(input: AdapterListInput): Promise<AdapterPage>;
75
+ /**
76
+ * Fetch a single adapter by id, or `null` when unknown. The route
77
+ * surfaces `null` as `404 adapter-not-found`.
78
+ */
79
+ get(input: AdapterGetInput): Promise<AdapterInfo | null>;
80
+ /**
81
+ * Run the kind-specific smoke probe. Returns `null` when the id is
82
+ * unknown — the route surfaces that as `404 adapter-not-found`.
83
+ * Otherwise returns an `AdapterTestOutcome` (which itself carries
84
+ * `ok: true | false` — failed probes are data, not errors).
85
+ */
86
+ test(input: AdapterTestInput): Promise<AdapterTestOutcome | null>;
87
+ }
88
+
89
+ /**
90
+ * Closed set of adapter kinds the framework knows about. New kinds
91
+ * require an additive schema update — we enumerate rather than accept
92
+ * an open string so wire consumers (UIs, command-line tools) can render
93
+ * kind-specific columns without guessing.
94
+ *
95
+ * `model-provider` is distinct from `model` for adapters that wrap a
96
+ * remote provider gateway (a hosted API or a self-hosted inference
97
+ * server) vs. adapters that host the model in-process.
98
+ */
99
+ export type AdapterKind =
100
+ | 'model'
101
+ | 'model-provider'
102
+ | 'embedding'
103
+ | 'blob'
104
+ | 'sandbox'
105
+ | 'eval-judge';
106
+
107
+ export const ADAPTER_KINDS: readonly AdapterKind[] = [
108
+ 'model',
109
+ 'model-provider',
110
+ 'embedding',
111
+ 'blob',
112
+ 'sandbox',
113
+ 'eval-judge',
114
+ ];
115
+
116
+ /**
117
+ * Adapter status the wire surface exposes. `active` = wired and
118
+ * last-observed healthy. `degraded` = wired but the binding has seen
119
+ * recent failures / partial capability loss. `error` = wired but
120
+ * unusable (e.g. auth material missing at boot). The binding is
121
+ * authoritative on how it derives the value.
122
+ */
123
+ export type AdapterStatus = 'active' | 'degraded' | 'error';
124
+
125
+ export const ADAPTER_STATUSES: readonly AdapterStatus[] = ['active', 'degraded', 'error'];
126
+
127
+ /**
128
+ * Wire shape for a single wired adapter. Deployments produce this
129
+ * from whatever data structure they use to hold their adapter set —
130
+ * commonly the `describe()` output on the adapter factory plus a
131
+ * status field the deployment tracks itself.
132
+ */
133
+ export interface AdapterInfo {
134
+ /** Stable id chosen by the deployment (e.g. `'sandbox-primary'`). */
135
+ readonly adapterId: string;
136
+ readonly kind: AdapterKind;
137
+ /** Package name that owns the implementation (e.g. `'@kindgi/adapter-model-in-process'`). */
138
+ readonly name: string;
139
+ /** Semver of the wired package. */
140
+ readonly version: string;
141
+ /**
142
+ * Kind-specific capability tags. Free-form strings scoped by kind —
143
+ * e.g. `['context-isolated']` for a sandbox adapter, `['tool-use', 'streaming']`
144
+ * for a model adapter, `['multipart-upload']` for blob storage.
145
+ */
146
+ readonly capabilities: readonly string[];
147
+ /**
148
+ * Redacted routing hints only. No secrets. Absent when the binding
149
+ * has nothing safe to expose.
150
+ */
151
+ readonly config?: Readonly<Record<string, unknown>>;
152
+ readonly status: AdapterStatus;
153
+ /** Human-readable reason accompanying `degraded` / `error` status. */
154
+ readonly statusReason?: string;
155
+ }
156
+
157
+ export interface AdapterListInput {
158
+ readonly tenantId: TenantId;
159
+ readonly limit: number;
160
+ readonly cursor?: Cursor;
161
+ readonly filter?: AdapterListFilter;
162
+ }
163
+
164
+ export interface AdapterListFilter {
165
+ readonly kind?: AdapterKind;
166
+ readonly status?: AdapterStatus;
167
+ }
168
+
169
+ export interface AdapterPage {
170
+ readonly data: readonly AdapterInfo[];
171
+ readonly nextCursor?: Cursor;
172
+ }
173
+
174
+ export interface AdapterGetInput {
175
+ readonly tenantId: TenantId;
176
+ readonly adapterId: string;
177
+ }
178
+
179
+ export interface AdapterTestInput {
180
+ readonly tenantId: TenantId;
181
+ readonly adapterId: string;
182
+ /**
183
+ * Optional kind-specific probe input. When absent the binding runs
184
+ * the default probe documented in the interface JSDoc above. Shape
185
+ * is intentionally open so bindings can extend the probe surface
186
+ * per kind without a schema change.
187
+ */
188
+ readonly input?: Readonly<Record<string, unknown>>;
189
+ }
190
+
191
+ /**
192
+ * Result of a probe run. `ok: false` is a valid observation — the
193
+ * route serialises it as HTTP 200 either way.
194
+ *
195
+ * `probe` is kind-specific data (e.g. `{ vectorLength: 384 }` for an
196
+ * embedding probe, `{ latencyMs: 42, completion: '2' }` for a model
197
+ * probe). Consumers should not depend on its exact shape — the UI
198
+ * treats it as a diagnostic bag to render as JSON.
199
+ */
200
+ export interface AdapterTestOutcome {
201
+ readonly ok: boolean;
202
+ readonly latencyMs: number;
203
+ readonly probe: Readonly<Record<string, unknown>>;
204
+ }
@@ -0,0 +1,231 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ import type { Agent, AgentId } from '@kindgi/agents';
5
+ import type { TupleEnqueueHook } from '@kindgi/authz';
6
+ import type { Scope } from '@kindgi/platform';
7
+ import type { Cursor, ProjectId, Semver, TenantId } from '@kindgi/types';
8
+
9
+ /**
10
+ * Caller-plugged surface for the agent catalog. Same shape as
11
+ * `TokenAdmin` / `ReviewerBinding` / `RunHandlerBinding`: the API
12
+ * package does NOT own registry persistence. Deployments wire a
13
+ * runtime `AgentRegistry` (from `@kindgi/agents`) — or a durable
14
+ * pack-backed store — through this binding.
15
+ *
16
+ * Every method is tenant-scoped: callers pass `tenantId` explicitly so
17
+ * multi-tenant deployments can partition storage without exposing the
18
+ * scoping inside the API package.
19
+ *
20
+ * Cursors are opaque — the binding chooses its encoding (index-based,
21
+ * `id@version`, ISO timestamps). The API layer only validates that a
22
+ * cursor round-trips as a string; it never inspects the payload.
23
+ */
24
+ export interface AgentRegistryBinding {
25
+ /**
26
+ * Cursor-paginated list of agents (latest version per id, sorted by
27
+ * agent id ascending). Optional `nameFilter` is a prefix match on the
28
+ * agent id — the runtime uses dotted namespaces (`acme.*`), so
29
+ * prefix matching is the natural filter shape.
30
+ */
31
+ list(input: AgentListInput): Promise<AgentPage>;
32
+ /**
33
+ * Latest version of the given agent id, or `null` if unknown. The
34
+ * route surfaces `null` as `404 agent-not-found`.
35
+ */
36
+ get(input: AgentGetInput): Promise<Agent | null>;
37
+ /**
38
+ * Specific `(agentId, version)` lookup, or `null` if unknown.
39
+ * Returns tombstoned versions too (unlike `list` / `get` which
40
+ * filter them) — the specific-version lookup is used by provenance
41
+ * paths that need to resolve historical run references.
42
+ */
43
+ getVersion(input: AgentGetVersionInput): Promise<Agent | null>;
44
+ /**
45
+ * Head-row existence check. Returns `true` iff the agent id has been
46
+ * registered in the tenant (regardless of whether any versions are
47
+ * active). Lets `GET /v1/agents/{id}` distinguish
48
+ * `410 gone` (identity exists, no active version) from `404 not-
49
+ * found` (never registered) — `.get(...)` returns `null` in both
50
+ * cases.
51
+ */
52
+ headExists(input: AgentGetInput): Promise<boolean>;
53
+ /**
54
+ * Cursor-paginated list of versions for a specific agent id. Sort
55
+ * order is binding-defined; the built-in in-memory registry sorts
56
+ * ascending semver. Returns an empty page (no error) when the id is
57
+ * unknown — the route flips that to `404` via a prior `get`.
58
+ */
59
+ listVersions(input: AgentListVersionsInput): Promise<AgentPage>;
60
+ /**
61
+ * Publish a validated agent definition. The API route validates
62
+ * shape via `defineAgent(...)` before calling — the binding receives
63
+ * a well-formed `Agent`. Bindings MAY reject with `already-registered`
64
+ * when the same `(agentId, version)` is re-published; the route
65
+ * maps that to `409`.
66
+ */
67
+ publish(input: AgentPublishInput): Promise<AgentPublishOutcome>;
68
+ /**
69
+ * Soft-tombstone a specific `(agentId, version)`. Returns
70
+ * `{ unregistered: true }` on success; `{ unregistered: false }`
71
+ * when the version was unknown OR already tombstoned — the route
72
+ * flips the latter to `404`. Head row is preserved; when this
73
+ * unregister leaves NO active versions, the agent has no latest
74
+ * version — it enters the derived "retired" state
75
+ * (GET returns 410 gone) but the identity persists. Publish of a
76
+ * new version reactivates.
77
+ */
78
+ unregister(input: AgentUnregisterInput): Promise<AgentUnregisterOutcome>;
79
+ /**
80
+ * Un-tombstone a specific `(agentId, version)` — clears the
81
+ * version's tombstone and recomputes the agent's latest version
82
+ * across active versions. Restores the version's
83
+ * manifest bytes verbatim (semver hygiene: reinstate never mutates
84
+ * the manifest). Idempotent: reinstating an active version is a
85
+ * no-op. `{ kind: 'not-found' }` when the version was never
86
+ * published.
87
+ */
88
+ reinstateVersion(input: AgentReinstateVersionInput): Promise<AgentReinstateVersionOutcome>;
89
+ }
90
+
91
+ export interface AgentListInput {
92
+ readonly tenantId: TenantId;
93
+ readonly limit: number;
94
+ readonly cursor?: Cursor;
95
+ /** Prefix match on `Agent.id`. Undefined = no filter. */
96
+ readonly nameFilter?: string;
97
+ /**
98
+ * Narrow the list to a specific scope. Absent = no scope narrow
99
+ * (return every row in the tenant the caller can see — admin/audit
100
+ * default).
101
+ *
102
+ * Content-scoped semantics (this binding):
103
+ * - `{ kind: 'project', projectId }` — rows in that project.
104
+ * - `{ kind: 'org', orgId }` — rows in every project belonging to
105
+ * that org.
106
+ * - `{ kind: 'tenant', tenantId }` — every row in the tenant.
107
+ *
108
+ * Content rows always belong to a project, so `inherit` has no
109
+ * effect here.
110
+ */
111
+ readonly scope?: Scope;
112
+ /**
113
+ * `false` = literal-at-this-scope only (admin/audit view).
114
+ * `true` (default) = inheritance walk (user-facing view).
115
+ * No-op for content-scoped bindings (rows only exist at
116
+ * project-level — there is no upward hierarchy to walk). Kept for
117
+ * uniformity: scope-aware bindings share one filter shape across the
118
+ * SDK and OpenAPI schemas.
119
+ */
120
+ readonly inherit?: boolean;
121
+ }
122
+
123
+ export interface AgentGetInput {
124
+ readonly tenantId: TenantId;
125
+ readonly agentId: AgentId;
126
+ }
127
+
128
+ export interface AgentGetVersionInput {
129
+ readonly tenantId: TenantId;
130
+ readonly agentId: AgentId;
131
+ readonly version: Semver;
132
+ }
133
+
134
+ export interface AgentListVersionsInput {
135
+ readonly tenantId: TenantId;
136
+ readonly agentId: AgentId;
137
+ readonly limit: number;
138
+ readonly cursor?: Cursor;
139
+ }
140
+
141
+ export interface AgentPublishInput {
142
+ readonly tenantId: TenantId;
143
+ /**
144
+ * Project the agent is published into. REQUIRED. Callers that
145
+ * don't naturally know a projectId
146
+ * (e.g. the deployments route) resolve the tenant's Default
147
+ * via `projectBinding.getDefault(tenantId)` at THEIR layer and
148
+ * thread the resolved id here — the storage adapter never
149
+ * silently falls back to Default.
150
+ */
151
+ readonly projectId: ProjectId;
152
+ readonly agent: Agent;
153
+ /**
154
+ * REQUIRED. Called inside the binding's write transaction after the
155
+ * head + version rows are inserted, receiving the FGA subject id
156
+ * (the business `agentId`). Returns the
157
+ * `TupleIntent[]` to enqueue in the same tx — typically
158
+ * `tuplesForCreate({kind:'agent', id, tenantId, projectId}, creatorUserId)`.
159
+ *
160
+ * Required, not opt-in: a binding that cannot enqueue tuples must fail
161
+ * loudly rather than silently skip.
162
+ */
163
+ readonly enqueueTuples: TupleEnqueueHook;
164
+ }
165
+
166
+ export interface AgentUnregisterInput {
167
+ readonly tenantId: TenantId;
168
+ readonly agentId: AgentId;
169
+ readonly version: Semver;
170
+ // No enqueueTuples hook. `unregister` soft-tombstones a version and
171
+ // recomputes the latest version; the head row is PRESERVED, so the
172
+ // agent identity persists in FGA as a retired entity. A method that
173
+ // fully removed the identity would take an `enqueueTuples` parameter
174
+ // for the `tuplesForDelete(...)` cleanup.
175
+ }
176
+
177
+ export interface AgentReinstateVersionInput {
178
+ readonly tenantId: TenantId;
179
+ readonly agentId: AgentId;
180
+ readonly version: Semver;
181
+ }
182
+
183
+ export interface AgentPage {
184
+ readonly data: readonly Agent[];
185
+ readonly nextCursor?: Cursor;
186
+ }
187
+
188
+ export type AgentPublishOutcome =
189
+ | {
190
+ readonly kind: 'ok';
191
+ readonly agentId: AgentId;
192
+ readonly version: Semver;
193
+ }
194
+ | {
195
+ readonly kind: 'already-registered';
196
+ readonly agentId: AgentId;
197
+ readonly version: Semver;
198
+ }
199
+ | {
200
+ /**
201
+ * The caller-supplied `projectId` does not resolve to a real
202
+ * project row in this tenant. Distinct from
203
+ * `already-registered` so callers can surface a clean error (the
204
+ * agents route answers `400 bad-input`) rather than the
205
+ * misleading `already-registered` fallback. Implementations
206
+ * detect a missing project at publish time (a SQL store typically
207
+ * from its foreign-key violation).
208
+ */
209
+ readonly kind: 'project-not-found';
210
+ readonly agentId: AgentId;
211
+ readonly version: Semver;
212
+ readonly projectId: ProjectId;
213
+ };
214
+
215
+ export type AgentUnregisterOutcome = {
216
+ readonly unregistered: boolean;
217
+ };
218
+
219
+ export type AgentReinstateVersionOutcome =
220
+ | {
221
+ readonly kind: 'ok';
222
+ readonly agentId: AgentId;
223
+ readonly version: Semver;
224
+ /** `false` when the version was already active (idempotent no-op). */
225
+ readonly wasTombstoned: boolean;
226
+ }
227
+ | {
228
+ readonly kind: 'not-found';
229
+ readonly agentId: AgentId;
230
+ readonly version: Semver;
231
+ };