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,300 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/speech/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-speech.js (with a per-node config prelude).
3
+ "use strict";
4
+ (() => {
5
+ // src/static/sdk-libs/_core/namespace.js
6
+ function namespace() {
7
+ if (!window.AIMEAT) window.AIMEAT = {};
8
+ return window.AIMEAT;
9
+ }
10
+ function attach(key, value) {
11
+ const ns = namespace();
12
+ ns[key] = value;
13
+ return ns;
14
+ }
15
+
16
+ // src/static/sdk-libs/speech/index.js
17
+ var _listeners = {};
18
+ function emit(event, data) {
19
+ (_listeners[event] || []).forEach(function(fn) {
20
+ fn(data);
21
+ });
22
+ }
23
+ var _supported = {
24
+ get tts() {
25
+ return typeof window !== "undefined" && "speechSynthesis" in window;
26
+ },
27
+ get stt() {
28
+ return typeof window !== "undefined" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window);
29
+ }
30
+ };
31
+ var _ttsProvider = null;
32
+ var _sttProvider = null;
33
+ var _speaking = false;
34
+ var _ttsQueue = [];
35
+ var _listening = false;
36
+ var _recognition = null;
37
+ var _mediaRecorder = null;
38
+ var _voicesLoaded = false;
39
+ var _voicesList = [];
40
+ function loadVoices() {
41
+ if (!_supported.tts) return [];
42
+ _voicesList = speechSynthesis.getVoices().map(function(v) {
43
+ return { name: v.name, lang: v.lang };
44
+ });
45
+ _voicesLoaded = _voicesList.length > 0;
46
+ return _voicesList;
47
+ }
48
+ if (typeof window !== "undefined" && _supported.tts) {
49
+ speechSynthesis.addEventListener("voiceschanged", loadVoices);
50
+ loadVoices();
51
+ }
52
+ function nativeSay(text, opts) {
53
+ return new Promise(function(resolve) {
54
+ const utt = new SpeechSynthesisUtterance(text);
55
+ if (opts && opts.lang) utt.lang = opts.lang;
56
+ if (opts && opts.rate !== void 0) utt.rate = opts.rate;
57
+ if (opts && opts.pitch !== void 0) utt.pitch = opts.pitch;
58
+ if (opts && opts.volume !== void 0) utt.volume = opts.volume;
59
+ if (opts && opts.voice) {
60
+ const voices = speechSynthesis.getVoices();
61
+ const match = voices.find(function(v) {
62
+ return v.name === opts.voice || v.name.indexOf(opts.voice) >= 0;
63
+ });
64
+ if (match) utt.voice = match;
65
+ }
66
+ utt.onstart = function() {
67
+ emit("start", {});
68
+ };
69
+ utt.onend = function() {
70
+ _speaking = false;
71
+ processQueue();
72
+ emit("end", {});
73
+ resolve(void 0);
74
+ };
75
+ utt.onboundary = function(e) {
76
+ if (e.name === "word") emit("word", { word: text.substr(e.charIndex, e.charLength || 10).split(/\s/)[0], index: e.charIndex });
77
+ };
78
+ utt.onerror = function(e) {
79
+ _speaking = false;
80
+ processQueue();
81
+ emit("error", { error: e.error });
82
+ resolve(void 0);
83
+ };
84
+ _speaking = true;
85
+ speechSynthesis.speak(utt);
86
+ });
87
+ }
88
+ function cloudSay(text, opts) {
89
+ if (!_ttsProvider || !_ttsProvider.say) return Promise.resolve();
90
+ _speaking = true;
91
+ emit("start", {});
92
+ return _ttsProvider.say(text, opts || {}).then(function(blob) {
93
+ if (!blob) {
94
+ _speaking = false;
95
+ processQueue();
96
+ emit("end", {});
97
+ return;
98
+ }
99
+ const ac = new (window.AudioContext || window.webkitAudioContext)();
100
+ return blob.arrayBuffer().then(function(ab) {
101
+ return ac.decodeAudioData(ab);
102
+ }).then(function(buf) {
103
+ const source = ac.createBufferSource();
104
+ source.buffer = buf;
105
+ source.connect(ac.destination);
106
+ source.onended = function() {
107
+ _speaking = false;
108
+ processQueue();
109
+ emit("end", {});
110
+ };
111
+ source.start();
112
+ });
113
+ }).catch(function(e) {
114
+ _speaking = false;
115
+ processQueue();
116
+ emit("error", { error: e.message });
117
+ });
118
+ }
119
+ function processQueue() {
120
+ if (_ttsQueue.length > 0 && !_speaking) {
121
+ const next = _ttsQueue.shift();
122
+ if (next) doSay(next.text, next.opts);
123
+ }
124
+ }
125
+ function doSay(text, opts) {
126
+ if (_ttsProvider) return cloudSay(text, opts);
127
+ if (!_supported.tts) {
128
+ console.warn("[aimeat-speech] TTS not supported in this browser");
129
+ return Promise.resolve();
130
+ }
131
+ return nativeSay(text, opts);
132
+ }
133
+ function nativeListen(opts) {
134
+ return new Promise(function(resolve, reject) {
135
+ const SpeechRecog = window.SpeechRecognition || window.webkitSpeechRecognition;
136
+ if (!SpeechRecog) {
137
+ reject(new Error("SpeechRecognition not supported"));
138
+ return;
139
+ }
140
+ _recognition = new SpeechRecog();
141
+ _recognition.lang = opts && opts.lang || "en-US";
142
+ _recognition.continuous = opts && opts.continuous || false;
143
+ _recognition.interimResults = opts && opts.interimResults || false;
144
+ const commands = opts && opts.commands || null;
145
+ _recognition.onstart = function() {
146
+ _listening = true;
147
+ emit("listening", {});
148
+ };
149
+ _recognition.onresult = function(e) {
150
+ for (let i = e.resultIndex; i < e.results.length; i++) {
151
+ const result = e.results[i];
152
+ const text = result[0].transcript.trim();
153
+ const final = result.isFinal;
154
+ const confidence = result[0].confidence;
155
+ emit("result", { text, final, confidence });
156
+ if (final && commands) matchCommand(text, commands);
157
+ if (final && !_recognition.continuous) {
158
+ resolve({ text, confidence, lang: _recognition.lang });
159
+ }
160
+ }
161
+ };
162
+ _recognition.onerror = function(e) {
163
+ _listening = false;
164
+ emit("error", { error: e.error });
165
+ if (!_recognition.continuous) reject(new Error(e.error));
166
+ };
167
+ _recognition.onend = function() {
168
+ _listening = false;
169
+ emit("stopped", {});
170
+ if (opts && opts.continuous && _recognition) {
171
+ try {
172
+ _recognition.start();
173
+ } catch {
174
+ }
175
+ }
176
+ };
177
+ _recognition.start();
178
+ });
179
+ }
180
+ function cloudListen(opts) {
181
+ if (!_sttProvider || !_sttProvider.listen) return Promise.reject(new Error("No STT provider configured"));
182
+ return navigator.mediaDevices.getUserMedia({ audio: true }).then(function(stream) {
183
+ return new Promise(function(resolve, reject) {
184
+ const chunks = [];
185
+ _mediaRecorder = new MediaRecorder(stream, { mimeType: "audio/webm" });
186
+ _listening = true;
187
+ emit("listening", {});
188
+ _mediaRecorder.ondataavailable = function(e) {
189
+ if (e.data.size > 0) chunks.push(e.data);
190
+ };
191
+ _mediaRecorder.onstop = function() {
192
+ _listening = false;
193
+ stream.getTracks().forEach(function(t) {
194
+ t.stop();
195
+ });
196
+ emit("stopped", {});
197
+ const blob = new Blob(chunks, { type: "audio/webm" });
198
+ _sttProvider.listen(blob, opts || {}).then(function(result) {
199
+ const text = typeof result === "string" ? result : result.text || result.transcript || "";
200
+ const confidence = typeof result === "object" ? result.confidence || 1 : 1;
201
+ emit("result", { text, final: true, confidence });
202
+ resolve({ text, confidence, lang: opts && opts.lang || "en-US" });
203
+ }).catch(function(e) {
204
+ emit("error", { error: e.message });
205
+ reject(e);
206
+ });
207
+ };
208
+ _mediaRecorder.start();
209
+ if (!(opts && opts.continuous)) {
210
+ setTimeout(function() {
211
+ if (_mediaRecorder && _mediaRecorder.state === "recording") _mediaRecorder.stop();
212
+ }, opts && opts.timeout || 5e3);
213
+ }
214
+ });
215
+ });
216
+ }
217
+ function matchCommand(text, commands) {
218
+ const lower = text.toLowerCase();
219
+ Object.keys(commands).forEach(function(pattern) {
220
+ const parts = pattern.toLowerCase().split(/\s+/);
221
+ const regex = "^" + parts.map(function(p) {
222
+ if (p.startsWith("*")) return "(.+)";
223
+ return p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
224
+ }).join("\\s+") + "$";
225
+ const match = lower.match(new RegExp(regex));
226
+ if (match) {
227
+ const captures = match.slice(1);
228
+ commands[pattern].apply(null, captures);
229
+ }
230
+ });
231
+ }
232
+ var speech = {
233
+ say: function(text, opts) {
234
+ if (_speaking) {
235
+ _ttsQueue.push({ text, opts });
236
+ return;
237
+ }
238
+ return doSay(text, opts);
239
+ },
240
+ stop: function() {
241
+ if (_supported.tts) speechSynthesis.cancel();
242
+ _speaking = false;
243
+ _ttsQueue = [];
244
+ },
245
+ get speaking() {
246
+ return _speaking;
247
+ },
248
+ voices: function(opts) {
249
+ if (!_voicesLoaded) loadVoices();
250
+ if (opts && opts.lang) {
251
+ const lang = opts.lang.toLowerCase();
252
+ return _voicesList.filter(function(v) {
253
+ return v.lang.toLowerCase().startsWith(lang);
254
+ });
255
+ }
256
+ return _voicesList;
257
+ },
258
+ listen: function(opts) {
259
+ if (_sttProvider) return cloudListen(opts);
260
+ return nativeListen(opts);
261
+ },
262
+ stopListening: function() {
263
+ if (_recognition) {
264
+ _recognition.continuous = false;
265
+ try {
266
+ _recognition.stop();
267
+ } catch {
268
+ }
269
+ _recognition = null;
270
+ }
271
+ if (_mediaRecorder && _mediaRecorder.state === "recording") {
272
+ _mediaRecorder.stop();
273
+ _mediaRecorder = null;
274
+ }
275
+ _listening = false;
276
+ },
277
+ get listening() {
278
+ return _listening;
279
+ },
280
+ get supported() {
281
+ return _supported;
282
+ },
283
+ use: function(type, provider) {
284
+ if (type === "tts") _ttsProvider = provider;
285
+ else if (type === "stt") _sttProvider = provider;
286
+ else console.warn("[aimeat-speech] Unknown provider type:", type);
287
+ },
288
+ on: function(event, fn) {
289
+ if (!_listeners[event]) _listeners[event] = [];
290
+ _listeners[event].push(fn);
291
+ },
292
+ off: function(event, fn) {
293
+ if (!_listeners[event]) return;
294
+ _listeners[event] = _listeners[event].filter(function(f) {
295
+ return f !== fn;
296
+ });
297
+ }
298
+ };
299
+ attach("speech", speech);
300
+ })();
@@ -0,0 +1,210 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/storage/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-storage.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/storage/index.js
52
+ var { getSession: getSession2, authFetch: authFetch2 } = makeSession("aimeat-storage.js");
53
+ var storage = {
54
+ // Upload a file (File object, Blob, or base64 string)
55
+ async upload(fileOrData, opts) {
56
+ let key, data, mime_type, visibility;
57
+ if (fileOrData instanceof File || fileOrData instanceof Blob) {
58
+ const file = (
59
+ /** @type {File} */
60
+ fileOrData
61
+ );
62
+ key = opts?.key || file.name || "file-" + Date.now();
63
+ mime_type = opts?.mime_type || file.type || "application/octet-stream";
64
+ visibility = opts?.visibility || "private";
65
+ const buf = await file.arrayBuffer();
66
+ const bytes = new Uint8Array(buf);
67
+ let binary = "";
68
+ for (let i = 0; i < bytes.length; i += 8192) {
69
+ binary += String.fromCharCode.apply(null, bytes.subarray(i, i + 8192));
70
+ }
71
+ data = btoa(binary);
72
+ } else if (typeof fileOrData === "string") {
73
+ key = opts?.key || "file-" + Date.now();
74
+ data = fileOrData;
75
+ mime_type = opts?.mime_type || "application/octet-stream";
76
+ visibility = opts?.visibility || "private";
77
+ } else {
78
+ throw new Error("upload() expects a File, Blob, or base64 string");
79
+ }
80
+ const res = await authFetch2("/v1/storage", {
81
+ method: "POST",
82
+ body: JSON.stringify({ key, data, mime_type, visibility })
83
+ });
84
+ if (!res.ok) throw new Error(res.error?.message || "Upload failed");
85
+ return res.data;
86
+ },
87
+ // Download a file as Blob
88
+ async download(key) {
89
+ const session = getSession2();
90
+ const jwt = session.jwt;
91
+ const r = await fetch(NODE_URL + "/v1/storage/" + encodeURIComponent(key), {
92
+ headers: { "Authorization": "Bearer " + jwt }
93
+ });
94
+ if (!r.ok) throw new Error("Download failed: " + r.status);
95
+ return r.blob();
96
+ },
97
+ // Get a direct URL for embedding (e.g. in <img src="">)
98
+ // Note: requires auth header, so only works with public files or session.fetch
99
+ publicUrl(key) {
100
+ return NODE_URL + "/v1/storage/" + encodeURIComponent(key);
101
+ },
102
+ // List all files
103
+ async list() {
104
+ const res = await authFetch2("/v1/storage");
105
+ if (!res.ok) throw new Error(res.error?.message || "Failed to list files");
106
+ return res.data;
107
+ },
108
+ // Get file metadata (HEAD request)
109
+ async metadata(key) {
110
+ const session = getSession2();
111
+ const jwt = session.jwt;
112
+ const r = await fetch(NODE_URL + "/v1/storage/" + encodeURIComponent(key), {
113
+ method: "HEAD",
114
+ headers: { "Authorization": "Bearer " + jwt }
115
+ });
116
+ if (!r.ok) throw new Error("Metadata fetch failed: " + r.status);
117
+ return {
118
+ contentType: r.headers.get("Content-Type"),
119
+ contentLength: parseInt(r.headers.get("Content-Length") || "0"),
120
+ visibility: r.headers.get("X-AIMEAT-Visibility"),
121
+ createdAt: r.headers.get("X-AIMEAT-Created")
122
+ };
123
+ },
124
+ // Delete a file
125
+ async delete(key) {
126
+ const res = await authFetch2("/v1/storage/" + encodeURIComponent(key), { method: "DELETE" });
127
+ if (!res.ok) throw new Error(res.error?.message || "Delete failed");
128
+ return res.data;
129
+ },
130
+ // ── Chunked upload for large files ──
131
+ async uploadChunked(file, opts) {
132
+ const chunkSize = opts?.chunkSize || 1024 * 1024;
133
+ const key = opts?.key || file.name || "file-" + Date.now();
134
+ const mime_type = opts?.mime_type || file.type || "application/octet-stream";
135
+ const visibility = opts?.visibility || "private";
136
+ const totalChunks = Math.ceil(file.size / chunkSize);
137
+ const initRes = await authFetch2("/v1/storage/upload/init", {
138
+ method: "POST",
139
+ body: JSON.stringify({ key, mime_type, visibility, chunk_size: chunkSize, total_chunks: totalChunks })
140
+ });
141
+ if (!initRes.ok) throw new Error(initRes.error?.message || "Chunked upload init failed");
142
+ const uploadId = initRes.data.upload_id;
143
+ const session = getSession2();
144
+ for (let i = 0; i < totalChunks; i++) {
145
+ const start = i * chunkSize;
146
+ const end = Math.min(start + chunkSize, file.size);
147
+ const chunk = file.slice(start, end);
148
+ const buf = await chunk.arrayBuffer();
149
+ const r = await fetch(NODE_URL + "/v1/storage/upload/" + uploadId + "/" + i, {
150
+ method: "PUT",
151
+ headers: {
152
+ "Authorization": "Bearer " + session.jwt,
153
+ "Content-Type": "application/octet-stream"
154
+ },
155
+ body: buf
156
+ });
157
+ if (!r.ok) throw new Error("Chunk " + i + " upload failed: " + r.status);
158
+ if (opts?.onProgress) opts.onProgress({ chunk: i, total: totalChunks, percent: Math.round((i + 1) / totalChunks * 100) });
159
+ }
160
+ const completeRes = await authFetch2("/v1/storage/upload/" + uploadId + "/complete", { method: "POST" });
161
+ if (!completeRes.ok) throw new Error(completeRes.error?.message || "Chunked upload complete failed");
162
+ return completeRes.data;
163
+ },
164
+ // Abort a chunked upload
165
+ async abortUpload(uploadId) {
166
+ const res = await authFetch2("/v1/storage/upload/" + uploadId, { method: "DELETE" });
167
+ if (!res.ok) throw new Error(res.error?.message || "Abort failed");
168
+ return res.data;
169
+ },
170
+ // ── Drag & Drop helper ──
171
+ enableDropZone(selector, opts) {
172
+ const el = (
173
+ /** @type {HTMLElement} */
174
+ typeof selector === "string" ? document.querySelector(selector) : selector
175
+ );
176
+ if (!el) throw new Error("Drop zone element not found: " + selector);
177
+ const accept = opts?.accept || "*/*";
178
+ const maxSize = opts?.maxSize || 10 * 1024 * 1024;
179
+ el.addEventListener("dragover", (e) => {
180
+ e.preventDefault();
181
+ el.style.outline = "2px dashed #38bdf8";
182
+ });
183
+ el.addEventListener("dragleave", () => {
184
+ el.style.outline = "";
185
+ });
186
+ el.addEventListener("drop", async (e) => {
187
+ e.preventDefault();
188
+ el.style.outline = "";
189
+ const files = Array.from(e.dataTransfer.files);
190
+ for (const file of files) {
191
+ if (accept !== "*/*" && !file.type.match(accept.replace("*", ".*"))) {
192
+ if (opts?.onError) opts.onError(new Error("File type not accepted: " + file.type));
193
+ continue;
194
+ }
195
+ if (file.size > maxSize) {
196
+ if (opts?.onError) opts.onError(new Error("File too large: " + file.name + " (" + file.size + " bytes)"));
197
+ continue;
198
+ }
199
+ try {
200
+ const ref = await storage.upload(file, opts);
201
+ if (opts?.onUpload) opts.onUpload(ref, file);
202
+ } catch (err) {
203
+ if (opts?.onError) opts.onError(err);
204
+ }
205
+ }
206
+ });
207
+ }
208
+ };
209
+ attach("storage", storage);
210
+ })();