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,243 @@
1
+ /**
2
+ * @file commerce/index.js
3
+ * @description The aimeat-commerce library (SDK-libs migration Phase 2, TARGET-033/034). Exposes
4
+ * AIMEAT.commerce — checkout sessions over /v1/commerce/*, offer price reading, money formatting in
5
+ * 6-decimal micro-units, the x402-style 402 `accepts` surface, and the app-tool convention (manifest
6
+ * read + one-call buy). Authenticated calls go through the AIMEAT.auth session; feed/getAppTools are
7
+ * public. Componentized ESM source esbuild bundles to the IIFE served, unchanged, at
8
+ * /v1/libs/aimeat-commerce.js. Ported verbatim from lib-commerce.ts. SECURITY: carries NO secrets —
9
+ * seller PSP credentials are server-side only; NODE_URL is the apex base (APEX_URL from _core/config).
10
+ * @structure imports APEX_URL (config) + authFetch (session) + attach (namespace); commerceError/
11
+ * normalizeItems; money helpers; checkout lifecycle; offer discovery; app-tools; attach('commerce', …).
12
+ * @usage <script src="/v1/libs/aimeat-auth.js"></script><script src="/v1/libs/aimeat-commerce.js"></script>
13
+ * const s = await AIMEAT.commerce.buyOffer('vendor#alice@node', 'translate-doc');
14
+ * @version-history
15
+ * v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-commerce.ts (SDK-libs migration Phase 2).
16
+ */
17
+ import { APEX_URL } from '../_core/config.js';
18
+ import { makeSession } from '../_core/session.js';
19
+ const { authFetch } = makeSession('aimeat-commerce.js');
20
+ import { attach } from '../_core/namespace.js';
21
+
22
+ const NODE_URL = APEX_URL;
23
+
24
+ /** Micros per whole currency unit — money amounts are 6-decimal micro-units (matches USDC/x402). */
25
+ const MONEY_UNIT = 1000000;
26
+
27
+ /** Build an Error from a failed envelope; 402 responses carry the x402-style accepts block. */
28
+ function commerceError(res, fallback) {
29
+ const e = /** @type {Error & { code?: string, paymentRequired?: boolean, accepts?: unknown, x402Version?: unknown }} */ (new Error((res.error && res.error.message) || fallback));
30
+ e.code = res.error && res.error.code;
31
+ if (res.accepts) {
32
+ e.paymentRequired = true;
33
+ e.accepts = res.accepts; // [{ scheme, handler, currencies, description, resource }]
34
+ e.x402Version = res.x402Version;
35
+ }
36
+ return e;
37
+ }
38
+
39
+ /** Normalize line items: accept offerId or offer_id, default kind 'offer', quantity 1. */
40
+ function normalizeItems(items) {
41
+ const arr = Array.isArray(items) ? items : [items];
42
+ return arr.map(function (i) {
43
+ const out = /** @type {Record<string, any>} */ ({ offer_id: i.offer_id || i.offerId });
44
+ if (i.kind) out.kind = i.kind;
45
+ if (i.agent) out.agent = i.agent;
46
+ if (i.org) out.org = i.org;
47
+ if (i.app) out.app = i.app; // app-tool items (TARGET-034)
48
+ if (i.tool) out.tool = i.tool;
49
+ if (i.input) out.input = i.input; // app-tool: buyer input for the capability invoke
50
+ if (i.quantity) out.quantity = i.quantity;
51
+ return out;
52
+ });
53
+ }
54
+
55
+ const commerce = {
56
+ MONEY_UNIT: MONEY_UNIT,
57
+
58
+ // ── Money formatting (same convention as the portal's utils.js fmtMoney) ──
59
+
60
+ /** Format money micro-units as "1.50 EUR" / "0.002 USD" (≥2 decimals, up to 6 when sub-cent). */
61
+ fmtMoney(micros, currency) {
62
+ const s = ((Number(micros) || 0) / MONEY_UNIT).toFixed(6).replace(/(\.\d{2}\d*?)0+$/, '$1');
63
+ return currency ? s + ' ' + currency : s;
64
+ },
65
+
66
+ /** Format any session/offer amount currency-aware: morsels are integers, money is micro-units. */
67
+ fmtAmount(amount, currency) {
68
+ if (!currency || currency === 'morsel' || currency === 'MORSEL') {
69
+ return (Number(amount) || 0) + ' morsels';
70
+ }
71
+ return commerce.fmtMoney(amount, currency);
72
+ },
73
+
74
+ /** Parse a major-unit input ("1.50", "0,002") into integer money micro-units; null if not positive. */
75
+ microsFromInput(str) {
76
+ const n = parseFloat(String(str).replace(',', '.'));
77
+ if (!Number.isFinite(n) || n <= 0) return null;
78
+ return Math.round(n * MONEY_UNIT);
79
+ },
80
+
81
+ // ── Offer discovery + price reading ──
82
+
83
+ /** Public product feed: every PUBLIC, priced agent offer on the node (no login needed). */
84
+ async feed() {
85
+ const r = await fetch(NODE_URL + '/v1/commerce/feed');
86
+ const res = await r.json();
87
+ if (res.error) throw commerceError(res, 'Failed to read the commerce feed');
88
+ return res; // { products: [{ id: "offer:<agentGaii>:<offerId>", title, price, seller }], total }
89
+ },
90
+
91
+ /** Read one offer (with price/priceMoney) from an agent's published offers. */
92
+ async getOffer(agent, offerId) {
93
+ const res = await authFetch('/v1/agents/' + encodeURIComponent(agent) + '/offers');
94
+ if (!res.ok) throw commerceError(res, 'Failed to read offers');
95
+ const offers = (res.data && res.data.offers) || [];
96
+ return offers.find(function (o) { return o.id === offerId; }) || null;
97
+ },
98
+
99
+ /**
100
+ * The price of an offer or app-tool entry in one currency.
101
+ * → { amount, currency, formatted } or null when it has no price in that currency.
102
+ * currency omitted/'morsel' → price.morsels; 'EUR'/'USD' → priceMoney micro-units.
103
+ */
104
+ priceOf(offer, currency) {
105
+ if (!offer) return null;
106
+ if (!currency || currency === 'morsel') {
107
+ const m = offer.price && Number(offer.price.morsels);
108
+ if (!m || m <= 0) return null;
109
+ return { amount: m, currency: 'morsel', formatted: commerce.fmtAmount(m, 'morsel') };
110
+ }
111
+ const pm = offer.priceMoney;
112
+ if (!pm || pm.currency !== currency) return null;
113
+ return { amount: pm.amount, currency: currency, formatted: commerce.fmtMoney(pm.amount, currency) };
114
+ },
115
+
116
+ // ── Checkout sessions (/v1/commerce/checkout-sessions) ──
117
+
118
+ /**
119
+ * Open a checkout session. items: [{ agent, offer_id, quantity? }] (kind defaults to 'offer').
120
+ * opts: { note?, currency? } — currency 'EUR'/'USD' needs a money price + a settling handler.
121
+ */
122
+ async openCheckout(items, opts) {
123
+ const body = /** @type {Record<string, any>} */ ({ items: normalizeItems(items) });
124
+ if (opts && opts.note) body.note = opts.note;
125
+ if (opts && opts.currency) body.currency = opts.currency;
126
+ const res = await authFetch('/v1/commerce/checkout-sessions', {
127
+ method: 'POST', body: JSON.stringify(body),
128
+ });
129
+ if (!res.ok) throw commerceError(res, 'Failed to open checkout');
130
+ return res.data.session;
131
+ },
132
+
133
+ /** Read one of the buyer's checkout sessions. */
134
+ async getCheckout(id) {
135
+ const res = await authFetch('/v1/commerce/checkout-sessions/' + encodeURIComponent(id));
136
+ if (!res.ok) throw commerceError(res, 'Failed to read checkout');
137
+ return res.data.session;
138
+ },
139
+
140
+ /** The buyer's checkout sessions (purchases), newest first. */
141
+ async listCheckouts(opts) {
142
+ const qs = opts && opts.limit ? '?limit=' + opts.limit : '';
143
+ const res = await authFetch('/v1/commerce/checkout-sessions' + qs);
144
+ if (!res.ok) throw commerceError(res, 'Failed to list checkouts');
145
+ return res.data.sessions;
146
+ },
147
+
148
+ /** Replace the cart of an open session. */
149
+ async updateCheckout(id, items) {
150
+ const res = await authFetch('/v1/commerce/checkout-sessions/' + encodeURIComponent(id), {
151
+ method: 'PATCH', body: JSON.stringify({ items: normalizeItems(items) }),
152
+ });
153
+ if (!res.ok) throw commerceError(res, 'Failed to update checkout');
154
+ return res.data.session;
155
+ },
156
+
157
+ /** Cancel an open session. */
158
+ async cancelCheckout(id) {
159
+ const res = await authFetch('/v1/commerce/checkout-sessions/' + encodeURIComponent(id), {
160
+ method: 'PATCH', body: JSON.stringify({ cancel: true }),
161
+ });
162
+ if (!res.ok) throw commerceError(res, 'Failed to cancel checkout');
163
+ return res.data.session;
164
+ },
165
+
166
+ /**
167
+ * Complete (pay + fulfill) a session. payment: { handler?, instrument? } — omit for the
168
+ * node default (morsels). On 402 the thrown error has err.paymentRequired + err.accepts.
169
+ * Returns the completed session: session.receipt { handler, charged, fee }, session.fulfillment.
170
+ */
171
+ async completeCheckout(id, payment) {
172
+ const res = await authFetch('/v1/commerce/checkout-sessions/' + encodeURIComponent(id) + '/complete', {
173
+ method: 'POST', body: JSON.stringify(payment ? { payment: payment } : {}),
174
+ });
175
+ if (!res.ok) throw commerceError(res, 'Failed to complete checkout');
176
+ return res.data.session;
177
+ },
178
+
179
+ /** One-call purchase: open a session for one offer and complete it immediately. */
180
+ async buyOffer(agent, offerId, opts) {
181
+ const session = await commerce.openCheckout(
182
+ [{ agent: agent, offer_id: offerId, quantity: (opts && opts.quantity) || 1 }], opts);
183
+ return commerce.completeCheckout(session.id, opts && opts.payment);
184
+ },
185
+
186
+ /** The seller's received orders (completed sessions where you are the seller). */
187
+ async listOrders(opts) {
188
+ const qs = opts && opts.limit ? '?limit=' + opts.limit : '';
189
+ const res = await authFetch('/v1/commerce/orders' + qs);
190
+ if (!res.ok) throw commerceError(res, 'Failed to list orders');
191
+ return res.data.orders;
192
+ },
193
+
194
+ // ── App tools (TARGET-034 — priced tool calls on agent-faced apps) ──
195
+
196
+ /**
197
+ * Read an app's declared tool manifest: the public memory record apps.{appId}.tools under the
198
+ * app owner's GHII — { tools: [{ name, description, inputSchema, action_id?, agent?, price?, priceMoney? }] }.
199
+ * Returns null when the app declares no tools. Works logged out (public read).
200
+ */
201
+ async getAppTools(ownerGhii, appId) {
202
+ const url = NODE_URL + '/v1/memory/' + encodeURIComponent(ownerGhii) + '/'
203
+ + encodeURIComponent('apps.' + appId + '.tools');
204
+ const r = await fetch(url);
205
+ const res = await r.json();
206
+ if (!res.ok) {
207
+ if (res.error && res.error.code === 'NOT_FOUND') return null;
208
+ throw commerceError(res, 'Failed to read app tools');
209
+ }
210
+ return res.data.value;
211
+ },
212
+
213
+ /**
214
+ * Buy + invoke a priced app-tool through the checkout core (TARGET-034):
215
+ * one { kind:'app-tool', app:'ownerName/appId', tool, input } line item, opened and
216
+ * completed in one call. A tool bound to a capability (action_id) runs with your input and
217
+ * the result comes back on session.fulfillment.results[0].result; an unbound tool queues an
218
+ * agent TASK for the app owner instead — session.fulfillment.taskIds[0] (the deliverable
219
+ * arrives via the seller's task flow). The receipt shows the charge either way.
220
+ * One call per invocation. On a node without the resolver this throws
221
+ * with code 'APP_TOOL_NOT_AVAILABLE'.
222
+ */
223
+ async invokeAppTool(ref, opts) {
224
+ try {
225
+ const session = await commerce.openCheckout(
226
+ [{ kind: 'app-tool', app: ref.app, tool: ref.tool, input: ref.input }], opts);
227
+ return commerce.completeCheckout(session.id, opts && opts.payment);
228
+ } catch (e) {
229
+ // Older nodes reject the kind at validation (zod enum error naming "kind"); a node with the
230
+ // widened schema but no resolver answers UNKNOWN_ITEM_KIND. Both mean: not sellable here.
231
+ if (e.code === 'UNKNOWN_ITEM_KIND' || (e.code === 'INVALID_CHECKOUT' && /invalid enum|"kind"/i.test(String(e.message)))) {
232
+ const err = /** @type {Error & { code?: string, cause?: unknown }} */ (new Error('This node does not sell app-tools (app-tool resolver not enabled)'));
233
+ err.code = 'APP_TOOL_NOT_AVAILABLE';
234
+ err.cause = e;
235
+ throw err;
236
+ }
237
+ throw e;
238
+ }
239
+ },
240
+ };
241
+
242
+ // ── Expose globally ──
243
+ attach('commerce', commerce);
@@ -0,0 +1,188 @@
1
+ /**
2
+ * @file data/index.js
3
+ * @description The aimeat-data library (SDK-libs migration — config-path proof lib). Exposes
4
+ * AIMEAT.data: the Memory API (Tier 1, JWT auth via AIMEAT.auth) with an app-creator public-read
5
+ * fallback, and Micro-Memory (Tier 0.5, GET-based). This is the componentized ESM source esbuild
6
+ * bundles to the IIFE served, unchanged, at /v1/libs/aimeat-data.js. It is the first migrated lib
7
+ * that actually CONSUMES the shared config: `NODE_URL` (direct public/micro fetches) and `NODE_ID`
8
+ * (the `creator@node` construction in get()'s fallback) come from _core/config — the exact values
9
+ * the legacy string form baked in via `${config.baseUrl}` / `${config.nodeId}`.
10
+ * @structure imports NODE_URL/NODE_ID (config), authFetch (session), attach (namespace); data.set/
11
+ * get/getEntry/update/delete/list/search/getPublic; data.micro()/microSets(); attach('data', …).
12
+ * @usage <script src="/v1/libs/aimeat-auth.js"></script><script src="/v1/libs/aimeat-data.js"></script>
13
+ * await AIMEAT.data.set('key', { value }); await AIMEAT.data.get('key');
14
+ * @version-history
15
+ * v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-data.ts; NODE_URL/NODE_ID now from _core/config.
16
+ */
17
+ import { NODE_URL, NODE_ID } from '../_core/config.js';
18
+ import { makeSession } from '../_core/session.js';
19
+ const { authFetch } = makeSession('aimeat-data.js');
20
+ import { attach } from '../_core/namespace.js';
21
+
22
+ // ── Memory API (Tier 1, JWT auth) ──
23
+
24
+ const data = {
25
+ // Write or upsert a memory entry
26
+ async set(key, value, opts) {
27
+ const body = { key, value, visibility: 'private', ...opts };
28
+ const res = await authFetch('/v1/memory', { method: 'POST', body: JSON.stringify(body) });
29
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to set memory');
30
+ return res.data;
31
+ },
32
+
33
+ // Read a single entry (falls back to public read from app creator if not found or empty).
34
+ // Uses ?soft=1 so a missing key is a clean 200 (value null) — no browser-console 404 noise;
35
+ // the contract is unchanged: resolves null when the key does not exist.
36
+ async get(key) {
37
+ const res = await authFetch('/v1/memory/' + encodeURIComponent(key) + '?soft=1');
38
+ var val = res.ok ? res.data.value : null;
39
+ var isEmpty = val == null || (typeof val === 'object' && Object.keys(val).length === 0);
40
+ if (!isEmpty) return val;
41
+ // Fallback: try public read from app creator's namespace
42
+ var creator = document.querySelector('meta[name="aimeat-creator"]')?.getAttribute('content');
43
+ if (!creator) {
44
+ var m = location.pathname.match(/\/v1\/apps\/([^/]+)\//);
45
+ if (m) {
46
+ creator = decodeURIComponent(m[1]);
47
+ if (creator && !creator.includes('@')) creator = creator + '@' + NODE_ID;
48
+ }
49
+ }
50
+ if (creator) {
51
+ try {
52
+ var pub = await data.getPublic(creator, key);
53
+ if (pub != null) return pub;
54
+ } catch { /* public-read fallback is best-effort */ }
55
+ }
56
+ return val;
57
+ },
58
+
59
+ // Read full entry metadata
60
+ async getEntry(key) {
61
+ const res = await authFetch('/v1/memory/' + encodeURIComponent(key));
62
+ if (!res.ok) {
63
+ if (res.error?.code === 'NOT_FOUND') return null;
64
+ throw new Error(res.error?.message || 'Failed to get memory');
65
+ }
66
+ return res.data;
67
+ },
68
+
69
+ // Update with optimistic locking
70
+ async update(key, value, version, opts) {
71
+ const body = { value, version, ...opts };
72
+ const res = await authFetch('/v1/memory/' + encodeURIComponent(key), {
73
+ method: 'PUT', body: JSON.stringify(body),
74
+ });
75
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to update memory');
76
+ return res.data;
77
+ },
78
+
79
+ // Delete an entry
80
+ async delete(key) {
81
+ const res = await authFetch('/v1/memory/' + encodeURIComponent(key), { method: 'DELETE' });
82
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to delete memory');
83
+ return res.data;
84
+ },
85
+
86
+ // List all memory keys
87
+ async list(opts) {
88
+ const params = new URLSearchParams();
89
+ if (opts?.prefix) params.set('prefix', opts.prefix);
90
+ if (opts?.visibility) params.set('visibility', opts.visibility);
91
+ if (opts?.tags) params.set('tags', opts.tags.join(','));
92
+ const qs = params.toString();
93
+ const res = await authFetch('/v1/memory' + (qs ? '?' + qs : ''));
94
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to list memory');
95
+ return res.data;
96
+ },
97
+
98
+ // Search memory entries
99
+ async search(query, opts) {
100
+ const params = new URLSearchParams({ q: query });
101
+ if (opts?.visibility) params.set('visibility', opts.visibility);
102
+ const res = await authFetch('/v1/memory/search?' + params.toString());
103
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to search memory');
104
+ return res.data;
105
+ },
106
+
107
+ // Read another agent's public memory (no auth needed). ?soft=1: missing (or hidden)
108
+ // keys resolve null via a clean 200 instead of logging a console 404.
109
+ async getPublic(gaii, key) {
110
+ const url = NODE_URL + '/v1/memory/' + encodeURIComponent(gaii) + '/' + encodeURIComponent(key) + '?soft=1';
111
+ const r = await fetch(url);
112
+ const res = await r.json();
113
+ if (!res.ok) {
114
+ if (res.error?.code === 'NOT_FOUND') return null;
115
+ throw new Error(res.error?.message || 'Failed to read public memory');
116
+ }
117
+ return res.data.value;
118
+ },
119
+
120
+ // ── Micro-Memory (Tier 0.5, GET-based) ──
121
+ micro(setName, accessCode) {
122
+ const base = NODE_URL + '/v1/mm';
123
+
124
+ function mmUrl(params) {
125
+ const p = new URLSearchParams(params);
126
+ if (accessCode) p.set('access_code', accessCode);
127
+ return base + '?' + p.toString();
128
+ }
129
+
130
+ async function mmFetch(params) {
131
+ const r = await fetch(mmUrl(params));
132
+ const res = await r.json();
133
+ if (!res.ok) throw new Error(res.error?.message || 'Micro-memory operation failed');
134
+ return res.data;
135
+ }
136
+
137
+ return {
138
+ // Add or overwrite a key
139
+ async add(key, value) {
140
+ return mmFetch({ op: 'add', set: setName, key, value: typeof value === 'object' ? JSON.stringify(value) : String(value) });
141
+ },
142
+ // Modify existing key
143
+ async mod(key, value) {
144
+ return mmFetch({ op: 'mod', set: setName, key, value: typeof value === 'object' ? JSON.stringify(value) : String(value) });
145
+ },
146
+ // Delete a key
147
+ async del(key) {
148
+ return mmFetch({ op: 'del', set: setName, key });
149
+ },
150
+ // List all entries in this set
151
+ async list() {
152
+ return mmFetch({ op: 'list', set: setName });
153
+ },
154
+ // Batch add multiple key-value pairs
155
+ async batch(entries) {
156
+ const params = { op: 'batch', set: setName };
157
+ Object.keys(entries).forEach((k, i) => {
158
+ params['key' + i] = k;
159
+ const v = entries[k];
160
+ params['value' + i] = typeof v === 'object' ? JSON.stringify(v) : String(v);
161
+ });
162
+ return mmFetch(params);
163
+ },
164
+ // Configure visibility
165
+ async config(visibility) {
166
+ const params = { op: 'config', set: setName, access: visibility };
167
+ return mmFetch(params);
168
+ },
169
+ // Get a single key value
170
+ async get(key) {
171
+ const d = await mmFetch({ op: 'list', set: setName });
172
+ return d.entries?.[key] ?? null;
173
+ },
174
+ };
175
+ },
176
+
177
+ // List all micro-memory sets
178
+ async microSets() {
179
+ const url = NODE_URL + '/v1/mm?op=list';
180
+ const r = await fetch(url);
181
+ const res = await r.json();
182
+ if (!res.ok) throw new Error(res.error?.message || 'Failed to list micro-memory sets');
183
+ return res.data;
184
+ },
185
+ };
186
+
187
+ // ── Expose globally ──
188
+ attach('data', data);
@@ -0,0 +1,91 @@
1
+ // GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/agentface/ (+ _core/).
2
+ // Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-agentface.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/agentface/index.js
17
+ var MAX_BYTES = 256 * 1024;
18
+ function getSession() {
19
+ const auth = window.AIMEAT && window.AIMEAT.auth;
20
+ if (!auth) {
21
+ throw new Error("AIMEAT.auth is required. Include aimeat-auth.js before aimeat-agentface.js");
22
+ }
23
+ const s = auth.getSession();
24
+ if (!s) {
25
+ throw new Error("Not signed in. AIMEATAgentFace.publish writes the face as the signed-in user — call AIMEAT.auth.login() first. Note: the node serves only the record written by the APP OWNER; another user's publish lands in their own namespace and is never served.");
26
+ }
27
+ return s;
28
+ }
29
+ function compose(doc) {
30
+ if (!doc || typeof doc !== "object") {
31
+ throw new Error("compose expects { title, sections: [{ heading, body }] }");
32
+ }
33
+ const parts = [];
34
+ if (doc.title) parts.push("# " + String(doc.title).trim());
35
+ const sections = Array.isArray(doc.sections) ? doc.sections : [];
36
+ for (const s of sections) {
37
+ if (!s || typeof s.heading !== "string" || !s.heading.trim()) {
38
+ throw new Error("Every section needs a non-empty string heading");
39
+ }
40
+ parts.push("## " + s.heading.trim() + "\n\n" + (typeof s.body === "string" ? s.body.trim() : ""));
41
+ }
42
+ if (parts.length === 0) throw new Error("Nothing to compose — provide a title and/or sections");
43
+ return parts.join("\n\n") + "\n";
44
+ }
45
+ function inferFilename() {
46
+ const meta = typeof document !== "undefined" && document.querySelector('meta[name="aimeat-app"]');
47
+ const fromMeta = meta && meta.getAttribute("content");
48
+ if (fromMeta && fromMeta.trim()) return fromMeta.trim();
49
+ const m = typeof location !== "undefined" && location.pathname.match(/\/v1\/apps\/[^/]+\/([^/?#]+\.html?)$/i);
50
+ if (m) return decodeURIComponent(m[1]);
51
+ return null;
52
+ }
53
+ var agentface = {
54
+ /** The convention memory key the face lives under. */
55
+ key(filename) {
56
+ return "apps." + filename + ".agentface";
57
+ },
58
+ /** The markdown composer (exposed so an app can preview what publish() will write). */
59
+ compose,
60
+ /**
61
+ * Publish this app's agent face: a markdown string, or { title, sections: [{ heading, body }] }.
62
+ * opts.app names the app filename explicitly (e.g. 'my-app.html') and overrides inference —
63
+ * pass it on per-app subdomain origins, where the filename is not derivable from the URL.
64
+ * Writes the public record apps.{filename}.agentface via the authenticated memory API.
65
+ */
66
+ async publish(input, opts) {
67
+ opts = opts || {};
68
+ const markdown = typeof input === "string" ? input : compose(input);
69
+ if (!markdown.trim()) throw new Error("AIMEATAgentFace.publish: the markdown content is empty");
70
+ if (new TextEncoder().encode(markdown).length > MAX_BYTES) {
71
+ throw new Error("Agent face exceeds the 256 KB cap — the node would treat it as absent. Publish a summary and link out to records instead.");
72
+ }
73
+ const filename = typeof opts.app === "string" && opts.app.trim() ? opts.app.trim() : inferFilename();
74
+ if (!filename) {
75
+ throw new Error('Cannot derive the app filename on this origin — pass { app: "your-file.html" } or add <meta name="aimeat-app" content="your-file.html"> to the page');
76
+ }
77
+ const session = getSession();
78
+ const key = agentface.key(filename);
79
+ const res = await session.fetch("/v1/memory", {
80
+ method: "POST",
81
+ body: JSON.stringify({ key, value: markdown, visibility: "public" })
82
+ });
83
+ if (!res.ok) {
84
+ throw new Error(res.error && res.error.message || "Failed to publish the agent face");
85
+ }
86
+ return { key, app: filename, version: res.data && res.data.version, visibility: "public" };
87
+ }
88
+ };
89
+ attach("agentface", agentface);
90
+ window.AIMEATAgentFace = agentface;
91
+ })();