@tai42/api-client 16.0.0 → 16.0.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 (370) hide show
  1. package/dist/client/agents-client.d.ts +26 -0
  2. package/dist/client/agents-client.d.ts.map +1 -0
  3. package/dist/client/agents-client.js +19 -0
  4. package/dist/client/agents-client.js.map +1 -0
  5. package/dist/client/auth-client.d.ts +205 -0
  6. package/dist/client/auth-client.d.ts.map +1 -0
  7. package/dist/client/auth-client.js +59 -0
  8. package/dist/client/auth-client.js.map +1 -0
  9. package/dist/client/backend-client.d.ts +39 -0
  10. package/dist/client/backend-client.d.ts.map +1 -0
  11. package/dist/client/backend-client.js +22 -0
  12. package/dist/client/backend-client.js.map +1 -0
  13. package/dist/client/backup-client.d.ts +56 -0
  14. package/dist/client/backup-client.d.ts.map +1 -0
  15. package/dist/client/backup-client.js +12 -0
  16. package/dist/client/backup-client.js.map +1 -0
  17. package/dist/client/capabilities-client.d.ts +35 -0
  18. package/dist/client/capabilities-client.d.ts.map +1 -0
  19. package/dist/client/capabilities-client.js +19 -0
  20. package/dist/client/capabilities-client.js.map +1 -0
  21. package/dist/client/channels-client.d.ts +7 -0
  22. package/dist/client/channels-client.d.ts.map +1 -0
  23. package/dist/client/channels-client.js +10 -0
  24. package/dist/client/channels-client.js.map +1 -0
  25. package/dist/client/config-client.d.ts +59 -0
  26. package/dist/client/config-client.d.ts.map +1 -0
  27. package/dist/client/config-client.js +18 -0
  28. package/dist/client/config-client.js.map +1 -0
  29. package/dist/client/connectors-client.d.ts +225 -0
  30. package/dist/client/connectors-client.d.ts.map +1 -0
  31. package/dist/client/connectors-client.js +31 -0
  32. package/dist/client/connectors-client.js.map +1 -0
  33. package/dist/client/conversations-client.d.ts +399 -0
  34. package/dist/client/conversations-client.d.ts.map +1 -0
  35. package/dist/client/conversations-client.js +120 -0
  36. package/dist/client/conversations-client.js.map +1 -0
  37. package/dist/client/hooks-client.d.ts +113 -0
  38. package/dist/client/hooks-client.d.ts.map +1 -0
  39. package/dist/client/hooks-client.js +25 -0
  40. package/dist/client/hooks-client.js.map +1 -0
  41. package/dist/{client.d.ts → client/index.d.ts} +2235 -2666
  42. package/dist/client/index.d.ts.map +1 -0
  43. package/dist/client/index.js +79 -0
  44. package/dist/client/index.js.map +1 -0
  45. package/dist/client/interactions-client.d.ts +52 -0
  46. package/dist/client/interactions-client.d.ts.map +1 -0
  47. package/dist/client/interactions-client.js +84 -0
  48. package/dist/client/interactions-client.js.map +1 -0
  49. package/dist/client/login-client.d.ts +56 -0
  50. package/dist/client/login-client.d.ts.map +1 -0
  51. package/dist/client/login-client.js +103 -0
  52. package/dist/client/login-client.js.map +1 -0
  53. package/dist/client/manifest-client.d.ts +354 -0
  54. package/dist/client/manifest-client.d.ts.map +1 -0
  55. package/dist/client/manifest-client.js +76 -0
  56. package/dist/client/manifest-client.js.map +1 -0
  57. package/dist/client/marketplace-client.d.ts +274 -0
  58. package/dist/client/marketplace-client.d.ts.map +1 -0
  59. package/dist/client/marketplace-client.js +46 -0
  60. package/dist/client/marketplace-client.js.map +1 -0
  61. package/dist/client/mcp-config-schema-client.d.ts +5 -0
  62. package/dist/client/mcp-config-schema-client.d.ts.map +1 -0
  63. package/dist/client/mcp-config-schema-client.js +9 -0
  64. package/dist/client/mcp-config-schema-client.js.map +1 -0
  65. package/dist/client/notifications-client.d.ts +27 -0
  66. package/dist/client/notifications-client.d.ts.map +1 -0
  67. package/dist/client/notifications-client.js +11 -0
  68. package/dist/client/notifications-client.js.map +1 -0
  69. package/dist/client/observability-client.d.ts +103 -0
  70. package/dist/client/observability-client.d.ts.map +1 -0
  71. package/dist/client/observability-client.js +43 -0
  72. package/dist/client/observability-client.js.map +1 -0
  73. package/dist/client/plugins-client.d.ts +17 -0
  74. package/dist/client/plugins-client.d.ts.map +1 -0
  75. package/dist/client/plugins-client.js +9 -0
  76. package/dist/client/plugins-client.js.map +1 -0
  77. package/dist/client/policy-client.d.ts +37 -0
  78. package/dist/client/policy-client.d.ts.map +1 -0
  79. package/dist/client/policy-client.js +26 -0
  80. package/dist/client/policy-client.js.map +1 -0
  81. package/dist/client/presets-client.d.ts +335 -0
  82. package/dist/client/presets-client.d.ts.map +1 -0
  83. package/dist/client/presets-client.js +38 -0
  84. package/dist/client/presets-client.js.map +1 -0
  85. package/dist/client/profiles-client.d.ts +102 -0
  86. package/dist/client/profiles-client.d.ts.map +1 -0
  87. package/dist/client/profiles-client.js +37 -0
  88. package/dist/client/profiles-client.js.map +1 -0
  89. package/dist/client/schedules-client.d.ts +28 -0
  90. package/dist/client/schedules-client.d.ts.map +1 -0
  91. package/dist/client/schedules-client.js +13 -0
  92. package/dist/client/schedules-client.js.map +1 -0
  93. package/dist/client/settings-schema-client.d.ts +23 -0
  94. package/dist/client/settings-schema-client.d.ts.map +1 -0
  95. package/dist/client/settings-schema-client.js +9 -0
  96. package/dist/client/settings-schema-client.js.map +1 -0
  97. package/dist/client/states-client.d.ts +471 -0
  98. package/dist/client/states-client.d.ts.map +1 -0
  99. package/dist/client/states-client.js +144 -0
  100. package/dist/client/states-client.js.map +1 -0
  101. package/dist/client/storage-client.d.ts +40 -0
  102. package/dist/client/storage-client.d.ts.map +1 -0
  103. package/dist/client/storage-client.js +43 -0
  104. package/dist/client/storage-client.js.map +1 -0
  105. package/dist/client/sub-mcp-client.d.ts +17 -0
  106. package/dist/client/sub-mcp-client.d.ts.map +1 -0
  107. package/dist/client/sub-mcp-client.js +14 -0
  108. package/dist/client/sub-mcp-client.js.map +1 -0
  109. package/dist/client/system-client.d.ts +11 -0
  110. package/dist/client/system-client.d.ts.map +1 -0
  111. package/dist/client/system-client.js +13 -0
  112. package/dist/client/system-client.js.map +1 -0
  113. package/dist/client/templates-client.d.ts +29 -0
  114. package/dist/client/templates-client.d.ts.map +1 -0
  115. package/dist/client/templates-client.js +21 -0
  116. package/dist/client/templates-client.js.map +1 -0
  117. package/dist/client/tool-extensions-client.d.ts +54 -0
  118. package/dist/client/tool-extensions-client.d.ts.map +1 -0
  119. package/dist/client/tool-extensions-client.js +21 -0
  120. package/dist/client/tool-extensions-client.js.map +1 -0
  121. package/dist/client/tool-meta-client.d.ts +69 -0
  122. package/dist/client/tool-meta-client.d.ts.map +1 -0
  123. package/dist/client/tool-meta-client.js +38 -0
  124. package/dist/client/tool-meta-client.js.map +1 -0
  125. package/dist/client/tools-client.d.ts +83 -0
  126. package/dist/client/tools-client.d.ts.map +1 -0
  127. package/dist/client/tools-client.js +38 -0
  128. package/dist/client/tools-client.js.map +1 -0
  129. package/dist/client/transport.d.ts +13 -0
  130. package/dist/client/transport.d.ts.map +1 -0
  131. package/dist/client/transport.js +10 -0
  132. package/dist/client/transport.js.map +1 -0
  133. package/dist/client/trigger-links-client.d.ts +44 -0
  134. package/dist/client/trigger-links-client.d.ts.map +1 -0
  135. package/dist/client/trigger-links-client.js +30 -0
  136. package/dist/client/trigger-links-client.js.map +1 -0
  137. package/dist/client/web-entry-gate-client.d.ts +34 -0
  138. package/dist/client/web-entry-gate-client.d.ts.map +1 -0
  139. package/dist/client/web-entry-gate-client.js +25 -0
  140. package/dist/client/web-entry-gate-client.js.map +1 -0
  141. package/dist/http.d.ts.map +1 -1
  142. package/dist/http.js +33 -17
  143. package/dist/http.js.map +1 -1
  144. package/dist/schemas/api-keys.d.ts +34 -0
  145. package/dist/schemas/api-keys.d.ts.map +1 -0
  146. package/dist/schemas/api-keys.js +22 -0
  147. package/dist/schemas/api-keys.js.map +1 -0
  148. package/dist/schemas/auth-routes.d.ts +78 -0
  149. package/dist/schemas/auth-routes.d.ts.map +1 -0
  150. package/dist/schemas/auth-routes.js +42 -0
  151. package/dist/schemas/auth-routes.js.map +1 -0
  152. package/dist/schemas/backup.d.ts +78 -0
  153. package/dist/schemas/backup.d.ts.map +1 -0
  154. package/dist/schemas/backup.js +33 -0
  155. package/dist/schemas/backup.js.map +1 -0
  156. package/dist/schemas/capabilities.d.ts +99 -0
  157. package/dist/schemas/capabilities.d.ts.map +1 -0
  158. package/dist/schemas/capabilities.js +74 -0
  159. package/dist/schemas/capabilities.js.map +1 -0
  160. package/dist/schemas/channels.d.ts +7 -0
  161. package/dist/schemas/channels.d.ts.map +1 -0
  162. package/dist/schemas/channels.js +9 -0
  163. package/dist/schemas/channels.js.map +1 -0
  164. package/dist/schemas/config.d.ts +17 -0
  165. package/dist/schemas/config.d.ts.map +1 -0
  166. package/dist/schemas/config.js +17 -0
  167. package/dist/schemas/config.js.map +1 -0
  168. package/dist/schemas/connectors.d.ts +383 -0
  169. package/dist/schemas/connectors.d.ts.map +1 -0
  170. package/dist/schemas/connectors.js +122 -0
  171. package/dist/schemas/connectors.js.map +1 -0
  172. package/dist/schemas/conversations.d.ts +600 -0
  173. package/dist/schemas/conversations.d.ts.map +1 -0
  174. package/dist/schemas/conversations.js +208 -0
  175. package/dist/schemas/conversations.js.map +1 -0
  176. package/dist/schemas/extensions.d.ts +44 -0
  177. package/dist/schemas/extensions.d.ts.map +1 -0
  178. package/dist/schemas/extensions.js +29 -0
  179. package/dist/schemas/extensions.js.map +1 -0
  180. package/dist/schemas/fleet.d.ts +271 -0
  181. package/dist/schemas/fleet.d.ts.map +1 -0
  182. package/dist/schemas/fleet.js +132 -0
  183. package/dist/schemas/fleet.js.map +1 -0
  184. package/dist/schemas/hooks.d.ts +120 -0
  185. package/dist/schemas/hooks.d.ts.map +1 -0
  186. package/dist/schemas/hooks.js +44 -0
  187. package/dist/schemas/hooks.js.map +1 -0
  188. package/dist/schemas/index.d.ts +38 -0
  189. package/dist/schemas/index.d.ts.map +1 -0
  190. package/dist/schemas/index.js +38 -0
  191. package/dist/schemas/index.js.map +1 -0
  192. package/dist/schemas/interactions.d.ts +156 -0
  193. package/dist/schemas/interactions.d.ts.map +1 -0
  194. package/dist/schemas/interactions.js +124 -0
  195. package/dist/schemas/interactions.js.map +1 -0
  196. package/dist/schemas/login.d.ts +86 -0
  197. package/dist/schemas/login.d.ts.map +1 -0
  198. package/dist/schemas/login.js +54 -0
  199. package/dist/schemas/login.js.map +1 -0
  200. package/dist/schemas/manifest-mcp.d.ts +125 -0
  201. package/dist/schemas/manifest-mcp.d.ts.map +1 -0
  202. package/dist/schemas/manifest-mcp.js +61 -0
  203. package/dist/schemas/manifest-mcp.js.map +1 -0
  204. package/dist/schemas/marketplace.d.ts +708 -0
  205. package/dist/schemas/marketplace.d.ts.map +1 -0
  206. package/dist/schemas/marketplace.js +387 -0
  207. package/dist/schemas/marketplace.js.map +1 -0
  208. package/dist/schemas/notifications.d.ts +61 -0
  209. package/dist/schemas/notifications.d.ts.map +1 -0
  210. package/dist/schemas/notifications.js +38 -0
  211. package/dist/schemas/notifications.js.map +1 -0
  212. package/dist/schemas/observability.d.ts +114 -0
  213. package/dist/schemas/observability.d.ts.map +1 -0
  214. package/dist/schemas/observability.js +74 -0
  215. package/dist/schemas/observability.js.map +1 -0
  216. package/dist/schemas/policy.d.ts +58 -0
  217. package/dist/schemas/policy.d.ts.map +1 -0
  218. package/dist/schemas/policy.js +32 -0
  219. package/dist/schemas/policy.js.map +1 -0
  220. package/dist/schemas/presets.d.ts +258 -0
  221. package/dist/schemas/presets.d.ts.map +1 -0
  222. package/dist/schemas/presets.js +95 -0
  223. package/dist/schemas/presets.js.map +1 -0
  224. package/dist/schemas/profiles.d.ts +180 -0
  225. package/dist/schemas/profiles.d.ts.map +1 -0
  226. package/dist/schemas/profiles.js +100 -0
  227. package/dist/schemas/profiles.js.map +1 -0
  228. package/dist/schemas/roles.d.ts +125 -0
  229. package/dist/schemas/roles.d.ts.map +1 -0
  230. package/dist/schemas/roles.js +46 -0
  231. package/dist/schemas/roles.js.map +1 -0
  232. package/dist/schemas/schedules.d.ts +25 -0
  233. package/dist/schemas/schedules.d.ts.map +1 -0
  234. package/dist/schemas/schedules.js +24 -0
  235. package/dist/schemas/schedules.js.map +1 -0
  236. package/dist/schemas/served.d.ts +626 -0
  237. package/dist/schemas/served.d.ts.map +1 -0
  238. package/dist/schemas/served.js +28 -0
  239. package/dist/schemas/served.js.map +1 -0
  240. package/dist/schemas/settings-schema.d.ts +23 -0
  241. package/dist/schemas/settings-schema.d.ts.map +1 -0
  242. package/dist/schemas/settings-schema.js +25 -0
  243. package/dist/schemas/settings-schema.js.map +1 -0
  244. package/dist/schemas/shared.d.ts +20 -0
  245. package/dist/schemas/shared.d.ts.map +1 -0
  246. package/dist/schemas/shared.js +20 -0
  247. package/dist/schemas/shared.js.map +1 -0
  248. package/dist/schemas/states.d.ts +499 -0
  249. package/dist/schemas/states.d.ts.map +1 -0
  250. package/dist/schemas/states.js +220 -0
  251. package/dist/schemas/states.js.map +1 -0
  252. package/dist/schemas/storage.d.ts +37 -0
  253. package/dist/schemas/storage.d.ts.map +1 -0
  254. package/dist/schemas/storage.js +24 -0
  255. package/dist/schemas/storage.js.map +1 -0
  256. package/dist/schemas/studio-plugins.d.ts +30 -0
  257. package/dist/schemas/studio-plugins.d.ts.map +1 -0
  258. package/dist/schemas/studio-plugins.js +20 -0
  259. package/dist/schemas/studio-plugins.js.map +1 -0
  260. package/dist/schemas/sub-mcp.d.ts +29 -0
  261. package/dist/schemas/sub-mcp.d.ts.map +1 -0
  262. package/dist/schemas/sub-mcp.js +22 -0
  263. package/dist/schemas/sub-mcp.js.map +1 -0
  264. package/dist/schemas/system-kinds.d.ts +122 -0
  265. package/dist/schemas/system-kinds.d.ts.map +1 -0
  266. package/dist/schemas/system-kinds.js +40 -0
  267. package/dist/schemas/system-kinds.js.map +1 -0
  268. package/dist/schemas/templates.d.ts +26 -0
  269. package/dist/schemas/templates.d.ts.map +1 -0
  270. package/dist/schemas/templates.js +11 -0
  271. package/dist/schemas/templates.js.map +1 -0
  272. package/dist/schemas/tool-meta.d.ts +64 -0
  273. package/dist/schemas/tool-meta.d.ts.map +1 -0
  274. package/dist/schemas/tool-meta.js +44 -0
  275. package/dist/schemas/tool-meta.js.map +1 -0
  276. package/dist/schemas/tools.d.ts +62 -0
  277. package/dist/schemas/tools.d.ts.map +1 -0
  278. package/dist/schemas/tools.js +53 -0
  279. package/dist/schemas/tools.js.map +1 -0
  280. package/dist/schemas/trigger-links.d.ts +71 -0
  281. package/dist/schemas/trigger-links.d.ts.map +1 -0
  282. package/dist/schemas/trigger-links.js +46 -0
  283. package/dist/schemas/trigger-links.js.map +1 -0
  284. package/dist/schemas/web-entry.d.ts +45 -0
  285. package/dist/schemas/web-entry.d.ts.map +1 -0
  286. package/dist/schemas/web-entry.js +36 -0
  287. package/dist/schemas/web-entry.js.map +1 -0
  288. package/dist/tool-runs.d.ts +4 -4
  289. package/package.json +1 -1
  290. package/src/client/agents-client.ts +23 -0
  291. package/src/client/auth-client.ts +144 -0
  292. package/src/client/backend-client.ts +25 -0
  293. package/src/client/backup-client.ts +16 -0
  294. package/src/client/capabilities-client.ts +22 -0
  295. package/src/client/channels-client.ts +11 -0
  296. package/src/client/config-client.ts +21 -0
  297. package/src/client/connectors-client.ts +52 -0
  298. package/src/client/conversations-client.ts +240 -0
  299. package/src/client/hooks-client.ts +44 -0
  300. package/src/client/index.ts +122 -0
  301. package/src/client/interactions-client.ts +89 -0
  302. package/src/client/login-client.ts +109 -0
  303. package/src/client/manifest-client.ts +118 -0
  304. package/src/client/marketplace-client.ts +122 -0
  305. package/src/client/mcp-config-schema-client.ts +11 -0
  306. package/src/client/notifications-client.ts +13 -0
  307. package/src/client/observability-client.ts +82 -0
  308. package/src/client/plugins-client.ts +11 -0
  309. package/src/client/policy-client.ts +41 -0
  310. package/src/client/presets-client.ts +124 -0
  311. package/src/client/profiles-client.ts +51 -0
  312. package/src/client/schedules-client.ts +22 -0
  313. package/src/client/settings-schema-client.ts +11 -0
  314. package/src/client/states-client.ts +292 -0
  315. package/src/client/storage-client.ts +63 -0
  316. package/src/client/sub-mcp-client.ts +17 -0
  317. package/src/client/system-client.ts +16 -0
  318. package/src/client/templates-client.ts +28 -0
  319. package/src/client/tool-extensions-client.ts +24 -0
  320. package/src/client/tool-meta-client.ts +65 -0
  321. package/src/client/tools-client.ts +66 -0
  322. package/src/client/transport.ts +18 -0
  323. package/src/client/trigger-links-client.ts +51 -0
  324. package/src/client/web-entry-gate-client.ts +45 -0
  325. package/src/http.ts +48 -24
  326. package/src/schemas/api-keys.ts +26 -0
  327. package/src/schemas/auth-routes.ts +48 -0
  328. package/src/schemas/backup.ts +42 -0
  329. package/src/schemas/capabilities.ts +87 -0
  330. package/src/schemas/channels.ts +11 -0
  331. package/src/schemas/config.ts +17 -0
  332. package/src/schemas/connectors.ts +138 -0
  333. package/src/schemas/conversations.ts +256 -0
  334. package/src/schemas/extensions.ts +34 -0
  335. package/src/schemas/fleet.ts +153 -0
  336. package/src/schemas/hooks.ts +56 -0
  337. package/src/schemas/index.ts +37 -0
  338. package/src/schemas/interactions.ts +146 -0
  339. package/src/schemas/login.ts +62 -0
  340. package/src/schemas/manifest-mcp.ts +69 -0
  341. package/src/schemas/marketplace.ts +447 -0
  342. package/src/schemas/notifications.ts +42 -0
  343. package/src/schemas/observability.ts +86 -0
  344. package/src/schemas/policy.ts +37 -0
  345. package/src/schemas/presets.ts +113 -0
  346. package/src/schemas/profiles.ts +119 -0
  347. package/src/schemas/roles.ts +57 -0
  348. package/src/schemas/schedules.ts +27 -0
  349. package/src/schemas/served.ts +49 -0
  350. package/src/schemas/settings-schema.ts +31 -0
  351. package/src/schemas/shared.ts +21 -0
  352. package/src/schemas/states.ts +272 -0
  353. package/src/schemas/storage.ts +31 -0
  354. package/src/schemas/studio-plugins.ts +21 -0
  355. package/src/schemas/sub-mcp.ts +24 -0
  356. package/src/schemas/system-kinds.ts +46 -0
  357. package/src/schemas/templates.ts +11 -0
  358. package/src/schemas/tool-meta.ts +51 -0
  359. package/src/schemas/tools.ts +61 -0
  360. package/src/schemas/trigger-links.ts +54 -0
  361. package/src/schemas/web-entry.ts +46 -0
  362. package/dist/client.d.ts.map +0 -1
  363. package/dist/client.js +0 -920
  364. package/dist/client.js.map +0 -1
  365. package/dist/schemas.d.ts +0 -5172
  366. package/dist/schemas.d.ts.map +0 -1
  367. package/dist/schemas.js +0 -2268
  368. package/dist/schemas.js.map +0 -1
  369. package/src/client.ts +0 -1771
  370. package/src/schemas.ts +0 -2760
@@ -0,0 +1,138 @@
1
+ /** Connector provider catalog and connection lifecycle schemas. */
2
+ import { z } from 'zod';
3
+ import { fleetReportFanout } from './fleet';
4
+
5
+ export const subServiceView = z.object({
6
+ id: z.string(),
7
+ display_name: z.string(),
8
+ description: z.string(),
9
+ scopes: z.array(z.string()),
10
+ });
11
+
12
+ export const configFieldView = z.object({
13
+ key: z.string(),
14
+ label: z.string(),
15
+ target: z.enum(['env', 'header']),
16
+ required: z.boolean(),
17
+ secret: z.boolean(),
18
+ });
19
+
20
+ export const providerView = z.object({
21
+ id: z.string(),
22
+ display_name: z.string(),
23
+ description: z.string(),
24
+ // Required and a real URL: the contract's `ProviderDescriptor.icon_url` runs
25
+ // `check_web_url(schemes=("https",))`, which rejects an empty/relative value, so
26
+ // an empty or malformed one here is drift and fails the parse loudly.
27
+ icon_url: z.url(),
28
+ kind: z.enum(['oauth', 'none']),
29
+ origin: z.enum(['system', 'community']),
30
+ category: z.string(),
31
+ sub_services: z.array(subServiceView),
32
+ config_fields: z.array(configFieldView),
33
+ });
34
+ export type ProviderView = z.infer<typeof providerView>;
35
+
36
+ /**
37
+ * One `connector_category` grouping row served alongside the catalog: the UI's
38
+ * label and sort key for the providers it groups, so the list can group, order,
39
+ * and label providers by category without a second read.
40
+ */
41
+ export const connectorCategoryView = z.object({
42
+ id: z.string(),
43
+ display_name: z.string(),
44
+ sort_order: z.number(),
45
+ });
46
+ export type ConnectorCategoryView = z.infer<typeof connectorCategoryView>;
47
+
48
+ /**
49
+ * `GET /api/connectors/providers` — the provider catalog: the providers plus the
50
+ * category groupings the UI arranges them under. Reshaped from a bare provider
51
+ * array so the category label/order surface rides the same read.
52
+ */
53
+ export const providers = z.object({
54
+ providers: z.array(providerView),
55
+ categories: z.array(connectorCategoryView),
56
+ });
57
+ export type ProviderCatalogResponse = z.infer<typeof providers>;
58
+
59
+ export const connectionView = z.object({
60
+ connection_id: z.string(),
61
+ provider_id: z.string(),
62
+ alias: z.string(),
63
+ kind: z.enum(['oauth', 'none']),
64
+ account_identity: z.string().nullable(),
65
+ enabled_sub_services: z.array(z.string()),
66
+ granted_scopes: z.array(z.string()),
67
+ // Sub-services whose MCP server did not answer a live reachability probe.
68
+ // Populated only on the single-connection GET (the list projection is
69
+ // probe-free and always sends `[]`). Reachability is distinct from
70
+ // `auth_health_state`: a healthy connection can still have a down sub-service.
71
+ // Defaulted so a projection that omits it (an older worker mid-rollout) still
72
+ // parses rather than false-failing the whole view.
73
+ unreachable_sub_services: z.array(z.string()).default([]),
74
+ auth_health_state: z.enum(['healthy', 'reconnect_required', 'refresh_failing']),
75
+ created_at: z.string(),
76
+ });
77
+ export type ConnectionView = z.infer<typeof connectionView>;
78
+
79
+ export const connectionsList = z.object({
80
+ items: z.array(connectionView),
81
+ total: z.number(),
82
+ // Count of connections whose `auth_health_state` is not healthy across the whole
83
+ // set (independent of any filter/limit) — the attention-badge count. Optional:
84
+ // no UI consumes it, and an older worker mid-rollout omits it.
85
+ unhealthy: z.number().optional(),
86
+ });
87
+
88
+ // A connector mutation that writes the manifest embeds the mode-wrapped fleet
89
+ // `fanout` of the reload it broadcast; it is `null` when the response path mutated no
90
+ // manifest (an OAuth START opens a flow before any write). Parsed EXPLICITLY so the
91
+ // shared fleet-report handler surfaces a failed propagation on every connector flow —
92
+ // zod's unknown-key stripping would otherwise drop it silently.
93
+ export const startConnectResult = z.union([
94
+ z.object({ flow_id: z.string(), authorize_url: z.string() }),
95
+ z.object({
96
+ connection_id: z.string(),
97
+ added_manifest_entries: z.array(z.string()),
98
+ fanout: fleetReportFanout.nullable(),
99
+ }),
100
+ ]);
101
+
102
+ // A reconnect START opens an OAuth flow and writes no manifest, so it carries no
103
+ // fan-out (the manifest write lands when the flow completes).
104
+ export const reconnectResult = z.object({ flow_id: z.string(), authorize_url: z.string() });
105
+
106
+ export const disconnectResult = z.object({
107
+ connection_id: z.string(),
108
+ upstream_revoke_outcome: z.enum(['success', 'failed', 'skipped']),
109
+ upstream_revoke_status: z.number().nullable(),
110
+ removed_manifest_entries: z.array(z.string()),
111
+ fanout: fleetReportFanout.nullable(),
112
+ });
113
+
114
+ export const patchSubServicesResult = z.object({
115
+ connection_id: z.string(),
116
+ enabled_sub_services: z.array(z.string()),
117
+ consent_required: z.boolean(),
118
+ flow_id: z.string().nullable(),
119
+ authorize_url: z.string().nullable(),
120
+ added_manifest_entries: z.array(z.string()),
121
+ removed_manifest_entries: z.array(z.string()),
122
+ // `null` on a consent-only toggle that forks an OAuth flow without a manifest write.
123
+ fanout: fleetReportFanout.nullable(),
124
+ });
125
+
126
+ export const oauthCompleteResult = z.discriminatedUnion('kind', [
127
+ z.object({
128
+ kind: z.literal('success'),
129
+ connection_id: z.string(),
130
+ return_url: z.string(),
131
+ // `null` when completing the flow mutated no manifest (a reconcile that changed
132
+ // nothing).
133
+ fanout: fleetReportFanout.nullable(),
134
+ }),
135
+ z.object({ kind: z.literal('failed'), reason: z.string() }),
136
+ z.object({ kind: z.literal('cancelled'), message: z.string() }),
137
+ ]);
138
+ export type OAuthCompleteResult = z.infer<typeof oauthCompleteResult>;
@@ -0,0 +1,256 @@
1
+ /** Conversation route, thread, transcript and config schemas. */
2
+ import { z } from 'zod';
3
+ import { conversationRoute, targetConversationConfig } from './served';
4
+ import { pageWindow } from './shared';
5
+
6
+ // The cross-channel conversation monitor's READ side: the stored routing rows
7
+ // (the route picker) from `GET /api/conversations`, a route's threads from
8
+ // `GET /api/conversations/{route}/threads`, and one thread's transcript from
9
+ // `GET /api/conversations/{route}/transcript?thread_id=`. Timestamps are float
10
+ // epoch seconds, not ISO strings, and both paged doors carry the same window
11
+ // fields; the transcript adds the direction it was read in.
12
+
13
+ /** The inbound door a route is bound to: the authed API, or a channel medium. */
14
+ export const conversationDoor = z.enum(['api', 'channel']);
15
+ export type ConversationDoor = z.infer<typeof conversationDoor>;
16
+
17
+ /** What a route's turn runs: a registered agent, or a tool dispatch. */
18
+ export const conversationTargetKind = z.enum(['agent', 'tool']);
19
+ export type ConversationTargetKind = z.infer<typeof conversationTargetKind>;
20
+
21
+ /**
22
+ * A route's default control mode (`initial_mode`) when a thread carries no
23
+ * per-thread override: `agent` runs the target turn, `manual` suppresses it for an
24
+ * operator to answer. The same value vocabulary as a per-thread mode override, but
25
+ * a distinct concept (the route default vs. one thread's override).
26
+ */
27
+ export const conversationMode = z.enum(['agent', 'manual']);
28
+ export type ConversationMode = z.infer<typeof conversationMode>;
29
+
30
+ /**
31
+ * Where a record sits between intake and a terminal outcome. `failed` is the one
32
+ * the monitor surfaces loudly; `shed` and `silent` are terminal by design and
33
+ * never send.
34
+ */
35
+ export const conversationDeliveryStatus = z.enum([
36
+ 'accepted',
37
+ 'pending_delivery',
38
+ 'provisional',
39
+ 'delivered',
40
+ 'failed',
41
+ 'shed',
42
+ 'silent',
43
+ ]);
44
+ export type ConversationDeliveryStatus = z.infer<typeof conversationDeliveryStatus>;
45
+
46
+ /** The nature of a turn's outcome, orthogonal to where its delivery stands. */
47
+ export const conversationAnswerStatus = z.enum(['answered', 'error', 'silent']);
48
+ export type ConversationAnswerStatus = z.infer<typeof conversationAnswerStatus>;
49
+
50
+ /**
51
+ * Who authored a record's outgoing side. `client` is the ordinary turn the flow
52
+ * answered; `operator` is a message a human sent into the thread, whose text
53
+ * rides `answer` (its `inbound_text` is empty).
54
+ */
55
+ export const conversationRecordOrigin = z.enum(['client', 'operator']);
56
+ export type ConversationRecordOrigin = z.infer<typeof conversationRecordOrigin>;
57
+
58
+ export const conversationRoutes = z.object({
59
+ items: z.array(conversationRoute),
60
+ total: z.number(),
61
+ });
62
+ export type ConversationRoutes = z.infer<typeof conversationRoutes>;
63
+
64
+ /**
65
+ * The create/replace reply: whether THIS call created the row (vs. replaced an
66
+ * existing one), the row itself (its `callback_secret` withheld), and the
67
+ * `callback_secret` returned ONCE for an `api`-door row (`null` for a `channel`
68
+ * row). The secret signs delivery callbacks and is never re-read from any door, so
69
+ * a caller that needs it must capture it from this reply.
70
+ */
71
+ export const conversationRouteWritten = z.object({
72
+ created: z.boolean(),
73
+ route_name: z.string(),
74
+ route: conversationRoute,
75
+ callback_secret: z.string().nullable(),
76
+ });
77
+ export type ConversationRouteWritten = z.infer<typeof conversationRouteWritten>;
78
+
79
+ /**
80
+ * The delete reply: `removed` says whether THIS call removed the routing row (a
81
+ * retryable reclamation of orphaned thread indexes answers `false` rather than a
82
+ * 404).
83
+ */
84
+ export const conversationRouteDeleted = z.object({
85
+ removed: z.boolean(),
86
+ route_name: z.string(),
87
+ });
88
+ export type ConversationRouteDeleted = z.infer<typeof conversationRouteDeleted>;
89
+
90
+ /**
91
+ * One thread of a route, summarized from its newest record. A `thread_id` holds
92
+ * an api-door address (`{principal}/{end user}`, percent-encoded), so it never
93
+ * goes back into a URL as a path segment — the transcript door takes it as a
94
+ * query value.
95
+ */
96
+ export const conversationThread = z.object({
97
+ thread_id: z.string(),
98
+ client_address: z.string(),
99
+ last_activity_at: z.number(),
100
+ message_count: z.number(),
101
+ last_delivery_status: conversationDeliveryStatus,
102
+ });
103
+ export type ConversationThread = z.infer<typeof conversationThread>;
104
+
105
+ export const conversationThreadsPage = z.object({
106
+ items: z.array(conversationThread),
107
+ ...pageWindow,
108
+ });
109
+ export type ConversationThreadsPage = z.infer<typeof conversationThreadsPage>;
110
+
111
+ /**
112
+ * One exchange: the visitor's `inbound_text` — every record answers a message, so
113
+ * both projections always carry it — and the agent's `answer`, plus where that
114
+ * answer's delivery stands. The fields after `updated_at` are ADMIN ONLY —
115
+ * the same door serves a caller-scoped projection that withholds them — so they
116
+ * are optional here and absence means "not published to this reader".
117
+ */
118
+ export const conversationMessage = z.object({
119
+ message_id: z.string(),
120
+ route_name: z.string(),
121
+ door: conversationDoor,
122
+ thread_id: z.string(),
123
+ client_address: z.string(),
124
+ caller_principal: z.string().nullable(),
125
+ inbound_text: z.string(),
126
+ answer_status: conversationAnswerStatus.nullable(),
127
+ answer: z.string().nullable(),
128
+ origin: conversationRecordOrigin,
129
+ delivery_status: conversationDeliveryStatus,
130
+ created_at: z.number(),
131
+ updated_at: z.number(),
132
+ channel: z.string().nullable().optional(),
133
+ our_identity: z.string().nullable().optional(),
134
+ provider_message_id: z.string().nullable().optional(),
135
+ callback_url: z.string().nullable().optional(),
136
+ error: z.string().nullable().optional(),
137
+ outbound_message_ids: z.array(z.string()).optional(),
138
+ attempts: z.number().optional(),
139
+ });
140
+ export type ConversationMessage = z.infer<typeof conversationMessage>;
141
+
142
+ /**
143
+ * The direction a transcript page reads in. `asc` is the reading order (oldest
144
+ * first); `desc` is the live-tail order, where page 1 is always the newest page
145
+ * and paging forward walks BACKWARDS through the thread's history.
146
+ */
147
+ export const transcriptOrder = z.enum(['asc', 'desc']);
148
+ export type TranscriptOrder = z.infer<typeof transcriptOrder>;
149
+
150
+ /** A transcript page, echoing the order it was read in. */
151
+ export const conversationTranscriptPage = z.object({
152
+ items: z.array(conversationMessage),
153
+ ...pageWindow,
154
+ order: transcriptOrder,
155
+ });
156
+ export type ConversationTranscriptPage = z.infer<typeof conversationTranscriptPage>;
157
+
158
+ /**
159
+ * A route-scoped message search (`GET /api/conversations/{route}/messages/search?q`):
160
+ * every record on the route whose text matches `q`, across threads, newest first.
161
+ * The record shape is the transcript's exactly, so a hit renders with the same
162
+ * projection. `truncated` says the match set outran the door's scan cap — surfaced
163
+ * loudly, never a silent cut.
164
+ */
165
+ export const conversationMessageSearchPage = z.object({
166
+ items: z.array(conversationMessage),
167
+ ...pageWindow,
168
+ });
169
+ export type ConversationMessageSearchPage = z.infer<typeof conversationMessageSearchPage>;
170
+
171
+ /**
172
+ * Who answers a thread's incoming messages: `agent` lets the flow reply on its
173
+ * own; `manual` holds the flow back so a human answers. `source` says whether the
174
+ * setting is the thread's own (`thread`) or inherited from its route (`route`).
175
+ */
176
+ export const conversationThreadMode = z.enum(['agent', 'manual']);
177
+ export type ConversationThreadMode = z.infer<typeof conversationThreadMode>;
178
+
179
+ export const conversationThreadModeState = z.object({
180
+ mode: conversationThreadMode,
181
+ source: z.enum(['thread', 'route']),
182
+ });
183
+ export type ConversationThreadModeState = z.infer<typeof conversationThreadModeState>;
184
+
185
+ /** The receipt a thread-message write returns: the stored id and its thread. */
186
+ export const conversationThreadMessageSent = z.object({
187
+ message_id: z.string(),
188
+ thread_id: z.string(),
189
+ });
190
+ export type ConversationThreadMessageSent = z.infer<typeof conversationThreadMessageSent>;
191
+
192
+ /** Every stored per-target config (`GET /api/conversation-configs`). */
193
+ export const conversationConfigs = z.object({
194
+ items: z.array(targetConversationConfig),
195
+ total: z.number(),
196
+ });
197
+ export type ConversationConfigs = z.infer<typeof conversationConfigs>;
198
+
199
+ /**
200
+ * The upsert reply: whether THIS call created the config (vs. replaced an existing
201
+ * one), its key, and the stored row.
202
+ */
203
+ export const conversationConfigWritten = z.object({
204
+ created: z.boolean(),
205
+ target_kind: conversationTargetKind,
206
+ target_name: z.string(),
207
+ config: targetConversationConfig,
208
+ });
209
+ export type ConversationConfigWritten = z.infer<typeof conversationConfigWritten>;
210
+
211
+ /** The config-delete reply: `removed` is always `true` on success (an unknown key is a 404). */
212
+ export const conversationConfigDeleted = z.object({
213
+ removed: z.boolean(),
214
+ target_kind: conversationTargetKind,
215
+ target_name: z.string(),
216
+ });
217
+ export type ConversationConfigDeleted = z.infer<typeof conversationConfigDeleted>;
218
+
219
+ /**
220
+ * The admin-only failed-delivery listing (`GET /api/conversations/messages/failed`):
221
+ * every answer record whose delivery ended `failed`, across every route and caller.
222
+ * The records are the ADMIN projection (delivery bookkeeping and `error` included),
223
+ * so the row shape is {@link conversationMessage} exactly. It is NOT a paged window —
224
+ * the door returns `{items, total}` and nothing more.
225
+ */
226
+ export const conversationFailedMessages = z.object({
227
+ items: z.array(conversationMessage),
228
+ total: z.number(),
229
+ });
230
+ export type ConversationFailedMessages = z.infer<typeof conversationFailedMessages>;
231
+
232
+ /**
233
+ * The thread-delete reply (`DELETE /api/conversations/{route_name}/thread?thread_id=`).
234
+ * `removed` is a COUNT of the answer records this call deleted — `0` when a prior
235
+ * run already cleared them, when they had aged out under retention, or when the id
236
+ * was never stored (forgetting is absolute, never a 404 on a valid id).
237
+ */
238
+ export const conversationThreadDeleted = z.object({
239
+ removed: z.number(),
240
+ route_name: z.string(),
241
+ thread_id: z.string(),
242
+ });
243
+ export type ConversationThreadDeleted = z.infer<typeof conversationThreadDeleted>;
244
+
245
+ /**
246
+ * The person-erase reply (`DELETE /api/conversations/persons/{person_id}`).
247
+ * `removed` counts the answer records deleted across the person's routes; `erased`
248
+ * says whether THIS call removed the person row (`false` on a retry or an
249
+ * already-gone person — never a 404).
250
+ */
251
+ export const conversationPersonDeleted = z.object({
252
+ person_id: z.string(),
253
+ removed: z.number(),
254
+ erased: z.boolean(),
255
+ });
256
+ export type ConversationPersonDeleted = z.infer<typeof conversationPersonDeleted>;
@@ -0,0 +1,34 @@
1
+ /** Extension element/combo and per-tool extension response schemas. */
2
+ import { z } from 'zod';
3
+
4
+ export const extension = z.object({ name: z.string(), kind: z.string() });
5
+ export const extensions = z.array(extension);
6
+ export type Extension = z.infer<typeof extension>;
7
+
8
+ /**
9
+ * One element of an extension combo: a bare extension NAME, or a
10
+ * `{ name, config }` mapping binding author config (e.g. an `output_schema` JSON
11
+ * Schema, or an `ask_external` verifier). Both wire forms are admitted so a
12
+ * config-bearing combo parses without dropping server data. A drift throws
13
+ * `ApiSchemaError`.
14
+ */
15
+ export const presetExtensionElement = z.union([
16
+ z.string(),
17
+ z.object({ name: z.string(), config: z.record(z.string(), z.unknown()) }),
18
+ ]);
19
+ export type PresetExtensionElement = z.infer<typeof presetExtensionElement>;
20
+
21
+ /**
22
+ * `GET /api/tools/{name}/extensions` — a tool's FULL lossless list-of-combos plus
23
+ * the extension catalog. `combos` is a list of combos, each an ordered list of
24
+ * extension ELEMENTS (a bare name or a config-bearing `{ name, config }` mapping —
25
+ * `output_schema` carries its schema this way); `[]` when the tool has no map entry.
26
+ * It carries EVERY combo mapped to the base tool (the union across every `tools`/`mcp`
27
+ * config), never a single flattened one. `available` is the same flat catalog
28
+ * `GET /api/extensions` returns. A drift throws `ApiSchemaError`.
29
+ */
30
+ export const toolExtensions = z.object({
31
+ combos: z.array(z.array(presetExtensionElement)),
32
+ available: extensions,
33
+ });
34
+ export type ToolExtensions = z.infer<typeof toolExtensions>;
@@ -0,0 +1,153 @@
1
+ /** Backend identity and worker-bus fleet/fan-out response schemas. */
2
+ import { z } from 'zod';
3
+ import { jsonValue } from './shared';
4
+
5
+ /** `GET /api/backend` — the execution-backend identity, or the absent sentinel
6
+ * (`present: false`, a 200) when no backend plugin is registered. Backend identity
7
+ * is kept distinct from the fleet: the fleet doors ride the app's worker bus and
8
+ * need no backend at all. */
9
+ export const backendInfo = z.object({
10
+ present: z.boolean(),
11
+ backend: z.string().nullable(),
12
+ module: z.string().nullable(),
13
+ });
14
+ export type BackendInfo = z.infer<typeof backendInfo>;
15
+
16
+ /** The two worker kinds that join the bus: an ASGI `serve` worker or a
17
+ * `backend` runtime process. A drift throws `ApiSchemaError`. */
18
+ export const workerKind = z.enum(['serve', 'backend']);
19
+ export type WorkerKind = z.infer<typeof workerKind>;
20
+
21
+ /** The lifecycle state a worker advertises in its presence value: `ready` once its
22
+ * resync has converged, `resyncing` while a boot/reconnect resync runs, `recycling`
23
+ * once it has begun a graceful self-exit. A drift throws `ApiSchemaError`. */
24
+ export const workerState = z.enum(['ready', 'resyncing', 'recycling']);
25
+ export type WorkerState = z.infer<typeof workerState>;
26
+
27
+ /** The last op a worker applied, stamped onto its presence row after the terminal
28
+ * reply. `outcome` is the free op-outcome string; `at` is the ISO instant it landed. */
29
+ export const workerLastOp = z.object({
30
+ op: z.string(),
31
+ outcome: z.string(),
32
+ at: z.string(),
33
+ });
34
+ export type WorkerLastOp = z.infer<typeof workerLastOp>;
35
+
36
+ /**
37
+ * One live worker on the bus — a presence-census row. `name` is the stable slot
38
+ * (`{kind}-{n}`) that doubles as a reload target; `generation` is the monotonic life
39
+ * counter minted with the worker's claim; `kind` tells the two worker kinds apart;
40
+ * `pid` is the process id. `joined_at`/`beat_at` are ISO instants (first-seen and last
41
+ * heartbeat) for the cosmetic seen-since display; `state` is the advertised lifecycle
42
+ * state; `stale` is SERVER-computed from the row's remaining presence TTL against the
43
+ * bus cadence (a quiet row past the freshness bound — reconnecting or dead) and is the
44
+ * only freshness signal a client reads, never a client-side threshold; `last_op` is the
45
+ * worker's last applied op, or `null` before it has applied one.
46
+ */
47
+ export const fleetWorker = z.object({
48
+ name: z.string(),
49
+ kind: workerKind,
50
+ pid: z.number(),
51
+ generation: z.number(),
52
+ joined_at: z.string(),
53
+ beat_at: z.string(),
54
+ state: workerState,
55
+ stale: z.boolean(),
56
+ last_op: workerLastOp.nullable(),
57
+ });
58
+ export type FleetWorker = z.infer<typeof fleetWorker>;
59
+
60
+ /**
61
+ * `GET /api/fleet/workers` — the live worker fleet from the bus presence census.
62
+ * The census lists ALL subscribed workers (ASGI `serve` workers and backend-runtime
63
+ * processes alike), not only backend workers. A census read that fails surfaces as a
64
+ * loud 500, never a fabricated empty fleet.
65
+ */
66
+ export const fleetWorkers = z.object({ workers: z.array(fleetWorker) });
67
+ export type FleetWorkers = z.infer<typeof fleetWorkers>;
68
+
69
+ /**
70
+ * One worker's outcome within a fleet broadcast. `applied`/`failed` are terminal wire
71
+ * replies from a subscriber; `missing`/`departed`/`timed_out` are publisher-computed
72
+ * from the presence census (a silent worker never sends them); `resyncing`/`recycling`/
73
+ * `stale` are the gap outcomes for a row that failed the ready+fresh gate — reported as
74
+ * its own actual condition rather than dropped (`resyncing` converges on its resync,
75
+ * `recycling` is departing, `stale` is a quiet row past the freshness bound carrying no
76
+ * convergence promise).
77
+ */
78
+ export const fleetOutcome = z.enum([
79
+ 'applied',
80
+ 'failed',
81
+ 'missing',
82
+ 'departed',
83
+ 'timed_out',
84
+ 'resyncing',
85
+ 'recycling',
86
+ 'stale',
87
+ ]);
88
+ export type FleetOutcome = z.infer<typeof fleetOutcome>;
89
+
90
+ /**
91
+ * One worker's result within a {@link fleetResult}. `payload` carries query-op data
92
+ * (opaque to the UI); `error` carries a failed apply's message; `detail` carries the
93
+ * publisher's report text for a computed gap outcome (`missing`/`departed`/`timed_out`/
94
+ * `resyncing`/`recycling`/`stale`). A drift throws `ApiSchemaError`.
95
+ */
96
+ export const fleetWorkerResult = z.object({
97
+ name: z.string(),
98
+ outcome: fleetOutcome,
99
+ payload: jsonValue,
100
+ error: z.string().nullable(),
101
+ detail: z.string().nullable(),
102
+ });
103
+ export type FleetWorkerResult = z.infer<typeof fleetWorkerResult>;
104
+
105
+ /**
106
+ * The awaited per-worker report of one fleet broadcast. Two honest shapes ride the
107
+ * same schema. Reachable (`reachable: true`): `results` holds one entry per expected
108
+ * worker (the serving worker's own entry included) plus the gap rows, so an unconfirmed
109
+ * sibling is a visible `failed`/`missing`/`departed`/`timed_out`/`resyncing`/`recycling`/
110
+ * `stale` entry, never a silent stale worker. Bus-unreachable (`reachable: false`): the
111
+ * transport failed before any worker could reply, so `results` is empty and only `error`
112
+ * is carried. This is the bare body of `POST /api/fleet/reload-config` and the single-MCP
113
+ * reload; it is also the body the mode-wrapped {@link fleetReportFanout} carries under its
114
+ * `fleet` / `unreachable` modes.
115
+ */
116
+ export const fleetResult = z.object({
117
+ op: z.string(),
118
+ reachable: z.boolean(),
119
+ local_only: z.boolean(),
120
+ results: z.array(fleetWorkerResult),
121
+ error: z.string().nullable(),
122
+ });
123
+ export type FleetResult = z.infer<typeof fleetResult>;
124
+
125
+ /**
126
+ * `POST /api/fleet/reload-config` — soft-restart the fleet and report per-worker. The
127
+ * serving worker applies its own reload first, then broadcasts; the returned report
128
+ * names every worker's outcome. A failed local apply does not abort the broadcast, so
129
+ * the report is embedded even on the convergence-failure path.
130
+ */
131
+ export const fleetReloadResult = fleetResult;
132
+ export type FleetReloadResult = z.infer<typeof fleetReloadResult>;
133
+
134
+ /**
135
+ * The mode-wrapped fan-out summary a mutation embeds under its `fanout` field. Three
136
+ * honest modes, discriminated on `mode`:
137
+ * - `local-only` — the broadcast reached no sibling (a lone worker / no bus), a
138
+ * benign single-process note.
139
+ * - `fleet` — a reachable multi-worker broadcast; carries the full {@link
140
+ * fleetResult} so an unconfirmed sibling is visible.
141
+ * - `unreachable` — the bus itself could not be reached; carries the
142
+ * bus-unreachable {@link fleetResult} (no worker list, only `error`).
143
+ *
144
+ * Every mutation whose response embeds this parses it EXPLICITLY: zod's default
145
+ * unknown-key stripping would otherwise silently drop the field, hiding a failed
146
+ * propagation from the shared fleet-report handler. A drift throws `ApiSchemaError`.
147
+ */
148
+ export const fleetReportFanout = z.discriminatedUnion('mode', [
149
+ z.object({ mode: z.literal('local-only'), note: z.string() }),
150
+ fleetResult.extend({ mode: z.literal('fleet') }),
151
+ fleetResult.extend({ mode: z.literal('unreachable') }),
152
+ ]);
153
+ export type FleetReportFanout = z.infer<typeof fleetReportFanout>;
@@ -0,0 +1,56 @@
1
+ /** Hook listing, registration and topic-verifier response schemas. */
2
+ import { z } from 'zod';
3
+ import { hookParams } from './served';
4
+
5
+ // The hand-written hook response DTOs: the fire-door authority enum, the list rows and
6
+ // their wrapper, and the per-topic verifier/trigger metadata. The served hook DOCUMENT
7
+ // schemas (`hookSubject`/`hookParams`/`hookRegister`) are generated from the contract
8
+ // bundle and re-exported at the top of this file, not defined here.
9
+
10
+ /** A fire door — who may trigger a path, not what the fire may do. A string enum. */
11
+ export const triggerAuth = z.enum([
12
+ 'public',
13
+ 'verifier',
14
+ 'token',
15
+ 'token+api_key',
16
+ 'out-of-service',
17
+ ]);
18
+ export type TriggerAuth = z.infer<typeof triggerAuth>;
19
+
20
+ export const hookList = z.object({
21
+ items: z.array(hookParams),
22
+ total: z.number(),
23
+ // Per-topic verifier bindings: the topic name maps to the verifier bound to it
24
+ // and that verifier's config (which carries a `secret_env` name, never a secret
25
+ // value). Tolerant of an older/empty response, which omits the key entirely.
26
+ topic_verifiers: z
27
+ .record(
28
+ z.string(),
29
+ z.object({ verifier: z.string(), config: z.record(z.string(), z.unknown()) }),
30
+ )
31
+ .default({}),
32
+ // Per-topic fire door (topic → door). Tolerant of an older response omitting it.
33
+ trigger_auth: z.record(z.string(), triggerAuth).default({}),
34
+ });
35
+ export type HookList = z.infer<typeof hookList>;
36
+
37
+ export const hookRegistered = z.object({
38
+ registered: z.boolean(),
39
+ name: z.string(),
40
+ });
41
+
42
+ export const hookRemoved = z.object({
43
+ removed: z.boolean(),
44
+ name: z.string(),
45
+ });
46
+
47
+ // The registered webhook-verifier catalog (`GET /api/hooks/verifiers`) — the
48
+ // sorted verifier NAMES only, never any verifier's config. An empty registry is a
49
+ // valid empty array. This is the ONLY source the topic-verifier bind picker reads.
50
+ export const hookVerifiers = z.array(z.string());
51
+
52
+ /** `PUT /api/hooks/topics/{topic}/verifier` — the bound topic + verifier name. */
53
+ export const topicVerifierSet = z.object({ topic: z.string(), verifier: z.string() });
54
+
55
+ /** `DELETE /api/hooks/topics/{topic}/verifier` — the unbound topic. */
56
+ export const topicVerifierRemoved = z.object({ removed: z.boolean(), topic: z.string() });
@@ -0,0 +1,37 @@
1
+ /** Public barrel for the api-client response/DTO schemas. */
2
+ export * from './served';
3
+ export { jsonSchema, jsonValue } from './shared';
4
+ export * from './tools';
5
+ export * from './extensions';
6
+ export * from './presets';
7
+ export * from './tool-meta';
8
+ export * from './templates';
9
+ export * from './storage';
10
+ export * from './fleet';
11
+ export * from './manifest-mcp';
12
+ export * from './system-kinds';
13
+ export * from './sub-mcp';
14
+ export * from './config';
15
+ export * from './profiles';
16
+ export * from './connectors';
17
+ export * from './studio-plugins';
18
+ export * from './interactions';
19
+ export * from './channels';
20
+ export * from './conversations';
21
+ export * from './web-entry';
22
+ export * from './notifications';
23
+ export * from './hooks';
24
+ export * from './trigger-links';
25
+ export * from './settings-schema';
26
+ export * from './auth-routes';
27
+ export * from './roles';
28
+ export * from './api-keys';
29
+ export * from './login';
30
+ export * from './capabilities';
31
+ export * from './policy';
32
+ export * from './backup';
33
+ export * from './schedules';
34
+ export * from './observability';
35
+ export * from './marketplace';
36
+ export * from './states';
37
+ export { toolRunSubmitResult, toolRunRecord, toolRunList } from '../tool-runs';