aimeat 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (507) hide show
  1. package/dist/.env.example +58 -1
  2. package/dist/build-stamp.json +4 -4
  3. package/dist/locales/en.json +41 -1
  4. package/dist/locales/es.json +41 -1
  5. package/dist/locales/fi.json +43 -3
  6. package/dist/public/changelog.json +12 -0
  7. package/dist/public/css/views/chat.css +388 -0
  8. package/dist/public/js/services/chat.js +190 -0
  9. package/dist/public/js/services/speech-reader.js +26 -0
  10. package/dist/public/lib/VENDORED.md +1 -0
  11. package/dist/public/lib/duckdb-wasm@1.32.0/duckdb-browser-eh.worker.js +14 -0
  12. package/dist/public/lib/duckdb-wasm@1.32.0/duckdb-browser.js +23 -0
  13. package/dist/public/lib/duckdb-wasm@1.32.0/duckdb-eh.wasm +0 -0
  14. package/dist/public/lib/duckdb-wasm@1.32.0/extensions/v1.4.3/wasm_eh/parquet.duckdb_extension.wasm +0 -0
  15. package/dist/public/lib/vendored-assets.json +19 -0
  16. package/dist/public/llms-full-template.txt +2706 -0
  17. package/dist/public/llms-index-template.txt +60 -0
  18. package/dist/public/robots.node.txt +64 -23
  19. package/dist/public/spa.html +8 -1
  20. package/dist/public/views/chat/parts.js +257 -0
  21. package/dist/public/views/chat.js +327 -0
  22. package/dist/public/views/landing.js +24 -1
  23. package/dist/public/views/profile/agents/scope-model.js +320 -315
  24. package/dist/scripts/audit-mcp-schemas.js +41 -0
  25. package/dist/scripts/audit-mcp-schemas.js.map +1 -1
  26. package/dist/scripts/build-sdk-libs.d.ts.map +1 -1
  27. package/dist/scripts/build-sdk-libs.js +1 -0
  28. package/dist/scripts/build-sdk-libs.js.map +1 -1
  29. package/dist/scripts/check-ai-disclosure.js +11 -0
  30. package/dist/scripts/check-ai-disclosure.js.map +1 -1
  31. package/dist/scripts/check-denial-coverage.d.ts +29 -0
  32. package/dist/scripts/check-denial-coverage.d.ts.map +1 -0
  33. package/dist/scripts/check-denial-coverage.js +237 -0
  34. package/dist/scripts/check-denial-coverage.js.map +1 -0
  35. package/dist/scripts/check-ext-entrypoints.js +14 -2
  36. package/dist/scripts/check-ext-entrypoints.js.map +1 -1
  37. package/dist/scripts/check-outbound-fetch.d.ts.map +1 -1
  38. package/dist/scripts/check-outbound-fetch.js +16 -2
  39. package/dist/scripts/check-outbound-fetch.js.map +1 -1
  40. package/dist/scripts/check-sse-parity.js +14 -0
  41. package/dist/scripts/check-sse-parity.js.map +1 -1
  42. package/dist/scripts/indexnow.js +9 -7
  43. package/dist/scripts/indexnow.js.map +1 -1
  44. package/dist/src/auth/middleware.d.ts +7 -0
  45. package/dist/src/auth/middleware.d.ts.map +1 -1
  46. package/dist/src/auth/middleware.js +15 -21
  47. package/dist/src/auth/middleware.js.map +1 -1
  48. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts +4 -0
  49. package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
  50. package/dist/src/cli/connect/mcp/tools/agent-tasks.js +11 -1
  51. package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
  52. package/dist/src/cli/connect/mcp/tools/apps.d.ts.map +1 -1
  53. package/dist/src/cli/connect/mcp/tools/apps.js +88 -0
  54. package/dist/src/cli/connect/mcp/tools/apps.js.map +1 -1
  55. package/dist/src/cli/connect/mcp/tools/core.d.ts +7 -0
  56. package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
  57. package/dist/src/cli/connect/mcp/tools/core.js +83 -4
  58. package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
  59. package/dist/src/cli/connect/onboarding-prompt.js +1 -1
  60. package/dist/src/cli/connect/skill-bundle.js +1 -1
  61. package/dist/src/cli/connect/tool-call-defs-app-draft-edit.d.ts +21 -0
  62. package/dist/src/cli/connect/tool-call-defs-app-draft-edit.d.ts.map +1 -0
  63. package/dist/src/cli/connect/tool-call-defs-app-draft-edit.js +137 -0
  64. package/dist/src/cli/connect/tool-call-defs-app-draft-edit.js.map +1 -0
  65. package/dist/src/cli/connect/tool-call-defs-core.d.ts +1 -0
  66. package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
  67. package/dist/src/cli/connect/tool-call-defs-core.js +30 -0
  68. package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
  69. package/dist/src/cli/connect/tool-call.d.ts.map +1 -1
  70. package/dist/src/cli/connect/tool-call.js +2 -0
  71. package/dist/src/cli/connect/tool-call.js.map +1 -1
  72. package/dist/src/config-types-ai.d.ts +76 -0
  73. package/dist/src/config-types-ai.d.ts.map +1 -0
  74. package/dist/src/config-types-ai.js +15 -0
  75. package/dist/src/config-types-ai.js.map +1 -0
  76. package/dist/src/config-types.d.ts +11 -2
  77. package/dist/src/config-types.d.ts.map +1 -1
  78. package/dist/src/config.d.ts.map +1 -1
  79. package/dist/src/config.js +25 -4
  80. package/dist/src/config.js.map +1 -1
  81. package/dist/src/data/builtin-skills.d.ts.map +1 -1
  82. package/dist/src/data/builtin-skills.js +3 -2
  83. package/dist/src/data/builtin-skills.js.map +1 -1
  84. package/dist/src/data/digital-signage-package.js +1 -1
  85. package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
  86. package/dist/src/data/library-packs/sdk.js +76 -0
  87. package/dist/src/data/library-packs/sdk.js.map +1 -1
  88. package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
  89. package/dist/src/data/library-packs/vendored.js +81 -0
  90. package/dist/src/data/library-packs/vendored.js.map +1 -1
  91. package/dist/src/data/library-packs.d.ts +2 -2
  92. package/dist/src/data/library-packs.js +2 -2
  93. package/dist/src/data/public-pages.d.ts +13 -0
  94. package/dist/src/data/public-pages.d.ts.map +1 -1
  95. package/dist/src/data/public-pages.js +153 -113
  96. package/dist/src/data/public-pages.js.map +1 -1
  97. package/dist/src/generated/api-types.d.ts +1652 -36
  98. package/dist/src/generated/api-types.d.ts.map +1 -1
  99. package/dist/src/index-start.d.ts.map +1 -1
  100. package/dist/src/index-start.js +3 -0
  101. package/dist/src/index-start.js.map +1 -1
  102. package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
  103. package/dist/src/mcp/agent-tasks.js +5 -0
  104. package/dist/src/mcp/agent-tasks.js.map +1 -1
  105. package/dist/src/mcp/ai-image.d.ts +22 -0
  106. package/dist/src/mcp/ai-image.d.ts.map +1 -0
  107. package/dist/src/mcp/ai-image.js +60 -0
  108. package/dist/src/mcp/ai-image.js.map +1 -0
  109. package/dist/src/mcp/annotations.d.ts +5 -0
  110. package/dist/src/mcp/annotations.d.ts.map +1 -1
  111. package/dist/src/mcp/annotations.js +18 -0
  112. package/dist/src/mcp/annotations.js.map +1 -1
  113. package/dist/src/mcp/apps-draft-edit.d.ts +28 -0
  114. package/dist/src/mcp/apps-draft-edit.d.ts.map +1 -0
  115. package/dist/src/mcp/apps-draft-edit.js +164 -0
  116. package/dist/src/mcp/apps-draft-edit.js.map +1 -0
  117. package/dist/src/mcp/apps-screenshot.d.ts +26 -0
  118. package/dist/src/mcp/apps-screenshot.d.ts.map +1 -0
  119. package/dist/src/mcp/apps-screenshot.js +39 -0
  120. package/dist/src/mcp/apps-screenshot.js.map +1 -0
  121. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts +1 -0
  122. package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
  123. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +40 -0
  124. package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
  125. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.d.ts +3 -0
  126. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.d.ts.map +1 -1
  127. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +74 -0
  128. package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
  129. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
  130. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +1 -0
  131. package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
  132. package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
  133. package/dist/src/mcp/catalog/scopes.js +19 -1
  134. package/dist/src/mcp/catalog/scopes.js.map +1 -1
  135. package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
  136. package/dist/src/mcp/catalog/surfaces.js +18 -4
  137. package/dist/src/mcp/catalog/surfaces.js.map +1 -1
  138. package/dist/src/mcp/core-datapackage.d.ts +32 -0
  139. package/dist/src/mcp/core-datapackage.d.ts.map +1 -0
  140. package/dist/src/mcp/core-datapackage.js +188 -0
  141. package/dist/src/mcp/core-datapackage.js.map +1 -0
  142. package/dist/src/mcp/core-storage.d.ts +7 -3
  143. package/dist/src/mcp/core-storage.d.ts.map +1 -1
  144. package/dist/src/mcp/core-storage.js +27 -4
  145. package/dist/src/mcp/core-storage.js.map +1 -1
  146. package/dist/src/mcp/core.d.ts.map +1 -1
  147. package/dist/src/mcp/core.js +3 -0
  148. package/dist/src/mcp/core.js.map +1 -1
  149. package/dist/src/mcp/extensions.d.ts.map +1 -1
  150. package/dist/src/mcp/extensions.js +11 -1
  151. package/dist/src/mcp/extensions.js.map +1 -1
  152. package/dist/src/mcp/index.d.ts +9 -0
  153. package/dist/src/mcp/index.d.ts.map +1 -1
  154. package/dist/src/mcp/index.js +34 -0
  155. package/dist/src/mcp/index.js.map +1 -1
  156. package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
  157. package/dist/src/models/agent-task-schemas.js +12 -1
  158. package/dist/src/models/agent-task-schemas.js.map +1 -1
  159. package/dist/src/models/workflow-schemas.d.ts +178 -1
  160. package/dist/src/models/workflow-schemas.d.ts.map +1 -1
  161. package/dist/src/models/workflow-schemas.js +75 -0
  162. package/dist/src/models/workflow-schemas.js.map +1 -1
  163. package/dist/src/routes/admin-extensions.d.ts +4 -0
  164. package/dist/src/routes/admin-extensions.d.ts.map +1 -1
  165. package/dist/src/routes/admin-extensions.js +135 -142
  166. package/dist/src/routes/admin-extensions.js.map +1 -1
  167. package/dist/src/routes/agent-conventions.d.ts.map +1 -1
  168. package/dist/src/routes/agent-conventions.js +4 -2
  169. package/dist/src/routes/agent-conventions.js.map +1 -1
  170. package/dist/src/routes/agent-docs.d.ts +4 -4
  171. package/dist/src/routes/agent-docs.js +145 -145
  172. package/dist/src/routes/agent-docs.js.map +1 -1
  173. package/dist/src/routes/agent-messages.d.ts +6 -0
  174. package/dist/src/routes/agent-messages.d.ts.map +1 -1
  175. package/dist/src/routes/agent-messages.js +23 -1
  176. package/dist/src/routes/agent-messages.js.map +1 -1
  177. package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
  178. package/dist/src/routes/agent-tasks/create-read.js +8 -1
  179. package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
  180. package/dist/src/routes/agent-tasks/lifecycle.d.ts +4 -1
  181. package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
  182. package/dist/src/routes/agent-tasks/lifecycle.js +80 -2
  183. package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
  184. package/dist/src/routes/ai.d.ts +5 -0
  185. package/dist/src/routes/ai.d.ts.map +1 -1
  186. package/dist/src/routes/ai.js +51 -1
  187. package/dist/src/routes/ai.js.map +1 -1
  188. package/dist/src/routes/app-grants.d.ts.map +1 -1
  189. package/dist/src/routes/app-grants.js +5 -0
  190. package/dist/src/routes/app-grants.js.map +1 -1
  191. package/dist/src/routes/apps/drafts.d.ts +6 -0
  192. package/dist/src/routes/apps/drafts.d.ts.map +1 -1
  193. package/dist/src/routes/apps/drafts.js +133 -1
  194. package/dist/src/routes/apps/drafts.js.map +1 -1
  195. package/dist/src/routes/apps/read.d.ts.map +1 -1
  196. package/dist/src/routes/apps/read.js +38 -1
  197. package/dist/src/routes/apps/read.js.map +1 -1
  198. package/dist/src/routes/auth-otk.d.ts +28 -0
  199. package/dist/src/routes/auth-otk.d.ts.map +1 -0
  200. package/dist/src/routes/auth-otk.js +190 -0
  201. package/dist/src/routes/auth-otk.js.map +1 -0
  202. package/dist/src/routes/auth.d.ts +17 -0
  203. package/dist/src/routes/auth.d.ts.map +1 -1
  204. package/dist/src/routes/auth.js +44 -153
  205. package/dist/src/routes/auth.js.map +1 -1
  206. package/dist/src/routes/bootstrap.d.ts +6 -0
  207. package/dist/src/routes/bootstrap.d.ts.map +1 -1
  208. package/dist/src/routes/bootstrap.js +47 -20
  209. package/dist/src/routes/bootstrap.js.map +1 -1
  210. package/dist/src/routes/chat.d.ts +23 -0
  211. package/dist/src/routes/chat.d.ts.map +1 -0
  212. package/dist/src/routes/chat.js +165 -0
  213. package/dist/src/routes/chat.js.map +1 -0
  214. package/dist/src/routes/commerce.js +4 -4
  215. package/dist/src/routes/commerce.js.map +1 -1
  216. package/dist/src/routes/datapackages.d.ts +35 -0
  217. package/dist/src/routes/datapackages.d.ts.map +1 -0
  218. package/dist/src/routes/datapackages.js +217 -0
  219. package/dist/src/routes/datapackages.js.map +1 -0
  220. package/dist/src/routes/disputes.d.ts +8 -0
  221. package/dist/src/routes/disputes.d.ts.map +1 -1
  222. package/dist/src/routes/disputes.js +52 -1
  223. package/dist/src/routes/disputes.js.map +1 -1
  224. package/dist/src/routes/ecosystem-apps-advisories.d.ts +16 -0
  225. package/dist/src/routes/ecosystem-apps-advisories.d.ts.map +1 -0
  226. package/dist/src/routes/ecosystem-apps-advisories.js +104 -0
  227. package/dist/src/routes/ecosystem-apps-advisories.js.map +1 -0
  228. package/dist/src/routes/ecosystem-apps.d.ts +6 -0
  229. package/dist/src/routes/ecosystem-apps.d.ts.map +1 -1
  230. package/dist/src/routes/ecosystem-apps.js +31 -99
  231. package/dist/src/routes/ecosystem-apps.js.map +1 -1
  232. package/dist/src/routes/extensions/actions.d.ts.map +1 -1
  233. package/dist/src/routes/extensions/actions.js +29 -1
  234. package/dist/src/routes/extensions/actions.js.map +1 -1
  235. package/dist/src/routes/federation-sync/routing.d.ts.map +1 -1
  236. package/dist/src/routes/federation-sync/routing.js +12 -3
  237. package/dist/src/routes/federation-sync/routing.js.map +1 -1
  238. package/dist/src/routes/glossary.js +1 -1
  239. package/dist/src/routes/glossary.js.map +1 -1
  240. package/dist/src/routes/home/track.d.ts +5 -1
  241. package/dist/src/routes/home/track.d.ts.map +1 -1
  242. package/dist/src/routes/home/track.js +20 -6
  243. package/dist/src/routes/home/track.js.map +1 -1
  244. package/dist/src/routes/instances/install.d.ts +3 -0
  245. package/dist/src/routes/instances/install.d.ts.map +1 -1
  246. package/dist/src/routes/instances/install.js +17 -24
  247. package/dist/src/routes/instances/install.js.map +1 -1
  248. package/dist/src/routes/libs.js +1 -1
  249. package/dist/src/routes/libs.js.map +1 -1
  250. package/dist/src/routes/markdown-mirrors.js +1 -1
  251. package/dist/src/routes/markdown-mirrors.js.map +1 -1
  252. package/dist/src/routes/odata.d.ts +36 -0
  253. package/dist/src/routes/odata.d.ts.map +1 -0
  254. package/dist/src/routes/odata.js +143 -0
  255. package/dist/src/routes/odata.js.map +1 -0
  256. package/dist/src/routes/openrouter.d.ts +4 -0
  257. package/dist/src/routes/openrouter.d.ts.map +1 -1
  258. package/dist/src/routes/openrouter.js +10 -1
  259. package/dist/src/routes/openrouter.js.map +1 -1
  260. package/dist/src/routes/organisms/gates.d.ts.map +1 -1
  261. package/dist/src/routes/organisms/gates.js +9 -2
  262. package/dist/src/routes/organisms/gates.js.map +1 -1
  263. package/dist/src/routes/portal.d.ts +1 -0
  264. package/dist/src/routes/portal.d.ts.map +1 -1
  265. package/dist/src/routes/portal.js +13 -0
  266. package/dist/src/routes/portal.js.map +1 -1
  267. package/dist/src/routes/schedules.d.ts +4 -0
  268. package/dist/src/routes/schedules.d.ts.map +1 -1
  269. package/dist/src/routes/schedules.js +9 -1
  270. package/dist/src/routes/schedules.js.map +1 -1
  271. package/dist/src/routes/storage-files.d.ts +23 -0
  272. package/dist/src/routes/storage-files.d.ts.map +1 -1
  273. package/dist/src/routes/storage-files.js +103 -82
  274. package/dist/src/routes/storage-files.js.map +1 -1
  275. package/dist/src/routes/workflows.d.ts.map +1 -1
  276. package/dist/src/routes/workflows.js +9 -1
  277. package/dist/src/routes/workflows.js.map +1 -1
  278. package/dist/src/server-bootstrap/routes-loader.d.ts +2 -0
  279. package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
  280. package/dist/src/server-bootstrap/routes-loader.js +20 -2
  281. package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
  282. package/dist/src/server-bootstrap/service-init.d.ts.map +1 -1
  283. package/dist/src/server-bootstrap/service-init.js +12 -7
  284. package/dist/src/server-bootstrap/service-init.js.map +1 -1
  285. package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
  286. package/dist/src/server-bootstrap/static-files.js +44 -10
  287. package/dist/src/server-bootstrap/static-files.js.map +1 -1
  288. package/dist/src/services/ai-allowance.d.ts +82 -0
  289. package/dist/src/services/ai-allowance.d.ts.map +1 -0
  290. package/dist/src/services/ai-allowance.js +117 -0
  291. package/dist/src/services/ai-allowance.js.map +1 -0
  292. package/dist/src/services/ai-completion.d.ts +26 -0
  293. package/dist/src/services/ai-completion.d.ts.map +1 -1
  294. package/dist/src/services/ai-completion.js +41 -13
  295. package/dist/src/services/ai-completion.js.map +1 -1
  296. package/dist/src/services/ai-image.d.ts +70 -0
  297. package/dist/src/services/ai-image.d.ts.map +1 -0
  298. package/dist/src/services/ai-image.js +104 -0
  299. package/dist/src/services/ai-image.js.map +1 -0
  300. package/dist/src/services/ai-model-defaults.d.ts +45 -0
  301. package/dist/src/services/ai-model-defaults.d.ts.map +1 -0
  302. package/dist/src/services/ai-model-defaults.js +42 -0
  303. package/dist/src/services/ai-model-defaults.js.map +1 -0
  304. package/dist/src/services/ai-tool-setup.d.ts +5 -1
  305. package/dist/src/services/ai-tool-setup.d.ts.map +1 -1
  306. package/dist/src/services/ai-tool-setup.js +36 -0
  307. package/dist/src/services/ai-tool-setup.js.map +1 -1
  308. package/dist/src/services/ai-transcription.d.ts +5 -0
  309. package/dist/src/services/ai-transcription.d.ts.map +1 -1
  310. package/dist/src/services/ai-transcription.js +5 -2
  311. package/dist/src/services/ai-transcription.js.map +1 -1
  312. package/dist/src/services/app-agent-surfaces.js +4 -4
  313. package/dist/src/services/app-agent-surfaces.js.map +1 -1
  314. package/dist/src/services/app-draft-edit.d.ts +144 -0
  315. package/dist/src/services/app-draft-edit.d.ts.map +1 -0
  316. package/dist/src/services/app-draft-edit.js +203 -0
  317. package/dist/src/services/app-draft-edit.js.map +1 -0
  318. package/dist/src/services/auth-md.js +2 -2
  319. package/dist/src/services/auth-md.js.map +1 -1
  320. package/dist/src/services/board-write.d.ts +11 -3
  321. package/dist/src/services/board-write.d.ts.map +1 -1
  322. package/dist/src/services/board-write.js +24 -3
  323. package/dist/src/services/board-write.js.map +1 -1
  324. package/dist/src/services/chat-agent.d.ts +36 -0
  325. package/dist/src/services/chat-agent.d.ts.map +1 -0
  326. package/dist/src/services/chat-agent.js +123 -0
  327. package/dist/src/services/chat-agent.js.map +1 -0
  328. package/dist/src/services/chat-session.d.ts +58 -0
  329. package/dist/src/services/chat-session.d.ts.map +1 -0
  330. package/dist/src/services/chat-session.js +151 -0
  331. package/dist/src/services/chat-session.js.map +1 -0
  332. package/dist/src/services/chat-threads.d.ts +61 -0
  333. package/dist/src/services/chat-threads.d.ts.map +1 -0
  334. package/dist/src/services/chat-threads.js +137 -0
  335. package/dist/src/services/chat-threads.js.map +1 -0
  336. package/dist/src/services/config-schema.d.ts.map +1 -1
  337. package/dist/src/services/config-schema.js +2 -1
  338. package/dist/src/services/config-schema.js.map +1 -1
  339. package/dist/src/services/datapackage/contract.d.ts +198 -0
  340. package/dist/src/services/datapackage/contract.d.ts.map +1 -0
  341. package/dist/src/services/datapackage/contract.js +140 -0
  342. package/dist/src/services/datapackage/contract.js.map +1 -0
  343. package/dist/src/services/datapackage/ext-capability.d.ts +85 -0
  344. package/dist/src/services/datapackage/ext-capability.d.ts.map +1 -0
  345. package/dist/src/services/datapackage/ext-capability.js +72 -0
  346. package/dist/src/services/datapackage/ext-capability.js.map +1 -0
  347. package/dist/src/services/datapackage/odata.d.ts +92 -0
  348. package/dist/src/services/datapackage/odata.d.ts.map +1 -0
  349. package/dist/src/services/datapackage/odata.js +256 -0
  350. package/dist/src/services/datapackage/odata.js.map +1 -0
  351. package/dist/src/services/datapackage/odps.d.ts +24 -0
  352. package/dist/src/services/datapackage/odps.d.ts.map +1 -0
  353. package/dist/src/services/datapackage/odps.js +183 -0
  354. package/dist/src/services/datapackage/odps.js.map +1 -0
  355. package/dist/src/services/datapackage/store.d.ts +143 -0
  356. package/dist/src/services/datapackage/store.d.ts.map +1 -0
  357. package/dist/src/services/datapackage/store.js +533 -0
  358. package/dist/src/services/datapackage/store.js.map +1 -0
  359. package/dist/src/services/datapackage/table.d.ts +67 -0
  360. package/dist/src/services/datapackage/table.d.ts.map +1 -0
  361. package/dist/src/services/datapackage/table.js +0 -0
  362. package/dist/src/services/datapackage/table.js.map +1 -0
  363. package/dist/src/services/extension-ctx.d.ts +1 -0
  364. package/dist/src/services/extension-ctx.d.ts.map +1 -1
  365. package/dist/src/services/extension-ctx.js +31 -6
  366. package/dist/src/services/extension-ctx.js.map +1 -1
  367. package/dist/src/services/extension-files.d.ts +20 -0
  368. package/dist/src/services/extension-files.d.ts.map +1 -1
  369. package/dist/src/services/extension-files.js +9 -2
  370. package/dist/src/services/extension-files.js.map +1 -1
  371. package/dist/src/services/extension-lifecycle.d.ts +3 -0
  372. package/dist/src/services/extension-lifecycle.d.ts.map +1 -1
  373. package/dist/src/services/extension-lifecycle.js +2 -26
  374. package/dist/src/services/extension-lifecycle.js.map +1 -1
  375. package/dist/src/services/extension-runtime.d.ts +28 -2
  376. package/dist/src/services/extension-runtime.d.ts.map +1 -1
  377. package/dist/src/services/extension-runtime.js +22 -0
  378. package/dist/src/services/extension-runtime.js.map +1 -1
  379. package/dist/src/services/extension-schedules.d.ts +90 -0
  380. package/dist/src/services/extension-schedules.d.ts.map +1 -0
  381. package/dist/src/services/extension-schedules.js +123 -0
  382. package/dist/src/services/extension-schedules.js.map +1 -0
  383. package/dist/src/services/extension-system-run.d.ts +91 -0
  384. package/dist/src/services/extension-system-run.d.ts.map +1 -0
  385. package/dist/src/services/extension-system-run.js +100 -0
  386. package/dist/src/services/extension-system-run.js.map +1 -0
  387. package/dist/src/services/extension-upsert.d.ts +2 -0
  388. package/dist/src/services/extension-upsert.d.ts.map +1 -1
  389. package/dist/src/services/extension-upsert.js +6 -24
  390. package/dist/src/services/extension-upsert.js.map +1 -1
  391. package/dist/src/services/goose-acp.d.ts +84 -0
  392. package/dist/src/services/goose-acp.d.ts.map +1 -0
  393. package/dist/src/services/goose-acp.js +304 -0
  394. package/dist/src/services/goose-acp.js.map +1 -0
  395. package/dist/src/services/markdown-negotiation.js +1 -1
  396. package/dist/src/services/markdown-negotiation.js.map +1 -1
  397. package/dist/src/services/openrouter.d.ts +20 -1
  398. package/dist/src/services/openrouter.d.ts.map +1 -1
  399. package/dist/src/services/openrouter.js +66 -0
  400. package/dist/src/services/openrouter.js.map +1 -1
  401. package/dist/src/services/prompt-defaults/tiers-core.js +4 -4
  402. package/dist/src/services/scheduler-extension-job.d.ts +29 -6
  403. package/dist/src/services/scheduler-extension-job.d.ts.map +1 -1
  404. package/dist/src/services/scheduler-extension-job.js +29 -75
  405. package/dist/src/services/scheduler-extension-job.js.map +1 -1
  406. package/dist/src/services/scope-vocabulary-migration.d.ts +34 -1
  407. package/dist/src/services/scope-vocabulary-migration.d.ts.map +1 -1
  408. package/dist/src/services/scope-vocabulary-migration.js +60 -0
  409. package/dist/src/services/scope-vocabulary-migration.js.map +1 -1
  410. package/dist/src/services/screenshot-capture.d.ts +40 -1
  411. package/dist/src/services/screenshot-capture.d.ts.map +1 -1
  412. package/dist/src/services/screenshot-capture.js +142 -60
  413. package/dist/src/services/screenshot-capture.js.map +1 -1
  414. package/dist/src/services/skill-bundle/generator.js +1 -1
  415. package/dist/src/services/skill-bundle/generic-adapter.js +1 -1
  416. package/dist/src/services/skill-bundle/hermes-adapter.js +1 -1
  417. package/dist/src/services/storage-file-write.d.ts +36 -1
  418. package/dist/src/services/storage-file-write.d.ts.map +1 -1
  419. package/dist/src/services/storage-file-write.js +49 -3
  420. package/dist/src/services/storage-file-write.js.map +1 -1
  421. package/dist/src/services/task-outcome.d.ts +53 -0
  422. package/dist/src/services/task-outcome.d.ts.map +1 -0
  423. package/dist/src/services/task-outcome.js +28 -0
  424. package/dist/src/services/task-outcome.js.map +1 -0
  425. package/dist/src/services/workflow/engine-human.d.ts +15 -0
  426. package/dist/src/services/workflow/engine-human.d.ts.map +1 -1
  427. package/dist/src/services/workflow/engine-human.js +10 -1
  428. package/dist/src/services/workflow/engine-human.js.map +1 -1
  429. package/dist/src/services/workflow/engine-steps.d.ts +48 -3
  430. package/dist/src/services/workflow/engine-steps.d.ts.map +1 -1
  431. package/dist/src/services/workflow/engine-steps.js +361 -0
  432. package/dist/src/services/workflow/engine-steps.js.map +1 -1
  433. package/dist/src/services/workflow/engine.d.ts +1 -0
  434. package/dist/src/services/workflow/engine.d.ts.map +1 -1
  435. package/dist/src/services/workflow/engine.js +2 -1
  436. package/dist/src/services/workflow/engine.js.map +1 -1
  437. package/dist/src/services/workflow/store.d.ts.map +1 -1
  438. package/dist/src/services/workflow/store.js +60 -4
  439. package/dist/src/services/workflow/store.js.map +1 -1
  440. package/dist/src/services/write-guards.d.ts +27 -1
  441. package/dist/src/services/write-guards.d.ts.map +1 -1
  442. package/dist/src/services/write-guards.js +39 -9
  443. package/dist/src/services/write-guards.js.map +1 -1
  444. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts +1 -0
  445. package/dist/src/storage/providers/postgres-kysely/db-types.d.ts.map +1 -1
  446. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +1 -0
  447. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
  448. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +3 -0
  449. package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
  450. package/dist/src/storage/providers/postgres-kysely/methods/files.d.ts +2 -0
  451. package/dist/src/storage/providers/postgres-kysely/methods/files.d.ts.map +1 -1
  452. package/dist/src/storage/providers/postgres-kysely/methods/files.js +34 -2
  453. package/dist/src/storage/providers/postgres-kysely/methods/files.js.map +1 -1
  454. package/dist/src/storage/providers/postgres-kysely/migrations/0039_storage_file_utf8_verified.sql +19 -0
  455. package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -1
  456. package/dist/src/storage/providers/sqlite/index.js +2 -1
  457. package/dist/src/storage/providers/sqlite/index.js.map +1 -1
  458. package/dist/src/storage/providers/sqlite/methods/apps.d.ts +1 -0
  459. package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
  460. package/dist/src/storage/providers/sqlite/methods/apps.js +33 -28
  461. package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
  462. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts +1 -12
  463. package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
  464. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +28 -135
  465. package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
  466. package/dist/src/storage/providers/sqlite/methods/storage-files.d.ts +38 -0
  467. package/dist/src/storage/providers/sqlite/methods/storage-files.d.ts.map +1 -0
  468. package/dist/src/storage/providers/sqlite/methods/storage-files.js +109 -0
  469. package/dist/src/storage/providers/sqlite/methods/storage-files.js.map +1 -0
  470. package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
  471. package/dist/src/storage/providers/sqlite/schema.js +134 -130
  472. package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
  473. package/dist/src/storage/repositories/app-grant.repository.d.ts +11 -0
  474. package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
  475. package/dist/src/storage/repositories/file.repository.d.ts +13 -0
  476. package/dist/src/storage/repositories/file.repository.d.ts.map +1 -1
  477. package/dist/src/storage/types/commerce.d.ts +6 -0
  478. package/dist/src/storage/types/commerce.d.ts.map +1 -1
  479. package/dist/src/utils/agent-footer.d.ts.map +1 -1
  480. package/dist/src/utils/agent-footer.js +1 -0
  481. package/dist/src/utils/agent-footer.js.map +1 -1
  482. package/dist/src/utils/app-content-type.d.ts +57 -3
  483. package/dist/src/utils/app-content-type.d.ts.map +1 -1
  484. package/dist/src/utils/app-content-type.js +81 -12
  485. package/dist/src/utils/app-content-type.js.map +1 -1
  486. package/dist/src/utils/env-config/sections-features.d.ts.map +1 -1
  487. package/dist/src/utils/env-config/sections-features.js +9 -3
  488. package/dist/src/utils/env-config/sections-features.js.map +1 -1
  489. package/dist/src/utils/file-download-headers.d.ts +5 -3
  490. package/dist/src/utils/file-download-headers.d.ts.map +1 -1
  491. package/dist/src/utils/file-download-headers.js +18 -5
  492. package/dist/src/utils/file-download-headers.js.map +1 -1
  493. package/dist/src/utils/http-range.d.ts +151 -0
  494. package/dist/src/utils/http-range.d.ts.map +1 -0
  495. package/dist/src/utils/http-range.js +190 -0
  496. package/dist/src/utils/http-range.js.map +1 -0
  497. package/dist/src/utils/page-head.d.ts +5 -0
  498. package/dist/src/utils/page-head.d.ts.map +1 -1
  499. package/dist/src/utils/page-head.js +10 -1
  500. package/dist/src/utils/page-head.js.map +1 -1
  501. package/dist/src/utils/reserved-keys.d.ts +4 -1
  502. package/dist/src/utils/reserved-keys.d.ts.map +1 -1
  503. package/dist/src/utils/reserved-keys.js +4 -1
  504. package/dist/src/utils/reserved-keys.js.map +1 -1
  505. package/dist/static/sdk-libs/datapackage/index.js +336 -0
  506. package/dist/static/sdk-libs/dist/aimeat-datapackage.js +305 -0
  507. package/package.json +10 -2
@@ -0,0 +1,388 @@
1
+ /**
2
+ * @file chat.css
3
+ * @description Styles for the chat page: the conversation list, the turns, the work log under each
4
+ * one, and the composer. Two panes on a desktop, one at a time on a phone.
5
+ *
6
+ * The work log is styled to be read, not hidden. It is the evidence that what the agent said it
7
+ * did, it did, and folding it away by default would turn the page back into something a person has
8
+ * to take on trust. All colours and spacing come from theme.css so it flips with the theme.
9
+ *
10
+ * NOTE: this file must be linked in spa.html (useViewCSS is a no-op).
11
+ * @version-history
12
+ * v1.1.0 — 2026-08-16 — The recorder beside the send button, and the read-aloud control on a turn.
13
+ * v1.0.0 — 2026-08-16 — Initial.
14
+ */
15
+
16
+ /* ── Layout ── */
17
+ .chat-view {
18
+ display: grid;
19
+ grid-template-columns: 260px 1fr;
20
+ gap: 16px;
21
+ max-width: 1100px;
22
+ margin: 0 auto;
23
+ padding: 16px;
24
+ height: calc(100dvh - 120px);
25
+ /* Low enough that a short window (a laptop with a docked terminal, 1280x460) still puts the
26
+ composer on screen. A taller floor pushed it 70px below the fold, and the composer is the one
27
+ control the page exists for. */
28
+ min-height: 320px;
29
+ }
30
+
31
+ .chat-view--signin {
32
+ display: block;
33
+ height: auto;
34
+ }
35
+
36
+ /* ── The conversation list ── */
37
+ .chat-threads {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 10px;
41
+ min-height: 0;
42
+ overflow-y: auto;
43
+ padding-right: 4px;
44
+ }
45
+
46
+ .chat-new { width: 100%; }
47
+
48
+ /* The way back out of the list. Only a phone needs it: on a desktop the list and the conversation
49
+ are both on screen, so there is nothing to go back from. */
50
+ .chat-threads-close { display: none; }
51
+
52
+ .chat-threads-empty {
53
+ color: var(--text-muted);
54
+ font-size: 0.85rem;
55
+ line-height: 1.5;
56
+ margin: 0;
57
+ }
58
+
59
+ .chat-thread-list {
60
+ list-style: none;
61
+ margin: 0;
62
+ padding: 0;
63
+ display: flex;
64
+ flex-direction: column;
65
+ gap: 4px;
66
+ }
67
+
68
+ .chat-thread {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 4px;
72
+ border-radius: var(--radius-sm);
73
+ }
74
+
75
+ .chat-thread--active { background: var(--bg-surface); }
76
+
77
+ .chat-thread-open {
78
+ flex: 1 1 auto;
79
+ min-width: 0;
80
+ text-align: left;
81
+ background: none;
82
+ border: none;
83
+ cursor: pointer;
84
+ padding: 8px 10px;
85
+ display: flex;
86
+ flex-direction: column;
87
+ gap: 2px;
88
+ color: inherit;
89
+ font: inherit;
90
+ }
91
+
92
+ .chat-thread-title {
93
+ font-size: 0.9rem;
94
+ font-weight: 600;
95
+ white-space: nowrap;
96
+ overflow: hidden;
97
+ text-overflow: ellipsis;
98
+ }
99
+
100
+ .chat-thread-sub {
101
+ font-size: 0.75rem;
102
+ color: var(--text-muted);
103
+ }
104
+
105
+ .chat-thread-del {
106
+ flex: 0 0 auto;
107
+ padding: 4px 8px;
108
+ opacity: 0;
109
+ transition: opacity 0.15s;
110
+ }
111
+
112
+ .chat-thread:hover .chat-thread-del,
113
+ .chat-thread--active .chat-thread-del { opacity: 1; }
114
+
115
+ /* ── The conversation ── */
116
+ .chat-main {
117
+ display: flex;
118
+ flex-direction: column;
119
+ min-height: 0;
120
+ background: var(--bg-card);
121
+ border: 1px solid var(--border);
122
+ border-radius: var(--radius);
123
+ overflow: hidden;
124
+ }
125
+
126
+ .chat-head {
127
+ display: flex;
128
+ align-items: center;
129
+ gap: 10px;
130
+ padding: 12px 16px;
131
+ border-bottom: 1px solid var(--border-subtle);
132
+ }
133
+
134
+ .chat-title {
135
+ margin: 0;
136
+ font-size: 1rem;
137
+ font-weight: 600;
138
+ white-space: nowrap;
139
+ overflow: hidden;
140
+ text-overflow: ellipsis;
141
+ }
142
+
143
+ /* The list is always visible on a desktop, so its toggle would be a button that does nothing. */
144
+ .chat-list-toggle { display: none; }
145
+
146
+ .chat-status {
147
+ display: flex;
148
+ align-items: center;
149
+ gap: 12px;
150
+ flex-wrap: wrap;
151
+ padding: 6px 16px;
152
+ font-size: 0.75rem;
153
+ color: var(--text-muted);
154
+ border-bottom: 1px solid var(--border-subtle);
155
+ background: var(--bg-surface);
156
+ }
157
+
158
+ .chat-status-agent { font-family: var(--font-mono); }
159
+ .chat-status-reset { margin-left: auto; font-size: 0.75rem; padding: 2px 8px; }
160
+
161
+ .chat-scroll {
162
+ flex: 1 1 auto;
163
+ min-height: 0;
164
+ overflow-y: auto;
165
+ padding: 16px;
166
+ display: flex;
167
+ flex-direction: column;
168
+ gap: 14px;
169
+ }
170
+
171
+ .chat-welcome {
172
+ color: var(--text-muted);
173
+ max-width: 46ch;
174
+ margin: auto;
175
+ text-align: center;
176
+ }
177
+
178
+ .chat-welcome h2 {
179
+ font-size: 1.1rem;
180
+ margin: 0 0 6px;
181
+ color: var(--text-primary);
182
+ }
183
+
184
+ .chat-welcome p { margin: 0; line-height: 1.6; font-size: 0.9rem; }
185
+
186
+ /* ── One turn ── */
187
+ .chat-turn {
188
+ display: flex;
189
+ flex-direction: column;
190
+ gap: 3px;
191
+ max-width: 85%;
192
+ }
193
+
194
+ .chat-turn--user { align-self: flex-end; align-items: flex-end; }
195
+ .chat-turn--agent { align-self: flex-start; }
196
+
197
+ .chat-bubble {
198
+ padding: 10px 14px;
199
+ border-radius: var(--radius);
200
+ background: var(--bg-surface);
201
+ line-height: 1.6;
202
+ font-size: 0.92rem;
203
+ overflow-wrap: anywhere;
204
+ }
205
+
206
+ .chat-turn--user .chat-bubble {
207
+ background: var(--accent-subtle);
208
+ border: 1px solid var(--accent-border);
209
+ }
210
+
211
+ .chat-said { margin: 0; white-space: pre-wrap; }
212
+
213
+ .chat-thinking {
214
+ margin: 0;
215
+ color: var(--text-muted);
216
+ font-style: italic;
217
+ }
218
+
219
+ .chat-meta {
220
+ display: flex;
221
+ gap: 8px;
222
+ font-size: 0.7rem;
223
+ color: var(--text-muted);
224
+ padding: 0 4px;
225
+ }
226
+
227
+ .chat-model { font-family: var(--font-mono); }
228
+
229
+ /* ── The work log ── */
230
+ .chat-work {
231
+ margin-top: 10px;
232
+ border-top: 1px solid var(--border-subtle);
233
+ padding-top: 8px;
234
+ }
235
+
236
+ .chat-work-head {
237
+ font-size: 0.7rem;
238
+ text-transform: uppercase;
239
+ letter-spacing: 0.04em;
240
+ color: var(--text-muted);
241
+ margin-bottom: 4px;
242
+ }
243
+
244
+ .chat-work-list {
245
+ list-style: none;
246
+ margin: 0;
247
+ padding: 0;
248
+ display: flex;
249
+ flex-direction: column;
250
+ gap: 2px;
251
+ }
252
+
253
+ .chat-work-line {
254
+ display: flex;
255
+ gap: 8px;
256
+ align-items: baseline;
257
+ font-size: 0.78rem;
258
+ font-family: var(--font-mono);
259
+ }
260
+
261
+ .chat-work-status {
262
+ flex: 0 0 auto;
263
+ min-width: 68px;
264
+ color: var(--text-muted);
265
+ }
266
+
267
+ .chat-work-line--completed .chat-work-status { color: var(--success, var(--text-secondary)); }
268
+ .chat-work-line--failed .chat-work-status { color: var(--accent); }
269
+
270
+ .chat-work-title {
271
+ min-width: 0;
272
+ overflow-wrap: anywhere;
273
+ }
274
+
275
+ /* ── A turn that could not run ── */
276
+ .chat-error {
277
+ align-self: stretch;
278
+ border: 1px solid var(--accent-border);
279
+ background: var(--accent-subtle);
280
+ border-radius: var(--radius-sm);
281
+ padding: 10px 14px;
282
+ display: flex;
283
+ align-items: center;
284
+ gap: 12px;
285
+ flex-wrap: wrap;
286
+ }
287
+
288
+ .chat-error-msg {
289
+ margin: 0;
290
+ flex: 1 1 240px;
291
+ font-size: 0.85rem;
292
+ line-height: 1.5;
293
+ }
294
+
295
+ /* ── The composer ── */
296
+ .chat-composer {
297
+ border-top: 1px solid var(--border-subtle);
298
+ padding: 10px 16px;
299
+ background: var(--bg-card);
300
+ }
301
+
302
+ .chat-composer-note {
303
+ margin: 0 0 6px;
304
+ font-size: 0.78rem;
305
+ color: var(--text-muted);
306
+ line-height: 1.5;
307
+ }
308
+
309
+ .chat-composer-row {
310
+ display: flex;
311
+ gap: 8px;
312
+ align-items: flex-end;
313
+ }
314
+
315
+ .chat-input {
316
+ flex: 1 1 auto;
317
+ min-width: 0;
318
+ resize: none;
319
+ max-height: 200px;
320
+ padding: 10px 12px;
321
+ border: 1px solid var(--border);
322
+ border-radius: var(--radius-sm);
323
+ background: var(--bg-input);
324
+ color: inherit;
325
+ font: inherit;
326
+ font-size: 0.92rem;
327
+ line-height: 1.5;
328
+ }
329
+
330
+ .chat-input:focus {
331
+ outline: none;
332
+ border-color: var(--border-focus);
333
+ background: var(--bg-input-focus);
334
+ }
335
+
336
+ .chat-send { flex: 0 0 auto; }
337
+ .chat-voice { flex: 0 0 auto; }
338
+
339
+ /* The read-aloud control sits with the timestamp rather than on the bubble: it is about the turn,
340
+ not part of what was said. */
341
+ .chat-listen { font-size: 0.7rem; padding: 0 6px; }
342
+
343
+ /* ── Phones ──
344
+ One pane at a time. The page takes the whole viewport, the shell's sticky nav is hidden (it lives
345
+ in a higher stacking context, so a z-index here cannot cover it), and the composer sits on the
346
+ keyboard: --chat-avail is the measured visual-viewport height, with 100dvh as the fallback the
347
+ viewport meta's interactive-widget=resizes-content already provides. Same pattern as the inbox,
348
+ which is the surface this one is modelled on. */
349
+ @media (max-width: 760px) {
350
+ .chat-view {
351
+ position: fixed;
352
+ inset: 0;
353
+ z-index: 1000;
354
+ grid-template-columns: 1fr;
355
+ gap: 0;
356
+ padding: 0;
357
+ max-width: none;
358
+ height: var(--chat-avail, 100dvh);
359
+ background: var(--bg);
360
+ }
361
+
362
+ body:has(.chat-view) { overflow: hidden; }
363
+ body:has(.chat-view) .topnav { display: none; }
364
+
365
+ /* The list is a place you go to, not a column that would leave neither pane readable. */
366
+ .chat-threads { display: none; }
367
+ .chat-view--list .chat-threads {
368
+ display: flex;
369
+ padding: 12px;
370
+ background: var(--bg-card);
371
+ }
372
+ .chat-view--list .chat-main { display: none; }
373
+
374
+ .chat-list-toggle { display: inline-flex; }
375
+ .chat-threads-close { display: inline-flex; align-self: flex-start; }
376
+
377
+ .chat-main {
378
+ border: none;
379
+ border-radius: 0;
380
+ height: 100%;
381
+ }
382
+
383
+ .chat-turn { max-width: 92%; }
384
+ .chat-scroll { padding: 12px 10px; }
385
+ .chat-composer {
386
+ padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
387
+ }
388
+ }
@@ -0,0 +1,190 @@
1
+ /**
2
+ * @file chat.js
3
+ * @description Frontend service for the built-in chat agent: the conversations, and one turn read
4
+ * as it arrives.
5
+ *
6
+ * The turn is the reason this is not four `api()` calls. It is `text/event-stream` over a POST, so
7
+ * `EventSource` cannot open it — that only does GET, and the message has to go in a body. The
8
+ * stream is read with `fetch` and a reader, and the frames are parsed here rather than in the view,
9
+ * because a half-frame at a chunk boundary is a protocol detail and not something a component
10
+ * should know about.
11
+ * @structure
12
+ * status / listThreads / createThread / getThread / deleteThread / resetThread / streamTurn
13
+ * speakToText — a recording becomes text the person can read before they send it
14
+ * @usage
15
+ * import * as chat from '/js/services/chat.js';
16
+ * for await (const u of chat.streamTurn(threadId, 'build me pong')) { … }
17
+ * @version-history
18
+ * v1.1.0 — 2026-08-16 — speakToText: a spoken message goes through storage and comes back as text.
19
+ * v1.0.0 — 2026-08-16 — Initial.
20
+ */
21
+ import { api, apiGet } from '/js/api.js';
22
+ import { authHeaders, getNodeUrl } from '/js/services/auth.js';
23
+
24
+ const enc = encodeURIComponent;
25
+
26
+ /** Does this node have a chat agent, what is it called, and what is left to spend. */
27
+ export async function status() {
28
+ return apiGet('/v1/chat/status');
29
+ }
30
+
31
+ /** Open conversations, newest first, without their turns. */
32
+ export async function listThreads() {
33
+ return apiGet('/v1/chat/threads');
34
+ }
35
+
36
+ /** Start one. The title is a placeholder until the first message replaces it. */
37
+ export async function createThread(title) {
38
+ return api('/v1/chat/threads', { method: 'POST', body: JSON.stringify({ title }) });
39
+ }
40
+
41
+ /** One conversation with every turn it holds. */
42
+ export async function getThread(id) {
43
+ return apiGet(`/v1/chat/threads/${enc(id)}`);
44
+ }
45
+
46
+ export async function deleteThread(id) {
47
+ return api(`/v1/chat/threads/${enc(id)}`, { method: 'DELETE' });
48
+ }
49
+
50
+ /**
51
+ * Forget the agent session, keep the conversation.
52
+ *
53
+ * What this is for: the session's credential carries the scopes it was minted with, so changing the
54
+ * chat agent's permissions in the Agents tab reaches the chat only once the session is replaced.
55
+ */
56
+ export async function resetThread(id) {
57
+ return api(`/v1/chat/threads/${enc(id)}/reset`, { method: 'POST' });
58
+ }
59
+
60
+ /**
61
+ * Send one message and yield each update as it arrives.
62
+ *
63
+ * Yields the server's own events: `text` and `thought` as words are written, `tool_call` as each
64
+ * call starts and finishes, `done` at the end, and `error` when the turn could not run. A turn that
65
+ * ends without a verdict yields one `error` of its own rather than stopping silently, because a
66
+ * conversation that just stops is indistinguishable from one still thinking.
67
+ *
68
+ * `signal` aborts the read. The turn keeps running on the node; the connection is what closes.
69
+ */
70
+ export async function* streamTurn(id, text, signal) {
71
+ const res = await fetch(`${getNodeUrl()}/v1/chat/threads/${enc(id)}/turn`, {
72
+ method: 'POST',
73
+ headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream', ...authHeaders() },
74
+ body: JSON.stringify({ text }),
75
+ signal,
76
+ });
77
+
78
+ if (!res.ok) {
79
+ // A refusal arrives as ordinary JSON: the stream never opened, so there is nothing to read.
80
+ // A refusal that is not JSON leaves the status as the only fact there is, and the status is
81
+ // what the person is shown. Nothing is hidden by not parsing further.
82
+ const body = await res.json()
83
+ // eslint-disable-next-line aimeat/no-silent-catch -- the status below carries the reason
84
+ .catch(() => null);
85
+ yield { kind: 'error', message: body?.error?.message || `The node refused the message (${res.status}).` };
86
+ return;
87
+ }
88
+ if (!res.body) {
89
+ yield { kind: 'error', message: 'This browser cannot read a streamed answer.' };
90
+ return;
91
+ }
92
+
93
+ const reader = res.body.getReader();
94
+ const decoder = new TextDecoder();
95
+ let buffer = '';
96
+ let sawVerdict = false;
97
+
98
+ try {
99
+ for (;;) {
100
+ const { done, value } = await reader.read();
101
+ if (done) break;
102
+ buffer += decoder.decode(value, { stream: true });
103
+
104
+ // Frames are separated by a blank line. Anything after the last one is a partial frame
105
+ // and stays in the buffer until the rest of it arrives.
106
+ let cut;
107
+ while ((cut = buffer.indexOf('\n\n')) !== -1) {
108
+ const frame = buffer.slice(0, cut);
109
+ buffer = buffer.slice(cut + 2);
110
+ for (const line of frame.split('\n')) {
111
+ if (!line.startsWith('data:')) continue; // `:open` and `:keepalive` are comments
112
+ let update;
113
+ try {
114
+ update = JSON.parse(line.slice(5).trim());
115
+ } catch (err) {
116
+ // One malformed frame is not the turn failing. Say so once and keep reading;
117
+ // dropping the whole stream over a bad line would lose the answer as well.
118
+ console.warn('[chat] skipped an unreadable frame:', err.message);
119
+ continue;
120
+ }
121
+ if (update.kind === 'done' || update.kind === 'error') sawVerdict = true;
122
+ yield update;
123
+ }
124
+ }
125
+ }
126
+ } finally {
127
+ // eslint-disable-next-line aimeat/no-silent-catch -- cancelling a stream that already ended is the normal case
128
+ reader.cancel().catch(() => { /* the stream is already gone; nothing to recover */ });
129
+ }
130
+
131
+ if (!sawVerdict) {
132
+ yield { kind: 'error', message: 'The connection closed before the answer finished.' };
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Turn a recording into text.
138
+ *
139
+ * The clip goes to storage first and the node is handed a key, never the bytes: a minute of speech
140
+ * is megabytes, and base64 in a JSON body inflates it by a third before hitting a body limit that
141
+ * has nothing to do with the storage quota. The same path the inbox already uses for a voice
142
+ * message, for the same reason.
143
+ *
144
+ * The text comes back to the composer rather than being sent. A person should read what the machine
145
+ * heard before it becomes something they asked for.
146
+ */
147
+ export async function speakToText(file) {
148
+ const rand = Math.random().toString(36).slice(2, 8);
149
+ const key = `chat-voice/${Date.now()}-${rand}.${(file.type.split('/')[1] || 'webm').split(';')[0]}`;
150
+ const mime = file.type || 'application/octet-stream';
151
+
152
+ const mint = await api('/v1/storage', {
153
+ method: 'POST',
154
+ body: JSON.stringify({ key, mime_type: mime, visibility: 'private', mode: 'presigned' }),
155
+ });
156
+ const uploadUrl = mint?.data?.upload_url;
157
+ if (!uploadUrl) throw new Error(mint?.error?.message || 'The node would not accept the recording.');
158
+
159
+ // Checked before the token is spent: it is single-use, so an oversized PUT burns it and answers
160
+ // a bare 413 instead of naming the limit.
161
+ const maxBytes = Number(mint?.data?.max_size_bytes) || 0;
162
+ if (maxBytes && file.size > maxBytes) {
163
+ throw new Error(`That recording is ${(file.size / 1048576).toFixed(1)} MB; this node accepts ${(maxBytes / 1048576).toFixed(0)} MB.`);
164
+ }
165
+
166
+ // Plain fetch, deliberately not api(): the presigned token IS the capability, so no
167
+ // Authorization header, and a retry on a consumed one-shot token answers 409 TOKEN_USED.
168
+ const put = await fetch(uploadTarget(uploadUrl), { method: 'PUT', headers: { 'Content-Type': mime }, body: file });
169
+ if (!put.ok) throw new Error(`The recording could not be stored (${put.status}).`);
170
+
171
+ const res = await api('/v1/ai/transcribe', {
172
+ method: 'POST',
173
+ body: JSON.stringify({ storage_key: key, mime, app_id: 'chat' }),
174
+ timeoutMs: 180_000,
175
+ retries: 0,
176
+ });
177
+ if (res?.ok === false) throw new Error(res.error?.message || 'The recording could not be transcribed.');
178
+ return String(res?.data?.text ?? '').trim();
179
+ }
180
+
181
+ /** The node mints an absolute upload URL. Collapse it to a path on the same origin so the PUT stays
182
+ * a plain request rather than a preflighted one. */
183
+ function uploadTarget(url) {
184
+ try {
185
+ const u = new URL(url, window.location.origin);
186
+ return u.origin === window.location.origin ? u.pathname + u.search : u.href;
187
+ } catch {
188
+ return url; // an unparseable URL is used verbatim; the PUT above reports the failure
189
+ }
190
+ }
@@ -19,6 +19,9 @@
19
19
  * @usage import { speak, stop, subscribeSpeech } from '/js/services/speech-reader.js';
20
20
  * speak('msg-42', textToParagraphs(msg.body));
21
21
  * @version-history
22
+ * v1.1.0 — 2026-08-16 — primeSpeech(): one silent utterance inside a user gesture, so automatic
23
+ * read-aloud is not a no-op on iOS. It refuses without a gesture and refuses SILENTLY, which is
24
+ * the hardest kind of missing sound to chase.
22
25
  * v1.0.0 — 2026-07-31 — Initial version: extracted the Sanomat read-aloud pacing into a shared SPA
23
26
  * service so the Inbox thread (and any later view) can speak its content.
24
27
  */
@@ -212,6 +215,29 @@ function speakNext(lang, voice) {
212
215
  speechSynthesis.speak(utt);
213
216
  }
214
217
 
218
+ /**
219
+ * Wake the speech engine inside a user gesture.
220
+ *
221
+ * iOS refuses `speechSynthesis.speak()` unless the page has spoken at least once from a real tap,
222
+ * and it refuses SILENTLY: automatic read-aloud simply never makes a sound, with no error to find.
223
+ * Speaking one empty utterance in the same click that starts the work removes that, costs nothing
224
+ * audible, and is a no-op on every other platform.
225
+ */
226
+ let _primed = false;
227
+ export function primeSpeech() {
228
+ if (_primed || !isSpeechSupported()) return;
229
+ _primed = true;
230
+ try {
231
+ const utt = new SpeechSynthesisUtterance('');
232
+ utt.volume = 0;
233
+ speechSynthesis.speak(utt);
234
+ } catch (err) {
235
+ // A browser refusing here IS the answer: it will refuse the real utterance too, and there is
236
+ // nothing to recover. Said out loud so a silent reader has a trace to find.
237
+ console.warn('[speech] the engine refused to prime:', err.message);
238
+ }
239
+ }
240
+
215
241
  /** Start reading `paragraphs` under `id`. Any reading already in progress is cancelled first — one
216
242
  * reader at a time. Returns false when there is nothing speakable (or no speech support). */
217
243
  export function speak(id, paragraphs, opts) {
@@ -27,6 +27,7 @@ with per-lib AI docs + changelogs) — keep this table and the registry in sync.
27
27
  | `toastui/toastui-editor-all.min.js` + `.min.css` | TOAST UI Editor | (SPA-internal) | — | `https://uicdn.toast.com` | MIT |
28
28
  | `pdfjs@6/pdf.min.mjs` + `pdf.worker.min.mjs` | `pdfjs-dist` (ESM + worker) | 6.1.200 | `pdfjs` | `https://cdn.jsdelivr.net/npm/pdfjs-dist@6.1.200/build/` | Apache-2.0 |
29
29
  | `ffmpeg-core@0.12.6/ffmpeg-core.js` + `.umd.js` + `ffmpeg-core.wasm` | `@ffmpeg/core` (ffmpeg 5.1.4, single-threaded) | 0.12.6 | `ffmpeg-core` | `https://unpkg.com/@ffmpeg/core@0.12.6/dist/esm/` (UMD loader from `dist/umd/`) | GPL-2.0-or-later (the compiled ffmpeg: `--enable-gpl --enable-libx264 --enable-libx265`; the npm `license: MIT` covers only the packaging) |
30
+ | `duckdb-wasm@1.32.0/duckdb-browser.js` + `duckdb-browser-eh.worker.js` + `duckdb-eh.wasm` + `extensions/v1.4.3/wasm_eh/parquet.duckdb_extension.wasm` | `@duckdb/duckdb-wasm` (eh = single-threaded) + `apache-arrow` bundled in | 1.32.0 (arrow 17.0.0) | `duckdb-wasm` | built by `aimeat/scripts/vendor-duckdb-wasm.mjs`; the two .wasm files fetched by `pnpm vendor:libs` | MIT (arrow: Apache-2.0) |
30
31
  | `yaml.mjs` | `yaml` (ESM) | 2.x | `yaml` | jsdelivr | ISC |
31
32
  | `preact.mjs`, `preact-hooks.mjs`, `htm.mjs`, `minidenticons.min.js` | preact / htm / minidenticons (ESM) | (SPA-internal, importmap) | — | jsdelivr | MIT |
32
33
  | `live-updates.js` | AIMEAT-local (SSE ESM wrapper) | (SPA-internal) | — | this repo | MIT |