aimeat 2.0.0 → 2.2.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 (722) hide show
  1. package/dist/.env.example +9 -4
  2. package/dist/locales/en.json +63 -1
  3. package/dist/locales/fi.json +63 -1
  4. package/dist/public/components/LinkPreview.js +101 -0
  5. package/dist/public/components/NotificationBell.js +18 -1
  6. package/dist/public/cortex-bundled/aimeat-charts.js +158 -10
  7. package/dist/public/cortex-bundled/aimeat-charts.yaml +1 -1
  8. package/dist/public/cortex-bundled/aimeat-dag.js +515 -173
  9. package/dist/public/cortex-bundled/aimeat-dag.yaml +1 -1
  10. package/dist/public/cortex-bundled/aimeat-i18n.js +6 -1
  11. package/dist/public/cortex-bundled/aimeat-i18n.yaml +1 -1
  12. package/dist/public/cortex-bundled/aimeat-surface.js +577 -0
  13. package/dist/public/cortex-bundled/aimeat-surface.yaml +107 -0
  14. package/dist/public/cortex-bundled/aimeat-viewport.js +405 -0
  15. package/dist/public/cortex-bundled/aimeat-viewport.yaml +100 -0
  16. package/dist/public/css/theme.css +57 -7
  17. package/dist/public/css/views/admin.css +8 -1
  18. package/dist/public/css/views/app-grant.css +18 -0
  19. package/dist/public/css/views/inbox.css +47 -1
  20. package/dist/public/css/views/portfolio.css +46 -0
  21. package/dist/public/css/views/profile.css +38 -4
  22. package/dist/public/js/services/apps.js +19 -3
  23. package/dist/public/js/services/messages-ai-prompts.js +38 -0
  24. package/dist/public/js/services/messages.js +26 -4
  25. package/dist/public/js/services/notebook.js +76 -0
  26. package/dist/public/js/services/unfurl.js +43 -0
  27. package/dist/public/lib/VENDORED.md +6 -3
  28. package/dist/public/lib/aimeat-daisyui-bridge.css +39 -2
  29. package/dist/public/lib/aimeat-theme.css +538 -0
  30. package/dist/public/lib/fonts/LICENSE.md +11 -4
  31. package/dist/public/lib/fonts/fraunces-var-latin-ext.woff2 +0 -0
  32. package/dist/public/lib/fonts/fraunces-var-latin.woff2 +0 -0
  33. package/dist/public/lib/fonts/inter-var-latin-ext.woff2 +0 -0
  34. package/dist/public/lib/fonts/inter-var-latin.woff2 +0 -0
  35. package/dist/public/lib/fonts/jetbrains-mono-var-latin-ext.woff2 +0 -0
  36. package/dist/public/lib/fonts/jetbrains-mono-var-latin.woff2 +0 -0
  37. package/dist/public/lib/fonts/space-grotesk-var-latin-ext.woff2 +0 -0
  38. package/dist/public/lib/fonts/space-grotesk-var-latin.woff2 +0 -0
  39. package/dist/public/lib/samples/LICENSE.md +11 -0
  40. package/dist/public/lib/samples/bass/A1.mp3 +0 -0
  41. package/dist/public/lib/samples/bass/B2.mp3 +0 -0
  42. package/dist/public/lib/samples/bass/D2.mp3 +0 -0
  43. package/dist/public/lib/samples/bass/E1.mp3 +0 -0
  44. package/dist/public/lib/samples/bass/E3.mp3 +0 -0
  45. package/dist/public/lib/samples/bass/G2.mp3 +0 -0
  46. package/dist/public/lib/samples/epiano/C2.mp3 +0 -0
  47. package/dist/public/lib/samples/epiano/C3.mp3 +0 -0
  48. package/dist/public/lib/samples/epiano/C4.mp3 +0 -0
  49. package/dist/public/lib/samples/epiano/C5.mp3 +0 -0
  50. package/dist/public/lib/samples/epiano/C6.mp3 +0 -0
  51. package/dist/public/lib/samples/epiano/G2.mp3 +0 -0
  52. package/dist/public/lib/samples/epiano/G3.mp3 +0 -0
  53. package/dist/public/lib/samples/epiano/G4.mp3 +0 -0
  54. package/dist/public/lib/samples/epiano/G5.mp3 +0 -0
  55. package/dist/public/lib/samples/guitar-steel/A2.mp3 +0 -0
  56. package/dist/public/lib/samples/guitar-steel/A4.mp3 +0 -0
  57. package/dist/public/lib/samples/guitar-steel/B3.mp3 +0 -0
  58. package/dist/public/lib/samples/guitar-steel/D3.mp3 +0 -0
  59. package/dist/public/lib/samples/guitar-steel/E2.mp3 +0 -0
  60. package/dist/public/lib/samples/guitar-steel/E4.mp3 +0 -0
  61. package/dist/public/lib/samples/guitar-steel/E5.mp3 +0 -0
  62. package/dist/public/lib/samples/guitar-steel/G3.mp3 +0 -0
  63. package/dist/public/lib/samples/organ/C2.mp3 +0 -0
  64. package/dist/public/lib/samples/organ/C3.mp3 +0 -0
  65. package/dist/public/lib/samples/organ/C4.mp3 +0 -0
  66. package/dist/public/lib/samples/organ/C5.mp3 +0 -0
  67. package/dist/public/lib/samples/organ/C6.mp3 +0 -0
  68. package/dist/public/lib/samples/organ/G2.mp3 +0 -0
  69. package/dist/public/lib/samples/organ/G3.mp3 +0 -0
  70. package/dist/public/lib/samples/organ/G4.mp3 +0 -0
  71. package/dist/public/lib/samples/organ/G5.mp3 +0 -0
  72. package/dist/public/lib/samples/strings/C2.mp3 +0 -0
  73. package/dist/public/lib/samples/strings/C3.mp3 +0 -0
  74. package/dist/public/lib/samples/strings/C4.mp3 +0 -0
  75. package/dist/public/lib/samples/strings/C5.mp3 +0 -0
  76. package/dist/public/lib/samples/strings/C6.mp3 +0 -0
  77. package/dist/public/lib/samples/strings/G2.mp3 +0 -0
  78. package/dist/public/lib/samples/strings/G3.mp3 +0 -0
  79. package/dist/public/lib/samples/strings/G4.mp3 +0 -0
  80. package/dist/public/lib/samples/strings/G5.mp3 +0 -0
  81. package/dist/public/lib/samples/theme-check.html +92 -0
  82. package/dist/public/lib/samples/themes-boot.js +20 -0
  83. package/dist/public/lib/samples/themes.html +154 -0
  84. package/dist/public/lib/samples/themes.js +60 -0
  85. package/dist/public/lib/samples/trumpet/A3.mp3 +0 -0
  86. package/dist/public/lib/samples/trumpet/A4.mp3 +0 -0
  87. package/dist/public/lib/samples/trumpet/A5.mp3 +0 -0
  88. package/dist/public/lib/samples/trumpet/C4.mp3 +0 -0
  89. package/dist/public/lib/samples/trumpet/C5.mp3 +0 -0
  90. package/dist/public/lib/samples/trumpet/E3.mp3 +0 -0
  91. package/dist/public/lib/samples/trumpet/E4.mp3 +0 -0
  92. package/dist/public/lib/samples/trumpet/E5.mp3 +0 -0
  93. package/dist/public/spa.html +2 -0
  94. package/dist/public/views/app-grant.js +24 -4
  95. package/dist/public/views/portfolio.js +61 -6
  96. package/dist/public/views/profile/access-tab/connected-apps.js +81 -5
  97. package/dist/public/views/profile/apps-tab.js +18 -1
  98. package/dist/public/views/profile/extensions-tab.maturity.js +4 -1
  99. package/dist/public/views/profile/inbox-tab/ai-actions.js +86 -0
  100. package/dist/public/views/profile/inbox-tab/components.js +141 -10
  101. package/dist/public/views/profile/inbox-tab/helpers.js +26 -0
  102. package/dist/public/views/profile/inbox-tab/panels.js +18 -3
  103. package/dist/public/views/profile/inbox-tab/use-thread-ux.js +47 -3
  104. package/dist/public/views/profile/inbox-tab.js +46 -49
  105. package/dist/public/views/profile/landing-page.cards.js +7 -0
  106. package/dist/public/views/profile/landing-page.js +12 -1
  107. package/dist/public/views/profile/libraries-tab.js +10 -2
  108. package/dist/public/views/profile/skills-tab.js +1 -1
  109. package/dist/public/views/profile/wallet-tab.js +64 -0
  110. package/dist/public/views/public-workspace-viewer.js +1 -1
  111. package/dist/public/views/start.js +2 -1
  112. package/dist/scripts/build-sdk-libs.d.ts +16 -0
  113. package/dist/scripts/build-sdk-libs.d.ts.map +1 -0
  114. package/dist/scripts/build-sdk-libs.js +112 -0
  115. package/dist/scripts/build-sdk-libs.js.map +1 -0
  116. package/dist/scripts/check-openapi.d.ts +2 -0
  117. package/dist/scripts/check-openapi.d.ts.map +1 -0
  118. package/dist/scripts/check-openapi.js +139 -0
  119. package/dist/scripts/check-openapi.js.map +1 -0
  120. package/dist/scripts/embed-viewport.d.ts +23 -0
  121. package/dist/scripts/embed-viewport.d.ts.map +1 -0
  122. package/dist/scripts/embed-viewport.js +116 -0
  123. package/dist/scripts/embed-viewport.js.map +1 -0
  124. package/dist/src/auth/sse-domain-scopes.d.ts +50 -0
  125. package/dist/src/auth/sse-domain-scopes.d.ts.map +1 -0
  126. package/dist/src/auth/sse-domain-scopes.js +111 -0
  127. package/dist/src/auth/sse-domain-scopes.js.map +1 -0
  128. package/dist/src/cli/connect/auth.d.ts +15 -0
  129. package/dist/src/cli/connect/auth.d.ts.map +1 -1
  130. package/dist/src/cli/connect/auth.js +25 -6
  131. package/dist/src/cli/connect/auth.js.map +1 -1
  132. package/dist/src/cli/connect/keychain.d.ts +9 -0
  133. package/dist/src/cli/connect/keychain.d.ts.map +1 -1
  134. package/dist/src/cli/connect/keychain.js +21 -8
  135. package/dist/src/cli/connect/keychain.js.map +1 -1
  136. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
  137. package/dist/src/cli/connect/mcp/tools/agent-tasks.js +4 -1
  138. package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
  139. package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
  140. package/dist/src/cli/connect/mcp/tools/core.js +14 -3
  141. package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
  142. package/dist/src/cli/connect/mcp/tools/exchange.d.ts +18 -0
  143. package/dist/src/cli/connect/mcp/tools/exchange.d.ts.map +1 -0
  144. package/dist/src/cli/connect/mcp/tools/exchange.js +170 -0
  145. package/dist/src/cli/connect/mcp/tools/exchange.js.map +1 -0
  146. package/dist/src/cli/connect/mcp/tools/index.d.ts.map +1 -1
  147. package/dist/src/cli/connect/mcp/tools/index.js +2 -0
  148. package/dist/src/cli/connect/mcp/tools/index.js.map +1 -1
  149. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts +3 -0
  150. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts.map +1 -1
  151. package/dist/src/cli/connect/mcp/tools/workspaces.js +4 -2
  152. package/dist/src/cli/connect/mcp/tools/workspaces.js.map +1 -1
  153. package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
  154. package/dist/src/cli/connect/tool-call-defs-core.js +13 -1
  155. package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
  156. package/dist/src/cli/connect/tool-call-defs-exchange.d.ts +3 -0
  157. package/dist/src/cli/connect/tool-call-defs-exchange.d.ts.map +1 -0
  158. package/dist/src/cli/connect/tool-call-defs-exchange.js +146 -0
  159. package/dist/src/cli/connect/tool-call-defs-exchange.js.map +1 -0
  160. package/dist/src/cli/connect/tool-call.d.ts.map +1 -1
  161. package/dist/src/cli/connect/tool-call.js +2 -0
  162. package/dist/src/cli/connect/tool-call.js.map +1 -1
  163. package/dist/src/commerce/__tests__/x402-registry.test.d.ts +2 -0
  164. package/dist/src/commerce/__tests__/x402-registry.test.d.ts.map +1 -0
  165. package/dist/src/commerce/__tests__/x402-registry.test.js +105 -0
  166. package/dist/src/commerce/__tests__/x402-registry.test.js.map +1 -0
  167. package/dist/src/commerce/evm-address.d.ts +21 -0
  168. package/dist/src/commerce/evm-address.d.ts.map +1 -0
  169. package/dist/src/commerce/evm-address.js +94 -0
  170. package/dist/src/commerce/evm-address.js.map +1 -0
  171. package/dist/src/commerce/money.d.ts +18 -5
  172. package/dist/src/commerce/money.d.ts.map +1 -1
  173. package/dist/src/commerce/money.js +27 -6
  174. package/dist/src/commerce/money.js.map +1 -1
  175. package/dist/src/commerce/session-service.d.ts +14 -0
  176. package/dist/src/commerce/session-service.d.ts.map +1 -1
  177. package/dist/src/commerce/session-service.js +1 -1
  178. package/dist/src/commerce/session-service.js.map +1 -1
  179. package/dist/src/commerce/x402-facilitator.d.ts +64 -13
  180. package/dist/src/commerce/x402-facilitator.d.ts.map +1 -1
  181. package/dist/src/commerce/x402-facilitator.js +71 -19
  182. package/dist/src/commerce/x402-facilitator.js.map +1 -1
  183. package/dist/src/commerce/x402-handler.d.ts +13 -7
  184. package/dist/src/commerce/x402-handler.d.ts.map +1 -1
  185. package/dist/src/commerce/x402-handler.js +23 -10
  186. package/dist/src/commerce/x402-handler.js.map +1 -1
  187. package/dist/src/commerce/x402.d.ts +11 -6
  188. package/dist/src/commerce/x402.d.ts.map +1 -1
  189. package/dist/src/commerce/x402.js +10 -7
  190. package/dist/src/commerce/x402.js.map +1 -1
  191. package/dist/src/config-types.d.ts +12 -0
  192. package/dist/src/config-types.d.ts.map +1 -1
  193. package/dist/src/config.d.ts.map +1 -1
  194. package/dist/src/config.js +8 -0
  195. package/dist/src/config.js.map +1 -1
  196. package/dist/src/data/app-templates/shells.d.ts +15 -3
  197. package/dist/src/data/app-templates/shells.d.ts.map +1 -1
  198. package/dist/src/data/app-templates/shells.js +97 -12
  199. package/dist/src/data/app-templates/shells.js.map +1 -1
  200. package/dist/src/data/app-templates.js +2 -2
  201. package/dist/src/data/app-templates.js.map +1 -1
  202. package/dist/src/data/appdev-pitfalls.d.ts +2 -0
  203. package/dist/src/data/appdev-pitfalls.d.ts.map +1 -1
  204. package/dist/src/data/appdev-pitfalls.js +24 -1
  205. package/dist/src/data/appdev-pitfalls.js.map +1 -1
  206. package/dist/src/data/library-packs/cortex.d.ts.map +1 -1
  207. package/dist/src/data/library-packs/cortex.js +108 -5
  208. package/dist/src/data/library-packs/cortex.js.map +1 -1
  209. package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
  210. package/dist/src/data/library-packs/sdk.js +32 -8
  211. package/dist/src/data/library-packs/sdk.js.map +1 -1
  212. package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
  213. package/dist/src/data/library-packs/vendored.js +83 -6
  214. package/dist/src/data/library-packs/vendored.js.map +1 -1
  215. package/dist/src/generated/api-types.d.ts +2039 -24
  216. package/dist/src/generated/api-types.d.ts.map +1 -1
  217. package/dist/src/mcp/agent-tasks.d.ts +4 -0
  218. package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
  219. package/dist/src/mcp/agent-tasks.js +20 -2
  220. package/dist/src/mcp/agent-tasks.js.map +1 -1
  221. package/dist/src/mcp/annotations.d.ts.map +1 -1
  222. package/dist/src/mcp/annotations.js +20 -0
  223. package/dist/src/mcp/annotations.js.map +1 -1
  224. package/dist/src/mcp/apps.d.ts.map +1 -1
  225. package/dist/src/mcp/apps.js +8 -4
  226. package/dist/src/mcp/apps.js.map +1 -1
  227. package/dist/src/mcp/capabilities.d.ts +7 -1
  228. package/dist/src/mcp/capabilities.d.ts.map +1 -1
  229. package/dist/src/mcp/capabilities.js +5 -2
  230. package/dist/src/mcp/capabilities.js.map +1 -1
  231. package/dist/src/mcp/catalog/definitions/commerce.d.ts.map +1 -1
  232. package/dist/src/mcp/catalog/definitions/commerce.js +4 -2
  233. package/dist/src/mcp/catalog/definitions/commerce.js.map +1 -1
  234. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
  235. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +4 -3
  236. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
  237. package/dist/src/mcp/catalog/definitions/exchange.d.ts +18 -0
  238. package/dist/src/mcp/catalog/definitions/exchange.d.ts.map +1 -0
  239. package/dist/src/mcp/catalog/definitions/exchange.js +182 -0
  240. package/dist/src/mcp/catalog/definitions/exchange.js.map +1 -0
  241. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +1 -1
  242. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
  243. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
  244. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +3 -2
  245. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
  246. package/dist/src/mcp/catalog/definitions.d.ts.map +1 -1
  247. package/dist/src/mcp/catalog/definitions.js +2 -0
  248. package/dist/src/mcp/catalog/definitions.js.map +1 -1
  249. package/dist/src/mcp/catalog/output-schemas.d.ts +6 -1
  250. package/dist/src/mcp/catalog/output-schemas.d.ts.map +1 -1
  251. package/dist/src/mcp/catalog/output-schemas.js +6 -1
  252. package/dist/src/mcp/catalog/output-schemas.js.map +1 -1
  253. package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
  254. package/dist/src/mcp/catalog/scopes.js +22 -0
  255. package/dist/src/mcp/catalog/scopes.js.map +1 -1
  256. package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
  257. package/dist/src/mcp/catalog/surfaces.js +14 -0
  258. package/dist/src/mcp/catalog/surfaces.js.map +1 -1
  259. package/dist/src/mcp/commerce.d.ts.map +1 -1
  260. package/dist/src/mcp/commerce.js +15 -3
  261. package/dist/src/mcp/commerce.js.map +1 -1
  262. package/dist/src/mcp/core-storage.d.ts +23 -0
  263. package/dist/src/mcp/core-storage.d.ts.map +1 -0
  264. package/dist/src/mcp/core-storage.js +157 -0
  265. package/dist/src/mcp/core-storage.js.map +1 -0
  266. package/dist/src/mcp/core.d.ts +16 -0
  267. package/dist/src/mcp/core.d.ts.map +1 -1
  268. package/dist/src/mcp/core.js +75 -119
  269. package/dist/src/mcp/core.js.map +1 -1
  270. package/dist/src/mcp/dm-messages.d.ts +4 -0
  271. package/dist/src/mcp/dm-messages.d.ts.map +1 -1
  272. package/dist/src/mcp/dm-messages.js +43 -2
  273. package/dist/src/mcp/dm-messages.js.map +1 -1
  274. package/dist/src/mcp/exchange-run.d.ts +5 -0
  275. package/dist/src/mcp/exchange-run.d.ts.map +1 -0
  276. package/dist/src/mcp/exchange-run.js +226 -0
  277. package/dist/src/mcp/exchange-run.js.map +1 -0
  278. package/dist/src/mcp/exchange.d.ts +5 -0
  279. package/dist/src/mcp/exchange.d.ts.map +1 -0
  280. package/dist/src/mcp/exchange.js +352 -0
  281. package/dist/src/mcp/exchange.js.map +1 -0
  282. package/dist/src/mcp/extensions.d.ts.map +1 -1
  283. package/dist/src/mcp/extensions.js +17 -2
  284. package/dist/src/mcp/extensions.js.map +1 -1
  285. package/dist/src/mcp/index.d.ts +5 -0
  286. package/dist/src/mcp/index.d.ts.map +1 -1
  287. package/dist/src/mcp/index.js +26 -3
  288. package/dist/src/mcp/index.js.map +1 -1
  289. package/dist/src/mcp/memory-namespace-hints.d.ts +33 -0
  290. package/dist/src/mcp/memory-namespace-hints.d.ts.map +1 -0
  291. package/dist/src/mcp/memory-namespace-hints.js +60 -0
  292. package/dist/src/mcp/memory-namespace-hints.js.map +1 -0
  293. package/dist/src/mcp/workspaces.d.ts +5 -0
  294. package/dist/src/mcp/workspaces.d.ts.map +1 -1
  295. package/dist/src/mcp/workspaces.js +5 -3
  296. package/dist/src/mcp/workspaces.js.map +1 -1
  297. package/dist/src/models/agent-task-schemas.d.ts +25 -3
  298. package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
  299. package/dist/src/models/agent-task-schemas.js +16 -0
  300. package/dist/src/models/agent-task-schemas.js.map +1 -1
  301. package/dist/src/models/app-tool-schemas.d.ts +573 -2
  302. package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
  303. package/dist/src/models/app-tool-schemas.js +73 -2
  304. package/dist/src/models/app-tool-schemas.js.map +1 -1
  305. package/dist/src/models/odps-schemas.d.ts +305 -0
  306. package/dist/src/models/odps-schemas.d.ts.map +1 -0
  307. package/dist/src/models/odps-schemas.js +182 -0
  308. package/dist/src/models/odps-schemas.js.map +1 -0
  309. package/dist/src/models/offer-schemas.d.ts +359 -4
  310. package/dist/src/models/offer-schemas.d.ts.map +1 -1
  311. package/dist/src/models/offer-schemas.js +37 -0
  312. package/dist/src/models/offer-schemas.js.map +1 -1
  313. package/dist/src/models/schemas.d.ts +7 -3
  314. package/dist/src/models/schemas.d.ts.map +1 -1
  315. package/dist/src/models/schemas.js +13 -1
  316. package/dist/src/models/schemas.js.map +1 -1
  317. package/dist/src/models/webhook-schemas.d.ts +8 -8
  318. package/dist/src/routes/agent-tasks/create-read.d.ts +4 -0
  319. package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
  320. package/dist/src/routes/agent-tasks/create-read.js +20 -1
  321. package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
  322. package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
  323. package/dist/src/routes/agent-tasks/lifecycle.js +10 -0
  324. package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
  325. package/dist/src/routes/agents/device-auth.d.ts +4 -0
  326. package/dist/src/routes/agents/device-auth.d.ts.map +1 -1
  327. package/dist/src/routes/agents/device-auth.js +19 -4
  328. package/dist/src/routes/agents/device-auth.js.map +1 -1
  329. package/dist/src/routes/agents/offers.d.ts +2 -0
  330. package/dist/src/routes/agents/offers.d.ts.map +1 -1
  331. package/dist/src/routes/agents/offers.js +0 -0
  332. package/dist/src/routes/agents/offers.js.map +1 -1
  333. package/dist/src/routes/app-grants.d.ts +12 -0
  334. package/dist/src/routes/app-grants.d.ts.map +1 -1
  335. package/dist/src/routes/app-grants.js +90 -27
  336. package/dist/src/routes/app-grants.js.map +1 -1
  337. package/dist/src/routes/apps/drafts.d.ts +3 -0
  338. package/dist/src/routes/apps/drafts.d.ts.map +1 -1
  339. package/dist/src/routes/apps/drafts.js +63 -1
  340. package/dist/src/routes/apps/drafts.js.map +1 -1
  341. package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
  342. package/dist/src/routes/apps/fork-manage.js +24 -1
  343. package/dist/src/routes/apps/fork-manage.js.map +1 -1
  344. package/dist/src/routes/apps/publish.d.ts +4 -0
  345. package/dist/src/routes/apps/publish.d.ts.map +1 -1
  346. package/dist/src/routes/apps/publish.js +44 -3
  347. package/dist/src/routes/apps/publish.js.map +1 -1
  348. package/dist/src/routes/apps-cost.d.ts +25 -0
  349. package/dist/src/routes/apps-cost.d.ts.map +1 -0
  350. package/dist/src/routes/apps-cost.js +107 -0
  351. package/dist/src/routes/apps-cost.js.map +1 -0
  352. package/dist/src/routes/commerce.d.ts.map +1 -1
  353. package/dist/src/routes/commerce.js +122 -2
  354. package/dist/src/routes/commerce.js.map +1 -1
  355. package/dist/src/routes/exchange-market.d.ts +32 -0
  356. package/dist/src/routes/exchange-market.d.ts.map +1 -0
  357. package/dist/src/routes/exchange-market.js +580 -0
  358. package/dist/src/routes/exchange-market.js.map +1 -0
  359. package/dist/src/routes/exchange.d.ts +33 -0
  360. package/dist/src/routes/exchange.d.ts.map +1 -0
  361. package/dist/src/routes/exchange.js +398 -0
  362. package/dist/src/routes/exchange.js.map +1 -0
  363. package/dist/src/routes/extensions/actions.d.ts.map +1 -1
  364. package/dist/src/routes/extensions/actions.js +18 -0
  365. package/dist/src/routes/extensions/actions.js.map +1 -1
  366. package/dist/src/routes/extensions/crud.d.ts.map +1 -1
  367. package/dist/src/routes/extensions/crud.js +36 -3
  368. package/dist/src/routes/extensions/crud.js.map +1 -1
  369. package/dist/src/routes/extensions/entitlement-gate.d.ts +33 -0
  370. package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -0
  371. package/dist/src/routes/extensions/entitlement-gate.js +156 -0
  372. package/dist/src/routes/extensions/entitlement-gate.js.map +1 -0
  373. package/dist/src/routes/extensions/manifest.d.ts +15 -0
  374. package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
  375. package/dist/src/routes/extensions/manifest.js +101 -2
  376. package/dist/src/routes/extensions/manifest.js.map +1 -1
  377. package/dist/src/routes/extensions/pacing.d.ts +31 -0
  378. package/dist/src/routes/extensions/pacing.d.ts.map +1 -0
  379. package/dist/src/routes/extensions/pacing.js +73 -0
  380. package/dist/src/routes/extensions/pacing.js.map +1 -0
  381. package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
  382. package/dist/src/routes/extensions/paywall.js +20 -11
  383. package/dist/src/routes/extensions/paywall.js.map +1 -1
  384. package/dist/src/routes/federation-sync/messaging.d.ts.map +1 -1
  385. package/dist/src/routes/federation-sync/messaging.js +3 -1
  386. package/dist/src/routes/federation-sync/messaging.js.map +1 -1
  387. package/dist/src/routes/ghii/recovery.d.ts +2 -0
  388. package/dist/src/routes/ghii/recovery.d.ts.map +1 -1
  389. package/dist/src/routes/ghii/recovery.js +7 -0
  390. package/dist/src/routes/ghii/recovery.js.map +1 -1
  391. package/dist/src/routes/ghii/register-login.d.ts +4 -0
  392. package/dist/src/routes/ghii/register-login.d.ts.map +1 -1
  393. package/dist/src/routes/ghii/register-login.js +45 -22
  394. package/dist/src/routes/ghii/register-login.js.map +1 -1
  395. package/dist/src/routes/ghii/web-verify.d.ts +5 -0
  396. package/dist/src/routes/ghii/web-verify.d.ts.map +1 -1
  397. package/dist/src/routes/ghii/web-verify.js +24 -3
  398. package/dist/src/routes/ghii/web-verify.js.map +1 -1
  399. package/dist/src/routes/libs/sdk-serve.d.ts +11 -0
  400. package/dist/src/routes/libs/sdk-serve.d.ts.map +1 -0
  401. package/dist/src/routes/libs/sdk-serve.js +53 -0
  402. package/dist/src/routes/libs/sdk-serve.js.map +1 -0
  403. package/dist/src/routes/libs.d.ts +7 -1
  404. package/dist/src/routes/libs.d.ts.map +1 -1
  405. package/dist/src/routes/libs.js +65 -146
  406. package/dist/src/routes/libs.js.map +1 -1
  407. package/dist/src/routes/memory/crud.d.ts.map +1 -1
  408. package/dist/src/routes/memory/crud.js +10 -0
  409. package/dist/src/routes/memory/crud.js.map +1 -1
  410. package/dist/src/routes/messages.d.ts +3 -0
  411. package/dist/src/routes/messages.d.ts.map +1 -1
  412. package/dist/src/routes/messages.js +9 -0
  413. package/dist/src/routes/messages.js.map +1 -1
  414. package/dist/src/routes/notifications.d.ts +6 -3
  415. package/dist/src/routes/notifications.d.ts.map +1 -1
  416. package/dist/src/routes/notifications.js +32 -3
  417. package/dist/src/routes/notifications.js.map +1 -1
  418. package/dist/src/routes/organisms/crud.d.ts +3 -0
  419. package/dist/src/routes/organisms/crud.d.ts.map +1 -1
  420. package/dist/src/routes/organisms/crud.js +5 -2
  421. package/dist/src/routes/organisms/crud.js.map +1 -1
  422. package/dist/src/routes/organisms/workspace-access.d.ts.map +1 -1
  423. package/dist/src/routes/organisms/workspace-access.js +38 -20
  424. package/dist/src/routes/organisms/workspace-access.js.map +1 -1
  425. package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
  426. package/dist/src/routes/organisms/workspace-read.js +7 -2
  427. package/dist/src/routes/organisms/workspace-read.js.map +1 -1
  428. package/dist/src/routes/public-stats.d.ts +7 -0
  429. package/dist/src/routes/public-stats.d.ts.map +1 -1
  430. package/dist/src/routes/public-stats.js +28 -7
  431. package/dist/src/routes/public-stats.js.map +1 -1
  432. package/dist/src/routes/sse.d.ts +7 -0
  433. package/dist/src/routes/sse.d.ts.map +1 -1
  434. package/dist/src/routes/sse.js +36 -6
  435. package/dist/src/routes/sse.js.map +1 -1
  436. package/dist/src/routes/storage-files.d.ts +11 -0
  437. package/dist/src/routes/storage-files.d.ts.map +1 -1
  438. package/dist/src/routes/storage-files.js +58 -51
  439. package/dist/src/routes/storage-files.js.map +1 -1
  440. package/dist/src/routes/subdomains.d.ts +4 -0
  441. package/dist/src/routes/subdomains.d.ts.map +1 -1
  442. package/dist/src/routes/subdomains.js +42 -5
  443. package/dist/src/routes/subdomains.js.map +1 -1
  444. package/dist/src/routes/unfurl.d.ts +27 -0
  445. package/dist/src/routes/unfurl.d.ts.map +1 -0
  446. package/dist/src/routes/unfurl.js +180 -0
  447. package/dist/src/routes/unfurl.js.map +1 -0
  448. package/dist/src/routes/upload.d.ts +13 -0
  449. package/dist/src/routes/upload.d.ts.map +1 -1
  450. package/dist/src/routes/upload.js +115 -28
  451. package/dist/src/routes/upload.js.map +1 -1
  452. package/dist/src/routes/webmcp.d.ts +3 -0
  453. package/dist/src/routes/webmcp.d.ts.map +1 -1
  454. package/dist/src/routes/webmcp.js +59 -0
  455. package/dist/src/routes/webmcp.js.map +1 -1
  456. package/dist/src/schemas/knowledge-package.d.ts +1 -1
  457. package/dist/src/server-bootstrap/routes-loader.d.ts +1 -0
  458. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
  459. package/dist/src/server-bootstrap/routes-loader.js +8 -0
  460. package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
  461. package/dist/src/server-bootstrap/static-files.d.ts +4 -0
  462. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
  463. package/dist/src/server-bootstrap/static-files.js +11 -0
  464. package/dist/src/server-bootstrap/static-files.js.map +1 -1
  465. package/dist/src/services/agent-face.d.ts +10 -2
  466. package/dist/src/services/agent-face.d.ts.map +1 -1
  467. package/dist/src/services/agent-face.js +10 -4
  468. package/dist/src/services/agent-face.js.map +1 -1
  469. package/dist/src/services/app-tool-interfaces.d.ts +37 -0
  470. package/dist/src/services/app-tool-interfaces.d.ts.map +1 -0
  471. package/dist/src/services/app-tool-interfaces.js +101 -0
  472. package/dist/src/services/app-tool-interfaces.js.map +1 -0
  473. package/dist/src/services/build-app-prompt.d.ts +22 -0
  474. package/dist/src/services/build-app-prompt.d.ts.map +1 -1
  475. package/dist/src/services/build-app-prompt.js +108 -11
  476. package/dist/src/services/build-app-prompt.js.map +1 -1
  477. package/dist/src/services/call-timing.d.ts +51 -0
  478. package/dist/src/services/call-timing.d.ts.map +1 -0
  479. package/dist/src/services/call-timing.js +91 -0
  480. package/dist/src/services/call-timing.js.map +1 -0
  481. package/dist/src/services/capability-invoke.d.ts +2 -0
  482. package/dist/src/services/capability-invoke.d.ts.map +1 -1
  483. package/dist/src/services/capability-invoke.js +10 -0
  484. package/dist/src/services/capability-invoke.js.map +1 -1
  485. package/dist/src/services/config-schema.d.ts.map +1 -1
  486. package/dist/src/services/config-schema.js +6 -0
  487. package/dist/src/services/config-schema.js.map +1 -1
  488. package/dist/src/services/contacts.d.ts +25 -1
  489. package/dist/src/services/contacts.d.ts.map +1 -1
  490. package/dist/src/services/contacts.js +30 -0
  491. package/dist/src/services/contacts.js.map +1 -1
  492. package/dist/src/services/draft-token.d.ts +22 -2
  493. package/dist/src/services/draft-token.d.ts.map +1 -1
  494. package/dist/src/services/draft-token.js +52 -3
  495. package/dist/src/services/draft-token.js.map +1 -1
  496. package/dist/src/services/entitlement-money.d.ts +55 -0
  497. package/dist/src/services/entitlement-money.d.ts.map +1 -0
  498. package/dist/src/services/entitlement-money.js +68 -0
  499. package/dist/src/services/entitlement-money.js.map +1 -0
  500. package/dist/src/services/exchange-market.d.ts +280 -0
  501. package/dist/src/services/exchange-market.d.ts.map +1 -0
  502. package/dist/src/services/exchange-market.js +276 -0
  503. package/dist/src/services/exchange-market.js.map +1 -0
  504. package/dist/src/services/exchange-odps.d.ts +58 -0
  505. package/dist/src/services/exchange-odps.d.ts.map +1 -0
  506. package/dist/src/services/exchange-odps.js +400 -0
  507. package/dist/src/services/exchange-odps.js.map +1 -0
  508. package/dist/src/services/exchange-projection.d.ts +61 -0
  509. package/dist/src/services/exchange-projection.d.ts.map +1 -0
  510. package/dist/src/services/exchange-projection.js +504 -0
  511. package/dist/src/services/exchange-projection.js.map +1 -0
  512. package/dist/src/services/exchange-proposals.d.ts +47 -0
  513. package/dist/src/services/exchange-proposals.d.ts.map +1 -0
  514. package/dist/src/services/exchange-proposals.js +73 -0
  515. package/dist/src/services/exchange-proposals.js.map +1 -0
  516. package/dist/src/services/exchange-work.d.ts +30 -0
  517. package/dist/src/services/exchange-work.d.ts.map +1 -0
  518. package/dist/src/services/exchange-work.js +43 -0
  519. package/dist/src/services/exchange-work.js.map +1 -0
  520. package/dist/src/services/extension-files.d.ts +64 -0
  521. package/dist/src/services/extension-files.d.ts.map +1 -0
  522. package/dist/src/services/extension-files.js +88 -0
  523. package/dist/src/services/extension-files.js.map +1 -0
  524. package/dist/src/services/extension-runtime.d.ts +33 -0
  525. package/dist/src/services/extension-runtime.d.ts.map +1 -1
  526. package/dist/src/services/extension-runtime.js +52 -0
  527. package/dist/src/services/extension-runtime.js.map +1 -1
  528. package/dist/src/services/file-refs.d.ts +105 -0
  529. package/dist/src/services/file-refs.d.ts.map +1 -0
  530. package/dist/src/services/file-refs.js +106 -0
  531. package/dist/src/services/file-refs.js.map +1 -0
  532. package/dist/src/services/message-send.d.ts.map +1 -1
  533. package/dist/src/services/message-send.js +4 -1
  534. package/dist/src/services/message-send.js.map +1 -1
  535. package/dist/src/services/metered-entitlements.d.ts +210 -0
  536. package/dist/src/services/metered-entitlements.d.ts.map +1 -0
  537. package/dist/src/services/metered-entitlements.js +268 -0
  538. package/dist/src/services/metered-entitlements.js.map +1 -0
  539. package/dist/src/services/notify.d.ts +7 -0
  540. package/dist/src/services/notify.d.ts.map +1 -1
  541. package/dist/src/services/notify.js +35 -0
  542. package/dist/src/services/notify.js.map +1 -1
  543. package/dist/src/services/owner-memory.d.ts +30 -1
  544. package/dist/src/services/owner-memory.d.ts.map +1 -1
  545. package/dist/src/services/owner-memory.js +31 -14
  546. package/dist/src/services/owner-memory.js.map +1 -1
  547. package/dist/src/services/owner-provisioning.d.ts +5 -0
  548. package/dist/src/services/owner-provisioning.d.ts.map +1 -1
  549. package/dist/src/services/owner-provisioning.js +20 -2
  550. package/dist/src/services/owner-provisioning.js.map +1 -1
  551. package/dist/src/services/task-files.d.ts +51 -0
  552. package/dist/src/services/task-files.d.ts.map +1 -0
  553. package/dist/src/services/task-files.js +58 -0
  554. package/dist/src/services/task-files.js.map +1 -0
  555. package/dist/src/services/upload-token.d.ts +29 -0
  556. package/dist/src/services/upload-token.d.ts.map +1 -1
  557. package/dist/src/services/upload-token.js +37 -0
  558. package/dist/src/services/upload-token.js.map +1 -1
  559. package/dist/src/services/upload-zip.d.ts +2 -0
  560. package/dist/src/services/upload-zip.d.ts.map +1 -1
  561. package/dist/src/services/upload-zip.js +5 -1
  562. package/dist/src/services/upload-zip.js.map +1 -1
  563. package/dist/src/services/workspace-meta.d.ts +15 -0
  564. package/dist/src/services/workspace-meta.d.ts.map +1 -1
  565. package/dist/src/services/workspace-meta.js +17 -0
  566. package/dist/src/services/workspace-meta.js.map +1 -1
  567. package/dist/src/services/workspace-provision.d.ts +3 -0
  568. package/dist/src/services/workspace-provision.d.ts.map +1 -1
  569. package/dist/src/services/workspace-provision.js +5 -3
  570. package/dist/src/services/workspace-provision.js.map +1 -1
  571. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +1 -0
  572. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
  573. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +10 -0
  574. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
  575. package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts +1 -0
  576. package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts.map +1 -1
  577. package/dist/src/storage/providers/postgres-kysely/methods/apps.js +2 -0
  578. package/dist/src/storage/providers/postgres-kysely/methods/apps.js.map +1 -1
  579. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts +1 -0
  580. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -1
  581. package/dist/src/storage/providers/postgres-kysely/methods/identity.js +4 -0
  582. package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -1
  583. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +2 -0
  584. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -1
  585. package/dist/src/storage/providers/postgres-kysely/methods/memory.js +12 -1
  586. package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -1
  587. package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -1
  588. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +5 -1
  589. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -1
  590. package/dist/src/storage/providers/postgres-kysely/migrations/0011_unique_verified_email.sql +25 -0
  591. package/dist/src/storage/providers/postgres-kysely/migrations/0012_unique_live_app_grant.sql +29 -0
  592. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +4 -0
  593. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  594. package/dist/src/storage/providers/sqlite/methods/apps.js +9 -0
  595. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  596. package/dist/src/storage/providers/sqlite/methods/governance.d.ts +1 -0
  597. package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
  598. package/dist/src/storage/providers/sqlite/methods/governance.js +4 -1
  599. package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
  600. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts +1 -0
  601. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
  602. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +4 -0
  603. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
  604. package/dist/src/storage/providers/sqlite/methods/owner.d.ts +5 -0
  605. package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
  606. package/dist/src/storage/providers/sqlite/methods/owner.js +8 -0
  607. package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
  608. package/dist/src/storage/providers/sqlite/schema.d.ts +3 -0
  609. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  610. package/dist/src/storage/providers/sqlite/schema.js +40 -0
  611. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  612. package/dist/src/storage/repositories/app-grant.repository.d.ts +9 -1
  613. package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
  614. package/dist/src/storage/repositories/app.repository.d.ts +0 -0
  615. package/dist/src/storage/repositories/app.repository.d.ts.map +1 -1
  616. package/dist/src/storage/repositories/identity.repository.d.ts +6 -0
  617. package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -1
  618. package/dist/src/storage/repositories/memory.repository.d.ts +14 -0
  619. package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
  620. package/dist/src/storage/repositories-impl/memory-repository.d.ts +8 -1
  621. package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -1
  622. package/dist/src/storage/repositories-impl/memory-repository.js +15 -4
  623. package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -1
  624. package/dist/src/storage/types/agents-messaging.d.ts +19 -0
  625. package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
  626. package/dist/src/storage/types/agents-messaging.js.map +1 -1
  627. package/dist/src/storage/types/apps.d.ts +1 -0
  628. package/dist/src/storage/types/apps.d.ts.map +1 -1
  629. package/dist/src/storage/types/organisms-federation.d.ts +50 -0
  630. package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
  631. package/dist/src/utils/app-badge.d.ts.map +1 -1
  632. package/dist/src/utils/app-badge.js +7 -3
  633. package/dist/src/utils/app-badge.js.map +1 -1
  634. package/dist/src/utils/app-mobile-lint.d.ts +17 -0
  635. package/dist/src/utils/app-mobile-lint.d.ts.map +1 -0
  636. package/dist/src/utils/app-mobile-lint.js +40 -0
  637. package/dist/src/utils/app-mobile-lint.js.map +1 -0
  638. package/dist/static/app-catalog/_template.html +18 -82
  639. package/dist/static/app-catalog/js/apps-io.js +51 -165
  640. package/dist/static/app-catalog/js/cortex.js +3 -1
  641. package/dist/static/app-catalog/js/cost.js +100 -0
  642. package/dist/static/app-catalog/js/db.js +23 -93
  643. package/dist/static/app-catalog/js/detail.js +568 -59
  644. package/dist/static/app-catalog/js/favorites.js +71 -0
  645. package/dist/static/app-catalog/js/i18n-data.js +369 -19
  646. package/dist/static/app-catalog/js/main.js +50 -139
  647. package/dist/static/app-catalog/js/migrate.js +88 -0
  648. package/dist/static/app-catalog/js/monetize.js +205 -17
  649. package/dist/static/app-catalog/js/odps.js +489 -0
  650. package/dist/static/app-catalog/js/promote.js +70 -0
  651. package/dist/static/app-catalog/js/render.js +29 -139
  652. package/dist/static/app-catalog/js/server-io.js +126 -223
  653. package/dist/static/app-catalog/js/settings.js +11 -204
  654. package/dist/static/app-catalog/js/workcopy.js +198 -0
  655. package/dist/static/app-catalog/styles/app-catalog.css +100 -0
  656. package/dist/static/app-catalog.html +2220 -1029
  657. package/dist/static/sdk-libs/_core/config.js +52 -0
  658. package/dist/static/sdk-libs/_core/http.js +52 -0
  659. package/dist/static/sdk-libs/_core/namespace.js +33 -0
  660. package/dist/static/sdk-libs/_core/sdk-globals.d.ts +50 -0
  661. package/dist/static/sdk-libs/_core/session.js +66 -0
  662. package/dist/static/sdk-libs/agentface/index.js +102 -0
  663. package/dist/static/sdk-libs/agents/index.js +305 -0
  664. package/dist/static/sdk-libs/ai/index.js +153 -0
  665. package/dist/static/sdk-libs/audio/core.js +111 -0
  666. package/dist/static/sdk-libs/audio/index.js +380 -0
  667. package/dist/static/sdk-libs/audio/instruments.js +369 -0
  668. package/dist/static/sdk-libs/auth/cluster.js +97 -0
  669. package/dist/static/sdk-libs/auth/config.js +46 -0
  670. package/dist/static/sdk-libs/auth/crypto.js +166 -0
  671. package/dist/static/sdk-libs/auth/events.js +27 -0
  672. package/dist/static/sdk-libs/auth/i18n.js +64 -0
  673. package/dist/static/sdk-libs/auth/index.js +61 -0
  674. package/dist/static/sdk-libs/auth/locale.js +151 -0
  675. package/dist/static/sdk-libs/auth/modal.js +554 -0
  676. package/dist/static/sdk-libs/auth/palette.js +172 -0
  677. package/dist/static/sdk-libs/auth/pill.js +198 -0
  678. package/dist/static/sdk-libs/auth/session.js +792 -0
  679. package/dist/static/sdk-libs/auth/signup.js +232 -0
  680. package/dist/static/sdk-libs/auth/theme.js +137 -0
  681. package/dist/static/sdk-libs/capabilities/index.js +179 -0
  682. package/dist/static/sdk-libs/commerce/index.js +243 -0
  683. package/dist/static/sdk-libs/data/index.js +250 -0
  684. package/dist/static/sdk-libs/dist/aimeat-agentface.js +91 -0
  685. package/dist/static/sdk-libs/dist/aimeat-agents.js +348 -0
  686. package/dist/static/sdk-libs/dist/aimeat-ai.js +168 -0
  687. package/dist/static/sdk-libs/dist/aimeat-audio.js +979 -0
  688. package/dist/static/sdk-libs/dist/aimeat-auth.js +2232 -0
  689. package/dist/static/sdk-libs/dist/aimeat-capabilities.js +177 -0
  690. package/dist/static/sdk-libs/dist/aimeat-commerce.js +265 -0
  691. package/dist/static/sdk-libs/dist/aimeat-data.js +247 -0
  692. package/dist/static/sdk-libs/dist/aimeat-editor.js +299 -0
  693. package/dist/static/sdk-libs/dist/aimeat-header.js +270 -0
  694. package/dist/static/sdk-libs/dist/aimeat-intake.js +94 -0
  695. package/dist/static/sdk-libs/dist/aimeat-live.js +317 -0
  696. package/dist/static/sdk-libs/dist/aimeat-markdown.js +633 -0
  697. package/dist/static/sdk-libs/dist/aimeat-organism.js +394 -0
  698. package/dist/static/sdk-libs/dist/aimeat-portfolio-standalone.js +90 -0
  699. package/dist/static/sdk-libs/dist/aimeat-social.js +157 -0
  700. package/dist/static/sdk-libs/dist/aimeat-speech.js +300 -0
  701. package/dist/static/sdk-libs/dist/aimeat-storage.js +210 -0
  702. package/dist/static/sdk-libs/dist/aimeat-tunnel.js +383 -0
  703. package/dist/static/sdk-libs/dist/aimeat-wallet.js +118 -0
  704. package/dist/static/sdk-libs/dist/aimeat-webmcp.js +187 -0
  705. package/dist/static/sdk-libs/dist/aimeat-work.js +213 -0
  706. package/dist/static/sdk-libs/dist/aimeat-workflows.js +147 -0
  707. package/dist/static/sdk-libs/editor/index.js +229 -0
  708. package/dist/static/sdk-libs/header/index.js +249 -0
  709. package/dist/static/sdk-libs/intake/index.js +75 -0
  710. package/dist/static/sdk-libs/live/index.js +223 -0
  711. package/dist/static/sdk-libs/markdown/index.js +570 -0
  712. package/dist/static/sdk-libs/organism/index.js +381 -0
  713. package/dist/static/sdk-libs/portfolio-standalone/index.js +78 -0
  714. package/dist/static/sdk-libs/social/index.js +140 -0
  715. package/dist/static/sdk-libs/speech/index.js +321 -0
  716. package/dist/static/sdk-libs/storage/index.js +189 -0
  717. package/dist/static/sdk-libs/tunnel/index.js +428 -0
  718. package/dist/static/sdk-libs/wallet/index.js +115 -0
  719. package/dist/static/sdk-libs/webmcp/index.js +185 -0
  720. package/dist/static/sdk-libs/work/index.js +191 -0
  721. package/dist/static/sdk-libs/workflows/index.js +113 -0
  722. package/package.json +10 -3
@@ -0,0 +1,226 @@
1
+ import { z } from 'zod';
2
+ import { parseGaiiLoose } from '../utils/gaii.js';
3
+ import { annotationsFor } from './annotations.js';
4
+ import { descriptionFor } from './catalog/shape.js';
5
+ import { readEntitlementForCall } from '../services/metered-entitlements.js';
6
+ import { getOffering } from '../services/exchange-market.js';
7
+ import { newWorkId, putWork, getWork, listWorkByConsumer, listWorkByProvider, } from '../services/exchange-work.js';
8
+ import { getProposal, listProposalsForOwner, supersedeWithProposal, putProposal, } from '../services/exchange-proposals.js';
9
+ import { settleMeteredCoordinate } from '../routes/extensions/entitlement-gate.js';
10
+ import { appToolsKey, AppToolsDocSchema } from '../models/app-tool-schemas.js';
11
+ import { getInterfaceVersion } from '../services/app-tool-interfaces.js';
12
+ import { sendDirectMessage } from '../services/message-send.js';
13
+ /** A capture-only mock Express Response: settleMeteredCoordinate writes its 402/429/500 body here on
14
+ * failure (it only ever calls res.status(code).json(body)); success never touches res. */
15
+ function captureRes() {
16
+ let cap = null;
17
+ const res = {
18
+ status(status) {
19
+ return { json(body) { cap = { status, body }; return res; } };
20
+ },
21
+ };
22
+ return { res, taken: () => cap };
23
+ }
24
+ /** Pull a human message out of a captured error envelope. */
25
+ function capMessage(cap, fallback) {
26
+ const b = cap?.body;
27
+ return b?.error?.message ? `${b.error.code ?? 'ERROR'}: ${b.error.message}` : fallback;
28
+ }
29
+ export function registerExchangeRunTools(mcp, storage, config, getAgentGaii, getToken) {
30
+ const agentGaii = getAgentGaii();
31
+ const owner = parseGaiiLoose(agentGaii).owner;
32
+ const callerGaii = agentGaii;
33
+ const ok = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
34
+ const fail = (msg) => ({ content: [{ type: 'text', text: msg }], isError: true });
35
+ const gh = (o) => `${o}@${config.nodeId}`;
36
+ async function notify(recipientOwner, subject, body) {
37
+ try {
38
+ await sendDirectMessage({ config, storage, peers: new Map() }, {
39
+ senderGhii: gh(owner), recipientGhii: gh(recipientOwner), body, subject, respondable: false, skipContactGate: true,
40
+ });
41
+ }
42
+ catch { /* notification failure must never fail the action */ }
43
+ }
44
+ function workView(w) {
45
+ return {
46
+ work_id: w.workId, offering_id: w.offeringId, consumer: w.consumerGaii, provider: w.providerGhii,
47
+ agent: w.agentGaii, task_type: w.taskType, ext: w.ext, action: w.action, input: w.input, output: w.output,
48
+ note: w.note, state: w.state, unit: w.unit, currency: w.currency, charged_units: w.chargedUnits,
49
+ created_at: w.createdAt, delivered_at: w.deliveredAt,
50
+ };
51
+ }
52
+ // ── aimeat_app_tool_invoke — call an app's offered tool through your metered contract ──────────────
53
+ mcp.tool('aimeat_app_tool_invoke', descriptionFor('aimeat_app_tool_invoke'), {
54
+ owner: z.string().min(1).max(120),
55
+ app: z.string().min(1).max(120),
56
+ tool: z.string().min(1).max(120),
57
+ input: z.record(z.string(), z.unknown()).optional(),
58
+ }, annotationsFor('aimeat_app_tool_invoke'), async ({ owner: appOwner, app, tool, input }) => {
59
+ const ownerName = appOwner.split('@')[0];
60
+ const manifestRec = await storage.getMemory(`${ownerName}@${config.nodeId}`, appToolsKey(app));
61
+ if (!manifestRec)
62
+ return fail(`APP_TOOLS_NOT_FOUND: app "${ownerName}/${app}" declares no tool manifest`);
63
+ const parsed = AppToolsDocSchema.safeParse(manifestRec.value);
64
+ if (!parsed.success)
65
+ return fail(`INVALID_TOOL_MANIFEST: app "${ownerName}/${app}" tool manifest is malformed`);
66
+ const toolDef = parsed.data.tools.find(t => t.name === tool);
67
+ if (!toolDef)
68
+ return fail(`TOOL_NOT_FOUND: no tool "${tool}" on app "${ownerName}/${app}"`);
69
+ const coordExt = `apptool:${ownerName}/${app}`;
70
+ const ent = await readEntitlementForCall(storage, callerGaii, coordExt, tool);
71
+ if (!ent)
72
+ return fail(`NO_CONTRACT: accept a contract for "${ownerName}/${app}/${tool}" first (aimeat_exchange_accept with its offering_id)`);
73
+ // Resolve the binding from the PINNED interface snapshot (the freeze), else the tool's current binding.
74
+ const pinnedVersion = ent.surface && ent.surface.kind === 'app-tool' ? ent.surface.ifaceVersion : undefined;
75
+ const iface = pinnedVersion ? await getInterfaceVersion(storage, ent.providerGhii, app, tool, pinnedVersion) : null;
76
+ const binding = iface?.binding ?? toolDef.action_id ?? null;
77
+ if (!binding)
78
+ return fail('TOOL_NOT_INVOKABLE: this tool has no capability binding to invoke');
79
+ const cap = await storage.getCapability(binding);
80
+ if (!cap)
81
+ return fail(`CAPABILITY_NOT_FOUND: backing capability not found (${binding})`);
82
+ // Settle the metered call (budget + rake) through the SAME gateway as the REST WebMCP path.
83
+ const { res, taken } = captureRes();
84
+ const outcome = await settleMeteredCoordinate({
85
+ config, storage, coordExt, coordAction: tool,
86
+ label: `${app}/${tool}${pinnedVersion ? ` v${pinnedVersion}` : ''}`, callerGaii, res,
87
+ });
88
+ if (!outcome)
89
+ return fail('NO_CONTRACT: no active contract to settle against');
90
+ if (!outcome.ok)
91
+ return fail(capMessage(taken(), 'PAYMENT_REQUIRED: the metered call could not settle'));
92
+ // Settled → invoke; refund on throw (never leave a phantom charge).
93
+ try {
94
+ const { invokeCapability } = await import('../services/capability-invoke.js');
95
+ const invoked = await invokeCapability(config, storage, cap, (input ?? {}), callerGaii, getToken() ?? '', 'normal');
96
+ return ok({ app: `${ownerName}/${app}`, tool, iface_version: pinnedVersion ?? null, metered: true, result: invoked.result });
97
+ }
98
+ catch (err) {
99
+ if (outcome.refund)
100
+ await outcome.refund();
101
+ const e = err;
102
+ return fail(`${e.code ?? 'TOOL_INVOKE_FAILED'}: ${e.message ?? 'tool invocation failed (you were refunded)'}`);
103
+ }
104
+ });
105
+ // ── aimeat_exchange_work — start a task under an agent-work contract (consumer) ────────────────────
106
+ mcp.tool('aimeat_exchange_work', descriptionFor('aimeat_exchange_work'), {
107
+ offering_id: z.string().min(1).max(120),
108
+ input: z.record(z.string(), z.unknown()).optional(),
109
+ note: z.string().max(2000).optional(),
110
+ }, annotationsFor('aimeat_exchange_work'), async ({ offering_id, input, note }) => {
111
+ const o = await getOffering(storage, offering_id);
112
+ if (!o || o.state !== 'listed' || o.kind !== 'agent-work' || !o.surface || o.surface.kind !== 'agent-work') {
113
+ return fail('NOT_FOUND: no such listed agent-work offering');
114
+ }
115
+ const ent = await readEntitlementForCall(storage, callerGaii, o.ext, o.action);
116
+ if (!ent || ent.state !== 'active') {
117
+ return fail('NO_CONTRACT: accept a contract for this agent-work offering before starting a task');
118
+ }
119
+ const s = o.surface;
120
+ const now = new Date().toISOString();
121
+ const work = {
122
+ workId: newWorkId(), offeringId: offering_id, consumerGaii: callerGaii, consumerOwner: owner,
123
+ providerGhii: o.providerGhii, providerOwner: o.providerOwner,
124
+ agentGaii: `${s.agentName}#${o.providerOwner}@${config.nodeId}`, taskType: s.taskType,
125
+ ext: o.ext, action: o.action, input: input ?? {}, output: null,
126
+ note: note ?? '', state: 'open', unit: ent.unit, currency: ent.currency,
127
+ chargedUnits: 0, createdAt: now, deliveredAt: null,
128
+ };
129
+ await putWork(storage, work);
130
+ await notify(o.providerOwner, 'EXCHANGE — new agent work started', `${owner} started a "${s.taskType}" task for your agent ${s.agentName} (work ${work.workId}). Deliver it to get paid.`);
131
+ return ok({ work: workView(work) });
132
+ });
133
+ // ── aimeat_exchange_work_deliver — provider delivers → settle on delivery ──────────────────────────
134
+ mcp.tool('aimeat_exchange_work_deliver', descriptionFor('aimeat_exchange_work_deliver'), {
135
+ work_id: z.string().min(1).max(120),
136
+ output: z.unknown().optional(),
137
+ note: z.string().max(2000).optional(),
138
+ }, annotationsFor('aimeat_exchange_work_deliver'), async ({ work_id, output, note }) => {
139
+ const w = await getWork(storage, work_id);
140
+ if (!w || w.providerOwner !== owner)
141
+ return fail('NOT_FOUND: no such work of yours to deliver');
142
+ if (w.state !== 'open')
143
+ return fail(`WORK_NOT_OPEN: work is ${w.state}`);
144
+ const before = await readEntitlementForCall(storage, w.consumerGaii, w.ext, w.action);
145
+ if (!before || before.state !== 'active')
146
+ return fail('CONTRACT_INACTIVE: the consumer contract is no longer active — cannot settle this delivery');
147
+ const { res, taken } = captureRes();
148
+ const outcome = await settleMeteredCoordinate({
149
+ config, storage, coordExt: w.ext, coordAction: w.action, label: `${w.agentGaii}:${w.taskType}`,
150
+ callerGaii: w.consumerGaii, res,
151
+ });
152
+ if (!outcome)
153
+ return fail('NO_CONTRACT: no active contract to settle against');
154
+ if (!outcome.ok)
155
+ return fail(capMessage(taken(), 'PAYMENT_REQUIRED: delivery could not settle (budget/rate)'));
156
+ const after = await readEntitlementForCall(storage, w.consumerGaii, w.ext, w.action);
157
+ const charged = after && before ? Math.max(0, after.budget.spentUnits - before.budget.spentUnits) : 0;
158
+ w.state = 'delivered';
159
+ w.output = output ?? null;
160
+ w.chargedUnits = charged;
161
+ w.deliveredAt = new Date().toISOString();
162
+ if (note)
163
+ w.note = note.slice(0, 2000);
164
+ await putWork(storage, w);
165
+ await notify(w.consumerOwner, 'EXCHANGE — your agent work was delivered', `Your "${w.taskType}" task (work ${w.workId}) was delivered by ${owner} and charged to your contract.`);
166
+ return ok({ work: workView(w) });
167
+ });
168
+ // ── aimeat_exchange_work_list — your agent-work items (consumer default, or provider) ──────────────
169
+ mcp.tool('aimeat_exchange_work_list', descriptionFor('aimeat_exchange_work_list'), {
170
+ role: z.enum(['consumer', 'provider']).optional(),
171
+ }, annotationsFor('aimeat_exchange_work_list'), async ({ role }) => {
172
+ const items = role === 'provider' ? await listWorkByProvider(storage, owner) : await listWorkByConsumer(storage, owner);
173
+ return ok({ work: items.map(workView), count: items.length, role: role ?? 'consumer' });
174
+ });
175
+ // ── aimeat_exchange_proposals — renegotiation proposals you are party to ───────────────────────────
176
+ mcp.tool('aimeat_exchange_proposals', descriptionFor('aimeat_exchange_proposals'), {}, annotationsFor('aimeat_exchange_proposals'), async () => {
177
+ const list = await listProposalsForOwner(storage, owner);
178
+ const view = list.map(p => ({
179
+ proposal_id: p.proposalId, capability: p.capabilityLabel, ext: p.ext, action: p.action,
180
+ consumer_gaii: p.consumerGaii, provider: p.providerGhii,
181
+ proposed_by: p.proposedByRole, proposer_owner: p.proposerOwner, counterparty_owner: p.counterpartyOwner,
182
+ new_price_per_call: p.newPricePerCall, new_cap_units: p.newCapUnits, note: p.note,
183
+ current_terms: p.currentTerms, status: p.status, created_at: p.createdAt, resolved_at: p.resolvedAt,
184
+ }));
185
+ return ok({ proposals: view, count: view.length });
186
+ });
187
+ // ── aimeat_exchange_proposal_decide — accept (supersede) / decline / withdraw a proposal ───────────
188
+ mcp.tool('aimeat_exchange_proposal_decide', descriptionFor('aimeat_exchange_proposal_decide'), {
189
+ proposal_id: z.string().min(1).max(120),
190
+ decision: z.enum(['accept', 'decline', 'withdraw']),
191
+ }, annotationsFor('aimeat_exchange_proposal_decide'), async ({ proposal_id, decision }) => {
192
+ const p = await getProposal(storage, proposal_id);
193
+ if (!p || p.status !== 'pending')
194
+ return fail('NOT_FOUND: no such pending proposal');
195
+ if (decision === 'withdraw') {
196
+ if (p.proposerOwner !== owner)
197
+ return fail('FORBIDDEN: only the proposer may withdraw');
198
+ p.status = 'withdrawn';
199
+ p.resolvedAt = new Date().toISOString();
200
+ await putProposal(storage, p);
201
+ return ok({ proposal_id: p.proposalId, status: p.status });
202
+ }
203
+ // accept / decline are the COUNTERPARTY's calls.
204
+ if (p.counterpartyOwner !== owner)
205
+ return fail(`FORBIDDEN: only the counterparty (${p.counterpartyOwner}) may ${decision} this proposal`);
206
+ if (decision === 'decline') {
207
+ p.status = 'declined';
208
+ p.resolvedAt = new Date().toISOString();
209
+ await putProposal(storage, p);
210
+ await notify(p.proposerOwner, 'EXCHANGE — contract change declined', `${owner} declined your proposed change to ${p.capabilityLabel}. The contract is unchanged.`);
211
+ return ok({ proposal_id: p.proposalId, status: p.status });
212
+ }
213
+ const ent = await supersedeWithProposal(storage, p);
214
+ if (!ent)
215
+ return fail('CONTRACT_GONE: the contract no longer exists');
216
+ p.status = 'accepted';
217
+ p.resolvedAt = new Date().toISOString();
218
+ await putProposal(storage, p);
219
+ await notify(p.proposerOwner, 'EXCHANGE — contract change accepted', `${owner} accepted your proposed change to ${p.capabilityLabel}. The new contract is in effect; the previous one is in your contract history.`);
220
+ return ok({
221
+ proposal_id: p.proposalId, status: p.status,
222
+ entitlement: { ext: ent.ext, action: ent.action, price_per_call: ent.pricePerCall, unit: ent.unit, state: ent.state, cap_units: ent.budget.capUnits },
223
+ });
224
+ });
225
+ }
226
+ //# sourceMappingURL=exchange-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange-run.js","sourceRoot":"","sources":["../../../src/mcp/exchange-run.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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AAE,WAAW,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC,8CAA8C,CAAC,CAAC;QACtE,CAAC,CAAC,MAAM,GAAG,UAAU,CAAC;QAAC,CAAC,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAAC,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9F,MAAM,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,qCAAqC,EAC/D,GAAG,KAAK,qCAAqC,CAAC,CAAC,eAAe,gFAAgF,CAAC,CAAC;QACpJ,OAAO,EAAE,CAAC;YACN,WAAW,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM;YAC3C,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE;SACxJ,CAAC,CAAC;IACP,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { AimeatConfig } from '../config.js';
3
+ import type { Storage } from '../storage/interface.js';
4
+ export declare function registerExchangeTools(mcp: McpServer, storage: Storage, config: AimeatConfig, getAgentGaii: () => string): void;
5
+ //# sourceMappingURL=exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../../src/mcp/exchange.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAoEvD,wBAAgB,qBAAqB,CACjC,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,MAAM,GAC3B,IAAI,CAoUN"}
@@ -0,0 +1,352 @@
1
+ /**
2
+ * @file src/mcp/exchange.ts
3
+ * @description MCP EXCHANGE marketplace tools (TARGET-045 over MCP): the agent-facing surface for the
4
+ * two-sided data-service market. Consumer side — browse OFFERINGs, read one in full (I/O schema +
5
+ * call-recipe + stats), ACCEPT a contract (mint a metered entitlement for the CALLER), list the
6
+ * caller's own contracts, pause/revoke one, post + browse NEEDs, and accept a bid. Provider side —
7
+ * bid on a need with an action the caller's extension owns, and see who holds contracts against an
8
+ * offering. Every tool mirrors the REST handlers in src/routes/exchange.ts + exchange-market.ts,
9
+ * calling the SAME services (exchange-market.ts, metered-entitlements.ts) — no new business logic.
10
+ * Pricing is ALWAYS authoritative from the provider action (resolveActionPricing), so a consumer can
11
+ * never undercut the provider. The consumer/requester identity is the caller's resolved GAII (never
12
+ * from input). Scope gates (exchange:read / exchange:write) are enforced by the per-session
13
+ * registration filter (catalog/scopes.ts) — stricter than the requireAuth-only REST routes on purpose.
14
+ * @structure registerExchangeTools() — registers 10 tools on an McpServer instance
15
+ * @usage
16
+ * import { registerExchangeTools } from './exchange.js';
17
+ * registerExchangeTools(mcp, storage, config, () => agentGaii);
18
+ * @version-history
19
+ * v1.2.0 — 2026-07-21 — need_post carries usage_intent; needs listings enriched with the requesting app's
20
+ * name/description (enrichNeeds) so a provider can judge who they'd serve.
21
+ * v1.1.0 — 2026-07-21 — accept by `offering_id` (ext-action AND app-tool kinds, via resolveOfferingPricing);
22
+ * offering_get surfaces the pinned app-tool interface schema + WebMCP call recipe (Gap 1 cross-app selling).
23
+ * v1.0.0 — 2026-07-20 — Initial EXCHANGE MCP surface (offerings/accept/contracts/off/needs/bid/consumers)
24
+ */
25
+ import { randomUUID } from 'node:crypto';
26
+ import { z } from 'zod';
27
+ import { parseGaiiLoose } from '../utils/gaii.js';
28
+ import { annotationsFor } from './annotations.js';
29
+ import { descriptionFor } from './catalog/shape.js';
30
+ import { commerceFeePercent } from '../services/marketplace-fee.js';
31
+ import { percentFee } from '../commerce/money.js';
32
+ import { createEntitlement, readEntitlementForCall, listEntitlementsByConsumer, pauseEntitlement, revokeEntitlement, } from '../services/metered-entitlements.js';
33
+ import { resolveActionPricing, resolveOfferingPricing, newNeedId, newBidId, getOffering, listOfferings, matchOfferings, putNeed, getNeed, listNeeds, putBid, getBid, offeringStats, offeringConsumers, enrichNeeds, } from '../services/exchange-market.js';
34
+ import { getInterfaceVersion } from '../services/app-tool-interfaces.js';
35
+ function ownerOf(gaii) {
36
+ return gaii.split('@')[0].split('#').pop() ?? gaii;
37
+ }
38
+ /** Shape a metered entitlement for the consumer-facing view (mirrors src/routes/exchange.ts `view`). */
39
+ function entitlementView(config, e) {
40
+ const rakePct = e.rakePercent ?? commerceFeePercent(config);
41
+ return {
42
+ entitlement_id: e.entitlementId,
43
+ consumer_gaii: e.consumerGaii,
44
+ app_id: e.appId,
45
+ provider: e.providerGhii,
46
+ ext: e.ext,
47
+ action: e.action,
48
+ surface: e.surface ?? null,
49
+ capability: e.capabilityLabel,
50
+ unit: e.unit,
51
+ currency: e.currency,
52
+ price_per_call: e.pricePerCall,
53
+ pricing: e.pricing ?? { model: 'per_call' },
54
+ rake_percent: rakePct,
55
+ rake_per_call: percentFee(e.pricePerCall, rakePct),
56
+ contract_ref: e.contractRef,
57
+ escrow_party: e.escrowParty,
58
+ state: e.state,
59
+ budget: {
60
+ cap_units: e.budget.capUnits,
61
+ spent_units: e.budget.spentUnits,
62
+ remaining_units: e.budget.capUnits === null ? null : Math.max(0, e.budget.capUnits - e.budget.spentUnits),
63
+ calls: e.budget.calls,
64
+ },
65
+ };
66
+ }
67
+ /** Parse a need's minimum-spec from a loose input object (mirrors exchange-market.ts route parseNeedSpec). */
68
+ function parseNeedSpec(v) {
69
+ if (!v || typeof v !== 'object')
70
+ return null;
71
+ const o = v;
72
+ const isObj = (x) => !!x && typeof x === 'object' && !Array.isArray(x);
73
+ const requiredFields = Array.isArray(o.requiredFields) ? o.requiredFields.filter(f => typeof f === 'string') : [];
74
+ const spec = { requiredFields };
75
+ if (typeof o.format === 'string')
76
+ spec.format = o.format;
77
+ if (typeof o.sample === 'string')
78
+ spec.sample = o.sample;
79
+ if (typeof o.notes === 'string')
80
+ spec.notes = o.notes;
81
+ if (isObj(o.inputSchema))
82
+ spec.inputSchema = o.inputSchema;
83
+ if (isObj(o.outputSchema))
84
+ spec.outputSchema = o.outputSchema;
85
+ return (requiredFields.length || spec.format || spec.sample || spec.notes || spec.inputSchema || spec.outputSchema) ? spec : null;
86
+ }
87
+ export function registerExchangeTools(mcp, storage, config, getAgentGaii) {
88
+ const agentGaii = getAgentGaii();
89
+ const owner = parseGaiiLoose(agentGaii).owner;
90
+ // The consumer/requester identity is the CALLER's own resolved GAII (never from input), so a caller
91
+ // can only accept/post/off/bid on their own behalf — the same guarantee resolveIdentity gives REST.
92
+ const consumerGaii = agentGaii;
93
+ const ok = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
94
+ const fail = (msg) => ({ content: [{ type: 'text', text: msg }], isError: true });
95
+ // ── Browse offerings (supply) ──────────────────────────────────────────────
96
+ mcp.tool('aimeat_exchange_offerings', descriptionFor('aimeat_exchange_offerings'), {
97
+ q: z.string().max(400).optional(),
98
+ ext: z.string().max(120).optional(),
99
+ action: z.string().max(120).optional(),
100
+ stats: z.boolean().optional(),
101
+ }, annotationsFor('aimeat_exchange_offerings'), async ({ q, ext, action, stats }) => {
102
+ const offerings = (ext && action) || q
103
+ ? await matchOfferings(storage, { ext: ext || null, action: action || null, text: q || null })
104
+ : await listOfferings(storage);
105
+ if (stats) {
106
+ const withStats = await Promise.all(offerings.map(async (o) => ({ ...o, stats: await offeringStats(storage, o) })));
107
+ return ok({ offerings: withStats, count: withStats.length });
108
+ }
109
+ return ok({ offerings, count: offerings.length });
110
+ });
111
+ // ── One offering in full (detail + I/O schema + call-recipe + stats) ────────
112
+ mcp.tool('aimeat_exchange_offering_get', descriptionFor('aimeat_exchange_offering_get'), {
113
+ offering_id: z.string().min(1).max(120),
114
+ }, annotationsFor('aimeat_exchange_offering_get'), async ({ offering_id }) => {
115
+ const o = await getOffering(storage, offering_id);
116
+ if (!o)
117
+ return fail(`NOT_FOUND: no such offering "${offering_id}"`);
118
+ const stats = await offeringStats(storage, o);
119
+ if (o.kind === 'app-tool' && o.surface && o.surface.kind === 'app-tool') {
120
+ const s = o.surface;
121
+ const iface = await getInterfaceVersion(storage, o.providerGhii, s.appId, s.tool, s.ifaceVersion);
122
+ return ok({
123
+ offering: o,
124
+ capability: iface ? {
125
+ kind: 'app-tool', app: `${s.ownerName}/${s.appId}`, tool: s.tool, iface_version: s.ifaceVersion,
126
+ input_schema: iface.inputSchema, output_schema: iface.outputSchema,
127
+ } : null,
128
+ call_recipe: {
129
+ method: 'POST',
130
+ url: `/v1/apps/${encodeURIComponent(s.ownerName)}/${encodeURIComponent(s.appId)}/webmcp/tools/${encodeURIComponent(s.tool)}`,
131
+ auth: 'Your own AIMEAT token — the accepted contract (metered entitlement) authorises the call; no separate API key is issued.',
132
+ note: `Metered + charged to your budget. Pinned to interface v${s.ifaceVersion}; the provider may ship newer app versions without breaking your integration.`,
133
+ body: '{ "input": { … } }',
134
+ },
135
+ stats,
136
+ });
137
+ }
138
+ const extRec = await storage.getExtension(o.ext);
139
+ const act = extRec?.actions.find(a => a.id === o.action);
140
+ return ok({
141
+ offering: o,
142
+ capability: act ? {
143
+ input_schema: act.inputSchema ?? {},
144
+ output_schema: act.outputSchema ?? {},
145
+ toll_morsels: act.tollMorsels ?? 0,
146
+ } : null,
147
+ call_recipe: {
148
+ method: 'POST',
149
+ url: `/v1/ext/${o.ext}/${o.action}`,
150
+ auth: 'Your own AIMEAT token — the accepted contract (metered entitlement) authorises the call; no separate API key is issued.',
151
+ note: 'Each call is metered + charged to your budget at the provider price; the provider’s own upstream keys stay server-side.',
152
+ mcp: `aimeat_extension_invoke { "name": "${o.ext}", "action": "${o.action}", "input": { … } }`,
153
+ },
154
+ stats,
155
+ });
156
+ });
157
+ // ── Accept a contract → mint a metered entitlement for the caller ───────────
158
+ mcp.tool('aimeat_exchange_accept', descriptionFor('aimeat_exchange_accept'), {
159
+ offering_id: z.string().min(1).max(120).optional(),
160
+ ext: z.string().min(1).max(120).optional(),
161
+ action: z.string().min(1).max(120).optional(),
162
+ contract_ref: z.string().min(1).max(200).optional(),
163
+ cap_units: z.number().int().nonnegative().optional(),
164
+ plan_id: z.string().min(1).max(120).optional(),
165
+ app_id: z.string().min(1).max(300).optional(),
166
+ }, annotationsFor('aimeat_exchange_accept'), async ({ offering_id, ext, action, contract_ref, cap_units, plan_id, app_id }) => {
167
+ const capUnits = cap_units !== undefined ? Math.floor(cap_units) : null;
168
+ // Preferred: accept an OFFERING by id (works for ext-action AND app-tool kinds).
169
+ if (offering_id) {
170
+ const o = await getOffering(storage, offering_id);
171
+ if (!o || o.state !== 'listed')
172
+ return fail('NOT_FOUND: no such listed offering');
173
+ const priced = await resolveOfferingPricing(storage, o, plan_id ?? null);
174
+ if (!priced.ok)
175
+ return fail(`${priced.code}: ${priced.message}`);
176
+ const minCharge = priced.pricing?.model === 'bundle' ? priced.pricing.blockPrice : priced.pricing?.model === 'subscription' ? priced.pricing.periodPrice : priced.pricePerCall;
177
+ if (capUnits !== null && capUnits < minCharge) {
178
+ return fail(`BUDGET_TOO_LOW: budget cap (${capUnits}) is below the ${minCharge}-${priced.unit === 'money' ? priced.currency : 'morsel'} minimum charge`);
179
+ }
180
+ const existing = await readEntitlementForCall(storage, consumerGaii, priced.ext, priced.action);
181
+ const ent = await createEntitlement(storage, {
182
+ consumerGaii, appId: app_id ?? null, providerGhii: priced.providerGhii, ext: priced.ext, action: priced.action,
183
+ capabilityLabel: priced.capabilityLabel, unit: priced.unit, pricePerCall: priced.pricePerCall,
184
+ currency: priced.currency, pricing: priced.pricing, capUnits, contractRef: contract_ref || `offering:${offering_id}`,
185
+ surface: priced.surface, tollMorsels: priced.tollMorsels, createdBy: owner, carrySpend: existing,
186
+ });
187
+ return ok({ entitlement: entitlementView(config, ent) });
188
+ }
189
+ // Legacy: accept a raw ext-action directly.
190
+ if (!ext || !action)
191
+ return fail('BAD_REQUEST: pass offering_id, or both ext and action');
192
+ const contractRef = contract_ref || `mcp:${randomUUID()}`;
193
+ const extRec = await storage.getExtension(ext);
194
+ if (!extRec)
195
+ return fail(`NOT_FOUND: extension "${ext}" not found`);
196
+ const act = extRec.actions.find(a => a.id === action);
197
+ if (!act)
198
+ return fail(`NOT_FOUND: action "${action}" not found on "${ext}"`);
199
+ // AUTHORITATIVE price + unit + (optional plan) pricing — shared resolver, so a consumer can
200
+ // never undercut the provider. `plan_id` picks a provider-declared plan; none → per_call.
201
+ const priced = resolveActionPricing(act.commercial, plan_id ?? null);
202
+ if (!priced.ok)
203
+ return fail(`${priced.code}: action "${ext}/${action}": ${priced.message}`);
204
+ const { unit, pricePerCall, currency, pricing } = priced;
205
+ const minCharge = pricing?.model === 'bundle' ? pricing.blockPrice : pricing?.model === 'subscription' ? pricing.periodPrice : pricePerCall;
206
+ if (capUnits !== null && capUnits < minCharge) {
207
+ return fail(`BUDGET_TOO_LOW: budget cap (${capUnits}) is below the ${minCharge}-${unit === 'money' ? currency : 'morsel'} minimum charge`);
208
+ }
209
+ const providerGhii = `${extRec.installedBy}@${config.nodeId}`;
210
+ // Carry spend forward on re-acceptance (renegotiation) so a new contract does not reset the meter.
211
+ const existing = await readEntitlementForCall(storage, consumerGaii, ext, action);
212
+ const ent = await createEntitlement(storage, {
213
+ consumerGaii, appId: app_id ?? null, providerGhii, ext, action, capabilityLabel: `${ext}/${action}`,
214
+ unit, pricePerCall, currency, pricing, capUnits, contractRef, tollMorsels: act.tollMorsels ?? null,
215
+ createdBy: owner, carrySpend: existing,
216
+ });
217
+ return ok({ entitlement: entitlementView(config, ent) });
218
+ });
219
+ // ── List the caller's own contracts (consumer side) ────────────────────────
220
+ mcp.tool('aimeat_exchange_contracts', descriptionFor('aimeat_exchange_contracts'), {}, annotationsFor('aimeat_exchange_contracts'), async () => {
221
+ const mine = await listEntitlementsByConsumer(storage, consumerGaii);
222
+ return ok({ entitlements: mine.map(e => entitlementView(config, e)), count: mine.length });
223
+ });
224
+ // ── Pause / revoke one of the caller's own contracts ───────────────────────
225
+ mcp.tool('aimeat_exchange_contract_off', descriptionFor('aimeat_exchange_contract_off'), {
226
+ ext: z.string().min(1).max(120),
227
+ action: z.string().min(1).max(120),
228
+ mode: z.enum(['pause', 'revoke']),
229
+ }, annotationsFor('aimeat_exchange_contract_off'), async ({ ext, action, mode }) => {
230
+ const ent = await readEntitlementForCall(storage, consumerGaii, ext, action);
231
+ if (!ent || ownerOf(ent.consumerGaii) !== owner) {
232
+ return fail('NOT_FOUND: no entitlement of yours for that capability');
233
+ }
234
+ const applied = mode === 'revoke'
235
+ ? await revokeEntitlement(storage, consumerGaii, ext, action)
236
+ : await pauseEntitlement(storage, consumerGaii, ext, action);
237
+ return ok({ ext, action, mode, applied });
238
+ });
239
+ // ── Browse needs (demand) ──────────────────────────────────────────────────
240
+ mcp.tool('aimeat_exchange_needs', descriptionFor('aimeat_exchange_needs'), {
241
+ open: z.boolean().optional(),
242
+ mine: z.boolean().optional(),
243
+ }, annotationsFor('aimeat_exchange_needs'), async ({ open, mine }) => {
244
+ const needs = await enrichNeeds(storage, await listNeeds(storage, { openOnly: !!open, owner: mine ? owner : undefined }));
245
+ return ok({ needs, count: needs.length });
246
+ });
247
+ // ── Post a need ────────────────────────────────────────────────────────────
248
+ mcp.tool('aimeat_exchange_need_post', descriptionFor('aimeat_exchange_need_post'), {
249
+ description: z.string().min(1).max(4000),
250
+ app_id: z.string().min(1).max(300),
251
+ ext: z.string().max(120).optional(),
252
+ action: z.string().max(120).optional(),
253
+ spec: z.record(z.string(), z.unknown()).optional(),
254
+ usage_intent: z.string().max(2000).optional(),
255
+ budget_unit: z.enum(['morsels', 'money']).optional(),
256
+ budget_cap: z.number().int().nonnegative().optional(),
257
+ autonomy: z.enum(['supervised', 'auto']).optional(),
258
+ }, annotationsFor('aimeat_exchange_need_post'), async ({ description, app_id, ext, action, spec, usage_intent, budget_unit, budget_cap, autonomy }) => {
259
+ const now = new Date().toISOString();
260
+ const need = {
261
+ needId: newNeedId(),
262
+ requesterGaii: consumerGaii,
263
+ requesterOwner: owner,
264
+ appId: app_id,
265
+ ext: ext || null, action: action || null,
266
+ description,
267
+ spec: parseNeedSpec(spec),
268
+ usageIntent: usage_intent || null,
269
+ budgetUnit: budget_unit ?? null, budgetCap: budget_cap !== undefined ? Math.floor(budget_cap) : null,
270
+ autonomy: autonomy === 'auto' ? 'auto' : 'supervised',
271
+ state: 'open', createdAt: now, updatedAt: now,
272
+ };
273
+ await putNeed(storage, need);
274
+ // Surface offerings that already satisfy it (accept directly, no bid needed).
275
+ const matches = await matchOfferings(storage, { ext: need.ext, action: need.action, text: need.description });
276
+ return ok({ need, matches: matches.slice(0, 10) });
277
+ });
278
+ // ── Bid on a need (provider) ───────────────────────────────────────────────
279
+ mcp.tool('aimeat_exchange_bid', descriptionFor('aimeat_exchange_bid'), {
280
+ need_id: z.string().min(1).max(120),
281
+ ext: z.string().min(1).max(120),
282
+ action: z.string().min(1).max(120),
283
+ plan_id: z.string().max(120).optional(),
284
+ note: z.string().max(2000).optional(),
285
+ offering_id: z.string().max(120).optional(),
286
+ }, annotationsFor('aimeat_exchange_bid'), async ({ need_id, ext, action, plan_id, note, offering_id }) => {
287
+ const n = await getNeed(storage, need_id);
288
+ if (!n)
289
+ return fail(`NOT_FOUND: no such need "${need_id}"`);
290
+ if (n.state !== 'open')
291
+ return fail(`NEED_CLOSED: need is ${n.state}`);
292
+ const extRec = await storage.getExtension(ext);
293
+ if (!extRec || extRec.installedBy !== owner)
294
+ return fail('FORBIDDEN: bid only with an action your extension owns');
295
+ if (!extRec.actions.find(a => a.id === action))
296
+ return fail(`NOT_FOUND: action "${action}" not found on "${ext}"`);
297
+ const bid = {
298
+ bidId: newBidId(), needId: n.needId,
299
+ bidderGhii: consumerGaii, bidderOwner: owner,
300
+ offeringId: offering_id || null, ext, action,
301
+ planId: plan_id || null, note: note ?? '',
302
+ state: 'open', createdAt: new Date().toISOString(),
303
+ };
304
+ await putBid(storage, bid);
305
+ return ok({ bid });
306
+ });
307
+ // ── Accept a bid → mint the entitlement (requester side) ───────────────────
308
+ mcp.tool('aimeat_exchange_bid_accept', descriptionFor('aimeat_exchange_bid_accept'), {
309
+ need_id: z.string().min(1).max(120),
310
+ bid_id: z.string().min(1).max(120),
311
+ cap_units: z.number().int().nonnegative().optional(),
312
+ }, annotationsFor('aimeat_exchange_bid_accept'), async ({ need_id, bid_id, cap_units }) => {
313
+ const n = await getNeed(storage, need_id);
314
+ if (!n || n.requesterOwner !== owner)
315
+ return fail('NOT_FOUND: no such need of yours');
316
+ const bid = await getBid(storage, n.needId, bid_id);
317
+ if (!bid || bid.state !== 'open')
318
+ return fail('NOT_FOUND: no such open bid');
319
+ const extRec = await storage.getExtension(bid.ext);
320
+ const act = extRec?.actions.find(a => a.id === bid.action);
321
+ if (!extRec || !act)
322
+ return fail('NOT_FOUND: bid capability no longer exists');
323
+ const priced = resolveActionPricing(act.commercial, bid.planId);
324
+ if (!priced.ok)
325
+ return fail(`${priced.code}: ${priced.message}`);
326
+ const capCap = cap_units !== undefined ? Math.floor(cap_units) : n.budgetCap;
327
+ const existing = await readEntitlementForCall(storage, consumerGaii, bid.ext, bid.action);
328
+ const ent = await createEntitlement(storage, {
329
+ consumerGaii, appId: n.appId, providerGhii: `${extRec.installedBy}@${config.nodeId}`,
330
+ ext: bid.ext, action: bid.action, capabilityLabel: `${bid.ext}/${bid.action}`,
331
+ unit: priced.unit, pricePerCall: priced.pricePerCall, currency: priced.currency, pricing: priced.pricing,
332
+ capUnits: capCap, contractRef: `bid:${bid.bidId}`, createdBy: owner, carrySpend: existing,
333
+ });
334
+ bid.state = 'accepted';
335
+ await putBid(storage, bid);
336
+ n.state = 'matched';
337
+ n.updatedAt = new Date().toISOString();
338
+ await putNeed(storage, n);
339
+ return ok({ entitlement_id: ent.entitlementId, ext: ent.ext, action: ent.action, unit: ent.unit, pricing: ent.pricing });
340
+ });
341
+ // ── Provider lineage: who holds contracts against my offering ──────────────
342
+ mcp.tool('aimeat_exchange_consumers', descriptionFor('aimeat_exchange_consumers'), {
343
+ offering_id: z.string().min(1).max(120),
344
+ }, annotationsFor('aimeat_exchange_consumers'), async ({ offering_id }) => {
345
+ const o = await getOffering(storage, offering_id);
346
+ if (!o || o.providerOwner !== owner)
347
+ return fail('NOT_FOUND: no such offering of yours');
348
+ const consumers = await offeringConsumers(storage, o);
349
+ return ok({ offeringId: o.offeringId, consumers, count: consumers.length });
350
+ });
351
+ }
352
+ //# sourceMappingURL=exchange.js.map