@tai42/api-client 16.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/agents.js +1 -1
  3. package/dist/agents.js.map +1 -1
  4. package/dist/client/agents-client.d.ts +26 -0
  5. package/dist/client/agents-client.d.ts.map +1 -0
  6. package/dist/client/agents-client.js +19 -0
  7. package/dist/client/agents-client.js.map +1 -0
  8. package/dist/client/auth-client.d.ts +247 -0
  9. package/dist/client/auth-client.d.ts.map +1 -0
  10. package/dist/client/auth-client.js +73 -0
  11. package/dist/client/auth-client.js.map +1 -0
  12. package/dist/client/backend-client.d.ts +39 -0
  13. package/dist/client/backend-client.d.ts.map +1 -0
  14. package/dist/client/backend-client.js +22 -0
  15. package/dist/client/backend-client.js.map +1 -0
  16. package/dist/client/backup-client.d.ts +56 -0
  17. package/dist/client/backup-client.d.ts.map +1 -0
  18. package/dist/client/backup-client.js +12 -0
  19. package/dist/client/backup-client.js.map +1 -0
  20. package/dist/client/capabilities-client.d.ts +40 -0
  21. package/dist/client/capabilities-client.d.ts.map +1 -0
  22. package/dist/client/capabilities-client.js +19 -0
  23. package/dist/client/capabilities-client.js.map +1 -0
  24. package/dist/client/channels-client.d.ts +7 -0
  25. package/dist/client/channels-client.d.ts.map +1 -0
  26. package/dist/client/channels-client.js +10 -0
  27. package/dist/client/channels-client.js.map +1 -0
  28. package/dist/client/config-client.d.ts +59 -0
  29. package/dist/client/config-client.d.ts.map +1 -0
  30. package/dist/client/config-client.js +18 -0
  31. package/dist/client/config-client.js.map +1 -0
  32. package/dist/client/connectors-client.d.ts +225 -0
  33. package/dist/client/connectors-client.d.ts.map +1 -0
  34. package/dist/client/connectors-client.js +31 -0
  35. package/dist/client/connectors-client.js.map +1 -0
  36. package/dist/client/conversations-client.d.ts +398 -0
  37. package/dist/client/conversations-client.d.ts.map +1 -0
  38. package/dist/client/conversations-client.js +120 -0
  39. package/dist/client/conversations-client.js.map +1 -0
  40. package/dist/client/hooks-client.d.ts +112 -0
  41. package/dist/client/hooks-client.d.ts.map +1 -0
  42. package/dist/client/hooks-client.js +25 -0
  43. package/dist/client/hooks-client.js.map +1 -0
  44. package/dist/{client.d.ts → client/index.d.ts} +2336 -2708
  45. package/dist/client/index.d.ts.map +1 -0
  46. package/dist/client/index.js +79 -0
  47. package/dist/client/index.js.map +1 -0
  48. package/dist/client/interactions-client.d.ts +52 -0
  49. package/dist/client/interactions-client.d.ts.map +1 -0
  50. package/dist/client/interactions-client.js +84 -0
  51. package/dist/client/interactions-client.js.map +1 -0
  52. package/dist/client/login-client.d.ts +69 -0
  53. package/dist/client/login-client.d.ts.map +1 -0
  54. package/dist/client/login-client.js +137 -0
  55. package/dist/client/login-client.js.map +1 -0
  56. package/dist/client/manifest-client.d.ts +354 -0
  57. package/dist/client/manifest-client.d.ts.map +1 -0
  58. package/dist/client/manifest-client.js +76 -0
  59. package/dist/client/manifest-client.js.map +1 -0
  60. package/dist/client/marketplace-client.d.ts +274 -0
  61. package/dist/client/marketplace-client.d.ts.map +1 -0
  62. package/dist/client/marketplace-client.js +46 -0
  63. package/dist/client/marketplace-client.js.map +1 -0
  64. package/dist/client/mcp-config-schema-client.d.ts +5 -0
  65. package/dist/client/mcp-config-schema-client.d.ts.map +1 -0
  66. package/dist/client/mcp-config-schema-client.js +9 -0
  67. package/dist/client/mcp-config-schema-client.js.map +1 -0
  68. package/dist/client/notifications-client.d.ts +27 -0
  69. package/dist/client/notifications-client.d.ts.map +1 -0
  70. package/dist/client/notifications-client.js +11 -0
  71. package/dist/client/notifications-client.js.map +1 -0
  72. package/dist/client/observability-client.d.ts +103 -0
  73. package/dist/client/observability-client.d.ts.map +1 -0
  74. package/dist/client/observability-client.js +43 -0
  75. package/dist/client/observability-client.js.map +1 -0
  76. package/dist/client/plugins-client.d.ts +17 -0
  77. package/dist/client/plugins-client.d.ts.map +1 -0
  78. package/dist/client/plugins-client.js +9 -0
  79. package/dist/client/plugins-client.js.map +1 -0
  80. package/dist/client/policy-client.d.ts +37 -0
  81. package/dist/client/policy-client.d.ts.map +1 -0
  82. package/dist/client/policy-client.js +26 -0
  83. package/dist/client/policy-client.js.map +1 -0
  84. package/dist/client/presets-client.d.ts +334 -0
  85. package/dist/client/presets-client.d.ts.map +1 -0
  86. package/dist/client/presets-client.js +38 -0
  87. package/dist/client/presets-client.js.map +1 -0
  88. package/dist/client/profiles-client.d.ts +101 -0
  89. package/dist/client/profiles-client.d.ts.map +1 -0
  90. package/dist/client/profiles-client.js +37 -0
  91. package/dist/client/profiles-client.js.map +1 -0
  92. package/dist/client/schedules-client.d.ts +27 -0
  93. package/dist/client/schedules-client.d.ts.map +1 -0
  94. package/dist/client/schedules-client.js +13 -0
  95. package/dist/client/schedules-client.js.map +1 -0
  96. package/dist/client/settings-schema-client.d.ts +23 -0
  97. package/dist/client/settings-schema-client.d.ts.map +1 -0
  98. package/dist/client/settings-schema-client.js +9 -0
  99. package/dist/client/settings-schema-client.js.map +1 -0
  100. package/dist/client/states-client.d.ts +470 -0
  101. package/dist/client/states-client.d.ts.map +1 -0
  102. package/dist/client/states-client.js +144 -0
  103. package/dist/client/states-client.js.map +1 -0
  104. package/dist/client/storage-client.d.ts +40 -0
  105. package/dist/client/storage-client.d.ts.map +1 -0
  106. package/dist/client/storage-client.js +43 -0
  107. package/dist/client/storage-client.js.map +1 -0
  108. package/dist/client/sub-mcp-client.d.ts +17 -0
  109. package/dist/client/sub-mcp-client.d.ts.map +1 -0
  110. package/dist/client/sub-mcp-client.js +14 -0
  111. package/dist/client/sub-mcp-client.js.map +1 -0
  112. package/dist/client/system-client.d.ts +11 -0
  113. package/dist/client/system-client.d.ts.map +1 -0
  114. package/dist/client/system-client.js +13 -0
  115. package/dist/client/system-client.js.map +1 -0
  116. package/dist/client/templates-client.d.ts +29 -0
  117. package/dist/client/templates-client.d.ts.map +1 -0
  118. package/dist/client/templates-client.js +21 -0
  119. package/dist/client/templates-client.js.map +1 -0
  120. package/dist/client/tool-extensions-client.d.ts +53 -0
  121. package/dist/client/tool-extensions-client.d.ts.map +1 -0
  122. package/dist/client/tool-extensions-client.js +21 -0
  123. package/dist/client/tool-extensions-client.js.map +1 -0
  124. package/dist/client/tool-meta-client.d.ts +69 -0
  125. package/dist/client/tool-meta-client.d.ts.map +1 -0
  126. package/dist/client/tool-meta-client.js +38 -0
  127. package/dist/client/tool-meta-client.js.map +1 -0
  128. package/dist/client/tools-client.d.ts +83 -0
  129. package/dist/client/tools-client.d.ts.map +1 -0
  130. package/dist/client/tools-client.js +38 -0
  131. package/dist/client/tools-client.js.map +1 -0
  132. package/dist/client/transport.d.ts +13 -0
  133. package/dist/client/transport.d.ts.map +1 -0
  134. package/dist/client/transport.js +10 -0
  135. package/dist/client/transport.js.map +1 -0
  136. package/dist/client/trigger-links-client.d.ts +44 -0
  137. package/dist/client/trigger-links-client.d.ts.map +1 -0
  138. package/dist/client/trigger-links-client.js +30 -0
  139. package/dist/client/trigger-links-client.js.map +1 -0
  140. package/dist/client/web-entry-gate-client.d.ts +34 -0
  141. package/dist/client/web-entry-gate-client.d.ts.map +1 -0
  142. package/dist/client/web-entry-gate-client.js +25 -0
  143. package/dist/client/web-entry-gate-client.js.map +1 -0
  144. package/dist/errors.d.ts +11 -0
  145. package/dist/errors.d.ts.map +1 -1
  146. package/dist/errors.js +15 -0
  147. package/dist/errors.js.map +1 -1
  148. package/dist/http.d.ts.map +1 -1
  149. package/dist/http.js +33 -17
  150. package/dist/http.js.map +1 -1
  151. package/dist/index.d.ts +12 -12
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +6 -13
  154. package/dist/index.js.map +1 -1
  155. package/dist/schemas/api-keys.d.ts +43 -0
  156. package/dist/schemas/api-keys.d.ts.map +1 -0
  157. package/dist/schemas/api-keys.js +29 -0
  158. package/dist/schemas/api-keys.js.map +1 -0
  159. package/dist/schemas/auth-routes.d.ts +78 -0
  160. package/dist/schemas/auth-routes.d.ts.map +1 -0
  161. package/dist/schemas/auth-routes.js +42 -0
  162. package/dist/schemas/auth-routes.js.map +1 -0
  163. package/dist/schemas/backup.d.ts +78 -0
  164. package/dist/schemas/backup.d.ts.map +1 -0
  165. package/dist/schemas/backup.js +33 -0
  166. package/dist/schemas/backup.js.map +1 -0
  167. package/dist/schemas/capabilities.d.ts +109 -0
  168. package/dist/schemas/capabilities.d.ts.map +1 -0
  169. package/dist/schemas/capabilities.js +78 -0
  170. package/dist/schemas/capabilities.js.map +1 -0
  171. package/dist/schemas/channels.d.ts +7 -0
  172. package/dist/schemas/channels.d.ts.map +1 -0
  173. package/dist/schemas/channels.js +9 -0
  174. package/dist/schemas/channels.js.map +1 -0
  175. package/dist/schemas/config.d.ts +17 -0
  176. package/dist/schemas/config.d.ts.map +1 -0
  177. package/dist/schemas/config.js +17 -0
  178. package/dist/schemas/config.js.map +1 -0
  179. package/dist/schemas/connectors.d.ts +383 -0
  180. package/dist/schemas/connectors.d.ts.map +1 -0
  181. package/dist/schemas/connectors.js +122 -0
  182. package/dist/schemas/connectors.js.map +1 -0
  183. package/dist/schemas/conversations.d.ts +600 -0
  184. package/dist/schemas/conversations.d.ts.map +1 -0
  185. package/dist/schemas/conversations.js +208 -0
  186. package/dist/schemas/conversations.js.map +1 -0
  187. package/dist/schemas/extensions.d.ts +44 -0
  188. package/dist/schemas/extensions.d.ts.map +1 -0
  189. package/dist/schemas/extensions.js +29 -0
  190. package/dist/schemas/extensions.js.map +1 -0
  191. package/dist/schemas/fleet.d.ts +271 -0
  192. package/dist/schemas/fleet.d.ts.map +1 -0
  193. package/dist/schemas/fleet.js +132 -0
  194. package/dist/schemas/fleet.js.map +1 -0
  195. package/dist/schemas/hooks.d.ts +120 -0
  196. package/dist/schemas/hooks.d.ts.map +1 -0
  197. package/dist/schemas/hooks.js +44 -0
  198. package/dist/schemas/hooks.js.map +1 -0
  199. package/dist/schemas/index.d.ts +40 -0
  200. package/dist/schemas/index.d.ts.map +1 -0
  201. package/dist/schemas/index.js +40 -0
  202. package/dist/schemas/index.js.map +1 -0
  203. package/dist/schemas/interactions.d.ts +156 -0
  204. package/dist/schemas/interactions.d.ts.map +1 -0
  205. package/dist/schemas/interactions.js +124 -0
  206. package/dist/schemas/interactions.js.map +1 -0
  207. package/dist/schemas/login.d.ts +93 -0
  208. package/dist/schemas/login.d.ts.map +1 -0
  209. package/dist/schemas/login.js +61 -0
  210. package/dist/schemas/login.js.map +1 -0
  211. package/dist/schemas/manifest-mcp.d.ts +125 -0
  212. package/dist/schemas/manifest-mcp.d.ts.map +1 -0
  213. package/dist/schemas/manifest-mcp.js +61 -0
  214. package/dist/schemas/manifest-mcp.js.map +1 -0
  215. package/dist/schemas/marketplace.d.ts +708 -0
  216. package/dist/schemas/marketplace.d.ts.map +1 -0
  217. package/dist/schemas/marketplace.js +387 -0
  218. package/dist/schemas/marketplace.js.map +1 -0
  219. package/dist/schemas/notifications.d.ts +61 -0
  220. package/dist/schemas/notifications.d.ts.map +1 -0
  221. package/dist/schemas/notifications.js +38 -0
  222. package/dist/schemas/notifications.js.map +1 -0
  223. package/dist/schemas/observability.d.ts +114 -0
  224. package/dist/schemas/observability.d.ts.map +1 -0
  225. package/dist/schemas/observability.js +74 -0
  226. package/dist/schemas/observability.js.map +1 -0
  227. package/dist/schemas/policy.d.ts +58 -0
  228. package/dist/schemas/policy.d.ts.map +1 -0
  229. package/dist/schemas/policy.js +32 -0
  230. package/dist/schemas/policy.js.map +1 -0
  231. package/dist/schemas/presets.d.ts +258 -0
  232. package/dist/schemas/presets.d.ts.map +1 -0
  233. package/dist/schemas/presets.js +95 -0
  234. package/dist/schemas/presets.js.map +1 -0
  235. package/dist/schemas/principals.d.ts +54 -0
  236. package/dist/schemas/principals.d.ts.map +1 -0
  237. package/dist/schemas/principals.js +34 -0
  238. package/dist/schemas/principals.js.map +1 -0
  239. package/dist/schemas/profiles.d.ts +180 -0
  240. package/dist/schemas/profiles.d.ts.map +1 -0
  241. package/dist/schemas/profiles.js +100 -0
  242. package/dist/schemas/profiles.js.map +1 -0
  243. package/dist/schemas/roles.d.ts +125 -0
  244. package/dist/schemas/roles.d.ts.map +1 -0
  245. package/dist/schemas/roles.js +46 -0
  246. package/dist/schemas/roles.js.map +1 -0
  247. package/dist/schemas/schedules.d.ts +25 -0
  248. package/dist/schemas/schedules.d.ts.map +1 -0
  249. package/dist/schemas/schedules.js +24 -0
  250. package/dist/schemas/schedules.js.map +1 -0
  251. package/dist/schemas/served.d.ts +626 -0
  252. package/dist/schemas/served.d.ts.map +1 -0
  253. package/dist/schemas/served.js +28 -0
  254. package/dist/schemas/served.js.map +1 -0
  255. package/dist/schemas/settings-schema.d.ts +23 -0
  256. package/dist/schemas/settings-schema.d.ts.map +1 -0
  257. package/dist/schemas/settings-schema.js +25 -0
  258. package/dist/schemas/settings-schema.js.map +1 -0
  259. package/dist/schemas/setup.d.ts +43 -0
  260. package/dist/schemas/setup.d.ts.map +1 -0
  261. package/dist/schemas/setup.js +19 -0
  262. package/dist/schemas/setup.js.map +1 -0
  263. package/dist/schemas/shared.d.ts +20 -0
  264. package/dist/schemas/shared.d.ts.map +1 -0
  265. package/dist/schemas/shared.js +20 -0
  266. package/dist/schemas/shared.js.map +1 -0
  267. package/dist/schemas/states.d.ts +499 -0
  268. package/dist/schemas/states.d.ts.map +1 -0
  269. package/dist/schemas/states.js +220 -0
  270. package/dist/schemas/states.js.map +1 -0
  271. package/dist/schemas/storage.d.ts +37 -0
  272. package/dist/schemas/storage.d.ts.map +1 -0
  273. package/dist/schemas/storage.js +24 -0
  274. package/dist/schemas/storage.js.map +1 -0
  275. package/dist/schemas/studio-plugins.d.ts +30 -0
  276. package/dist/schemas/studio-plugins.d.ts.map +1 -0
  277. package/dist/schemas/studio-plugins.js +20 -0
  278. package/dist/schemas/studio-plugins.js.map +1 -0
  279. package/dist/schemas/sub-mcp.d.ts +29 -0
  280. package/dist/schemas/sub-mcp.d.ts.map +1 -0
  281. package/dist/schemas/sub-mcp.js +22 -0
  282. package/dist/schemas/sub-mcp.js.map +1 -0
  283. package/dist/schemas/system-kinds.d.ts +122 -0
  284. package/dist/schemas/system-kinds.d.ts.map +1 -0
  285. package/dist/schemas/system-kinds.js +40 -0
  286. package/dist/schemas/system-kinds.js.map +1 -0
  287. package/dist/schemas/templates.d.ts +26 -0
  288. package/dist/schemas/templates.d.ts.map +1 -0
  289. package/dist/schemas/templates.js +11 -0
  290. package/dist/schemas/templates.js.map +1 -0
  291. package/dist/schemas/tool-meta.d.ts +64 -0
  292. package/dist/schemas/tool-meta.d.ts.map +1 -0
  293. package/dist/schemas/tool-meta.js +44 -0
  294. package/dist/schemas/tool-meta.js.map +1 -0
  295. package/dist/schemas/tools.d.ts +62 -0
  296. package/dist/schemas/tools.d.ts.map +1 -0
  297. package/dist/schemas/tools.js +53 -0
  298. package/dist/schemas/tools.js.map +1 -0
  299. package/dist/schemas/trigger-links.d.ts +71 -0
  300. package/dist/schemas/trigger-links.d.ts.map +1 -0
  301. package/dist/schemas/trigger-links.js +46 -0
  302. package/dist/schemas/trigger-links.js.map +1 -0
  303. package/dist/schemas/web-entry.d.ts +45 -0
  304. package/dist/schemas/web-entry.d.ts.map +1 -0
  305. package/dist/schemas/web-entry.js +36 -0
  306. package/dist/schemas/web-entry.js.map +1 -0
  307. package/dist/tool-runs.d.ts.map +1 -1
  308. package/dist/tool-runs.js.map +1 -1
  309. package/package.json +1 -1
  310. package/src/agents.ts +2 -2
  311. package/src/client/agents-client.ts +23 -0
  312. package/src/client/auth-client.ts +170 -0
  313. package/src/client/backend-client.ts +25 -0
  314. package/src/client/backup-client.ts +16 -0
  315. package/src/client/capabilities-client.ts +22 -0
  316. package/src/client/channels-client.ts +11 -0
  317. package/src/client/config-client.ts +21 -0
  318. package/src/client/connectors-client.ts +52 -0
  319. package/src/client/conversations-client.ts +240 -0
  320. package/src/client/hooks-client.ts +44 -0
  321. package/src/client/index.ts +122 -0
  322. package/src/client/interactions-client.ts +89 -0
  323. package/src/client/login-client.ts +150 -0
  324. package/src/client/manifest-client.ts +118 -0
  325. package/src/client/marketplace-client.ts +122 -0
  326. package/src/client/mcp-config-schema-client.ts +11 -0
  327. package/src/client/notifications-client.ts +13 -0
  328. package/src/client/observability-client.ts +82 -0
  329. package/src/client/plugins-client.ts +11 -0
  330. package/src/client/policy-client.ts +41 -0
  331. package/src/client/presets-client.ts +124 -0
  332. package/src/client/profiles-client.ts +51 -0
  333. package/src/client/schedules-client.ts +22 -0
  334. package/src/client/settings-schema-client.ts +11 -0
  335. package/src/client/states-client.ts +292 -0
  336. package/src/client/storage-client.ts +63 -0
  337. package/src/client/sub-mcp-client.ts +17 -0
  338. package/src/client/system-client.ts +16 -0
  339. package/src/client/templates-client.ts +28 -0
  340. package/src/client/tool-extensions-client.ts +24 -0
  341. package/src/client/tool-meta-client.ts +65 -0
  342. package/src/client/tools-client.ts +66 -0
  343. package/src/client/transport.ts +18 -0
  344. package/src/client/trigger-links-client.ts +51 -0
  345. package/src/client/web-entry-gate-client.ts +45 -0
  346. package/src/errors.ts +16 -0
  347. package/src/http.ts +48 -24
  348. package/src/index.ts +231 -226
  349. package/src/schemas/api-keys.ts +34 -0
  350. package/src/schemas/auth-routes.ts +48 -0
  351. package/src/schemas/backup.ts +43 -0
  352. package/src/schemas/capabilities.ts +92 -0
  353. package/src/schemas/channels.ts +11 -0
  354. package/src/schemas/config.ts +17 -0
  355. package/src/schemas/connectors.ts +139 -0
  356. package/src/schemas/conversations.ts +257 -0
  357. package/src/schemas/extensions.ts +34 -0
  358. package/src/schemas/fleet.ts +154 -0
  359. package/src/schemas/hooks.ts +57 -0
  360. package/src/schemas/index.ts +39 -0
  361. package/src/schemas/interactions.ts +147 -0
  362. package/src/schemas/login.ts +69 -0
  363. package/src/schemas/manifest-mcp.ts +70 -0
  364. package/src/schemas/marketplace.ts +447 -0
  365. package/src/schemas/notifications.ts +43 -0
  366. package/src/schemas/observability.ts +87 -0
  367. package/src/schemas/policy.ts +38 -0
  368. package/src/schemas/presets.ts +114 -0
  369. package/src/schemas/principals.ts +41 -0
  370. package/src/schemas/profiles.ts +120 -0
  371. package/src/schemas/roles.ts +58 -0
  372. package/src/schemas/schedules.ts +28 -0
  373. package/src/schemas/served.ts +50 -0
  374. package/src/schemas/settings-schema.ts +32 -0
  375. package/src/schemas/setup.ts +39 -0
  376. package/src/schemas/shared.ts +21 -0
  377. package/src/schemas/states.ts +273 -0
  378. package/src/schemas/storage.ts +31 -0
  379. package/src/schemas/studio-plugins.ts +21 -0
  380. package/src/schemas/sub-mcp.ts +24 -0
  381. package/src/schemas/system-kinds.ts +47 -0
  382. package/src/schemas/templates.ts +12 -0
  383. package/src/schemas/tool-meta.ts +51 -0
  384. package/src/schemas/tools.ts +62 -0
  385. package/src/schemas/trigger-links.ts +55 -0
  386. package/src/schemas/web-entry.ts +46 -0
  387. package/src/tool-runs.ts +1 -1
  388. package/dist/client.d.ts.map +0 -1
  389. package/dist/client.js +0 -920
  390. package/dist/client.js.map +0 -1
  391. package/dist/schemas.d.ts +0 -5172
  392. package/dist/schemas.d.ts.map +0 -1
  393. package/dist/schemas.js +0 -2268
  394. package/dist/schemas.js.map +0 -1
  395. package/src/client.ts +0 -1771
  396. package/src/schemas.ts +0 -2760
@@ -0,0 +1,122 @@
1
+ /** Composition root: assembles the per-resource sub-clients into the client. */
2
+ import type { ApiConfig } from '../http';
3
+ import { agentsClient } from './agents-client';
4
+ import { authClient } from './auth-client';
5
+ import { backendClient } from './backend-client';
6
+ import { backupClient } from './backup-client';
7
+ import { capabilitiesGetCaps, capabilitiesGetMe } from './capabilities-client';
8
+ import { channelsClient } from './channels-client';
9
+ import { configClient } from './config-client';
10
+ import { connectorsClient } from './connectors-client';
11
+ import { conversationsClient } from './conversations-client';
12
+ import { hooksClient } from './hooks-client';
13
+ import { interactionsClient, interactionsStreamClient } from './interactions-client';
14
+ import { loginClient, logoutClient } from './login-client';
15
+ import { manifestClient, manifestSecretEnvClient } from './manifest-client';
16
+ import { marketplaceClient } from './marketplace-client';
17
+ import { mcpConfigSchemaClient } from './mcp-config-schema-client';
18
+ import { notificationsClient } from './notifications-client';
19
+ import { observabilityClient } from './observability-client';
20
+ import { pluginsClient } from './plugins-client';
21
+ import { policyClient } from './policy-client';
22
+ import { presetsClient } from './presets-client';
23
+ import { profilesClient } from './profiles-client';
24
+ import { schedulesClient } from './schedules-client';
25
+ import { settingsSchemaClient } from './settings-schema-client';
26
+ import { statesClient } from './states-client';
27
+ import { storageClient } from './storage-client';
28
+ import { subMcpClient } from './sub-mcp-client';
29
+ import { systemClient } from './system-client';
30
+ import { templatesClient } from './templates-client';
31
+ import { toolExtensionsClient } from './tool-extensions-client';
32
+ import { toolMetaClient } from './tool-meta-client';
33
+ import { toolsClient } from './tools-client';
34
+ import { makeTransport } from './transport';
35
+ import { triggerLinksClient } from './trigger-links-client';
36
+ import { webEntryGateClient } from './web-entry-gate-client';
37
+
38
+ export type {
39
+ AddUrlToScopeBody,
40
+ ApiKeyBody,
41
+ ClaimLinkBody,
42
+ PinRoutePublicBody,
43
+ RoleCreateBody,
44
+ RoleUpdateBody,
45
+ } from './auth-client';
46
+ export type { StartConnectArgs } from './connectors-client';
47
+ export type {
48
+ ConversationMessageSearchQuery,
49
+ ConversationThreadFilters,
50
+ ConversationThreadMessageBody,
51
+ ConversationTranscriptQuery,
52
+ } from './conversations-client';
53
+ export type { TopicVerifierBody } from './hooks-client';
54
+ export { isSafeApiPath } from './login-client';
55
+ export type { ApiToolsListsBody } from './manifest-client';
56
+ export type {
57
+ MarketplaceInstallBody,
58
+ MarketplaceInstallPreviewBody,
59
+ MarketplaceSearchQuery,
60
+ MarketplaceUninstallBody,
61
+ } from './marketplace-client';
62
+ export type { MetricsQuery, RunsQuery } from './observability-client';
63
+ export type { ValidateConditionBody } from './policy-client';
64
+ export type { CreatePresetBody, SavePresetVersionBody, ValidatePresetBody } from './presets-client';
65
+ export type {
66
+ StateAttachmentBody,
67
+ StateDeclarationBody,
68
+ StatePageQuery,
69
+ StateSubjectRef,
70
+ StateTemplateBody,
71
+ } from './states-client';
72
+ export type { StorageUploadBody } from './storage-client';
73
+ export type { ToolMetaPatch } from './tool-meta-client';
74
+ export type { RunToolArgs, ToolAdminArgs } from './tools-client';
75
+ export type { TriggerLinkCreateBody } from './trigger-links-client';
76
+ export type { WebEntryCodeMintBody } from './web-entry-gate-client';
77
+
78
+ export function createApiClient(config: ApiConfig) {
79
+ const t = makeTransport(config);
80
+ return {
81
+ baseUrl: config.baseUrl ?? '',
82
+ ...toolsClient(t),
83
+ ...presetsClient(t),
84
+ ...statesClient(t),
85
+ ...toolMetaClient(t),
86
+ ...storageClient(t),
87
+ ...backendClient(t),
88
+ ...toolExtensionsClient(t),
89
+ ...templatesClient(t),
90
+ ...manifestClient(t),
91
+ ...subMcpClient(t),
92
+ ...configClient(t),
93
+ ...profilesClient(t),
94
+ ...manifestSecretEnvClient(t),
95
+ ...connectorsClient(t),
96
+ ...pluginsClient(t),
97
+ ...interactionsClient(t),
98
+ ...channelsClient(t),
99
+ ...conversationsClient(t),
100
+ ...webEntryGateClient(t),
101
+ ...notificationsClient(t),
102
+ ...agentsClient(t),
103
+ ...hooksClient(t),
104
+ ...triggerLinksClient(t),
105
+ ...mcpConfigSchemaClient(t),
106
+ ...settingsSchemaClient(t),
107
+ ...authClient(t),
108
+ ...capabilitiesGetMe(t),
109
+ ...loginClient(t),
110
+ ...capabilitiesGetCaps(t),
111
+ ...logoutClient(t),
112
+ ...policyClient(t),
113
+ ...backupClient(t),
114
+ ...schedulesClient(t),
115
+ ...observabilityClient(t),
116
+ ...marketplaceClient(t),
117
+ ...systemClient(t),
118
+ ...interactionsStreamClient(t),
119
+ } as const;
120
+ }
121
+
122
+ export type ApiClient = ReturnType<typeof createApiClient>;
@@ -0,0 +1,89 @@
1
+ /** Interaction listing/answer and the SSE stream sub-clients. */
2
+ import { ApiError, ApiUnauthorizedError } from '../errors';
3
+ import { encodeSegment, extractError } from '../http';
4
+ import * as s from '../schemas';
5
+ import { readSseFrames, sseOpenToken } from '../sse';
6
+ import type { Transport } from './transport';
7
+
8
+ export function interactionsClient(t: Transport) {
9
+ const { req } = t;
10
+ return {
11
+ // One page of the pending interactions (the tail-only stream's paged base). The
12
+ // door filters by audience before paging — the SAME filter the stream applies —
13
+ // so `total` is the caller's own count, and every terminal frame it later receives
14
+ // refers to a question within that `total`.
15
+ listInteractions: (page: number, pageSize: number, signal?: AbortSignal) =>
16
+ req('/api/interactions', s.interactionsPage, { signal, query: { page, pageSize } }),
17
+ answerInteraction: (interactionId: string, answer: unknown) =>
18
+ req(`/api/interactions/${encodeSegment(interactionId)}/answer`, s.interactionAnswered, {
19
+ method: 'POST',
20
+ body: { answer },
21
+ }),
22
+ // Withdraw a pending ask WITHOUT answering it (a bodyless POST): the question is
23
+ // resolved as cancelled and the flow that asked never resumes. Terminal like an
24
+ // answer, so the loud failure mappings mirror it — a 409 (already answered, so no
25
+ // longer cancellable) surfaces as `ApiConflictError`, a 404 (unknown/already gone)
26
+ // and a 403 (not this caller's audience) as `ApiError` — all via the shared
27
+ // `apiRequest` status handling.
28
+ cancelInteraction: (interactionId: string) =>
29
+ req(`/api/interactions/${encodeSegment(interactionId)}/cancel`, s.interactionCancelled, {
30
+ method: 'POST',
31
+ }),
32
+ };
33
+ }
34
+
35
+ export function interactionsStreamClient(t: Transport) {
36
+ const { config } = t;
37
+ return {
38
+ /**
39
+ * Open the authed interactions SSE stream. The stream is TAIL-ONLY: its cursor
40
+ * is the stream tail at connect, so it carries no backlog and no
41
+ * `interaction.backlog_done` frame — the pending base comes from
42
+ * `listInteractions`. The caller drives reconnect and refetches that base on
43
+ * each (re)connect. Returns the raw frame iterator; the interactions feature
44
+ * maps frames to typed events.
45
+ *
46
+ * `lastEventId` (the id of the last frame the caller saw) is sent as the
47
+ * `Last-Event-ID` header so the server resumes AFTER it and replays any frame —
48
+ * including a card's `answered` — that landed during a disconnect gap. It is
49
+ * also sent as a `?last_event_id=` query param so a proxy that strips the header
50
+ * still resumes; the server reads either. Omitted on a first connect.
51
+ */
52
+ streamInteractions: async (signal?: AbortSignal, lastEventId?: string) => {
53
+ const doFetch = config.fetch ?? globalThis.fetch;
54
+ const token = config.getToken();
55
+ const headers: Record<string, string> = { accept: 'text/event-stream' };
56
+ if (token) headers['x-api-key'] = token;
57
+ if (lastEventId) headers['last-event-id'] = lastEventId;
58
+ // Distinct-URL per open — see the canonical constraint on `sseOpenToken`.
59
+ const resume = lastEventId ? `&last_event_id=${encodeURIComponent(lastEventId)}` : '';
60
+ const url = `${config.baseUrl ?? ''}/api/interactions/stream?_=${sseOpenToken()}${resume}`;
61
+ const response = await doFetch(url, {
62
+ headers,
63
+ signal,
64
+ });
65
+ if (response.status === 401) throw new ApiUnauthorizedError();
66
+ // A non-ok stream open (5xx/4xx) still carries a body, which would parse to
67
+ // zero frames and look like a silently-empty stream — surface it loudly so
68
+ // the caller shows an error instead of hanging on a reconnect loop. Read the
69
+ // `{ "error" }` envelope so a load-bearing server message (e.g. the OFF
70
+ // store's 501 remediation line) surfaces verbatim instead of collapsing to
71
+ // the bare status text.
72
+ if (!response.ok) {
73
+ let payload: unknown;
74
+ try {
75
+ payload = await response.json();
76
+ } catch {
77
+ throw new ApiError(response.statusText || 'stream failed', response.status);
78
+ }
79
+ const { message, code } = extractError(payload);
80
+ throw new ApiError(
81
+ message ?? (response.statusText || 'stream failed'),
82
+ response.status,
83
+ code,
84
+ );
85
+ }
86
+ return readSseFrames(response, signal);
87
+ },
88
+ };
89
+ }
@@ -0,0 +1,150 @@
1
+ /** Public sign-in aggregator and session-logout sub-clients. */
2
+ import {
3
+ ApiError,
4
+ ApiLoginFailedError,
5
+ ApiSetupFailedError,
6
+ ApiUnauthorizedError,
7
+ } from '../errors';
8
+ import * as s from '../schemas';
9
+ import type { Transport } from './transport';
10
+
11
+ /**
12
+ * Whether a login-method target is a safe same-origin relative API path. The
13
+ * login screen is the one page where a misconfigured/compromised manifest could
14
+ * redirect CREDENTIALS off-origin, so a `submit_path`/`href` MUST start `/api/`
15
+ * — anything else (absolute URL, protocol-relative `//host`, missing prefix) is
16
+ * rejected. The `/api/` prefix already excludes `//`-prefixed values; the
17
+ * explicit double-slash clause is kept for readability.
18
+ */
19
+ export function isSafeApiPath(path: string): boolean {
20
+ return path.startsWith('/api/') && !path.startsWith('//');
21
+ }
22
+
23
+ /**
24
+ * Map a transport error from a login submission onto an `ApiLoginFailedError`
25
+ * (rendered inline on the login page) or rethrow it unchanged (5xx, schema
26
+ * drift, network — the page's generic failure branch surfaces it loudly).
27
+ *
28
+ * A transport 401 arrives as `ApiUnauthorizedError` before any body is read, so
29
+ * its message is generic by construction; the domain 4xx statuses carry the
30
+ * server's informative envelope text (rate-limit, password-policy, or the claim
31
+ * exchange's uniform "unknown or already used" 404) straight through to the
32
+ * inline surface.
33
+ */
34
+ function asLoginError(error: unknown): never {
35
+ if (error instanceof ApiUnauthorizedError) {
36
+ throw new ApiLoginFailedError('Sign-in failed — check your credentials.', 401);
37
+ }
38
+ if (
39
+ error instanceof ApiError &&
40
+ (error.status === 400 ||
41
+ error.status === 403 ||
42
+ error.status === 404 ||
43
+ error.status === 409 ||
44
+ error.status === 422 ||
45
+ error.status === 429)
46
+ ) {
47
+ throw new ApiLoginFailedError(error.message, error.status);
48
+ }
49
+ throw error;
50
+ }
51
+
52
+ /**
53
+ * Map a transport error from the setup submission onto an `ApiSetupFailedError`
54
+ * (rendered inline on the setup entry, keyed on `status`) or rethrow it unchanged
55
+ * (schema drift, network, any other status — the generic failure branch surfaces
56
+ * it loudly). The mapped statuses are the setup door's own: 403/429 (a bad or
57
+ * throttled token — no oracle), 409 (already initialized), 501 (setup
58
+ * unsupported), and 400/422 (an invalid body).
59
+ */
60
+ function asSetupError(error: unknown): never {
61
+ if (
62
+ error instanceof ApiError &&
63
+ (error.status === 400 ||
64
+ error.status === 403 ||
65
+ error.status === 409 ||
66
+ error.status === 422 ||
67
+ error.status === 429 ||
68
+ error.status === 501)
69
+ ) {
70
+ throw new ApiSetupFailedError(error.message, error.status);
71
+ }
72
+ throw error;
73
+ }
74
+
75
+ export function loginClient(t: Transport) {
76
+ const { req } = t;
77
+ return {
78
+ // PUBLIC by design: `apiRequest` attaches `x-api-key` only when a token
79
+ // exists, so the unauthenticated call carries no auth header — no transport
80
+ // change needed.
81
+ getLoginMethods: (options?: { signal?: AbortSignal }) =>
82
+ req('/api/login/methods', s.loginMethods, { signal: options?.signal }),
83
+ // Submit a `form` method's field VALUES as a flat top-level JSON body (the
84
+ // server's request models take the declared field names top-level). `path`
85
+ // is re-checked with the same relative-`/api/` guard the renderer uses — an
86
+ // off-origin path is a PROGRAMMING error (loud `Error`), not a login failure.
87
+ // A refused credential becomes an inline `ApiLoginFailedError`.
88
+ submitLoginForm: async (path: string, values: Record<string, string>) => {
89
+ if (!isSafeApiPath(path)) {
90
+ throw new Error(
91
+ `login submit_path must be a relative /api/ path; received ${JSON.stringify(path)}`,
92
+ );
93
+ }
94
+ try {
95
+ return await req(path, s.loginResult, { method: 'POST', body: values });
96
+ } catch (error) {
97
+ return asLoginError(error);
98
+ }
99
+ },
100
+ // Exchange a one-time SSO hand-back code for a session (never a token in the
101
+ // URL). An expired/reused code is a login failure, surfaced inline.
102
+ exchangeSsoCode: async (code: string) => {
103
+ try {
104
+ return await req('/api/login/sso/exchange', s.loginResult, {
105
+ method: 'POST',
106
+ body: { code },
107
+ });
108
+ } catch (error) {
109
+ return asLoginError(error);
110
+ }
111
+ },
112
+ // Exchange a one-time claim token (read from the login URL fragment, never a
113
+ // query param) for a session. PUBLIC. The token is single-use and burns
114
+ // server-side; a used/unknown/expired token answers the uniform 404, which —
115
+ // like the SSO leg — maps to an inline `ApiLoginFailedError`, not a global
116
+ // unauthorized redirect. The caller latches the exchange so it fires once.
117
+ claimLogin: async (body: { token: string }) => {
118
+ try {
119
+ return await req('/api/login/claim', s.loginResult, { method: 'POST', body });
120
+ } catch (error) {
121
+ return asLoginError(error);
122
+ }
123
+ },
124
+ // Initialize the deployment: create the owner principal, mint the owner's
125
+ // first key (returned once), and optionally attach the owner's login. PUBLIC
126
+ // (anonymous — no credential exists yet). A refused/throttled token, an
127
+ // already-initialized deployment, an unsupported setup door, or an invalid
128
+ // body becomes an inline `ApiSetupFailedError`; any other failure rethrows
129
+ // loudly.
130
+ submitSetup: async (body: s.SetupBody) => {
131
+ try {
132
+ return await req('/api/setup', s.setupResult, { method: 'POST', body });
133
+ } catch (error) {
134
+ return asSetupError(error);
135
+ }
136
+ },
137
+ };
138
+ }
139
+
140
+ export function logoutClient(t: Transport) {
141
+ const { req } = t;
142
+ return {
143
+ // The single authed logout dispatcher — revokes the caller's accounts
144
+ // session server-side before the shell clears local state. A plain `sk-` key
145
+ // has nothing to revoke and answers 404 (surfaced as an `ApiError`, quiet at
146
+ // the call site); a 5xx/network failure is a real revoke failure the shell
147
+ // surfaces loudly.
148
+ logout: () => req('/api/auth/logout', s.logoutResult, { method: 'POST' }),
149
+ };
150
+ }
@@ -0,0 +1,118 @@
1
+ /** Manifest / MCP section, env-ref and config-reload sub-clients. */
2
+ import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
+ import type { Transport } from './transport';
5
+
6
+ /**
7
+ * Names to add to / remove from the manifest `api_tools` include and exclude
8
+ * lists (`POST /api/api-tools`). Each field is a bare name list; the server
9
+ * refuses a body whose four lists are all empty.
10
+ */
11
+ export interface ApiToolsListsBody {
12
+ readonly include_add?: string[];
13
+ readonly include_remove?: string[];
14
+ readonly exclude_add?: string[];
15
+ readonly exclude_remove?: string[];
16
+ }
17
+
18
+ /**
19
+ * Body for the combined env+manifest secret op (POST `/api/mcp-config/secret-env`).
20
+ * The server generates the env key from `value` (shaping the name from `key_hint`),
21
+ * then writes the env value and the literal `!ENV ${KEY}` manifest leaf at
22
+ * `manifest_pointer` atomically. `manifest_pointer`'s head segment MUST be `mcp`
23
+ * (the server refuses any other with a loud 400).
24
+ */
25
+ export interface SetMcpSecretEnvBody {
26
+ readonly value: string;
27
+ readonly key_hint: string;
28
+ readonly manifest_pointer: string;
29
+ }
30
+
31
+ export function manifestClient(t: Transport) {
32
+ const { req } = t;
33
+ return {
34
+ getManifest: (signal?: AbortSignal) => req('/api/manifest', s.manifestView, { signal }),
35
+ setMcpConfig: (mcp: unknown[]) =>
36
+ req('/api/mcp-config', s.reloadConfigResult, { method: 'POST', body: { mcp } }),
37
+ getMcpStatus: (signal?: AbortSignal) => req('/api/mcp-status', s.mcpStatus, { signal }),
38
+ reloadMcp: (title: string) =>
39
+ req(`/api/mcp-status/${encodeSegment(title)}/reload`, s.mcpReloadResult, {
40
+ method: 'POST',
41
+ }),
42
+
43
+ // Granular manifest-section entry edits — add/replace or remove ONE entry by
44
+ // title, leaving the rest of the section untouched (the surgical counterpart to
45
+ // the whole-section `setMcpConfig`). Each crosses the config pipeline and returns
46
+ // the shared apply-result (`status` + `env_keys` + fleet `fanout`). `replace` lets
47
+ // an entry whose title already exists swap in; without it a collision is refused.
48
+ addToolsEntries: (entries: readonly unknown[], replace = false) =>
49
+ req('/api/tools-config/entries', s.reloadConfigResult, {
50
+ method: 'POST',
51
+ body: { entries, replace },
52
+ }),
53
+ removeToolsEntry: (title: string) =>
54
+ req(`/api/tools-config/entries/${encodeSegment(title)}`, s.reloadConfigResult, {
55
+ method: 'DELETE',
56
+ }),
57
+ addAgentsEntries: (entries: readonly unknown[], replace = false) =>
58
+ req('/api/agents-config/entries', s.reloadConfigResult, {
59
+ method: 'POST',
60
+ body: { entries, replace },
61
+ }),
62
+ removeAgentsEntry: (title: string) =>
63
+ req(`/api/agents-config/entries/${encodeSegment(title)}`, s.reloadConfigResult, {
64
+ method: 'DELETE',
65
+ }),
66
+ // Edit the manifest `api_tools` include/exclude name lists by delta (add/remove
67
+ // names on either list). Absent fields default to empty; the server refuses a body
68
+ // whose four lists are all empty. Returns the shared apply-result.
69
+ updateApiTools: (body: ApiToolsListsBody) =>
70
+ req('/api/api-tools', s.reloadConfigResult, {
71
+ method: 'POST',
72
+ body: {
73
+ include_add: body.include_add ?? [],
74
+ include_remove: body.include_remove ?? [],
75
+ exclude_add: body.exclude_add ?? [],
76
+ exclude_remove: body.exclude_remove ?? [],
77
+ },
78
+ }),
79
+
80
+ // The MCP servers skipped by the viability check, plus their remediation ops. The
81
+ // LIST rides the fleet fan-out primitive (each worker's failed roster arrives as
82
+ // its own report payload; `failedMcpsFromReport` unions them). Reload-all re-probes
83
+ // every failed server; deregister detaches one server's tools by title. Each op
84
+ // returns the bare per-worker `fleetResult`.
85
+ listFailedMcps: (signal?: AbortSignal) =>
86
+ req('/api/mcp-status/failed', s.fleetResult, { signal }),
87
+ reloadFailedMcps: () =>
88
+ req('/api/mcp-status/reload-failed', s.fleetResult, {
89
+ method: 'POST',
90
+ body: { targets: null },
91
+ }),
92
+ deregisterMcp: (title: string) =>
93
+ req(`/api/mcp-status/${encodeSegment(title)}/deregister`, s.fleetResult, {
94
+ method: 'POST',
95
+ body: { targets: null },
96
+ }),
97
+ };
98
+ }
99
+
100
+ export function manifestSecretEnvClient(t: Transport) {
101
+ const { req } = t;
102
+ return {
103
+ // The SecretRefField server half: one atomic env-value + `!ENV` manifest
104
+ // write, returning the shared apply-result shape (reload + fleet fanout).
105
+ setMcpSecretEnv: (body: SetMcpSecretEnvBody) =>
106
+ req('/api/mcp-config/secret-env', s.reloadConfigResult, { method: 'POST', body }),
107
+ // The PRESERVED manifest (`!ENV` markers intact, no resolved secrets) — the
108
+ // connectors page's McpServersSection reads this so round-trips never inline
109
+ // resolved values.
110
+ getManifestPreserved: (signal?: AbortSignal) =>
111
+ req('/api/manifest/preserved', s.manifestView, { signal }),
112
+ // The manifest MCP section's `!ENV ${VAR[:default]}` marker refs — NAMES and
113
+ // set/unset BOOLEANS only, never values. Drives the McpServersSection env-refs
114
+ // checklist on the connectors page.
115
+ getMcpEnvRefs: (signal?: AbortSignal) =>
116
+ req('/api/manifest/mcp-env-refs', s.mcpEnvRefs, { signal }),
117
+ };
118
+ }
@@ -0,0 +1,122 @@
1
+ /** Marketplace search, install, update and advisory sub-client. */
2
+ import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
+ import type { Transport } from './transport';
5
+
6
+ /**
7
+ * The marketplace search filter (GET `/api/marketplace/search` query params).
8
+ * `tags` is sent as REPEATED `tags` params, one per value; `page` is supplied
9
+ * per-request by the infinite query, never from the URL. `tier`, `namespace`,
10
+ * `contract`, and `page_size` are accepted by the route but the v1 UI sends none
11
+ * of them (every v1 row is official/tai42; the page size stays the server
12
+ * default) — they exist for contract completeness.
13
+ */
14
+ export interface MarketplaceSearchQuery {
15
+ readonly q?: string;
16
+ readonly kind?: string;
17
+ readonly category?: string;
18
+ readonly tags?: string[];
19
+ readonly namespace?: string;
20
+ readonly tier?: string;
21
+ readonly contract?: string;
22
+ readonly sort?: 'downloads' | 'updated' | 'name' | 'relevance';
23
+ readonly page?: number;
24
+ readonly page_size?: number;
25
+ }
26
+
27
+ /**
28
+ * Body for installing / updating a plugin. `ref` is `namespace/name`.
29
+ *
30
+ * `env` / `secret_keys` satisfy an mcp-server entry's required `!ENV` markers in
31
+ * the same transaction that writes the entry: `env` supplies the values,
32
+ * `secret_keys` marks which land in the secret band. Both omitted for a plain
33
+ * install (no required markers).
34
+ *
35
+ * `route_mounts` maps a route-carrying item name to the base prefix its routes
36
+ * mount under (the default or the operator's remap); `accept_public_routes`
37
+ * explicitly consents to the routes served without authentication. Omitted for a
38
+ * plugin that registers no routes.
39
+ */
40
+ export interface MarketplaceInstallBody {
41
+ readonly ref: string;
42
+ readonly version?: string;
43
+ readonly env?: Record<string, string>;
44
+ readonly secret_keys?: string[];
45
+ readonly route_mounts?: Record<string, string>;
46
+ readonly accept_public_routes?: boolean;
47
+ }
48
+
49
+ /**
50
+ * Body for previewing an install / update (`POST /api/marketplace/install/preview`):
51
+ * resolves the spec and computes the routes, collisions, and public rows WITHOUT
52
+ * side effects. `route_mounts` applies base overrides so the operator sees the
53
+ * effect of a remap before committing.
54
+ */
55
+ export interface MarketplaceInstallPreviewBody {
56
+ readonly ref: string;
57
+ readonly version?: string;
58
+ readonly route_mounts?: Record<string, string>;
59
+ }
60
+
61
+ /** Body for uninstalling a plugin. */
62
+ export interface MarketplaceUninstallBody {
63
+ readonly ref: string;
64
+ }
65
+
66
+ export function marketplaceClient(t: Transport) {
67
+ const { req } = t;
68
+ return {
69
+ // Browse/search proxy the registry through the app (one origin, one auth);
70
+ // install/uninstall/update mutate the RUNNING app (pip install + manifest
71
+ // patch + reload) and return synchronous receipts.
72
+ searchMarketplace: (query: MarketplaceSearchQuery = {}, signal?: AbortSignal) =>
73
+ req('/api/marketplace/search', s.marketplaceSearchPage, {
74
+ query: {
75
+ q: query.q,
76
+ kind: query.kind,
77
+ category: query.category,
78
+ tags: query.tags,
79
+ namespace: query.namespace,
80
+ tier: query.tier,
81
+ contract: query.contract,
82
+ sort: query.sort,
83
+ page: query.page,
84
+ page_size: query.page_size,
85
+ },
86
+ signal,
87
+ }),
88
+ getMarketplacePlugin: (namespace: string, name: string, signal?: AbortSignal) =>
89
+ req(
90
+ `/api/marketplace/plugins/${encodeSegment(namespace)}/${encodeSegment(name)}`,
91
+ s.marketplacePluginDetail,
92
+ { signal },
93
+ ),
94
+ listMarketplaceCategories: (signal?: AbortSignal) =>
95
+ req('/api/marketplace/categories', s.marketplaceCategories, { signal }),
96
+ listMarketplaceKinds: (signal?: AbortSignal) =>
97
+ req('/api/marketplace/kinds', s.marketplaceKinds, { signal }),
98
+ listInstalledMarketplacePlugins: (signal?: AbortSignal) =>
99
+ req('/api/marketplace/installed', s.marketplaceInstalled, { signal }),
100
+ // Preview resolves the spec and computes routes/collisions/public rows with
101
+ // NO side effects, so the install dialog can show absolute paths, block on a
102
+ // collision, and surface the public routes before the operator commits.
103
+ previewMarketplaceInstall: (body: MarketplaceInstallPreviewBody, signal?: AbortSignal) =>
104
+ req('/api/marketplace/install/preview', s.marketplaceInstallPreview, {
105
+ method: 'POST',
106
+ body,
107
+ signal,
108
+ }),
109
+ installMarketplacePlugin: (body: MarketplaceInstallBody) =>
110
+ req('/api/marketplace/install', s.marketplaceInstallResult, { method: 'POST', body }),
111
+ uninstallMarketplacePlugin: (body: MarketplaceUninstallBody) =>
112
+ req('/api/marketplace/uninstall', s.marketplaceUninstallResult, { method: 'POST', body }),
113
+ updateMarketplacePlugin: (body: MarketplaceInstallBody) =>
114
+ req('/api/marketplace/update', s.marketplaceInstallResult, { method: 'POST', body }),
115
+ // Upgrade EVERY installed plugin to its newest compatible version in one
116
+ // pass; the response is the per-plugin outcome readout.
117
+ upgradeAllMarketplacePlugins: () =>
118
+ req('/api/marketplace/upgrade-all', s.marketplaceUpgradeAllResult, { method: 'POST' }),
119
+ getMarketplaceAdvisories: (signal?: AbortSignal) =>
120
+ req('/api/marketplace/advisories', s.marketplaceAdvisories, { signal }),
121
+ };
122
+ }
@@ -0,0 +1,11 @@
1
+ /** MCP config-schema read sub-client. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function mcpConfigSchemaClient(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ getMcpConfigSchema: (signal?: AbortSignal) =>
9
+ req('/api/mcp-config/schema', s.jsonSchema, { signal }),
10
+ };
11
+ }
@@ -0,0 +1,13 @@
1
+ /** Notification-sink listing sub-client. */
2
+ import * as s from '../schemas';
3
+ import type { Transport } from './transport';
4
+
5
+ export function notificationsClient(t: Transport) {
6
+ const { req } = t;
7
+ return {
8
+ // The internal notifications sink, newest-first — the messages the `notify_user`
9
+ // operation records with no channel, so they surface only in this inbox.
10
+ listNotifications: (signal?: AbortSignal) =>
11
+ req('/api/notifications', s.notifications, { signal }),
12
+ };
13
+ }