@kabmo-labs/kabmo 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +336 -336
- package/dist/client/static/js/index-18xe7655.css +1 -0
- package/dist/client/static/js/{index-qwpvd9fv.js → index-nxpe7835.js} +933 -898
- package/package.json +11 -1
- package/src/client/components/common/code-surface/bracket-guide.test.ts +249 -0
- package/src/client/components/common/code-surface/bracket-guide.ts +131 -0
- package/src/client/components/common/code-surface/documents.test.ts +122 -0
- package/src/client/components/common/code-surface/documents.ts +286 -0
- package/src/client/components/common/code-surface/extensions.test.ts +115 -0
- package/src/client/components/common/code-surface/extensions.ts +295 -0
- package/src/client/components/common/code-surface/fold-stack.test.ts +218 -0
- package/src/client/components/common/code-surface/fold.test.ts +148 -0
- package/src/client/components/common/code-surface/fold.ts +118 -0
- package/src/client/components/common/code-surface/handle.ts +102 -0
- package/src/client/components/common/code-surface/indent-guide.ts +104 -0
- package/src/client/components/common/code-surface/indent.test.ts +239 -0
- package/src/client/components/common/code-surface/indent.ts +124 -0
- package/src/client/components/common/code-surface/index.tsx +283 -314
- package/src/client/components/common/code-surface/keymap.test.ts +133 -0
- package/src/client/components/common/code-surface/keymap.ts +256 -0
- package/src/client/components/common/code-surface/line-commands.test.ts +90 -0
- package/src/client/components/common/code-surface/line-commands.ts +103 -0
- package/src/client/components/common/code-surface/marks.ts +74 -0
- package/src/client/components/common/code-surface/props.ts +87 -0
- package/src/client/components/common/code-surface/shiki.ts +234 -0
- package/src/client/components/common/code-surface/stream-language.test.ts +118 -0
- package/src/client/components/common/code-surface/stream-language.ts +123 -0
- package/src/client/components/common/code-surface/sync.test.ts +185 -0
- package/src/client/components/common/code-surface/sync.ts +58 -0
- package/src/client/components/common/code-surface/theme.test.ts +237 -0
- package/src/client/components/common/code-surface/theme.ts +224 -0
- package/src/client/components/common/code-surface/typing.test.ts +97 -0
- package/src/client/components/common/code-surface/typing.ts +111 -0
- package/src/client/components/common/editor-view-buttons/index.test.tsx +148 -0
- package/src/client/components/common/editor-view-buttons/index.tsx +109 -0
- package/src/client/components/common/shell-update-button/Modal.tsx +163 -0
- package/src/client/components/common/shell-update-button/index.test.tsx +251 -0
- package/src/client/components/common/shell-update-button/index.tsx +125 -0
- package/src/client/components/common/toolbar-row/index.test.tsx +215 -0
- package/src/client/components/common/toolbar-row/index.tsx +260 -0
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +58 -78
- package/src/client/components/layout/desktop-layout/index.tsx +65 -67
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +6 -3
- package/src/client/components/layout/session-sidebar/Footer.tsx +8 -15
- package/src/client/components/mobile/LayoutWrapper.tsx +1 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +3 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +98 -71
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +20 -1
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.test.tsx +137 -0
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.tsx +14 -3
- package/src/client/components/mobile/mobile-right-sidebar/editor-props.ts +25 -0
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +9 -21
- package/src/client/components/settings/Modal.tsx +8 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +9 -0
- package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +87 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +167 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +184 -0
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +99 -0
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +8 -2
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +16 -8
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +9 -4
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +9 -7
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +9 -4
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +15 -11
- package/src/client/components/workspace/chat-timeline/chat-input/stretch-send.test.tsx +165 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +132 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +120 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.test.tsx +319 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +285 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +2 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +34 -29
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +11 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +10 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +25 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +8 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.test.ts +114 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +111 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +7 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +9 -59
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactBody.tsx +2 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +43 -30
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +49 -32
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +8 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/HighlightedCode.tsx +35 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +4 -4
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +179 -0
- package/src/client/components/workspace/diff-panel/ThemedMergeDiffView.tsx +24 -0
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +224 -186
- package/src/client/components/workspace/diff-panel/ToolbarSegments.tsx +98 -0
- package/src/client/components/workspace/diff-panel/index.tsx +76 -145
- package/src/client/components/workspace/diff-panel/merge.ts +315 -0
- package/src/client/components/workspace/editor/Body.tsx +28 -7
- package/src/client/components/workspace/editor/CommandPalette.tsx +6 -6
- package/src/client/components/workspace/editor/ConflictStrip.tsx +77 -0
- package/src/client/components/workspace/editor/Dialogs.tsx +53 -0
- package/src/client/components/workspace/editor/EmptyEditor.tsx +23 -0
- package/src/client/components/workspace/editor/ExternalChangeStrip.tsx +61 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +146 -63
- package/src/client/components/workspace/editor/FilePane.tsx +47 -7
- package/src/client/components/workspace/editor/FindWidget.test.ts +9 -5
- package/src/client/components/workspace/editor/FindWidget.tsx +36 -2
- package/src/client/components/workspace/editor/GoToLineModal.tsx +123 -0
- package/src/client/components/workspace/editor/Notices.tsx +71 -0
- package/src/client/components/workspace/editor/Pane.tsx +118 -0
- package/src/client/components/workspace/editor/PluginColumn.tsx +32 -0
- package/src/client/components/workspace/editor/QuickOpenModal.tsx +146 -0
- package/src/client/components/workspace/editor/SaveAsModal.tsx +175 -0
- package/src/client/components/workspace/editor/SplitColumn.tsx +98 -0
- package/src/client/components/workspace/editor/SplitPane.tsx +57 -0
- package/src/client/components/workspace/editor/StatusBar.tsx +106 -0
- package/src/client/components/workspace/editor/TabContextMenu.tsx +75 -0
- package/src/client/components/workspace/editor/Tabs.tsx +195 -18
- package/src/client/components/workspace/editor/Toolbar.tsx +110 -140
- package/src/client/components/workspace/editor/index.tsx +201 -193
- package/src/client/components/workspace/editor/props.ts +64 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +300 -0
- package/src/client/components/workspace/file-explorer/Modals.tsx +14 -1
- package/src/client/components/workspace/file-explorer/OutlineSection.test.tsx +18 -0
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +10 -3
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +2 -1
- package/src/client/components/workspace/file-explorer/clipboard.test.ts +3 -1
- package/src/client/components/workspace/file-explorer/index.test.ts +61 -0
- package/src/client/components/workspace/file-explorer/index.tsx +10 -48
- package/src/client/components/workspace/file-explorer/local-edit.test.ts +8 -3
- package/src/client/components/workspace/search-panel/Body.tsx +7 -2
- package/src/client/components/workspace/worktree-modal/index.test.tsx +118 -0
- package/src/client/hooks/chat/composer/file-drop.ts +22 -37
- package/src/client/hooks/chat/composer/pipeline.test.ts +76 -0
- package/src/client/hooks/chat/composer/pipeline.ts +12 -1
- package/src/client/hooks/chat/omp/reconnect.test.ts +338 -0
- package/src/client/hooks/chat/omp/reconnect.ts +187 -0
- package/src/client/hooks/chat/omp/run-liveness.test.ts +71 -0
- package/src/client/hooks/chat/omp/run-liveness.ts +65 -0
- package/src/client/hooks/chat/omp/session-list.activity.test.ts +114 -0
- package/src/client/hooks/chat/omp/session-list.test-util.ts +164 -0
- package/src/client/hooks/chat/omp/session-list.test.ts +30 -150
- package/src/client/hooks/chat/omp/session-list.tsx +69 -9
- package/src/client/hooks/chat/timeline/generating.ts +19 -2
- package/src/client/hooks/chat/timeline/index.ts +19 -24
- package/src/client/hooks/chat/timeline/lost-run.test.ts +329 -0
- package/src/client/hooks/chat/timeline/lost-run.ts +177 -0
- package/src/client/hooks/chat/timeline/session-load.test-util.ts +205 -0
- package/src/client/hooks/chat/timeline/session-load.test.ts +61 -162
- package/src/client/hooks/chat/timeline/session-load.ts +69 -37
- package/src/client/hooks/chat/timeline/session-switch.test.ts +65 -0
- package/src/client/hooks/chat/timeline/session-switch.ts +63 -0
- package/src/client/hooks/code/deferred-highlight.test.ts +182 -0
- package/src/client/hooks/code/deferred-highlight.ts +129 -0
- package/src/client/hooks/editor/caret-position.test.ts +58 -0
- package/src/client/hooks/editor/caret-position.ts +48 -0
- package/src/client/hooks/editor/file-editor-types.ts +200 -0
- package/src/client/hooks/editor/find-history.test.ts +132 -0
- package/src/client/hooks/editor/find-history.ts +46 -0
- package/src/client/hooks/editor/find-selection-range.test.ts +100 -0
- package/src/client/hooks/editor/find-selection-range.ts +49 -0
- package/src/client/hooks/editor/find-state.ts +14 -1
- package/src/client/hooks/editor/font.test.ts +0 -93
- package/src/client/hooks/editor/indent-settings.test.ts +104 -0
- package/src/client/hooks/editor/indent-settings.ts +88 -0
- package/src/client/hooks/editor/quick-open.test.ts +141 -0
- package/src/client/hooks/editor/quick-open.ts +127 -0
- package/src/client/hooks/editor/save-as.test.ts +156 -0
- package/src/client/hooks/editor/save-as.ts +122 -0
- package/src/client/hooks/editor/save-file.test.ts +179 -0
- package/src/client/hooks/editor/save-file.ts +73 -28
- package/src/client/hooks/editor/theme.test.ts +206 -0
- package/src/client/hooks/editor/theme.ts +82 -0
- package/src/client/hooks/editor/typing-settings.test.ts +73 -0
- package/src/client/hooks/editor/typing-settings.ts +65 -0
- package/src/client/hooks/editor/use-close-guard.ts +98 -0
- package/src/client/hooks/editor/use-editor-drop-overlay.test.ts +159 -0
- package/src/client/hooks/editor/use-editor-drop.shell.test.ts +224 -0
- package/src/client/hooks/editor/use-editor-drop.test.ts +101 -0
- package/src/client/hooks/editor/use-editor-drop.ts +120 -77
- package/src/client/hooks/editor/use-editor-find.test.ts +2 -2
- package/src/client/hooks/editor/use-editor-find.ts +45 -10
- package/src/client/hooks/editor/use-editor-panel-keys.ts +152 -0
- package/src/client/hooks/editor/use-editor-tab-state.ts +71 -0
- package/src/client/hooks/editor/use-external-change-notice.ts +71 -0
- package/src/client/hooks/editor/use-external-change.test.ts +88 -0
- package/src/client/hooks/editor/use-external-change.ts +146 -0
- package/src/client/hooks/editor/use-file-editor.ts +83 -116
- package/src/client/hooks/editor/use-file-read.ts +16 -8
- package/src/client/hooks/editor/use-file-writes.ts +28 -3
- package/src/client/hooks/editor/use-mobile-editor-find.ts +69 -0
- package/src/client/hooks/editor/use-mobile-reveal.ts +53 -0
- package/src/client/hooks/editor/use-outline-view.test.ts +182 -0
- package/src/client/hooks/editor/use-outline-view.ts +94 -7
- package/src/client/hooks/editor/use-scroll-restore.test.ts +55 -2
- package/src/client/hooks/editor/use-scroll-restore.ts +124 -4
- package/src/client/hooks/editor/use-search-reveal-jump.ts +57 -0
- package/src/client/hooks/editor/use-search-reveal.ts +1 -1
- package/src/client/hooks/editor/use-split-editor.test.tsx +169 -0
- package/src/client/hooks/editor/use-split-editor.ts +91 -0
- package/src/client/hooks/editor/use-unload-guard.tsx +117 -0
- package/src/client/hooks/editor/use-write-conflict.test.ts +164 -0
- package/src/client/hooks/editor/use-write-conflict.ts +152 -0
- package/src/client/hooks/editor/wheel-zoom.test.ts +141 -0
- package/src/client/hooks/editor/wheel-zoom.ts +96 -0
- package/src/client/hooks/ui/drag-presence.test.ts +193 -0
- package/src/client/hooks/ui/drag-presence.ts +108 -0
- package/src/client/hooks/ui/settings-modal.test.ts +115 -0
- package/src/client/hooks/ui/settings-modal.ts +56 -0
- package/src/client/hooks/ui/updates/shell-download.test.ts +2 -0
- package/src/client/hooks/ui/updates/shell-download.ts +55 -14
- package/src/client/hooks/ui/updates/shell-offer.test.ts +26 -0
- package/src/client/hooks/ui/updates/shell-update.test.ts +140 -0
- package/src/client/hooks/ui/updates/shell-update.ts +119 -0
- package/src/client/hooks/workspace/diff-file.ts +29 -10
- package/src/client/hooks/workspace/diff-git-actions.ts +147 -0
- package/src/client/hooks/workspace/editor-view.ts +61 -0
- package/src/client/hooks/workspace/file-listing.ts +36 -24
- package/src/client/hooks/workspace/file-tabs.test.ts +152 -5
- package/src/client/hooks/workspace/file-tabs.ts +70 -11
- package/src/client/hooks/workspace/file-tree-edits.ts +103 -0
- package/src/client/hooks/workspace/navbar-session-actions.ts +72 -0
- package/src/client/hooks/workspace/worktree/index.ts +20 -5
- package/src/client/lib/desktop/bridge.ts +45 -0
- package/src/client/lib/desktop/dropped-paths.ts +83 -0
- package/src/client/lib/editor/tab-menu.test.ts +127 -0
- package/src/client/lib/editor/tab-menu.ts +127 -0
- package/src/client/lib/editor-dirty-tabs.test.ts +102 -0
- package/src/client/lib/editor-dirty-tabs.ts +103 -0
- package/src/client/lib/native/resume.test.ts +66 -0
- package/src/client/lib/native/resume.ts +42 -0
- package/src/client/lib/search-reveal.ts +1 -1
- package/src/client/main.tsx +13 -1
- package/src/client/tailwind.css +75 -8
- package/src/server/lib/auth/guard.test.ts +28 -0
- package/src/server/lib/auth/guard.ts +10 -0
- package/src/server/lib/bundler/css.test.ts +31 -0
- package/src/server/lib/fs/listing.test.ts +81 -16
- package/src/server/lib/fs/listing.ts +72 -5
- package/src/server/lib/fs/worktree/create.ts +2 -3
- package/src/server/lib/fs/worktree/list.ts +13 -0
- package/src/server/lib/fs/worktree/remove.ts +3 -3
- package/src/server/lib/fs/write-conflict.test.ts +68 -0
- package/src/server/lib/fs/write-conflict.ts +84 -0
- package/src/server/lib/lifecycle/claim-port.test.ts +156 -0
- package/src/server/lib/lifecycle/port-guard.test.ts +20 -164
- package/src/server/lib/lifecycle/port-guard.ts +39 -7
- package/src/server/lib/lifecycle/probe-health.test.ts +166 -0
- package/src/server/lib/lifecycle/probe.test.ts +77 -164
- package/src/server/lib/lifecycle/probe.ts +121 -13
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +112 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +10 -5
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +162 -0
- package/src/server/lib/omp/session/sidebar-activity.server.ts +70 -0
- package/src/server/lib/omp/session/telemetry/compute.ts +13 -1
- package/src/server/lib/omp/session/telemetry.test.ts +33 -0
- package/src/server/lib/realtime/signals.server.ts +10 -0
- package/src/server/lib/realtime/topics/catalog.server.ts +4 -1
- package/src/server/lib/realtime/topics.server.ts +16 -0
- package/src/server/lib/updates/shell-assets.ts +94 -3
- package/src/server/lib/updates/shell-cache.ts +105 -0
- package/src/server/lib/updates/shell-pages.test.ts +33 -2
- package/src/server/lib/updates/shell-pages.ts +17 -5
- package/src/server/lib/updates/shell-release-desktop.test.ts +166 -0
- package/src/server/lib/updates/shell-release.test.ts +10 -27
- package/src/server/lib/updates/shell-release.ts +107 -111
- package/src/server/routes/fs/action-save-as.test.ts +82 -0
- package/src/server/routes/fs/action.test.ts +82 -0
- package/src/server/routes/fs/action.ts +54 -1
- package/src/server/routes/fs/exists.ts +11 -1
- package/src/server/routes/fs/git-merge.test.ts +11 -1
- package/src/server/routes/fs/read.test.ts +24 -7
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/fs/scope.test.ts +15 -10
- package/src/server/routes/fs/scope.ts +3 -14
- package/src/server/routes/updates/android.ts +6 -1
- package/src/server/routes/updates/desktop.ts +29 -7
- package/src/server/routes/updates/ios.ts +5 -1
- package/src/server/routes/worktrees/list.ts +11 -1
- package/src/server/routes/worktrees/routes.test.ts +17 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.test.ts +36 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +18 -0
- package/src/shared/lib/chat/timeline/run-signals.test.ts +2 -0
- package/src/shared/lib/code/editor/comment-syntax.test.ts +37 -0
- package/src/shared/lib/code/editor/comment-syntax.ts +55 -0
- package/src/shared/lib/code/editor/find-replace.test.ts +134 -0
- package/src/shared/lib/code/editor/{find.ts → find-replace.ts} +23 -107
- package/src/shared/lib/code/editor/{find.test.ts → find-scan.test.ts} +20 -74
- package/src/shared/lib/code/editor/find-scan.ts +198 -0
- package/src/shared/lib/code/editor/find-selection.test.ts +56 -0
- package/src/shared/lib/code/editor/indent-guide-rule.test.ts +65 -0
- package/src/shared/lib/code/editor/indent-guide-rule.ts +47 -0
- package/src/shared/lib/code/editor/indent-rules.test.ts +219 -0
- package/src/shared/lib/code/editor/indent-rules.ts +198 -0
- package/src/shared/lib/code/editor/keymap.test.ts +23 -0
- package/src/shared/lib/code/editor/keymap.ts +43 -6
- package/src/shared/lib/code/editor/lines.test.ts +7 -55
- package/src/shared/lib/code/editor/lines.ts +8 -48
- package/src/shared/lib/code/editor/marks.test.ts +4 -5
- package/src/shared/lib/code/editor/marks.ts +13 -25
- package/src/shared/lib/code/editor/palette.test.ts +25 -2
- package/src/shared/lib/code/editor/palette.ts +10 -0
- package/src/shared/lib/code/editor/stream-modes.ts +225 -0
- package/src/shared/lib/code/editor/theme-loader.ts +97 -0
- package/src/shared/lib/code/editor/themes.generated.ts +156 -0
- package/src/shared/lib/code/editor/themes.test.ts +165 -0
- package/src/shared/lib/code/editor/themes.ts +165 -0
- package/src/shared/lib/code/highlight-memo.test.ts +103 -0
- package/src/shared/lib/code/highlight-memo.ts +149 -0
- package/src/shared/lib/code/highlighter-warmup.ts +112 -0
- package/src/shared/lib/code/highlighter.ts +3 -1
- package/src/shared/lib/code/idle.ts +37 -0
- package/src/shared/lib/code/outline/rows.test.ts +96 -0
- package/src/shared/lib/code/outline/rows.ts +94 -0
- package/src/shared/lib/code/syntax-highlight.test.ts +2 -80
- package/src/shared/lib/code/syntax-highlight.ts +2 -3
- package/src/shared/lib/fs/file-kind-classify.test.ts +25 -11
- package/src/shared/lib/fs/file-kind.ts +47 -13
- package/src/shared/lib/fs/file-tree.test.ts +41 -0
- package/src/shared/lib/fs/file-tree.ts +126 -34
- package/src/shared/lib/fs/file-url.test.ts +52 -0
- package/src/shared/lib/fs/file-url.ts +37 -0
- package/src/shared/lib/fs/folder-chain.test.ts +87 -0
- package/src/shared/lib/fs/folder-chain.ts +91 -0
- package/src/shared/lib/fs/fs-helpers.test.ts +4 -50
- package/src/shared/lib/fs/patch-sides.test.ts +114 -0
- package/src/shared/lib/fs/patch-sides.ts +139 -0
- package/src/shared/lib/realtime/connection.test.ts +5 -1
- package/src/shared/lib/realtime/connection.ts +25 -119
- package/src/shared/lib/realtime/frozen-recovery.test.ts +93 -0
- package/src/shared/lib/realtime/protocol.ts +16 -0
- package/src/shared/lib/realtime/resume.ts +223 -0
- package/src/shared/lib/realtime/state.ts +22 -0
- package/src/shared/lib/realtime/watchdog-wiring.test.ts +224 -0
- package/src/shared/lib/realtime/watchdog.test.ts +99 -0
- package/src/shared/lib/realtime/watchdog.ts +72 -0
- package/src/shared/lib/ui/toolbar-overflow.test.ts +83 -0
- package/src/shared/lib/ui/toolbar-overflow.ts +86 -0
- package/src/shared/lib/updates/shell-arch.ts +54 -0
- package/src/shared/lib/updates/shell-ua.ts +4 -4
- package/src/shared/lib/workspace/editor-view-mode.test.ts +70 -0
- package/src/shared/lib/workspace/editor-view-mode.ts +48 -0
- package/src/shared/lib/workspace/panel-widths.test.ts +30 -0
- package/src/shared/lib/workspace/panel-widths.ts +25 -5
- package/src/shared/lib/workspace/session-state/cache.ts +159 -0
- package/src/shared/lib/workspace/session-state/harness.test-util.ts +55 -0
- package/src/shared/lib/workspace/session-state/merge.ts +100 -0
- package/src/shared/lib/workspace/session-state/store-load.test.ts +206 -0
- package/src/shared/lib/workspace/session-state/store.test.ts +17 -139
- package/src/shared/lib/workspace/session-state/store.ts +92 -130
- package/src/shared/lib/workspace/split-editor.test.ts +104 -0
- package/src/shared/lib/workspace/split-editor.ts +129 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +124 -0
- package/src/shared/types/realtime.ts +29 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/src/test-support/file-explorer-disk.test-util.ts +30 -3
- package/src/test-support/loopback.ts +183 -0
- package/src/test-support/pristine-globals.ts +7 -0
- package/dist/client/static/js/index-gtbpewr7.css +0 -1
- package/src/client/components/common/code-editor/handler.test.ts +0 -274
- package/src/client/components/common/code-editor/handler.ts +0 -175
- package/src/client/components/common/code-editor/index.tsx +0 -314
- package/src/client/components/common/code-surface/measure.ts +0 -148
- package/src/client/components/workspace/chat-timeline/target-picker/index.test.tsx +0 -227
- package/src/client/components/workspace/chat-timeline/target-picker/index.tsx +0 -260
- package/src/client/components/workspace/diff-panel/SplitView.tsx +0 -209
- package/src/client/components/workspace/diff-panel/UnifiedView.tsx +0 -150
- package/src/client/hooks/editor/scroll-container.test.ts +0 -102
- package/src/client/hooks/editor/scroll-container.ts +0 -26
- package/src/client/hooks/editor/use-code-window.ts +0 -100
- package/src/client/hooks/editor/use-editor-history.test.ts +0 -216
- package/src/client/hooks/editor/use-editor-history.ts +0 -134
- package/src/client/hooks/editor/use-occurrences.test.ts +0 -236
- package/src/client/hooks/editor/use-occurrences.ts +0 -98
- package/src/shared/lib/code/editor/commands.test.ts +0 -155
- package/src/shared/lib/code/editor/commands.ts +0 -260
- package/src/shared/lib/code/editor/edits.test.ts +0 -100
- package/src/shared/lib/code/editor/edits.ts +0 -122
- package/src/shared/lib/code/editor/history.test.ts +0 -118
- package/src/shared/lib/code/editor/history.ts +0 -101
- package/src/shared/lib/code/editor/layers.test.ts +0 -77
- package/src/shared/lib/code/editor/layers.ts +0 -67
- package/src/shared/lib/code/editor/line-edits.test.ts +0 -131
- package/src/shared/lib/code/editor/line-edits.ts +0 -159
- package/src/shared/lib/code/editor/occurrences.test.ts +0 -117
- package/src/shared/lib/code/editor/occurrences.ts +0 -111
- package/src/shared/lib/code/editor/reset-css.test.ts +0 -35
- package/src/shared/lib/code/editor/reset-css.ts +0 -32
- package/src/shared/lib/code/editor/text-commands.test.ts +0 -178
- package/src/shared/lib/code/editor/text-commands.ts +0 -154
- package/src/shared/lib/code/lazy-window.test.ts +0 -161
- package/src/shared/lib/code/lazy-window.ts +0 -156
- package/src/shared/lib/code/windowed-highlight.ts +0 -114
- package/src/shared/lib/fs/diff-parser.test.ts +0 -116
- package/src/shared/lib/fs/diff-parser.ts +0 -213
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The per-tab dirty store.
|
|
8
|
+
*
|
|
9
|
+
* The rule worth pinning is the one a `Set` makes easy to get wrong: an unchanged
|
|
10
|
+
* publish must return the SAME snapshot object, or every subscriber re-renders on
|
|
11
|
+
* every keystroke elsewhere in the panel. And `retain` must drop a closed tab's
|
|
12
|
+
* entry, or a freshly opened tab that reuses the id would come up already dotted.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
hasDirtyTabs,
|
|
19
|
+
isTabDirty,
|
|
20
|
+
resetDirtyTabs,
|
|
21
|
+
retainDirtyTabs,
|
|
22
|
+
setDirtyTabs,
|
|
23
|
+
subscribeDirtyTabs,
|
|
24
|
+
} from '@/client/lib/editor-dirty-tabs';
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
resetDirtyTabs();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('setDirtyTabs', () => {
|
|
31
|
+
test('records exactly what it was given', () => {
|
|
32
|
+
setDirtyTabs(['a', 2]);
|
|
33
|
+
expect(isTabDirty('a')).toBe(true);
|
|
34
|
+
expect(isTabDirty(2)).toBe(true);
|
|
35
|
+
expect(isTabDirty('b')).toBe(false);
|
|
36
|
+
expect(hasDirtyTabs()).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('replaces rather than merges, so a saved tab stops being dirty', () => {
|
|
40
|
+
setDirtyTabs(['a', 'b']);
|
|
41
|
+
setDirtyTabs(['a']);
|
|
42
|
+
expect(isTabDirty('b')).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('an empty set clears the flag the unload guard reads', () => {
|
|
46
|
+
setDirtyTabs(['a']);
|
|
47
|
+
setDirtyTabs([]);
|
|
48
|
+
expect(hasDirtyTabs()).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('retainDirtyTabs', () => {
|
|
53
|
+
test('drops the ids that left the tab set', () => {
|
|
54
|
+
setDirtyTabs(['a', 'b', 'c']);
|
|
55
|
+
retainDirtyTabs(['a']);
|
|
56
|
+
expect(isTabDirty('a')).toBe(true);
|
|
57
|
+
expect(isTabDirty('b')).toBe(false);
|
|
58
|
+
expect(isTabDirty('c')).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a closed tab’s id does not decorate a tab that reuses it', () => {
|
|
62
|
+
setDirtyTabs([7]);
|
|
63
|
+
retainDirtyTabs([]);
|
|
64
|
+
// The same id, a different file: the entry is gone, so the tab opens clean.
|
|
65
|
+
expect(isTabDirty(7)).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('a publish that changes nothing notifies nobody', () => {
|
|
70
|
+
test('the same set twice is ONE notification', () => {
|
|
71
|
+
// The panel re-renders on every keystroke, so a publish that re-notifies an
|
|
72
|
+
// unchanged set would re-render the whole tab strip for nothing.
|
|
73
|
+
let calls = 0;
|
|
74
|
+
const stop = subscribeDirtyTabs(() => { calls += 1; });
|
|
75
|
+
setDirtyTabs(['a']);
|
|
76
|
+
expect(calls).toBe(1);
|
|
77
|
+
setDirtyTabs(['a']);
|
|
78
|
+
expect(calls).toBe(1);
|
|
79
|
+
setDirtyTabs(['a', 'b']);
|
|
80
|
+
expect(calls).toBe(2);
|
|
81
|
+
stop();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('a retain that drops nothing is silent, and one that drops a row notifies', () => {
|
|
85
|
+
setDirtyTabs(['a']);
|
|
86
|
+
let calls = 0;
|
|
87
|
+
const stop = subscribeDirtyTabs(() => { calls += 1; });
|
|
88
|
+
retainDirtyTabs(['a', 'b']);
|
|
89
|
+
expect(calls).toBe(0);
|
|
90
|
+
retainDirtyTabs(['b']);
|
|
91
|
+
expect(calls).toBe(1);
|
|
92
|
+
stop();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('a released subscriber stops hearing about changes', () => {
|
|
96
|
+
let calls = 0;
|
|
97
|
+
const stop = subscribeDirtyTabs(() => { calls += 1; });
|
|
98
|
+
stop();
|
|
99
|
+
setDirtyTabs(['a']);
|
|
100
|
+
expect(calls).toBe(0);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which OPEN editor tabs hold edits that are not on disk.
|
|
8
|
+
*
|
|
9
|
+
* `useFileEditor` computes `isDirty` for the ACTIVE tab, and that is all a single
|
|
10
|
+
* hook can know: it caches one buffer at a time. The tab strip needs the same
|
|
11
|
+
* answer for a BACKGROUND tab — the one the user is about to close — so the editor
|
|
12
|
+
* publishes a per-tab record here and the strip reads it.
|
|
13
|
+
*
|
|
14
|
+
* ## Why a store and not a prop
|
|
15
|
+
*
|
|
16
|
+
* The editor panel owns the tabs (`openedFiles` comes from the layout) while the
|
|
17
|
+
* buffer state lives in `useFileEditor`. Threading a `dirtyIds` prop through
|
|
18
|
+
* `Editor → EditorTabs` would mean the panel recomputing dirtiness it cannot see;
|
|
19
|
+
* a store lets the ONE component that knows (the editor) publish it, and the one
|
|
20
|
+
* that draws it (the strip) subscribe.
|
|
21
|
+
*
|
|
22
|
+
* ## A closed tab's entry is dropped with the tab
|
|
23
|
+
*
|
|
24
|
+
* Keyed by tab id, and `retain` prunes it — the same lifecycle as the content
|
|
25
|
+
* cache. A stale entry would draw a dot on a freshly opened tab that happens to
|
|
26
|
+
* reuse an id.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { useSyncExternalStore } from 'preact/compat';
|
|
30
|
+
|
|
31
|
+
/** Tab ids currently holding unsaved edits. */
|
|
32
|
+
const dirty = new Set<string | number>();
|
|
33
|
+
const listeners = new Set<() => void>();
|
|
34
|
+
/** A stable snapshot object, so `useSyncExternalStore` does not re-render forever. */
|
|
35
|
+
let snapshot: ReadonlySet<string | number> = new Set();
|
|
36
|
+
|
|
37
|
+
function publish(): void {
|
|
38
|
+
snapshot = new Set(dirty);
|
|
39
|
+
for (const listener of [...listeners]) listener();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Replace the whole set. The editor calls this after every render that moved it. */
|
|
43
|
+
export function setDirtyTabs(ids: Iterable<string | number>): void {
|
|
44
|
+
const next = new Set(ids);
|
|
45
|
+
if (next.size === dirty.size) {
|
|
46
|
+
let same = true;
|
|
47
|
+
for (const id of next) {
|
|
48
|
+
if (!dirty.has(id)) { same = false; break; }
|
|
49
|
+
}
|
|
50
|
+
if (same) return;
|
|
51
|
+
}
|
|
52
|
+
dirty.clear();
|
|
53
|
+
for (const id of next) dirty.add(id);
|
|
54
|
+
publish();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Drop the ids that left the tab set. */
|
|
58
|
+
export function retainDirtyTabs(keep: Iterable<string | number>): void {
|
|
59
|
+
const keepSet = new Set(keep);
|
|
60
|
+
let dropped = false;
|
|
61
|
+
for (const id of [...dirty]) {
|
|
62
|
+
if (!keepSet.has(id)) { dirty.delete(id); dropped = true; }
|
|
63
|
+
}
|
|
64
|
+
if (dropped) publish();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Whether `id` currently holds unsaved edits. */
|
|
68
|
+
export function isTabDirty(id: string | number): boolean {
|
|
69
|
+
return dirty.has(id);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Whether ANY tab does — the condition `beforeunload` is armed on. */
|
|
73
|
+
export function hasDirtyTabs(): boolean {
|
|
74
|
+
return dirty.size > 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Observe changes.
|
|
79
|
+
*
|
|
80
|
+
* Exported because the hook is not the only reader that matters: the panel's own
|
|
81
|
+
* tests assert that an unchanged publish notifies nobody, and a subscription is the
|
|
82
|
+
* only way to see that.
|
|
83
|
+
*/
|
|
84
|
+
export function subscribeDirtyTabs(listener: () => void): () => void {
|
|
85
|
+
listeners.add(listener);
|
|
86
|
+
return () => {
|
|
87
|
+
listeners.delete(listener);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const subscribe = subscribeDirtyTabs;
|
|
92
|
+
|
|
93
|
+
/** The live set, for a component that draws a dot per row. */
|
|
94
|
+
export function useDirtyTabs(): ReadonlySet<string | number> {
|
|
95
|
+
return useSyncExternalStore(subscribe, () => snapshot);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Test seam: forget every entry. */
|
|
99
|
+
export function resetDirtyTabs(): void {
|
|
100
|
+
if (dirty.size === 0) return;
|
|
101
|
+
dirty.clear();
|
|
102
|
+
publish();
|
|
103
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The native shell's resume hook.
|
|
8
|
+
*
|
|
9
|
+
* A backgrounded Android WebView fires no `visibilitychange` on return, and a
|
|
10
|
+
* socket the server's heartbeat reaped while the page was frozen produces no
|
|
11
|
+
* `close` — so the shell is the only thing that knows the app came back. It
|
|
12
|
+
* evaluates `window.__kabmoResume()`, and that has to be a function the page
|
|
13
|
+
* installed before the first render.
|
|
14
|
+
*
|
|
15
|
+
* What is pinned here is the CONTRACT between the two sides (the property name,
|
|
16
|
+
* and that it is installed idempotently) plus the one behaviour that makes it
|
|
17
|
+
* safe to call unconditionally: with nothing subscribed it does nothing at all,
|
|
18
|
+
* because the shell calls it on every foreground, including the first.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
22
|
+
import { Window } from 'happy-dom';
|
|
23
|
+
|
|
24
|
+
import { RESUME_PROPERTY, installResumeDispatcher } from '@/client/lib/native/resume';
|
|
25
|
+
import { resetRealtimeClient } from '@/shared/lib/realtime/client';
|
|
26
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
resetRealtimeClient();
|
|
30
|
+
restoreDomGlobals();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function installWindow(): Window {
|
|
34
|
+
const win = new Window({ url: 'http://localhost/' });
|
|
35
|
+
installDomGlobals(win);
|
|
36
|
+
return win;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe('installResumeDispatcher', () => {
|
|
40
|
+
test('exposes window.__kabmoResume and is idempotent', () => {
|
|
41
|
+
const win = installWindow();
|
|
42
|
+
installResumeDispatcher();
|
|
43
|
+
installResumeDispatcher();
|
|
44
|
+
|
|
45
|
+
const installed = (win as unknown as Record<string, unknown>)[RESUME_PROPERTY];
|
|
46
|
+
expect(typeof installed).toBe('function');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('the property name is the one the shells evaluate', () => {
|
|
50
|
+
// Spelled out rather than read from the module: the Kotlin and Swift shells
|
|
51
|
+
// hardcode the string in an `evaluateJavascript`, so a rename here has to be
|
|
52
|
+
// a deliberate edit there too. This is the assertion that fails if it is not.
|
|
53
|
+
expect(RESUME_PROPERTY).toBe('__kabmoResume');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('calling it with nothing subscribed dials nothing', () => {
|
|
57
|
+
const win = installWindow();
|
|
58
|
+
installResumeDispatcher();
|
|
59
|
+
const resume = (win as unknown as Record<string, unknown>)[RESUME_PROPERTY] as () => void;
|
|
60
|
+
|
|
61
|
+
// The shell calls this on EVERY foreground, including the very first, so it
|
|
62
|
+
// must be inert when the page has no subscription — otherwise a phone would
|
|
63
|
+
// open a socket the moment the app appears, before anything asked for one.
|
|
64
|
+
expect(() => resume()).not.toThrow();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The native shell's resume hook, delegated to the page.
|
|
8
|
+
*
|
|
9
|
+
* A backgrounded Android WebView does not reliably deliver the browser events
|
|
10
|
+
* the realtime channel listens for: the document is never reported hidden when
|
|
11
|
+
* the app goes to the background, so returning to it fires no
|
|
12
|
+
* `visibilitychange`, and a socket the server reaped while the page was frozen
|
|
13
|
+
* produces no `close`. The channel's watchdog (`shared/lib/realtime/resume.ts`)
|
|
14
|
+
* repairs that on its own, but only on its next tick — up to 5s, plus a 2s probe
|
|
15
|
+
* — which is the difference between the stream continuing and the user
|
|
16
|
+
* concluding it is dead.
|
|
17
|
+
*
|
|
18
|
+
* So the shell says so directly: `MainActivity.onResume` /
|
|
19
|
+
* `ShellViewController.viewDidAppear` evaluate `window.__kabmoResume()`, and the
|
|
20
|
+
* repair starts on that tick. Same indirection as `__kabmoBack`, and for the
|
|
21
|
+
* same reason — the page owns the state, the shell only knows the moment.
|
|
22
|
+
*
|
|
23
|
+
* Idempotent and safe to call at any time: a healthy connection is probed, a
|
|
24
|
+
* dead one is re-dialed, and a tab with no subscribers does nothing.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { wake } from '@/shared/lib/realtime/connection';
|
|
28
|
+
|
|
29
|
+
/** The property the shell calls. Named once so both sides agree. */
|
|
30
|
+
export const RESUME_PROPERTY = '__kabmoResume';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Install `window.__kabmoResume`. Idempotent — a hot reload re-runs it.
|
|
34
|
+
*
|
|
35
|
+
* Installed unconditionally: the function is inert in a browser (nothing calls
|
|
36
|
+
* it), and gating it on a user agent would be a second place that has to know
|
|
37
|
+
* which shells exist.
|
|
38
|
+
*/
|
|
39
|
+
export function installResumeDispatcher(): void {
|
|
40
|
+
if (typeof window === 'undefined') return;
|
|
41
|
+
(window as unknown as Record<string, unknown>)[RESUME_PROPERTY] = wake;
|
|
42
|
+
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* editor can decide by equality whether the request is for the file it holds.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import type { FindOptions } from '@/shared/lib/code/editor/find';
|
|
26
|
+
import type { FindOptions } from '@/shared/lib/code/editor/find-scan';
|
|
27
27
|
|
|
28
28
|
export interface SearchRevealRequest {
|
|
29
29
|
/** Workspace-relative path of the file the match lives in. */
|
package/src/client/main.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { hydrate } from 'preact';
|
|
2
2
|
import { App } from '@/client/App';
|
|
3
3
|
import { bootSyntax } from '@/shared/lib/code/highlighter';
|
|
4
|
+
import { warmSyntaxTokenizers } from '@/shared/lib/code/highlighter-warmup';
|
|
4
5
|
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
5
6
|
import { initDocumentTheme } from '@/client/hooks/ui/theme';
|
|
6
7
|
import { primeWindowChrome } from '@/client/hooks/ui/window-chrome';
|
|
@@ -9,6 +10,7 @@ import { installPluginRuntime } from '@/client/lib/plugins/runtime';
|
|
|
9
10
|
import { installUiKit } from '@/client/lib/plugins/kit';
|
|
10
11
|
import { installScrollbarActivity } from '@/client/lib/scrollbar-activity';
|
|
11
12
|
import { installBackDispatcher } from '@/client/lib/native/back';
|
|
13
|
+
import { installResumeDispatcher } from '@/client/lib/native/resume';
|
|
12
14
|
import { installFileLaunchHandler } from '@/client/lib/launch/file-handlers';
|
|
13
15
|
|
|
14
16
|
import '@/client/tailwind.css';
|
|
@@ -59,6 +61,13 @@ installScrollbarActivity();
|
|
|
59
61
|
// a back press during hydration must find the dispatcher, not `undefined`.
|
|
60
62
|
installBackDispatcher();
|
|
61
63
|
|
|
64
|
+
// The native shell calls `window.__kabmoResume()` when its app returns to the
|
|
65
|
+
// foreground. A backgrounded Android WebView fires no `visibilitychange` and
|
|
66
|
+
// gets no `close` for a socket the server reaped, so the shell's own lifecycle
|
|
67
|
+
// is the only reliable resume signal there — see `shared/lib/realtime/resume.ts`
|
|
68
|
+
// for the watchdog that covers the case no event arrives at all.
|
|
69
|
+
installResumeDispatcher();
|
|
70
|
+
|
|
62
71
|
// A file the OS handed to Kabmo (PWA File Handling) arrives as a
|
|
63
72
|
// `FileSystemFileHandle` on `launchQueue`, and the consumer must be installed
|
|
64
73
|
// before the first render: launches that happened before the script ran are
|
|
@@ -70,7 +79,10 @@ installFileLaunchHandler((result) => {
|
|
|
70
79
|
});
|
|
71
80
|
|
|
72
81
|
// Fire-and-forget: warms the Shiki highlighter in parallel with hydration.
|
|
73
|
-
|
|
82
|
+
// Once the eager grammars land, each is tokenized once on a tiny sample during
|
|
83
|
+
// idle time — loading a grammar is not compiling it, and the compile used to be
|
|
84
|
+
// paid inside the first tool card the reader expanded.
|
|
85
|
+
void bootSyntax().then(() => warmSyntaxTokenizers());
|
|
74
86
|
|
|
75
87
|
if (root) {
|
|
76
88
|
hydrate(
|
package/src/client/tailwind.css
CHANGED
|
@@ -384,6 +384,81 @@
|
|
|
384
384
|
.shiki span { color: var(--shiki-light); }
|
|
385
385
|
html[data-theme-variant="dark"] .shiki span { color: var(--shiki-dark); }
|
|
386
386
|
|
|
387
|
+
/* No per-token underline in a diff.
|
|
388
|
+
*
|
|
389
|
+
* `@codemirror/merge` wraps the characters that changed in `.cm-changedText`
|
|
390
|
+
* (and a deleted chunk's in `.cm-deletedText`) and its BASE THEME paints a 2px
|
|
391
|
+
* gradient along the bottom of each fragment. A word-level change is usually
|
|
392
|
+
* several fragments — `2` → `22` is one — so the reader got a run of short
|
|
393
|
+
* coloured bars under the code that reads as a second, broken baseline rather
|
|
394
|
+
* than as emphasis. The row's own band and the gutter marker already say which
|
|
395
|
+
* side a row belongs to.
|
|
396
|
+
*
|
|
397
|
+
* Three facts about how this has to be written, each measured:
|
|
398
|
+
*
|
|
399
|
+
* 1. **It cannot be suppressed from the panel's own `EditorView.theme`.** That
|
|
400
|
+
* theme rejects the `&light`/`&dark` selectors the package's rules are spelled
|
|
401
|
+
* with (`RangeError: Unsupported selector: &light`, which took the whole
|
|
402
|
+
* merge view down and left an empty host).
|
|
403
|
+
* 2. **A plain `.cm-changedText { background: none }` LOSES.** The package's rule
|
|
404
|
+
* is `.ͼ2.cm-merge-b .cm-changedText` — two classes on the root plus one on the
|
|
405
|
+
* span, i.e. specificity (0,3,0) — and CodeMirror mounts its style modules
|
|
406
|
+
* after this sheet, so document order is against us as well.
|
|
407
|
+
* 3. **So the selector carries three class-level parts of its own** (`.cm-editor`
|
|
408
|
+
* + `.cm-merge-b`/`.cm-merge-a` + the span class), which wins on specificity
|
|
409
|
+
* rather than by `!important` — an `!important` here would also beat a
|
|
410
|
+
* future theme that legitimately wants a different treatment, and this is a
|
|
411
|
+
* cosmetic suppression, not a hard override.
|
|
412
|
+
*
|
|
413
|
+
* `diff-panel.e2e.ts` asserts the computed `background-image` on a real changed
|
|
414
|
+
* token, so a package bump that reintroduces the bar fails there rather than in
|
|
415
|
+
* a screenshot review. */
|
|
416
|
+
.cm-editor.cm-merge-a .cm-changedText,
|
|
417
|
+
.cm-editor.cm-merge-b .cm-changedText,
|
|
418
|
+
.cm-editor.cm-merge-a .cm-deletedChunk .cm-deletedText,
|
|
419
|
+
.cm-editor.cm-merge-b .cm-deletedChunk .cm-deletedText,
|
|
420
|
+
.cm-editor .cm-deletedChunk .cm-deletedText {
|
|
421
|
+
background: none;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/* The CodeMirror root FILLS its host, so a bounded host scrolls instead of
|
|
425
|
+
* clipping.
|
|
426
|
+
*
|
|
427
|
+
* `.cm-editor` (and a merge view's `.cm-mergeView`) carries `height: 100%` in
|
|
428
|
+
* the surface theme, and a percentage height resolves against a DEFINITE
|
|
429
|
+
* containing block. The diff panel's host has one — its parent is a sized flex
|
|
430
|
+
* column — but a chat card's diff only has a CEILING (`max-h-72` on the
|
|
431
|
+
* wrapper), and a box whose height comes from `max-height` is indefinite for
|
|
432
|
+
* percentage resolution. The root therefore computed to `auto`, grew to its
|
|
433
|
+
* content and the host's `overflow: hidden` clipped it: measured in the
|
|
434
|
+
* timeline, a 1847px editor inside a 288px host with `scrollHeight ===
|
|
435
|
+
* clientHeight` — a 30-line edit card that showed 9 rows with no way to reach
|
|
436
|
+
* the rest, in BOTH shapes (unified 1847px, split 1928px).
|
|
437
|
+
*
|
|
438
|
+
* Making the host a column flex container and the root a shrinking flex item
|
|
439
|
+
* gives the root the host's height through LAYOUT rather than through a
|
|
440
|
+
* percentage, so it works whether the host's height is definite, capped or
|
|
441
|
+
* automatic: `min-height: 0` is what allows the item to go below its content
|
|
442
|
+
* height, and the editor's own `.cm-scroller` then owns the overflow (it is
|
|
443
|
+
* the element with `overflow: auto`). Verified on both shapes: 288px host,
|
|
444
|
+
* scroller `clientHeight 288 / scrollHeight 1847`, scrolled to 400. An
|
|
445
|
+
* unconstrained host (`max-h-none`, the full-output reader) still sizes to its
|
|
446
|
+
* content, because an auto-height flex column does.
|
|
447
|
+
*
|
|
448
|
+
* This is stated on the shared marker rather than per call site: every host
|
|
449
|
+
* that claims to BE a code surface wants the same thing, and the two surfaces
|
|
450
|
+
* that draw one (the editor pane and a diff) each restated it wrong once. */
|
|
451
|
+
[data-code-surface] {
|
|
452
|
+
display: flex;
|
|
453
|
+
flex-direction: column;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
[data-code-surface] > .cm-editor,
|
|
457
|
+
[data-code-surface] > .cm-mergeView {
|
|
458
|
+
flex: 1 1 auto;
|
|
459
|
+
min-height: 0;
|
|
460
|
+
}
|
|
461
|
+
|
|
387
462
|
/* Find matches, painted inside the token spans the highlighter emits. An
|
|
388
463
|
* inline <mark> colours a background without moving a glyph, which is what
|
|
389
464
|
* keeps the transparent <textarea> above aligned with this layer — a block or
|
|
@@ -400,14 +475,6 @@ html[data-theme-variant="dark"] .shiki span { color: var(--shiki-dark); }
|
|
|
400
475
|
color: inherit;
|
|
401
476
|
background: color-mix(in srgb, var(--theme-warning) 32%, transparent);
|
|
402
477
|
}
|
|
403
|
-
/* An extra ⌘D selection: same geometry as a find match, different ink. The
|
|
404
|
-
* caret can only live in the primary range, so the two must not look alike —
|
|
405
|
-
* the user has to see where their keystrokes will land. */
|
|
406
|
-
.shiki .find-match[data-occurrence] {
|
|
407
|
-
background: color-mix(in srgb, var(--theme-info) 30%, transparent);
|
|
408
|
-
border-top: 1px solid color-mix(in srgb, var(--theme-info) 55%, transparent);
|
|
409
|
-
border-bottom: 1px solid color-mix(in srgb, var(--theme-info) 55%, transparent);
|
|
410
|
-
}
|
|
411
478
|
.shiki .find-match[data-find-current] {
|
|
412
479
|
background: color-mix(in srgb, var(--theme-warning) 55%, transparent);
|
|
413
480
|
border-top: 1px solid color-mix(in srgb, var(--theme-warning) 75%, transparent);
|
|
@@ -30,6 +30,18 @@ describe('public paths', () => {
|
|
|
30
30
|
expect(isPublicPath('/login')).toBe(true);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The two shells ask their update check from native code, which has no
|
|
35
|
+
* session cookie — and the button is for a shell so stale it may not be able
|
|
36
|
+
* to load the console at all. Gating these answered `401` to every shell on a
|
|
37
|
+
* password-protected console, which the settings screen could only report as
|
|
38
|
+
* "Could not ask the server" (measured against a real install).
|
|
39
|
+
*/
|
|
40
|
+
test('the native shells can ask what is published without a session', () => {
|
|
41
|
+
expect(isPublicPath('/api/updates/android')).toBe(true);
|
|
42
|
+
expect(isPublicPath('/api/updates/ios')).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
|
|
33
45
|
test('the assets the login screen is built from are public', () => {
|
|
34
46
|
for (const path of [
|
|
35
47
|
'/_dev-assets/client/index-abc.js',
|
|
@@ -153,6 +165,22 @@ describe('authentication is per run, never inherited from disk', () => {
|
|
|
153
165
|
expect(response?.status).toBe(401);
|
|
154
166
|
});
|
|
155
167
|
|
|
168
|
+
/**
|
|
169
|
+
* The bug this pins: both shells ask their update check from NATIVE code,
|
|
170
|
+
* which carries no cookie, so a password-protected console answered `401` and
|
|
171
|
+
* the settings screen could only say "Could not ask the server" (measured on a
|
|
172
|
+
* real install). The desktop route stays gated because the CONSOLE asks it,
|
|
173
|
+
* and the console is behind the login.
|
|
174
|
+
*/
|
|
175
|
+
test('a password does not gate the native shells\u2019 update check', async () => {
|
|
176
|
+
useTempDataDir();
|
|
177
|
+
await initAuth('correct-horse');
|
|
178
|
+
|
|
179
|
+
expect(authGate(new Request('http://localhost/api/updates/android'))).toBeUndefined();
|
|
180
|
+
expect(authGate(new Request('http://localhost/api/updates/ios'))).toBeUndefined();
|
|
181
|
+
expect(authGate(new Request('http://localhost/api/updates/desktop?kind=macos'))?.status).toBe(401);
|
|
182
|
+
});
|
|
183
|
+
|
|
156
184
|
test('a document request is redirected to the login screen, not answered 401', async () => {
|
|
157
185
|
useTempDataDir();
|
|
158
186
|
await initAuth('correct-horse');
|
|
@@ -41,6 +41,16 @@ const LOGIN_PATH = '/login';
|
|
|
41
41
|
/** Paths that never require a session, because they ARE the way in. */
|
|
42
42
|
const PUBLIC_EXACT = new Set([
|
|
43
43
|
'/api/health',
|
|
44
|
+
// The native shells' own update check. Android and iOS ask these from
|
|
45
|
+
// NATIVE code (`AppUpdateCheck.kt`, `SettingsViewController.fetchRelease`),
|
|
46
|
+
// which carries no WebView cookie — and the button exists precisely for a
|
|
47
|
+
// shell too stale to load the console, so it cannot depend on a session
|
|
48
|
+
// either. Both answer GitHub's public release list (a version and a download
|
|
49
|
+
// URL), which is the same data an unauthenticated browser can read from
|
|
50
|
+
// github.com; `/api/updates/desktop` stays gated because only the CONSOLE
|
|
51
|
+
// asks it, and the console is behind the login.
|
|
52
|
+
'/api/updates/android',
|
|
53
|
+
'/api/updates/ios',
|
|
44
54
|
'/api/auth/state',
|
|
45
55
|
'/api/auth/login',
|
|
46
56
|
'/api/auth/logout',
|
|
@@ -213,6 +213,37 @@ describe('css plugin — the scrollbar system reaches the browser', () => {
|
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* The CodeMirror root filling its host, which is what makes a bounded diff
|
|
218
|
+
* scroll at all.
|
|
219
|
+
*
|
|
220
|
+
* `.cm-editor` carries `height: 100%`, and a percentage resolves against a
|
|
221
|
+
* DEFINITE containing block. A chat card's diff host is bounded only by a
|
|
222
|
+
* `max-height`, which is indefinite for that purpose, so the root computed to
|
|
223
|
+
* `auto` and grew to its content — measured in the timeline: a 1847px editor
|
|
224
|
+
* inside a 288px host, `scrollHeight === clientHeight`, a 30-line edit card
|
|
225
|
+
* showing 9 rows with no way to reach the rest. The fix is layout rather than
|
|
226
|
+
* a percentage: the host is a column flex container and the root a shrinking
|
|
227
|
+
* flex item.
|
|
228
|
+
*
|
|
229
|
+
* Both halves are asserted because either alone is inert: `min-height: 0` on
|
|
230
|
+
* the item is what lets it go below its content height, and the host's
|
|
231
|
+
* `flex-direction` is what makes that height the one the item is measured
|
|
232
|
+
* against. The minifier also rewrites `flex: 1 1 auto` to `flex: auto`, which
|
|
233
|
+
* is why the gate reads the built sheet.
|
|
234
|
+
*/
|
|
235
|
+
describe('css plugin — a code surface fills its host', () => {
|
|
236
|
+
test('the host is a column flex container and the root shrinks inside it', async () => {
|
|
237
|
+
const out = await buildProjectStylesheet();
|
|
238
|
+
|
|
239
|
+
expect(out).toContain('[data-code-surface]{display:flex;flex-direction:column}');
|
|
240
|
+
expect(out).toContain('[data-code-surface]>.cm-editor');
|
|
241
|
+
expect(out).toContain('[data-code-surface]>.cm-mergeView');
|
|
242
|
+
expect(out).toContain('min-height:0');
|
|
243
|
+
expect(out).toMatch(/\[data-code-surface\]>\.cm-(editor|mergeView)[^{]*\{[^}]*flex:auto/);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
216
247
|
/**
|
|
217
248
|
* The collapsible-section reveal (Source Control's stash section).
|
|
218
249
|
*
|