aimeat 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/dist/.env.example +9 -4
  2. package/dist/locales/en.json +28 -0
  3. package/dist/locales/fi.json +28 -0
  4. package/dist/public/cortex-bundled/aimeat-charts.js +158 -10
  5. package/dist/public/cortex-bundled/aimeat-charts.yaml +1 -1
  6. package/dist/public/cortex-bundled/aimeat-dag.js +515 -173
  7. package/dist/public/cortex-bundled/aimeat-dag.yaml +1 -1
  8. package/dist/public/cortex-bundled/aimeat-i18n.js +6 -1
  9. package/dist/public/cortex-bundled/aimeat-i18n.yaml +1 -1
  10. package/dist/public/cortex-bundled/aimeat-surface.js +577 -0
  11. package/dist/public/cortex-bundled/aimeat-surface.yaml +107 -0
  12. package/dist/public/cortex-bundled/aimeat-viewport.js +405 -0
  13. package/dist/public/cortex-bundled/aimeat-viewport.yaml +100 -0
  14. package/dist/public/css/views/inbox.css +1 -1
  15. package/dist/public/css/views/profile.css +9 -0
  16. package/dist/public/lib/VENDORED.md +6 -3
  17. package/dist/public/lib/aimeat-daisyui-bridge.css +39 -2
  18. package/dist/public/lib/aimeat-theme.css +538 -0
  19. package/dist/public/lib/fonts/LICENSE.md +11 -4
  20. package/dist/public/lib/fonts/fraunces-var-latin-ext.woff2 +0 -0
  21. package/dist/public/lib/fonts/fraunces-var-latin.woff2 +0 -0
  22. package/dist/public/lib/fonts/inter-var-latin-ext.woff2 +0 -0
  23. package/dist/public/lib/fonts/inter-var-latin.woff2 +0 -0
  24. package/dist/public/lib/fonts/jetbrains-mono-var-latin-ext.woff2 +0 -0
  25. package/dist/public/lib/fonts/jetbrains-mono-var-latin.woff2 +0 -0
  26. package/dist/public/lib/fonts/space-grotesk-var-latin-ext.woff2 +0 -0
  27. package/dist/public/lib/fonts/space-grotesk-var-latin.woff2 +0 -0
  28. package/dist/public/lib/samples/theme-check.html +92 -0
  29. package/dist/public/lib/samples/themes-boot.js +20 -0
  30. package/dist/public/lib/samples/themes.html +154 -0
  31. package/dist/public/lib/samples/themes.js +60 -0
  32. package/dist/public/views/profile/access-tab/connected-apps.js +81 -5
  33. package/dist/public/views/profile/extensions-tab.maturity.js +4 -1
  34. package/dist/public/views/profile/inbox-tab/components.js +17 -1
  35. package/dist/public/views/profile/inbox-tab/use-thread-ux.js +29 -2
  36. package/dist/public/views/profile/libraries-tab.js +10 -2
  37. package/dist/public/views/profile/wallet-tab.js +64 -0
  38. package/dist/scripts/check-openapi.d.ts +2 -0
  39. package/dist/scripts/check-openapi.d.ts.map +1 -0
  40. package/dist/scripts/check-openapi.js +139 -0
  41. package/dist/scripts/check-openapi.js.map +1 -0
  42. package/dist/scripts/embed-viewport.d.ts +23 -0
  43. package/dist/scripts/embed-viewport.d.ts.map +1 -0
  44. package/dist/scripts/embed-viewport.js +116 -0
  45. package/dist/scripts/embed-viewport.js.map +1 -0
  46. package/dist/src/auth/sse-domain-scopes.d.ts +50 -0
  47. package/dist/src/auth/sse-domain-scopes.d.ts.map +1 -0
  48. package/dist/src/auth/sse-domain-scopes.js +111 -0
  49. package/dist/src/auth/sse-domain-scopes.js.map +1 -0
  50. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
  51. package/dist/src/cli/connect/mcp/tools/agent-tasks.js +4 -1
  52. package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
  53. package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
  54. package/dist/src/cli/connect/mcp/tools/core.js +14 -3
  55. package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
  56. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts +3 -0
  57. package/dist/src/cli/connect/mcp/tools/workspaces.d.ts.map +1 -1
  58. package/dist/src/cli/connect/mcp/tools/workspaces.js +4 -2
  59. package/dist/src/cli/connect/mcp/tools/workspaces.js.map +1 -1
  60. package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
  61. package/dist/src/cli/connect/tool-call-defs-core.js +13 -1
  62. package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
  63. package/dist/src/commerce/__tests__/x402-registry.test.d.ts +2 -0
  64. package/dist/src/commerce/__tests__/x402-registry.test.d.ts.map +1 -0
  65. package/dist/src/commerce/__tests__/x402-registry.test.js +105 -0
  66. package/dist/src/commerce/__tests__/x402-registry.test.js.map +1 -0
  67. package/dist/src/commerce/evm-address.d.ts +21 -0
  68. package/dist/src/commerce/evm-address.d.ts.map +1 -0
  69. package/dist/src/commerce/evm-address.js +94 -0
  70. package/dist/src/commerce/evm-address.js.map +1 -0
  71. package/dist/src/commerce/money.d.ts +18 -5
  72. package/dist/src/commerce/money.d.ts.map +1 -1
  73. package/dist/src/commerce/money.js +27 -6
  74. package/dist/src/commerce/money.js.map +1 -1
  75. package/dist/src/commerce/x402-facilitator.d.ts +64 -13
  76. package/dist/src/commerce/x402-facilitator.d.ts.map +1 -1
  77. package/dist/src/commerce/x402-facilitator.js +71 -19
  78. package/dist/src/commerce/x402-facilitator.js.map +1 -1
  79. package/dist/src/commerce/x402-handler.d.ts +13 -7
  80. package/dist/src/commerce/x402-handler.d.ts.map +1 -1
  81. package/dist/src/commerce/x402-handler.js +23 -10
  82. package/dist/src/commerce/x402-handler.js.map +1 -1
  83. package/dist/src/commerce/x402.d.ts +11 -6
  84. package/dist/src/commerce/x402.d.ts.map +1 -1
  85. package/dist/src/commerce/x402.js +10 -7
  86. package/dist/src/commerce/x402.js.map +1 -1
  87. package/dist/src/config-types.d.ts +12 -0
  88. package/dist/src/config-types.d.ts.map +1 -1
  89. package/dist/src/config.d.ts.map +1 -1
  90. package/dist/src/config.js +8 -0
  91. package/dist/src/config.js.map +1 -1
  92. package/dist/src/data/app-templates/shells.d.ts +11 -3
  93. package/dist/src/data/app-templates/shells.d.ts.map +1 -1
  94. package/dist/src/data/app-templates/shells.js +87 -6
  95. package/dist/src/data/app-templates/shells.js.map +1 -1
  96. package/dist/src/data/app-templates.js +2 -2
  97. package/dist/src/data/app-templates.js.map +1 -1
  98. package/dist/src/data/library-packs/cortex.d.ts.map +1 -1
  99. package/dist/src/data/library-packs/cortex.js +108 -5
  100. package/dist/src/data/library-packs/cortex.js.map +1 -1
  101. package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
  102. package/dist/src/data/library-packs/sdk.js +32 -8
  103. package/dist/src/data/library-packs/sdk.js.map +1 -1
  104. package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
  105. package/dist/src/data/library-packs/vendored.js +83 -6
  106. package/dist/src/data/library-packs/vendored.js.map +1 -1
  107. package/dist/src/generated/api-types.d.ts +478 -19
  108. package/dist/src/generated/api-types.d.ts.map +1 -1
  109. package/dist/src/mcp/agent-tasks.d.ts +4 -0
  110. package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
  111. package/dist/src/mcp/agent-tasks.js +20 -2
  112. package/dist/src/mcp/agent-tasks.js.map +1 -1
  113. package/dist/src/mcp/capabilities.d.ts +7 -1
  114. package/dist/src/mcp/capabilities.d.ts.map +1 -1
  115. package/dist/src/mcp/capabilities.js +5 -2
  116. package/dist/src/mcp/capabilities.js.map +1 -1
  117. package/dist/src/mcp/catalog/definitions/commerce.d.ts.map +1 -1
  118. package/dist/src/mcp/catalog/definitions/commerce.js +4 -2
  119. package/dist/src/mcp/catalog/definitions/commerce.js.map +1 -1
  120. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
  121. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +4 -3
  122. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
  123. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +1 -1
  124. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
  125. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
  126. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +3 -2
  127. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
  128. package/dist/src/mcp/catalog/output-schemas.d.ts +6 -1
  129. package/dist/src/mcp/catalog/output-schemas.d.ts.map +1 -1
  130. package/dist/src/mcp/catalog/output-schemas.js +6 -1
  131. package/dist/src/mcp/catalog/output-schemas.js.map +1 -1
  132. package/dist/src/mcp/commerce.d.ts.map +1 -1
  133. package/dist/src/mcp/commerce.js +15 -3
  134. package/dist/src/mcp/commerce.js.map +1 -1
  135. package/dist/src/mcp/core-storage.d.ts +23 -0
  136. package/dist/src/mcp/core-storage.d.ts.map +1 -0
  137. package/dist/src/mcp/core-storage.js +157 -0
  138. package/dist/src/mcp/core-storage.js.map +1 -0
  139. package/dist/src/mcp/core.d.ts +16 -0
  140. package/dist/src/mcp/core.d.ts.map +1 -1
  141. package/dist/src/mcp/core.js +75 -119
  142. package/dist/src/mcp/core.js.map +1 -1
  143. package/dist/src/mcp/dm-messages.d.ts +4 -0
  144. package/dist/src/mcp/dm-messages.d.ts.map +1 -1
  145. package/dist/src/mcp/dm-messages.js +43 -2
  146. package/dist/src/mcp/dm-messages.js.map +1 -1
  147. package/dist/src/mcp/exchange.d.ts.map +1 -1
  148. package/dist/src/mcp/exchange.js +3 -2
  149. package/dist/src/mcp/exchange.js.map +1 -1
  150. package/dist/src/mcp/extensions.d.ts.map +1 -1
  151. package/dist/src/mcp/extensions.js +6 -2
  152. package/dist/src/mcp/extensions.js.map +1 -1
  153. package/dist/src/mcp/index.d.ts +5 -0
  154. package/dist/src/mcp/index.d.ts.map +1 -1
  155. package/dist/src/mcp/index.js +23 -4
  156. package/dist/src/mcp/index.js.map +1 -1
  157. package/dist/src/mcp/memory-namespace-hints.d.ts +33 -0
  158. package/dist/src/mcp/memory-namespace-hints.d.ts.map +1 -0
  159. package/dist/src/mcp/memory-namespace-hints.js +60 -0
  160. package/dist/src/mcp/memory-namespace-hints.js.map +1 -0
  161. package/dist/src/mcp/workspaces.d.ts +5 -0
  162. package/dist/src/mcp/workspaces.d.ts.map +1 -1
  163. package/dist/src/mcp/workspaces.js +5 -3
  164. package/dist/src/mcp/workspaces.js.map +1 -1
  165. package/dist/src/models/agent-task-schemas.d.ts +25 -3
  166. package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
  167. package/dist/src/models/agent-task-schemas.js +16 -0
  168. package/dist/src/models/agent-task-schemas.js.map +1 -1
  169. package/dist/src/models/app-tool-schemas.d.ts +518 -1
  170. package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
  171. package/dist/src/models/app-tool-schemas.js +53 -1
  172. package/dist/src/models/app-tool-schemas.js.map +1 -1
  173. package/dist/src/models/odps-schemas.d.ts +305 -0
  174. package/dist/src/models/odps-schemas.d.ts.map +1 -0
  175. package/dist/src/models/odps-schemas.js +182 -0
  176. package/dist/src/models/odps-schemas.js.map +1 -0
  177. package/dist/src/models/offer-schemas.d.ts +357 -2
  178. package/dist/src/models/offer-schemas.d.ts.map +1 -1
  179. package/dist/src/models/offer-schemas.js +37 -0
  180. package/dist/src/models/offer-schemas.js.map +1 -1
  181. package/dist/src/models/schemas.d.ts +6 -3
  182. package/dist/src/models/schemas.d.ts.map +1 -1
  183. package/dist/src/models/schemas.js +10 -1
  184. package/dist/src/models/schemas.js.map +1 -1
  185. package/dist/src/models/webhook-schemas.d.ts +8 -8
  186. package/dist/src/routes/agent-tasks/create-read.d.ts +4 -0
  187. package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
  188. package/dist/src/routes/agent-tasks/create-read.js +20 -1
  189. package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
  190. package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
  191. package/dist/src/routes/agent-tasks/lifecycle.js +10 -0
  192. package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
  193. package/dist/src/routes/agents/offers.d.ts +2 -0
  194. package/dist/src/routes/agents/offers.d.ts.map +1 -1
  195. package/dist/src/routes/agents/offers.js +0 -0
  196. package/dist/src/routes/agents/offers.js.map +1 -1
  197. package/dist/src/routes/app-grants.d.ts +6 -0
  198. package/dist/src/routes/app-grants.d.ts.map +1 -1
  199. package/dist/src/routes/app-grants.js +55 -25
  200. package/dist/src/routes/app-grants.js.map +1 -1
  201. package/dist/src/routes/apps/drafts.d.ts +3 -0
  202. package/dist/src/routes/apps/drafts.d.ts.map +1 -1
  203. package/dist/src/routes/apps/drafts.js +63 -1
  204. package/dist/src/routes/apps/drafts.js.map +1 -1
  205. package/dist/src/routes/apps/publish.d.ts +2 -0
  206. package/dist/src/routes/apps/publish.d.ts.map +1 -1
  207. package/dist/src/routes/apps/publish.js +17 -2
  208. package/dist/src/routes/apps/publish.js.map +1 -1
  209. package/dist/src/routes/commerce.d.ts.map +1 -1
  210. package/dist/src/routes/commerce.js +122 -2
  211. package/dist/src/routes/commerce.js.map +1 -1
  212. package/dist/src/routes/exchange-market.d.ts +6 -2
  213. package/dist/src/routes/exchange-market.d.ts.map +1 -1
  214. package/dist/src/routes/exchange-market.js +154 -28
  215. package/dist/src/routes/exchange-market.js.map +1 -1
  216. package/dist/src/routes/exchange.d.ts.map +1 -1
  217. package/dist/src/routes/exchange.js +5 -2
  218. package/dist/src/routes/exchange.js.map +1 -1
  219. package/dist/src/routes/extensions/actions.d.ts.map +1 -1
  220. package/dist/src/routes/extensions/actions.js +18 -0
  221. package/dist/src/routes/extensions/actions.js.map +1 -1
  222. package/dist/src/routes/extensions/crud.d.ts.map +1 -1
  223. package/dist/src/routes/extensions/crud.js +36 -3
  224. package/dist/src/routes/extensions/crud.js.map +1 -1
  225. package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -1
  226. package/dist/src/routes/extensions/entitlement-gate.js +13 -0
  227. package/dist/src/routes/extensions/entitlement-gate.js.map +1 -1
  228. package/dist/src/routes/extensions/manifest.d.ts +6 -0
  229. package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
  230. package/dist/src/routes/extensions/manifest.js +68 -1
  231. package/dist/src/routes/extensions/manifest.js.map +1 -1
  232. package/dist/src/routes/extensions/pacing.d.ts +31 -0
  233. package/dist/src/routes/extensions/pacing.d.ts.map +1 -0
  234. package/dist/src/routes/extensions/pacing.js +73 -0
  235. package/dist/src/routes/extensions/pacing.js.map +1 -0
  236. package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
  237. package/dist/src/routes/extensions/paywall.js +17 -17
  238. package/dist/src/routes/extensions/paywall.js.map +1 -1
  239. package/dist/src/routes/memory/crud.d.ts.map +1 -1
  240. package/dist/src/routes/memory/crud.js +10 -0
  241. package/dist/src/routes/memory/crud.js.map +1 -1
  242. package/dist/src/routes/organisms/crud.d.ts +3 -0
  243. package/dist/src/routes/organisms/crud.d.ts.map +1 -1
  244. package/dist/src/routes/organisms/crud.js +5 -2
  245. package/dist/src/routes/organisms/crud.js.map +1 -1
  246. package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
  247. package/dist/src/routes/organisms/workspace-read.js +7 -2
  248. package/dist/src/routes/organisms/workspace-read.js.map +1 -1
  249. package/dist/src/routes/public-stats.d.ts +7 -0
  250. package/dist/src/routes/public-stats.d.ts.map +1 -1
  251. package/dist/src/routes/public-stats.js +28 -7
  252. package/dist/src/routes/public-stats.js.map +1 -1
  253. package/dist/src/routes/sse.d.ts +7 -0
  254. package/dist/src/routes/sse.d.ts.map +1 -1
  255. package/dist/src/routes/sse.js +36 -6
  256. package/dist/src/routes/sse.js.map +1 -1
  257. package/dist/src/routes/storage-files.d.ts +11 -0
  258. package/dist/src/routes/storage-files.d.ts.map +1 -1
  259. package/dist/src/routes/storage-files.js +58 -51
  260. package/dist/src/routes/storage-files.js.map +1 -1
  261. package/dist/src/routes/subdomains.d.ts +4 -0
  262. package/dist/src/routes/subdomains.d.ts.map +1 -1
  263. package/dist/src/routes/subdomains.js +42 -5
  264. package/dist/src/routes/subdomains.js.map +1 -1
  265. package/dist/src/routes/upload.d.ts +11 -0
  266. package/dist/src/routes/upload.d.ts.map +1 -1
  267. package/dist/src/routes/upload.js +108 -28
  268. package/dist/src/routes/upload.js.map +1 -1
  269. package/dist/src/routes/webmcp.d.ts.map +1 -1
  270. package/dist/src/routes/webmcp.js +4 -0
  271. package/dist/src/routes/webmcp.js.map +1 -1
  272. package/dist/src/schemas/knowledge-package.d.ts +1 -1
  273. package/dist/src/server-bootstrap/static-files.d.ts +4 -0
  274. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
  275. package/dist/src/server-bootstrap/static-files.js +11 -0
  276. package/dist/src/server-bootstrap/static-files.js.map +1 -1
  277. package/dist/src/services/build-app-prompt.d.ts +19 -0
  278. package/dist/src/services/build-app-prompt.d.ts.map +1 -1
  279. package/dist/src/services/build-app-prompt.js +97 -11
  280. package/dist/src/services/build-app-prompt.js.map +1 -1
  281. package/dist/src/services/call-timing.d.ts +51 -0
  282. package/dist/src/services/call-timing.d.ts.map +1 -0
  283. package/dist/src/services/call-timing.js +91 -0
  284. package/dist/src/services/call-timing.js.map +1 -0
  285. package/dist/src/services/capability-invoke.d.ts +2 -0
  286. package/dist/src/services/capability-invoke.d.ts.map +1 -1
  287. package/dist/src/services/capability-invoke.js +10 -0
  288. package/dist/src/services/capability-invoke.js.map +1 -1
  289. package/dist/src/services/config-schema.d.ts.map +1 -1
  290. package/dist/src/services/config-schema.js +6 -0
  291. package/dist/src/services/config-schema.js.map +1 -1
  292. package/dist/src/services/draft-token.d.ts +22 -2
  293. package/dist/src/services/draft-token.d.ts.map +1 -1
  294. package/dist/src/services/draft-token.js +52 -3
  295. package/dist/src/services/draft-token.js.map +1 -1
  296. package/dist/src/services/exchange-market.d.ts +41 -8
  297. package/dist/src/services/exchange-market.d.ts.map +1 -1
  298. package/dist/src/services/exchange-market.js +24 -2
  299. package/dist/src/services/exchange-market.js.map +1 -1
  300. package/dist/src/services/exchange-odps.d.ts +58 -0
  301. package/dist/src/services/exchange-odps.d.ts.map +1 -0
  302. package/dist/src/services/exchange-odps.js +400 -0
  303. package/dist/src/services/exchange-odps.js.map +1 -0
  304. package/dist/src/services/exchange-projection.d.ts +61 -0
  305. package/dist/src/services/exchange-projection.d.ts.map +1 -0
  306. package/dist/src/services/exchange-projection.js +504 -0
  307. package/dist/src/services/exchange-projection.js.map +1 -0
  308. package/dist/src/services/exchange-proposals.d.ts.map +1 -1
  309. package/dist/src/services/exchange-proposals.js +2 -0
  310. package/dist/src/services/exchange-proposals.js.map +1 -1
  311. package/dist/src/services/extension-files.d.ts +64 -0
  312. package/dist/src/services/extension-files.d.ts.map +1 -0
  313. package/dist/src/services/extension-files.js +88 -0
  314. package/dist/src/services/extension-files.js.map +1 -0
  315. package/dist/src/services/extension-runtime.d.ts +33 -0
  316. package/dist/src/services/extension-runtime.d.ts.map +1 -1
  317. package/dist/src/services/extension-runtime.js +52 -0
  318. package/dist/src/services/extension-runtime.js.map +1 -1
  319. package/dist/src/services/file-refs.d.ts +105 -0
  320. package/dist/src/services/file-refs.d.ts.map +1 -0
  321. package/dist/src/services/file-refs.js +106 -0
  322. package/dist/src/services/file-refs.js.map +1 -0
  323. package/dist/src/services/metered-entitlements.d.ts +7 -0
  324. package/dist/src/services/metered-entitlements.d.ts.map +1 -1
  325. package/dist/src/services/metered-entitlements.js +4 -0
  326. package/dist/src/services/metered-entitlements.js.map +1 -1
  327. package/dist/src/services/owner-memory.d.ts +14 -1
  328. package/dist/src/services/owner-memory.d.ts.map +1 -1
  329. package/dist/src/services/owner-memory.js +8 -14
  330. package/dist/src/services/owner-memory.js.map +1 -1
  331. package/dist/src/services/task-files.d.ts +51 -0
  332. package/dist/src/services/task-files.d.ts.map +1 -0
  333. package/dist/src/services/task-files.js +58 -0
  334. package/dist/src/services/task-files.js.map +1 -0
  335. package/dist/src/services/upload-token.d.ts +29 -0
  336. package/dist/src/services/upload-token.d.ts.map +1 -1
  337. package/dist/src/services/upload-token.js +37 -0
  338. package/dist/src/services/upload-token.js.map +1 -1
  339. package/dist/src/services/upload-zip.d.ts +2 -0
  340. package/dist/src/services/upload-zip.d.ts.map +1 -1
  341. package/dist/src/services/upload-zip.js +5 -1
  342. package/dist/src/services/upload-zip.js.map +1 -1
  343. package/dist/src/services/workspace-meta.d.ts +15 -0
  344. package/dist/src/services/workspace-meta.d.ts.map +1 -1
  345. package/dist/src/services/workspace-meta.js +17 -0
  346. package/dist/src/services/workspace-meta.js.map +1 -1
  347. package/dist/src/services/workspace-provision.d.ts +3 -0
  348. package/dist/src/services/workspace-provision.d.ts.map +1 -1
  349. package/dist/src/services/workspace-provision.js +5 -3
  350. package/dist/src/services/workspace-provision.js.map +1 -1
  351. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +1 -0
  352. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
  353. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +10 -0
  354. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
  355. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +2 -0
  356. package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -1
  357. package/dist/src/storage/providers/postgres-kysely/methods/memory.js +12 -1
  358. package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -1
  359. package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -1
  360. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +5 -1
  361. package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -1
  362. package/dist/src/storage/providers/postgres-kysely/migrations/0012_unique_live_app_grant.sql +29 -0
  363. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +3 -0
  364. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  365. package/dist/src/storage/providers/sqlite/methods/apps.js +7 -0
  366. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  367. package/dist/src/storage/providers/sqlite/methods/governance.d.ts +1 -0
  368. package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
  369. package/dist/src/storage/providers/sqlite/methods/governance.js +4 -1
  370. package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
  371. package/dist/src/storage/providers/sqlite/methods/owner.d.ts +5 -0
  372. package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
  373. package/dist/src/storage/providers/sqlite/methods/owner.js +8 -0
  374. package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
  375. package/dist/src/storage/providers/sqlite/schema.d.ts +3 -0
  376. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  377. package/dist/src/storage/providers/sqlite/schema.js +20 -0
  378. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  379. package/dist/src/storage/repositories/app-grant.repository.d.ts +9 -1
  380. package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
  381. package/dist/src/storage/repositories/memory.repository.d.ts +14 -0
  382. package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
  383. package/dist/src/storage/repositories-impl/memory-repository.d.ts +8 -1
  384. package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -1
  385. package/dist/src/storage/repositories-impl/memory-repository.js +15 -4
  386. package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -1
  387. package/dist/src/storage/types/agents-messaging.d.ts +19 -0
  388. package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
  389. package/dist/src/storage/types/agents-messaging.js.map +1 -1
  390. package/dist/src/storage/types/organisms-federation.d.ts +29 -0
  391. package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
  392. package/dist/src/utils/app-badge.d.ts.map +1 -1
  393. package/dist/src/utils/app-badge.js +7 -3
  394. package/dist/src/utils/app-badge.js.map +1 -1
  395. package/dist/static/app-catalog/_template.html +6 -5
  396. package/dist/static/app-catalog/js/cortex.js +3 -1
  397. package/dist/static/app-catalog/js/detail.js +411 -36
  398. package/dist/static/app-catalog/js/i18n-data.js +279 -3
  399. package/dist/static/app-catalog/js/main.js +28 -37
  400. package/dist/static/app-catalog/js/monetize.js +204 -16
  401. package/dist/static/app-catalog/js/odps.js +489 -0
  402. package/dist/static/app-catalog/js/render.js +3 -0
  403. package/dist/static/app-catalog/js/workcopy.js +198 -0
  404. package/dist/static/app-catalog/styles/app-catalog.css +60 -0
  405. package/dist/static/app-catalog.html +1450 -137
  406. package/dist/static/sdk-libs/agents/index.js +45 -7
  407. package/dist/static/sdk-libs/auth/cluster.js +97 -0
  408. package/dist/static/sdk-libs/auth/index.js +25 -1
  409. package/dist/static/sdk-libs/auth/locale.js +151 -0
  410. package/dist/static/sdk-libs/auth/modal.js +11 -2
  411. package/dist/static/sdk-libs/auth/palette.js +172 -0
  412. package/dist/static/sdk-libs/auth/pill.js +37 -6
  413. package/dist/static/sdk-libs/auth/theme.js +61 -20
  414. package/dist/static/sdk-libs/data/index.js +70 -8
  415. package/dist/static/sdk-libs/dist/aimeat-agents.js +41 -8
  416. package/dist/static/sdk-libs/dist/aimeat-auth.js +422 -21
  417. package/dist/static/sdk-libs/dist/aimeat-data.js +50 -8
  418. package/dist/static/sdk-libs/dist/aimeat-live.js +54 -2
  419. package/dist/static/sdk-libs/dist/aimeat-markdown.js +32 -1
  420. package/dist/static/sdk-libs/live/index.js +71 -4
  421. package/dist/static/sdk-libs/markdown/index.js +49 -1
  422. package/package.json +6 -2
package/dist/.env.example CHANGED
@@ -315,10 +315,15 @@ AIMEAT_PORT=40050
315
315
  # AIMEAT_VAT_RATE_PERCENT=25.5 # Default ALV/VAT rate for money-sale bookings (Finland standard 25.5%); overridable per company.
316
316
  # AIMEAT_PLATFORM_STRIPE_KEY= # Legacy alias for AIMEAT_STRIPE_SECRET_KEY (only used if the latter is unset).
317
317
 
318
- # ── x402 stablecoin settlement (TARGET-042) — NON-CUSTODIAL USDC on a USD price ──
319
- # AIMEAT_X402_ENABLED=false # Register the x402 USDC PaymentHandler (settles money/USD sessions via the exact scheme + facilitator). OFF by default: advertise the exact scheme only when the node can settle it.
320
- # AIMEAT_X402_NETWORK=base-sepolia # Network id in the accepts[] exact scheme: base-sepolia (testnet) | base (mainnet). A parameter, not hardcoded Solana etc. drop in via the network registry (src/commerce/x402-facilitator.ts).
321
- # AIMEAT_X402_FACILITATOR_URL=https://x402.org/facilitator # Facilitator /verify + /settle base URL (all calls go through safeFetch). Coinbase CDP facilitator in prod; the public x402.org one covers Base Sepolia.
318
+ # ── x402 stablecoin settlement (TARGET-042) — NON-CUSTODIAL stablecoin on a fiat price ──
319
+ # The token follows the price: a USD session settles in USDC, a EUR session in EURC. One seller payout
320
+ # address receives both. The currencies the node advertises are DERIVED from the assets the configured
321
+ # network has, so a currency is never offered unless it can really settle.
322
+ # AIMEAT_PACING_TOLL_DEFAULT=0 # Morsels burned per METERED call when the capability declares no toll of its own. Morsels replenish daily with a hard ceiling, so a non-zero value puts an absolute RATE floor under every capability - including money-priced ones, whose only other brake is the buyer's total budget. Applies on every metered path (app tools, exchange runs, agent work, raw extension invokes). 0 = off (existing billing unchanged).
323
+ # AIMEAT_X402_ENABLED=false # Register the x402 PaymentHandler (settles money sessions via the exact scheme + facilitator). OFF by default: advertise the exact scheme only when the node can settle it.
324
+ # AIMEAT_X402_NETWORK=base-sepolia # Network id in the accepts[] exact scheme: base-sepolia (testnet) | base (mainnet). Both carry USDC + EURC. A parameter, not hardcoded — Solana etc. drop in via the network registry (src/commerce/x402-facilitator.ts).
325
+ # AIMEAT_X402_FACILITATOR_URL=https://x402.org/facilitator # Facilitator /verify + /settle base URL (all calls go through safeFetch). The public x402.org one covers Base Sepolia (USDC and EURC alike) but NOT Base mainnet — mainnet needs a facilitator that serves it, e.g. Coinbase CDP.
326
+ # AIMEAT_X402_RPC_URL= # OPTIONAL read-only JSON-RPC (e.g. https://mainnet.base.org). Used ONLY to check that a seller's payout address is an account, not a contract, before it is saved. Empty = check skipped; a payout setting must not depend on a third party being up.
322
327
  # AIMEAT_X402_TEST_FACILITATOR=false # TEST ONLY: an off-chain facilitator double so the x402 chain is E2E-provable without a testnet wallet. NEVER in prod (real settlement = the real facilitator).
323
328
 
324
329
  # ── Crawlers / Content Signals / Web Bot Auth ──────────────────
@@ -10,6 +10,8 @@
10
10
  "inbox.sending": "Sending…",
11
11
  "inbox.reply": "Reply",
12
12
  "inbox.quoteReply": "Reply to this message",
13
+ "inbox.copyMessage": "Copy this message to the clipboard",
14
+ "inbox.copied": "Copied",
13
15
  "inbox.quoteJump": "Show the original message",
14
16
  "inbox.quoteYou": "You",
15
17
  "inbox.replyingTo": "Replying to",
@@ -2538,6 +2540,16 @@
2538
2540
  "pspRemove": "Remove",
2539
2541
  "pspSaved": "Payment key saved",
2540
2542
  "pspRemoved": "Payment key removed",
2543
+ "x402Title": "Stablecoin payouts (x402)",
2544
+ "x402Desc": "A different rail from Stripe: a buyer signs a stablecoin payment and the facilitator settles it on-chain straight to this address. The token follows the price — a dollar price settles in USDC, a euro price in EURC — and the same address receives both. Non-custodial: the node holds no key and no funds. Without an address, a stablecoin sale of yours fails.",
2545
+ "x402Configured": "Payout address set",
2546
+ "x402Missing": "No payout address",
2547
+ "x402Save": "Save address",
2548
+ "x402Remove": "Remove",
2549
+ "x402Saved": "Payout address saved",
2550
+ "x402Removed": "Payout address removed. Card and invoice settlement is unaffected.",
2551
+ "x402Invalid": "An address is 0x followed by 40 hex characters.",
2552
+ "x402Testnet": "test network",
2541
2553
  "moneyTitle": "Money purchases & sales",
2542
2554
  "moneyDesc": "Real-money (EUR/USD) checkout activity — separate from morsels. Funds move through the seller's own payment provider, never the node.",
2543
2555
  "moneyPurchases": "Purchases",
@@ -3035,6 +3047,12 @@
3035
3047
  "agConfirmRevoke": "Revoke access for \"{name}\"? It loses access immediately.",
3036
3048
  "agRevoked": "App access revoked",
3037
3049
  "agRevoke": "Revoke",
3050
+ "agScopesToggle": "Show or hide the granted permissions",
3051
+ "agUnusedNote": "{count} of these have not been used in over {days} days.",
3052
+ "agRevokeUnused": "Revoke {count} unused",
3053
+ "agConfirmRevokeUnused": "Revoke access for {count} apps unused for over {days} days? They lose access immediately.",
3054
+ "agRevokedCount": "{count} app grants revoked",
3055
+ "agRevokedSome": "{done} revoked, {failed} failed",
3038
3056
  "patTitle": "Agent Access Tokens",
3039
3057
  "patDesc": "Create a revocable token an agent can use (as a Bearer header) to log in and test your apps. One token can be shared across all your agents.",
3040
3058
  "patLabelRequired": "Give the token a name",
@@ -3385,6 +3403,11 @@
3385
3403
  "frontier": "Frontier-safe — a version-drift trap for weaker models; they must read its doc",
3386
3404
  "needs-doc": "AIMEAT-authored wrapper — the AI must fetch its doc to use it (no priors)"
3387
3405
  },
3406
+ "tierLabel": {
3407
+ "any": "ANY MODEL",
3408
+ "frontier": "VERSION TRAP",
3409
+ "needs-doc": "READ THE DOC"
3410
+ },
3388
3411
  "heroDesc": "Get more done with less. AI Chat can handle bigger apps when you hand it ready-made cortex building blocks — reusable UI libraries, schemas, and prompts. Use the same cortex across multiple apps.",
3389
3412
  "visibility": {
3390
3413
  "private": "Private",
@@ -4507,6 +4530,11 @@
4507
4530
  "errFederatedLogin": "Could not reach home node {remoteNode} for federated login.",
4508
4531
  "loggedIn": "logged in",
4509
4532
  "logoutBtn": "Logout",
4533
+ "switchLanguage": "Language",
4534
+ "themeLabel": "Theme",
4535
+ "lightMode": "Light mode",
4536
+ "darkMode": "Dark mode",
4537
+ "chooseLook": "Choose look",
4510
4538
  "usernameLabel": "Username",
4511
4539
  "passwordLabel": "Password",
4512
4540
  "displayNameLabel": "Display Name",
@@ -10,6 +10,8 @@
10
10
  "inbox.sending": "Lähetetään…",
11
11
  "inbox.reply": "Vastaa",
12
12
  "inbox.quoteReply": "Vastaa tähän viestiin",
13
+ "inbox.copyMessage": "Kopioi tämä viesti leikepöydälle",
14
+ "inbox.copied": "Kopioitu",
13
15
  "inbox.quoteJump": "Näytä alkuperäinen viesti",
14
16
  "inbox.quoteYou": "Sinä",
15
17
  "inbox.replyingTo": "Vastataan:",
@@ -2538,6 +2540,16 @@
2538
2540
  "pspRemove": "Poista",
2539
2541
  "pspSaved": "Maksuavain tallennettu",
2540
2542
  "pspRemoved": "Maksuavain poistettu",
2543
+ "x402Title": "Stablecoin-tilitykset (x402)",
2544
+ "x402Desc": "Eri raide kuin Stripe: ostaja allekirjoittaa stablecoin-maksun ja fasilitaattori tilittää sen ketjussa suoraan tähän osoitteeseen. Rahake määräytyy hinnan mukaan: dollarihinta tilittyy USDC:nä ja eurohinta EURC:nä, ja sama osoite ottaa vastaan molemmat. Ei-säilytyksellinen: noodi ei pidä avainta eikä varoja. Ilman osoitetta stablecoin-myyntisi kaatuu.",
2545
+ "x402Configured": "Tilitysosoite asetettu",
2546
+ "x402Missing": "Ei tilitysosoitetta",
2547
+ "x402Save": "Tallenna osoite",
2548
+ "x402Remove": "Poista",
2549
+ "x402Saved": "Tilitysosoite tallennettu",
2550
+ "x402Removed": "Tilitysosoite poistettu. Kortti- ja laskutilitys ei muutu.",
2551
+ "x402Invalid": "Osoite on 0x ja 40 heksamerkkiä.",
2552
+ "x402Testnet": "testiverkko",
2541
2553
  "moneyTitle": "Rahaostot ja -myynnit",
2542
2554
  "moneyDesc": "Rahamaksut (EUR/USD) — erillään murusista. Varat liikkuvat myyjän oman maksupalvelun kautta, ei koskaan noodin.",
2543
2555
  "moneyPurchases": "Ostot",
@@ -3035,6 +3047,12 @@
3035
3047
  "agConfirmRevoke": "Peruutetaanko sovelluksen \"{name}\" pääsy? Se menettää pääsyn välittömästi.",
3036
3048
  "agRevoked": "Sovelluksen pääsy peruutettu",
3037
3049
  "agRevoke": "Peruuta",
3050
+ "agScopesToggle": "Näytä tai piilota myönnetyt oikeudet",
3051
+ "agUnusedNote": "Näistä {count} on ollut käyttämättä yli {days} päivää.",
3052
+ "agRevokeUnused": "Peruuta {count} käyttämätöntä",
3053
+ "agConfirmRevokeUnused": "Peruutetaanko pääsy {count} sovellukselta, joita ei ole käytetty yli {days} päivään? Ne menettävät pääsyn välittömästi.",
3054
+ "agRevokedCount": "{count} sovelluksen pääsy peruutettu",
3055
+ "agRevokedSome": "{done} peruutettu, {failed} epäonnistui",
3038
3056
  "patTitle": "Agenttien käyttötokenit",
3039
3057
  "patDesc": "Luo peruutettava token, jota agentti voi käyttää (Bearer-headerina) kirjautuakseen ja testatakseen appejasi. Yhtä tokenia voi jakaa kaikille agenteillesi.",
3040
3058
  "patLabelRequired": "Anna tokenille nimi",
@@ -3385,6 +3403,11 @@
3385
3403
  "frontier": "Vahvoille malleille turvallinen — versioansa heikommille; niiden on luettava dokumentaatio",
3386
3404
  "needs-doc": "AIMEAT:n oma wrapper — tekoälyn on haettava dokumentaatio käyttääkseen sitä (ei ennakkotietoa)"
3387
3405
  },
3406
+ "tierLabel": {
3407
+ "any": "KAIKILLE MALLEILLE",
3408
+ "frontier": "VERSIOANSA",
3409
+ "needs-doc": "LUE DOKUMENTTI"
3410
+ },
3388
3411
  "heroDesc": "Cortexeilla saat enemmän aikaiseksi vähemmällä. AI Chat suoriutuu isommista sovelluksista kun annat sille valmiita cortex-rakennuspalikoita — uudelleenkäytettäviä UI-kirjastoja, skeemoja ja prompteja. Voit käyttää samaa cortexia useassa sovelluksessa.",
3389
3412
  "visibility": {
3390
3413
  "private": "Yksityinen",
@@ -4507,6 +4530,11 @@
4507
4530
  "errFederatedLogin": "Kotisolmuun {remoteNode} ei saatu yhteyttä federoitua kirjautumista varten.",
4508
4531
  "loggedIn": "kirjautuneena",
4509
4532
  "logoutBtn": "Kirjaudu ulos",
4533
+ "switchLanguage": "Kieli",
4534
+ "themeLabel": "Teema",
4535
+ "lightMode": "Vaalea tila",
4536
+ "darkMode": "Tumma tila",
4537
+ "chooseLook": "Valitse tyyli",
4510
4538
  "usernameLabel": "Käyttäjänimi",
4511
4539
  "passwordLabel": "Salasana",
4512
4540
  "displayNameLabel": "Näyttönimi",
@@ -11,6 +11,30 @@
11
11
  * Usage:
12
12
  * AIMEAT.charts.ChartBuilder({ elementId: 'my-chart', type: 'bar', data: {...} })
13
13
  * AIMEAT.charts.ChartPanel({ elementId: 'my-chart', chartKey: 'chart:sales-2024', nodeUrl: '...' })
14
+ *
15
+ * @version-history
16
+ * v1.1.2 — 2026-07-25 — One observer, not two. This lib attached its own ResizeObserver that
17
+ * called `chart.resize()` with no arguments; Chart.js already watches the same container and
18
+ * already resizes from the observer entry's contentRect. The two disagree wherever an
19
+ * ancestor carries `transform: scale(k)` — the no-argument call measures with
20
+ * getBoundingClientRect(), which is k times the layout size. Measured while dragging a frame
21
+ * on a zoomable board: 30 canvas style writes for 15 pointer moves, alternating between the
22
+ * right height and exactly k x it (k = 0.31, 0.99, 1.87 all reproduce); a chart left holding
23
+ * the scaled answer stayed at 31% of its box for good. Now the observer exists only for
24
+ * non-responsive charts, and it passes layout pixels instead of re-measuring.
25
+ * v1.1.1 — 2026-07-25 — Give the canvas size back to Chart.js. The injected
26
+ * `.aimeat-chart-container canvas { width:100%!important; height:auto!important }` overrode the
27
+ * inline height Chart.js writes and then watches, so in any height-constrained container the
28
+ * two fought: measured 14 distinct canvas sizes in 3 seconds, visible as a fast flicker between
29
+ * two renderings. Only display:block and max-width remain.
30
+ * v1.1.0 — 2026-07-25 — Charts follow the theme. The palette is resolved from the theme tokens
31
+ * when a chart is drawn, and every chart this lib owns is repainted when the palette or the
32
+ * light/dark mode changes. The old list called itself "the AIMEAT brand palette" and was
33
+ * Tailwind's indigo/violet default: it was neither the house coral nor aware of the five
34
+ * palettes the theme system ships, so every chart in every app was off-brand and stayed that
35
+ * way when the reader switched look. A canvas cannot inherit a CSS variable the way a div can,
36
+ * which is why this needs resolving at draw time plus a repaint, not a stylesheet rule.
37
+ * Datasets that carry their own colours are still left alone.
14
38
  */
15
39
  (function (AIMEAT) {
16
40
  'use strict';
@@ -22,13 +46,48 @@
22
46
  /** Supported Chart.js chart types. */
23
47
  var TYPES = ['bar', 'line', 'pie', 'doughnut', 'radar', 'scatter', 'bubble'];
24
48
 
25
- /** AIMEAT brand palette — used as default colours when datasets omit backgroundColor. */
26
- var PALETTE = [
49
+ /**
50
+ * Used when the page has no AIMEAT theme loaded, so a bare Chart.js page still gets a chart
51
+ * with distinguishable series rather than ten black bars.
52
+ */
53
+ var FALLBACK_PALETTE = [
27
54
  '#6366f1', '#8b5cf6', '#a78bfa', '#c4b5fd',
28
55
  '#f59e0b', '#10b981', '#ef4444', '#3b82f6',
29
56
  '#ec4899', '#14b8a6'
30
57
  ];
31
58
 
59
+ /** The theme tokens a chart draws from, in the order a reader should see them. */
60
+ var PALETTE_TOKENS = [
61
+ '--color-primary', '--color-secondary', '--color-accent', '--color-info',
62
+ '--color-success', '--color-warning', '--color-error'
63
+ ];
64
+
65
+ /**
66
+ * The palette in effect right now, read from the theme.
67
+ *
68
+ * Resolved per draw rather than once at load: the theme has two axes (light/dark and five
69
+ * palettes) and both can change while the page is open.
70
+ *
71
+ * @param {Element=} host element to resolve against — the tokens live on :root, but resolving
72
+ * against the chart's own container lets a scoped override win.
73
+ * @returns {string[]} colours, or FALLBACK_PALETTE when no theme is present.
74
+ */
75
+ function themePalette(host) {
76
+ try {
77
+ var cs = window.getComputedStyle(host || document.documentElement);
78
+ var out = [];
79
+ PALETTE_TOKENS.forEach(function (name) {
80
+ var v = String(cs.getPropertyValue(name) || '').trim();
81
+ if (v && out.indexOf(v) === -1) out.push(v);
82
+ });
83
+ /* Two colours cannot carry a multi-series chart, so a half-defined theme falls back whole
84
+ rather than mixing house colours with Tailwind defaults. */
85
+ return out.length >= 3 ? out : FALLBACK_PALETTE;
86
+ } catch (_e) {
87
+ return FALLBACK_PALETTE;
88
+ }
89
+ }
90
+
32
91
  /** Chart types where each data-point gets its own colour slice. */
33
92
  var SLICE_TYPES = ['pie', 'doughnut'];
34
93
 
@@ -53,10 +112,15 @@
53
112
  ' max-width: 100%;' +
54
113
  ' box-sizing: border-box;' +
55
114
  '}' +
115
+ /* Chart.js owns the canvas size in responsive mode: it writes style.width/height inline
116
+ and watches the result. These two !important rules overrode that inline height, so the
117
+ canvas rendered at the backing store's own ratio instead, Chart.js's ResizeObserver saw a
118
+ different size and wrote the height again — a two-state oscillation, several times a
119
+ second, whenever the container height was constrained. Two authorities for one value.
120
+ display:block stays (it removes the inline-element baseline gap); the sizing is Chart.js's. */
56
121
  '.aimeat-chart-container canvas {' +
57
122
  ' display: block;' +
58
- ' width: 100% !important;' +
59
- ' height: auto !important;' +
123
+ ' max-width: 100%;' +
60
124
  '}' +
61
125
  '.aimeat-chart-error {' +
62
126
  ' padding: 20px;' +
@@ -132,11 +196,13 @@
132
196
  *
133
197
  * @param {object} data Chart.js data object ({ labels, datasets }).
134
198
  * @param {string} type Chart type string (e.g. 'bar', 'pie').
199
+ * @param {Element=} host container to resolve the theme against.
135
200
  * @returns {object} Cloned data with palette applied.
136
201
  */
137
- function applyPalette(data, type) {
202
+ function applyPalette(data, type, host) {
138
203
  var d = JSON.parse(JSON.stringify(data));
139
204
  var isSlice = SLICE_TYPES.indexOf(type) !== -1;
205
+ var PALETTE = themePalette(host);
140
206
 
141
207
  d.datasets.forEach(function (ds, i) {
142
208
  if (!ds.backgroundColor) {
@@ -160,6 +226,65 @@
160
226
  return d;
161
227
  }
162
228
 
229
+ // ---------------------------------------------------------------------------
230
+ // Following the theme
231
+ // ---------------------------------------------------------------------------
232
+
233
+ /**
234
+ * Every chart this lib currently owns, with the data the CALLER passed.
235
+ *
236
+ * The caller's data is what gets kept, not the drawn data: applyPalette fills in a colour where
237
+ * one was missing, so re-applying it to already-drawn data would find every dataset "already
238
+ * coloured" and change nothing. Recolouring has to start from the original each time, which
239
+ * also keeps the promise that a dataset with its own colour is never overridden.
240
+ */
241
+ var live = [];
242
+ var watching = false;
243
+
244
+ /** Drop charts whose canvas has left the document, so a long-lived page does not accumulate. */
245
+ function pruneLive() {
246
+ live = live.filter(function (rec) {
247
+ var c = rec.chart;
248
+ return c && c.canvas && c.canvas.isConnected;
249
+ });
250
+ }
251
+
252
+ /** Repaint every live chart against the theme as it is now. */
253
+ function repaintAll() {
254
+ pruneLive();
255
+ live.forEach(function (rec) {
256
+ try {
257
+ var next = applyPalette(rec.data, rec.type, rec.el);
258
+ rec.chart.data.datasets.forEach(function (ds, i) {
259
+ var src = next.datasets[i];
260
+ if (!src) return;
261
+ ds.backgroundColor = src.backgroundColor;
262
+ ds.borderColor = src.borderColor;
263
+ });
264
+ /* A plain update(), not update('none'): the 'none' mode skips the element style cache
265
+ as well as the animation, so a bar chart kept its old fill while its own legend showed
266
+ the new one. Measured on canvas pixels, not inferred. The colour transition it animates
267
+ instead is the right feel for a palette change. */
268
+ rec.chart.update();
269
+ } catch (_e) { /* one bad chart must not stop the rest */ }
270
+ });
271
+ }
272
+
273
+ /**
274
+ * Watch the theme. A MutationObserver on the two attributes rather than the
275
+ * 'aimeat-palette-change' event, because light/dark has no event of its own and an app is free
276
+ * to set either attribute directly — the attribute is the thing that is actually true.
277
+ */
278
+ function watchTheme() {
279
+ if (watching || typeof MutationObserver === 'undefined') return;
280
+ watching = true;
281
+ try {
282
+ new MutationObserver(repaintAll).observe(document.documentElement, {
283
+ attributes: true, attributeFilter: ['data-theme', 'data-palette']
284
+ });
285
+ } catch (_e) { watching = false; }
286
+ }
287
+
163
288
  /**
164
289
  * Create a <canvas> inside the given container, wrapped in the standard
165
290
  * .aimeat-chart-container div.
@@ -178,18 +303,35 @@
178
303
  }
179
304
 
180
305
  /**
181
- * Attach a ResizeObserver to the chart's parent so Chart.js can re-draw when
182
- * the container size changes (e.g. responsive layout, collapsible panels).
306
+ * Keep a chart sized to its container.
307
+ *
308
+ * A responsive chart is already watched by Chart.js itself, and Chart.js measures the right
309
+ * thing: its own ResizeObserver hands `resize()` the entry's contentRect, which is layout
310
+ * pixels. `chart.resize()` with no arguments measures the container with
311
+ * getBoundingClientRect() instead — and inside an ancestor carrying `transform: scale(k)`, as
312
+ * every zoomable board has, that rect is k times the layout size. Two observers, two answers,
313
+ * one canvas: measured on ORIGAMI while dragging a frame's resize grip, the canvas got two
314
+ * style writes per pointer move, one correct and one exactly k x correct — 30 writes for 15
315
+ * moves at k=0.31, k=0.99 and k=1.87 alike. Without this second observer: 15 writes, one size.
316
+ * A chart left holding the scaled answer stayed at 31% of its box and never recovered.
317
+ *
318
+ * So the observer is only for the non-responsive case, where Chart.js watches nothing — and
319
+ * even there it passes layout pixels explicitly rather than asking for a fresh measurement.
183
320
  *
184
321
  * @param {object} chart Chart.js instance.
185
322
  * @param {HTMLElement} el The outer container element.
186
323
  */
187
324
  function observeResize(chart, el) {
188
325
  if (typeof ResizeObserver === 'undefined') return;
326
+ if (!chart.options || chart.options.responsive !== false) return;
189
327
 
190
328
  var observer = new ResizeObserver(function () {
191
329
  try {
192
- chart.resize();
330
+ /* clientWidth/clientHeight, never the no-argument resize(): these are layout pixels and
331
+ stay true inside a scaled ancestor. The box is the canvas's own parent, which is what
332
+ Chart.js measures. */
333
+ var box = chart.canvas && chart.canvas.parentElement;
334
+ if (box) chart.resize(box.clientWidth, box.clientHeight);
193
335
  } catch (_e) {
194
336
  // Chart may have been destroyed — silently ignore.
195
337
  }
@@ -293,7 +435,7 @@
293
435
 
294
436
  try {
295
437
  var canvas = createCanvas(el);
296
- var chartData = applyPalette(opts.data, opts.type);
438
+ var chartData = applyPalette(opts.data, opts.type, el);
297
439
  var chartOptions = buildOptions(opts.title, opts.options);
298
440
 
299
441
  var chart = new window.Chart(canvas, {
@@ -303,6 +445,9 @@
303
445
  });
304
446
 
305
447
  observeResize(chart, el);
448
+ pruneLive();
449
+ live.push({ chart: chart, el: el, data: opts.data, type: opts.type });
450
+ watchTheme();
306
451
  return chart;
307
452
  } catch (err) {
308
453
  showError(el, 'Failed to render chart: ' + (err.message || String(err)));
@@ -441,7 +586,10 @@
441
586
  var exports = {
442
587
  ChartPanel: ChartPanel,
443
588
  ChartBuilder: ChartBuilder,
444
- TYPES: TYPES
589
+ TYPES: TYPES,
590
+ VERSION: '1.1.2',
591
+ /** The palette a chart would draw with right now, for legends and non-canvas visuals. */
592
+ palette: themePalette
445
593
  };
446
594
 
447
595
  AIMEAT.register('aimeat-charts', exports);
@@ -10,7 +10,7 @@ metadata:
10
10
  domain: visualization
11
11
 
12
12
  spec:
13
- version: "1.0.2"
13
+ version: "1.1.2"
14
14
  license: MIT
15
15
  components:
16
16
  - type: schema