@tai42/api-client 16.0.0 → 17.0.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 (396) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/agents.js +1 -1
  3. package/dist/agents.js.map +1 -1
  4. package/dist/client/agents-client.d.ts +26 -0
  5. package/dist/client/agents-client.d.ts.map +1 -0
  6. package/dist/client/agents-client.js +19 -0
  7. package/dist/client/agents-client.js.map +1 -0
  8. package/dist/client/auth-client.d.ts +247 -0
  9. package/dist/client/auth-client.d.ts.map +1 -0
  10. package/dist/client/auth-client.js +73 -0
  11. package/dist/client/auth-client.js.map +1 -0
  12. package/dist/client/backend-client.d.ts +39 -0
  13. package/dist/client/backend-client.d.ts.map +1 -0
  14. package/dist/client/backend-client.js +22 -0
  15. package/dist/client/backend-client.js.map +1 -0
  16. package/dist/client/backup-client.d.ts +56 -0
  17. package/dist/client/backup-client.d.ts.map +1 -0
  18. package/dist/client/backup-client.js +12 -0
  19. package/dist/client/backup-client.js.map +1 -0
  20. package/dist/client/capabilities-client.d.ts +40 -0
  21. package/dist/client/capabilities-client.d.ts.map +1 -0
  22. package/dist/client/capabilities-client.js +19 -0
  23. package/dist/client/capabilities-client.js.map +1 -0
  24. package/dist/client/channels-client.d.ts +7 -0
  25. package/dist/client/channels-client.d.ts.map +1 -0
  26. package/dist/client/channels-client.js +10 -0
  27. package/dist/client/channels-client.js.map +1 -0
  28. package/dist/client/config-client.d.ts +59 -0
  29. package/dist/client/config-client.d.ts.map +1 -0
  30. package/dist/client/config-client.js +18 -0
  31. package/dist/client/config-client.js.map +1 -0
  32. package/dist/client/connectors-client.d.ts +225 -0
  33. package/dist/client/connectors-client.d.ts.map +1 -0
  34. package/dist/client/connectors-client.js +31 -0
  35. package/dist/client/connectors-client.js.map +1 -0
  36. package/dist/client/conversations-client.d.ts +398 -0
  37. package/dist/client/conversations-client.d.ts.map +1 -0
  38. package/dist/client/conversations-client.js +120 -0
  39. package/dist/client/conversations-client.js.map +1 -0
  40. package/dist/client/hooks-client.d.ts +112 -0
  41. package/dist/client/hooks-client.d.ts.map +1 -0
  42. package/dist/client/hooks-client.js +25 -0
  43. package/dist/client/hooks-client.js.map +1 -0
  44. package/dist/{client.d.ts → client/index.d.ts} +2336 -2708
  45. package/dist/client/index.d.ts.map +1 -0
  46. package/dist/client/index.js +79 -0
  47. package/dist/client/index.js.map +1 -0
  48. package/dist/client/interactions-client.d.ts +52 -0
  49. package/dist/client/interactions-client.d.ts.map +1 -0
  50. package/dist/client/interactions-client.js +84 -0
  51. package/dist/client/interactions-client.js.map +1 -0
  52. package/dist/client/login-client.d.ts +69 -0
  53. package/dist/client/login-client.d.ts.map +1 -0
  54. package/dist/client/login-client.js +137 -0
  55. package/dist/client/login-client.js.map +1 -0
  56. package/dist/client/manifest-client.d.ts +354 -0
  57. package/dist/client/manifest-client.d.ts.map +1 -0
  58. package/dist/client/manifest-client.js +76 -0
  59. package/dist/client/manifest-client.js.map +1 -0
  60. package/dist/client/marketplace-client.d.ts +274 -0
  61. package/dist/client/marketplace-client.d.ts.map +1 -0
  62. package/dist/client/marketplace-client.js +46 -0
  63. package/dist/client/marketplace-client.js.map +1 -0
  64. package/dist/client/mcp-config-schema-client.d.ts +5 -0
  65. package/dist/client/mcp-config-schema-client.d.ts.map +1 -0
  66. package/dist/client/mcp-config-schema-client.js +9 -0
  67. package/dist/client/mcp-config-schema-client.js.map +1 -0
  68. package/dist/client/notifications-client.d.ts +27 -0
  69. package/dist/client/notifications-client.d.ts.map +1 -0
  70. package/dist/client/notifications-client.js +11 -0
  71. package/dist/client/notifications-client.js.map +1 -0
  72. package/dist/client/observability-client.d.ts +103 -0
  73. package/dist/client/observability-client.d.ts.map +1 -0
  74. package/dist/client/observability-client.js +43 -0
  75. package/dist/client/observability-client.js.map +1 -0
  76. package/dist/client/plugins-client.d.ts +17 -0
  77. package/dist/client/plugins-client.d.ts.map +1 -0
  78. package/dist/client/plugins-client.js +9 -0
  79. package/dist/client/plugins-client.js.map +1 -0
  80. package/dist/client/policy-client.d.ts +37 -0
  81. package/dist/client/policy-client.d.ts.map +1 -0
  82. package/dist/client/policy-client.js +26 -0
  83. package/dist/client/policy-client.js.map +1 -0
  84. package/dist/client/presets-client.d.ts +334 -0
  85. package/dist/client/presets-client.d.ts.map +1 -0
  86. package/dist/client/presets-client.js +38 -0
  87. package/dist/client/presets-client.js.map +1 -0
  88. package/dist/client/profiles-client.d.ts +101 -0
  89. package/dist/client/profiles-client.d.ts.map +1 -0
  90. package/dist/client/profiles-client.js +37 -0
  91. package/dist/client/profiles-client.js.map +1 -0
  92. package/dist/client/schedules-client.d.ts +27 -0
  93. package/dist/client/schedules-client.d.ts.map +1 -0
  94. package/dist/client/schedules-client.js +13 -0
  95. package/dist/client/schedules-client.js.map +1 -0
  96. package/dist/client/settings-schema-client.d.ts +23 -0
  97. package/dist/client/settings-schema-client.d.ts.map +1 -0
  98. package/dist/client/settings-schema-client.js +9 -0
  99. package/dist/client/settings-schema-client.js.map +1 -0
  100. package/dist/client/states-client.d.ts +470 -0
  101. package/dist/client/states-client.d.ts.map +1 -0
  102. package/dist/client/states-client.js +144 -0
  103. package/dist/client/states-client.js.map +1 -0
  104. package/dist/client/storage-client.d.ts +40 -0
  105. package/dist/client/storage-client.d.ts.map +1 -0
  106. package/dist/client/storage-client.js +43 -0
  107. package/dist/client/storage-client.js.map +1 -0
  108. package/dist/client/sub-mcp-client.d.ts +17 -0
  109. package/dist/client/sub-mcp-client.d.ts.map +1 -0
  110. package/dist/client/sub-mcp-client.js +14 -0
  111. package/dist/client/sub-mcp-client.js.map +1 -0
  112. package/dist/client/system-client.d.ts +11 -0
  113. package/dist/client/system-client.d.ts.map +1 -0
  114. package/dist/client/system-client.js +13 -0
  115. package/dist/client/system-client.js.map +1 -0
  116. package/dist/client/templates-client.d.ts +29 -0
  117. package/dist/client/templates-client.d.ts.map +1 -0
  118. package/dist/client/templates-client.js +21 -0
  119. package/dist/client/templates-client.js.map +1 -0
  120. package/dist/client/tool-extensions-client.d.ts +53 -0
  121. package/dist/client/tool-extensions-client.d.ts.map +1 -0
  122. package/dist/client/tool-extensions-client.js +21 -0
  123. package/dist/client/tool-extensions-client.js.map +1 -0
  124. package/dist/client/tool-meta-client.d.ts +69 -0
  125. package/dist/client/tool-meta-client.d.ts.map +1 -0
  126. package/dist/client/tool-meta-client.js +38 -0
  127. package/dist/client/tool-meta-client.js.map +1 -0
  128. package/dist/client/tools-client.d.ts +83 -0
  129. package/dist/client/tools-client.d.ts.map +1 -0
  130. package/dist/client/tools-client.js +38 -0
  131. package/dist/client/tools-client.js.map +1 -0
  132. package/dist/client/transport.d.ts +13 -0
  133. package/dist/client/transport.d.ts.map +1 -0
  134. package/dist/client/transport.js +10 -0
  135. package/dist/client/transport.js.map +1 -0
  136. package/dist/client/trigger-links-client.d.ts +44 -0
  137. package/dist/client/trigger-links-client.d.ts.map +1 -0
  138. package/dist/client/trigger-links-client.js +30 -0
  139. package/dist/client/trigger-links-client.js.map +1 -0
  140. package/dist/client/web-entry-gate-client.d.ts +34 -0
  141. package/dist/client/web-entry-gate-client.d.ts.map +1 -0
  142. package/dist/client/web-entry-gate-client.js +25 -0
  143. package/dist/client/web-entry-gate-client.js.map +1 -0
  144. package/dist/errors.d.ts +11 -0
  145. package/dist/errors.d.ts.map +1 -1
  146. package/dist/errors.js +15 -0
  147. package/dist/errors.js.map +1 -1
  148. package/dist/http.d.ts.map +1 -1
  149. package/dist/http.js +33 -17
  150. package/dist/http.js.map +1 -1
  151. package/dist/index.d.ts +12 -12
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +6 -13
  154. package/dist/index.js.map +1 -1
  155. package/dist/schemas/api-keys.d.ts +43 -0
  156. package/dist/schemas/api-keys.d.ts.map +1 -0
  157. package/dist/schemas/api-keys.js +29 -0
  158. package/dist/schemas/api-keys.js.map +1 -0
  159. package/dist/schemas/auth-routes.d.ts +78 -0
  160. package/dist/schemas/auth-routes.d.ts.map +1 -0
  161. package/dist/schemas/auth-routes.js +42 -0
  162. package/dist/schemas/auth-routes.js.map +1 -0
  163. package/dist/schemas/backup.d.ts +78 -0
  164. package/dist/schemas/backup.d.ts.map +1 -0
  165. package/dist/schemas/backup.js +33 -0
  166. package/dist/schemas/backup.js.map +1 -0
  167. package/dist/schemas/capabilities.d.ts +109 -0
  168. package/dist/schemas/capabilities.d.ts.map +1 -0
  169. package/dist/schemas/capabilities.js +78 -0
  170. package/dist/schemas/capabilities.js.map +1 -0
  171. package/dist/schemas/channels.d.ts +7 -0
  172. package/dist/schemas/channels.d.ts.map +1 -0
  173. package/dist/schemas/channels.js +9 -0
  174. package/dist/schemas/channels.js.map +1 -0
  175. package/dist/schemas/config.d.ts +17 -0
  176. package/dist/schemas/config.d.ts.map +1 -0
  177. package/dist/schemas/config.js +17 -0
  178. package/dist/schemas/config.js.map +1 -0
  179. package/dist/schemas/connectors.d.ts +383 -0
  180. package/dist/schemas/connectors.d.ts.map +1 -0
  181. package/dist/schemas/connectors.js +122 -0
  182. package/dist/schemas/connectors.js.map +1 -0
  183. package/dist/schemas/conversations.d.ts +600 -0
  184. package/dist/schemas/conversations.d.ts.map +1 -0
  185. package/dist/schemas/conversations.js +208 -0
  186. package/dist/schemas/conversations.js.map +1 -0
  187. package/dist/schemas/extensions.d.ts +44 -0
  188. package/dist/schemas/extensions.d.ts.map +1 -0
  189. package/dist/schemas/extensions.js +29 -0
  190. package/dist/schemas/extensions.js.map +1 -0
  191. package/dist/schemas/fleet.d.ts +271 -0
  192. package/dist/schemas/fleet.d.ts.map +1 -0
  193. package/dist/schemas/fleet.js +132 -0
  194. package/dist/schemas/fleet.js.map +1 -0
  195. package/dist/schemas/hooks.d.ts +120 -0
  196. package/dist/schemas/hooks.d.ts.map +1 -0
  197. package/dist/schemas/hooks.js +44 -0
  198. package/dist/schemas/hooks.js.map +1 -0
  199. package/dist/schemas/index.d.ts +40 -0
  200. package/dist/schemas/index.d.ts.map +1 -0
  201. package/dist/schemas/index.js +40 -0
  202. package/dist/schemas/index.js.map +1 -0
  203. package/dist/schemas/interactions.d.ts +156 -0
  204. package/dist/schemas/interactions.d.ts.map +1 -0
  205. package/dist/schemas/interactions.js +124 -0
  206. package/dist/schemas/interactions.js.map +1 -0
  207. package/dist/schemas/login.d.ts +93 -0
  208. package/dist/schemas/login.d.ts.map +1 -0
  209. package/dist/schemas/login.js +61 -0
  210. package/dist/schemas/login.js.map +1 -0
  211. package/dist/schemas/manifest-mcp.d.ts +125 -0
  212. package/dist/schemas/manifest-mcp.d.ts.map +1 -0
  213. package/dist/schemas/manifest-mcp.js +61 -0
  214. package/dist/schemas/manifest-mcp.js.map +1 -0
  215. package/dist/schemas/marketplace.d.ts +708 -0
  216. package/dist/schemas/marketplace.d.ts.map +1 -0
  217. package/dist/schemas/marketplace.js +387 -0
  218. package/dist/schemas/marketplace.js.map +1 -0
  219. package/dist/schemas/notifications.d.ts +61 -0
  220. package/dist/schemas/notifications.d.ts.map +1 -0
  221. package/dist/schemas/notifications.js +38 -0
  222. package/dist/schemas/notifications.js.map +1 -0
  223. package/dist/schemas/observability.d.ts +114 -0
  224. package/dist/schemas/observability.d.ts.map +1 -0
  225. package/dist/schemas/observability.js +74 -0
  226. package/dist/schemas/observability.js.map +1 -0
  227. package/dist/schemas/policy.d.ts +58 -0
  228. package/dist/schemas/policy.d.ts.map +1 -0
  229. package/dist/schemas/policy.js +32 -0
  230. package/dist/schemas/policy.js.map +1 -0
  231. package/dist/schemas/presets.d.ts +258 -0
  232. package/dist/schemas/presets.d.ts.map +1 -0
  233. package/dist/schemas/presets.js +95 -0
  234. package/dist/schemas/presets.js.map +1 -0
  235. package/dist/schemas/principals.d.ts +54 -0
  236. package/dist/schemas/principals.d.ts.map +1 -0
  237. package/dist/schemas/principals.js +34 -0
  238. package/dist/schemas/principals.js.map +1 -0
  239. package/dist/schemas/profiles.d.ts +180 -0
  240. package/dist/schemas/profiles.d.ts.map +1 -0
  241. package/dist/schemas/profiles.js +100 -0
  242. package/dist/schemas/profiles.js.map +1 -0
  243. package/dist/schemas/roles.d.ts +125 -0
  244. package/dist/schemas/roles.d.ts.map +1 -0
  245. package/dist/schemas/roles.js +46 -0
  246. package/dist/schemas/roles.js.map +1 -0
  247. package/dist/schemas/schedules.d.ts +25 -0
  248. package/dist/schemas/schedules.d.ts.map +1 -0
  249. package/dist/schemas/schedules.js +24 -0
  250. package/dist/schemas/schedules.js.map +1 -0
  251. package/dist/schemas/served.d.ts +626 -0
  252. package/dist/schemas/served.d.ts.map +1 -0
  253. package/dist/schemas/served.js +28 -0
  254. package/dist/schemas/served.js.map +1 -0
  255. package/dist/schemas/settings-schema.d.ts +23 -0
  256. package/dist/schemas/settings-schema.d.ts.map +1 -0
  257. package/dist/schemas/settings-schema.js +25 -0
  258. package/dist/schemas/settings-schema.js.map +1 -0
  259. package/dist/schemas/setup.d.ts +43 -0
  260. package/dist/schemas/setup.d.ts.map +1 -0
  261. package/dist/schemas/setup.js +19 -0
  262. package/dist/schemas/setup.js.map +1 -0
  263. package/dist/schemas/shared.d.ts +20 -0
  264. package/dist/schemas/shared.d.ts.map +1 -0
  265. package/dist/schemas/shared.js +20 -0
  266. package/dist/schemas/shared.js.map +1 -0
  267. package/dist/schemas/states.d.ts +499 -0
  268. package/dist/schemas/states.d.ts.map +1 -0
  269. package/dist/schemas/states.js +220 -0
  270. package/dist/schemas/states.js.map +1 -0
  271. package/dist/schemas/storage.d.ts +37 -0
  272. package/dist/schemas/storage.d.ts.map +1 -0
  273. package/dist/schemas/storage.js +24 -0
  274. package/dist/schemas/storage.js.map +1 -0
  275. package/dist/schemas/studio-plugins.d.ts +30 -0
  276. package/dist/schemas/studio-plugins.d.ts.map +1 -0
  277. package/dist/schemas/studio-plugins.js +20 -0
  278. package/dist/schemas/studio-plugins.js.map +1 -0
  279. package/dist/schemas/sub-mcp.d.ts +29 -0
  280. package/dist/schemas/sub-mcp.d.ts.map +1 -0
  281. package/dist/schemas/sub-mcp.js +22 -0
  282. package/dist/schemas/sub-mcp.js.map +1 -0
  283. package/dist/schemas/system-kinds.d.ts +122 -0
  284. package/dist/schemas/system-kinds.d.ts.map +1 -0
  285. package/dist/schemas/system-kinds.js +40 -0
  286. package/dist/schemas/system-kinds.js.map +1 -0
  287. package/dist/schemas/templates.d.ts +26 -0
  288. package/dist/schemas/templates.d.ts.map +1 -0
  289. package/dist/schemas/templates.js +11 -0
  290. package/dist/schemas/templates.js.map +1 -0
  291. package/dist/schemas/tool-meta.d.ts +64 -0
  292. package/dist/schemas/tool-meta.d.ts.map +1 -0
  293. package/dist/schemas/tool-meta.js +44 -0
  294. package/dist/schemas/tool-meta.js.map +1 -0
  295. package/dist/schemas/tools.d.ts +62 -0
  296. package/dist/schemas/tools.d.ts.map +1 -0
  297. package/dist/schemas/tools.js +53 -0
  298. package/dist/schemas/tools.js.map +1 -0
  299. package/dist/schemas/trigger-links.d.ts +71 -0
  300. package/dist/schemas/trigger-links.d.ts.map +1 -0
  301. package/dist/schemas/trigger-links.js +46 -0
  302. package/dist/schemas/trigger-links.js.map +1 -0
  303. package/dist/schemas/web-entry.d.ts +45 -0
  304. package/dist/schemas/web-entry.d.ts.map +1 -0
  305. package/dist/schemas/web-entry.js +36 -0
  306. package/dist/schemas/web-entry.js.map +1 -0
  307. package/dist/tool-runs.d.ts.map +1 -1
  308. package/dist/tool-runs.js.map +1 -1
  309. package/package.json +1 -1
  310. package/src/agents.ts +2 -2
  311. package/src/client/agents-client.ts +23 -0
  312. package/src/client/auth-client.ts +170 -0
  313. package/src/client/backend-client.ts +25 -0
  314. package/src/client/backup-client.ts +16 -0
  315. package/src/client/capabilities-client.ts +22 -0
  316. package/src/client/channels-client.ts +11 -0
  317. package/src/client/config-client.ts +21 -0
  318. package/src/client/connectors-client.ts +52 -0
  319. package/src/client/conversations-client.ts +240 -0
  320. package/src/client/hooks-client.ts +44 -0
  321. package/src/client/index.ts +122 -0
  322. package/src/client/interactions-client.ts +89 -0
  323. package/src/client/login-client.ts +150 -0
  324. package/src/client/manifest-client.ts +118 -0
  325. package/src/client/marketplace-client.ts +122 -0
  326. package/src/client/mcp-config-schema-client.ts +11 -0
  327. package/src/client/notifications-client.ts +13 -0
  328. package/src/client/observability-client.ts +82 -0
  329. package/src/client/plugins-client.ts +11 -0
  330. package/src/client/policy-client.ts +41 -0
  331. package/src/client/presets-client.ts +124 -0
  332. package/src/client/profiles-client.ts +51 -0
  333. package/src/client/schedules-client.ts +22 -0
  334. package/src/client/settings-schema-client.ts +11 -0
  335. package/src/client/states-client.ts +292 -0
  336. package/src/client/storage-client.ts +63 -0
  337. package/src/client/sub-mcp-client.ts +17 -0
  338. package/src/client/system-client.ts +16 -0
  339. package/src/client/templates-client.ts +28 -0
  340. package/src/client/tool-extensions-client.ts +24 -0
  341. package/src/client/tool-meta-client.ts +65 -0
  342. package/src/client/tools-client.ts +66 -0
  343. package/src/client/transport.ts +18 -0
  344. package/src/client/trigger-links-client.ts +51 -0
  345. package/src/client/web-entry-gate-client.ts +45 -0
  346. package/src/errors.ts +16 -0
  347. package/src/http.ts +48 -24
  348. package/src/index.ts +231 -226
  349. package/src/schemas/api-keys.ts +34 -0
  350. package/src/schemas/auth-routes.ts +48 -0
  351. package/src/schemas/backup.ts +43 -0
  352. package/src/schemas/capabilities.ts +92 -0
  353. package/src/schemas/channels.ts +11 -0
  354. package/src/schemas/config.ts +17 -0
  355. package/src/schemas/connectors.ts +139 -0
  356. package/src/schemas/conversations.ts +257 -0
  357. package/src/schemas/extensions.ts +34 -0
  358. package/src/schemas/fleet.ts +154 -0
  359. package/src/schemas/hooks.ts +57 -0
  360. package/src/schemas/index.ts +39 -0
  361. package/src/schemas/interactions.ts +147 -0
  362. package/src/schemas/login.ts +69 -0
  363. package/src/schemas/manifest-mcp.ts +70 -0
  364. package/src/schemas/marketplace.ts +447 -0
  365. package/src/schemas/notifications.ts +43 -0
  366. package/src/schemas/observability.ts +87 -0
  367. package/src/schemas/policy.ts +38 -0
  368. package/src/schemas/presets.ts +114 -0
  369. package/src/schemas/principals.ts +41 -0
  370. package/src/schemas/profiles.ts +120 -0
  371. package/src/schemas/roles.ts +58 -0
  372. package/src/schemas/schedules.ts +28 -0
  373. package/src/schemas/served.ts +50 -0
  374. package/src/schemas/settings-schema.ts +32 -0
  375. package/src/schemas/setup.ts +39 -0
  376. package/src/schemas/shared.ts +21 -0
  377. package/src/schemas/states.ts +273 -0
  378. package/src/schemas/storage.ts +31 -0
  379. package/src/schemas/studio-plugins.ts +21 -0
  380. package/src/schemas/sub-mcp.ts +24 -0
  381. package/src/schemas/system-kinds.ts +47 -0
  382. package/src/schemas/templates.ts +12 -0
  383. package/src/schemas/tool-meta.ts +51 -0
  384. package/src/schemas/tools.ts +62 -0
  385. package/src/schemas/trigger-links.ts +55 -0
  386. package/src/schemas/web-entry.ts +46 -0
  387. package/src/tool-runs.ts +1 -1
  388. package/dist/client.d.ts.map +0 -1
  389. package/dist/client.js +0 -920
  390. package/dist/client.js.map +0 -1
  391. package/dist/schemas.d.ts +0 -5172
  392. package/dist/schemas.d.ts.map +0 -1
  393. package/dist/schemas.js +0 -2268
  394. package/dist/schemas.js.map +0 -1
  395. package/src/client.ts +0 -1771
  396. package/src/schemas.ts +0 -2760
@@ -0,0 +1,273 @@
1
+ /** State declaration, record, template and consumer response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ import { conversationTargetKind } from './conversations';
5
+ import { stateDeclaration, stateTemplateDocument } from './served';
6
+
7
+ // The hand-written state response DTOs — list rows and detail (built on the generated
8
+ // `stateDeclaration`), attachments, per-subject records and subjects, stats and consumers.
9
+ // The served DOCUMENT schemas (`stateDeclaration`/`stateTemplateDocument` and the template
10
+ // sub-shapes) are generated from the contract bundle and re-exported at the top of this
11
+ // file. The composed `effective_schema` and write `regimes` stay permissive JSON records
12
+ // (the auto-form and JsonTree interpret them at runtime) and are server-computed, so they
13
+ // are modelled optional and a response that omits them still parses.
14
+
15
+ /** One addressed subject: the conversation-target scope plus the (kind, key) within it. */
16
+ export const stateSubject = z.object({
17
+ target_kind: conversationTargetKind,
18
+ target_name: z.string(),
19
+ kind: z.string(),
20
+ key: z.string(),
21
+ });
22
+ export type StateSubject = z.infer<typeof stateSubject>;
23
+
24
+ /** One absolute write-regime rule composed over the attachments: `{path, regime}`, permissive. */
25
+ export const stateRegime = z.record(z.string(), z.unknown());
26
+
27
+ /**
28
+ * One row of `GET /api/states` — a served declaration (`list_states` dumps every
29
+ * `StateDeclaration`) plus `updated_at` (the row's last-write timestamp, ISO or
30
+ * `null`). The list carries no record count; the `Records` column reads
31
+ * `getStateStats` lazily per row.
32
+ */
33
+ export const stateListItem = stateDeclaration.extend({
34
+ updated_at: z.string().nullable().default(null),
35
+ });
36
+ export type StateListItem = z.infer<typeof stateListItem>;
37
+ export const stateList = z.array(stateListItem);
38
+
39
+ /** One template attachment on a state: where the fragment lands + its param/declaration values. */
40
+ export const stateAttachment = z.object({
41
+ template: z.string(),
42
+ path: z.array(z.string()),
43
+ parameters: z.record(z.string(), z.unknown()).default({}),
44
+ declarations: z.record(z.string(), z.unknown()).default({}),
45
+ });
46
+ export type StateAttachment = z.infer<typeof stateAttachment>;
47
+ export const stateAttachmentList = z.array(stateAttachment);
48
+
49
+ /** `GET /api/states/{name}` — the declaration (with effective schema + regimes) plus attachments. */
50
+ export const stateDetail = stateDeclaration.extend({
51
+ attachments: z.array(stateAttachment).default([]),
52
+ });
53
+ export type StateDetail = z.infer<typeof stateDetail>;
54
+
55
+ /**
56
+ * `GET /api/states/{name}/stats` — `records` (total documents), `per_field` (the count
57
+ * of records carrying each base-schema property), `per_kind` (records per subject kind)
58
+ * and `consumers` (the count of listable consumers). The Records tab shows `records`;
59
+ * the states list reads it lazily for its Records column.
60
+ */
61
+ export const stateStats = z.object({
62
+ records: z.number(),
63
+ per_field: z.record(z.string(), z.number()).default({}),
64
+ per_kind: z.record(z.string(), z.number()).default({}),
65
+ consumers: z.number().default(0),
66
+ });
67
+ export type StateStats = z.infer<typeof stateStats>;
68
+
69
+ /**
70
+ * One row of `GET /api/state-templates`. The template document plus the two derived columns
71
+ * the Templates tab shows: `attached_to` (how many states attach it — a delete is refused
72
+ * while > 0) and `shipped_default` (a platform-shipped template). Both are server-derived
73
+ * columns; the document fields are verbatim.
74
+ */
75
+ export const stateTemplateListItem = stateTemplateDocument.extend({
76
+ attached_to: z.number().default(0),
77
+ shipped_default: z.boolean().default(false),
78
+ });
79
+ export type StateTemplateListItem = z.infer<typeof stateTemplateListItem>;
80
+ export const stateTemplateList = z.array(stateTemplateListItem);
81
+
82
+ /** A read record: the state, its subject, the document + monotonic seq, and any fold. */
83
+ export const stateRecord = z.object({
84
+ state: z.string(),
85
+ subject: stateSubject,
86
+ data: z.record(z.string(), z.unknown()).default({}),
87
+ seq: z.number(),
88
+ canonical_subject: stateSubject,
89
+ folded_from: z.array(stateSubject).default([]),
90
+ });
91
+ export type StateRecord = z.infer<typeof stateRecord>;
92
+
93
+ /** The outcome of an `apply` (a delta batch): whether it applied + the resulting doc. */
94
+ export const applyResult = z.object({
95
+ applied: z.boolean(),
96
+ data: z.record(z.string(), z.unknown()).nullable().default(null),
97
+ seq: z.number().nullable().default(null),
98
+ skipped: z.array(z.record(z.string(), z.unknown())).default([]),
99
+ });
100
+ export type ApplyResult = z.infer<typeof applyResult>;
101
+
102
+ /**
103
+ * `GET …/template-jq/{name}` — the evaluated template jq's `name`, its `purpose`, and
104
+ * its `value` (the `input` jq's read). GET evaluates ONLY an `input`-purpose jq; a GET
105
+ * on an `update`-purpose name is refused with 422, so the result's purpose is always
106
+ * `input`.
107
+ */
108
+ export const templateJqResult = z.object({
109
+ name: z.string(),
110
+ purpose: z.literal('input'),
111
+ value: z.unknown(),
112
+ });
113
+ export type TemplateJqResult = z.infer<typeof templateJqResult>;
114
+
115
+ /**
116
+ * `POST …/template-jq/{name}` — the applied template jq's outcome. The jq lands an op
117
+ * batch through the same `apply` chokepoint as a delta, so `applied`/`data`/`seq`/`skipped`
118
+ * carry that outcome.
119
+ */
120
+ export const templateJqApplyResult = z.object({
121
+ name: z.string(),
122
+ applied: z.boolean(),
123
+ data: z.record(z.string(), z.unknown()).nullable().default(null),
124
+ seq: z.number().nullable().default(null),
125
+ skipped: z.array(z.record(z.string(), z.unknown())).default([]),
126
+ });
127
+ export type TemplateJqApplyResult = z.infer<typeof templateJqApplyResult>;
128
+
129
+ /**
130
+ * One paged subject row: the addressed `subject` plus its record's last-write
131
+ * `updated_at` — epoch seconds (the store's `extract(epoch FROM updated_at)`), served
132
+ * raw (no `mode="json"` dump), and `NOT NULL` on every record, so a plain number.
133
+ */
134
+ export const subjectRow = z.object({
135
+ subject: stateSubject,
136
+ updated_at: z.number(),
137
+ });
138
+ export type SubjectRow = z.infer<typeof subjectRow>;
139
+
140
+ /**
141
+ * `GET /api/states/{name}/subjects` — a keyset page of subject rows (optionally of one
142
+ * `kind`): the matched `subjects` plus the `next_cursor` a "Load more" carries back
143
+ * (`null` at the end).
144
+ */
145
+ export const subjectPage = z.object({
146
+ subjects: z.array(subjectRow),
147
+ next_cursor: z.string().nullable().default(null),
148
+ });
149
+ export type SubjectPage = z.infer<typeof subjectPage>;
150
+
151
+ /**
152
+ * `POST /api/states/{name}/records/search` — a keyset page of the subject rows whose
153
+ * document contains the filters (a JSONB containment match). Each hit's `subject` opens
154
+ * the record page; `next_cursor` pages the rest.
155
+ */
156
+ export const recordSearchPage = z.object({
157
+ matches: z.array(subjectRow),
158
+ next_cursor: z.string().nullable().default(null),
159
+ });
160
+ export type RecordSearchPage = z.infer<typeof recordSearchPage>;
161
+
162
+ /** A WriteEntry's origin completed by the platform chokepoint (mirrors CompletedOrigin). */
163
+ export const completedOrigin = z.object({
164
+ consumer: z.string().nullable().default(null),
165
+ // Opaque consumer-supplied provenance JSON the platform stores as is.
166
+ meta: z.record(z.string(), z.unknown()).nullable().default(null),
167
+ run_id: z.string().nullable().default(null),
168
+ op_id: z.string().nullable().default(null),
169
+ door: z.string(),
170
+ actor: z.string().nullable().default(null),
171
+ turn_id: z.string().nullable().default(null),
172
+ inbound_id: z.string().nullable().default(null),
173
+ });
174
+ export type CompletedOrigin = z.infer<typeof completedOrigin>;
175
+
176
+ /** One row of a subject's audit trail (mirrors WriteEntry). `paths` are absolute. */
177
+ export const writeEntry = z.object({
178
+ seq: z.number(),
179
+ at: z.string(),
180
+ origin: completedOrigin,
181
+ paths: z.array(z.array(z.union([z.string(), z.number()]))).default([]),
182
+ });
183
+ export type WriteEntry = z.infer<typeof writeEntry>;
184
+
185
+ /** `GET /api/states/{name}/records/.../writes` — a keyset page of the audit trail. */
186
+ export const writesPage = z.object({
187
+ items: z.array(writeEntry),
188
+ next_cursor: z.string().nullable().default(null),
189
+ });
190
+ export type WritesPage = z.infer<typeof writesPage>;
191
+
192
+ /** Where the Studio opens a consumer (mirrors ConsumerLink): a token+search OR plugin path. */
193
+ export const consumerLink = z.object({
194
+ token: z.string().nullable().default(null),
195
+ plugin_path: z.string().nullable().default(null),
196
+ search: z.record(z.string(), z.unknown()).nullable().default(null),
197
+ });
198
+ export type ConsumerLink = z.infer<typeof consumerLink>;
199
+
200
+ /**
201
+ * One thing that binds a state (mirrors ConsumerRow): its `kind` (flow / hook / schedule
202
+ * / agent), `name`, human `detail` and optional `link`. `unavailable` marks a consumer
203
+ * family that cannot be listed on this deployment (e.g. no scheduling backend), surfaced
204
+ * as a muted line — never swallowed.
205
+ */
206
+ export const consumerRow = z.object({
207
+ kind: z.string(),
208
+ name: z.string().nullable().default(null),
209
+ detail: z.string().nullable().default(null),
210
+ link: consumerLink.nullable().default(null),
211
+ unavailable: z.string().nullable().default(null),
212
+ });
213
+ export type ConsumerRow = z.infer<typeof consumerRow>;
214
+
215
+ /** `GET /api/states/{name}/consumers` — the union of every registered lister's rows. */
216
+ export const stateConsumers = z.array(consumerRow);
217
+ export type StateConsumers = z.infer<typeof stateConsumers>;
218
+
219
+ /** `DELETE /api/states/{name}` — the removed state. */
220
+ export const stateDeleted = z.object({ name: z.string(), deleted: z.literal(true) });
221
+
222
+ /** `PUT /api/states/{name}/attachments/{template}` — the template now attached to the state. */
223
+ export const stateAttached = z.object({
224
+ attached: z.literal(true),
225
+ state: z.string(),
226
+ template: z.string(),
227
+ });
228
+ export type StateAttached = z.infer<typeof stateAttached>;
229
+
230
+ /** `PATCH /api/states/{name}/attachments/{template}` — the attachment whose declarations were rewritten. */
231
+ export const stateAttachmentUpdated = z.object({
232
+ updated: z.literal(true),
233
+ state: z.string(),
234
+ template: z.string(),
235
+ });
236
+ export type StateAttachmentUpdated = z.infer<typeof stateAttachmentUpdated>;
237
+
238
+ /** `DELETE /api/states/{name}/attachments/{template}` — the template detached from the state. */
239
+ export const stateDetached = z.object({
240
+ detached: z.literal(true),
241
+ state: z.string(),
242
+ template: z.string(),
243
+ });
244
+ export type StateDetached = z.infer<typeof stateDetached>;
245
+
246
+ /**
247
+ * `POST /api/states/{name}/records/.../fold` — the fold report: the `mode`, the
248
+ * `{kind, key}` of the folded `from` and surviving `into` subjects, whether the fold
249
+ * was `already` in place, and how many records were `flattened` into the survivor.
250
+ */
251
+ export const stateFoldReport = z.object({
252
+ mode: z.enum(['switch', 'merge']),
253
+ from: z.object({ kind: z.string(), key: z.string() }),
254
+ into: z.object({ kind: z.string(), key: z.string() }),
255
+ already: z.boolean(),
256
+ flattened: z.number().default(0),
257
+ });
258
+ export type StateFoldReport = z.infer<typeof stateFoldReport>;
259
+
260
+ /** `DELETE /api/state-templates/{name}` — the removed template document. */
261
+ export const stateTemplateDeleted = z.object({ name: z.string(), deleted: z.literal(true) });
262
+
263
+ /** `DELETE /api/states/{name}/records/...` — the erased record marker. */
264
+ export const recordErased = z.object({ erased: z.literal(true) });
265
+
266
+ /**
267
+ * `POST /api/state-retention/prune` — the retention sweep's per-state deleted counts
268
+ * (`{}` when nothing expired); the UI sums the values for its total.
269
+ */
270
+ export const stateRetentionPruned = z.object({
271
+ pruned: z.record(z.string(), z.number()).default({}),
272
+ });
273
+ export type StateRetentionPruned = z.infer<typeof stateRetentionPruned>;
@@ -0,0 +1,31 @@
1
+ /** Storage-provider info and resource CRUD response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ /** `GET /api/storage` — the storage-provider identity, or the absent sentinel
5
+ * (`present: false`, a 200) when no storage-provider plugin is installed. */
6
+ export const storageInfo = z.object({
7
+ present: z.boolean(),
8
+ provider: z.string().nullable(),
9
+ module: z.string().nullable(),
10
+ });
11
+ export type StorageInfo = z.infer<typeof storageInfo>;
12
+
13
+ /** `GET /api/storage/resources` — the full sorted resource-id list. */
14
+ export const storageResourceList = z.object({ resources: z.array(z.string()) });
15
+
16
+ /** `GET /api/storage/resources/{id}/stat` — an object's inferred content type;
17
+ * `null` when the provider cannot infer one (e.g. an unknown suffix). */
18
+ export const storageResourceStat = z.object({
19
+ id: z.string(),
20
+ content_type: z.string().nullable(),
21
+ });
22
+ export type StorageResourceStat = z.infer<typeof storageResourceStat>;
23
+
24
+ /** `POST /api/storage/resources` — the stored object's id. */
25
+ export const storageResourceStored = z.object({ id: z.string(), stored: z.literal(true) });
26
+
27
+ /** `DELETE /api/storage/resources/{id}` — the removed object's id. */
28
+ export const storageResourceDeleted = z.object({ id: z.string(), deleted: z.literal(true) });
29
+
30
+ /** `DELETE /api/storage/dirs/{path}` — the removed directory subtree. */
31
+ export const storageDirDeleted = z.object({ dir: z.string(), deleted: z.literal(true) });
@@ -0,0 +1,21 @@
1
+ /** Studio front-end plugin registry response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ export const studioPluginManifest = z.object({
5
+ name: z.string(),
6
+ version: z.string(),
7
+ api_version: z.number(),
8
+ entry: z.string(),
9
+ integrity: z.record(z.string(), z.string()),
10
+ contributions: z.object({
11
+ tool_panels: z.record(z.string(), z.string()).default({}),
12
+ pages: z.array(z.string()).default([]),
13
+ settings_tabs: z.array(z.string()).default([]),
14
+ // Optional with a default so a manifest without the field still parses; the
15
+ // non-strict object would otherwise SILENTLY STRIP an undeclared field, so a
16
+ // server that serves `nav_entries` would never reach the UI.
17
+ nav_entries: z.array(z.string()).default([]),
18
+ }),
19
+ });
20
+ export const studioPluginRegistry = z.array(studioPluginManifest);
21
+ export type StudioPluginManifest = z.infer<typeof studioPluginManifest>;
@@ -0,0 +1,24 @@
1
+ /** Sub-MCP mount registry response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * One registered sub-MCP mount as it rides the registry list and the projection:
6
+ * the tools it exposes and the transport it serves on. In `GET /api/sub-mcp` the
7
+ * slug is the map key, so the mount value carries no slug; {@link subMcpEntry}
8
+ * extends this with `slug` for the capability projection where mounts are a flat
9
+ * list. `transport` is always present on the wire (the server defaults it to
10
+ * `http`), so it is required — its absence is a drift, not a legal shape.
11
+ */
12
+ export const subMcpMount = z.object({
13
+ tools: z.array(z.string()),
14
+ transport: z.string(),
15
+ });
16
+ export type SubMcpMount = z.infer<typeof subMcpMount>;
17
+
18
+ export const subMcpList = z.record(z.string(), subMcpMount);
19
+ export const subMcpCreated = z.object({
20
+ slug: z.string(),
21
+ tools: z.array(z.string()),
22
+ transport: z.string(),
23
+ });
24
+ export const subMcpRemoved = z.object({ slug: z.string(), removed: z.literal(true) });
@@ -0,0 +1,47 @@
1
+ /** Pluggable-kind status and MCP status/reload response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ import { fleetResult } from './fleet';
5
+ import { reloadConfigResult } from './manifest-mcp';
6
+
7
+ // `GET /api/system/kinds` — one row per pluggable kind (identity, accounts,
8
+ // monitoring, storage, backend, channels, webhook_verifiers, config,
9
+ // studio_plugins). `state` is the kind's active/default/off status: `active` = a
10
+ // real plugin serves it, `default` = a built-in fallback serves it, `off` =
11
+ // nothing is registered (a legal state, reported not "fixed"). `plugin` is the
12
+ // provider/module name when known, else null. Plain (non-strict) `z.object` so a
13
+ // server that adds a field to the row still parses.
14
+
15
+ export const kindStatus = z.object({
16
+ kind: z.string(),
17
+ state: z.enum(['active', 'default', 'off']),
18
+ plugin: z.string().nullable(),
19
+ detail: z.string(),
20
+ });
21
+ export const kindStatusList = z.array(kindStatus);
22
+ export type KindStatus = z.infer<typeof kindStatus>;
23
+
24
+ /**
25
+ * `POST /api/tools/{name}/extensions` — the apply result. The write persists the
26
+ * manifest, reloads locally, then broadcasts the reload to the whole fleet. The
27
+ * response is the one apply-result shape every config-writer returns: the local
28
+ * reload result (`status` + `env_keys`) plus the mode-wrapped fleet `fanout`. The
29
+ * fan-out rides EVERY deployment (a lone worker reports `local-only`), so this flat
30
+ * shape parses every save and the shared fleet-report handler renders any failed
31
+ * propagation from `fanout`.
32
+ */
33
+ export const toolExtensionsApplyResult = reloadConfigResult;
34
+ export type ToolExtensionsApplyResult = z.infer<typeof toolExtensionsApplyResult>;
35
+ export const mcpStatus = z.object({
36
+ bound: z.record(z.string(), z.array(z.string())),
37
+ failed: z.array(z.object({ title: z.string(), status: z.string() })),
38
+ });
39
+
40
+ /**
41
+ * `POST /api/mcp-status/{title}/reload` — re-probe a single MCP server and broadcast
42
+ * the reload to the fleet. The response is the bare per-worker {@link fleetResult}
43
+ * (the serving worker's re-probe rides its own `results` entry as the payload); there
44
+ * is no local/workers split. A drift throws `ApiSchemaError`.
45
+ */
46
+ export const mcpReloadResult = fleetResult;
47
+ export type McpReloadResult = z.infer<typeof mcpReloadResult>;
@@ -0,0 +1,12 @@
1
+ /** Prompt-template listing, render and mutation ack schemas. */
2
+ import { z } from 'zod';
3
+
4
+ import { jsonSchema } from './shared';
5
+
6
+ export const templateNames = z.array(z.string());
7
+ export const templateDetail = z.object({ template: z.string(), schema: jsonSchema });
8
+ export const templateUploaded = z.object({ path: z.string(), uploaded: z.literal(true) });
9
+ export const templateDeleted = z.object({ path: z.string(), deleted: z.literal(true) });
10
+ export const templateDirDeleted = z.object({ path: z.string(), deleted: z.literal(true) });
11
+ export const templateRendered = z.object({ rendered: z.string() });
12
+ export const templateCacheCleared = z.object({ cleared: z.literal(true) });
@@ -0,0 +1,51 @@
1
+ /** Tool-organization overlay (folders and per-tool meta) schemas. */
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * One folder in the tool-organization tree (`tool_folders`). `parent_id` is `null`
6
+ * for a root folder and otherwise the containing folder's `id`; nesting is endless
7
+ * via the parent chain. Ids are UUID strings. A drift throws `ApiSchemaError`.
8
+ */
9
+ export const folderRecord = z.object({
10
+ id: z.string(),
11
+ name: z.string(),
12
+ parent_id: z.string().nullable(),
13
+ });
14
+ export type FolderRecord = z.infer<typeof folderRecord>;
15
+
16
+ /**
17
+ * The organizational overlay for one tool, keyed by `tool_name`. `display_name`
18
+ * overrides the rendered label (`display_name ?? name`); `folder_id` places the tool
19
+ * in a folder (`null` = unfiled); `tags` is the user's editable categorization,
20
+ * merged with the tool's read-only native tags by the UI; `badges` is the operator's
21
+ * editable capability-label overlay, merged with the tool's read-only plugin-declared
22
+ * badges by the UI (INFORMATIONAL, never an enforced gate); `hidden` is TRI-STATE —
23
+ * `null` = defer to the plugin declaration, `true` = force hidden, `false` = force
24
+ * visible. A drift throws `ApiSchemaError`.
25
+ */
26
+ export const toolMetaRecord = z.object({
27
+ tool_name: z.string(),
28
+ display_name: z.string().nullable(),
29
+ folder_id: z.string().nullable(),
30
+ tags: z.array(z.string()),
31
+ badges: z.array(z.string()),
32
+ hidden: z.boolean().nullable(),
33
+ });
34
+ export type ToolMetaRecord = z.infer<typeof toolMetaRecord>;
35
+
36
+ /**
37
+ * `GET /api/tool-meta` — the whole overlay in one read: the flat folder tree plus
38
+ * every per-tool row. The UI builds the tree and merges the rows against the live
39
+ * tool list client-side. A drift throws `ApiSchemaError`.
40
+ */
41
+ export const toolMetaOverlay = z.object({
42
+ folders: z.array(folderRecord),
43
+ meta: z.array(toolMetaRecord),
44
+ });
45
+ export type ToolMetaOverlay = z.infer<typeof toolMetaOverlay>;
46
+
47
+ /** `DELETE /api/tool-meta/tools/{tool_name}` — the dropped overlay row (idempotent). */
48
+ export const toolMetaDeleted = z.object({ tool_name: z.string(), deleted: z.literal(true) });
49
+
50
+ /** `DELETE /api/tool-meta/folders/{folder_id}` — the removed empty folder. */
51
+ export const folderDeleted = z.object({ folder_id: z.string(), deleted: z.literal(true) });
@@ -0,0 +1,62 @@
1
+ /** Tool catalog, run-result and per-tool tag response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ import { jsonSchema, jsonValue } from './shared';
5
+
6
+ export const toolNames = z.array(z.string());
7
+
8
+ export const toolSchema = z.object({
9
+ input: jsonSchema,
10
+ output: jsonSchema.nullable(),
11
+ description: z.string().nullable(),
12
+ });
13
+ export type ToolSchema = z.infer<typeof toolSchema>;
14
+
15
+ export const allToolSchemas = z.record(z.string(), toolSchema);
16
+
17
+ export const runToolResult = jsonValue;
18
+
19
+ /**
20
+ * The MEDIA content shape a direct tool run may return — fastmcp's serialized
21
+ * `Image`/`Audio` MediaBlock (`{ type, data: <base64>, mimeType }`). One recognised
22
+ * shape of the otherwise-arbitrary `runToolResult`, kept as its own schema so the
23
+ * viewer detects media by parse, not by ad-hoc shape check.
24
+ *
25
+ * SECURITY: the refinement pins `mimeType` to its kind — `image` MUST be `image/*`,
26
+ * `audio` MUST be `audio/*` — so a drifting/arbitrary mime fails the parse and is
27
+ * never turned into a `data:` URI (a `File` MediaBlock's distinct `EmbeddedResource`
28
+ * shape also fails here, by design).
29
+ */
30
+ export const toolMediaResult = z
31
+ .object({
32
+ type: z.enum(['image', 'audio']),
33
+ data: z.string(),
34
+ mimeType: z.string(),
35
+ })
36
+ .refine((media) => media.mimeType.startsWith(`${media.type}/`), {
37
+ message: 'media mimeType must match its media kind (image/* for image, audio/* for audio)',
38
+ path: ['mimeType'],
39
+ });
40
+ export type ToolMediaResult = z.infer<typeof toolMediaResult>;
41
+
42
+ /**
43
+ * The ADDITIVE per-tool native surface (`GET /api/tools/tags`). Distinct from the
44
+ * flat `toolNames` contract (`GET /api/tools`, unchanged): each entry carries the
45
+ * tool's read-only FastMCP `tags` — so the shared `ToolPicker` can group/filter its
46
+ * options — plus `hidden`, the tool's OWN plugin-declared visibility (read from the
47
+ * FastMCP `meta` under `tai42/hidden`; a tool that never declared it is not hidden).
48
+ * The tool_meta overlay's tri-state override is merged on top client-side; this read
49
+ * exposes only the declaration.
50
+ *
51
+ * `badges` are the tool's plugin-DECLARED capability labels — purely INFORMATIONAL
52
+ * (e.g. `network`, `filesystem`), never a gate the server enforces. The overlay's
53
+ * own badges are merged on top client-side; this read exposes only the declaration.
54
+ */
55
+ export const toolTagEntry = z.object({
56
+ name: z.string(),
57
+ tags: z.array(z.string()),
58
+ badges: z.array(z.string()),
59
+ hidden: z.boolean(),
60
+ });
61
+ export const toolTags = z.array(toolTagEntry);
62
+ export type ToolTagEntry = z.infer<typeof toolTagEntry>;
@@ -0,0 +1,55 @@
1
+ /** Trigger-link record and lifecycle response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ import { triggerAuth } from './hooks';
5
+
6
+ // A trigger link is a minted, token-bearing PUBLIC URL (`GET|POST /trigger/{token}`)
7
+ // that resolves to a hook TOPIC and fires it. Studio mints, lists, and revokes them
8
+ // on the hooks page; the QR encodes the composed absolute URL.
9
+
10
+ /**
11
+ * `POST /api/hooks/trigger-links` — a freshly minted trigger link. `trigger_path`
12
+ * is a relative path (`/trigger/<token>`, never an absolute URL — Studio composes
13
+ * the API origin); `token` is the raw token returned exactly ONCE, in this response
14
+ * (nothing else stores or lists it — a listed link's QR is unrecoverable by
15
+ * design). `expires_at` is an ISO-8601 instant, or `null` for a permanent link.
16
+ */
17
+ export const triggerLinkCreated = z.object({
18
+ name: z.string(),
19
+ trigger_path: z.string(),
20
+ token: z.string(),
21
+ topic: z.string(),
22
+ expires_at: z.string().nullable(),
23
+ });
24
+ export type TriggerLinkCreated = z.infer<typeof triggerLinkCreated>;
25
+
26
+ /**
27
+ * One listed trigger-link record (`GET /api/hooks/trigger-links` item). `tool_kwargs`
28
+ * is the per-link params merged last into every fire (`null` or `{}` = none);
29
+ * `created_by` is the ambient creator identity (`null` on an identity-less,
30
+ * gate-off deployment); `token_hash_prefix` is a short hash prefix for log
31
+ * correlation — never a raw token (none is stored).
32
+ */
33
+ export const triggerLinkRecord = z.object({
34
+ name: z.string(),
35
+ topic: z.string(),
36
+ execution_key: z.string().min(1),
37
+ trigger_auth: triggerAuth,
38
+ tool_kwargs: z.record(z.string(), z.unknown()).nullable(),
39
+ created_by: z.string().nullable(),
40
+ created_at: z.string(),
41
+ expires_at: z.string().nullable(),
42
+ token_hash_prefix: z.string(),
43
+ });
44
+ export type TriggerLinkRecord = z.infer<typeof triggerLinkRecord>;
45
+
46
+ /** `GET /api/hooks/trigger-links` — every live trigger-link record. */
47
+ export const triggerLinkList = z.object({
48
+ items: z.array(triggerLinkRecord),
49
+ total: z.number(),
50
+ });
51
+ export type TriggerLinkList = z.infer<typeof triggerLinkList>;
52
+
53
+ /** `DELETE /api/hooks/trigger-links/{name}` — the revoked link. */
54
+ export const triggerLinkDeleted = z.object({ removed: z.boolean(), name: z.string() });
55
+ export type TriggerLinkDeleted = z.infer<typeof triggerLinkDeleted>;
@@ -0,0 +1,46 @@
1
+ /** Web-channel entry-gate code response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ // The web channel's entry gate: a web route can be gated so its chat page is
5
+ // served only to a navigation carrying a live entry code. These four doors are
6
+ // keyed by the route's `our_identity`. A raw code exists only in flight (the
7
+ // mint reply); a listed code carries its hash id, never a raw value (none is
8
+ // stored).
9
+
10
+ /** One minted entry code as the gate read door lists it — its hash id, its
11
+ * optional label, and when it was created / dies. Never a raw code. */
12
+ export const webEntryCode = z.object({
13
+ code_id: z.string(),
14
+ label: z.string().nullable(),
15
+ created_at: z.string(),
16
+ expires_at: z.string().nullable(),
17
+ });
18
+ export type WebEntryCode = z.infer<typeof webEntryCode>;
19
+
20
+ /** `GET /api/channels/web/gates/{identity}` — the gate flag and its live codes. */
21
+ export const webEntryGate = z.object({
22
+ enabled: z.boolean(),
23
+ codes: z.array(webEntryCode),
24
+ });
25
+ export type WebEntryGate = z.infer<typeof webEntryGate>;
26
+
27
+ /** `PUT /api/channels/web/gates/{identity}` — the gate flag after the write. */
28
+ export const webEntryGateState = z.object({ enabled: z.boolean() });
29
+ export type WebEntryGateState = z.infer<typeof webEntryGateState>;
30
+
31
+ /**
32
+ * `POST /api/channels/web/gates/{identity}/codes` — a freshly minted code. The
33
+ * raw `code` rides this reply ONCE (nothing else stores or lists it — a listed
34
+ * code's raw value is unrecoverable by design); `code_id` is its hash id and
35
+ * `expires_at` an ISO-8601 instant, or `null` for a code that never expires.
36
+ */
37
+ export const webEntryCodeMinted = z.object({
38
+ code: z.string(),
39
+ code_id: z.string(),
40
+ expires_at: z.string().nullable(),
41
+ });
42
+ export type WebEntryCodeMinted = z.infer<typeof webEntryCodeMinted>;
43
+
44
+ /** `DELETE /api/channels/web/gates/{identity}/codes/{code_id}` — the revoked code. */
45
+ export const webEntryCodeRevoked = z.object({ status: z.literal('revoked') });
46
+ export type WebEntryCodeRevoked = z.infer<typeof webEntryCodeRevoked>;
package/src/tool-runs.ts CHANGED
@@ -14,8 +14,8 @@
14
14
  */
15
15
  import { z } from 'zod';
16
16
 
17
- import { apiRequest, encodeSegment } from './http';
18
17
  import type { ApiConfig } from './http';
18
+ import { apiRequest, encodeSegment } from './http';
19
19
 
20
20
  /** A run's lifecycle state. `lost` = the server restarted mid-run; the result is
21
21
  * unrecoverable. `running` is the only non-terminal state. */