@ggui-ai/mcp-server-handlers 0.1.0-rc.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 (339) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +32 -0
  3. package/dist/app-discovery/errors.d.ts +23 -0
  4. package/dist/app-discovery/errors.d.ts.map +1 -0
  5. package/dist/app-discovery/errors.js +26 -0
  6. package/dist/app-discovery/index.d.ts +19 -0
  7. package/dist/app-discovery/index.d.ts.map +1 -0
  8. package/dist/app-discovery/index.js +18 -0
  9. package/dist/app-discovery/list-gadgets.d.ts +93 -0
  10. package/dist/app-discovery/list-gadgets.d.ts.map +1 -0
  11. package/dist/app-discovery/list-gadgets.js +93 -0
  12. package/dist/app-discovery/list-themes.d.ts +70 -0
  13. package/dist/app-discovery/list-themes.d.ts.map +1 -0
  14. package/dist/app-discovery/list-themes.js +80 -0
  15. package/dist/blueprints/describe-blueprint-format.d.ts +25 -0
  16. package/dist/blueprints/describe-blueprint-format.d.ts.map +1 -0
  17. package/dist/blueprints/describe-blueprint-format.js +138 -0
  18. package/dist/blueprints/describe-data-contract-format.d.ts +31 -0
  19. package/dist/blueprints/describe-data-contract-format.d.ts.map +1 -0
  20. package/dist/blueprints/describe-data-contract-format.js +292 -0
  21. package/dist/blueprints/get-blueprint-boilerplate.d.ts +45 -0
  22. package/dist/blueprints/get-blueprint-boilerplate.d.ts.map +1 -0
  23. package/dist/blueprints/get-blueprint-boilerplate.js +57 -0
  24. package/dist/blueprints/get-example-blueprints.d.ts +67 -0
  25. package/dist/blueprints/get-example-blueprints.d.ts.map +1 -0
  26. package/dist/blueprints/get-example-blueprints.js +315 -0
  27. package/dist/blueprints/index.d.ts +38 -0
  28. package/dist/blueprints/index.d.ts.map +1 -0
  29. package/dist/blueprints/index.js +34 -0
  30. package/dist/blueprints/list-available-primitives.d.ts +31 -0
  31. package/dist/blueprints/list-available-primitives.d.ts.map +1 -0
  32. package/dist/blueprints/list-available-primitives.js +44 -0
  33. package/dist/blueprints/list-featured-blueprints.d.ts +45 -0
  34. package/dist/blueprints/list-featured-blueprints.d.ts.map +1 -0
  35. package/dist/blueprints/list-featured-blueprints.js +47 -0
  36. package/dist/blueprints/render-blueprint.d.ts +80 -0
  37. package/dist/blueprints/render-blueprint.d.ts.map +1 -0
  38. package/dist/blueprints/render-blueprint.js +129 -0
  39. package/dist/blueprints/search-blueprints.d.ts +103 -0
  40. package/dist/blueprints/search-blueprints.d.ts.map +1 -0
  41. package/dist/blueprints/search-blueprints.js +225 -0
  42. package/dist/blueprints/validate-blueprint.d.ts +56 -0
  43. package/dist/blueprints/validate-blueprint.d.ts.map +1 -0
  44. package/dist/blueprints/validate-blueprint.js +69 -0
  45. package/dist/contract-tests/index.d.ts +20 -0
  46. package/dist/contract-tests/index.d.ts.map +1 -0
  47. package/dist/contract-tests/index.js +19 -0
  48. package/dist/contract-tests/push-handler.contract.d.ts +31 -0
  49. package/dist/contract-tests/push-handler.contract.d.ts.map +1 -0
  50. package/dist/contract-tests/push-handler.contract.js +378 -0
  51. package/dist/credits/get-credit-balance.d.ts +70 -0
  52. package/dist/credits/get-credit-balance.d.ts.map +1 -0
  53. package/dist/credits/get-credit-balance.js +69 -0
  54. package/dist/credits/index.d.ts +30 -0
  55. package/dist/credits/index.d.ts.map +1 -0
  56. package/dist/credits/index.js +27 -0
  57. package/dist/credits/list-credit-transactions.d.ts +79 -0
  58. package/dist/credits/list-credit-transactions.d.ts.map +1 -0
  59. package/dist/credits/list-credit-transactions.js +67 -0
  60. package/dist/index.d.ts +28 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +43 -0
  63. package/dist/ops-apps/create-app.d.ts +40 -0
  64. package/dist/ops-apps/create-app.d.ts.map +1 -0
  65. package/dist/ops-apps/create-app.js +60 -0
  66. package/dist/ops-apps/delete-app.d.ts +35 -0
  67. package/dist/ops-apps/delete-app.d.ts.map +1 -0
  68. package/dist/ops-apps/delete-app.js +55 -0
  69. package/dist/ops-apps/identity.d.ts +18 -0
  70. package/dist/ops-apps/identity.d.ts.map +1 -0
  71. package/dist/ops-apps/identity.js +13 -0
  72. package/dist/ops-apps/in-memory-fake.test-util.d.ts +48 -0
  73. package/dist/ops-apps/in-memory-fake.test-util.d.ts.map +1 -0
  74. package/dist/ops-apps/in-memory-fake.test-util.js +90 -0
  75. package/dist/ops-apps/index.d.ts +31 -0
  76. package/dist/ops-apps/index.d.ts.map +1 -0
  77. package/dist/ops-apps/index.js +23 -0
  78. package/dist/ops-apps/list-apps.d.ts +35 -0
  79. package/dist/ops-apps/list-apps.d.ts.map +1 -0
  80. package/dist/ops-apps/list-apps.js +40 -0
  81. package/dist/ops-apps/rename-app.d.ts +45 -0
  82. package/dist/ops-apps/rename-app.d.ts.map +1 -0
  83. package/dist/ops-apps/rename-app.js +76 -0
  84. package/dist/ops-apps/set-default-app.d.ts +32 -0
  85. package/dist/ops-apps/set-default-app.d.ts.map +1 -0
  86. package/dist/ops-apps/set-default-app.js +51 -0
  87. package/dist/ops-apps/types.d.ts +112 -0
  88. package/dist/ops-apps/types.d.ts.map +1 -0
  89. package/dist/ops-apps/types.js +27 -0
  90. package/dist/ops-apps/update-app-system-prompt.d.ts +41 -0
  91. package/dist/ops-apps/update-app-system-prompt.d.ts.map +1 -0
  92. package/dist/ops-apps/update-app-system-prompt.js +69 -0
  93. package/dist/ops-blueprint/delete.d.ts +39 -0
  94. package/dist/ops-blueprint/delete.d.ts.map +1 -0
  95. package/dist/ops-blueprint/delete.js +56 -0
  96. package/dist/ops-blueprint/errors.d.ts +55 -0
  97. package/dist/ops-blueprint/errors.d.ts.map +1 -0
  98. package/dist/ops-blueprint/errors.js +65 -0
  99. package/dist/ops-blueprint/generate.d.ts +173 -0
  100. package/dist/ops-blueprint/generate.d.ts.map +1 -0
  101. package/dist/ops-blueprint/generate.js +322 -0
  102. package/dist/ops-blueprint/index.d.ts +26 -0
  103. package/dist/ops-blueprint/index.d.ts.map +1 -0
  104. package/dist/ops-blueprint/index.js +25 -0
  105. package/dist/ops-blueprint/list.d.ts +65 -0
  106. package/dist/ops-blueprint/list.d.ts.map +1 -0
  107. package/dist/ops-blueprint/list.js +121 -0
  108. package/dist/ops-blueprint/persona-normalization.d.ts +85 -0
  109. package/dist/ops-blueprint/persona-normalization.d.ts.map +1 -0
  110. package/dist/ops-blueprint/persona-normalization.js +134 -0
  111. package/dist/ops-blueprint/register.d.ts +126 -0
  112. package/dist/ops-blueprint/register.d.ts.map +1 -0
  113. package/dist/ops-blueprint/register.js +227 -0
  114. package/dist/ops-blueprint/update.d.ts +61 -0
  115. package/dist/ops-blueprint/update.d.ts.map +1 -0
  116. package/dist/ops-blueprint/update.js +138 -0
  117. package/dist/ops-connector-keys/in-memory-fake.test-util.d.ts +26 -0
  118. package/dist/ops-connector-keys/in-memory-fake.test-util.d.ts.map +1 -0
  119. package/dist/ops-connector-keys/in-memory-fake.test-util.js +60 -0
  120. package/dist/ops-connector-keys/index.d.ts +19 -0
  121. package/dist/ops-connector-keys/index.d.ts.map +1 -0
  122. package/dist/ops-connector-keys/index.js +14 -0
  123. package/dist/ops-connector-keys/issue-connector-key.d.ts +57 -0
  124. package/dist/ops-connector-keys/issue-connector-key.d.ts.map +1 -0
  125. package/dist/ops-connector-keys/issue-connector-key.js +83 -0
  126. package/dist/ops-connector-keys/list-connector-keys.d.ts +35 -0
  127. package/dist/ops-connector-keys/list-connector-keys.d.ts.map +1 -0
  128. package/dist/ops-connector-keys/list-connector-keys.js +37 -0
  129. package/dist/ops-connector-keys/revoke-connector-key.d.ts +36 -0
  130. package/dist/ops-connector-keys/revoke-connector-key.d.ts.map +1 -0
  131. package/dist/ops-connector-keys/revoke-connector-key.js +48 -0
  132. package/dist/ops-connector-keys/types.d.ts +85 -0
  133. package/dist/ops-connector-keys/types.d.ts.map +1 -0
  134. package/dist/ops-connector-keys/types.js +24 -0
  135. package/dist/ops-coupon/in-memory-fake.test-util.d.ts +28 -0
  136. package/dist/ops-coupon/in-memory-fake.test-util.d.ts.map +1 -0
  137. package/dist/ops-coupon/in-memory-fake.test-util.js +66 -0
  138. package/dist/ops-coupon/index.d.ts +15 -0
  139. package/dist/ops-coupon/index.d.ts.map +1 -0
  140. package/dist/ops-coupon/index.js +12 -0
  141. package/dist/ops-coupon/redeem-coupon.d.ts +42 -0
  142. package/dist/ops-coupon/redeem-coupon.d.ts.map +1 -0
  143. package/dist/ops-coupon/redeem-coupon.js +60 -0
  144. package/dist/ops-coupon/types.d.ts +59 -0
  145. package/dist/ops-coupon/types.d.ts.map +1 -0
  146. package/dist/ops-coupon/types.js +38 -0
  147. package/dist/ops-orgs/create-org.d.ts +39 -0
  148. package/dist/ops-orgs/create-org.d.ts.map +1 -0
  149. package/dist/ops-orgs/create-org.js +54 -0
  150. package/dist/ops-orgs/in-memory-fake.test-util.d.ts +59 -0
  151. package/dist/ops-orgs/in-memory-fake.test-util.d.ts.map +1 -0
  152. package/dist/ops-orgs/in-memory-fake.test-util.js +129 -0
  153. package/dist/ops-orgs/index.d.ts +24 -0
  154. package/dist/ops-orgs/index.d.ts.map +1 -0
  155. package/dist/ops-orgs/index.js +18 -0
  156. package/dist/ops-orgs/invite-to-org.d.ts +60 -0
  157. package/dist/ops-orgs/invite-to-org.d.ts.map +1 -0
  158. package/dist/ops-orgs/invite-to-org.js +71 -0
  159. package/dist/ops-orgs/list-orgs.d.ts +35 -0
  160. package/dist/ops-orgs/list-orgs.d.ts.map +1 -0
  161. package/dist/ops-orgs/list-orgs.js +36 -0
  162. package/dist/ops-orgs/revoke-invite.d.ts +42 -0
  163. package/dist/ops-orgs/revoke-invite.d.ts.map +1 -0
  164. package/dist/ops-orgs/revoke-invite.js +52 -0
  165. package/dist/ops-orgs/types.d.ts +116 -0
  166. package/dist/ops-orgs/types.d.ts.map +1 -0
  167. package/dist/ops-orgs/types.js +22 -0
  168. package/dist/provider-keys/index.d.ts +20 -0
  169. package/dist/provider-keys/index.d.ts.map +1 -0
  170. package/dist/provider-keys/index.js +15 -0
  171. package/dist/provider-keys/list-provider-keys.d.ts +42 -0
  172. package/dist/provider-keys/list-provider-keys.d.ts.map +1 -0
  173. package/dist/provider-keys/list-provider-keys.js +46 -0
  174. package/dist/provider-keys/remove-provider-key.d.ts +34 -0
  175. package/dist/provider-keys/remove-provider-key.d.ts.map +1 -0
  176. package/dist/provider-keys/remove-provider-key.js +47 -0
  177. package/dist/provider-keys/set-provider-key.d.ts +46 -0
  178. package/dist/provider-keys/set-provider-key.d.ts.map +1 -0
  179. package/dist/provider-keys/set-provider-key.js +68 -0
  180. package/dist/provider-keys/types.d.ts +66 -0
  181. package/dist/provider-keys/types.d.ts.map +1 -0
  182. package/dist/provider-keys/types.js +20 -0
  183. package/dist/session-mutations/apply-stack-item-patch.d.ts +79 -0
  184. package/dist/session-mutations/apply-stack-item-patch.d.ts.map +1 -0
  185. package/dist/session-mutations/apply-stack-item-patch.js +74 -0
  186. package/dist/session-mutations/assert-action-contract.d.ts +20 -0
  187. package/dist/session-mutations/assert-action-contract.d.ts.map +1 -0
  188. package/dist/session-mutations/assert-action-contract.js +29 -0
  189. package/dist/session-mutations/assert-contract-no-retired-fields.d.ts +31 -0
  190. package/dist/session-mutations/assert-contract-no-retired-fields.d.ts.map +1 -0
  191. package/dist/session-mutations/assert-contract-no-retired-fields.js +47 -0
  192. package/dist/session-mutations/assert-event-allowed.d.ts +29 -0
  193. package/dist/session-mutations/assert-event-allowed.d.ts.map +1 -0
  194. package/dist/session-mutations/assert-event-allowed.js +34 -0
  195. package/dist/session-mutations/assert-gadgets.d.ts +164 -0
  196. package/dist/session-mutations/assert-gadgets.d.ts.map +1 -0
  197. package/dist/session-mutations/assert-gadgets.js +245 -0
  198. package/dist/session-mutations/assert-generator.d.ts +35 -0
  199. package/dist/session-mutations/assert-generator.d.ts.map +1 -0
  200. package/dist/session-mutations/assert-generator.js +43 -0
  201. package/dist/session-mutations/assert-no-duplicate-gadget-hooks.d.ts +43 -0
  202. package/dist/session-mutations/assert-no-duplicate-gadget-hooks.d.ts.map +1 -0
  203. package/dist/session-mutations/assert-no-duplicate-gadget-hooks.js +57 -0
  204. package/dist/session-mutations/assert-props-contract.d.ts +19 -0
  205. package/dist/session-mutations/assert-props-contract.d.ts.map +1 -0
  206. package/dist/session-mutations/assert-props-contract.js +28 -0
  207. package/dist/session-mutations/assert-public-env.d.ts +100 -0
  208. package/dist/session-mutations/assert-public-env.d.ts.map +1 -0
  209. package/dist/session-mutations/assert-public-env.js +145 -0
  210. package/dist/session-mutations/assert-stream-contract.d.ts +27 -0
  211. package/dist/session-mutations/assert-stream-contract.d.ts.map +1 -0
  212. package/dist/session-mutations/assert-stream-contract.js +52 -0
  213. package/dist/session-mutations/blueprint-matcher.d.ts +124 -0
  214. package/dist/session-mutations/blueprint-matcher.d.ts.map +1 -0
  215. package/dist/session-mutations/blueprint-matcher.js +277 -0
  216. package/dist/session-mutations/blueprint-registry.d.ts +286 -0
  217. package/dist/session-mutations/blueprint-registry.d.ts.map +1 -0
  218. package/dist/session-mutations/blueprint-registry.js +425 -0
  219. package/dist/session-mutations/bootstrap-meta-derivation.d.ts +429 -0
  220. package/dist/session-mutations/bootstrap-meta-derivation.d.ts.map +1 -0
  221. package/dist/session-mutations/bootstrap-meta-derivation.js +657 -0
  222. package/dist/session-mutations/cache-trace-sink.d.ts +326 -0
  223. package/dist/session-mutations/cache-trace-sink.d.ts.map +1 -0
  224. package/dist/session-mutations/cache-trace-sink.js +92 -0
  225. package/dist/session-mutations/canvas-lifecycle.d.ts +33 -0
  226. package/dist/session-mutations/canvas-lifecycle.d.ts.map +1 -0
  227. package/dist/session-mutations/canvas-lifecycle.js +20 -0
  228. package/dist/session-mutations/client-observations.d.ts +79 -0
  229. package/dist/session-mutations/client-observations.d.ts.map +1 -0
  230. package/dist/session-mutations/client-observations.js +48 -0
  231. package/dist/session-mutations/close.d.ts +70 -0
  232. package/dist/session-mutations/close.d.ts.map +1 -0
  233. package/dist/session-mutations/close.js +127 -0
  234. package/dist/session-mutations/consume.d.ts +183 -0
  235. package/dist/session-mutations/consume.d.ts.map +1 -0
  236. package/dist/session-mutations/consume.js +302 -0
  237. package/dist/session-mutations/errors.d.ts +180 -0
  238. package/dist/session-mutations/errors.d.ts.map +1 -0
  239. package/dist/session-mutations/errors.js +187 -0
  240. package/dist/session-mutations/fetch-gadget-types.d.ts +60 -0
  241. package/dist/session-mutations/fetch-gadget-types.d.ts.map +1 -0
  242. package/dist/session-mutations/fetch-gadget-types.js +119 -0
  243. package/dist/session-mutations/generation-cache.d.ts +147 -0
  244. package/dist/session-mutations/generation-cache.d.ts.map +1 -0
  245. package/dist/session-mutations/generation-cache.js +151 -0
  246. package/dist/session-mutations/get-session.d.ts +71 -0
  247. package/dist/session-mutations/get-session.d.ts.map +1 -0
  248. package/dist/session-mutations/get-session.js +153 -0
  249. package/dist/session-mutations/get-stack.d.ts +32 -0
  250. package/dist/session-mutations/get-stack.d.ts.map +1 -0
  251. package/dist/session-mutations/get-stack.js +85 -0
  252. package/dist/session-mutations/handle-stream.d.ts +121 -0
  253. package/dist/session-mutations/handle-stream.d.ts.map +1 -0
  254. package/dist/session-mutations/handle-stream.js +67 -0
  255. package/dist/session-mutations/handshake.d.ts +464 -0
  256. package/dist/session-mutations/handshake.d.ts.map +1 -0
  257. package/dist/session-mutations/handshake.js +550 -0
  258. package/dist/session-mutations/index.d.ts +85 -0
  259. package/dist/session-mutations/index.d.ts.map +1 -0
  260. package/dist/session-mutations/index.js +93 -0
  261. package/dist/session-mutations/install-to-cache.d.ts +114 -0
  262. package/dist/session-mutations/install-to-cache.d.ts.map +1 -0
  263. package/dist/session-mutations/install-to-cache.js +87 -0
  264. package/dist/session-mutations/installed-blueprints-provider.d.ts +151 -0
  265. package/dist/session-mutations/installed-blueprints-provider.d.ts.map +1 -0
  266. package/dist/session-mutations/installed-blueprints-provider.js +0 -0
  267. package/dist/session-mutations/new-session.d.ts +108 -0
  268. package/dist/session-mutations/new-session.d.ts.map +1 -0
  269. package/dist/session-mutations/new-session.js +248 -0
  270. package/dist/session-mutations/no-credentials-card.d.ts +45 -0
  271. package/dist/session-mutations/no-credentials-card.d.ts.map +1 -0
  272. package/dist/session-mutations/no-credentials-card.js +30 -0
  273. package/dist/session-mutations/payload-trace-sink.d.ts +105 -0
  274. package/dist/session-mutations/payload-trace-sink.d.ts.map +1 -0
  275. package/dist/session-mutations/payload-trace-sink.js +97 -0
  276. package/dist/session-mutations/pop.d.ts +41 -0
  277. package/dist/session-mutations/pop.d.ts.map +1 -0
  278. package/dist/session-mutations/pop.js +62 -0
  279. package/dist/session-mutations/provisional-preview.d.ts +443 -0
  280. package/dist/session-mutations/provisional-preview.d.ts.map +1 -0
  281. package/dist/session-mutations/provisional-preview.js +369 -0
  282. package/dist/session-mutations/push.d.ts +839 -0
  283. package/dist/session-mutations/push.d.ts.map +1 -0
  284. package/dist/session-mutations/push.js +1908 -0
  285. package/dist/session-mutations/refresh-bootstrap.d.ts +133 -0
  286. package/dist/session-mutations/refresh-bootstrap.d.ts.map +1 -0
  287. package/dist/session-mutations/refresh-bootstrap.js +148 -0
  288. package/dist/session-mutations/stream-replay-ops.d.ts +240 -0
  289. package/dist/session-mutations/stream-replay-ops.d.ts.map +1 -0
  290. package/dist/session-mutations/stream-replay-ops.js +273 -0
  291. package/dist/session-mutations/stream.d.ts +57 -0
  292. package/dist/session-mutations/stream.d.ts.map +1 -0
  293. package/dist/session-mutations/stream.js +80 -0
  294. package/dist/session-mutations/submit-action.d.ts +155 -0
  295. package/dist/session-mutations/submit-action.d.ts.map +1 -0
  296. package/dist/session-mutations/submit-action.js +273 -0
  297. package/dist/session-mutations/sync-context.d.ts +90 -0
  298. package/dist/session-mutations/sync-context.d.ts.map +1 -0
  299. package/dist/session-mutations/sync-context.js +273 -0
  300. package/dist/session-mutations/update.d.ts +267 -0
  301. package/dist/session-mutations/update.d.ts.map +1 -0
  302. package/dist/session-mutations/update.js +397 -0
  303. package/dist/threads/append-message.d.ts +26 -0
  304. package/dist/threads/append-message.d.ts.map +1 -0
  305. package/dist/threads/append-message.js +5 -0
  306. package/dist/threads/apply-thread-action.d.ts +36 -0
  307. package/dist/threads/apply-thread-action.d.ts.map +1 -0
  308. package/dist/threads/apply-thread-action.js +5 -0
  309. package/dist/threads/context.d.ts +25 -0
  310. package/dist/threads/context.d.ts.map +1 -0
  311. package/dist/threads/context.js +1 -0
  312. package/dist/threads/create-thread.d.ts +19 -0
  313. package/dist/threads/create-thread.d.ts.map +1 -0
  314. package/dist/threads/create-thread.js +5 -0
  315. package/dist/threads/errors.d.ts +38 -0
  316. package/dist/threads/errors.d.ts.map +1 -0
  317. package/dist/threads/errors.js +41 -0
  318. package/dist/threads/get-thread.d.ts +23 -0
  319. package/dist/threads/get-thread.d.ts.map +1 -0
  320. package/dist/threads/get-thread.js +7 -0
  321. package/dist/threads/index.d.ts +34 -0
  322. package/dist/threads/index.d.ts.map +1 -0
  323. package/dist/threads/index.js +25 -0
  324. package/dist/threads/list-messages.d.ts +25 -0
  325. package/dist/threads/list-messages.d.ts.map +1 -0
  326. package/dist/threads/list-messages.js +5 -0
  327. package/dist/threads/list-threads.d.ts +18 -0
  328. package/dist/threads/list-threads.d.ts.map +1 -0
  329. package/dist/threads/list-threads.js +5 -0
  330. package/dist/threads/observe-messages.d.ts +31 -0
  331. package/dist/threads/observe-messages.d.ts.map +1 -0
  332. package/dist/threads/observe-messages.js +5 -0
  333. package/dist/threads/schemas.d.ts +73 -0
  334. package/dist/threads/schemas.d.ts.map +1 -0
  335. package/dist/threads/schemas.js +86 -0
  336. package/dist/types.d.ts +244 -0
  337. package/dist/types.d.ts.map +1 -0
  338. package/dist/types.js +24 -0
  339. package/package.json +121 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Loqu, Inc. (Guuey)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @ggui-ai/mcp-server-handlers
2
+
3
+ MCP tool handler logic for the **ggui protocol**.
4
+
5
+ This package implements the actual behavior behind every ggui MCP tool — session
6
+ lifecycle, the contract handshake, UI push, blueprint management, threads, app
7
+ discovery, and the operator (`ggui_ops_*`) tools. The handlers are written purely
8
+ over the seam interfaces in
9
+ [`@ggui-ai/mcp-server-core`](https://www.npmjs.com/package/@ggui-ai/mcp-server-core),
10
+ so they never import AWS, HTTP transports, or CLI concerns — the host supplies the
11
+ storage backends and transport.
12
+
13
+ [`@ggui-ai/mcp-server`](https://www.npmjs.com/package/@ggui-ai/mcp-server) runs
14
+ these handlers with in-memory adapters by default. Other hosts bind the same
15
+ handlers to their own context and storage.
16
+
17
+ ## Audience routes
18
+
19
+ Every handler carries an `audience` tag (`agent`, `runtime`, `protocol`, or `ops`)
20
+ that determines which route it surfaces on and its wire-name prefix —
21
+ `ggui_*` / `ggui_runtime_*` / `ggui_protocol_*` / `ggui_ops_*`.
22
+
23
+ ## Subpath exports
24
+
25
+ Handler families are also available behind subpath exports — for example
26
+ `@ggui-ai/mcp-server-handlers/blueprints`, `/session-mutations`, `/threads`,
27
+ `/credits`, `/app-discovery`, and the `/ops-*` families — so consumers can import
28
+ exactly the family they need.
29
+
30
+ ## License
31
+
32
+ Apache-2.0
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Typed errors thrown by app-discovery handlers.
3
+ *
4
+ * Lives alongside the handlers (not in `@ggui-ai/protocol`) for the
5
+ * same reason `session-mutations/errors.ts` does — these are
6
+ * handler-flow diagnostics, not contract-shape violations.
7
+ */
8
+ /**
9
+ * Thrown by `ggui_list_gadgets` (and any future tenant-
10
+ * scoped app-discovery tool) when the caller supplies an explicit
11
+ * `appId` that does NOT match `ctx.appId` resolved by the upstream
12
+ * auth adapter. Cross-tenant probes get a uniform error so the
13
+ * existence of an alternate `appId` is not leaked.
14
+ *
15
+ * Recovery: omit `appId` to default to `ctx.appId`, or call from a
16
+ * deployment where the caller's identity resolves to the requested
17
+ * app.
18
+ */
19
+ export declare class AppAccessDeniedError extends Error {
20
+ readonly code: "app_access_denied";
21
+ constructor(message?: string);
22
+ }
23
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/app-discovery/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAG,mBAAmB,CAAU;gBACjC,OAAO,CAAC,EAAE,MAAM;CAO7B"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Typed errors thrown by app-discovery handlers.
3
+ *
4
+ * Lives alongside the handlers (not in `@ggui-ai/protocol`) for the
5
+ * same reason `session-mutations/errors.ts` does — these are
6
+ * handler-flow diagnostics, not contract-shape violations.
7
+ */
8
+ /**
9
+ * Thrown by `ggui_list_gadgets` (and any future tenant-
10
+ * scoped app-discovery tool) when the caller supplies an explicit
11
+ * `appId` that does NOT match `ctx.appId` resolved by the upstream
12
+ * auth adapter. Cross-tenant probes get a uniform error so the
13
+ * existence of an alternate `appId` is not leaked.
14
+ *
15
+ * Recovery: omit `appId` to default to `ctx.appId`, or call from a
16
+ * deployment where the caller's identity resolves to the requested
17
+ * app.
18
+ */
19
+ export class AppAccessDeniedError extends Error {
20
+ code = 'app_access_denied';
21
+ constructor(message) {
22
+ super(message ??
23
+ 'app_access_denied: the supplied appId does not match the caller identity. Omit the appId field to default to the caller-resolved app, or invoke from a deployment whose auth resolves to the requested app.');
24
+ this.name = 'AppAccessDeniedError';
25
+ }
26
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * App-discovery handler family — per-app metadata lookups.
3
+ *
4
+ * This subpath holds tools that surface runtime, per-app state (vs.
5
+ * the static spec/discovery `ggui_protocol_*` family in
6
+ * `blueprints/`).
7
+ *
8
+ * - `createGguiListGadgetsHandler` — `ggui_list_gadgets`
9
+ * returns the app's `gadgets` catalog (stdlib seed by
10
+ * default).
11
+ *
12
+ * Future additions land here when they read per-app data scoped to
13
+ * `ctx.appId` (per-app adapter grants, per-app permission scopes,
14
+ * etc.).
15
+ */
16
+ export { createGguiListGadgetsHandler, type GguiListGadgetsHandlerDeps, type GguiListGadgetsOutput, } from './list-gadgets.js';
17
+ export { createGguiListThemesHandler, type GguiListThemesHandlerDeps, type GguiListThemesOutput, type ThemeCatalogEntry, } from './list-themes.js';
18
+ export { AppAccessDeniedError } from './errors.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app-discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,4BAA4B,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,2BAA2B,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * App-discovery handler family — per-app metadata lookups.
3
+ *
4
+ * This subpath holds tools that surface runtime, per-app state (vs.
5
+ * the static spec/discovery `ggui_protocol_*` family in
6
+ * `blueprints/`).
7
+ *
8
+ * - `createGguiListGadgetsHandler` — `ggui_list_gadgets`
9
+ * returns the app's `gadgets` catalog (stdlib seed by
10
+ * default).
11
+ *
12
+ * Future additions land here when they read per-app data scoped to
13
+ * `ctx.appId` (per-app adapter grants, per-app permission scopes,
14
+ * etc.).
15
+ */
16
+ export { createGguiListGadgetsHandler, } from './list-gadgets.js';
17
+ export { createGguiListThemesHandler, } from './list-themes.js';
18
+ export { AppAccessDeniedError } from './errors.js';
@@ -0,0 +1,93 @@
1
+ /**
2
+ * `ggui_list_gadgets` — per-app browser-capability gadget
3
+ * catalog discovery tool.
4
+ *
5
+ * Returns the list of `GadgetDescriptor` declarations registered for
6
+ * an app — the stdlib seed (`STDLIB_GADGETS` from
7
+ * `@ggui-ai/protocol`) by default, or an operator-mutated catalog
8
+ * once operator mutation is supported.
9
+ *
10
+ * ## Behavior
11
+ *
12
+ * 1. Validates the input shape (`{appId?: string}`). When omitted,
13
+ * `appId` defaults to `ctx.appId` resolved by the upstream auth
14
+ * adapter.
15
+ * 2. When `appId` is supplied explicitly, asserts it matches
16
+ * `ctx.appId`; cross-tenant requests fail with
17
+ * {@link AppAccessDeniedError}.
18
+ * 3. Reads `app.gadgets` from the bound {@link AppMetadataStore}.
19
+ * When the store returns `null` (app not registered — common for
20
+ * OSS sandbox apps that bypass an explicit register call) the
21
+ * handler falls back to `STDLIB_GADGETS` so callers
22
+ * always get a meaningful catalog. This is a permitted-error
23
+ * path, not a tenancy escape — `ctx.appId` was already proved
24
+ * by the auth adapter; the absence of a registry row just means
25
+ * the deployment runs default-seeded.
26
+ *
27
+ * ## Audience
28
+ *
29
+ * `['agent']` — registered on `/mcp` alongside the rest of the
30
+ * runtime tools. NOT `ggui_protocol_*` (that family is for static
31
+ * spec/discovery); this tool fetches RUNTIME, per-app data.
32
+ *
33
+ * ## Why a tool (not a static endpoint)
34
+ *
35
+ * Each agent gets exactly the catalog its app is configured for —
36
+ * the same generator request fed into two apps with different
37
+ * `gadgets` lists produces different boilerplate. A static
38
+ * spec endpoint would have to expose every-possible-gadget, which
39
+ * defeats per-app curation.
40
+ */
41
+ import { z } from 'zod';
42
+ import { type GadgetDescriptor } from '@ggui-ai/protocol';
43
+ import type { AppMetadataStore } from '@ggui-ai/mcp-server-core';
44
+ import type { SharedHandler } from '../types.js';
45
+ declare const inputSchema: {
46
+ readonly appId: z.ZodOptional<z.ZodString>;
47
+ };
48
+ declare const outputSchema: {
49
+ readonly gadgets: z.ZodArray<z.ZodObject<{
50
+ exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
51
+ description: z.ZodOptional<z.ZodString>;
52
+ usage: z.ZodOptional<z.ZodString>;
53
+ example: z.ZodOptional<z.ZodType<import("@ggui-ai/protocol").JsonValue, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").JsonValue, unknown>>>;
54
+ permission: z.ZodOptional<z.ZodString>;
55
+ gotchas: z.ZodOptional<z.ZodString>;
56
+ required: z.ZodOptional<z.ZodBoolean>;
57
+ hook: z.ZodString;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ description: z.ZodOptional<z.ZodString>;
60
+ usage: z.ZodOptional<z.ZodString>;
61
+ example: z.ZodOptional<z.ZodType<import("@ggui-ai/protocol").JsonValue, unknown, z.core.$ZodTypeInternals<import("@ggui-ai/protocol").JsonValue, unknown>>>;
62
+ permission: z.ZodOptional<z.ZodString>;
63
+ gotchas: z.ZodOptional<z.ZodString>;
64
+ required: z.ZodOptional<z.ZodBoolean>;
65
+ component: z.ZodString;
66
+ }, z.core.$strict>]>>;
67
+ version: z.ZodString;
68
+ package: z.ZodString;
69
+ bundleUrl: z.ZodOptional<z.ZodURL>;
70
+ bundleHost: z.ZodOptional<z.ZodString>;
71
+ bundleSri: z.ZodOptional<z.ZodString>;
72
+ styleUrl: z.ZodOptional<z.ZodURL>;
73
+ connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
74
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
75
+ typesUrl: z.ZodOptional<z.ZodURL>;
76
+ typesSri: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strict>>;
78
+ };
79
+ export interface GguiListGadgetsHandlerDeps {
80
+ /**
81
+ * Per-app metadata source. The handler reads `app.gadgets`
82
+ * off the resolved record; when `get()` returns `null` the
83
+ * handler falls back to `STDLIB_GADGETS` (sandbox-app
84
+ * permitted-error path).
85
+ */
86
+ readonly appMetadataStore: AppMetadataStore;
87
+ }
88
+ export interface GguiListGadgetsOutput {
89
+ readonly gadgets: readonly GadgetDescriptor[];
90
+ }
91
+ export declare function createGguiListGadgetsHandler(deps: GguiListGadgetsHandlerDeps): SharedHandler<typeof inputSchema, typeof outputSchema, GguiListGadgetsOutput>;
92
+ export {};
93
+ //# sourceMappingURL=list-gadgets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-gadgets.d.ts","sourceRoot":"","sources":["../../src/app-discovery/list-gadgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjE,QAAA,MAAM,WAAW;;CAQP,CAAC;AAkBX,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAER,CAAC;AAEX,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAC/C;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,0BAA0B,GAC/B,aAAa,CACd,OAAO,WAAW,EAClB,OAAO,YAAY,EACnB,qBAAqB,CACtB,CA6BA"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * `ggui_list_gadgets` — per-app browser-capability gadget
3
+ * catalog discovery tool.
4
+ *
5
+ * Returns the list of `GadgetDescriptor` declarations registered for
6
+ * an app — the stdlib seed (`STDLIB_GADGETS` from
7
+ * `@ggui-ai/protocol`) by default, or an operator-mutated catalog
8
+ * once operator mutation is supported.
9
+ *
10
+ * ## Behavior
11
+ *
12
+ * 1. Validates the input shape (`{appId?: string}`). When omitted,
13
+ * `appId` defaults to `ctx.appId` resolved by the upstream auth
14
+ * adapter.
15
+ * 2. When `appId` is supplied explicitly, asserts it matches
16
+ * `ctx.appId`; cross-tenant requests fail with
17
+ * {@link AppAccessDeniedError}.
18
+ * 3. Reads `app.gadgets` from the bound {@link AppMetadataStore}.
19
+ * When the store returns `null` (app not registered — common for
20
+ * OSS sandbox apps that bypass an explicit register call) the
21
+ * handler falls back to `STDLIB_GADGETS` so callers
22
+ * always get a meaningful catalog. This is a permitted-error
23
+ * path, not a tenancy escape — `ctx.appId` was already proved
24
+ * by the auth adapter; the absence of a registry row just means
25
+ * the deployment runs default-seeded.
26
+ *
27
+ * ## Audience
28
+ *
29
+ * `['agent']` — registered on `/mcp` alongside the rest of the
30
+ * runtime tools. NOT `ggui_protocol_*` (that family is for static
31
+ * spec/discovery); this tool fetches RUNTIME, per-app data.
32
+ *
33
+ * ## Why a tool (not a static endpoint)
34
+ *
35
+ * Each agent gets exactly the catalog its app is configured for —
36
+ * the same generator request fed into two apps with different
37
+ * `gadgets` lists produces different boilerplate. A static
38
+ * spec endpoint would have to expose every-possible-gadget, which
39
+ * defeats per-app curation.
40
+ */
41
+ import { z } from 'zod';
42
+ import { STDLIB_GADGETS, gadgetDescriptorSchema, } from '@ggui-ai/protocol';
43
+ import { AppAccessDeniedError } from './errors.js';
44
+ const inputSchema = {
45
+ appId: z
46
+ .string()
47
+ .min(1)
48
+ .optional()
49
+ .describe('The app id whose gadget catalog to return. Defaults to the caller-resolved app id from the auth header. Cross-tenant requests fail with app_access_denied.'),
50
+ };
51
+ /**
52
+ * Output wire schema for one catalog entry. The handler returns
53
+ * PACKAGE descriptors — `{package, version, exports:
54
+ * GadgetExport[], …transport}` — so the entry schema is the
55
+ * protocol's own {@link gadgetDescriptorSchema} re-used directly. A
56
+ * GadgetDescriptor is a package: identity (`package`, `version`), an
57
+ * `exports` array (≥1, each a field-presence-discriminated hook or
58
+ * component export), and the per-package transport fields.
59
+ *
60
+ * Re-using the exported schema (rather than re-describing the shape)
61
+ * makes drift between this MCP-boundary parse and the protocol
62
+ * structurally impossible — when the descriptor shape evolves, this
63
+ * tool's `outputSchema` evolves with it.
64
+ */
65
+ const gadgetEntryWireSchema = gadgetDescriptorSchema;
66
+ const outputSchema = {
67
+ gadgets: z.array(gadgetEntryWireSchema),
68
+ };
69
+ export function createGguiListGadgetsHandler(deps) {
70
+ return {
71
+ name: 'ggui_list_gadgets',
72
+ title: 'List gadgets',
73
+ audience: ['agent'],
74
+ description: 'List the per-app catalog of browser-capability gadget hooks the UI may import in `clientCapabilities.gadgets[*]` of a DataContract. Returns the v1 stdlib catalog by default; operator-mutated per-app overrides ship in a follow-up slice. Pass appId to scope explicitly (must match the caller identity); omit to default to the caller-resolved app.',
75
+ inputSchema,
76
+ outputSchema,
77
+ async handler(rawInput, ctx) {
78
+ const parsed = z.object(inputSchema).parse(rawInput);
79
+ const resolvedAppId = parsed.appId ?? ctx.appId;
80
+ if (parsed.appId !== undefined && parsed.appId !== ctx.appId) {
81
+ throw new AppAccessDeniedError();
82
+ }
83
+ const app = await deps.appMetadataStore.get(resolvedAppId);
84
+ // App-not-found is a permitted-error path: ctx.appId was already
85
+ // proved by the auth adapter; the registry row just hasn't been
86
+ // explicitly created. Return the stdlib seed so callers always
87
+ // get a meaningful catalog. This mirrors the cloud DDB adapter's
88
+ // default-on-read pattern at the row-projection site.
89
+ const gadgets = app?.gadgets ?? STDLIB_GADGETS;
90
+ return { gadgets };
91
+ },
92
+ };
93
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `ggui_list_themes` — per-app theme catalog discovery tool.
3
+ *
4
+ * Returns the list of `ThemeEntry` records the app exposes — every
5
+ * registered preset by default, or an operator-curated filter when
6
+ * `App.availableThemeIds` is set. Lets the agent reason about visual
7
+ * style ("calming" vs "urgent" vs "marketing") by reading descriptions
8
+ * instead of guessing at preset ids.
9
+ *
10
+ * ## Behavior
11
+ *
12
+ * 1. Validates input shape (`{appId?: string}`). Cross-tenant
13
+ * access protected the same way as `ggui_list_gadgets`.
14
+ * 2. Reads the global theme catalog via the bound `themes` dep
15
+ * (a `() => readonly ThemeCatalogEntry[]` resolver — keeps the
16
+ * handler design-package-agnostic).
17
+ * 3. If `app.availableThemeIds` is set, filters the catalog to just
18
+ * those ids; otherwise returns the full catalog.
19
+ *
20
+ * ## Audience
21
+ *
22
+ * `['agent']` — registered on `/mcp`. Agent-callable anytime; pair
23
+ * with `ggui_new_session({themeId})` or `ggui_push({themeId})` to
24
+ * apply a chosen theme.
25
+ */
26
+ import { z } from 'zod';
27
+ import type { AppMetadataStore } from '@ggui-ai/mcp-server-core';
28
+ import type { SharedHandler } from '../types.js';
29
+ declare const inputSchema: {
30
+ readonly appId: z.ZodOptional<z.ZodString>;
31
+ };
32
+ declare const outputSchema: {
33
+ readonly themes: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ name: z.ZodString;
36
+ description: z.ZodString;
37
+ modes: z.ZodArray<z.ZodEnum<{
38
+ light: "light";
39
+ dark: "dark";
40
+ }>>;
41
+ }, z.core.$loose>>;
42
+ };
43
+ export interface ThemeCatalogEntry {
44
+ readonly id: string;
45
+ readonly name: string;
46
+ readonly description: string;
47
+ readonly modes: readonly ('light' | 'dark')[];
48
+ }
49
+ export interface GguiListThemesHandlerDeps {
50
+ /**
51
+ * Per-app metadata source. The handler reads `app.availableThemeIds`
52
+ * off the resolved record; when present, filters the global catalog
53
+ * to just the allowed ids. `null` result ⇒ no filter (return all).
54
+ */
55
+ readonly appMetadataStore: AppMetadataStore;
56
+ /**
57
+ * Global theme catalog resolver. Returns every theme the runtime
58
+ * has registered. The CLI binds this to `@ggui-ai/design`'s
59
+ * `listThemes()`; hosted deployments may project a different shape.
60
+ * Kept as a function so the catalog can change mid-process without
61
+ * a server restart (future operator-defined themes).
62
+ */
63
+ readonly themes: () => readonly ThemeCatalogEntry[];
64
+ }
65
+ export interface GguiListThemesOutput {
66
+ readonly themes: readonly ThemeCatalogEntry[];
67
+ }
68
+ export declare function createGguiListThemesHandler(deps: GguiListThemesHandlerDeps): SharedHandler<typeof inputSchema, typeof outputSchema, GguiListThemesOutput>;
69
+ export {};
70
+ //# sourceMappingURL=list-themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-themes.d.ts","sourceRoot":"","sources":["../../src/app-discovery/list-themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjE,QAAA,MAAM,WAAW;;CAQP,CAAC;AAkBX,QAAA,MAAM,YAAY;;;;;;;;;;CAER,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,SAAS,iBAAiB,EAAE,CAAC;CACrD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC/C;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,yBAAyB,GAC9B,aAAa,CACd,OAAO,WAAW,EAClB,OAAO,YAAY,EACnB,oBAAoB,CACrB,CAgCA"}