aimeat 1.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 (1366) hide show
  1. package/dist/.env.example +300 -0
  2. package/dist/bin/aimeat.d.ts +3 -0
  3. package/dist/bin/aimeat.d.ts.map +1 -0
  4. package/dist/bin/aimeat.js +22 -0
  5. package/dist/bin/aimeat.js.map +1 -0
  6. package/dist/locales/en.json +4566 -0
  7. package/dist/locales/fi.json +4566 -0
  8. package/dist/public/BingSiteAuth.xml +4 -0
  9. package/dist/public/agent-consent.html +521 -0
  10. package/dist/public/aimeat-developers.html +679 -0
  11. package/dist/public/assets/mcp_1_add_custom_connector.png +0 -0
  12. package/dist/public/assets/mcp_2_connect_disconnect_connector.png +0 -0
  13. package/dist/public/components/Alert.js +18 -0
  14. package/dist/public/components/Card.js +19 -0
  15. package/dist/public/components/CopyButton.js +24 -0
  16. package/dist/public/components/FormField.js +16 -0
  17. package/dist/public/components/Modal.js +121 -0
  18. package/dist/public/components/Spinner.js +11 -0
  19. package/dist/public/components/Toast.js +26 -0
  20. package/dist/public/components/index.js +8 -0
  21. package/dist/public/components/useViewCSS.js +12 -0
  22. package/dist/public/cortex-bundled/aimeat-canvas.js +1408 -0
  23. package/dist/public/cortex-bundled/aimeat-canvas.yaml +241 -0
  24. package/dist/public/cortex-bundled/aimeat-charts.js +455 -0
  25. package/dist/public/cortex-bundled/aimeat-charts.yaml +178 -0
  26. package/dist/public/cortex-bundled/aimeat-ui-dialogs.js +667 -0
  27. package/dist/public/cortex-bundled/aimeat-ui-dialogs.yaml +66 -0
  28. package/dist/public/cortex-bundled/aimeat-ui-forms.js +1106 -0
  29. package/dist/public/cortex-bundled/aimeat-ui-forms.yaml +90 -0
  30. package/dist/public/cortex-bundled/aimeat-ui-layout.js +436 -0
  31. package/dist/public/cortex-bundled/aimeat-ui-layout.yaml +87 -0
  32. package/dist/public/cortex-bundled/aimeat-ui-nav.js +722 -0
  33. package/dist/public/cortex-bundled/aimeat-ui-nav.yaml +73 -0
  34. package/dist/public/cortex-bundled/aimeat-ui-viewers.js +602 -0
  35. package/dist/public/cortex-bundled/aimeat-ui-viewers.yaml +73 -0
  36. package/dist/public/css/components/tags.css +67 -0
  37. package/dist/public/css/theme.css +716 -0
  38. package/dist/public/css/views/admin.css +576 -0
  39. package/dist/public/css/views/aimeat-os.css +153 -0
  40. package/dist/public/css/views/calibrator.css +480 -0
  41. package/dist/public/css/views/foundry.css +1334 -0
  42. package/dist/public/css/views/help.css +136 -0
  43. package/dist/public/css/views/hobbies.css +73 -0
  44. package/dist/public/css/views/marketplace.css +134 -0
  45. package/dist/public/css/views/openclaw.css +33 -0
  46. package/dist/public/css/views/portal-classic.css +484 -0
  47. package/dist/public/css/views/portal-dev.css +139 -0
  48. package/dist/public/css/views/portal.css +365 -0
  49. package/dist/public/css/views/portfolio.css +322 -0
  50. package/dist/public/css/views/profile.css +1799 -0
  51. package/dist/public/echat.html +442 -0
  52. package/dist/public/img/genesis-001-badge.png +0 -0
  53. package/dist/public/img/platforms/chatgpt.png +0 -0
  54. package/dist/public/img/platforms/claude.png +0 -0
  55. package/dist/public/img/platforms/copilot.png +0 -0
  56. package/dist/public/img/platforms/deepseek.png +0 -0
  57. package/dist/public/img/platforms/gemini.png +0 -0
  58. package/dist/public/img/platforms/grok.png +0 -0
  59. package/dist/public/img/platforms/lmstudio.png +0 -0
  60. package/dist/public/img/platforms/m365copilot.png +0 -0
  61. package/dist/public/img/platforms/openclaw.png +0 -0
  62. package/dist/public/img/platforms/other.png +0 -0
  63. package/dist/public/js/api.js +123 -0
  64. package/dist/public/js/components/auth-image.js +59 -0
  65. package/dist/public/js/components/tag-cloud.js +31 -0
  66. package/dist/public/js/components/tag-editor.js +46 -0
  67. package/dist/public/js/hooks.js +63 -0
  68. package/dist/public/js/i18n.js +76 -0
  69. package/dist/public/js/services/admin.js +239 -0
  70. package/dist/public/js/services/agents.js +57 -0
  71. package/dist/public/js/services/apps.js +35 -0
  72. package/dist/public/js/services/auth.js +40 -0
  73. package/dist/public/js/services/boards.js +79 -0
  74. package/dist/public/js/services/calibrator.js +97 -0
  75. package/dist/public/js/services/catalogue.js +39 -0
  76. package/dist/public/js/services/consent.js +57 -0
  77. package/dist/public/js/services/cortex.js +95 -0
  78. package/dist/public/js/services/extensions.js +61 -0
  79. package/dist/public/js/services/federation.js +11 -0
  80. package/dist/public/js/services/foundry-context-bundle.js +128 -0
  81. package/dist/public/js/services/foundry-contract.js +117 -0
  82. package/dist/public/js/services/foundry-packaging.js +762 -0
  83. package/dist/public/js/services/foundry-probe-reconcile.js +52 -0
  84. package/dist/public/js/services/foundry-prompts-base.js +1886 -0
  85. package/dist/public/js/services/foundry-prompts-build.js +2187 -0
  86. package/dist/public/js/services/foundry-prompts-cortex-app.js +154 -0
  87. package/dist/public/js/services/foundry-prompts-cortex-data.js +241 -0
  88. package/dist/public/js/services/foundry-prompts-cortex-feature.js +281 -0
  89. package/dist/public/js/services/foundry-prompts-fix.js +408 -0
  90. package/dist/public/js/services/foundry-prompts-test.js +520 -0
  91. package/dist/public/js/services/foundry-prompts.js +31 -0
  92. package/dist/public/js/services/foundry-smoke.js +65 -0
  93. package/dist/public/js/services/foundry-testing.js +64 -0
  94. package/dist/public/js/services/foundry-validate.js +1082 -0
  95. package/dist/public/js/services/foundry.js +1194 -0
  96. package/dist/public/js/services/generator-context-bundle.js +134 -0
  97. package/dist/public/js/services/generator-contract.js +117 -0
  98. package/dist/public/js/services/generator-packaging.js +762 -0
  99. package/dist/public/js/services/generator-probe-reconcile.js +52 -0
  100. package/dist/public/js/services/generator-prompts-base.js +1890 -0
  101. package/dist/public/js/services/generator-prompts-build.js +1126 -0
  102. package/dist/public/js/services/generator-prompts-cortex-app.js +155 -0
  103. package/dist/public/js/services/generator-prompts-cortex-data.js +199 -0
  104. package/dist/public/js/services/generator-prompts-cortex-feature.js +276 -0
  105. package/dist/public/js/services/generator-prompts-fix.js +316 -0
  106. package/dist/public/js/services/generator-prompts-test.js +402 -0
  107. package/dist/public/js/services/generator-prompts.js +31 -0
  108. package/dist/public/js/services/generator-smoke.js +65 -0
  109. package/dist/public/js/services/generator-spec-tests.js +280 -0
  110. package/dist/public/js/services/generator-spec-validate.js +192 -0
  111. package/dist/public/js/services/generator-specs.js +369 -0
  112. package/dist/public/js/services/generator-testing.js +64 -0
  113. package/dist/public/js/services/generator-validate.js +916 -0
  114. package/dist/public/js/services/generator.js +952 -0
  115. package/dist/public/js/services/knowledge.js +120 -0
  116. package/dist/public/js/services/memory.js +112 -0
  117. package/dist/public/js/services/nodes.js +55 -0
  118. package/dist/public/js/services/organisms.js +74 -0
  119. package/dist/public/js/services/packages.js +97 -0
  120. package/dist/public/js/services/security.js +67 -0
  121. package/dist/public/js/services/stats.js +11 -0
  122. package/dist/public/js/services/wallet.js +24 -0
  123. package/dist/public/js/services/work.js +51 -0
  124. package/dist/public/js/utils.js +184 -0
  125. package/dist/public/lib/htm.mjs +4 -0
  126. package/dist/public/lib/live-updates.js +89 -0
  127. package/dist/public/lib/minidenticons.min.js +1 -0
  128. package/dist/public/lib/preact-hooks.mjs +3 -0
  129. package/dist/public/lib/preact.mjs +3 -0
  130. package/dist/public/lib/realtime.js +549 -0
  131. package/dist/public/lib/three.min.js +6 -0
  132. package/dist/public/lib/yaml.mjs +141 -0
  133. package/dist/public/llms-template.txt +1043 -0
  134. package/dist/public/oauth-consent.html +388 -0
  135. package/dist/public/og-image.png +0 -0
  136. package/dist/public/robots.txt +52 -0
  137. package/dist/public/spa.html +533 -0
  138. package/dist/public/sw.js +34 -0
  139. package/dist/public/tmp-paste.txt +223 -0
  140. package/dist/public/views/_template.js +85 -0
  141. package/dist/public/views/admin/actions-tab.js +41 -0
  142. package/dist/public/views/admin/agents-tab.js +84 -0
  143. package/dist/public/views/admin/boards-tab.js +154 -0
  144. package/dist/public/views/admin/chat-instances-tab.js +207 -0
  145. package/dist/public/views/admin/config-tab.js +151 -0
  146. package/dist/public/views/admin/consul-tab.js +77 -0
  147. package/dist/public/views/admin/cors-tab.js +240 -0
  148. package/dist/public/views/admin/cortex-tab.js +171 -0
  149. package/dist/public/views/admin/csm-tab.js +261 -0
  150. package/dist/public/views/admin/directory-tab.js +44 -0
  151. package/dist/public/views/admin/economy-tab.js +80 -0
  152. package/dist/public/views/admin/email-tab.js +460 -0
  153. package/dist/public/views/admin/federation-tab.js +412 -0
  154. package/dist/public/views/admin/generator-debug-tab.js +238 -0
  155. package/dist/public/views/admin/genesis-tab.js +70 -0
  156. package/dist/public/views/admin/ghii-tab.js +101 -0
  157. package/dist/public/views/admin/hooks-tab.js +69 -0
  158. package/dist/public/views/admin/knowledge-tab.js +297 -0
  159. package/dist/public/views/admin/maintenance-tab.js +98 -0
  160. package/dist/public/views/admin/matching-tab.js +44 -0
  161. package/dist/public/views/admin/memory-tab.js +222 -0
  162. package/dist/public/views/admin/msm-tab.js +342 -0
  163. package/dist/public/views/admin/overview-tab.js +90 -0
  164. package/dist/public/views/admin/owners-tab.js +55 -0
  165. package/dist/public/views/admin/packages-tab.js +510 -0
  166. package/dist/public/views/admin/portal-tab.js +211 -0
  167. package/dist/public/views/admin/prompts-tab.js +287 -0
  168. package/dist/public/views/admin/push-tab.js +291 -0
  169. package/dist/public/views/admin/realtime-tab.js +68 -0
  170. package/dist/public/views/admin/scheduler-tab.js +156 -0
  171. package/dist/public/views/admin/services-tab.js +981 -0
  172. package/dist/public/views/admin/shared.js +148 -0
  173. package/dist/public/views/admin/stats-tab.js +187 -0
  174. package/dist/public/views/admin/work-tab.js +45 -0
  175. package/dist/public/views/admin.js +400 -0
  176. package/dist/public/views/aimeat-os.js +259 -0
  177. package/dist/public/views/guides.js +402 -0
  178. package/dist/public/views/help.js +79 -0
  179. package/dist/public/views/hobbies.js +697 -0
  180. package/dist/public/views/marketplace.js +647 -0
  181. package/dist/public/views/openclaw.js +223 -0
  182. package/dist/public/views/portal-classic.js +519 -0
  183. package/dist/public/views/portal-dev.js +816 -0
  184. package/dist/public/views/portal.js +1354 -0
  185. package/dist/public/views/portfolio.js +795 -0
  186. package/dist/public/views/profile/access-tab.js +58 -0
  187. package/dist/public/views/profile/agents-tab.js +689 -0
  188. package/dist/public/views/profile/apps-tab.js +197 -0
  189. package/dist/public/views/profile/boards-tab.js +323 -0
  190. package/dist/public/views/profile/calibrator-batch.js +926 -0
  191. package/dist/public/views/profile/calibrator-chart.js +135 -0
  192. package/dist/public/views/profile/calibrator-llm-editor.js +205 -0
  193. package/dist/public/views/profile/calibrator-tab.js +535 -0
  194. package/dist/public/views/profile/chat-sessions-tab.js +184 -0
  195. package/dist/public/views/profile/data-wallet-tab.js +313 -0
  196. package/dist/public/views/profile/email-tab.js +157 -0
  197. package/dist/public/views/profile/extensions-tab.js +711 -0
  198. package/dist/public/views/profile/federation-tab.js +63 -0
  199. package/dist/public/views/profile/foundry-dashboard/DebugPanel.js +193 -0
  200. package/dist/public/views/profile/foundry-dashboard/DiagnosticsPanel.js +69 -0
  201. package/dist/public/views/profile/foundry-dashboard/EditModePanel.js +141 -0
  202. package/dist/public/views/profile/foundry-dashboard/PackageDialog.js +96 -0
  203. package/dist/public/views/profile/foundry-dashboard/RemovePanel.js +53 -0
  204. package/dist/public/views/profile/foundry-dashboard/use-autopilot-state.js +53 -0
  205. package/dist/public/views/profile/foundry-dashboard/use-autopilot.js +1016 -0
  206. package/dist/public/views/profile/foundry-dashboard/use-dashboard-core.js +154 -0
  207. package/dist/public/views/profile/foundry-dashboard/use-edit-mode.js +294 -0
  208. package/dist/public/views/profile/foundry-dashboard/use-lifecycle.js +101 -0
  209. package/dist/public/views/profile/foundry-dashboard/use-packaging.js +97 -0
  210. package/dist/public/views/profile/foundry-dashboard/use-test-execution.js +275 -0
  211. package/dist/public/views/profile/foundry-dashboard.js +395 -0
  212. package/dist/public/views/profile/foundry-detail.js +1178 -0
  213. package/dist/public/views/profile/foundry-settings.js +377 -0
  214. package/dist/public/views/profile/foundry-tab.js +546 -0
  215. package/dist/public/views/profile/generator-dashboard/DebugPanel.js +193 -0
  216. package/dist/public/views/profile/generator-dashboard/DiagnosticsPanel.js +69 -0
  217. package/dist/public/views/profile/generator-dashboard/EditModePanel.js +141 -0
  218. package/dist/public/views/profile/generator-dashboard/PackageDialog.js +96 -0
  219. package/dist/public/views/profile/generator-dashboard/RemovePanel.js +53 -0
  220. package/dist/public/views/profile/generator-dashboard/use-autopilot-state.js +53 -0
  221. package/dist/public/views/profile/generator-dashboard/use-autopilot.js +136 -0
  222. package/dist/public/views/profile/generator-dashboard/use-dashboard-core.js +143 -0
  223. package/dist/public/views/profile/generator-dashboard/use-edit-mode.js +296 -0
  224. package/dist/public/views/profile/generator-dashboard/use-lifecycle.js +101 -0
  225. package/dist/public/views/profile/generator-dashboard/use-packaging.js +97 -0
  226. package/dist/public/views/profile/generator-dashboard/use-test-execution.js +275 -0
  227. package/dist/public/views/profile/generator-dashboard.js +377 -0
  228. package/dist/public/views/profile/generator-detail.js +1007 -0
  229. package/dist/public/views/profile/generator-settings.js +417 -0
  230. package/dist/public/views/profile/generator-tab.js +544 -0
  231. package/dist/public/views/profile/inline-panels.js +277 -0
  232. package/dist/public/views/profile/knowledge-tab.js +735 -0
  233. package/dist/public/views/profile/landing-page.js +539 -0
  234. package/dist/public/views/profile/mcp-tab.js +140 -0
  235. package/dist/public/views/profile/memory-tab.js +599 -0
  236. package/dist/public/views/profile/node-stats-tab.js +132 -0
  237. package/dist/public/views/profile/nodes-tab.js +195 -0
  238. package/dist/public/views/profile/notifications-tab.js +274 -0
  239. package/dist/public/views/profile/organisms-tab.js +402 -0
  240. package/dist/public/views/profile/packages-tab.js +393 -0
  241. package/dist/public/views/profile/portfolio-tab.js +31 -0
  242. package/dist/public/views/profile/security-tab.js +219 -0
  243. package/dist/public/views/profile/services-tab.js +281 -0
  244. package/dist/public/views/profile/shared.js +58 -0
  245. package/dist/public/views/profile/wallet-tab.js +272 -0
  246. package/dist/public/views/profile/work-tab.js +220 -0
  247. package/dist/public/views/profile.js +271 -0
  248. package/dist/public/wizard.html +1320 -0
  249. package/dist/scripts/db-init.d.ts +19 -0
  250. package/dist/scripts/db-init.d.ts.map +1 -0
  251. package/dist/scripts/db-init.js +168 -0
  252. package/dist/scripts/db-init.js.map +1 -0
  253. package/dist/scripts/db-reset.d.ts +15 -0
  254. package/dist/scripts/db-reset.d.ts.map +1 -0
  255. package/dist/scripts/db-reset.js +162 -0
  256. package/dist/scripts/db-reset.js.map +1 -0
  257. package/dist/scripts/indexnow.d.ts +18 -0
  258. package/dist/scripts/indexnow.d.ts.map +1 -0
  259. package/dist/scripts/indexnow.js +104 -0
  260. package/dist/scripts/indexnow.js.map +1 -0
  261. package/dist/scripts/kill-port.d.ts +3 -0
  262. package/dist/scripts/kill-port.d.ts.map +1 -0
  263. package/dist/scripts/kill-port.js +89 -0
  264. package/dist/scripts/kill-port.js.map +1 -0
  265. package/dist/scripts/seed-digital-signage.d.ts +13 -0
  266. package/dist/scripts/seed-digital-signage.d.ts.map +1 -0
  267. package/dist/scripts/seed-digital-signage.js +85 -0
  268. package/dist/scripts/seed-digital-signage.js.map +1 -0
  269. package/dist/src/auth/jwt.d.ts +40 -0
  270. package/dist/src/auth/jwt.d.ts.map +1 -0
  271. package/dist/src/auth/jwt.js +139 -0
  272. package/dist/src/auth/jwt.js.map +1 -0
  273. package/dist/src/auth/keypair.d.ts +8 -0
  274. package/dist/src/auth/keypair.d.ts.map +1 -0
  275. package/dist/src/auth/keypair.js +35 -0
  276. package/dist/src/auth/keypair.js.map +1 -0
  277. package/dist/src/auth/middleware.d.ts +50 -0
  278. package/dist/src/auth/middleware.d.ts.map +1 -0
  279. package/dist/src/auth/middleware.js +241 -0
  280. package/dist/src/auth/middleware.js.map +1 -0
  281. package/dist/src/auth/node-keys.d.ts +7 -0
  282. package/dist/src/auth/node-keys.d.ts.map +1 -0
  283. package/dist/src/auth/node-keys.js +116 -0
  284. package/dist/src/auth/node-keys.js.map +1 -0
  285. package/dist/src/cli/config-export.d.ts +9 -0
  286. package/dist/src/cli/config-export.d.ts.map +1 -0
  287. package/dist/src/cli/config-export.js +90 -0
  288. package/dist/src/cli/config-export.js.map +1 -0
  289. package/dist/src/cli/config-import.d.ts +10 -0
  290. package/dist/src/cli/config-import.d.ts.map +1 -0
  291. package/dist/src/cli/config-import.js +124 -0
  292. package/dist/src/cli/config-import.js.map +1 -0
  293. package/dist/src/cli/federation-join.d.ts +13 -0
  294. package/dist/src/cli/federation-join.d.ts.map +1 -0
  295. package/dist/src/cli/federation-join.js +395 -0
  296. package/dist/src/cli/federation-join.js.map +1 -0
  297. package/dist/src/cli/init-wizard.d.ts +8 -0
  298. package/dist/src/cli/init-wizard.d.ts.map +1 -0
  299. package/dist/src/cli/init-wizard.js +1489 -0
  300. package/dist/src/cli/init-wizard.js.map +1 -0
  301. package/dist/src/cli/scaffold.d.ts +33 -0
  302. package/dist/src/cli/scaffold.d.ts.map +1 -0
  303. package/dist/src/cli/scaffold.js +142 -0
  304. package/dist/src/cli/scaffold.js.map +1 -0
  305. package/dist/src/config.d.ts +272 -0
  306. package/dist/src/config.d.ts.map +1 -0
  307. package/dist/src/config.js +362 -0
  308. package/dist/src/config.js.map +1 -0
  309. package/dist/src/data/example-packages.d.ts +49 -0
  310. package/dist/src/data/example-packages.d.ts.map +1 -0
  311. package/dist/src/data/example-packages.js +814 -0
  312. package/dist/src/data/example-packages.js.map +1 -0
  313. package/dist/src/i18n.d.ts +19 -0
  314. package/dist/src/i18n.d.ts.map +1 -0
  315. package/dist/src/i18n.js +126 -0
  316. package/dist/src/i18n.js.map +1 -0
  317. package/dist/src/index.d.ts +3 -0
  318. package/dist/src/index.d.ts.map +1 -0
  319. package/dist/src/index.js +608 -0
  320. package/dist/src/index.js.map +1 -0
  321. package/dist/src/mcp/boards.d.ts +18 -0
  322. package/dist/src/mcp/boards.d.ts.map +1 -0
  323. package/dist/src/mcp/boards.js +279 -0
  324. package/dist/src/mcp/boards.js.map +1 -0
  325. package/dist/src/mcp/catalogue.d.ts +17 -0
  326. package/dist/src/mcp/catalogue.d.ts.map +1 -0
  327. package/dist/src/mcp/catalogue.js +114 -0
  328. package/dist/src/mcp/catalogue.js.map +1 -0
  329. package/dist/src/mcp/chat-instances.d.ts +18 -0
  330. package/dist/src/mcp/chat-instances.d.ts.map +1 -0
  331. package/dist/src/mcp/chat-instances.js +161 -0
  332. package/dist/src/mcp/chat-instances.js.map +1 -0
  333. package/dist/src/mcp/consent.d.ts +18 -0
  334. package/dist/src/mcp/consent.d.ts.map +1 -0
  335. package/dist/src/mcp/consent.js +158 -0
  336. package/dist/src/mcp/consent.js.map +1 -0
  337. package/dist/src/mcp/core.d.ts +18 -0
  338. package/dist/src/mcp/core.d.ts.map +1 -0
  339. package/dist/src/mcp/core.js +489 -0
  340. package/dist/src/mcp/core.js.map +1 -0
  341. package/dist/src/mcp/extensions.d.ts +18 -0
  342. package/dist/src/mcp/extensions.d.ts.map +1 -0
  343. package/dist/src/mcp/extensions.js +299 -0
  344. package/dist/src/mcp/extensions.js.map +1 -0
  345. package/dist/src/mcp/flags.d.ts +18 -0
  346. package/dist/src/mcp/flags.d.ts.map +1 -0
  347. package/dist/src/mcp/flags.js +59 -0
  348. package/dist/src/mcp/flags.js.map +1 -0
  349. package/dist/src/mcp/index.d.ts +31 -0
  350. package/dist/src/mcp/index.d.ts.map +1 -0
  351. package/dist/src/mcp/index.js +694 -0
  352. package/dist/src/mcp/index.js.map +1 -0
  353. package/dist/src/mcp/knowledge.d.ts +18 -0
  354. package/dist/src/mcp/knowledge.d.ts.map +1 -0
  355. package/dist/src/mcp/knowledge.js +214 -0
  356. package/dist/src/mcp/knowledge.js.map +1 -0
  357. package/dist/src/mcp/memory-extended.d.ts +18 -0
  358. package/dist/src/mcp/memory-extended.d.ts.map +1 -0
  359. package/dist/src/mcp/memory-extended.js +73 -0
  360. package/dist/src/mcp/memory-extended.js.map +1 -0
  361. package/dist/src/mcp/organisms.d.ts +18 -0
  362. package/dist/src/mcp/organisms.d.ts.map +1 -0
  363. package/dist/src/mcp/organisms.js +291 -0
  364. package/dist/src/mcp/organisms.js.map +1 -0
  365. package/dist/src/mcp/prompts.d.ts +17 -0
  366. package/dist/src/mcp/prompts.d.ts.map +1 -0
  367. package/dist/src/mcp/prompts.js +65 -0
  368. package/dist/src/mcp/prompts.js.map +1 -0
  369. package/dist/src/mcp/wallet-extended.d.ts +17 -0
  370. package/dist/src/mcp/wallet-extended.d.ts.map +1 -0
  371. package/dist/src/mcp/wallet-extended.js +42 -0
  372. package/dist/src/mcp/wallet-extended.js.map +1 -0
  373. package/dist/src/middleware/__tests__/cookie-consent.test.d.ts +2 -0
  374. package/dist/src/middleware/__tests__/cookie-consent.test.d.ts.map +1 -0
  375. package/dist/src/middleware/__tests__/cookie-consent.test.js +432 -0
  376. package/dist/src/middleware/__tests__/cookie-consent.test.js.map +1 -0
  377. package/dist/src/middleware/cookie-consent.d.ts +19 -0
  378. package/dist/src/middleware/cookie-consent.d.ts.map +1 -0
  379. package/dist/src/middleware/cookie-consent.js +127 -0
  380. package/dist/src/middleware/cookie-consent.js.map +1 -0
  381. package/dist/src/middleware/cors.d.ts +12 -0
  382. package/dist/src/middleware/cors.d.ts.map +1 -0
  383. package/dist/src/middleware/cors.js +112 -0
  384. package/dist/src/middleware/cors.js.map +1 -0
  385. package/dist/src/middleware/envelope.d.ts +33 -0
  386. package/dist/src/middleware/envelope.d.ts.map +1 -0
  387. package/dist/src/middleware/envelope.js +32 -0
  388. package/dist/src/middleware/envelope.js.map +1 -0
  389. package/dist/src/middleware/idempotency.d.ts +3 -0
  390. package/dist/src/middleware/idempotency.d.ts.map +1 -0
  391. package/dist/src/middleware/idempotency.js +64 -0
  392. package/dist/src/middleware/idempotency.js.map +1 -0
  393. package/dist/src/middleware/metrics.d.ts +8 -0
  394. package/dist/src/middleware/metrics.d.ts.map +1 -0
  395. package/dist/src/middleware/metrics.js +25 -0
  396. package/dist/src/middleware/metrics.js.map +1 -0
  397. package/dist/src/middleware/rate-limit.d.ts +4 -0
  398. package/dist/src/middleware/rate-limit.d.ts.map +1 -0
  399. package/dist/src/middleware/rate-limit.js +73 -0
  400. package/dist/src/middleware/rate-limit.js.map +1 -0
  401. package/dist/src/middleware/request-id.d.ts +18 -0
  402. package/dist/src/middleware/request-id.d.ts.map +1 -0
  403. package/dist/src/middleware/request-id.js +23 -0
  404. package/dist/src/middleware/request-id.js.map +1 -0
  405. package/dist/src/middleware/stats.d.ts +4 -0
  406. package/dist/src/middleware/stats.d.ts.map +1 -0
  407. package/dist/src/middleware/stats.js +11 -0
  408. package/dist/src/middleware/stats.js.map +1 -0
  409. package/dist/src/middleware/workspace-access.d.ts +16 -0
  410. package/dist/src/middleware/workspace-access.d.ts.map +1 -0
  411. package/dist/src/middleware/workspace-access.js +115 -0
  412. package/dist/src/middleware/workspace-access.js.map +1 -0
  413. package/dist/src/models/schemas.d.ts +311 -0
  414. package/dist/src/models/schemas.d.ts.map +1 -0
  415. package/dist/src/models/schemas.js +281 -0
  416. package/dist/src/models/schemas.js.map +1 -0
  417. package/dist/src/routes/actions.d.ts +5 -0
  418. package/dist/src/routes/actions.d.ts.map +1 -0
  419. package/dist/src/routes/actions.js +199 -0
  420. package/dist/src/routes/actions.js.map +1 -0
  421. package/dist/src/routes/admin-agents.d.ts +5 -0
  422. package/dist/src/routes/admin-agents.d.ts.map +1 -0
  423. package/dist/src/routes/admin-agents.js +60 -0
  424. package/dist/src/routes/admin-agents.js.map +1 -0
  425. package/dist/src/routes/admin-config.d.ts +7 -0
  426. package/dist/src/routes/admin-config.d.ts.map +1 -0
  427. package/dist/src/routes/admin-config.js +209 -0
  428. package/dist/src/routes/admin-config.js.map +1 -0
  429. package/dist/src/routes/admin-economy.d.ts +5 -0
  430. package/dist/src/routes/admin-economy.d.ts.map +1 -0
  431. package/dist/src/routes/admin-economy.js +57 -0
  432. package/dist/src/routes/admin-economy.js.map +1 -0
  433. package/dist/src/routes/admin-extensions.d.ts +6 -0
  434. package/dist/src/routes/admin-extensions.d.ts.map +1 -0
  435. package/dist/src/routes/admin-extensions.js +619 -0
  436. package/dist/src/routes/admin-extensions.js.map +1 -0
  437. package/dist/src/routes/admin-features.d.ts +16 -0
  438. package/dist/src/routes/admin-features.d.ts.map +1 -0
  439. package/dist/src/routes/admin-features.js +672 -0
  440. package/dist/src/routes/admin-features.js.map +1 -0
  441. package/dist/src/routes/admin-maintenance.d.ts +8 -0
  442. package/dist/src/routes/admin-maintenance.d.ts.map +1 -0
  443. package/dist/src/routes/admin-maintenance.js +86 -0
  444. package/dist/src/routes/admin-maintenance.js.map +1 -0
  445. package/dist/src/routes/admin-memory.d.ts +12 -0
  446. package/dist/src/routes/admin-memory.d.ts.map +1 -0
  447. package/dist/src/routes/admin-memory.js +64 -0
  448. package/dist/src/routes/admin-memory.js.map +1 -0
  449. package/dist/src/routes/admin-monitoring.d.ts +5 -0
  450. package/dist/src/routes/admin-monitoring.d.ts.map +1 -0
  451. package/dist/src/routes/admin-monitoring.js +343 -0
  452. package/dist/src/routes/admin-monitoring.js.map +1 -0
  453. package/dist/src/routes/admin-prompts.d.ts +5 -0
  454. package/dist/src/routes/admin-prompts.d.ts.map +1 -0
  455. package/dist/src/routes/admin-prompts.js +198 -0
  456. package/dist/src/routes/admin-prompts.js.map +1 -0
  457. package/dist/src/routes/admin-scheduler.d.ts +6 -0
  458. package/dist/src/routes/admin-scheduler.d.ts.map +1 -0
  459. package/dist/src/routes/admin-scheduler.js +153 -0
  460. package/dist/src/routes/admin-scheduler.js.map +1 -0
  461. package/dist/src/routes/admin.d.ts +10 -0
  462. package/dist/src/routes/admin.d.ts.map +1 -0
  463. package/dist/src/routes/admin.js +847 -0
  464. package/dist/src/routes/admin.js.map +1 -0
  465. package/dist/src/routes/agents.d.ts +5 -0
  466. package/dist/src/routes/agents.d.ts.map +1 -0
  467. package/dist/src/routes/agents.js +946 -0
  468. package/dist/src/routes/agents.js.map +1 -0
  469. package/dist/src/routes/app-store.d.ts +25 -0
  470. package/dist/src/routes/app-store.d.ts.map +1 -0
  471. package/dist/src/routes/app-store.js +269 -0
  472. package/dist/src/routes/app-store.js.map +1 -0
  473. package/dist/src/routes/appeals.d.ts +5 -0
  474. package/dist/src/routes/appeals.d.ts.map +1 -0
  475. package/dist/src/routes/appeals.js +241 -0
  476. package/dist/src/routes/appeals.js.map +1 -0
  477. package/dist/src/routes/apps.d.ts +14 -0
  478. package/dist/src/routes/apps.d.ts.map +1 -0
  479. package/dist/src/routes/apps.js +395 -0
  480. package/dist/src/routes/apps.js.map +1 -0
  481. package/dist/src/routes/auth.d.ts +13 -0
  482. package/dist/src/routes/auth.d.ts.map +1 -0
  483. package/dist/src/routes/auth.js +517 -0
  484. package/dist/src/routes/auth.js.map +1 -0
  485. package/dist/src/routes/boards.d.ts +5 -0
  486. package/dist/src/routes/boards.d.ts.map +1 -0
  487. package/dist/src/routes/boards.js +614 -0
  488. package/dist/src/routes/boards.js.map +1 -0
  489. package/dist/src/routes/bootstrap.d.ts +6 -0
  490. package/dist/src/routes/bootstrap.d.ts.map +1 -0
  491. package/dist/src/routes/bootstrap.js +360 -0
  492. package/dist/src/routes/bootstrap.js.map +1 -0
  493. package/dist/src/routes/calibrator.d.ts +28 -0
  494. package/dist/src/routes/calibrator.d.ts.map +1 -0
  495. package/dist/src/routes/calibrator.js +556 -0
  496. package/dist/src/routes/calibrator.js.map +1 -0
  497. package/dist/src/routes/catalogue.d.ts +7 -0
  498. package/dist/src/routes/catalogue.d.ts.map +1 -0
  499. package/dist/src/routes/catalogue.js +377 -0
  500. package/dist/src/routes/catalogue.js.map +1 -0
  501. package/dist/src/routes/chat-instances.d.ts +5 -0
  502. package/dist/src/routes/chat-instances.d.ts.map +1 -0
  503. package/dist/src/routes/chat-instances.js +131 -0
  504. package/dist/src/routes/chat-instances.js.map +1 -0
  505. package/dist/src/routes/consent.d.ts +6 -0
  506. package/dist/src/routes/consent.d.ts.map +1 -0
  507. package/dist/src/routes/consent.js +188 -0
  508. package/dist/src/routes/consent.js.map +1 -0
  509. package/dist/src/routes/cortex.d.ts +5 -0
  510. package/dist/src/routes/cortex.d.ts.map +1 -0
  511. package/dist/src/routes/cortex.js +617 -0
  512. package/dist/src/routes/cortex.js.map +1 -0
  513. package/dist/src/routes/csm.d.ts +5 -0
  514. package/dist/src/routes/csm.d.ts.map +1 -0
  515. package/dist/src/routes/csm.js +258 -0
  516. package/dist/src/routes/csm.js.map +1 -0
  517. package/dist/src/routes/disputes.d.ts +5 -0
  518. package/dist/src/routes/disputes.d.ts.map +1 -0
  519. package/dist/src/routes/disputes.js +528 -0
  520. package/dist/src/routes/disputes.js.map +1 -0
  521. package/dist/src/routes/extensions.d.ts +6 -0
  522. package/dist/src/routes/extensions.d.ts.map +1 -0
  523. package/dist/src/routes/extensions.js +1149 -0
  524. package/dist/src/routes/extensions.js.map +1 -0
  525. package/dist/src/routes/federation-genesis.d.ts +11 -0
  526. package/dist/src/routes/federation-genesis.d.ts.map +1 -0
  527. package/dist/src/routes/federation-genesis.js +638 -0
  528. package/dist/src/routes/federation-genesis.js.map +1 -0
  529. package/dist/src/routes/federation-peer.d.ts +10 -0
  530. package/dist/src/routes/federation-peer.d.ts.map +1 -0
  531. package/dist/src/routes/federation-peer.js +613 -0
  532. package/dist/src/routes/federation-peer.js.map +1 -0
  533. package/dist/src/routes/federation-settlements.d.ts +10 -0
  534. package/dist/src/routes/federation-settlements.d.ts.map +1 -0
  535. package/dist/src/routes/federation-settlements.js +231 -0
  536. package/dist/src/routes/federation-settlements.js.map +1 -0
  537. package/dist/src/routes/federation-sync.d.ts +15 -0
  538. package/dist/src/routes/federation-sync.d.ts.map +1 -0
  539. package/dist/src/routes/federation-sync.js +629 -0
  540. package/dist/src/routes/federation-sync.js.map +1 -0
  541. package/dist/src/routes/federation.d.ts +15 -0
  542. package/dist/src/routes/federation.d.ts.map +1 -0
  543. package/dist/src/routes/federation.js +23 -0
  544. package/dist/src/routes/federation.js.map +1 -0
  545. package/dist/src/routes/flags.d.ts +5 -0
  546. package/dist/src/routes/flags.d.ts.map +1 -0
  547. package/dist/src/routes/flags.js +194 -0
  548. package/dist/src/routes/flags.js.map +1 -0
  549. package/dist/src/routes/foundry.d.ts +5 -0
  550. package/dist/src/routes/foundry.d.ts.map +1 -0
  551. package/dist/src/routes/foundry.js +955 -0
  552. package/dist/src/routes/foundry.js.map +1 -0
  553. package/dist/src/routes/generator-autopilot.d.ts +12 -0
  554. package/dist/src/routes/generator-autopilot.d.ts.map +1 -0
  555. package/dist/src/routes/generator-autopilot.js +71 -0
  556. package/dist/src/routes/generator-autopilot.js.map +1 -0
  557. package/dist/src/routes/generator.d.ts +5 -0
  558. package/dist/src/routes/generator.d.ts.map +1 -0
  559. package/dist/src/routes/generator.js +1313 -0
  560. package/dist/src/routes/generator.js.map +1 -0
  561. package/dist/src/routes/ghii.d.ts +16 -0
  562. package/dist/src/routes/ghii.d.ts.map +1 -0
  563. package/dist/src/routes/ghii.js +1115 -0
  564. package/dist/src/routes/ghii.js.map +1 -0
  565. package/dist/src/routes/instances.d.ts +31 -0
  566. package/dist/src/routes/instances.d.ts.map +1 -0
  567. package/dist/src/routes/instances.js +722 -0
  568. package/dist/src/routes/instances.js.map +1 -0
  569. package/dist/src/routes/knowledge.d.ts +33 -0
  570. package/dist/src/routes/knowledge.d.ts.map +1 -0
  571. package/dist/src/routes/knowledge.js +1108 -0
  572. package/dist/src/routes/knowledge.js.map +1 -0
  573. package/dist/src/routes/lib-data.d.ts +7 -0
  574. package/dist/src/routes/lib-data.d.ts.map +1 -0
  575. package/dist/src/routes/lib-data.js +189 -0
  576. package/dist/src/routes/lib-data.js.map +1 -0
  577. package/dist/src/routes/lib-social.d.ts +7 -0
  578. package/dist/src/routes/lib-social.d.ts.map +1 -0
  579. package/dist/src/routes/lib-social.js +159 -0
  580. package/dist/src/routes/lib-social.js.map +1 -0
  581. package/dist/src/routes/lib-storage.d.ts +7 -0
  582. package/dist/src/routes/lib-storage.d.ts.map +1 -0
  583. package/dist/src/routes/lib-storage.js +202 -0
  584. package/dist/src/routes/lib-storage.js.map +1 -0
  585. package/dist/src/routes/lib-tunnel.d.ts +8 -0
  586. package/dist/src/routes/lib-tunnel.d.ts.map +1 -0
  587. package/dist/src/routes/lib-tunnel.js +442 -0
  588. package/dist/src/routes/lib-tunnel.js.map +1 -0
  589. package/dist/src/routes/lib-wallet.d.ts +7 -0
  590. package/dist/src/routes/lib-wallet.d.ts.map +1 -0
  591. package/dist/src/routes/lib-wallet.js +129 -0
  592. package/dist/src/routes/lib-wallet.js.map +1 -0
  593. package/dist/src/routes/lib-work.d.ts +7 -0
  594. package/dist/src/routes/lib-work.d.ts.map +1 -0
  595. package/dist/src/routes/lib-work.js +210 -0
  596. package/dist/src/routes/lib-work.js.map +1 -0
  597. package/dist/src/routes/libs.d.ts +10 -0
  598. package/dist/src/routes/libs.d.ts.map +1 -0
  599. package/dist/src/routes/libs.js +989 -0
  600. package/dist/src/routes/libs.js.map +1 -0
  601. package/dist/src/routes/matches.d.ts +10 -0
  602. package/dist/src/routes/matches.d.ts.map +1 -0
  603. package/dist/src/routes/matches.js +218 -0
  604. package/dist/src/routes/matches.js.map +1 -0
  605. package/dist/src/routes/memory.d.ts +6 -0
  606. package/dist/src/routes/memory.d.ts.map +1 -0
  607. package/dist/src/routes/memory.js +796 -0
  608. package/dist/src/routes/memory.js.map +1 -0
  609. package/dist/src/routes/micro-memory.d.ts +5 -0
  610. package/dist/src/routes/micro-memory.d.ts.map +1 -0
  611. package/dist/src/routes/micro-memory.js +488 -0
  612. package/dist/src/routes/micro-memory.js.map +1 -0
  613. package/dist/src/routes/msm.d.ts +5 -0
  614. package/dist/src/routes/msm.d.ts.map +1 -0
  615. package/dist/src/routes/msm.js +242 -0
  616. package/dist/src/routes/msm.js.map +1 -0
  617. package/dist/src/routes/openrouter.d.ts +23 -0
  618. package/dist/src/routes/openrouter.d.ts.map +1 -0
  619. package/dist/src/routes/openrouter.js +337 -0
  620. package/dist/src/routes/openrouter.js.map +1 -0
  621. package/dist/src/routes/organisms.d.ts +5 -0
  622. package/dist/src/routes/organisms.d.ts.map +1 -0
  623. package/dist/src/routes/organisms.js +415 -0
  624. package/dist/src/routes/organisms.js.map +1 -0
  625. package/dist/src/routes/owners.d.ts +5 -0
  626. package/dist/src/routes/owners.d.ts.map +1 -0
  627. package/dist/src/routes/owners.js +637 -0
  628. package/dist/src/routes/owners.js.map +1 -0
  629. package/dist/src/routes/packages.d.ts +35 -0
  630. package/dist/src/routes/packages.d.ts.map +1 -0
  631. package/dist/src/routes/packages.js +600 -0
  632. package/dist/src/routes/packages.js.map +1 -0
  633. package/dist/src/routes/permissions.d.ts +5 -0
  634. package/dist/src/routes/permissions.d.ts.map +1 -0
  635. package/dist/src/routes/permissions.js +85 -0
  636. package/dist/src/routes/permissions.js.map +1 -0
  637. package/dist/src/routes/personal.d.ts +7 -0
  638. package/dist/src/routes/personal.d.ts.map +1 -0
  639. package/dist/src/routes/personal.js +594 -0
  640. package/dist/src/routes/personal.js.map +1 -0
  641. package/dist/src/routes/portal-api.d.ts +9 -0
  642. package/dist/src/routes/portal-api.d.ts.map +1 -0
  643. package/dist/src/routes/portal-api.js +49 -0
  644. package/dist/src/routes/portal-api.js.map +1 -0
  645. package/dist/src/routes/portal-human.d.ts +12 -0
  646. package/dist/src/routes/portal-human.d.ts.map +1 -0
  647. package/dist/src/routes/portal-human.js +2652 -0
  648. package/dist/src/routes/portal-human.js.map +1 -0
  649. package/dist/src/routes/portal.d.ts +24 -0
  650. package/dist/src/routes/portal.d.ts.map +1 -0
  651. package/dist/src/routes/portal.js +372 -0
  652. package/dist/src/routes/portal.js.map +1 -0
  653. package/dist/src/routes/portfolio.d.ts +5 -0
  654. package/dist/src/routes/portfolio.d.ts.map +1 -0
  655. package/dist/src/routes/portfolio.js +231 -0
  656. package/dist/src/routes/portfolio.js.map +1 -0
  657. package/dist/src/routes/profile.d.ts +5 -0
  658. package/dist/src/routes/profile.d.ts.map +1 -0
  659. package/dist/src/routes/profile.js +2042 -0
  660. package/dist/src/routes/profile.js.map +1 -0
  661. package/dist/src/routes/prompts.d.ts +5 -0
  662. package/dist/src/routes/prompts.d.ts.map +1 -0
  663. package/dist/src/routes/prompts.js +318 -0
  664. package/dist/src/routes/prompts.js.map +1 -0
  665. package/dist/src/routes/push.d.ts +6 -0
  666. package/dist/src/routes/push.d.ts.map +1 -0
  667. package/dist/src/routes/push.js +75 -0
  668. package/dist/src/routes/push.js.map +1 -0
  669. package/dist/src/routes/realtime.d.ts +7 -0
  670. package/dist/src/routes/realtime.d.ts.map +1 -0
  671. package/dist/src/routes/realtime.js +289 -0
  672. package/dist/src/routes/realtime.js.map +1 -0
  673. package/dist/src/routes/schemas.d.ts +5 -0
  674. package/dist/src/routes/schemas.d.ts.map +1 -0
  675. package/dist/src/routes/schemas.js +130 -0
  676. package/dist/src/routes/schemas.js.map +1 -0
  677. package/dist/src/routes/setup.d.ts +7 -0
  678. package/dist/src/routes/setup.d.ts.map +1 -0
  679. package/dist/src/routes/setup.js +243 -0
  680. package/dist/src/routes/setup.js.map +1 -0
  681. package/dist/src/routes/site.d.ts +6 -0
  682. package/dist/src/routes/site.d.ts.map +1 -0
  683. package/dist/src/routes/site.js +201 -0
  684. package/dist/src/routes/site.js.map +1 -0
  685. package/dist/src/routes/spec.d.ts +3 -0
  686. package/dist/src/routes/spec.d.ts.map +1 -0
  687. package/dist/src/routes/spec.js +47 -0
  688. package/dist/src/routes/spec.js.map +1 -0
  689. package/dist/src/routes/sse.d.ts +5 -0
  690. package/dist/src/routes/sse.d.ts.map +1 -0
  691. package/dist/src/routes/sse.js +66 -0
  692. package/dist/src/routes/sse.js.map +1 -0
  693. package/dist/src/routes/stats.d.ts +7 -0
  694. package/dist/src/routes/stats.d.ts.map +1 -0
  695. package/dist/src/routes/stats.js +98 -0
  696. package/dist/src/routes/stats.js.map +1 -0
  697. package/dist/src/routes/storage-files.d.ts +5 -0
  698. package/dist/src/routes/storage-files.d.ts.map +1 -0
  699. package/dist/src/routes/storage-files.js +460 -0
  700. package/dist/src/routes/storage-files.js.map +1 -0
  701. package/dist/src/routes/templates.d.ts +30 -0
  702. package/dist/src/routes/templates.d.ts.map +1 -0
  703. package/dist/src/routes/templates.js +511 -0
  704. package/dist/src/routes/templates.js.map +1 -0
  705. package/dist/src/routes/totp.d.ts +5 -0
  706. package/dist/src/routes/totp.d.ts.map +1 -0
  707. package/dist/src/routes/totp.js +166 -0
  708. package/dist/src/routes/totp.js.map +1 -0
  709. package/dist/src/routes/validate.d.ts +4 -0
  710. package/dist/src/routes/validate.d.ts.map +1 -0
  711. package/dist/src/routes/validate.js +71 -0
  712. package/dist/src/routes/validate.js.map +1 -0
  713. package/dist/src/routes/verification.d.ts +8 -0
  714. package/dist/src/routes/verification.d.ts.map +1 -0
  715. package/dist/src/routes/verification.js +259 -0
  716. package/dist/src/routes/verification.js.map +1 -0
  717. package/dist/src/routes/wallet.d.ts +18 -0
  718. package/dist/src/routes/wallet.d.ts.map +1 -0
  719. package/dist/src/routes/wallet.js +164 -0
  720. package/dist/src/routes/wallet.js.map +1 -0
  721. package/dist/src/routes/wellknown.d.ts +5 -0
  722. package/dist/src/routes/wellknown.d.ts.map +1 -0
  723. package/dist/src/routes/wellknown.js +57 -0
  724. package/dist/src/routes/wellknown.js.map +1 -0
  725. package/dist/src/routes/work.d.ts +21 -0
  726. package/dist/src/routes/work.d.ts.map +1 -0
  727. package/dist/src/routes/work.js +654 -0
  728. package/dist/src/routes/work.js.map +1 -0
  729. package/dist/src/schemas/knowledge-package.d.ts +203 -0
  730. package/dist/src/schemas/knowledge-package.d.ts.map +1 -0
  731. package/dist/src/schemas/knowledge-package.js +233 -0
  732. package/dist/src/schemas/knowledge-package.js.map +1 -0
  733. package/dist/src/server-bootstrap/config-init.d.ts +16 -0
  734. package/dist/src/server-bootstrap/config-init.d.ts.map +1 -0
  735. package/dist/src/server-bootstrap/config-init.js +113 -0
  736. package/dist/src/server-bootstrap/config-init.js.map +1 -0
  737. package/dist/src/server-bootstrap/middleware-guards.d.ts +15 -0
  738. package/dist/src/server-bootstrap/middleware-guards.d.ts.map +1 -0
  739. package/dist/src/server-bootstrap/middleware-guards.js +244 -0
  740. package/dist/src/server-bootstrap/middleware-guards.js.map +1 -0
  741. package/dist/src/server-bootstrap/routes-loader.d.ts +35 -0
  742. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -0
  743. package/dist/src/server-bootstrap/routes-loader.js +290 -0
  744. package/dist/src/server-bootstrap/routes-loader.js.map +1 -0
  745. package/dist/src/server-bootstrap/service-init.d.ts +24 -0
  746. package/dist/src/server-bootstrap/service-init.d.ts.map +1 -0
  747. package/dist/src/server-bootstrap/service-init.js +195 -0
  748. package/dist/src/server-bootstrap/service-init.js.map +1 -0
  749. package/dist/src/server-bootstrap/static-files.d.ts +7 -0
  750. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -0
  751. package/dist/src/server-bootstrap/static-files.js +119 -0
  752. package/dist/src/server-bootstrap/static-files.js.map +1 -0
  753. package/dist/src/server.d.ts +22 -0
  754. package/dist/src/server.d.ts.map +1 -0
  755. package/dist/src/server.js +133 -0
  756. package/dist/src/server.js.map +1 -0
  757. package/dist/src/services/cache-cleanup.d.ts +31 -0
  758. package/dist/src/services/cache-cleanup.d.ts.map +1 -0
  759. package/dist/src/services/cache-cleanup.js +123 -0
  760. package/dist/src/services/cache-cleanup.js.map +1 -0
  761. package/dist/src/services/catalogue-sync.d.ts +45 -0
  762. package/dist/src/services/catalogue-sync.d.ts.map +1 -0
  763. package/dist/src/services/catalogue-sync.js +196 -0
  764. package/dist/src/services/catalogue-sync.js.map +1 -0
  765. package/dist/src/services/component-registrar.d.ts +46 -0
  766. package/dist/src/services/component-registrar.d.ts.map +1 -0
  767. package/dist/src/services/component-registrar.js +389 -0
  768. package/dist/src/services/component-registrar.js.map +1 -0
  769. package/dist/src/services/config-loader.d.ts +42 -0
  770. package/dist/src/services/config-loader.d.ts.map +1 -0
  771. package/dist/src/services/config-loader.js +187 -0
  772. package/dist/src/services/config-loader.js.map +1 -0
  773. package/dist/src/services/config-provenance.d.ts +32 -0
  774. package/dist/src/services/config-provenance.d.ts.map +1 -0
  775. package/dist/src/services/config-provenance.js +59 -0
  776. package/dist/src/services/config-provenance.js.map +1 -0
  777. package/dist/src/services/config-schema.d.ts +52 -0
  778. package/dist/src/services/config-schema.d.ts.map +1 -0
  779. package/dist/src/services/config-schema.js +288 -0
  780. package/dist/src/services/config-schema.js.map +1 -0
  781. package/dist/src/services/consent.d.ts +43 -0
  782. package/dist/src/services/consent.d.ts.map +1 -0
  783. package/dist/src/services/consent.js +137 -0
  784. package/dist/src/services/consent.js.map +1 -0
  785. package/dist/src/services/consul-config.d.ts +30 -0
  786. package/dist/src/services/consul-config.d.ts.map +1 -0
  787. package/dist/src/services/consul-config.js +110 -0
  788. package/dist/src/services/consul-config.js.map +1 -0
  789. package/dist/src/services/core-jobs.d.ts +8 -0
  790. package/dist/src/services/core-jobs.d.ts.map +1 -0
  791. package/dist/src/services/core-jobs.js +161 -0
  792. package/dist/src/services/core-jobs.js.map +1 -0
  793. package/dist/src/services/cortex-manifest.d.ts +17 -0
  794. package/dist/src/services/cortex-manifest.d.ts.map +1 -0
  795. package/dist/src/services/cortex-manifest.js +343 -0
  796. package/dist/src/services/cortex-manifest.js.map +1 -0
  797. package/dist/src/services/cortex-seeder.d.ts +18 -0
  798. package/dist/src/services/cortex-seeder.d.ts.map +1 -0
  799. package/dist/src/services/cortex-seeder.js +86 -0
  800. package/dist/src/services/cortex-seeder.js.map +1 -0
  801. package/dist/src/services/cross-node-matching.d.ts +23 -0
  802. package/dist/src/services/cross-node-matching.d.ts.map +1 -0
  803. package/dist/src/services/cross-node-matching.js +62 -0
  804. package/dist/src/services/cross-node-matching.js.map +1 -0
  805. package/dist/src/services/csm-parser.d.ts +57 -0
  806. package/dist/src/services/csm-parser.d.ts.map +1 -0
  807. package/dist/src/services/csm-parser.js +161 -0
  808. package/dist/src/services/csm-parser.js.map +1 -0
  809. package/dist/src/services/csm-seed.d.ts +15 -0
  810. package/dist/src/services/csm-seed.d.ts.map +1 -0
  811. package/dist/src/services/csm-seed.js +89 -0
  812. package/dist/src/services/csm-seed.js.map +1 -0
  813. package/dist/src/services/directory.d.ts +86 -0
  814. package/dist/src/services/directory.d.ts.map +1 -0
  815. package/dist/src/services/directory.js +307 -0
  816. package/dist/src/services/directory.js.map +1 -0
  817. package/dist/src/services/email-templates.d.ts +29 -0
  818. package/dist/src/services/email-templates.d.ts.map +1 -0
  819. package/dist/src/services/email-templates.js +204 -0
  820. package/dist/src/services/email-templates.js.map +1 -0
  821. package/dist/src/services/email.d.ts +18 -0
  822. package/dist/src/services/email.d.ts.map +1 -0
  823. package/dist/src/services/email.js +102 -0
  824. package/dist/src/services/email.js.map +1 -0
  825. package/dist/src/services/encryption.d.ts +31 -0
  826. package/dist/src/services/encryption.d.ts.map +1 -0
  827. package/dist/src/services/encryption.js +51 -0
  828. package/dist/src/services/encryption.js.map +1 -0
  829. package/dist/src/services/eudiw.d.ts +15 -0
  830. package/dist/src/services/eudiw.d.ts.map +1 -0
  831. package/dist/src/services/eudiw.js +89 -0
  832. package/dist/src/services/eudiw.js.map +1 -0
  833. package/dist/src/services/event-bus.d.ts +8 -0
  834. package/dist/src/services/event-bus.d.ts.map +1 -0
  835. package/dist/src/services/event-bus.js +13 -0
  836. package/dist/src/services/event-bus.js.map +1 -0
  837. package/dist/src/services/extension-runtime.d.ts +72 -0
  838. package/dist/src/services/extension-runtime.d.ts.map +1 -0
  839. package/dist/src/services/extension-runtime.js +282 -0
  840. package/dist/src/services/extension-runtime.js.map +1 -0
  841. package/dist/src/services/federation-helpers.d.ts +37 -0
  842. package/dist/src/services/federation-helpers.d.ts.map +1 -0
  843. package/dist/src/services/federation-helpers.js +100 -0
  844. package/dist/src/services/federation-helpers.js.map +1 -0
  845. package/dist/src/services/federation.d.ts +32 -0
  846. package/dist/src/services/federation.d.ts.map +1 -0
  847. package/dist/src/services/federation.js +201 -0
  848. package/dist/src/services/federation.js.map +1 -0
  849. package/dist/src/services/foundry-debug.d.ts +77 -0
  850. package/dist/src/services/foundry-debug.d.ts.map +1 -0
  851. package/dist/src/services/foundry-debug.js +214 -0
  852. package/dist/src/services/foundry-debug.js.map +1 -0
  853. package/dist/src/services/foundry-registration.d.ts +42 -0
  854. package/dist/src/services/foundry-registration.d.ts.map +1 -0
  855. package/dist/src/services/foundry-registration.js +330 -0
  856. package/dist/src/services/foundry-registration.js.map +1 -0
  857. package/dist/src/services/foundry-testing.d.ts +90 -0
  858. package/dist/src/services/foundry-testing.d.ts.map +1 -0
  859. package/dist/src/services/foundry-testing.js +253 -0
  860. package/dist/src/services/foundry-testing.js.map +1 -0
  861. package/dist/src/services/foundry-validate.d.ts +115 -0
  862. package/dist/src/services/foundry-validate.d.ts.map +1 -0
  863. package/dist/src/services/foundry-validate.js +781 -0
  864. package/dist/src/services/foundry-validate.js.map +1 -0
  865. package/dist/src/services/generator-autopilot.d.ts +37 -0
  866. package/dist/src/services/generator-autopilot.d.ts.map +1 -0
  867. package/dist/src/services/generator-autopilot.js +1076 -0
  868. package/dist/src/services/generator-autopilot.js.map +1 -0
  869. package/dist/src/services/generator-debug.d.ts +79 -0
  870. package/dist/src/services/generator-debug.d.ts.map +1 -0
  871. package/dist/src/services/generator-debug.js +218 -0
  872. package/dist/src/services/generator-debug.js.map +1 -0
  873. package/dist/src/services/generator-prompt-seeds.d.ts +13 -0
  874. package/dist/src/services/generator-prompt-seeds.d.ts.map +1 -0
  875. package/dist/src/services/generator-prompt-seeds.js +2694 -0
  876. package/dist/src/services/generator-prompt-seeds.js.map +1 -0
  877. package/dist/src/services/generator-prompts/bundle.d.ts +17 -0
  878. package/dist/src/services/generator-prompts/bundle.d.ts.map +1 -0
  879. package/dist/src/services/generator-prompts/bundle.js +95 -0
  880. package/dist/src/services/generator-prompts/bundle.js.map +1 -0
  881. package/dist/src/services/generator-prompts/index.d.ts +48 -0
  882. package/dist/src/services/generator-prompts/index.d.ts.map +1 -0
  883. package/dist/src/services/generator-prompts/index.js +97 -0
  884. package/dist/src/services/generator-prompts/index.js.map +1 -0
  885. package/dist/src/services/generator-prompts/resolvers.d.ts +21 -0
  886. package/dist/src/services/generator-prompts/resolvers.d.ts.map +1 -0
  887. package/dist/src/services/generator-prompts/resolvers.js +1553 -0
  888. package/dist/src/services/generator-prompts/resolvers.js.map +1 -0
  889. package/dist/src/services/generator-prompts/spec-validate.d.ts +29 -0
  890. package/dist/src/services/generator-prompts/spec-validate.d.ts.map +1 -0
  891. package/dist/src/services/generator-prompts/spec-validate.js +190 -0
  892. package/dist/src/services/generator-prompts/spec-validate.js.map +1 -0
  893. package/dist/src/services/generator-prompts/strip.d.ts +13 -0
  894. package/dist/src/services/generator-prompts/strip.d.ts.map +1 -0
  895. package/dist/src/services/generator-prompts/strip.js +60 -0
  896. package/dist/src/services/generator-prompts/strip.js.map +1 -0
  897. package/dist/src/services/generator-prompts/types.d.ts +229 -0
  898. package/dist/src/services/generator-prompts/types.d.ts.map +1 -0
  899. package/dist/src/services/generator-prompts/types.js +8 -0
  900. package/dist/src/services/generator-prompts/types.js.map +1 -0
  901. package/dist/src/services/generator-prompts/validate.d.ts +48 -0
  902. package/dist/src/services/generator-prompts/validate.d.ts.map +1 -0
  903. package/dist/src/services/generator-prompts/validate.js +927 -0
  904. package/dist/src/services/generator-prompts/validate.js.map +1 -0
  905. package/dist/src/services/generator-registration.d.ts +43 -0
  906. package/dist/src/services/generator-registration.d.ts.map +1 -0
  907. package/dist/src/services/generator-registration.js +343 -0
  908. package/dist/src/services/generator-registration.js.map +1 -0
  909. package/dist/src/services/generator-testing.d.ts +93 -0
  910. package/dist/src/services/generator-testing.d.ts.map +1 -0
  911. package/dist/src/services/generator-testing.js +300 -0
  912. package/dist/src/services/generator-testing.js.map +1 -0
  913. package/dist/src/services/generator-validate.d.ts +117 -0
  914. package/dist/src/services/generator-validate.d.ts.map +1 -0
  915. package/dist/src/services/generator-validate.js +790 -0
  916. package/dist/src/services/generator-validate.js.map +1 -0
  917. package/dist/src/services/genesis-peering.d.ts +12 -0
  918. package/dist/src/services/genesis-peering.d.ts.map +1 -0
  919. package/dist/src/services/genesis-peering.js +91 -0
  920. package/dist/src/services/genesis-peering.js.map +1 -0
  921. package/dist/src/services/genesis-sync.d.ts +29 -0
  922. package/dist/src/services/genesis-sync.d.ts.map +1 -0
  923. package/dist/src/services/genesis-sync.js +370 -0
  924. package/dist/src/services/genesis-sync.js.map +1 -0
  925. package/dist/src/services/hooks.d.ts +21 -0
  926. package/dist/src/services/hooks.d.ts.map +1 -0
  927. package/dist/src/services/hooks.js +85 -0
  928. package/dist/src/services/hooks.js.map +1 -0
  929. package/dist/src/services/job-seeding.d.ts +7 -0
  930. package/dist/src/services/job-seeding.d.ts.map +1 -0
  931. package/dist/src/services/job-seeding.js +39 -0
  932. package/dist/src/services/job-seeding.js.map +1 -0
  933. package/dist/src/services/knowledge.d.ts +13 -0
  934. package/dist/src/services/knowledge.d.ts.map +1 -0
  935. package/dist/src/services/knowledge.js +15 -0
  936. package/dist/src/services/knowledge.js.map +1 -0
  937. package/dist/src/services/mailbox-notification.d.ts +37 -0
  938. package/dist/src/services/mailbox-notification.d.ts.map +1 -0
  939. package/dist/src/services/mailbox-notification.js +249 -0
  940. package/dist/src/services/mailbox-notification.js.map +1 -0
  941. package/dist/src/services/mailbox.d.ts +16 -0
  942. package/dist/src/services/mailbox.d.ts.map +1 -0
  943. package/dist/src/services/mailbox.js +77 -0
  944. package/dist/src/services/mailbox.js.map +1 -0
  945. package/dist/src/services/match-notification.d.ts +12 -0
  946. package/dist/src/services/match-notification.d.ts.map +1 -0
  947. package/dist/src/services/match-notification.js +121 -0
  948. package/dist/src/services/match-notification.js.map +1 -0
  949. package/dist/src/services/matching.d.ts +54 -0
  950. package/dist/src/services/matching.d.ts.map +1 -0
  951. package/dist/src/services/matching.js +293 -0
  952. package/dist/src/services/matching.js.map +1 -0
  953. package/dist/src/services/memory-replication.d.ts +43 -0
  954. package/dist/src/services/memory-replication.d.ts.map +1 -0
  955. package/dist/src/services/memory-replication.js +213 -0
  956. package/dist/src/services/memory-replication.js.map +1 -0
  957. package/dist/src/services/morsel.d.ts +49 -0
  958. package/dist/src/services/morsel.d.ts.map +1 -0
  959. package/dist/src/services/morsel.js +174 -0
  960. package/dist/src/services/morsel.js.map +1 -0
  961. package/dist/src/services/msm-parser.d.ts +55 -0
  962. package/dist/src/services/msm-parser.d.ts.map +1 -0
  963. package/dist/src/services/msm-parser.js +186 -0
  964. package/dist/src/services/msm-parser.js.map +1 -0
  965. package/dist/src/services/mydata-receipt.d.ts +29 -0
  966. package/dist/src/services/mydata-receipt.d.ts.map +1 -0
  967. package/dist/src/services/mydata-receipt.js +31 -0
  968. package/dist/src/services/mydata-receipt.js.map +1 -0
  969. package/dist/src/services/notification-templates.d.ts +40 -0
  970. package/dist/src/services/notification-templates.d.ts.map +1 -0
  971. package/dist/src/services/notification-templates.js +109 -0
  972. package/dist/src/services/notification-templates.js.map +1 -0
  973. package/dist/src/services/openrouter.d.ts +30 -0
  974. package/dist/src/services/openrouter.d.ts.map +1 -0
  975. package/dist/src/services/openrouter.js +95 -0
  976. package/dist/src/services/openrouter.js.map +1 -0
  977. package/dist/src/services/organism-reputation.d.ts +7 -0
  978. package/dist/src/services/organism-reputation.d.ts.map +1 -0
  979. package/dist/src/services/organism-reputation.js +107 -0
  980. package/dist/src/services/organism-reputation.js.map +1 -0
  981. package/dist/src/services/package-hash.d.ts +19 -0
  982. package/dist/src/services/package-hash.d.ts.map +1 -0
  983. package/dist/src/services/package-hash.js +22 -0
  984. package/dist/src/services/package-hash.js.map +1 -0
  985. package/dist/src/services/package-zip.d.ts +60 -0
  986. package/dist/src/services/package-zip.d.ts.map +1 -0
  987. package/dist/src/services/package-zip.js +267 -0
  988. package/dist/src/services/package-zip.js.map +1 -0
  989. package/dist/src/services/password.d.ts +9 -0
  990. package/dist/src/services/password.d.ts.map +1 -0
  991. package/dist/src/services/password.js +32 -0
  992. package/dist/src/services/password.js.map +1 -0
  993. package/dist/src/services/personal-routing.d.ts +21 -0
  994. package/dist/src/services/personal-routing.d.ts.map +1 -0
  995. package/dist/src/services/personal-routing.js +77 -0
  996. package/dist/src/services/personal-routing.js.map +1 -0
  997. package/dist/src/services/personal-tunnel.d.ts +39 -0
  998. package/dist/src/services/personal-tunnel.d.ts.map +1 -0
  999. package/dist/src/services/personal-tunnel.js +371 -0
  1000. package/dist/src/services/personal-tunnel.js.map +1 -0
  1001. package/dist/src/services/profile-schemas.d.ts +12 -0
  1002. package/dist/src/services/profile-schemas.d.ts.map +1 -0
  1003. package/dist/src/services/profile-schemas.js +100 -0
  1004. package/dist/src/services/profile-schemas.js.map +1 -0
  1005. package/dist/src/services/prometheus.d.ts +32 -0
  1006. package/dist/src/services/prometheus.d.ts.map +1 -0
  1007. package/dist/src/services/prometheus.js +162 -0
  1008. package/dist/src/services/prometheus.js.map +1 -0
  1009. package/dist/src/services/prompt-defaults.d.ts +33 -0
  1010. package/dist/src/services/prompt-defaults.d.ts.map +1 -0
  1011. package/dist/src/services/prompt-defaults.js +1675 -0
  1012. package/dist/src/services/prompt-defaults.js.map +1 -0
  1013. package/dist/src/services/prompt-seeder.d.ts +8 -0
  1014. package/dist/src/services/prompt-seeder.d.ts.map +1 -0
  1015. package/dist/src/services/prompt-seeder.js +65 -0
  1016. package/dist/src/services/prompt-seeder.js.map +1 -0
  1017. package/dist/src/services/prompt-variables.d.ts +15 -0
  1018. package/dist/src/services/prompt-variables.d.ts.map +1 -0
  1019. package/dist/src/services/prompt-variables.js +34 -0
  1020. package/dist/src/services/prompt-variables.js.map +1 -0
  1021. package/dist/src/services/push.d.ts +26 -0
  1022. package/dist/src/services/push.d.ts.map +1 -0
  1023. package/dist/src/services/push.js +70 -0
  1024. package/dist/src/services/push.js.map +1 -0
  1025. package/dist/src/services/quota.d.ts +45 -0
  1026. package/dist/src/services/quota.d.ts.map +1 -0
  1027. package/dist/src/services/quota.js +129 -0
  1028. package/dist/src/services/quota.js.map +1 -0
  1029. package/dist/src/services/realtime-manager.d.ts +144 -0
  1030. package/dist/src/services/realtime-manager.d.ts.map +1 -0
  1031. package/dist/src/services/realtime-manager.js +640 -0
  1032. package/dist/src/services/realtime-manager.js.map +1 -0
  1033. package/dist/src/services/scheduler.d.ts +55 -0
  1034. package/dist/src/services/scheduler.d.ts.map +1 -0
  1035. package/dist/src/services/scheduler.js +420 -0
  1036. package/dist/src/services/scheduler.js.map +1 -0
  1037. package/dist/src/services/schema-validator.d.ts +20 -0
  1038. package/dist/src/services/schema-validator.d.ts.map +1 -0
  1039. package/dist/src/services/schema-validator.js +68 -0
  1040. package/dist/src/services/schema-validator.js.map +1 -0
  1041. package/dist/src/services/site-sync.d.ts +15 -0
  1042. package/dist/src/services/site-sync.d.ts.map +1 -0
  1043. package/dist/src/services/site-sync.js +99 -0
  1044. package/dist/src/services/site-sync.js.map +1 -0
  1045. package/dist/src/services/site.d.ts +65 -0
  1046. package/dist/src/services/site.d.ts.map +1 -0
  1047. package/dist/src/services/site.js +378 -0
  1048. package/dist/src/services/site.js.map +1 -0
  1049. package/dist/src/services/stats.d.ts +75 -0
  1050. package/dist/src/services/stats.d.ts.map +1 -0
  1051. package/dist/src/services/stats.js +124 -0
  1052. package/dist/src/services/stats.js.map +1 -0
  1053. package/dist/src/services/sync-health.d.ts +53 -0
  1054. package/dist/src/services/sync-health.d.ts.map +1 -0
  1055. package/dist/src/services/sync-health.js +122 -0
  1056. package/dist/src/services/sync-health.js.map +1 -0
  1057. package/dist/src/services/sync-scheduler.d.ts +25 -0
  1058. package/dist/src/services/sync-scheduler.d.ts.map +1 -0
  1059. package/dist/src/services/sync-scheduler.js +211 -0
  1060. package/dist/src/services/sync-scheduler.js.map +1 -0
  1061. package/dist/src/services/totp.d.ts +31 -0
  1062. package/dist/src/services/totp.d.ts.map +1 -0
  1063. package/dist/src/services/totp.js +96 -0
  1064. package/dist/src/services/totp.js.map +1 -0
  1065. package/dist/src/services/trust-broadcast.d.ts +37 -0
  1066. package/dist/src/services/trust-broadcast.d.ts.map +1 -0
  1067. package/dist/src/services/trust-broadcast.js +107 -0
  1068. package/dist/src/services/trust-broadcast.js.map +1 -0
  1069. package/dist/src/services/trust.d.ts +16 -0
  1070. package/dist/src/services/trust.d.ts.map +1 -0
  1071. package/dist/src/services/trust.js +109 -0
  1072. package/dist/src/services/trust.js.map +1 -0
  1073. package/dist/src/services/vc-issuer.d.ts +14 -0
  1074. package/dist/src/services/vc-issuer.d.ts.map +1 -0
  1075. package/dist/src/services/vc-issuer.js +24 -0
  1076. package/dist/src/services/vc-issuer.js.map +1 -0
  1077. package/dist/src/storage/interface.d.ts +1161 -0
  1078. package/dist/src/storage/interface.d.ts.map +1 -0
  1079. package/dist/src/storage/interface.js +2 -0
  1080. package/dist/src/storage/interface.js.map +1 -0
  1081. package/dist/src/storage/pattern-utils.d.ts +20 -0
  1082. package/dist/src/storage/pattern-utils.d.ts.map +1 -0
  1083. package/dist/src/storage/pattern-utils.js +57 -0
  1084. package/dist/src/storage/pattern-utils.js.map +1 -0
  1085. package/dist/src/storage/providers/mongodb/index.d.ts +608 -0
  1086. package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -0
  1087. package/dist/src/storage/providers/mongodb/index.js +4931 -0
  1088. package/dist/src/storage/providers/mongodb/index.js.map +1 -0
  1089. package/dist/src/storage/providers/sqlite/index.d.ts +602 -0
  1090. package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -0
  1091. package/dist/src/storage/providers/sqlite/index.js +4156 -0
  1092. package/dist/src/storage/providers/sqlite/index.js.map +1 -0
  1093. package/dist/src/storage/providers/sqlite/repos/action.d.ts +13 -0
  1094. package/dist/src/storage/providers/sqlite/repos/action.d.ts.map +1 -0
  1095. package/dist/src/storage/providers/sqlite/repos/action.js +79 -0
  1096. package/dist/src/storage/providers/sqlite/repos/action.js.map +1 -0
  1097. package/dist/src/storage/providers/sqlite/repos/agent.d.ts +13 -0
  1098. package/dist/src/storage/providers/sqlite/repos/agent.d.ts.map +1 -0
  1099. package/dist/src/storage/providers/sqlite/repos/agent.js +103 -0
  1100. package/dist/src/storage/providers/sqlite/repos/agent.js.map +1 -0
  1101. package/dist/src/storage/providers/sqlite/repos/auth.d.ts +56 -0
  1102. package/dist/src/storage/providers/sqlite/repos/auth.d.ts.map +1 -0
  1103. package/dist/src/storage/providers/sqlite/repos/auth.js +282 -0
  1104. package/dist/src/storage/providers/sqlite/repos/auth.js.map +1 -0
  1105. package/dist/src/storage/providers/sqlite/repos/board.d.ts +24 -0
  1106. package/dist/src/storage/providers/sqlite/repos/board.d.ts.map +1 -0
  1107. package/dist/src/storage/providers/sqlite/repos/board.js +154 -0
  1108. package/dist/src/storage/providers/sqlite/repos/board.js.map +1 -0
  1109. package/dist/src/storage/providers/sqlite/repos/community.d.ts +33 -0
  1110. package/dist/src/storage/providers/sqlite/repos/community.d.ts.map +1 -0
  1111. package/dist/src/storage/providers/sqlite/repos/community.js +202 -0
  1112. package/dist/src/storage/providers/sqlite/repos/community.js.map +1 -0
  1113. package/dist/src/storage/providers/sqlite/repos/consent.d.ts +23 -0
  1114. package/dist/src/storage/providers/sqlite/repos/consent.d.ts.map +1 -0
  1115. package/dist/src/storage/providers/sqlite/repos/consent.js +187 -0
  1116. package/dist/src/storage/providers/sqlite/repos/consent.js.map +1 -0
  1117. package/dist/src/storage/providers/sqlite/repos/dispute.d.ts +20 -0
  1118. package/dist/src/storage/providers/sqlite/repos/dispute.d.ts.map +1 -0
  1119. package/dist/src/storage/providers/sqlite/repos/dispute.js +118 -0
  1120. package/dist/src/storage/providers/sqlite/repos/dispute.js.map +1 -0
  1121. package/dist/src/storage/providers/sqlite/repos/flag.d.ts +26 -0
  1122. package/dist/src/storage/providers/sqlite/repos/flag.d.ts.map +1 -0
  1123. package/dist/src/storage/providers/sqlite/repos/flag.js +147 -0
  1124. package/dist/src/storage/providers/sqlite/repos/flag.js.map +1 -0
  1125. package/dist/src/storage/providers/sqlite/repos/identity.d.ts +36 -0
  1126. package/dist/src/storage/providers/sqlite/repos/identity.d.ts.map +1 -0
  1127. package/dist/src/storage/providers/sqlite/repos/identity.js +297 -0
  1128. package/dist/src/storage/providers/sqlite/repos/identity.js.map +1 -0
  1129. package/dist/src/storage/providers/sqlite/repos/mailbox.d.ts +18 -0
  1130. package/dist/src/storage/providers/sqlite/repos/mailbox.d.ts.map +1 -0
  1131. package/dist/src/storage/providers/sqlite/repos/mailbox.js +91 -0
  1132. package/dist/src/storage/providers/sqlite/repos/mailbox.js.map +1 -0
  1133. package/dist/src/storage/providers/sqlite/repos/memory.d.ts +28 -0
  1134. package/dist/src/storage/providers/sqlite/repos/memory.d.ts.map +1 -0
  1135. package/dist/src/storage/providers/sqlite/repos/memory.js +152 -0
  1136. package/dist/src/storage/providers/sqlite/repos/memory.js.map +1 -0
  1137. package/dist/src/storage/providers/sqlite/repos/owner.d.ts +14 -0
  1138. package/dist/src/storage/providers/sqlite/repos/owner.d.ts.map +1 -0
  1139. package/dist/src/storage/providers/sqlite/repos/owner.js +124 -0
  1140. package/dist/src/storage/providers/sqlite/repos/owner.js.map +1 -0
  1141. package/dist/src/storage/providers/sqlite/repos/service-manifest.d.ts +17 -0
  1142. package/dist/src/storage/providers/sqlite/repos/service-manifest.d.ts.map +1 -0
  1143. package/dist/src/storage/providers/sqlite/repos/service-manifest.js +114 -0
  1144. package/dist/src/storage/providers/sqlite/repos/service-manifest.js.map +1 -0
  1145. package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts +19 -0
  1146. package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts.map +1 -0
  1147. package/dist/src/storage/providers/sqlite/repos/storage-file.js +128 -0
  1148. package/dist/src/storage/providers/sqlite/repos/storage-file.js.map +1 -0
  1149. package/dist/src/storage/providers/sqlite/repos/work.d.ts +13 -0
  1150. package/dist/src/storage/providers/sqlite/repos/work.d.ts.map +1 -0
  1151. package/dist/src/storage/providers/sqlite/repos/work.js +86 -0
  1152. package/dist/src/storage/providers/sqlite/repos/work.js.map +1 -0
  1153. package/dist/src/storage/providers/sqlite/schema.d.ts +7 -0
  1154. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -0
  1155. package/dist/src/storage/providers/sqlite/schema.js +1090 -0
  1156. package/dist/src/storage/providers/sqlite/schema.js.map +1 -0
  1157. package/dist/src/storage/repositories/action.repository.d.ts +14 -0
  1158. package/dist/src/storage/repositories/action.repository.d.ts.map +1 -0
  1159. package/dist/src/storage/repositories/action.repository.js +2 -0
  1160. package/dist/src/storage/repositories/action.repository.js.map +1 -0
  1161. package/dist/src/storage/repositories/agent.repository.d.ts +18 -0
  1162. package/dist/src/storage/repositories/agent.repository.d.ts.map +1 -0
  1163. package/dist/src/storage/repositories/agent.repository.js +2 -0
  1164. package/dist/src/storage/repositories/agent.repository.js.map +1 -0
  1165. package/dist/src/storage/repositories/app-marketplace.repository.d.ts +9 -0
  1166. package/dist/src/storage/repositories/app-marketplace.repository.d.ts.map +1 -0
  1167. package/dist/src/storage/repositories/app-marketplace.repository.js +2 -0
  1168. package/dist/src/storage/repositories/app-marketplace.repository.js.map +1 -0
  1169. package/dist/src/storage/repositories/app.repository.d.ts +17 -0
  1170. package/dist/src/storage/repositories/app.repository.d.ts.map +1 -0
  1171. package/dist/src/storage/repositories/app.repository.js +2 -0
  1172. package/dist/src/storage/repositories/app.repository.js.map +1 -0
  1173. package/dist/src/storage/repositories/auth.repository.d.ts +6 -0
  1174. package/dist/src/storage/repositories/auth.repository.d.ts.map +1 -0
  1175. package/dist/src/storage/repositories/auth.repository.js +2 -0
  1176. package/dist/src/storage/repositories/auth.repository.js.map +1 -0
  1177. package/dist/src/storage/repositories/board.repository.d.ts +27 -0
  1178. package/dist/src/storage/repositories/board.repository.d.ts.map +1 -0
  1179. package/dist/src/storage/repositories/board.repository.js +2 -0
  1180. package/dist/src/storage/repositories/board.repository.js.map +1 -0
  1181. package/dist/src/storage/repositories/catalogue.repository.d.ts +18 -0
  1182. package/dist/src/storage/repositories/catalogue.repository.d.ts.map +1 -0
  1183. package/dist/src/storage/repositories/catalogue.repository.js +2 -0
  1184. package/dist/src/storage/repositories/catalogue.repository.js.map +1 -0
  1185. package/dist/src/storage/repositories/config.repository.d.ts +17 -0
  1186. package/dist/src/storage/repositories/config.repository.d.ts.map +1 -0
  1187. package/dist/src/storage/repositories/config.repository.js +2 -0
  1188. package/dist/src/storage/repositories/config.repository.js.map +1 -0
  1189. package/dist/src/storage/repositories/consent.repository.d.ts +19 -0
  1190. package/dist/src/storage/repositories/consent.repository.d.ts.map +1 -0
  1191. package/dist/src/storage/repositories/consent.repository.js +2 -0
  1192. package/dist/src/storage/repositories/consent.repository.js.map +1 -0
  1193. package/dist/src/storage/repositories/device-auth.repository.d.ts +11 -0
  1194. package/dist/src/storage/repositories/device-auth.repository.d.ts.map +1 -0
  1195. package/dist/src/storage/repositories/device-auth.repository.js +2 -0
  1196. package/dist/src/storage/repositories/device-auth.repository.js.map +1 -0
  1197. package/dist/src/storage/repositories/dispute.repository.d.ts +12 -0
  1198. package/dist/src/storage/repositories/dispute.repository.d.ts.map +1 -0
  1199. package/dist/src/storage/repositories/dispute.repository.js +2 -0
  1200. package/dist/src/storage/repositories/dispute.repository.js.map +1 -0
  1201. package/dist/src/storage/repositories/extension-instance.repository.d.ts +9 -0
  1202. package/dist/src/storage/repositories/extension-instance.repository.d.ts.map +1 -0
  1203. package/dist/src/storage/repositories/extension-instance.repository.js +2 -0
  1204. package/dist/src/storage/repositories/extension-instance.repository.js.map +1 -0
  1205. package/dist/src/storage/repositories/federation.repository.d.ts +37 -0
  1206. package/dist/src/storage/repositories/federation.repository.d.ts.map +1 -0
  1207. package/dist/src/storage/repositories/federation.repository.js +2 -0
  1208. package/dist/src/storage/repositories/federation.repository.js.map +1 -0
  1209. package/dist/src/storage/repositories/file.repository.d.ts +14 -0
  1210. package/dist/src/storage/repositories/file.repository.d.ts.map +1 -0
  1211. package/dist/src/storage/repositories/file.repository.js +2 -0
  1212. package/dist/src/storage/repositories/file.repository.js.map +1 -0
  1213. package/dist/src/storage/repositories/identity.repository.d.ts +29 -0
  1214. package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -0
  1215. package/dist/src/storage/repositories/identity.repository.js +2 -0
  1216. package/dist/src/storage/repositories/identity.repository.js.map +1 -0
  1217. package/dist/src/storage/repositories/index.d.ts +34 -0
  1218. package/dist/src/storage/repositories/index.d.ts.map +1 -0
  1219. package/dist/src/storage/repositories/index.js +2 -0
  1220. package/dist/src/storage/repositories/index.js.map +1 -0
  1221. package/dist/src/storage/repositories/knowledge.repository.d.ts +18 -0
  1222. package/dist/src/storage/repositories/knowledge.repository.d.ts.map +1 -0
  1223. package/dist/src/storage/repositories/knowledge.repository.js +2 -0
  1224. package/dist/src/storage/repositories/knowledge.repository.js.map +1 -0
  1225. package/dist/src/storage/repositories/marketplace.repository.d.ts +23 -0
  1226. package/dist/src/storage/repositories/marketplace.repository.d.ts.map +1 -0
  1227. package/dist/src/storage/repositories/marketplace.repository.js +2 -0
  1228. package/dist/src/storage/repositories/marketplace.repository.js.map +1 -0
  1229. package/dist/src/storage/repositories/memory.repository.d.ts +32 -0
  1230. package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -0
  1231. package/dist/src/storage/repositories/memory.repository.js +2 -0
  1232. package/dist/src/storage/repositories/memory.repository.js.map +1 -0
  1233. package/dist/src/storage/repositories/micro-memory.repository.d.ts +10 -0
  1234. package/dist/src/storage/repositories/micro-memory.repository.d.ts.map +1 -0
  1235. package/dist/src/storage/repositories/micro-memory.repository.js +2 -0
  1236. package/dist/src/storage/repositories/micro-memory.repository.js.map +1 -0
  1237. package/dist/src/storage/repositories/moderation.repository.d.ts +36 -0
  1238. package/dist/src/storage/repositories/moderation.repository.d.ts.map +1 -0
  1239. package/dist/src/storage/repositories/moderation.repository.js +2 -0
  1240. package/dist/src/storage/repositories/moderation.repository.js.map +1 -0
  1241. package/dist/src/storage/repositories/node.repository.d.ts +59 -0
  1242. package/dist/src/storage/repositories/node.repository.d.ts.map +1 -0
  1243. package/dist/src/storage/repositories/node.repository.js +2 -0
  1244. package/dist/src/storage/repositories/node.repository.js.map +1 -0
  1245. package/dist/src/storage/repositories/notification-template.repository.d.ts +8 -0
  1246. package/dist/src/storage/repositories/notification-template.repository.d.ts.map +1 -0
  1247. package/dist/src/storage/repositories/notification-template.repository.js +2 -0
  1248. package/dist/src/storage/repositories/notification-template.repository.js.map +1 -0
  1249. package/dist/src/storage/repositories/notification.repository.d.ts +14 -0
  1250. package/dist/src/storage/repositories/notification.repository.d.ts.map +1 -0
  1251. package/dist/src/storage/repositories/notification.repository.js +2 -0
  1252. package/dist/src/storage/repositories/notification.repository.js.map +1 -0
  1253. package/dist/src/storage/repositories/oauth.repository.d.ts +19 -0
  1254. package/dist/src/storage/repositories/oauth.repository.d.ts.map +1 -0
  1255. package/dist/src/storage/repositories/oauth.repository.js +2 -0
  1256. package/dist/src/storage/repositories/oauth.repository.js.map +1 -0
  1257. package/dist/src/storage/repositories/organism.repository.d.ts +34 -0
  1258. package/dist/src/storage/repositories/organism.repository.d.ts.map +1 -0
  1259. package/dist/src/storage/repositories/organism.repository.js +2 -0
  1260. package/dist/src/storage/repositories/organism.repository.js.map +1 -0
  1261. package/dist/src/storage/repositories/otk.repository.d.ts +9 -0
  1262. package/dist/src/storage/repositories/otk.repository.d.ts.map +1 -0
  1263. package/dist/src/storage/repositories/otk.repository.js +2 -0
  1264. package/dist/src/storage/repositories/otk.repository.js.map +1 -0
  1265. package/dist/src/storage/repositories/owner.repository.d.ts +9 -0
  1266. package/dist/src/storage/repositories/owner.repository.d.ts.map +1 -0
  1267. package/dist/src/storage/repositories/owner.repository.js +2 -0
  1268. package/dist/src/storage/repositories/owner.repository.js.map +1 -0
  1269. package/dist/src/storage/repositories/package-instance.repository.d.ts +26 -0
  1270. package/dist/src/storage/repositories/package-instance.repository.d.ts.map +1 -0
  1271. package/dist/src/storage/repositories/package-instance.repository.js +12 -0
  1272. package/dist/src/storage/repositories/package-instance.repository.js.map +1 -0
  1273. package/dist/src/storage/repositories/package.repository.d.ts +28 -0
  1274. package/dist/src/storage/repositories/package.repository.d.ts.map +1 -0
  1275. package/dist/src/storage/repositories/package.repository.js +12 -0
  1276. package/dist/src/storage/repositories/package.repository.js.map +1 -0
  1277. package/dist/src/storage/repositories/replication-queue.repository.d.ts +10 -0
  1278. package/dist/src/storage/repositories/replication-queue.repository.d.ts.map +1 -0
  1279. package/dist/src/storage/repositories/replication-queue.repository.js +2 -0
  1280. package/dist/src/storage/repositories/replication-queue.repository.js.map +1 -0
  1281. package/dist/src/storage/repositories/scheduler.repository.d.ts +30 -0
  1282. package/dist/src/storage/repositories/scheduler.repository.d.ts.map +1 -0
  1283. package/dist/src/storage/repositories/scheduler.repository.js +2 -0
  1284. package/dist/src/storage/repositories/scheduler.repository.js.map +1 -0
  1285. package/dist/src/storage/repositories/schema.repository.d.ts +9 -0
  1286. package/dist/src/storage/repositories/schema.repository.d.ts.map +1 -0
  1287. package/dist/src/storage/repositories/schema.repository.js +2 -0
  1288. package/dist/src/storage/repositories/schema.repository.js.map +1 -0
  1289. package/dist/src/storage/repositories/session.repository.d.ts +22 -0
  1290. package/dist/src/storage/repositories/session.repository.d.ts.map +1 -0
  1291. package/dist/src/storage/repositories/session.repository.js +2 -0
  1292. package/dist/src/storage/repositories/session.repository.js.map +1 -0
  1293. package/dist/src/storage/repositories/system-prompt.repository.d.ts +14 -0
  1294. package/dist/src/storage/repositories/system-prompt.repository.d.ts.map +1 -0
  1295. package/dist/src/storage/repositories/system-prompt.repository.js +2 -0
  1296. package/dist/src/storage/repositories/system-prompt.repository.js.map +1 -0
  1297. package/dist/src/storage/repositories/template-listing.repository.d.ts +44 -0
  1298. package/dist/src/storage/repositories/template-listing.repository.d.ts.map +1 -0
  1299. package/dist/src/storage/repositories/template-listing.repository.js +13 -0
  1300. package/dist/src/storage/repositories/template-listing.repository.js.map +1 -0
  1301. package/dist/src/storage/repositories/wallet.repository.d.ts +8 -0
  1302. package/dist/src/storage/repositories/wallet.repository.d.ts.map +1 -0
  1303. package/dist/src/storage/repositories/wallet.repository.js +2 -0
  1304. package/dist/src/storage/repositories/wallet.repository.js.map +1 -0
  1305. package/dist/src/storage/repositories/work.repository.d.ts +10 -0
  1306. package/dist/src/storage/repositories/work.repository.d.ts.map +1 -0
  1307. package/dist/src/storage/repositories/work.repository.js +2 -0
  1308. package/dist/src/storage/repositories/work.repository.js.map +1 -0
  1309. package/dist/src/storage/storage-factory.d.ts +9 -0
  1310. package/dist/src/storage/storage-factory.d.ts.map +1 -0
  1311. package/dist/src/storage/storage-factory.js +20 -0
  1312. package/dist/src/storage/storage-factory.js.map +1 -0
  1313. package/dist/src/types/route-manifest.d.ts +53 -0
  1314. package/dist/src/types/route-manifest.d.ts.map +1 -0
  1315. package/dist/src/types/route-manifest.js +44 -0
  1316. package/dist/src/types/route-manifest.js.map +1 -0
  1317. package/dist/src/utils/catalogue-hash.d.ts +10 -0
  1318. package/dist/src/utils/catalogue-hash.d.ts.map +1 -0
  1319. package/dist/src/utils/catalogue-hash.js +23 -0
  1320. package/dist/src/utils/catalogue-hash.js.map +1 -0
  1321. package/dist/src/utils/env-config.d.ts +8 -0
  1322. package/dist/src/utils/env-config.d.ts.map +1 -0
  1323. package/dist/src/utils/env-config.js +1264 -0
  1324. package/dist/src/utils/env-config.js.map +1 -0
  1325. package/dist/src/utils/env-validator.d.ts +14 -0
  1326. package/dist/src/utils/env-validator.d.ts.map +1 -0
  1327. package/dist/src/utils/env-validator.js +338 -0
  1328. package/dist/src/utils/env-validator.js.map +1 -0
  1329. package/dist/src/utils/fire-hook.d.ts +9 -0
  1330. package/dist/src/utils/fire-hook.d.ts.map +1 -0
  1331. package/dist/src/utils/fire-hook.js +12 -0
  1332. package/dist/src/utils/fire-hook.js.map +1 -0
  1333. package/dist/src/utils/gaii.d.ts +57 -0
  1334. package/dist/src/utils/gaii.d.ts.map +1 -0
  1335. package/dist/src/utils/gaii.js +148 -0
  1336. package/dist/src/utils/gaii.js.map +1 -0
  1337. package/dist/src/utils/ghii-resolver.d.ts +14 -0
  1338. package/dist/src/utils/ghii-resolver.d.ts.map +1 -0
  1339. package/dist/src/utils/ghii-resolver.js +21 -0
  1340. package/dist/src/utils/ghii-resolver.js.map +1 -0
  1341. package/dist/src/utils/logger.d.ts +9 -0
  1342. package/dist/src/utils/logger.d.ts.map +1 -0
  1343. package/dist/src/utils/logger.js +36 -0
  1344. package/dist/src/utils/logger.js.map +1 -0
  1345. package/dist/src/utils/otk.d.ts +2 -0
  1346. package/dist/src/utils/otk.d.ts.map +1 -0
  1347. package/dist/src/utils/otk.js +5 -0
  1348. package/dist/src/utils/otk.js.map +1 -0
  1349. package/dist/src/utils/tracking-code.d.ts +9 -0
  1350. package/dist/src/utils/tracking-code.d.ts.map +1 -0
  1351. package/dist/src/utils/tracking-code.js +16 -0
  1352. package/dist/src/utils/tracking-code.js.map +1 -0
  1353. package/dist/src/utils/url-validator.d.ts +5 -0
  1354. package/dist/src/utils/url-validator.d.ts.map +1 -0
  1355. package/dist/src/utils/url-validator.js +56 -0
  1356. package/dist/src/utils/url-validator.js.map +1 -0
  1357. package/dist/static/app-catalog.html +4401 -0
  1358. package/dist/static/cookieconsent.css +1 -0
  1359. package/dist/static/cookieconsent.umd.js +7 -0
  1360. package/dist/static/icons/icon-maskable.svg +27 -0
  1361. package/dist/static/icons/icon.svg +27 -0
  1362. package/dist/static/manifest.json +17 -0
  1363. package/dist/static/offline.html +167 -0
  1364. package/dist/static/sw.js +260 -0
  1365. package/package.json +182 -0
  1366. package/prisma/schema.prisma +1086 -0
@@ -0,0 +1,1886 @@
1
+ /**
2
+ * @file foundry-prompts-base.js
3
+ * @description Base constants and helpers for foundry prompts — shared context,
4
+ * instruction disclaimer, per-type component templates, and API summary helpers.
5
+ * @structure
6
+ * - AIMEAT_CONTEXT: shared preamble for all prompts
7
+ * - INSTRUCTION_DISCLAIMER: instruction compliance prefix
8
+ * - COMPONENT_TEMPLATES: per-type template factory functions
9
+ * - summarizeExtensionApi: compact API summary for completed extensions
10
+ * - summarizeCortexApi: compact API summary for completed cortex libraries
11
+ * @usage
12
+ * import { AIMEAT_CONTEXT, INSTRUCTION_DISCLAIMER, COMPONENT_TEMPLATES } from '/js/services/foundry-prompts-base.js';
13
+ * @version-history
14
+ * v1.0.0 — 2026-03-22 — Extracted from foundry-prompts.js
15
+ */
16
+
17
+ export const AIMEAT_CONTEXT = `
18
+ You are helping create an AIMEAT service. AIMEAT is an AI agent infrastructure protocol.
19
+
20
+ Available building blocks:
21
+ - CSM (Community Service Manifest): YAML defining data schemas, fields, consent rules, validation.
22
+ - MSM (Micro Service Manifest): YAML defining external API integrations, auth, endpoints.
23
+ - Extension: V8-sandboxed JavaScript logic with YAML manifest. Actions get ctx object with memory, wallet, consent, trust, fetch APIs.
24
+ - App: HTML/JS user interface published to the apps catalog.
25
+ - Memory: Key-value storage with namespace isolation.
26
+ - Translation: Per-locale i18n strings.
27
+ - Cortex: Client-side JS domain library (IIFE on AIMEAT namespace). Wraps extension APIs and memory reads into clean domain methods for apps.
28
+
29
+ Extensions run in an ISOLATED V8 sandbox with ONLY this API (no Node.js, no global fetch, no setTimeout, no require, no import):
30
+ ctx.memory.get(key) → value or null (ALWAYS null-check before using: `|| []` or `|| {}`)
31
+ ctx.memory.set(key, value) → void
32
+ ctx.memory.search(prefix) → Array<{ key, value }> (NOT plain strings!)
33
+ ctx.memory.delete(key) → boolean
34
+ ctx.memory.getPublic(namespace, key) → value or null (read data from a DIFFERENT namespace)
35
+ Use this to read: (a) another extension's public data, (b) the OWNER's shared data (memory components, translations, settings).
36
+ Example — read another extension's data: await ctx.memory.getPublic('ext:other-ext', 'some.key')
37
+ Example — read owner's shared data: await ctx.memory.getPublic(ctx.caller.gaii, 'lookup.data')
38
+ ╔═══════════════════════════════════════════════════════════════════════════════╗
39
+ ║ IMPORTANT: ctx.memory.get() ONLY reads from the extension's OWN namespace. ║
40
+ ║ Data stored by memory components (seed data, settings, translations) lives ║
41
+ ║ in the OWNER's namespace — use ctx.memory.getPublic(ctx.caller.gaii, key) ║
42
+ ║ to access it. ctx.caller.gaii is the caller's GHII identity (e.g. "testuser@node-id"). ║
43
+ ╚═══════════════════════════════════════════════════════════════════════════════╝
44
+ ctx.fetch(url, { method, headers, body }) → { status, ok, text, headers }
45
+ Use ctx.fetch for ALL HTTP requests. Global fetch() is NOT available.
46
+ Response body is always .text (string) — parse JSON with JSON.parse(resp.text).
47
+ Encoding is handled automatically — the runtime detects charset from: (1) Content-Type header,
48
+ (2) XML prolog encoding attribute, (3) HTML meta charset tag. Falls back to UTF-8.
49
+ You always get correct Unicode text — no manual decoding needed, even for ISO-8859-1 feeds.
50
+ ctx.wallet.consume(amount, reason), ctx.wallet.getBalance()
51
+ ctx.consent.check(gaii, scope), ctx.consent.require(gaii, scope)
52
+ ctx.trust.getScore(gaii)
53
+ ctx.caller = { gaii, owner, roles }
54
+ ctx.config = extension config object (from manifest config section)
55
+ ctx.instance = { id, config } (when called via instance endpoint)
56
+ ctx.log.info/warn/error(msg, data)
57
+
58
+ AIMEAT Data Standards (MUST follow in ALL components):
59
+ Dates/times: ISO 8601 ONLY — "2026-03-14T13:00:00.000Z". NEVER store RFC 2822 ("Sat, 14 Mar ..."), Unix timestamps, or locale-formatted dates. Convert all dates to ISO before storing.
60
+ Memory keys: lowercase dot-namespaced — "items.by-date.2026-03-14". Dates in keys MUST use YYYY-MM-DD.
61
+ Resource IDs: URL-safe strings (kebab-case or hex hashes). No spaces, no special characters.
62
+ Action IDs: camelCase — "getItems", "addToWatchlist", "checkChanges". NEVER kebab-case for actions.
63
+ Locale codes: BCP 47 — "fi", "en", "fi-FI", "en-US".
64
+ Coordinates: { latitude: number, longitude: number } — WGS84 decimal degrees.
65
+ Currency/amounts: integers (no floats) — morsels are whole numbers.
66
+ `.trim();
67
+
68
+ /* ── Instruction Disclaimer (prepended to every prompt) ── */
69
+
70
+ export const INSTRUCTION_DISCLAIMER = `IMPORTANT: These are detailed instructions that you MUST read carefully and follow exactly. Every rule, constraint, format requirement, and example below exists for a reason. Do NOT skip sections, do NOT invent your own conventions, and do NOT deviate from the specified output format. If a rule says "MUST" or "NEVER", treat it as absolute.
71
+
72
+ `;
73
+
74
+ export const COMPONENT_TEMPLATES = {
75
+ csm: (label, context) => `${AIMEAT_CONTEXT}
76
+
77
+ Create a CSM (Community Service Manifest) YAML for: ${label}
78
+
79
+ ${context}
80
+
81
+ ## YAML STRING RULES (read this FIRST — violations cause parse errors)
82
+
83
+ Every string value MUST be on ONE line wrapped in double quotes. No exceptions.
84
+ NEVER use > or | (block scalars). NEVER leave strings unquoted.
85
+
86
+ WRONG — will crash the parser:
87
+ description: > This is a multi-line folded string
88
+ description: This has (parens) and special: chars
89
+ description: |
90
+ This is a literal block
91
+
92
+ CORRECT — always do this:
93
+ description: "This has (parens) and special: chars all on one line"
94
+
95
+ ## Structure
96
+
97
+ Return ONLY valid YAML in a yaml code block. Copy this structure EXACTLY:
98
+ \`\`\`yaml
99
+ csm: "1.0"
100
+ service:
101
+ name: kebab-case-name
102
+ type: directory
103
+ description: "What this service does — keep on ONE line in double quotes"
104
+ version: "1.0"
105
+ schema_mode: open
106
+ data_schema:
107
+ required:
108
+ fieldName:
109
+ type: string
110
+ anotherField:
111
+ type: number
112
+ optional:
113
+ optionalField:
114
+ type: string
115
+ enum: [value1, value2]
116
+ consent_requirements:
117
+ visibility_default: public
118
+ requires_consent: false
119
+ consent_purpose: "Why consent is needed"
120
+ data_retention: "365_days"
121
+ moderation:
122
+ flags_enabled: true
123
+ auto_hide_threshold: 5
124
+ appeals_enabled: false
125
+ ui_hints:
126
+ list_view: [fieldName, anotherField]
127
+ detail_view: [fieldName, anotherField, optionalField]
128
+ search_fields: [fieldName]
129
+ \`\`\`
130
+
131
+ ## Additional rules
132
+ - data_schema.required and data_schema.optional are MAPS (fieldName: {type: ...}), NOT arrays (- name: ...)
133
+ - data_schema.required MUST have at least one field
134
+ - Field types: string, number, integer, boolean, array, object
135
+ - All date/time fields MUST be type: string with description mentioning ISO 8601 format
136
+ - service.name: concise kebab-case identifier, 1-3 words. Use the project's own name when it has one. Do NOT invent generic abbreviations or add redundant suffixes like "-service" or "-monitor".
137
+ - ONLY include fields that exist in the raw source data. Computed/derived values (aggregates, scores, trends, risk levels, statistics) are calculated by extensions and stored in separate memory keys — they do NOT belong in the CSM data_schema.
138
+ - Avoid redundant fields. If the source provides a unique identifier (e.g. guid), do not add a second id field. If a value is always the same (e.g. single data source), do not include it as a field.`,
139
+
140
+ msm: (label, context) => `${AIMEAT_CONTEXT}
141
+
142
+ Create an MSM (Micro Service Manifest) YAML for: ${label}
143
+
144
+ ${context}
145
+
146
+ ## YAML STRING RULES (read this FIRST — violations cause parse errors)
147
+
148
+ Every string value MUST be on ONE line wrapped in double quotes. No exceptions.
149
+ NEVER use > or | (block scalars). NEVER leave strings unquoted.
150
+
151
+ WRONG: description: > This is a folded string
152
+ WRONG: description: This has (parens) and colons: here
153
+ CORRECT: description: "This has (parens) and colons: here — all on one line"
154
+
155
+ ## Structure
156
+
157
+ Return ONLY valid YAML in a yaml code block. Copy this structure EXACTLY:
158
+ \`\`\`yaml
159
+ msm: "1.0"
160
+ service:
161
+ name: "Human Readable Service Name"
162
+ description: "What this integration does — one line, double quoted"
163
+ homepage: "https://api.example.com"
164
+ category: data
165
+ tags: [tag1, tag2]
166
+ auth:
167
+ type: none
168
+ param_name: ""
169
+ env_var: ""
170
+ actions:
171
+ - id: actionId
172
+ display_name: "Human Readable Action Name"
173
+ description: "What this action does"
174
+ endpoint:
175
+ method: GET
176
+ url: "https://api.example.com/path?q={input.query}"
177
+ input:
178
+ query:
179
+ type: string
180
+ required: true
181
+ description: "Search query"
182
+ output:
183
+ result:
184
+ type: string
185
+ description: "The result"
186
+ \`\`\`
187
+
188
+ ## Additional rules
189
+ - \`service\` section with \`name\`, \`description\`, \`category\` is REQUIRED
190
+ - \`category\` must be one of: data, utility, image, communication, analytics, analysis
191
+ - \`auth.type\` must be one of: bearer, query_param, oauth2, api_key, none
192
+ - For public APIs (RSS feeds, open data) use \`auth.type: none\` — many APIs don't require authentication
193
+ - \`actions\` is an array — each action needs: id, display_name, description, endpoint (method + url), input, output
194
+ - Each action output MUST have at least one field`,
195
+
196
+ extension: (label, context) => `${AIMEAT_CONTEXT}
197
+
198
+ Create an AIMEAT Extension for: ${label}
199
+
200
+ ${context}
201
+
202
+ ## YAML STRING RULES (read this FIRST — violations cause parse errors)
203
+
204
+ Every string value MUST be on ONE line wrapped in double quotes. No exceptions.
205
+ NEVER use > or | (block scalars). NEVER leave strings unquoted.
206
+
207
+ WRONG: description: > This is a folded string
208
+ WRONG: description: This has (parens) and colons: here
209
+ CORRECT: description: "This has (parens) and colons: here — all on one line"
210
+
211
+ ${SANDBOX_CONSTRAINTS}
212
+
213
+ ## ctx.memory API — CRITICAL details
214
+
215
+ ### ctx.memory.get(key) — WILL CRASH if you use JSON.parse()
216
+
217
+ ctx.memory.get() returns the VALUE directly (already a JS object/array/value), or null.
218
+ It is NOT a string. Calling JSON.parse() on it will CRASH with "null is not valid JSON".
219
+
220
+ ╔══════════════════════════════════════════════════════════════════════════╗
221
+ ║ NEVER WRITE: JSON.parse(await ctx.memory.get(...)) ║
222
+ ║ NEVER WRITE: JSON.parse(ctx.memory.get(...)) ║
223
+ ║ NEVER WRITE: const x = JSON.parse(someMemoryValue) ║
224
+ ║ These ALL crash. The value is ALREADY PARSED. ║
225
+ ╚══════════════════════════════════════════════════════════════════════════╝
226
+
227
+ WRONG (CRASHES EVERY TIME):
228
+ const data = JSON.parse(await ctx.memory.get("my.key")); // "undefined" is not valid JSON
229
+
230
+ CORRECT:
231
+ const data = await ctx.memory.get("my.key");
232
+ if (!data) return { error: "No data found" };
233
+ // data is already a JS object/array/value — use it directly
234
+
235
+ ### ctx.memory.get() returns null when key does not exist — ALWAYS null-check!
236
+
237
+ ╔══════════════════════════════════════════════════════════════════════════╗
238
+ ║ ALWAYS check the return value before using it. ║
239
+ ║ Arrays and objects from memory may be null on first run. ║
240
+ ╚══════════════════════════════════════════════════════════════════════════╝
241
+
242
+ WRONG (CRASHES on first run when no data exists yet):
243
+ const index = await ctx.memory.get("items.__index");
244
+ index.some(...) // 💥 Cannot read properties of null (reading 'some')
245
+ index.push(...) // 💥 Cannot read properties of null (reading 'push')
246
+ index.length // 💥 Cannot read properties of null (reading 'length')
247
+
248
+ CORRECT:
249
+ const index = await ctx.memory.get("items.__index") || [];
250
+ index.some(...) // ✓ works — falls back to empty array
251
+
252
+ CORRECT (for objects):
253
+ const stats = await ctx.memory.get("daily.stats") || {};
254
+ stats.count = (stats.count || 0) + 1;
255
+
256
+ ### ctx.memory.set(key, value) stores any JSON-serializable value
257
+ await ctx.memory.set("items.2026-03-14", { entries: [...], count: 5 });
258
+
259
+ ### ctx.memory.search(prefix) returns objects, NOT strings — returns ALL matching keys (no pagination)
260
+ WARNING: search() loads ALL matching keys into memory at once. If your prefix matches thousands of keys, the V8 sandbox may run out of memory. Use specific prefixes (e.g., "items.by-date.2026-03-14" not "items.")
261
+
262
+ WRONG:
263
+ const keys = await ctx.memory.search("prefix.");
264
+ for (const key of keys) { await ctx.memory.get(key); } // ERROR: key is {key,value} not string
265
+
266
+ CORRECT:
267
+ const results = await ctx.memory.search("prefix.");
268
+ for (const entry of results) {
269
+ const key = entry.key; // string
270
+ const value = entry.value; // the stored value — already parsed, NOT a string
271
+ }
272
+
273
+ ## Output format — SINGLE block, copy-paste friendly
274
+
275
+ Return EVERYTHING in ONE code block. The YAML manifest first, then all JavaScript files separated by // actions/filename.js comments. The user will copy-paste the entire response at once.
276
+
277
+ \`\`\`
278
+ metadata:
279
+ name: kebab-case-name
280
+ version: "1.0.0"
281
+ description: "What this extension does — one line, double quoted"
282
+ author: foundry
283
+ required_apis: [memory]
284
+ config: {}
285
+ limits:
286
+ memory_mb: 128
287
+ timeout_ms: 30000
288
+ max_api_calls: 500
289
+ actions:
290
+ - id: first-action
291
+ description: "What this action does"
292
+ method: POST
293
+ path: /v1/ext/{name}/first-action
294
+ auth: required
295
+ input: {}
296
+ output: {}
297
+ script: first-action.js
298
+ - id: second-action
299
+ description: "Another action"
300
+ method: POST
301
+ path: /v1/ext/{name}/second-action
302
+ auth: required
303
+ input:
304
+ type: object
305
+ properties:
306
+ name:
307
+ type: string
308
+ required: [name]
309
+ output:
310
+ type: object
311
+ script: second-action.js
312
+ schedules: []
313
+
314
+ YAML actions format — EVERY action MUST have "- id:" as the FIRST key:
315
+ CORRECT: - id: myAction (id: is explicit key)
316
+ WRONG: - myAction (bare value — causes YAML parse error)
317
+ WRONG: - myAction: (colon after name — causes YAML parse error)
318
+ NEVER omit "id:" from any action entry. This is the #1 cause of validation failures.
319
+ // actions/myAction.js
320
+ export default async function(ctx, input) {
321
+ // ── Reading from EXTERNAL APIs (ctx.fetch) ──
322
+ // ctx.fetch() returns { ok, status, text, headers } — text is a RAW string, parse it yourself
323
+ // Encoding is auto-detected (Content-Type header, XML prolog, HTML meta) — you get Unicode text
324
+ const resp = await ctx.fetch('https://example.com/api');
325
+ if (!resp.ok) {
326
+ ctx.log.error('API request failed', { status: resp.status });
327
+ return { error: 'Request failed with status ' + resp.status };
328
+ }
329
+ const data = JSON.parse(resp.text); // ← correct: resp.text IS a string (for JSON APIs)
330
+ // For XML/RSS: resp.text is already decoded Unicode — parse with regex or string methods
331
+
332
+ // ── Reading from EXTENSION'S OWN MEMORY (ctx.memory.get) ──
333
+ // ctx.memory.get() returns a JS value directly — NEVER use JSON.parse
334
+ const stored = await ctx.memory.get("my.key");
335
+ if (!stored) return { items: [] }; // ← stored is already an object, or null
336
+
337
+ // ── Reading OWNER'S SHARED DATA (memory components, settings, translations) ──
338
+ // Data stored by memory-1, memory-2 etc. lives in the OWNER's namespace, NOT the extension's.
339
+ // Use getPublic(ctx.caller.gaii, key) to read it:
340
+ const lookup = await ctx.memory.getPublic(ctx.caller.gaii, "lookup.data") || [];
341
+ const settings = await ctx.memory.getPublic(ctx.caller.gaii, "settings.config") || {};
342
+
343
+ // ── Writing to EXTENSION'S OWN MEMORY ──
344
+ await ctx.memory.set("results.today", { items: data.results, fetchedAt: new Date().toISOString() });
345
+
346
+ return { result: stored };
347
+ }
348
+ \`\`\`
349
+
350
+ CRITICAL: Do NOT use separate code blocks. Put YAML manifest and ALL JavaScript files in ONE block.
351
+ Each JavaScript file MUST start with a comment line: // actions/{filename}.js
352
+
353
+ ## Action path — instance vs non-instance
354
+
355
+ ╔══════════════════════════════════════════════════════════════════════════╗
356
+ ║ Most extensions are SINGLE-INSTANCE (no :instanceId in path). ║
357
+ ║ Use: /v1/ext/{name}/actionId ║
358
+ ║ NEVER add :instanceId unless the blueprint explicitly requires ║
359
+ ║ multi-instance support (e.g., per-store, per-tenant separation). ║
360
+ ╚══════════════════════════════════════════════════════════════════════════╝
361
+
362
+ - Default (single-instance): \`path: /v1/ext/{name}/actionId\`
363
+ - Multi-instance (only if needed): \`path: /v1/ext/{name}/:instanceId/actionId\`
364
+
365
+ ## Scheduled Jobs (schedules section)
366
+
367
+ Extensions can declare recurring background jobs via \`schedules\` in the manifest.
368
+ AIMEAT's built-in scheduler runs these automatically — no browser needed.
369
+
370
+ ╔══════════════════════════════════════════════════════════════════════════╗
371
+ ║ If the blueprint has "schedules" for this extension, you MUST include ║
372
+ ║ a schedules section in the YAML manifest. This is the ONLY way to ║
373
+ ║ register recurring jobs — cortex and apps CANNOT schedule work. ║
374
+ ╚══════════════════════════════════════════════════════════════════════════╝
375
+
376
+ Format:
377
+ \`\`\`yaml
378
+ schedules:
379
+ - id: unique-job-id
380
+ action: actionId
381
+ cron: "*/15 * * * *"
382
+ description: "What this scheduled job does"
383
+ instance_scope: false
384
+ input: {}
385
+ \`\`\`
386
+
387
+ Rules:
388
+ - \`action\` MUST reference an existing action id from the \`actions\` array
389
+ - \`cron\` uses standard 5-field cron syntax (minute hour day-of-month month day-of-week) OR the special value \`@activate\`
390
+ - \`@activate\` trigger: runs when the extension is activated AND on every server restart. Use for init/bootstrap jobs.
391
+ - \`instance_scope: false\` for single-instance extensions (most cases)
392
+ - \`input\` is optional static input passed to the action on each run
393
+ - Common patterns: \`@activate\` (init/bootstrap), \`*/15 * * * *\` (every 15 min), \`0 2 * * *\` (daily at 02:00), \`0 */6 * * *\` (every 6 hours)
394
+ - If a nightly job depends on data from a periodic job (e.g., aggregation needs fresh data), schedule it AFTER the last periodic run (e.g., collection at */15, aggregation at 02:00)
395
+ - If the blueprint has no "schedules" for this extension, set \`schedules: []\`
396
+
397
+ ### @activate Init Pattern
398
+
399
+ If the extension collects or computes data, add an \`@activate\` scheduled job that:
400
+ 1. Checks if data exists and is fresh (not stale)
401
+ 2. If missing or stale, runs the init/collection logic
402
+ 3. If data is already fresh, does nothing (returns early)
403
+
404
+ This solves the cold-start problem: after first activation or a server restart, the extension's data is immediately populated instead of waiting for the next cron tick.
405
+
406
+ Example @activate action script pattern:
407
+ \`\`\`javascript
408
+ // Check if data already exists and is recent
409
+ const lastRun = await ctx.memory.get('last-ingest-timestamp');
410
+ if (lastRun) {
411
+ const age = Date.now() - new Date(lastRun).getTime();
412
+ if (age < 15 * 60 * 1000) return; // Data is fresh (< 15 min), skip
413
+ }
414
+ // Data is missing or stale — run the init/collection logic
415
+ // ... fetch data, store in memory ...
416
+ await ctx.memory.set('last-ingest-timestamp', new Date().toISOString());
417
+ \`\`\`
418
+
419
+ Schedule entry:
420
+ \`\`\`yaml
421
+ - id: init-data
422
+ action: init
423
+ cron: "@activate"
424
+ description: "Initialize/refresh data on activation and server restart"
425
+ instance_scope: false
426
+ input: {}
427
+ \`\`\`
428
+
429
+ IMPORTANT: @activate actions MUST be idempotent — they will run multiple times (every restart). Always check existing data before overwriting.
430
+
431
+ ### Init Action — Initialize Runtime Data Only
432
+
433
+ The init/@activate action should initialize extension-owned runtime data (watchlists, caches, logs).
434
+ Do NOT copy translations or settings to the extension namespace — cortex reads those
435
+ directly from the owner namespace via AIMEAT.data.get().
436
+
437
+ Pattern:
438
+ \`\`\`javascript
439
+ // Initialize extension runtime data if not already present
440
+ const watchlist = await ctx.memory.get('watchlist.items');
441
+ if (!watchlist) {
442
+ await ctx.memory.set('watchlist.items', []);
443
+ ctx.log.info('Initialized empty watchlist');
444
+ }
445
+ \`\`\`
446
+
447
+ Only initialize keys that the EXTENSION owns and writes to (runtime data).
448
+ Translations and settings live in the OWNER namespace — the cortex reads them directly.
449
+
450
+ ## Additional rules
451
+ - \`metadata\` section MUST have: name, version, description, author
452
+ - \`actions\` array MUST NOT be empty — each action needs: id, method, path, script
453
+ - Each action's \`script\` field value must match a \`// actions/{script}\` comment below the YAML
454
+ - \`limits.timeout_ms\`: use 30000 for extensions that call external APIs, 5000 for memory-only
455
+ - \`limits.max_api_calls\`: use 500 for data collectors (many memory writes per run), 100 for simple actions
456
+ - All helper functions must be defined INSIDE the same script file — no imports, no cross-file references
457
+ - If two actions need the same helper (e.g., date parsing, data normalization), DUPLICATE the helper in BOTH script files — copy it exactly, do NOT refactor into a shared module
458
+ - NEVER reference functions from another action's script — each script runs in its own ISOLATED V8 sandbox scope
459
+ - When duplicating helpers across actions, keep them IDENTICAL — if you fix a bug in one copy, fix it in all copies
460
+ - ╔═ NEVER call JSON.parse() on ctx.memory.get() results — they are already parsed JS values ═╗
461
+ - Always check for undefined/null before using memory values — on first run, NOTHING exists yet
462
+ - Always convert dates to ISO 8601 before storing in memory
463
+ - ╔═ OWNER DATA: seed data (memory components), settings, and translations are in the OWNER's namespace ═╗
464
+ Use \`ctx.memory.getPublic(ctx.caller.gaii, key)\` to read them — NOT \`ctx.memory.get(key)\`.
465
+ \`ctx.memory.get()\` only reads from the extension's own \`ext:{name}\` namespace.
466
+ Common pattern: \`const data = await ctx.memory.getPublic(ctx.caller.gaii, "lookup.data") || [];\`
467
+ ${HTML_ENTITY_RULES}`,
468
+
469
+ app: (label, context, completedComponents) => {
470
+ // Extract translation keys from completed translation components
471
+ const translationComponents = (completedComponents || []).filter(c => c.type === 'translation');
472
+ let translationKeysSection = '';
473
+ if (translationComponents.length > 0) {
474
+ const allKeys = new Set();
475
+ for (const tc of translationComponents) {
476
+ try {
477
+ let raw = tc.result;
478
+ // Strip markdown code fences if present
479
+ if (typeof raw === 'string') {
480
+ const fenceMatch = raw.match(/```(?:json)?\s*\n([\s\S]*?)```/);
481
+ if (fenceMatch) raw = fenceMatch[1];
482
+ }
483
+ const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
484
+ // Translation result is { "fi": { "key": "value" } } or { "en": { ... } }
485
+ const locale = Object.keys(parsed || {})[0];
486
+ if (locale && parsed[locale]) {
487
+ for (const key of Object.keys(parsed[locale])) allKeys.add(key);
488
+ }
489
+ } catch { /* skip unparseable */ }
490
+ }
491
+ if (allKeys.size > 0) {
492
+ const sorted = [...allKeys].sort();
493
+ translationKeysSection = `
494
+ ## AVAILABLE TRANSLATION KEYS (from registered translation components — use EXACTLY these)
495
+
496
+ ╔══════════════════════════════════════════════════════════════════════════╗
497
+ ║ Your app MUST use these EXACT keys when calling t(key, translations). ║
498
+ ║ Do NOT invent your own keys like "field.name" or "detail.addresses". ║
499
+ ║ The translation components have ALREADY defined these keys. ║
500
+ ╚══════════════════════════════════════════════════════════════════════════╝
501
+
502
+ ${sorted.map(k => '- `' + k + '`').join('\n')}
503
+
504
+ Total: ${sorted.length} keys available. If you need a label, find the closest matching key from this list.
505
+ `;
506
+ }
507
+ }
508
+
509
+ // Check if any cortex libraries are in completed components
510
+ const cortexComponents = (completedComponents || []).filter(c => c.type === 'cortex');
511
+ const hasCortex = cortexComponents.length > 0;
512
+
513
+ let cortexInstructions = '';
514
+ let cortexScriptLoads = '';
515
+ if (hasCortex) {
516
+ const cortexLibs = cortexComponents.map(c => {
517
+ // Use registeredAs (set during registration) — it's the canonical name
518
+ // Fallback: try regex on YAML metadata.name, then label
519
+ const libName = c.registeredAs
520
+ || c.result?.match?.(/metadata:\s*\n\s+name:\s*"?([^\s"]+)"?/)?.[1]
521
+ || c.label;
522
+ return { name: libName, label: c.label, result: c.result };
523
+ });
524
+
525
+ cortexScriptLoads = cortexLibs.map(lib =>
526
+ ` await loadScript('/v1/cortex/${lib.name}/libs/${lib.name}.js');`
527
+ ).join('\n');
528
+
529
+ // Extract actual method names from cortex code exports
530
+ const extractedMethods = [];
531
+ for (const lib of cortexLibs) {
532
+ // Extract actual LIB_NAME from cortex code (authoritative), fallback to camelCase conversion
533
+ const libNameMatch = lib.result?.match?.(/const\s+LIB_NAME\s*=\s*['"]([^'"]+)['"]/);
534
+ const camelName = libNameMatch ? libNameMatch[1] : lib.name.replace(/-([a-z0-9])/g, (_, ch) => ch.toUpperCase());
535
+ const exportsMatch = lib.result?.match?.(/(?:const|let|var)\s+\w*[Ee]xport\w*\s*=\s*\{([\s\S]*?)\}/);
536
+ if (exportsMatch) {
537
+ const methods = exportsMatch[1].split(',').map(m => m.trim().split(':')[0].trim()).filter(Boolean);
538
+ for (const m of methods) {
539
+ extractedMethods.push('- `AIMEAT.' + camelName + '.' + m + '()`');
540
+ }
541
+ }
542
+ }
543
+
544
+ let methodList = '';
545
+ if (extractedMethods.length > 0) {
546
+ methodList = `
547
+ ### AVAILABLE CORTEX METHODS (extracted from actual code — use ONLY these):
548
+ ${extractedMethods.join('\n')}
549
+
550
+ Do NOT call any method not in this list. Do NOT rename these methods.
551
+ `;
552
+ }
553
+
554
+ cortexInstructions = `
555
+ ## CORTEX LIBRARIES (use these — do NOT call extensions or memory directly)
556
+
557
+ This project has Cortex libraries that wrap all extension APIs into clean domain methods.
558
+ Load them via <script> tags and use their API.
559
+
560
+ ${(() => {
561
+ // Collect probe results from extension components — real API response data
562
+ const extProbeResults = (completedComponents || [])
563
+ .filter(c => c.type === 'extension' && c.probeResults && c.probeResults.length > 0)
564
+ .flatMap(c => c.probeResults.filter(p => p.status === 200 && p.response));
565
+ return cortexLibs.map(lib => {
566
+ const apiSummary = lib.result ? summarizeCortexApiForApp(lib.result, extProbeResults) : ' (no API info available)';
567
+ return `### ${lib.label}
568
+ Load: \\\`<script src="/v1/cortex/${lib.name}/libs/${lib.name}.js"></script>\\\`
569
+ ${apiSummary}
570
+ `;
571
+ }).join('\n');
572
+ })()}
573
+
574
+ ${methodList}
575
+ RULES:
576
+ - Call \\\`AIMEAT.{libName}.init()\\\` on app start (libName is camelCase of cortex name, e.g., \\\`my-domain-lib\\\` → \\\`AIMEAT.myDomainLib.init()\\\`)
577
+ - Use cortex methods for ALL data access — never call extensions or memory directly
578
+ - NEVER call internal functions like callExt(), readExtMemory() — these are PRIVATE
579
+ - NEVER build retry loops — show an error message on failure, do NOT auto-retry
580
+ - Use EXACTLY the method names and return value shapes shown above
581
+
582
+ ### AIMEAT Platform UI Libraries (load BEFORE your domain cortex)
583
+
584
+ \\\`\\\`\\\`html
585
+ <script src="/v1/cortex/aimeat-ui-nav/libs/aimeat-ui-nav.js"></script>
586
+ <script src="/v1/cortex/aimeat-ui-layout/libs/aimeat-ui-layout.js"></script>
587
+ <script src="/v1/cortex/aimeat-ui-viewers/libs/aimeat-ui-viewers.js"></script>
588
+ <script src="/v1/cortex/aimeat-ui-forms/libs/aimeat-ui-forms.js"></script>
589
+ <script src="/v1/cortex/aimeat-ui-dialogs/libs/aimeat-ui-dialogs.js"></script>
590
+ \\\`\\\`\\\`
591
+
592
+ Use these instead of raw HTML: \\\`Tabs\\\` for navigation, \\\`DataTable\\\` for tables, \\\`Input/Select/Toggle\\\` for forms, \\\`toast/Modal/Confirm\\\` for dialogs (never use native alert/confirm/prompt).
593
+ `;
594
+ }
595
+
596
+ return `${AIMEAT_CONTEXT}
597
+
598
+ Create an AIMEAT App (HTML/JS) for: ${label}
599
+
600
+ ${context}
601
+
602
+ ## CRITICAL: Authentication & API Calls
603
+
604
+ The app runs on the SAME ORIGIN as the AIMEAT node. Use relative API paths (e.g., "/v1/ext/..."), NOT absolute URLs.
605
+
606
+ ### Library setup (copy this exactly — load BOTH libraries):
607
+ \`\`\`javascript
608
+ // Load AIMEAT libraries — auth handles login/JWT, data handles memory API
609
+ function loadScript(src) {
610
+ return new Promise((resolve, reject) => {
611
+ const s = document.createElement('script');
612
+ s.src = src; s.onload = resolve; s.onerror = reject;
613
+ document.head.appendChild(s);
614
+ });
615
+ }
616
+
617
+ async function boot() {
618
+ try {
619
+ await loadScript('/v1/libs/aimeat-auth.js');
620
+ await loadScript('/v1/libs/aimeat-data.js');
621
+ // Platform UI libraries (pre-installed on every AIMEAT node)
622
+ await loadScript('/v1/cortex/aimeat-ui-nav/libs/aimeat-ui-nav.js');
623
+ await loadScript('/v1/cortex/aimeat-ui-layout/libs/aimeat-ui-layout.js');
624
+ await loadScript('/v1/cortex/aimeat-ui-viewers/libs/aimeat-ui-viewers.js');
625
+ await loadScript('/v1/cortex/aimeat-ui-forms/libs/aimeat-ui-forms.js');
626
+ await loadScript('/v1/cortex/aimeat-ui-dialogs/libs/aimeat-ui-dialogs.js');
627
+ ${hasCortex ? '\n' + cortexScriptLoads : ''}
628
+ AIMEAT.auth.mountLoginButton('#auth-container', {
629
+ onLogin: () => startApp(),
630
+ onLogout: () => location.reload(),
631
+ });
632
+ AIMEAT.auth.login().then(session => { if (session) startApp(); }).catch(() => {});
633
+ } catch (err) {
634
+ document.body.innerHTML = '<div style="padding:2rem;color:#ef4444;font-family:system-ui">'
635
+ + '<h2>Failed to load application</h2><p>' + err.message + '</p>'
636
+ + '<p>Make sure the AIMEAT node is running and accessible.</p></div>';
637
+ }
638
+ }
639
+ boot();
640
+ \`\`\`
641
+
642
+ ${translationKeysSection}
643
+ ${hasCortex ? cortexInstructions : `### AIMEAT.data API (memory read/write — handles auth and envelope automatically):
644
+ \\\`\\\`\\\`javascript
645
+ // Read YOUR OWN memory key — returns the stored value directly, or null
646
+ const myData = await AIMEAT.data.get('my.settings');
647
+
648
+ // Write a memory key (your own namespace)
649
+ await AIMEAT.data.set('my.key', { count: 42 });
650
+
651
+ // Delete your own memory key
652
+ await AIMEAT.data.delete('my.key');
653
+ \\\`\\\`\\\`
654
+
655
+ ### Reading EXTENSION-produced data (CRITICAL — most apps need this):
656
+ Extensions store data in their OWN namespace (\\\`ext:{extension-name}\\\`).
657
+ To read data that an extension wrote, use \\\`getPublic()\\\`:
658
+ \\\`\\\`\\\`javascript
659
+ // WRONG — this reads YOUR memory, not the extension's:
660
+ const data = await AIMEAT.data.get('items.by-date.__index'); // returns null!
661
+
662
+ // CORRECT — read from the extension's namespace:
663
+ const data = await AIMEAT.data.getPublic('ext:my-collector-extension', 'items.by-date.__index');
664
+ \\\`\\\`\\\`
665
+ The first argument is the extension's memory owner: \\\`"ext:" + extensionName\\\` (the \\\`name\\\` field from the extension manifest metadata).
666
+ Use this for ALL data produced by extensions (collected data, computed stats, caches, etc.).
667
+ \\\`getPublic()\\\` returns the value directly (auto-unwraps), or null if not found.
668
+
669
+ ### Reading TRANSLATIONS (stored in owner namespace by translation components):
670
+ Translations are stored in the OWNER's namespace by the translation component during registration.
671
+ The key format is: \\\`{service-name}.i18n.{locale}\\\` (e.g. \\\`my-service.i18n.fi\\\`).
672
+ \\\`\\\`\\\`javascript
673
+ // Read translations from OWNER namespace (the translation component stored them here):
674
+ const fiStrings = await AIMEAT.data.get('my-service.i18n.fi') || await AIMEAT.data.get('i18n.fi') || {};
675
+ const enStrings = await AIMEAT.data.get('my-service.i18n.en') || await AIMEAT.data.get('i18n.en') || {};
676
+ \\\`\\\`\\\`
677
+ Use AIMEAT.data.get() — this reads from the current user's namespace where translations live.
678
+ If a cortex library has a getI18n(locale) method, use that instead (recommended).
679
+
680
+ ### Calling extension actions (use AIMEAT.auth session for authenticated fetch):
681
+
682
+ ╔══════════════════════════════════════════════════════════════════════════╗
683
+ ║ CRITICAL: session.fetch() returns ALREADY-PARSED JSON, not Response. ║
684
+ ║ Do NOT call resp.json() — it will crash with "not a function". ║
685
+ ║ Access resp.ok, resp.data, resp.error directly. ║
686
+ ╚══════════════════════════════════════════════════════════════════════════╝
687
+
688
+ \\\`\\\`\\\`javascript
689
+ // Helper for extension calls (copy this EXACTLY):
690
+ // ALL extension actions are POST — the backend only has router.post() routes
691
+ async function extCall(extName, actionId, body = {}) {
692
+ const session = await AIMEAT.auth.login();
693
+ if (!session) throw new Error('Not logged in');
694
+ const url = '/v1/ext/' + extName + '/' + actionId;
695
+ const resp = await session.fetch(url, { method: 'POST', body: JSON.stringify(body) });
696
+ // resp is ALREADY parsed JSON — never call resp.json()
697
+ if (!resp.ok) throw new Error(resp.error?.message || 'Extension call failed');
698
+ return resp.data; // unwrapped payload
699
+ }
700
+
701
+ // Usage:
702
+ const results = await extCall('my-extension', 'search', { query: 'test' });
703
+ const detail = await extCall('my-extension', 'getDetail', { id: 'abc-123' });
704
+ \\\`\\\`\\\``}
705
+
706
+ ## CDN Libraries & Design Resources
707
+
708
+ The AIMEAT app catalog allows external CDN scripts. Available libraries:
709
+
710
+ | Library | Script Tag | Use for |
711
+ |---------|-----------|---------|
712
+ | Leaflet | \`<script src="https://unpkg.com/leaflet@1/dist/leaflet.js"></script>\` + CSS link: \`<link rel="stylesheet" href="https://unpkg.com/leaflet@1/dist/leaflet.css">\` | Maps, markers, geospatial |
713
+ | Chart.js | \`<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>\` | Bar, line, pie, radar charts |
714
+ | Motion | \`<script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.js"></script>\` | Animations via \`Motion.animate(el, {x: 100}, {duration: 0.5})\` |
715
+ | Phaser 3 | \`<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js"></script>\` | Games, interactive canvas, physics |
716
+
717
+ ### CSP (Content Security Policy) — the app HTML MUST include a meta tag
718
+
719
+ AIMEAT enforces CSP headers. If your app loads CDN scripts/styles, you MUST add a \`<meta>\` tag:
720
+ \\\`\\\`\\\`html
721
+ <meta http-equiv="Content-Security-Policy" content="
722
+ default-src 'self';
723
+ script-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net;
724
+ style-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net https://fonts.googleapis.com;
725
+ img-src 'self' data: https: blob:;
726
+ font-src 'self' https://fonts.gstatic.com;
727
+ connect-src 'self' https://*.tile.openstreetmap.org https://cdn.jsdelivr.net https://unpkg.com;
728
+ ">
729
+ \\\`\\\`\\\`
730
+ Only include CDN domains you actually use. Without this tag, CDN scripts will be BLOCKED silently.
731
+
732
+ IMPORTANT: If your app uses Leaflet or any map library that loads tiles from external servers,
733
+ you MUST add the tile server domain to \`connect-src\`. For OpenStreetMap: \`https://*.tile.openstreetmap.org\`.
734
+ Without this, the map will appear but tiles will be blocked and it shows a grey/empty map.
735
+
736
+ For UI inspiration, reference uiverse.io for fancy buttons, cards, toggles, and loaders (CSS-only patterns).
737
+
738
+ ## CSS Design System
739
+
740
+ Use CSS custom properties for ALL styling. Define a theme at the top, then use var() everywhere:
741
+ \`\`\`css
742
+ :root {
743
+ --color-primary: #3b82f6; /* main action color — customize per project */
744
+ --color-secondary: #64748b;
745
+ --color-success: #22c55e;
746
+ --color-warning: #f59e0b;
747
+ --color-danger: #ef4444;
748
+ --color-bg: #ffffff;
749
+ --color-bg-card: #f8fafc;
750
+ --color-text: #1e293b;
751
+ --color-text-dim: #64748b;
752
+ --color-border: #e2e8f0;
753
+ --radius: 8px;
754
+ --radius-lg: 12px;
755
+ --spacing-xs: 4px;
756
+ --spacing-sm: 8px;
757
+ --spacing-md: 16px;
758
+ --spacing-lg: 24px;
759
+ --spacing-xl: 32px;
760
+ --font-sans: system-ui, -apple-system, sans-serif;
761
+ --font-mono: 'JetBrains Mono', ui-monospace, monospace;
762
+ --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
763
+ --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
764
+ --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
765
+ --transition: 150ms ease;
766
+ }
767
+ \`\`\`
768
+
769
+ NEVER use hardcoded hex colors in component styles. Always use var(--color-*).
770
+ Customize the palette based on the project's domain and the style preferences from the spec.
771
+
772
+ ## Auth UI Layout
773
+
774
+ The #auth-container renders a login button and session bar at the top of the page.
775
+ Reserve space for it in your layout — do not overlap or hide it:
776
+ \`\`\`html
777
+ <body>
778
+ <div id="auth-container"></div> <!-- AIMEAT login/session UI — always at top -->
779
+ <header><!-- your app header --></header>
780
+ <main id="app"><!-- your content --></main>
781
+ </body>
782
+ \`\`\`
783
+
784
+ ## Rules
785
+ - DO NOT add manual configuration fields for API URL, Bearer Token, or Instance ID
786
+ - DO NOT use prompt() or manual token entry — the auth library handles everything
787
+ - ALL API paths MUST be relative (start with /) — never use absolute URLs or NODE_URL
788
+ - Use \`await AIMEAT.auth.login()\` to restore session from storage; if null, show a "Sign in" message. getSession() alone returns null until login() is called.
789
+ - Use vanilla JS (no build step needed)
790
+ - All dates displayed to users should be formatted from ISO 8601 strings (never store display-formatted dates)
791
+ - Has a clean, responsive UI with good mobile support
792
+ - Use CSS custom properties for theming where possible
793
+ ${hasCortex ? '- Call cortex init() on app start — it handles everything automatically\n- Focus on UX/UI — the cortex handles data access and initialization' : ''}
794
+
795
+ ## CRITICAL: Rendering API Data — Handle Nested Objects
796
+
797
+ API responses often contain nested objects instead of plain strings. For example:
798
+ - \`itemId: { value: "12345", registrationDate: "2024-01-15" }\` — access \`.value\`
799
+ - \`identifier: { value: "ID-12345", source: "1" }\` — access \`.value\`
800
+ - \`website: { url: "www.example.com", registrationDate: "..." }\` — access \`.url\`
801
+ - \`names: [{ name: "Example Item", type: "1" }]\` — access \`[0].name\`
802
+
803
+ ╔══════════════════════════════════════════════════════════════════════════╗
804
+ ║ NEVER render an object directly as text — it will show [object Object] ║
805
+ ║ ALWAYS check: if (typeof val === 'object' && val !== null) ║
806
+ ║ Then access the appropriate sub-field (.value, .url, .name, etc.) ║
807
+ ╚══════════════════════════════════════════════════════════════════════════╝
808
+
809
+ Helper pattern:
810
+ \\\`\\\`\\\`javascript
811
+ function displayValue(val) {
812
+ if (val == null) return '-';
813
+ if (typeof val === 'string') return val;
814
+ if (typeof val === 'number' || typeof val === 'boolean') return String(val);
815
+ if (val.value) return val.value; // { value: "..." } pattern
816
+ if (val.url) return val.url; // { url: "..." } pattern
817
+ if (val.name) return val.name; // { name: "..." } pattern
818
+ if (Array.isArray(val)) return val.map(displayValue).join(', ');
819
+ return JSON.stringify(val); // last resort — never [object Object]
820
+ }
821
+ \\\`\\\`\\\`
822
+
823
+ ## CRITICAL: Empty-State Handling
824
+
825
+ On first run, extension data does NOT exist yet. The app MUST show a friendly empty state:
826
+ - Check every data response for null/empty before rendering
827
+ - Show helpful messages: "No data yet — extensions will collect data on their next scheduled run"
828
+ - NEVER crash on null/undefined data — always provide fallback UI
829
+
830
+ ## Built-in Error Collector (diagnostics)
831
+
832
+ Add this error collector at the TOP of your main <script>, before any other code:
833
+ \\\`\\\`\\\`javascript
834
+ // Error collector — surfaces runtime errors in the UI for diagnostics
835
+ (function() {
836
+ var errors = [];
837
+ window.onerror = function(msg, src, line, col) {
838
+ errors.push({ msg: msg, src: src, line: line, col: col, at: new Date().toISOString() });
839
+ showErrors();
840
+ };
841
+ window.addEventListener('unhandledrejection', function(e) {
842
+ errors.push({ msg: String(e.reason), src: 'promise', line: 0, col: 0, at: new Date().toISOString() });
843
+ showErrors();
844
+ });
845
+ function showErrors() {
846
+ var el = document.getElementById('app-errors');
847
+ if (!el) { el = document.createElement('div'); el.id = 'app-errors'; el.style.cssText = 'position:fixed;bottom:0;left:0;right:0;background:#1a0000;color:#ff6b6b;font-size:12px;padding:8px 12px;max-height:120px;overflow:auto;z-index:9999;font-family:monospace;border-top:2px solid #ff4444'; document.body.appendChild(el); }
848
+ el.innerHTML = errors.map(function(e) { return e.at.slice(11,19) + ' ' + e.msg + ' (' + e.src + ':' + e.line + ')'; }).join('<br>');
849
+ }
850
+ })();
851
+ \\\`\\\`\\\`
852
+ This lets users see runtime errors without opening the browser console.
853
+
854
+ ${HTML_ENTITY_RULES}
855
+
856
+ Return a complete HTML file with an app manifest comment at the top:
857
+
858
+ \`\`\`html
859
+ <!-- AIMEAT App Manifest
860
+ name: kebab-case-name
861
+ version: 1.0.0
862
+ description: What this app does
863
+ entry: index.html
864
+ -->
865
+ <!DOCTYPE html>
866
+ <html>
867
+ <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>App Name</title></head>
868
+ <body>
869
+ <div id="auth-container"></div>
870
+ <div id="app"></div>
871
+ <script>
872
+ // Auth setup + API helper + app logic here
873
+ </script>
874
+ </body>
875
+ </html>
876
+ \`\`\``;
877
+ },
878
+
879
+ memory: (label, context) => `${AIMEAT_CONTEXT}
880
+
881
+ Define memory structure for: ${label}
882
+
883
+ ${context}
884
+
885
+ ## Memory Key Conventions
886
+
887
+ AIMEAT memory uses dot-namespaced keys with a standard metadata pattern:
888
+
889
+ - \`namespace.__meta\` — describes the namespace (version, key format, description)
890
+ - \`namespace.__index\` — lightweight index for fast lookups (list of dates, counts, rankings)
891
+ - \`namespace.__config\` — configuration for the namespace (TTLs, thresholds, weights)
892
+ - \`namespace.YYYY-MM-DD\` — date-bucketed data (one key per day)
893
+ - \`namespace.item-id\` — individual items
894
+
895
+ Values are JSON objects — a single value can hold arrays, nested objects, and large datasets (up to several MB). There is NO reason to split a dataset across multiple keys when it logically belongs together.
896
+
897
+ ## Rules
898
+ - All keys MUST be lowercase with dots as namespace separators
899
+ - Date-bucketed keys MUST use YYYY-MM-DD format: "items.by-date.2026-03-14"
900
+ - All date/time values inside objects MUST be ISO 8601: "2026-03-14T13:00:00.000Z"
901
+ - Include __meta with version and description for every namespace
902
+ - Include __index if consumers need to discover which keys exist (e.g., list of dates with data)
903
+ - Keep __index lightweight — just key names, counts, and pointers. NOT full data copies.
904
+ - Use arrays for ordered collections within a bucket (e.g., entries per day)
905
+ - Use meaningful field names that match the CSM data_schema where applicable
906
+ - PREFER fewer, larger keys over many small keys. A lookup table, reference dataset, or configuration object should be ONE key containing the full data structure (object or array), NOT split into one key per entry. For example, a list of 300 items should be ONE key "catalog.data" containing the full array — NOT 300 separate keys.
907
+
908
+ Return a JSON object where keys are memory key names and values are the initial/template data:
909
+ \`\`\`json
910
+ {
911
+ "namespace.__meta": {
912
+ "version": "1.0",
913
+ "description": "What this namespace stores",
914
+ "keyFormat": "namespace.YYYY-MM-DD"
915
+ },
916
+ "namespace.__index": {
917
+ "dates": [],
918
+ "totalItems": 0,
919
+ "lastUpdated": ""
920
+ },
921
+ "namespace.YYYY-MM-DD": {
922
+ "date": "YYYY-MM-DD",
923
+ "items": []
924
+ }
925
+ }
926
+ \`\`\``,
927
+
928
+ translation: (label, context) => `${AIMEAT_CONTEXT}
929
+
930
+ Create translations for: ${label}
931
+
932
+ ${context}
933
+
934
+ ## Translation Key Conventions
935
+
936
+ - Keys use dot-namespaced paths matching the UI structure: "app.list.title", "app.filters.status"
937
+ - Group by UI section: "app.nav.*", "app.map.*", "app.filters.*", "app.stats.*"
938
+ - Include domain-specific terms: categories, statuses, types relevant to the project
939
+ - Use interpolation with \${variable} syntax for dynamic values: "Found \${count} items"
940
+
941
+ ## CRITICAL: Generate ONLY the locale indicated by the label
942
+
943
+ Each translation component covers ONE locale. The label tells you which one:
944
+ - "Finnish (fi) Strings" → generate ONLY Finnish translations under the "fi" root key
945
+ - "English (en) Strings" → generate ONLY English translations under the "en" root key
946
+
947
+ ╔══════════════════════════════════════════════════════════════════════════╗
948
+ ║ NEVER generate both locales in one component. ║
949
+ ║ If the label says "Finnish", output ONLY { "fi": { ... } }. ║
950
+ ║ If the label says "English", output ONLY { "en": { ... } }. ║
951
+ ║ The other locale is handled by a SEPARATE component in the blueprint. ║
952
+ ╚══════════════════════════════════════════════════════════════════════════╝
953
+
954
+ ## Rules
955
+ - The root key MUST match the locale in the label: "en" for English, "fi" for Finnish
956
+ - NEVER include the other locale — it will be generated in its own component
957
+ - Finnish translations must be natural Finnish with correct characters (ä, ö, å) — not machine-translated
958
+ - Include ALL text that appears in the UI — labels, buttons, tooltips, empty states, error messages
959
+ - Keep keys consistent with what the App component will reference
960
+ - Use plural-aware keys where needed: "item.one" / "item.many"
961
+ - Both locale components MUST use the SAME key structure — the app uses the same keys for both
962
+
963
+ Return JSON with translations for the SINGLE locale from the label:
964
+
965
+ Example — if label is "Finnish (fi) Strings":
966
+ \`\`\`json
967
+ {
968
+ "fi": {
969
+ "app.title": "Sovelluksen nimi",
970
+ "app.nav.home": "Etusivu",
971
+ "app.filters.status": "Tila",
972
+ "app.filters.all": "Kaikki",
973
+ "app.empty": "Tietoja ei löytynyt",
974
+ "app.error": "Jokin meni pieleen",
975
+ "domain.type.example_category": "Esimerkkikategoria",
976
+ "domain.status.active": "Aktiivinen"
977
+ }
978
+ }
979
+ \`\`\`
980
+
981
+ Example — if label is "English (en) Strings":
982
+ \`\`\`json
983
+ {
984
+ "en": {
985
+ "app.title": "App Title",
986
+ "app.nav.home": "Home",
987
+ "app.filters.status": "Status",
988
+ "app.filters.all": "All",
989
+ "app.empty": "No data found",
990
+ "app.error": "Something went wrong",
991
+ "domain.type.example_category": "Example Category",
992
+ "domain.status.active": "Active"
993
+ }
994
+ }
995
+ \`\`\``,
996
+
997
+ cortex: (label, context, completedComponents) => {
998
+ // Build extension reference from completed components
999
+ const extComponents = (completedComponents || []).filter(c => c.type === 'extension');
1000
+ let extRef = '';
1001
+ if (extComponents.length > 0) {
1002
+ extRef = `\n## Registered Extensions (your cortex wraps these)\n`;
1003
+ extRef += `\nIMPORTANT: Use readExtMemory(EXT.name, 'key') to read from extension namespace.\n`;
1004
+ extRef += `The extension name in EXT object MUST exactly match the registered metadata.name.\n\n`;
1005
+ for (const ext of extComponents) {
1006
+ // Use registeredAs (canonical name from registration), fallback to regex then label
1007
+ const extName = ext.registeredAs
1008
+ || ext.result?.match?.(/name:\s*"?([^\s"]+)"?/)?.[1]
1009
+ || ext.label;
1010
+ extRef += `- **${extName}** (${ext.label}): memory owner = \`ext:${extName}\`\n`;
1011
+ if (ext.result) {
1012
+ // Include API summary with memory keys and data shapes — NOT full code.
1013
+ // This gives the cortex enough info to generate correct wrapper methods
1014
+ // without overwhelming the AI with thousands of lines of extension code.
1015
+ extRef += summarizeExtensionApi(ext.result);
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ return `${AIMEAT_CONTEXT}
1021
+
1022
+ Create a Cortex extension (client-side JS domain library) for: ${label}
1023
+
1024
+ ${context}
1025
+ ${extRef}
1026
+ ## What is a Cortex Library?
1027
+
1028
+ A Cortex library is a client-side JavaScript library that bridges V8 extensions and the app layer.
1029
+ It wraps raw AIMEAT API calls (extension actions, memory reads from extension namespaces) into
1030
+ clean, documented domain methods. Apps import the cortex and call simple methods like
1031
+ \`AIMEAT.myLib.getData()\` instead of knowing about memory namespaces and extension names.
1032
+
1033
+ ## CRITICAL: Use the Extension API Summary Above
1034
+
1035
+ The extension API summary shows the EXACT memory keys and data shapes. Your cortex MUST match them:
1036
+
1037
+ ╔══════════════════════════════════════════════════════════════════════════╗
1038
+ ║ 1. Use the "Memory writes" keys as your readExtMemory() keys ║
1039
+ ║ 2. Use the "Data shape" info to know what fields the data contains ║
1040
+ ║ 3. Your getPublic() calls MUST use those EXACT same keys ║
1041
+ ║ 4. Your methods MUST return data in the EXACT shape the extension ║
1042
+ ║ stores it — do NOT invent new field names or structures ║
1043
+ ║ 5. Use the "Action" endpoints for callExt() on-demand calls ║
1044
+ ╚══════════════════════════════════════════════════════════════════════════╝
1045
+
1046
+ Example: if the extension writes to key "orders.data" with shape { id, title, ... }
1047
+ then your cortex must read \`getPublic('ext:extension-name', 'orders.data')\`
1048
+ and return objects with the SAME structure — NOT \`data\`, NOT \`entries\`, NOT \`results\`.
1049
+
1050
+ ## Design Principles
1051
+
1052
+ 1. **Domain Cohesion**: Group related operations into a single API surface
1053
+ 2. **Facade Pattern**: Hide extension namespaces (\`ext:{name}\`), memory key patterns, and error handling
1054
+ 3. **DRY / Genericity**: If a capability is reusable across projects, make it generic
1055
+ 4. **Smart Init**: \`init()\` checks if data exists and returns status — see init() rules below
1056
+ 5. **Composability**: Cortex libs can use other cortex libs via \`AIMEAT.{otherLib}\`
1057
+ 6. **Self-Documenting**: Export clear, named functions with consistent patterns
1058
+
1059
+ ## What Cortex Libraries Can Contain
1060
+
1061
+ Cortex is a CLIENT-SIDE JavaScript library. It can contain:
1062
+
1063
+ - **Data access methods**: read/write AIMEAT memory, call extension actions (on-demand only)
1064
+ - **UI components**: functions that create DOM elements, render HTML, inject CSS
1065
+ - **Visualization helpers**: chart builders, map renderers, interactive widgets
1066
+ - **Event handling**: click handlers, ResizeObserver, custom events
1067
+ - **Domain logic**: client-side data transformation, filtering, sorting, formatting
1068
+
1069
+ Example: \`aimeat-charts\` cortex exports \`ChartPanel()\` and \`ChartBuilder()\` — functions that create \`<canvas>\` elements, inject CSS styles, and render interactive Chart.js visualizations.
1070
+
1071
+ A cortex library is NOT limited to data access — it can be a full UI component library.
1072
+ However, it MUST NOT contain backend/server logic (no scheduling, no data collection, no recurring tasks — that belongs to extensions).
1073
+
1074
+ ## IMPORTANT: How Extension Memory Works
1075
+
1076
+ Extensions store data in their OWN namespace (\`ext:{name}\`).
1077
+
1078
+ ╔══════════════════════════════════════════════════════════════════════════╗
1079
+ ║ CRITICAL: Extension namespace is READ-ONLY from client-side. ║
1080
+ ║ ║
1081
+ ║ ✅ Client CAN READ: getPublic('ext:my-collector', 'some.key') ║
1082
+ ║ ❌ Client CANNOT WRITE: PUT /v1/memory/ext:name/key → 404 ║
1083
+ ║ ║
1084
+ ║ To WRITE extension data, call an extension ACTION via callExt() ║
1085
+ ║ which runs server-side and uses ctx.memory.set(). ║
1086
+ ║ ║
1087
+ ║ For USER data (watches, settings, preferences), use writeOwnerMemory ║
1088
+ ║ which writes to the CURRENT USER's namespace via PUT /v1/memory/:key ║
1089
+ ╚══════════════════════════════════════════════════════════════════════════╝
1090
+
1091
+ To READ extension data from client-side:
1092
+ \\\`\\\`\\\`javascript
1093
+ // If AIMEAT.data is loaded (preferred):
1094
+ const value = await AIMEAT.data.getPublic('ext:my-collector', 'items.by-date.__index');
1095
+
1096
+ // Fallback without AIMEAT.data:
1097
+ const url = NODE_URL + '/v1/memory/' + encodeURIComponent('ext:my-collector') + '/' + encodeURIComponent(key);
1098
+ const resp = await fetch(url);
1099
+ const json = await resp.json();
1100
+ const value = json.ok ? json.data.value : null;
1101
+ \\\`\\\`\\\`
1102
+
1103
+ To WRITE data that belongs to the extension (shared across all users):
1104
+ \\\`\\\`\\\`javascript
1105
+ // WRONG — will 404:
1106
+ await session.fetch('/v1/memory/ext:my-collector/' + key, { method: 'PUT', ... });
1107
+
1108
+ // CORRECT — call an extension action that does ctx.memory.set() server-side:
1109
+ await callExt('my-collector', 'updateWatches', { watches: updatedList });
1110
+ \\\`\\\`\\\`
1111
+
1112
+ To WRITE data that belongs to the current user (personal preferences):
1113
+ \\\`\\\`\\\`javascript
1114
+ // CORRECT — writes to user's own namespace:
1115
+ await writeOwnerMemory('settings.config', { locale: 'fi', notifications: true });
1116
+ \\\`\\\`\\\`
1117
+
1118
+ ## IMPORTANT: How Translations Work
1119
+
1120
+ Translations are stored in the OWNER namespace by the translation component during registration.
1121
+ The key format is: \\\`{service-slug}.i18n.{locale}\\\` (e.g. \\\`my-service.i18n.fi\\\`).
1122
+ Read them with AIMEAT.data.get():
1123
+ \\\`\\\`\\\`javascript
1124
+ // Read translations from OWNER namespace (where translation component stored them):
1125
+ const fiStrings = await AIMEAT.data.get(SERVICE_SLUG + '.i18n.fi') || {};
1126
+ const enStrings = await AIMEAT.data.get(SERVICE_SLUG + '.i18n.en') || {};
1127
+ \\\`\\\`\\\`
1128
+
1129
+ Do NOT use readExtMemory or getPublic('ext:...') for translations — they are NOT in the extension namespace.
1130
+
1131
+ ### MANDATORY: t() helper function (MUST use this exact implementation)
1132
+
1133
+ Foundry produces flat translation keys like \\\`"tab.search": "Haku"\\\`. The t() function
1134
+ MUST check flat keys first, then fall back to nested dot-path traversal:
1135
+
1136
+ \\\`\\\`\\\`javascript
1137
+ function t(key, translations) {
1138
+ if (!key || !translations) return key || '';
1139
+ // Flat key first (e.g., "tab.search" as direct property)
1140
+ if (translations[key] != null && typeof translations[key] !== 'object') return translations[key];
1141
+ // Then nested dot-path traversal
1142
+ var parts = key.split('.'); var val = translations;
1143
+ for (var i = 0; i < parts.length; i++) {
1144
+ if (val == null || typeof val !== 'object') return key;
1145
+ val = val[parts[i]];
1146
+ }
1147
+ return (val != null && typeof val !== 'object') ? val : key;
1148
+ }
1149
+ \\\`\\\`\\\`
1150
+
1151
+ This function is an INTERNAL helper — do NOT export it. Use it in public methods that
1152
+ need translated text, e.g., \\\`t('tab.search', fiStrings)\\\`.
1153
+
1154
+ ## IMPORTANT: How Settings Work
1155
+
1156
+ Default settings are stored in the OWNER namespace by the memory component.
1157
+ The key is: \\\`{service-slug}.settings.config\\\`.
1158
+ \\\`\\\`\\\`javascript
1159
+ // Read settings from OWNER namespace (where memory component stored them):
1160
+ const settings = await AIMEAT.data.get(SERVICE_SLUG + '.settings.config') || {};
1161
+ \\\`\\\`\\\`
1162
+
1163
+ Do NOT use readExtMemory for settings — they are NOT in the extension namespace.
1164
+
1165
+ ## Extension Action Calls (authenticated — internal helper, NOT exported)
1166
+
1167
+ callExt() is an INTERNAL helper inside the cortex IIFE. It is NOT part of the public API.
1168
+ Apps MUST NOT call callExt() directly — use the cortex's exported methods instead.
1169
+
1170
+ \\\`\\\`\\\`javascript
1171
+ // ALL extension actions are POST — the backend only has router.post() routes
1172
+ async function callExt(extName, actionId, body) {
1173
+ try {
1174
+ if (!AIMEAT.auth || !AIMEAT.auth.getSession) return null;
1175
+ var session = AIMEAT.auth.getSession();
1176
+ if (!session) return null;
1177
+ var url = '/v1/ext/' + extName + '/' + actionId;
1178
+ var opts = { method: 'POST', body: JSON.stringify(body || {}) };
1179
+ var resp = await session.fetch(url, opts);
1180
+ if (!resp || !resp.ok) return null;
1181
+ return resp.data;
1182
+ } catch (e) {
1183
+ return null;
1184
+ }
1185
+ }
1186
+ \\\`\\\`\\\`
1187
+
1188
+ IMPORTANT: callExt is a PRIVATE helper inside the IIFE. Do NOT export it.
1189
+ Apps use the cortex's public methods (init, searchCompanies, etc.), never callExt directly.
1190
+
1191
+ ### Where to store different types of data
1192
+
1193
+ | Data type | Where to store | How to write |
1194
+ |-----------|---------------|-------------|
1195
+ | Shared/service data (feeds, stats, reference) | ext:{name} namespace | Extension scheduler via ctx.memory.set() |
1196
+ | Shared user-generated data (watches, alerts) | ext:{name} namespace | Extension action via callExt() → ctx.memory.set() |
1197
+ | Personal user preferences (settings, locale) | User's own namespace | writeOwnerMemory() via PUT /v1/memory/:key |
1198
+
1199
+ ## Output format — TWO separate code blocks
1200
+
1201
+ Return the YAML manifest and JavaScript library as TWO separate, properly tagged code blocks.
1202
+ The installer expects to receive them separately — the YAML defines the manifest, the JS is the library file.
1203
+
1204
+ CRITICAL: Use \\\`\\\`\\\`yaml for the manifest and \\\`\\\`\\\`javascript for the library code.
1205
+ Do NOT combine them into a single block. Do NOT use an untagged block.
1206
+
1207
+ First block — YAML manifest:
1208
+ \\\`\\\`\\\`yaml
1209
+ apiVersion: cortex.aimeat.org/v1
1210
+ kind: Extension
1211
+ metadata:
1212
+ name: my-domain-lib
1213
+ namespace: community
1214
+ description: "What this library does"
1215
+ author: foundry
1216
+ tags: [domain, tag1, tag2]
1217
+ labels:
1218
+ domain: specific-domain
1219
+ spec:
1220
+ version: "1.0.0"
1221
+ license: MIT
1222
+ components:
1223
+ - type: prompt
1224
+ name: domain-assistant
1225
+ content: |
1226
+ You are using the {{metadata.name}} cortex library.
1227
+ Node URL: {{node_url}}
1228
+
1229
+ Available API:
1230
+ AIMEAT.myLib.init() — Check data readiness and return status
1231
+ AIMEAT.myLib.getData(filters) — Get filtered data
1232
+ AIMEAT.myLib.getStats(date) — Get statistics for a date
1233
+
1234
+ To load in an app:
1235
+ <script src="{{node_url}}/v1/cortex/my-domain-lib/libs/my-domain-lib.js"></script>
1236
+
1237
+ - type: lib
1238
+ name: my-domain-lib
1239
+ filename: my-domain-lib.js
1240
+ exports: [init, getData, getStats]
1241
+ api_surface: |
1242
+ AIMEAT.myLib.init() — Check data readiness, returns { ready, hasData }
1243
+ AIMEAT.myLib.getData({hours, type}) — Filtered domain data
1244
+ AIMEAT.myLib.getStats(date) — Aggregated statistics
1245
+ \\\`\\\`\\\`
1246
+
1247
+ Second block — JavaScript library:
1248
+ \\\`\\\`\\\`javascript
1249
+ (function (AIMEAT) {
1250
+ 'use strict';
1251
+
1252
+ const LIB_NAME = 'myLib';
1253
+ // Extension names this cortex wraps — MUST match the registered extension names
1254
+ const EXT = {
1255
+ collector: 'my-collector-extension',
1256
+ aggregator: 'my-aggregator-extension',
1257
+ };
1258
+
1259
+ // ── Internal helpers ──
1260
+
1261
+ function nodeUrl() { return window.location.origin; }
1262
+
1263
+ // ── Memory helpers — use AIMEAT.data library (always available in browser) ──
1264
+ // The AIMEAT.data library handles auth, endpoints, and response parsing automatically.
1265
+ // Do NOT use raw fetch() or session.fetch() for memory operations.
1266
+
1267
+ /** Read from extension namespace (public, no auth needed) */
1268
+ async function readExtMemory(extName, key) {
1269
+ try { return await AIMEAT.data.getPublic('ext:' + extName, key); }
1270
+ catch (e) { return null; }
1271
+ }
1272
+
1273
+ /** Read from current user's own namespace */
1274
+ async function readOwnerMemory(key) {
1275
+ try { return await AIMEAT.data.get(key); }
1276
+ catch (e) { return null; }
1277
+ }
1278
+
1279
+ /** Write to current user's own namespace */
1280
+ async function writeOwnerMemory(key, value) {
1281
+ try { await AIMEAT.data.set(key, value); return true; }
1282
+ catch (e) { return false; }
1283
+ }
1284
+
1285
+ /** Delete from current user's own namespace */
1286
+ async function deleteOwnerMemory(key) {
1287
+ try { await AIMEAT.data.delete(key); return true; }
1288
+ catch (e) { return false; }
1289
+ }
1290
+
1291
+ // ╔══════════════════════════════════════════════════════════════════════════╗
1292
+ // ║ CRITICAL: session.fetch() returns ALREADY-PARSED JSON (not Response). ║
1293
+ // ║ Do NOT call resp.json() — it will crash. Use resp.data directly. ║
1294
+ // ╚══════════════════════════════════════════════════════════════════════════╝
1295
+ // ALL extension actions are POST — the backend only has router.post() routes
1296
+ async function callExt(extName, actionId, body) {
1297
+ try {
1298
+ if (!AIMEAT.auth || !AIMEAT.auth.getSession) return null;
1299
+ const session = AIMEAT.auth.getSession();
1300
+ if (!session) return null;
1301
+ const url = '/v1/ext/' + extName + '/' + actionId;
1302
+ const opts = { method: 'POST', body: JSON.stringify(body || {}) };
1303
+ const resp = await session.fetch(url, opts);
1304
+ if (!resp || !resp.ok) return null;
1305
+ return resp.data;
1306
+ } catch (e) {
1307
+ return null;
1308
+ }
1309
+ }
1310
+
1311
+ // ── Public API ──
1312
+
1313
+ async function init() {
1314
+ // Check if extension scheduler has produced data yet
1315
+ const cursor = await readExtMemory(EXT.collector, 'data.cursor');
1316
+ return { ready: true, hasData: !!cursor };
1317
+ // App shows empty state if hasData is false — scheduler will populate data in background
1318
+ }
1319
+
1320
+ async function getData(filters) {
1321
+ // Read from extension memory, apply filters, return clean data
1322
+ }
1323
+
1324
+ // ── Register ──
1325
+ const exports = { init, getData };
1326
+ if (AIMEAT.register) AIMEAT.register(LIB_NAME, exports);
1327
+ AIMEAT[LIB_NAME] = exports;
1328
+
1329
+ })(window.AIMEAT || (window.AIMEAT = {}));
1330
+ \\\`\\\`\\\`
1331
+
1332
+ CRITICAL: Use TWO separate code blocks — \\\`\\\`\\\`yaml for the manifest and \\\`\\\`\\\`javascript for the library.
1333
+ The JavaScript filename MUST match the \`filename\` field in the YAML lib component.
1334
+
1335
+ ## Rules
1336
+
1337
+ ### CRITICAL: Name Consistency
1338
+ The YAML \`metadata.name\` and the JS \`LIB_NAME\` MUST follow this convention:
1339
+ - YAML \`metadata.name\`: kebab-case (e.g., \`my-domain-lib\`)
1340
+ - JS \`LIB_NAME\`: MUST be declared with \`const\` (not var or let): \`const LIB_NAME = 'myDomainLib';\`
1341
+ - JS \`LIB_NAME\`: camelCase version of the SAME name (e.g., \`myDomainLib\`)
1342
+ - \`AIMEAT.register(LIB_NAME, exports)\` uses the camelCase name
1343
+ - Apps load via: \`/v1/cortex/{metadata.name}/libs/{metadata.name}.js\`
1344
+ - Apps access via: \`AIMEAT.{LIB_NAME}.method()\`
1345
+
1346
+ Example: YAML name \`my-domain-lib\` → LIB_NAME = \`myDomainLib\` → \`AIMEAT.myDomainLib.init()\`
1347
+
1348
+ - The library MUST be a single IIFE that registers on \`window.AIMEAT\`
1349
+ - Use \`AIMEAT.register(name, exports)\` if available, always set \`AIMEAT[name] = exports\`
1350
+ - Use \`AIMEAT.data.getPublic()\` for public memory reads (extension namespace data)
1351
+ - Use \`AIMEAT.auth.getSession().fetch()\` for ALL authenticated calls — NEVER use raw fetch() for API calls
1352
+ - The fallback path (when AIMEAT.data is not loaded) MUST also use session.fetch(), not raw fetch()
1353
+ - Extension names in \`EXT\` object MUST exactly match the registered extension \`metadata.name\`
1354
+ - \`init()\` MUST follow the init() contract below — no custom behavior
1355
+ - All public methods must be async (return Promises)
1356
+ - Handle errors gracefully — return null or empty arrays, don't throw for missing data
1357
+ - Include the prompt component with documented API surface for downstream AI consumers
1358
+
1359
+ ### MANDATORY: JSDoc for every public method
1360
+
1361
+ Every exported method MUST have a JSDoc comment with:
1362
+ - \`@param\` for each parameter with its type and description
1363
+ - \`@returns\` with the EXACT return shape — never use \`{Object}\`, always describe the fields
1364
+
1365
+ WRONG:
1366
+ \\\`\\\`\\\`javascript
1367
+ /** @returns {Object|null} Item data */
1368
+ async function getItem(id) { ... }
1369
+ \\\`\\\`\\\`
1370
+
1371
+ RIGHT:
1372
+ \\\`\\\`\\\`javascript
1373
+ /**
1374
+ * @param {string} id - Unique identifier
1375
+ * @returns {{ id: string, name: string, status: string, metadata: { createdAt: string, updatedAt: string } } | null}
1376
+ */
1377
+ async function getItem(id) { ... }
1378
+ \\\`\\\`\\\`
1379
+
1380
+ Use the ACTUAL API RESPONSES section (from probe data) to determine the exact return shapes.
1381
+ Every field you see in the probe response MUST appear in the @returns type definition.
1382
+ If probe data shows a nested object like \`field: { value: "abc", date: "2024-01-01" }\`, your @returns MUST reflect that: \`field: { value: string, date: string }\`.
1383
+
1384
+ ## init() Contract (MUST follow exactly)
1385
+
1386
+ ╔══════════════════════════════════════════════════════════════════════════╗
1387
+ ║ init() is a UI READINESS CHECK — it does NOT trigger backend logic. ║
1388
+ ║ The extension scheduler handles all data collection and computation. ║
1389
+ ║ Cortex init() only checks what data is available and returns status. ║
1390
+ ╚══════════════════════════════════════════════════════════════════════════╝
1391
+
1392
+ \\\`\\\`\\\`javascript
1393
+ async function init() {
1394
+ // 1. Check if data exists by reading the primary cursor/index key
1395
+ const cursor = await readExtMemory(EXT.collector, 'data.cursor');
1396
+
1397
+ // 2. Return status so the app knows what to show
1398
+ if (cursor) {
1399
+ return { ready: true, hasData: true };
1400
+ }
1401
+
1402
+ // 3. No data yet — scheduler hasn't run. App should show empty/loading state.
1403
+ return { ready: true, hasData: false };
1404
+ }
1405
+ \\\`\\\`\\\`
1406
+
1407
+ Rules for init():
1408
+ - NEVER trigger extension actions (callExt) from init() — the extension scheduler handles all recurring work
1409
+ - NEVER set up intervals, timers, or recurring triggers
1410
+ - NEVER call init() automatically inside the cortex IIFE — let the app call it
1411
+ - init() MUST be idempotent — calling it twice returns the same status
1412
+ - Return \`{ ready: true }\` always — the app checks this to know the cortex is loaded
1413
+ - Return \`{ hasData: false }\` when no data exists yet — the app shows an appropriate empty state ("Data is being collected, please wait...")
1414
+ - The ONLY place where callExt() is appropriate in a cortex is for ON-DEMAND user actions (e.g., findNearby, manual refresh button) — never for scheduled/background work
1415
+
1416
+ ## CRITICAL: Empty-State Handling (first-run scenario)
1417
+
1418
+ On first run, the extension scheduler may not have run yet — NO data exists.
1419
+ init() returns \`{ ready: true, hasData: false }\` and the app shows a waiting state.
1420
+ Every method MUST handle missing data gracefully:
1421
+
1422
+ \\\`\\\`\\\`javascript
1423
+ // WRONG — crashes if index doesn't exist:
1424
+ async function getData() {
1425
+ const index = await readExtMemory(EXT.collector, 'items.__index');
1426
+ return index.dates.map(d => ...); // TypeError: Cannot read 'dates' of null
1427
+ }
1428
+
1429
+ // CORRECT — return empty data:
1430
+ async function getData() {
1431
+ const index = await readExtMemory(EXT.collector, 'items.__index');
1432
+ if (!index || !index.dates || index.dates.length === 0) return [];
1433
+ // ... process data
1434
+ }
1435
+ \\\`\\\`\\\`
1436
+
1437
+ EVERY readExtMemory/getPublic call must be followed by a null/undefined check.
1438
+ NEVER assume data exists — the user may open the app before any extension has run.`;
1439
+ },
1440
+ };
1441
+
1442
+ /**
1443
+ * Summarize extension code into a compact API reference (actions, memory keys, data shapes).
1444
+ * Avoids injecting thousands of lines of full extension code into prompts.
1445
+ */
1446
+ /**
1447
+ * Extract only code blocks (```yaml ... ``` and ```javascript ... ```) from AI response.
1448
+ * Strips explanatory text that AI adds during fix rounds.
1449
+ */
1450
+ export function extractCodeBlocks(text) {
1451
+ if (!text) return '';
1452
+ const blocks = [];
1453
+ const re = /```(\w*)\n([\s\S]*?)```/g;
1454
+ let m;
1455
+ while ((m = re.exec(text)) !== null) {
1456
+ blocks.push('```' + m[1] + '\n' + m[2] + '```');
1457
+ }
1458
+ return blocks.length > 0 ? blocks.join('\n\n') : text;
1459
+ }
1460
+
1461
+ export function summarizeExtensionApi(result) {
1462
+ if (!result) return ' (no code available)\n';
1463
+ const lines = typeof result === 'string' ? result.split('\n') : [];
1464
+ const summary = [];
1465
+
1466
+ // Extract metadata.name
1467
+ const nameMatch = result.match(/name:\s*"?([^\s"]+)"?/);
1468
+ if (nameMatch) summary.push(` Extension name: ${nameMatch[1]}`);
1469
+
1470
+ // Extract actions (id, method, path, description)
1471
+ const actionRegex = /- id:\s*(\S+)/g;
1472
+ const descRegex = /description:\s*"([^"]+)"/g;
1473
+ const methodRegex = /method:\s*(\S+)/g;
1474
+ const pathRegex = /path:\s*(\S+)/g;
1475
+
1476
+ // Parse YAML actions section
1477
+ const actionsStart = result.indexOf('actions:');
1478
+ const schedulesStart = result.indexOf('schedules:');
1479
+ const actionsSection = actionsStart >= 0
1480
+ ? result.substring(actionsStart, schedulesStart >= 0 ? schedulesStart : undefined)
1481
+ : '';
1482
+
1483
+ if (actionsSection) {
1484
+ const actionBlocks = actionsSection.split(/\n - id:/);
1485
+ for (const block of actionBlocks.slice(1)) {
1486
+ const id = block.split('\n')[0].trim();
1487
+ const desc = block.match(/description:\s*"([^"]+)"/)?.[1] || '';
1488
+ const method = block.match(/method:\s*(\S+)/)?.[1] || 'POST';
1489
+ const path = block.match(/path:\s*(\S+)/)?.[1] || '';
1490
+ summary.push(` Action: ${method} ${path} (${id}) — ${desc}`);
1491
+ // Extract input properties
1492
+ const inputProps = block.match(/properties:\n((?:\s+\w+:\n(?:\s+\w+:.*\n)*)*)/);
1493
+ if (inputProps) {
1494
+ const propNames = [...inputProps[1].matchAll(/^\s{8}(\w+):/gm)].map(m => m[1]);
1495
+ if (propNames.length) summary.push(` Input: { ${propNames.join(', ')} }`);
1496
+ }
1497
+ }
1498
+ }
1499
+
1500
+ // Extract memory keys from ctx.memory.set() and ctx.memory.get() calls
1501
+ const memSetKeys = new Set();
1502
+ const memGetKeys = new Set();
1503
+ for (const match of result.matchAll(/ctx\.memory\.set\(['"]([^'"]+)['"]/g)) {
1504
+ memSetKeys.add(match[1]);
1505
+ }
1506
+ for (const match of result.matchAll(/ctx\.memory\.get\(['"]([^'"]+)['"]/g)) {
1507
+ memGetKeys.add(match[1]);
1508
+ }
1509
+ if (memSetKeys.size > 0) summary.push(` Memory writes: ${[...memSetKeys].join(', ')}`);
1510
+ if (memGetKeys.size > 0) summary.push(` Memory reads: ${[...memGetKeys].join(', ')}`);
1511
+
1512
+ // Extract data shapes from ctx.memory.set() values (first occurrence)
1513
+ for (const key of memSetKeys) {
1514
+ const setPattern = new RegExp(`ctx\\.memory\\.set\\(['"]${key.replace(/\./g, '\\.')}['"],\\s*\\{([^}]{1,200})`);
1515
+ const shapeMatch = result.match(setPattern);
1516
+ if (shapeMatch) {
1517
+ summary.push(` Data shape for "${key}": { ${shapeMatch[1].trim()} ... }`);
1518
+ }
1519
+ }
1520
+
1521
+ return summary.join('\n') + '\n';
1522
+ }
1523
+
1524
+ /**
1525
+ * Summarize cortex code into a compact API reference (public methods).
1526
+ */
1527
+ export function summarizeCortexApi(result) {
1528
+ if (!result) return ' (no code available)\n';
1529
+ const summary = [];
1530
+
1531
+ // Extract metadata.name
1532
+ const nameMatch = result.match(/name:\s*"?([^\s"]+)"?/);
1533
+ if (nameMatch) summary.push(` Cortex name: ${nameMatch[1]}`);
1534
+
1535
+ // Extract LIB_NAME
1536
+ const libMatch = result.match(/const\s+LIB_NAME\s*=\s*['"]([^'"]+)['"]/);
1537
+ if (libMatch) summary.push(` JS access: AIMEAT.${libMatch[1]}`);
1538
+
1539
+ // Extract public methods (async function declarations that are exported)
1540
+ const methodRegex = /async\s+function\s+(\w+)\s*\(/g;
1541
+ const methods = [];
1542
+ let match;
1543
+ while ((match = methodRegex.exec(result)) !== null) {
1544
+ methods.push(match[1]);
1545
+ }
1546
+ if (methods.length > 0) summary.push(` Public methods: ${methods.join(', ')}`);
1547
+
1548
+ // Extract EXT object (extension names this cortex wraps)
1549
+ const extMatch = result.match(/const\s+EXT\s*=\s*\{([^}]+)\}/);
1550
+ if (extMatch) summary.push(` Wraps extensions: ${extMatch[1].trim()}`);
1551
+
1552
+ // Extract readExtMemory calls (memory keys this cortex reads)
1553
+ const readKeys = new Set();
1554
+ for (const m of result.matchAll(/readExtMemory\([^,]+,\s*['"]([^'"]+)['"]/g)) {
1555
+ readKeys.add(m[1]);
1556
+ }
1557
+ if (readKeys.size > 0) summary.push(` Reads memory keys: ${[...readKeys].join(', ')}`);
1558
+
1559
+ return summary.join('\n') + '\n';
1560
+ }
1561
+
1562
+ /**
1563
+ * Summarize cortex API for the app prompt — shows ONLY public methods and return shapes.
1564
+ * Never shows internal functions (callExt, readExtMemory, etc.) to prevent apps from
1565
+ * bypassing the cortex and calling extensions directly.
1566
+ */
1567
+ /**
1568
+ * Generate a JSDoc-style API reference from cortex source code for the app prompt.
1569
+ * Shows ONLY public methods with parameters and return types.
1570
+ * Never exposes internal functions (callExt, readExtMemory, etc.).
1571
+ */
1572
+ export function summarizeCortexApiForApp(result, probeResults) {
1573
+ if (!result) return ' (no API info available)';
1574
+
1575
+ // Extract LIB_NAME
1576
+ const libMatch = result.match(/const\s+LIB_NAME\s*=\s*['"]([^'"]+)['"]/);
1577
+ const libName = libMatch ? libMatch[1] : 'unknownLib';
1578
+
1579
+ // Extract exported method names from the exports object
1580
+ const exportsMatch = result.match(/(?:const|var)\s+exports\s*=\s*\{([\s\S]*?)\}/);
1581
+ const exportedNames = new Set();
1582
+ if (exportsMatch) {
1583
+ for (const m of exportsMatch[1].split(',')) {
1584
+ const name = m.trim().split(':')[0].trim();
1585
+ if (name && !name.startsWith('//')) exportedNames.add(name);
1586
+ }
1587
+ }
1588
+
1589
+ // Extract function signatures + JSDoc comments for exported methods only
1590
+ const jsdocEntries = [];
1591
+ // Match JSDoc + function pairs: /** ... */ followed by async function name(...)
1592
+ const funcRegex = /(\/\*\*[\s\S]*?\*\/)\s*(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)/g;
1593
+ let match;
1594
+ while ((match = funcRegex.exec(result)) !== null) {
1595
+ const [, docComment, funcName, params] = match;
1596
+ if (!exportedNames.has(funcName)) continue; // skip internal functions
1597
+ jsdocEntries.push({ name: funcName, params, doc: docComment });
1598
+ }
1599
+
1600
+ // Also catch functions without JSDoc (fallback)
1601
+ const bareFuncRegex = /(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)\s*\{/g;
1602
+ while ((match = bareFuncRegex.exec(result)) !== null) {
1603
+ const [, funcName, params] = match;
1604
+ if (!exportedNames.has(funcName)) continue;
1605
+ if (jsdocEntries.some(e => e.name === funcName)) continue; // already captured
1606
+ jsdocEntries.push({ name: funcName, params, doc: null });
1607
+ }
1608
+
1609
+ // Build JSDoc-style output
1610
+ const lines = [];
1611
+ lines.push(`/**`);
1612
+ lines.push(` * Cortex library: AIMEAT.${libName}`);
1613
+ lines.push(` * Load: <script src="/v1/cortex/.../${libName.replace(/([A-Z])/g, '-$1').toLowerCase()}.js"></script>`);
1614
+ lines.push(` *`);
1615
+ lines.push(` * Call these methods from your app. They handle all backend communication internally.`);
1616
+ lines.push(` * Do NOT call callExt(), readExtMemory(), writeOwnerMemory() or /v1/ext/ directly.`);
1617
+ lines.push(` */`);
1618
+ lines.push('');
1619
+
1620
+ for (const entry of jsdocEntries) {
1621
+ if (entry.doc) {
1622
+ // Include the original JSDoc comment
1623
+ lines.push(entry.doc.trim());
1624
+ }
1625
+ lines.push(`async AIMEAT.${libName}.${entry.name}(${entry.params})`);
1626
+
1627
+ // Extract @returns shape from JSDoc for prominent display
1628
+ if (entry.doc) {
1629
+ const returnsMatch = entry.doc.match(/@returns\s+\{([^}]+)\}/);
1630
+ if (returnsMatch) {
1631
+ lines.push(` ⚠️ RETURNS: ${returnsMatch[1].trim()}`);
1632
+ lines.push(` Use EXACTLY these field names when accessing the result.`);
1633
+ }
1634
+ }
1635
+
1636
+ // Attach real response example from probe if available
1637
+ if (probeResults && probeResults.length > 0) {
1638
+ const probe = probeResults.find(p => p.action === entry.name);
1639
+ if (probe && probe.response) {
1640
+ const example = JSON.stringify(probe.response, null, 2);
1641
+ const truncated = example.length > 600 ? example.substring(0, 600) + '...' : example;
1642
+ lines.push(` ACTUAL RESPONSE (from live probe — use these EXACT field names):`);
1643
+ lines.push(` ${truncated.split('\n').join('\n ')}`);
1644
+ }
1645
+ }
1646
+ lines.push('');
1647
+ }
1648
+
1649
+ // If no JSDoc entries found, fall back to api_surface from YAML
1650
+ if (jsdocEntries.length === 0) {
1651
+ const apiSurfaceMatch = result.match(/api_surface:\s*\|\n([\s\S]*?)(?=\n\s{4}\w|\n\s{2}-|\n[^\s])/);
1652
+ if (apiSurfaceMatch) {
1653
+ lines.push('Public API:');
1654
+ for (const sl of apiSurfaceMatch[1].split('\n').map(l => l.trim()).filter(Boolean)) {
1655
+ lines.push(' ' + sl);
1656
+ }
1657
+ } else {
1658
+ // Last resort: just list method names
1659
+ for (const name of exportedNames) {
1660
+ lines.push(`async AIMEAT.${libName}.${name}()`);
1661
+ }
1662
+ }
1663
+ }
1664
+
1665
+ lines.push('');
1666
+ lines.push('╔══════════════════════════════════════════════════════════════════════════╗');
1667
+ lines.push('║ Use EXACTLY the field names shown in @returns and ACTUAL RESPONSE ║');
1668
+ lines.push('║ above. If @returns says { companies: Array }, use .companies ║');
1669
+ lines.push('║ NOT .results, .data, .items, or any other guessed name. ║');
1670
+ lines.push('║ These are the ONLY methods available. NEVER call callExt(), ║');
1671
+ lines.push('║ readExtMemory(), or /v1/ext/ directly. ║');
1672
+ lines.push('╚══════════════════════════════════════════════════════════════════════════╝');
1673
+
1674
+ return lines.join('\n');
1675
+ }
1676
+
1677
+ /* ── Shared Platform Rules ─────────────────────────────────────────────── */
1678
+ // These constants are shared across multiple prompts (extension, cortex, test, fix, edit)
1679
+ // to ensure consistent platform knowledge. When a rule changes, it propagates everywhere.
1680
+
1681
+ /**
1682
+ * NAMESPACE_RULES — How AIMEAT data is organized across namespaces.
1683
+ * Used by: extension template, cortex template, test prompt, fix prompt
1684
+ */
1685
+ export const NAMESPACE_RULES = `
1686
+ ## AIMEAT Namespace Rules
1687
+
1688
+ AIMEAT has TWO types of memory namespaces — understanding this is CRITICAL:
1689
+
1690
+ 1. **Owner namespace** — where the human user's data lives
1691
+ - Memory components (seed data, lookup tables) store here
1692
+ - Translation components store here (i18n.fi, i18n.en)
1693
+ - Settings components store here (settings.config)
1694
+ - Accessible via: ctx.memory.getPublic(ctx.caller.gaii, key) [from extension]
1695
+ - Accessible via: /v1/memory/{key} [from HTTP with owner's JWT]
1696
+
1697
+ 2. **Extension namespace** (\`ext:{name}\`) — where extension runtime data lives
1698
+ - Extension writes here via ctx.memory.set(key, value)
1699
+ - Accessible to ALL users via: ctx.memory.getPublic('ext:{name}', key)
1700
+ - Accessible via: readExtMemory(name, key) [from cortex/app]
1701
+ - NOT accessible via /v1/memory/{key} (that reads owner namespace!)
1702
+
1703
+ ╔══════════════════════════════════════════════════════════════════════════╗
1704
+ ║ Extension ctx.memory.get(key) ONLY reads from ext:{name} namespace. ║
1705
+ ║ Seed data (memory components), settings, translations live in the ║
1706
+ ║ OWNER's namespace — use ctx.memory.getPublic(ctx.caller.gaii, key). ║
1707
+ ║ ║
1708
+ ║ From OUTSIDE (cortex, app, tests): ║
1709
+ ║ - Read extension data: getPublic('ext:{name}', key) or readExtMemory ║
1710
+ ║ - Read owner data: /v1/memory/{key} or AIMEAT.data.get(key) ║
1711
+ ║ - Write extension data: call an extension ACTION (callExt) ║
1712
+ ║ - You CANNOT PUT to ext:{name} namespace from client — returns 404 ║
1713
+ ╚══════════════════════════════════════════════════════════════════════════╝
1714
+
1715
+ ### Init Action
1716
+ Extensions should initialize runtime data (empty watchlists, caches, logs) in their @activate init action.
1717
+ Do NOT copy translations or settings — cortex reads those from the owner namespace directly.
1718
+ `.trim();
1719
+
1720
+ /**
1721
+ * SANDBOX_CONSTRAINTS — V8 sandbox rules for extension code.
1722
+ * Used by: extension template, test prompt, fix prompt
1723
+ */
1724
+ export const SANDBOX_CONSTRAINTS = `
1725
+ ## V8 Sandbox Environment
1726
+
1727
+ ╔══════════════════════════════════════════════════════════════════════════╗
1728
+ ║ This is a BARE V8 JavaScript engine — NOT Node.js, NOT a browser. ║
1729
+ ║ Only ECMAScript built-in objects and the ctx API exist. ║
1730
+ ║ The ONLY way to interact with the outside world is through ctx. ║
1731
+ ╚══════════════════════════════════════════════════════════════════════════╝
1732
+
1733
+ ### What IS available (ECMAScript built-ins):
1734
+ JSON, Math, Date, RegExp, Promise, async/await, String, Array, Object,
1735
+ Map, Set, WeakMap, WeakSet, Symbol, Proxy, Reflect,
1736
+ encodeURIComponent, decodeURIComponent, parseInt, parseFloat, isNaN, isFinite
1737
+
1738
+ ### What is NOT available:
1739
+
1740
+ **Node.js APIs** — no require, no import, no Buffer, no process, no fs, no path, no crypto
1741
+ **Web APIs** — no URLSearchParams, no URL, no TextEncoder, no TextDecoder,
1742
+ no Headers, no Request, no Response, no FormData, no Blob, no File,
1743
+ no AbortController, no atob, no btoa, no structuredClone, no crypto (Web Crypto),
1744
+ no queueMicrotask, no performance
1745
+ **Browser APIs** — no document, no window, no fetch (use ctx.fetch), no navigator
1746
+ **Timers** — no setTimeout, no setInterval, no setImmediate
1747
+ **Console** — no console.log (use ctx.log.info/warn/error)
1748
+ **Modules** — no require(), no import (except export default for action entry point)
1749
+
1750
+ ### URL construction (URLSearchParams is NOT available):
1751
+ \`\`\`
1752
+ WRONG: const params = new URLSearchParams(); params.set('name', query);
1753
+ WRONG: const url = new URL(baseUrl); url.searchParams.set('name', query);
1754
+ RIGHT: const url = baseUrl + '?name=' + encodeURIComponent(query);
1755
+ RIGHT: const url = baseUrl + '?name=' + encodeURIComponent(query) + '&id=' + encodeURIComponent(id);
1756
+ \`\`\`
1757
+
1758
+ ### The ctx API — ONLY these properties exist:
1759
+
1760
+ ╔══════════════════════════════════════════════════════════════════════════╗
1761
+ ║ ctx.memory (get/set/search/delete/getPublic) ║
1762
+ ║ ctx.fetch(url, opts) → { ok, status, text, headers } ║
1763
+ ║ ctx.wallet (consume/getBalance) ║
1764
+ ║ ctx.consent (check/require) ║
1765
+ ║ ctx.trust (getScore) ║
1766
+ ║ ctx.caller (gaii/owner/roles) ║
1767
+ ║ ctx.config (extension config object) ║
1768
+ ║ ctx.log (info/warn/error) ║
1769
+ ║ ctx.notify(message, {title?, priority?, channel?}) → boolean ║
1770
+ ║ ctx.email(to, subject, body) → boolean (requires SMTP configured) ║
1771
+ ║ ctx.instance (id/config — only for instance-scoped actions) ║
1772
+ ║ NOTHING ELSE. Do NOT invent methods that are not listed here. ║
1773
+ ╚══════════════════════════════════════════════════════════════════════════╝
1774
+
1775
+ ### Actions are INDEPENDENT — CANNOT call each other
1776
+
1777
+ ╔══════════════════════════════════════════════════════════════════════════╗
1778
+ ║ Each action is a SEPARATE function. Actions CANNOT call each other. ║
1779
+ ║ There is NO ctx.otherAction() or ctx.callAction() method. ║
1780
+ ║ Writing ctx.getCompany() or ctx.searchItems() will CRASH with: ║
1781
+ ║ "ctx.getCompany is not a function" ║
1782
+ ║ ║
1783
+ ║ If multiple actions need the same logic, define a HELPER FUNCTION ║
1784
+ ║ above the action exports and duplicate it in each script file. ║
1785
+ ╚══════════════════════════════════════════════════════════════════════════╝
1786
+
1787
+ ### ctx.memory.get — returns PARSED value, NOT string
1788
+
1789
+ ╔══════════════════════════════════════════════════════════════════════════╗
1790
+ ║ NEVER WRITE: JSON.parse(await ctx.memory.get(...)) ║
1791
+ ║ The value is ALREADY PARSED. JSON.parse on it will CRASH. ║
1792
+ ║ CORRECT: const data = await ctx.memory.get("key") || []; ║
1793
+ ╚══════════════════════════════════════════════════════════════════════════╝
1794
+
1795
+ ### ctx.fetch — returns { ok, status, text, headers }
1796
+ - text is a RAW string — parse JSON with JSON.parse(resp.text)
1797
+ - Encoding auto-detected (Content-Type, XML prolog, HTML meta)
1798
+ - You always get Unicode text — no manual decoding needed
1799
+ `.trim();
1800
+
1801
+ /**
1802
+ * EXTENSION_CONSUMPTION_RULES — How to call/read extensions from outside.
1803
+ * Used by: cortex template, test prompt, fix prompt
1804
+ */
1805
+ export const EXTENSION_CONSUMPTION_RULES = `
1806
+ ## How to Consume Extensions (callExt / readExtMemory pattern)
1807
+
1808
+ Extensions expose TWO interfaces to the outside world:
1809
+
1810
+ ### 1. Call actions via HTTP POST
1811
+ POST /v1/ext/{extensionName}/{actionId}
1812
+ Body: JSON input
1813
+ Response: { ok: true, data: { ...action return value... } }
1814
+
1815
+ - ALL actions use POST (even if manifest says GET — the route is POST-only)
1816
+ - The {actionId} is the action's "id" field from the YAML manifest
1817
+ - r.body.ok is the AIMEAT envelope — ALWAYS true even when the action fails
1818
+ - Check r.body.data for the ACTUAL result (success data OR error message)
1819
+
1820
+ ### 2. Read extension memory via getPublic
1821
+ Extension data lives in ext:{name} namespace.
1822
+ Read it: getPublic('ext:{name}', key) or readExtMemory(name, key)
1823
+
1824
+ NEVER read extension data via /v1/memory/{key} — that reads the OWNER's
1825
+ namespace, not the extension's. You'll get null.
1826
+
1827
+ ### Testing extensions — use callExt and readExtMemory
1828
+ The test sandbox provides callExt() and readExtMemory() — the SAME helpers
1829
+ that cortex uses in production. Use these instead of raw testFetch:
1830
+
1831
+ callExt('ext-name', 'actionId', { input }) → action's return value (unwrapped)
1832
+ readExtMemory('ext-name', 'key') → value from ext:{name} namespace
1833
+
1834
+ DO NOT use testFetch for extension actions — use callExt.
1835
+ DO NOT use /v1/memory/ to read extension data — use readExtMemory.
1836
+ DO NOT create custom getMemory/setMemory helpers.
1837
+
1838
+ ### Action types for testing
1839
+ - [MEMORY] actions: use ONLY ctx.memory (no external API). Tests MUST assert specific return values.
1840
+ - [EXTERNAL API] actions: call ctx.fetch to third-party URLs. Tests check response SHAPE only
1841
+ (has data fields OR error message), because the external API may be down/rate-limited.
1842
+ Graceful error handling is correct behavior — only FAIL on HTTP 500 (extension crashed).
1843
+ `.trim();
1844
+
1845
+ /**
1846
+ * INIT_CONTRACT — Extension @activate and cortex init() rules.
1847
+ * Used by: extension template, cortex template, test prompt
1848
+ */
1849
+ export const INIT_CONTRACT = `
1850
+ ## Init Contracts
1851
+
1852
+ ### Extension @activate init
1853
+ - Runs on activation AND every server restart
1854
+ - MUST be idempotent (check existing data before overwriting)
1855
+ - Initialize extension-owned runtime data (watchlists, caches, logs) if not present
1856
+ - Should check if data exists and is fresh — skip if already populated
1857
+ - Do NOT copy translations or settings — cortex reads those from owner namespace directly
1858
+ - Pattern: check existing data → initialize missing runtime keys → return status
1859
+
1860
+ ### Cortex init()
1861
+ - UI readiness check ONLY — NEVER triggers backend logic
1862
+ - MUST return { ready: true/false, hasData: true/false }
1863
+ - NEVER call callExt() from init() — the extension scheduler handles background work
1864
+ - NEVER set up timers or intervals
1865
+ - Apps show empty state when hasData === false
1866
+ - init() runs BEFORE any other method — app waits for it
1867
+ `.trim();
1868
+
1869
+ /**
1870
+ * HTML_ENTITY_RULES — Prevent HTML entities in generated code.
1871
+ * Used by: extension template, app template, fix prompt, edit prompt
1872
+ */
1873
+ export const HTML_ENTITY_RULES = `
1874
+ ## No HTML Entities in Code
1875
+
1876
+ ╔════════════════════════════════════════════════════════════════════╗
1877
+ ║ Your code MUST use real operators, NOT HTML entities. ║
1878
+ ║ The V8 sandbox executes raw JS — HTML entities are syntax errors. ║
1879
+ ╚════════════════════════════════════════════════════════════════════╝
1880
+
1881
+ WRONG (crashes): const gt = a =&gt; a &gt; 0 &amp;&amp; b;
1882
+ CORRECT: const gt = a => a > 0 && b;
1883
+
1884
+ Check your ENTIRE output. If you see &gt; &lt; &amp; &quot; &#39; anywhere
1885
+ in code, replace them with > < & " ' respectively.
1886
+ `.trim();