aimeat 2.0.0 → 2.1.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 (412) hide show
  1. package/dist/locales/en.json +35 -1
  2. package/dist/locales/fi.json +35 -1
  3. package/dist/public/components/LinkPreview.js +101 -0
  4. package/dist/public/components/NotificationBell.js +18 -1
  5. package/dist/public/css/theme.css +57 -7
  6. package/dist/public/css/views/admin.css +8 -1
  7. package/dist/public/css/views/app-grant.css +18 -0
  8. package/dist/public/css/views/inbox.css +46 -0
  9. package/dist/public/css/views/portfolio.css +46 -0
  10. package/dist/public/css/views/profile.css +29 -4
  11. package/dist/public/js/services/apps.js +19 -3
  12. package/dist/public/js/services/messages-ai-prompts.js +38 -0
  13. package/dist/public/js/services/messages.js +26 -4
  14. package/dist/public/js/services/notebook.js +76 -0
  15. package/dist/public/js/services/unfurl.js +43 -0
  16. package/dist/public/lib/samples/LICENSE.md +11 -0
  17. package/dist/public/lib/samples/bass/A1.mp3 +0 -0
  18. package/dist/public/lib/samples/bass/B2.mp3 +0 -0
  19. package/dist/public/lib/samples/bass/D2.mp3 +0 -0
  20. package/dist/public/lib/samples/bass/E1.mp3 +0 -0
  21. package/dist/public/lib/samples/bass/E3.mp3 +0 -0
  22. package/dist/public/lib/samples/bass/G2.mp3 +0 -0
  23. package/dist/public/lib/samples/epiano/C2.mp3 +0 -0
  24. package/dist/public/lib/samples/epiano/C3.mp3 +0 -0
  25. package/dist/public/lib/samples/epiano/C4.mp3 +0 -0
  26. package/dist/public/lib/samples/epiano/C5.mp3 +0 -0
  27. package/dist/public/lib/samples/epiano/C6.mp3 +0 -0
  28. package/dist/public/lib/samples/epiano/G2.mp3 +0 -0
  29. package/dist/public/lib/samples/epiano/G3.mp3 +0 -0
  30. package/dist/public/lib/samples/epiano/G4.mp3 +0 -0
  31. package/dist/public/lib/samples/epiano/G5.mp3 +0 -0
  32. package/dist/public/lib/samples/guitar-steel/A2.mp3 +0 -0
  33. package/dist/public/lib/samples/guitar-steel/A4.mp3 +0 -0
  34. package/dist/public/lib/samples/guitar-steel/B3.mp3 +0 -0
  35. package/dist/public/lib/samples/guitar-steel/D3.mp3 +0 -0
  36. package/dist/public/lib/samples/guitar-steel/E2.mp3 +0 -0
  37. package/dist/public/lib/samples/guitar-steel/E4.mp3 +0 -0
  38. package/dist/public/lib/samples/guitar-steel/E5.mp3 +0 -0
  39. package/dist/public/lib/samples/guitar-steel/G3.mp3 +0 -0
  40. package/dist/public/lib/samples/organ/C2.mp3 +0 -0
  41. package/dist/public/lib/samples/organ/C3.mp3 +0 -0
  42. package/dist/public/lib/samples/organ/C4.mp3 +0 -0
  43. package/dist/public/lib/samples/organ/C5.mp3 +0 -0
  44. package/dist/public/lib/samples/organ/C6.mp3 +0 -0
  45. package/dist/public/lib/samples/organ/G2.mp3 +0 -0
  46. package/dist/public/lib/samples/organ/G3.mp3 +0 -0
  47. package/dist/public/lib/samples/organ/G4.mp3 +0 -0
  48. package/dist/public/lib/samples/organ/G5.mp3 +0 -0
  49. package/dist/public/lib/samples/strings/C2.mp3 +0 -0
  50. package/dist/public/lib/samples/strings/C3.mp3 +0 -0
  51. package/dist/public/lib/samples/strings/C4.mp3 +0 -0
  52. package/dist/public/lib/samples/strings/C5.mp3 +0 -0
  53. package/dist/public/lib/samples/strings/C6.mp3 +0 -0
  54. package/dist/public/lib/samples/strings/G2.mp3 +0 -0
  55. package/dist/public/lib/samples/strings/G3.mp3 +0 -0
  56. package/dist/public/lib/samples/strings/G4.mp3 +0 -0
  57. package/dist/public/lib/samples/strings/G5.mp3 +0 -0
  58. package/dist/public/lib/samples/trumpet/A3.mp3 +0 -0
  59. package/dist/public/lib/samples/trumpet/A4.mp3 +0 -0
  60. package/dist/public/lib/samples/trumpet/A5.mp3 +0 -0
  61. package/dist/public/lib/samples/trumpet/C4.mp3 +0 -0
  62. package/dist/public/lib/samples/trumpet/C5.mp3 +0 -0
  63. package/dist/public/lib/samples/trumpet/E3.mp3 +0 -0
  64. package/dist/public/lib/samples/trumpet/E4.mp3 +0 -0
  65. package/dist/public/lib/samples/trumpet/E5.mp3 +0 -0
  66. package/dist/public/spa.html +2 -0
  67. package/dist/public/views/app-grant.js +24 -4
  68. package/dist/public/views/portfolio.js +61 -6
  69. package/dist/public/views/profile/apps-tab.js +18 -1
  70. package/dist/public/views/profile/inbox-tab/ai-actions.js +86 -0
  71. package/dist/public/views/profile/inbox-tab/components.js +124 -9
  72. package/dist/public/views/profile/inbox-tab/helpers.js +26 -0
  73. package/dist/public/views/profile/inbox-tab/panels.js +18 -3
  74. package/dist/public/views/profile/inbox-tab/use-thread-ux.js +18 -1
  75. package/dist/public/views/profile/inbox-tab.js +46 -49
  76. package/dist/public/views/profile/landing-page.cards.js +7 -0
  77. package/dist/public/views/profile/landing-page.js +12 -1
  78. package/dist/public/views/profile/skills-tab.js +1 -1
  79. package/dist/public/views/public-workspace-viewer.js +1 -1
  80. package/dist/public/views/start.js +2 -1
  81. package/dist/scripts/build-sdk-libs.d.ts +16 -0
  82. package/dist/scripts/build-sdk-libs.d.ts.map +1 -0
  83. package/dist/scripts/build-sdk-libs.js +112 -0
  84. package/dist/scripts/build-sdk-libs.js.map +1 -0
  85. package/dist/src/cli/connect/auth.d.ts +15 -0
  86. package/dist/src/cli/connect/auth.d.ts.map +1 -1
  87. package/dist/src/cli/connect/auth.js +25 -6
  88. package/dist/src/cli/connect/auth.js.map +1 -1
  89. package/dist/src/cli/connect/keychain.d.ts +9 -0
  90. package/dist/src/cli/connect/keychain.d.ts.map +1 -1
  91. package/dist/src/cli/connect/keychain.js +21 -8
  92. package/dist/src/cli/connect/keychain.js.map +1 -1
  93. package/dist/src/cli/connect/mcp/tools/exchange.d.ts +18 -0
  94. package/dist/src/cli/connect/mcp/tools/exchange.d.ts.map +1 -0
  95. package/dist/src/cli/connect/mcp/tools/exchange.js +170 -0
  96. package/dist/src/cli/connect/mcp/tools/exchange.js.map +1 -0
  97. package/dist/src/cli/connect/mcp/tools/index.d.ts.map +1 -1
  98. package/dist/src/cli/connect/mcp/tools/index.js +2 -0
  99. package/dist/src/cli/connect/mcp/tools/index.js.map +1 -1
  100. package/dist/src/cli/connect/tool-call-defs-exchange.d.ts +3 -0
  101. package/dist/src/cli/connect/tool-call-defs-exchange.d.ts.map +1 -0
  102. package/dist/src/cli/connect/tool-call-defs-exchange.js +146 -0
  103. package/dist/src/cli/connect/tool-call-defs-exchange.js.map +1 -0
  104. package/dist/src/cli/connect/tool-call.d.ts.map +1 -1
  105. package/dist/src/cli/connect/tool-call.js +2 -0
  106. package/dist/src/cli/connect/tool-call.js.map +1 -1
  107. package/dist/src/commerce/session-service.d.ts +14 -0
  108. package/dist/src/commerce/session-service.d.ts.map +1 -1
  109. package/dist/src/commerce/session-service.js +1 -1
  110. package/dist/src/commerce/session-service.js.map +1 -1
  111. package/dist/src/data/app-templates/shells.d.ts +7 -3
  112. package/dist/src/data/app-templates/shells.d.ts.map +1 -1
  113. package/dist/src/data/app-templates/shells.js +10 -6
  114. package/dist/src/data/app-templates/shells.js.map +1 -1
  115. package/dist/src/data/appdev-pitfalls.d.ts +2 -0
  116. package/dist/src/data/appdev-pitfalls.d.ts.map +1 -1
  117. package/dist/src/data/appdev-pitfalls.js +24 -1
  118. package/dist/src/data/appdev-pitfalls.js.map +1 -1
  119. package/dist/src/generated/api-types.d.ts +1565 -9
  120. package/dist/src/generated/api-types.d.ts.map +1 -1
  121. package/dist/src/mcp/annotations.d.ts.map +1 -1
  122. package/dist/src/mcp/annotations.js +20 -0
  123. package/dist/src/mcp/annotations.js.map +1 -1
  124. package/dist/src/mcp/apps.d.ts.map +1 -1
  125. package/dist/src/mcp/apps.js +8 -4
  126. package/dist/src/mcp/apps.js.map +1 -1
  127. package/dist/src/mcp/catalog/definitions/exchange.d.ts +18 -0
  128. package/dist/src/mcp/catalog/definitions/exchange.d.ts.map +1 -0
  129. package/dist/src/mcp/catalog/definitions/exchange.js +182 -0
  130. package/dist/src/mcp/catalog/definitions/exchange.js.map +1 -0
  131. package/dist/src/mcp/catalog/definitions.d.ts.map +1 -1
  132. package/dist/src/mcp/catalog/definitions.js +2 -0
  133. package/dist/src/mcp/catalog/definitions.js.map +1 -1
  134. package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
  135. package/dist/src/mcp/catalog/scopes.js +22 -0
  136. package/dist/src/mcp/catalog/scopes.js.map +1 -1
  137. package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
  138. package/dist/src/mcp/catalog/surfaces.js +14 -0
  139. package/dist/src/mcp/catalog/surfaces.js.map +1 -1
  140. package/dist/src/mcp/exchange-run.d.ts +5 -0
  141. package/dist/src/mcp/exchange-run.d.ts.map +1 -0
  142. package/dist/src/mcp/exchange-run.js +226 -0
  143. package/dist/src/mcp/exchange-run.js.map +1 -0
  144. package/dist/src/mcp/exchange.d.ts +5 -0
  145. package/dist/src/mcp/exchange.d.ts.map +1 -0
  146. package/dist/src/mcp/exchange.js +351 -0
  147. package/dist/src/mcp/exchange.js.map +1 -0
  148. package/dist/src/mcp/extensions.d.ts.map +1 -1
  149. package/dist/src/mcp/extensions.js +11 -0
  150. package/dist/src/mcp/extensions.js.map +1 -1
  151. package/dist/src/mcp/index.d.ts.map +1 -1
  152. package/dist/src/mcp/index.js +6 -2
  153. package/dist/src/mcp/index.js.map +1 -1
  154. package/dist/src/models/app-tool-schemas.d.ts +55 -1
  155. package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
  156. package/dist/src/models/app-tool-schemas.js +20 -1
  157. package/dist/src/models/app-tool-schemas.js.map +1 -1
  158. package/dist/src/models/offer-schemas.d.ts +2 -2
  159. package/dist/src/models/schemas.d.ts +1 -0
  160. package/dist/src/models/schemas.d.ts.map +1 -1
  161. package/dist/src/models/schemas.js +3 -0
  162. package/dist/src/models/schemas.js.map +1 -1
  163. package/dist/src/routes/agents/device-auth.d.ts +4 -0
  164. package/dist/src/routes/agents/device-auth.d.ts.map +1 -1
  165. package/dist/src/routes/agents/device-auth.js +19 -4
  166. package/dist/src/routes/agents/device-auth.js.map +1 -1
  167. package/dist/src/routes/app-grants.d.ts +6 -0
  168. package/dist/src/routes/app-grants.d.ts.map +1 -1
  169. package/dist/src/routes/app-grants.js +35 -2
  170. package/dist/src/routes/app-grants.js.map +1 -1
  171. package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
  172. package/dist/src/routes/apps/fork-manage.js +24 -1
  173. package/dist/src/routes/apps/fork-manage.js.map +1 -1
  174. package/dist/src/routes/apps/publish.d.ts +2 -0
  175. package/dist/src/routes/apps/publish.d.ts.map +1 -1
  176. package/dist/src/routes/apps/publish.js +27 -1
  177. package/dist/src/routes/apps/publish.js.map +1 -1
  178. package/dist/src/routes/apps-cost.d.ts +25 -0
  179. package/dist/src/routes/apps-cost.d.ts.map +1 -0
  180. package/dist/src/routes/apps-cost.js +107 -0
  181. package/dist/src/routes/apps-cost.js.map +1 -0
  182. package/dist/src/routes/exchange-market.d.ts +28 -0
  183. package/dist/src/routes/exchange-market.d.ts.map +1 -0
  184. package/dist/src/routes/exchange-market.js +454 -0
  185. package/dist/src/routes/exchange-market.js.map +1 -0
  186. package/dist/src/routes/exchange.d.ts +33 -0
  187. package/dist/src/routes/exchange.d.ts.map +1 -0
  188. package/dist/src/routes/exchange.js +395 -0
  189. package/dist/src/routes/exchange.js.map +1 -0
  190. package/dist/src/routes/extensions/entitlement-gate.d.ts +33 -0
  191. package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -0
  192. package/dist/src/routes/extensions/entitlement-gate.js +143 -0
  193. package/dist/src/routes/extensions/entitlement-gate.js.map +1 -0
  194. package/dist/src/routes/extensions/manifest.d.ts +9 -0
  195. package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
  196. package/dist/src/routes/extensions/manifest.js +33 -1
  197. package/dist/src/routes/extensions/manifest.js.map +1 -1
  198. package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
  199. package/dist/src/routes/extensions/paywall.js +9 -0
  200. package/dist/src/routes/extensions/paywall.js.map +1 -1
  201. package/dist/src/routes/federation-sync/messaging.d.ts.map +1 -1
  202. package/dist/src/routes/federation-sync/messaging.js +3 -1
  203. package/dist/src/routes/federation-sync/messaging.js.map +1 -1
  204. package/dist/src/routes/ghii/recovery.d.ts +2 -0
  205. package/dist/src/routes/ghii/recovery.d.ts.map +1 -1
  206. package/dist/src/routes/ghii/recovery.js +7 -0
  207. package/dist/src/routes/ghii/recovery.js.map +1 -1
  208. package/dist/src/routes/ghii/register-login.d.ts +4 -0
  209. package/dist/src/routes/ghii/register-login.d.ts.map +1 -1
  210. package/dist/src/routes/ghii/register-login.js +45 -22
  211. package/dist/src/routes/ghii/register-login.js.map +1 -1
  212. package/dist/src/routes/ghii/web-verify.d.ts +5 -0
  213. package/dist/src/routes/ghii/web-verify.d.ts.map +1 -1
  214. package/dist/src/routes/ghii/web-verify.js +24 -3
  215. package/dist/src/routes/ghii/web-verify.js.map +1 -1
  216. package/dist/src/routes/libs/sdk-serve.d.ts +11 -0
  217. package/dist/src/routes/libs/sdk-serve.d.ts.map +1 -0
  218. package/dist/src/routes/libs/sdk-serve.js +53 -0
  219. package/dist/src/routes/libs/sdk-serve.js.map +1 -0
  220. package/dist/src/routes/libs.d.ts +7 -1
  221. package/dist/src/routes/libs.d.ts.map +1 -1
  222. package/dist/src/routes/libs.js +65 -146
  223. package/dist/src/routes/libs.js.map +1 -1
  224. package/dist/src/routes/messages.d.ts +3 -0
  225. package/dist/src/routes/messages.d.ts.map +1 -1
  226. package/dist/src/routes/messages.js +9 -0
  227. package/dist/src/routes/messages.js.map +1 -1
  228. package/dist/src/routes/notifications.d.ts +6 -3
  229. package/dist/src/routes/notifications.d.ts.map +1 -1
  230. package/dist/src/routes/notifications.js +32 -3
  231. package/dist/src/routes/notifications.js.map +1 -1
  232. package/dist/src/routes/organisms/workspace-access.d.ts.map +1 -1
  233. package/dist/src/routes/organisms/workspace-access.js +38 -20
  234. package/dist/src/routes/organisms/workspace-access.js.map +1 -1
  235. package/dist/src/routes/unfurl.d.ts +27 -0
  236. package/dist/src/routes/unfurl.d.ts.map +1 -0
  237. package/dist/src/routes/unfurl.js +180 -0
  238. package/dist/src/routes/unfurl.js.map +1 -0
  239. package/dist/src/routes/upload.d.ts +2 -0
  240. package/dist/src/routes/upload.d.ts.map +1 -1
  241. package/dist/src/routes/upload.js +7 -0
  242. package/dist/src/routes/upload.js.map +1 -1
  243. package/dist/src/routes/webmcp.d.ts +3 -0
  244. package/dist/src/routes/webmcp.d.ts.map +1 -1
  245. package/dist/src/routes/webmcp.js +55 -0
  246. package/dist/src/routes/webmcp.js.map +1 -1
  247. package/dist/src/server-bootstrap/routes-loader.d.ts +1 -0
  248. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
  249. package/dist/src/server-bootstrap/routes-loader.js +8 -0
  250. package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
  251. package/dist/src/services/agent-face.d.ts +10 -2
  252. package/dist/src/services/agent-face.d.ts.map +1 -1
  253. package/dist/src/services/agent-face.js +10 -4
  254. package/dist/src/services/agent-face.js.map +1 -1
  255. package/dist/src/services/app-tool-interfaces.d.ts +37 -0
  256. package/dist/src/services/app-tool-interfaces.d.ts.map +1 -0
  257. package/dist/src/services/app-tool-interfaces.js +101 -0
  258. package/dist/src/services/app-tool-interfaces.js.map +1 -0
  259. package/dist/src/services/build-app-prompt.d.ts +3 -0
  260. package/dist/src/services/build-app-prompt.d.ts.map +1 -1
  261. package/dist/src/services/build-app-prompt.js +12 -1
  262. package/dist/src/services/build-app-prompt.js.map +1 -1
  263. package/dist/src/services/contacts.d.ts +25 -1
  264. package/dist/src/services/contacts.d.ts.map +1 -1
  265. package/dist/src/services/contacts.js +30 -0
  266. package/dist/src/services/contacts.js.map +1 -1
  267. package/dist/src/services/entitlement-money.d.ts +55 -0
  268. package/dist/src/services/entitlement-money.d.ts.map +1 -0
  269. package/dist/src/services/entitlement-money.js +68 -0
  270. package/dist/src/services/entitlement-money.js.map +1 -0
  271. package/dist/src/services/exchange-market.d.ts +247 -0
  272. package/dist/src/services/exchange-market.d.ts.map +1 -0
  273. package/dist/src/services/exchange-market.js +254 -0
  274. package/dist/src/services/exchange-market.js.map +1 -0
  275. package/dist/src/services/exchange-proposals.d.ts +47 -0
  276. package/dist/src/services/exchange-proposals.d.ts.map +1 -0
  277. package/dist/src/services/exchange-proposals.js +71 -0
  278. package/dist/src/services/exchange-proposals.js.map +1 -0
  279. package/dist/src/services/exchange-work.d.ts +30 -0
  280. package/dist/src/services/exchange-work.d.ts.map +1 -0
  281. package/dist/src/services/exchange-work.js +43 -0
  282. package/dist/src/services/exchange-work.js.map +1 -0
  283. package/dist/src/services/message-send.d.ts.map +1 -1
  284. package/dist/src/services/message-send.js +4 -1
  285. package/dist/src/services/message-send.js.map +1 -1
  286. package/dist/src/services/metered-entitlements.d.ts +203 -0
  287. package/dist/src/services/metered-entitlements.d.ts.map +1 -0
  288. package/dist/src/services/metered-entitlements.js +264 -0
  289. package/dist/src/services/metered-entitlements.js.map +1 -0
  290. package/dist/src/services/notify.d.ts +7 -0
  291. package/dist/src/services/notify.d.ts.map +1 -1
  292. package/dist/src/services/notify.js +35 -0
  293. package/dist/src/services/notify.js.map +1 -1
  294. package/dist/src/services/owner-memory.d.ts +16 -0
  295. package/dist/src/services/owner-memory.d.ts.map +1 -1
  296. package/dist/src/services/owner-memory.js +23 -0
  297. package/dist/src/services/owner-memory.js.map +1 -1
  298. package/dist/src/services/owner-provisioning.d.ts +5 -0
  299. package/dist/src/services/owner-provisioning.d.ts.map +1 -1
  300. package/dist/src/services/owner-provisioning.js +20 -2
  301. package/dist/src/services/owner-provisioning.js.map +1 -1
  302. package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts +1 -0
  303. package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts.map +1 -1
  304. package/dist/src/storage/providers/postgres-kysely/methods/apps.js +2 -0
  305. package/dist/src/storage/providers/postgres-kysely/methods/apps.js.map +1 -1
  306. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts +1 -0
  307. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -1
  308. package/dist/src/storage/providers/postgres-kysely/methods/identity.js +4 -0
  309. package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -1
  310. package/dist/src/storage/providers/postgres-kysely/migrations/0011_unique_verified_email.sql +25 -0
  311. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +1 -0
  312. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  313. package/dist/src/storage/providers/sqlite/methods/apps.js +2 -0
  314. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  315. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts +1 -0
  316. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
  317. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +4 -0
  318. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
  319. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  320. package/dist/src/storage/providers/sqlite/schema.js +20 -0
  321. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  322. package/dist/src/storage/repositories/app.repository.d.ts +0 -0
  323. package/dist/src/storage/repositories/app.repository.d.ts.map +1 -1
  324. package/dist/src/storage/repositories/identity.repository.d.ts +6 -0
  325. package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -1
  326. package/dist/src/storage/types/apps.d.ts +1 -0
  327. package/dist/src/storage/types/apps.d.ts.map +1 -1
  328. package/dist/src/storage/types/organisms-federation.d.ts +21 -0
  329. package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
  330. package/dist/src/utils/app-mobile-lint.d.ts +17 -0
  331. package/dist/src/utils/app-mobile-lint.d.ts.map +1 -0
  332. package/dist/src/utils/app-mobile-lint.js +40 -0
  333. package/dist/src/utils/app-mobile-lint.js.map +1 -0
  334. package/dist/static/app-catalog/_template.html +12 -77
  335. package/dist/static/app-catalog/js/apps-io.js +51 -165
  336. package/dist/static/app-catalog/js/cost.js +100 -0
  337. package/dist/static/app-catalog/js/db.js +23 -93
  338. package/dist/static/app-catalog/js/detail.js +158 -24
  339. package/dist/static/app-catalog/js/favorites.js +71 -0
  340. package/dist/static/app-catalog/js/i18n-data.js +90 -16
  341. package/dist/static/app-catalog/js/main.js +23 -103
  342. package/dist/static/app-catalog/js/migrate.js +88 -0
  343. package/dist/static/app-catalog/js/monetize.js +1 -1
  344. package/dist/static/app-catalog/js/promote.js +70 -0
  345. package/dist/static/app-catalog/js/render.js +26 -139
  346. package/dist/static/app-catalog/js/server-io.js +126 -223
  347. package/dist/static/app-catalog/js/settings.js +11 -204
  348. package/dist/static/app-catalog/styles/app-catalog.css +40 -0
  349. package/dist/static/app-catalog.html +790 -912
  350. package/dist/static/sdk-libs/_core/config.js +52 -0
  351. package/dist/static/sdk-libs/_core/http.js +52 -0
  352. package/dist/static/sdk-libs/_core/namespace.js +33 -0
  353. package/dist/static/sdk-libs/_core/sdk-globals.d.ts +50 -0
  354. package/dist/static/sdk-libs/_core/session.js +66 -0
  355. package/dist/static/sdk-libs/agentface/index.js +102 -0
  356. package/dist/static/sdk-libs/agents/index.js +267 -0
  357. package/dist/static/sdk-libs/ai/index.js +153 -0
  358. package/dist/static/sdk-libs/audio/core.js +111 -0
  359. package/dist/static/sdk-libs/audio/index.js +380 -0
  360. package/dist/static/sdk-libs/audio/instruments.js +369 -0
  361. package/dist/static/sdk-libs/auth/config.js +46 -0
  362. package/dist/static/sdk-libs/auth/crypto.js +166 -0
  363. package/dist/static/sdk-libs/auth/events.js +27 -0
  364. package/dist/static/sdk-libs/auth/i18n.js +64 -0
  365. package/dist/static/sdk-libs/auth/index.js +37 -0
  366. package/dist/static/sdk-libs/auth/modal.js +545 -0
  367. package/dist/static/sdk-libs/auth/pill.js +167 -0
  368. package/dist/static/sdk-libs/auth/session.js +792 -0
  369. package/dist/static/sdk-libs/auth/signup.js +232 -0
  370. package/dist/static/sdk-libs/auth/theme.js +96 -0
  371. package/dist/static/sdk-libs/capabilities/index.js +179 -0
  372. package/dist/static/sdk-libs/commerce/index.js +243 -0
  373. package/dist/static/sdk-libs/data/index.js +188 -0
  374. package/dist/static/sdk-libs/dist/aimeat-agentface.js +91 -0
  375. package/dist/static/sdk-libs/dist/aimeat-agents.js +315 -0
  376. package/dist/static/sdk-libs/dist/aimeat-ai.js +168 -0
  377. package/dist/static/sdk-libs/dist/aimeat-audio.js +979 -0
  378. package/dist/static/sdk-libs/dist/aimeat-auth.js +1831 -0
  379. package/dist/static/sdk-libs/dist/aimeat-capabilities.js +177 -0
  380. package/dist/static/sdk-libs/dist/aimeat-commerce.js +265 -0
  381. package/dist/static/sdk-libs/dist/aimeat-data.js +205 -0
  382. package/dist/static/sdk-libs/dist/aimeat-editor.js +299 -0
  383. package/dist/static/sdk-libs/dist/aimeat-header.js +270 -0
  384. package/dist/static/sdk-libs/dist/aimeat-intake.js +94 -0
  385. package/dist/static/sdk-libs/dist/aimeat-live.js +265 -0
  386. package/dist/static/sdk-libs/dist/aimeat-markdown.js +602 -0
  387. package/dist/static/sdk-libs/dist/aimeat-organism.js +394 -0
  388. package/dist/static/sdk-libs/dist/aimeat-portfolio-standalone.js +90 -0
  389. package/dist/static/sdk-libs/dist/aimeat-social.js +157 -0
  390. package/dist/static/sdk-libs/dist/aimeat-speech.js +300 -0
  391. package/dist/static/sdk-libs/dist/aimeat-storage.js +210 -0
  392. package/dist/static/sdk-libs/dist/aimeat-tunnel.js +383 -0
  393. package/dist/static/sdk-libs/dist/aimeat-wallet.js +118 -0
  394. package/dist/static/sdk-libs/dist/aimeat-webmcp.js +187 -0
  395. package/dist/static/sdk-libs/dist/aimeat-work.js +213 -0
  396. package/dist/static/sdk-libs/dist/aimeat-workflows.js +147 -0
  397. package/dist/static/sdk-libs/editor/index.js +229 -0
  398. package/dist/static/sdk-libs/header/index.js +249 -0
  399. package/dist/static/sdk-libs/intake/index.js +75 -0
  400. package/dist/static/sdk-libs/live/index.js +156 -0
  401. package/dist/static/sdk-libs/markdown/index.js +522 -0
  402. package/dist/static/sdk-libs/organism/index.js +381 -0
  403. package/dist/static/sdk-libs/portfolio-standalone/index.js +78 -0
  404. package/dist/static/sdk-libs/social/index.js +140 -0
  405. package/dist/static/sdk-libs/speech/index.js +321 -0
  406. package/dist/static/sdk-libs/storage/index.js +189 -0
  407. package/dist/static/sdk-libs/tunnel/index.js +428 -0
  408. package/dist/static/sdk-libs/wallet/index.js +115 -0
  409. package/dist/static/sdk-libs/webmcp/index.js +185 -0
  410. package/dist/static/sdk-libs/work/index.js +191 -0
  411. package/dist/static/sdk-libs/workflows/index.js +113 -0
  412. package/package.json +5 -2
@@ -0,0 +1,383 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/tunnel/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-tunnel.js (with a per-node config prelude).
3
+ "use strict";
4
+ (() => {
5
+ // src/static/sdk-libs/_core/config.js
6
+ function cfg() {
7
+ return window.__AIMEAT_SDK_CFG__ || { nodeId: "", baseUrl: "" };
8
+ }
9
+ function resolveNodeUrl() {
10
+ const meta = document.querySelector('meta[name="aimeat-node"]');
11
+ if (meta) return (meta.getAttribute("content") || "").replace(/\/$/, "");
12
+ if (location.protocol === "http:" || location.protocol === "https:") return location.origin;
13
+ return cfg().baseUrl;
14
+ }
15
+ var NODE_URL = resolveNodeUrl();
16
+ var APEX_URL = cfg().baseUrl;
17
+ var NODE_ID = cfg().nodeId;
18
+ var HEARTBEAT_MS = cfg().heartbeatMs || 3e4;
19
+
20
+ // src/static/sdk-libs/_core/session.js
21
+ function getSession(libLabel) {
22
+ const auth = window.AIMEAT && window.AIMEAT.auth;
23
+ if (!auth) {
24
+ throw new Error("AIMEAT.auth is required. Include aimeat-auth.js before " + (libLabel || "this library"));
25
+ }
26
+ const s = auth.getSession();
27
+ if (!s) throw new Error("Not logged in. Call AIMEAT.auth.login() first.");
28
+ return s;
29
+ }
30
+ function authFetch(path, opts, libLabel) {
31
+ return getSession(libLabel).fetch(path, opts);
32
+ }
33
+ function makeSession(libLabel) {
34
+ return {
35
+ getSession: () => getSession(libLabel),
36
+ authFetch: (path, opts) => authFetch(path, opts, libLabel)
37
+ };
38
+ }
39
+
40
+ // src/static/sdk-libs/_core/namespace.js
41
+ function namespace() {
42
+ if (!window.AIMEAT) window.AIMEAT = {};
43
+ return window.AIMEAT;
44
+ }
45
+ function attach(key, value) {
46
+ const ns = namespace();
47
+ ns[key] = value;
48
+ return ns;
49
+ }
50
+
51
+ // src/static/sdk-libs/tunnel/index.js
52
+ var { getSession: getSession2 } = makeSession("aimeat-tunnel.js");
53
+ function uuid() {
54
+ return crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
55
+ var r = Math.random() * 16 | 0;
56
+ return (c === "x" ? r : r & 3 | 8).toString(16);
57
+ });
58
+ }
59
+ function TunnelClient(opts) {
60
+ this._opts = Object.assign({
61
+ heartbeatIntervalMs: HEARTBEAT_MS,
62
+ reconnect: true,
63
+ reconnectBaseMs: 1e3,
64
+ reconnectMaxMs: 6e4,
65
+ reconnectJitter: true,
66
+ maxReconnectAttempts: Infinity,
67
+ requestTimeoutMs: 3e4,
68
+ onRequest: null,
69
+ // async (msg) => response_payload
70
+ onMailbox: null,
71
+ // (items) => void
72
+ onDeliveryReceipt: null,
73
+ // (receipt) => void
74
+ onStatusChange: null,
75
+ // (status: 'connecting'|'online'|'degraded'|'offline') => void
76
+ onError: null
77
+ // (error) => void
78
+ }, opts || {});
79
+ this._ws = null;
80
+ this._status = "offline";
81
+ this._heartbeatTimer = null;
82
+ this._reconnectTimer = null;
83
+ this._reconnectAttempts = 0;
84
+ this._pendingResponses = /* @__PURE__ */ new Map();
85
+ this._closed = false;
86
+ this._lastHeartbeatAck = 0;
87
+ this._serverConfig = null;
88
+ }
89
+ TunnelClient.prototype._setStatus = function(status) {
90
+ if (this._status !== status) {
91
+ this._status = status;
92
+ if (this._opts.onStatusChange) {
93
+ try {
94
+ this._opts.onStatusChange(status);
95
+ } catch (e) {
96
+ console.error("[aimeat-tunnel] onStatusChange error:", e);
97
+ }
98
+ }
99
+ }
100
+ };
101
+ TunnelClient.prototype.connect = function() {
102
+ if (this._closed) return;
103
+ this._setStatus("connecting");
104
+ var session = getSession2();
105
+ var wsUrl = NODE_URL.replace(/^http/, "ws") + "/v1/personal/tunnel?token=" + encodeURIComponent(session.jwt);
106
+ var self = this;
107
+ try {
108
+ this._ws = new WebSocket(wsUrl);
109
+ } catch (e) {
110
+ this._setStatus("offline");
111
+ if (this._opts.onError) this._opts.onError(e);
112
+ this._scheduleReconnect();
113
+ return;
114
+ }
115
+ this._ws.onopen = function() {
116
+ self._reconnectAttempts = 0;
117
+ self._lastHeartbeatAck = Date.now();
118
+ self._setStatus("online");
119
+ self._startHeartbeat();
120
+ };
121
+ this._ws.onmessage = function(event) {
122
+ try {
123
+ var msg = JSON.parse(event.data);
124
+ self._handleMessage(msg);
125
+ } catch (e) {
126
+ console.error("[aimeat-tunnel] Invalid message:", e);
127
+ }
128
+ };
129
+ this._ws.onclose = function() {
130
+ self._cleanup();
131
+ self._setStatus("offline");
132
+ if (!self._closed) {
133
+ self._scheduleReconnect();
134
+ }
135
+ };
136
+ this._ws.onerror = function(err) {
137
+ if (self._opts.onError) self._opts.onError(err);
138
+ };
139
+ };
140
+ TunnelClient.prototype._handleMessage = function(msg) {
141
+ switch (msg.type) {
142
+ case "welcome":
143
+ this._handleWelcome(msg);
144
+ break;
145
+ case "request":
146
+ this._handleRequest(msg);
147
+ break;
148
+ case "heartbeat_ack":
149
+ this._lastHeartbeatAck = Date.now();
150
+ break;
151
+ case "mailbox_sync":
152
+ this._handleMailboxSync(msg);
153
+ break;
154
+ case "delivery_receipt":
155
+ if (this._opts.onDeliveryReceipt && msg.payload) {
156
+ try {
157
+ this._opts.onDeliveryReceipt(JSON.parse(msg.payload));
158
+ } catch {
159
+ }
160
+ }
161
+ break;
162
+ case "response": {
163
+ var pending = this._pendingResponses.get(msg.id);
164
+ if (pending) {
165
+ clearTimeout(pending.timer);
166
+ this._pendingResponses.delete(msg.id);
167
+ pending.resolve(msg);
168
+ }
169
+ break;
170
+ }
171
+ default:
172
+ console.warn("[aimeat-tunnel] Unknown message type:", msg.type);
173
+ }
174
+ };
175
+ TunnelClient.prototype._handleWelcome = function(msg) {
176
+ if (!msg.payload) return;
177
+ try {
178
+ this._serverConfig = JSON.parse(msg.payload);
179
+ if (this._serverConfig.heartbeat_interval_ms) {
180
+ this._opts.heartbeatIntervalMs = this._serverConfig.heartbeat_interval_ms;
181
+ if (this._heartbeatTimer) this._startHeartbeat();
182
+ }
183
+ if (this._serverConfig.reconnect_hint) {
184
+ var hint = this._serverConfig.reconnect_hint;
185
+ if (hint.base_ms) this._opts.reconnectBaseMs = hint.base_ms;
186
+ if (hint.max_ms) this._opts.reconnectMaxMs = hint.max_ms;
187
+ if (hint.jitter !== void 0) this._opts.reconnectJitter = hint.jitter;
188
+ }
189
+ } catch (e) {
190
+ console.error("[aimeat-tunnel] Welcome parse error:", e);
191
+ }
192
+ };
193
+ TunnelClient.prototype._handleRequest = async function(msg) {
194
+ if (!this._opts.onRequest) {
195
+ this._sendResponse(msg.id, null);
196
+ return;
197
+ }
198
+ try {
199
+ var result = await this._opts.onRequest({
200
+ id: msg.id,
201
+ from: msg.from,
202
+ to: msg.to,
203
+ payload: msg.payload ? JSON.parse(msg.payload) : null,
204
+ timestamp: msg.timestamp
205
+ });
206
+ this._sendResponse(msg.id, result);
207
+ } catch (e) {
208
+ console.error("[aimeat-tunnel] onRequest handler error:", e);
209
+ this._sendResponse(msg.id, { error: e.message || "Handler error" });
210
+ }
211
+ };
212
+ TunnelClient.prototype._sendResponse = function(requestId, payload) {
213
+ if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
214
+ this._ws.send(JSON.stringify({
215
+ type: "response",
216
+ id: requestId,
217
+ payload: payload != null ? JSON.stringify(payload) : null,
218
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
219
+ }));
220
+ };
221
+ TunnelClient.prototype._handleMailboxSync = function(msg) {
222
+ if (!msg.payload) return;
223
+ try {
224
+ var data = JSON.parse(msg.payload);
225
+ var items = data.mailbox_items || [];
226
+ if (this._opts.onMailbox && items.length > 0) {
227
+ this._opts.onMailbox(items.map(function(item) {
228
+ return {
229
+ id: item.id,
230
+ type: item.type,
231
+ from: item.from,
232
+ to: item.to,
233
+ payload: item.payload ? JSON.parse(item.payload) : null,
234
+ created_at: item.created_at
235
+ };
236
+ }));
237
+ }
238
+ if (items.length > 0) {
239
+ var itemIds = items.map(function(i) {
240
+ return i.id;
241
+ });
242
+ this._send({
243
+ type: "mailbox_ack",
244
+ id: uuid(),
245
+ payload: JSON.stringify(itemIds),
246
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
247
+ });
248
+ }
249
+ } catch (e) {
250
+ console.error("[aimeat-tunnel] Mailbox sync error:", e);
251
+ }
252
+ };
253
+ TunnelClient.prototype._startHeartbeat = function() {
254
+ this._stopHeartbeat();
255
+ var self = this;
256
+ var interval = this._opts.heartbeatIntervalMs;
257
+ this._heartbeatTimer = setInterval(function() {
258
+ if (!self._ws || self._ws.readyState !== WebSocket.OPEN) return;
259
+ var sinceLast = Date.now() - self._lastHeartbeatAck;
260
+ if (sinceLast > interval * 3) {
261
+ console.warn("[aimeat-tunnel] Heartbeat ack timeout (" + sinceLast + "ms), reconnecting...");
262
+ self._ws.close(4e3, "heartbeat_timeout");
263
+ return;
264
+ }
265
+ self._send({
266
+ type: "heartbeat",
267
+ id: uuid(),
268
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
269
+ });
270
+ }, interval);
271
+ };
272
+ TunnelClient.prototype._stopHeartbeat = function() {
273
+ if (this._heartbeatTimer) {
274
+ clearInterval(this._heartbeatTimer);
275
+ this._heartbeatTimer = null;
276
+ }
277
+ };
278
+ TunnelClient.prototype._scheduleReconnect = function() {
279
+ if (this._closed || !this._opts.reconnect) return;
280
+ if (this._reconnectAttempts >= this._opts.maxReconnectAttempts) {
281
+ console.error("[aimeat-tunnel] Max reconnect attempts reached (" + this._opts.maxReconnectAttempts + ")");
282
+ if (this._opts.onError) this._opts.onError(new Error("Max reconnect attempts reached"));
283
+ return;
284
+ }
285
+ var base = this._opts.reconnectBaseMs;
286
+ var max = this._opts.reconnectMaxMs;
287
+ var attempt = this._reconnectAttempts;
288
+ var delay = Math.min(base * Math.pow(2, attempt), max);
289
+ if (this._opts.reconnectJitter) {
290
+ var jitter = delay * 0.25 * (Math.random() * 2 - 1);
291
+ delay = Math.max(base, delay + jitter);
292
+ }
293
+ var self = this;
294
+ this._reconnectAttempts++;
295
+ console.log("[aimeat-tunnel] Reconnecting in " + Math.round(delay) + "ms (attempt " + this._reconnectAttempts + ")");
296
+ this._reconnectTimer = setTimeout(function() {
297
+ self._reconnectTimer = null;
298
+ self.connect();
299
+ }, delay);
300
+ };
301
+ TunnelClient.prototype._send = function(msg) {
302
+ if (this._ws && this._ws.readyState === WebSocket.OPEN) {
303
+ this._ws.send(JSON.stringify(msg));
304
+ }
305
+ };
306
+ TunnelClient.prototype.sendRequest = function(payload, timeoutMs) {
307
+ var self = this;
308
+ var timeout = timeoutMs || this._opts.requestTimeoutMs;
309
+ var id = uuid();
310
+ return new Promise(function(resolve, reject) {
311
+ if (!self._ws || self._ws.readyState !== WebSocket.OPEN) {
312
+ return reject(new Error("Tunnel not connected"));
313
+ }
314
+ var timer = setTimeout(function() {
315
+ self._pendingResponses.delete(id);
316
+ reject(new Error("Request timeout (" + timeout + "ms)"));
317
+ }, timeout);
318
+ self._pendingResponses.set(id, { resolve, timer });
319
+ self._send({
320
+ type: "request",
321
+ id,
322
+ payload: JSON.stringify(payload),
323
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
324
+ });
325
+ });
326
+ };
327
+ TunnelClient.prototype._cleanup = function() {
328
+ this._stopHeartbeat();
329
+ for (var entry of this._pendingResponses.values()) {
330
+ clearTimeout(entry.timer);
331
+ entry.resolve(null);
332
+ }
333
+ this._pendingResponses.clear();
334
+ };
335
+ TunnelClient.prototype.close = function() {
336
+ this._closed = true;
337
+ this._cleanup();
338
+ if (this._reconnectTimer) {
339
+ clearTimeout(this._reconnectTimer);
340
+ this._reconnectTimer = null;
341
+ }
342
+ if (this._ws) {
343
+ this._send({
344
+ type: "disconnect",
345
+ id: uuid(),
346
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
347
+ });
348
+ try {
349
+ this._ws.close(1e3, "client_close");
350
+ } catch {
351
+ }
352
+ this._ws = null;
353
+ }
354
+ this._setStatus("offline");
355
+ };
356
+ TunnelClient.prototype.isOnline = function() {
357
+ return this._status === "online";
358
+ };
359
+ TunnelClient.prototype.getStatus = function() {
360
+ return this._status;
361
+ };
362
+ TunnelClient.prototype.getReconnectAttempts = function() {
363
+ return this._reconnectAttempts;
364
+ };
365
+ TunnelClient.prototype.getServerConfig = function() {
366
+ return this._serverConfig;
367
+ };
368
+ var tunnel = {
369
+ // Create and connect a tunnel client
370
+ connect: function(opts) {
371
+ var client = new TunnelClient(opts);
372
+ client.connect();
373
+ return client;
374
+ },
375
+ // Create without auto-connecting
376
+ create: function(opts) {
377
+ return new TunnelClient(opts);
378
+ },
379
+ // Version
380
+ version: "1.0.0"
381
+ };
382
+ attach("tunnel", tunnel);
383
+ })();
@@ -0,0 +1,118 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/wallet/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-wallet.js (with a per-node config prelude).
3
+ "use strict";
4
+ (() => {
5
+ // src/static/sdk-libs/_core/session.js
6
+ function getSession(libLabel) {
7
+ const auth = window.AIMEAT && window.AIMEAT.auth;
8
+ if (!auth) {
9
+ throw new Error("AIMEAT.auth is required. Include aimeat-auth.js before " + (libLabel || "this library"));
10
+ }
11
+ const s = auth.getSession();
12
+ if (!s) throw new Error("Not logged in. Call AIMEAT.auth.login() first.");
13
+ return s;
14
+ }
15
+ function authFetch(path, opts, libLabel) {
16
+ return getSession(libLabel).fetch(path, opts);
17
+ }
18
+ function makeSession(libLabel) {
19
+ return {
20
+ getSession: () => getSession(libLabel),
21
+ authFetch: (path, opts) => authFetch(path, opts, libLabel)
22
+ };
23
+ }
24
+
25
+ // src/static/sdk-libs/_core/namespace.js
26
+ function namespace() {
27
+ if (!window.AIMEAT) window.AIMEAT = {};
28
+ return window.AIMEAT;
29
+ }
30
+ function attach(key, value) {
31
+ const ns = namespace();
32
+ ns[key] = value;
33
+ return ns;
34
+ }
35
+
36
+ // src/static/sdk-libs/wallet/index.js
37
+ var { authFetch: authFetch2 } = makeSession("aimeat-wallet.js");
38
+ var wallet = {
39
+ // Get current balance
40
+ async balance() {
41
+ const res = await authFetch2("/v1/wallet");
42
+ if (!res.ok) throw new Error(res.error?.message || "Failed to get balance");
43
+ return res.data;
44
+ },
45
+ // Get transaction history
46
+ async transactions(opts) {
47
+ const params = new URLSearchParams();
48
+ if (opts?.type) params.set("type", opts.type);
49
+ if (opts?.page) params.set("page", String(opts.page));
50
+ if (opts?.per_page) params.set("per_page", String(opts.per_page));
51
+ if (opts?.limit) params.set("limit", String(opts.limit));
52
+ const qs = params.toString();
53
+ const res = await authFetch2("/v1/wallet/transactions" + (qs ? "?" + qs : ""));
54
+ if (!res.ok) throw new Error(res.error?.message || "Failed to get transactions");
55
+ return res.data;
56
+ },
57
+ // Legacy: get transaction history
58
+ async history(opts) {
59
+ const params = new URLSearchParams();
60
+ if (opts?.limit) params.set("limit", String(opts.limit));
61
+ const qs = params.toString();
62
+ const res = await authFetch2("/v1/wallet/history" + (qs ? "?" + qs : ""));
63
+ if (!res.ok) throw new Error(res.error?.message || "Failed to get history");
64
+ return res.data;
65
+ },
66
+ // Request morsels (e.g. daily allowance)
67
+ async request(amount, reason) {
68
+ const res = await authFetch2("/v1/wallet/request", {
69
+ method: "POST",
70
+ body: JSON.stringify({ amount, reason })
71
+ });
72
+ if (!res.ok) throw new Error(res.error?.message || "Failed to request morsels");
73
+ return res.data;
74
+ },
75
+ // ── UI Component: Balance Badge ──
76
+ mountBadge(selector, opts) {
77
+ const el = typeof selector === "string" ? document.querySelector(selector) : selector;
78
+ if (!el) throw new Error("Badge element not found: " + selector);
79
+ const badge = document.createElement("div");
80
+ badge.style.cssText = "display:inline-flex;align-items:center;gap:6px;padding:4px 12px;background:#1e293b;border:1px solid #475569;border-radius:20px;color:#e2e8f0;font-family:system-ui;font-size:13px;cursor:pointer";
81
+ badge.innerHTML = '<span style="font-size:16px">🍪</span><span class="aimeat-balance">...</span>';
82
+ el.appendChild(badge);
83
+ async function refresh() {
84
+ try {
85
+ const data = await wallet.balance();
86
+ badge.querySelector(".aimeat-balance").textContent = (data.available ?? data.balance ?? 0) + " morsels";
87
+ } catch {
88
+ badge.querySelector(".aimeat-balance").textContent = "--";
89
+ }
90
+ }
91
+ refresh();
92
+ const interval = setInterval(refresh, (opts?.refreshInterval || 30) * 1e3);
93
+ badge.addEventListener("click", async () => {
94
+ try {
95
+ const txData = await wallet.transactions({ limit: 10 });
96
+ const txList = (txData.transactions || []).map(
97
+ (tx) => '<div style="padding:4px 0;border-bottom:1px solid #334155;font-size:12px"><span style="color:' + (tx.amount >= 0 ? "#4ade80" : "#f87171") + '">' + (tx.amount >= 0 ? "+" : "") + tx.amount + "</span> " + (tx.type || "") + ' <span style="color:#94a3b8">' + new Date(tx.timestamp).toLocaleString() + "</span></div>"
98
+ ).join("");
99
+ const popup = document.createElement("div");
100
+ popup.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:99999";
101
+ popup.innerHTML = '<div style="background:#1e293b;border:1px solid #475569;border-radius:12px;padding:16px;max-width:320px;width:90%;color:#e2e8f0;font-family:system-ui;max-height:60vh;overflow-y:auto"><h4 style="margin:0 0 12px">🍪 Wallet Transactions</h4>' + (txList || '<p style="color:#94a3b8;font-size:13px">No transactions yet.</p>') + '<button style="margin-top:12px;padding:6px 16px;background:#334155;color:#e2e8f0;border:none;border-radius:8px;cursor:pointer;font-size:13px">Close</button></div>';
102
+ popup.querySelector("button").addEventListener("click", () => popup.remove());
103
+ popup.addEventListener("click", (e) => {
104
+ if (e.target === popup) popup.remove();
105
+ });
106
+ document.body.appendChild(popup);
107
+ } catch (e) {
108
+ console.error("AIMEAT wallet:", e);
109
+ }
110
+ });
111
+ return { refresh, destroy: () => {
112
+ clearInterval(interval);
113
+ badge.remove();
114
+ } };
115
+ }
116
+ };
117
+ attach("wallet", wallet);
118
+ })();
@@ -0,0 +1,187 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/webmcp/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-webmcp.js (with a per-node config prelude).
3
+ "use strict";
4
+ (() => {
5
+ // src/static/sdk-libs/_core/config.js
6
+ function cfg() {
7
+ return window.__AIMEAT_SDK_CFG__ || { nodeId: "", baseUrl: "" };
8
+ }
9
+ function resolveNodeUrl() {
10
+ const meta = document.querySelector('meta[name="aimeat-node"]');
11
+ if (meta) return (meta.getAttribute("content") || "").replace(/\/$/, "");
12
+ if (location.protocol === "http:" || location.protocol === "https:") return location.origin;
13
+ return cfg().baseUrl;
14
+ }
15
+ var NODE_URL = resolveNodeUrl();
16
+ var APEX_URL = cfg().baseUrl;
17
+ var NODE_ID = cfg().nodeId;
18
+ var HEARTBEAT_MS = cfg().heartbeatMs || 3e4;
19
+
20
+ // src/static/sdk-libs/_core/namespace.js
21
+ function namespace() {
22
+ if (!window.AIMEAT) window.AIMEAT = {};
23
+ return window.AIMEAT;
24
+ }
25
+ function attach(key, value) {
26
+ const ns = namespace();
27
+ ns[key] = value;
28
+ return ns;
29
+ }
30
+
31
+ // src/static/sdk-libs/webmcp/index.js
32
+ var NODE_URL2 = APEX_URL;
33
+ function asContent(value) {
34
+ const text = typeof value === "string" ? value : JSON.stringify(value, null, 1);
35
+ return { content: [{ type: "text", text }] };
36
+ }
37
+ async function registerWith(tools) {
38
+ const doc = (
39
+ /** @type {any} */
40
+ typeof document !== "undefined" ? document : {}
41
+ );
42
+ const nav = (
43
+ /** @type {any} */
44
+ typeof navigator !== "undefined" ? navigator : {}
45
+ );
46
+ const docMc = doc.modelContext;
47
+ const navMc = nav.modelContext;
48
+ if (docMc && typeof docMc.registerTool === "function") {
49
+ for (const t of tools) await docMc.registerTool(t);
50
+ return "document.modelContext.registerTool";
51
+ }
52
+ if (navMc && typeof navMc.registerTool === "function") {
53
+ for (const t of tools) await navMc.registerTool(t);
54
+ return "navigator.modelContext.registerTool";
55
+ }
56
+ if (navMc && typeof navMc.provideContext === "function") {
57
+ await navMc.provideContext({ tools: webmcp.tools.concat(tools) });
58
+ return "navigator.modelContext.provideContext";
59
+ }
60
+ return "none";
61
+ }
62
+ async function fetchListing(owner, appId) {
63
+ const r = await fetch(NODE_URL2 + "/v1/apps/" + encodeURIComponent(owner) + "/" + encodeURIComponent(appId) + "/webmcp");
64
+ const body = await r.json();
65
+ if (!r.ok) throw new Error(body.error && body.error.message || "WebMCP listing failed: " + r.status);
66
+ return body;
67
+ }
68
+ function buildExecute(owner, appId, entry) {
69
+ return async function execute(args) {
70
+ const appRef = owner + "/" + appId;
71
+ const paid = entry.payment && entry.payment.required;
72
+ if (paid) {
73
+ const commerce = window.AIMEAT && window.AIMEAT.commerce;
74
+ const session = window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.getSession && window.AIMEAT.auth.getSession();
75
+ if (commerce && session) {
76
+ try {
77
+ const done = await commerce.invokeAppTool({ app: appRef, tool: entry.name, input: args || {} });
78
+ const f = done.fulfillment || {};
79
+ const result = f.results && f.results[0] && f.results[0].result !== void 0 ? f.results[0].result : { queued_task: f.taskIds && f.taskIds[0] || null, note: "Order queued as an agent task; the deliverable arrives via the seller." };
80
+ return asContent({ tool: entry.name, receipt: done.receipt, result });
81
+ } catch (e) {
82
+ return asContent({ tool: entry.name, error: e.message, code: e.code, accepts: e.accepts });
83
+ }
84
+ }
85
+ const r = await fetch(entry.invoke.url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input: args || {} }) });
86
+ return asContent(await r.json());
87
+ }
88
+ const sess = window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.getSession && window.AIMEAT.auth.getSession();
89
+ if (!sess) return asContent({ tool: entry.name, error: "Sign in to call this free tool (bearer token required)." });
90
+ const res = await sess.fetch("/v1/apps/" + encodeURIComponent(owner) + "/" + encodeURIComponent(appId) + "/webmcp/tools/" + encodeURIComponent(entry.name), {
91
+ method: "POST",
92
+ body: JSON.stringify({ input: args || {} })
93
+ });
94
+ return asContent(res.ok ? res.data : res);
95
+ };
96
+ }
97
+ var webmcp = {
98
+ /** Every tool descriptor this page has registered (introspection + provideContext resends). */
99
+ tools: [],
100
+ /** The registration surface last used ('none' when no agent API is present). */
101
+ surface: "none",
102
+ /** Low-level: register ready-made WebMCP tool descriptors ({name, description, inputSchema, execute}).
103
+ * Re-registering a name REPLACES the earlier descriptor (idempotent across repeated expose calls). */
104
+ async register(tools) {
105
+ const names = tools.map(function(t) {
106
+ return t.name;
107
+ });
108
+ webmcp.tools = webmcp.tools.filter(function(t) {
109
+ return names.indexOf(t.name) === -1;
110
+ });
111
+ const surface = await registerWith(tools);
112
+ webmcp.tools = webmcp.tools.concat(tools);
113
+ webmcp.surface = surface;
114
+ return surface;
115
+ },
116
+ /**
117
+ * Expose an app's declared tools (apps.{appId}.tools manifest) to the in-browser agent.
118
+ * Descriptions of priced tools carry the price tag so the agent can tell the user the cost.
119
+ */
120
+ async exposeAppTools(ref) {
121
+ const listing = await fetchListing(ref.owner, ref.appId);
122
+ const tools = (listing.tools || []).map(function(entry) {
123
+ let desc = entry.description || entry.name;
124
+ if (entry.payment && entry.payment.required) {
125
+ const p = entry.payment;
126
+ const tags = [];
127
+ if (p.price) tags.push(p.price.morsels + " morsels/call");
128
+ if (p.priceMoney) tags.push(p.priceMoney.amount / 1e6 + " " + p.priceMoney.currency + "/call");
129
+ desc = "[PAID: " + tags.join(" or ") + "] " + desc;
130
+ }
131
+ return {
132
+ name: entry.name,
133
+ description: desc,
134
+ inputSchema: entry.inputSchema || { type: "object", properties: {} },
135
+ execute: buildExecute(ref.owner, ref.appId, entry)
136
+ };
137
+ });
138
+ await webmcp.register(tools);
139
+ return { surface: webmcp.surface, tools: tools.map(function(t) {
140
+ return t.name;
141
+ }) };
142
+ },
143
+ /** Node-level tools for the portal pages: public commerce/product discovery, no auth needed. */
144
+ async exposeNodeTools() {
145
+ const tools = [
146
+ {
147
+ name: "aimeat-commerce-feed",
148
+ description: "List everything for sale on this AIMEAT node: agent offers and priced app-tools (per-call functions of published apps), with prices in morsels or money micro-units.",
149
+ inputSchema: { type: "object", properties: {} },
150
+ async execute() {
151
+ const r = await fetch(NODE_URL2 + "/v1/commerce/feed");
152
+ return asContent(await r.json());
153
+ }
154
+ },
155
+ {
156
+ name: "aimeat-node-info",
157
+ description: "Describe this AIMEAT node: identity, capabilities, discovery endpoints, and how agents connect.",
158
+ inputSchema: { type: "object", properties: {} },
159
+ async execute() {
160
+ const r = await fetch(NODE_URL2 + "/.well-known/aimeat");
161
+ return asContent(await r.json());
162
+ }
163
+ }
164
+ ];
165
+ await webmcp.register(tools);
166
+ return { surface: webmcp.surface, tools: tools.map(function(t) {
167
+ return t.name;
168
+ }) };
169
+ }
170
+ };
171
+ attach("webmcp", webmcp);
172
+ try {
173
+ const el = (
174
+ /** @type {any} */
175
+ typeof document !== "undefined" && document.currentScript
176
+ );
177
+ const src = el && el.src ? new URL(el.src, location.href) : null;
178
+ const expose = src && src.searchParams.get("expose") || el && el.dataset && el.dataset.expose;
179
+ if (expose === "node") {
180
+ setTimeout(function() {
181
+ webmcp.exposeNodeTools().catch(function() {
182
+ });
183
+ }, 0);
184
+ }
185
+ } catch {
186
+ }
187
+ })();