@cryptiklemur/lattice 4.0.1 → 5.0.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 (394) hide show
  1. package/bin/lattice +1 -9
  2. package/dist/client/assets/{angular-html-N8PCEquT.js → angular-html-DKTL-XDO.js} +1 -1
  3. package/dist/client/assets/{angular-ts-CJ8RJIPD.js → angular-ts-tvBzOwQR.js} +1 -1
  4. package/dist/client/assets/{apl-BD6tCLWN.js → apl-CCzl5qFl.js} +1 -1
  5. package/dist/client/assets/{astro-CpIIfBs6.js → astro-DNQTpO2Y.js} +1 -1
  6. package/dist/client/assets/{blade-D3qgnjiV.js → blade-CyJoIMeJ.js} +1 -1
  7. package/dist/client/assets/{c-Dr6ADN_t.js → c-OEwk5KN8.js} +1 -1
  8. package/dist/client/assets/{cobol-BIfDE0Hr.js → cobol-DpHyJzz2.js} +1 -1
  9. package/dist/client/assets/{coffee-DHQ57vfY.js → coffee-BX5dbDzZ.js} +1 -1
  10. package/dist/client/assets/{cpp-CEBY6JOp.js → cpp-BTBjNg2U.js} +1 -1
  11. package/dist/client/assets/{crystal-D125CSmP.js → crystal-CNzZd6DW.js} +1 -1
  12. package/dist/client/assets/{css-CBmrkYSr.js → css-BuKsNmms.js} +1 -1
  13. package/dist/client/assets/{dist-A_mCRD1f.js → dist-CKpDHMy6.js} +2 -2
  14. package/dist/client/assets/{edge-Ccsz7cJW.js → edge-DzhnGgJE.js} +1 -1
  15. package/dist/client/assets/{elixir-Do6gk14X.js → elixir-Dqs0waqF.js} +1 -1
  16. package/dist/client/assets/{elm-Db22zT4C.js → elm-BtWwjxWn.js} +1 -1
  17. package/dist/client/assets/{erb-MXVqAAJD.js → erb-iPD89b4v.js} +1 -1
  18. package/dist/client/assets/{git-rebase-B-LLWBOA.js → git-rebase-BxVNXJL4.js} +1 -1
  19. package/dist/client/assets/{glimmer-js-eWszRU73.js → glimmer-js-BlyCupwF.js} +1 -1
  20. package/dist/client/assets/{glimmer-ts-VQmwGqUp.js → glimmer-ts-DjIxWOS9.js} +1 -1
  21. package/dist/client/assets/{glsl-B8ilOfAl.js → glsl-CGIL-65r.js} +1 -1
  22. package/dist/client/assets/{graphql-DnTqxeOc.js → graphql-DeOn6mNV.js} +1 -1
  23. package/dist/client/assets/{hack-XJsHYSQb.js → hack-DVppeCmS.js} +1 -1
  24. package/dist/client/assets/{haml-CQ7Vqzwp.js → haml-WDhua0Mp.js} +1 -1
  25. package/dist/client/assets/{handlebars-C4szooBf.js → handlebars-i2Fu_9HI.js} +1 -1
  26. package/dist/client/assets/{html-B6EgAiSd.js → html-B1e6oxzK.js} +1 -1
  27. package/dist/client/assets/{html-derivative-DdinogQX.js → html-derivative-MofKXIVd.js} +1 -1
  28. package/dist/client/assets/{http-BSLxCgRq.js → http-Dk6S5pRD.js} +1 -1
  29. package/dist/client/assets/{hurl-pOsTwNfp.js → hurl-CroFYYJG.js} +1 -1
  30. package/dist/client/assets/{index-BHQ_8mvl.js → index-CVu-S6Yk.js} +2 -2
  31. package/dist/client/assets/{java-DRQLiiST.js → java-B89FYjqS.js} +1 -1
  32. package/dist/client/assets/{javascript-DvEK2-47.js → javascript-m6CO1Uiy.js} +1 -1
  33. package/dist/client/assets/{jinja-D2NYJ25y.js → jinja-DC9Wi41X.js} +1 -1
  34. package/dist/client/assets/{jison-DDZaLNAp.js → jison-6xiegwDk.js} +1 -1
  35. package/dist/client/assets/{json-TGR0NIWd.js → json-HA-96-qr.js} +1 -1
  36. package/dist/client/assets/{jsx-BjUoPYga.js → jsx-Wt1a8i8U.js} +1 -1
  37. package/dist/client/assets/{julia-C4gjSpFu.js → julia-7M93VBON.js} +1 -1
  38. package/dist/client/assets/{just-H351x5u_.js → just-CjfDLYLv.js} +1 -1
  39. package/dist/client/assets/{latex-BiTmf6gf.js → latex-CitsJ46x.js} +1 -1
  40. package/dist/client/assets/{liquid-86ufjRy-.js → liquid-C8VIFin8.js} +1 -1
  41. package/dist/client/assets/{lua-BNxR0F_8.js → lua-Ba2N7esc.js} +1 -1
  42. package/dist/client/assets/{marko-CvRxpRjM.js → marko-lTLvb2wu.js} +1 -1
  43. package/dist/client/assets/{mdc-CYbAIy2C.js → mdc-D6IV-8FD.js} +1 -1
  44. package/dist/client/assets/{nginx-egdgMq-F.js → nginx-Ch5AjE6S.js} +1 -1
  45. package/dist/client/assets/{nim-CXBJVz_w.js → nim-WmDDC6LW.js} +1 -1
  46. package/dist/client/assets/{perl-XRfMobzg.js → perl-CQv0gYuq.js} +1 -1
  47. package/dist/client/assets/{php-Br7a8uil.js → php-BJmH0qOB.js} +1 -1
  48. package/dist/client/assets/{pug-BVbbUVvy.js → pug-CsHPkzc9.js} +1 -1
  49. package/dist/client/assets/{qml-ByKvrL1j.js → qml-B36ecArG.js} +1 -1
  50. package/dist/client/assets/{r-mVoV0Ni6.js → r-D5Yi5Z4y.js} +1 -1
  51. package/dist/client/assets/{razor-T5O-9UJL.js → razor-CHAxVq4R.js} +1 -1
  52. package/dist/client/assets/{regexp-CioRuhuN.js → regexp-gfs--3M7.js} +1 -1
  53. package/dist/client/assets/{rst-V__uTudD.js → rst-ugdlp-hl.js} +1 -1
  54. package/dist/client/assets/{ruby-C_PuKPTI.js → ruby-CDRRW37j.js} +1 -1
  55. package/dist/client/assets/{sas-D_DqqQH4.js → sas-DZaNQaIP.js} +1 -1
  56. package/dist/client/assets/{scss-D-TjzZ4c.js → scss-CzWQEplj.js} +1 -1
  57. package/dist/client/assets/{shellscript-E5759VHu.js → shellscript-fgYvpu9N.js} +1 -1
  58. package/dist/client/assets/{shellsession-AESTM-Pv.js → shellsession-BoAohHh7.js} +1 -1
  59. package/dist/client/assets/{soy-QrbrrcDv.js → soy-DBzVgv9x.js} +1 -1
  60. package/dist/client/assets/{sql-0M8VcDHD.js → sql-BYXpAYTs.js} +1 -1
  61. package/dist/client/assets/{stata-CgeIpGtc.js → stata-I71MMY3p.js} +1 -1
  62. package/dist/client/assets/{surrealql-DBGwnZbw.js → surrealql-C9U8_1VO.js} +1 -1
  63. package/dist/client/assets/{svelte-Cv0PvUc_.js → svelte-VOFrPnWT.js} +1 -1
  64. package/dist/client/assets/{templ-B9t7xRE4.js → templ-BIaxAEtC.js} +1 -1
  65. package/dist/client/assets/{tex-DhZZ8dr2.js → tex-D1dwnBE5.js} +1 -1
  66. package/dist/client/assets/{ts-tags-BFv8sbnd.js → ts-tags-C0L2Q0r5.js} +1 -1
  67. package/dist/client/assets/{tsx-CXC9KSbY.js → tsx-BqcycEv1.js} +1 -1
  68. package/dist/client/assets/{twig-CM_OO66r.js → twig-vyWqOhpM.js} +1 -1
  69. package/dist/client/assets/{typescript-BdgOTaoD.js → typescript-B2YbovqG.js} +1 -1
  70. package/dist/client/assets/{vue-BnQhjnCm.js → vue-CbXxGdjo.js} +1 -1
  71. package/dist/client/assets/{vue-html-CNnGecRI.js → vue-html-DDX4KXW7.js} +1 -1
  72. package/dist/client/assets/{vue-vine-DCuMkRhK.js → vue-vine-DsyY1LR5.js} +1 -1
  73. package/dist/client/assets/{xml-CbTD7cB8.js → xml-Ddi0-r0D.js} +1 -1
  74. package/dist/client/assets/{xsl-uOqqo7cf.js → xsl-CsFcZHFS.js} +1 -1
  75. package/dist/client/assets/{yaml-BNrLoH59.js → yaml-tGJWoH6Y.js} +1 -1
  76. package/dist/client/index.html +1 -1
  77. package/dist/client/sw.js +1 -1
  78. package/dist/server/analytics/engine.js +832 -0
  79. package/dist/server/assets.js +39 -0
  80. package/dist/server/auth/passphrase.js +70 -0
  81. package/dist/server/config.js +47 -0
  82. package/dist/server/daemon.js +535 -0
  83. package/dist/server/features/ralph-loop.js +138 -0
  84. package/dist/server/features/scheduler.js +260 -0
  85. package/dist/server/features/sticky-notes.js +99 -0
  86. package/dist/server/handlers/analytics.js +28 -0
  87. package/dist/server/handlers/attachment.js +158 -0
  88. package/dist/server/handlers/bookmarks.js +41 -0
  89. package/dist/server/handlers/chat.js +350 -0
  90. package/dist/server/handlers/editor.js +72 -0
  91. package/dist/server/handlers/fs.js +234 -0
  92. package/dist/server/handlers/loop.js +33 -0
  93. package/dist/server/handlers/memory.js +181 -0
  94. package/dist/server/handlers/mesh.js +322 -0
  95. package/dist/server/handlers/notes.js +36 -0
  96. package/dist/server/handlers/plugins.js +593 -0
  97. package/dist/server/handlers/project-settings.js +166 -0
  98. package/dist/server/handlers/scheduler.js +52 -0
  99. package/dist/server/handlers/session.js +194 -0
  100. package/dist/server/handlers/settings.js +148 -0
  101. package/dist/server/handlers/skills.js +360 -0
  102. package/dist/server/handlers/terminal.js +75 -0
  103. package/dist/server/handlers/themes.js +102 -0
  104. package/dist/server/handlers/update.js +124 -0
  105. package/dist/server/identity.js +45 -0
  106. package/dist/server/index.js +435 -0
  107. package/dist/server/logger.js +20 -0
  108. package/dist/server/mesh/connector.js +355 -0
  109. package/dist/server/mesh/crypto.js +88 -0
  110. package/dist/server/mesh/discovery.js +95 -0
  111. package/dist/server/mesh/pairing.js +104 -0
  112. package/dist/server/mesh/peers.js +54 -0
  113. package/dist/server/mesh/proxy.js +86 -0
  114. package/dist/server/mesh/session-sync.js +85 -0
  115. package/dist/server/project/bookmarks.js +77 -0
  116. package/dist/server/project/context-breakdown.js +279 -0
  117. package/dist/server/project/file-browser.js +97 -0
  118. package/dist/server/project/project-files.js +274 -0
  119. package/dist/server/project/registry.js +51 -0
  120. package/dist/server/project/sdk-bridge.js +960 -0
  121. package/dist/server/project/session.js +696 -0
  122. package/dist/server/project/terminal.js +87 -0
  123. package/dist/server/project/warmup.js +242 -0
  124. package/dist/server/push.js +87 -0
  125. package/dist/server/tls.js +50 -0
  126. package/dist/server/tui.js +83 -0
  127. package/dist/server/update-checker.js +119 -0
  128. package/dist/server/ws/broadcast.js +50 -0
  129. package/dist/server/ws/router.js +105 -0
  130. package/dist/server/ws/server.js +2 -0
  131. package/dist/shared/analytics.js +1 -0
  132. package/dist/shared/messages.js +1 -0
  133. package/dist/shared/models.js +1 -0
  134. package/dist/shared/project-settings.js +1 -0
  135. package/package.json +5 -8
  136. package/themes/alabaster.json +9 -0
  137. package/themes/amoled.json +20 -0
  138. package/themes/ayu-light.json +9 -0
  139. package/themes/catppuccin-latte.json +9 -0
  140. package/themes/catppuccin-mocha.json +9 -0
  141. package/themes/clay-light.json +10 -0
  142. package/themes/clay.json +10 -0
  143. package/themes/dracula.json +9 -0
  144. package/themes/everforest-light.json +9 -0
  145. package/themes/everforest.json +9 -0
  146. package/themes/github-light.json +9 -0
  147. package/themes/gruvbox-dark.json +9 -0
  148. package/themes/gruvbox-light.json +9 -0
  149. package/themes/horizon-light.json +9 -0
  150. package/themes/kanagawa-lotus.json +9 -0
  151. package/themes/kanagawa.json +9 -0
  152. package/themes/modus-operandi.json +9 -0
  153. package/themes/monokai.json +9 -0
  154. package/themes/nightfox.json +9 -0
  155. package/themes/nord-light.json +9 -0
  156. package/themes/nord.json +9 -0
  157. package/themes/one-dark.json +9 -0
  158. package/themes/one-light.json +9 -0
  159. package/themes/palenight.json +9 -0
  160. package/themes/paper.json +9 -0
  161. package/themes/penumbra-light.json +9 -0
  162. package/themes/poimandres.json +9 -0
  163. package/themes/quiet-light.json +9 -0
  164. package/themes/rose-pine-dawn.json +9 -0
  165. package/themes/rose-pine.json +9 -0
  166. package/themes/solarized-dark.json +9 -0
  167. package/themes/solarized-light.json +9 -0
  168. package/themes/synthwave84.json +9 -0
  169. package/themes/tokyo-night-light.json +9 -0
  170. package/themes/tokyo-night.json +9 -0
  171. package/themes/vesper.json +9 -0
  172. package/index.html +0 -20
  173. package/public/icons/icon-192.svg +0 -11
  174. package/public/icons/icon-512.svg +0 -11
  175. package/public/sw-push.js +0 -53
  176. package/src/client/App.tsx +0 -42
  177. package/src/client/commands.ts +0 -36
  178. package/src/client/components/analytics/AnalyticsView.tsx +0 -244
  179. package/src/client/components/analytics/ChartCard.tsx +0 -194
  180. package/src/client/components/analytics/PeriodSelector.tsx +0 -42
  181. package/src/client/components/analytics/QuickStats.tsx +0 -122
  182. package/src/client/components/analytics/chartTokens.ts +0 -188
  183. package/src/client/components/analytics/charts/ActivityCalendar.tsx +0 -204
  184. package/src/client/components/analytics/charts/CacheEfficiencyChart.tsx +0 -56
  185. package/src/client/components/analytics/charts/ContextUtilizationChart.tsx +0 -106
  186. package/src/client/components/analytics/charts/CostAreaChart.tsx +0 -79
  187. package/src/client/components/analytics/charts/CostDistributionChart.tsx +0 -59
  188. package/src/client/components/analytics/charts/CostDonutChart.tsx +0 -84
  189. package/src/client/components/analytics/charts/CumulativeCostChart.tsx +0 -59
  190. package/src/client/components/analytics/charts/DailySummaryCards.tsx +0 -86
  191. package/src/client/components/analytics/charts/HourlyHeatmap.tsx +0 -133
  192. package/src/client/components/analytics/charts/NodeFleetOverview.tsx +0 -89
  193. package/src/client/components/analytics/charts/PermissionBreakdown.tsx +0 -98
  194. package/src/client/components/analytics/charts/ProjectRadar.tsx +0 -126
  195. package/src/client/components/analytics/charts/ResponseTimeScatter.tsx +0 -96
  196. package/src/client/components/analytics/charts/SessionBubbleChart.tsx +0 -114
  197. package/src/client/components/analytics/charts/SessionComplexityList.tsx +0 -65
  198. package/src/client/components/analytics/charts/SessionTimeline.tsx +0 -107
  199. package/src/client/components/analytics/charts/TokenFlowChart.tsx +0 -78
  200. package/src/client/components/analytics/charts/TokenSankeyChart.tsx +0 -93
  201. package/src/client/components/analytics/charts/ToolSunburst.tsx +0 -123
  202. package/src/client/components/analytics/charts/ToolTreemap.tsx +0 -110
  203. package/src/client/components/auth/PassphrasePrompt.tsx +0 -70
  204. package/src/client/components/chat/AttachmentChips.tsx +0 -116
  205. package/src/client/components/chat/ChatInput.tsx +0 -533
  206. package/src/client/components/chat/ChatView.tsx +0 -1076
  207. package/src/client/components/chat/CommandPalette.tsx +0 -162
  208. package/src/client/components/chat/ElicitationCard.tsx +0 -238
  209. package/src/client/components/chat/Message.tsx +0 -825
  210. package/src/client/components/chat/ModelSelector.tsx +0 -108
  211. package/src/client/components/chat/PermissionModeSelector.tsx +0 -41
  212. package/src/client/components/chat/PromptQuestion.tsx +0 -271
  213. package/src/client/components/chat/StatusBar.tsx +0 -50
  214. package/src/client/components/chat/TodoCard.tsx +0 -57
  215. package/src/client/components/chat/ToolGroup.tsx +0 -129
  216. package/src/client/components/chat/ToolResultRenderer.tsx +0 -348
  217. package/src/client/components/chat/VoiceRecorder.tsx +0 -85
  218. package/src/client/components/chat/toolSummary.ts +0 -41
  219. package/src/client/components/dashboard/DashboardView.tsx +0 -200
  220. package/src/client/components/dashboard/ProjectDashboardView.tsx +0 -179
  221. package/src/client/components/mesh/NodeBadge.tsx +0 -24
  222. package/src/client/components/mesh/PairingDialog.tsx +0 -340
  223. package/src/client/components/project-settings/ProjectClaude.tsx +0 -318
  224. package/src/client/components/project-settings/ProjectEnvironment.tsx +0 -235
  225. package/src/client/components/project-settings/ProjectGeneral.tsx +0 -76
  226. package/src/client/components/project-settings/ProjectMcp.tsx +0 -232
  227. package/src/client/components/project-settings/ProjectMemory.tsx +0 -488
  228. package/src/client/components/project-settings/ProjectNotifications.tsx +0 -48
  229. package/src/client/components/project-settings/ProjectPermissions.tsx +0 -209
  230. package/src/client/components/project-settings/ProjectPlugins.tsx +0 -117
  231. package/src/client/components/project-settings/ProjectRules.tsx +0 -286
  232. package/src/client/components/project-settings/ProjectSettingsView.tsx +0 -117
  233. package/src/client/components/project-settings/ProjectSkills.tsx +0 -91
  234. package/src/client/components/settings/Appearance.tsx +0 -275
  235. package/src/client/components/settings/BudgetSettings.tsx +0 -165
  236. package/src/client/components/settings/ClaudeSettings.tsx +0 -175
  237. package/src/client/components/settings/Editor.tsx +0 -123
  238. package/src/client/components/settings/Environment.tsx +0 -185
  239. package/src/client/components/settings/GlobalMcp.tsx +0 -216
  240. package/src/client/components/settings/GlobalMemory.tsx +0 -19
  241. package/src/client/components/settings/GlobalPlugins.tsx +0 -806
  242. package/src/client/components/settings/GlobalRules.tsx +0 -149
  243. package/src/client/components/settings/GlobalSkills.tsx +0 -140
  244. package/src/client/components/settings/MeshStatus.tsx +0 -183
  245. package/src/client/components/settings/Notifications.tsx +0 -123
  246. package/src/client/components/settings/SettingsView.tsx +0 -75
  247. package/src/client/components/settings/SkillMarketplace.tsx +0 -175
  248. package/src/client/components/settings/ThemePreview.tsx +0 -140
  249. package/src/client/components/settings/ThemeWizard.tsx +0 -405
  250. package/src/client/components/settings/mcp-shared.tsx +0 -194
  251. package/src/client/components/settings/skill-shared.tsx +0 -186
  252. package/src/client/components/setup/SetupWizard.tsx +0 -755
  253. package/src/client/components/sidebar/AddProjectModal.tsx +0 -438
  254. package/src/client/components/sidebar/NodeSettingsModal.tsx +0 -206
  255. package/src/client/components/sidebar/ProjectDropdown.tsx +0 -211
  256. package/src/client/components/sidebar/ProjectRail.tsx +0 -353
  257. package/src/client/components/sidebar/SearchFilter.tsx +0 -52
  258. package/src/client/components/sidebar/SessionList.tsx +0 -599
  259. package/src/client/components/sidebar/SettingsSidebar.tsx +0 -139
  260. package/src/client/components/sidebar/Sidebar.tsx +0 -469
  261. package/src/client/components/sidebar/UserIsland.tsx +0 -282
  262. package/src/client/components/sidebar/UserMenu.tsx +0 -107
  263. package/src/client/components/ui/CommandPalette.tsx +0 -321
  264. package/src/client/components/ui/ContextMenu.tsx +0 -153
  265. package/src/client/components/ui/ErrorBoundary.tsx +0 -56
  266. package/src/client/components/ui/IconPicker.tsx +0 -184
  267. package/src/client/components/ui/KeyboardShortcuts.tsx +0 -129
  268. package/src/client/components/ui/LatticeLogomark.tsx +0 -19
  269. package/src/client/components/ui/NodeDisconnectedOverlay.tsx +0 -35
  270. package/src/client/components/ui/PopupMenu.tsx +0 -120
  271. package/src/client/components/ui/SaveFooter.tsx +0 -63
  272. package/src/client/components/ui/Toast.tsx +0 -132
  273. package/src/client/components/ui/UpdateBanner.tsx +0 -110
  274. package/src/client/components/ui/UpdatePrompt.tsx +0 -47
  275. package/src/client/components/workspace/BookmarksView.tsx +0 -156
  276. package/src/client/components/workspace/FileBrowser.tsx +0 -174
  277. package/src/client/components/workspace/FileTree.tsx +0 -129
  278. package/src/client/components/workspace/FileViewer.tsx +0 -211
  279. package/src/client/components/workspace/NoteCard.tsx +0 -120
  280. package/src/client/components/workspace/NotesView.tsx +0 -102
  281. package/src/client/components/workspace/ScheduledTasksView.tsx +0 -117
  282. package/src/client/components/workspace/SplitPane.tsx +0 -81
  283. package/src/client/components/workspace/TabBar.tsx +0 -170
  284. package/src/client/components/workspace/TaskCard.tsx +0 -159
  285. package/src/client/components/workspace/TaskEditModal.tsx +0 -129
  286. package/src/client/components/workspace/TerminalInstance.tsx +0 -171
  287. package/src/client/components/workspace/TerminalView.tsx +0 -110
  288. package/src/client/components/workspace/WorkspaceView.tsx +0 -141
  289. package/src/client/hooks/useAnalytics.ts +0 -84
  290. package/src/client/hooks/useAttachments.ts +0 -313
  291. package/src/client/hooks/useBookmarks.ts +0 -57
  292. package/src/client/hooks/useEditorConfig.ts +0 -28
  293. package/src/client/hooks/useFocusTrap.ts +0 -74
  294. package/src/client/hooks/useIdleDetection.ts +0 -50
  295. package/src/client/hooks/useInstallPrompt.ts +0 -53
  296. package/src/client/hooks/useMesh.ts +0 -89
  297. package/src/client/hooks/useNotifications.ts +0 -54
  298. package/src/client/hooks/useOnline.ts +0 -6
  299. package/src/client/hooks/useProjectSettings.ts +0 -56
  300. package/src/client/hooks/useProjects.ts +0 -98
  301. package/src/client/hooks/usePushNotifications.ts +0 -92
  302. package/src/client/hooks/useSaveState.ts +0 -65
  303. package/src/client/hooks/useSession.ts +0 -580
  304. package/src/client/hooks/useSidebar.ts +0 -90
  305. package/src/client/hooks/useSkills.ts +0 -30
  306. package/src/client/hooks/useSpinnerVerb.ts +0 -36
  307. package/src/client/hooks/useSwipeDrawer.ts +0 -299
  308. package/src/client/hooks/useTheme.ts +0 -114
  309. package/src/client/hooks/useTimeTick.ts +0 -35
  310. package/src/client/hooks/useVoiceRecorder.ts +0 -169
  311. package/src/client/hooks/useWebSocket.ts +0 -27
  312. package/src/client/hooks/useWorkspace.ts +0 -57
  313. package/src/client/lib/theme-derive.ts +0 -196
  314. package/src/client/lib/workspace-url.ts +0 -219
  315. package/src/client/main.tsx +0 -10
  316. package/src/client/providers/WebSocketProvider.tsx +0 -186
  317. package/src/client/router.tsx +0 -578
  318. package/src/client/stores/analytics.ts +0 -68
  319. package/src/client/stores/bookmarks.ts +0 -45
  320. package/src/client/stores/mesh.ts +0 -78
  321. package/src/client/stores/session.ts +0 -569
  322. package/src/client/stores/sidebar.ts +0 -530
  323. package/src/client/stores/theme.ts +0 -44
  324. package/src/client/stores/workspace.ts +0 -518
  325. package/src/client/styles/global.css +0 -391
  326. package/src/client/styles/theme-vars.css +0 -18
  327. package/src/client/themes/index.ts +0 -105
  328. package/src/client/utils/editorUrl.ts +0 -55
  329. package/src/client/utils/findDuplicateKeys.ts +0 -12
  330. package/src/client/utils/formatSessionTitle.ts +0 -17
  331. package/src/client/vite-env.d.ts +0 -6
  332. package/src/server/analytics/engine.ts +0 -920
  333. package/src/server/assets.ts +0 -45
  334. package/src/server/auth/passphrase.ts +0 -78
  335. package/src/server/config.ts +0 -55
  336. package/src/server/daemon.ts +0 -567
  337. package/src/server/features/ralph-loop.ts +0 -173
  338. package/src/server/features/scheduler.ts +0 -304
  339. package/src/server/features/sticky-notes.ts +0 -104
  340. package/src/server/handlers/analytics.ts +0 -39
  341. package/src/server/handlers/attachment.ts +0 -189
  342. package/src/server/handlers/bookmarks.ts +0 -50
  343. package/src/server/handlers/chat.ts +0 -381
  344. package/src/server/handlers/editor.ts +0 -76
  345. package/src/server/handlers/fs.ts +0 -251
  346. package/src/server/handlers/loop.ts +0 -37
  347. package/src/server/handlers/memory.ts +0 -182
  348. package/src/server/handlers/mesh.ts +0 -362
  349. package/src/server/handlers/notes.ts +0 -47
  350. package/src/server/handlers/plugins.ts +0 -655
  351. package/src/server/handlers/project-settings.ts +0 -180
  352. package/src/server/handlers/scheduler.ts +0 -64
  353. package/src/server/handlers/session.ts +0 -226
  354. package/src/server/handlers/settings.ts +0 -157
  355. package/src/server/handlers/skills.ts +0 -378
  356. package/src/server/handlers/terminal.ts +0 -88
  357. package/src/server/handlers/themes.ts +0 -121
  358. package/src/server/handlers/update.ts +0 -133
  359. package/src/server/identity.ts +0 -56
  360. package/src/server/index.ts +0 -454
  361. package/src/server/logger.ts +0 -21
  362. package/src/server/mesh/connector.ts +0 -419
  363. package/src/server/mesh/crypto.ts +0 -106
  364. package/src/server/mesh/discovery.ts +0 -126
  365. package/src/server/mesh/pairing.ts +0 -123
  366. package/src/server/mesh/peers.ts +0 -60
  367. package/src/server/mesh/proxy.ts +0 -106
  368. package/src/server/mesh/session-sync.ts +0 -107
  369. package/src/server/project/bookmarks.ts +0 -83
  370. package/src/server/project/context-breakdown.ts +0 -307
  371. package/src/server/project/file-browser.ts +0 -106
  372. package/src/server/project/project-files.ts +0 -267
  373. package/src/server/project/pty-worker.cjs +0 -83
  374. package/src/server/project/registry.ts +0 -57
  375. package/src/server/project/sdk-bridge.ts +0 -1100
  376. package/src/server/project/session.ts +0 -723
  377. package/src/server/project/terminal.ts +0 -111
  378. package/src/server/project/warmup.ts +0 -285
  379. package/src/server/push.ts +0 -121
  380. package/src/server/tls.ts +0 -65
  381. package/src/server/tui.ts +0 -103
  382. package/src/server/update-checker.ts +0 -147
  383. package/src/server/ws/broadcast.ts +0 -61
  384. package/src/server/ws/router.ts +0 -123
  385. package/src/server/ws/server.ts +0 -2
  386. package/src/shared/analytics.ts +0 -40
  387. package/src/shared/messages.ts +0 -1302
  388. package/src/shared/models.ts +0 -255
  389. package/src/shared/project-settings.ts +0 -45
  390. package/tsconfig.json +0 -25
  391. package/vite.config.ts +0 -71
  392. /package/{src/server/runtime.ts → dist/server/runtime.js} +0 -0
  393. /package/{src/shared/constants.ts → dist/shared/constants.js} +0 -0
  394. /package/{src/shared/index.ts → dist/shared/index.js} +0 -0
@@ -1,189 +0,0 @@
1
- import type { Attachment } from "#shared";
2
- import type { AttachmentChunkMessage, AttachmentCompleteMessage, ClientMessage } from "#shared";
3
- import { registerHandler } from "../ws/router";
4
- import { sendTo } from "../ws/broadcast";
5
-
6
- var MAX_ATTACHMENT_SIZE = 10 * 1024 * 1024;
7
-
8
- interface PendingUpload {
9
- chunks: Map<number, Buffer>;
10
- totalChunks: number;
11
- receivedCount: number;
12
- totalBytes: number;
13
- createdAt: number;
14
- }
15
-
16
- var stores = new Map<string, Map<string, PendingUpload>>();
17
- var completed = new Map<string, Map<string, Attachment>>();
18
-
19
- var TTL_MS = 5 * 60 * 1000;
20
- var CLEANUP_INTERVAL_MS = 60 * 1000;
21
-
22
- function getClientStore(clientId: string): Map<string, PendingUpload> {
23
- var store = stores.get(clientId);
24
- if (!store) {
25
- store = new Map();
26
- stores.set(clientId, store);
27
- }
28
- return store;
29
- }
30
-
31
- function getClientCompleted(clientId: string): Map<string, Attachment> {
32
- var store = completed.get(clientId);
33
- if (!store) {
34
- store = new Map();
35
- completed.set(clientId, store);
36
- }
37
- return store;
38
- }
39
-
40
- registerHandler("attachment", function (clientId: string, message: ClientMessage) {
41
- if (message.type === "attachment:chunk") {
42
- var msg = message as AttachmentChunkMessage;
43
- var store = getClientStore(clientId);
44
-
45
- var pending = store.get(msg.attachmentId);
46
- if (!pending) {
47
- pending = {
48
- chunks: new Map(),
49
- totalChunks: msg.totalChunks,
50
- receivedCount: 0,
51
- totalBytes: 0,
52
- createdAt: Date.now(),
53
- };
54
- store.set(msg.attachmentId, pending);
55
- }
56
-
57
- if (pending.chunks.has(msg.chunkIndex)) {
58
- sendTo(clientId, {
59
- type: "attachment:error",
60
- attachmentId: msg.attachmentId,
61
- error: "Duplicate chunk index: " + msg.chunkIndex,
62
- });
63
- return;
64
- }
65
-
66
- var chunkBuffer = Buffer.from(msg.data, "base64");
67
- if (pending.totalBytes + chunkBuffer.length > MAX_ATTACHMENT_SIZE) {
68
- store.delete(msg.attachmentId);
69
- sendTo(clientId, {
70
- type: "attachment:error",
71
- attachmentId: msg.attachmentId,
72
- error: "Attachment exceeds maximum size of " + (MAX_ATTACHMENT_SIZE / 1024 / 1024) + "MB",
73
- });
74
- return;
75
- }
76
-
77
- pending.chunks.set(msg.chunkIndex, chunkBuffer);
78
- pending.receivedCount++;
79
- pending.totalBytes += chunkBuffer.length;
80
-
81
- sendTo(clientId, {
82
- type: "attachment:progress",
83
- attachmentId: msg.attachmentId,
84
- received: pending.receivedCount,
85
- total: pending.totalChunks,
86
- });
87
- return;
88
- }
89
-
90
- if (message.type === "attachment:complete") {
91
- var completeMsg = message as AttachmentCompleteMessage;
92
- var completeStore = getClientStore(clientId);
93
- var completePending = completeStore.get(completeMsg.attachmentId);
94
-
95
- if (!completePending) {
96
- sendTo(clientId, {
97
- type: "attachment:error",
98
- attachmentId: completeMsg.attachmentId,
99
- error: "No chunks received for this attachment",
100
- });
101
- return;
102
- }
103
-
104
- if (completePending.receivedCount !== completePending.totalChunks) {
105
- sendTo(clientId, {
106
- type: "attachment:error",
107
- attachmentId: completeMsg.attachmentId,
108
- error: "Missing chunks: received " + completePending.receivedCount + " of " + completePending.totalChunks,
109
- });
110
- return;
111
- }
112
-
113
- var buffers: Buffer[] = [];
114
- for (var ci = 0; ci < completePending.totalChunks; ci++) {
115
- var chunk = completePending.chunks.get(ci);
116
- if (!chunk) {
117
- sendTo(clientId, {
118
- type: "attachment:error",
119
- attachmentId: completeMsg.attachmentId,
120
- error: "Missing chunk at index " + ci,
121
- });
122
- return;
123
- }
124
- buffers.push(chunk);
125
- }
126
-
127
- var assembled = Buffer.concat(buffers);
128
- var isText = completeMsg.attachmentType === "paste" || isTextMimeType(completeMsg.mimeType);
129
- var content = isText ? assembled.toString("utf-8") : assembled.toString("base64");
130
-
131
- var attachment: Attachment = {
132
- type: completeMsg.attachmentType,
133
- name: completeMsg.name,
134
- content,
135
- mimeType: completeMsg.mimeType,
136
- size: completeMsg.size,
137
- lineCount: completeMsg.lineCount,
138
- };
139
-
140
- var finishedStore = getClientCompleted(clientId);
141
- finishedStore.set(completeMsg.attachmentId, attachment);
142
- completeStore.delete(completeMsg.attachmentId);
143
- return;
144
- }
145
- });
146
-
147
- function isTextMimeType(mime: string): boolean {
148
- if (mime.startsWith("text/")) return true;
149
- var textTypes = [
150
- "application/json",
151
- "application/xml",
152
- "application/javascript",
153
- "application/typescript",
154
- "application/x-yaml",
155
- "application/yaml",
156
- "image/svg+xml",
157
- ];
158
- return textTypes.indexOf(mime) !== -1;
159
- }
160
-
161
- export function getAttachments(clientId: string, ids: string[]): Attachment[] {
162
- var store = getClientCompleted(clientId);
163
- var result: Attachment[] = [];
164
- for (var i = 0; i < ids.length; i++) {
165
- var att = store.get(ids[i]);
166
- if (att) {
167
- result.push(att);
168
- store.delete(ids[i]);
169
- }
170
- }
171
- return result;
172
- }
173
-
174
- export function cleanupClient(clientId: string): void {
175
- stores.delete(clientId);
176
- completed.delete(clientId);
177
- }
178
-
179
- var ttlCleanupInterval = setInterval(function () {
180
- var now = Date.now();
181
- stores.forEach(function (store) {
182
- store.forEach(function (pending, id) {
183
- if (now - pending.createdAt > TTL_MS) {
184
- store.delete(id);
185
- }
186
- });
187
- });
188
- }, CLEANUP_INTERVAL_MS);
189
- ttlCleanupInterval.unref();
@@ -1,50 +0,0 @@
1
- import type {
2
- ClientMessage,
3
- BookmarkListMessage,
4
- BookmarkAddMessage,
5
- BookmarkRemoveMessage,
6
- } from "#shared";
7
- import { registerHandler } from "../ws/router";
8
- import { sendTo } from "../ws/broadcast";
9
- import { listBookmarks, addBookmark, removeBookmark } from "../project/bookmarks";
10
-
11
- registerHandler("bookmark", function (clientId: string, message: ClientMessage) {
12
- if (message.type === "bookmark:list") {
13
- var listMsg = message as BookmarkListMessage;
14
- var isSessionScoped = Boolean(listMsg.sessionId);
15
- sendTo(clientId, {
16
- type: "bookmark:list_result",
17
- scope: isSessionScoped ? "session" : "all",
18
- bookmarks: listBookmarks(listMsg.projectSlug, listMsg.sessionId),
19
- });
20
- return;
21
- }
22
-
23
- if (message.type === "bookmark:add") {
24
- var addMsg = message as BookmarkAddMessage;
25
- addBookmark({
26
- sessionId: addMsg.sessionId,
27
- projectSlug: addMsg.projectSlug,
28
- messageUuid: addMsg.messageUuid,
29
- messageText: addMsg.messageText,
30
- messageType: addMsg.messageType,
31
- });
32
- sendTo(clientId, {
33
- type: "bookmark:list_result",
34
- scope: "session",
35
- bookmarks: listBookmarks(addMsg.projectSlug, addMsg.sessionId),
36
- });
37
- return;
38
- }
39
-
40
- if (message.type === "bookmark:remove") {
41
- var removeMsg = message as BookmarkRemoveMessage;
42
- removeBookmark(removeMsg.id);
43
- sendTo(clientId, {
44
- type: "bookmark:list_result",
45
- scope: "all",
46
- bookmarks: listBookmarks(),
47
- });
48
- return;
49
- }
50
- });
@@ -1,381 +0,0 @@
1
- import type { ChatSendMessage, ChatPermissionResponseMessage, ChatSetPermissionModeMessage, ChatPromptResponseMessage, ClientMessage } from "#shared";
2
- import { registerHandler } from "../ws/router";
3
- import { sendTo } from "../ws/broadcast";
4
- import { getProjectBySlug } from "../project/registry";
5
- import { loadConfig } from "../config";
6
- import { startChatStream, getPendingPermission, deletePendingPermission, addAutoApprovedTool, setSessionPermissionOverride, getActiveStream, getSessionStream, buildPermissionRule, getPendingElicitation, resolveElicitation } from "../project/sdk-bridge";
7
- import { getAttachments } from "./attachment";
8
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
- import { join } from "node:path";
10
- import { getDailySpend } from "../analytics/engine";
11
- import { log } from "../logger";
12
-
13
- function formatSdkRule(rule: { toolName: string; ruleContent?: string }): string {
14
- if (!rule.ruleContent) return rule.toolName;
15
- if (rule.toolName === "Bash") {
16
- var firstWord = rule.ruleContent.split(/\s+/)[0].replace(/:.*$/, "");
17
- if (firstWord === "curl" || firstWord === "wget") {
18
- var urlMatch = rule.ruleContent.match(/https?:\/\/[^\s"']+/);
19
- if (urlMatch) {
20
- try {
21
- var parsed = new URL(urlMatch[0]);
22
- return rule.toolName + "(" + firstWord + ":" + parsed.hostname + ")";
23
- } catch {}
24
- }
25
- }
26
- return rule.toolName + "(" + firstWord + ":*)";
27
- }
28
- return rule.toolName + "(" + rule.ruleContent + ")";
29
- }
30
-
31
- function addProjectAllowRules(projectPath: string, suggestions: Array<{ type: string; rules?: Array<{ toolName: string; ruleContent?: string }>; directories?: string[]; behavior?: string }> | undefined, fallbackToolName: string, fallbackInput: Record<string, unknown>): void {
32
- var claudeDir = join(projectPath, ".claude");
33
- var settingsPath = join(claudeDir, "settings.json");
34
-
35
- var settings: Record<string, unknown> = {};
36
- if (existsSync(settingsPath)) {
37
- try {
38
- settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
39
- } catch {
40
- settings = {};
41
- }
42
- }
43
-
44
- if (!settings.permissions) {
45
- settings.permissions = {};
46
- }
47
- var permissions = settings.permissions as Record<string, unknown>;
48
- if (!Array.isArray(permissions.allow)) {
49
- permissions.allow = [];
50
- }
51
- if (!Array.isArray(permissions.additionalDirectories)) {
52
- permissions.additionalDirectories = [];
53
- }
54
- var allowList = permissions.allow as string[];
55
- var additionalDirs = permissions.additionalDirectories as string[];
56
-
57
- if (suggestions && suggestions.length > 0) {
58
- for (var si = 0; si < suggestions.length; si++) {
59
- var suggestion = suggestions[si];
60
- if (suggestion.type === "addRules" && suggestion.behavior === "allow" && suggestion.rules) {
61
- for (var ri = 0; ri < suggestion.rules.length; ri++) {
62
- var rule = formatSdkRule(suggestion.rules[ri]);
63
- if (!allowList.includes(rule)) {
64
- allowList.push(rule);
65
- }
66
- if (suggestion.rules[ri].ruleContent) {
67
- var ruleDir = suggestion.rules[ri].ruleContent!.replace(/\/\*\*$/, "").replace(/^\//, "");
68
- if (ruleDir.startsWith("/") && !additionalDirs.includes(ruleDir)) {
69
- additionalDirs.push(ruleDir);
70
- }
71
- }
72
- }
73
- }
74
- if (suggestion.type === "addDirectories" && suggestion.directories) {
75
- for (var di = 0; di < suggestion.directories.length; di++) {
76
- if (!additionalDirs.includes(suggestion.directories[di])) {
77
- additionalDirs.push(suggestion.directories[di]);
78
- }
79
- }
80
- }
81
- }
82
- } else {
83
- var fallbackRule = buildPermissionRule(fallbackToolName, fallbackInput);
84
- if (!allowList.includes(fallbackRule)) {
85
- allowList.push(fallbackRule);
86
- }
87
- }
88
-
89
- if (!existsSync(claudeDir)) {
90
- mkdirSync(claudeDir, { recursive: true });
91
- }
92
- writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
93
- }
94
-
95
- var activeSessionByClient = new Map<string, { projectSlug: string; sessionId: string }>();
96
- var pendingBudgetOverride = new Map<string, { projectSlug: string; sessionId: string; sendMsg: ChatSendMessage; env: Record<string, string> | undefined; cwd: string; }>();
97
-
98
- export function sendBudgetStatus(clientId: string): void {
99
- var config = loadConfig();
100
- if (!config.costBudget) return;
101
- var dailySpend = getDailySpend();
102
- sendTo(clientId, {
103
- type: "budget:status",
104
- dailySpend: dailySpend,
105
- dailyLimit: config.costBudget.dailyLimit,
106
- enforcement: config.costBudget.enforcement,
107
- } as never);
108
- }
109
-
110
- export function setActiveSession(clientId: string, projectSlug: string, sessionId: string): void {
111
- activeSessionByClient.set(clientId, { projectSlug, sessionId });
112
- }
113
-
114
- export function clearActiveSession(clientId: string): void {
115
- activeSessionByClient.delete(clientId);
116
- }
117
-
118
- export function getActiveSession(clientId: string): { projectSlug: string; sessionId: string } | undefined {
119
- return activeSessionByClient.get(clientId);
120
- }
121
-
122
- registerHandler("budget", function (clientId: string, message: ClientMessage) {
123
- if (message.type === "budget:override") {
124
- var pending = pendingBudgetOverride.get(clientId);
125
- if (!pending) return;
126
- pendingBudgetOverride.delete(clientId);
127
-
128
- var overrideAttachments = pending.sendMsg.attachmentIds
129
- ? getAttachments(clientId, pending.sendMsg.attachmentIds)
130
- : [];
131
-
132
- startChatStream({
133
- projectSlug: pending.projectSlug,
134
- sessionId: pending.sessionId,
135
- text: pending.sendMsg.text,
136
- attachments: overrideAttachments,
137
- clientId,
138
- cwd: pending.cwd,
139
- env: pending.env,
140
- model: pending.sendMsg.model,
141
- effort: pending.sendMsg.effort as "low" | "medium" | "high" | "max" | undefined,
142
- });
143
- return;
144
- }
145
- });
146
-
147
- registerHandler("chat", function (clientId: string, message: ClientMessage) {
148
- if (message.type === "chat:send") {
149
- var sendMsg = message as ChatSendMessage;
150
- var active = activeSessionByClient.get(clientId);
151
-
152
- if (!active) {
153
- sendTo(clientId, { type: "chat:error", message: "No active session. Activate a session first." });
154
- return;
155
- }
156
-
157
- var project = getProjectBySlug(active.projectSlug);
158
- if (!project) {
159
- sendTo(clientId, { type: "chat:error", message: `Project not found: ${active.projectSlug}` });
160
- return;
161
- }
162
-
163
- var config = loadConfig();
164
- var env = Object.assign({}, config.globalEnv, project.env);
165
-
166
- if (config.costBudget && config.costBudget.dailyLimit > 0) {
167
- var dailySpend = getDailySpend();
168
- if (dailySpend >= config.costBudget.dailyLimit) {
169
- if (config.costBudget.enforcement === "hard-block") {
170
- sendTo(clientId, { type: "chat:error", message: "Daily cost budget exceeded ($" + dailySpend.toFixed(2) + " / $" + config.costBudget.dailyLimit.toFixed(2) + "). Sending is blocked until tomorrow." });
171
- return;
172
- }
173
- if (config.costBudget.enforcement === "soft-block") {
174
- pendingBudgetOverride.set(clientId, {
175
- projectSlug: active.projectSlug,
176
- sessionId: active.sessionId,
177
- sendMsg: sendMsg,
178
- env: Object.keys(env).length > 0 ? env : undefined,
179
- cwd: project.path,
180
- });
181
- sendTo(clientId, {
182
- type: "budget:exceeded",
183
- dailySpend: dailySpend,
184
- dailyLimit: config.costBudget.dailyLimit,
185
- } as never);
186
- return;
187
- }
188
- }
189
- }
190
-
191
- var attachments = sendMsg.attachmentIds
192
- ? getAttachments(clientId, sendMsg.attachmentIds)
193
- : [];
194
-
195
- startChatStream({
196
- projectSlug: active.projectSlug,
197
- sessionId: active.sessionId,
198
- text: sendMsg.text,
199
- attachments,
200
- clientId,
201
- cwd: project.path,
202
- env: Object.keys(env).length > 0 ? env : undefined,
203
- model: sendMsg.model,
204
- effort: sendMsg.effort as "low" | "medium" | "high" | "max" | undefined,
205
- });
206
-
207
- return;
208
- }
209
-
210
- if (message.type === "chat:cancel") {
211
- var active = activeSessionByClient.get(clientId);
212
- if (!active) {
213
- sendTo(clientId, { type: "chat:error", message: "No active session." });
214
- return;
215
- }
216
- var stream = getActiveStream(active.sessionId);
217
- if (!stream) {
218
- sendTo(clientId, { type: "chat:error", message: "No active stream to cancel." });
219
- return;
220
- }
221
- stream.interrupt().catch(function () {});
222
- return;
223
- }
224
-
225
- if (message.type === "chat:permission_response") {
226
- var permMsg = message as ChatPermissionResponseMessage;
227
- var pending = getPendingPermission(permMsg.requestId);
228
- if (!pending) {
229
- return;
230
- }
231
-
232
- var active = activeSessionByClient.get(clientId);
233
-
234
- if (permMsg.allow) {
235
- if (permMsg.alwaysAllow && permMsg.alwaysAllowScope === "session" && active) {
236
- addAutoApprovedTool(active.sessionId, pending.toolName);
237
- }
238
-
239
- if (permMsg.alwaysAllow && permMsg.alwaysAllowScope === "project" && active) {
240
- var project = getProjectBySlug(active.projectSlug);
241
- if (project) {
242
- addProjectAllowRules(project.path, pending.suggestions as any, pending.toolName, pending.input);
243
- }
244
- pending.resolve({ behavior: "allow", updatedInput: pending.input, toolUseID: pending.toolUseID });
245
- } else {
246
- pending.resolve({ behavior: "allow", updatedInput: pending.input, toolUseID: pending.toolUseID });
247
- }
248
-
249
- var resolvedStatus = permMsg.alwaysAllow ? "always_allowed" : "allowed";
250
- sendTo(clientId, { type: "chat:permission_resolved", requestId: permMsg.requestId, status: resolvedStatus });
251
- } else {
252
- pending.resolve({ behavior: "deny", message: "User denied this operation.", toolUseID: pending.toolUseID });
253
- sendTo(clientId, { type: "chat:permission_resolved", requestId: permMsg.requestId, status: "denied" });
254
- }
255
-
256
- deletePendingPermission(permMsg.requestId);
257
- return;
258
- }
259
-
260
- if (message.type === "chat:prompt_response") {
261
- var promptRespMsg = message as ChatPromptResponseMessage;
262
- var pendingPrompt = getPendingPermission(promptRespMsg.requestId);
263
- if (!pendingPrompt || pendingPrompt.promptType !== "question") {
264
- return;
265
- }
266
-
267
- var updatedInput = Object.assign({}, pendingPrompt.input, {
268
- answers: promptRespMsg.answers,
269
- });
270
- if (promptRespMsg.annotations) {
271
- (updatedInput as Record<string, unknown>).annotations = promptRespMsg.annotations;
272
- }
273
-
274
- pendingPrompt.resolve({
275
- behavior: "allow",
276
- updatedInput: updatedInput,
277
- toolUseID: pendingPrompt.toolUseID,
278
- });
279
-
280
- sendTo(clientId, { type: "chat:prompt_resolved", requestId: promptRespMsg.requestId });
281
- deletePendingPermission(promptRespMsg.requestId);
282
- return;
283
- }
284
-
285
- if ((message as any).type === "chat:elicitation_response") {
286
- var elicitMsg = message as { type: string; requestId: string; action: "accept" | "decline"; content?: Record<string, unknown> };
287
- var pendingElicit = getPendingElicitation(elicitMsg.requestId);
288
- if (!pendingElicit) return;
289
- resolveElicitation(elicitMsg.requestId, {
290
- action: elicitMsg.action,
291
- content: elicitMsg.content || {},
292
- });
293
- return;
294
- }
295
-
296
- if ((message as any).type === "chat:rewind_preview") {
297
- var rewindMsg = message as { type: string; messageUuid: string };
298
- var activeForRewind = activeSessionByClient.get(clientId);
299
- if (!activeForRewind) return;
300
-
301
- var sessionStreamForRewind = getSessionStream(activeForRewind.sessionId);
302
- if (!sessionStreamForRewind) {
303
- sendTo(clientId, { type: "chat:rewind_preview_result", messageUuid: rewindMsg.messageUuid, canRewind: false, error: "No active stream for rewind" } as any);
304
- return;
305
- }
306
-
307
- void sessionStreamForRewind.queryInstance.rewindFiles(rewindMsg.messageUuid, { dryRun: true }).then(function (result) {
308
- sendTo(clientId, {
309
- type: "chat:rewind_preview_result",
310
- messageUuid: rewindMsg.messageUuid,
311
- canRewind: result.canRewind,
312
- error: result.error,
313
- filesChanged: (result.filesChanged || []).length,
314
- filesCreated: 0,
315
- filesDeleted: 0,
316
- } as any);
317
- }).catch(function (err) {
318
- sendTo(clientId, { type: "chat:rewind_preview_result", messageUuid: rewindMsg.messageUuid, canRewind: false, error: String(err) } as any);
319
- });
320
- return;
321
- }
322
-
323
- if ((message as any).type === "chat:rewind_execute") {
324
- var execRewindMsg = message as { type: string; messageUuid: string; mode: string };
325
- var activeForExec = activeSessionByClient.get(clientId);
326
- if (!activeForExec) return;
327
-
328
- var sessionStreamForExec = getSessionStream(activeForExec.sessionId);
329
- if (!sessionStreamForExec) {
330
- sendTo(clientId, { type: "chat:rewind_execute_result", messageUuid: execRewindMsg.messageUuid, success: false, error: "No active stream" } as any);
331
- return;
332
- }
333
-
334
- if (execRewindMsg.mode === "files" || execRewindMsg.mode === "both") {
335
- void sessionStreamForExec.queryInstance.rewindFiles(execRewindMsg.messageUuid, { dryRun: false }).then(function (result) {
336
- sendTo(clientId, {
337
- type: "chat:rewind_execute_result",
338
- messageUuid: execRewindMsg.messageUuid,
339
- success: result.canRewind,
340
- error: result.error,
341
- } as any);
342
- }).catch(function (err) {
343
- sendTo(clientId, { type: "chat:rewind_execute_result", messageUuid: execRewindMsg.messageUuid, success: false, error: String(err) } as any);
344
- });
345
- } else {
346
- sendTo(clientId, { type: "chat:rewind_execute_result", messageUuid: execRewindMsg.messageUuid, success: true } as any);
347
- }
348
- return;
349
- }
350
-
351
- if ((message as any).type === "chat:set_model") {
352
- var modelMsg = message as { type: string; model: string };
353
- var activeSession = activeSessionByClient.get(clientId);
354
- if (!activeSession) return;
355
-
356
- var sessionStream = getSessionStream(activeSession.sessionId);
357
- if (sessionStream) {
358
- void sessionStream.queryInstance.setModel(modelMsg.model === "default" ? undefined : modelMsg.model).catch(function (err) {
359
- log.chat("Failed to switch model: %O", err);
360
- });
361
- sessionStream.currentModel = modelMsg.model;
362
- }
363
- return;
364
- }
365
-
366
- if (message.type === "chat:set_permission_mode") {
367
- var modeMsg = message as ChatSetPermissionModeMessage;
368
- var activeSession = activeSessionByClient.get(clientId);
369
- if (!activeSession) {
370
- return;
371
- }
372
-
373
- var stream = getActiveStream(activeSession.sessionId);
374
- if (stream) {
375
- void stream.setPermissionMode(modeMsg.mode);
376
- } else {
377
- setSessionPermissionOverride(activeSession.sessionId, modeMsg.mode);
378
- }
379
- return;
380
- }
381
- });
@@ -1,76 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
- import { join } from "node:path";
4
- import type { ClientMessage, EditorDetectMessage, EditorEnsureProjectMessage } from "#shared";
5
- import { registerHandler } from "../ws/router";
6
- import { sendTo } from "../ws/broadcast";
7
- import { loadConfig } from "../config";
8
- import { loadOrCreateIdentity } from "../identity";
9
- import { broadcast } from "../ws/broadcast";
10
- import { detectIdeProjectName } from "./settings";
11
-
12
- var binaryNames: Record<string, string[]> = {
13
- "vscode": ["code"],
14
- "vscode-insiders": ["code-insiders"],
15
- "cursor": ["cursor"],
16
- "webstorm": ["webstorm", "webstorm.sh", "wstorm"],
17
- "intellij": ["idea", "idea.sh"],
18
- "pycharm": ["pycharm", "pycharm.sh", "charm"],
19
- "goland": ["goland", "goland.sh"],
20
- "notepad++": ["notepad++"],
21
- "sublime": ["subl", "sublime_text"],
22
- };
23
-
24
- function detectEditorPath(editorType: string): string | null {
25
- var names = binaryNames[editorType];
26
- if (!names) return null;
27
-
28
- for (var i = 0; i < names.length; i++) {
29
- try {
30
- var result = execSync("which " + names[i], { encoding: "utf-8", timeout: 3000 }).trim();
31
- if (result) return result;
32
- } catch {
33
- // not found
34
- }
35
- }
36
- return null;
37
- }
38
-
39
- function ensureIdeaProject(projectPath: string, projectTitle: string): string {
40
- var ideaDir = join(projectPath, ".idea");
41
- if (!existsSync(ideaDir)) {
42
- mkdirSync(ideaDir, { recursive: true });
43
- }
44
- var nameFile = join(ideaDir, ".name");
45
- if (!existsSync(nameFile)) {
46
- writeFileSync(nameFile, projectTitle, "utf-8");
47
- }
48
- return projectTitle;
49
- }
50
-
51
- registerHandler("editor", function (clientId: string, message: ClientMessage) {
52
- if (message.type === "editor:detect") {
53
- var detectMsg = message as EditorDetectMessage;
54
- var detectedPath = detectEditorPath(detectMsg.editorType);
55
- sendTo(clientId, { type: "editor:detect_result", editorType: detectMsg.editorType, path: detectedPath });
56
- return;
57
- }
58
-
59
- if (message.type === "editor:ensure-project") {
60
- var ensureMsg = message as EditorEnsureProjectMessage;
61
- var config = loadConfig();
62
- var project = config.projects.find(function (p: typeof config.projects[number]) { return p.slug === ensureMsg.projectSlug; });
63
- if (project) {
64
- var name = ensureIdeaProject(project.path, project.title);
65
- sendTo(clientId, { type: "editor:ensure-project_result", projectSlug: ensureMsg.projectSlug, ideProjectName: name });
66
- var identity = loadOrCreateIdentity();
67
- broadcast({
68
- type: "projects:list",
69
- projects: config.projects.map(function (p: typeof config.projects[number]) {
70
- return { slug: p.slug, path: p.path, title: p.title, nodeId: identity.id, nodeName: config.name, isRemote: false, ideProjectName: detectIdeProjectName(p.path) };
71
- }),
72
- });
73
- }
74
- return;
75
- }
76
- });