@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,782 @@
1
+ // Right-edge snap docking for draggable modals.
2
+ //
3
+ // Adds a "drag-to-right" gesture that docks a modal as a right-side panel
4
+ // (mirrors the snap-to-top fullscreen pattern used by _makeDraggable in
5
+ // emailLibrary.js / documentLibrary.js / galleryEditor.js). While docked:
6
+ // - the modal-content lives at `right: 0; top: 0; bottom: 0` with a
7
+ // viewport-fraction width
8
+ // - body gets `right-dock-active` + `--right-dock-w` so the chat /
9
+ // doc panel / notes pane underneath reserves room via padding-right
10
+ // - if the remaining chat width would drop under 380px, the wide
11
+ // sidebar auto-collapses to the icon rail (mirrors notes-view UX)
12
+ //
13
+ // Drag-away from the right edge un-docks back to a centered window —
14
+ // the same restore values the snap-to-top exit path uses.
15
+
16
+ // Wider snap zone than the top-snap fullscreen (6px) — the right edge
17
+ // is harder to hit precisely since most users drag broadly toward the
18
+ // side rather than aiming at a 1px line. 60px feels generous without
19
+ // false-positive triggers from casual repositioning.
20
+ const SNAP_PX = 60;
21
+ const UNSNAP_PX = 80;
22
+ const MIN_CHAT_WIDTH = 380;
23
+ const EMAIL_DOC_SPLIT_WIDTH_KEY = 'zero-email-doc-split-width';
24
+
25
+ function _dockClassForSide(side) {
26
+ return side === 'left' ? 'modal-left-docked' : 'modal-right-docked';
27
+ }
28
+
29
+ function _hasOtherDockedWindow(side, owner) {
30
+ const cls = _dockClassForSide(side);
31
+ return Array.from(document.querySelectorAll(`.${cls}`)).some((el) => {
32
+ if (!el || el === owner) return false;
33
+ if (owner && el.contains && el.contains(owner)) return false;
34
+ if (owner && owner.contains && owner.contains(el)) return false;
35
+ return true;
36
+ });
37
+ }
38
+
39
+ function _hasAnyOtherDockedWindow(owner) {
40
+ return _hasOtherDockedWindow('left', owner) || _hasOtherDockedWindow('right', owner);
41
+ }
42
+
43
+ export function clearDockSide(side, owner = null) {
44
+ if (side !== 'left' && side !== 'right') return;
45
+ if (_hasOtherDockedWindow(side, owner)) return;
46
+ document.body.classList.remove(side === 'left' ? 'left-dock-active' : 'right-dock-active');
47
+ document.documentElement.style.removeProperty(side === 'left' ? '--left-dock-w' : '--right-dock-w');
48
+ if (side === 'left') {
49
+ try { window._restoreSidebarIfRouteCollapsed?.(); } catch (_) {}
50
+ }
51
+ }
52
+
53
+ // Default dock width: ~38% of viewport, clamped to a reasonable band.
54
+ function _defaultDockWidth() {
55
+ return Math.min(640, Math.max(420, Math.round(window.innerWidth * 0.38)));
56
+ }
57
+
58
+ function _showSnapHint(on, side = 'right') {
59
+ const cls = side === 'left' ? 'modal-snap-hint-left' : 'modal-snap-hint-right';
60
+ let hint = document.querySelector('.' + cls);
61
+ if (!on) {
62
+ if (hint) hint.remove();
63
+ return;
64
+ }
65
+ if (hint) return;
66
+ hint = document.createElement('div');
67
+ hint.className = 'modal-snap-hint ' + cls;
68
+ const w = _defaultDockWidth();
69
+ const edge = side === 'left' ? 'left:0' : 'right:0';
70
+ const borderSide = side === 'left' ? 'border-right' : 'border-left';
71
+ hint.style.cssText = `position:fixed;${edge};top:0;bottom:0;width:${w}px;background:color-mix(in srgb, var(--accent-primary, #60a5fa) 12%, transparent);${borderSide}:2px dashed color-mix(in srgb, var(--accent-primary, #60a5fa) 60%, transparent);z-index:9998;pointer-events:none;transition:opacity 0.12s;`;
72
+ document.body.appendChild(hint);
73
+ }
74
+
75
+ // Check if the body's current chat area would be narrower than the
76
+ // MIN_CHAT_WIDTH floor after reserving dockW pixels on the right. Returns
77
+ // true if the wide sidebar should be collapsed to the rail.
78
+ function _shouldAutoCollapseSidebar(dockW) {
79
+ const sidebar = document.getElementById('sidebar');
80
+ const rail = document.getElementById('icon-rail');
81
+ if (!sidebar) return false;
82
+ const sidebarHidden = sidebar.classList.contains('hidden');
83
+ if (sidebarHidden) return false;
84
+ const sb = sidebar.getBoundingClientRect().width || 0;
85
+ const rl = (rail && window.getComputedStyle(rail).display !== 'none')
86
+ ? rail.getBoundingClientRect().width
87
+ : 0;
88
+ const remaining = window.innerWidth - sb - rl - dockW;
89
+ return remaining < MIN_CHAT_WIDTH;
90
+ }
91
+
92
+ // Right edge (px) of whatever left navigation is currently showing — the
93
+ // expanded sidebar if visible, otherwise the icon rail. Used to anchor the
94
+ // left dock so it always sits flush to the right of the nav.
95
+ function _leftNavRight() {
96
+ const sidebar = document.getElementById('sidebar');
97
+ const rail = document.getElementById('icon-rail');
98
+ let x = 0;
99
+ if (sidebar && !sidebar.classList.contains('hidden')) {
100
+ const r = sidebar.getBoundingClientRect();
101
+ if (r.width) x = Math.max(x, r.right);
102
+ }
103
+ if (rail && window.getComputedStyle(rail).display !== 'none') {
104
+ const r = rail.getBoundingClientRect();
105
+ if (r.width) x = Math.max(x, r.right);
106
+ }
107
+ return x;
108
+ }
109
+
110
+ function _clampEmailDocSplitWidth(width, left = _leftNavRight()) {
111
+ const available = Math.max(0, window.innerWidth - left);
112
+ if (!available) return 0;
113
+ const compact = available < 760;
114
+ const minEmail = compact ? 260 : 340;
115
+ const minDoc = compact ? 260 : 360;
116
+ const maxEmail = Math.max(minEmail, available - minDoc);
117
+ return Math.min(maxEmail, Math.max(minEmail, Math.round(width)));
118
+ }
119
+
120
+ function _storedEmailDocSplitWidth() {
121
+ try {
122
+ const raw = localStorage.getItem(EMAIL_DOC_SPLIT_WIDTH_KEY);
123
+ const n = parseFloat(raw || '');
124
+ return Number.isFinite(n) && n > 0 ? n : null;
125
+ } catch (_) {
126
+ return null;
127
+ }
128
+ }
129
+
130
+ function _saveEmailDocSplitWidth(width) {
131
+ try { localStorage.setItem(EMAIL_DOC_SPLIT_WIDTH_KEY, String(Math.round(width))); } catch (_) {}
132
+ }
133
+
134
+ function _disconnectLeftDockObservers(content) {
135
+ if (!content?._leftDockNavObs) return;
136
+ const obs = content._leftDockNavObs;
137
+ try { obs.navObs && obs.navObs.disconnect(); } catch (_) {}
138
+ try { obs.bodyObs && obs.bodyObs.disconnect(); } catch (_) {}
139
+ try { obs.disconnectDocObs && obs.disconnectDocObs(); } catch (_) {}
140
+ try { window.removeEventListener('resize', obs.reanchor); } catch (_) {}
141
+ delete content._leftDockNavObs;
142
+ }
143
+
144
+ function _applyEmailDocSplitGeometry(left, emailWidth) {
145
+ const x = left + emailWidth;
146
+ document.documentElement.style.setProperty('--email-doc-split-left-x', `${left}px`);
147
+ document.documentElement.style.setProperty('--email-doc-split-email-w', `${emailWidth}px`);
148
+ document.documentElement.style.setProperty('--email-doc-split-right-x', `${x}px`);
149
+
150
+ // emailLibrary.js pins the document pane with inline !important styles
151
+ // after opening a document beside a snapped email. Update that inline
152
+ // geometry too, otherwise the email resizes but the document stays put.
153
+ const docPane = document.getElementById('doc-editor-pane');
154
+ if (!docPane || window.innerWidth <= 768) return;
155
+ docPane.style.setProperty('position', 'fixed', 'important');
156
+ docPane.style.setProperty('left', `${x}px`, 'important');
157
+ docPane.style.setProperty('right', '0px', 'important');
158
+ docPane.style.setProperty('top', '0px', 'important');
159
+ docPane.style.setProperty('bottom', '0px', 'important');
160
+ docPane.style.setProperty('width', 'auto', 'important');
161
+ docPane.style.setProperty('max-width', 'none', 'important');
162
+ docPane.style.setProperty('height', '100vh', 'important');
163
+ docPane.style.setProperty('z-index', '260', 'important');
164
+ docPane.style.setProperty('transform', 'none', 'important');
165
+ }
166
+
167
+ function _clearEmailDocSplitGeometry() {
168
+ document.body.classList.remove('email-doc-split-active');
169
+ document.documentElement.style.removeProperty('--email-doc-split-left-x');
170
+ document.documentElement.style.removeProperty('--email-doc-split-email-w');
171
+ document.documentElement.style.removeProperty('--email-doc-split-right-x');
172
+ const docPane = document.getElementById('doc-editor-pane');
173
+ if (!docPane) return;
174
+ [
175
+ 'position', 'left', 'right', 'top', 'bottom', 'width', 'max-width',
176
+ 'height', 'z-index', 'transform',
177
+ ].forEach(prop => docPane.style.removeProperty(prop));
178
+ }
179
+
180
+ function _resolveEmailDocSplitWidth(content, left) {
181
+ const available = Math.max(0, window.innerWidth - left);
182
+ const fallback = Math.max(440, available * 0.55);
183
+ const requested = content?._emailDocSplitUserW || _storedEmailDocSplitWidth() || fallback;
184
+ return _clampEmailDocSplitWidth(requested, left);
185
+ }
186
+
187
+ // Position a left-docked window flush against the current left nav, covering
188
+ // the chat area. Re-run whenever the sidebar is toggled so the window slides
189
+ // to follow the nav instead of being covered by it.
190
+ //
191
+ // Also: if the document editor pane is rendered to the right of the chat
192
+ // area, cap the email's right edge to stop just before it so the two share
193
+ // the row instead of overlapping. Pure geometry read — no CSS class changes
194
+ // (the previous attempt that flipped body classes here caused layout thrash
195
+ // and broke the whole tab).
196
+ function _anchorLeftDock(content) {
197
+ if (!content || content._dockSide !== 'left') return;
198
+ const left = _leftNavRight();
199
+ const w = _resolveEmailDocSplitWidth(content, left);
200
+ content.style.left = left + 'px';
201
+ content.style.width = w + 'px';
202
+ content.style.maxWidth = w + 'px';
203
+ // If a document is also open, drive the existing email/doc-split CSS rule
204
+ // (style.css `body.email-doc-split-active.doc-view .doc-editor-pane`) so
205
+ // the doc-pane becomes position:fixed starting at the email's right edge.
206
+ // No flex/max-width fighting; the doc just owns the right side from the
207
+ // email's right edge to the viewport edge — they touch flush, no gap.
208
+ const docOpen = document.body.classList.contains('doc-view');
209
+ if (docOpen) {
210
+ if (!document.body.classList.contains('email-doc-split-active')) {
211
+ document.body.classList.add('email-doc-split-active');
212
+ }
213
+ _applyEmailDocSplitGeometry(left, w);
214
+ } else if (document.body.classList.contains('email-doc-split-active')) {
215
+ _clearEmailDocSplitGeometry();
216
+ }
217
+ }
218
+
219
+ function _collapseSidebarToRail() {
220
+ const sidebar = document.getElementById('sidebar');
221
+ const rail = document.getElementById('icon-rail');
222
+ if (!sidebar || !rail) return;
223
+ // Mark the collapse as route/dock-driven so the paired restore in
224
+ // app.js (window._restoreSidebarIfRouteCollapsed) knows it owns the
225
+ // un-collapse. Same marker the /email and /notes openers use — they
226
+ // can't both be active at once so no conflict.
227
+ if (!sidebar.classList.contains('hidden')) {
228
+ document.body.dataset.routeCollapsedSidebar = '1';
229
+ }
230
+ sidebar.classList.add('hidden');
231
+ rail.classList.remove('rail-hidden');
232
+ try { window.syncRailSide && window.syncRailSide(); } catch (_) {}
233
+ }
234
+
235
+ // Resolve the dock target. For .modal containers, the inner .modal-content
236
+ // is what we position; for standalone panes (research, compare, etc.) the
237
+ // passed element itself is both the container and the content. Returns
238
+ // {modal, content} or null when nothing usable was passed in.
239
+ function _resolveDockNodes(target) {
240
+ if (!target) return null;
241
+ const content = target.querySelector
242
+ ? (target.querySelector('.modal-content') || target)
243
+ : target;
244
+ return { modal: target, content };
245
+ }
246
+
247
+ // Apply edge dock state to a modal/pane. `side` is 'right' (default) or 'left'.
248
+ export function applyEdgeDock(modal, side = 'right', dockClass) {
249
+ if (!dockClass) dockClass = side === 'left' ? 'modal-left-docked' : 'modal-right-docked';
250
+ return _applyDockInternal(modal, side, dockClass);
251
+ }
252
+
253
+ // Backwards-compat: existing callers use applyRightDock for right snaps.
254
+ export function applyRightDock(modal, dockClass = 'modal-right-docked') {
255
+ return _applyDockInternal(modal, 'right', dockClass);
256
+ }
257
+
258
+ function _applyDockInternal(modal, side, dockClass) {
259
+ const nodes = _resolveDockNodes(modal);
260
+ if (!nodes) return 0;
261
+ const content = nodes.content;
262
+ if (!content) return 0;
263
+ // If the modal is currently docked on the OTHER side (e.g. the user
264
+ // manually docked it right, then a reply re-docks it left), clear that
265
+ // side's class + body push first. Otherwise both sides' state coexist —
266
+ // the old dock keeps pushing/overlapping and the reply doc opens beneath
267
+ // the still-docked window. We keep _preDockSnapshot (the guard below skips
268
+ // re-capturing) so un-dock still restores the original floating geometry.
269
+ // Guarded on the other-side class so a normal first dock still snapshots
270
+ // the floating window's real left/right inline styles below.
271
+ const otherSide = side === 'left' ? 'right' : 'left';
272
+ const otherClass = _dockClassForSide(otherSide);
273
+ if (modal.classList.contains(otherClass)) {
274
+ modal.classList.remove(otherClass);
275
+ clearDockSide(otherSide, modal);
276
+ // Reset the edge anchors so the new side positions from a clean slate
277
+ // (the right dock pins right:0; the left dock pins left:<nav>).
278
+ content.style.left = '';
279
+ content.style.right = '';
280
+ }
281
+ // Snapshot the actual rendered rect + inline styles so un-dock can
282
+ // restore the exact same floating window the user had before. Without
283
+ // this, a window the user had carefully resized would snap back to
284
+ // some 720×85vh default — feels like the dock ate their layout.
285
+ if (!content._preDockSnapshot) {
286
+ const r = content.getBoundingClientRect();
287
+ content._preDockSnapshot = {
288
+ rect: { left: r.left, top: r.top, width: r.width, height: r.height },
289
+ style: {
290
+ position: content.style.position,
291
+ left: content.style.left,
292
+ top: content.style.top,
293
+ right: content.style.right,
294
+ bottom: content.style.bottom,
295
+ width: content.style.width,
296
+ maxWidth: content.style.maxWidth,
297
+ height: content.style.height,
298
+ maxHeight: content.style.maxHeight,
299
+ borderRadius: content.style.borderRadius,
300
+ transform: content.style.transform,
301
+ margin: content.style.margin,
302
+ },
303
+ // Track whether we collapsed the wide sidebar — only restore it
304
+ // on un-dock if the dock was responsible for the collapse.
305
+ collapsedSidebar: false,
306
+ };
307
+ }
308
+ modal.classList.add(dockClass);
309
+ content.style.position = 'fixed';
310
+ content.style.top = '0';
311
+ content.style.bottom = '0';
312
+ content.style.height = '100vh';
313
+ content.style.maxHeight = '100vh';
314
+ content.style.borderRadius = '0';
315
+ content.style.transform = 'none';
316
+ content.style.margin = '0';
317
+ let w;
318
+ if (side === 'left') {
319
+ // Email-style left dock: collapse the sidebar to the icon rail, then
320
+ // OVERLAY the window beside the rail, covering the chat area. We anchor
321
+ // at the rail's right edge (so it sits to the RIGHT of the rail — not
322
+ // left of the sidebar) and DON'T reserve body padding (so it covers the
323
+ // chat rather than pushing it), leaving the right side free for the doc.
324
+ _collapseSidebarToRail();
325
+ content._preDockSnapshot.collapsedSidebar = true;
326
+ content.style.right = 'auto';
327
+ content._dockSide = 'left';
328
+ _anchorLeftDock(content);
329
+ w = parseFloat(content.style.width) || 0;
330
+ document.body.classList.add('left-dock-active');
331
+ document.documentElement.style.setProperty('--left-dock-w', '0px'); // overlay, no push
332
+ // Re-anchor the email when the sidebar is toggled (expanded/collapsed) so
333
+ // the nav slides the window over instead of growing on top of it. Also
334
+ // re-anchor when the document editor pane appears/disappears (signaled by
335
+ // body.doc-view) AND when the user drags the doc divider to resize it
336
+ // (ResizeObserver) so the email shrinks/grows inversely to keep the two
337
+ // sharing the row cleanly.
338
+ if (!content._leftDockNavObs && typeof MutationObserver !== 'undefined') {
339
+ const sidebar = document.getElementById('sidebar');
340
+ const _doAnchor = () => {
341
+ if (modal.classList.contains(dockClass)) _anchorLeftDock(content);
342
+ };
343
+ const reanchor = () => {
344
+ if (!modal.classList.contains(dockClass)) return;
345
+ _doAnchor();
346
+ // Multi-stage settle: the dock-flip + sidebar collapse + doc mount
347
+ // each have their own transition timing (160ms / ~240ms / variable).
348
+ // Re-measure at each plausible settle point so the email lands flush
349
+ // against the doc's FINAL position, not a mid-transition snapshot.
350
+ requestAnimationFrame(_doAnchor);
351
+ setTimeout(_doAnchor, 80);
352
+ setTimeout(_doAnchor, 250);
353
+ setTimeout(_doAnchor, 500);
354
+ };
355
+ const navObs = new MutationObserver(reanchor);
356
+ if (sidebar) navObs.observe(sidebar, { attributes: true, attributeFilter: ['class', 'style'] });
357
+ // Only react to doc-view toggling — NOT to every body attribute mutation.
358
+ // Listening broadly caused thrashing last time and crashed the tab.
359
+ let _lastDocView = document.body.classList.contains('doc-view');
360
+ const bodyObs = new MutationObserver(() => {
361
+ const cur = document.body.classList.contains('doc-view');
362
+ if (cur !== _lastDocView) {
363
+ _lastDocView = cur;
364
+ reanchor();
365
+ // Rebind the resize observer — the doc pane gets created/destroyed
366
+ // when doc-view flips, so the previous target may be stale.
367
+ _bindDocResizeObs();
368
+ }
369
+ });
370
+ bodyObs.observe(document.body, { attributes: true, attributeFilter: ['class'] });
371
+
372
+ // ResizeObserver on the current .doc-editor-pane so dragging its
373
+ // divider live-reflows the email's right edge. Also observe
374
+ // #chat-container — its width changes when the sidebar collapses,
375
+ // when right-dock padding drains, or when doc content paint reflows
376
+ // the row, all of which shift the doc pane's left edge without
377
+ // necessarily resizing the doc pane itself.
378
+ let docResizeObs = null;
379
+ let chatResizeObs = null;
380
+ const _bindDocResizeObs = () => {
381
+ if (docResizeObs) { try { docResizeObs.disconnect(); } catch (_) {} docResizeObs = null; }
382
+ if (chatResizeObs) { try { chatResizeObs.disconnect(); } catch (_) {} chatResizeObs = null; }
383
+ if (typeof ResizeObserver === 'undefined') return;
384
+ const docPane = document.querySelector('.doc-editor-pane');
385
+ if (docPane) {
386
+ docResizeObs = new ResizeObserver(reanchor);
387
+ docResizeObs.observe(docPane);
388
+ }
389
+ const chatPane = document.getElementById('chat-container');
390
+ if (chatPane) {
391
+ chatResizeObs = new ResizeObserver(reanchor);
392
+ chatResizeObs.observe(chatPane);
393
+ }
394
+ };
395
+ _bindDocResizeObs();
396
+
397
+ window.addEventListener('resize', reanchor);
398
+ content._leftDockNavObs = {
399
+ navObs,
400
+ bodyObs,
401
+ reanchor,
402
+ disconnectDocObs: () => {
403
+ try { docResizeObs && docResizeObs.disconnect(); } catch (_) {}
404
+ try { chatResizeObs && chatResizeObs.disconnect(); } catch (_) {}
405
+ },
406
+ };
407
+ }
408
+ } else {
409
+ w = _defaultDockWidth();
410
+ content.style.left = 'auto';
411
+ content.style.right = '0';
412
+ content.style.width = w + 'px';
413
+ content.style.maxWidth = w + 'px';
414
+ document.body.classList.add('right-dock-active');
415
+ document.documentElement.style.setProperty('--right-dock-w', w + 'px');
416
+ if (_shouldAutoCollapseSidebar(w)) {
417
+ _collapseSidebarToRail();
418
+ content._preDockSnapshot.collapsedSidebar = true;
419
+ }
420
+ }
421
+ content._dockSide = side;
422
+ // Watch for the docked modal disappearing (removed from DOM or hidden
423
+ // via .hidden class) and clean up the body padding + sidebar in that
424
+ // case. Without this, closing a docked window leaves a phantom strip
425
+ // of empty space on the right because nothing tells the body to drop
426
+ // its padding-right.
427
+ if (!modal._dockCloseWatcher && typeof MutationObserver !== 'undefined') {
428
+ const onGone = () => _onDockedModalGone(modal, dockClass);
429
+ // Watch the modal for: the `.hidden` class flip, an inline
430
+ // `display:none` (how the draggable modals — calendar, plan, workspace,
431
+ // etc. — actually close), and parent removal. Without the `style` filter
432
+ // a display:none close left the body's dock padding on, so the chat
433
+ // stayed shifted after the docked modal was closed.
434
+ const _isGone = () => !modal.isConnected
435
+ || modal.classList.contains('hidden')
436
+ || modal.style.display === 'none';
437
+ const obs = new MutationObserver(() => { if (_isGone()) onGone(); });
438
+ obs.observe(modal, { attributes: true, attributeFilter: ['class', 'style'] });
439
+ // A second observer catches DOM removal — childList on the parent
440
+ // is the reliable signal for `.remove()` / `.removeChild()` calls.
441
+ if (modal.parentNode) {
442
+ const parentObs = new MutationObserver(() => {
443
+ if (!modal.isConnected) onGone();
444
+ });
445
+ parentObs.observe(modal.parentNode, { childList: true });
446
+ modal._dockCloseWatcher = { obs, parentObs };
447
+ } else {
448
+ modal._dockCloseWatcher = { obs };
449
+ }
450
+ }
451
+ return w;
452
+ }
453
+
454
+ // Internal: tear down dock state when a docked modal vanishes (close
455
+ // button, X, escape, or programmatic removal). Idempotent — bails out
456
+ // if the dock is already cleared so multiple observers can fire safely.
457
+ function _onDockedModalGone(modal, dockClass) {
458
+ if (!modal) return;
459
+ const watcher = modal._dockCloseWatcher;
460
+ if (watcher) {
461
+ try { watcher.obs && watcher.obs.disconnect(); } catch (_) {}
462
+ try { watcher.parentObs && watcher.parentObs.disconnect(); } catch (_) {}
463
+ delete modal._dockCloseWatcher;
464
+ }
465
+ const _c = modal.querySelector ? modal.querySelector('.modal-content') : null;
466
+ _disconnectLeftDockObservers(_c);
467
+ const hadRight = modal.classList.contains('modal-right-docked');
468
+ const hadLeft = modal.classList.contains('modal-left-docked');
469
+ // Clear body-level dock state only for the side this modal owned, and only
470
+ // when another docked window is not still using that side.
471
+ if (hadRight) clearDockSide('right', modal);
472
+ if (hadLeft) clearDockSide('left', modal);
473
+ // Tear down the email/doc split CSS vars we set in _anchorLeftDock so the
474
+ // doc-pane returns to its natural flex layout when the email is closed.
475
+ if (hadLeft && !_hasOtherDockedWindow('left', modal)) {
476
+ _clearEmailDocSplitGeometry();
477
+ }
478
+ if (_c?._preDockSnapshot?.collapsedSidebar && !_hasAnyOtherDockedWindow(modal)) {
479
+ _expandSidebarFromRail();
480
+ }
481
+ modal.classList.remove('modal-right-docked');
482
+ modal.classList.remove('modal-left-docked');
483
+ // Clear the content's docked inline geometry. Singleton modals (plan,
484
+ // workspace, calendar, …) reuse the same element across open/close, so if we
485
+ // only drop the body push the element stays positioned (position:fixed;
486
+ // right:0; fixed width) on the next open — floating over the chat with no
487
+ // push. We deliberately do NOT restore the pre-dock snapshot here: that
488
+ // snapshot is the drag position from when the user pulled the window to the
489
+ // edge (near the side), so restoring it would reopen the modal off to the
490
+ // side, still overlapping. Clearing the inline styles lets the modal reopen
491
+ // at its CSS default (centered). Drag-to-undock still uses clearRightDock,
492
+ // which DOES restore the snapshot for the peel-off feel.
493
+ if (_c) {
494
+ for (const prop of ['position', 'inset', 'left', 'top', 'right', 'bottom',
495
+ 'width', 'maxWidth', 'height', 'maxHeight',
496
+ 'borderRadius', 'transform', 'margin']) {
497
+ _c.style[prop] = '';
498
+ }
499
+ delete _c._preDockSnapshot;
500
+ delete _c._dockSide;
501
+ }
502
+ }
503
+
504
+ function _expandSidebarFromRail() {
505
+ const sidebar = document.getElementById('sidebar');
506
+ if (!sidebar) return;
507
+ sidebar.classList.remove('hidden');
508
+ try { window.syncRailSide && window.syncRailSide(); } catch (_) {}
509
+ }
510
+
511
+ // Un-dock a previously docked modal. Restores the exact rendered size +
512
+ // position the modal had before being docked. (cx, cy) re-anchors the
513
+ // drag near the cursor so the panel feels like it peeled off the edge.
514
+ export function clearRightDock(modal, cx, cy, dockClass) {
515
+ const nodes = _resolveDockNodes(modal);
516
+ if (!nodes) return;
517
+ const content = nodes.content;
518
+ if (!content) return;
519
+ // Figure out which side was docked — fall back to right for legacy callers.
520
+ const side = content._dockSide || (modal.classList.contains('modal-left-docked') ? 'left' : 'right');
521
+ if (!dockClass) dockClass = side === 'left' ? 'modal-left-docked' : 'modal-right-docked';
522
+ if (!modal.classList.contains(dockClass)) return;
523
+ modal.classList.remove(dockClass);
524
+ clearDockSide(side, modal);
525
+ if (side === 'left' && !_hasOtherDockedWindow('left', modal)) {
526
+ _clearEmailDocSplitGeometry();
527
+ }
528
+ delete content._dockSide;
529
+ _disconnectLeftDockObservers(content);
530
+ const snap = content._preDockSnapshot;
531
+ // Re-expand the wide sidebar if we collapsed it — but only if the
532
+ // user didn't manually toggle it during the dock (we don't want to
533
+ // override their explicit choice).
534
+ if (snap && snap.collapsedSidebar && !_hasAnyOtherDockedWindow(modal)) _expandSidebarFromRail();
535
+ // Restore the exact inline style values the modal had before docking
536
+ // (width: min(720px, 92vw), max-height: 85vh, etc. — whatever the
537
+ // mount path set). Setting an empty string here removes the property
538
+ // from the inline style attribute, letting CSS rules take back over.
539
+ const r = snap && snap.rect;
540
+ const sty = (snap && snap.style) || {};
541
+ content.style.position = sty.position || 'fixed';
542
+ content.style.right = sty.right || '';
543
+ content.style.bottom = sty.bottom || '';
544
+ // Inline width/height may have been empty on the original (CSS-driven)
545
+ // modal — but we're now forcing position:fixed, which kills the
546
+ // CSS-flex-centered layout that produced the original size. Without a
547
+ // fallback, position:fixed + width:auto collapses the window to its
548
+ // content's min-width and the user sees a tiny pane after undock.
549
+ // Use the captured rendered rect as a backup so the floating window
550
+ // returns at roughly the same dimensions it had before docking.
551
+ content.style.width = sty.width || (r && r.width ? r.width + 'px' : '');
552
+ content.style.maxWidth = sty.maxWidth || '';
553
+ content.style.height = sty.height || (r && r.height ? r.height + 'px' : '');
554
+ content.style.maxHeight = sty.maxHeight || '';
555
+ content.style.borderRadius = sty.borderRadius || '';
556
+ content.style.transform = sty.transform || '';
557
+ content.style.margin = sty.margin || '';
558
+ // Re-anchor near the cursor so the panel feels peeled-off the edge.
559
+ // Use the captured rect width as the centering reference (CSS may not
560
+ // have resolved the inline width yet on this microtask). Fall back to
561
+ // the original captured left/top when no cursor coords are passed.
562
+ const refW = (r && r.width) || content.offsetWidth || 720;
563
+ const refH = (r && r.height) || content.offsetHeight || (window.innerHeight * 0.7);
564
+ const targetLeft = (typeof cx === 'number')
565
+ ? Math.max(8, cx - refW / 2)
566
+ : (sty.left || (r ? r.left + 'px' : Math.max(8, (window.innerWidth - refW) / 2) + 'px'));
567
+ const targetTop = (typeof cy === 'number')
568
+ ? Math.max(8, cy - 20)
569
+ : (sty.top || (r ? r.top + 'px' : Math.max(8, (window.innerHeight - refH) / 3) + 'px'));
570
+ content.style.left = (typeof targetLeft === 'number') ? targetLeft + 'px' : targetLeft;
571
+ content.style.top = (typeof targetTop === 'number') ? targetTop + 'px' : targetTop;
572
+ delete content._preDockSnapshot;
573
+ delete content._dockSuspended;
574
+ }
575
+
576
+ // Temporarily release a docked modal's body push (chat returns to full
577
+ // width) WITHOUT un-docking the window — used when a docked modal is
578
+ // MINIMIZED. The modal keeps its docked geometry + class + snapshot so
579
+ // resumeDock() can snap it right back when the chip is reopened. Returns the
580
+ // docked side, or null if the modal wasn't docked.
581
+ export function suspendDock(modal) {
582
+ const nodes = _resolveDockNodes(modal);
583
+ if (!nodes || !nodes.content) return null;
584
+ const content = nodes.content;
585
+ const hadEmailSnapLeft = modal.classList.contains('email-snap-left');
586
+ const side = content._dockSide
587
+ || (modal.classList.contains('modal-left-docked') ? 'left'
588
+ : modal.classList.contains('email-snap-left') ? 'left'
589
+ : modal.classList.contains('modal-right-docked') ? 'right' : null);
590
+ if (!side) return null;
591
+ // Stop the close-watcher from tearing the dock fully down when `.hidden`
592
+ // is added by minimize — we want to keep the dock, just release the push.
593
+ if (modal._dockCloseWatcher) {
594
+ try { modal._dockCloseWatcher.obs && modal._dockCloseWatcher.obs.disconnect(); } catch (_) {}
595
+ try { modal._dockCloseWatcher.parentObs && modal._dockCloseWatcher.parentObs.disconnect(); } catch (_) {}
596
+ delete modal._dockCloseWatcher;
597
+ }
598
+ // Release the body push + restore the sidebar so the chat fills the width.
599
+ clearDockSide(side, modal);
600
+ if (side === 'left') {
601
+ _disconnectLeftDockObservers(content);
602
+ }
603
+ if (hadEmailSnapLeft) {
604
+ modal.classList.remove('email-snap-left');
605
+ _clearEmailDocSplitGeometry();
606
+ delete content._dockSide;
607
+ delete content._dockSuspended;
608
+ return null;
609
+ }
610
+ if (side === 'left' && !_hasOtherDockedWindow('left', modal)) {
611
+ _clearEmailDocSplitGeometry();
612
+ }
613
+ if (content._preDockSnapshot?.collapsedSidebar && !_hasAnyOtherDockedWindow(modal)) {
614
+ _expandSidebarFromRail();
615
+ }
616
+ content._dockSuspended = side;
617
+ return side;
618
+ }
619
+
620
+ // Re-apply the body push (+ sidebar collapse + width var + close-watcher)
621
+ // for a modal that was suspendDock()'d, so RESTORING a minimized docked
622
+ // window nudges the chat back in. Idempotent via applyEdgeDock's guarded
623
+ // snapshot. Returns true if a suspended dock was resumed.
624
+ export function resumeDock(modal) {
625
+ const nodes = _resolveDockNodes(modal);
626
+ if (!nodes || !nodes.content) return false;
627
+ const content = nodes.content;
628
+ const side = content._dockSuspended;
629
+ if (!side) return false;
630
+ delete content._dockSuspended;
631
+ try { applyEdgeDock(modal, side); } catch (_) {}
632
+ return true;
633
+ }
634
+
635
+ // Wire right-edge snap detection into a drag session. Call this once per
636
+ // modal that should support docking. Returns an object the caller's drag
637
+ // handler can poll: { hovering(): boolean, commit(): void, release(): void }.
638
+ // The drag handler is responsible for calling onMove(clientX, clientY)
639
+ // during mousemove and commit() at mouseup if hovering().
640
+ export function makeRightDockController(modal, dockClass = 'modal-right-docked') {
641
+ return makeEdgeDockController(modal, 'right', dockClass);
642
+ }
643
+
644
+ // Read live rail+sidebar width — used as the LEFT "edge" for snap
645
+ // detection, since the visible left boundary the user can drag to is
646
+ // the nav, not x=0 (the rail covers 0..48 and the wide sidebar covers
647
+ // 0..~290 when open).
648
+ function _leftNavWidth() {
649
+ const rs = getComputedStyle(document.documentElement);
650
+ const rail = parseInt(rs.getPropertyValue('--icon-rail-w') || '48', 10) || 0;
651
+ const sb = parseInt(rs.getPropertyValue('--sidebar-w') || '0', 10) || 0;
652
+ return rail + sb;
653
+ }
654
+
655
+ // Generic edge-snap controller. `side` is 'left' or 'right'. Same pattern
656
+ // as the original right-only controller: caller drives onMove during
657
+ // mousemove, then calls commit()/release() at mouseup based on hovering().
658
+ export function makeEdgeDockController(modal, side = 'right', dockClass) {
659
+ if (!dockClass) dockClass = side === 'left' ? 'modal-left-docked' : 'modal-right-docked';
660
+ let _hoveringSnap = false;
661
+ const _distFromEdge = (cx) => {
662
+ if (side === 'left') return cx - _leftNavWidth();
663
+ return window.innerWidth - cx;
664
+ };
665
+ return {
666
+ onMove(cx, cy) {
667
+ if (modal.classList.contains(dockClass)) {
668
+ if (_distFromEdge(cx) > UNSNAP_PX) {
669
+ clearRightDock(modal, cx, cy, dockClass);
670
+ return true;
671
+ }
672
+ return false;
673
+ }
674
+ const nearEdge = _distFromEdge(cx) <= SNAP_PX;
675
+ if (nearEdge !== _hoveringSnap) {
676
+ _hoveringSnap = nearEdge;
677
+ _showSnapHint(nearEdge, side);
678
+ }
679
+ return false;
680
+ },
681
+ hovering() { return _hoveringSnap; },
682
+ side() { return side; },
683
+ commit() {
684
+ _showSnapHint(false, side);
685
+ _hoveringSnap = false;
686
+ _applyDockInternal(modal, side, dockClass);
687
+ },
688
+ release() {
689
+ _showSnapHint(false, side);
690
+ _hoveringSnap = false;
691
+ },
692
+ };
693
+ }
694
+
695
+ (function _initSplitSeamIndicator() {
696
+ if (typeof document === 'undefined') return;
697
+ const stripe = document.createElement('div');
698
+ stripe.id = 'email-doc-split-seam';
699
+ stripe.style.position = 'fixed';
700
+ stripe.style.top = '0';
701
+ stripe.style.bottom = '0';
702
+ stripe.style.width = '10px';
703
+ stripe.style.cursor = 'col-resize';
704
+ stripe.style.zIndex = '9999';
705
+ stripe.style.background = 'linear-gradient(to right, transparent 0 3px, color-mix(in srgb, var(--accent, var(--red)) 35%, transparent) 3px 7px, transparent 7px 10px)';
706
+ stripe.style.pointerEvents = 'auto';
707
+ stripe.style.touchAction = 'none';
708
+ stripe.style.display = 'none';
709
+ stripe.title = 'Drag to resize email and draft';
710
+
711
+ const _activeLeftDockContent = () => {
712
+ const modal = document.querySelector(
713
+ '#email-lib-modal.modal-left-docked:not(.hidden), ' +
714
+ '#email-lib-modal.email-snap-left:not(.hidden), ' +
715
+ '.modal[id^="email-reader-"].modal-left-docked:not(.hidden), ' +
716
+ '.modal[id^="email-reader-"].email-snap-left:not(.hidden)'
717
+ );
718
+ return modal?.querySelector?.('.modal-content') || null;
719
+ };
720
+
721
+ const _position = () => {
722
+ const splitActive = document.body.classList.contains('email-doc-split-active')
723
+ && document.body.classList.contains('doc-view')
724
+ && window.innerWidth > 768;
725
+ if (!splitActive) { stripe.style.display = 'none'; return; }
726
+ const x = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--email-doc-split-right-x')) || 0;
727
+ if (!x) { stripe.style.display = 'none'; return; }
728
+ stripe.style.display = 'block';
729
+ stripe.style.left = (x - 5) + 'px';
730
+ };
731
+
732
+ const _dragTo = (clientX) => {
733
+ const content = _activeLeftDockContent();
734
+ if (!content) return;
735
+ const left = _leftNavRight();
736
+ const w = _clampEmailDocSplitWidth(clientX - left, left);
737
+ content._emailDocSplitUserW = w;
738
+ content.style.left = left + 'px';
739
+ content.style.width = w + 'px';
740
+ content.style.maxWidth = w + 'px';
741
+ _applyEmailDocSplitGeometry(left, w);
742
+ _position();
743
+ };
744
+
745
+ stripe.addEventListener('pointerdown', (e) => {
746
+ if (stripe.style.display === 'none') return;
747
+ e.preventDefault();
748
+ stripe.setPointerCapture?.(e.pointerId);
749
+ const prevCursor = document.body.style.cursor;
750
+ const prevUserSelect = document.body.style.userSelect;
751
+ document.body.style.cursor = 'col-resize';
752
+ document.body.style.userSelect = 'none';
753
+ document.body.classList.add('email-doc-split-resizing');
754
+ _dragTo(e.clientX);
755
+ const onMove = (ev) => {
756
+ ev.preventDefault();
757
+ _dragTo(ev.clientX);
758
+ };
759
+ const onUp = (ev) => {
760
+ try { stripe.releasePointerCapture?.(e.pointerId); } catch (_) {}
761
+ document.removeEventListener('pointermove', onMove, true);
762
+ document.removeEventListener('pointerup', onUp, true);
763
+ document.removeEventListener('pointercancel', onUp, true);
764
+ document.body.classList.remove('email-doc-split-resizing');
765
+ document.body.style.cursor = prevCursor;
766
+ document.body.style.userSelect = prevUserSelect;
767
+ const rightX = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--email-doc-split-right-x')) || 0;
768
+ const left = _leftNavRight();
769
+ if (rightX > left) _saveEmailDocSplitWidth(rightX - left);
770
+ ev.preventDefault();
771
+ };
772
+ document.addEventListener('pointermove', onMove, true);
773
+ document.addEventListener('pointerup', onUp, true);
774
+ document.addEventListener('pointercancel', onUp, true);
775
+ });
776
+
777
+ document.body.appendChild(stripe);
778
+ new MutationObserver(_position).observe(document.body, { attributes: true, attributeFilter: ['class'] });
779
+ new MutationObserver(_position).observe(document.documentElement, { attributes: true, attributeFilter: ['style'] });
780
+ window.addEventListener('resize', _position);
781
+ _position();
782
+ })();