@chatcode/cco-better-sidebar 0.18.0-alpha.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/LICENSE +21 -0
- package/README.md +554 -0
- package/README_EN.md +563 -0
- package/assets/logo.svg +1 -0
- package/cordis.patch.yml +79 -0
- package/lib/client-editor.js +55744 -0
- package/lib/client-mermaid.js +208256 -0
- package/lib/client-registry.js +30378 -0
- package/lib/client-terminal.js +16894 -0
- package/lib/client.js +30378 -0
- package/lib/index.js +6897 -0
- package/lib/invariant.js +22 -0
- package/lib/types/agent-opens.d.ts +65 -0
- package/lib/types/agent-pty.d.ts +226 -0
- package/lib/types/browser-probe.d.ts +15 -0
- package/lib/types/bundle-route.d.ts +12 -0
- package/lib/types/chatcode-update.d.ts +47 -0
- package/lib/types/client/AccountMenu.d.ts +1 -0
- package/lib/types/client/AiRatioSection.d.ts +3 -0
- package/lib/types/client/BrowserView.d.ts +39 -0
- package/lib/types/client/ChatcodeGate.d.ts +6 -0
- package/lib/types/client/CodingPlanModelsSettings.d.ts +9 -0
- package/lib/types/client/DiffTab.d.ts +6 -0
- package/lib/types/client/DiffView.d.ts +51 -0
- package/lib/types/client/EditorHost.d.ts +13 -0
- package/lib/types/client/FenceErrorNotice.d.ts +5 -0
- package/lib/types/client/FileTree.d.ts +41 -0
- package/lib/types/client/FreeWindow.d.ts +29 -0
- package/lib/types/client/GitView.d.ts +12 -0
- package/lib/types/client/MarkdownHtml.d.ts +32 -0
- package/lib/types/client/OrphanedTab.d.ts +11 -0
- package/lib/types/client/PdfView.d.ts +6 -0
- package/lib/types/client/ReleaseNotesDialog.d.ts +11 -0
- package/lib/types/client/RenderBoundary.d.ts +32 -0
- package/lib/types/client/SandboxStatusBar.d.ts +10 -0
- package/lib/types/client/SideCardSection.d.ts +74 -0
- package/lib/types/client/Sidebar.d.ts +8 -0
- package/lib/types/client/TabBar.d.ts +54 -0
- package/lib/types/client/TerminalView.d.ts +24 -0
- package/lib/types/client/TextEditor.d.ts +10 -0
- package/lib/types/client/TreePanel.d.ts +27 -0
- package/lib/types/client/UpdateDialog.d.ts +10 -0
- package/lib/types/client/UpdateSettingsPanel.d.ts +1 -0
- package/lib/types/client/UpdateSettingsSection.d.ts +10 -0
- package/lib/types/client/UploadOverlay.d.ts +20 -0
- package/lib/types/client/UsageHeatmapSection.d.ts +4 -0
- package/lib/types/client/add-plugin-modal.d.ts +15 -0
- package/lib/types/client/api.d.ts +345 -0
- package/lib/types/client/binary-download.d.ts +12 -0
- package/lib/types/client/breakpoints.d.ts +17 -0
- package/lib/types/client/browser.d.ts +60 -0
- package/lib/types/client/builtins/index.d.ts +18 -0
- package/lib/types/client/builtins/tabs.d.ts +11 -0
- package/lib/types/client/builtins/viewers.d.ts +3 -0
- package/lib/types/client/chat-presentation.d.ts +13 -0
- package/lib/types/client/chunk-loader.d.ts +124 -0
- package/lib/types/client/chunks/editor.d.ts +9 -0
- package/lib/types/client/chunks/mermaid.d.ts +10 -0
- package/lib/types/client/chunks/terminal.d.ts +9 -0
- package/lib/types/client/cm-themes.d.ts +24 -0
- package/lib/types/client/conversation-draft.d.ts +14 -0
- package/lib/types/client/desktop-env.d.ts +35 -0
- package/lib/types/client/editor-load.d.ts +66 -0
- package/lib/types/client/frame-batcher.d.ts +24 -0
- package/lib/types/client/icons.d.ts +66 -0
- package/lib/types/client/image-types.d.ts +3 -0
- package/lib/types/client/ime-guard.d.ts +36 -0
- package/lib/types/client/index.d.ts +19 -0
- package/lib/types/client/intercept.d.ts +44 -0
- package/lib/types/client/lang.d.ts +14 -0
- package/lib/types/client/layout-push.d.ts +15 -0
- package/lib/types/client/lazy-chunk.d.ts +25 -0
- package/lib/types/client/link-intercept.d.ts +42 -0
- package/lib/types/client/locales-ar.d.ts +18 -0
- package/lib/types/client/locales-de.d.ts +4 -0
- package/lib/types/client/locales-fr.d.ts +10 -0
- package/lib/types/client/locales-hi.d.ts +17 -0
- package/lib/types/client/locales-id.d.ts +15 -0
- package/lib/types/client/locales-it.d.ts +8 -0
- package/lib/types/client/locales-ja.d.ts +17 -0
- package/lib/types/client/locales-ko.d.ts +9 -0
- package/lib/types/client/locales-nl.d.ts +16 -0
- package/lib/types/client/locales-pl.d.ts +19 -0
- package/lib/types/client/locales-pt.d.ts +1 -0
- package/lib/types/client/locales-ru.d.ts +13 -0
- package/lib/types/client/locales-sv.d.ts +1 -0
- package/lib/types/client/locales-th.d.ts +17 -0
- package/lib/types/client/locales-tr.d.ts +17 -0
- package/lib/types/client/locales-vi.d.ts +17 -0
- package/lib/types/client/locales-zh-HK.d.ts +32 -0
- package/lib/types/client/locales-zh-MO.d.ts +32 -0
- package/lib/types/client/locales-zh-TW.d.ts +32 -0
- package/lib/types/client/locales.d.ts +571 -0
- package/lib/types/client/markdown-html.d.ts +96 -0
- package/lib/types/client/markdown-images.d.ts +45 -0
- package/lib/types/client/markdown-labels.d.ts +21 -0
- package/lib/types/client/md-toc.d.ts +4 -0
- package/lib/types/client/mermaid-blocks.d.ts +47 -0
- package/lib/types/client/mermaid-sanitize.d.ts +2 -0
- package/lib/types/client/mermaid.d.ts +12 -0
- package/lib/types/client/open-when-sized.d.ts +20 -0
- package/lib/types/client/open-with-settings.d.ts +4 -0
- package/lib/types/client/open-with.d.ts +87 -0
- package/lib/types/client/openpath-intercept.d.ts +52 -0
- package/lib/types/client/paths.d.ts +43 -0
- package/lib/types/client/pdf-types.d.ts +2 -0
- package/lib/types/client/pinned.d.ts +86 -0
- package/lib/types/client/plugin-settings.d.ts +8 -0
- package/lib/types/client/plugins-shared.d.ts +27 -0
- package/lib/types/client/plugins-tabs.d.ts +3 -0
- package/lib/types/client/plugins-viewers.d.ts +3 -0
- package/lib/types/client/prefs.d.ts +41 -0
- package/lib/types/client/produced-files.d.ts +29 -0
- package/lib/types/client/selection-payload.d.ts +27 -0
- package/lib/types/client/service.d.ts +445 -0
- package/lib/types/client/session-pins.d.ts +14 -0
- package/lib/types/client/settings-nav-icon.d.ts +27 -0
- package/lib/types/client/shell-presets.d.ts +48 -0
- package/lib/types/client/split-pane.d.ts +38 -0
- package/lib/types/client/state.d.ts +480 -0
- package/lib/types/client/tab-content-memo.d.ts +40 -0
- package/lib/types/client/terminal-font.d.ts +78 -0
- package/lib/types/client/terminal-links.d.ts +119 -0
- package/lib/types/client/theme.d.ts +45 -0
- package/lib/types/client/titlebar-strip.d.ts +23 -0
- package/lib/types/client/ui-tweaks/appicons.d.ts +16 -0
- package/lib/types/client/ui-tweaks/archive.d.ts +42 -0
- package/lib/types/client/ui-tweaks/branding.d.ts +45 -0
- package/lib/types/client/ui-tweaks/cachehit.d.ts +41 -0
- package/lib/types/client/ui-tweaks/gitbar.d.ts +103 -0
- package/lib/types/client/ui-tweaks/index.d.ts +279 -0
- package/lib/types/client/ui-tweaks/mcp.d.ts +28 -0
- package/lib/types/client/ui-tweaks/notifier.d.ts +125 -0
- package/lib/types/client/ui-tweaks/whale.d.ts +55 -0
- package/lib/types/client/upload.d.ts +69 -0
- package/lib/types/client/useChatcodeAccount.d.ts +10 -0
- package/lib/types/client/wco.d.ts +47 -0
- package/lib/types/codingplan.d.ts +37 -0
- package/lib/types/config.d.ts +95 -0
- package/lib/types/context-types.d.ts +540 -0
- package/lib/types/fs-operations.d.ts +30 -0
- package/lib/types/fs-search.d.ts +24 -0
- package/lib/types/fs-tree.d.ts +51 -0
- package/lib/types/git.d.ts +124 -0
- package/lib/types/html-route.d.ts +59 -0
- package/lib/types/index.d.ts +47 -0
- package/lib/types/invariant.d.ts +15 -0
- package/lib/types/login-route.d.ts +2 -0
- package/lib/types/open-external.d.ts +24 -0
- package/lib/types/path-security.d.ts +26 -0
- package/lib/types/prefs-shared.d.ts +257 -0
- package/lib/types/pty-deps.d.ts +79 -0
- package/lib/types/pty-manager.d.ts +168 -0
- package/lib/types/tools.d.ts +34 -0
- package/lib/types/trust-fence.d.ts +24 -0
- package/lib/types/ui-tweaks/archive.d.ts +71 -0
- package/lib/types/ui-tweaks/config.d.ts +186 -0
- package/lib/types/ui-tweaks/git-web.d.ts +43 -0
- package/lib/types/ui-tweaks/git.d.ts +311 -0
- package/lib/types/ui-tweaks/index.d.ts +17 -0
- package/lib/types/ui-tweaks/mcp.d.ts +103 -0
- package/lib/types/ui-tweaks/turn-outcome.d.ts +57 -0
- package/lib/types/ui-tweaks/web.d.ts +55 -0
- package/lib/types/wire.d.ts +38 -0
- package/package.json +213 -0
- package/scripts/install.ps1 +310 -0
- package/scripts/install.sh +287 -0
- package/src/agent-opens.ts +265 -0
- package/src/agent-pty.ts +527 -0
- package/src/browser-probe.ts +26 -0
- package/src/bundle-route.ts +129 -0
- package/src/chatcode-update.ts +193 -0
- package/src/client/AccountMenu.tsx +177 -0
- package/src/client/AiRatioSection.module.css +329 -0
- package/src/client/AiRatioSection.tsx +292 -0
- package/src/client/BrowserView.tsx +289 -0
- package/src/client/ChatcodeGate.tsx +35 -0
- package/src/client/CodingPlanModelsSettings.module.css +118 -0
- package/src/client/CodingPlanModelsSettings.tsx +101 -0
- package/src/client/DiffTab.tsx +114 -0
- package/src/client/DiffView.tsx +305 -0
- package/src/client/EditorHost.tsx +563 -0
- package/src/client/FenceErrorNotice.tsx +40 -0
- package/src/client/FileTree.tsx +701 -0
- package/src/client/FreeWindow.tsx +337 -0
- package/src/client/GitView.tsx +722 -0
- package/src/client/MarkdownHtml.tsx +296 -0
- package/src/client/OrphanedTab.tsx +27 -0
- package/src/client/PdfView.tsx +110 -0
- package/src/client/ReleaseNotesDialog.tsx +91 -0
- package/src/client/RenderBoundary.tsx +49 -0
- package/src/client/SandboxStatusBar.tsx +60 -0
- package/src/client/SideCardSection.module.css +932 -0
- package/src/client/SideCardSection.tsx +1169 -0
- package/src/client/Sidebar.tsx +1857 -0
- package/src/client/TabBar.tsx +365 -0
- package/src/client/TerminalView.tsx +424 -0
- package/src/client/TextEditor.tsx +468 -0
- package/src/client/TreePanel.tsx +279 -0
- package/src/client/UpdateDialog.tsx +186 -0
- package/src/client/UpdateSettingsPanel.tsx +29 -0
- package/src/client/UpdateSettingsSection.tsx +22 -0
- package/src/client/UploadOverlay.tsx +62 -0
- package/src/client/UsageHeatmapSection.module.css +440 -0
- package/src/client/UsageHeatmapSection.tsx +301 -0
- package/src/client/add-plugin-modal.tsx +199 -0
- package/src/client/api.ts +433 -0
- package/src/client/binary-download.tsx +23 -0
- package/src/client/breakpoints.ts +61 -0
- package/src/client/browser.ts +167 -0
- package/src/client/builtins/index.ts +37 -0
- package/src/client/builtins/tabs.tsx +275 -0
- package/src/client/builtins/viewers.tsx +125 -0
- package/src/client/chat-presentation.ts +95 -0
- package/src/client/chunk-loader.ts +350 -0
- package/src/client/chunks/editor.tsx +9 -0
- package/src/client/chunks/mermaid.tsx +10 -0
- package/src/client/chunks/terminal.tsx +9 -0
- package/src/client/cm-themes.ts +129 -0
- package/src/client/conversation-draft.ts +29 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/desktop-env.ts +72 -0
- package/src/client/editor-load.ts +92 -0
- package/src/client/frame-batcher.ts +56 -0
- package/src/client/icons.tsx +170 -0
- package/src/client/image-types.ts +8 -0
- package/src/client/ime-guard.ts +47 -0
- package/src/client/index.tsx +501 -0
- package/src/client/intercept.tsx +172 -0
- package/src/client/lang.ts +225 -0
- package/src/client/layout-push.ts +37 -0
- package/src/client/layout.css +156 -0
- package/src/client/lazy-chunk.tsx +89 -0
- package/src/client/link-intercept.ts +73 -0
- package/src/client/locales-ar.ts +387 -0
- package/src/client/locales-de.ts +372 -0
- package/src/client/locales-fr.ts +379 -0
- package/src/client/locales-hi.ts +386 -0
- package/src/client/locales-id.ts +384 -0
- package/src/client/locales-it.ts +377 -0
- package/src/client/locales-ja.ts +486 -0
- package/src/client/locales-ko.ts +378 -0
- package/src/client/locales-nl.ts +384 -0
- package/src/client/locales-pl.ts +388 -0
- package/src/client/locales-pt.ts +369 -0
- package/src/client/locales-ru.ts +384 -0
- package/src/client/locales-sv.ts +369 -0
- package/src/client/locales-th.ts +386 -0
- package/src/client/locales-tr.ts +386 -0
- package/src/client/locales-vi.ts +386 -0
- package/src/client/locales-zh-HK.ts +401 -0
- package/src/client/locales-zh-MO.ts +401 -0
- package/src/client/locales-zh-TW.ts +401 -0
- package/src/client/locales.ts +1229 -0
- package/src/client/markdown-html.ts +331 -0
- package/src/client/markdown-images.ts +137 -0
- package/src/client/markdown-labels.tsx +31 -0
- package/src/client/md-toc.tsx +127 -0
- package/src/client/mermaid-blocks.ts +110 -0
- package/src/client/mermaid-sanitize.ts +93 -0
- package/src/client/mermaid.tsx +406 -0
- package/src/client/open-when-sized.ts +43 -0
- package/src/client/open-with-settings.tsx +135 -0
- package/src/client/open-with.ts +221 -0
- package/src/client/openpath-intercept.ts +79 -0
- package/src/client/paths.ts +63 -0
- package/src/client/pdf-types.ts +4 -0
- package/src/client/pinned.ts +184 -0
- package/src/client/plugin-settings.ts +43 -0
- package/src/client/plugins-shared.ts +29 -0
- package/src/client/plugins-tabs.ts +153 -0
- package/src/client/plugins-viewers.ts +44 -0
- package/src/client/prefs.ts +216 -0
- package/src/client/produced-files.ts +120 -0
- package/src/client/selection-payload.ts +86 -0
- package/src/client/service.ts +873 -0
- package/src/client/session-pins.tsx +334 -0
- package/src/client/settings-nav-icon.ts +55 -0
- package/src/client/shell-presets.ts +83 -0
- package/src/client/sidebar.module.css +3607 -0
- package/src/client/split-pane.tsx +333 -0
- package/src/client/state.ts +1646 -0
- package/src/client/tab-content-memo.ts +55 -0
- package/src/client/terminal-font.ts +224 -0
- package/src/client/terminal-links.ts +194 -0
- package/src/client/theme.ts +110 -0
- package/src/client/titlebar-strip.ts +37 -0
- package/src/client/ui-tweaks/appicons.ts +24 -0
- package/src/client/ui-tweaks/archive.tsx +281 -0
- package/src/client/ui-tweaks/branding.tsx +232 -0
- package/src/client/ui-tweaks/cachehit.tsx +122 -0
- package/src/client/ui-tweaks/gitbar.tsx +2559 -0
- package/src/client/ui-tweaks/index.tsx +1696 -0
- package/src/client/ui-tweaks/mcp.tsx +582 -0
- package/src/client/ui-tweaks/notifier.ts +514 -0
- package/src/client/ui-tweaks/whale.tsx +171 -0
- package/src/client/upload.ts +187 -0
- package/src/client/useChatcodeAccount.ts +103 -0
- package/src/client/wco.ts +120 -0
- package/src/codingplan.ts +146 -0
- package/src/config.ts +207 -0
- package/src/context-types.ts +559 -0
- package/src/fs-operations.ts +97 -0
- package/src/fs-search.ts +113 -0
- package/src/fs-tree.ts +158 -0
- package/src/git.ts +446 -0
- package/src/html-route.ts +106 -0
- package/src/index.ts +1524 -0
- package/src/invariant.ts +32 -0
- package/src/login-route.ts +26 -0
- package/src/open-external.ts +90 -0
- package/src/path-security.ts +81 -0
- package/src/prefs-shared.ts +303 -0
- package/src/pty-deps.ts +241 -0
- package/src/pty-manager.ts +376 -0
- package/src/tools.ts +482 -0
- package/src/trust-fence.ts +84 -0
- package/src/ui-tweaks/archive.ts +293 -0
- package/src/ui-tweaks/config.ts +257 -0
- package/src/ui-tweaks/git-web.ts +421 -0
- package/src/ui-tweaks/git.ts +1524 -0
- package/src/ui-tweaks/index.ts +61 -0
- package/src/ui-tweaks/mcp.ts +535 -0
- package/src/ui-tweaks/turn-outcome.ts +105 -0
- package/src/ui-tweaks/web.ts +225 -0
- package/src/wire.ts +110 -0
- package/vendor/addon-fit.js +2 -0
- package/vendor/xterm.css +218 -0
- package/vendor/xterm.js +5 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks configuration: conversation font size (px), markdown table
|
|
3
|
+
* style, and feature toggles. Every field
|
|
4
|
+
* defaults at the schema boundary, so a hand-edited settings document and the
|
|
5
|
+
* Settings panel stay consistent.
|
|
6
|
+
* @module dsh-ui-tweaks/config
|
|
7
|
+
*/
|
|
8
|
+
import type Schema from '@deepseek-ai/schemastery';
|
|
9
|
+
import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
10
|
+
/** Settings document namespace owned by this plugin. */
|
|
11
|
+
export declare const UI_TWEAKS_SETTINGS_NAMESPACE: SettingsNamespace;
|
|
12
|
+
/** Raw user-facing configuration (partial inputs receive schema defaults). */
|
|
13
|
+
export interface UITweaksConfig {
|
|
14
|
+
/** Message content font size in px. */
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Code font size as a percentage of the message font size. 81 is the stock
|
|
18
|
+
* ratio (13px code block at a 16px body); 100 makes code match the body.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Legacy percent input, kept for migration; prefer
|
|
21
|
+
* `codeFontSize`. Ignored once `codeFontSize` is set.
|
|
22
|
+
*/
|
|
23
|
+
codeFontScale?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Absolute code font size in px (8–32). 13 matches the stock DSH code block
|
|
26
|
+
* at a 16px body. Drives the code block directly; inline code and the small
|
|
27
|
+
* code font follow proportionally. When unset, falls back to the legacy
|
|
28
|
+
* `codeFontScale` percentage, then to the stock default.
|
|
29
|
+
*/
|
|
30
|
+
codeFontSize?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The "行高" base unit in px: the vertical rhythm of the reply area. It
|
|
33
|
+
* drives the gap between message rows (Think ↔ tool cards, user ↔
|
|
34
|
+
* assistant), the gap between content blocks inside one assistant reply
|
|
35
|
+
* (Think ↔ text), the markdown text line-height, paragraph bottom margins,
|
|
36
|
+
* and list margins — all scaled proportionally. 16 matches the stock DSH
|
|
37
|
+
* spacing.
|
|
38
|
+
*/
|
|
39
|
+
lineHeight?: number;
|
|
40
|
+
/** Markdown table presentation style. */
|
|
41
|
+
tableStyle?: 'default' | 'claude';
|
|
42
|
+
/**
|
|
43
|
+
* Whether the GitBar (branch / diff / commit-message pills above the input)
|
|
44
|
+
* is shown. Off by default; the bar hides itself when the session has no
|
|
45
|
+
* cwd or the directory is not a git repository.
|
|
46
|
+
*/
|
|
47
|
+
gitBarEnabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the Archive manager is shown: the "归档" Settings page that lists
|
|
50
|
+
* archived sessions and can restore or permanently delete them. Off by
|
|
51
|
+
* default; users turn it on in Settings.
|
|
52
|
+
*/
|
|
53
|
+
archiveManagerEnabled?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the MCP manager is shown: the "MCP 管理" Settings page that lists
|
|
56
|
+
* the configured MCP servers (status, tool count) and can restart them. Off
|
|
57
|
+
* by default; users turn it on in Settings.
|
|
58
|
+
*/
|
|
59
|
+
mcpManagerEnabled?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the `/init` slash command is registered: picking a prompt language
|
|
62
|
+
* submits an AGENTS.md bootstrap prompt into the session. Off by default;
|
|
63
|
+
* users turn it on in Settings.
|
|
64
|
+
*/
|
|
65
|
+
initCommandEnabled?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the whale working indicator is shown: a little brand whale
|
|
68
|
+
* centered above the input box — translucent and still while the model is
|
|
69
|
+
* idle, swimming while it works. Off by default; users turn it on in
|
|
70
|
+
* Settings.
|
|
71
|
+
*/
|
|
72
|
+
whaleIndicatorEnabled?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the composer stats line's cache-hit figure keeps two decimal
|
|
75
|
+
* places ("缓存命中 96.35%"), computed client-side from the raw
|
|
76
|
+
* cached-read / cached-write / uncached-input token buckets instead of
|
|
77
|
+
* DSH's rounded integer. Off by default; users turn it on in Settings.
|
|
78
|
+
*/
|
|
79
|
+
preciseCacheHitEnabled?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Master switch for task notifications: browser-side alerts (tab-title
|
|
82
|
+
* flash, system notification, chime) raised when a session finishes its
|
|
83
|
+
* turn or starts waiting on the user. Off by default; users turn it on in
|
|
84
|
+
* Settings.
|
|
85
|
+
*/
|
|
86
|
+
notificationsEnabled?: boolean;
|
|
87
|
+
/** Stay quiet while the page is visible and focused; alert only once hidden or unfocused. */
|
|
88
|
+
notifyOnlyWhenHidden?: boolean;
|
|
89
|
+
/** Alert when a session ends its turn — completed, interrupted or failed. */
|
|
90
|
+
notifyOnComplete?: boolean;
|
|
91
|
+
/** Alert when a session starts blocking on an approval, plan review or question. */
|
|
92
|
+
notifyOnInteraction?: boolean;
|
|
93
|
+
/** Blink an unread counter into the tab title until the user returns. */
|
|
94
|
+
notifyTitleFlash?: boolean;
|
|
95
|
+
/** Fire desktop-level Web Notifications; clicking one opens that session. */
|
|
96
|
+
notifySystemNotification?: boolean;
|
|
97
|
+
/** Play a synthesized two-note chime (rising = done, falling = needs you). */
|
|
98
|
+
notifySound?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Optional explicit `provider:model` for generating commit messages with the
|
|
101
|
+
* LLM (e.g. `jiyuanlvdong:deepseek-v4-flash-0731`). When unset, the first
|
|
102
|
+
* registered provider/model is used; when the LLM service is unavailable or
|
|
103
|
+
* the call fails, a heuristic commit message is generated instead.
|
|
104
|
+
*/
|
|
105
|
+
suggestModel?: string;
|
|
106
|
+
}
|
|
107
|
+
export declare const MIN_FONT_SIZE = 10;
|
|
108
|
+
export declare const MAX_FONT_SIZE = 32;
|
|
109
|
+
export declare const DEFAULT_FONT_SIZE = 16;
|
|
110
|
+
/** 16px matches the stock DSH vertical rhythm (message/block gaps, etc.). */
|
|
111
|
+
export declare const MIN_LINE_HEIGHT = 0;
|
|
112
|
+
export declare const MAX_LINE_HEIGHT = 64;
|
|
113
|
+
export declare const DEFAULT_LINE_HEIGHT = 16;
|
|
114
|
+
/** 81% = the stock code ratio (13px code block at a 16px body). Legacy input. */
|
|
115
|
+
export declare const MIN_CODE_FONT_SCALE = 50;
|
|
116
|
+
export declare const MAX_CODE_FONT_SCALE = 150;
|
|
117
|
+
export declare const DEFAULT_CODE_FONT_SCALE = 81;
|
|
118
|
+
/** Absolute code font size (px): 13 is the stock DSH code block at a 16px body. */
|
|
119
|
+
export declare const MIN_CODE_FONT_SIZE = 8;
|
|
120
|
+
export declare const MAX_CODE_FONT_SIZE = 32;
|
|
121
|
+
export declare const DEFAULT_CODE_FONT_SIZE = 13;
|
|
122
|
+
/** GitBar defaults to off; users turn it on in Settings. */
|
|
123
|
+
export declare const DEFAULT_GITBAR_ENABLED = false;
|
|
124
|
+
/** Archive manager defaults to off; users turn it on in Settings. */
|
|
125
|
+
export declare const DEFAULT_ARCHIVE_MANAGER_ENABLED = false;
|
|
126
|
+
/** MCP manager defaults to off; users turn it on in Settings. */
|
|
127
|
+
export declare const DEFAULT_MCP_MANAGER_ENABLED = false;
|
|
128
|
+
/** The /init slash command defaults to off; users turn it on in Settings. */
|
|
129
|
+
export declare const DEFAULT_INIT_COMMAND_ENABLED = false;
|
|
130
|
+
/** The whale working indicator defaults to off; users turn it on in Settings. */
|
|
131
|
+
export declare const DEFAULT_WHALE_INDICATOR_ENABLED = false;
|
|
132
|
+
/** The precise cache-hit readout defaults to off; users turn it on in Settings. */
|
|
133
|
+
export declare const DEFAULT_PRECISE_CACHE_HIT_ENABLED = false;
|
|
134
|
+
/** Task notifications default to off; users turn them on in Settings. */
|
|
135
|
+
export declare const DEFAULT_NOTIFICATIONS_ENABLED = false;
|
|
136
|
+
/** Notification behavior defaults: quiet while watched, both event kinds on. */
|
|
137
|
+
export declare const DEFAULT_NOTIFY_ONLY_WHEN_HIDDEN = true;
|
|
138
|
+
export declare const DEFAULT_NOTIFY_ON_COMPLETE = true;
|
|
139
|
+
export declare const DEFAULT_NOTIFY_ON_INTERACTION = true;
|
|
140
|
+
/** Notification channel defaults: title flash + system notification on, chime opt-in. */
|
|
141
|
+
export declare const DEFAULT_NOTIFY_TITLE_FLASH = true;
|
|
142
|
+
export declare const DEFAULT_NOTIFY_SYSTEM_NOTIFICATION = true;
|
|
143
|
+
export declare const DEFAULT_NOTIFY_SOUND = false;
|
|
144
|
+
/** Configuration schema with documented defaults. */
|
|
145
|
+
export declare const Config: Schema<UITweaksConfig>;
|
|
146
|
+
/** Configuration after static validation, with every default materialized. */
|
|
147
|
+
export interface ResolvedUITweaksConfig {
|
|
148
|
+
fontSize: number;
|
|
149
|
+
/** Code font size as a percentage of the message font size (legacy input). */
|
|
150
|
+
codeFontScale: number;
|
|
151
|
+
/** Effective absolute code font size in px (codeFontSize, else legacy %, else stock). */
|
|
152
|
+
codeFontSize: number;
|
|
153
|
+
/** Base vertical spacing (px) for the reply area ("行高"). */
|
|
154
|
+
lineHeight: number;
|
|
155
|
+
tableStyle: 'default' | 'claude';
|
|
156
|
+
/** Whether the GitBar pills above the input are shown. */
|
|
157
|
+
gitBarEnabled: boolean;
|
|
158
|
+
/** Whether the Archive manager sidebar entry is shown. */
|
|
159
|
+
archiveManagerEnabled: boolean;
|
|
160
|
+
/** Whether the MCP manager Settings page is shown. */
|
|
161
|
+
mcpManagerEnabled: boolean;
|
|
162
|
+
/** Whether the /init slash command is registered. */
|
|
163
|
+
initCommandEnabled: boolean;
|
|
164
|
+
/** Whether the whale working indicator above the input is shown. */
|
|
165
|
+
whaleIndicatorEnabled: boolean;
|
|
166
|
+
/** Whether the stats line's cache-hit figure keeps two decimals. */
|
|
167
|
+
preciseCacheHitEnabled: boolean;
|
|
168
|
+
/** Whether task notifications (title flash / system notification / chime) are active. */
|
|
169
|
+
notificationsEnabled: boolean;
|
|
170
|
+
/** Stay quiet while the page is visible and focused. */
|
|
171
|
+
notifyOnlyWhenHidden: boolean;
|
|
172
|
+
/** Alert when a session ends its turn — completed, interrupted or failed. */
|
|
173
|
+
notifyOnComplete: boolean;
|
|
174
|
+
/** Alert when a session blocks on an approval, plan review or question. */
|
|
175
|
+
notifyOnInteraction: boolean;
|
|
176
|
+
/** Blink an unread counter into the tab title. */
|
|
177
|
+
notifyTitleFlash: boolean;
|
|
178
|
+
/** Fire desktop-level Web Notifications. */
|
|
179
|
+
notifySystemNotification: boolean;
|
|
180
|
+
/** Play the synthesized two-note chime. */
|
|
181
|
+
notifySound: boolean;
|
|
182
|
+
/** Optional `provider:model` override for LLM commit-message generation. */
|
|
183
|
+
suggestModel?: string;
|
|
184
|
+
}
|
|
185
|
+
/** Resolve a partial config into a fully defaulted value. */
|
|
186
|
+
export declare function resolveConfig(config?: UITweaksConfig): ResolvedUITweaksConfig;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — Git Web routes.
|
|
3
|
+
*
|
|
4
|
+
* Same-origin JSON endpoints backing the GitBar browser half. Every mutating
|
|
5
|
+
* action is a POST guarded by the same origin/same-site checks as the Settings
|
|
6
|
+
* route; the session id arrives as a query/body field and the backend resolves
|
|
7
|
+
* the working directory from the session header.
|
|
8
|
+
*
|
|
9
|
+
* The terminal panel rides two extra surfaces on the same prefix:
|
|
10
|
+
* - `GET /vendor/<file>` serves the vendored xterm.js UMD builds the browser
|
|
11
|
+
* half lazy-loads on first panel open (whitelist only — no path traversal).
|
|
12
|
+
* - `WS /terminal-ws` upgrades into the persistent PTY bridge: server→client
|
|
13
|
+
* frames are RAW pty output (plus one JSON `{"type":"exit"}` notice),
|
|
14
|
+
* client→server frames are JSON (`input` / `resize` / `close`) so a pasted
|
|
15
|
+
* brace can never be mistaken for a control frame.
|
|
16
|
+
* @module dsh-ui-tweaks/git-web
|
|
17
|
+
*/
|
|
18
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
19
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
20
|
+
import { GitBackend } from './git.ts';
|
|
21
|
+
/** Route prefix shared with the browser half. */
|
|
22
|
+
export declare const GIT_ROUTE = "/_dsh/ui-tweaks/git";
|
|
23
|
+
/** Exact path of the terminal WebSocket upgrade route. */
|
|
24
|
+
export declare const TERMINAL_WS_PATH = "/_dsh/ui-tweaks/git/terminal-ws";
|
|
25
|
+
/**
|
|
26
|
+
* Same-origin Git endpoints. GETs are read-only; POSTs mutate the repository
|
|
27
|
+
* and reject cross-site requests.
|
|
28
|
+
*/
|
|
29
|
+
export declare class GitWebHandler {
|
|
30
|
+
private readonly backend;
|
|
31
|
+
constructor(backend: GitBackend);
|
|
32
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
33
|
+
private requireCwd;
|
|
34
|
+
/** Serve one whitelisted vendored asset; anything else is a 404. */
|
|
35
|
+
private serveVendor;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Attach the Git routes plus the terminal WebSocket whenever a webServer
|
|
39
|
+
* service is present.
|
|
40
|
+
* @param ctx - plugin context owning route effects.
|
|
41
|
+
* @param backend - Git backend.
|
|
42
|
+
*/
|
|
43
|
+
export declare function installGitWeb(ctx: Context, backend: GitBackend): void;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — Git backend (host half).
|
|
3
|
+
*
|
|
4
|
+
* Executes read-only and mutating git commands in a session's working
|
|
5
|
+
* directory (the "current project", resolved from the session header's cwd)
|
|
6
|
+
* for the GitBar: status snapshot (branch, ahead/behind, changed files with
|
|
7
|
+
* ±line counts), branch enumeration, per-file diff views, commit-message
|
|
8
|
+
* suggestion (LLM first, heuristic fallback), and the commit / push /
|
|
9
|
+
* switch / create actions.
|
|
10
|
+
*
|
|
11
|
+
* Every command runs through `child_process.execFile` — never a shell, args
|
|
12
|
+
* as an argv array, cwd pinned, bounded timeout, abort propagation — so
|
|
13
|
+
* repo-controlled strings cannot escape into a shell and a hung remote cannot
|
|
14
|
+
* wedge the plugin.
|
|
15
|
+
*
|
|
16
|
+
* The terminal panel additionally runs a PERSISTENT REAL PTY per target
|
|
17
|
+
* (node-pty — conpty on Windows), streamed to the browser over a WebSocket
|
|
18
|
+
* and rendered with xterm.js: shell state, colors, Ctrl+C and interactive
|
|
19
|
+
* apps work exactly like the DSH-better-sidebar terminal, whose pty-manager
|
|
20
|
+
* design (transcript ring replay + reconnect grace) this follows.
|
|
21
|
+
* @module dsh-ui-tweaks/git
|
|
22
|
+
*/
|
|
23
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
24
|
+
import type { UITweaksConfig } from './config.ts';
|
|
25
|
+
/** One changed file with its ±line counts. */
|
|
26
|
+
export interface GitFileChange {
|
|
27
|
+
path: string;
|
|
28
|
+
/** Display status: M / A / D / R / C / U (untracked). */
|
|
29
|
+
status: string;
|
|
30
|
+
added: number;
|
|
31
|
+
deleted: number;
|
|
32
|
+
untracked: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Full status snapshot for one session cwd. */
|
|
35
|
+
export interface GitSnapshot {
|
|
36
|
+
isRepo: boolean;
|
|
37
|
+
/** Absolute working directory, when resolvable. */
|
|
38
|
+
cwd?: string;
|
|
39
|
+
/** Current branch name, or null when detached. */
|
|
40
|
+
branch: string | null;
|
|
41
|
+
/** Short HEAD sha while detached. */
|
|
42
|
+
detachedHead?: string;
|
|
43
|
+
/** Upstream ref name (e.g. `origin/main`), when tracked. */
|
|
44
|
+
upstream?: string;
|
|
45
|
+
/** Commits ahead of the upstream. */
|
|
46
|
+
ahead: number;
|
|
47
|
+
/** Commits behind the upstream. */
|
|
48
|
+
behind: number;
|
|
49
|
+
hasRemote: boolean;
|
|
50
|
+
clean: boolean;
|
|
51
|
+
files: GitFileChange[];
|
|
52
|
+
totalAdded: number;
|
|
53
|
+
totalDeleted: number;
|
|
54
|
+
}
|
|
55
|
+
/** Local + remote branch enumeration. */
|
|
56
|
+
export interface GitBranches {
|
|
57
|
+
current: string | null;
|
|
58
|
+
local: string[];
|
|
59
|
+
remote: string[];
|
|
60
|
+
}
|
|
61
|
+
/** One commit row of the graph table. */
|
|
62
|
+
export interface GitGraphCommit {
|
|
63
|
+
/** ASCII graph edge prefix (monospace drawing column). */
|
|
64
|
+
graph: string;
|
|
65
|
+
/** Full commit hash. */
|
|
66
|
+
fullHash: string;
|
|
67
|
+
/** Short hash (7 chars). */
|
|
68
|
+
hash: string;
|
|
69
|
+
/** Subject line. */
|
|
70
|
+
subject: string;
|
|
71
|
+
/** Author name. */
|
|
72
|
+
author: string;
|
|
73
|
+
/** ISO-8601 commit date. */
|
|
74
|
+
date: string;
|
|
75
|
+
/** Relative date, e.g. "3 days ago". */
|
|
76
|
+
dateRelative: string;
|
|
77
|
+
/** Ref decorations, e.g. `HEAD -> main, origin/main` (outer parens stripped). */
|
|
78
|
+
refs: string;
|
|
79
|
+
}
|
|
80
|
+
/** Git commit graph table (`git log --graph`, structured rows). */
|
|
81
|
+
export interface GitGraph {
|
|
82
|
+
commits: GitGraphCommit[];
|
|
83
|
+
/** Whether the requested commit window was cut off by the limit. */
|
|
84
|
+
truncated: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** One rendered line of a per-file diff view. */
|
|
87
|
+
export interface DiffLine {
|
|
88
|
+
type: 'hunk' | 'add' | 'del' | 'ctx';
|
|
89
|
+
/** Old-file line number (null for added lines). */
|
|
90
|
+
old: number | null;
|
|
91
|
+
/** New-file line number (null for deleted lines). */
|
|
92
|
+
new: number | null;
|
|
93
|
+
/** Content after the +/-/space prefix; hunk lines carry the full `@@` header. */
|
|
94
|
+
text: string;
|
|
95
|
+
}
|
|
96
|
+
/** Structured per-file diff for the GitBar side panel. */
|
|
97
|
+
export interface GitDiffResult {
|
|
98
|
+
path: string;
|
|
99
|
+
/** `hunk` = changed ranges only; `full` = whole file with added lines marked. */
|
|
100
|
+
mode: 'hunk' | 'full';
|
|
101
|
+
lines: DiffLine[];
|
|
102
|
+
truncated: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Deterministic offline commit-message generation (LLM fallback). */
|
|
105
|
+
export declare function heuristicSuggest(snapshot: GitSnapshot): string;
|
|
106
|
+
/** How a commit message was produced, and why the LLM path was skipped. */
|
|
107
|
+
export interface GitSuggestResult {
|
|
108
|
+
message: string;
|
|
109
|
+
/** `llm` = a model wrote it; `heuristic` = offline fallback from file names. */
|
|
110
|
+
via: 'llm' | 'heuristic';
|
|
111
|
+
/** Provider/model actually used (or attempted). */
|
|
112
|
+
provider?: string;
|
|
113
|
+
model?: string;
|
|
114
|
+
/** Why the LLM path did not produce a message (only when `via` is heuristic). */
|
|
115
|
+
reason?: string;
|
|
116
|
+
/** Whether the diff excerpt handed to the model was cut short. */
|
|
117
|
+
truncated?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The Git service: resolves a session's cwd and runs git on its behalf.
|
|
121
|
+
* @param ctx - plugin context (sessions and llm are read structurally, never required).
|
|
122
|
+
* @param readConfig - reads the plugin config for the `suggestModel` override.
|
|
123
|
+
*/
|
|
124
|
+
export declare class GitBackend {
|
|
125
|
+
private readonly ctx;
|
|
126
|
+
private readonly readConfig;
|
|
127
|
+
/** Persistent PTY shell sessions for the terminal panel (WebSocket-streamed). */
|
|
128
|
+
readonly terminals: TerminalSessionManager;
|
|
129
|
+
constructor(ctx: Context, readConfig: () => UITweaksConfig);
|
|
130
|
+
/** Resolve the session's working directory, or undefined when absent. */
|
|
131
|
+
resolveCwd(sessionId: string | undefined): string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Resolve a workspace title (the hero/new-session screen has no real session
|
|
134
|
+
* yet, only the picked workspace) to its directory. Matches the display
|
|
135
|
+
* title exactly first, then a basename suffix — titles may duplicate, so an
|
|
136
|
+
* exact hit always wins. Optional-service read like resolveCwd.
|
|
137
|
+
*/
|
|
138
|
+
resolveWorkspaceCwd(name: string | undefined): string | undefined;
|
|
139
|
+
/** Resolve either target form to a cwd (session id first, then workspace title). */
|
|
140
|
+
resolveTargetCwd(target: {
|
|
141
|
+
session?: string | undefined;
|
|
142
|
+
ws?: string | undefined;
|
|
143
|
+
}): string | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Open the project folder in an external app (explorer / editors). The
|
|
146
|
+
* editor targets launch through their CLI shims (code / idea / goland /
|
|
147
|
+
* webstorm / pycharm — Toolbox puts the JetBrains ones on PATH).
|
|
148
|
+
* Fire-and-forget GUI launches: explorer exits non-zero even on success, so
|
|
149
|
+
* only a spawn FAILURE rejects; app shims missing from PATH reject with a
|
|
150
|
+
* user-visible hint instead of crashing the route.
|
|
151
|
+
*/
|
|
152
|
+
openFolder(cwd: string, target: 'explorer' | 'vscode' | 'idea' | 'goland' | 'webstorm' | 'pycharm'): Promise<void>;
|
|
153
|
+
/** Full status snapshot for a session's cwd. One merged `status -z --branch
|
|
154
|
+
* --untracked-files=all` call carries branch/upstream/tracking and the
|
|
155
|
+
* per-file untracked list (no ls-files expansion pass), and every read —
|
|
156
|
+
* repo probe included — runs in one parallel batch. The previous nine
|
|
157
|
+
* sequential process spawns cost ~700ms on Windows, this costs one spawn. */
|
|
158
|
+
snapshot(cwd: string, signal?: AbortSignal): Promise<GitSnapshot>;
|
|
159
|
+
/** Local + remote branch enumeration. */
|
|
160
|
+
branches(cwd: string, signal?: AbortSignal): Promise<GitBranches>;
|
|
161
|
+
/**
|
|
162
|
+
* Per-file diff for the side panel. `mode: 'hunk'` returns only the changed
|
|
163
|
+
* ranges (untracked files render as whole-file additions); `mode: 'full'`
|
|
164
|
+
* returns the whole file with added lines marked.
|
|
165
|
+
*/
|
|
166
|
+
diff(cwd: string, path: string, mode: 'hunk' | 'full', signal?: AbortSignal): Promise<GitDiffResult>;
|
|
167
|
+
/**
|
|
168
|
+
* Suggest a commit message: LLM first (when the service and a model are
|
|
169
|
+
* available), heuristic fallback otherwise. Kept for callers that only want
|
|
170
|
+
* the text; {@link suggestDetailed} also reports which path produced it.
|
|
171
|
+
*/
|
|
172
|
+
suggest(cwd: string, signal?: AbortSignal): Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Suggest a commit message and report how it was produced. A failing LLM
|
|
175
|
+
* path is no longer silent: the caller receives `via: 'heuristic'` plus the
|
|
176
|
+
* reason, and the failure is logged, because an offline fallback message
|
|
177
|
+
* looks exactly like a model-written one in the UI.
|
|
178
|
+
*/
|
|
179
|
+
suggestDetailed(cwd: string, signal?: AbortSignal): Promise<GitSuggestResult>;
|
|
180
|
+
/**
|
|
181
|
+
* Resolve which provider/model writes the commit message: the `suggestModel`
|
|
182
|
+
* override, else this host's default Agent model. No further fallback — if
|
|
183
|
+
* the default model is unavailable or fails, the suggestion fails (the
|
|
184
|
+
* caller reports the reason) rather than silently using another provider.
|
|
185
|
+
*/
|
|
186
|
+
private resolveSuggestModel;
|
|
187
|
+
private llmSuggest;
|
|
188
|
+
/**
|
|
189
|
+
* Stage and commit; optionally push afterwards. Returns the short hash.
|
|
190
|
+
* When `exclude` names changed files, they are unstaged and left out of the
|
|
191
|
+
* commit (they stay in the working tree); otherwise everything is staged
|
|
192
|
+
* with `git add -A`.
|
|
193
|
+
*/
|
|
194
|
+
commit(cwd: string, message: string, opts?: {
|
|
195
|
+
push?: boolean;
|
|
196
|
+
exclude?: readonly string[];
|
|
197
|
+
signal?: AbortSignal;
|
|
198
|
+
}): Promise<{
|
|
199
|
+
hash?: string;
|
|
200
|
+
pushed: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
/** Delete a local branch (force; the UI confirms first). Protected branches cannot be deleted. */
|
|
203
|
+
deleteBranch(cwd: string, name: string, signal?: AbortSignal): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Delete a remote branch (`origin/foo` → `git push origin --delete foo`).
|
|
206
|
+
* Protected branches cannot be deleted. The local remote-tracking ref is
|
|
207
|
+
* pruned afterwards so the branch list refreshes without waiting for a fetch.
|
|
208
|
+
*/
|
|
209
|
+
deleteRemoteBranch(cwd: string, name: string, signal?: AbortSignal): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Recent commit graph as structured rows (`git log --graph --all --no-color`
|
|
212
|
+
* with a machine-readable format), bounded by `limit` commits. The graph edge
|
|
213
|
+
* prefix is kept verbatim for the monospace drawing column.
|
|
214
|
+
*/
|
|
215
|
+
graph(cwd: string, limit: number | undefined, signal?: AbortSignal): Promise<GitGraph>;
|
|
216
|
+
/** Push the current branch; a branch without upstream gets `-u origin <branch>`. */
|
|
217
|
+
push(cwd: string, signal?: AbortSignal): Promise<void>;
|
|
218
|
+
/** Switch to an existing branch (git switch, falling back to checkout). */
|
|
219
|
+
checkout(cwd: string, branch: string, signal?: AbortSignal): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Create a branch from `base` (default: current HEAD) and switch to it.
|
|
222
|
+
* When `pushRemote` is true, the new branch is also pushed to `origin`
|
|
223
|
+
* with `-u`, creating it on the remote.
|
|
224
|
+
*/
|
|
225
|
+
createBranch(cwd: string, name: string, base: string | undefined, pushRemote: boolean, signal?: AbortSignal): Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Duck-typed face of the `node-pty` module — only what this plugin touches.
|
|
229
|
+
* Kept structural so a broken native install degrades into a clear
|
|
230
|
+
* "pty unavailable" error instead of crashing plugin activation.
|
|
231
|
+
*/
|
|
232
|
+
interface NodePtyModule {
|
|
233
|
+
spawn(file: string, args: readonly string[], options: {
|
|
234
|
+
name: string;
|
|
235
|
+
cols: number;
|
|
236
|
+
rows: number;
|
|
237
|
+
cwd: string;
|
|
238
|
+
env: NodeJS.ProcessEnv;
|
|
239
|
+
}): IPtyLike;
|
|
240
|
+
}
|
|
241
|
+
/** Duck-typed face of one node-pty terminal handle. */
|
|
242
|
+
interface IPtyLike {
|
|
243
|
+
pid: number;
|
|
244
|
+
write(data: string): void;
|
|
245
|
+
resize(cols: number, rows: number): void;
|
|
246
|
+
kill(): void;
|
|
247
|
+
onData(listener: (data: string) => void): unknown;
|
|
248
|
+
onExit(listener: (event: {
|
|
249
|
+
exitCode: number;
|
|
250
|
+
signal?: number;
|
|
251
|
+
}) => void): unknown;
|
|
252
|
+
}
|
|
253
|
+
/** A browser socket attached to one terminal (the WebSocket adapter). */
|
|
254
|
+
export interface TerminalClient {
|
|
255
|
+
/** Push one chunk to the browser: raw pty bytes or a JSON control frame. */
|
|
256
|
+
send(text: string): void;
|
|
257
|
+
/** Whether the connection can still carry frames. */
|
|
258
|
+
readonly alive: boolean;
|
|
259
|
+
}
|
|
260
|
+
interface TerminalSession {
|
|
261
|
+
key: string;
|
|
262
|
+
cwd: string;
|
|
263
|
+
pty: IPtyLike;
|
|
264
|
+
/** Output accumulated since spawn (bounded; head dropped when over the limit). */
|
|
265
|
+
transcript: string;
|
|
266
|
+
exited: boolean;
|
|
267
|
+
exitCode: number | null;
|
|
268
|
+
clients: Set<TerminalClient>;
|
|
269
|
+
closeTimer: ReturnType<typeof setTimeout> | null;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Owns the terminal shells, keyed by target (`session:<id>` / `ws:<name>`).
|
|
273
|
+
* One live process per key: re-attach reuses it (transcript replay makes the
|
|
274
|
+
* panel reopen seamless), an exited or cwd-changed handle is replaced with a
|
|
275
|
+
* fresh spawn. Socket drops schedule a grace close that a timely re-attach
|
|
276
|
+
* cancels; only the explicit close frame and teardown kill immediately.
|
|
277
|
+
*/
|
|
278
|
+
export declare class TerminalSessionManager {
|
|
279
|
+
private readonly sessions;
|
|
280
|
+
private readonly nodePty;
|
|
281
|
+
constructor(loadPty?: () => NodePtyModule | undefined);
|
|
282
|
+
/** Whether the native pty module could not be loaded (degraded mode). */
|
|
283
|
+
get unavailable(): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Attach one browser client to the target's terminal, opening (or replacing)
|
|
286
|
+
* the underlying shell as needed.
|
|
287
|
+
* @returns the session whose `transcript` must be replayed to the client
|
|
288
|
+
* before live data (empty on a fresh spawn).
|
|
289
|
+
*/
|
|
290
|
+
attach(key: string, cwd: string, cols: number, rows: number, client: TerminalClient): TerminalSession;
|
|
291
|
+
/** Remove one client; when the last one leaves, arm the reconnect grace. */
|
|
292
|
+
detach(key: string, client: TerminalClient): void;
|
|
293
|
+
/** Forward raw stdin bytes from the browser to the shell. */
|
|
294
|
+
input(key: string, data: string): void;
|
|
295
|
+
/** Propagate the xterm viewport size to the pty. */
|
|
296
|
+
resize(key: string, cols: number, rows: number): void;
|
|
297
|
+
/** Kill the target's shell now (explicit close frame / teardown path). */
|
|
298
|
+
close(key: string): void;
|
|
299
|
+
/** Kill every shell (plugin teardown). */
|
|
300
|
+
disposeAll(): void;
|
|
301
|
+
private spawn;
|
|
302
|
+
/** Fan one pty chunk out to every attached, still-open client. */
|
|
303
|
+
private broadcast;
|
|
304
|
+
/** Make room for a new shell: drop exited records first, then detached ones. */
|
|
305
|
+
private evictForNewSession;
|
|
306
|
+
/** Arm (or re-arm) the delayed destruction used for bare socket drops. */
|
|
307
|
+
private scheduleClose;
|
|
308
|
+
/** Cancel a pending scheduled close (a client re-attached in time). */
|
|
309
|
+
private cancelClose;
|
|
310
|
+
}
|
|
311
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — server half.
|
|
3
|
+
*
|
|
4
|
+
* Registers the `ui-tweaks` settings namespace so users can tune the
|
|
5
|
+
* conversation UI either from the Settings panel or by editing the settings
|
|
6
|
+
* document directly (settings.yaml `ui-tweaks:` section). All rendering work
|
|
7
|
+
* happens in the browser bundle (`src/client`), which reads and writes this
|
|
8
|
+
* namespace through the same-origin route mounted here — the Web settings RPC
|
|
9
|
+
* only exposes a fixed allowlist of namespaces since rc.6, so a custom route is
|
|
10
|
+
* the supported way for a plugin to own a configuration page.
|
|
11
|
+
* @module dsh-ui-tweaks
|
|
12
|
+
*/
|
|
13
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
14
|
+
export declare const name = "dsh-ui-tweaks";
|
|
15
|
+
/** Required services: the settings seam is the whole server-side surface. */
|
|
16
|
+
export declare const inject: string[];
|
|
17
|
+
export declare function apply(ctx: Context): void;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — MCP manager (host half).
|
|
3
|
+
*
|
|
4
|
+
* The browser MCP manager (the "MCP 管理" settings section, shown when the
|
|
5
|
+
* mcpManagerEnabled setting is on) manages the configured MCP servers through
|
|
6
|
+
* this same-origin route:
|
|
7
|
+
*
|
|
8
|
+
* - **list** — every `@deepseek-ai/dsh-mcp-client` loader entry with its live
|
|
9
|
+
* fiber status (active / failed / loading / stopped / disabled), its config
|
|
10
|
+
* (serverName, transport, command / url, env), a YAML rendering of the
|
|
11
|
+
* config (for the YAML editor), and the tools it registered
|
|
12
|
+
* (`mcp__<serverName>__*`) counted from the tool registry.
|
|
13
|
+
* - **save / remove / set-enabled** — ADD, EDIT, DELETE, and ENABLE/DISABLE a
|
|
14
|
+
* server durably by editing the profile's own `cordis.patch.yml` (the same
|
|
15
|
+
* file the user edits by hand): the entry is inserted / replaced / removed /
|
|
16
|
+
* flagged `disabled`, the file is written atomically, and DSH's built-in
|
|
17
|
+
* patch watcher (`watchUserPatches`, Cordis HMR) hot-reloads the loader, so
|
|
18
|
+
* the MCP server starts / stops / restarts live. The loader tree itself is
|
|
19
|
+
* never rewritten, so the patch file stays the single source of truth.
|
|
20
|
+
*
|
|
21
|
+
* Env values are returned to the same-origin browser (the user's own machine
|
|
22
|
+
* and config) because the editor must be able to show and modify them.
|
|
23
|
+
* @module dsh-ui-tweaks/mcp
|
|
24
|
+
*/
|
|
25
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
26
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
27
|
+
/** Exact route used by the browser MCP manager. */
|
|
28
|
+
export declare const MCP_ROUTE = "/_dsh/ui-tweaks/mcp";
|
|
29
|
+
/** Lifecycle status of one MCP server instance. */
|
|
30
|
+
export type McpStatus = 'disabled' | 'stopped' | 'active' | 'failed' | 'loading';
|
|
31
|
+
/** Public view of one configured MCP server. */
|
|
32
|
+
export interface McpServerView {
|
|
33
|
+
/** Loader entry id (e.g. `mcp-mysql-local`). */
|
|
34
|
+
id: string;
|
|
35
|
+
/** The server's tool namespace (`mcp__<serverName>__*`). */
|
|
36
|
+
serverName: string;
|
|
37
|
+
transport: string;
|
|
38
|
+
command?: string;
|
|
39
|
+
args: string[];
|
|
40
|
+
url?: string;
|
|
41
|
+
headers: Record<string, string>;
|
|
42
|
+
env: Record<string, string>;
|
|
43
|
+
/** Per-tool-call timeout in milliseconds. */
|
|
44
|
+
toolCallTimeoutMs?: number;
|
|
45
|
+
/** The server's config rendered as YAML (for the YAML editor). */
|
|
46
|
+
yaml: string;
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
status: McpStatus;
|
|
49
|
+
toolCount: number;
|
|
50
|
+
/** Raw tool names registered by this server, sorted. */
|
|
51
|
+
tools: string[];
|
|
52
|
+
}
|
|
53
|
+
/** Editor payload for add/edit/set-enabled. */
|
|
54
|
+
export interface McpServerInput {
|
|
55
|
+
id: string;
|
|
56
|
+
serverName: string;
|
|
57
|
+
transport: 'stdio' | 'streamable-http';
|
|
58
|
+
command?: string;
|
|
59
|
+
args?: string[];
|
|
60
|
+
url?: string;
|
|
61
|
+
headers?: Record<string, string>;
|
|
62
|
+
env?: Record<string, string>;
|
|
63
|
+
toolCallTimeoutMs?: number;
|
|
64
|
+
disabled: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface McpSnapshot {
|
|
67
|
+
servers: McpServerView[];
|
|
68
|
+
}
|
|
69
|
+
/** Same-origin MCP read/write handler. */
|
|
70
|
+
export declare class McpBackend {
|
|
71
|
+
private readonly ctx;
|
|
72
|
+
constructor(ctx: Context);
|
|
73
|
+
private loader;
|
|
74
|
+
/** Best-effort enumeration of the global tool registry (no public list API). */
|
|
75
|
+
private toolNames;
|
|
76
|
+
private snapshot;
|
|
77
|
+
/** Resolve the profile directory: the root Include entry's config.path is
|
|
78
|
+
* the profile's `cordis.yml` (a `file://` URL), whose parent IS the profile
|
|
79
|
+
* directory. Falls back to the loader's baseUrl. */
|
|
80
|
+
private profileDir;
|
|
81
|
+
private patchFilePath;
|
|
82
|
+
/** Find one MCP entry in the patch document; also reports its insert seq, index, and owning patch. */
|
|
83
|
+
private findPatchEntry;
|
|
84
|
+
/** The insert seq new MCP entries should join (first one already holding MCP entries, else the first insert). */
|
|
85
|
+
private insertTarget;
|
|
86
|
+
private entryNode;
|
|
87
|
+
private mutatePatchFile;
|
|
88
|
+
private validateInput;
|
|
89
|
+
/** Add or edit one server (upsert by id), persisting to the profile patch file. */
|
|
90
|
+
private save;
|
|
91
|
+
/** Delete one server from the profile patch file. */
|
|
92
|
+
private remove;
|
|
93
|
+
/** Enable or disable one server in the profile patch file. */
|
|
94
|
+
private setEnabled;
|
|
95
|
+
/** Handle the exact MCP route. */
|
|
96
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Attach the MCP route whenever a webServer service is present.
|
|
100
|
+
* @param ctx - plugin context owning route effects.
|
|
101
|
+
* @param backend - MCP handler.
|
|
102
|
+
*/
|
|
103
|
+
export declare function installMcpWeb(ctx: Context, backend: McpBackend): void;
|