@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
|
+
* 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-better-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>;
|