@tai42/api-client 15.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 (383) 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} +2199 -2508
  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/generated/served-schemas.d.ts +748 -0
  142. package/dist/generated/served-schemas.d.ts.map +1 -0
  143. package/dist/generated/served-schemas.js +60 -0
  144. package/dist/generated/served-schemas.js.map +1 -0
  145. package/dist/http.d.ts.map +1 -1
  146. package/dist/http.js +33 -17
  147. package/dist/http.js.map +1 -1
  148. package/dist/index.d.ts +1 -1
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/schemas/api-keys.d.ts +34 -0
  151. package/dist/schemas/api-keys.d.ts.map +1 -0
  152. package/dist/schemas/api-keys.js +22 -0
  153. package/dist/schemas/api-keys.js.map +1 -0
  154. package/dist/schemas/auth-routes.d.ts +78 -0
  155. package/dist/schemas/auth-routes.d.ts.map +1 -0
  156. package/dist/schemas/auth-routes.js +42 -0
  157. package/dist/schemas/auth-routes.js.map +1 -0
  158. package/dist/schemas/backup.d.ts +78 -0
  159. package/dist/schemas/backup.d.ts.map +1 -0
  160. package/dist/schemas/backup.js +33 -0
  161. package/dist/schemas/backup.js.map +1 -0
  162. package/dist/schemas/capabilities.d.ts +99 -0
  163. package/dist/schemas/capabilities.d.ts.map +1 -0
  164. package/dist/schemas/capabilities.js +74 -0
  165. package/dist/schemas/capabilities.js.map +1 -0
  166. package/dist/schemas/channels.d.ts +7 -0
  167. package/dist/schemas/channels.d.ts.map +1 -0
  168. package/dist/schemas/channels.js +9 -0
  169. package/dist/schemas/channels.js.map +1 -0
  170. package/dist/schemas/config.d.ts +17 -0
  171. package/dist/schemas/config.d.ts.map +1 -0
  172. package/dist/schemas/config.js +17 -0
  173. package/dist/schemas/config.js.map +1 -0
  174. package/dist/schemas/connectors.d.ts +383 -0
  175. package/dist/schemas/connectors.d.ts.map +1 -0
  176. package/dist/schemas/connectors.js +122 -0
  177. package/dist/schemas/connectors.js.map +1 -0
  178. package/dist/schemas/conversations.d.ts +600 -0
  179. package/dist/schemas/conversations.d.ts.map +1 -0
  180. package/dist/schemas/conversations.js +208 -0
  181. package/dist/schemas/conversations.js.map +1 -0
  182. package/dist/schemas/extensions.d.ts +44 -0
  183. package/dist/schemas/extensions.d.ts.map +1 -0
  184. package/dist/schemas/extensions.js +29 -0
  185. package/dist/schemas/extensions.js.map +1 -0
  186. package/dist/schemas/fleet.d.ts +271 -0
  187. package/dist/schemas/fleet.d.ts.map +1 -0
  188. package/dist/schemas/fleet.js +132 -0
  189. package/dist/schemas/fleet.js.map +1 -0
  190. package/dist/schemas/hooks.d.ts +120 -0
  191. package/dist/schemas/hooks.d.ts.map +1 -0
  192. package/dist/schemas/hooks.js +44 -0
  193. package/dist/schemas/hooks.js.map +1 -0
  194. package/dist/schemas/index.d.ts +38 -0
  195. package/dist/schemas/index.d.ts.map +1 -0
  196. package/dist/schemas/index.js +38 -0
  197. package/dist/schemas/index.js.map +1 -0
  198. package/dist/schemas/interactions.d.ts +156 -0
  199. package/dist/schemas/interactions.d.ts.map +1 -0
  200. package/dist/schemas/interactions.js +124 -0
  201. package/dist/schemas/interactions.js.map +1 -0
  202. package/dist/schemas/login.d.ts +86 -0
  203. package/dist/schemas/login.d.ts.map +1 -0
  204. package/dist/schemas/login.js +54 -0
  205. package/dist/schemas/login.js.map +1 -0
  206. package/dist/schemas/manifest-mcp.d.ts +125 -0
  207. package/dist/schemas/manifest-mcp.d.ts.map +1 -0
  208. package/dist/schemas/manifest-mcp.js +61 -0
  209. package/dist/schemas/manifest-mcp.js.map +1 -0
  210. package/dist/schemas/marketplace.d.ts +708 -0
  211. package/dist/schemas/marketplace.d.ts.map +1 -0
  212. package/dist/schemas/marketplace.js +387 -0
  213. package/dist/schemas/marketplace.js.map +1 -0
  214. package/dist/schemas/notifications.d.ts +61 -0
  215. package/dist/schemas/notifications.d.ts.map +1 -0
  216. package/dist/schemas/notifications.js +38 -0
  217. package/dist/schemas/notifications.js.map +1 -0
  218. package/dist/schemas/observability.d.ts +114 -0
  219. package/dist/schemas/observability.d.ts.map +1 -0
  220. package/dist/schemas/observability.js +74 -0
  221. package/dist/schemas/observability.js.map +1 -0
  222. package/dist/schemas/policy.d.ts +58 -0
  223. package/dist/schemas/policy.d.ts.map +1 -0
  224. package/dist/schemas/policy.js +32 -0
  225. package/dist/schemas/policy.js.map +1 -0
  226. package/dist/schemas/presets.d.ts +258 -0
  227. package/dist/schemas/presets.d.ts.map +1 -0
  228. package/dist/schemas/presets.js +95 -0
  229. package/dist/schemas/presets.js.map +1 -0
  230. package/dist/schemas/profiles.d.ts +180 -0
  231. package/dist/schemas/profiles.d.ts.map +1 -0
  232. package/dist/schemas/profiles.js +100 -0
  233. package/dist/schemas/profiles.js.map +1 -0
  234. package/dist/schemas/roles.d.ts +125 -0
  235. package/dist/schemas/roles.d.ts.map +1 -0
  236. package/dist/schemas/roles.js +46 -0
  237. package/dist/schemas/roles.js.map +1 -0
  238. package/dist/schemas/schedules.d.ts +25 -0
  239. package/dist/schemas/schedules.d.ts.map +1 -0
  240. package/dist/schemas/schedules.js +24 -0
  241. package/dist/schemas/schedules.js.map +1 -0
  242. package/dist/schemas/served.d.ts +626 -0
  243. package/dist/schemas/served.d.ts.map +1 -0
  244. package/dist/schemas/served.js +28 -0
  245. package/dist/schemas/served.js.map +1 -0
  246. package/dist/schemas/settings-schema.d.ts +23 -0
  247. package/dist/schemas/settings-schema.d.ts.map +1 -0
  248. package/dist/schemas/settings-schema.js +25 -0
  249. package/dist/schemas/settings-schema.js.map +1 -0
  250. package/dist/schemas/shared.d.ts +20 -0
  251. package/dist/schemas/shared.d.ts.map +1 -0
  252. package/dist/schemas/shared.js +20 -0
  253. package/dist/schemas/shared.js.map +1 -0
  254. package/dist/schemas/states.d.ts +499 -0
  255. package/dist/schemas/states.d.ts.map +1 -0
  256. package/dist/schemas/states.js +220 -0
  257. package/dist/schemas/states.js.map +1 -0
  258. package/dist/schemas/storage.d.ts +37 -0
  259. package/dist/schemas/storage.d.ts.map +1 -0
  260. package/dist/schemas/storage.js +24 -0
  261. package/dist/schemas/storage.js.map +1 -0
  262. package/dist/schemas/studio-plugins.d.ts +30 -0
  263. package/dist/schemas/studio-plugins.d.ts.map +1 -0
  264. package/dist/schemas/studio-plugins.js +20 -0
  265. package/dist/schemas/studio-plugins.js.map +1 -0
  266. package/dist/schemas/sub-mcp.d.ts +29 -0
  267. package/dist/schemas/sub-mcp.d.ts.map +1 -0
  268. package/dist/schemas/sub-mcp.js +22 -0
  269. package/dist/schemas/sub-mcp.js.map +1 -0
  270. package/dist/schemas/system-kinds.d.ts +122 -0
  271. package/dist/schemas/system-kinds.d.ts.map +1 -0
  272. package/dist/schemas/system-kinds.js +40 -0
  273. package/dist/schemas/system-kinds.js.map +1 -0
  274. package/dist/schemas/templates.d.ts +26 -0
  275. package/dist/schemas/templates.d.ts.map +1 -0
  276. package/dist/schemas/templates.js +11 -0
  277. package/dist/schemas/templates.js.map +1 -0
  278. package/dist/schemas/tool-meta.d.ts +64 -0
  279. package/dist/schemas/tool-meta.d.ts.map +1 -0
  280. package/dist/schemas/tool-meta.js +44 -0
  281. package/dist/schemas/tool-meta.js.map +1 -0
  282. package/dist/schemas/tools.d.ts +62 -0
  283. package/dist/schemas/tools.d.ts.map +1 -0
  284. package/dist/schemas/tools.js +53 -0
  285. package/dist/schemas/tools.js.map +1 -0
  286. package/dist/schemas/trigger-links.d.ts +71 -0
  287. package/dist/schemas/trigger-links.d.ts.map +1 -0
  288. package/dist/schemas/trigger-links.js +46 -0
  289. package/dist/schemas/trigger-links.js.map +1 -0
  290. package/dist/schemas/web-entry.d.ts +45 -0
  291. package/dist/schemas/web-entry.d.ts.map +1 -0
  292. package/dist/schemas/web-entry.js +36 -0
  293. package/dist/schemas/web-entry.js.map +1 -0
  294. package/dist/templated-text.d.ts +30 -0
  295. package/dist/templated-text.d.ts.map +1 -0
  296. package/dist/templated-text.js +30 -0
  297. package/dist/templated-text.js.map +1 -0
  298. package/dist/tool-runs.d.ts +4 -4
  299. package/package.json +6 -2
  300. package/src/client/agents-client.ts +23 -0
  301. package/src/client/auth-client.ts +144 -0
  302. package/src/client/backend-client.ts +25 -0
  303. package/src/client/backup-client.ts +16 -0
  304. package/src/client/capabilities-client.ts +22 -0
  305. package/src/client/channels-client.ts +11 -0
  306. package/src/client/config-client.ts +21 -0
  307. package/src/client/connectors-client.ts +52 -0
  308. package/src/client/conversations-client.ts +240 -0
  309. package/src/client/hooks-client.ts +44 -0
  310. package/src/client/index.ts +122 -0
  311. package/src/client/interactions-client.ts +89 -0
  312. package/src/client/login-client.ts +109 -0
  313. package/src/client/manifest-client.ts +118 -0
  314. package/src/client/marketplace-client.ts +122 -0
  315. package/src/client/mcp-config-schema-client.ts +11 -0
  316. package/src/client/notifications-client.ts +13 -0
  317. package/src/client/observability-client.ts +82 -0
  318. package/src/client/plugins-client.ts +11 -0
  319. package/src/client/policy-client.ts +41 -0
  320. package/src/client/presets-client.ts +124 -0
  321. package/src/client/profiles-client.ts +51 -0
  322. package/src/client/schedules-client.ts +22 -0
  323. package/src/client/settings-schema-client.ts +11 -0
  324. package/src/client/states-client.ts +292 -0
  325. package/src/client/storage-client.ts +63 -0
  326. package/src/client/sub-mcp-client.ts +17 -0
  327. package/src/client/system-client.ts +16 -0
  328. package/src/client/templates-client.ts +28 -0
  329. package/src/client/tool-extensions-client.ts +24 -0
  330. package/src/client/tool-meta-client.ts +65 -0
  331. package/src/client/tools-client.ts +66 -0
  332. package/src/client/transport.ts +18 -0
  333. package/src/client/trigger-links-client.ts +51 -0
  334. package/src/client/web-entry-gate-client.ts +45 -0
  335. package/src/generated/served-schemas.ts +126 -0
  336. package/src/http.ts +48 -24
  337. package/src/index.ts +1 -0
  338. package/src/schemas/api-keys.ts +26 -0
  339. package/src/schemas/auth-routes.ts +48 -0
  340. package/src/schemas/backup.ts +42 -0
  341. package/src/schemas/capabilities.ts +87 -0
  342. package/src/schemas/channels.ts +11 -0
  343. package/src/schemas/config.ts +17 -0
  344. package/src/schemas/connectors.ts +138 -0
  345. package/src/schemas/conversations.ts +256 -0
  346. package/src/schemas/extensions.ts +34 -0
  347. package/src/schemas/fleet.ts +153 -0
  348. package/src/schemas/hooks.ts +56 -0
  349. package/src/schemas/index.ts +37 -0
  350. package/src/schemas/interactions.ts +146 -0
  351. package/src/schemas/login.ts +62 -0
  352. package/src/schemas/manifest-mcp.ts +69 -0
  353. package/src/schemas/marketplace.ts +447 -0
  354. package/src/schemas/notifications.ts +42 -0
  355. package/src/schemas/observability.ts +86 -0
  356. package/src/schemas/policy.ts +37 -0
  357. package/src/schemas/presets.ts +113 -0
  358. package/src/schemas/profiles.ts +119 -0
  359. package/src/schemas/roles.ts +57 -0
  360. package/src/schemas/schedules.ts +27 -0
  361. package/src/schemas/served.ts +49 -0
  362. package/src/schemas/settings-schema.ts +31 -0
  363. package/src/schemas/shared.ts +21 -0
  364. package/src/schemas/states.ts +272 -0
  365. package/src/schemas/storage.ts +31 -0
  366. package/src/schemas/studio-plugins.ts +21 -0
  367. package/src/schemas/sub-mcp.ts +24 -0
  368. package/src/schemas/system-kinds.ts +46 -0
  369. package/src/schemas/templates.ts +11 -0
  370. package/src/schemas/tool-meta.ts +51 -0
  371. package/src/schemas/tools.ts +61 -0
  372. package/src/schemas/trigger-links.ts +54 -0
  373. package/src/schemas/web-entry.ts +46 -0
  374. package/src/templated-text.ts +35 -0
  375. package/dist/client.d.ts.map +0 -1
  376. package/dist/client.js +0 -920
  377. package/dist/client.js.map +0 -1
  378. package/dist/schemas.d.ts +0 -5152
  379. package/dist/schemas.d.ts.map +0 -1
  380. package/dist/schemas.js +0 -2556
  381. package/dist/schemas.js.map +0 -1
  382. package/src/client.ts +0 -1765
  383. package/src/schemas.ts +0 -3067
@@ -0,0 +1,144 @@
1
+ /** Auth scopes, routes, roles and API-key sub-client. */
2
+ import * as s from '../schemas';
3
+ import { encodeSegment } from '../http';
4
+ import type { Transport } from './transport';
5
+
6
+ /** Body for creating or editing an API key (POST/PUT `/api/auth/api-keys`). */
7
+ export interface ApiKeyBody {
8
+ readonly user_id: string;
9
+ readonly description: string;
10
+ readonly scopes: string[];
11
+ // `null` is an explicit clear on edit (PATCH-style PUT): absent preserves the
12
+ // stored policy data, `null` wipes it. Create never sends `null`.
13
+ readonly policy_data?: Record<string, unknown> | null;
14
+ // The access-control condition: an authored templated-text value (inline content
15
+ // or a stored template id), or `null` to explicitly clear it on edit.
16
+ readonly condition?: s.TemplatedText | null;
17
+ }
18
+
19
+ /**
20
+ * Body for one-time claim-link creation (POST `/api/auth/claim-links`). The
21
+ * `api_key` is a raw key the caller holds (the just-minted key, client-side
22
+ * exactly once); `ttl_seconds` optionally overrides the default lifetime (the
23
+ * server caps it at its ceiling).
24
+ */
25
+ export interface ClaimLinkBody {
26
+ readonly api_key: string;
27
+ readonly ttl_seconds?: number | null;
28
+ }
29
+
30
+ /** Body for adding a URL to a scope (POST `/api/auth/scopes`). */
31
+ export interface AddUrlToScopeBody {
32
+ readonly scope_id: string;
33
+ readonly url: string;
34
+ readonly pattern?: string;
35
+ }
36
+
37
+ /**
38
+ * Body for creating a role (POST `/api/auth/roles`). `base_tier` is the security
39
+ * tier the role inherits (`editor`/`viewer` — `admin` is reserved); its jq is
40
+ * resolved server-side, never authored here. `grants` is the editable per-tag
41
+ * access-level map (feature-group tag → `none`/`read`/`write`); it defaults to
42
+ * empty (every group `none`, fail-closed) when omitted.
43
+ */
44
+ export interface RoleCreateBody {
45
+ readonly name: string;
46
+ readonly description?: string;
47
+ readonly base_tier: string;
48
+ readonly grants?: Record<string, s.GrantLevel>;
49
+ }
50
+
51
+ /**
52
+ * Body for editing a role (PUT `/api/auth/roles/{name}`). Both fields are
53
+ * omit-means-KEEP: an absent `grants` preserves the stored map (never a silent
54
+ * wipe), an absent `description` preserves the stored description. The base-tier jq
55
+ * is seed-fixed and not editable here.
56
+ */
57
+ export interface RoleUpdateBody {
58
+ readonly grants?: Record<string, s.GrantLevel>;
59
+ readonly description?: string;
60
+ }
61
+
62
+ /**
63
+ * Body for pinning a route public (POST `/api/auth/public-routes`). `pattern` is an
64
+ * optional regex the AC verifier full-matches request paths against, mapping every
65
+ * match to the `url` key (so a mount's whole subtree can be pinned in one call).
66
+ */
67
+ export interface PinRoutePublicBody {
68
+ readonly url: string;
69
+ readonly pattern?: string;
70
+ }
71
+
72
+ export function authClient(t: Transport) {
73
+ const { req } = t;
74
+ return {
75
+ listScopes: (signal?: AbortSignal) => req('/api/auth/scopes', s.authScopes, { signal }),
76
+ addUrlToScope: (body: AddUrlToScopeBody) =>
77
+ req('/api/auth/scopes', s.addUrlToScopeResult, { method: 'POST', body }),
78
+ removeUrlFromScope: (body: { url: string }) =>
79
+ req('/api/auth/scopes/urls', s.removeUrlFromScopeResult, { method: 'DELETE', body }),
80
+ removeScope: (scopeId: string) =>
81
+ req(`/api/auth/scopes/${encodeSegment(scopeId)}`, s.removeScopeResult, {
82
+ method: 'DELETE',
83
+ }),
84
+ // The app's HTTP route catalog with each route's current mapping — the only
85
+ // source of the mapper's unassigned-routes bucket (`mapped: null` entries).
86
+ listAuthRoutes: (signal?: AbortSignal) => req('/api/auth/routes', s.authRoutes, { signal }),
87
+ // The urls pinned to the public marker; pinning/unpinning is the dedicated
88
+ // public-routes writer, never the scope machinery.
89
+ listPublicRoutes: (signal?: AbortSignal) =>
90
+ req('/api/auth/public-routes', s.publicRoutes, { signal }),
91
+ pinRoutePublic: (body: PinRoutePublicBody) =>
92
+ req('/api/auth/public-routes', s.pinPublicResult, { method: 'POST', body }),
93
+ // Unpin a public url. A url that is absent or scope-mapped is a loud 404.
94
+ unpinPublicRoute: (url: string) =>
95
+ req('/api/auth/public-routes', s.unpinPublicResult, { method: 'DELETE', body: { url } }),
96
+
97
+ // The seeded + operator-authored roles as full bodies (base-tier ceiling +
98
+ // editable per-tag grant map). ADMIN-ONLY — the route is `secret` (a listing
99
+ // exposes each role's raw base-tier jq); a non-admin projection never reaches it.
100
+ listRoles: (signal?: AbortSignal) => req('/api/auth/roles', s.roleList, { signal }),
101
+ // Create an operator-authored role. The server validates the grant map + base
102
+ // tier and 409s on a name collision; the reserved `admin` role cannot be created.
103
+ createRole: (body: RoleCreateBody) =>
104
+ req('/api/auth/roles', s.roleBody, { method: 'POST', body }),
105
+ // Edit a role's per-tag grant map + description (omit-means-keep). The reserved
106
+ // `admin` role and any `allow_all` role are block-downgrade guarded server-side.
107
+ updateRole: (name: string, body: RoleUpdateBody) =>
108
+ req(`/api/auth/roles/${encodeSegment(name)}`, s.roleBody, { method: 'PUT', body }),
109
+ // Delete a role. The reserved `admin` role is undeletable; a role still assigned
110
+ // to any principal is a loud 409.
111
+ deleteRole: (name: string) =>
112
+ req(`/api/auth/roles/${encodeSegment(name)}`, s.roleDeleted, { method: 'DELETE' }),
113
+ // A role's append-only version history + who/action/before→after audit trail.
114
+ // ADMIN-ONLY (`secret`).
115
+ listRoleVersions: (name: string, signal?: AbortSignal) =>
116
+ req(`/api/auth/roles/${encodeSegment(name)}/versions`, s.roleVersions, { signal }),
117
+ // Re-point a role's active version to a prior one (LIVE — holders follow on
118
+ // their next request); returns the re-pointed role body.
119
+ rollbackRole: (name: string, version: number) =>
120
+ req(`/api/auth/roles/${encodeSegment(name)}/rollback`, s.roleBody, {
121
+ method: 'POST',
122
+ body: { version },
123
+ }),
124
+
125
+ listTokensPayload: (signal?: AbortSignal) =>
126
+ req('/api/auth/tokens-payload', s.tokensPayload, { signal }),
127
+ createApiKey: (body: ApiKeyBody) =>
128
+ req('/api/auth/api-keys', s.createdApiKey, { method: 'POST', body }),
129
+ editApiKey: (userId: string, body: Omit<ApiKeyBody, 'user_id'>) =>
130
+ req(`/api/auth/api-keys/${encodeSegment(userId)}`, s.editApiKeyResult, {
131
+ method: 'PUT',
132
+ body,
133
+ }),
134
+ revokeApiKey: (userId: string) =>
135
+ req(`/api/auth/api-keys/${encodeSegment(userId)}`, s.revokeApiKeyResult, {
136
+ method: 'DELETE',
137
+ }),
138
+ // Mint a one-time claim link carrying a raw key to another device (the QR
139
+ // onboarding leg). The token rides the URL fragment; the server returns a
140
+ // relative `claim_path` and the raw token ONCE.
141
+ createClaimLink: (body: ClaimLinkBody) =>
142
+ req('/api/auth/claim-links', s.claimLinkCreated, { method: 'POST', body }),
143
+ };
144
+ }
@@ -0,0 +1,25 @@
1
+ /** Backend identity and worker-bus fleet sub-client. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function backendClient(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ // Backend IDENTITY (`getBackendInfo`, kept on `/api/backend`) is distinct from
9
+ // the FLEET doors, which ride the app's worker bus and need no backend at all.
10
+ // `getBackendInfo` reports `present: false` (a 200 empty state) when no backend
11
+ // plugin is registered. `listFleetWorkers` reads the live bus presence census
12
+ // (every subscribed worker, ASGI + backend-runtime) and never fabricates an empty
13
+ // fleet — a census read that fails surfaces as a loud 500.
14
+ getBackendInfo: (signal?: AbortSignal) => req('/api/backend', s.backendInfo, { signal }),
15
+ listFleetWorkers: (signal?: AbortSignal) =>
16
+ req('/api/fleet/workers', s.fleetWorkers, { signal }),
17
+ // Soft-restart the fleet: `targets` names the workers to reload, or `null` for
18
+ // the whole fleet. The serving worker applies locally then broadcasts; a 200
19
+ // response carries the per-worker fleet report, so workers that did not converge
20
+ // are named, not hidden. A failed local apply instead re-raises as a loud error
21
+ // (the transport throws with the failure message), not a returned report.
22
+ reloadFleetConfig: (targets: string[] | null) =>
23
+ req('/api/fleet/reload-config', s.fleetReloadResult, { method: 'POST', body: { targets } }),
24
+ };
25
+ }
@@ -0,0 +1,16 @@
1
+ /** Backup section listing, export and import sub-client. */
2
+ import * as s from '../schemas';
3
+ import { apiDownload } from '../http';
4
+ import type { Transport } from './transport';
5
+
6
+ export function backupClient(t: Transport) {
7
+ const { config, req } = t;
8
+ return {
9
+ listBackupSections: (signal?: AbortSignal) =>
10
+ req('/api/backup/sections', s.backupSections, { signal }),
11
+ exportBackup: (sections: string[], signal?: AbortSignal): Promise<Blob> =>
12
+ apiDownload(config, '/api/backup/export', { method: 'POST', body: { sections }, signal }),
13
+ importBackup: (body: { document: unknown; sections: string[] }) =>
14
+ req('/api/backup/import', s.backupImportReport, { method: 'POST', body }),
15
+ };
16
+ }
@@ -0,0 +1,22 @@
1
+ /** Caller capability projection and auth-capabilities sub-clients. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function capabilitiesGetMe(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ // The derived (path, method) surface + tools/agents the caller can reach
9
+ // right now — the projection the Studio filters its nav and pages on.
10
+ getMe: (signal?: AbortSignal) => req('/api/auth/me', s.meProjection, { signal }),
11
+ };
12
+ }
13
+
14
+ export function capabilitiesGetCaps(t: Transport) {
15
+ const { req } = t;
16
+ return {
17
+ // Whether this deployment can mint API keys locally (the settings key-create
18
+ // UI gates on `mintable`). AUTHED.
19
+ getAuthCapabilities: (signal?: AbortSignal) =>
20
+ req('/api/auth/capabilities', s.authCapabilities, { signal }),
21
+ };
22
+ }
@@ -0,0 +1,11 @@
1
+ /** Installed channel-plugin catalog sub-client. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function channelsClient(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ // The installed channel-plugin names (delivery media for ask_user questions).
9
+ listChannels: (signal?: AbortSignal) => req('/api/channels', s.channels, { signal }),
10
+ };
11
+ }
@@ -0,0 +1,21 @@
1
+ /** Environment-config and reload sub-client. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function configClient(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ getEnvConfig: (signal?: AbortSignal) => req('/api/config/env', s.envConfig, { signal }),
9
+ setEnvConfig: (env: Record<string, string>) =>
10
+ req('/api/config/env', s.reloadConfigResult, { method: 'POST', body: env }),
11
+ getConfigMode: (signal?: AbortSignal) => req('/api/config/mode', s.configMode, { signal }),
12
+ // The LOCAL soft-restart door (distinct from the System page's fleet door
13
+ // `/api/fleet/reload-config`): refresh env from the config manager, reset the
14
+ // settings caches, and re-initialize from the manifest — applied on the serving
15
+ // worker and broadcast to the fleet (all workers, or only `targets`; `null` = all).
16
+ // Admin-`fenced`; the 200 body is the bare per-worker fleet report so an
17
+ // unconverged sibling is visible, never hidden.
18
+ reloadConfig: (targets: string[] | null = null) =>
19
+ req('/api/config/reload', s.fleetReloadResult, { method: 'POST', body: { targets } }),
20
+ };
21
+ }
@@ -0,0 +1,52 @@
1
+ /** Connector provider and connection lifecycle sub-client. */
2
+ import * as s from '../schemas';
3
+ import { encodeSegment } from '../http';
4
+ import type { Transport } from './transport';
5
+
6
+ export interface StartConnectArgs {
7
+ readonly provider_id: string;
8
+ readonly alias: string;
9
+ readonly enabled_sub_services: string[];
10
+ readonly config_values?: Record<string, string>;
11
+ readonly return_url?: string;
12
+ }
13
+
14
+ export function connectorsClient(t: Transport) {
15
+ const { req } = t;
16
+ return {
17
+ listProviders: (signal?: AbortSignal) =>
18
+ req('/api/connectors/providers', s.providers, { signal }),
19
+ listConnections: (signal?: AbortSignal) =>
20
+ req('/api/connectors/connections', s.connectionsList, { signal }),
21
+ getConnection: (id: string, signal?: AbortSignal) =>
22
+ req(`/api/connectors/connections/${encodeSegment(id)}`, s.connectionView, { signal }),
23
+ startConnect: (args: StartConnectArgs) =>
24
+ req('/api/connectors/connections/start', s.startConnectResult, {
25
+ method: 'POST',
26
+ body: args,
27
+ }),
28
+ disconnect: (id: string) =>
29
+ req(`/api/connectors/connections/${encodeSegment(id)}`, s.disconnectResult, {
30
+ method: 'DELETE',
31
+ }),
32
+ reconnect: (id: string, enabled_sub_services: string[], return_url?: string) =>
33
+ req(`/api/connectors/connections/${encodeSegment(id)}/reconnect`, s.reconnectResult, {
34
+ method: 'POST',
35
+ body: { enabled_sub_services, return_url },
36
+ }),
37
+ patchSubServices: (id: string, enabled_sub_services: string[], return_url?: string) =>
38
+ req(
39
+ `/api/connectors/connections/${encodeSegment(id)}/sub-services`,
40
+ s.patchSubServicesResult,
41
+ {
42
+ method: 'PATCH',
43
+ body: { enabled_sub_services, return_url },
44
+ },
45
+ ),
46
+ completeOAuth: (state: string, code: string, error?: string) =>
47
+ req('/api/connectors/oauth/complete', s.oauthCompleteResult, {
48
+ method: 'POST',
49
+ body: { state, code, error },
50
+ }),
51
+ };
52
+ }
@@ -0,0 +1,240 @@
1
+ /** Conversation route, thread, transcript, config and admin sub-client. */
2
+ import * as s from '../schemas';
3
+ import { encodeSegment } from '../http';
4
+ import type { Transport } from './transport';
5
+
6
+ /**
7
+ * The thread-list filter set (GET `/api/conversations/{route}/threads` query
8
+ * params, alongside `page`/`pageSize`). `status` narrows to threads whose newest
9
+ * record sits in one delivery state; `address` is a SUBSTRING match over the
10
+ * client address. Both omitted when undefined — an unfiltered listing.
11
+ */
12
+ export interface ConversationThreadFilters {
13
+ readonly status?: s.ConversationDeliveryStatus;
14
+ readonly address?: string;
15
+ }
16
+
17
+ /**
18
+ * One transcript read (GET `/api/conversations/{route}/transcript` query params).
19
+ * `order` is not a default the caller may skip: `asc` reads the thread from its
20
+ * beginning and `desc` from its newest end, and which one a screen wants is a
21
+ * decision that screen must make. `q` narrows the page to records whose text
22
+ * matches it (a SUBSTRING), omitted for an unfiltered read.
23
+ */
24
+ export interface ConversationTranscriptQuery {
25
+ readonly routeName: string;
26
+ readonly threadId: string;
27
+ readonly page: number;
28
+ readonly pageSize: number;
29
+ readonly order: s.TranscriptOrder;
30
+ readonly q?: string;
31
+ }
32
+
33
+ /**
34
+ * A route-scoped message search (GET
35
+ * `/api/conversations/{route}/messages/search` query params). `q` is the required
36
+ * needle — a substring over record text, across every thread on the route; `page`
37
+ * is supplied per-request by the infinite query.
38
+ */
39
+ export interface ConversationMessageSearchQuery {
40
+ readonly routeName: string;
41
+ readonly q: string;
42
+ readonly page: number;
43
+ readonly pageSize: number;
44
+ }
45
+
46
+ /**
47
+ * Body for sending a message into a thread (POST
48
+ * `/api/conversations/{route}/thread/messages`). `thread_id` names the thread
49
+ * (an api-door address, passed as a value); `text` is the message. `address` is
50
+ * an optional override the server otherwise derives from the thread, omitted
51
+ * when undefined.
52
+ */
53
+ export interface ConversationThreadMessageBody {
54
+ readonly thread_id: string;
55
+ readonly text: string;
56
+ readonly address?: string;
57
+ }
58
+
59
+ /** Route CRUD: the stored routing rows and their create/replace/delete doors. */
60
+ function conversationRouteMethods(t: Transport) {
61
+ const { req } = t;
62
+ return {
63
+ // The stored routing rows, each with its `callback_secret` withheld — the
64
+ // conversation monitor's route picker.
65
+ listConversationRoutes: (signal?: AbortSignal) =>
66
+ req('/api/conversations', s.conversationRoutes, { signal }),
67
+ // Create or REPLACE a route (an UPSERT: the same door is the create and the
68
+ // edit path). `route_name` rides the URL path AND the body; the door rejects a
69
+ // disagreeing pair, so both come from the one create object. The reply carries
70
+ // the freshly-minted `callback_secret` for an `api`-door row, returned ONCE.
71
+ createOrReplaceConversationRoute: (route: s.ConversationRouteCreate) =>
72
+ req(`/api/conversations/${encodeSegment(route.route_name)}`, s.conversationRouteWritten, {
73
+ method: 'POST',
74
+ body: route,
75
+ }),
76
+ // Delete a route by name (destructive + authority-changing server-side): it
77
+ // drops the routing row and reclaims the thread indexes it owned.
78
+ deleteConversationRoute: (routeName: string) =>
79
+ req(`/api/conversations/${encodeSegment(routeName)}`, s.conversationRouteDeleted, {
80
+ method: 'DELETE',
81
+ }),
82
+ };
83
+ }
84
+
85
+ /** Thread reads and writes: listings, transcript, message search, send, reply mode. */
86
+ function conversationThreadMethods(t: Transport) {
87
+ const { req } = t;
88
+ return {
89
+ // One route's threads, newest activity first. Admin-only server-side: a
90
+ // listing spans every caller on the route, so a scoped session gets a 403.
91
+ listConversationThreads: (
92
+ routeName: string,
93
+ page: number,
94
+ pageSize: number,
95
+ filters: ConversationThreadFilters = {},
96
+ signal?: AbortSignal,
97
+ ) =>
98
+ req(`/api/conversations/${encodeSegment(routeName)}/threads`, s.conversationThreadsPage, {
99
+ signal,
100
+ query: { page, pageSize, status: filters.status, address: filters.address },
101
+ }),
102
+ // One thread's transcript, caller-scoped, read in the asked-for direction.
103
+ // The `thread_id` rides the QUERY STRING, never the path: it embeds the api
104
+ // door's `{principal}/{end user}` address with the principal already
105
+ // percent-encoded, which a path segment would have to encode a second time
106
+ // and the server would then decode once too few. A query value is decoded
107
+ // exactly once whatever it holds, so it is passed through verbatim.
108
+ readConversationTranscript: (query: ConversationTranscriptQuery, signal?: AbortSignal) =>
109
+ req(
110
+ `/api/conversations/${encodeSegment(query.routeName)}/transcript`,
111
+ s.conversationTranscriptPage,
112
+ {
113
+ signal,
114
+ query: {
115
+ thread_id: query.threadId,
116
+ page: query.page,
117
+ pageSize: query.pageSize,
118
+ order: query.order,
119
+ q: query.q,
120
+ },
121
+ },
122
+ ),
123
+ // Search every record on a route by text, across threads, newest first. The
124
+ // needle rides the QUERY (`q`); paging is the infinite query's own window. The
125
+ // page's `truncated` flag says the match set outran the door's scan cap.
126
+ searchConversationMessages: (query: ConversationMessageSearchQuery, signal?: AbortSignal) =>
127
+ req(
128
+ `/api/conversations/${encodeSegment(query.routeName)}/messages/search`,
129
+ s.conversationMessageSearchPage,
130
+ { signal, query: { q: query.q, page: query.page, pageSize: query.pageSize } },
131
+ ),
132
+ // Send a human message into a thread. The `thread_id` rides the BODY (a POST,
133
+ // never a path segment) — same encode-once reasoning as the transcript read.
134
+ sendConversationThreadMessage: (routeName: string, body: ConversationThreadMessageBody) =>
135
+ req(
136
+ `/api/conversations/${encodeSegment(routeName)}/thread/messages`,
137
+ s.conversationThreadMessageSent,
138
+ { method: 'POST', body },
139
+ ),
140
+ // Read a thread's reply mode (`agent`/`manual`) and where it comes from. The
141
+ // `thread_id` rides the QUERY value, encoded once, as the transcript read does.
142
+ getConversationThreadMode: (routeName: string, threadId: string, signal?: AbortSignal) =>
143
+ req(
144
+ `/api/conversations/${encodeSegment(routeName)}/thread/mode`,
145
+ s.conversationThreadModeState,
146
+ { signal, query: { thread_id: threadId } },
147
+ ),
148
+ // Flip a thread's reply mode. The `thread_id` rides the BODY (a PUT).
149
+ setConversationThreadMode: (
150
+ routeName: string,
151
+ threadId: string,
152
+ mode: s.ConversationThreadMode,
153
+ ) =>
154
+ req(
155
+ `/api/conversations/${encodeSegment(routeName)}/thread/mode`,
156
+ s.conversationThreadModeState,
157
+ { method: 'PUT', body: { thread_id: threadId, mode } },
158
+ ),
159
+ };
160
+ }
161
+
162
+ /** Per-target presentation configs, keyed by `(target_kind, target_name)`. Admin surface. */
163
+ function conversationConfigMethods(t: Transport) {
164
+ const { req } = t;
165
+ return {
166
+ // The stored per-target presentation configs (each `(target_kind, target_name)`
167
+ // pair's multichannel flag + first-contact greeting). Admin config surface.
168
+ listConversationConfigs: (signal?: AbortSignal) =>
169
+ req('/api/conversation-configs', s.conversationConfigs, { signal }),
170
+ // One config by its `(target_kind, target_name)` key. 404 when unknown.
171
+ getConversationConfig: (
172
+ targetKind: s.ConversationTargetKind,
173
+ targetName: string,
174
+ signal?: AbortSignal,
175
+ ) =>
176
+ req(
177
+ `/api/conversation-configs/${encodeSegment(targetKind)}/${encodeSegment(targetName)}`,
178
+ s.targetConversationConfig,
179
+ { signal },
180
+ ),
181
+ // Create or REPLACE a config (an UPSERT: the same door is the create and the
182
+ // edit path). The `(target_kind, target_name)` key rides the URL path; the door
183
+ // rejects a body whose key disagrees, so both come from the one config object.
184
+ setConversationConfig: (config: s.TargetConversationConfig) =>
185
+ req(
186
+ `/api/conversation-configs/${encodeSegment(config.target_kind)}/${encodeSegment(config.target_name)}`,
187
+ s.conversationConfigWritten,
188
+ { method: 'PUT', body: config },
189
+ ),
190
+ // Delete a config by its key. 404 when the key is unknown.
191
+ deleteConversationConfig: (targetKind: s.ConversationTargetKind, targetName: string) =>
192
+ req(
193
+ `/api/conversation-configs/${encodeSegment(targetKind)}/${encodeSegment(targetName)}`,
194
+ s.conversationConfigDeleted,
195
+ { method: 'DELETE' },
196
+ ),
197
+ };
198
+ }
199
+
200
+ /** Admin/GDPR doors: failed-message audit and destructive thread/person erasure. */
201
+ function conversationAdminMethods(t: Transport) {
202
+ const { req } = t;
203
+ return {
204
+ // Every answer record whose delivery ended `failed`, across every route and
205
+ // caller. Admin-only server-side; not a paged window (returns `{items, total}`).
206
+ listFailedConversationMessages: (signal?: AbortSignal) =>
207
+ req('/api/conversations/messages/failed', s.conversationFailedMessages, { signal }),
208
+ // Forget ONE thread on a route (destructive): its checkpoint, answer records and
209
+ // thread indexes. The `thread_id` rides the QUERY value, encoded once — it embeds
210
+ // the api door's percent-encoded `{principal}/{end user}` address, which a path
211
+ // segment would encode a second time. `removed` counts the records this call
212
+ // cleared; a valid id on its own route always succeeds, never a 404.
213
+ deleteConversationThread: (routeName: string, threadId: string) =>
214
+ req(`/api/conversations/${encodeSegment(routeName)}/thread`, s.conversationThreadDeleted, {
215
+ method: 'DELETE',
216
+ query: { thread_id: threadId },
217
+ }),
218
+ // Erase a LINKED person ENTIRELY (GDPR, wide blast radius): its aggregated thread
219
+ // and checkpoint, its person row, and every address→person index mapping, across
220
+ // EVERY route it wrote under. The `person_id` is a uuid4 with no percent-encoded
221
+ // principal, so it rides the PATH cleanly. `erased` says whether this call removed
222
+ // the person row (idempotent — a retry answers `false`, never a 404).
223
+ deleteConversationPerson: (personId: string) =>
224
+ req(`/api/conversations/persons/${encodeSegment(personId)}`, s.conversationPersonDeleted, {
225
+ method: 'DELETE',
226
+ }),
227
+ };
228
+ }
229
+
230
+ export function conversationsClient(t: Transport) {
231
+ // Declaration emit prepends each spread group's members, so the groups are
232
+ // spread in reverse of their public order to keep the surface route → thread
233
+ // → config → admin.
234
+ return {
235
+ ...conversationAdminMethods(t),
236
+ ...conversationConfigMethods(t),
237
+ ...conversationThreadMethods(t),
238
+ ...conversationRouteMethods(t),
239
+ };
240
+ }
@@ -0,0 +1,44 @@
1
+ /** Hook listing, registration and topic-verifier sub-client. */
2
+ import * as s from '../schemas';
3
+ import { encodeSegment } from '../http';
4
+ import type { Transport } from './transport';
5
+
6
+ /**
7
+ * Body for binding a webhook verifier to a topic
8
+ * (PUT `/api/hooks/topics/{topic}/verifier`). `verifier` is a registered verifier
9
+ * NAME, resolved against the live registry at bind time (an unknown name is a loud
10
+ * 400). `config` is that verifier's config object — it carries a `secret_env` name,
11
+ * never a secret value — and defaults to `{}` when omitted.
12
+ */
13
+ export interface TopicVerifierBody {
14
+ readonly verifier: string;
15
+ readonly config?: Record<string, unknown>;
16
+ }
17
+
18
+ export function hooksClient(t: Transport) {
19
+ const { req } = t;
20
+ return {
21
+ listHooks: (topic?: string, signal?: AbortSignal) =>
22
+ req('/api/hooks', s.hookList, { signal, query: topic === undefined ? undefined : { topic } }),
23
+ registerHook: (params: s.HookRegister) =>
24
+ req('/api/hooks', s.hookRegistered, { method: 'POST', body: params }),
25
+ unregisterHook: (name: string) =>
26
+ req(`/api/hooks/${encodeSegment(name)}`, s.hookRemoved, { method: 'DELETE' }),
27
+ // The registered webhook-verifier catalog — the only source the bind picker
28
+ // reads (names only; an empty registry is a valid empty list).
29
+ listHookVerifiers: (signal?: AbortSignal) =>
30
+ req('/api/hooks/verifiers', s.hookVerifiers, { signal }),
31
+ // Bind a verifier to a topic (locks its otherwise-open public ingress). A PUT
32
+ // replaces any existing binding; an unknown verifier name is a loud 400.
33
+ setTopicVerifier: (topic: string, body: TopicVerifierBody) =>
34
+ req(`/api/hooks/topics/${encodeSegment(topic)}/verifier`, s.topicVerifierSet, {
35
+ method: 'PUT',
36
+ body,
37
+ }),
38
+ // Unbind a topic's verifier (re-opens its public ingress). 404 when no binding.
39
+ deleteTopicVerifier: (topic: string) =>
40
+ req(`/api/hooks/topics/${encodeSegment(topic)}/verifier`, s.topicVerifierRemoved, {
41
+ method: 'DELETE',
42
+ }),
43
+ };
44
+ }