@fraziym/axoniz 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (512) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/agents/definition.d.ts +15 -0
  4. package/dist/agents/definition.d.ts.map +1 -0
  5. package/dist/agents/definition.js +41 -0
  6. package/dist/agents/definition.js.map +1 -0
  7. package/dist/agents/index.d.ts +12 -0
  8. package/dist/agents/index.d.ts.map +1 -0
  9. package/dist/agents/index.js +11 -0
  10. package/dist/agents/index.js.map +1 -0
  11. package/dist/agents/registry.d.ts +17 -0
  12. package/dist/agents/registry.d.ts.map +1 -0
  13. package/dist/agents/registry.js +23 -0
  14. package/dist/agents/registry.js.map +1 -0
  15. package/dist/agents/specialized.d.ts +31 -0
  16. package/dist/agents/specialized.d.ts.map +1 -0
  17. package/dist/agents/specialized.js +75 -0
  18. package/dist/agents/specialized.js.map +1 -0
  19. package/dist/awareness/index.d.ts +14 -0
  20. package/dist/awareness/index.d.ts.map +1 -0
  21. package/dist/awareness/index.js +22 -0
  22. package/dist/awareness/index.js.map +1 -0
  23. package/dist/awareness/service.d.ts +180 -0
  24. package/dist/awareness/service.d.ts.map +1 -0
  25. package/dist/awareness/service.js +789 -0
  26. package/dist/awareness/service.js.map +1 -0
  27. package/dist/cli/entry.d.ts +13 -0
  28. package/dist/cli/entry.d.ts.map +1 -0
  29. package/dist/cli/entry.js +35 -0
  30. package/dist/cli/entry.js.map +1 -0
  31. package/dist/comms/telegram.d.ts +41 -0
  32. package/dist/comms/telegram.d.ts.map +1 -0
  33. package/dist/comms/telegram.js +332 -0
  34. package/dist/comms/telegram.js.map +1 -0
  35. package/dist/core/agent.d.ts +252 -0
  36. package/dist/core/agent.d.ts.map +1 -0
  37. package/dist/core/agent.js +1399 -0
  38. package/dist/core/agent.js.map +1 -0
  39. package/dist/core/auth.d.ts +23 -0
  40. package/dist/core/auth.d.ts.map +1 -0
  41. package/dist/core/auth.js +113 -0
  42. package/dist/core/auth.js.map +1 -0
  43. package/dist/core/authority.d.ts +118 -0
  44. package/dist/core/authority.d.ts.map +1 -0
  45. package/dist/core/authority.js +402 -0
  46. package/dist/core/authority.js.map +1 -0
  47. package/dist/core/backend/async_queue.d.ts +17 -0
  48. package/dist/core/backend/async_queue.d.ts.map +1 -0
  49. package/dist/core/backend/async_queue.js +66 -0
  50. package/dist/core/backend/async_queue.js.map +1 -0
  51. package/dist/core/backend/index.d.ts +24 -0
  52. package/dist/core/backend/index.d.ts.map +1 -0
  53. package/dist/core/backend/index.js +128 -0
  54. package/dist/core/backend/index.js.map +1 -0
  55. package/dist/core/backend/llama_server.d.ts +39 -0
  56. package/dist/core/backend/llama_server.d.ts.map +1 -0
  57. package/dist/core/backend/llama_server.js +182 -0
  58. package/dist/core/backend/llama_server.js.map +1 -0
  59. package/dist/core/backend/llamacpp.d.ts +40 -0
  60. package/dist/core/backend/llamacpp.d.ts.map +1 -0
  61. package/dist/core/backend/llamacpp.js +200 -0
  62. package/dist/core/backend/llamacpp.js.map +1 -0
  63. package/dist/core/backend/lmstudio.d.ts +53 -0
  64. package/dist/core/backend/lmstudio.d.ts.map +1 -0
  65. package/dist/core/backend/lmstudio.js +274 -0
  66. package/dist/core/backend/lmstudio.js.map +1 -0
  67. package/dist/core/backend/ollama.d.ts +25 -0
  68. package/dist/core/backend/ollama.d.ts.map +1 -0
  69. package/dist/core/backend/ollama.js +86 -0
  70. package/dist/core/backend/ollama.js.map +1 -0
  71. package/dist/core/backend/openai.d.ts +27 -0
  72. package/dist/core/backend/openai.d.ts.map +1 -0
  73. package/dist/core/backend/openai.js +84 -0
  74. package/dist/core/backend/openai.js.map +1 -0
  75. package/dist/core/backend/types.d.ts +73 -0
  76. package/dist/core/backend/types.d.ts.map +1 -0
  77. package/dist/core/backend/types.js +137 -0
  78. package/dist/core/backend/types.js.map +1 -0
  79. package/dist/core/chat_store.d.ts +77 -0
  80. package/dist/core/chat_store.d.ts.map +1 -0
  81. package/dist/core/chat_store.js +332 -0
  82. package/dist/core/chat_store.js.map +1 -0
  83. package/dist/core/cli.d.ts +82 -0
  84. package/dist/core/cli.d.ts.map +1 -0
  85. package/dist/core/cli.js +602 -0
  86. package/dist/core/cli.js.map +1 -0
  87. package/dist/core/config.d.ts +127 -0
  88. package/dist/core/config.d.ts.map +1 -0
  89. package/dist/core/config.js +295 -0
  90. package/dist/core/config.js.map +1 -0
  91. package/dist/core/debug.d.ts +8 -0
  92. package/dist/core/debug.d.ts.map +1 -0
  93. package/dist/core/debug.js +8 -0
  94. package/dist/core/debug.js.map +1 -0
  95. package/dist/core/downloader.d.ts +31 -0
  96. package/dist/core/downloader.d.ts.map +1 -0
  97. package/dist/core/downloader.js +180 -0
  98. package/dist/core/downloader.js.map +1 -0
  99. package/dist/core/errors.d.ts +80 -0
  100. package/dist/core/errors.d.ts.map +1 -0
  101. package/dist/core/errors.js +134 -0
  102. package/dist/core/errors.js.map +1 -0
  103. package/dist/core/extras.d.ts +160 -0
  104. package/dist/core/extras.d.ts.map +1 -0
  105. package/dist/core/extras.js +553 -0
  106. package/dist/core/extras.js.map +1 -0
  107. package/dist/core/health.d.ts +27 -0
  108. package/dist/core/health.d.ts.map +1 -0
  109. package/dist/core/health.js +96 -0
  110. package/dist/core/health.js.map +1 -0
  111. package/dist/core/history.d.ts +50 -0
  112. package/dist/core/history.d.ts.map +1 -0
  113. package/dist/core/history.js +276 -0
  114. package/dist/core/history.js.map +1 -0
  115. package/dist/core/index.d.ts +6 -0
  116. package/dist/core/index.d.ts.map +1 -0
  117. package/dist/core/index.js +6 -0
  118. package/dist/core/index.js.map +1 -0
  119. package/dist/core/intelligence/ast_index.d.ts +255 -0
  120. package/dist/core/intelligence/ast_index.d.ts.map +1 -0
  121. package/dist/core/intelligence/ast_index.js +1369 -0
  122. package/dist/core/intelligence/ast_index.js.map +1 -0
  123. package/dist/core/intelligence/confidence.d.ts +113 -0
  124. package/dist/core/intelligence/confidence.d.ts.map +1 -0
  125. package/dist/core/intelligence/confidence.js +298 -0
  126. package/dist/core/intelligence/confidence.js.map +1 -0
  127. package/dist/core/intelligence/context_compressor.d.ts +80 -0
  128. package/dist/core/intelligence/context_compressor.d.ts.map +1 -0
  129. package/dist/core/intelligence/context_compressor.js +245 -0
  130. package/dist/core/intelligence/context_compressor.js.map +1 -0
  131. package/dist/core/intelligence/daemon.d.ts +247 -0
  132. package/dist/core/intelligence/daemon.d.ts.map +1 -0
  133. package/dist/core/intelligence/daemon.js +842 -0
  134. package/dist/core/intelligence/daemon.js.map +1 -0
  135. package/dist/core/intelligence/index.d.ts +60 -0
  136. package/dist/core/intelligence/index.d.ts.map +1 -0
  137. package/dist/core/intelligence/index.js +101 -0
  138. package/dist/core/intelligence/index.js.map +1 -0
  139. package/dist/core/intelligence/predictor.d.ts +246 -0
  140. package/dist/core/intelligence/predictor.d.ts.map +1 -0
  141. package/dist/core/intelligence/predictor.js +590 -0
  142. package/dist/core/intelligence/predictor.js.map +1 -0
  143. package/dist/core/intelligence/reflex.d.ts +84 -0
  144. package/dist/core/intelligence/reflex.d.ts.map +1 -0
  145. package/dist/core/intelligence/reflex.js +344 -0
  146. package/dist/core/intelligence/reflex.js.map +1 -0
  147. package/dist/core/intelligence/self_correction.d.ts +121 -0
  148. package/dist/core/intelligence/self_correction.d.ts.map +1 -0
  149. package/dist/core/intelligence/self_correction.js +327 -0
  150. package/dist/core/intelligence/self_correction.js.map +1 -0
  151. package/dist/core/intelligence/skill_distiller.d.ts +100 -0
  152. package/dist/core/intelligence/skill_distiller.d.ts.map +1 -0
  153. package/dist/core/intelligence/skill_distiller.js +246 -0
  154. package/dist/core/intelligence/skill_distiller.js.map +1 -0
  155. package/dist/core/intelligence/swarm.d.ts +330 -0
  156. package/dist/core/intelligence/swarm.d.ts.map +1 -0
  157. package/dist/core/intelligence/swarm.js +1064 -0
  158. package/dist/core/intelligence/swarm.js.map +1 -0
  159. package/dist/core/intelligence/trajectory.d.ts +107 -0
  160. package/dist/core/intelligence/trajectory.d.ts.map +1 -0
  161. package/dist/core/intelligence/trajectory.js +330 -0
  162. package/dist/core/intelligence/trajectory.js.map +1 -0
  163. package/dist/core/logger.d.ts +111 -0
  164. package/dist/core/logger.d.ts.map +1 -0
  165. package/dist/core/logger.js +640 -0
  166. package/dist/core/logger.js.map +1 -0
  167. package/dist/core/loop.d.ts +123 -0
  168. package/dist/core/loop.d.ts.map +1 -0
  169. package/dist/core/loop.js +423 -0
  170. package/dist/core/loop.js.map +1 -0
  171. package/dist/core/memory.d.ts +81 -0
  172. package/dist/core/memory.d.ts.map +1 -0
  173. package/dist/core/memory.js +328 -0
  174. package/dist/core/memory.js.map +1 -0
  175. package/dist/core/metrics.d.ts +29 -0
  176. package/dist/core/metrics.d.ts.map +1 -0
  177. package/dist/core/metrics.js +109 -0
  178. package/dist/core/metrics.js.map +1 -0
  179. package/dist/core/models.d.ts +51 -0
  180. package/dist/core/models.d.ts.map +1 -0
  181. package/dist/core/models.js +146 -0
  182. package/dist/core/models.js.map +1 -0
  183. package/dist/core/optimizer.d.ts +34 -0
  184. package/dist/core/optimizer.d.ts.map +1 -0
  185. package/dist/core/optimizer.js +131 -0
  186. package/dist/core/optimizer.js.map +1 -0
  187. package/dist/core/persona.d.ts +35 -0
  188. package/dist/core/persona.d.ts.map +1 -0
  189. package/dist/core/persona.js +126 -0
  190. package/dist/core/persona.js.map +1 -0
  191. package/dist/core/rate_limit.d.ts +23 -0
  192. package/dist/core/rate_limit.d.ts.map +1 -0
  193. package/dist/core/rate_limit.js +62 -0
  194. package/dist/core/rate_limit.js.map +1 -0
  195. package/dist/core/runner.d.ts +63 -0
  196. package/dist/core/runner.d.ts.map +1 -0
  197. package/dist/core/runner.js +671 -0
  198. package/dist/core/runner.js.map +1 -0
  199. package/dist/core/stream_parser.d.ts +43 -0
  200. package/dist/core/stream_parser.d.ts.map +1 -0
  201. package/dist/core/stream_parser.js +140 -0
  202. package/dist/core/stream_parser.js.map +1 -0
  203. package/dist/core/tool_schemas.d.ts +26 -0
  204. package/dist/core/tool_schemas.d.ts.map +1 -0
  205. package/dist/core/tool_schemas.js +124 -0
  206. package/dist/core/tool_schemas.js.map +1 -0
  207. package/dist/core/which.d.ts +2 -0
  208. package/dist/core/which.d.ts.map +1 -0
  209. package/dist/core/which.js +35 -0
  210. package/dist/core/which.js.map +1 -0
  211. package/dist/goals/index.d.ts +9 -0
  212. package/dist/goals/index.d.ts.map +1 -0
  213. package/dist/goals/index.js +17 -0
  214. package/dist/goals/index.js.map +1 -0
  215. package/dist/goals/service.d.ts +115 -0
  216. package/dist/goals/service.d.ts.map +1 -0
  217. package/dist/goals/service.js +415 -0
  218. package/dist/goals/service.js.map +1 -0
  219. package/dist/goals/types.d.ts +47 -0
  220. package/dist/goals/types.d.ts.map +1 -0
  221. package/dist/goals/types.js +66 -0
  222. package/dist/goals/types.js.map +1 -0
  223. package/dist/index.d.ts +22 -0
  224. package/dist/index.d.ts.map +1 -0
  225. package/dist/index.js +22 -0
  226. package/dist/index.js.map +1 -0
  227. package/dist/integrations/autonomous_startup.d.ts +51 -0
  228. package/dist/integrations/autonomous_startup.d.ts.map +1 -0
  229. package/dist/integrations/autonomous_startup.js +419 -0
  230. package/dist/integrations/autonomous_startup.js.map +1 -0
  231. package/dist/integrations/goose.d.ts +105 -0
  232. package/dist/integrations/goose.d.ts.map +1 -0
  233. package/dist/integrations/goose.js +408 -0
  234. package/dist/integrations/goose.js.map +1 -0
  235. package/dist/integrations/index.d.ts +21 -0
  236. package/dist/integrations/index.d.ts.map +1 -0
  237. package/dist/integrations/index.js +17 -0
  238. package/dist/integrations/index.js.map +1 -0
  239. package/dist/integrations/mcp.d.ts +73 -0
  240. package/dist/integrations/mcp.d.ts.map +1 -0
  241. package/dist/integrations/mcp.js +307 -0
  242. package/dist/integrations/mcp.js.map +1 -0
  243. package/dist/integrations/mempalace.d.ts +18 -0
  244. package/dist/integrations/mempalace.d.ts.map +1 -0
  245. package/dist/integrations/mempalace.js +25 -0
  246. package/dist/integrations/mempalace.js.map +1 -0
  247. package/dist/integrations/multi_agent.d.ts +82 -0
  248. package/dist/integrations/multi_agent.d.ts.map +1 -0
  249. package/dist/integrations/multi_agent.js +280 -0
  250. package/dist/integrations/multi_agent.js.map +1 -0
  251. package/dist/integrations/unified_memory.d.ts +415 -0
  252. package/dist/integrations/unified_memory.d.ts.map +1 -0
  253. package/dist/integrations/unified_memory.js +1489 -0
  254. package/dist/integrations/unified_memory.js.map +1 -0
  255. package/dist/roles/beru.yaml +48 -0
  256. package/dist/sidecar/client.d.ts +63 -0
  257. package/dist/sidecar/client.d.ts.map +1 -0
  258. package/dist/sidecar/client.js +222 -0
  259. package/dist/sidecar/client.js.map +1 -0
  260. package/dist/sidecar/index.d.ts +7 -0
  261. package/dist/sidecar/index.d.ts.map +1 -0
  262. package/dist/sidecar/index.js +6 -0
  263. package/dist/sidecar/index.js.map +1 -0
  264. package/dist/startup.d.ts +22 -0
  265. package/dist/startup.d.ts.map +1 -0
  266. package/dist/startup.js +194 -0
  267. package/dist/startup.js.map +1 -0
  268. package/dist/tools/_internal.d.ts +90 -0
  269. package/dist/tools/_internal.d.ts.map +1 -0
  270. package/dist/tools/_internal.js +375 -0
  271. package/dist/tools/_internal.js.map +1 -0
  272. package/dist/tools/_smoke.d.ts +2 -0
  273. package/dist/tools/_smoke.d.ts.map +1 -0
  274. package/dist/tools/_smoke.js +203 -0
  275. package/dist/tools/_smoke.js.map +1 -0
  276. package/dist/tools/axodex_tools.d.ts +51 -0
  277. package/dist/tools/axodex_tools.d.ts.map +1 -0
  278. package/dist/tools/axodex_tools.js +181 -0
  279. package/dist/tools/axodex_tools.js.map +1 -0
  280. package/dist/tools/code_tools.d.ts +33 -0
  281. package/dist/tools/code_tools.d.ts.map +1 -0
  282. package/dist/tools/code_tools.js +191 -0
  283. package/dist/tools/code_tools.js.map +1 -0
  284. package/dist/tools/computer_tools.d.ts +59 -0
  285. package/dist/tools/computer_tools.d.ts.map +1 -0
  286. package/dist/tools/computer_tools.js +348 -0
  287. package/dist/tools/computer_tools.js.map +1 -0
  288. package/dist/tools/file_tools.d.ts +51 -0
  289. package/dist/tools/file_tools.d.ts.map +1 -0
  290. package/dist/tools/file_tools.js +424 -0
  291. package/dist/tools/file_tools.js.map +1 -0
  292. package/dist/tools/index.d.ts +13 -0
  293. package/dist/tools/index.d.ts.map +1 -0
  294. package/dist/tools/index.js +13 -0
  295. package/dist/tools/index.js.map +1 -0
  296. package/dist/tools/shell_tools.d.ts +39 -0
  297. package/dist/tools/shell_tools.d.ts.map +1 -0
  298. package/dist/tools/shell_tools.js +163 -0
  299. package/dist/tools/shell_tools.js.map +1 -0
  300. package/dist/tools/web_tools.d.ts +31 -0
  301. package/dist/tools/web_tools.d.ts.map +1 -0
  302. package/dist/tools/web_tools.js +117 -0
  303. package/dist/tools/web_tools.js.map +1 -0
  304. package/dist/voice/index.d.ts +41 -0
  305. package/dist/voice/index.d.ts.map +1 -0
  306. package/dist/voice/index.js +58 -0
  307. package/dist/voice/index.js.map +1 -0
  308. package/dist/voice/light_daemon.d.ts +197 -0
  309. package/dist/voice/light_daemon.d.ts.map +1 -0
  310. package/dist/voice/light_daemon.js +746 -0
  311. package/dist/voice/light_daemon.js.map +1 -0
  312. package/dist/voice/setup.d.ts +63 -0
  313. package/dist/voice/setup.d.ts.map +1 -0
  314. package/dist/voice/setup.js +443 -0
  315. package/dist/voice/setup.js.map +1 -0
  316. package/dist/voice/stt.d.ts +148 -0
  317. package/dist/voice/stt.d.ts.map +1 -0
  318. package/dist/voice/stt.js +361 -0
  319. package/dist/voice/stt.js.map +1 -0
  320. package/dist/voice/tts.d.ts +168 -0
  321. package/dist/voice/tts.d.ts.map +1 -0
  322. package/dist/voice/tts.js +698 -0
  323. package/dist/voice/tts.js.map +1 -0
  324. package/dist/voice/voice_loop.d.ts +101 -0
  325. package/dist/voice/voice_loop.d.ts.map +1 -0
  326. package/dist/voice/voice_loop.js +463 -0
  327. package/dist/voice/voice_loop.js.map +1 -0
  328. package/dist/voice/wake_word.d.ts +153 -0
  329. package/dist/voice/wake_word.d.ts.map +1 -0
  330. package/dist/voice/wake_word.js +458 -0
  331. package/dist/voice/wake_word.js.map +1 -0
  332. package/dist/voice/wav.d.ts +99 -0
  333. package/dist/voice/wav.d.ts.map +1 -0
  334. package/dist/voice/wav.js +306 -0
  335. package/dist/voice/wav.js.map +1 -0
  336. package/dist/web/broker.d.ts +33 -0
  337. package/dist/web/broker.d.ts.map +1 -0
  338. package/dist/web/broker.js +58 -0
  339. package/dist/web/broker.js.map +1 -0
  340. package/dist/web/open_browser.d.ts +2 -0
  341. package/dist/web/open_browser.d.ts.map +1 -0
  342. package/dist/web/open_browser.js +42 -0
  343. package/dist/web/open_browser.js.map +1 -0
  344. package/dist/web/server.d.ts +54 -0
  345. package/dist/web/server.d.ts.map +1 -0
  346. package/dist/web/server.js +831 -0
  347. package/dist/web/server.js.map +1 -0
  348. package/dist/web/static/app.js +4121 -0
  349. package/dist/web/static/index.html +2281 -0
  350. package/dist/web/static/js/MODULE_SUMMARY.md +124 -0
  351. package/dist/web/static/js/a11y.js +165 -0
  352. package/dist/web/static/js/admin.js +2145 -0
  353. package/dist/web/static/js/assistant.js +475 -0
  354. package/dist/web/static/js/calendar/reminders.js +114 -0
  355. package/dist/web/static/js/calendar/utils.js +166 -0
  356. package/dist/web/static/js/calendar.js +3348 -0
  357. package/dist/web/static/js/censor.js +356 -0
  358. package/dist/web/static/js/chat.js +4546 -0
  359. package/dist/web/static/js/chatRenderer.js +2294 -0
  360. package/dist/web/static/js/chatStream.js +276 -0
  361. package/dist/web/static/js/codeRunner.js +398 -0
  362. package/dist/web/static/js/color/hex.js +14 -0
  363. package/dist/web/static/js/colorPicker.js +453 -0
  364. package/dist/web/static/js/compare/icons.js +77 -0
  365. package/dist/web/static/js/compare/index.js +1482 -0
  366. package/dist/web/static/js/compare/models.js +104 -0
  367. package/dist/web/static/js/compare/panes.js +817 -0
  368. package/dist/web/static/js/compare/probe.js +78 -0
  369. package/dist/web/static/js/compare/scoreboard.js +223 -0
  370. package/dist/web/static/js/compare/selector.js +1335 -0
  371. package/dist/web/static/js/compare/state.js +58 -0
  372. package/dist/web/static/js/compare/stream.js +695 -0
  373. package/dist/web/static/js/compare/vote.js +254 -0
  374. package/dist/web/static/js/cookbook-diagnosis.js +694 -0
  375. package/dist/web/static/js/cookbook-hwfit.js +1888 -0
  376. package/dist/web/static/js/cookbook.js +2093 -0
  377. package/dist/web/static/js/cookbookDownload.js +633 -0
  378. package/dist/web/static/js/cookbookProgressSignal.js +29 -0
  379. package/dist/web/static/js/cookbookRunning.js +3506 -0
  380. package/dist/web/static/js/cookbookServe.js +2128 -0
  381. package/dist/web/static/js/document.js +9731 -0
  382. package/dist/web/static/js/documentLibrary.js +3376 -0
  383. package/dist/web/static/js/dragSort.js +265 -0
  384. package/dist/web/static/js/editor/ai-inpaint.js +374 -0
  385. package/dist/web/static/js/editor/ai-models.js +273 -0
  386. package/dist/web/static/js/editor/ai-rembg.js +230 -0
  387. package/dist/web/static/js/editor/ai-tool-runner.js +147 -0
  388. package/dist/web/static/js/editor/ai-tools-misc.js +216 -0
  389. package/dist/web/static/js/editor/build/controls.js +366 -0
  390. package/dist/web/static/js/editor/build/popups.js +112 -0
  391. package/dist/web/static/js/editor/build/right-panel.js +200 -0
  392. package/dist/web/static/js/editor/build/toolbar.js +73 -0
  393. package/dist/web/static/js/editor/build/topbar.js +131 -0
  394. package/dist/web/static/js/editor/build/transform-popup.js +109 -0
  395. package/dist/web/static/js/editor/canvas-coords.js +21 -0
  396. package/dist/web/static/js/editor/canvas-events.js +197 -0
  397. package/dist/web/static/js/editor/canvas-transforms.js +132 -0
  398. package/dist/web/static/js/editor/checkerboard.js +24 -0
  399. package/dist/web/static/js/editor/clipboard-and-drop.js +133 -0
  400. package/dist/web/static/js/editor/composite-helpers.js +83 -0
  401. package/dist/web/static/js/editor/filters/blur.js +118 -0
  402. package/dist/web/static/js/editor/filters/edge-feather.js +70 -0
  403. package/dist/web/static/js/editor/fx/adj-popup.js +677 -0
  404. package/dist/web/static/js/editor/fx/filter-string.js +38 -0
  405. package/dist/web/static/js/editor/fx/histogram.js +67 -0
  406. package/dist/web/static/js/editor/fx/pixel-pass.js +249 -0
  407. package/dist/web/static/js/editor/harmonize-masks.js +116 -0
  408. package/dist/web/static/js/editor/history-panel.js +176 -0
  409. package/dist/web/static/js/editor/keyboard-shortcuts.js +271 -0
  410. package/dist/web/static/js/editor/layer-helpers.js +131 -0
  411. package/dist/web/static/js/editor/layer-panel.js +600 -0
  412. package/dist/web/static/js/editor/mask-utils.js +91 -0
  413. package/dist/web/static/js/editor/shortcuts-popover.js +149 -0
  414. package/dist/web/static/js/editor/slider-ux.js +191 -0
  415. package/dist/web/static/js/editor/snap.js +107 -0
  416. package/dist/web/static/js/editor/state.js +257 -0
  417. package/dist/web/static/js/editor/stroke-pipeline.js +162 -0
  418. package/dist/web/static/js/editor/stroke-tool-sliders.js +64 -0
  419. package/dist/web/static/js/editor/tools/clone.js +81 -0
  420. package/dist/web/static/js/editor/tools/crop.js +137 -0
  421. package/dist/web/static/js/editor/tools/flood-fill.js +72 -0
  422. package/dist/web/static/js/editor/tools/lasso-mask.js +171 -0
  423. package/dist/web/static/js/editor/tools/lasso.js +65 -0
  424. package/dist/web/static/js/editor/tools/move.js +79 -0
  425. package/dist/web/static/js/editor/tools/stroke.js +123 -0
  426. package/dist/web/static/js/editor/tools/transform-drag.js +174 -0
  427. package/dist/web/static/js/editor/tools/transform-handles.js +271 -0
  428. package/dist/web/static/js/editor/tools/transform-session.js +381 -0
  429. package/dist/web/static/js/editor/tools/wand.js +46 -0
  430. package/dist/web/static/js/editor/wire-import.js +148 -0
  431. package/dist/web/static/js/editor/wire-inpaint-controls.js +164 -0
  432. package/dist/web/static/js/editor/wire-merge-buttons.js +103 -0
  433. package/dist/web/static/js/editor/wire-selection-controls.js +170 -0
  434. package/dist/web/static/js/editor/wire-topbar-menus.js +174 -0
  435. package/dist/web/static/js/editor/wire-topbar-overflow.js +49 -0
  436. package/dist/web/static/js/editor/wire-topbar.js +188 -0
  437. package/dist/web/static/js/emailInbox.js +1245 -0
  438. package/dist/web/static/js/emailLibrary/replyRecipients.js +27 -0
  439. package/dist/web/static/js/emailLibrary/signatureFold.js +339 -0
  440. package/dist/web/static/js/emailLibrary/state.js +34 -0
  441. package/dist/web/static/js/emailLibrary/utils.js +202 -0
  442. package/dist/web/static/js/emailLibrary.js +5217 -0
  443. package/dist/web/static/js/emojiPicker.js +311 -0
  444. package/dist/web/static/js/escMenuStack.js +102 -0
  445. package/dist/web/static/js/fileHandler.js +295 -0
  446. package/dist/web/static/js/gallery.js +2835 -0
  447. package/dist/web/static/js/galleryEditor.js +3798 -0
  448. package/dist/web/static/js/group.js +955 -0
  449. package/dist/web/static/js/init.js +405 -0
  450. package/dist/web/static/js/keyboard-shortcuts.js +292 -0
  451. package/dist/web/static/js/langIcons.js +187 -0
  452. package/dist/web/static/js/markdown/tableRow.js +19 -0
  453. package/dist/web/static/js/markdown.js +806 -0
  454. package/dist/web/static/js/memory.js +1418 -0
  455. package/dist/web/static/js/modalManager.js +1552 -0
  456. package/dist/web/static/js/modalSnap.js +782 -0
  457. package/dist/web/static/js/model/matchKey.js +19 -0
  458. package/dist/web/static/js/modelPicker.js +695 -0
  459. package/dist/web/static/js/modelSort.js +33 -0
  460. package/dist/web/static/js/models.js +642 -0
  461. package/dist/web/static/js/notes.js +5054 -0
  462. package/dist/web/static/js/package.json +1 -0
  463. package/dist/web/static/js/platform.js +47 -0
  464. package/dist/web/static/js/presets.js +1110 -0
  465. package/dist/web/static/js/providers.js +93 -0
  466. package/dist/web/static/js/rag.js +177 -0
  467. package/dist/web/static/js/research/jobs.js +335 -0
  468. package/dist/web/static/js/research/panel.js +1233 -0
  469. package/dist/web/static/js/researchSynapse.js +225 -0
  470. package/dist/web/static/js/search-chat.js +201 -0
  471. package/dist/web/static/js/search.js +52 -0
  472. package/dist/web/static/js/section-management.js +260 -0
  473. package/dist/web/static/js/sessions.js +3108 -0
  474. package/dist/web/static/js/settings.js +4991 -0
  475. package/dist/web/static/js/sidebar-layout.js +573 -0
  476. package/dist/web/static/js/signature.js +504 -0
  477. package/dist/web/static/js/skills.js +1908 -0
  478. package/dist/web/static/js/slashAutocomplete.js +267 -0
  479. package/dist/web/static/js/slashCommands.js +6099 -0
  480. package/dist/web/static/js/spinner.js +406 -0
  481. package/dist/web/static/js/storage.js +123 -0
  482. package/dist/web/static/js/tasks.js +2699 -0
  483. package/dist/web/static/js/theme.js +2086 -0
  484. package/dist/web/static/js/tileManager.js +386 -0
  485. package/dist/web/static/js/tourAutoplay.js +133 -0
  486. package/dist/web/static/js/tourHints.js +179 -0
  487. package/dist/web/static/js/tts-ai.js +521 -0
  488. package/dist/web/static/js/ui.js +1288 -0
  489. package/dist/web/static/js/util/ordinal.js +13 -0
  490. package/dist/web/static/js/voiceRecorder.js +283 -0
  491. package/dist/web/static/js/windowDrag.js +326 -0
  492. package/dist/web/static/js/windowResize.js +233 -0
  493. package/dist/web/static/landing.html +824 -0
  494. package/dist/web/static/lib/docx.umd.min.js +20116 -0
  495. package/dist/web/static/lib/highlight.min.js +1213 -0
  496. package/dist/web/static/lib/html2pdf.bundle.min.js +3 -0
  497. package/dist/web/static/lib/mammoth.browser.min.js +21 -0
  498. package/dist/web/static/lib/qrcode.min.js +8 -0
  499. package/dist/web/static/lib/xlsx.full.min.js +24 -0
  500. package/dist/web/static/login.html +582 -0
  501. package/dist/web/static/manifest.json +15 -0
  502. package/dist/web/static/style.css +35733 -0
  503. package/dist/web/static/sw.js +144 -0
  504. package/dist/workflows/engine.d.ts +162 -0
  505. package/dist/workflows/engine.d.ts.map +1 -0
  506. package/dist/workflows/engine.js +625 -0
  507. package/dist/workflows/engine.js.map +1 -0
  508. package/dist/workflows/index.d.ts +8 -0
  509. package/dist/workflows/index.d.ts.map +1 -0
  510. package/dist/workflows/index.js +14 -0
  511. package/dist/workflows/index.js.map +1 -0
  512. package/package.json +112 -0
@@ -0,0 +1,386 @@
1
+ /**
2
+ * tileManager.js — desktop window tiling for tool modals.
3
+ *
4
+ * Hooks into any modal whose `.modal-header` is dragged (each tool wires its
5
+ * own drag; we just watch pointer moves). Shows a translucent ghost preview
6
+ * when the cursor is near a snap zone. On release, snaps the modal-content
7
+ * to fill that zone with a springy animation.
8
+ *
9
+ * Snap zones (9):
10
+ * - top edge (10% strip) → maximize
11
+ * - top-left corner → top-left quarter
12
+ * - top-right corner → top-right quarter
13
+ * - left edge → left half
14
+ * - right edge → right half
15
+ * - bottom-left corner → bottom-left quarter
16
+ * - bottom-right corner → bottom-right quarter
17
+ * - bottom edge → bottom half
18
+ * - sidebar edge (if present) → snap next to the sidebar
19
+ *
20
+ * Mobile (≤768px) is excluded — the swipe-dismiss UX takes precedence.
21
+ *
22
+ * Each modal-content remembers its pre-snap geometry so dragging away restores
23
+ * the original size.
24
+ */
25
+
26
+ const EDGE_THRESHOLD_PX = 24; // how close to an edge counts as "near"
27
+ const CORNER_THRESHOLD_PX = 64; // corner box size
28
+ const TOP_FULL_STRIP_PX = 8; // top strip → maximize
29
+
30
+ let _ghost = null;
31
+ let _activeZone = null;
32
+ let _tracking = null; // { content, startRect }
33
+
34
+ function _isDesktop() { return window.innerWidth > 768; }
35
+
36
+ function _dockClassForSide(side) {
37
+ return side === 'left' ? 'modal-left-docked' : 'modal-right-docked';
38
+ }
39
+
40
+ function _hasOtherDockedWindow(side, owner) {
41
+ const cls = _dockClassForSide(side);
42
+ return Array.from(document.querySelectorAll(`.${cls}`)).some((el) => {
43
+ if (!el || el === owner) return false;
44
+ if (owner && el.contains && el.contains(owner)) return false;
45
+ if (owner && owner.contains && owner.contains(el)) return false;
46
+ return true;
47
+ });
48
+ }
49
+
50
+ function _clearDockSide(side, owner = null) {
51
+ if (side !== 'left' && side !== 'right') return;
52
+ if (_hasOtherDockedWindow(side, owner)) return;
53
+ document.body.classList.remove(side === 'left' ? 'left-dock-active' : 'right-dock-active');
54
+ document.documentElement.style.removeProperty(side === 'left' ? '--left-dock-w' : '--right-dock-w');
55
+ if (side === 'left') {
56
+ try { window._restoreSidebarIfRouteCollapsed?.(); } catch (_) {}
57
+ }
58
+ }
59
+
60
+ function _ensureGhost() {
61
+ if (_ghost) return _ghost;
62
+ _ghost = document.createElement('div');
63
+ _ghost.id = 'tile-ghost';
64
+ document.body.appendChild(_ghost);
65
+ return _ghost;
66
+ }
67
+
68
+ function _hideGhost() {
69
+ if (_ghost) _ghost.classList.remove('visible');
70
+ }
71
+
72
+ function _showGhost(rect) {
73
+ const g = _ensureGhost();
74
+ g.style.left = rect.left + 'px';
75
+ g.style.top = rect.top + 'px';
76
+ g.style.width = rect.width + 'px';
77
+ g.style.height = rect.height + 'px';
78
+ g.classList.add('visible');
79
+ }
80
+
81
+ function _viewportSafeRect() {
82
+ // Account for the icon rail / sidebar on the left side of the viewport.
83
+ const sidebar = document.getElementById('sidebar');
84
+ const rail = document.querySelector('.icon-rail') || document.querySelector('#icon-rail');
85
+ let leftEdge = 0;
86
+ const sb = sidebar?.getBoundingClientRect();
87
+ if (sb && sb.right > 0 && !sidebar.classList.contains('hidden')) leftEdge = Math.max(leftEdge, sb.right);
88
+ const rr = rail?.getBoundingClientRect();
89
+ if (rr && rr.right > 0) leftEdge = Math.max(leftEdge, rr.right);
90
+ return {
91
+ left: leftEdge + 4,
92
+ top: 4,
93
+ right: window.innerWidth - 4,
94
+ bottom: window.innerHeight - 4,
95
+ };
96
+ }
97
+
98
+ function _zoneForPointer(x, y) {
99
+ const safe = _viewportSafeRect();
100
+ const W = safe.right - safe.left;
101
+ const H = safe.bottom - safe.top;
102
+
103
+ // Dragged OVER the top edge (cursor at/past the very top) → TRUE fullscreen
104
+ // that covers everything, including the sidebar.
105
+ if (y <= 0) {
106
+ return { name: 'fullscreen', rect: { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight } };
107
+ }
108
+ // Near the top edge (but not over it) → "maximize": fill the safe area,
109
+ // which sits NEXT TO the sidebar/rail rather than covering it.
110
+ if (y <= safe.top + TOP_FULL_STRIP_PX) {
111
+ return { name: 'maximize', rect: { left: safe.left, top: safe.top, width: W, height: H } };
112
+ }
113
+
114
+ // Corner quarter-snaps DISABLED (user request) — only the top strip
115
+ // (maximize) and the right/bottom half-snaps remain. The LEFT-half snap
116
+ // is also disabled (the sidebar lives there; docking over it is awkward).
117
+ if (x >= safe.right - EDGE_THRESHOLD_PX)
118
+ return { name: 'right-half', rect: { left: safe.left + W / 2, top: safe.top, width: W / 2, height: H } };
119
+ if (y >= safe.bottom - EDGE_THRESHOLD_PX)
120
+ return { name: 'bottom-half', rect: { left: safe.left, top: safe.top + H / 2, width: W, height: H / 2 } };
121
+
122
+ return null;
123
+ }
124
+
125
+ function _zoneForContent(content, x, y) {
126
+ const modal = content && content.closest && content.closest('.modal, .research-overlay');
127
+ const zone = _zoneForPointer(x, y);
128
+ if (!zone) return null;
129
+ // Settings has a dense two-column layout; the full-height sidebar-style dock
130
+ // crushes it. Let it tile only into the normal right half, where the nav can
131
+ // flip to top tabs via CSS when the window gets narrow.
132
+ if (modal && modal.id === 'settings-modal' && zone.name !== 'right-half') return null;
133
+ if (modal && (modal.id === 'cookbook-modal'
134
+ || modal.id === 'theme-modal'
135
+ || modal.id === 'memory-modal')
136
+ && zone.name !== 'fullscreen') return null;
137
+ return zone;
138
+ }
139
+
140
+ function _clearEdgeDockResidue(modal, content) {
141
+ const hadDockState = !!(
142
+ (modal && (modal.classList.contains('modal-left-docked') || modal.classList.contains('modal-right-docked')))
143
+ || (content && (content._preDockSnapshot || content._dockSide || content._dockSuspended))
144
+ );
145
+ if (modal) {
146
+ const hadLeft = modal.classList.contains('modal-left-docked');
147
+ const hadRight = modal.classList.contains('modal-right-docked');
148
+ modal.classList.remove('modal-left-docked', 'modal-right-docked');
149
+ if (hadLeft) _clearDockSide('left', modal);
150
+ if (hadRight) _clearDockSide('right', modal);
151
+ if (modal._dockCloseWatcher) {
152
+ try { modal._dockCloseWatcher.obs && modal._dockCloseWatcher.obs.disconnect(); } catch (_) {}
153
+ try { modal._dockCloseWatcher.parentObs && modal._dockCloseWatcher.parentObs.disconnect(); } catch (_) {}
154
+ delete modal._dockCloseWatcher;
155
+ }
156
+ }
157
+ if (!content) return;
158
+ if (content._leftDockNavObs) {
159
+ try { content._leftDockNavObs.navObs.disconnect(); } catch (_) {}
160
+ try { window.removeEventListener('resize', content._leftDockNavObs.reanchor); } catch (_) {}
161
+ delete content._leftDockNavObs;
162
+ }
163
+ delete content._preDockSnapshot;
164
+ delete content._dockSide;
165
+ delete content._dockSuspended;
166
+ if (hadDockState) {
167
+ ['right', 'bottom', 'max-width', 'border-radius']
168
+ .forEach(p => content.style.removeProperty(p));
169
+ }
170
+ }
171
+
172
+ function _applySnap(content, rect, zoneName) {
173
+ // A tile-snap supersedes any edge-dock on this same modal. The two
174
+ // systems (windowDrag→modalSnap edge-dock, and this tile manager) both
175
+ // fire on a left/right-edge drag-release. If we leave modalSnap's
176
+ // `left-dock-active` body class + `--left-dock-w` padding in place, it
177
+ // reserves a strip on the left AND this manager's safe-rect already
178
+ // accounts for the sidebar's (now padding-shifted) position — the two
179
+ // double-count and jam the window to the right behind a massive empty
180
+ // zone, which gets worse each time the sidebar is toggled. Clear the
181
+ // orphaned edge-dock state so only the tile-snap positions the window.
182
+ const _modal = content.closest && content.closest('.modal, .research-overlay');
183
+ const _fromRect = content.getBoundingClientRect();
184
+ _clearEdgeDockResidue(_modal, content);
185
+
186
+ // Stash pre-snap geometry once; if we re-snap, keep the original. Capture a
187
+ // CONCRETE fixed position (from the rendered rect when the inline value is
188
+ // empty) and the position itself — otherwise un-snap restored empty left/top
189
+ // + no position, and the .modal flex parent re-centered the window.
190
+ if (!content.dataset._tilePreSnap) {
191
+ content.dataset._tilePreSnap = JSON.stringify({
192
+ position: 'fixed',
193
+ left: content.style.left || (Math.round(_fromRect.left) + 'px'),
194
+ top: content.style.top || (Math.round(_fromRect.top) + 'px'),
195
+ width: content.style.width,
196
+ height: content.style.height,
197
+ maxHeight: content.style.maxHeight,
198
+ transform: content.style.transform,
199
+ });
200
+ }
201
+ content.style.transition = 'left 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.22s cubic-bezier(0.34, 1.56, 0.64, 1)';
202
+ // Use !important — some modals (e.g. cookbook) carry inline width/height
203
+ // and CSS that otherwise re-center the .modal-content, which made the snap
204
+ // "jump back to the middle" on release.
205
+ content.style.setProperty('position', 'fixed', 'important');
206
+ content.style.setProperty('left', rect.left + 'px', 'important');
207
+ content.style.setProperty('top', rect.top + 'px', 'important');
208
+ content.style.setProperty('width', rect.width + 'px', 'important');
209
+ content.style.setProperty('height', rect.height + 'px', 'important');
210
+ content.style.setProperty('max-height', rect.height + 'px', 'important');
211
+ content.style.setProperty('margin', '0', 'important');
212
+ content.style.setProperty('transform', 'none', 'important');
213
+ content.dataset._tileZone = zoneName;
214
+ setTimeout(() => { content.style.transition = ''; }, 250);
215
+ }
216
+
217
+ function _unsnap(content) {
218
+ const pre = content.dataset._tilePreSnap;
219
+ if (!pre) return;
220
+ // Clear the !important snap props first — Object.assign can't override them.
221
+ ['position', 'left', 'top', 'width', 'height', 'max-height', 'margin', 'transform']
222
+ .forEach(p => content.style.removeProperty(p));
223
+ try {
224
+ const r = JSON.parse(pre);
225
+ Object.assign(content.style, r);
226
+ } catch {}
227
+ // Keep it a fixed floating window so the restored left/top actually take
228
+ // effect — without position:fixed the .modal flex parent re-centers it.
229
+ if (!content.style.position) content.style.position = 'fixed';
230
+ delete content.dataset._tilePreSnap;
231
+ delete content.dataset._tileZone;
232
+ }
233
+
234
+ function _findDragTarget(e) {
235
+ const header = e.target.closest('.modal-header');
236
+ if (!header) return null;
237
+ // Skip clicks on header buttons (close, minimize, etc.)
238
+ if (e.target.closest('button')) return null;
239
+ const modal = header.closest('.modal, .research-overlay');
240
+ if (!modal) return null;
241
+ const content = modal.querySelector('.modal-content, .research-pane');
242
+ return content || null;
243
+ }
244
+
245
+ document.addEventListener('pointerdown', (e) => {
246
+ if (!_isDesktop()) return;
247
+ const content = _findDragTarget(e);
248
+ if (!content) return;
249
+
250
+ // If we're already snapped, dragging away should unsnap immediately so the
251
+ // user can move freely.
252
+ if (content.dataset._tileZone) {
253
+ // Defer slightly so pointermove threshold is met before unsnap kicks in
254
+ _tracking = { content, startX: e.clientX, startY: e.clientY, willUnsnap: true };
255
+ } else {
256
+ _tracking = { content, startX: e.clientX, startY: e.clientY, willUnsnap: false };
257
+ }
258
+ });
259
+
260
+ document.addEventListener('pointermove', (e) => {
261
+ if (!_tracking) return;
262
+ if (!_isDesktop()) return;
263
+ const dx = e.clientX - _tracking.startX;
264
+ const dy = e.clientY - _tracking.startY;
265
+ if (Math.hypot(dx, dy) < 6) return;
266
+
267
+ // Unsnap on first significant move
268
+ if (_tracking.willUnsnap) {
269
+ _unsnap(_tracking.content);
270
+ _tracking.willUnsnap = false;
271
+ }
272
+
273
+ // Detect snap zone under cursor
274
+ const zone = _zoneForContent(_tracking.content, e.clientX, e.clientY);
275
+ if (zone) {
276
+ _showGhost(zone.rect);
277
+ _activeZone = zone;
278
+ } else {
279
+ _hideGhost();
280
+ _activeZone = null;
281
+ }
282
+ });
283
+
284
+ document.addEventListener('pointerup', () => {
285
+ if (!_tracking) return;
286
+ const t = _tracking;
287
+ _tracking = null;
288
+ _hideGhost();
289
+ if (_activeZone && _isDesktop()) {
290
+ _applySnap(t.content, _activeZone.rect, _activeZone.name);
291
+ }
292
+ _activeZone = null;
293
+ });
294
+
295
+ // Re-clamp every currently-snapped window so it keeps filling its zone after
296
+ // the safe-rect changes (viewport resize, sidebar toggle, etc.).
297
+ function _reclampAll(animate = false) {
298
+ document.querySelectorAll('.modal-content[data-_tile-zone], .research-pane[data-_tile-zone]').forEach(c => {
299
+ const name = c.dataset._tileZone;
300
+ if (!name) return;
301
+ const safe = _viewportSafeRect();
302
+ const W = safe.right - safe.left, H = safe.bottom - safe.top;
303
+ let r;
304
+ switch (name) {
305
+ case 'fullscreen': r = { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight }; break;
306
+ case 'maximize': r = { left: safe.left, top: safe.top, width: W, height: H }; break;
307
+ case 'left-half': r = { left: safe.left, top: safe.top, width: W/2, height: H }; break;
308
+ case 'right-half': r = { left: safe.left + W/2, top: safe.top, width: W/2, height: H }; break;
309
+ case 'bottom-half': r = { left: safe.left, top: safe.top + H/2, width: W, height: H/2 }; break;
310
+ case 'top-left': r = { left: safe.left, top: safe.top, width: W/2, height: H/2 }; break;
311
+ case 'top-right': r = { left: safe.left + W/2, top: safe.top, width: W/2, height: H/2 }; break;
312
+ case 'bottom-left': r = { left: safe.left, top: safe.top + H/2, width: W/2, height: H/2 }; break;
313
+ case 'bottom-right': r = { left: safe.left + W/2, top: safe.top + H/2, width: W/2, height: H/2 }; break;
314
+ default: return;
315
+ }
316
+ if (animate) {
317
+ c.style.transition = 'left 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.22s cubic-bezier(0.34, 1.56, 0.64, 1)';
318
+ setTimeout(() => { c.style.transition = ''; }, 250);
319
+ }
320
+ c.style.setProperty('left', r.left + 'px', 'important');
321
+ c.style.setProperty('top', r.top + 'px', 'important');
322
+ c.style.setProperty('width', r.width + 'px', 'important');
323
+ c.style.setProperty('height', r.height + 'px', 'important');
324
+ c.style.setProperty('max-height', r.height + 'px', 'important');
325
+ });
326
+ }
327
+
328
+ let _reclampPending = false;
329
+ function _reclampAllThrottled(animate) {
330
+ if (_reclampPending) return;
331
+ _reclampPending = true;
332
+ requestAnimationFrame(() => {
333
+ try { _reclampAll(animate); } finally { _reclampPending = false; }
334
+ });
335
+ }
336
+
337
+ window.addEventListener('resize', () => _reclampAllThrottled(false));
338
+
339
+ // Watch the sidebar's class attribute so toggling hidden/right-side re-tiles
340
+ // any snapped modal that was anchored to the old safe-rect.
341
+ function _watchSidebar() {
342
+ const sidebar = document.getElementById('sidebar');
343
+ if (!sidebar) {
344
+ // Sidebar may not be in the DOM yet during early init.
345
+ requestAnimationFrame(_watchSidebar);
346
+ return;
347
+ }
348
+ const mo = new MutationObserver(() => _reclampAllThrottled(true));
349
+ mo.observe(sidebar, { attributes: true, attributeFilter: ['class'] });
350
+ }
351
+ if (document.readyState === 'loading') {
352
+ document.addEventListener('DOMContentLoaded', _watchSidebar);
353
+ } else {
354
+ _watchSidebar();
355
+ }
356
+
357
+ // ── Public API for other drag sources (e.g. dragging a minimized dock chip
358
+ // to a screen edge) to reuse the same snap zones + ghost preview + apply. ──
359
+
360
+ // Show the snap-zone ghost for a point and return the zone (or null).
361
+ export function previewZoneAt(x, y, target = null) {
362
+ if (!_isDesktop()) { _hideGhost(); _activeZone = null; return null; }
363
+ const content = target && target.querySelector
364
+ ? (target.querySelector('.modal-content, .research-pane') || target)
365
+ : null;
366
+ const zone = content ? _zoneForContent(content, x, y) : _zoneForPointer(x, y);
367
+ if (zone) { _showGhost(zone.rect); _activeZone = zone; }
368
+ else { _hideGhost(); _activeZone = null; }
369
+ return zone;
370
+ }
371
+
372
+ export function clearPreview() {
373
+ _hideGhost();
374
+ _activeZone = null;
375
+ }
376
+
377
+ // Snap a modal (its .modal-content) into a previously-detected zone.
378
+ export function snapModalToZone(modal, zone) {
379
+ if (!modal || !zone) return;
380
+ const content = modal.querySelector ? (modal.querySelector('.modal-content, .research-pane') || modal) : modal;
381
+ if (!content) return;
382
+ if (modal.id === 'settings-modal' && zone.name !== 'right-half') return;
383
+ _applySnap(content, zone.rect, zone.name);
384
+ }
385
+
386
+ export {};
@@ -0,0 +1,133 @@
1
+ // tourAutoplay.js — auto-fires the matching `/tour-<x>` slash command the
2
+ // first time the user opens a tool modal. One-shot per modal: dismissed or
3
+ // not, the marker is set so reopens never auto-trigger again.
4
+ //
5
+ // Pairs with the existing tourHints.js (which shows a single global "drag
6
+ // title bar to snap" hint). Tours are richer per-feature walkthroughs.
7
+ //
8
+ // Mobile is excluded — tours position halos by rect math that doesn't fit
9
+ // the bottom-sheet layout cleanly.
10
+
11
+ import { handleSlashCommand } from './slashCommands.js';
12
+
13
+ // Modal id → slash command to fire (without the leading "/"). Add to this
14
+ // map when a new feature picks up a `tour-*` command.
15
+ const TOUR_FOR_MODAL = {
16
+ 'doclib-modal': 'tour-library',
17
+ 'cookbook-modal': 'tour-cookbook',
18
+ 'research-overlay': 'tour-research',
19
+ 'compare-model-overlay': 'tour-compare',
20
+ 'theme-modal': 'tour-theme',
21
+ 'settings-modal': 'tour-settings',
22
+ 'gallery-modal': 'tour-gallery',
23
+ };
24
+
25
+ const SEEN_KEY = (tour) => `zero-tour-autoplay-seen-${tour}`;
26
+
27
+ let _initialized = false;
28
+ // Suppress re-fire if a tour is already active or another modal opens while
29
+ // we're mid-tour. The slash command itself adds `body.tour-active` for the
30
+ // duration of its halos.
31
+ function _tourActive() {
32
+ return document.body.classList.contains('tour-active');
33
+ }
34
+
35
+ function _isVisible(el) {
36
+ if (!el || el.classList.contains('hidden')) return false;
37
+ if (el.style.display === 'none') return false;
38
+ const r = el.getBoundingClientRect();
39
+ return r.width > 0 && r.height > 0;
40
+ }
41
+
42
+ async function _maybeFire(modal) {
43
+ const id = modal.id;
44
+ const tour = TOUR_FOR_MODAL[id];
45
+ if (!tour) return;
46
+ if (_tourActive()) {
47
+ try { window.cancelActiveTour?.('modal-opened'); } catch (_) {}
48
+ return;
49
+ }
50
+ let seen = false;
51
+ try { seen = localStorage.getItem(SEEN_KEY(tour)) === '1'; } catch (_) {}
52
+ if (seen) return;
53
+ // Mark immediately so a quick double-trigger (e.g. modal-class observer
54
+ // fires twice during animation) can't queue two tours.
55
+ try { localStorage.setItem(SEEN_KEY(tour), '1'); } catch (_) {}
56
+ // Let the modal's own enter-animation settle before halos try to position
57
+ // off the title bar / first card / etc. ~400ms matches tourHints.
58
+ setTimeout(() => {
59
+ if (_tourActive()) return;
60
+ try {
61
+ handleSlashCommand('/' + tour);
62
+ } catch (e) {
63
+ // If firing fails we don't unmark — re-attempting on every modal open
64
+ // would be more annoying than a missed tour. User can run `/tour-x`
65
+ // manually from the chat input.
66
+ // eslint-disable-next-line no-console
67
+ console.warn(`Tour autoplay failed for ${id}:`, e);
68
+ }
69
+ }, 400);
70
+ }
71
+
72
+ function _watchModals() {
73
+ if (typeof MutationObserver === 'undefined') return;
74
+ const observer = new MutationObserver((muts) => {
75
+ for (const m of muts) {
76
+ if (m.attributeName !== 'class' && m.attributeName !== 'style') continue;
77
+ const el = m.target;
78
+ if (!(el instanceof HTMLElement)) continue;
79
+ if (!(el.id in TOUR_FOR_MODAL)) continue;
80
+ const wasHidden = !m.oldValue
81
+ || /\bhidden\b/.test(m.oldValue)
82
+ || /display:\s*none/.test(m.oldValue);
83
+ if (wasHidden && _isVisible(el)) _maybeFire(el);
84
+ }
85
+ });
86
+ // Observe each known target if it exists at boot…
87
+ Object.keys(TOUR_FOR_MODAL).forEach(id => {
88
+ const el = document.getElementById(id);
89
+ if (el) {
90
+ observer.observe(el, {
91
+ attributes: true,
92
+ attributeOldValue: true,
93
+ attributeFilter: ['class', 'style'],
94
+ });
95
+ }
96
+ });
97
+ // …and also for any matching modal added later (research overlay is
98
+ // appended on demand, for example).
99
+ const docObserver = new MutationObserver((muts) => {
100
+ for (const m of muts) {
101
+ m.addedNodes.forEach(node => {
102
+ if (!(node instanceof HTMLElement)) return;
103
+ if (node.id in TOUR_FOR_MODAL) {
104
+ observer.observe(node, {
105
+ attributes: true,
106
+ attributeOldValue: true,
107
+ attributeFilter: ['class', 'style'],
108
+ });
109
+ if (_isVisible(node)) _maybeFire(node);
110
+ }
111
+ });
112
+ }
113
+ });
114
+ docObserver.observe(document.body, { childList: true, subtree: false });
115
+ }
116
+
117
+ export function init() {
118
+ if (_initialized) return;
119
+ _initialized = true;
120
+ // Disabled for v1 stability: opening ordinary app windows must never
121
+ // auto-spawn tour overlays or interfere with close/backdrop behavior.
122
+ // Manual slash tours still work through slashCommands.js.
123
+ }
124
+
125
+ if (typeof window !== 'undefined') {
126
+ if (document.readyState === 'loading') {
127
+ document.addEventListener('DOMContentLoaded', init);
128
+ } else {
129
+ init();
130
+ }
131
+ }
132
+
133
+ export default { init };