aimeat 2.1.0 → 2.3.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 (1300) hide show
  1. package/README.md +110 -84
  2. package/dist/.env.example +57 -16
  3. package/dist/locales/en.json +277 -369
  4. package/dist/locales/fi.json +281 -373
  5. package/dist/public/components/ContactCard.js +30 -5
  6. package/dist/public/components/ContactPicker.js +3 -2
  7. package/dist/public/components/ImageDeliverable.js +2 -1
  8. package/dist/public/components/JsonView.js +1 -0
  9. package/dist/public/components/LinkPreview.js +1 -1
  10. package/dist/public/components/NotificationBell.js +6 -4
  11. package/dist/public/components/UsageChart.js +2 -1
  12. package/dist/public/cortex-bundled/aimeat-charts.js +158 -10
  13. package/dist/public/cortex-bundled/aimeat-charts.yaml +1 -1
  14. package/dist/public/cortex-bundled/aimeat-dag.js +515 -173
  15. package/dist/public/cortex-bundled/aimeat-dag.yaml +1 -1
  16. package/dist/public/cortex-bundled/aimeat-i18n.js +6 -1
  17. package/dist/public/cortex-bundled/aimeat-i18n.yaml +1 -1
  18. package/dist/public/cortex-bundled/aimeat-surface.js +577 -0
  19. package/dist/public/cortex-bundled/aimeat-surface.yaml +107 -0
  20. package/dist/public/cortex-bundled/aimeat-viewport.js +405 -0
  21. package/dist/public/cortex-bundled/aimeat-viewport.yaml +100 -0
  22. package/dist/public/css/theme.css +1516 -1432
  23. package/dist/public/css/views/app-grant.css +95 -36
  24. package/dist/public/css/views/help.css +28 -0
  25. package/dist/public/css/views/inbox.css +1 -1
  26. package/dist/public/css/views/landing.css +20 -0
  27. package/dist/public/css/views/members.css +40 -10
  28. package/dist/public/css/views/portal-dev.css +64 -45
  29. package/dist/public/css/views/profile.css +17 -0
  30. package/dist/public/js/api.js +1 -0
  31. package/dist/public/js/app-sandbox.js +1 -0
  32. package/dist/public/js/components/auth-image.js +3 -1
  33. package/dist/public/js/i18n.js +3 -1
  34. package/dist/public/js/presence-store.js +3 -1
  35. package/dist/public/js/recents.js +2 -0
  36. package/dist/public/js/services/agent-activity.js +2 -1
  37. package/dist/public/js/services/agent-directives.js +2 -1
  38. package/dist/public/js/services/agent-integration.js +2 -1
  39. package/dist/public/js/services/agent-messages.js +2 -1
  40. package/dist/public/js/services/agent-tasks.js +2 -1
  41. package/dist/public/js/services/agents.js +3 -2
  42. package/dist/public/js/services/calibrator.js +2 -1
  43. package/dist/public/js/services/consent.js +2 -1
  44. package/dist/public/js/services/contacts.js +2 -1
  45. package/dist/public/js/services/cortex.js +5 -4
  46. package/dist/public/js/services/ecosystem.js +2 -1
  47. package/dist/public/js/services/knowledge.js +2 -1
  48. package/dist/public/js/services/ledger.js +2 -1
  49. package/dist/public/js/services/living.js +10 -9
  50. package/dist/public/js/services/memory.js +2 -1
  51. package/dist/public/js/services/messages.js +53 -8
  52. package/dist/public/js/services/nodes.js +3 -2
  53. package/dist/public/js/services/notebook-plan.js +2 -1
  54. package/dist/public/js/services/notebook.js +6 -5
  55. package/dist/public/js/services/offers.js +6 -5
  56. package/dist/public/js/services/organisms.js +26 -25
  57. package/dist/public/js/services/organisms.prompts.js +3 -2
  58. package/dist/public/js/services/organisms.shared.js +2 -1
  59. package/dist/public/js/services/organisms.workspace-gen.js +3 -2
  60. package/dist/public/js/services/packages.js +1 -0
  61. package/dist/public/js/services/schedules.js +2 -1
  62. package/dist/public/js/services/security.js +3 -2
  63. package/dist/public/js/services/skills.js +1 -0
  64. package/dist/public/js/services/tracked-responses.js +4 -3
  65. package/dist/public/js/services/unfurl.js +4 -4
  66. package/dist/public/js/services/work.js +2 -1
  67. package/dist/public/js/site.js +74 -0
  68. package/dist/public/js/swallowed.js +69 -0
  69. package/dist/public/js/theme.js +2 -1
  70. package/dist/public/js/utils.js +3 -1
  71. package/dist/public/lib/VENDORED.md +7 -3
  72. package/dist/public/lib/aimeat-daisyui-bridge.css +39 -2
  73. package/dist/public/lib/aimeat-game/board.css +262 -0
  74. package/dist/public/lib/aimeat-game/progress.css +406 -0
  75. package/dist/public/lib/aimeat-game/shell.css +388 -0
  76. package/dist/public/lib/aimeat-game.css +394 -0
  77. package/dist/public/lib/aimeat-theme.css +538 -0
  78. package/dist/public/lib/fonts/LICENSE.md +11 -4
  79. package/dist/public/lib/fonts/fraunces-var-latin-ext.woff2 +0 -0
  80. package/dist/public/lib/fonts/fraunces-var-latin.woff2 +0 -0
  81. package/dist/public/lib/fonts/inter-var-latin-ext.woff2 +0 -0
  82. package/dist/public/lib/fonts/inter-var-latin.woff2 +0 -0
  83. package/dist/public/lib/fonts/jetbrains-mono-var-latin-ext.woff2 +0 -0
  84. package/dist/public/lib/fonts/jetbrains-mono-var-latin.woff2 +0 -0
  85. package/dist/public/lib/fonts/space-grotesk-var-latin-ext.woff2 +0 -0
  86. package/dist/public/lib/fonts/space-grotesk-var-latin.woff2 +0 -0
  87. package/dist/public/lib/pdfjs@6/pdf.min.mjs +29 -0
  88. package/dist/public/lib/pdfjs@6/pdf.worker.min.mjs +29 -0
  89. package/dist/public/lib/samples/theme-check.html +92 -0
  90. package/dist/public/lib/samples/themes-boot.js +20 -0
  91. package/dist/public/lib/samples/themes.html +154 -0
  92. package/dist/public/lib/samples/themes.js +60 -0
  93. package/dist/public/privacy.fi.html +1 -1
  94. package/dist/public/privacy.html +1 -1
  95. package/dist/public/spa.html +885 -793
  96. package/dist/public/sw.js +4 -2
  97. package/dist/public/views/admin/agent-integration-tab.js +7 -6
  98. package/dist/public/views/admin/ai-usage-tab.js +2 -1
  99. package/dist/public/views/admin/cortex-tab.js +2 -1
  100. package/dist/public/views/admin/economy-tab.js +0 -1
  101. package/dist/public/views/admin/email-tab.js +4 -2
  102. package/dist/public/views/admin/federation-tab.js +3 -2
  103. package/dist/public/views/admin/feedback-tab.js +2 -1
  104. package/dist/public/views/admin/knowledge-tab.js +2 -1
  105. package/dist/public/views/admin/messages-tab.js +2 -1
  106. package/dist/public/views/admin/msm-tab.js +2 -1
  107. package/dist/public/views/admin/packages-tab.js +3 -2
  108. package/dist/public/views/admin/portal-tab.js +7 -2
  109. package/dist/public/views/admin/push-tab.js +9 -4
  110. package/dist/public/views/admin/stats-tab.js +2 -1
  111. package/dist/public/views/admin/usage-tab.js +4 -3
  112. package/dist/public/views/admin.js +6 -4
  113. package/dist/public/views/agent-solo.js +4 -3
  114. package/dist/public/views/app-grant.js +105 -32
  115. package/dist/public/views/business.js +139 -55
  116. package/dist/public/views/command-palette.js +5 -3
  117. package/dist/public/views/companies.js +3 -2
  118. package/dist/public/views/doc-solo.js +2 -1
  119. package/dist/public/views/help.js +95 -15
  120. package/dist/public/views/how-it-works.js +41 -8
  121. package/dist/public/views/invite-accept.js +3 -2
  122. package/dist/public/views/landing-activity.js +3 -2
  123. package/dist/public/views/landing-node-totals.js +2 -1
  124. package/dist/public/views/landing.js +75 -152
  125. package/dist/public/views/members.js +29 -2
  126. package/dist/public/views/my-company.js +9 -7
  127. package/dist/public/views/my-company.payments.js +2 -1
  128. package/dist/public/views/portal-classic.js +2 -1
  129. package/dist/public/views/portal-dev.js +64 -35
  130. package/dist/public/views/portal-dev.panels.js +39 -2
  131. package/dist/public/views/portal-dev.upload.js +25 -196
  132. package/dist/public/views/portal.components.js +4 -3
  133. package/dist/public/views/portfolio.js +5 -4
  134. package/dist/public/views/profile/access-tab/access-tokens.js +2 -1
  135. package/dist/public/views/profile/access-tab/agent-defaults.js +3 -1
  136. package/dist/public/views/profile/access-tab/connected-apps.js +152 -7
  137. package/dist/public/views/profile/access-tab/sharing-groups.js +4 -1
  138. package/dist/public/views/profile/access-tab.js +3 -1
  139. package/dist/public/views/profile/agents/agent-card.js +6 -5
  140. package/dist/public/views/profile/agents/tab-activity.js +10 -8
  141. package/dist/public/views/profile/agents/tab-agent-config.js +3 -1
  142. package/dist/public/views/profile/agents/tab-contracts.js +2 -1
  143. package/dist/public/views/profile/agents/tab-data-access.js +10 -7
  144. package/dist/public/views/profile/agents/tab-helpers.js +5 -0
  145. package/dist/public/views/profile/agents/tab-integration.js +12 -9
  146. package/dist/public/views/profile/agents/tab-messages.js +6 -4
  147. package/dist/public/views/profile/agents/tab-quality.js +3 -2
  148. package/dist/public/views/profile/agents/tab-usage.js +5 -3
  149. package/dist/public/views/profile/agents/task-item.js +12 -7
  150. package/dist/public/views/profile/agents-activity-subtab.js +5 -2
  151. package/dist/public/views/profile/agents-capabilities-subtab.js +4 -2
  152. package/dist/public/views/profile/agents-messages-subtab.js +5 -2
  153. package/dist/public/views/profile/agents-services-subtab.js +1 -0
  154. package/dist/public/views/profile/agents-tab.js +11 -7
  155. package/dist/public/views/profile/appdev-tab.js +3 -2
  156. package/dist/public/views/profile/apps-tab.js +10 -8
  157. package/dist/public/views/profile/boards-tab.js +5 -4
  158. package/dist/public/views/profile/calibrator-batch.helpers.js +3 -2
  159. package/dist/public/views/profile/calibrator-batch.js +3 -1
  160. package/dist/public/views/profile/calibrator-llm-editor.js +3 -2
  161. package/dist/public/views/profile/calibrator-tab.js +5 -4
  162. package/dist/public/views/profile/capabilities-tab.js +2 -1
  163. package/dist/public/views/profile/chat-sessions-tab.js +6 -3
  164. package/dist/public/views/profile/contacts-tab.js +2 -1
  165. package/dist/public/views/profile/data-wallet-tab.js +5 -4
  166. package/dist/public/views/profile/discover-tab.js +4 -1
  167. package/dist/public/views/profile/ecosystem-tab.automation.js +13 -9
  168. package/dist/public/views/profile/ecosystem-tab.cards.js +3 -2
  169. package/dist/public/views/profile/ecosystem-tab.js +10 -7
  170. package/dist/public/views/profile/email-tab.js +2 -1
  171. package/dist/public/views/profile/extensions-tab.js +7 -6
  172. package/dist/public/views/profile/extensions-tab.maturity.js +6 -2
  173. package/dist/public/views/profile/extensions-tab.prompts.js +24 -0
  174. package/dist/public/views/profile/federation-tab.js +2 -1
  175. package/dist/public/views/profile/inbox-tab/components.js +30 -11
  176. package/dist/public/views/profile/inbox-tab/helpers.js +15 -1
  177. package/dist/public/views/profile/inbox-tab/use-thread-ux.js +30 -3
  178. package/dist/public/views/profile/inbox-tab.js +33 -30
  179. package/dist/public/views/profile/inline-panels.js +5 -4
  180. package/dist/public/views/profile/knowledge-tab.js +15 -13
  181. package/dist/public/views/profile/landing-page.cards.js +14 -9
  182. package/dist/public/views/profile/landing-page.helpers.js +5 -2
  183. package/dist/public/views/profile/landing-page.js +11 -7
  184. package/dist/public/views/profile/landing-page.modals.js +8 -5
  185. package/dist/public/views/profile/libraries-tab.js +10 -2
  186. package/dist/public/views/profile/living-tab.js +3 -2
  187. package/dist/public/views/profile/mcp-tab.js +4 -2
  188. package/dist/public/views/profile/memory-tab/browse-view.js +3 -2
  189. package/dist/public/views/profile/memory-tab/components.js +4 -3
  190. package/dist/public/views/profile/memory-tab/entries-view.js +3 -2
  191. package/dist/public/views/profile/memory-tab.js +18 -16
  192. package/dist/public/views/profile/nodes-tab.js +2 -1
  193. package/dist/public/views/profile/notebook-card.js +4 -3
  194. package/dist/public/views/profile/notebook-tab.js +7 -5
  195. package/dist/public/views/profile/notifications-tab.js +9 -5
  196. package/dist/public/views/profile/offers-tab.js +5 -4
  197. package/dist/public/views/profile/openrouter-settings.js +5 -4
  198. package/dist/public/views/profile/organisms/activity-panel.js +2 -1
  199. package/dist/public/views/profile/organisms/agents.js +2 -1
  200. package/dist/public/views/profile/organisms/document.js +13 -12
  201. package/dist/public/views/profile/organisms/helpers.js +2 -1
  202. package/dist/public/views/profile/organisms/home.js +7 -6
  203. package/dist/public/views/profile/organisms/invite-panel.js +1 -1
  204. package/dist/public/views/profile/organisms/members.js +7 -6
  205. package/dist/public/views/profile/organisms/mindmap.js +1 -1
  206. package/dist/public/views/profile/organisms/panels.js +4 -3
  207. package/dist/public/views/profile/organisms/participants-panel.js +11 -10
  208. package/dist/public/views/profile/organisms/readme-panel.js +1 -0
  209. package/dist/public/views/profile/organisms/sources-panel.js +2 -1
  210. package/dist/public/views/profile/organisms/workspace/doc-space.js +2 -1
  211. package/dist/public/views/profile/organisms/workspace/model.js +1 -0
  212. package/dist/public/views/profile/organisms/workspace-apps.js +4 -2
  213. package/dist/public/views/profile/organisms/workspace-comments.js +3 -2
  214. package/dist/public/views/profile/organisms/workspace-list.js +5 -4
  215. package/dist/public/views/profile/organisms/workspace.js +19 -16
  216. package/dist/public/views/profile/organisms-tab.js +20 -12
  217. package/dist/public/views/profile/packages-tab.js +6 -4
  218. package/dist/public/views/profile/portfolio-tab.js +1 -1
  219. package/dist/public/views/profile/scheduler-calendar.js +2 -1
  220. package/dist/public/views/profile/scheduler-tab.js +2 -1
  221. package/dist/public/views/profile/security-tab.js +2 -1
  222. package/dist/public/views/profile/services-tab.js +4 -3
  223. package/dist/public/views/profile/wallet-tab.js +106 -36
  224. package/dist/public/views/profile/work-tab.js +3 -2
  225. package/dist/public/views/profile/workflows-form.js +2 -1
  226. package/dist/public/views/profile/workflows-tab.js +3 -2
  227. package/dist/public/views/public-workspace-viewer.js +7 -4
  228. package/dist/scripts/build-sdk-libs.d.ts.map +1 -1
  229. package/dist/scripts/build-sdk-libs.js +4 -0
  230. package/dist/scripts/build-sdk-libs.js.map +1 -1
  231. package/dist/scripts/check-openapi.d.ts +2 -0
  232. package/dist/scripts/check-openapi.d.ts.map +1 -0
  233. package/dist/scripts/check-openapi.js +139 -0
  234. package/dist/scripts/check-openapi.js.map +1 -0
  235. package/dist/scripts/check-silent-catch.d.ts +2 -0
  236. package/dist/scripts/check-silent-catch.d.ts.map +1 -0
  237. package/dist/scripts/check-silent-catch.js +159 -0
  238. package/dist/scripts/check-silent-catch.js.map +1 -0
  239. package/dist/scripts/embed-viewport.d.ts +23 -0
  240. package/dist/scripts/embed-viewport.d.ts.map +1 -0
  241. package/dist/scripts/embed-viewport.js +116 -0
  242. package/dist/scripts/embed-viewport.js.map +1 -0
  243. package/dist/src/auth/jwt.d.ts +2 -0
  244. package/dist/src/auth/jwt.d.ts.map +1 -1
  245. package/dist/src/auth/jwt.js +15 -3
  246. package/dist/src/auth/jwt.js.map +1 -1
  247. package/dist/src/auth/keypair.d.ts.map +1 -1
  248. package/dist/src/auth/keypair.js +3 -0
  249. package/dist/src/auth/keypair.js.map +1 -1
  250. package/dist/src/auth/middleware.d.ts +2 -0
  251. package/dist/src/auth/middleware.d.ts.map +1 -1
  252. package/dist/src/auth/middleware.js +33 -14
  253. package/dist/src/auth/middleware.js.map +1 -1
  254. package/dist/src/auth/node-keys.d.ts.map +1 -1
  255. package/dist/src/auth/node-keys.js +59 -16
  256. package/dist/src/auth/node-keys.js.map +1 -1
  257. package/dist/src/auth/sse-domain-scopes.d.ts +50 -0
  258. package/dist/src/auth/sse-domain-scopes.d.ts.map +1 -0
  259. package/dist/src/auth/sse-domain-scopes.js +111 -0
  260. package/dist/src/auth/sse-domain-scopes.js.map +1 -0
  261. package/dist/src/cli/config-import.d.ts.map +1 -1
  262. package/dist/src/cli/config-import.js +3 -1
  263. package/dist/src/cli/config-import.js.map +1 -1
  264. package/dist/src/cli/connect/auth.d.ts.map +1 -1
  265. package/dist/src/cli/connect/auth.js +1 -0
  266. package/dist/src/cli/connect/auth.js.map +1 -1
  267. package/dist/src/cli/connect/config.d.ts.map +1 -1
  268. package/dist/src/cli/connect/config.js +3 -1
  269. package/dist/src/cli/connect/config.js.map +1 -1
  270. package/dist/src/cli/connect/keychain.d.ts.map +1 -1
  271. package/dist/src/cli/connect/keychain.js +6 -2
  272. package/dist/src/cli/connect/keychain.js.map +1 -1
  273. package/dist/src/cli/connect/mcp/local-server.d.ts.map +1 -1
  274. package/dist/src/cli/connect/mcp/local-server.js +9 -2
  275. package/dist/src/cli/connect/mcp/local-server.js.map +1 -1
  276. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
  277. package/dist/src/cli/connect/mcp/tools/agent-tasks.js +4 -1
  278. package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
  279. package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
  280. package/dist/src/cli/connect/mcp/tools/core.js +14 -3
  281. package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
  282. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts +3 -0
  283. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts.map +1 -1
  284. package/dist/src/cli/connect/mcp/tools/workspaces.js +6 -2
  285. package/dist/src/cli/connect/mcp/tools/workspaces.js.map +1 -1
  286. package/dist/src/cli/connect/task-runner.d.ts.map +1 -1
  287. package/dist/src/cli/connect/task-runner.js +11 -4
  288. package/dist/src/cli/connect/task-runner.js.map +1 -1
  289. package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
  290. package/dist/src/cli/connect/tool-call-defs-core.js +13 -1
  291. package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
  292. package/dist/src/cli/connect/tool-call-helpers.d.ts.map +1 -1
  293. package/dist/src/cli/connect/tool-call-helpers.js +1 -0
  294. package/dist/src/cli/connect/tool-call-helpers.js.map +1 -1
  295. package/dist/src/cli/connect/tunnel-client.d.ts.map +1 -1
  296. package/dist/src/cli/connect/tunnel-client.js +26 -8
  297. package/dist/src/cli/connect/tunnel-client.js.map +1 -1
  298. package/dist/src/cli/federation-join.d.ts.map +1 -1
  299. package/dist/src/cli/federation-join.js +7 -3
  300. package/dist/src/cli/federation-join.js.map +1 -1
  301. package/dist/src/cli/init-wizard/presets.d.ts.map +1 -1
  302. package/dist/src/cli/init-wizard/presets.js +21 -0
  303. package/dist/src/cli/init-wizard/presets.js.map +1 -1
  304. package/dist/src/cli/init-wizard/steps-advanced.d.ts.map +1 -1
  305. package/dist/src/cli/init-wizard/steps-advanced.js +2 -0
  306. package/dist/src/cli/init-wizard/steps-advanced.js.map +1 -1
  307. package/dist/src/cli/init-wizard/steps-operator.d.ts.map +1 -1
  308. package/dist/src/cli/init-wizard/steps-operator.js +10 -0
  309. package/dist/src/cli/init-wizard/steps-operator.js.map +1 -1
  310. package/dist/src/commerce/__tests__/x402-registry.test.d.ts +2 -0
  311. package/dist/src/commerce/__tests__/x402-registry.test.d.ts.map +1 -0
  312. package/dist/src/commerce/__tests__/x402-registry.test.js +105 -0
  313. package/dist/src/commerce/__tests__/x402-registry.test.js.map +1 -0
  314. package/dist/src/commerce/evm-address.d.ts +21 -0
  315. package/dist/src/commerce/evm-address.d.ts.map +1 -0
  316. package/dist/src/commerce/evm-address.js +94 -0
  317. package/dist/src/commerce/evm-address.js.map +1 -0
  318. package/dist/src/commerce/invoice-handler.d.ts +5 -0
  319. package/dist/src/commerce/invoice-handler.d.ts.map +1 -0
  320. package/dist/src/commerce/invoice-handler.js +41 -0
  321. package/dist/src/commerce/invoice-handler.js.map +1 -0
  322. package/dist/src/commerce/money.d.ts +18 -5
  323. package/dist/src/commerce/money.d.ts.map +1 -1
  324. package/dist/src/commerce/money.js +27 -6
  325. package/dist/src/commerce/money.js.map +1 -1
  326. package/dist/src/commerce/payable-book.d.ts +31 -0
  327. package/dist/src/commerce/payable-book.d.ts.map +1 -0
  328. package/dist/src/commerce/payable-book.js +27 -0
  329. package/dist/src/commerce/payable-book.js.map +1 -0
  330. package/dist/src/commerce/payment-handlers.d.ts.map +1 -1
  331. package/dist/src/commerce/payment-handlers.js +8 -4
  332. package/dist/src/commerce/payment-handlers.js.map +1 -1
  333. package/dist/src/commerce/sellable-resolvers.d.ts +6 -6
  334. package/dist/src/commerce/sellable-resolvers.d.ts.map +1 -1
  335. package/dist/src/commerce/sellable-resolvers.js +17 -4
  336. package/dist/src/commerce/sellable-resolvers.js.map +1 -1
  337. package/dist/src/commerce/session-service.js +2 -2
  338. package/dist/src/commerce/session-service.js.map +1 -1
  339. package/dist/src/commerce/stripe-handler.d.ts +33 -0
  340. package/dist/src/commerce/stripe-handler.d.ts.map +1 -0
  341. package/dist/src/commerce/stripe-handler.js +108 -0
  342. package/dist/src/commerce/stripe-handler.js.map +1 -0
  343. package/dist/src/commerce/types.d.ts +10 -12
  344. package/dist/src/commerce/types.d.ts.map +1 -1
  345. package/dist/src/commerce/x402-facilitator.d.ts +64 -13
  346. package/dist/src/commerce/x402-facilitator.d.ts.map +1 -1
  347. package/dist/src/commerce/x402-facilitator.js +72 -19
  348. package/dist/src/commerce/x402-facilitator.js.map +1 -1
  349. package/dist/src/commerce/x402-handler.d.ts +13 -7
  350. package/dist/src/commerce/x402-handler.d.ts.map +1 -1
  351. package/dist/src/commerce/x402-handler.js +23 -10
  352. package/dist/src/commerce/x402-handler.js.map +1 -1
  353. package/dist/src/commerce/x402.d.ts +11 -6
  354. package/dist/src/commerce/x402.d.ts.map +1 -1
  355. package/dist/src/commerce/x402.js +10 -7
  356. package/dist/src/commerce/x402.js.map +1 -1
  357. package/dist/src/config-types.d.ts +78 -0
  358. package/dist/src/config-types.d.ts.map +1 -1
  359. package/dist/src/config.d.ts.map +1 -1
  360. package/dist/src/config.js +70 -1
  361. package/dist/src/config.js.map +1 -1
  362. package/dist/src/data/app-templates/shells.d.ts +11 -3
  363. package/dist/src/data/app-templates/shells.d.ts.map +1 -1
  364. package/dist/src/data/app-templates/shells.js +87 -6
  365. package/dist/src/data/app-templates/shells.js.map +1 -1
  366. package/dist/src/data/app-templates.js +2 -2
  367. package/dist/src/data/app-templates.js.map +1 -1
  368. package/dist/src/data/library-packs/cortex.d.ts.map +1 -1
  369. package/dist/src/data/library-packs/cortex.js +108 -5
  370. package/dist/src/data/library-packs/cortex.js.map +1 -1
  371. package/dist/src/data/library-packs/sdk.d.ts +4 -0
  372. package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
  373. package/dist/src/data/library-packs/sdk.js +78 -8
  374. package/dist/src/data/library-packs/sdk.js.map +1 -1
  375. package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
  376. package/dist/src/data/library-packs/vendored.js +171 -6
  377. package/dist/src/data/library-packs/vendored.js.map +1 -1
  378. package/dist/src/generated/api-types.d.ts +949 -44
  379. package/dist/src/generated/api-types.d.ts.map +1 -1
  380. package/dist/src/index-connect.d.ts.map +1 -1
  381. package/dist/src/index-connect.js +4 -1
  382. package/dist/src/index-connect.js.map +1 -1
  383. package/dist/src/index-start.d.ts.map +1 -1
  384. package/dist/src/index-start.js +10 -6
  385. package/dist/src/index-start.js.map +1 -1
  386. package/dist/src/mcp/agent-tasks.d.ts +4 -0
  387. package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
  388. package/dist/src/mcp/agent-tasks.js +20 -2
  389. package/dist/src/mcp/agent-tasks.js.map +1 -1
  390. package/dist/src/mcp/app-template-proposals.d.ts.map +1 -1
  391. package/dist/src/mcp/app-template-proposals.js +2 -1
  392. package/dist/src/mcp/app-template-proposals.js.map +1 -1
  393. package/dist/src/mcp/apps.d.ts.map +1 -1
  394. package/dist/src/mcp/apps.js +4 -3
  395. package/dist/src/mcp/apps.js.map +1 -1
  396. package/dist/src/mcp/capabilities.d.ts +7 -1
  397. package/dist/src/mcp/capabilities.d.ts.map +1 -1
  398. package/dist/src/mcp/capabilities.js +8 -4
  399. package/dist/src/mcp/capabilities.js.map +1 -1
  400. package/dist/src/mcp/catalog/definitions/commerce.d.ts.map +1 -1
  401. package/dist/src/mcp/catalog/definitions/commerce.js +4 -2
  402. package/dist/src/mcp/catalog/definitions/commerce.js.map +1 -1
  403. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
  404. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +4 -3
  405. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
  406. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +1 -1
  407. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
  408. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
  409. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +3 -2
  410. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
  411. package/dist/src/mcp/catalog/output-schemas.d.ts +6 -1
  412. package/dist/src/mcp/catalog/output-schemas.d.ts.map +1 -1
  413. package/dist/src/mcp/catalog/output-schemas.js +6 -1
  414. package/dist/src/mcp/catalog/output-schemas.js.map +1 -1
  415. package/dist/src/mcp/catalog/scopes.d.ts +0 -1
  416. package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
  417. package/dist/src/mcp/catalog/scopes.js +2 -11
  418. package/dist/src/mcp/catalog/scopes.js.map +1 -1
  419. package/dist/src/mcp/catalog/surfaces.d.ts +1 -7
  420. package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
  421. package/dist/src/mcp/catalog/surfaces.js +10 -16
  422. package/dist/src/mcp/catalog/surfaces.js.map +1 -1
  423. package/dist/src/mcp/commerce.d.ts.map +1 -1
  424. package/dist/src/mcp/commerce.js +50 -6
  425. package/dist/src/mcp/commerce.js.map +1 -1
  426. package/dist/src/mcp/core-storage.d.ts +23 -0
  427. package/dist/src/mcp/core-storage.d.ts.map +1 -0
  428. package/dist/src/mcp/core-storage.js +157 -0
  429. package/dist/src/mcp/core-storage.js.map +1 -0
  430. package/dist/src/mcp/core.d.ts +16 -0
  431. package/dist/src/mcp/core.d.ts.map +1 -1
  432. package/dist/src/mcp/core.js +78 -121
  433. package/dist/src/mcp/core.js.map +1 -1
  434. package/dist/src/mcp/dm-messages.d.ts +4 -0
  435. package/dist/src/mcp/dm-messages.d.ts.map +1 -1
  436. package/dist/src/mcp/dm-messages.js +43 -2
  437. package/dist/src/mcp/dm-messages.js.map +1 -1
  438. package/dist/src/mcp/exchange-run.d.ts +28 -0
  439. package/dist/src/mcp/exchange-run.d.ts.map +1 -1
  440. package/dist/src/mcp/exchange-run.js +58 -37
  441. package/dist/src/mcp/exchange-run.js.map +1 -1
  442. package/dist/src/mcp/exchange.d.ts.map +1 -1
  443. package/dist/src/mcp/exchange.js +12 -9
  444. package/dist/src/mcp/exchange.js.map +1 -1
  445. package/dist/src/mcp/extensions.d.ts.map +1 -1
  446. package/dist/src/mcp/extensions.js +66 -108
  447. package/dist/src/mcp/extensions.js.map +1 -1
  448. package/dist/src/mcp/index.d.ts +5 -0
  449. package/dist/src/mcp/index.d.ts.map +1 -1
  450. package/dist/src/mcp/index.js +24 -9
  451. package/dist/src/mcp/index.js.map +1 -1
  452. package/dist/src/mcp/knowledge.d.ts.map +1 -1
  453. package/dist/src/mcp/knowledge.js +1 -0
  454. package/dist/src/mcp/knowledge.js.map +1 -1
  455. package/dist/src/mcp/memory-namespace-hints.d.ts +33 -0
  456. package/dist/src/mcp/memory-namespace-hints.d.ts.map +1 -0
  457. package/dist/src/mcp/memory-namespace-hints.js +60 -0
  458. package/dist/src/mcp/memory-namespace-hints.js.map +1 -0
  459. package/dist/src/mcp/oauth.d.ts +3 -0
  460. package/dist/src/mcp/oauth.d.ts.map +1 -1
  461. package/dist/src/mcp/oauth.js +13 -8
  462. package/dist/src/mcp/oauth.js.map +1 -1
  463. package/dist/src/mcp/workspaces.d.ts +5 -0
  464. package/dist/src/mcp/workspaces.d.ts.map +1 -1
  465. package/dist/src/mcp/workspaces.js +12 -7
  466. package/dist/src/mcp/workspaces.js.map +1 -1
  467. package/dist/src/middleware/cors.d.ts.map +1 -1
  468. package/dist/src/middleware/cors.js +3 -1
  469. package/dist/src/middleware/cors.js.map +1 -1
  470. package/dist/src/middleware/subdomain.d.ts +4 -0
  471. package/dist/src/middleware/subdomain.d.ts.map +1 -1
  472. package/dist/src/middleware/subdomain.js +23 -2
  473. package/dist/src/middleware/subdomain.js.map +1 -1
  474. package/dist/src/models/agent-task-schemas.d.ts +25 -3
  475. package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
  476. package/dist/src/models/agent-task-schemas.js +16 -0
  477. package/dist/src/models/agent-task-schemas.js.map +1 -1
  478. package/dist/src/models/app-tool-schemas.d.ts +553 -1
  479. package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
  480. package/dist/src/models/app-tool-schemas.js +97 -1
  481. package/dist/src/models/app-tool-schemas.js.map +1 -1
  482. package/dist/src/models/odps-schemas.d.ts +305 -0
  483. package/dist/src/models/odps-schemas.d.ts.map +1 -0
  484. package/dist/src/models/odps-schemas.js +182 -0
  485. package/dist/src/models/odps-schemas.js.map +1 -0
  486. package/dist/src/models/offer-schemas.d.ts +357 -2
  487. package/dist/src/models/offer-schemas.d.ts.map +1 -1
  488. package/dist/src/models/offer-schemas.js +37 -0
  489. package/dist/src/models/offer-schemas.js.map +1 -1
  490. package/dist/src/models/schemas.d.ts +6 -3
  491. package/dist/src/models/schemas.d.ts.map +1 -1
  492. package/dist/src/models/schemas.js +10 -1
  493. package/dist/src/models/schemas.js.map +1 -1
  494. package/dist/src/models/webhook-schemas.d.ts +8 -8
  495. package/dist/src/routes/admin-config.d.ts.map +1 -1
  496. package/dist/src/routes/admin-config.js +4 -1
  497. package/dist/src/routes/admin-config.js.map +1 -1
  498. package/dist/src/routes/admin-extensions.d.ts.map +1 -1
  499. package/dist/src/routes/admin-extensions.js +2 -1
  500. package/dist/src/routes/admin-extensions.js.map +1 -1
  501. package/dist/src/routes/admin-monitoring.js +14 -5
  502. package/dist/src/routes/admin-monitoring.js.map +1 -1
  503. package/dist/src/routes/admin-security.d.ts.map +1 -1
  504. package/dist/src/routes/admin-security.js +4 -1
  505. package/dist/src/routes/admin-security.js.map +1 -1
  506. package/dist/src/routes/admin.d.ts.map +1 -1
  507. package/dist/src/routes/admin.js +6 -4
  508. package/dist/src/routes/admin.js.map +1 -1
  509. package/dist/src/routes/agent-activity.d.ts.map +1 -1
  510. package/dist/src/routes/agent-activity.js +4 -1
  511. package/dist/src/routes/agent-activity.js.map +1 -1
  512. package/dist/src/routes/agent-directives.d.ts +3 -10
  513. package/dist/src/routes/agent-directives.d.ts.map +1 -1
  514. package/dist/src/routes/agent-directives.js +7 -12
  515. package/dist/src/routes/agent-directives.js.map +1 -1
  516. package/dist/src/routes/agent-integration.d.ts.map +1 -1
  517. package/dist/src/routes/agent-integration.js +3 -1
  518. package/dist/src/routes/agent-integration.js.map +1 -1
  519. package/dist/src/routes/agent-messages.d.ts.map +1 -1
  520. package/dist/src/routes/agent-messages.js +5 -2
  521. package/dist/src/routes/agent-messages.js.map +1 -1
  522. package/dist/src/routes/agent-onboarding.d.ts.map +1 -1
  523. package/dist/src/routes/agent-onboarding.js +19 -6
  524. package/dist/src/routes/agent-onboarding.js.map +1 -1
  525. package/dist/src/routes/agent-skills-discovery.d.ts.map +1 -1
  526. package/dist/src/routes/agent-skills-discovery.js +2 -1
  527. package/dist/src/routes/agent-skills-discovery.js.map +1 -1
  528. package/dist/src/routes/agent-tasks/completion.js +1 -1
  529. package/dist/src/routes/agent-tasks/completion.js.map +1 -1
  530. package/dist/src/routes/agent-tasks/create-read.d.ts +4 -0
  531. package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
  532. package/dist/src/routes/agent-tasks/create-read.js +23 -2
  533. package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
  534. package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
  535. package/dist/src/routes/agent-tasks/lifecycle.js +38 -9
  536. package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
  537. package/dist/src/routes/agents/management.d.ts.map +1 -1
  538. package/dist/src/routes/agents/management.js +4 -1
  539. package/dist/src/routes/agents/management.js.map +1 -1
  540. package/dist/src/routes/agents/offers.d.ts +2 -0
  541. package/dist/src/routes/agents/offers.d.ts.map +1 -1
  542. package/dist/src/routes/agents/offers.js +0 -0
  543. package/dist/src/routes/agents/offers.js.map +1 -1
  544. package/dist/src/routes/agents/profile-metadata.d.ts.map +1 -1
  545. package/dist/src/routes/agents/profile-metadata.js +2 -1
  546. package/dist/src/routes/agents/profile-metadata.js.map +1 -1
  547. package/dist/src/routes/app-grants.d.ts +13 -0
  548. package/dist/src/routes/app-grants.d.ts.map +1 -1
  549. package/dist/src/routes/app-grants.js +124 -29
  550. package/dist/src/routes/app-grants.js.map +1 -1
  551. package/dist/src/routes/appdev-overview.d.ts.map +1 -1
  552. package/dist/src/routes/appdev-overview.js +2 -1
  553. package/dist/src/routes/appdev-overview.js.map +1 -1
  554. package/dist/src/routes/apps/catalogue-admin.d.ts.map +1 -1
  555. package/dist/src/routes/apps/catalogue-admin.js +2 -1
  556. package/dist/src/routes/apps/catalogue-admin.js.map +1 -1
  557. package/dist/src/routes/apps/drafts.d.ts +3 -0
  558. package/dist/src/routes/apps/drafts.d.ts.map +1 -1
  559. package/dist/src/routes/apps/drafts.js +65 -2
  560. package/dist/src/routes/apps/drafts.js.map +1 -1
  561. package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
  562. package/dist/src/routes/apps/fork-manage.js +6 -3
  563. package/dist/src/routes/apps/fork-manage.js.map +1 -1
  564. package/dist/src/routes/apps/helpers.d.ts.map +1 -1
  565. package/dist/src/routes/apps/helpers.js +5 -1
  566. package/dist/src/routes/apps/helpers.js.map +1 -1
  567. package/dist/src/routes/apps/publish.d.ts +2 -0
  568. package/dist/src/routes/apps/publish.d.ts.map +1 -1
  569. package/dist/src/routes/apps/publish.js +25 -5
  570. package/dist/src/routes/apps/publish.js.map +1 -1
  571. package/dist/src/routes/apps/read.d.ts.map +1 -1
  572. package/dist/src/routes/apps/read.js +2 -1
  573. package/dist/src/routes/apps/read.js.map +1 -1
  574. package/dist/src/routes/auth.d.ts.map +1 -1
  575. package/dist/src/routes/auth.js +2 -1
  576. package/dist/src/routes/auth.js.map +1 -1
  577. package/dist/src/routes/boards.js +1 -1
  578. package/dist/src/routes/boards.js.map +1 -1
  579. package/dist/src/routes/bootstrap.d.ts.map +1 -1
  580. package/dist/src/routes/bootstrap.js +8 -3
  581. package/dist/src/routes/bootstrap.js.map +1 -1
  582. package/dist/src/routes/capabilities.d.ts.map +1 -1
  583. package/dist/src/routes/capabilities.js +4 -3
  584. package/dist/src/routes/capabilities.js.map +1 -1
  585. package/dist/src/routes/commerce-acp.js +1 -1
  586. package/dist/src/routes/commerce-acp.js.map +1 -1
  587. package/dist/src/routes/commerce-ucp.d.ts +2 -3
  588. package/dist/src/routes/commerce-ucp.d.ts.map +1 -1
  589. package/dist/src/routes/commerce-ucp.js +6 -12
  590. package/dist/src/routes/commerce-ucp.js.map +1 -1
  591. package/dist/src/routes/commerce.d.ts +7 -1
  592. package/dist/src/routes/commerce.d.ts.map +1 -1
  593. package/dist/src/routes/commerce.js +175 -5
  594. package/dist/src/routes/commerce.js.map +1 -1
  595. package/dist/src/routes/csm.d.ts.map +1 -1
  596. package/dist/src/routes/csm.js +3 -1
  597. package/dist/src/routes/csm.js.map +1 -1
  598. package/dist/src/routes/ecosystem-apps.d.ts.map +1 -1
  599. package/dist/src/routes/ecosystem-apps.js +7 -6
  600. package/dist/src/routes/ecosystem-apps.js.map +1 -1
  601. package/dist/src/routes/exchange-market.d.ts +6 -2
  602. package/dist/src/routes/exchange-market.d.ts.map +1 -1
  603. package/dist/src/routes/exchange-market.js +163 -33
  604. package/dist/src/routes/exchange-market.js.map +1 -1
  605. package/dist/src/routes/exchange.d.ts +10 -1
  606. package/dist/src/routes/exchange.d.ts.map +1 -1
  607. package/dist/src/routes/exchange.js +349 -11
  608. package/dist/src/routes/exchange.js.map +1 -1
  609. package/dist/src/routes/extensions/actions.d.ts +2 -0
  610. package/dist/src/routes/extensions/actions.d.ts.map +1 -1
  611. package/dist/src/routes/extensions/actions.js +65 -8
  612. package/dist/src/routes/extensions/actions.js.map +1 -1
  613. package/dist/src/routes/extensions/crud.d.ts.map +1 -1
  614. package/dist/src/routes/extensions/crud.js +36 -3
  615. package/dist/src/routes/extensions/crud.js.map +1 -1
  616. package/dist/src/routes/extensions/entitlement-gate.d.ts +44 -7
  617. package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -1
  618. package/dist/src/routes/extensions/entitlement-gate.js +22 -130
  619. package/dist/src/routes/extensions/entitlement-gate.js.map +1 -1
  620. package/dist/src/routes/extensions/internal-pass.d.ts +23 -0
  621. package/dist/src/routes/extensions/internal-pass.d.ts.map +1 -0
  622. package/dist/src/routes/extensions/internal-pass.js +70 -0
  623. package/dist/src/routes/extensions/internal-pass.js.map +1 -0
  624. package/dist/src/routes/extensions/manifest.d.ts +10 -0
  625. package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
  626. package/dist/src/routes/extensions/manifest.js +136 -5
  627. package/dist/src/routes/extensions/manifest.js.map +1 -1
  628. package/dist/src/routes/extensions/metered-response.d.ts +37 -0
  629. package/dist/src/routes/extensions/metered-response.d.ts.map +1 -0
  630. package/dist/src/routes/extensions/metered-response.js +60 -0
  631. package/dist/src/routes/extensions/metered-response.js.map +1 -0
  632. package/dist/src/routes/extensions/pacing.d.ts +62 -0
  633. package/dist/src/routes/extensions/pacing.d.ts.map +1 -0
  634. package/dist/src/routes/extensions/pacing.js +45 -0
  635. package/dist/src/routes/extensions/pacing.js.map +1 -0
  636. package/dist/src/routes/extensions/paywall.d.ts +16 -0
  637. package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
  638. package/dist/src/routes/extensions/paywall.js +170 -21
  639. package/dist/src/routes/extensions/paywall.js.map +1 -1
  640. package/dist/src/routes/extensions/priced-binding.d.ts +50 -0
  641. package/dist/src/routes/extensions/priced-binding.d.ts.map +1 -0
  642. package/dist/src/routes/extensions/priced-binding.js +46 -0
  643. package/dist/src/routes/extensions/priced-binding.js.map +1 -0
  644. package/dist/src/routes/federation-genesis.d.ts.map +1 -1
  645. package/dist/src/routes/federation-genesis.js +14 -5
  646. package/dist/src/routes/federation-genesis.js.map +1 -1
  647. package/dist/src/routes/federation-peer/introduce.d.ts.map +1 -1
  648. package/dist/src/routes/federation-peer/introduce.js +3 -1
  649. package/dist/src/routes/federation-peer/introduce.js.map +1 -1
  650. package/dist/src/routes/federation-peer/lifecycle.d.ts.map +1 -1
  651. package/dist/src/routes/federation-peer/lifecycle.js +3 -2
  652. package/dist/src/routes/federation-peer/lifecycle.js.map +1 -1
  653. package/dist/src/routes/federation-peer/peers.d.ts.map +1 -1
  654. package/dist/src/routes/federation-peer/peers.js +5 -3
  655. package/dist/src/routes/federation-peer/peers.js.map +1 -1
  656. package/dist/src/routes/federation-peer/policy-book.d.ts.map +1 -1
  657. package/dist/src/routes/federation-peer/policy-book.js +2 -1
  658. package/dist/src/routes/federation-peer/policy-book.js.map +1 -1
  659. package/dist/src/routes/federation-peer/promotion.d.ts.map +1 -1
  660. package/dist/src/routes/federation-peer/promotion.js +4 -1
  661. package/dist/src/routes/federation-peer/promotion.js.map +1 -1
  662. package/dist/src/routes/federation-settlements.js +2 -2
  663. package/dist/src/routes/federation-settlements.js.map +1 -1
  664. package/dist/src/routes/federation-sync/catalogue-trust.js +5 -3
  665. package/dist/src/routes/federation-sync/catalogue-trust.js.map +1 -1
  666. package/dist/src/routes/federation-sync/messaging.js +5 -3
  667. package/dist/src/routes/federation-sync/messaging.js.map +1 -1
  668. package/dist/src/routes/federation-sync/routing.d.ts.map +1 -1
  669. package/dist/src/routes/federation-sync/routing.js +7 -5
  670. package/dist/src/routes/federation-sync/routing.js.map +1 -1
  671. package/dist/src/routes/flags.d.ts.map +1 -1
  672. package/dist/src/routes/flags.js +3 -1
  673. package/dist/src/routes/flags.js.map +1 -1
  674. package/dist/src/routes/ghii/register-login.js +1 -1
  675. package/dist/src/routes/ghii/register-login.js.map +1 -1
  676. package/dist/src/routes/instances/install.d.ts.map +1 -1
  677. package/dist/src/routes/instances/install.js +2 -1
  678. package/dist/src/routes/instances/install.js.map +1 -1
  679. package/dist/src/routes/instances/manage.d.ts.map +1 -1
  680. package/dist/src/routes/instances/manage.js +2 -1
  681. package/dist/src/routes/instances/manage.js.map +1 -1
  682. package/dist/src/routes/knowledge/packages-core.d.ts.map +1 -1
  683. package/dist/src/routes/knowledge/packages-core.js +2 -1
  684. package/dist/src/routes/knowledge/packages-core.js.map +1 -1
  685. package/dist/src/routes/knowledge/sharing.d.ts.map +1 -1
  686. package/dist/src/routes/knowledge/sharing.js +2 -1
  687. package/dist/src/routes/knowledge/sharing.js.map +1 -1
  688. package/dist/src/routes/library-packs.d.ts.map +1 -1
  689. package/dist/src/routes/library-packs.js +10 -3
  690. package/dist/src/routes/library-packs.js.map +1 -1
  691. package/dist/src/routes/libs.d.ts +9 -0
  692. package/dist/src/routes/libs.d.ts.map +1 -1
  693. package/dist/src/routes/libs.js +11 -2
  694. package/dist/src/routes/libs.js.map +1 -1
  695. package/dist/src/routes/matches.d.ts.map +1 -1
  696. package/dist/src/routes/matches.js +7 -3
  697. package/dist/src/routes/matches.js.map +1 -1
  698. package/dist/src/routes/memory/bulk.d.ts.map +1 -1
  699. package/dist/src/routes/memory/bulk.js +3 -1
  700. package/dist/src/routes/memory/bulk.js.map +1 -1
  701. package/dist/src/routes/memory/crud.d.ts.map +1 -1
  702. package/dist/src/routes/memory/crud.js +14 -2
  703. package/dist/src/routes/memory/crud.js.map +1 -1
  704. package/dist/src/routes/memory/federation.d.ts.map +1 -1
  705. package/dist/src/routes/memory/federation.js +5 -0
  706. package/dist/src/routes/memory/federation.js.map +1 -1
  707. package/dist/src/routes/memory/key.d.ts.map +1 -1
  708. package/dist/src/routes/memory/key.js +9 -4
  709. package/dist/src/routes/memory/key.js.map +1 -1
  710. package/dist/src/routes/messages.d.ts.map +1 -1
  711. package/dist/src/routes/messages.js +2 -1
  712. package/dist/src/routes/messages.js.map +1 -1
  713. package/dist/src/routes/msm.d.ts.map +1 -1
  714. package/dist/src/routes/msm.js +3 -1
  715. package/dist/src/routes/msm.js.map +1 -1
  716. package/dist/src/routes/oauth-login.d.ts.map +1 -1
  717. package/dist/src/routes/oauth-login.js +1 -0
  718. package/dist/src/routes/oauth-login.js.map +1 -1
  719. package/dist/src/routes/openrouter.js +2 -2
  720. package/dist/src/routes/openrouter.js.map +1 -1
  721. package/dist/src/routes/organisms/crud.d.ts +3 -0
  722. package/dist/src/routes/organisms/crud.d.ts.map +1 -1
  723. package/dist/src/routes/organisms/crud.js +8 -4
  724. package/dist/src/routes/organisms/crud.js.map +1 -1
  725. package/dist/src/routes/organisms/gates.d.ts.map +1 -1
  726. package/dist/src/routes/organisms/gates.js +3 -2
  727. package/dist/src/routes/organisms/gates.js.map +1 -1
  728. package/dist/src/routes/organisms/intake.d.ts.map +1 -1
  729. package/dist/src/routes/organisms/intake.js +13 -1
  730. package/dist/src/routes/organisms/intake.js.map +1 -1
  731. package/dist/src/routes/organisms/shared.d.ts.map +1 -1
  732. package/dist/src/routes/organisms/shared.js +7 -3
  733. package/dist/src/routes/organisms/shared.js.map +1 -1
  734. package/dist/src/routes/organisms/workspace-ops.d.ts.map +1 -1
  735. package/dist/src/routes/organisms/workspace-ops.js +6 -5
  736. package/dist/src/routes/organisms/workspace-ops.js.map +1 -1
  737. package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
  738. package/dist/src/routes/organisms/workspace-read.js +11 -4
  739. package/dist/src/routes/organisms/workspace-read.js.map +1 -1
  740. package/dist/src/routes/owners.d.ts.map +1 -1
  741. package/dist/src/routes/owners.js +37 -12
  742. package/dist/src/routes/owners.js.map +1 -1
  743. package/dist/src/routes/personal.js +3 -1
  744. package/dist/src/routes/personal.js.map +1 -1
  745. package/dist/src/routes/portal.d.ts +6 -1
  746. package/dist/src/routes/portal.d.ts.map +1 -1
  747. package/dist/src/routes/portal.js +75 -10
  748. package/dist/src/routes/portal.js.map +1 -1
  749. package/dist/src/routes/portfolio.d.ts.map +1 -1
  750. package/dist/src/routes/portfolio.js +5 -1
  751. package/dist/src/routes/portfolio.js.map +1 -1
  752. package/dist/src/routes/prompts.d.ts.map +1 -1
  753. package/dist/src/routes/prompts.js +36 -2
  754. package/dist/src/routes/prompts.js.map +1 -1
  755. package/dist/src/routes/public-events.d.ts.map +1 -1
  756. package/dist/src/routes/public-events.js +4 -1
  757. package/dist/src/routes/public-events.js.map +1 -1
  758. package/dist/src/routes/public-stats.d.ts +7 -0
  759. package/dist/src/routes/public-stats.d.ts.map +1 -1
  760. package/dist/src/routes/public-stats.js +57 -17
  761. package/dist/src/routes/public-stats.js.map +1 -1
  762. package/dist/src/routes/schedules.d.ts +3 -0
  763. package/dist/src/routes/schedules.d.ts.map +1 -1
  764. package/dist/src/routes/schedules.js +14 -1
  765. package/dist/src/routes/schedules.js.map +1 -1
  766. package/dist/src/routes/sse.d.ts +7 -0
  767. package/dist/src/routes/sse.d.ts.map +1 -1
  768. package/dist/src/routes/sse.js +36 -6
  769. package/dist/src/routes/sse.js.map +1 -1
  770. package/dist/src/routes/stats.d.ts.map +1 -1
  771. package/dist/src/routes/stats.js +5 -1
  772. package/dist/src/routes/stats.js.map +1 -1
  773. package/dist/src/routes/storage-files.d.ts +15 -0
  774. package/dist/src/routes/storage-files.d.ts.map +1 -1
  775. package/dist/src/routes/storage-files.js +69 -51
  776. package/dist/src/routes/storage-files.js.map +1 -1
  777. package/dist/src/routes/subdomains.d.ts +13 -0
  778. package/dist/src/routes/subdomains.d.ts.map +1 -1
  779. package/dist/src/routes/subdomains.js +106 -8
  780. package/dist/src/routes/subdomains.js.map +1 -1
  781. package/dist/src/routes/unfurl.d.ts.map +1 -1
  782. package/dist/src/routes/unfurl.js +13 -3
  783. package/dist/src/routes/unfurl.js.map +1 -1
  784. package/dist/src/routes/upload.d.ts +22 -0
  785. package/dist/src/routes/upload.d.ts.map +1 -1
  786. package/dist/src/routes/upload.js +204 -34
  787. package/dist/src/routes/upload.js.map +1 -1
  788. package/dist/src/routes/wallet.d.ts +3 -0
  789. package/dist/src/routes/wallet.d.ts.map +1 -1
  790. package/dist/src/routes/wallet.js +6 -1
  791. package/dist/src/routes/wallet.js.map +1 -1
  792. package/dist/src/routes/webmcp.d.ts +8 -0
  793. package/dist/src/routes/webmcp.d.ts.map +1 -1
  794. package/dist/src/routes/webmcp.js +97 -46
  795. package/dist/src/routes/webmcp.js.map +1 -1
  796. package/dist/src/routes/wellknown.d.ts.map +1 -1
  797. package/dist/src/routes/wellknown.js +1 -0
  798. package/dist/src/routes/wellknown.js.map +1 -1
  799. package/dist/src/schemas/knowledge-package.d.ts +1 -1
  800. package/dist/src/server-bootstrap/config-init.d.ts.map +1 -1
  801. package/dist/src/server-bootstrap/config-init.js +2 -0
  802. package/dist/src/server-bootstrap/config-init.js.map +1 -1
  803. package/dist/src/server-bootstrap/routes-loader.d.ts +4 -2
  804. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
  805. package/dist/src/server-bootstrap/routes-loader.js +11 -22
  806. package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
  807. package/dist/src/server-bootstrap/service-init.js +3 -1
  808. package/dist/src/server-bootstrap/service-init.js.map +1 -1
  809. package/dist/src/server-bootstrap/static-files.d.ts +4 -0
  810. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
  811. package/dist/src/server-bootstrap/static-files.js +14 -1
  812. package/dist/src/server-bootstrap/static-files.js.map +1 -1
  813. package/dist/src/services/agent-statistics.d.ts.map +1 -1
  814. package/dist/src/services/agent-statistics.js +4 -1
  815. package/dist/src/services/agent-statistics.js.map +1 -1
  816. package/dist/src/services/app-agent-deploy.d.ts.map +1 -1
  817. package/dist/src/services/app-agent-deploy.js +4 -1
  818. package/dist/src/services/app-agent-deploy.js.map +1 -1
  819. package/dist/src/services/app-agent-surface.d.ts +78 -0
  820. package/dist/src/services/app-agent-surface.d.ts.map +1 -0
  821. package/dist/src/services/app-agent-surface.js +74 -0
  822. package/dist/src/services/app-agent-surface.js.map +1 -0
  823. package/dist/src/services/app-tool-names.d.ts +15 -0
  824. package/dist/src/services/app-tool-names.d.ts.map +1 -0
  825. package/dist/src/services/app-tool-names.js +24 -0
  826. package/dist/src/services/app-tool-names.js.map +1 -0
  827. package/dist/src/services/appdev-overview.d.ts.map +1 -1
  828. package/dist/src/services/appdev-overview.js +3 -2
  829. package/dist/src/services/appdev-overview.js.map +1 -1
  830. package/dist/src/services/attachment-duplication.js +3 -3
  831. package/dist/src/services/attachment-duplication.js.map +1 -1
  832. package/dist/src/services/build-app-prompt.d.ts +19 -0
  833. package/dist/src/services/build-app-prompt.d.ts.map +1 -1
  834. package/dist/src/services/build-app-prompt.js +97 -11
  835. package/dist/src/services/build-app-prompt.js.map +1 -1
  836. package/dist/src/services/build-extension-prompt.d.ts +40 -0
  837. package/dist/src/services/build-extension-prompt.d.ts.map +1 -0
  838. package/dist/src/services/build-extension-prompt.js +253 -0
  839. package/dist/src/services/build-extension-prompt.js.map +1 -0
  840. package/dist/src/services/cache-cleanup.d.ts.map +1 -1
  841. package/dist/src/services/cache-cleanup.js +2 -1
  842. package/dist/src/services/cache-cleanup.js.map +1 -1
  843. package/dist/src/services/call-timing.d.ts +51 -0
  844. package/dist/src/services/call-timing.d.ts.map +1 -0
  845. package/dist/src/services/call-timing.js +92 -0
  846. package/dist/src/services/call-timing.js.map +1 -0
  847. package/dist/src/services/capability-invoke.d.ts +8 -1
  848. package/dist/src/services/capability-invoke.d.ts.map +1 -1
  849. package/dist/src/services/capability-invoke.js +24 -2
  850. package/dist/src/services/capability-invoke.js.map +1 -1
  851. package/dist/src/services/catalogue-sync.d.ts.map +1 -1
  852. package/dist/src/services/catalogue-sync.js +1 -0
  853. package/dist/src/services/catalogue-sync.js.map +1 -1
  854. package/dist/src/services/component-registrar.d.ts.map +1 -1
  855. package/dist/src/services/component-registrar.js +22 -6
  856. package/dist/src/services/component-registrar.js.map +1 -1
  857. package/dist/src/services/config-loader.d.ts.map +1 -1
  858. package/dist/src/services/config-loader.js +6 -1
  859. package/dist/src/services/config-loader.js.map +1 -1
  860. package/dist/src/services/config-schema.d.ts.map +1 -1
  861. package/dist/src/services/config-schema.js +7 -0
  862. package/dist/src/services/config-schema.js.map +1 -1
  863. package/dist/src/services/connect-tunnel.d.ts.map +1 -1
  864. package/dist/src/services/connect-tunnel.js +17 -6
  865. package/dist/src/services/connect-tunnel.js.map +1 -1
  866. package/dist/src/services/consent.d.ts.map +1 -1
  867. package/dist/src/services/consent.js +3 -1
  868. package/dist/src/services/consent.js.map +1 -1
  869. package/dist/src/services/consul-config.d.ts.map +1 -1
  870. package/dist/src/services/consul-config.js +7 -2
  871. package/dist/src/services/consul-config.js.map +1 -1
  872. package/dist/src/services/contacts.js +4 -2
  873. package/dist/src/services/contacts.js.map +1 -1
  874. package/dist/src/services/core-jobs.js +1 -1
  875. package/dist/src/services/core-jobs.js.map +1 -1
  876. package/dist/src/services/db/agent-messages-overview-db-service.d.ts.map +1 -1
  877. package/dist/src/services/db/agent-messages-overview-db-service.js +2 -1
  878. package/dist/src/services/db/agent-messages-overview-db-service.js.map +1 -1
  879. package/dist/src/services/db/agent-quality-overview-db-service.d.ts.map +1 -1
  880. package/dist/src/services/db/agent-quality-overview-db-service.js +2 -1
  881. package/dist/src/services/db/agent-quality-overview-db-service.js.map +1 -1
  882. package/dist/src/services/db/messages-inbox-db-service.d.ts.map +1 -1
  883. package/dist/src/services/db/messages-inbox-db-service.js +3 -2
  884. package/dist/src/services/db/messages-inbox-db-service.js.map +1 -1
  885. package/dist/src/services/db/messaging-db-service.d.ts.map +1 -1
  886. package/dist/src/services/db/messaging-db-service.js +3 -2
  887. package/dist/src/services/db/messaging-db-service.js.map +1 -1
  888. package/dist/src/services/db/wallet-tab-db-service.d.ts +3 -3
  889. package/dist/src/services/doc-images.d.ts.map +1 -1
  890. package/dist/src/services/doc-images.js +7 -4
  891. package/dist/src/services/doc-images.js.map +1 -1
  892. package/dist/src/services/draft-token.d.ts +22 -2
  893. package/dist/src/services/draft-token.d.ts.map +1 -1
  894. package/dist/src/services/draft-token.js +52 -3
  895. package/dist/src/services/draft-token.js.map +1 -1
  896. package/dist/src/services/ecosystem-automation-notify.d.ts.map +1 -1
  897. package/dist/src/services/ecosystem-automation-notify.js +10 -4
  898. package/dist/src/services/ecosystem-automation-notify.js.map +1 -1
  899. package/dist/src/services/ecosystem-automation.d.ts.map +1 -1
  900. package/dist/src/services/ecosystem-automation.js +3 -2
  901. package/dist/src/services/ecosystem-automation.js.map +1 -1
  902. package/dist/src/services/ecosystem-events.js +1 -1
  903. package/dist/src/services/ecosystem-events.js.map +1 -1
  904. package/dist/src/services/entitlement-merge.d.ts +50 -0
  905. package/dist/src/services/entitlement-merge.d.ts.map +1 -0
  906. package/dist/src/services/entitlement-merge.js +116 -0
  907. package/dist/src/services/entitlement-merge.js.map +1 -0
  908. package/dist/src/services/entitlement-money.d.ts.map +1 -1
  909. package/dist/src/services/entitlement-money.js +4 -1
  910. package/dist/src/services/entitlement-money.js.map +1 -1
  911. package/dist/src/services/exchange-market.d.ts +88 -10
  912. package/dist/src/services/exchange-market.d.ts.map +1 -1
  913. package/dist/src/services/exchange-market.js +104 -11
  914. package/dist/src/services/exchange-market.js.map +1 -1
  915. package/dist/src/services/exchange-odps.d.ts +58 -0
  916. package/dist/src/services/exchange-odps.d.ts.map +1 -0
  917. package/dist/src/services/exchange-odps.js +400 -0
  918. package/dist/src/services/exchange-odps.js.map +1 -0
  919. package/dist/src/services/exchange-projection.d.ts +67 -0
  920. package/dist/src/services/exchange-projection.d.ts.map +1 -0
  921. package/dist/src/services/exchange-projection.js +629 -0
  922. package/dist/src/services/exchange-projection.js.map +1 -0
  923. package/dist/src/services/exchange-proposals.d.ts.map +1 -1
  924. package/dist/src/services/exchange-proposals.js +6 -2
  925. package/dist/src/services/exchange-proposals.js.map +1 -1
  926. package/dist/src/services/extension-files.d.ts +64 -0
  927. package/dist/src/services/extension-files.d.ts.map +1 -0
  928. package/dist/src/services/extension-files.js +88 -0
  929. package/dist/src/services/extension-files.js.map +1 -0
  930. package/dist/src/services/extension-purchase.d.ts +36 -0
  931. package/dist/src/services/extension-purchase.d.ts.map +1 -0
  932. package/dist/src/services/extension-purchase.js +110 -0
  933. package/dist/src/services/extension-purchase.js.map +1 -0
  934. package/dist/src/services/extension-runtime.d.ts +56 -1
  935. package/dist/src/services/extension-runtime.d.ts.map +1 -1
  936. package/dist/src/services/extension-runtime.js +73 -4
  937. package/dist/src/services/extension-runtime.js.map +1 -1
  938. package/dist/src/services/extension-secrets.d.ts +8 -0
  939. package/dist/src/services/extension-secrets.d.ts.map +1 -1
  940. package/dist/src/services/extension-secrets.js +14 -0
  941. package/dist/src/services/extension-secrets.js.map +1 -1
  942. package/dist/src/services/federation-availability.d.ts.map +1 -1
  943. package/dist/src/services/federation-availability.js +1 -0
  944. package/dist/src/services/federation-availability.js.map +1 -1
  945. package/dist/src/services/federation-book.js +15 -7
  946. package/dist/src/services/federation-book.js.map +1 -1
  947. package/dist/src/services/federation-helpers.d.ts.map +1 -1
  948. package/dist/src/services/federation-helpers.js +1 -0
  949. package/dist/src/services/federation-helpers.js.map +1 -1
  950. package/dist/src/services/federation.d.ts.map +1 -1
  951. package/dist/src/services/federation.js +8 -6
  952. package/dist/src/services/federation.js.map +1 -1
  953. package/dist/src/services/file-refs.d.ts +105 -0
  954. package/dist/src/services/file-refs.d.ts.map +1 -0
  955. package/dist/src/services/file-refs.js +106 -0
  956. package/dist/src/services/file-refs.js.map +1 -0
  957. package/dist/src/services/gate-expiry.d.ts.map +1 -1
  958. package/dist/src/services/gate-expiry.js +2 -1
  959. package/dist/src/services/gate-expiry.js.map +1 -1
  960. package/dist/src/services/genesis-sync.d.ts.map +1 -1
  961. package/dist/src/services/genesis-sync.js +9 -4
  962. package/dist/src/services/genesis-sync.js.map +1 -1
  963. package/dist/src/services/handbooks/commerce.d.ts +13 -0
  964. package/dist/src/services/handbooks/commerce.d.ts.map +1 -0
  965. package/dist/src/services/handbooks/commerce.js +60 -0
  966. package/dist/src/services/handbooks/commerce.js.map +1 -0
  967. package/dist/src/services/handbooks/index.d.ts +1 -0
  968. package/dist/src/services/handbooks/index.d.ts.map +1 -1
  969. package/dist/src/services/handbooks/index.js +2 -2
  970. package/dist/src/services/handbooks/index.js.map +1 -1
  971. package/dist/src/services/hooks.d.ts.map +1 -1
  972. package/dist/src/services/hooks.js +2 -0
  973. package/dist/src/services/hooks.js.map +1 -1
  974. package/dist/src/services/invitations.d.ts.map +1 -1
  975. package/dist/src/services/invitations.js +2 -0
  976. package/dist/src/services/invitations.js.map +1 -1
  977. package/dist/src/services/living-author.d.ts.map +1 -1
  978. package/dist/src/services/living-author.js +4 -1
  979. package/dist/src/services/living-author.js.map +1 -1
  980. package/dist/src/services/living-pulse.js +18 -6
  981. package/dist/src/services/living-pulse.js.map +1 -1
  982. package/dist/src/services/mailbox-notification.d.ts.map +1 -1
  983. package/dist/src/services/mailbox-notification.js +1 -0
  984. package/dist/src/services/mailbox-notification.js.map +1 -1
  985. package/dist/src/services/match-notification.d.ts.map +1 -1
  986. package/dist/src/services/match-notification.js +2 -1
  987. package/dist/src/services/match-notification.js.map +1 -1
  988. package/dist/src/services/matching.d.ts.map +1 -1
  989. package/dist/src/services/matching.js +5 -2
  990. package/dist/src/services/matching.js.map +1 -1
  991. package/dist/src/services/memory-replication.d.ts.map +1 -1
  992. package/dist/src/services/memory-replication.js +3 -1
  993. package/dist/src/services/memory-replication.js.map +1 -1
  994. package/dist/src/services/message-broadcast.d.ts.map +1 -1
  995. package/dist/src/services/message-broadcast.js +2 -1
  996. package/dist/src/services/message-broadcast.js.map +1 -1
  997. package/dist/src/services/message-delivery.d.ts.map +1 -1
  998. package/dist/src/services/message-delivery.js +9 -4
  999. package/dist/src/services/message-delivery.js.map +1 -1
  1000. package/dist/src/services/metered-access.d.ts +148 -0
  1001. package/dist/src/services/metered-access.d.ts.map +1 -0
  1002. package/dist/src/services/metered-access.js +128 -0
  1003. package/dist/src/services/metered-access.js.map +1 -0
  1004. package/dist/src/services/metered-entitlements.d.ts +147 -5
  1005. package/dist/src/services/metered-entitlements.d.ts.map +1 -1
  1006. package/dist/src/services/metered-entitlements.js +251 -30
  1007. package/dist/src/services/metered-entitlements.js.map +1 -1
  1008. package/dist/src/services/metered-settlement.d.ts +45 -0
  1009. package/dist/src/services/metered-settlement.d.ts.map +1 -0
  1010. package/dist/src/services/metered-settlement.js +117 -0
  1011. package/dist/src/services/metered-settlement.js.map +1 -0
  1012. package/dist/src/services/network-policy.d.ts.map +1 -1
  1013. package/dist/src/services/network-policy.js +6 -2
  1014. package/dist/src/services/network-policy.js.map +1 -1
  1015. package/dist/src/services/notebook-classify.d.ts.map +1 -1
  1016. package/dist/src/services/notebook-classify.js +7 -2
  1017. package/dist/src/services/notebook-classify.js.map +1 -1
  1018. package/dist/src/services/notebook-plan.d.ts.map +1 -1
  1019. package/dist/src/services/notebook-plan.js +4 -1
  1020. package/dist/src/services/notebook-plan.js.map +1 -1
  1021. package/dist/src/services/notify.d.ts.map +1 -1
  1022. package/dist/src/services/notify.js +6 -3
  1023. package/dist/src/services/notify.js.map +1 -1
  1024. package/dist/src/services/openrouter.d.ts.map +1 -1
  1025. package/dist/src/services/openrouter.js +1 -0
  1026. package/dist/src/services/openrouter.js.map +1 -1
  1027. package/dist/src/services/organism-export.d.ts.map +1 -1
  1028. package/dist/src/services/organism-export.js +4 -1
  1029. package/dist/src/services/organism-export.js.map +1 -1
  1030. package/dist/src/services/organism-import.d.ts.map +1 -1
  1031. package/dist/src/services/organism-import.js +5 -1
  1032. package/dist/src/services/organism-import.js.map +1 -1
  1033. package/dist/src/services/owner-memory.d.ts +14 -1
  1034. package/dist/src/services/owner-memory.d.ts.map +1 -1
  1035. package/dist/src/services/owner-memory.js +8 -14
  1036. package/dist/src/services/owner-memory.js.map +1 -1
  1037. package/dist/src/services/perf-trace.js +3 -1
  1038. package/dist/src/services/perf-trace.js.map +1 -1
  1039. package/dist/src/services/personal-tunnel.js +14 -8
  1040. package/dist/src/services/personal-tunnel.js.map +1 -1
  1041. package/dist/src/services/presence.d.ts.map +1 -1
  1042. package/dist/src/services/presence.js +11 -5
  1043. package/dist/src/services/presence.js.map +1 -1
  1044. package/dist/src/services/protected-resource.d.ts +60 -0
  1045. package/dist/src/services/protected-resource.d.ts.map +1 -0
  1046. package/dist/src/services/protected-resource.js +137 -0
  1047. package/dist/src/services/protected-resource.js.map +1 -0
  1048. package/dist/src/services/realtime-manager.d.ts.map +1 -1
  1049. package/dist/src/services/realtime-manager.js +8 -5
  1050. package/dist/src/services/realtime-manager.js.map +1 -1
  1051. package/dist/src/services/safe-zip.d.ts.map +1 -1
  1052. package/dist/src/services/safe-zip.js +4 -1
  1053. package/dist/src/services/safe-zip.js.map +1 -1
  1054. package/dist/src/services/scheduler-extension-job.js +2 -2
  1055. package/dist/src/services/scheduler-extension-job.js.map +1 -1
  1056. package/dist/src/services/scheduler.js +13 -7
  1057. package/dist/src/services/scheduler.js.map +1 -1
  1058. package/dist/src/services/security-incident.d.ts.map +1 -1
  1059. package/dist/src/services/security-incident.js +7 -2
  1060. package/dist/src/services/security-incident.js.map +1 -1
  1061. package/dist/src/services/site-sync.d.ts.map +1 -1
  1062. package/dist/src/services/site-sync.js +1 -0
  1063. package/dist/src/services/site-sync.js.map +1 -1
  1064. package/dist/src/services/site.d.ts +1 -1
  1065. package/dist/src/services/site.d.ts.map +1 -1
  1066. package/dist/src/services/site.js +29 -8
  1067. package/dist/src/services/site.js.map +1 -1
  1068. package/dist/src/services/structure-overview.d.ts.map +1 -1
  1069. package/dist/src/services/structure-overview.js +4 -1
  1070. package/dist/src/services/structure-overview.js.map +1 -1
  1071. package/dist/src/services/structure-snapshot.d.ts.map +1 -1
  1072. package/dist/src/services/structure-snapshot.js +3 -2
  1073. package/dist/src/services/structure-snapshot.js.map +1 -1
  1074. package/dist/src/services/sync-scheduler.js +3 -2
  1075. package/dist/src/services/sync-scheduler.js.map +1 -1
  1076. package/dist/src/services/task-files.d.ts +51 -0
  1077. package/dist/src/services/task-files.d.ts.map +1 -0
  1078. package/dist/src/services/task-files.js +58 -0
  1079. package/dist/src/services/task-files.js.map +1 -0
  1080. package/dist/src/services/tracked-response.js +1 -1
  1081. package/dist/src/services/tracked-response.js.map +1 -1
  1082. package/dist/src/services/trust-broadcast.d.ts.map +1 -1
  1083. package/dist/src/services/trust-broadcast.js +1 -0
  1084. package/dist/src/services/trust-broadcast.js.map +1 -1
  1085. package/dist/src/services/upload-token.d.ts +29 -0
  1086. package/dist/src/services/upload-token.d.ts.map +1 -1
  1087. package/dist/src/services/upload-token.js +37 -0
  1088. package/dist/src/services/upload-token.js.map +1 -1
  1089. package/dist/src/services/upload-zip.d.ts +9 -0
  1090. package/dist/src/services/upload-zip.d.ts.map +1 -1
  1091. package/dist/src/services/upload-zip.js +19 -81
  1092. package/dist/src/services/upload-zip.js.map +1 -1
  1093. package/dist/src/services/web-bot-auth.d.ts.map +1 -1
  1094. package/dist/src/services/web-bot-auth.js +1 -0
  1095. package/dist/src/services/web-bot-auth.js.map +1 -1
  1096. package/dist/src/services/workflow/engine-steps.d.ts.map +1 -1
  1097. package/dist/src/services/workflow/engine-steps.js +12 -6
  1098. package/dist/src/services/workflow/engine-steps.js.map +1 -1
  1099. package/dist/src/services/workspace-export.d.ts.map +1 -1
  1100. package/dist/src/services/workspace-export.js +5 -2
  1101. package/dist/src/services/workspace-export.js.map +1 -1
  1102. package/dist/src/services/workspace-import.d.ts.map +1 -1
  1103. package/dist/src/services/workspace-import.js +2 -1
  1104. package/dist/src/services/workspace-import.js.map +1 -1
  1105. package/dist/src/services/workspace-meta.d.ts +15 -0
  1106. package/dist/src/services/workspace-meta.d.ts.map +1 -1
  1107. package/dist/src/services/workspace-meta.js +17 -0
  1108. package/dist/src/services/workspace-meta.js.map +1 -1
  1109. package/dist/src/services/workspace-provision.d.ts +3 -0
  1110. package/dist/src/services/workspace-provision.d.ts.map +1 -1
  1111. package/dist/src/services/workspace-provision.js +5 -3
  1112. package/dist/src/services/workspace-provision.js.map +1 -1
  1113. package/dist/src/services/workspace-versions.d.ts.map +1 -1
  1114. package/dist/src/services/workspace-versions.js +0 -0
  1115. package/dist/src/services/workspace-versions.js.map +1 -1
  1116. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts +5 -0
  1117. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts.map +1 -1
  1118. package/dist/src/storage/providers/postgres-kysely/helpers.d.ts +11 -0
  1119. package/dist/src/storage/providers/postgres-kysely/helpers.d.ts.map +1 -1
  1120. package/dist/src/storage/providers/postgres-kysely/helpers.js +14 -0
  1121. package/dist/src/storage/providers/postgres-kysely/helpers.js.map +1 -1
  1122. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +2 -1
  1123. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
  1124. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +16 -0
  1125. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
  1126. package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js +3 -3
  1127. package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js.map +1 -1
  1128. package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js +3 -3
  1129. package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js.map +1 -1
  1130. package/dist/src/storage/providers/postgres-kysely/methods/federation.d.ts.map +1 -1
  1131. package/dist/src/storage/providers/postgres-kysely/methods/federation.js +12 -10
  1132. package/dist/src/storage/providers/postgres-kysely/methods/federation.js.map +1 -1
  1133. package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -1
  1134. package/dist/src/storage/providers/postgres-kysely/methods/identity.js +26 -12
  1135. package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -1
  1136. package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js +5 -5
  1137. package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js.map +1 -1
  1138. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +2 -0
  1139. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -1
  1140. package/dist/src/storage/providers/postgres-kysely/methods/memory.js +12 -1
  1141. package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -1
  1142. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts +9 -0
  1143. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts.map +1 -1
  1144. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js +31 -27
  1145. package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js.map +1 -1
  1146. package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -1
  1147. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +15 -15
  1148. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -1
  1149. package/dist/src/storage/providers/postgres-kysely/methods/otk.js +3 -3
  1150. package/dist/src/storage/providers/postgres-kysely/methods/otk.js.map +1 -1
  1151. package/dist/src/storage/providers/postgres-kysely/methods/packages.d.ts.map +1 -1
  1152. package/dist/src/storage/providers/postgres-kysely/methods/packages.js +4 -14
  1153. package/dist/src/storage/providers/postgres-kysely/methods/packages.js.map +1 -1
  1154. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.d.ts.map +1 -1
  1155. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js +11 -10
  1156. package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js.map +1 -1
  1157. package/dist/src/storage/providers/postgres-kysely/methods/wallet.d.ts.map +1 -1
  1158. package/dist/src/storage/providers/postgres-kysely/methods/wallet.js +3 -1
  1159. package/dist/src/storage/providers/postgres-kysely/methods/wallet.js.map +1 -1
  1160. package/dist/src/storage/providers/postgres-kysely/migrate.d.ts.map +1 -1
  1161. package/dist/src/storage/providers/postgres-kysely/migrate.js +3 -0
  1162. package/dist/src/storage/providers/postgres-kysely/migrate.js.map +1 -1
  1163. package/dist/src/storage/providers/postgres-kysely/migrations/0012_unique_live_app_grant.sql +29 -0
  1164. package/dist/src/storage/providers/postgres-kysely/migrations/0013_ghii_password_lockout.sql +12 -0
  1165. package/dist/src/storage/providers/postgres-kysely/migrations/0014_transaction_initiator.sql +6 -0
  1166. package/dist/src/storage/providers/postgres-kysely/migrations/0015_app_grant_spend_cap.sql +5 -0
  1167. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +4 -1
  1168. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  1169. package/dist/src/storage/providers/sqlite/methods/apps.js +19 -2
  1170. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  1171. package/dist/src/storage/providers/sqlite/methods/community.d.ts.map +1 -1
  1172. package/dist/src/storage/providers/sqlite/methods/community.js +6 -1
  1173. package/dist/src/storage/providers/sqlite/methods/community.js.map +1 -1
  1174. package/dist/src/storage/providers/sqlite/methods/governance.d.ts +1 -0
  1175. package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
  1176. package/dist/src/storage/providers/sqlite/methods/governance.js +4 -1
  1177. package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
  1178. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
  1179. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +9 -2
  1180. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
  1181. package/dist/src/storage/providers/sqlite/methods/owner.d.ts +5 -0
  1182. package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
  1183. package/dist/src/storage/providers/sqlite/methods/owner.js +8 -0
  1184. package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
  1185. package/dist/src/storage/providers/sqlite/methods/work.d.ts.map +1 -1
  1186. package/dist/src/storage/providers/sqlite/methods/work.js +4 -2
  1187. package/dist/src/storage/providers/sqlite/methods/work.js.map +1 -1
  1188. package/dist/src/storage/providers/sqlite/repos/community.d.ts.map +1 -1
  1189. package/dist/src/storage/providers/sqlite/repos/community.js +6 -1
  1190. package/dist/src/storage/providers/sqlite/repos/community.js.map +1 -1
  1191. package/dist/src/storage/providers/sqlite/repos/identity.d.ts +3 -0
  1192. package/dist/src/storage/providers/sqlite/repos/identity.d.ts.map +1 -1
  1193. package/dist/src/storage/providers/sqlite/repos/identity.js +13 -4
  1194. package/dist/src/storage/providers/sqlite/repos/identity.js.map +1 -1
  1195. package/dist/src/storage/providers/sqlite/repos/work.d.ts.map +1 -1
  1196. package/dist/src/storage/providers/sqlite/repos/work.js +4 -2
  1197. package/dist/src/storage/providers/sqlite/repos/work.js.map +1 -1
  1198. package/dist/src/storage/providers/sqlite/schema-tables-1.d.ts.map +1 -1
  1199. package/dist/src/storage/providers/sqlite/schema-tables-1.js +1 -0
  1200. package/dist/src/storage/providers/sqlite/schema-tables-1.js.map +1 -1
  1201. package/dist/src/storage/providers/sqlite/schema-tables-2.d.ts.map +1 -1
  1202. package/dist/src/storage/providers/sqlite/schema-tables-2.js +2 -0
  1203. package/dist/src/storage/providers/sqlite/schema-tables-2.js.map +1 -1
  1204. package/dist/src/storage/providers/sqlite/schema.d.ts +3 -0
  1205. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  1206. package/dist/src/storage/providers/sqlite/schema.js +34 -1
  1207. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  1208. package/dist/src/storage/repositories/app-grant.repository.d.ts +10 -2
  1209. package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
  1210. package/dist/src/storage/repositories/memory.repository.d.ts +14 -0
  1211. package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
  1212. package/dist/src/storage/repositories-impl/memory-repository.d.ts +8 -1
  1213. package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -1
  1214. package/dist/src/storage/repositories-impl/memory-repository.js +15 -4
  1215. package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -1
  1216. package/dist/src/storage/types/agents-messaging.d.ts +19 -0
  1217. package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
  1218. package/dist/src/storage/types/agents-messaging.js.map +1 -1
  1219. package/dist/src/storage/types/auth.d.ts +9 -0
  1220. package/dist/src/storage/types/auth.d.ts.map +1 -1
  1221. package/dist/src/storage/types/commerce.d.ts +13 -0
  1222. package/dist/src/storage/types/commerce.d.ts.map +1 -1
  1223. package/dist/src/storage/types/organisms-federation.d.ts +29 -0
  1224. package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
  1225. package/dist/src/utils/app-agent-discovery.d.ts +31 -0
  1226. package/dist/src/utils/app-agent-discovery.d.ts.map +1 -0
  1227. package/dist/src/utils/app-agent-discovery.js +96 -0
  1228. package/dist/src/utils/app-agent-discovery.js.map +1 -0
  1229. package/dist/src/utils/app-badge.d.ts.map +1 -1
  1230. package/dist/src/utils/app-badge.js +7 -3
  1231. package/dist/src/utils/app-badge.js.map +1 -1
  1232. package/dist/src/utils/app-protect.d.ts.map +1 -1
  1233. package/dist/src/utils/app-protect.js +1 -0
  1234. package/dist/src/utils/app-protect.js.map +1 -1
  1235. package/dist/src/utils/env-validator.d.ts.map +1 -1
  1236. package/dist/src/utils/env-validator.js +5 -1
  1237. package/dist/src/utils/env-validator.js.map +1 -1
  1238. package/dist/src/utils/gaii.d.ts +50 -0
  1239. package/dist/src/utils/gaii.d.ts.map +1 -1
  1240. package/dist/src/utils/gaii.js +66 -0
  1241. package/dist/src/utils/gaii.js.map +1 -1
  1242. package/dist/src/utils/url-validator.d.ts.map +1 -1
  1243. package/dist/src/utils/url-validator.js +4 -1
  1244. package/dist/src/utils/url-validator.js.map +1 -1
  1245. package/dist/src/utils/version.d.ts.map +1 -1
  1246. package/dist/src/utils/version.js +1 -0
  1247. package/dist/src/utils/version.js.map +1 -1
  1248. package/dist/static/app-catalog/_template.html +6 -5
  1249. package/dist/static/app-catalog/js/cortex.js +3 -1
  1250. package/dist/static/app-catalog/js/detail.js +411 -36
  1251. package/dist/static/app-catalog/js/i18n-data.js +279 -3
  1252. package/dist/static/app-catalog/js/main.js +28 -37
  1253. package/dist/static/app-catalog/js/monetize.js +204 -16
  1254. package/dist/static/app-catalog/js/odps.js +489 -0
  1255. package/dist/static/app-catalog/js/render.js +3 -0
  1256. package/dist/static/app-catalog/js/workcopy.js +198 -0
  1257. package/dist/static/app-catalog/styles/app-catalog.css +60 -0
  1258. package/dist/static/app-catalog.html +1450 -137
  1259. package/dist/static/sdk-libs/agents/index.js +45 -7
  1260. package/dist/static/sdk-libs/auth/cluster.js +97 -0
  1261. package/dist/static/sdk-libs/auth/index.js +25 -1
  1262. package/dist/static/sdk-libs/auth/locale.js +151 -0
  1263. package/dist/static/sdk-libs/auth/modal.js +11 -2
  1264. package/dist/static/sdk-libs/auth/palette.js +172 -0
  1265. package/dist/static/sdk-libs/auth/pill.js +37 -6
  1266. package/dist/static/sdk-libs/auth/session.js +7 -3
  1267. package/dist/static/sdk-libs/auth/theme.js +61 -20
  1268. package/dist/static/sdk-libs/data/index.js +70 -8
  1269. package/dist/static/sdk-libs/dist/aimeat-agents.js +41 -8
  1270. package/dist/static/sdk-libs/dist/aimeat-auth.js +423 -22
  1271. package/dist/static/sdk-libs/dist/aimeat-data.js +50 -8
  1272. package/dist/static/sdk-libs/dist/aimeat-exchange.js +675 -0
  1273. package/dist/static/sdk-libs/dist/aimeat-game.js +1555 -0
  1274. package/dist/static/sdk-libs/dist/aimeat-live.js +54 -2
  1275. package/dist/static/sdk-libs/dist/aimeat-markdown.js +32 -1
  1276. package/dist/static/sdk-libs/dist/aimeat-webmcp.js +46 -0
  1277. package/dist/static/sdk-libs/exchange/browse.js +81 -0
  1278. package/dist/static/sdk-libs/exchange/client.js +131 -0
  1279. package/dist/static/sdk-libs/exchange/contracts.js +228 -0
  1280. package/dist/static/sdk-libs/exchange/demand.js +106 -0
  1281. package/dist/static/sdk-libs/exchange/earnings.js +39 -0
  1282. package/dist/static/sdk-libs/exchange/format.js +51 -0
  1283. package/dist/static/sdk-libs/exchange/index.js +70 -0
  1284. package/dist/static/sdk-libs/exchange/odps-completeness.js +177 -0
  1285. package/dist/static/sdk-libs/exchange/sell.js +253 -0
  1286. package/dist/static/sdk-libs/game/board.js +331 -0
  1287. package/dist/static/sdk-libs/game/dom.js +223 -0
  1288. package/dist/static/sdk-libs/game/i18n.js +201 -0
  1289. package/dist/static/sdk-libs/game/index.js +72 -0
  1290. package/dist/static/sdk-libs/game/markers.js +150 -0
  1291. package/dist/static/sdk-libs/game/menu.js +260 -0
  1292. package/dist/static/sdk-libs/game/overlay.js +193 -0
  1293. package/dist/static/sdk-libs/game/progress.js +280 -0
  1294. package/dist/static/sdk-libs/game/score.js +134 -0
  1295. package/dist/static/sdk-libs/game/screen.js +120 -0
  1296. package/dist/static/sdk-libs/game/units.js +55 -0
  1297. package/dist/static/sdk-libs/live/index.js +71 -4
  1298. package/dist/static/sdk-libs/markdown/index.js +49 -1
  1299. package/dist/static/sdk-libs/webmcp/index.js +63 -0
  1300. package/package.json +7 -2
@@ -1,793 +1,885 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <!-- AI: To help this user build apps on AIMEAT, fetch /llms.txt for templates and API docs. Ask what they want to build. -->
5
- <meta charset="UTF-8">
6
- <!-- interactive-widget=resizes-content: the on-screen keyboard resizes the layout viewport so dvh units
7
- + sticky/bottom-pinned composers stay above the keyboard. viewport-fit=cover exposes env(safe-area-*)
8
- for notch / home-indicator padding (used by the full-screen mobile messenger). -->
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content">
10
- <meta name="aimeat-node" content="">
11
- <title>AIMEAT — AI Memory Exchange and Action Transfer</title>
12
- <meta name="description" content="AIMEAT — AI Memory Exchange and Action Transfer. Open protocol infrastructure for AI agents: persistent memory, identity, consent, and coordination.">
13
-
14
- <!-- Open Graph -->
15
- <meta property="og:type" content="website">
16
- <meta property="og:url" content="https://aimeat.io/">
17
- <meta property="og:title" content="AIMEAT — AI Memory Exchange and Action Transfer">
18
- <meta property="og:description" content="Open protocol infrastructure for AI agents. Persistent memory, GHII/GAII identity, morsel economy, MCP connector, and federation.">
19
- <meta property="og:image" content="https://aimeat.io/og-image.png">
20
-
21
- <!-- Twitter/X card -->
22
- <meta name="twitter:card" content="summary_large_image">
23
- <meta name="twitter:title" content="AIMEAT — AI Memory Exchange and Action Transfer">
24
- <meta name="twitter:description" content="Open protocol infrastructure for AI agents. Persistent memory, GHII/GAII identity, morsel economy, MCP connector, and federation.">
25
- <meta name="twitter:image" content="https://aimeat.io/og-image.png">
26
-
27
- <!-- Schema.org JSON-LD -->
28
- <script type="application/ld+json">
29
- {
30
- "@context": "https://schema.org",
31
- "@type": "SoftwareApplication",
32
- "name": "AIMEAT",
33
- "alternateName": "AI Memory Exchange and Action Transfer",
34
- "url": "https://aimeat.io",
35
- "description": "Open protocol infrastructure for AI agents: persistent memory, GHII/GAII identity, morsel economy, consent management, MCP connector, and federation.",
36
- "applicationCategory": "DeveloperApplication",
37
- "operatingSystem": "Any",
38
- "offers": {
39
- "@type": "Offer",
40
- "price": "0",
41
- "priceCurrency": "USD"
42
- },
43
- "sameAs": [
44
- "https://github.com/miikkij/aimeat-protocol"
45
- ]
46
- }
47
- </script>
48
-
49
- <link rel="icon" href="/favicon.svg" type="image/svg+xml">
50
- <link rel="manifest" href="/manifest.json">
51
- <!-- WebMCP bridge (TARGET-034 phase C): registers node-level tools (commerce feed, node info)
52
- on document/navigator.modelContext for in-browser agents + readiness scanners. No-op when
53
- no agent API is present. -->
54
- <script src="/v1/libs/aimeat-webmcp.js?expose=node" defer></script>
55
- <meta name="theme-color" content="#FAFAF8">
56
- <!-- No-flash theme boot: set data-theme on <html> before first paint.
57
- Plain inline JS (NOT a module — modules defer and reintroduce the flash).
58
- Unset key = follow OS until the user makes an explicit choice. -->
59
- <script>
60
- (function () {
61
- try {
62
- var stored = localStorage.getItem('aimeat-theme'); // 'light' | 'dark' | null
63
- var theme = (stored === 'light' || stored === 'dark')
64
- ? stored
65
- : (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
66
- document.documentElement.dataset.theme = theme;
67
- } catch (e) {
68
- document.documentElement.dataset.theme = 'light';
69
- }
70
- })();
71
- </script>
72
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
73
- <link rel="stylesheet" href="/css/theme.css">
74
- <!-- Canonical styles for the shared <Markdown> component — load before views so it styles
75
- rendered markdown everywhere the component is used (no per-view re-definition). -->
76
- <link rel="stylesheet" href="/css/components/markdown.css">
77
- <link rel="stylesheet" href="/css/components/contact-picker.css">
78
- <link rel="stylesheet" href="/css/components/app-sandbox.css">
79
- <link rel="stylesheet" href="/css/views/app-grant.css">
80
- <link rel="stylesheet" href="/css/views/invite-accept.css">
81
- <!-- View CSS preloaded so they are ready before any view renders (prevents FOUC) -->
82
- <!-- hrefs are stamped with ?v=BUILD_ID at serve time by portal.ts serveSpa() -->
83
- <link rel="stylesheet" href="/css/views/portal.css">
84
- <link rel="stylesheet" href="/css/views/landing.css">
85
- <link rel="stylesheet" href="/css/views/portal-classic.css">
86
- <link rel="stylesheet" href="/css/views/portal-dev.css">
87
- <link rel="stylesheet" href="/css/views/profile.css">
88
- <link rel="stylesheet" href="/css/views/notebook.css">
89
- <link rel="stylesheet" href="/css/views/living.css">
90
- <link rel="stylesheet" href="/css/views/offers.css">
91
- <link rel="stylesheet" href="/css/views/calibrator.css">
92
- <link rel="stylesheet" href="/css/views/aimeat-os.css">
93
- <link rel="stylesheet" href="/css/views/portfolio.css">
94
- <link rel="stylesheet" href="/css/views/members.css">
95
- <link rel="stylesheet" href="/css/views/inbox.css">
96
- <link rel="stylesheet" href="/css/components/tags.css">
97
- <link rel="stylesheet" href="/css/components/image-deliverable.css">
98
- <link rel="stylesheet" href="/css/views/help.css">
99
- <link rel="stylesheet" href="/css/views/my-company.css">
100
- <link rel="stylesheet" href="/css/views/companies.css">
101
- <link rel="stylesheet" href="/css/views/capabilities.css">
102
- <link rel="stylesheet" href="/css/views/agents-detail.css">
103
- <link rel="stylesheet" href="/css/views/scheduler.css">
104
- <link rel="stylesheet" href="/css/views/workflows.css">
105
- <link rel="stylesheet" href="/css/views/admin.css">
106
- <link rel="stylesheet" href="/css/views/admin-agent-integration.css">
107
- <link rel="stylesheet" href="/css/views/public-knowledge-viewer.css">
108
- <link rel="stylesheet" href="/css/views/public-workspace-viewer.css">
109
- <link rel="stylesheet" href="/css/views/start.css">
110
- <script type="importmap">
111
- {
112
- "imports": {
113
- "preact": "/lib/preact.mjs",
114
- "preact/hooks": "/lib/preact-hooks.mjs",
115
- "htm": "/lib/htm.mjs",
116
- "/js/i18n.js": "/js/i18n.js",
117
- "/js/theme.js": "/js/theme.js",
118
- "/js/utils.js": "/js/utils.js",
119
- "/js/app-sandbox.js": "/js/app-sandbox.js",
120
- "/js/format.js": "/js/format.js",
121
- "/js/api.js": "/js/api.js",
122
- "/js/hooks.js": "/js/hooks.js",
123
- "/js/recents.js": "/js/recents.js",
124
- "/js/services/admin.js": "/js/services/admin.js",
125
- "/js/services/agents.js": "/js/services/agents.js",
126
- "/js/services/ecosystem.js": "/js/services/ecosystem.js",
127
- "/js/services/apps.js": "/js/services/apps.js",
128
- "/js/services/auth.js": "/js/services/auth.js",
129
- "/js/services/boards.js": "/js/services/boards.js",
130
- "/js/services/catalogue.js": "/js/services/catalogue.js",
131
- "/js/services/consent.js": "/js/services/consent.js",
132
- "/js/services/cortex.js": "/js/services/cortex.js",
133
- "/js/services/extensions.js": "/js/services/extensions.js",
134
- "/js/services/federation.js": "/js/services/federation.js",
135
- "/js/services/calibrator.js": "/js/services/calibrator.js",
136
- "/views/profile/calibrator-llm-editor.js": "/views/profile/calibrator-llm-editor.js",
137
- "/views/profile/calibrator-chart.js": "/views/profile/calibrator-chart.js",
138
- "/views/profile/calibrator-batch.js": "/views/profile/calibrator-batch.js",
139
- "/js/services/knowledge.js": "/js/services/knowledge.js",
140
- "/js/services/living.js": "/js/services/living.js",
141
- "/js/services/skills.js": "/js/services/skills.js",
142
- "/js/services/memory.js": "/js/services/memory.js",
143
- "/js/services/notebook.js": "/js/services/notebook.js",
144
- "/js/services/notebook-plan.js": "/js/services/notebook-plan.js",
145
- "/js/services/nodes.js": "/js/services/nodes.js",
146
- "/js/services/organisms.js": "/js/services/organisms.js",
147
- "/js/services/offers.js": "/js/services/offers.js",
148
- "/js/services/offers-grouping.js": "/js/services/offers-grouping.js",
149
- "/js/services/packages.js": "/js/services/packages.js",
150
- "/js/services/security.js": "/js/services/security.js",
151
- "/js/services/stats.js": "/js/services/stats.js",
152
- "/js/services/appdev.js": "/js/services/appdev.js",
153
- "/js/services/wallet.js": "/js/services/wallet.js",
154
- "/js/services/work.js": "/js/services/work.js",
155
- "/js/services/messages.js": "/js/services/messages.js",
156
- "/js/services/messages-ai-prompts.js": "/js/services/messages-ai-prompts.js",
157
- "/js/services/unfurl.js": "/js/services/unfurl.js",
158
- "/js/services/tracked-responses.js": "/js/services/tracked-responses.js",
159
- "/js/services/presence.js": "/js/services/presence.js",
160
- "/js/presence-store.js": "/js/presence-store.js",
161
- "/js/components/auth-image.js": "/js/components/auth-image.js",
162
- "/js/components/tag-cloud.js": "/js/components/tag-cloud.js",
163
- "/js/components/tag-editor.js": "/js/components/tag-editor.js",
164
- "/components/Modal.js": "/components/Modal.js",
165
- "/components/useViewCSS.js": "/components/useViewCSS.js",
166
- "/components/Markdown.js": "/components/Markdown.js",
167
- "/components/LinkPreview.js": "/components/LinkPreview.js",
168
- "/components/InboxLink.js": "/components/InboxLink.js",
169
- "/components/JsonView.js": "/components/JsonView.js",
170
- "/components/ImageDeliverable.js": "/components/ImageDeliverable.js",
171
- "/components/offer-card-view.js": "/components/offer-card-view.js",
172
- "/components/Mermaid.js": "/components/Mermaid.js",
173
- "/components/NotificationBell.js": "/components/NotificationBell.js",
174
- "/components/CopyButton.js": "/components/CopyButton.js",
175
- "/components/Toast.js": "/components/Toast.js",
176
- "/components/ContactCard.js": "/components/ContactCard.js",
177
- "/components/Spinner.js": "/components/Spinner.js",
178
- "/components/EmptyState.js": "/components/EmptyState.js",
179
- "/components/ToggleSwitch.js": "/components/ToggleSwitch.js",
180
- "/components/Card.js": "/components/Card.js",
181
- "/components/StatusDot.js": "/components/StatusDot.js",
182
- "/components/PresenceDot.js": "/components/PresenceDot.js",
183
- "/components/TagList.js": "/components/TagList.js",
184
- "/components/Pagination.js": "/components/Pagination.js",
185
- "/components/KeyValueRow.js": "/components/KeyValueRow.js",
186
- "/components/SearchBar.js": "/components/SearchBar.js",
187
- "/components/DataTable.js": "/components/DataTable.js",
188
- "/components/Collapsible.js": "/components/Collapsible.js",
189
- "/components/UsageChart.js": "/components/UsageChart.js",
190
- "/lib/live-updates.js": "/lib/live-updates.js",
191
- "/lib/minidenticons.min.js": "/lib/minidenticons.min.js",
192
- "/lib/yaml.mjs": "/lib/yaml.mjs",
193
- "/views/profile/agents-tasks-subtab.js": "/views/profile/agents-tasks-subtab.js",
194
- "/js/services/agent-tasks.js": "/js/services/agent-tasks.js",
195
- "/js/services/agent-directives.js": "/js/services/agent-directives.js",
196
- "/js/services/agent-capabilities.js": "/js/services/agent-capabilities.js",
197
- "/views/profile/agents-capabilities-subtab.js": "/views/profile/agents-capabilities-subtab.js",
198
- "/js/services/sharing-groups.js": "/js/services/sharing-groups.js",
199
- "/js/services/agent-activity.js": "/js/services/agent-activity.js",
200
- "/js/services/ledger.js": "/js/services/ledger.js",
201
- "/views/profile/agents-activity-subtab.js": "/views/profile/agents-activity-subtab.js",
202
- "/views/profile/agents-services-subtab.js": "/views/profile/agents-services-subtab.js",
203
- "/views/profile/agents-messages-subtab.js": "/views/profile/agents-messages-subtab.js",
204
- "/js/services/agent-services.js": "/js/services/agent-services.js",
205
- "/js/services/agent-messages.js": "/js/services/agent-messages.js",
206
- "/js/services/agent-integration.js": "/js/services/agent-integration.js",
207
- "/js/services/admin-agent-integration.js": "/js/services/admin-agent-integration.js",
208
- "/js/services/schedules.js": "/js/services/schedules.js",
209
- "/js/services/workflows.js": "/js/services/workflows.js",
210
- "/views/portfolio-themes.js": "/views/portfolio-themes.js",
211
- "/views/my-company.payments.js": "/views/my-company.payments.js",
212
- "/views/profile/shared.js": "/views/profile/shared.js",
213
- "/views/profile/openrouter-settings.js": "/views/profile/openrouter-settings.js",
214
- "/views/profile/organisms/helpers.js": "/views/profile/organisms/helpers.js",
215
- "/views/profile/organisms/widgets.js": "/views/profile/organisms/widgets.js",
216
- "/views/profile/organisms/panels.js": "/views/profile/organisms/panels.js",
217
- "/views/profile/organisms/agents.js": "/views/profile/organisms/agents.js",
218
- "/views/profile/organisms/members.js": "/views/profile/organisms/members.js",
219
- "/views/profile/organisms/invite-panel.js": "/views/profile/organisms/invite-panel.js",
220
- "/js/services/contacts.js": "/js/services/contacts.js",
221
- "/components/ContactPicker.js": "/components/ContactPicker.js",
222
- "/views/profile/organisms/home.js": "/views/profile/organisms/home.js",
223
- "/views/profile/organisms/workspace-list.js": "/views/profile/organisms/workspace-list.js",
224
- "/views/profile/organisms/workspace.js": "/views/profile/organisms/workspace.js",
225
- "/views/profile/organisms/activity-panel.js": "/views/profile/organisms/activity-panel.js",
226
- "/views/profile/organisms/participants-panel.js": "/views/profile/organisms/participants-panel.js",
227
- "/views/profile/organisms/workspace-comments.js": "/views/profile/organisms/workspace-comments.js",
228
- "/views/profile/organisms/sources-panel.js": "/views/profile/organisms/sources-panel.js",
229
- "/views/profile/organisms/skills-panel.js": "/views/profile/organisms/skills-panel.js",
230
- "/views/profile/skills-tab.js": "/views/profile/skills-tab.js",
231
- "/views/profile/organisms/workspace-apps.js": "/views/profile/organisms/workspace-apps.js",
232
- "/views/profile/organisms/schema-form.js": "/views/profile/organisms/schema-form.js",
233
- "/views/profile/organisms/document.js": "/views/profile/organisms/document.js",
234
- "/views/command-palette.js": "/views/command-palette.js",
235
- "/views/profile/organisms/mindmap.js": "/views/profile/organisms/mindmap.js",
236
- "/views/profile/organisms/readme-panel.js": "/views/profile/organisms/readme-panel.js",
237
- "/views/profile/organisms/timeline-panel.js": "/views/profile/organisms/timeline-panel.js"
238
- }
239
- }
240
- </script>
241
- </head>
242
- <body>
243
- <!-- Background -->
244
- <div class="bg-canvas" id="bgCanvas"></div>
245
-
246
- <!-- Static H1 for crawlers — visually hidden, SPA renders the real UI -->
247
- <h1 class="visually-hidden">AIMEAT AI Memory Exchange and Action Transfer. Open protocol for AI agents: persistent memory, identity, app generation, and federated node networks.</h1>
248
-
249
- <!-- App root (Preact mounts here) -->
250
- <div id="app"></div>
251
-
252
- <!-- SSO handoff: the desktop app already holds an authenticated owner JWT (from its inline
253
- sign-in). It opens the portal with #handoff=<base64({owner,jwt})> so the browser is logged
254
- in WITHOUT a second sign-in. Runs synchronously before the app reads the session. -->
255
- <script>
256
- (function () {
257
- try {
258
- var m = location.hash.match(/[#&]handoff=([^&]+)/);
259
- if (!m) return;
260
- var s = JSON.parse(atob(decodeURIComponent(m[1])));
261
- if (s && s.jwt && s.owner) {
262
- var node = '';
263
- try { node = (JSON.parse(atob(s.jwt.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))) || {}).node || ''; } catch (e) {}
264
- localStorage.setItem('aimeat_session', JSON.stringify({
265
- owner: s.owner, jwt: s.jwt, ghii: node ? (s.owner + '@' + node) : null, gaii: null,
266
- }));
267
- }
268
- // Strip the token from the URL so it is not bookmarked or left in history.
269
- history.replaceState(null, '', location.pathname + location.search);
270
- } catch (e) { /* ignore a malformed handoff */ }
271
- })();
272
- </script>
273
-
274
- <script type="module">
275
- import { h, render, Component } from 'preact';
276
- import { useState, useEffect, useCallback } from 'preact/hooks';
277
- import htm from 'htm';
278
- import { loadTranslations, t, getLocale, switchLocale, onLocaleChange } from '/js/i18n.js';
279
- import { initThemeSystem } from '/js/theme.js';
280
- import { NotificationBell, openNotificationLink } from '/components/NotificationBell.js';
281
- import { CommandPalette } from '/views/command-palette.js';
282
- import { openAppSandboxed, isAppHtmlUrl } from '/js/app-sandbox.js';
283
- // generateStars no longer needed for light theme
284
-
285
- const html = htm.bind(h);
286
-
287
- // ── Notification cold-open deep link ──
288
- // A push-notification click can open '/v1/profile?tab=messages#inbox/<conversationId>' (or
289
- // the bell's '#<tab>[/<rest>]' hash form) in a fresh window. Prime the landing page's
290
- // sessionStorage contract ({tabId, slot} JSON landing-page.js openView init) BEFORE the
291
- // view mounts, plus the inbox thread key that inbox-tab.js consumes on mount. Overwriting the
292
- // saved tab matters: landing-page prefers sessionStorage over ?tab=, so a stale value from
293
- // earlier browsing would otherwise beat the deep link in a reused browser tab.
294
- (() => {
295
- if (location.pathname !== '/v1/profile') return;
296
- const m = /^#([a-z]+)(?:\/(.+))?$/i.exec(location.hash || '');
297
- const rawTab = new URLSearchParams(location.search).get('tab') || (m ? m[1] : '');
298
- if (!rawTab) return;
299
- const tabId = rawTab.toLowerCase() === 'inbox' ? 'messages' : rawTab;
300
- try {
301
- sessionStorage.setItem('aimeat-profile-tab', JSON.stringify({ tabId, slot: 'main' }));
302
- if (tabId === 'messages' && m && m[2]) sessionStorage.setItem('aimeat.inbox.open', m[2]);
303
- } catch { /* private mode — ?tab= still lands the tab */ }
304
- })();
305
-
306
- // ── Error Boundary ──
307
- class ErrorBoundary extends Component {
308
- constructor(props) {
309
- super(props);
310
- this.state = { error: null };
311
- }
312
- static getDerivedStateFromError(error) {
313
- return { error };
314
- }
315
- componentDidCatch(error, info) {
316
- console.error('View render error:', error, info);
317
- }
318
- render() {
319
- if (this.state.error) {
320
- const retry = () => {
321
- this.setState({ error: null });
322
- if (this.props.onRetry) this.props.onRetry();
323
- };
324
- return html`
325
- <div style="text-align:center; padding:3rem 1.5rem; color:var(--text-dim,#888);">
326
- <h2 style="color:var(--text-bright,#fff); margin-bottom:0.5rem;">${t('common.somethingWentWrong')}</h2>
327
- <p style="margin-bottom:1rem; font-size:0.9rem;">${this.state.error?.message || 'Unknown error'}</p>
328
- <button class="btn-primary" onClick=${retry} style="animation:none;">${t('common.retry')}</button>
329
- </div>
330
- `;
331
- }
332
- return this.props.children;
333
- }
334
- }
335
-
336
- // ── Route definitions ──
337
- // window.__B is injected by the server as "?v=BUILD_ID" to bust the browser's
338
- // ES module cache on every server restart (HTTP no-cache/ETag alone is
339
- // insufficient modules stay in the module registry for the full session).
340
- const B = window.__B || '';
341
- const ROUTES = {
342
- // Landing/portal split (2026-06-10): the route serves the logged-out landing;
343
- // logged-in visitors are forwarded to /v1/profile by the view itself. The old
344
- // portal view stays reachable at /v1/classic (prompt boxes / "Build").
345
- '/v1/portal': () => import('/views/landing.js' + B),
346
- '/v1/pricing': () => import('/views/pricing.js' + B),
347
- '/v1/start': () => import('/views/start.js' + B),
348
- '/v1/how-it-works': () => import('/views/how-it-works.js' + B),
349
- '/v1/business': () => import('/views/business.js' + B),
350
- '/v1/profile': () => import('/views/profile.js' + B),
351
- '/v1/my-company': () => import('/views/my-company.js' + B),
352
- '/v1/companies': () => import('/views/companies.js' + B),
353
- '/v1/app-grant': () => import('/views/app-grant.js' + B),
354
- '/v1/invite': () => import('/views/invite-accept.js' + B),
355
- '/v1/aimeat-os': () => import('/views/aimeat-os.js' + B),
356
- '/v1/classic': () => import('/views/portal-classic.js' + B),
357
- '/v1/portfolio': () => import('/views/portfolio.js' + B),
358
- '/v1/members': () => import('/views/members.js' + B),
359
- '/v1/admin': () => import('/views/admin.js' + B),
360
- '/v1/help': () => import('/views/help.js' + B),
361
- '/v1/publicknowledgeviewer': () => import('/views/public-knowledge-viewer.js' + B),
362
- '/v1/publicworkspaceviewer': () => import('/views/public-workspace-viewer.js' + B),
363
- };
364
-
365
- // Match route, handling query params for special views
366
- function matchRoute(pathname, search) {
367
- // Dev portal is ?view=dev on /v1/portal
368
- if (pathname === '/v1/portal' && search.includes('view=dev')) {
369
- return () => import('/views/portal-dev.js' + B);
370
- }
371
- // Single-agent pop-out window: /v1/profile?solo=<agentName>
372
- if (pathname === '/v1/profile' && /[?&]solo=/.test(search)) {
373
- return () => import('/views/agent-solo.js' + B);
374
- }
375
- // Single-document pop-out window: /v1/profile?doc=<org>:<ws>:<type>:<id>
376
- if (pathname === '/v1/profile' && /[?&]doc=/.test(search)) {
377
- return () => import('/views/doc-solo.js' + B);
378
- }
379
- // Portfolio public view: /v1/portfolio/<username>
380
- if (pathname.startsWith('/v1/portfolio/') && pathname !== '/v1/portfolio/') {
381
- return () => import('/views/portfolio.js' + B);
382
- }
383
- return ROUTES[pathname] || ROUTES['/v1/portal'];
384
- }
385
-
386
- // ── App Component ──
387
- function App() {
388
- const [View, setView] = useState(null);
389
- const [viewError, setViewError] = useState(null);
390
- const [locale, setLocale] = useState(getLocale());
391
-
392
- // Navigate to a route
393
- const navigate = useCallback(async (path, replace = false) => {
394
- const url = new URL(path, window.location.origin);
395
- const loader = matchRoute(url.pathname, url.search);
396
-
397
- if (replace) {
398
- history.replaceState(null, '', path);
399
- } else {
400
- history.pushState(null, '', path);
401
- }
402
-
403
- try {
404
- setViewError(null);
405
- const mod = await loader();
406
- setView(() => mod.default);
407
- } catch (err) {
408
- console.error('Failed to load view:', err);
409
- setViewError(err);
410
- setView(null);
411
- }
412
- }, []);
413
-
414
- // Push-notification interactions on an already-open window. The service worker (sw.js) focuses
415
- // this window and posts either:
416
- // - 'aimeat-notification-click': the notification's target URL → deep-link it in place.
417
- // - 'aimeat-notification-action': an action button was pressed. A lock screen can't hold the
418
- // JWT, so the SW hands the action here to run with the owner's session. An 'api' action
419
- // (approve/deny/accept/decline) executes directly; 'reply'/'navigate' just deep-link so the
420
- // owner completes it in the SPA (a reply needs text we can't compose from a button).
421
- useEffect(() => {
422
- if (!('serviceWorker' in navigator)) return undefined;
423
- const onSwMessage = async (e) => {
424
- const d = e.data;
425
- if (!d) return;
426
- if (d.type === 'aimeat-notification-click' && d.url) { openNotificationLink(d.url, navigate); return; }
427
- if (d.type === 'aimeat-notification-action' && d.action) {
428
- const a = d.action;
429
- if (a.kind === 'api' && a.endpoint) {
430
- try {
431
- const jwt = window.AIMEAT?.auth?.getSession?.()?.jwt;
432
- if (jwt) {
433
- await fetch(a.endpoint, {
434
- method: a.method || 'POST',
435
- headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + jwt },
436
- body: a.body ? JSON.stringify(a.body) : undefined,
437
- });
438
- window.dispatchEvent(new CustomEvent('aimeat-live-update'));
439
- }
440
- } catch { /* best-effort; the target view still shows the current state */ }
441
- }
442
- // Land the owner on the notification's target so the result is visible in context.
443
- if (d.url) openNotificationLink(d.url, navigate);
444
- }
445
- };
446
- navigator.serviceWorker.addEventListener('message', onSwMessage);
447
- return () => navigator.serviceWorker.removeEventListener('message', onSwMessage);
448
- }, [navigate]);
449
-
450
- // Initial load + popstate
451
- useEffect(() => {
452
- // Load initial route
453
- const path = location.pathname + location.search;
454
- navigate(path, true);
455
-
456
- // Handle back/forward
457
- const onPopState = () => {
458
- const loader = matchRoute(location.pathname, location.search);
459
- loader().then(mod => {
460
- setViewError(null);
461
- setView(() => mod.default);
462
- }).catch(err => {
463
- console.error('Popstate view load failed:', err);
464
- setViewError(err);
465
- setView(null);
466
- });
467
- };
468
- window.addEventListener('popstate', onPopState);
469
-
470
- // Intercept internal link clicks for SPA navigation
471
- const onClick = (e) => {
472
- const a = e.target.closest('a[href]');
473
- if (!a) return;
474
- const href = a.getAttribute('href');
475
- // H-2: a published-app HTML link must NEVER open as a top-level document on the
476
- // apex origin (same origin as this authenticated SPA) — it could read the
477
- // visitor's session. Force it into a sandboxed, opaque-origin iframe instead,
478
- // regardless of target=_blank / modifier keys.
479
- if (isAppHtmlUrl(href)) {
480
- e.preventDefault();
481
- const label = (a.textContent || '').trim() || 'App';
482
- openAppSandboxed(href, label);
483
- return;
484
- }
485
- // Only intercept internal /v1/ links
486
- if (!href || !href.startsWith('/v1/')) return;
487
- if (e.ctrlKey || e.metaKey || e.shiftKey) return;
488
- // Respect explicit new-tab / new-window targets without this, an
489
- // <a href="/v1/apps/.../launch?mode=inline" target="_blank"> from a
490
- // child component would be hijacked, navigated in the same tab via
491
- // matchRoute (which doesn't know /v1/apps/...), and dump the user
492
- // back on the landing page.
493
- const target = a.getAttribute('target');
494
- if (target && target !== '_self' && target !== '') return;
495
- if (a.hasAttribute('download')) return;
496
- e.preventDefault();
497
- navigate(href);
498
- };
499
- document.addEventListener('click', onClick);
500
-
501
- return () => {
502
- window.removeEventListener('popstate', onPopState);
503
- document.removeEventListener('click', onClick);
504
- };
505
- }, [navigate]);
506
-
507
- // Listen for locale changes
508
- useEffect(() => {
509
- return onLocaleChange((loc) => setLocale(loc));
510
- }, []);
511
-
512
- const retryView = useCallback(() => {
513
- navigate(location.pathname + location.search, true);
514
- }, [navigate]);
515
-
516
- return html`
517
- <${Header} navigate=${navigate} locale=${locale} />
518
- <${CommandPalette} navigate=${navigate} />
519
- <div class="page-content">
520
- ${viewError
521
- ? html`<div style="text-align:center; padding:3rem 1.5rem; color:var(--text-dim,#888);">
522
- <h2 style="color:var(--text-bright,#fff); margin-bottom:0.5rem;">Failed to load page</h2>
523
- <p style="margin-bottom:1rem; font-size:0.9rem;">${viewError.message || 'Network error'}</p>
524
- <button class="btn-primary" onClick=${retryView} style="animation:none;">Retry</button>
525
- </div>`
526
- : View
527
- ? html`<${ErrorBoundary} onRetry=${retryView}><${View} navigate=${navigate} locale=${locale} /></${ErrorBoundary}>`
528
- : html`<div class="empty"><div class="spinner"></div></div>`
529
- }
530
- </div>
531
- `;
532
- }
533
-
534
- // ── Theme Toggle ──
535
- // The light/dark switch now lives INSIDE the golden login pill (served by libs.ts →
536
- // mountLoginButton) so every app embedding the pill inherits it for free. theme.js still
537
- // runs (initThemeSystem) to track OS preference and adopt the pill's theme changes.
538
-
539
- // ── Header Component ──
540
- // Built-in public links. Operators can show/hide and reorder these via the admin
541
- // Portal tab (persisted at /v1/site/header-nav). Auth/role-gated links (Apps, Profile,
542
- // Admin) are NOT in this list they stay forced by the session/role checks below.
543
- const PUBLIC_NAV_LINKS = [
544
- { id: 'try', path: '/v1/portal', key: 'nav.try' },
545
- { id: 'howItWorks', path: '/v1/how-it-works', key: 'nav.howItWorks', fallback: 'How it works' },
546
- { id: 'business', path: '/v1/business', key: 'nav.business', fallback: 'For your business' },
547
- { id: 'companies', path: '/v1/companies', key: 'nav.companies', fallback: 'Companies' },
548
- { id: 'members', path: '/v1/members', key: 'nav.members', fallback: 'Members' },
549
- { id: 'devView', path: '/v1/portal?view=dev', key: 'nav.devView', matchActive: false },
550
- { id: 'help', path: '/v1/help', key: 'nav.help' },
551
- ];
552
-
553
- function Header({ navigate, locale }) {
554
- const [session, setSession] = useState(null);
555
- const [morsels, setMorsels] = useState(null);
556
- const [menuOpen, setMenuOpen] = useState(false);
557
- // Node feature flags from /v1/site/header-nav. Empty until the fetch resolves,
558
- // so optional surfaces stay hidden until we positively learn they're enabled (no flash).
559
- const [features, setFeatures] = useState({});
560
- // Header nav config: { order, hidden }. Defaults to all visible in declared order
561
- // until the public /v1/site/header-nav fetch resolves (no flash of empty nav).
562
- const [navConfig, setNavConfig] = useState({ order: PUBLIC_NAV_LINKS.map(l => l.id), hidden: [] });
563
-
564
- // Check auth state
565
- useEffect(() => {
566
- const checkAuth = () => {
567
- if (window.AIMEAT?.auth?.hasSession) {
568
- const s = window.AIMEAT.auth.getSession();
569
- setSession(s);
570
- } else {
571
- setSession(null);
572
- }
573
- };
574
- checkAuth();
575
- // Re-check when auth lib fires events
576
- window.addEventListener('aimeat-auth-change', checkAuth);
577
- return () => window.removeEventListener('aimeat-auth-change', checkAuth);
578
- }, []);
579
-
580
- // Load operator-configured header nav (public endpoint, no auth needed).
581
- useEffect(() => {
582
- let cancelled = false;
583
- fetch('/v1/site/header-nav')
584
- .then(r => r.json())
585
- .then(d => {
586
- if (cancelled || !d?.ok || !d.data) return;
587
- const order = Array.isArray(d.data.order) ? d.data.order : PUBLIC_NAV_LINKS.map(l => l.id);
588
- const hidden = Array.isArray(d.data.hidden) ? d.data.hidden : [];
589
- setNavConfig({ order, hidden });
590
- setFeatures(d.data.features || {});
591
- })
592
- .catch(e => console.warn('Header nav fetch failed:', e.message));
593
- return () => { cancelled = true; };
594
- }, []);
595
-
596
- // Fetch morsels when session is available
597
- useEffect(() => {
598
- if (!session) { setMorsels(null); return; }
599
- fetch('/v1/wallet', {
600
- headers: { 'Authorization': 'Bearer ' + session.jwt }
601
- })
602
- .then(r => r.json())
603
- .then(d => { if (d.ok) setMorsels(d.data?.balance ?? null); })
604
- .catch(e => console.warn('Wallet fetch failed:', e.message));
605
- }, [session]);
606
-
607
- const handleLangSwitch = (lang) => {
608
- switchLocale(lang);
609
- };
610
-
611
- const handleNav = (e, path) => {
612
- e.preventDefault();
613
- // Mark in-app navigation: the landing redirects logged-in users to their Home
614
- // ONLY on direct arrival (bookmark/external link), never when they deliberately
615
- // navigated here from inside the app (e.g. the brand link).
616
- try { sessionStorage.setItem('aimeat.in-app', '1'); } catch {}
617
- navigate(path);
618
- };
619
-
620
- const currentPath = location.pathname;
621
-
622
- // Resolve the public links to render: config order, minus hidden, by declared id.
623
- const linkById = Object.fromEntries(PUBLIC_NAV_LINKS.map(l => [l.id, l]));
624
- const hiddenSet = new Set(navConfig.hidden);
625
- const visibleLinks = navConfig.order
626
- .map(id => linkById[id])
627
- .filter(l => l && !hiddenSet.has(l.id));
628
-
629
- return html`
630
- <nav class="topnav">
631
- <div style="display:flex;align-items:center;gap:20px">
632
- <a href="/v1/portal" class="topnav-brand" onClick=${(e) => handleNav(e, '/v1/portal')}>
633
- AIME<span class="heart">\u2665</span><span class="brand-at">AT</span>
634
- </a>
635
- ${morsels !== null && html`<span class="brand-morsels" style="display:inline-flex">${morsels}</span>`}
636
- </div>
637
-
638
- <div class="topnav-right">
639
- <button class="topnav-burger" aria-label="Menu" aria-expanded=${menuOpen ? 'true' : 'false'}
640
- onClick=${() => setMenuOpen(o => !o)}>☰</button>
641
- <div class="topnav-menu ${menuOpen ? 'open' : ''}">
642
- <!-- Public links are operator-configurable (visibility + order) via the admin
643
- Portal tab. "Try it" leads to the landing's path cards + app gallery.
644
- Classic stays reachable deeper (landing card B "Start building"). -->
645
- ${visibleLinks.map(link => html`
646
- <a href="${link.path}" key=${link.id}
647
- onClick=${(e) => { handleNav(e, link.path); setMenuOpen(false); }}
648
- class="${link.matchActive !== false && currentPath === link.path ? 'active' : ''}">${t(link.key) || link.fallback || link.key}</a>
649
- `)}
650
- ${session && html`
651
- <a href="/app-catalog.html" target="_blank" onClick=${() => setMenuOpen(false)} class="${currentPath === '/app-catalog.html' ? 'active' : ''}">${t('nav.apps') || 'Apps'}</a>
652
- <a href="/v1/profile" class="profile-link visible ${currentPath === '/v1/profile' ? 'active' : ''}" onClick=${(e) => { handleNav(e, '/v1/profile'); setMenuOpen(false); }}>
653
- ${t('nav.profile')}
654
- </a>
655
- <a href="/v1/my-company" class="${currentPath === '/v1/my-company' ? 'active' : ''}" onClick=${(e) => { handleNav(e, '/v1/my-company'); setMenuOpen(false); }}>
656
- ${t('nav.myCompany')}
657
- </a>
658
- ${session.roles && session.roles.includes('operator') && html`
659
- <a href="/v1/admin" class="${currentPath === '/v1/admin' ? 'active' : ''}" onClick=${(e) => { handleNav(e, '/v1/admin'); setMenuOpen(false); }}>
660
- ${t('nav.admin')}
661
- </a>
662
- `}
663
- `}
664
- <div class="topnav-center">
665
- <button class="lang-btn ${locale === 'en' ? 'active' : ''}" onClick=${() => handleLangSwitch('en')}>EN</button>
666
- <button class="lang-btn ${locale === 'fi' ? 'active' : ''}" onClick=${() => handleLangSwitch('fi')}>FI</button>
667
- </div>
668
- </div>
669
- ${session && html`<${NotificationBell} t=${t} onNavigate=${(p) => navigate(p)} />`}
670
- <span class="header-auth-slot" id="headerAuth"></span>
671
- </div>
672
- </nav>
673
- `;
674
- }
675
-
676
- // ── Bootstrap ──
677
- async function boot() {
678
- // Load translations
679
- await loadTranslations();
680
-
681
- // Initialize theme system (head snippet already set the initial theme;
682
- // this keeps meta in sync and tracks OS preference until an explicit choice).
683
- initThemeSystem();
684
-
685
- // Load auth library (served from /v1/libs/aimeat-auth.js)
686
- await new Promise((resolve) => {
687
- const script = document.createElement('script');
688
- script.src = '/v1/libs/aimeat-auth.js';
689
- script.onload = resolve;
690
- script.onerror = resolve; // Continue even if auth fails
691
- document.head.appendChild(script);
692
- });
693
-
694
- // Restore session from localStorage (critical for Ctrl+F5 / page reload)
695
- if (window.AIMEAT?.auth?.login) {
696
- try { await window.AIMEAT.auth.login(); } catch (_) {}
697
- }
698
-
699
- // Listen for session expiry — show notification and trigger re-login
700
- if (window.AIMEAT?.auth?.on) {
701
- window.AIMEAT.auth.on('expired', () => {
702
- console.warn('[aimeat] Session expired — attempting re-login');
703
- window.dispatchEvent(new Event('aimeat-auth-change'));
704
- // Try silent re-login from stored credentials
705
- if (window.AIMEAT.auth.login) {
706
- window.AIMEAT.auth.login().then(session => {
707
- if (session) {
708
- window.dispatchEvent(new Event('aimeat-auth-change'));
709
- } else {
710
- // Show login UI if silent re-login fails
711
- window.dispatchEvent(new CustomEvent('aimeat-session-expired'));
712
- }
713
- }).catch(() => {
714
- window.dispatchEvent(new CustomEvent('aimeat-session-expired'));
715
- });
716
- }
717
- });
718
- }
719
-
720
- // Mount Preact app
721
- render(html`<${App} />`, document.getElementById('app'));
722
-
723
- // Build i18n object for auth widget from modal.* translations
724
- function authI18n() {
725
- const keys = [
726
- 'descNew', 'descReturning', 'usernameLabel', 'usernamePlaceholder',
727
- 'passwordLabel', 'passwordPlaceholder', 'displayNameLabel', 'displayNameHint',
728
- 'displayNamePlaceholder', 'signInBtn', 'cancelBtn', 'orLabel', 'googleSignIn', 'working',
729
- 'errUserShort', 'errPassShort', 'errWrongPass', 'loggedIn', 'logoutBtn',
730
- 'forgotPassword', 'forgotUsername', 'resetPasswordTitle', 'resetPasswordDesc',
731
- 'sendResetCode', 'backToLogin', 'resetCodeSent', 'enterNewPasswordTitle',
732
- 'codeLabel', 'newPasswordLabel', 'newPasswordPlaceholder', 'errPassWeak',
733
- 'resetPassword', 'resetSuccess', 'recoverUsernameTitle', 'recoverUsernameDesc',
734
- 'emailLabel', 'sendUsername', 'usernameSent',
735
- 'completeAccountTitle', 'completeAccountDesc', 'completeAccountDescResend',
736
- 'sendVerificationCode', 'enterCodeTitle', 'enterCodeDesc', 'confirmAndSignIn',
737
- 'emailVerifiedSigningIn', 'errEmailInvalid', 'errCodeRequired',
738
- 'whyTitle', 'whyGhii', 'whyPrivacy', 'whyAgents', 'whyMorsels',
739
- ];
740
- const obj = {};
741
- for (const k of keys) {
742
- const v = t('modal.' + k);
743
- if (v !== 'modal.' + k) obj[k] = v;
744
- }
745
- // Labels for the theme toggle that now lives inside the login pill.
746
- obj.themeToDark = t('nav.themeToDark');
747
- obj.themeToLight = t('nav.themeToLight');
748
- return obj;
749
- }
750
-
751
- function mountAuth() {
752
- try {
753
- if (document.getElementById('headerAuth') && window.AIMEAT?.auth?.mountLoginButton) {
754
- window.AIMEAT.auth.mountLoginButton('#headerAuth', {
755
- onLogin: () => window.dispatchEvent(new Event('aimeat-auth-change')),
756
- onLogout: () => window.dispatchEvent(new Event('aimeat-auth-change')),
757
- i18n: authI18n(),
758
- });
759
- }
760
- } catch (err) {
761
- console.error('Auth mount failed:', err);
762
- }
763
- }
764
-
765
- // Mount auth button after Preact renders
766
- requestAnimationFrame(() => mountAuth());
767
-
768
- // Re-mount auth button when locale changes
769
- window.addEventListener('lang-change', () => requestAnimationFrame(() => mountAuth()));
770
- }
771
-
772
- boot().catch(err => {
773
- console.error('Boot failed:', err);
774
- const app = document.getElementById('app');
775
- const wrap = document.createElement('div');
776
- wrap.style.cssText = 'text-align:center;padding:3rem;color:#6B7280;font-family:DM Sans,system-ui';
777
- const h = document.createElement('h2');
778
- h.textContent = 'AIMEAT failed to start';
779
- const p = document.createElement('p');
780
- p.textContent = err.message || 'Unknown error';
781
- const btn = document.createElement('button');
782
- btn.textContent = 'Reload';
783
- btn.style.cssText = 'margin-top:1rem;padding:0.6rem 1.5rem;background:linear-gradient(135deg,#E8564A,#FF6B6B);color:#fff;border:none;border-radius:10px;cursor:pointer;font-weight:700';
784
- btn.onclick = () => location.reload();
785
- wrap.appendChild(h);
786
- wrap.appendChild(p);
787
- wrap.appendChild(btn);
788
- app.textContent = '';
789
- app.appendChild(wrap);
790
- });
791
- </script>
792
- </body>
793
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <!-- AI: To help this user build apps on AIMEAT, fetch /llms.txt for templates and API docs. Ask what they want to build. -->
5
+ <meta charset="UTF-8">
6
+ <!-- interactive-widget=resizes-content: the on-screen keyboard resizes the layout viewport so dvh units
7
+ + sticky/bottom-pinned composers stay above the keyboard. viewport-fit=cover exposes env(safe-area-*)
8
+ for notch / home-indicator padding (used by the full-screen mobile messenger). -->
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content">
10
+ <meta name="aimeat-node" content="">
11
+ <title>AIMEAT — AI Memory Exchange and Action Transfer</title>
12
+ <meta name="description" content="AIMEAT — AI Memory Exchange and Action Transfer. Open protocol infrastructure for AI agents: persistent memory, identity, consent, and coordination.">
13
+
14
+ <!-- Open Graph -->
15
+ <meta property="og:type" content="website">
16
+ <meta property="og:url" content="https://aimeat.io/">
17
+ <meta property="og:title" content="AIMEAT — AI Memory Exchange and Action Transfer">
18
+ <meta property="og:description" content="Open protocol infrastructure for AI agents. Persistent memory, GHII/GAII identity, morsel economy, MCP connector, and federation.">
19
+ <meta property="og:image" content="https://aimeat.io/og-image.png">
20
+
21
+ <!-- Twitter/X card -->
22
+ <meta name="twitter:card" content="summary_large_image">
23
+ <meta name="twitter:title" content="AIMEAT — AI Memory Exchange and Action Transfer">
24
+ <meta name="twitter:description" content="Open protocol infrastructure for AI agents. Persistent memory, GHII/GAII identity, morsel economy, MCP connector, and federation.">
25
+ <meta name="twitter:image" content="https://aimeat.io/og-image.png">
26
+
27
+ <!-- Schema.org JSON-LD -->
28
+ <script type="application/ld+json">
29
+ {
30
+ "@context": "https://schema.org",
31
+ "@type": "SoftwareApplication",
32
+ "name": "AIMEAT",
33
+ "alternateName": "AI Memory Exchange and Action Transfer",
34
+ "url": "https://aimeat.io",
35
+ "description": "Open protocol infrastructure for AI agents: persistent memory, GHII/GAII identity, morsel economy, consent management, MCP connector, and federation.",
36
+ "applicationCategory": "DeveloperApplication",
37
+ "operatingSystem": "Any",
38
+ "offers": {
39
+ "@type": "Offer",
40
+ "price": "0",
41
+ "priceCurrency": "USD"
42
+ },
43
+ "sameAs": [
44
+ "https://github.com/miikkij/aimeat-protocol"
45
+ ]
46
+ }
47
+ </script>
48
+
49
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
50
+ <link rel="manifest" href="/manifest.json">
51
+ <!-- WebMCP bridge (TARGET-034 phase C): registers node-level tools (commerce feed, node info)
52
+ on document/navigator.modelContext for in-browser agents + readiness scanners. No-op when
53
+ no agent API is present. -->
54
+ <script src="/v1/libs/aimeat-webmcp.js?expose=node" defer></script>
55
+ <meta name="theme-color" content="#FAFAF8">
56
+ <!-- No-flash theme boot: set data-theme on <html> before first paint.
57
+ Plain inline JS (NOT a module — modules defer and reintroduce the flash).
58
+ Unset key = follow OS until the user makes an explicit choice. -->
59
+ <script>
60
+ (function () {
61
+ try {
62
+ var stored = localStorage.getItem('aimeat-theme'); // 'light' | 'dark' | null
63
+ var theme = (stored === 'light' || stored === 'dark')
64
+ ? stored
65
+ : (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
66
+ document.documentElement.dataset.theme = theme;
67
+ } catch (e) {
68
+ document.documentElement.dataset.theme = 'light';
69
+ }
70
+ })();
71
+ </script>
72
+ <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
73
+ <link rel="stylesheet" href="/css/theme.css">
74
+ <!-- Canonical styles for the shared <Markdown> component — load before views so it styles
75
+ rendered markdown everywhere the component is used (no per-view re-definition). -->
76
+ <link rel="stylesheet" href="/css/components/markdown.css">
77
+ <link rel="stylesheet" href="/css/components/contact-picker.css">
78
+ <link rel="stylesheet" href="/css/components/app-sandbox.css">
79
+ <link rel="stylesheet" href="/css/views/app-grant.css">
80
+ <link rel="stylesheet" href="/css/views/invite-accept.css">
81
+ <!-- View CSS preloaded so they are ready before any view renders (prevents FOUC) -->
82
+ <!-- hrefs are stamped with ?v=BUILD_ID at serve time by portal.ts serveSpa() -->
83
+ <link rel="stylesheet" href="/css/views/portal.css">
84
+ <link rel="stylesheet" href="/css/views/landing.css">
85
+ <link rel="stylesheet" href="/css/views/portal-classic.css">
86
+ <link rel="stylesheet" href="/css/views/portal-dev.css">
87
+ <link rel="stylesheet" href="/css/views/profile.css">
88
+ <link rel="stylesheet" href="/css/views/notebook.css">
89
+ <link rel="stylesheet" href="/css/views/living.css">
90
+ <link rel="stylesheet" href="/css/views/offers.css">
91
+ <link rel="stylesheet" href="/css/views/calibrator.css">
92
+ <link rel="stylesheet" href="/css/views/aimeat-os.css">
93
+ <link rel="stylesheet" href="/css/views/portfolio.css">
94
+ <link rel="stylesheet" href="/css/views/members.css">
95
+ <link rel="stylesheet" href="/css/views/inbox.css">
96
+ <link rel="stylesheet" href="/css/components/tags.css">
97
+ <link rel="stylesheet" href="/css/components/image-deliverable.css">
98
+ <link rel="stylesheet" href="/css/views/help.css">
99
+ <link rel="stylesheet" href="/css/views/capabilities.css">
100
+ <link rel="stylesheet" href="/css/views/agents-detail.css">
101
+ <link rel="stylesheet" href="/css/views/scheduler.css">
102
+ <link rel="stylesheet" href="/css/views/workflows.css">
103
+ <link rel="stylesheet" href="/css/views/admin.css">
104
+ <link rel="stylesheet" href="/css/views/admin-agent-integration.css">
105
+ <link rel="stylesheet" href="/css/views/public-knowledge-viewer.css">
106
+ <link rel="stylesheet" href="/css/views/public-workspace-viewer.css">
107
+ <link rel="stylesheet" href="/css/views/start.css">
108
+ <script type="importmap">
109
+ {
110
+ "imports": {
111
+ "preact": "/lib/preact.mjs",
112
+ "preact/hooks": "/lib/preact-hooks.mjs",
113
+ "htm": "/lib/htm.mjs",
114
+ "/js/i18n.js": "/js/i18n.js",
115
+ "/js/swallowed.js": "/js/swallowed.js",
116
+ "/js/site.js": "/js/site.js",
117
+ "/js/theme.js": "/js/theme.js",
118
+ "/js/utils.js": "/js/utils.js",
119
+ "/js/app-sandbox.js": "/js/app-sandbox.js",
120
+ "/js/format.js": "/js/format.js",
121
+ "/js/api.js": "/js/api.js",
122
+ "/js/hooks.js": "/js/hooks.js",
123
+ "/js/recents.js": "/js/recents.js",
124
+ "/js/services/admin.js": "/js/services/admin.js",
125
+ "/js/services/agents.js": "/js/services/agents.js",
126
+ "/js/services/ecosystem.js": "/js/services/ecosystem.js",
127
+ "/js/services/apps.js": "/js/services/apps.js",
128
+ "/js/services/auth.js": "/js/services/auth.js",
129
+ "/js/services/boards.js": "/js/services/boards.js",
130
+ "/js/services/catalogue.js": "/js/services/catalogue.js",
131
+ "/js/services/consent.js": "/js/services/consent.js",
132
+ "/js/services/cortex.js": "/js/services/cortex.js",
133
+ "/js/services/extensions.js": "/js/services/extensions.js",
134
+ "/js/services/federation.js": "/js/services/federation.js",
135
+ "/js/services/calibrator.js": "/js/services/calibrator.js",
136
+ "/views/profile/calibrator-llm-editor.js": "/views/profile/calibrator-llm-editor.js",
137
+ "/views/profile/calibrator-chart.js": "/views/profile/calibrator-chart.js",
138
+ "/views/profile/calibrator-batch.js": "/views/profile/calibrator-batch.js",
139
+ "/js/services/knowledge.js": "/js/services/knowledge.js",
140
+ "/js/services/living.js": "/js/services/living.js",
141
+ "/js/services/skills.js": "/js/services/skills.js",
142
+ "/js/services/memory.js": "/js/services/memory.js",
143
+ "/js/services/notebook.js": "/js/services/notebook.js",
144
+ "/js/services/notebook-plan.js": "/js/services/notebook-plan.js",
145
+ "/js/services/nodes.js": "/js/services/nodes.js",
146
+ "/js/services/organisms.js": "/js/services/organisms.js",
147
+ "/js/services/offers.js": "/js/services/offers.js",
148
+ "/js/services/offers-grouping.js": "/js/services/offers-grouping.js",
149
+ "/js/services/packages.js": "/js/services/packages.js",
150
+ "/js/services/security.js": "/js/services/security.js",
151
+ "/js/services/stats.js": "/js/services/stats.js",
152
+ "/js/services/appdev.js": "/js/services/appdev.js",
153
+ "/js/services/wallet.js": "/js/services/wallet.js",
154
+ "/js/services/work.js": "/js/services/work.js",
155
+ "/js/services/messages.js": "/js/services/messages.js",
156
+ "/js/services/messages-ai-prompts.js": "/js/services/messages-ai-prompts.js",
157
+ "/js/services/unfurl.js": "/js/services/unfurl.js",
158
+ "/js/services/tracked-responses.js": "/js/services/tracked-responses.js",
159
+ "/js/services/presence.js": "/js/services/presence.js",
160
+ "/js/presence-store.js": "/js/presence-store.js",
161
+ "/js/components/auth-image.js": "/js/components/auth-image.js",
162
+ "/js/components/tag-cloud.js": "/js/components/tag-cloud.js",
163
+ "/js/components/tag-editor.js": "/js/components/tag-editor.js",
164
+ "/components/Modal.js": "/components/Modal.js",
165
+ "/components/useViewCSS.js": "/components/useViewCSS.js",
166
+ "/components/Markdown.js": "/components/Markdown.js",
167
+ "/components/LinkPreview.js": "/components/LinkPreview.js",
168
+ "/components/InboxLink.js": "/components/InboxLink.js",
169
+ "/components/JsonView.js": "/components/JsonView.js",
170
+ "/components/ImageDeliverable.js": "/components/ImageDeliverable.js",
171
+ "/components/offer-card-view.js": "/components/offer-card-view.js",
172
+ "/components/Mermaid.js": "/components/Mermaid.js",
173
+ "/components/NotificationBell.js": "/components/NotificationBell.js",
174
+ "/components/CopyButton.js": "/components/CopyButton.js",
175
+ "/components/Toast.js": "/components/Toast.js",
176
+ "/components/ContactCard.js": "/components/ContactCard.js",
177
+ "/components/Spinner.js": "/components/Spinner.js",
178
+ "/components/EmptyState.js": "/components/EmptyState.js",
179
+ "/components/ToggleSwitch.js": "/components/ToggleSwitch.js",
180
+ "/components/Card.js": "/components/Card.js",
181
+ "/components/StatusDot.js": "/components/StatusDot.js",
182
+ "/components/PresenceDot.js": "/components/PresenceDot.js",
183
+ "/components/TagList.js": "/components/TagList.js",
184
+ "/components/Pagination.js": "/components/Pagination.js",
185
+ "/components/KeyValueRow.js": "/components/KeyValueRow.js",
186
+ "/components/SearchBar.js": "/components/SearchBar.js",
187
+ "/components/DataTable.js": "/components/DataTable.js",
188
+ "/components/Collapsible.js": "/components/Collapsible.js",
189
+ "/components/UsageChart.js": "/components/UsageChart.js",
190
+ "/lib/live-updates.js": "/lib/live-updates.js",
191
+ "/lib/minidenticons.min.js": "/lib/minidenticons.min.js",
192
+ "/lib/yaml.mjs": "/lib/yaml.mjs",
193
+ "/views/profile/agents-tasks-subtab.js": "/views/profile/agents-tasks-subtab.js",
194
+ "/js/services/agent-tasks.js": "/js/services/agent-tasks.js",
195
+ "/js/services/agent-directives.js": "/js/services/agent-directives.js",
196
+ "/js/services/agent-capabilities.js": "/js/services/agent-capabilities.js",
197
+ "/views/profile/agents-capabilities-subtab.js": "/views/profile/agents-capabilities-subtab.js",
198
+ "/js/services/sharing-groups.js": "/js/services/sharing-groups.js",
199
+ "/js/services/agent-activity.js": "/js/services/agent-activity.js",
200
+ "/js/services/ledger.js": "/js/services/ledger.js",
201
+ "/views/profile/agents-activity-subtab.js": "/views/profile/agents-activity-subtab.js",
202
+ "/views/profile/agents-services-subtab.js": "/views/profile/agents-services-subtab.js",
203
+ "/views/profile/agents-messages-subtab.js": "/views/profile/agents-messages-subtab.js",
204
+ "/js/services/agent-services.js": "/js/services/agent-services.js",
205
+ "/js/services/agent-messages.js": "/js/services/agent-messages.js",
206
+ "/js/services/agent-integration.js": "/js/services/agent-integration.js",
207
+ "/js/services/admin-agent-integration.js": "/js/services/admin-agent-integration.js",
208
+ "/js/services/schedules.js": "/js/services/schedules.js",
209
+ "/js/services/workflows.js": "/js/services/workflows.js",
210
+ "/views/profile/shared.js": "/views/profile/shared.js",
211
+ "/views/profile/openrouter-settings.js": "/views/profile/openrouter-settings.js",
212
+ "/views/profile/organisms/helpers.js": "/views/profile/organisms/helpers.js",
213
+ "/views/profile/organisms/widgets.js": "/views/profile/organisms/widgets.js",
214
+ "/views/profile/organisms/panels.js": "/views/profile/organisms/panels.js",
215
+ "/views/profile/organisms/agents.js": "/views/profile/organisms/agents.js",
216
+ "/views/profile/organisms/members.js": "/views/profile/organisms/members.js",
217
+ "/views/profile/organisms/invite-panel.js": "/views/profile/organisms/invite-panel.js",
218
+ "/js/services/contacts.js": "/js/services/contacts.js",
219
+ "/components/ContactPicker.js": "/components/ContactPicker.js",
220
+ "/views/profile/organisms/home.js": "/views/profile/organisms/home.js",
221
+ "/views/profile/organisms/workspace-list.js": "/views/profile/organisms/workspace-list.js",
222
+ "/views/profile/organisms/workspace.js": "/views/profile/organisms/workspace.js",
223
+ "/views/profile/organisms/activity-panel.js": "/views/profile/organisms/activity-panel.js",
224
+ "/views/profile/organisms/participants-panel.js": "/views/profile/organisms/participants-panel.js",
225
+ "/views/profile/organisms/workspace-comments.js": "/views/profile/organisms/workspace-comments.js",
226
+ "/views/profile/organisms/sources-panel.js": "/views/profile/organisms/sources-panel.js",
227
+ "/views/profile/organisms/skills-panel.js": "/views/profile/organisms/skills-panel.js",
228
+ "/views/profile/skills-tab.js": "/views/profile/skills-tab.js",
229
+ "/views/profile/organisms/workspace-apps.js": "/views/profile/organisms/workspace-apps.js",
230
+ "/views/profile/organisms/schema-form.js": "/views/profile/organisms/schema-form.js",
231
+ "/views/profile/organisms/document.js": "/views/profile/organisms/document.js",
232
+ "/views/command-palette.js": "/views/command-palette.js",
233
+ "/views/profile/organisms/mindmap.js": "/views/profile/organisms/mindmap.js",
234
+ "/views/profile/organisms/readme-panel.js": "/views/profile/organisms/readme-panel.js",
235
+ "/views/profile/organisms/timeline-panel.js": "/views/profile/organisms/timeline-panel.js"
236
+ }
237
+ }
238
+ </script>
239
+ </head>
240
+ <body>
241
+ <!-- Background -->
242
+ <div class="bg-canvas" id="bgCanvas"></div>
243
+
244
+ <!-- Static H1 for crawlers — visually hidden, SPA renders the real UI -->
245
+ <h1 class="visually-hidden">AIMEAT — AI Memory Exchange and Action Transfer. Open protocol for AI agents: persistent memory, identity, app generation, and federated node networks.</h1>
246
+
247
+ <!-- App root (Preact mounts here) -->
248
+ <div id="app"></div>
249
+
250
+ <!-- SSO handoff: the desktop app already holds an authenticated owner JWT (from its inline
251
+ sign-in). It opens the portal with #handoff=<base64({owner,jwt})> so the browser is logged
252
+ in WITHOUT a second sign-in. Runs synchronously before the app reads the session. -->
253
+ <script>
254
+ (function () {
255
+ try {
256
+ var m = location.hash.match(/[#&]handoff=([^&]+)/);
257
+ if (!m) return;
258
+ var s = JSON.parse(atob(decodeURIComponent(m[1])));
259
+ if (s && s.jwt && s.owner) {
260
+ var node = '';
261
+ try { node = (JSON.parse(atob(s.jwt.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))) || {}).node || ''; } catch (e) {}
262
+ localStorage.setItem('aimeat_session', JSON.stringify({
263
+ owner: s.owner, jwt: s.jwt, ghii: node ? (s.owner + '@' + node) : null, gaii: null,
264
+ }));
265
+ }
266
+ // Strip the token from the URL so it is not bookmarked or left in history.
267
+ history.replaceState(null, '', location.pathname + location.search);
268
+ } catch (e) { /* ignore a malformed handoff */ }
269
+ })();
270
+ </script>
271
+
272
+ <script type="module">
273
+ import { h, render, Component } from 'preact';
274
+ import { useState, useEffect, useCallback, useRef } from 'preact/hooks';
275
+ import htm from 'htm';
276
+ import { loadTranslations, t, getLocale, switchLocale, onLocaleChange } from '/js/i18n.js';
277
+ import { initThemeSystem } from '/js/theme.js';
278
+ import { siteLink } from '/js/site.js';
279
+ import { NotificationBell, openNotificationLink } from '/components/NotificationBell.js';
280
+ import { CommandPalette } from '/views/command-palette.js';
281
+ import { openAppSandboxed, isAppHtmlUrl } from '/js/app-sandbox.js';
282
+ // generateStars no longer needed for light theme
283
+
284
+ const html = htm.bind(h);
285
+
286
+ // ── Notification cold-open deep link ──
287
+ // A push-notification click can open '/v1/profile?tab=messages#inbox/<conversationId>' (or
288
+ // the bell's '#<tab>[/<rest>]' hash form) in a fresh window. Prime the landing page's
289
+ // sessionStorage contract ({tabId, slot} JSON landing-page.js openView init) BEFORE the
290
+ // view mounts, plus the inbox thread key that inbox-tab.js consumes on mount. Overwriting the
291
+ // saved tab matters: landing-page prefers sessionStorage over ?tab=, so a stale value from
292
+ // earlier browsing would otherwise beat the deep link in a reused browser tab.
293
+ (() => {
294
+ if (location.pathname !== '/v1/profile') return;
295
+ const m = /^#([a-z]+)(?:\/(.+))?$/i.exec(location.hash || '');
296
+ const rawTab = new URLSearchParams(location.search).get('tab') || (m ? m[1] : '');
297
+ if (!rawTab) return;
298
+ const tabId = rawTab.toLowerCase() === 'inbox' ? 'messages' : rawTab;
299
+ try {
300
+ sessionStorage.setItem('aimeat-profile-tab', JSON.stringify({ tabId, slot: 'main' }));
301
+ if (tabId === 'messages' && m && m[2]) sessionStorage.setItem('aimeat.inbox.open', m[2]);
302
+ } catch { /* private mode ?tab= still lands the tab */ }
303
+ })();
304
+
305
+ // ── Error Boundary ──
306
+ class ErrorBoundary extends Component {
307
+ constructor(props) {
308
+ super(props);
309
+ this.state = { error: null };
310
+ }
311
+ static getDerivedStateFromError(error) {
312
+ return { error };
313
+ }
314
+ componentDidCatch(error, info) {
315
+ console.error('View render error:', error, info);
316
+ }
317
+ render() {
318
+ if (this.state.error) {
319
+ const retry = () => {
320
+ this.setState({ error: null });
321
+ if (this.props.onRetry) this.props.onRetry();
322
+ };
323
+ return html`
324
+ <div style="text-align:center; padding:3rem 1.5rem; color:var(--text-dim,#888);">
325
+ <h2 style="color:var(--text-bright,#fff); margin-bottom:0.5rem;">${t('common.somethingWentWrong')}</h2>
326
+ <p style="margin-bottom:1rem; font-size:0.9rem;">${this.state.error?.message || 'Unknown error'}</p>
327
+ <button class="btn-primary" onClick=${retry} style="animation:none;">${t('common.retry')}</button>
328
+ </div>
329
+ `;
330
+ }
331
+ return this.props.children;
332
+ }
333
+ }
334
+
335
+ // ── Route definitions ──
336
+ // window.__B is injected by the server as "?v=BUILD_ID" to bust the browser's
337
+ // ES module cache on every server restart (HTTP no-cache/ETag alone is
338
+ // insufficient modules stay in the module registry for the full session).
339
+ const B = window.__B || '';
340
+ const ROUTES = {
341
+ // Landing/portal split (2026-06-10): the route serves the logged-out landing;
342
+ // logged-in visitors are forwarded to /v1/profile by the view itself. The old
343
+ // portal view stays reachable at /v1/classic (prompt boxes / "Build").
344
+ '/v1/portal': () => import('/views/landing.js' + B),
345
+ '/v1/pricing': () => import('/views/pricing.js' + B),
346
+ '/v1/start': () => import('/views/start.js' + B),
347
+ '/v1/how-it-works': () => import('/views/how-it-works.js' + B),
348
+ '/v1/business': () => import('/views/business.js' + B),
349
+ '/v1/profile': () => import('/views/profile.js' + B),
350
+ '/v1/app-grant': () => import('/views/app-grant.js' + B),
351
+ '/v1/invite': () => import('/views/invite-accept.js' + B),
352
+ '/v1/aimeat-os': () => import('/views/aimeat-os.js' + B),
353
+ '/v1/classic': () => import('/views/portal-classic.js' + B),
354
+ '/v1/portfolio': () => import('/views/portfolio.js' + B),
355
+ '/v1/members': () => import('/views/members.js' + B),
356
+ '/v1/admin': () => import('/views/admin.js' + B),
357
+ '/v1/help': () => import('/views/help.js' + B),
358
+ '/v1/publicknowledgeviewer': () => import('/views/public-knowledge-viewer.js' + B),
359
+ '/v1/publicworkspaceviewer': () => import('/views/public-workspace-viewer.js' + B),
360
+ };
361
+
362
+ // Match route, handling query params for special views
363
+ function matchRoute(pathname, search) {
364
+ // Dev portal is ?view=dev on /v1/portal
365
+ if (pathname === '/v1/portal' && search.includes('view=dev')) {
366
+ return () => import('/views/portal-dev.js' + B);
367
+ }
368
+ // Single-agent pop-out window: /v1/profile?solo=<agentName>
369
+ if (pathname === '/v1/profile' && /[?&]solo=/.test(search)) {
370
+ return () => import('/views/agent-solo.js' + B);
371
+ }
372
+ // Single-document pop-out window: /v1/profile?doc=<org>:<ws>:<type>:<id>
373
+ if (pathname === '/v1/profile' && /[?&]doc=/.test(search)) {
374
+ return () => import('/views/doc-solo.js' + B);
375
+ }
376
+ // Portfolio public view: /v1/portfolio/<username>
377
+ if (pathname.startsWith('/v1/portfolio/') && pathname !== '/v1/portfolio/') {
378
+ return () => import('/views/portfolio.js' + B);
379
+ }
380
+ return ROUTES[pathname] || ROUTES['/v1/portal'];
381
+ }
382
+
383
+ // ── App Component ──
384
+ function App() {
385
+ const [View, setView] = useState(null);
386
+ const [viewError, setViewError] = useState(null);
387
+ const [locale, setLocale] = useState(getLocale());
388
+
389
+ // Navigate to a route
390
+ const navigate = useCallback(async (path, replace = false) => {
391
+ const url = new URL(path, window.location.origin);
392
+ const loader = matchRoute(url.pathname, url.search);
393
+
394
+ if (replace) {
395
+ history.replaceState(null, '', path);
396
+ } else {
397
+ history.pushState(null, '', path);
398
+ }
399
+
400
+ try {
401
+ setViewError(null);
402
+ const mod = await loader();
403
+ setView(() => mod.default);
404
+ } catch (err) {
405
+ console.error('Failed to load view:', err);
406
+ setViewError(err);
407
+ setView(null);
408
+ }
409
+ }, []);
410
+
411
+ // Push-notification interactions on an already-open window. The service worker (sw.js) focuses
412
+ // this window and posts either:
413
+ // - 'aimeat-notification-click': the notification's target URL → deep-link it in place.
414
+ // - 'aimeat-notification-action': an action button was pressed. A lock screen can't hold the
415
+ // JWT, so the SW hands the action here to run with the owner's session. An 'api' action
416
+ // (approve/deny/accept/decline) executes directly; 'reply'/'navigate' just deep-link so the
417
+ // owner completes it in the SPA (a reply needs text we can't compose from a button).
418
+ useEffect(() => {
419
+ if (!('serviceWorker' in navigator)) return undefined;
420
+ const onSwMessage = async (e) => {
421
+ const d = e.data;
422
+ if (!d) return;
423
+ if (d.type === 'aimeat-notification-click' && d.url) { openNotificationLink(d.url, navigate); return; }
424
+ if (d.type === 'aimeat-notification-action' && d.action) {
425
+ const a = d.action;
426
+ if (a.kind === 'api' && a.endpoint) {
427
+ try {
428
+ const jwt = window.AIMEAT?.auth?.getSession?.()?.jwt;
429
+ if (jwt) {
430
+ await fetch(a.endpoint, {
431
+ method: a.method || 'POST',
432
+ headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + jwt },
433
+ body: a.body ? JSON.stringify(a.body) : undefined,
434
+ });
435
+ window.dispatchEvent(new CustomEvent('aimeat-live-update'));
436
+ }
437
+ } catch { /* best-effort; the target view still shows the current state */ }
438
+ }
439
+ // Land the owner on the notification's target so the result is visible in context.
440
+ if (d.url) openNotificationLink(d.url, navigate);
441
+ }
442
+ };
443
+ navigator.serviceWorker.addEventListener('message', onSwMessage);
444
+ return () => navigator.serviceWorker.removeEventListener('message', onSwMessage);
445
+ }, [navigate]);
446
+
447
+ // Initial load + popstate
448
+ useEffect(() => {
449
+ // Load initial route
450
+ const path = location.pathname + location.search;
451
+ navigate(path, true);
452
+
453
+ // Handle back/forward
454
+ const onPopState = () => {
455
+ const loader = matchRoute(location.pathname, location.search);
456
+ loader().then(mod => {
457
+ setViewError(null);
458
+ setView(() => mod.default);
459
+ }).catch(err => {
460
+ console.error('Popstate view load failed:', err);
461
+ setViewError(err);
462
+ setView(null);
463
+ });
464
+ };
465
+ window.addEventListener('popstate', onPopState);
466
+
467
+ // Intercept internal link clicks for SPA navigation
468
+ const onClick = (e) => {
469
+ const a = e.target.closest('a[href]');
470
+ if (!a) return;
471
+ const href = a.getAttribute('href');
472
+ // H-2: a published-app HTML link must NEVER open as a top-level document on the
473
+ // apex origin (same origin as this authenticated SPA) — it could read the
474
+ // visitor's session. Force it into a sandboxed, opaque-origin iframe instead,
475
+ // regardless of target=_blank / modifier keys.
476
+ if (isAppHtmlUrl(href)) {
477
+ e.preventDefault();
478
+ const label = (a.textContent || '').trim() || 'App';
479
+ openAppSandboxed(href, label);
480
+ return;
481
+ }
482
+ // Only intercept internal /v1/ links
483
+ if (!href || !href.startsWith('/v1/')) return;
484
+ if (e.ctrlKey || e.metaKey || e.shiftKey) return;
485
+ // Respect explicit new-tab / new-window targets — without this, an
486
+ // <a href="/v1/apps/.../launch?mode=inline" target="_blank"> from a
487
+ // child component would be hijacked, navigated in the same tab via
488
+ // matchRoute (which doesn't know /v1/apps/...), and dump the user
489
+ // back on the landing page.
490
+ const target = a.getAttribute('target');
491
+ if (target && target !== '_self' && target !== '') return;
492
+ if (a.hasAttribute('download')) return;
493
+ e.preventDefault();
494
+ navigate(href);
495
+ };
496
+ document.addEventListener('click', onClick);
497
+
498
+ return () => {
499
+ window.removeEventListener('popstate', onPopState);
500
+ document.removeEventListener('click', onClick);
501
+ };
502
+ }, [navigate]);
503
+
504
+ // Listen for locale changes
505
+ useEffect(() => {
506
+ return onLocaleChange((loc) => setLocale(loc));
507
+ }, []);
508
+
509
+ const retryView = useCallback(() => {
510
+ navigate(location.pathname + location.search, true);
511
+ }, [navigate]);
512
+
513
+ return html`
514
+ <${Header} navigate=${navigate} locale=${locale} />
515
+ <${CommandPalette} navigate=${navigate} />
516
+ <div class="page-content">
517
+ ${viewError
518
+ ? html`<div style="text-align:center; padding:3rem 1.5rem; color:var(--text-dim,#888);">
519
+ <h2 style="color:var(--text-bright,#fff); margin-bottom:0.5rem;">Failed to load page</h2>
520
+ <p style="margin-bottom:1rem; font-size:0.9rem;">${viewError.message || 'Network error'}</p>
521
+ <button class="btn-primary" onClick=${retryView} style="animation:none;">Retry</button>
522
+ </div>`
523
+ : View
524
+ ? html`<${ErrorBoundary} onRetry=${retryView}><${View} navigate=${navigate} locale=${locale} /></${ErrorBoundary}>`
525
+ : html`<div class="empty"><div class="spinner"></div></div>`
526
+ }
527
+ </div>
528
+ `;
529
+ }
530
+
531
+ // ── Theme Toggle ──
532
+ // The light/dark switch now lives INSIDE the golden login pill (served by libs.ts →
533
+ // mountLoginButton) so every app embedding the pill inherits it for free. theme.js still
534
+ // runs (initThemeSystem) to track OS preference and adopt the pill's theme changes.
535
+
536
+ // ── Header Component ──
537
+ // Built-in public links. Operators can show/hide and reorder these via the admin
538
+ // Portal tab (persisted at /v1/site/header-nav). Auth/role-gated links (Apps, Profile,
539
+ // Admin) are NOT in this list — they stay forced by the session/role checks below.
540
+ // There is no Companies or My Company link because there is no company object any more
541
+ // (removed 2026-07-28). Doing business on AIMEAT means standing up a node and running the
542
+ // company on it: one concept instead of two, and it works the same for every shape of
543
+ // organisation. A profile, an organism and the node's own operator identity carry what the
544
+ // separate object used to.
545
+ //
546
+ // `siteKey` entries are apps that belong to THIS node's operator, not protocol surfaces.
547
+ // They render only when the node configured a URL for them (AIMEAT_SITE_* → window.__SITE),
548
+ // so a fresh clone gets a nav without them instead of links into somebody else's apps.
549
+ const PUBLIC_NAV_LINKS = [
550
+ { id: 'try', path: '/v1/portal', key: 'nav.try' },
551
+ { id: 'howItWorks', path: '/v1/how-it-works', key: 'nav.howItWorks', fallback: 'How it works' },
552
+ { id: 'learn', siteKey: 'learn', key: 'nav.learn', fallback: 'Learn', external: true },
553
+ { id: 'exchange', siteKey: 'exchange', key: 'nav.exchange', fallback: 'EXCHANGE', external: true },
554
+ { id: 'business', path: '/v1/business', key: 'nav.business', fallback: 'For your business' },
555
+ { id: 'members', path: '/v1/members', key: 'nav.members', fallback: 'Members' },
556
+ { id: 'devView', path: '/v1/portal?view=dev', key: 'nav.devView', matchActive: false },
557
+ { id: 'help', path: '/v1/help', key: 'nav.help' },
558
+ ];
559
+
560
+ /**
561
+ * Reconcile the operator's saved nav order with the links this build declares.
562
+ *
563
+ * A saved order predates every link added since the operator last touched the Portal tab,
564
+ * so shipping a nav item would otherwise be invisible on every node that has ever saved
565
+ * one. Keep the operator's arrangement for the ids they know about, and slot each newcomer
566
+ * next to the neighbour it is declared beside — appending them all to the end would bury
567
+ * "Learn" and "EXCHANGE" behind "Help".
568
+ */
569
+ function mergeNavOrder(stored) {
570
+ const known = new Set(stored);
571
+ const order = stored.slice();
572
+ let anchor = -1; // index in `order` of the last declared link we have placed
573
+ for (const link of PUBLIC_NAV_LINKS) {
574
+ const at = order.indexOf(link.id);
575
+ if (at !== -1) { anchor = at; continue; }
576
+ if (known.has(link.id)) continue;
577
+ anchor = anchor === -1 ? 0 : anchor + 1;
578
+ order.splice(anchor, 0, link.id);
579
+ known.add(link.id);
580
+ }
581
+ return order;
582
+ }
583
+
584
+ function Header({ navigate, locale }) {
585
+ const [session, setSession] = useState(null);
586
+ const [morsels, setMorsels] = useState(null);
587
+ const [menuOpen, setMenuOpen] = useState(false);
588
+ const [meOpen, setMeOpen] = useState(false);
589
+ const navRef = useRef(null);
590
+ const meRef = useRef(null);
591
+ // Node feature flags from /v1/site/header-nav. Empty until the fetch resolves,
592
+ // so optional surfaces stay hidden until we positively learn they're enabled (no flash).
593
+ const [features, setFeatures] = useState({});
594
+ // Header nav config: { order, hidden }. Defaults to all visible in declared order
595
+ // until the public /v1/site/header-nav fetch resolves (no flash of empty nav).
596
+ const [navConfig, setNavConfig] = useState({ order: PUBLIC_NAV_LINKS.map(l => l.id), hidden: [] });
597
+
598
+ // Check auth state
599
+ useEffect(() => {
600
+ const checkAuth = () => {
601
+ if (window.AIMEAT?.auth?.hasSession) {
602
+ const s = window.AIMEAT.auth.getSession();
603
+ setSession(s);
604
+ } else {
605
+ setSession(null);
606
+ }
607
+ };
608
+ checkAuth();
609
+ // Re-check when auth lib fires events
610
+ window.addEventListener('aimeat-auth-change', checkAuth);
611
+ return () => window.removeEventListener('aimeat-auth-change', checkAuth);
612
+ }, []);
613
+
614
+ // Collapse to the hamburger by MEASUREMENT, not by a guessed pixel width.
615
+ //
616
+ // How much room the bar needs depends on state, not just on the screen: signing in adds
617
+ // the Me button, a notification bell and a wide gold pill, and an operator adds Admin
618
+ // inside Me. A fixed breakpoint cannot know any of that, which is how a 2000px window
619
+ // ended up with the nav hanging out underneath a 56px-tall bar.
620
+ //
621
+ // The test has to run with the bar EXPANDED (a collapsed bar always "fits"), so it drops
622
+ // the class, measures, and puts it back in the same frame — no paint happens in between.
623
+ useEffect(() => {
624
+ const nav = navRef.current;
625
+ if (!nav || typeof ResizeObserver === 'undefined') return undefined;
626
+ let raf = 0;
627
+ const measure = () => {
628
+ raf = 0;
629
+ const wasCompact = nav.classList.contains('topnav--compact');
630
+ if (wasCompact) nav.classList.remove('topnav--compact');
631
+ const overflows = nav.scrollWidth > nav.clientWidth + 1;
632
+ nav.classList.toggle('topnav--compact', overflows);
633
+ if (overflows !== wasCompact && !overflows) setMenuOpen(false);
634
+ };
635
+ const schedule = () => { if (!raf) raf = requestAnimationFrame(measure); };
636
+ const ro = new ResizeObserver(schedule);
637
+ ro.observe(nav);
638
+ schedule();
639
+ window.addEventListener('resize', schedule);
640
+ return () => { ro.disconnect(); window.removeEventListener('resize', schedule); if (raf) cancelAnimationFrame(raf); };
641
+ // Re-measures whenever the bar's contents change: signing in, the operator's Admin
642
+ // link appearing, a different nav config arriving, or the language switching.
643
+ }, [session, locale, navConfig, morsels]);
644
+
645
+ // Close the Me dropdown on an outside click, the way every other menu on the page behaves.
646
+ useEffect(() => {
647
+ if (!meOpen) return undefined;
648
+ const onDown = (e) => { if (meRef.current && !meRef.current.contains(e.target)) setMeOpen(false); };
649
+ const onKey = (e) => { if (e.key === 'Escape') setMeOpen(false); };
650
+ document.addEventListener('pointerdown', onDown);
651
+ document.addEventListener('keydown', onKey);
652
+ return () => { document.removeEventListener('pointerdown', onDown); document.removeEventListener('keydown', onKey); };
653
+ }, [meOpen]);
654
+
655
+ // Load operator-configured header nav (public endpoint, no auth needed).
656
+ useEffect(() => {
657
+ let cancelled = false;
658
+ fetch('/v1/site/header-nav')
659
+ .then(r => r.json())
660
+ .then(d => {
661
+ if (cancelled || !d?.ok || !d.data) return;
662
+ const stored = Array.isArray(d.data.order) ? d.data.order : PUBLIC_NAV_LINKS.map(l => l.id);
663
+ const hidden = Array.isArray(d.data.hidden) ? d.data.hidden : [];
664
+ setNavConfig({ order: mergeNavOrder(stored), hidden });
665
+ setFeatures(d.data.features || {});
666
+ })
667
+ .catch(e => console.warn('Header nav fetch failed:', e.message));
668
+ return () => { cancelled = true; };
669
+ }, []);
670
+
671
+ // Fetch morsels when session is available
672
+ useEffect(() => {
673
+ if (!session) { setMorsels(null); return; }
674
+ fetch('/v1/wallet', {
675
+ headers: { 'Authorization': 'Bearer ' + session.jwt }
676
+ })
677
+ .then(r => r.json())
678
+ .then(d => { if (d.ok) setMorsels(d.data?.balance ?? null); })
679
+ .catch(e => console.warn('Wallet fetch failed:', e.message));
680
+ }, [session]);
681
+
682
+ const handleLangSwitch = (lang) => {
683
+ switchLocale(lang);
684
+ };
685
+
686
+ const handleNav = (e, path) => {
687
+ e.preventDefault();
688
+ // Mark in-app navigation: the landing redirects logged-in users to their Home
689
+ // ONLY on direct arrival (bookmark/external link), never when they deliberately
690
+ // navigated here from inside the app (e.g. the brand link).
691
+ try { sessionStorage.setItem('aimeat.in-app', '1'); } catch {}
692
+ navigate(path);
693
+ };
694
+
695
+ const currentPath = location.pathname;
696
+
697
+ // Resolve the public links to render: config order, minus hidden, by declared id.
698
+ const linkById = Object.fromEntries(PUBLIC_NAV_LINKS.map(l => [l.id, l]));
699
+ const hiddenSet = new Set(navConfig.hidden);
700
+ // Operator-owned apps (siteKey) resolve their href from window.__SITE and drop out of
701
+ // the nav entirely when this node has not configured one.
702
+ const visibleLinks = navConfig.order
703
+ .map(id => linkById[id])
704
+ .filter(l => l && !hiddenSet.has(l.id))
705
+ .map(l => (l.siteKey ? { ...l, path: siteLink(l.siteKey) } : l))
706
+ .filter(l => l.path);
707
+
708
+ return html`
709
+ <nav class="topnav" ref=${navRef}>
710
+ <div style="display:flex;align-items:center;gap:20px">
711
+ <a href="/v1/portal" class="topnav-brand" onClick=${(e) => handleNav(e, '/v1/portal')}>
712
+ AIME<span class="heart">\u2665</span><span class="brand-at">AT</span>
713
+ </a>
714
+ ${morsels !== null && html`<span class="brand-morsels" style="display:inline-flex">${morsels}</span>`}
715
+ </div>
716
+
717
+ <div class="topnav-right">
718
+ <button class="topnav-burger" aria-label="Menu" aria-expanded=${menuOpen ? 'true' : 'false'}
719
+ onClick=${() => setMenuOpen(o => !o)}>☰</button>
720
+ <div class="topnav-menu ${menuOpen ? 'open' : ''}">
721
+ <!-- Public links are operator-configurable (visibility + order) via the admin
722
+ Portal tab. "Try it" leads to the landing's path cards + app gallery.
723
+ Classic stays reachable deeper (landing card B "Start building"). -->
724
+ ${visibleLinks.map(link => (link.external
725
+ ? html`
726
+ <a href="${link.path}" key=${link.id} target="_blank" rel="noopener"
727
+ onClick=${() => setMenuOpen(false)}>${t(link.key) || link.fallback || link.key}</a>
728
+ `
729
+ : html`
730
+ <a href="${link.path}" key=${link.id}
731
+ onClick=${(e) => { handleNav(e, link.path); setMenuOpen(false); }}
732
+ class="${link.matchActive !== false && currentPath === link.path ? 'active' : ''}">${t(link.key) || link.fallback || link.key}</a>
733
+ `))}
734
+ <!-- Signing in used to append four more top-level links (Apps, Profile, My
735
+ Company, Admin) next to a bell and a wide gold pill, which is what pushed
736
+ the bar past its width even on a 2000px screen. They live behind one "Me"
737
+ button now; inside the burger sheet the button disappears and the links
738
+ simply join the list. -->
739
+ ${session && html`
740
+ <div class="topnav-me" ref=${meRef}>
741
+ <button type="button" class="topnav-me-btn" aria-haspopup="true" aria-expanded=${meOpen ? 'true' : 'false'}
742
+ onClick=${() => setMeOpen(o => !o)}>${t('nav.me') || 'Me'}<span class="chev">▾</span></button>
743
+ <div class="topnav-me-menu ${meOpen ? 'open' : ''}">
744
+ <a href="/app-catalog.html" target="_blank" onClick=${() => { setMeOpen(false); setMenuOpen(false); }} class="${currentPath === '/app-catalog.html' ? 'active' : ''}">${t('nav.apps') || 'Apps'}</a>
745
+ <a href="/v1/profile" class="profile-link visible ${currentPath === '/v1/profile' ? 'active' : ''}" onClick=${(e) => { handleNav(e, '/v1/profile'); setMeOpen(false); setMenuOpen(false); }}>
746
+ ${t('nav.profile')}
747
+ </a>
748
+ ${session.roles && session.roles.includes('operator') && html`
749
+ <a href="/v1/admin" class="${currentPath === '/v1/admin' ? 'active' : ''}" onClick=${(e) => { handleNav(e, '/v1/admin'); setMeOpen(false); setMenuOpen(false); }}>
750
+ ${t('nav.admin')}
751
+ </a>
752
+ `}
753
+ </div>
754
+ </div>
755
+ `}
756
+ <div class="topnav-center">
757
+ <button class="lang-btn ${locale === 'en' ? 'active' : ''}" onClick=${() => handleLangSwitch('en')}>EN</button>
758
+ <button class="lang-btn ${locale === 'fi' ? 'active' : ''}" onClick=${() => handleLangSwitch('fi')}>FI</button>
759
+ </div>
760
+ </div>
761
+ ${session && html`<${NotificationBell} t=${t} onNavigate=${(p) => navigate(p)} />`}
762
+ <span class="header-auth-slot" id="headerAuth"></span>
763
+ </div>
764
+ </nav>
765
+ `;
766
+ }
767
+
768
+ // ── Bootstrap ──
769
+ async function boot() {
770
+ // Load translations
771
+ await loadTranslations();
772
+
773
+ // Initialize theme system (head snippet already set the initial theme;
774
+ // this keeps meta in sync and tracks OS preference until an explicit choice).
775
+ initThemeSystem();
776
+
777
+ // Load auth library (served from /v1/libs/aimeat-auth.js)
778
+ await new Promise((resolve) => {
779
+ const script = document.createElement('script');
780
+ script.src = '/v1/libs/aimeat-auth.js';
781
+ script.onload = resolve;
782
+ script.onerror = resolve; // Continue even if auth fails
783
+ document.head.appendChild(script);
784
+ });
785
+
786
+ // Restore session from localStorage (critical for Ctrl+F5 / page reload)
787
+ if (window.AIMEAT?.auth?.login) {
788
+ try { await window.AIMEAT.auth.login(); } catch (_) {}
789
+ }
790
+
791
+ // Listen for session expiry — show notification and trigger re-login
792
+ if (window.AIMEAT?.auth?.on) {
793
+ window.AIMEAT.auth.on('expired', () => {
794
+ console.warn('[aimeat] Session expired — attempting re-login');
795
+ window.dispatchEvent(new Event('aimeat-auth-change'));
796
+ // Try silent re-login from stored credentials
797
+ if (window.AIMEAT.auth.login) {
798
+ window.AIMEAT.auth.login().then(session => {
799
+ if (session) {
800
+ window.dispatchEvent(new Event('aimeat-auth-change'));
801
+ } else {
802
+ // Show login UI if silent re-login fails
803
+ window.dispatchEvent(new CustomEvent('aimeat-session-expired'));
804
+ }
805
+ }).catch(() => {
806
+ window.dispatchEvent(new CustomEvent('aimeat-session-expired'));
807
+ });
808
+ }
809
+ });
810
+ }
811
+
812
+ // Mount Preact app
813
+ render(html`<${App} />`, document.getElementById('app'));
814
+
815
+ // Build i18n object for auth widget from modal.* translations
816
+ function authI18n() {
817
+ const keys = [
818
+ 'descNew', 'descReturning', 'usernameLabel', 'usernamePlaceholder',
819
+ 'passwordLabel', 'passwordPlaceholder', 'displayNameLabel', 'displayNameHint',
820
+ 'displayNamePlaceholder', 'signInBtn', 'cancelBtn', 'orLabel', 'googleSignIn', 'working',
821
+ 'errUserShort', 'errPassShort', 'errWrongPass', 'loggedIn', 'logoutBtn',
822
+ 'forgotPassword', 'forgotUsername', 'resetPasswordTitle', 'resetPasswordDesc',
823
+ 'sendResetCode', 'backToLogin', 'resetCodeSent', 'enterNewPasswordTitle',
824
+ 'codeLabel', 'newPasswordLabel', 'newPasswordPlaceholder', 'errPassWeak',
825
+ 'resetPassword', 'resetSuccess', 'recoverUsernameTitle', 'recoverUsernameDesc',
826
+ 'emailLabel', 'sendUsername', 'usernameSent',
827
+ 'completeAccountTitle', 'completeAccountDesc', 'completeAccountDescResend',
828
+ 'sendVerificationCode', 'enterCodeTitle', 'enterCodeDesc', 'confirmAndSignIn',
829
+ 'emailVerifiedSigningIn', 'errEmailInvalid', 'errCodeRequired',
830
+ 'whyTitle', 'whyGhii', 'whyPrivacy', 'whyAgents', 'whyMorsels',
831
+ ];
832
+ const obj = {};
833
+ for (const k of keys) {
834
+ const v = t('modal.' + k);
835
+ if (v !== 'modal.' + k) obj[k] = v;
836
+ }
837
+ // Labels for the theme toggle that now lives inside the login pill.
838
+ obj.themeToDark = t('nav.themeToDark');
839
+ obj.themeToLight = t('nav.themeToLight');
840
+ return obj;
841
+ }
842
+
843
+ function mountAuth() {
844
+ try {
845
+ if (document.getElementById('headerAuth') && window.AIMEAT?.auth?.mountLoginButton) {
846
+ window.AIMEAT.auth.mountLoginButton('#headerAuth', {
847
+ onLogin: () => window.dispatchEvent(new Event('aimeat-auth-change')),
848
+ onLogout: () => window.dispatchEvent(new Event('aimeat-auth-change')),
849
+ i18n: authI18n(),
850
+ });
851
+ }
852
+ } catch (err) {
853
+ console.error('Auth mount failed:', err);
854
+ }
855
+ }
856
+
857
+ // Mount auth button after Preact renders
858
+ requestAnimationFrame(() => mountAuth());
859
+
860
+ // Re-mount auth button when locale changes
861
+ window.addEventListener('lang-change', () => requestAnimationFrame(() => mountAuth()));
862
+ }
863
+
864
+ boot().catch(err => {
865
+ console.error('Boot failed:', err);
866
+ const app = document.getElementById('app');
867
+ const wrap = document.createElement('div');
868
+ wrap.style.cssText = 'text-align:center;padding:3rem;color:#6B7280;font-family:DM Sans,system-ui';
869
+ const h = document.createElement('h2');
870
+ h.textContent = 'AIMEAT failed to start';
871
+ const p = document.createElement('p');
872
+ p.textContent = err.message || 'Unknown error';
873
+ const btn = document.createElement('button');
874
+ btn.textContent = 'Reload';
875
+ btn.style.cssText = 'margin-top:1rem;padding:0.6rem 1.5rem;background:linear-gradient(135deg,#E8564A,#FF6B6B);color:#fff;border:none;border-radius:10px;cursor:pointer;font-weight:700';
876
+ btn.onclick = () => location.reload();
877
+ wrap.appendChild(h);
878
+ wrap.appendChild(p);
879
+ wrap.appendChild(btn);
880
+ app.textContent = '';
881
+ app.appendChild(wrap);
882
+ });
883
+ </script>
884
+ </body>
885
+ </html>