@myrialabs/clopen 0.0.1
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.
- package/.env.example +6 -0
- package/.github/workflows/release.yml +60 -0
- package/.github/workflows/test.yml +40 -0
- package/CONTRIBUTING.md +499 -0
- package/LICENSE +21 -0
- package/README.md +209 -0
- package/backend/index.ts +156 -0
- package/backend/lib/chat/helpers.ts +42 -0
- package/backend/lib/chat/index.ts +2 -0
- package/backend/lib/chat/stream-manager.ts +1126 -0
- package/backend/lib/database/README.md +77 -0
- package/backend/lib/database/index.ts +119 -0
- package/backend/lib/database/migrations/001_create_projects_table.ts +31 -0
- package/backend/lib/database/migrations/002_create_chat_sessions_table.ts +33 -0
- package/backend/lib/database/migrations/003_create_messages_table.ts +32 -0
- package/backend/lib/database/migrations/004_create_prompt_templates_table.ts +34 -0
- package/backend/lib/database/migrations/005_create_settings_table.ts +24 -0
- package/backend/lib/database/migrations/006_add_user_to_messages.ts +58 -0
- package/backend/lib/database/migrations/007_create_stream_states_table.ts +41 -0
- package/backend/lib/database/migrations/008_create_message_snapshots_table.ts +62 -0
- package/backend/lib/database/migrations/009_add_delta_snapshot_fields.ts +41 -0
- package/backend/lib/database/migrations/010_add_soft_delete_and_branch_support.ts +70 -0
- package/backend/lib/database/migrations/011_git_like_commit_graph.ts +156 -0
- package/backend/lib/database/migrations/012_add_file_change_statistics.ts +41 -0
- package/backend/lib/database/migrations/013_checkpoint_tree_state.ts +118 -0
- package/backend/lib/database/migrations/014_add_engine_to_sessions.ts +18 -0
- package/backend/lib/database/migrations/015_add_model_to_sessions.ts +18 -0
- package/backend/lib/database/migrations/016_create_user_projects_table.ts +34 -0
- package/backend/lib/database/migrations/017_add_current_session_to_user_projects.ts +32 -0
- package/backend/lib/database/migrations/018_create_claude_accounts_table.ts +24 -0
- package/backend/lib/database/migrations/019_add_claude_account_to_sessions.ts +18 -0
- package/backend/lib/database/migrations/020_add_snapshot_tree_hash.ts +32 -0
- package/backend/lib/database/migrations/021_drop_prompt_templates_table.ts +33 -0
- package/backend/lib/database/migrations/index.ts +154 -0
- package/backend/lib/database/queries/checkpoint-queries.ts +87 -0
- package/backend/lib/database/queries/engine-queries.ts +75 -0
- package/backend/lib/database/queries/index.ts +9 -0
- package/backend/lib/database/queries/message-queries.ts +472 -0
- package/backend/lib/database/queries/project-queries.ts +117 -0
- package/backend/lib/database/queries/session-queries.ts +271 -0
- package/backend/lib/database/queries/settings-queries.ts +34 -0
- package/backend/lib/database/queries/snapshot-queries.ts +326 -0
- package/backend/lib/database/queries/utils-queries.ts +59 -0
- package/backend/lib/database/seeders/index.ts +13 -0
- package/backend/lib/database/seeders/settings_seeder.ts +84 -0
- package/backend/lib/database/utils/connection.ts +174 -0
- package/backend/lib/database/utils/index.ts +4 -0
- package/backend/lib/database/utils/migration-runner.ts +118 -0
- package/backend/lib/database/utils/seeder-runner.ts +121 -0
- package/backend/lib/engine/adapters/claude/environment.ts +164 -0
- package/backend/lib/engine/adapters/claude/error-handler.ts +60 -0
- package/backend/lib/engine/adapters/claude/index.ts +1 -0
- package/backend/lib/engine/adapters/claude/path-utils.ts +38 -0
- package/backend/lib/engine/adapters/claude/stream.ts +177 -0
- package/backend/lib/engine/adapters/opencode/index.ts +2 -0
- package/backend/lib/engine/adapters/opencode/message-converter.ts +862 -0
- package/backend/lib/engine/adapters/opencode/server.ts +104 -0
- package/backend/lib/engine/adapters/opencode/stream.ts +755 -0
- package/backend/lib/engine/index.ts +196 -0
- package/backend/lib/engine/types.ts +58 -0
- package/backend/lib/files/file-operations.ts +478 -0
- package/backend/lib/files/file-reading.ts +308 -0
- package/backend/lib/files/file-watcher.ts +383 -0
- package/backend/lib/files/path-browsing.ts +382 -0
- package/backend/lib/git/git-executor.ts +88 -0
- package/backend/lib/git/git-parser.ts +411 -0
- package/backend/lib/git/git-service.ts +505 -0
- package/backend/lib/mcp/README.md +1144 -0
- package/backend/lib/mcp/config.ts +316 -0
- package/backend/lib/mcp/index.ts +35 -0
- package/backend/lib/mcp/project-context.ts +236 -0
- package/backend/lib/mcp/servers/browser-automation/actions.ts +156 -0
- package/backend/lib/mcp/servers/browser-automation/browser.ts +419 -0
- package/backend/lib/mcp/servers/browser-automation/index.ts +791 -0
- package/backend/lib/mcp/servers/browser-automation/inspection.ts +501 -0
- package/backend/lib/mcp/servers/helper.ts +143 -0
- package/backend/lib/mcp/servers/index.ts +45 -0
- package/backend/lib/mcp/servers/weather/get-temperature.ts +56 -0
- package/backend/lib/mcp/servers/weather/index.ts +31 -0
- package/backend/lib/mcp/stdio-server.ts +103 -0
- package/backend/lib/mcp/types.ts +65 -0
- package/backend/lib/preview/browser/browser-audio-capture.ts +86 -0
- package/backend/lib/preview/browser/browser-console-manager.ts +263 -0
- package/backend/lib/preview/browser/browser-dialog-handler.ts +222 -0
- package/backend/lib/preview/browser/browser-interaction-handler.ts +421 -0
- package/backend/lib/preview/browser/browser-mcp-control.ts +415 -0
- package/backend/lib/preview/browser/browser-native-ui-handler.ts +512 -0
- package/backend/lib/preview/browser/browser-navigation-tracker.ts +104 -0
- package/backend/lib/preview/browser/browser-pool.ts +357 -0
- package/backend/lib/preview/browser/browser-preview-service.ts +882 -0
- package/backend/lib/preview/browser/browser-tab-manager.ts +935 -0
- package/backend/lib/preview/browser/browser-video-capture.ts +695 -0
- package/backend/lib/preview/browser/scripts/audio-stream.ts +292 -0
- package/backend/lib/preview/browser/scripts/cursor-tracking.ts +85 -0
- package/backend/lib/preview/browser/scripts/video-stream.ts +438 -0
- package/backend/lib/preview/browser/types.ts +359 -0
- package/backend/lib/preview/index.ts +24 -0
- package/backend/lib/project/index.ts +2 -0
- package/backend/lib/project/status-manager.ts +182 -0
- package/backend/lib/shared/index.ts +2 -0
- package/backend/lib/shared/port-utils.ts +25 -0
- package/backend/lib/shared/process-manager.ts +281 -0
- package/backend/lib/snapshot/blob-store.ts +227 -0
- package/backend/lib/snapshot/gitignore.ts +307 -0
- package/backend/lib/snapshot/helpers.ts +397 -0
- package/backend/lib/snapshot/snapshot-service.ts +483 -0
- package/backend/lib/terminal/helpers.ts +14 -0
- package/backend/lib/terminal/index.ts +8 -0
- package/backend/lib/terminal/pty-manager.ts +4 -0
- package/backend/lib/terminal/pty-session-manager.ts +387 -0
- package/backend/lib/terminal/shell-utils.ts +313 -0
- package/backend/lib/terminal/stream-manager.ts +293 -0
- package/backend/lib/tunnel/global-tunnel-manager.ts +243 -0
- package/backend/lib/tunnel/project-tunnel-manager.ts +311 -0
- package/backend/lib/user/helpers.ts +87 -0
- package/backend/lib/utils/ws.ts +944 -0
- package/backend/lib/vite-dev.ts +353 -0
- package/backend/middleware/cors.ts +15 -0
- package/backend/middleware/error-handler.ts +49 -0
- package/backend/middleware/logger.ts +9 -0
- package/backend/types/api.ts +24 -0
- package/backend/ws/README.md +1505 -0
- package/backend/ws/chat/background.ts +198 -0
- package/backend/ws/chat/index.ts +21 -0
- package/backend/ws/chat/stream.ts +707 -0
- package/backend/ws/engine/claude/accounts.ts +401 -0
- package/backend/ws/engine/claude/index.ts +13 -0
- package/backend/ws/engine/claude/status.ts +43 -0
- package/backend/ws/engine/index.ts +14 -0
- package/backend/ws/engine/opencode/index.ts +11 -0
- package/backend/ws/engine/opencode/status.ts +30 -0
- package/backend/ws/engine/utils.ts +36 -0
- package/backend/ws/files/index.ts +30 -0
- package/backend/ws/files/read.ts +189 -0
- package/backend/ws/files/search.ts +453 -0
- package/backend/ws/files/watch.ts +124 -0
- package/backend/ws/files/write.ts +143 -0
- package/backend/ws/git/branch.ts +106 -0
- package/backend/ws/git/commit.ts +39 -0
- package/backend/ws/git/conflict.ts +68 -0
- package/backend/ws/git/diff.ts +69 -0
- package/backend/ws/git/index.ts +24 -0
- package/backend/ws/git/log.ts +41 -0
- package/backend/ws/git/remote.ts +214 -0
- package/backend/ws/git/staging.ts +84 -0
- package/backend/ws/git/status.ts +90 -0
- package/backend/ws/index.ts +69 -0
- package/backend/ws/mcp/index.ts +61 -0
- package/backend/ws/messages/crud.ts +74 -0
- package/backend/ws/messages/index.ts +14 -0
- package/backend/ws/preview/browser/cleanup.ts +129 -0
- package/backend/ws/preview/browser/console.ts +114 -0
- package/backend/ws/preview/browser/interact.ts +513 -0
- package/backend/ws/preview/browser/mcp.ts +129 -0
- package/backend/ws/preview/browser/native-ui.ts +235 -0
- package/backend/ws/preview/browser/stats.ts +55 -0
- package/backend/ws/preview/browser/tab-info.ts +126 -0
- package/backend/ws/preview/browser/tab.ts +166 -0
- package/backend/ws/preview/browser/webcodecs.ts +293 -0
- package/backend/ws/preview/index.ts +146 -0
- package/backend/ws/projects/crud.ts +113 -0
- package/backend/ws/projects/index.ts +25 -0
- package/backend/ws/projects/presence.ts +46 -0
- package/backend/ws/projects/status.ts +116 -0
- package/backend/ws/sessions/crud.ts +327 -0
- package/backend/ws/sessions/index.ts +33 -0
- package/backend/ws/settings/crud.ts +112 -0
- package/backend/ws/settings/index.ts +14 -0
- package/backend/ws/snapshot/index.ts +17 -0
- package/backend/ws/snapshot/restore.ts +173 -0
- package/backend/ws/snapshot/timeline.ts +141 -0
- package/backend/ws/system/index.ts +14 -0
- package/backend/ws/system/operations.ts +49 -0
- package/backend/ws/terminal/index.ts +40 -0
- package/backend/ws/terminal/persistence.ts +153 -0
- package/backend/ws/terminal/session.ts +382 -0
- package/backend/ws/terminal/stream.ts +79 -0
- package/backend/ws/tunnel/index.ts +14 -0
- package/backend/ws/tunnel/operations.ts +91 -0
- package/backend/ws/types.ts +20 -0
- package/backend/ws/user/crud.ts +156 -0
- package/backend/ws/user/index.ts +14 -0
- package/bin/clopen.ts +307 -0
- package/bun.lock +1352 -0
- package/frontend/App.svelte +34 -0
- package/frontend/app.css +313 -0
- package/frontend/lib/app-environment.ts +10 -0
- package/frontend/lib/components/chat/ChatInterface.svelte +407 -0
- package/frontend/lib/components/chat/formatters/ErrorMessage.svelte +57 -0
- package/frontend/lib/components/chat/formatters/MessageFormatter.svelte +224 -0
- package/frontend/lib/components/chat/formatters/TextMessage.svelte +395 -0
- package/frontend/lib/components/chat/formatters/Tools.svelte +70 -0
- package/frontend/lib/components/chat/formatters/index.ts +3 -0
- package/frontend/lib/components/chat/input/ChatInput.svelte +421 -0
- package/frontend/lib/components/chat/input/components/ChatInputActions.svelte +78 -0
- package/frontend/lib/components/chat/input/components/DragDropOverlay.svelte +30 -0
- package/frontend/lib/components/chat/input/components/EditModeIndicator.svelte +33 -0
- package/frontend/lib/components/chat/input/components/EngineModelPicker.svelte +619 -0
- package/frontend/lib/components/chat/input/components/FileAttachmentPreview.svelte +48 -0
- package/frontend/lib/components/chat/input/components/LoadingIndicator.svelte +31 -0
- package/frontend/lib/components/chat/input/composables/use-animations.svelte.ts +201 -0
- package/frontend/lib/components/chat/input/composables/use-chat-actions.svelte.ts +148 -0
- package/frontend/lib/components/chat/input/composables/use-file-handling.svelte.ts +216 -0
- package/frontend/lib/components/chat/input/composables/use-input-state.svelte.ts +357 -0
- package/frontend/lib/components/chat/input/composables/use-textarea-resize.svelte.ts +57 -0
- package/frontend/lib/components/chat/message/ChatMessage.svelte +478 -0
- package/frontend/lib/components/chat/message/ChatMessages.svelte +541 -0
- package/frontend/lib/components/chat/message/DateSeparator.svelte +86 -0
- package/frontend/lib/components/chat/message/MessageBubble.svelte +86 -0
- package/frontend/lib/components/chat/message/MessageHeader.svelte +157 -0
- package/frontend/lib/components/chat/modal/DebugModal.svelte +59 -0
- package/frontend/lib/components/chat/modal/TokenUsageModal.svelte +124 -0
- package/frontend/lib/components/chat/shared/index.ts +2 -0
- package/frontend/lib/components/chat/shared/utils.ts +116 -0
- package/frontend/lib/components/chat/tools/BashOutputTool.svelte +35 -0
- package/frontend/lib/components/chat/tools/BashTool.svelte +46 -0
- package/frontend/lib/components/chat/tools/CustomMcpTool.svelte +139 -0
- package/frontend/lib/components/chat/tools/EditTool.svelte +48 -0
- package/frontend/lib/components/chat/tools/ExitPlanModeTool.svelte +32 -0
- package/frontend/lib/components/chat/tools/GlobTool.svelte +51 -0
- package/frontend/lib/components/chat/tools/GrepTool.svelte +90 -0
- package/frontend/lib/components/chat/tools/KillShellTool.svelte +26 -0
- package/frontend/lib/components/chat/tools/ListMcpResourcesTool.svelte +31 -0
- package/frontend/lib/components/chat/tools/NotebookEditTool.svelte +38 -0
- package/frontend/lib/components/chat/tools/ReadMcpResourceTool.svelte +34 -0
- package/frontend/lib/components/chat/tools/ReadTool.svelte +41 -0
- package/frontend/lib/components/chat/tools/TaskTool.svelte +64 -0
- package/frontend/lib/components/chat/tools/TodoWriteTool.svelte +75 -0
- package/frontend/lib/components/chat/tools/WebFetchTool.svelte +35 -0
- package/frontend/lib/components/chat/tools/WebSearchTool.svelte +84 -0
- package/frontend/lib/components/chat/tools/WriteTool.svelte +33 -0
- package/frontend/lib/components/chat/tools/components/CodeBlock.svelte +79 -0
- package/frontend/lib/components/chat/tools/components/DiffBlock.svelte +408 -0
- package/frontend/lib/components/chat/tools/components/FileHeader.svelte +45 -0
- package/frontend/lib/components/chat/tools/components/InfoLine.svelte +19 -0
- package/frontend/lib/components/chat/tools/components/StatsBadges.svelte +27 -0
- package/frontend/lib/components/chat/tools/components/TerminalCommand.svelte +54 -0
- package/frontend/lib/components/chat/tools/components/index.ts +7 -0
- package/frontend/lib/components/chat/tools/index.ts +26 -0
- package/frontend/lib/components/chat/widgets/FloatingTodoList.svelte +249 -0
- package/frontend/lib/components/chat/widgets/TokenUsage.svelte +78 -0
- package/frontend/lib/components/checkpoint/TimelineModal.svelte +391 -0
- package/frontend/lib/components/checkpoint/timeline/TimelineEdge.svelte +26 -0
- package/frontend/lib/components/checkpoint/timeline/TimelineGraph.svelte +87 -0
- package/frontend/lib/components/checkpoint/timeline/TimelineNode.svelte +108 -0
- package/frontend/lib/components/checkpoint/timeline/TimelineVersionGroup.svelte +59 -0
- package/frontend/lib/components/checkpoint/timeline/animation.ts +168 -0
- package/frontend/lib/components/checkpoint/timeline/config.ts +44 -0
- package/frontend/lib/components/checkpoint/timeline/graph-builder.ts +304 -0
- package/frontend/lib/components/checkpoint/timeline/types.ts +65 -0
- package/frontend/lib/components/checkpoint/timeline/utils.ts +53 -0
- package/frontend/lib/components/common/Alert.svelte +139 -0
- package/frontend/lib/components/common/AvatarBubble.svelte +56 -0
- package/frontend/lib/components/common/Button.svelte +71 -0
- package/frontend/lib/components/common/Card.svelte +102 -0
- package/frontend/lib/components/common/Checkbox.svelte +48 -0
- package/frontend/lib/components/common/Dialog.svelte +249 -0
- package/frontend/lib/components/common/FolderBrowser.svelte +843 -0
- package/frontend/lib/components/common/Icon.svelte +58 -0
- package/frontend/lib/components/common/Input.svelte +72 -0
- package/frontend/lib/components/common/Lightbox.svelte +233 -0
- package/frontend/lib/components/common/LoadingScreen.svelte +52 -0
- package/frontend/lib/components/common/LoadingSpinner.svelte +48 -0
- package/frontend/lib/components/common/Modal.svelte +177 -0
- package/frontend/lib/components/common/ModalProvider.svelte +28 -0
- package/frontend/lib/components/common/ModelSelector.svelte +110 -0
- package/frontend/lib/components/common/MonacoEditor.svelte +569 -0
- package/frontend/lib/components/common/NotificationToast.svelte +113 -0
- package/frontend/lib/components/common/PageTemplate.svelte +76 -0
- package/frontend/lib/components/common/ProjectUserAvatars.svelte +79 -0
- package/frontend/lib/components/common/Select.svelte +98 -0
- package/frontend/lib/components/common/Textarea.svelte +80 -0
- package/frontend/lib/components/common/ThemeToggle.svelte +44 -0
- package/frontend/lib/components/common/lucide-icons.ts +1642 -0
- package/frontend/lib/components/common/material-icons.ts +1082 -0
- package/frontend/lib/components/common/xterm/XTerm.svelte +796 -0
- package/frontend/lib/components/common/xterm/index.ts +16 -0
- package/frontend/lib/components/common/xterm/terminal-config.ts +68 -0
- package/frontend/lib/components/common/xterm/types.ts +31 -0
- package/frontend/lib/components/common/xterm/xterm-service.ts +353 -0
- package/frontend/lib/components/files/FileNode.svelte +384 -0
- package/frontend/lib/components/files/FileTree.svelte +681 -0
- package/frontend/lib/components/files/FileViewer.svelte +728 -0
- package/frontend/lib/components/files/SearchResults.svelte +303 -0
- package/frontend/lib/components/git/BranchManager.svelte +458 -0
- package/frontend/lib/components/git/ChangesSection.svelte +107 -0
- package/frontend/lib/components/git/CommitForm.svelte +76 -0
- package/frontend/lib/components/git/ConflictResolver.svelte +158 -0
- package/frontend/lib/components/git/DiffViewer.svelte +364 -0
- package/frontend/lib/components/git/FileChangeItem.svelte +97 -0
- package/frontend/lib/components/git/GitButton.svelte +33 -0
- package/frontend/lib/components/git/GitLog.svelte +361 -0
- package/frontend/lib/components/git/GitModal.svelte +80 -0
- package/frontend/lib/components/history/HistoryModal.svelte +563 -0
- package/frontend/lib/components/history/HistoryView.svelte +615 -0
- package/frontend/lib/components/index.ts +34 -0
- package/frontend/lib/components/preview/browser/BrowserPreview.svelte +549 -0
- package/frontend/lib/components/preview/browser/components/Canvas.svelte +1058 -0
- package/frontend/lib/components/preview/browser/components/ConsolePanel.svelte +757 -0
- package/frontend/lib/components/preview/browser/components/Container.svelte +450 -0
- package/frontend/lib/components/preview/browser/components/ContextMenu.svelte +236 -0
- package/frontend/lib/components/preview/browser/components/SelectDropdown.svelte +224 -0
- package/frontend/lib/components/preview/browser/components/Toolbar.svelte +339 -0
- package/frontend/lib/components/preview/browser/components/VirtualCursor.svelte +36 -0
- package/frontend/lib/components/preview/browser/core/cleanup.svelte.ts +155 -0
- package/frontend/lib/components/preview/browser/core/coordinator.svelte.ts +837 -0
- package/frontend/lib/components/preview/browser/core/interactions.svelte.ts +113 -0
- package/frontend/lib/components/preview/browser/core/mcp-handlers.svelte.ts +296 -0
- package/frontend/lib/components/preview/browser/core/native-ui-handlers.svelte.ts +391 -0
- package/frontend/lib/components/preview/browser/core/stream-handler.svelte.ts +231 -0
- package/frontend/lib/components/preview/browser/core/tab-manager.svelte.ts +210 -0
- package/frontend/lib/components/preview/browser/core/tab-operations.svelte.ts +239 -0
- package/frontend/lib/components/preview/index.ts +2 -0
- package/frontend/lib/components/settings/SettingsModal.svelte +235 -0
- package/frontend/lib/components/settings/SettingsView.svelte +36 -0
- package/frontend/lib/components/settings/appearance/AppearanceSettings.svelte +51 -0
- package/frontend/lib/components/settings/appearance/LayoutPresetSettings.svelte +160 -0
- package/frontend/lib/components/settings/appearance/LayoutPreview.svelte +76 -0
- package/frontend/lib/components/settings/engines/AIEnginesSettings.svelte +917 -0
- package/frontend/lib/components/settings/general/AdvancedSettings.svelte +187 -0
- package/frontend/lib/components/settings/general/DataManagementSettings.svelte +203 -0
- package/frontend/lib/components/settings/general/GeneralSettings.svelte +10 -0
- package/frontend/lib/components/settings/model/ModelSettings.svelte +357 -0
- package/frontend/lib/components/settings/notifications/NotificationSettings.svelte +205 -0
- package/frontend/lib/components/settings/user/UserSettings.svelte +197 -0
- package/frontend/lib/components/terminal/Terminal.svelte +368 -0
- package/frontend/lib/components/terminal/TerminalTabs.svelte +87 -0
- package/frontend/lib/components/terminal/TerminalView.svelte +55 -0
- package/frontend/lib/components/tunnel/TunnelActive.svelte +142 -0
- package/frontend/lib/components/tunnel/TunnelButton.svelte +54 -0
- package/frontend/lib/components/tunnel/TunnelInactive.svelte +284 -0
- package/frontend/lib/components/tunnel/TunnelModal.svelte +47 -0
- package/frontend/lib/components/tunnel/TunnelQRCode.svelte +49 -0
- package/frontend/lib/components/workspace/DesktopNavigator.svelte +382 -0
- package/frontend/lib/components/workspace/MobileNavigator.svelte +403 -0
- package/frontend/lib/components/workspace/PanelContainer.svelte +100 -0
- package/frontend/lib/components/workspace/PanelHeader.svelte +505 -0
- package/frontend/lib/components/workspace/ViewMenu.svelte +162 -0
- package/frontend/lib/components/workspace/WorkspaceLayout.svelte +169 -0
- package/frontend/lib/components/workspace/layout/DesktopLayout.svelte +15 -0
- package/frontend/lib/components/workspace/layout/MobileLayout.svelte +17 -0
- package/frontend/lib/components/workspace/layout/split-pane/Container.svelte +42 -0
- package/frontend/lib/components/workspace/layout/split-pane/Handle.svelte +85 -0
- package/frontend/lib/components/workspace/layout/split-pane/Layout.svelte +37 -0
- package/frontend/lib/components/workspace/panels/ChatPanel.svelte +274 -0
- package/frontend/lib/components/workspace/panels/FilesPanel.svelte +1261 -0
- package/frontend/lib/components/workspace/panels/GitPanel.svelte +1560 -0
- package/frontend/lib/components/workspace/panels/PreviewPanel.svelte +150 -0
- package/frontend/lib/components/workspace/panels/TerminalPanel.svelte +73 -0
- package/frontend/lib/constants/preview.ts +45 -0
- package/frontend/lib/services/chat/chat.service.ts +704 -0
- package/frontend/lib/services/chat/index.ts +7 -0
- package/frontend/lib/services/notification/global-stream-monitor.ts +86 -0
- package/frontend/lib/services/notification/index.ts +8 -0
- package/frontend/lib/services/notification/push.service.ts +144 -0
- package/frontend/lib/services/notification/sound.service.ts +127 -0
- package/frontend/lib/services/preview/browser/browser-console.service.ts +61 -0
- package/frontend/lib/services/preview/browser/browser-webcodecs.service.ts +1499 -0
- package/frontend/lib/services/preview/browser/mcp-integration.svelte.ts +67 -0
- package/frontend/lib/services/preview/index.ts +23 -0
- package/frontend/lib/services/project/index.ts +8 -0
- package/frontend/lib/services/project/status.service.ts +159 -0
- package/frontend/lib/services/snapshot/snapshot.service.ts +47 -0
- package/frontend/lib/services/terminal/background/index.ts +130 -0
- package/frontend/lib/services/terminal/background/session-restore.ts +274 -0
- package/frontend/lib/services/terminal/background/stream-manager.ts +286 -0
- package/frontend/lib/services/terminal/index.ts +14 -0
- package/frontend/lib/services/terminal/persistence.service.ts +260 -0
- package/frontend/lib/services/terminal/project.service.ts +953 -0
- package/frontend/lib/services/terminal/session.service.ts +364 -0
- package/frontend/lib/services/terminal/terminal.service.ts +369 -0
- package/frontend/lib/stores/core/app.svelte.ts +117 -0
- package/frontend/lib/stores/core/files.svelte.ts +73 -0
- package/frontend/lib/stores/core/presence.svelte.ts +48 -0
- package/frontend/lib/stores/core/projects.svelte.ts +317 -0
- package/frontend/lib/stores/core/sessions.svelte.ts +383 -0
- package/frontend/lib/stores/features/claude-accounts.svelte.ts +58 -0
- package/frontend/lib/stores/features/models.svelte.ts +89 -0
- package/frontend/lib/stores/features/settings.svelte.ts +87 -0
- package/frontend/lib/stores/features/terminal.svelte.ts +701 -0
- package/frontend/lib/stores/features/tunnel.svelte.ts +161 -0
- package/frontend/lib/stores/features/user.svelte.ts +96 -0
- package/frontend/lib/stores/ui/chat-input.svelte.ts +57 -0
- package/frontend/lib/stores/ui/chat-model.svelte.ts +61 -0
- package/frontend/lib/stores/ui/dialog.svelte.ts +59 -0
- package/frontend/lib/stores/ui/edit-mode.svelte.ts +214 -0
- package/frontend/lib/stores/ui/notification.svelte.ts +166 -0
- package/frontend/lib/stores/ui/settings-modal.svelte.ts +88 -0
- package/frontend/lib/stores/ui/theme.svelte.ts +179 -0
- package/frontend/lib/stores/ui/workspace.svelte.ts +754 -0
- package/frontend/lib/types/native-ui.ts +73 -0
- package/frontend/lib/utils/chat/date-separator.ts +39 -0
- package/frontend/lib/utils/chat/message-grouper.ts +219 -0
- package/frontend/lib/utils/chat/message-processor.ts +135 -0
- package/frontend/lib/utils/chat/tool-handler.ts +161 -0
- package/frontend/lib/utils/chat/virtual-scroll.svelte.ts +142 -0
- package/frontend/lib/utils/click-outside.ts +20 -0
- package/frontend/lib/utils/context-manager.ts +257 -0
- package/frontend/lib/utils/file-icon-mappings.ts +769 -0
- package/frontend/lib/utils/folder-icon-mappings.ts +1030 -0
- package/frontend/lib/utils/git-status.ts +68 -0
- package/frontend/lib/utils/platform.ts +113 -0
- package/frontend/lib/utils/port-check.ts +65 -0
- package/frontend/lib/utils/terminalFormatter.ts +207 -0
- package/frontend/lib/utils/theme.ts +6 -0
- package/frontend/lib/utils/tree-visualizer.ts +320 -0
- package/frontend/lib/utils/ws.ts +44 -0
- package/frontend/main.ts +13 -0
- package/index.html +70 -0
- package/package.json +111 -0
- package/scripts/generate-icons.ts +87 -0
- package/scripts/pre-publish-check.sh +142 -0
- package/scripts/setup-hooks.sh +134 -0
- package/scripts/validate-branch-name.sh +47 -0
- package/scripts/validate-commit-msg.sh +42 -0
- package/shared/constants/engines.ts +134 -0
- package/shared/types/database/connection.ts +16 -0
- package/shared/types/database/index.ts +6 -0
- package/shared/types/database/schema.ts +141 -0
- package/shared/types/engine/index.ts +45 -0
- package/shared/types/filesystem/index.ts +22 -0
- package/shared/types/git.ts +171 -0
- package/shared/types/messaging/index.ts +239 -0
- package/shared/types/messaging/tool.ts +526 -0
- package/shared/types/network/api.ts +18 -0
- package/shared/types/network/index.ts +5 -0
- package/shared/types/stores/app.ts +23 -0
- package/shared/types/stores/dialog.ts +21 -0
- package/shared/types/stores/index.ts +3 -0
- package/shared/types/stores/settings.ts +15 -0
- package/shared/types/terminal/index.ts +44 -0
- package/shared/types/ui/components.ts +61 -0
- package/shared/types/ui/icons.ts +23 -0
- package/shared/types/ui/index.ts +22 -0
- package/shared/types/ui/notifications.ts +14 -0
- package/shared/types/ui/theme.ts +12 -0
- package/shared/types/websocket/index.ts +43 -0
- package/shared/types/window.d.ts +13 -0
- package/shared/utils/anonymous-user.ts +168 -0
- package/shared/utils/async.ts +10 -0
- package/shared/utils/diff-calculator.ts +184 -0
- package/shared/utils/file-type-detection.ts +166 -0
- package/shared/utils/logger.ts +158 -0
- package/shared/utils/message-formatter.ts +79 -0
- package/shared/utils/path.ts +47 -0
- package/shared/utils/ws-client.ts +768 -0
- package/shared/utils/ws-server.ts +660 -0
- package/static/audio/notification.ogg +0 -0
- package/static/favicon.svg +8 -0
- package/static/fonts/dm-sans/dm-sans-italic-latin-ext.woff2 +0 -0
- package/static/fonts/dm-sans/dm-sans-italic-latin.woff2 +0 -0
- package/static/fonts/dm-sans/dm-sans-normal-latin-ext.woff2 +0 -0
- package/static/fonts/dm-sans/dm-sans-normal-latin.woff2 +0 -0
- package/static/fonts/dm-sans.css +96 -0
- package/svelte.config.js +20 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
##############################################
|
|
4
|
+
# Pre-Publish Validation
|
|
5
|
+
#
|
|
6
|
+
# Run this before publishing to npm:
|
|
7
|
+
# bash scripts/pre-publish-check.sh
|
|
8
|
+
#
|
|
9
|
+
# Validates:
|
|
10
|
+
# - On main/dev branch
|
|
11
|
+
# - No uncommitted changes
|
|
12
|
+
# - Type check passes
|
|
13
|
+
# - Lint passes
|
|
14
|
+
# - Build succeeds
|
|
15
|
+
##############################################
|
|
16
|
+
|
|
17
|
+
echo ""
|
|
18
|
+
echo "┌─────────────────────────────────────────────┐"
|
|
19
|
+
echo "│ │"
|
|
20
|
+
echo "│ 🔍 Pre-Publish Validation │"
|
|
21
|
+
echo "│ │"
|
|
22
|
+
echo "└─────────────────────────────────────────────┘"
|
|
23
|
+
echo ""
|
|
24
|
+
|
|
25
|
+
# ============================================
|
|
26
|
+
# CHECK 1: Current Branch
|
|
27
|
+
# ============================================
|
|
28
|
+
echo "1️⃣ Checking branch..."
|
|
29
|
+
|
|
30
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
31
|
+
|
|
32
|
+
if [ "$BRANCH" != "main" ] && [ "$BRANCH" != "dev" ]; then
|
|
33
|
+
echo " ❌ Must publish from main or dev branch"
|
|
34
|
+
echo " Current: $BRANCH"
|
|
35
|
+
echo ""
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo " ✅ Branch: $BRANCH"
|
|
40
|
+
echo ""
|
|
41
|
+
|
|
42
|
+
# ============================================
|
|
43
|
+
# CHECK 2: Uncommitted Changes
|
|
44
|
+
# ============================================
|
|
45
|
+
echo "2️⃣ Checking for uncommitted changes..."
|
|
46
|
+
|
|
47
|
+
if ! git diff-index --quiet HEAD --; then
|
|
48
|
+
echo " ❌ You have uncommitted changes"
|
|
49
|
+
echo ""
|
|
50
|
+
git status --short
|
|
51
|
+
echo ""
|
|
52
|
+
echo " Commit or stash changes first"
|
|
53
|
+
echo ""
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
58
|
+
echo " ❌ Working directory not clean"
|
|
59
|
+
echo ""
|
|
60
|
+
git status --short
|
|
61
|
+
echo ""
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
echo " ✅ No uncommitted changes"
|
|
66
|
+
echo ""
|
|
67
|
+
|
|
68
|
+
# ============================================
|
|
69
|
+
# CHECK 3: Type Check
|
|
70
|
+
# ============================================
|
|
71
|
+
echo "3️⃣ Running type check..."
|
|
72
|
+
|
|
73
|
+
bun run check > /dev/null 2>&1
|
|
74
|
+
|
|
75
|
+
if [ $? -ne 0 ]; then
|
|
76
|
+
echo " ❌ Type check failed"
|
|
77
|
+
echo ""
|
|
78
|
+
bun run check
|
|
79
|
+
echo ""
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
echo " ✅ Type check passed"
|
|
84
|
+
echo ""
|
|
85
|
+
|
|
86
|
+
# ============================================
|
|
87
|
+
# CHECK 4: Lint
|
|
88
|
+
# ============================================
|
|
89
|
+
echo "4️⃣ Running lint..."
|
|
90
|
+
|
|
91
|
+
bun run lint > /dev/null 2>&1
|
|
92
|
+
|
|
93
|
+
if [ $? -ne 0 ]; then
|
|
94
|
+
echo " ❌ Lint failed"
|
|
95
|
+
echo ""
|
|
96
|
+
bun run lint
|
|
97
|
+
echo ""
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
echo " ✅ Lint passed"
|
|
102
|
+
echo ""
|
|
103
|
+
|
|
104
|
+
# ============================================
|
|
105
|
+
# CHECK 5: Build
|
|
106
|
+
# ============================================
|
|
107
|
+
echo "5️⃣ Testing build..."
|
|
108
|
+
|
|
109
|
+
bun run build > /dev/null 2>&1
|
|
110
|
+
|
|
111
|
+
if [ $? -ne 0 ]; then
|
|
112
|
+
echo " ❌ Build failed"
|
|
113
|
+
echo ""
|
|
114
|
+
bun run build
|
|
115
|
+
echo ""
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Verify dist exists
|
|
120
|
+
if [ ! -d "dist" ]; then
|
|
121
|
+
echo " ❌ dist/ directory not found"
|
|
122
|
+
echo ""
|
|
123
|
+
exit 1
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
echo " ✅ Build successful"
|
|
127
|
+
echo ""
|
|
128
|
+
|
|
129
|
+
# ============================================
|
|
130
|
+
# All Checks Passed!
|
|
131
|
+
# ============================================
|
|
132
|
+
echo "┌─────────────────────────────────────────────┐"
|
|
133
|
+
echo "│ │"
|
|
134
|
+
echo "│ ✅ All Checks Passed! │"
|
|
135
|
+
echo "│ │"
|
|
136
|
+
echo "└─────────────────────────────────────────────┘"
|
|
137
|
+
echo ""
|
|
138
|
+
echo "Ready to publish:"
|
|
139
|
+
echo ""
|
|
140
|
+
echo " bun publish --dry-run # Preview what will be published"
|
|
141
|
+
echo " bun publish # Publish to npm"
|
|
142
|
+
echo ""
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
##############################################
|
|
4
|
+
# Setup Git Hooks for Clopen
|
|
5
|
+
#
|
|
6
|
+
# This script installs git hooks to validate:
|
|
7
|
+
# - Commit message format
|
|
8
|
+
# - Code quality (type check + lint)
|
|
9
|
+
# - Branch naming
|
|
10
|
+
# - Build success (on main/dev push)
|
|
11
|
+
##############################################
|
|
12
|
+
|
|
13
|
+
echo ""
|
|
14
|
+
echo "🔧 Installing Git Hooks..."
|
|
15
|
+
echo ""
|
|
16
|
+
|
|
17
|
+
HOOKS_DIR=".git/hooks"
|
|
18
|
+
|
|
19
|
+
# ============================================
|
|
20
|
+
# HOOK 1: Validate Commit Message Format
|
|
21
|
+
# ============================================
|
|
22
|
+
echo "📝 Creating commit-msg hook..."
|
|
23
|
+
|
|
24
|
+
cat > "$HOOKS_DIR/commit-msg" << 'EOF'
|
|
25
|
+
#!/bin/bash
|
|
26
|
+
# Validates commit message follows convention
|
|
27
|
+
bash scripts/validate-commit-msg.sh "$1"
|
|
28
|
+
exit $?
|
|
29
|
+
EOF
|
|
30
|
+
|
|
31
|
+
chmod +x "$HOOKS_DIR/commit-msg"
|
|
32
|
+
echo " ✅ commit-msg hook created"
|
|
33
|
+
|
|
34
|
+
# ============================================
|
|
35
|
+
# HOOK 2: Type Check + Lint Before Commit
|
|
36
|
+
# ============================================
|
|
37
|
+
echo "🔍 Creating pre-commit hook..."
|
|
38
|
+
|
|
39
|
+
cat > "$HOOKS_DIR/pre-commit" << 'EOF'
|
|
40
|
+
#!/bin/bash
|
|
41
|
+
echo ""
|
|
42
|
+
echo "🔍 Running pre-commit checks..."
|
|
43
|
+
|
|
44
|
+
# Type check with Bun
|
|
45
|
+
echo " 📝 Type checking..."
|
|
46
|
+
bun run check
|
|
47
|
+
if [ $? -ne 0 ]; then
|
|
48
|
+
echo ""
|
|
49
|
+
echo " ❌ Type check failed"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Lint with Bun
|
|
54
|
+
echo " 🔍 Linting..."
|
|
55
|
+
bun run lint
|
|
56
|
+
if [ $? -ne 0 ]; then
|
|
57
|
+
echo ""
|
|
58
|
+
echo " ❌ Lint failed"
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo " ✅ All checks passed"
|
|
63
|
+
echo ""
|
|
64
|
+
exit 0
|
|
65
|
+
EOF
|
|
66
|
+
|
|
67
|
+
chmod +x "$HOOKS_DIR/pre-commit"
|
|
68
|
+
echo " ✅ pre-commit hook created"
|
|
69
|
+
|
|
70
|
+
# ============================================
|
|
71
|
+
# HOOK 3: Branch Name + Build Test
|
|
72
|
+
# ============================================
|
|
73
|
+
echo "🚀 Creating pre-push hook..."
|
|
74
|
+
|
|
75
|
+
cat > "$HOOKS_DIR/pre-push" << 'EOF'
|
|
76
|
+
#!/bin/bash
|
|
77
|
+
echo ""
|
|
78
|
+
echo "🚀 Running pre-push checks..."
|
|
79
|
+
|
|
80
|
+
# Validate branch name
|
|
81
|
+
echo " 🌿 Checking branch name..."
|
|
82
|
+
bash scripts/validate-branch-name.sh
|
|
83
|
+
if [ $? -ne 0 ]; then
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Get current branch
|
|
88
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
89
|
+
|
|
90
|
+
# Build test for protected branches
|
|
91
|
+
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "dev" ]; then
|
|
92
|
+
echo " 🔨 Testing build (protected branch)..."
|
|
93
|
+
bun run build
|
|
94
|
+
if [ $? -ne 0 ]; then
|
|
95
|
+
echo ""
|
|
96
|
+
echo " ❌ Build failed"
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
echo " ✅ All checks passed"
|
|
102
|
+
echo ""
|
|
103
|
+
exit 0
|
|
104
|
+
EOF
|
|
105
|
+
|
|
106
|
+
chmod +x "$HOOKS_DIR/pre-push"
|
|
107
|
+
echo " ✅ pre-push hook created"
|
|
108
|
+
|
|
109
|
+
# ============================================
|
|
110
|
+
# Make Validation Scripts Executable
|
|
111
|
+
# ============================================
|
|
112
|
+
chmod +x scripts/validate-commit-msg.sh
|
|
113
|
+
chmod +x scripts/validate-branch-name.sh
|
|
114
|
+
|
|
115
|
+
# ============================================
|
|
116
|
+
# Done!
|
|
117
|
+
# ============================================
|
|
118
|
+
echo ""
|
|
119
|
+
echo "✅ Git hooks installed successfully!"
|
|
120
|
+
echo ""
|
|
121
|
+
echo "┌─────────────────────────────────────────────┐"
|
|
122
|
+
echo "│ Hooks Installed: │"
|
|
123
|
+
echo "├─────────────────────────────────────────────┤"
|
|
124
|
+
echo "│ • commit-msg → Validate message format │"
|
|
125
|
+
echo "│ • pre-commit → Type check + Lint │"
|
|
126
|
+
echo "│ • pre-push → Branch name + Build test │"
|
|
127
|
+
echo "└─────────────────────────────────────────────┘"
|
|
128
|
+
echo ""
|
|
129
|
+
echo "📚 See CONTRIBUTING.md for commit/branch conventions"
|
|
130
|
+
echo ""
|
|
131
|
+
echo "⚠️ To bypass (not recommended):"
|
|
132
|
+
echo " git commit --no-verify"
|
|
133
|
+
echo " git push --no-verify"
|
|
134
|
+
echo ""
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Validate branch name format
|
|
4
|
+
# Called by pre-push hook
|
|
5
|
+
|
|
6
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
7
|
+
|
|
8
|
+
# Allowed branch patterns:
|
|
9
|
+
# - main, dev (protected branches)
|
|
10
|
+
# - feature/*, fix/*, docs/*, chore/*
|
|
11
|
+
PATTERN="^(main|dev|feature|fix|docs|chore)/[a-z0-9-]+$"
|
|
12
|
+
|
|
13
|
+
# Allow protected branches
|
|
14
|
+
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "dev" ]; then
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Validate branch name
|
|
19
|
+
if ! echo "$BRANCH" | grep -qE "$PATTERN"; then
|
|
20
|
+
echo ""
|
|
21
|
+
echo "❌ Invalid branch name: $BRANCH"
|
|
22
|
+
echo ""
|
|
23
|
+
echo "Expected format:"
|
|
24
|
+
echo " <type>/<short-description>"
|
|
25
|
+
echo ""
|
|
26
|
+
echo "Types:"
|
|
27
|
+
echo " feature - New feature"
|
|
28
|
+
echo " fix - Bug fix"
|
|
29
|
+
echo " docs - Documentation"
|
|
30
|
+
echo " chore - Other changes"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "Rules:"
|
|
33
|
+
echo " - All lowercase"
|
|
34
|
+
echo " - Use hyphens (not spaces or underscores)"
|
|
35
|
+
echo " - Short and descriptive"
|
|
36
|
+
echo ""
|
|
37
|
+
echo "Examples:"
|
|
38
|
+
echo " feature/add-git-management"
|
|
39
|
+
echo " fix/terminal-crash"
|
|
40
|
+
echo " docs/update-readme"
|
|
41
|
+
echo " chore/update-deps"
|
|
42
|
+
echo ""
|
|
43
|
+
echo "See CONTRIBUTING.md for full guidelines"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
exit 0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Validate commit message format
|
|
4
|
+
# Called by commit-msg hook
|
|
5
|
+
|
|
6
|
+
COMMIT_MSG_FILE=$1
|
|
7
|
+
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
|
|
8
|
+
|
|
9
|
+
# Regex for conventional commits
|
|
10
|
+
# Format: type(scope): subject
|
|
11
|
+
# Examples: feat: add feature, fix(api): resolve bug
|
|
12
|
+
PATTERN="^(feat|fix|docs|chore|release)(\(.+\))?: .{1,72}"
|
|
13
|
+
|
|
14
|
+
if ! echo "$COMMIT_MSG" | grep -qE "$PATTERN"; then
|
|
15
|
+
echo ""
|
|
16
|
+
echo "❌ Invalid commit message format!"
|
|
17
|
+
echo ""
|
|
18
|
+
echo "Expected format:"
|
|
19
|
+
echo " <type>(<scope>): <subject>"
|
|
20
|
+
echo ""
|
|
21
|
+
echo "Types:"
|
|
22
|
+
echo " feat - New feature"
|
|
23
|
+
echo " fix - Bug fix"
|
|
24
|
+
echo " docs - Documentation"
|
|
25
|
+
echo " chore - Other changes (refactor, test, build, etc)"
|
|
26
|
+
echo " release - Version release"
|
|
27
|
+
echo ""
|
|
28
|
+
echo "Examples:"
|
|
29
|
+
echo " feat: add database management"
|
|
30
|
+
echo " fix(terminal): resolve crash issue"
|
|
31
|
+
echo " docs(readme): update installation guide"
|
|
32
|
+
echo " chore: update dependencies"
|
|
33
|
+
echo " release: v0.0.2"
|
|
34
|
+
echo ""
|
|
35
|
+
echo "Your message:"
|
|
36
|
+
echo " $COMMIT_MSG"
|
|
37
|
+
echo ""
|
|
38
|
+
echo "See CONTRIBUTING.md for full guidelines"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
exit 0
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { EngineType, EngineModel, EngineInfo } from '$shared/types/engine';
|
|
2
|
+
|
|
3
|
+
// Re-export engine types for convenience
|
|
4
|
+
export type { EngineModel, EngineType, EngineInfo };
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Engine Definitions
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export const ENGINES: EngineInfo[] = [
|
|
11
|
+
{
|
|
12
|
+
type: 'claude-code',
|
|
13
|
+
name: 'Claude Code',
|
|
14
|
+
description: 'Anthropic Claude models',
|
|
15
|
+
icon: {
|
|
16
|
+
light: '<svg width="1200" height="1200" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg"><g id="g314"><path id="path147" fill="#d97757" stroke="none" d="M 233.959793 800.214905 L 468.644287 668.536987 L 472.590637 657.100647 L 468.644287 650.738403 L 457.208069 650.738403 L 417.986633 648.322144 L 283.892639 644.69812 L 167.597321 639.865845 L 54.926208 633.825623 L 26.577238 627.785339 L 3.3e-05 592.751709 L 2.73832 575.27533 L 26.577238 559.248352 L 60.724873 562.228149 L 136.187973 567.382629 L 249.422867 575.194763 L 331.570496 580.026978 L 453.261841 592.671082 L 472.590637 592.671082 L 475.328857 584.859009 L 468.724915 580.026978 L 463.570557 575.194763 L 346.389313 495.785217 L 219.543671 411.865906 L 153.100723 363.543762 L 117.181267 339.060425 L 99.060455 316.107361 L 91.248367 266.01355 L 123.865784 230.093994 L 167.677887 233.073853 L 178.872513 236.053772 L 223.248367 270.201477 L 318.040283 343.570496 L 441.825592 434.738342 L 459.946411 449.798706 L 467.194672 444.64447 L 468.080597 441.020203 L 459.946411 427.409485 L 392.617493 305.718323 L 320.778564 181.932983 L 288.80542 130.630859 L 280.348999 99.865845 C 277.369171 87.221436 275.194641 76.590698 275.194641 63.624268 L 312.322174 13.20813 L 332.8591 6.604126 L 382.389313 13.20813 L 403.248352 31.328979 L 434.013519 101.71814 L 483.865753 212.537048 L 561.181274 363.221497 L 583.812134 407.919434 L 595.892639 449.315491 L 600.40271 461.959839 L 608.214783 461.959839 L 608.214783 454.711609 L 614.577271 369.825623 L 626.335632 265.61084 L 637.771851 131.516846 L 641.718201 93.745117 L 660.402832 48.483276 L 697.530334 24.000122 L 726.52356 37.852417 L 750.362549 72 L 747.060486 94.067139 L 732.886047 186.201416 L 705.100708 330.52356 L 686.979919 427.167847 L 697.530334 427.167847 L 709.61084 415.087341 L 758.496704 350.174561 L 840.644348 247.490051 L 876.885925 206.738342 L 919.167847 161.71814 L 946.308838 140.29541 L 997.61084 140.29541 L 1035.38269 196.429626 L 1018.469849 254.416199 L 965.637634 321.422852 L 921.825562 378.201538 L 859.006714 462.765259 L 819.785278 530.41626 L 823.409424 535.812073 L 832.75177 534.92627 L 974.657776 504.724915 L 1051.328979 490.872559 L 1142.818848 475.167786 L 1184.214844 494.496582 L 1188.724854 514.147644 L 1172.456421 554.335693 L 1074.604126 578.496765 L 959.838989 601.449829 L 788.939636 641.879272 L 786.845764 643.409485 L 789.261841 646.389343 L 866.255127 653.637634 L 899.194702 655.409424 L 979.812134 655.409424 L 1129.932861 666.604187 L 1169.154419 692.537109 L 1192.671265 724.268677 L 1188.724854 748.429688 L 1128.322144 779.194641 L 1046.818848 759.865845 L 856.590759 714.604126 L 791.355774 698.335754 L 782.335693 698.335754 L 782.335693 703.731567 L 836.69812 756.885986 L 936.322205 846.845581 L 1061.073975 962.81897 L 1067.436279 991.490112 L 1051.409424 1014.120911 L 1034.496704 1011.704712 L 924.885986 929.234924 L 882.604126 892.107544 L 786.845764 811.48999 L 780.483276 811.48999 L 780.483276 819.946289 L 802.550415 852.241699 L 919.087341 1027.409424 L 925.127625 1081.127686 L 916.671204 1098.604126 L 886.469849 1109.154419 L 853.288696 1103.114136 L 785.073914 1007.355835 L 714.684631 899.516785 L 657.906067 802.872498 L 650.979858 806.81897 L 617.476624 1167.704834 L 601.771851 1186.147705 L 565.530212 1200 L 535.328857 1177.046997 L 519.302124 1139.919556 L 535.328857 1066.550537 L 554.657776 970.792053 L 570.362488 894.68457 L 584.536926 800.134277 L 592.993347 768.724976 L 592.429626 766.630859 L 585.503479 767.516968 L 514.22821 865.369263 L 405.825531 1011.865906 L 320.053711 1103.677979 L 299.516815 1111.812256 L 263.919525 1093.369263 L 267.221497 1060.429688 L 287.114136 1031.114136 L 405.825531 880.107361 L 477.422913 786.52356 L 523.651062 732.483276 L 523.328918 724.671265 L 520.590698 724.671265 L 205.288605 929.395935 L 149.154434 936.644409 L 124.993355 914.01355 L 127.973183 876.885986 L 139.409409 864.80542 L 234.201385 799.570435 L 233.879227 799.8927 Z"/></g></svg>',
|
|
17
|
+
dark: '<svg width="1200" height="1200" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg"><g id="g314"><path id="path147" fill="#d97757" stroke="none" d="M 233.959793 800.214905 L 468.644287 668.536987 L 472.590637 657.100647 L 468.644287 650.738403 L 457.208069 650.738403 L 417.986633 648.322144 L 283.892639 644.69812 L 167.597321 639.865845 L 54.926208 633.825623 L 26.577238 627.785339 L 3.3e-05 592.751709 L 2.73832 575.27533 L 26.577238 559.248352 L 60.724873 562.228149 L 136.187973 567.382629 L 249.422867 575.194763 L 331.570496 580.026978 L 453.261841 592.671082 L 472.590637 592.671082 L 475.328857 584.859009 L 468.724915 580.026978 L 463.570557 575.194763 L 346.389313 495.785217 L 219.543671 411.865906 L 153.100723 363.543762 L 117.181267 339.060425 L 99.060455 316.107361 L 91.248367 266.01355 L 123.865784 230.093994 L 167.677887 233.073853 L 178.872513 236.053772 L 223.248367 270.201477 L 318.040283 343.570496 L 441.825592 434.738342 L 459.946411 449.798706 L 467.194672 444.64447 L 468.080597 441.020203 L 459.946411 427.409485 L 392.617493 305.718323 L 320.778564 181.932983 L 288.80542 130.630859 L 280.348999 99.865845 C 277.369171 87.221436 275.194641 76.590698 275.194641 63.624268 L 312.322174 13.20813 L 332.8591 6.604126 L 382.389313 13.20813 L 403.248352 31.328979 L 434.013519 101.71814 L 483.865753 212.537048 L 561.181274 363.221497 L 583.812134 407.919434 L 595.892639 449.315491 L 600.40271 461.959839 L 608.214783 461.959839 L 608.214783 454.711609 L 614.577271 369.825623 L 626.335632 265.61084 L 637.771851 131.516846 L 641.718201 93.745117 L 660.402832 48.483276 L 697.530334 24.000122 L 726.52356 37.852417 L 750.362549 72 L 747.060486 94.067139 L 732.886047 186.201416 L 705.100708 330.52356 L 686.979919 427.167847 L 697.530334 427.167847 L 709.61084 415.087341 L 758.496704 350.174561 L 840.644348 247.490051 L 876.885925 206.738342 L 919.167847 161.71814 L 946.308838 140.29541 L 997.61084 140.29541 L 1035.38269 196.429626 L 1018.469849 254.416199 L 965.637634 321.422852 L 921.825562 378.201538 L 859.006714 462.765259 L 819.785278 530.41626 L 823.409424 535.812073 L 832.75177 534.92627 L 974.657776 504.724915 L 1051.328979 490.872559 L 1142.818848 475.167786 L 1184.214844 494.496582 L 1188.724854 514.147644 L 1172.456421 554.335693 L 1074.604126 578.496765 L 959.838989 601.449829 L 788.939636 641.879272 L 786.845764 643.409485 L 789.261841 646.389343 L 866.255127 653.637634 L 899.194702 655.409424 L 979.812134 655.409424 L 1129.932861 666.604187 L 1169.154419 692.537109 L 1192.671265 724.268677 L 1188.724854 748.429688 L 1128.322144 779.194641 L 1046.818848 759.865845 L 856.590759 714.604126 L 791.355774 698.335754 L 782.335693 698.335754 L 782.335693 703.731567 L 836.69812 756.885986 L 936.322205 846.845581 L 1061.073975 962.81897 L 1067.436279 991.490112 L 1051.409424 1014.120911 L 1034.496704 1011.704712 L 924.885986 929.234924 L 882.604126 892.107544 L 786.845764 811.48999 L 780.483276 811.48999 L 780.483276 819.946289 L 802.550415 852.241699 L 919.087341 1027.409424 L 925.127625 1081.127686 L 916.671204 1098.604126 L 886.469849 1109.154419 L 853.288696 1103.114136 L 785.073914 1007.355835 L 714.684631 899.516785 L 657.906067 802.872498 L 650.979858 806.81897 L 617.476624 1167.704834 L 601.771851 1186.147705 L 565.530212 1200 L 535.328857 1177.046997 L 519.302124 1139.919556 L 535.328857 1066.550537 L 554.657776 970.792053 L 570.362488 894.68457 L 584.536926 800.134277 L 592.993347 768.724976 L 592.429626 766.630859 L 585.503479 767.516968 L 514.22821 865.369263 L 405.825531 1011.865906 L 320.053711 1103.677979 L 299.516815 1111.812256 L 263.919525 1093.369263 L 267.221497 1060.429688 L 287.114136 1031.114136 L 405.825531 880.107361 L 477.422913 786.52356 L 523.651062 732.483276 L 523.328918 724.671265 L 520.590698 724.671265 L 205.288605 929.395935 L 149.154434 936.644409 L 124.993355 914.01355 L 127.973183 876.885986 L 139.409409 864.80542 L 234.201385 799.570435 L 233.879227 799.8927 Z"/></g></svg>'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'opencode',
|
|
22
|
+
name: 'Open Code',
|
|
23
|
+
description: 'Multi-provider AI models',
|
|
24
|
+
icon: {
|
|
25
|
+
light: '<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1401_86274)"><mask id="mask0_1401_86274" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="240" height="300"><path d="M240 0H0V300H240V0Z" fill="white"/></mask><g mask="url(#mask0_1401_86274)"><path d="M180 240H60V120H180V240Z" fill="#CFCECD"/><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#211E1E"/></g></g><defs><clipPath id="clip0_1401_86274"><rect width="240" height="300" fill="white"/></clipPath></defs></svg>',
|
|
26
|
+
dark: '<svg width="240" height="300" viewBox="0 0 240 300" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1401_86283)"><mask id="mask0_1401_86283" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="240" height="300"><path d="M240 0H0V300H240V0Z" fill="white"/></mask><g mask="url(#mask0_1401_86283)"><path d="M180 240H60V120H180V240Z" fill="#4B4646"/><path d="M180 60H60V240H180V60ZM240 300H0V0H240V300Z" fill="#F1ECEC"/></g></g><defs><clipPath id="clip0_1401_86283"><rect width="240" height="300" fill="white"/></clipPath></defs></svg>'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const getEngineInfo = (engineType: EngineType): EngineInfo | undefined => {
|
|
32
|
+
return ENGINES.find(e => e.type === engineType);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Claude Code Models (static)
|
|
37
|
+
// ============================================================================
|
|
38
|
+
|
|
39
|
+
export const CLAUDE_CODE_MODELS: EngineModel[] = [
|
|
40
|
+
{
|
|
41
|
+
id: 'claude-code:opus',
|
|
42
|
+
engine: 'claude-code',
|
|
43
|
+
modelId: 'opus',
|
|
44
|
+
name: 'Opus 4.6',
|
|
45
|
+
provider: 'anthropic',
|
|
46
|
+
description: 'Most capable model with sustained performance for complex, long-running tasks',
|
|
47
|
+
capabilities: ['Reasoning', 'Attachments'],
|
|
48
|
+
contextWindow: 200000,
|
|
49
|
+
category: 'latest'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'claude-code:sonnet',
|
|
53
|
+
engine: 'claude-code',
|
|
54
|
+
modelId: 'sonnet',
|
|
55
|
+
name: 'Sonnet 4.5',
|
|
56
|
+
provider: 'anthropic',
|
|
57
|
+
description: 'High-performance model with excellent coding capabilities and extended thinking',
|
|
58
|
+
capabilities: ['Reasoning', 'Attachments'],
|
|
59
|
+
contextWindow: 200000,
|
|
60
|
+
category: 'latest',
|
|
61
|
+
recommended: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'claude-code:haiku',
|
|
65
|
+
engine: 'claude-code',
|
|
66
|
+
modelId: 'haiku',
|
|
67
|
+
name: 'Haiku 4.5',
|
|
68
|
+
provider: 'anthropic',
|
|
69
|
+
description: 'Fast and efficient model for quick tasks and responses',
|
|
70
|
+
capabilities: ['Reasoning', 'Attachments'],
|
|
71
|
+
contextWindow: 200000,
|
|
72
|
+
category: 'latest'
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
// ============================================================================
|
|
77
|
+
// Model Registry (mutable — dynamic engines can register models at runtime)
|
|
78
|
+
// ============================================================================
|
|
79
|
+
|
|
80
|
+
/** All registered models. Claude Code models are static; Open Code models are fetched dynamically. */
|
|
81
|
+
const modelRegistry: EngineModel[] = [...CLAUDE_CODE_MODELS];
|
|
82
|
+
|
|
83
|
+
/** Register models for a specific engine (replaces any existing models for that engine) */
|
|
84
|
+
export const registerModels = (engine: EngineType, models: EngineModel[]): void => {
|
|
85
|
+
// Remove existing models for this engine
|
|
86
|
+
const filtered = modelRegistry.filter(m => m.engine !== engine);
|
|
87
|
+
modelRegistry.length = 0;
|
|
88
|
+
modelRegistry.push(...filtered, ...models);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Get all registered models (snapshot) */
|
|
92
|
+
export const getAllModels = (): EngineModel[] => [...modelRegistry];
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// Defaults
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export const DEFAULT_ENGINE: EngineType = 'claude-code';
|
|
100
|
+
export const DEFAULT_MODEL = 'claude-code:sonnet';
|
|
101
|
+
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Lookup Helpers
|
|
104
|
+
// ============================================================================
|
|
105
|
+
|
|
106
|
+
export const getModelById = (modelId: string): EngineModel | undefined => {
|
|
107
|
+
return modelRegistry.find(model => model.id === modelId);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const getModelsByEngine = (engine: EngineType): EngineModel[] => {
|
|
111
|
+
return modelRegistry.filter(model => model.engine === engine);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Parse a compound model ID into engine + modelId
|
|
116
|
+
* e.g. "claude-code:sonnet" → { engine: "claude-code", modelId: "sonnet" }
|
|
117
|
+
*/
|
|
118
|
+
export const parseModelId = (compoundId: string): { engine: EngineType; modelId: string } => {
|
|
119
|
+
const colonIndex = compoundId.indexOf(':');
|
|
120
|
+
if (colonIndex !== -1) {
|
|
121
|
+
const engine = compoundId.slice(0, colonIndex) as EngineType;
|
|
122
|
+
const modelId = compoundId.slice(colonIndex + 1);
|
|
123
|
+
return { engine, modelId };
|
|
124
|
+
}
|
|
125
|
+
return { engine: 'claude-code', modelId: compoundId };
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// SDK Configuration - NO LIMITS FOR LOCAL PROJECT
|
|
129
|
+
export const SDK_CONFIG = {
|
|
130
|
+
DEFAULT_MAX_TURNS: undefined, // No limit - unlimited conversation
|
|
131
|
+
DEFAULT_TEMPERATURE: 0.7,
|
|
132
|
+
DEFAULT_MAX_TOKENS: undefined, // No limit - unlimited tokens
|
|
133
|
+
TIMEOUT_MS: undefined, // No timeout - unlimited duration
|
|
134
|
+
} as const;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DatabaseConnection {
|
|
2
|
+
query(sql: string): {
|
|
3
|
+
all(...params: unknown[]): unknown[];
|
|
4
|
+
get(...params: unknown[]): unknown;
|
|
5
|
+
run(...params: unknown[]): unknown;
|
|
6
|
+
finalize(): void;
|
|
7
|
+
};
|
|
8
|
+
prepare(query: string): {
|
|
9
|
+
all(...params: unknown[]): unknown[];
|
|
10
|
+
get(...params: unknown[]): unknown;
|
|
11
|
+
run(...params: unknown[]): unknown;
|
|
12
|
+
finalize(): void;
|
|
13
|
+
};
|
|
14
|
+
exec(query: string): unknown;
|
|
15
|
+
close(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database-specific types
|
|
3
|
+
*
|
|
4
|
+
* Uses official @anthropic-ai/claude-agent-sdk types for consistency
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { SDKMessage, EngineSDKMessage } from '../messaging';
|
|
8
|
+
import type { EngineType } from '../engine';
|
|
9
|
+
|
|
10
|
+
// Core database entities moved from core folder
|
|
11
|
+
export interface Project {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
created_at: string;
|
|
16
|
+
last_opened_at: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ChatSession {
|
|
20
|
+
id: string;
|
|
21
|
+
project_id: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
engine?: EngineType; // AI engine used for this session
|
|
24
|
+
model?: string; // Compound model ID (e.g., 'claude-code:haiku', 'opencode:gpt-5.2')
|
|
25
|
+
claude_account_id?: number; // Per-session Claude account override (references claude_accounts.id)
|
|
26
|
+
latest_sdk_session_id?: string; // Latest SDK session_id from responses
|
|
27
|
+
current_head_message_id?: string; // Git-like HEAD pointer to current branch tip
|
|
28
|
+
started_at: string;
|
|
29
|
+
ended_at?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Settings {
|
|
33
|
+
key: string;
|
|
34
|
+
value: string;
|
|
35
|
+
updated_at: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Database Message interface
|
|
41
|
+
* Stores official SDKMessage as JSON with additional metadata
|
|
42
|
+
*/
|
|
43
|
+
export interface DatabaseMessage {
|
|
44
|
+
id: string;
|
|
45
|
+
session_id: string;
|
|
46
|
+
timestamp: string;
|
|
47
|
+
// Store the complete SDKMessage as JSON for full fidelity
|
|
48
|
+
sdk_message: string; // JSON string of SDKMessage
|
|
49
|
+
// User identification for shared chat
|
|
50
|
+
sender_id?: string | null;
|
|
51
|
+
sender_name?: string | null;
|
|
52
|
+
// Git-like commit graph support
|
|
53
|
+
parent_message_id?: string | null; // Parent message (like git parent commit)
|
|
54
|
+
// Soft delete and branch support for undo/redo (deprecated, kept for backward compatibility)
|
|
55
|
+
is_deleted?: number; // 0 = active, 1 = soft deleted
|
|
56
|
+
branch_id?: string | null; // Branch identifier (now used as branch name)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* SDK Message with database timestamp and user info for UI display
|
|
61
|
+
*/
|
|
62
|
+
export type SDKMessageFormatter = EngineSDKMessage & {
|
|
63
|
+
partialText?: string; // Accumulated partial text for streaming messages (transient, not persisted)
|
|
64
|
+
metadata?: { // System-added info (not part of official SDK response)
|
|
65
|
+
message_id?: string; // Database message ID
|
|
66
|
+
created_at?: string; // Message creation timestamp
|
|
67
|
+
sender_id?: string | null; // User ID who submitted the chat (user messages only)
|
|
68
|
+
sender_name?: string | null; // Display name of who submitted the chat (user messages only)
|
|
69
|
+
parent_message_id?: string | null; // Git-like parent pointer
|
|
70
|
+
engine?: string; // Engine type that produced this message (claude-code, opencode)
|
|
71
|
+
reasoning?: boolean; // Whether this message is a reasoning/thinking message
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Database-specific Setting interface
|
|
77
|
+
* Different from core Settings which might have different structure
|
|
78
|
+
*/
|
|
79
|
+
export interface Setting {
|
|
80
|
+
key: string;
|
|
81
|
+
value: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Message Snapshot for time travel feature
|
|
87
|
+
* Supports both full snapshots and delta (incremental) snapshots
|
|
88
|
+
*/
|
|
89
|
+
export interface MessageSnapshot {
|
|
90
|
+
id: string;
|
|
91
|
+
message_id: string;
|
|
92
|
+
session_id: string;
|
|
93
|
+
project_id: string;
|
|
94
|
+
files_snapshot: string; // JSON string of {[filepath]: fileContent} (legacy) or '{}' (blob-store format)
|
|
95
|
+
project_metadata?: string; // JSON string with project metadata
|
|
96
|
+
created_at: string;
|
|
97
|
+
snapshot_type?: 'full' | 'delta'; // Type of snapshot (default: 'full')
|
|
98
|
+
parent_snapshot_id?: string; // Reference to parent snapshot (for delta snapshots)
|
|
99
|
+
delta_changes?: string; // JSON string of delta changes (legacy: full content, blob-store: hash references)
|
|
100
|
+
// File change statistics (git-like)
|
|
101
|
+
files_changed?: number; // Number of files changed
|
|
102
|
+
insertions?: number; // Number of lines inserted
|
|
103
|
+
deletions?: number; // Number of lines deleted
|
|
104
|
+
// Soft delete and branch support for undo/redo
|
|
105
|
+
is_deleted?: number; // 0 = active, 1 = soft deleted
|
|
106
|
+
branch_id?: string | null; // Branch identifier for multi-branch redo
|
|
107
|
+
// Blob store format (new): tree hash for content-addressable storage
|
|
108
|
+
tree_hash?: string | null; // When set, snapshot uses blob store (files in ~/.clopen/snapshots/)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Delta changes structure for incremental snapshots
|
|
113
|
+
*/
|
|
114
|
+
export interface DeltaChanges {
|
|
115
|
+
added: { [filepath: string]: string }; // New files
|
|
116
|
+
modified: { [filepath: string]: string }; // Changed files with new content
|
|
117
|
+
deleted: string[]; // Deleted file paths
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Session Relationship for tracking session branching
|
|
122
|
+
*/
|
|
123
|
+
export interface SessionRelationship {
|
|
124
|
+
id: string;
|
|
125
|
+
parent_session_id: string;
|
|
126
|
+
child_session_id: string;
|
|
127
|
+
branched_from_message_id?: string;
|
|
128
|
+
created_at: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Branch tracking for git-like version control
|
|
133
|
+
* Each branch has a name and points to a HEAD message
|
|
134
|
+
*/
|
|
135
|
+
export interface Branch {
|
|
136
|
+
id: string;
|
|
137
|
+
session_id: string;
|
|
138
|
+
branch_name: string; // Human-readable branch name (e.g., "version_1", "version_2")
|
|
139
|
+
head_message_id: string; // Points to the tip of this branch
|
|
140
|
+
created_at: string;
|
|
141
|
+
}
|