@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,164 @@
1
+ /**
2
+ * Inpaint panel controls — the non-AI side-panel UI for the inpaint
3
+ * tool (the AI Generate/Remove/Outpaint buttons live in
4
+ * editor/ai-inpaint.js).
5
+ *
6
+ * Pre-gen sliders (Feather + Strength swatch previews):
7
+ * #ge-strength-slider just-updates-the-label-and-swatch
8
+ *
9
+ * Post-gen live edge tuners — alpha-blur + dilate/erode on the most
10
+ * recent Inpaint Result layer, rAF-throttled so dragging stays
11
+ * smooth on big canvases:
12
+ * #ge-feather-slider calls applyInpaintFeather + composite
13
+ * #ge-edgestroke-slider same
14
+ *
15
+ * Mask controls:
16
+ * #ge-mask-vis toggle red-overlay visibility
17
+ * #ge-inpaint-invert invert the active mask sub-layer
18
+ * #ge-inpaint-clear wipe the active mask
19
+ * #ge-inpaint-mode-paint set persistent paint mode
20
+ * #ge-inpaint-mode-erase set persistent erase mode
21
+ *
22
+ * Mask tint pickers (wired to keep both visually in sync):
23
+ * .ge-inpaint-mask-color (inpaint section)
24
+ * #ge-topbar-mask-color (topbar swatch — HSV picker attached)
25
+ *
26
+ * @param {{
27
+ * composite: () => void,
28
+ * applyInpaintFeather: (layer: object, featherPx: number, edgeShiftPx: number) => void,
29
+ * syncToolClearIndicators: () => void,
30
+ * attachColorPicker: (el: HTMLInputElement) => void,
31
+ * uiModule: object,
32
+ * }} deps
33
+ */
34
+ import { state } from './state.js';
35
+
36
+ const EYE_OPEN_SM = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>';
37
+ const EYE_OFF_SM = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><line x1="8" y1="16" x2="16" y2="8"/><line x1="8" y1="8" x2="16" y2="16"/></svg>';
38
+
39
+ export function wireInpaintControls({
40
+ composite, applyInpaintFeather, syncToolClearIndicators,
41
+ attachColorPicker, uiModule,
42
+ }) {
43
+ // ── Feather + Strength preview swatches ──
44
+ const featherPrev = document.getElementById('ge-feather-preview');
45
+ const strengthPrev = document.getElementById('ge-strength-preview');
46
+ function syncFeatherPreview(v) {
47
+ if (!featherPrev) return;
48
+ const inner = Math.max(0, 50 - v * 1.25);
49
+ featherPrev.style.background = `radial-gradient(circle, var(--fg) 0%, var(--fg) ${inner}%, transparent 75%)`;
50
+ }
51
+ function syncStrengthPreview(v) {
52
+ if (!strengthPrev) return;
53
+ strengthPrev.style.opacity = (v / 100).toFixed(2);
54
+ }
55
+
56
+ // ── Post-inpaint live edge tuner ──
57
+ // Alpha-blur (Feather) + dilate/erode (Edge Stroke) on the last
58
+ // Inpaint Result layer. rAF-throttled so dragging stays smooth.
59
+ let featherRafPending = false;
60
+ function scheduleInpaintEdgeRefresh() {
61
+ if (featherRafPending) return;
62
+ featherRafPending = true;
63
+ requestAnimationFrame(() => {
64
+ featherRafPending = false;
65
+ const layer = state.layers.find(l => l.id === state.lastInpaintLayerId);
66
+ if (!layer || !layer.inpaintSource) return;
67
+ const feather = parseInt(document.getElementById('ge-feather-slider')?.value || '0', 10);
68
+ const edge = parseInt(document.getElementById('ge-edgestroke-slider')?.value || '0', 10);
69
+ applyInpaintFeather(layer, feather, edge);
70
+ composite();
71
+ });
72
+ }
73
+ document.getElementById('ge-feather-slider')?.addEventListener('input', (e) => {
74
+ const v = parseInt(e.target.value, 10);
75
+ document.getElementById('ge-feather-label').textContent = v + 'px';
76
+ syncFeatherPreview(v);
77
+ scheduleInpaintEdgeRefresh();
78
+ });
79
+ document.getElementById('ge-edgestroke-slider')?.addEventListener('input', (e) => {
80
+ const v = parseInt(e.target.value, 10);
81
+ const label = document.getElementById('ge-edgestroke-label');
82
+ if (label) label.textContent = (v > 0 ? '+' : '') + v + 'px';
83
+ const prev = document.getElementById('ge-edgestroke-preview');
84
+ if (prev) {
85
+ // Visualise direction: dilate (+) → green, erode (−) → red.
86
+ const dir = v === 0 ? 'transparent' : (v > 0 ? 'rgba(120,200,120,0.5)' : 'rgba(200,120,120,0.5)');
87
+ prev.style.background = dir;
88
+ prev.style.opacity = Math.min(1, Math.abs(v) / 80).toFixed(2);
89
+ }
90
+ scheduleInpaintEdgeRefresh();
91
+ });
92
+ document.getElementById('ge-strength-slider')?.addEventListener('input', (e) => {
93
+ document.getElementById('ge-strength-label').textContent = (e.target.value / 100).toFixed(2);
94
+ syncStrengthPreview(parseInt(e.target.value, 10));
95
+ });
96
+ syncFeatherPreview(0);
97
+ syncStrengthPreview(75);
98
+
99
+ // ── Mask vis / invert / clear ──
100
+ document.getElementById('ge-mask-vis')?.addEventListener('click', () => {
101
+ state.maskVisible = !state.maskVisible;
102
+ const btn = document.getElementById('ge-mask-vis');
103
+ if (!btn) { composite(); return; }
104
+ btn.innerHTML = `${state.maskVisible ? EYE_OPEN_SM : EYE_OFF_SM}<span id="ge-mask-vis-label">${state.maskVisible ? 'Hide' : 'Show'}</span>`;
105
+ btn.title = state.maskVisible ? 'Hide mask' : 'Show mask';
106
+ btn.classList.toggle('visible', state.maskVisible);
107
+ composite();
108
+ });
109
+ document.getElementById('ge-inpaint-invert')?.addEventListener('click', () => {
110
+ if (!state.maskCtx || !state.maskCanvas) return;
111
+ const imgData = state.maskCtx.getImageData(0, 0, state.maskCanvas.width, state.maskCanvas.height);
112
+ const d = imgData.data;
113
+ for (let i = 0; i < d.length; i += 4) {
114
+ const alpha = d[i + 3];
115
+ if (alpha > 0) {
116
+ d[i] = 0; d[i+1] = 0; d[i+2] = 0; d[i+3] = 0;
117
+ } else {
118
+ d[i] = 255; d[i+1] = 255; d[i+2] = 255; d[i+3] = 255;
119
+ }
120
+ }
121
+ state.maskCtx.putImageData(imgData, 0, 0);
122
+ composite();
123
+ syncToolClearIndicators();
124
+ uiModule.showToast('Mask inverted');
125
+ });
126
+ document.getElementById('ge-inpaint-clear')?.addEventListener('click', () => {
127
+ if (state.maskCtx) { state.maskCtx.clearRect(0, 0, state.maskCanvas.width, state.maskCanvas.height); composite(); }
128
+ syncToolClearIndicators();
129
+ });
130
+
131
+ // ── Paint / Erase segmented toggle ──
132
+ function setInpaintMode(eraseMode) {
133
+ state.inpaintEraseMode = !!eraseMode;
134
+ const paintBtn = document.getElementById('ge-inpaint-mode-paint');
135
+ const eraseBtn = document.getElementById('ge-inpaint-mode-erase');
136
+ if (paintBtn) paintBtn.classList.toggle('active', !state.inpaintEraseMode);
137
+ if (eraseBtn) eraseBtn.classList.toggle('active', state.inpaintEraseMode);
138
+ }
139
+ document.getElementById('ge-inpaint-mode-paint')?.addEventListener('click', () => setInpaintMode(false));
140
+ document.getElementById('ge-inpaint-mode-erase')?.addEventListener('click', () => setInpaintMode(true));
141
+
142
+ // ── Mask color picker ──
143
+ // Updates state.maskTintColor live so the user can pick a colour
144
+ // that contrasts with their photo. Wire both the topbar picker AND
145
+ // the inpaint-section picker so changing one syncs the other.
146
+ function applyMaskTintFromHex(hex) {
147
+ const r = parseInt(hex.slice(1, 3), 16);
148
+ const g = parseInt(hex.slice(3, 5), 16);
149
+ const b = parseInt(hex.slice(5, 7), 16);
150
+ state.maskTintColor = `rgba(${r}, ${g}, ${b}, 1)`;
151
+ const inpaintPicker = document.querySelector('.ge-inpaint-mask-color');
152
+ const topbarPicker = document.getElementById('ge-topbar-mask-color');
153
+ if (inpaintPicker && inpaintPicker.value !== hex) inpaintPicker.value = hex;
154
+ if (topbarPicker && topbarPicker.value !== hex) topbarPicker.value = hex;
155
+ composite();
156
+ }
157
+ document.querySelector('.ge-inpaint-mask-color')?.addEventListener('input', (e) => applyMaskTintFromHex(e.target.value));
158
+ document.getElementById('ge-topbar-mask-color')?.addEventListener('input', (e) => applyMaskTintFromHex(e.target.value));
159
+ // Use the in-house HSV picker for the topbar swatch.
160
+ const topbarMaskColor = document.getElementById('ge-topbar-mask-color');
161
+ if (topbarMaskColor) {
162
+ try { attachColorPicker(topbarMaskColor); topbarMaskColor.value = topbarMaskColor.value; } catch {}
163
+ }
164
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Layer merge / flatten buttons in the layer-panel footer:
3
+ *
4
+ * #ge-flatten Flatten Copy — merge every visible layer into a
5
+ * new "Flattened" layer, keep originals.
6
+ * #ge-merge-all Merge All — flatten every VISIBLE layer into the
7
+ * lowest visible one. Hidden layers dropped. Base
8
+ * = lowest visible (not bottom of stack) so a
9
+ * hidden base can't absorb the visible stack into
10
+ * an invisible result.
11
+ * #ge-merge-down Merge active layer into the one beneath it.
12
+ *
13
+ * @param {{
14
+ * saveState: (label?: string) => void,
15
+ * createLayer: (name, w, h) => object,
16
+ * renderLayerPanel: () => void,
17
+ * composite: () => void,
18
+ * uiModule: object,
19
+ * }} deps
20
+ */
21
+ import { state } from './state.js';
22
+
23
+ export function mergeLayerDownAtIndex(idx) {
24
+ if (idx < 1 || idx >= state.layers.length) return null;
25
+ const upper = state.layers[idx];
26
+ const lower = state.layers[idx - 1];
27
+ const upperOff = state.layerOffsets.get(upper.id) || { x: 0, y: 0 };
28
+ const lowerOff = state.layerOffsets.get(lower.id) || { x: 0, y: 0 };
29
+ lower.ctx.save();
30
+ lower.ctx.globalAlpha = upper.opacity;
31
+ lower.ctx.drawImage(
32
+ upper.canvas,
33
+ upperOff.x - lowerOff.x,
34
+ upperOff.y - lowerOff.y,
35
+ );
36
+ lower.ctx.restore();
37
+ state.layers.splice(idx, 1);
38
+ state.layerOffsets.delete(upper.id);
39
+ state.activeLayerId = lower.id;
40
+ return lower;
41
+ }
42
+
43
+ export function wireMergeButtons({ saveState, createLayer, renderLayerPanel, composite, uiModule }) {
44
+ // Flatten Copy.
45
+ document.getElementById('ge-flatten')?.addEventListener('click', () => {
46
+ if (state.layers.length < 2) return;
47
+ saveState('Flatten copy');
48
+ const merged = createLayer('Flattened', state.imgWidth, state.imgHeight);
49
+ const ctx = merged.ctx;
50
+ for (const l of state.layers) {
51
+ if (!l.visible) continue;
52
+ const off = state.layerOffsets.get(l.id) || { x: 0, y: 0 };
53
+ ctx.globalAlpha = l.opacity;
54
+ ctx.drawImage(l.canvas, off.x, off.y);
55
+ ctx.globalAlpha = 1;
56
+ }
57
+ state.layers.push(merged);
58
+ state.activeLayerId = merged.id;
59
+ renderLayerPanel();
60
+ composite();
61
+ uiModule.showToast('Flattened copy created');
62
+ });
63
+
64
+ // Merge All — drop hidden layers; base = lowest visible.
65
+ document.getElementById('ge-merge-all')?.addEventListener('click', () => {
66
+ const visibleLayers = state.layers.filter(l => l.visible);
67
+ if (visibleLayers.length < 2) {
68
+ if (uiModule) uiModule.showToast('Need at least two visible layers to merge');
69
+ return;
70
+ }
71
+ saveState('Merge all');
72
+ const base = visibleLayers[0];
73
+ const baseCtx = base.ctx;
74
+ for (let i = 1; i < visibleLayers.length; i++) {
75
+ const l = visibleLayers[i];
76
+ const off = state.layerOffsets.get(l.id) || { x: 0, y: 0 };
77
+ baseCtx.globalAlpha = l.opacity;
78
+ baseCtx.drawImage(l.canvas, off.x, off.y);
79
+ baseCtx.globalAlpha = 1;
80
+ }
81
+ // Free offset entries for the discarded layers; keep base.
82
+ for (const l of state.layers) {
83
+ if (l === base) continue;
84
+ state.layerOffsets.delete(l.id);
85
+ }
86
+ state.layers = [base];
87
+ state.activeLayerId = base.id;
88
+ renderLayerPanel();
89
+ composite();
90
+ uiModule.showToast('Visible layers merged');
91
+ });
92
+
93
+ // Merge Down.
94
+ document.getElementById('ge-merge-down')?.addEventListener('click', () => {
95
+ const idx = state.layers.findIndex(l => l.id === state.activeLayerId);
96
+ if (idx < 1) return; // can't merge the bottom layer
97
+ saveState('Merge down');
98
+ mergeLayerDownAtIndex(idx);
99
+ renderLayerPanel();
100
+ composite();
101
+ uiModule.showToast('Layer merged down');
102
+ });
103
+ }
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Lasso + Magic Wand panel controls — sliders, mode toggles, and the
3
+ * panel action buttons (Invert / Clear / Delete / Copy / To Mask /
4
+ * Bg Remove). The actual selection algorithms live in their tool
5
+ * modules (editor/tools/lasso.js, editor/tools/wand.js); this file
6
+ * just wires the side-panel UI to them.
7
+ *
8
+ * Lasso section:
9
+ * #ge-lasso-feather slider, updates label + preview, recomposites
10
+ * #ge-lasso-grow slider, updates label + recomposites
11
+ * #ge-lasso-invert → invertSelection
12
+ * #ge-lasso-delete → lassoDeleteSelection
13
+ * #ge-lasso-copy → lassoCopyToLayer
14
+ * #ge-lasso-mask → lassoToMask
15
+ *
16
+ * Wand section:
17
+ * #ge-wand-feather slider, updates label + recomposites
18
+ * #ge-wand-grow slider, updates label + recomposites
19
+ * #ge-wand-tolerance slider, updates future wand-click tolerance
20
+ * #ge-wand-live opt-in rAF-coalesced live retune while dragging
21
+ * .ge-wand-mode-btn segmented toggle (New / Add / Subtract)
22
+ * #ge-wand-vis toggle the translucent red overlay
23
+ * #ge-wand-clear / -invert / -delete / -copy / -mask / -rembg
24
+ *
25
+ * @param {{
26
+ * composite: () => void,
27
+ * invertSelection: () => boolean,
28
+ * lassoDeleteSelection: () => void,
29
+ * lassoCopyToLayer: () => void,
30
+ * lassoToMask: () => void,
31
+ * runMagicWand: (x: number, y: number, mode: string, opts?: object) => void,
32
+ * wandClear: () => void,
33
+ * wandDeleteSelection: () => void,
34
+ * wandCopyToNewLayer: () => void,
35
+ * wandToMask: () => void,
36
+ * buildSelectionHintMask: () => string | null,
37
+ * applyImageTool: (endpoint, payload, name, btn, opts?) => Promise<void>,
38
+ * uiModule: object,
39
+ * }} deps
40
+ */
41
+ import { state } from './state.js';
42
+
43
+ const EYE_OPEN = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>';
44
+ const EYE_OFF = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><line x1="8" y1="16" x2="16" y2="8"/><line x1="8" y1="8" x2="16" y2="16"/></svg>';
45
+
46
+ export function wireSelectionControls({
47
+ composite,
48
+ invertSelection,
49
+ lassoDeleteSelection, lassoCopyToLayer, lassoToMask,
50
+ runMagicWand,
51
+ wandClear, wandDeleteSelection, wandCopyToNewLayer, wandToMask,
52
+ buildSelectionHintMask, applyImageTool,
53
+ uiModule,
54
+ }) {
55
+ // ── Lasso section ──
56
+ const lassoFPrev = document.getElementById('ge-lasso-feather-preview');
57
+ function syncLassoFeather(v) {
58
+ if (!lassoFPrev) return;
59
+ const inner = Math.max(0, 50 - v * 1.0);
60
+ lassoFPrev.style.background = `radial-gradient(circle, var(--fg) 0%, var(--fg) ${inner}%, transparent 75%)`;
61
+ }
62
+ syncLassoFeather(0);
63
+ document.getElementById('ge-lasso-feather')?.addEventListener('input', (e) => {
64
+ document.getElementById('ge-lasso-feather-label').textContent = e.target.value + 'px';
65
+ syncLassoFeather(parseInt(e.target.value, 10));
66
+ composite();
67
+ });
68
+ document.getElementById('ge-lasso-grow')?.addEventListener('input', (e) => {
69
+ document.getElementById('ge-lasso-grow-label').textContent = e.target.value + 'px';
70
+ composite();
71
+ });
72
+ document.getElementById('ge-lasso-delete')?.addEventListener('click', () => {
73
+ if (state.lassoPoints.length >= 3 && !state.lassoActive) lassoDeleteSelection();
74
+ else if (state.wandMask) wandDeleteSelection();
75
+ });
76
+ document.getElementById('ge-lasso-copy')?.addEventListener('click', () => {
77
+ if (state.lassoPoints.length >= 3 && !state.lassoActive) lassoCopyToLayer();
78
+ else if (state.wandMask) wandCopyToNewLayer();
79
+ });
80
+ document.getElementById('ge-lasso-mask')?.addEventListener('click', () => {
81
+ if (state.lassoPoints.length >= 3 && !state.lassoActive) lassoToMask();
82
+ else if (state.wandMask) wandToMask();
83
+ });
84
+ document.getElementById('ge-lasso-invert')?.addEventListener('click', invertSelection);
85
+
86
+ // ── Wand section ──
87
+ document.getElementById('ge-wand-feather')?.addEventListener('input', (e) => {
88
+ const v = parseInt(e.target.value, 10) || 0;
89
+ document.getElementById('ge-wand-feather-label').textContent = v + 'px';
90
+ const prev = document.getElementById('ge-wand-feather-preview');
91
+ if (prev) prev.style.setProperty('--feather-blur', Math.min(v / 14, 8) + 'px');
92
+ composite();
93
+ });
94
+ document.getElementById('ge-wand-grow')?.addEventListener('input', (e) => {
95
+ document.getElementById('ge-wand-grow-label').textContent = e.target.value + 'px';
96
+ composite();
97
+ });
98
+
99
+ // Tolerance slider fires `input` rapidly — coalesce to one wand run
100
+ // per frame with rAF. Label updates synchronously so the number
101
+ // tracks the cursor even when the flood-fill runs at ~60fps.
102
+ let wandRetuneRaf = null;
103
+ const retuneWand = () => {
104
+ if (!state.wandLastSeed || !state.wandMask) return;
105
+ if (wandRetuneRaf) return;
106
+ wandRetuneRaf = requestAnimationFrame(() => {
107
+ wandRetuneRaf = null;
108
+ runMagicWand(state.wandLastSeed.x, state.wandLastSeed.y, 'replace', { retune: true });
109
+ });
110
+ };
111
+ const liveBtn = document.getElementById('ge-wand-live');
112
+ liveBtn?.addEventListener('click', () => {
113
+ state.wandLiveRetune = !state.wandLiveRetune;
114
+ liveBtn.classList.toggle('active', state.wandLiveRetune);
115
+ liveBtn.setAttribute('aria-pressed', state.wandLiveRetune ? 'true' : 'false');
116
+ if (state.wandLiveRetune) retuneWand();
117
+ });
118
+ document.getElementById('ge-wand-tolerance')?.addEventListener('input', (e) => {
119
+ state.wandTolerance = parseInt(e.target.value, 10);
120
+ const lbl = document.getElementById('ge-wand-tol-label');
121
+ if (lbl) lbl.textContent = state.wandTolerance;
122
+ const wp = document.getElementById('ge-wand-tol-preview');
123
+ if (wp) wp.style.opacity = (state.wandTolerance / 100).toFixed(2);
124
+ if (state.wandLiveRetune) retuneWand();
125
+ });
126
+
127
+ // Wand mode segmented toggle (New / Add / Subtract).
128
+ document.querySelectorAll('.ge-wand-mode-btn').forEach(btn => {
129
+ btn.addEventListener('click', () => {
130
+ const mode = btn.dataset.wandMode;
131
+ if (!mode) return;
132
+ state.wandMode = mode;
133
+ document.querySelectorAll('.ge-wand-mode-btn').forEach(b => {
134
+ b.classList.toggle('active', b.dataset.wandMode === mode);
135
+ });
136
+ });
137
+ });
138
+
139
+ // Toggle the translucent red overlay for the wand selection.
140
+ document.getElementById('ge-wand-vis')?.addEventListener('click', () => {
141
+ state.wandMaskVisible = !state.wandMaskVisible;
142
+ const btn = document.getElementById('ge-wand-vis');
143
+ if (btn) {
144
+ btn.innerHTML = state.wandMaskVisible ? EYE_OPEN : EYE_OFF;
145
+ btn.title = state.wandMaskVisible ? 'Hide selection overlay' : 'Show selection overlay';
146
+ btn.classList.toggle('visible', state.wandMaskVisible);
147
+ }
148
+ composite();
149
+ });
150
+
151
+ document.getElementById('ge-wand-clear')?.addEventListener('click', wandClear);
152
+ document.getElementById('ge-wand-invert')?.addEventListener('click', invertSelection);
153
+ document.getElementById('ge-wand-delete')?.addEventListener('click', wandDeleteSelection);
154
+ document.getElementById('ge-wand-copy')?.addEventListener('click', wandCopyToNewLayer);
155
+ document.getElementById('ge-wand-mask')?.addEventListener('click', wandToMask);
156
+ // Selection-constrained Bg Remove — reuses the same path the toolbar
157
+ // Bg Remove button does. buildSelectionHintMask picks the active
158
+ // wand/lasso selection, so this just kicks off the existing flow.
159
+ document.getElementById('ge-wand-rembg')?.addEventListener('click', async () => {
160
+ const btn = document.getElementById('ge-wand-rembg');
161
+ const hint = buildSelectionHintMask();
162
+ if (!hint) { if (uiModule) uiModule.showToast('Click to make a wand selection first'); return; }
163
+ await applyImageTool('/api/image/remove-bg', { hint_mask: hint }, 'BG Removed', btn);
164
+ wandClear();
165
+ });
166
+
167
+ // Live tolerance preview (just opacity-tracking like sharpen).
168
+ const wandTolPrev = document.getElementById('ge-wand-tol-preview');
169
+ if (wandTolPrev) wandTolPrev.style.opacity = (state.wandTolerance / 100).toFixed(2);
170
+ }
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Topbar dropdown menus — Image, Filter, and Resize.
3
+ *
4
+ * Image menu (#ge-image-menu-btn → #ge-image-menu):
5
+ * resize, selection (edge feather/delete), fill, rotate 90/180,
6
+ * flip horizontal/vertical.
7
+ *
8
+ * Filter menu (#ge-filter-menu-btn → #ge-filter-menu):
9
+ * Blur sub-menu — Gaussian, Zoom.
10
+ *
11
+ * Resize menu (#ge-resize-menu-btn → #ge-resize-menu):
12
+ * preset W×H items (data-resize-w/-h) apply immediately;
13
+ * [data-resize-custom] opens a themed prompt for arbitrary sizes.
14
+ *
15
+ * Returns the resize helpers so the keyboard-shortcuts module can
16
+ * call them too (Ctrl+Shift+T opens the custom prompt).
17
+ *
18
+ * @param {{
19
+ * closeOtherTopbarMenus: (keepId: string) => void,
20
+ * registerDocClickAway: (handler: (e: Event) => void) => void,
21
+ * saveState: (label?: string) => void,
22
+ * composite: () => void,
23
+ * fitZoom: () => void,
24
+ * promptCanvasSize: (opts: object) => Promise<{w, h} | null>,
25
+ * doFillSelection: () => void,
26
+ * rotateAllLayers: (deg: number) => void,
27
+ * flipAllLayers: (axis: 'h' | 'v') => void,
28
+ * applyGaussianBlur: () => void,
29
+ * applyZoomBlur: () => void,
30
+ * uiModule: object,
31
+ * }} deps
32
+ *
33
+ * @returns {{
34
+ * applyResize: (newW: number, newH: number) => void,
35
+ * resizeCustomPrompt: () => Promise<void>,
36
+ * }}
37
+ */
38
+ import { state } from './state.js';
39
+
40
+ export function wireTopbarMenus({
41
+ closeOtherTopbarMenus, registerDocClickAway,
42
+ saveState, composite, fitZoom,
43
+ promptCanvasSize, doFillSelection,
44
+ rotateAllLayers, flipAllLayers,
45
+ applyGaussianBlur, applyZoomBlur,
46
+ uiModule,
47
+ }) {
48
+ // ── Resize canvas ──
49
+ // Extracted so both the popup presets and the Ctrl+Shift+T shortcut
50
+ // can call it.
51
+ function applyResize(newW, newH) {
52
+ if (!newW || !newH || newW < 1 || newH < 1) {
53
+ uiModule.showToast('Invalid size');
54
+ return;
55
+ }
56
+ saveState('Resize canvas');
57
+ // Only resize the main canvas — layers keep their original size.
58
+ // Content outside the new bounds is clipped during composite, not
59
+ // destroyed.
60
+ if (state.maskCanvas) {
61
+ const tmpMask = document.createElement('canvas');
62
+ tmpMask.width = state.maskCanvas.width;
63
+ tmpMask.height = state.maskCanvas.height;
64
+ tmpMask.getContext('2d').drawImage(state.maskCanvas, 0, 0);
65
+ state.maskCanvas.width = newW;
66
+ state.maskCanvas.height = newH;
67
+ state.maskCtx.drawImage(tmpMask, 0, 0);
68
+ }
69
+ state.imgWidth = newW;
70
+ state.imgHeight = newH;
71
+ state.mainCanvas.width = newW;
72
+ state.mainCanvas.height = newH;
73
+ const sizeLabel = document.getElementById('ge-canvas-size');
74
+ if (sizeLabel) sizeLabel.textContent = `${newW}×${newH}`;
75
+ fitZoom();
76
+ composite();
77
+ uiModule.showToast(`Canvas resized to ${newW}×${newH}`);
78
+ }
79
+
80
+ async function resizeCustomPrompt() {
81
+ const result = await promptCanvasSize({
82
+ title: 'Canvas size',
83
+ okLabel: 'Apply',
84
+ initialW: state.imgWidth,
85
+ initialH: state.imgHeight,
86
+ });
87
+ if (!result) return;
88
+ applyResize(result.w, result.h);
89
+ }
90
+
91
+ // ── Image menu ──
92
+ {
93
+ const btn = document.getElementById('ge-image-menu-btn');
94
+ const menu = document.getElementById('ge-image-menu');
95
+ if (btn && menu) {
96
+ btn.addEventListener('click', (e) => {
97
+ e.stopPropagation();
98
+ const willOpen = menu.hidden;
99
+ if (willOpen) closeOtherTopbarMenus('ge-image-menu');
100
+ menu.hidden = !menu.hidden;
101
+ });
102
+ menu.addEventListener('click', (e) => {
103
+ const item = e.target.closest('[data-image-action]');
104
+ if (!item || item.disabled) return;
105
+ menu.hidden = true;
106
+ const action = item.dataset.imageAction;
107
+ if (action === 'resize') resizeCustomPrompt();
108
+ else if (action === 'selection') document.getElementById('ge-edge-menu-btn')?.click();
109
+ else if (action === 'fill') doFillSelection();
110
+ else if (action === 'rotate-90') rotateAllLayers(90);
111
+ else if (action === 'rotate-180') rotateAllLayers(180);
112
+ else if (action === 'flip-h') flipAllLayers('h');
113
+ else if (action === 'flip-v') flipAllLayers('v');
114
+ });
115
+ registerDocClickAway((e) => {
116
+ if (!menu.hidden && !menu.contains(e.target) && e.target !== btn) menu.hidden = true;
117
+ });
118
+ }
119
+ }
120
+
121
+ // ── Filter menu (Blur sub-menu — Gaussian / Zoom) ──
122
+ {
123
+ const btn = document.getElementById('ge-filter-menu-btn');
124
+ const menu = document.getElementById('ge-filter-menu');
125
+ if (btn && menu) {
126
+ btn.addEventListener('click', (e) => {
127
+ e.stopPropagation();
128
+ const willOpen = menu.hidden;
129
+ if (willOpen) closeOtherTopbarMenus('ge-filter-menu');
130
+ menu.hidden = !menu.hidden;
131
+ });
132
+ menu.addEventListener('click', (e) => {
133
+ const item = e.target.closest('[data-filter-action]');
134
+ if (!item) return;
135
+ menu.hidden = true;
136
+ const action = item.dataset.filterAction;
137
+ if (action === 'blur-gaussian') applyGaussianBlur();
138
+ else if (action === 'blur-zoom') applyZoomBlur();
139
+ });
140
+ registerDocClickAway((e) => {
141
+ if (!menu.hidden && !menu.contains(e.target) && e.target !== btn) menu.hidden = true;
142
+ });
143
+ }
144
+ }
145
+
146
+ // ── Resize popup (preset items + Custom… → resizeCustomPrompt) ──
147
+ {
148
+ const btn = document.getElementById('ge-resize-menu-btn');
149
+ const menu = document.getElementById('ge-resize-menu');
150
+ if (btn && menu) {
151
+ btn.addEventListener('click', (e) => {
152
+ e.stopPropagation();
153
+ const willOpen = menu.hidden;
154
+ if (willOpen) closeOtherTopbarMenus('ge-resize-menu');
155
+ menu.hidden = !menu.hidden;
156
+ });
157
+ menu.querySelectorAll('[data-resize-w]').forEach(item => {
158
+ item.addEventListener('click', () => {
159
+ menu.hidden = true;
160
+ applyResize(parseInt(item.dataset.resizeW, 10), parseInt(item.dataset.resizeH, 10));
161
+ });
162
+ });
163
+ menu.querySelector('[data-resize-custom]')?.addEventListener('click', () => {
164
+ menu.hidden = true;
165
+ resizeCustomPrompt();
166
+ });
167
+ registerDocClickAway((e) => {
168
+ if (!menu.hidden && !menu.contains(e.target) && e.target !== btn) menu.hidden = true;
169
+ });
170
+ }
171
+ }
172
+
173
+ return { applyResize, resizeCustomPrompt };
174
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Topbar overflow handler — keeps lightweight labels updated and hides
3
+ * only low-priority AI model controls when the editor window gets narrow.
4
+ *
5
+ * Plus the small canvas-size display label updater (since it sits in
6
+ * the topbar too).
7
+ *
8
+ * Import and Canvas stay as real topbar buttons; there is intentionally
9
+ * no "More" overflow menu here.
10
+ *
11
+ * @param {{
12
+ * container: HTMLElement,
13
+ * registerDocClickAway: (handler: (e: Event) => void) => void,
14
+ * }} deps
15
+ */
16
+ import { state } from './state.js';
17
+
18
+ export function wireTopbarOverflow({ container }) {
19
+ // Canvas-size badge updater (kept simple — it lives in the topbar).
20
+ const sizeLabel = document.getElementById('ge-canvas-size');
21
+ function updateSizeLabel() {
22
+ if (sizeLabel) sizeLabel.textContent = `${state.imgWidth}×${state.imgHeight}`;
23
+ }
24
+ updateSizeLabel();
25
+
26
+ const topbar = container.querySelector('.ge-topbar');
27
+ // The Gen control + its "Gen" label span — collapse as a group when
28
+ // narrow. The Inpaint model selector moved into the side panel.
29
+ const aiGroup = [
30
+ container.querySelector('#ge-ai-model'),
31
+ ...container.querySelectorAll('.ge-topbar span[style*="font-size:9px"]'),
32
+ ].filter(Boolean);
33
+
34
+ function syncOverflow() {
35
+ if (!topbar) return;
36
+ aiGroup.forEach(el => { el.style.display = ''; });
37
+ if (topbar.scrollWidth > topbar.clientWidth) {
38
+ // Hide AI group first — bulky and least essential at narrow widths.
39
+ aiGroup.forEach(el => { el.style.display = 'none'; });
40
+ }
41
+ }
42
+
43
+ if (topbar && window.ResizeObserver) {
44
+ const ro = new ResizeObserver(() => syncOverflow());
45
+ ro.observe(topbar);
46
+ }
47
+ // Initial pass after layout settles.
48
+ requestAnimationFrame(syncOverflow);
49
+ }