@myrialabs/clopen 0.2.16 → 0.2.18

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 (285) hide show
  1. package/.env.example +4 -4
  2. package/backend/utils/env.ts +5 -5
  3. package/bin/clopen.ts +21 -298
  4. package/dist/assets/addon-clipboard-wHJhZAA4.js +1 -0
  5. package/dist/assets/addon-fit-DX4qG4td.js +1 -0
  6. package/dist/assets/addon-ligatures-DpDY8N_X.js +2 -0
  7. package/dist/assets/addon-unicode11-Bt8F3D7-.js +7 -0
  8. package/dist/assets/addon-web-links-DIbG5aQx.js +1 -0
  9. package/dist/assets/index-C-eR9PGW.js +2 -0
  10. package/dist/assets/main-D1IISCsM.js +247 -0
  11. package/dist/assets/main-DzSwlujO.css +1 -0
  12. package/dist/assets/xterm-B-qIQCd3.js +16 -0
  13. package/{index.html → dist/index.html} +2 -1
  14. package/package.json +12 -2
  15. package/scripts/start.ts +3 -3
  16. package/shared/utils/logger.ts +1 -1
  17. package/.dockerignore +0 -5
  18. package/.github/workflows/ci.yml +0 -86
  19. package/CONTRIBUTING.md +0 -188
  20. package/bun.lock +0 -1127
  21. package/docker-compose.yml +0 -31
  22. package/frontend/App.svelte +0 -77
  23. package/frontend/app-environment.ts +0 -10
  24. package/frontend/app.css +0 -313
  25. package/frontend/components/auth/InvitePage.svelte +0 -215
  26. package/frontend/components/auth/LoginPage.svelte +0 -129
  27. package/frontend/components/auth/SetupPage.svelte +0 -1054
  28. package/frontend/components/chat/ChatInterface.svelte +0 -426
  29. package/frontend/components/chat/formatters/ErrorMessage.svelte +0 -57
  30. package/frontend/components/chat/formatters/MessageFormatter.svelte +0 -244
  31. package/frontend/components/chat/formatters/TextMessage.svelte +0 -383
  32. package/frontend/components/chat/formatters/Tools.svelte +0 -79
  33. package/frontend/components/chat/formatters/index.ts +0 -3
  34. package/frontend/components/chat/input/ChatInput.svelte +0 -492
  35. package/frontend/components/chat/input/components/ChatInputActions.svelte +0 -88
  36. package/frontend/components/chat/input/components/DragDropOverlay.svelte +0 -30
  37. package/frontend/components/chat/input/components/EditModeIndicator.svelte +0 -33
  38. package/frontend/components/chat/input/components/EngineModelPicker.svelte +0 -642
  39. package/frontend/components/chat/input/components/FileAttachmentPreview.svelte +0 -48
  40. package/frontend/components/chat/input/components/LoadingIndicator.svelte +0 -43
  41. package/frontend/components/chat/input/composables/use-animations.svelte.ts +0 -217
  42. package/frontend/components/chat/input/composables/use-chat-actions.svelte.ts +0 -152
  43. package/frontend/components/chat/input/composables/use-file-handling.svelte.ts +0 -216
  44. package/frontend/components/chat/input/composables/use-input-state.svelte.ts +0 -357
  45. package/frontend/components/chat/input/composables/use-textarea-resize.svelte.ts +0 -69
  46. package/frontend/components/chat/message/ChatMessage.svelte +0 -509
  47. package/frontend/components/chat/message/ChatMessages.svelte +0 -553
  48. package/frontend/components/chat/message/DateSeparator.svelte +0 -86
  49. package/frontend/components/chat/message/MessageBubble.svelte +0 -114
  50. package/frontend/components/chat/message/MessageHeader.svelte +0 -143
  51. package/frontend/components/chat/modal/DebugModal.svelte +0 -59
  52. package/frontend/components/chat/shared/index.ts +0 -2
  53. package/frontend/components/chat/shared/utils.ts +0 -116
  54. package/frontend/components/chat/tools/AgentTool.svelte +0 -96
  55. package/frontend/components/chat/tools/AskUserQuestionTool.svelte +0 -391
  56. package/frontend/components/chat/tools/BashOutputTool.svelte +0 -35
  57. package/frontend/components/chat/tools/BashTool.svelte +0 -51
  58. package/frontend/components/chat/tools/CustomMcpTool.svelte +0 -141
  59. package/frontend/components/chat/tools/EditTool.svelte +0 -48
  60. package/frontend/components/chat/tools/EnterPlanModeTool.svelte +0 -24
  61. package/frontend/components/chat/tools/ExitPlanModeTool.svelte +0 -29
  62. package/frontend/components/chat/tools/GlobTool.svelte +0 -51
  63. package/frontend/components/chat/tools/GrepTool.svelte +0 -90
  64. package/frontend/components/chat/tools/ListMcpResourcesTool.svelte +0 -31
  65. package/frontend/components/chat/tools/NotebookEditTool.svelte +0 -38
  66. package/frontend/components/chat/tools/ReadMcpResourceTool.svelte +0 -34
  67. package/frontend/components/chat/tools/ReadTool.svelte +0 -41
  68. package/frontend/components/chat/tools/SkillTool.svelte +0 -21
  69. package/frontend/components/chat/tools/TaskStopTool.svelte +0 -26
  70. package/frontend/components/chat/tools/TaskTool.svelte +0 -64
  71. package/frontend/components/chat/tools/TodoWriteTool.svelte +0 -75
  72. package/frontend/components/chat/tools/WebFetchTool.svelte +0 -35
  73. package/frontend/components/chat/tools/WebSearchTool.svelte +0 -84
  74. package/frontend/components/chat/tools/WriteTool.svelte +0 -33
  75. package/frontend/components/chat/tools/components/CodeBlock.svelte +0 -79
  76. package/frontend/components/chat/tools/components/DiffBlock.svelte +0 -408
  77. package/frontend/components/chat/tools/components/FileHeader.svelte +0 -59
  78. package/frontend/components/chat/tools/components/InfoLine.svelte +0 -19
  79. package/frontend/components/chat/tools/components/StatsBadges.svelte +0 -27
  80. package/frontend/components/chat/tools/components/TerminalCommand.svelte +0 -61
  81. package/frontend/components/chat/tools/components/index.ts +0 -7
  82. package/frontend/components/chat/tools/index.ts +0 -30
  83. package/frontend/components/chat/widgets/ContextIndicator.svelte +0 -186
  84. package/frontend/components/chat/widgets/FloatingTodoList.svelte +0 -367
  85. package/frontend/components/checkpoint/ConflictResolutionModal.svelte +0 -189
  86. package/frontend/components/checkpoint/TimelineModal.svelte +0 -447
  87. package/frontend/components/checkpoint/timeline/TimelineEdge.svelte +0 -26
  88. package/frontend/components/checkpoint/timeline/TimelineGraph.svelte +0 -87
  89. package/frontend/components/checkpoint/timeline/TimelineNode.svelte +0 -119
  90. package/frontend/components/checkpoint/timeline/TimelineVersionGroup.svelte +0 -59
  91. package/frontend/components/checkpoint/timeline/animation.ts +0 -168
  92. package/frontend/components/checkpoint/timeline/config.ts +0 -44
  93. package/frontend/components/checkpoint/timeline/graph-builder.ts +0 -304
  94. package/frontend/components/checkpoint/timeline/types.ts +0 -69
  95. package/frontend/components/checkpoint/timeline/utils.ts +0 -53
  96. package/frontend/components/common/display/AvatarBubble.svelte +0 -56
  97. package/frontend/components/common/display/Button.svelte +0 -71
  98. package/frontend/components/common/display/Card.svelte +0 -102
  99. package/frontend/components/common/display/Icon.svelte +0 -58
  100. package/frontend/components/common/display/PageTemplate.svelte +0 -76
  101. package/frontend/components/common/display/ProjectUserAvatars.svelte +0 -79
  102. package/frontend/components/common/display/ThemeToggle.svelte +0 -44
  103. package/frontend/components/common/editor/MonacoEditor.svelte +0 -583
  104. package/frontend/components/common/feedback/Alert.svelte +0 -139
  105. package/frontend/components/common/feedback/ConnectionBanner.svelte +0 -55
  106. package/frontend/components/common/feedback/LoadingScreen.svelte +0 -52
  107. package/frontend/components/common/feedback/LoadingSpinner.svelte +0 -48
  108. package/frontend/components/common/feedback/NotificationToast.svelte +0 -128
  109. package/frontend/components/common/feedback/RestartRequiredModal.svelte +0 -53
  110. package/frontend/components/common/feedback/UpdateBanner.svelte +0 -99
  111. package/frontend/components/common/form/Checkbox.svelte +0 -48
  112. package/frontend/components/common/form/FolderBrowser.svelte +0 -856
  113. package/frontend/components/common/form/Input.svelte +0 -72
  114. package/frontend/components/common/form/ModelSelector.svelte +0 -110
  115. package/frontend/components/common/form/Select.svelte +0 -98
  116. package/frontend/components/common/form/Textarea.svelte +0 -80
  117. package/frontend/components/common/lucide-icons.ts +0 -1642
  118. package/frontend/components/common/material-icons.ts +0 -1082
  119. package/frontend/components/common/media/MediaPreview.svelte +0 -187
  120. package/frontend/components/common/overlay/Dialog.svelte +0 -251
  121. package/frontend/components/common/overlay/Lightbox.svelte +0 -233
  122. package/frontend/components/common/overlay/Modal.svelte +0 -177
  123. package/frontend/components/common/overlay/ModalProvider.svelte +0 -28
  124. package/frontend/components/common/xterm/XTerm.svelte +0 -743
  125. package/frontend/components/common/xterm/index.ts +0 -16
  126. package/frontend/components/common/xterm/terminal-config.ts +0 -68
  127. package/frontend/components/common/xterm/types.ts +0 -32
  128. package/frontend/components/common/xterm/xterm-service.ts +0 -437
  129. package/frontend/components/files/FileNode.svelte +0 -327
  130. package/frontend/components/files/FileTree.svelte +0 -690
  131. package/frontend/components/files/FileViewer.svelte +0 -551
  132. package/frontend/components/files/SearchResults.svelte +0 -303
  133. package/frontend/components/git/BranchManager.svelte +0 -446
  134. package/frontend/components/git/ChangesSection.svelte +0 -196
  135. package/frontend/components/git/CommitForm.svelte +0 -128
  136. package/frontend/components/git/ConflictResolver.svelte +0 -158
  137. package/frontend/components/git/DiffViewer.svelte +0 -298
  138. package/frontend/components/git/FileChangeItem.svelte +0 -119
  139. package/frontend/components/git/GitButton.svelte +0 -33
  140. package/frontend/components/git/GitLog.svelte +0 -401
  141. package/frontend/components/git/GitModal.svelte +0 -80
  142. package/frontend/components/history/HistoryModal.svelte +0 -602
  143. package/frontend/components/history/HistoryView.svelte +0 -561
  144. package/frontend/components/index.ts +0 -34
  145. package/frontend/components/preview/browser/BrowserPreview.svelte +0 -558
  146. package/frontend/components/preview/browser/components/Canvas.svelte +0 -1523
  147. package/frontend/components/preview/browser/components/ConsolePanel.svelte +0 -757
  148. package/frontend/components/preview/browser/components/Container.svelte +0 -507
  149. package/frontend/components/preview/browser/components/ContextMenu.svelte +0 -236
  150. package/frontend/components/preview/browser/components/SelectDropdown.svelte +0 -224
  151. package/frontend/components/preview/browser/components/Toolbar.svelte +0 -358
  152. package/frontend/components/preview/browser/components/VirtualCursor.svelte +0 -36
  153. package/frontend/components/preview/browser/core/cleanup.svelte.ts +0 -155
  154. package/frontend/components/preview/browser/core/coordinator.svelte.ts +0 -885
  155. package/frontend/components/preview/browser/core/interactions.svelte.ts +0 -113
  156. package/frontend/components/preview/browser/core/mcp-handlers.svelte.ts +0 -331
  157. package/frontend/components/preview/browser/core/native-ui-handlers.svelte.ts +0 -391
  158. package/frontend/components/preview/browser/core/stream-handler.svelte.ts +0 -288
  159. package/frontend/components/preview/browser/core/tab-manager.svelte.ts +0 -210
  160. package/frontend/components/preview/browser/core/tab-operations.svelte.ts +0 -241
  161. package/frontend/components/preview/index.ts +0 -2
  162. package/frontend/components/settings/SettingsModal.svelte +0 -268
  163. package/frontend/components/settings/SettingsView.svelte +0 -54
  164. package/frontend/components/settings/account/AccountSettings.svelte +0 -5
  165. package/frontend/components/settings/admin/InviteManagement.svelte +0 -239
  166. package/frontend/components/settings/admin/UserManagement.svelte +0 -127
  167. package/frontend/components/settings/appearance/AppearanceSettings.svelte +0 -104
  168. package/frontend/components/settings/appearance/LayoutPresetSettings.svelte +0 -160
  169. package/frontend/components/settings/appearance/LayoutPreview.svelte +0 -76
  170. package/frontend/components/settings/engines/AIEnginesSettings.svelte +0 -917
  171. package/frontend/components/settings/general/AdvancedSettings.svelte +0 -193
  172. package/frontend/components/settings/general/AuthModeSettings.svelte +0 -229
  173. package/frontend/components/settings/general/DataManagementSettings.svelte +0 -89
  174. package/frontend/components/settings/general/GeneralSettings.svelte +0 -20
  175. package/frontend/components/settings/general/UpdateSettings.svelte +0 -130
  176. package/frontend/components/settings/git/GitSettings.svelte +0 -392
  177. package/frontend/components/settings/model/EngineModelPicker.svelte +0 -284
  178. package/frontend/components/settings/model/ModelSettings.svelte +0 -240
  179. package/frontend/components/settings/notifications/NotificationSettings.svelte +0 -205
  180. package/frontend/components/settings/security/SecuritySettings.svelte +0 -10
  181. package/frontend/components/settings/system/SystemSettings.svelte +0 -10
  182. package/frontend/components/settings/tunnel/TunnelSettings.svelte +0 -1060
  183. package/frontend/components/settings/user/UserSettings.svelte +0 -270
  184. package/frontend/components/terminal/Terminal.svelte +0 -338
  185. package/frontend/components/terminal/TerminalTabs.svelte +0 -88
  186. package/frontend/components/terminal/TerminalView.svelte +0 -55
  187. package/frontend/components/tunnel/TunnelActive.svelte +0 -218
  188. package/frontend/components/tunnel/TunnelButton.svelte +0 -60
  189. package/frontend/components/tunnel/TunnelInactive.svelte +0 -260
  190. package/frontend/components/tunnel/TunnelModal.svelte +0 -101
  191. package/frontend/components/tunnel/TunnelQRCode.svelte +0 -49
  192. package/frontend/components/workspace/DesktopNavigator.svelte +0 -445
  193. package/frontend/components/workspace/MobileNavigator.svelte +0 -427
  194. package/frontend/components/workspace/PanelContainer.svelte +0 -100
  195. package/frontend/components/workspace/PanelHeader.svelte +0 -664
  196. package/frontend/components/workspace/ViewMenu.svelte +0 -146
  197. package/frontend/components/workspace/WorkspaceLayout.svelte +0 -199
  198. package/frontend/components/workspace/layout/DesktopLayout.svelte +0 -15
  199. package/frontend/components/workspace/layout/MobileLayout.svelte +0 -17
  200. package/frontend/components/workspace/layout/split-pane/Container.svelte +0 -42
  201. package/frontend/components/workspace/layout/split-pane/Handle.svelte +0 -85
  202. package/frontend/components/workspace/layout/split-pane/Layout.svelte +0 -62
  203. package/frontend/components/workspace/panels/ChatPanel.svelte +0 -282
  204. package/frontend/components/workspace/panels/FilesPanel.svelte +0 -1376
  205. package/frontend/components/workspace/panels/GitPanel.svelte +0 -1601
  206. package/frontend/components/workspace/panels/PreviewPanel.svelte +0 -153
  207. package/frontend/components/workspace/panels/TerminalPanel.svelte +0 -73
  208. package/frontend/main.ts +0 -17
  209. package/frontend/services/chat/chat.service.ts +0 -975
  210. package/frontend/services/chat/index.ts +0 -7
  211. package/frontend/services/favicon.service.ts +0 -103
  212. package/frontend/services/notification/global-stream-monitor.ts +0 -120
  213. package/frontend/services/notification/index.ts +0 -8
  214. package/frontend/services/notification/push.service.ts +0 -144
  215. package/frontend/services/notification/sound.service.ts +0 -127
  216. package/frontend/services/preview/browser/browser-console.service.ts +0 -61
  217. package/frontend/services/preview/browser/browser-webcodecs.service.ts +0 -1643
  218. package/frontend/services/preview/browser/mcp-integration.svelte.ts +0 -67
  219. package/frontend/services/preview/index.ts +0 -23
  220. package/frontend/services/project/index.ts +0 -8
  221. package/frontend/services/project/status.service.ts +0 -170
  222. package/frontend/services/snapshot/snapshot.service.ts +0 -86
  223. package/frontend/services/terminal/background/index.ts +0 -130
  224. package/frontend/services/terminal/background/session-restore.ts +0 -274
  225. package/frontend/services/terminal/background/stream-manager.ts +0 -286
  226. package/frontend/services/terminal/index.ts +0 -14
  227. package/frontend/services/terminal/persistence.service.ts +0 -260
  228. package/frontend/services/terminal/project.service.ts +0 -1004
  229. package/frontend/services/terminal/session.service.ts +0 -364
  230. package/frontend/services/terminal/terminal.service.ts +0 -379
  231. package/frontend/stores/core/app.svelte.ts +0 -296
  232. package/frontend/stores/core/files.svelte.ts +0 -87
  233. package/frontend/stores/core/presence.svelte.ts +0 -128
  234. package/frontend/stores/core/projects.svelte.ts +0 -325
  235. package/frontend/stores/core/sessions.svelte.ts +0 -452
  236. package/frontend/stores/features/auth.svelte.ts +0 -336
  237. package/frontend/stores/features/claude-accounts.svelte.ts +0 -58
  238. package/frontend/stores/features/models.svelte.ts +0 -89
  239. package/frontend/stores/features/settings.svelte.ts +0 -151
  240. package/frontend/stores/features/terminal.svelte.ts +0 -747
  241. package/frontend/stores/features/tunnel-config.svelte.ts +0 -205
  242. package/frontend/stores/features/tunnel.svelte.ts +0 -277
  243. package/frontend/stores/features/user.svelte.ts +0 -54
  244. package/frontend/stores/ui/chat-input.svelte.ts +0 -57
  245. package/frontend/stores/ui/chat-model.svelte.ts +0 -61
  246. package/frontend/stores/ui/connection.svelte.ts +0 -40
  247. package/frontend/stores/ui/dialog.svelte.ts +0 -59
  248. package/frontend/stores/ui/edit-mode.svelte.ts +0 -214
  249. package/frontend/stores/ui/notification.svelte.ts +0 -169
  250. package/frontend/stores/ui/settings-modal.svelte.ts +0 -116
  251. package/frontend/stores/ui/theme.svelte.ts +0 -179
  252. package/frontend/stores/ui/todo-panel.svelte.ts +0 -39
  253. package/frontend/stores/ui/update.svelte.ts +0 -159
  254. package/frontend/stores/ui/workspace.svelte.ts +0 -798
  255. package/frontend/utils/chat/date-separator.ts +0 -39
  256. package/frontend/utils/chat/message-grouper.ts +0 -329
  257. package/frontend/utils/chat/message-processor.ts +0 -169
  258. package/frontend/utils/chat/tool-handler.ts +0 -287
  259. package/frontend/utils/chat/virtual-scroll.svelte.ts +0 -142
  260. package/frontend/utils/click-outside.ts +0 -20
  261. package/frontend/utils/context-manager.ts +0 -55
  262. package/frontend/utils/file-icon-mappings.ts +0 -769
  263. package/frontend/utils/file-type.ts +0 -68
  264. package/frontend/utils/folder-icon-mappings.ts +0 -1030
  265. package/frontend/utils/git-status.ts +0 -68
  266. package/frontend/utils/native-ui.ts +0 -73
  267. package/frontend/utils/platform.ts +0 -113
  268. package/frontend/utils/port-check.ts +0 -65
  269. package/frontend/utils/preview-constants.ts +0 -45
  270. package/frontend/utils/terminal-formatter.ts +0 -207
  271. package/frontend/utils/theme.ts +0 -6
  272. package/frontend/utils/tree-visualizer.ts +0 -320
  273. package/frontend/utils/ws.ts +0 -90
  274. package/scripts/dev.ts +0 -46
  275. package/scripts/generate-icons.ts +0 -87
  276. package/svelte.config.js +0 -20
  277. package/vite.config.ts +0 -51
  278. /package/{static → dist}/audio/notification.ogg +0 -0
  279. /package/{static → dist}/favicon.svg +0 -0
  280. /package/{static → dist}/fonts/dm-sans/dm-sans-italic-latin-ext.woff2 +0 -0
  281. /package/{static → dist}/fonts/dm-sans/dm-sans-italic-latin.woff2 +0 -0
  282. /package/{static → dist}/fonts/dm-sans/dm-sans-normal-latin-ext.woff2 +0 -0
  283. /package/{static → dist}/fonts/dm-sans/dm-sans-normal-latin.woff2 +0 -0
  284. /package/{static → dist}/fonts/dm-sans.css +0 -0
  285. /package/{static → dist}/manifest.json +0 -0
@@ -1,59 +0,0 @@
1
- import type { AlertOptions, ConfirmOptions, DialogState } from '$shared/types/stores/dialog';
2
-
3
- const dialogState = $state<DialogState>({
4
- alert: {
5
- isOpen: false,
6
- options: {
7
- message: ''
8
- }
9
- },
10
- confirm: {
11
- isOpen: false,
12
- options: {
13
- message: ''
14
- }
15
- }
16
- });
17
-
18
- export const showAlert = (options: AlertOptions): Promise<void> => {
19
- return new Promise((resolve) => {
20
- dialogState.alert = {
21
- isOpen: true,
22
- options,
23
- resolve
24
- };
25
- });
26
- };
27
-
28
- export const showConfirm = (options: ConfirmOptions): Promise<boolean> => {
29
- return new Promise((resolve) => {
30
- dialogState.confirm = {
31
- isOpen: true,
32
- options,
33
- resolve
34
- };
35
- });
36
- };
37
-
38
- export const closeAlert = () => {
39
- if (dialogState.alert.resolve) {
40
- dialogState.alert.resolve();
41
- }
42
- dialogState.alert.isOpen = false;
43
- };
44
-
45
- export const closeConfirm = (confirmed: boolean) => {
46
- if (dialogState.confirm.resolve) {
47
- dialogState.confirm.resolve(confirmed);
48
- }
49
- dialogState.confirm.isOpen = false;
50
- };
51
-
52
- export const dialogStore = {
53
- get alert() {
54
- return dialogState.alert;
55
- },
56
- get confirm() {
57
- return dialogState.confirm;
58
- }
59
- };
@@ -1,214 +0,0 @@
1
- /**
2
- * Edit Mode State Store
3
- * Manages message editing state with collaborative sync
4
- * Server is single source of truth - no client storage
5
- */
6
-
7
- import ws from '$frontend/utils/ws';
8
- import { userStore } from '$frontend/stores/features/user.svelte';
9
- import { sessionState } from '$frontend/stores/core/sessions.svelte';
10
- import { debug } from '$shared/utils/logger';
11
-
12
- export interface EditAttachment {
13
- type: 'image' | 'document';
14
- data: string; // base64
15
- mediaType: string;
16
- fileName: string;
17
- }
18
-
19
- interface EditModeState {
20
- isEditing: boolean;
21
- messageId: string | null;
22
- messageText: string;
23
- messageTimestamp: string | null;
24
- attachments: EditAttachment[];
25
- parentMessageId: string | null;
26
- }
27
-
28
- // Create reactive state
29
- const state = $state<EditModeState>({
30
- isEditing: false,
31
- messageId: null,
32
- messageText: '',
33
- messageTimestamp: null,
34
- attachments: [],
35
- parentMessageId: null
36
- });
37
-
38
- // ============================================================================
39
- // BROADCAST
40
- // ============================================================================
41
-
42
- function broadcastEditMode(isEditing: boolean, messageId: string | null, messageTimestamp: string | null) {
43
- const currentUserId = userStore.currentUser?.id;
44
- const chatSessionId = sessionState.currentSession?.id;
45
- if (!currentUserId || !chatSessionId) return;
46
-
47
- ws.emit('chat:edit-mode', {
48
- senderId: currentUserId,
49
- chatSessionId,
50
- isEditing,
51
- messageId,
52
- messageTimestamp
53
- });
54
- }
55
-
56
- // ============================================================================
57
- // PUBLIC API
58
- // ============================================================================
59
-
60
- /**
61
- * Enter edit mode for a message
62
- */
63
- export function startEdit(
64
- messageId: string,
65
- messageText: string,
66
- messageTimestamp: string,
67
- attachments: EditAttachment[] = [],
68
- parentMessageId: string | null = null
69
- ) {
70
- state.isEditing = true;
71
- state.messageId = messageId;
72
- state.messageText = messageText;
73
- state.messageTimestamp = messageTimestamp;
74
- state.attachments = attachments;
75
- state.parentMessageId = parentMessageId;
76
-
77
- broadcastEditMode(true, messageId, messageTimestamp);
78
- }
79
-
80
- /**
81
- * Cancel edit mode
82
- */
83
- export function cancelEdit() {
84
- state.isEditing = false;
85
- state.messageId = null;
86
- state.messageText = '';
87
- state.messageTimestamp = null;
88
- state.attachments = [];
89
- state.parentMessageId = null;
90
-
91
- broadcastEditMode(false, null, null);
92
- }
93
-
94
- /**
95
- * Check if a message is after the edit point
96
- */
97
- export function isMessageAfterEditPoint(messageTimestamp: string): boolean {
98
- if (!state.isEditing || !state.messageTimestamp) {
99
- return false;
100
- }
101
- return messageTimestamp > state.messageTimestamp;
102
- }
103
-
104
- /**
105
- * Check if a message is the one being edited
106
- */
107
- export function isMessageBeingEdited(messageId: string | undefined): boolean {
108
- if (!state.isEditing || !state.messageId || !messageId) {
109
- return false;
110
- }
111
- return messageId === state.messageId;
112
- }
113
-
114
- /**
115
- * Check if a message should be dimmed (not the one being edited)
116
- */
117
- export function shouldDimMessage(messageId: string | undefined): boolean {
118
- if (!state.isEditing) {
119
- return false;
120
- }
121
- return !isMessageBeingEdited(messageId);
122
- }
123
-
124
- // ============================================================================
125
- // SERVER STATE MANAGEMENT
126
- // ============================================================================
127
-
128
- /**
129
- * Clear state without broadcasting (for project switching)
130
- */
131
- function clearStateQuietly() {
132
- state.isEditing = false;
133
- state.messageId = null;
134
- state.messageText = '';
135
- state.messageTimestamp = null;
136
- state.attachments = [];
137
- state.parentMessageId = null;
138
- }
139
-
140
- /**
141
- * Fetch edit mode state from server for the current project.
142
- * Server is the single source of truth.
143
- */
144
- export async function restoreEditMode() {
145
- try {
146
- const chatSessionId = sessionState.currentSession?.id || '';
147
- const serverState = await ws.http('chat:get-edit-mode', { chatSessionId });
148
- if (serverState && serverState.isEditing && serverState.messageId) {
149
- state.isEditing = true;
150
- state.messageId = serverState.messageId;
151
- state.messageText = '';
152
- state.messageTimestamp = serverState.messageTimestamp;
153
- state.attachments = [];
154
- state.parentMessageId = null;
155
- } else {
156
- clearStateQuietly();
157
- }
158
- } catch {
159
- clearStateQuietly();
160
- }
161
- }
162
-
163
- /**
164
- * Called when switching away from a project.
165
- * Clears in-memory state without broadcasting (server retains per-project state).
166
- */
167
- export function onProjectLeave() {
168
- clearStateQuietly();
169
- }
170
-
171
- /**
172
- * Called when entering a new project.
173
- * Fetches edit mode state from server for the new project.
174
- * MUST be called AFTER ws.setProject() has completed.
175
- */
176
- export async function onProjectEnter() {
177
- await restoreEditMode();
178
- }
179
-
180
- // ============================================================================
181
- // COLLABORATIVE LISTENER
182
- // ============================================================================
183
-
184
- /**
185
- * Setup WebSocket listener for edit mode events from other users.
186
- * Call once during app initialization.
187
- */
188
- export function setupEditModeListener() {
189
- ws.on('chat:edit-mode', (data: {
190
- senderId: string;
191
- isEditing: boolean;
192
- messageId: string | null;
193
- messageTimestamp: string | null;
194
- }) => {
195
- const currentUserId = userStore.currentUser?.id;
196
- if (!currentUserId || data.senderId === currentUserId) return;
197
-
198
- if (data.isEditing && data.messageId) {
199
- debug.log('chat', `User ${data.senderId} started editing message ${data.messageId}`);
200
- state.isEditing = true;
201
- state.messageId = data.messageId;
202
- state.messageText = '';
203
- state.messageTimestamp = data.messageTimestamp;
204
- state.attachments = [];
205
- state.parentMessageId = null;
206
- } else {
207
- debug.log('chat', `User ${data.senderId} cancelled edit mode`);
208
- clearStateQuietly();
209
- }
210
- });
211
- }
212
-
213
- // Export reactive state
214
- export const editModeState = state;
@@ -1,169 +0,0 @@
1
- import type { ToastNotification } from '$shared/types/ui/notifications';
2
-
3
- // Notification store using Svelte 5 runes
4
- export const notificationStore = $state({
5
- notifications: [] as ToastNotification[],
6
- maxNotifications: 5
7
- });
8
-
9
- // Monotonic counter for unique notification IDs
10
- let _notificationCounter = 0;
11
-
12
- // Derived values as functions (cannot export derived state from modules)
13
- export function hasNotifications() {
14
- return notificationStore.notifications.length > 0;
15
- }
16
-
17
- export function notificationCount() {
18
- return notificationStore.notifications.length;
19
- }
20
-
21
- // Notification management functions
22
- export function addNotification(notification: Omit<ToastNotification, 'id'>) {
23
- const newNotification: ToastNotification = {
24
- id: `${Date.now()}-${++_notificationCounter}`,
25
- ...notification,
26
- duration: notification.duration || 5000 // Default 5 seconds
27
- };
28
-
29
- notificationStore.notifications.push(newNotification);
30
-
31
- // Remove oldest notification if we exceed max
32
- if (notificationStore.notifications.length > notificationStore.maxNotifications) {
33
- notificationStore.notifications.shift();
34
- }
35
-
36
- return newNotification;
37
- }
38
-
39
- export function removeNotification(id: string) {
40
- notificationStore.notifications = notificationStore.notifications.filter((n) => n.id !== id);
41
- }
42
-
43
- export function clearNotifications() {
44
- notificationStore.notifications = [];
45
- }
46
-
47
- export function updateNotification(id: string, updates: Partial<ToastNotification>) {
48
- const index = notificationStore.notifications.findIndex((n) => n.id === id);
49
- if (index !== -1) {
50
- notificationStore.notifications[index] = {
51
- ...notificationStore.notifications[index],
52
- ...updates
53
- };
54
- }
55
- }
56
-
57
- // Convenience functions for different notification types
58
- export function showSuccess(title: string, message: string, duration?: number) {
59
- return addNotification({
60
- type: 'success',
61
- title,
62
- message,
63
- duration
64
- });
65
- }
66
-
67
- export function showError(title: string, message: string, duration?: number) {
68
- return addNotification({
69
- type: 'error',
70
- title,
71
- message,
72
- duration: duration || 8000 // Errors should stay longer
73
- });
74
- }
75
-
76
- export function showWarning(title: string, message: string, duration?: number) {
77
- return addNotification({
78
- type: 'warning',
79
- title,
80
- message,
81
- duration: duration || 6000
82
- });
83
- }
84
-
85
- export function showInfo(title: string, message: string, duration?: number) {
86
- return addNotification({
87
- type: 'info',
88
- title,
89
- message,
90
- duration
91
- });
92
- }
93
-
94
- // Show notification with actions
95
- export function showNotificationWithActions(
96
- type: ToastNotification['type'],
97
- title: string,
98
- message: string,
99
- actions: Array<{ label: string; action: () => void }>,
100
- duration?: number
101
- ) {
102
- return addNotification({
103
- type,
104
- title,
105
- message,
106
- actions,
107
- duration: duration || 10000 // Notifications with actions should stay longer
108
- });
109
- }
110
-
111
- // Show progress notification
112
- export function showProgressNotification(title: string, message: string) {
113
- return addNotification({
114
- type: 'info',
115
- title,
116
- message,
117
- duration: 0 // Don't auto-dismiss progress notifications
118
- });
119
- }
120
-
121
- // Auto-dismiss notification after delay
122
- export function autoRemoveNotification(id: string, delay: number) {
123
- setTimeout(() => {
124
- removeNotification(id);
125
- }, delay);
126
- }
127
-
128
- // Initialize notifications
129
- export function initializeNotifications() {
130
- // Clear any existing notifications on initialization
131
- clearNotifications();
132
- }
133
-
134
- // Handle global error notifications
135
- export function showGlobalError(error: Error | string) {
136
- const message = typeof error === 'string' ? error : error.message;
137
- return showError('Error', message);
138
- }
139
-
140
- // Handle API error notifications
141
- export function showApiError(error: any) {
142
- const message =
143
- error?.response?.data?.message || error?.message || 'An unexpected error occurred';
144
- return showError('API Error', message);
145
- }
146
-
147
- // Handle network error notifications
148
- export function showNetworkError() {
149
- return showError('Network Error', 'Please check your internet connection and try again');
150
- }
151
-
152
- // Handle validation error notifications
153
- export function showValidationError(message: string) {
154
- return showWarning('Validation Error', message);
155
- }
156
-
157
- // Handle success operations
158
- export function showOperationSuccess(operation: string) {
159
- return showSuccess('Success', `${operation} completed successfully`);
160
- }
161
-
162
- // Handle file operation notifications
163
- export function showFileOperationSuccess(operation: string, fileName: string) {
164
- return showSuccess('File Operation', `${operation} "${fileName}" successfully`);
165
- }
166
-
167
- export function showFileOperationError(operation: string, fileName: string, error: string) {
168
- return showError('File Operation Failed', `Failed to ${operation} "${fileName}": ${error}`);
169
- }
@@ -1,116 +0,0 @@
1
- /**
2
- * Settings Modal Store - Svelte 5 Runes
3
- * Controls the visibility and active section of the settings modal
4
- */
5
-
6
- import type { IconName } from '$shared/types/ui/icons';
7
-
8
- export type SettingsSection =
9
- | 'models'
10
- | 'engines'
11
- | 'appearance'
12
- | 'notifications'
13
- | 'tunnel'
14
- | 'account'
15
- | 'team'
16
- | 'security'
17
- | 'system';
18
-
19
- interface SettingsModalState {
20
- isOpen: boolean;
21
- activeSection: SettingsSection;
22
- }
23
-
24
- // Settings sections metadata
25
- export interface SettingsSectionMeta {
26
- id: SettingsSection;
27
- label: string;
28
- icon: IconName;
29
- description: string;
30
- adminOnly?: boolean;
31
- }
32
-
33
- export const settingsSections: SettingsSectionMeta[] = [
34
- {
35
- id: 'models',
36
- label: 'Models',
37
- icon: 'lucide:sparkles',
38
- description: 'Chat and commit model'
39
- },
40
- {
41
- id: 'appearance',
42
- label: 'Appearance',
43
- icon: 'lucide:palette',
44
- description: 'Theme and layout'
45
- },
46
- {
47
- id: 'notifications',
48
- label: 'Notifications',
49
- icon: 'lucide:bell',
50
- description: 'Sound and push notifications'
51
- },
52
- {
53
- id: 'tunnel',
54
- label: 'Tunnel',
55
- icon: 'lucide:globe',
56
- description: 'Cloudflare tunnel services'
57
- },
58
- {
59
- id: 'account',
60
- label: 'User Profile',
61
- icon: 'lucide:user',
62
- description: 'Your profile and access'
63
- },
64
- {
65
- id: 'engines',
66
- label: 'Engines',
67
- icon: 'lucide:plug',
68
- description: 'Installation and accounts',
69
- adminOnly: true
70
- },
71
- {
72
- id: 'team',
73
- label: 'Team',
74
- icon: 'lucide:users',
75
- description: 'Users and invites',
76
- adminOnly: true
77
- },
78
- {
79
- id: 'security',
80
- label: 'Security',
81
- icon: 'lucide:shield',
82
- description: 'Login and access control',
83
- adminOnly: true
84
- },
85
- {
86
- id: 'system',
87
- label: 'System',
88
- icon: 'lucide:settings-2',
89
- description: 'Updates and data',
90
- adminOnly: true
91
- }
92
- ];
93
-
94
- // Create the state using Svelte 5 runes
95
- export const settingsModalState = $state<SettingsModalState>({
96
- isOpen: false,
97
- activeSection: 'models'
98
- });
99
-
100
- // Helper functions
101
- export function openSettingsModal(section: SettingsSection = 'models') {
102
- settingsModalState.isOpen = true;
103
- settingsModalState.activeSection = section;
104
- }
105
-
106
- export function closeSettingsModal() {
107
- settingsModalState.isOpen = false;
108
- }
109
-
110
- export function setActiveSection(section: SettingsSection) {
111
- settingsModalState.activeSection = section;
112
- }
113
-
114
- export function toggleSettingsModal() {
115
- settingsModalState.isOpen = !settingsModalState.isOpen;
116
- }