dsh-coding-sidebar 1.0.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 +524 -0
- package/cordis.patch.yml +49 -0
- package/lib/client-editor.js +48229 -0
- package/lib/client-mermaid.js +200745 -0
- package/lib/client-registry.js +21867 -0
- package/lib/client-terminal.js +9361 -0
- package/lib/client.js +21867 -0
- package/lib/index.js +4556 -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/client/BrowserView.d.ts +39 -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/FileTree.d.ts +38 -0
- package/lib/types/client/FreeWindow.d.ts +29 -0
- package/lib/types/client/GitView.d.ts +10 -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/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 +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 +24 -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 +275 -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/chunk-loader.d.ts +131 -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 +59 -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 +25 -0
- package/lib/types/client/intercept.d.ts +46 -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 +452 -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 +38 -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 +85 -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 +439 -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 +36 -0
- package/lib/types/client/state.d.ts +432 -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 +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/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 +605 -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 +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/jobs-routes.d.ts +45 -0
- package/lib/types/open-external.d.ts +24 -0
- package/lib/types/path-security.d.ts +20 -0
- package/lib/types/prefs-shared.d.ts +236 -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 +34 -0
- package/lib/types/trust-fence.d.ts +24 -0
- package/lib/types/wire.d.ts +38 -0
- package/package.json +172 -0
- package/scripts/install.ps1 +306 -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/client/BrowserView.tsx +289 -0
- package/src/client/DiffTab.tsx +114 -0
- package/src/client/DiffView.tsx +305 -0
- package/src/client/EditorHost.tsx +558 -0
- package/src/client/FileTree.tsx +669 -0
- package/src/client/FreeWindow.tsx +337 -0
- package/src/client/GitView.tsx +717 -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/RenderBoundary.tsx +49 -0
- package/src/client/SandboxStatusBar.tsx +60 -0
- package/src/client/SideCardSection.module.css +960 -0
- package/src/client/SideCardSection.tsx +1163 -0
- package/src/client/SideChatView.module.css +437 -0
- package/src/client/SideChatView.tsx +645 -0
- package/src/client/Sidebar.tsx +1370 -0
- package/src/client/SubagentView.module.css +547 -0
- package/src/client/SubagentView.tsx +883 -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 +275 -0
- package/src/client/UploadOverlay.tsx +62 -0
- package/src/client/add-plugin-modal.tsx +199 -0
- package/src/client/api.ts +357 -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 +340 -0
- package/src/client/builtins/viewers.tsx +125 -0
- package/src/client/chunk-loader.ts +358 -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 +152 -0
- package/src/client/image-types.ts +8 -0
- package/src/client/ime-guard.ts +47 -0
- package/src/client/index.tsx +427 -0
- package/src/client/intercept.tsx +188 -0
- package/src/client/lang.ts +225 -0
- package/src/client/layout-push.ts +24 -0
- package/src/client/layout.css +90 -0
- package/src/client/lazy-chunk.tsx +89 -0
- package/src/client/link-intercept.ts +73 -0
- package/src/client/locales-ar.ts +368 -0
- package/src/client/locales-de.ts +353 -0
- package/src/client/locales-fr.ts +360 -0
- package/src/client/locales-hi.ts +367 -0
- package/src/client/locales-id.ts +365 -0
- package/src/client/locales-it.ts +358 -0
- package/src/client/locales-ja.ts +367 -0
- package/src/client/locales-ko.ts +359 -0
- package/src/client/locales-nl.ts +365 -0
- package/src/client/locales-pl.ts +369 -0
- package/src/client/locales-pt.ts +350 -0
- package/src/client/locales-ru.ts +365 -0
- package/src/client/locales-sv.ts +350 -0
- package/src/client/locales-th.ts +367 -0
- package/src/client/locales-tr.ts +367 -0
- package/src/client/locales-vi.ts +367 -0
- package/src/client/locales-zh-HK.ts +382 -0
- package/src/client/locales-zh-MO.ts +382 -0
- package/src/client/locales-zh-TW.ts +382 -0
- package/src/client/locales.ts +894 -0
- package/src/client/markdown-html.ts +331 -0
- package/src/client/markdown-images.ts +137 -0
- package/src/client/markdown-labels.tsx +52 -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 +143 -0
- package/src/client/paths.ts +63 -0
- package/src/client/pdf-types.ts +4 -0
- package/src/client/pinned.ts +183 -0
- package/src/client/plugin-settings.ts +43 -0
- package/src/client/plugins-shared.ts +29 -0
- package/src/client/plugins-tabs.ts +96 -0
- package/src/client/plugins-viewers.ts +30 -0
- package/src/client/prefs.ts +210 -0
- package/src/client/produced-files.ts +120 -0
- package/src/client/selection-payload.ts +86 -0
- package/src/client/service.ts +859 -0
- package/src/client/settings-nav-icon.ts +45 -0
- package/src/client/shell-presets.ts +83 -0
- package/src/client/sidebar.module.css +2788 -0
- package/src/client/sidechat-transcript.ts +321 -0
- package/src/client/split-pane.tsx +331 -0
- package/src/client/state.ts +1497 -0
- package/src/client/subagent-detect.ts +137 -0
- package/src/client/subagent-jobs.ts +161 -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/upload.ts +187 -0
- package/src/client/wco.ts +120 -0
- package/src/config.ts +154 -0
- package/src/context-types.ts +611 -0
- package/src/fs-operations.ts +95 -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 +1291 -0
- package/src/invariant.ts +32 -0
- package/src/jobs-routes.ts +257 -0
- package/src/open-external.ts +90 -0
- package/src/path-security.ts +75 -0
- package/src/prefs-shared.ts +280 -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 +482 -0
- package/src/trust-fence.ts +84 -0
- package/src/wire.ts +100 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal URL hyperlinks: xterm's `registerLinkProvider` is fed per-line
|
|
3
|
+
* link descriptors built from the pty stream, so URLs printed by any tool
|
|
4
|
+
* become hoverable / clickable spans.
|
|
5
|
+
*
|
|
6
|
+
* To stay out of the user's way (a terminal's primary interaction is text
|
|
7
|
+
* selection, not browsing), a click only activates when the user holds
|
|
8
|
+
* Ctrl (Win/Linux) or Cmd (mac) — a plain click is left for xterm's
|
|
9
|
+
* normal selection handling. Only http(s) URLs are dispatched to the
|
|
10
|
+
* browser; other schemes (`file://`, `mailto:`, `javascript:`, …) are
|
|
11
|
+
* underlined for visibility but rejected at activation, so a `file://`
|
|
12
|
+
* URL printed by a tool stays inert instead of being handed to
|
|
13
|
+
* `window.open`.
|
|
14
|
+
*
|
|
15
|
+
* Kept as a pure module (no xterm import) so the regex, the line
|
|
16
|
+
* scanner, the modifier gate and the scheme guard are unit-testable
|
|
17
|
+
* without mounting a terminal. `buildTerminalLinks` returns plain-object
|
|
18
|
+
* descriptors whose shape matches xterm's `ILink` minus the `activate`
|
|
19
|
+
* callback — the caller attaches `activate` (which closes over the
|
|
20
|
+
* event modifier check + `openTerminalUrl`) so this module never
|
|
21
|
+
* imports xterm types.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The URL pattern used to scan each terminal line.
|
|
25
|
+
*
|
|
26
|
+
* A word boundary (`\b`) guards the leading scheme so `notttps://…` does
|
|
27
|
+
* not match. The character class excludes ASCII whitespace and the
|
|
28
|
+
* wrapping punctuation that shells commonly emit around URLs (quotes,
|
|
29
|
+
* angle brackets, brackets/braces, pipes, backslashes, backticks) so a
|
|
30
|
+
* URL printed as `"https://example.com"` or `<https://example.com>` does
|
|
31
|
+
* not drag the wrapping character into the link target.
|
|
32
|
+
*
|
|
33
|
+
* Carries the `g` flag so `findTerminalUrlsInLine` can iterate every
|
|
34
|
+
* match on a line; callers must reset `lastIndex` before reuse (the
|
|
35
|
+
* helper does this defensively).
|
|
36
|
+
*/
|
|
37
|
+
export declare const TERMINAL_URL_REGEX: RegExp;
|
|
38
|
+
/** A URL match in a terminal line: the text and its 0-based start offset. */
|
|
39
|
+
export interface TerminalUrlMatch {
|
|
40
|
+
/** 0-based start index of the URL within the line string. */
|
|
41
|
+
start: number;
|
|
42
|
+
/** The matched URL text. */
|
|
43
|
+
text: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Find every http(s) URL in a line of terminal text, in source order
|
|
47
|
+
* with 0-based start offsets. A link provider maps these to buffer
|
|
48
|
+
* ranges for xterm's `registerLinkProvider`.
|
|
49
|
+
*
|
|
50
|
+
* Trailing unmatched closing parens are trimmed from each match (see
|
|
51
|
+
* {@link trimUnbalancedTrailingParens}), so a URL wrapped in parens by
|
|
52
|
+
* a shell opens without the trailing `)`, while Wikipedia-style URLs
|
|
53
|
+
* with balanced parens stay intact.
|
|
54
|
+
*
|
|
55
|
+
* Resets the regex's `lastIndex` before and after the scan so a
|
|
56
|
+
* previous partial iteration can't desynchronize a later one (the
|
|
57
|
+
* regex carries the `g` flag and is module-shared).
|
|
58
|
+
*/
|
|
59
|
+
export declare function findTerminalUrlsInLine(line: string): TerminalUrlMatch[];
|
|
60
|
+
/**
|
|
61
|
+
* A buffer range in xterm's coordinate system. xterm's cell `x` is
|
|
62
|
+
* 1-based (1..cols) and `y` is the buffer line number; the `end` is
|
|
63
|
+
* inclusive (the last cell covered by the link). Structurally
|
|
64
|
+
* compatible with xterm's `IBufferRange` so the caller can pass it
|
|
65
|
+
* straight through without importing xterm types here.
|
|
66
|
+
*/
|
|
67
|
+
export interface TerminalLinkRange {
|
|
68
|
+
start: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
};
|
|
72
|
+
end: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A link descriptor: a buffer range plus the URL text. The caller
|
|
79
|
+
* (the link provider in `TerminalView`) attaches the `activate`
|
|
80
|
+
* callback, which closes over the modifier gate and `openTerminalUrl`.
|
|
81
|
+
*/
|
|
82
|
+
export interface TerminalLinkDescriptor {
|
|
83
|
+
range: TerminalLinkRange;
|
|
84
|
+
text: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Build link descriptors for every URL found in a terminal line.
|
|
88
|
+
*
|
|
89
|
+
* @param lineText - the line's text (e.g. from
|
|
90
|
+
* `IBufferLine.translateToString(true)`).
|
|
91
|
+
* @param lineNumber - the buffer line number xterm passed to
|
|
92
|
+
* `ILinkProvider.provideLinks` (used as the `y` of every range; URLs
|
|
93
|
+
* never span wrapped lines because each wrapped row is its own
|
|
94
|
+
* buffer line).
|
|
95
|
+
* @returns descriptors in source order; empty when the line has no URL.
|
|
96
|
+
*/
|
|
97
|
+
export declare function buildTerminalLinks(lineText: string, lineNumber: number): TerminalLinkDescriptor[];
|
|
98
|
+
/**
|
|
99
|
+
* Decide whether a click on a terminal link should activate (open the URL).
|
|
100
|
+
*
|
|
101
|
+
* Mirrors what every modern terminal does (Windows Terminal, iTerm2, the
|
|
102
|
+
* VSCode integrated terminal): a plain click stays a text-selection
|
|
103
|
+
* gesture, and only Ctrl (Win/Linux) or Cmd (mac) hands the URL to the
|
|
104
|
+
* browser. The modifier is read off the activating `MouseEvent`, not
|
|
105
|
+
* tracked separately, so a key-up between hover and click never
|
|
106
|
+
* desynchronizes the gate.
|
|
107
|
+
*/
|
|
108
|
+
export declare function shouldActivateTerminalLink(event: MouseEvent): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Open a URL matched in the terminal, with a scheme guard so a printed
|
|
111
|
+
* `file://` or anything that slipped past the regex cannot reach
|
|
112
|
+
* `window.open`. The URL is constructed via `new URL(...)` which throws
|
|
113
|
+
* on malformed input; the catch makes the function total so the xterm
|
|
114
|
+
* handler never throws into the terminal's event loop.
|
|
115
|
+
*
|
|
116
|
+
* @returns `true` when the URL was dispatched to `window.open`, `false`
|
|
117
|
+
* when it was rejected (bad URL, disallowed scheme, no `window`).
|
|
118
|
+
*/
|
|
119
|
+
export declare function openTerminalUrl(uri: string): boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live theme access for surfaces that cannot consume the token colors
|
|
3
|
+
* directly — xterm's palette and CodeMirror's theme extensions need concrete
|
|
4
|
+
* values, but the app's scheme flips at runtime (ui-layout's ThemePresenter
|
|
5
|
+
* projects prefers-color-scheme and the user's choice onto
|
|
6
|
+
* body[data-ds-dark-theme] and html { color-scheme }). This module reads the
|
|
7
|
+
* resolved scheme and token values, and notifies subscribers on flips, so
|
|
8
|
+
* the terminal and the editor re-theme in place instead of freezing in the
|
|
9
|
+
* scheme they happened to be created under.
|
|
10
|
+
*/
|
|
11
|
+
/** Whether the app shell resolved to the dark scheme.
|
|
12
|
+
*
|
|
13
|
+
* The presenter sets `html { color-scheme }` together with the body palette
|
|
14
|
+
* attribute, so a set color-scheme means the decision is authoritative (an
|
|
15
|
+
* absent attribute is then LIGHT even when the OS prefers dark — the user
|
|
16
|
+
* chose light). Before the presenter has run, fall back to the OS media
|
|
17
|
+
* query as the best guess.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isDarkScheme(): boolean;
|
|
20
|
+
/** One token's computed value on <body> ('' while the theme has not applied). */
|
|
21
|
+
export declare function tokenValue(name: string): string;
|
|
22
|
+
/** The alpha channel of a computed CSS color, or null when the format is
|
|
23
|
+
* not parseable (named colors, `color()`… — treated as opaque). Handles
|
|
24
|
+
* the shapes getComputedStyle actually returns: the rgb()/rgba() and
|
|
25
|
+
* hsl()/hsla() function forms (comma or space syntax, with or without the
|
|
26
|
+
* `/ alpha` slot) and the #rgb/#rgba/#rrggbb/#rrggbbaa hex family. */
|
|
27
|
+
export declare function colorAlpha(color: string): number | null;
|
|
28
|
+
/**
|
|
29
|
+
* A token value that actually PAINTS something — the guard for text
|
|
30
|
+
* surfaces (issue #90). Skin systems routinely set global tokens to
|
|
31
|
+
* `transparent` (glass skins) or translucent glass values (`rgba(…,0.16–0.7)`,
|
|
32
|
+
* e.g. the dsh-web-ui skins) — both are truthy strings, so callers using
|
|
33
|
+
* `|| fallback` never fire and the terminal/editor goes see-through over
|
|
34
|
+
* the skin's backdrop. This returns '' for visually inert values (unset
|
|
35
|
+
* keywords, transparent, and any color below the opacity floor) so the
|
|
36
|
+
* caller's fallback chain engages; effectively opaque values pass through.
|
|
37
|
+
*/
|
|
38
|
+
export declare function effectiveTokenValue(name: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to color-scheme flips (the presenter toggles the body
|
|
41
|
+
* attribute). The callback fires after the attribute changed; re-read the
|
|
42
|
+
* scheme inside it.
|
|
43
|
+
* @returns the disposer.
|
|
44
|
+
*/
|
|
45
|
+
export declare function subscribeColorScheme(callback: () => void): () => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The title-bar strip resolution chain — the ONE place that decides how
|
|
3
|
+
* many pixels the sidebar yields at the top. Standard signals first, then
|
|
4
|
+
* the user's chosen scheme; never a per-shell branch:
|
|
5
|
+
*
|
|
6
|
+
* 0. `web` scheme — EXPLICIT "DSH official web": never adapt, not even
|
|
7
|
+
* standard WCO geometry (the user declares the plain web UI).
|
|
8
|
+
* 1. Window Controls Overlay real geometry (standard API, authoritative
|
|
9
|
+
* when present — even 0, e.g. the overlay is hidden while maximized).
|
|
10
|
+
* 2. The `dsh-desktop-titlebar-inset` URL contract parameter (a shell
|
|
11
|
+
* declares the exact pixels it reserves).
|
|
12
|
+
* 3. The active shell preset's strip (scheme `preset` — opt-in data).
|
|
13
|
+
* 4. The legacy manual `titleBarStripPx` (scheme `custom`).
|
|
14
|
+
* 5. 0 — plain-browser semantics, nothing modified.
|
|
15
|
+
*
|
|
16
|
+
* The result drives `--dsh-title-bar-strip` + `body[data-dsh-title-bar-compat]`
|
|
17
|
+
* exactly like the legacy boolean did; only the VALUE source changed.
|
|
18
|
+
*/
|
|
19
|
+
import type { DesktopEnv } from './desktop-env.ts';
|
|
20
|
+
import type { TitleBarScheme } from '../prefs-shared.ts';
|
|
21
|
+
import type { WcoSnapshot } from './wco.ts';
|
|
22
|
+
import { type ShellPreset } from './shell-presets.ts';
|
|
23
|
+
export declare function computeTitleBarStrip(env: DesktopEnv, wco: WcoSnapshot, scheme: TitleBarScheme, preset: ShellPreset | undefined, customStripPx: number): number;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-upload plumbing for the files window: turn a file picker or a drag-drop
|
|
3
|
+
* into per-file raw-byte uploads through the sidebar's `/sidebar/upload` route.
|
|
4
|
+
*
|
|
5
|
+
* Folders keep their tree in both flows: the picker's `webkitdirectory`
|
|
6
|
+
* selection arrives as Files with `webkitRelativePath` filled, and dropped
|
|
7
|
+
* folders — which never surface in `dataTransfer.files` — are traversed via
|
|
8
|
+
* `webkitGetAsEntry`, so the relative path is preserved for every nested file
|
|
9
|
+
* and the host recreates the tree under the chosen directory. The File is
|
|
10
|
+
* streamed straight into the POST body (no base64 inflation); uploads run
|
|
11
|
+
* sequentially so one slow file cannot starve the others, and each result
|
|
12
|
+
* reports its own outcome (the tree keeps going after a failure). An
|
|
13
|
+
* optional `AbortSignal` stops the queue at the next item boundary and
|
|
14
|
+
* aborts the in-flight request; the host cleans up its temp file when the
|
|
15
|
+
* request stream dies.
|
|
16
|
+
*/
|
|
17
|
+
import { type SessionScope } from './api.ts';
|
|
18
|
+
import type { CopyKey } from './locales.ts';
|
|
19
|
+
/** One pending file: the browser File plus the workspace-relative target path. */
|
|
20
|
+
export interface UploadItem {
|
|
21
|
+
file: File;
|
|
22
|
+
relativePath: string;
|
|
23
|
+
}
|
|
24
|
+
/** One settled upload. */
|
|
25
|
+
export interface UploadResult {
|
|
26
|
+
relativePath: string;
|
|
27
|
+
ok: boolean;
|
|
28
|
+
path?: string;
|
|
29
|
+
/** Wire error code when the host refused the upload ('too-large', ...). */
|
|
30
|
+
code?: string;
|
|
31
|
+
/** The host's error message (English wire text; localize via `code`). */
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Collect a picker selection (webkitdirectory folders carry relative paths). */
|
|
35
|
+
export declare function uploadItemsFromFiles(files: FileList | readonly File[]): UploadItem[];
|
|
36
|
+
/**
|
|
37
|
+
* Collect a drag-drop payload. Dropped folders do NOT surface in
|
|
38
|
+
* `dataTransfer.files` — they arrive as directory items, so entries are
|
|
39
|
+
* captured via `webkitGetAsEntry` and traversed (draining readEntries
|
|
40
|
+
* batches), keeping each nested file's relative path. MUST be invoked
|
|
41
|
+
* synchronously from the drop handler: the dataTransfer enters protected
|
|
42
|
+
* mode once the event dispatch ends, while the captured entry handles stay
|
|
43
|
+
* readable asynchronously. Falls back to the flat file list when the entry
|
|
44
|
+
* API is unavailable; an entry that fails to read is skipped, not fatal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function uploadItemsFromDrop(data: DataTransfer | undefined): Promise<UploadItem[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Client-side pre-check cap. Mirrors the host's default (config `uploadLimit`)
|
|
49
|
+
* only — the host enforces the real, configurable limit, so a lowered host
|
|
50
|
+
* limit surfaces as a `too-large` wire error, never as a silent pass.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MAX_UPLOAD_BYTES: number;
|
|
53
|
+
/** How long a success hint stays before fading (failures stay until the next action). */
|
|
54
|
+
export declare const UPLOAD_HINT_MS = 3500;
|
|
55
|
+
/**
|
|
56
|
+
* One-line upload progress text: 'Uploading into {dir}…' while no file is in
|
|
57
|
+
* flight, then 'Uploading {done}/{total}: {name}' per file. Shared by the tree
|
|
58
|
+
* hint and the full-window upload overlay.
|
|
59
|
+
*/
|
|
60
|
+
export declare function uploadHintText(done: number, total: number, current: string, dir: string, t: (key: CopyKey, params?: Record<string, string | number>) => string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Upload every item into `dir` (absolute, inside the session workspace),
|
|
63
|
+
* sequentially, reporting progress as `(done, total, currentRelativePath)`.
|
|
64
|
+
* Resolves with one result per item — never rejects; `signal.aborted` stops
|
|
65
|
+
* the queue at the next item boundary (completed items stay uploaded).
|
|
66
|
+
*/
|
|
67
|
+
export declare function uploadToDir(scope: SessionScope, dir: string, items: UploadItem[], onProgress?: (done: number, total: number, current: string) => void, signal?: AbortSignal): Promise<UploadResult[]>;
|
|
68
|
+
/** Fold a result list into a one-line status for the tree hint. */
|
|
69
|
+
export declare function summarizeResults(results: UploadResult[], t: (key: CopyKey, params?: Record<string, string | number>) => string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive Window Controls Overlay geometry — the STANDARD web mechanism
|
|
3
|
+
* for frameless Chromium shells that draw the native caption buttons
|
|
4
|
+
* (minimize / maximize / close) OVER the web content (Electron
|
|
5
|
+
* `titleBarOverlay` on Windows; issue #257). Feature-detected: absent in
|
|
6
|
+
* plain browsers, macOS, Tauri etc., where the snapshot stays `NONE` and
|
|
7
|
+
* the sidebar adapts nothing — this is the conservative "auto" signal.
|
|
8
|
+
*
|
|
9
|
+
* The API reports the real titlebar rect (CSS px), which differs between
|
|
10
|
+
* shells and Electron versions (32 / 36 …), and fires `geometrychange`
|
|
11
|
+
* when the window maximizes / restores / moves — so the strip must be
|
|
12
|
+
* reactive, not memoized like the URL stamps.
|
|
13
|
+
*
|
|
14
|
+
* Module-level store so the Sidebar shell can subscribe via
|
|
15
|
+
* `useSyncExternalStore`; `setWcoSourceForTests` swaps the source for unit
|
|
16
|
+
* tests (no real API exists in jsdom/headless).
|
|
17
|
+
*/
|
|
18
|
+
export interface WcoSource {
|
|
19
|
+
readonly visible: boolean;
|
|
20
|
+
getTitlebarAreaRect(): {
|
|
21
|
+
readonly x: number;
|
|
22
|
+
readonly y: number;
|
|
23
|
+
readonly width: number;
|
|
24
|
+
readonly height: number;
|
|
25
|
+
};
|
|
26
|
+
addEventListener(type: 'geometrychange', listener: () => void): void;
|
|
27
|
+
removeEventListener(type: 'geometrychange', listener: () => void): void;
|
|
28
|
+
}
|
|
29
|
+
/** The current overlay geometry (present=false = API unavailable). */
|
|
30
|
+
export interface WcoSnapshot {
|
|
31
|
+
readonly present: boolean;
|
|
32
|
+
readonly height: number;
|
|
33
|
+
}
|
|
34
|
+
/** Snapshot when the API is unavailable (plain browser / non-overlay shell). */
|
|
35
|
+
export declare const WCO_NONE: WcoSnapshot;
|
|
36
|
+
type Listener = () => void;
|
|
37
|
+
/** Read the current snapshot (returns the frozen NONE when unavailable). */
|
|
38
|
+
export declare function getWcoSnapshot(): WcoSnapshot;
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to overlay geometry changes. Attaches to the real
|
|
41
|
+
* `navigator.windowControlsOverlay` on first subscribe; the disposer
|
|
42
|
+
* detaches the native listener when the last subscriber leaves.
|
|
43
|
+
*/
|
|
44
|
+
export declare function subscribeWco(onChange: Listener): () => void;
|
|
45
|
+
/** Test hook: swap the geometry source (undefined = API unavailable). */
|
|
46
|
+
export declare function setWcoSourceForTests(next: WcoSource | undefined): void;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializable configuration and defaults for the sidebar host half. Loader
|
|
3
|
+
* schema validation normally fills defaults; {@link resolveSidebarConfig}
|
|
4
|
+
* applies the same defaults for direct callers that bypass the Loader.
|
|
5
|
+
* @module dsh-coding-sidebar/config
|
|
6
|
+
*/
|
|
7
|
+
import z from 'schemastery';
|
|
8
|
+
import { type SidebarPrefs } from './prefs-shared.ts';
|
|
9
|
+
export { SIDEBAR_PREFS_DEFAULTS, SIDEBAR_PREFS_NS, TERMINAL_FONT_SIZE_DEFAULT, TERMINAL_FONT_SIZE_MAX, TERMINAL_FONT_SIZE_MIN, TITLE_BAR_STRIP_DEFAULT, TITLE_BAR_STRIP_MAX, TITLE_BAR_STRIP_MIN, WIDTH_PERCENT_DEFAULT, WIDTH_PERCENT_MAX, WIDTH_PERCENT_MIN, type SidebarPrefs, } from './prefs-shared.ts';
|
|
10
|
+
/** Tunable sidebar host limits (every field optional; defaults fill in). */
|
|
11
|
+
export interface SidebarConfig {
|
|
12
|
+
/** Read cap of one text file (bytes); larger files return truncated. */
|
|
13
|
+
readLimit?: number;
|
|
14
|
+
/** Media route cap (bytes); larger binaries are refused. */
|
|
15
|
+
mediaLimit?: number;
|
|
16
|
+
/** Upload route cap (bytes); larger files are refused without touching disk. */
|
|
17
|
+
uploadLimit?: number;
|
|
18
|
+
/** Explorer row bound of one level. */
|
|
19
|
+
listLimit?: number;
|
|
20
|
+
/** Terminals per session. */
|
|
21
|
+
terminalsPerSession?: number;
|
|
22
|
+
/** How long a disconnected terminal process survives awaiting a reconnect. */
|
|
23
|
+
reconnectGraceMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Terminal shell (absolute path or bare executable name) for BOTH the UI
|
|
26
|
+
* terminal tabs and the model-facing `terminal_*` tools. Empty = auto:
|
|
27
|
+
* POSIX follows `$SHELL` then the account login shell; Windows follows
|
|
28
|
+
* `DSH_SIDEBAR_SHELL`, then probes for `pwsh.exe`, then falls back to the
|
|
29
|
+
* inbox `powershell.exe` (5.1). Set it from `cordis.patch.yml` / profile
|
|
30
|
+
* plugin config, e.g. `config: { shell: /bin/zsh }`.
|
|
31
|
+
*/
|
|
32
|
+
shell?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional arguments passed to the shell executable. When non-empty these
|
|
35
|
+
* REPLACE the automatic platform defaults (POSIX `-l` / Windows none), so
|
|
36
|
+
* the deployment has full control over how the shell starts. When omitted
|
|
37
|
+
* the existing default behavior is kept.
|
|
38
|
+
*/
|
|
39
|
+
shellArgs?: string[];
|
|
40
|
+
}
|
|
41
|
+
/** Schemastery schema for the plugin configuration. */
|
|
42
|
+
export declare const Config: z<SidebarConfig>;
|
|
43
|
+
/** Fully defaulted sidebar host settings. */
|
|
44
|
+
export interface ResolvedSidebarConfig {
|
|
45
|
+
readLimit: number;
|
|
46
|
+
mediaLimit: number;
|
|
47
|
+
uploadLimit: number;
|
|
48
|
+
listLimit: number;
|
|
49
|
+
terminalsPerSession: number;
|
|
50
|
+
reconnectGraceMs: number;
|
|
51
|
+
/** The configured terminal shell; empty means the host auto-resolves it. */
|
|
52
|
+
shell: string;
|
|
53
|
+
/** Explicit shell arguments; empty means use the platform defaults. */
|
|
54
|
+
shellArgs: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Apply direct-call defaults after Loader schema validation has normally run.
|
|
58
|
+
*
|
|
59
|
+
* @param config - Deployment-provided sidebar host settings.
|
|
60
|
+
* @returns Complete settings consumed by the host half.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveSidebarConfig(config: SidebarConfig | undefined): ResolvedSidebarConfig;
|
|
63
|
+
/** Schemastery schema for the user-facing preferences (validated by the settings service). */
|
|
64
|
+
export declare const PrefsSchema: z<SidebarPrefs>;
|