@keith9681/dsh-sidebar 0.15.2
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 +0 -0
- package/README_EN.md +0 -0
- package/cordis.patch.yml +49 -0
- package/lib/client-editor.js +34651 -0
- package/lib/client-mermaid.js +200629 -0
- package/lib/client-registry.js +13388 -0
- package/lib/client-terminal.js +8904 -0
- package/lib/client.js +13388 -0
- package/lib/index.js +3959 -0
- package/lib/invariant.js +22 -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/client/BrowserView.d.ts +22 -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 +12 -0
- package/lib/types/client/FileTree.d.ts +36 -0
- package/lib/types/client/GitView.d.ts +8 -0
- package/lib/types/client/OrphanedTab.d.ts +11 -0
- package/lib/types/client/PdfView.d.ts +6 -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/SideChatView.d.ts +16 -0
- package/lib/types/client/Sidebar.d.ts +6 -0
- package/lib/types/client/SubagentView.d.ts +16 -0
- package/lib/types/client/TabBar.d.ts +43 -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 +23 -0
- package/lib/types/client/UploadOverlay.d.ts +20 -0
- package/lib/types/client/add-plugin-modal.d.ts +15 -0
- package/lib/types/client/api.d.ts +268 -0
- package/lib/types/client/binary-download.d.ts +12 -0
- package/lib/types/client/breakpoints.d.ts +12 -0
- package/lib/types/client/browser.d.ts +50 -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/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/editable-state.d.ts +27 -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 +57 -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 +33 -0
- package/lib/types/client/lang.d.ts +12 -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.d.ts +366 -0
- package/lib/types/client/mermaid-blocks.d.ts +41 -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 +41 -0
- package/lib/types/client/paths.d.ts +35 -0
- package/lib/types/client/pdf-types.d.ts +2 -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 +23 -0
- package/lib/types/client/selection-payload.d.ts +27 -0
- package/lib/types/client/service.d.ts +440 -0
- package/lib/types/client/settings-nav-icon.d.ts +19 -0
- package/lib/types/client/shell-presets.d.ts +48 -0
- package/lib/types/client/sidechat-transcript.d.ts +103 -0
- package/lib/types/client/split-pane.d.ts +30 -0
- package/lib/types/client/state.d.ts +359 -0
- package/lib/types/client/subagent-detect.d.ts +54 -0
- package/lib/types/client/subagent-jobs.d.ts +63 -0
- package/lib/types/client/tab-content-memo.d.ts +33 -0
- package/lib/types/client/terminal-font.d.ts +20 -0
- package/lib/types/client/theme.d.ts +45 -0
- package/lib/types/client/titlebar-strip.d.ts +23 -0
- package/lib/types/client/upload.d.ts +69 -0
- package/lib/types/client/wco.d.ts +47 -0
- package/lib/types/config.d.ts +64 -0
- package/lib/types/context-types.d.ts +603 -0
- package/lib/types/fs-operations.d.ts +28 -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 +82 -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/jobs-routes.d.ts +45 -0
- package/lib/types/open-external.d.ts +24 -0
- package/lib/types/prefs-shared.d.ts +225 -0
- package/lib/types/pty-deps.d.ts +78 -0
- package/lib/types/pty-manager.d.ts +168 -0
- package/lib/types/sidechat-core.d.ts +172 -0
- package/lib/types/sidechat-routes.d.ts +30 -0
- package/lib/types/subagent-activity.d.ts +44 -0
- package/lib/types/subagent-live-route.d.ts +44 -0
- package/lib/types/tools.d.ts +31 -0
- package/lib/types/trust-fence.d.ts +24 -0
- package/lib/types/wire.d.ts +38 -0
- package/package.json +173 -0
- package/scripts/install.ps1 +289 -0
- package/scripts/install.sh +287 -0
- package/src/agent-pty.ts +527 -0
- package/src/browser-probe.ts +26 -0
- package/src/bundle-route.ts +129 -0
- package/src/client/BrowserView.tsx +253 -0
- package/src/client/DiffTab.tsx +110 -0
- package/src/client/DiffView.tsx +305 -0
- package/src/client/EditorHost.tsx +525 -0
- package/src/client/FileTree.tsx +653 -0
- package/src/client/GitView.tsx +558 -0
- package/src/client/OrphanedTab.tsx +27 -0
- package/src/client/PdfView.tsx +110 -0
- package/src/client/RenderBoundary.tsx +49 -0
- package/src/client/SandboxStatusBar.tsx +60 -0
- package/src/client/SideCardSection.module.css +960 -0
- package/src/client/SideCardSection.tsx +1152 -0
- package/src/client/SideChatView.module.css +437 -0
- package/src/client/SideChatView.tsx +644 -0
- package/src/client/Sidebar.tsx +1148 -0
- package/src/client/SubagentView.module.css +547 -0
- package/src/client/SubagentView.tsx +883 -0
- package/src/client/TabBar.tsx +305 -0
- package/src/client/TerminalView.tsx +383 -0
- package/src/client/TextEditor.tsx +500 -0
- package/src/client/TreePanel.tsx +273 -0
- package/src/client/UploadOverlay.tsx +62 -0
- package/src/client/add-plugin-modal.tsx +199 -0
- package/src/client/api.ts +335 -0
- package/src/client/binary-download.tsx +23 -0
- package/src/client/breakpoints.ts +51 -0
- package/src/client/browser.ts +119 -0
- package/src/client/builtins/index.ts +37 -0
- package/src/client/builtins/tabs.tsx +331 -0
- package/src/client/builtins/viewers.tsx +125 -0
- package/src/client/chunk-loader.ts +351 -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/editable-state.ts +70 -0
- package/src/client/editor-load.ts +92 -0
- package/src/client/frame-batcher.ts +56 -0
- package/src/client/icons.tsx +161 -0
- package/src/client/image-types.ts +8 -0
- package/src/client/ime-guard.ts +47 -0
- package/src/client/index.tsx +369 -0
- package/src/client/intercept.tsx +110 -0
- package/src/client/lang.ts +103 -0
- package/src/client/layout.css +94 -0
- package/src/client/lazy-chunk.tsx +89 -0
- package/src/client/link-intercept.ts +73 -0
- package/src/client/locales.ts +734 -0
- package/src/client/mermaid-blocks.ts +110 -0
- package/src/client/mermaid-sanitize.ts +93 -0
- package/src/client/mermaid.tsx +401 -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 +62 -0
- package/src/client/paths.ts +47 -0
- package/src/client/pdf-types.ts +4 -0
- package/src/client/plugin-settings.ts +43 -0
- package/src/client/plugins-shared.ts +29 -0
- package/src/client/plugins-tabs.ts +87 -0
- package/src/client/plugins-viewers.ts +30 -0
- package/src/client/prefs.ts +207 -0
- package/src/client/produced-files.ts +91 -0
- package/src/client/selection-payload.ts +86 -0
- package/src/client/service.ts +838 -0
- package/src/client/settings-nav-icon.ts +45 -0
- package/src/client/shell-presets.ts +83 -0
- package/src/client/sidebar.module.css +2577 -0
- package/src/client/sidechat-transcript.ts +321 -0
- package/src/client/split-pane.tsx +322 -0
- package/src/client/state.ts +1175 -0
- package/src/client/subagent-detect.ts +137 -0
- package/src/client/subagent-jobs.ts +161 -0
- package/src/client/tab-content-memo.ts +46 -0
- package/src/client/terminal-font.ts +28 -0
- package/src/client/theme.ts +110 -0
- package/src/client/titlebar-strip.ts +37 -0
- package/src/client/upload.ts +187 -0
- package/src/client/wco.ts +120 -0
- package/src/config.ts +155 -0
- package/src/context-types.ts +610 -0
- package/src/fs-operations.ts +99 -0
- package/src/fs-search.ts +86 -0
- package/src/fs-tree.ts +158 -0
- package/src/git.ts +244 -0
- package/src/html-route.ts +106 -0
- package/src/index.ts +1132 -0
- package/src/invariant.ts +32 -0
- package/src/jobs-routes.ts +257 -0
- package/src/open-external.ts +90 -0
- package/src/prefs-shared.ts +268 -0
- package/src/pty-deps.ts +240 -0
- package/src/pty-manager.ts +376 -0
- package/src/sidechat-core.ts +468 -0
- package/src/sidechat-routes.ts +344 -0
- package/src/subagent-activity.ts +91 -0
- package/src/subagent-live-route.ts +93 -0
- package/src/tools.ts +479 -0
- package/src/trust-fence.ts +77 -0
- package/src/wire.ts +100 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mark this plugin's row in the DSH settings navigation so its bundled CSS
|
|
3
|
+
* can replace the shell's fallback gear with the Side card glyph.
|
|
4
|
+
*
|
|
5
|
+
* DSH 0.1.x projects only `id`, `order`, and `label` from a
|
|
6
|
+
* `settings.section` registration, then chooses icons inside the settings
|
|
7
|
+
* shell from a closed list of built-in ids. Until that public contract grows
|
|
8
|
+
* an icon field, the plugin identifies only its own localized row after the
|
|
9
|
+
* dialog mounts. The marker owns no shell structure and is removed on fiber
|
|
10
|
+
* disposal, so the adaptation remains HMR-safe.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const SETTINGS_NAV_MARKER = 'data-dsh-better-sidebar-settings-nav'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Keep the marker on the settings-nav button whose visible text is this
|
|
17
|
+
* plugin's current localized section label.
|
|
18
|
+
* @param label - locale-aware label resolver used by the section registration.
|
|
19
|
+
* @returns disposer that disconnects observation and removes owned markers.
|
|
20
|
+
*/
|
|
21
|
+
export function registerSettingsNavIcon(label: () => string): () => void {
|
|
22
|
+
let disposed = false
|
|
23
|
+
|
|
24
|
+
const sync = (): void => {
|
|
25
|
+
if (disposed) return
|
|
26
|
+
const currentLabel = label().trim()
|
|
27
|
+
const buttons = document.querySelectorAll<HTMLButtonElement>('[role="dialog"] nav button')
|
|
28
|
+
for (const button of buttons) {
|
|
29
|
+
const matches = currentLabel.length > 0 && button.textContent?.trim() === currentLabel
|
|
30
|
+
if (matches) button.setAttribute(SETTINGS_NAV_MARKER, '')
|
|
31
|
+
else button.removeAttribute(SETTINGS_NAV_MARKER)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
sync()
|
|
36
|
+
const observer = new MutationObserver(sync)
|
|
37
|
+
observer.observe(document.body, { childList: true, subtree: true, characterData: true })
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
disposed = true
|
|
41
|
+
observer.disconnect()
|
|
42
|
+
document.querySelectorAll(`[${SETTINGS_NAV_MARKER}]`)
|
|
43
|
+
.forEach(element => { element.removeAttribute(SETTINGS_NAV_MARKER) })
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in desktop-shell presets for the "位置兼容模式" secondary setting
|
|
3
|
+
* (scheme `preset`). DATA-DRIVEN by design: each shell's adaptation lives
|
|
4
|
+
* in one entry (strip values / optional CSS), the core applies it through
|
|
5
|
+
* the SAME generic strip variable and CSS-injection mechanism — adding a
|
|
6
|
+
* shell is adding data, never a code path.
|
|
7
|
+
*
|
|
8
|
+
* Inclusion rule (maintained in AGENTS.md §8): only shells that (a) appear
|
|
9
|
+
* in this repo's issues/PRs (a user actually hit a problem) and (b) have
|
|
10
|
+
* 100+ GitHub stars (a real user base). The mechanism is opt-in: auto
|
|
11
|
+
* detection never applies a preset — the settings badge only SUGGESTS it.
|
|
12
|
+
*/
|
|
13
|
+
import type { DesktopEnv } from './desktop-env.ts'
|
|
14
|
+
|
|
15
|
+
export interface ShellPreset {
|
|
16
|
+
/** Stable preset id (persisted in `titleBarPresetId`). */
|
|
17
|
+
readonly id: string
|
|
18
|
+
/** User-facing name of the shell. */
|
|
19
|
+
readonly title: string
|
|
20
|
+
/** One-line description shown in the settings popup. */
|
|
21
|
+
readonly desc: string
|
|
22
|
+
/**
|
|
23
|
+
* The top strip (px) this shell reserves over web content, per
|
|
24
|
+
* environment — the fallback used when neither the standard WCO API nor
|
|
25
|
+
* the `dsh-desktop-titlebar-inset` contract parameter is available.
|
|
26
|
+
* Return undefined when the shell needs no strip in that environment.
|
|
27
|
+
* MUST be pure (called during render).
|
|
28
|
+
*/
|
|
29
|
+
readonly stripFor?: (env: DesktopEnv) => number | undefined
|
|
30
|
+
/**
|
|
31
|
+
* Extra CSS applied while the preset is enabled (injected last, after the
|
|
32
|
+
* plugin's own styles). Targets the plugin's stable data attributes and
|
|
33
|
+
* shell-declared body/URL markers only — never other shells' class names.
|
|
34
|
+
* Empty for presets fully covered by the strip variable.
|
|
35
|
+
*/
|
|
36
|
+
readonly css?: string
|
|
37
|
+
/**
|
|
38
|
+
* Whether this shell's marker is currently visible (URL stamps / preload
|
|
39
|
+
* markers — see desktop-env.ts). Used ONLY for the settings "已检测"
|
|
40
|
+
* badge; never auto-applies anything. MUST be pure.
|
|
41
|
+
*/
|
|
42
|
+
readonly detect?: (env: DesktopEnv) => boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* DeepSeek Harness Desktop (anywhere-labs, Electron, 16k+ stars — the most
|
|
47
|
+
* reported shell in this repo's issues/PRs). Advanced mode: macOS reserves
|
|
48
|
+
* a 20px caption row (traffic lights top-left), win32 draws the native
|
|
49
|
+
* window controls in a ~32px overlay (WCO reports the real height when
|
|
50
|
+
* available, which the auto scheme already consumes; the 32 is the
|
|
51
|
+
* no-WCO fallback). Compatibility mode keeps the native frame — nothing.
|
|
52
|
+
*/
|
|
53
|
+
const DSH_DESKTOP: ShellPreset = {
|
|
54
|
+
id: 'dsh-desktop',
|
|
55
|
+
title: 'DeepSeek Harness Desktop',
|
|
56
|
+
desc: 'Electron 高级模式(无边框):macOS 顶栏 20px、Windows 无 WCO 时 32px 标题栏让位',
|
|
57
|
+
stripFor: (env) => {
|
|
58
|
+
if (env.mode !== 'advanced') return undefined
|
|
59
|
+
if (env.platform === 'darwin') return 20
|
|
60
|
+
if (env.platform === 'win32') return 32
|
|
61
|
+
return undefined
|
|
62
|
+
},
|
|
63
|
+
detect: (env) => env.mode === 'advanced',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const PRESETS: readonly ShellPreset[] = [
|
|
67
|
+
DSH_DESKTOP,
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
/** All built-in shell presets (registration order = settings list order). */
|
|
71
|
+
export function getShellPresets(): readonly ShellPreset[] {
|
|
72
|
+
return PRESETS
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** One preset by id, or undefined for an unknown/empty id. */
|
|
76
|
+
export function getShellPreset(id: string): ShellPreset | undefined {
|
|
77
|
+
return PRESETS.find(preset => preset.id === id)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The strip the active preset contributes for the given environment. */
|
|
81
|
+
export function presetStripFor(preset: ShellPreset | undefined, env: DesktopEnv): number | undefined {
|
|
82
|
+
return preset?.stripFor?.(env)
|
|
83
|
+
}
|