@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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — turn outcome projection (host half).
|
|
3
|
+
*
|
|
4
|
+
* Registers the `dshTurnOutcome` session projection unit: the outcome of the
|
|
5
|
+
* session's most recent agent turn, folded from the log's `turn/end` events.
|
|
6
|
+
* The task notifier reads it off each sessions-list row (`projectionValues`)
|
|
7
|
+
* so it can announce WHY a turn ended — completed vs user-aborted vs failed —
|
|
8
|
+
* instead of announcing every running-drop as a plain finish.
|
|
9
|
+
*
|
|
10
|
+
* Whole-value rule: every `turn/end` replaces the previous value outright
|
|
11
|
+
* (last-wins), and `null` means no completed turn yet. Error turns keep a
|
|
12
|
+
* truncated copy of the structured failure message for notification bodies.
|
|
13
|
+
*
|
|
14
|
+
* `TurnEndReason` is merge-extensible upstream; unknown future kinds flow
|
|
15
|
+
* through as their literal kind string and the client falls back to a generic
|
|
16
|
+
* finish announcement.
|
|
17
|
+
* @module dsh-ui-tweaks/turn-outcome
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
21
|
+
import type { ProjectionDefinition } from '@deepseek-ai/dsh-session-projection'
|
|
22
|
+
import type { ZodType } from 'zod'
|
|
23
|
+
|
|
24
|
+
/** Projection key the browser notifier reads through list-row `projectionValues`. */
|
|
25
|
+
export const TURN_OUTCOME_PROJECTION_KEY = 'dshTurnOutcome'
|
|
26
|
+
|
|
27
|
+
/** The stock `TurnEndReason` kinds (the map is merge-extensible upstream). */
|
|
28
|
+
export type TurnOutcomeKind = 'completed' | 'aborted' | 'blocked' | 'error' | 'max-tokens' | 'interrupted'
|
|
29
|
+
|
|
30
|
+
/** Whole projection value: why the latest turn ended. */
|
|
31
|
+
export interface TurnOutcomeValue {
|
|
32
|
+
kind: TurnOutcomeKind
|
|
33
|
+
/** Unix epoch ms of the `turn/end` event. */
|
|
34
|
+
time: number
|
|
35
|
+
/** Turn number carried by the same event. */
|
|
36
|
+
turn?: number
|
|
37
|
+
/** Truncated human-readable failure text; present only on `error` outcomes. */
|
|
38
|
+
errorMessage?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Cap the embedded error message so projection payloads stay small. */
|
|
42
|
+
const MAX_ERROR_CHARS = 160
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Wire-schema shim: the projection value is plain JSON by construction, and
|
|
46
|
+
* pulling the real zod dependency in just to re-validate it would be waste.
|
|
47
|
+
*/
|
|
48
|
+
const outcomeSchema = {
|
|
49
|
+
parse: (value: unknown) => value as TurnOutcomeValue | null,
|
|
50
|
+
} as ZodType<TurnOutcomeValue | null>
|
|
51
|
+
|
|
52
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
53
|
+
interface SessionProjectionMap {
|
|
54
|
+
/** Outcome of the session's most recent agent turn; null before the first one ends. */
|
|
55
|
+
dshTurnOutcome: TurnOutcomeValue | null
|
|
56
|
+
}
|
|
57
|
+
interface SessionProjectionStateMap {
|
|
58
|
+
/** Host fold state for the turn-outcome key (same shape as the wire value). */
|
|
59
|
+
dshTurnOutcome: TurnOutcomeValue | null
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Registration-ready unit type with the client-visible `wire` block narrowed in. */
|
|
64
|
+
type TurnOutcomeProjectionUnit = Omit<
|
|
65
|
+
ProjectionDefinition<'dshTurnOutcome', TurnOutcomeValue | null>,
|
|
66
|
+
'wire'
|
|
67
|
+
> & {
|
|
68
|
+
wire: NonNullable<ProjectionDefinition<'dshTurnOutcome', TurnOutcomeValue | null>['wire']>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The `dshTurnOutcome` projection unit: last-wins fold over `turn/end`. */
|
|
72
|
+
export const turnOutcomeProjectionDefinition: TurnOutcomeProjectionUnit = {
|
|
73
|
+
key: TURN_OUTCOME_PROJECTION_KEY,
|
|
74
|
+
stateSchema: outcomeSchema,
|
|
75
|
+
init: () => null,
|
|
76
|
+
apply: (_state, event) => {
|
|
77
|
+
if (event.type !== 'turn/end') return _state
|
|
78
|
+
const { reason } = event.data
|
|
79
|
+
const value: TurnOutcomeValue = {
|
|
80
|
+
kind: reason.kind,
|
|
81
|
+
time: event.time,
|
|
82
|
+
turn: event.data.turn,
|
|
83
|
+
...(reason.kind === 'error' && reason.error.message !== ''
|
|
84
|
+
? { errorMessage: reason.error.message.slice(0, MAX_ERROR_CHARS) }
|
|
85
|
+
: {}),
|
|
86
|
+
}
|
|
87
|
+
return value
|
|
88
|
+
},
|
|
89
|
+
wire: {
|
|
90
|
+
viewSchema: outcomeSchema,
|
|
91
|
+
view: (state) => state,
|
|
92
|
+
},
|
|
93
|
+
stateVersion: 1,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Register the projection whenever the `sessionProjections` service is
|
|
98
|
+
* present. Headless assemblies without the registry stay unaffected.
|
|
99
|
+
* @param ctx - plugin context owning the registration effect.
|
|
100
|
+
*/
|
|
101
|
+
export function installTurnOutcomeProjection(ctx: Context): void {
|
|
102
|
+
ctx.inject(['sessionProjections'], (projectionCtx) => {
|
|
103
|
+
projectionCtx.sessionProjections.register(turnOutcomeProjectionDefinition)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-ui-tweaks — optional Web routes.
|
|
3
|
+
*
|
|
4
|
+
* The browser Settings panel reads and writes the `ui-tweaks` namespace through
|
|
5
|
+
* this same-origin route, because the Web settings RPC only exposes a fixed
|
|
6
|
+
* allowlist of namespaces (hardcoded in dsh-host-apiproxy since rc.6). The route
|
|
7
|
+
* proxies to the real `ctx.settings` service, so the settings document
|
|
8
|
+
* (settings.yaml) stays the single source of truth and hand edits keep working.
|
|
9
|
+
* @module dsh-ui-tweaks/web
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { readFile } from 'node:fs/promises'
|
|
13
|
+
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
14
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
15
|
+
// Type-only import activates the optional webServer Context declaration.
|
|
16
|
+
import type {} from '@deepseek-ai/dsh-host-webserver'
|
|
17
|
+
import { SettingsConflictError } from '@deepseek-ai/dsh-settings'
|
|
18
|
+
import { UI_TWEAKS_SETTINGS_NAMESPACE } from './config.ts'
|
|
19
|
+
|
|
20
|
+
/** Exact route used by the browser Settings page. */
|
|
21
|
+
export const SETTINGS_ROUTE = '/_dsh/ui-tweaks/settings'
|
|
22
|
+
/** Project-owned logo, served to the browser from the packaged assets folder. */
|
|
23
|
+
export const LOGO_ROUTE = '/_dsh/ui-tweaks/assets/logo.svg'
|
|
24
|
+
|
|
25
|
+
/** Public Settings snapshot; no secrets exist in this namespace. */
|
|
26
|
+
export interface UITweaksSnapshot {
|
|
27
|
+
writable: boolean
|
|
28
|
+
value: unknown
|
|
29
|
+
revision: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface SetRequest {
|
|
33
|
+
action: 'set'
|
|
34
|
+
field: string
|
|
35
|
+
value: unknown
|
|
36
|
+
expectedRevision: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface UnsetRequest {
|
|
40
|
+
action: 'unset'
|
|
41
|
+
field: string
|
|
42
|
+
expectedRevision: number
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type UITweaksRequest = SetRequest | UnsetRequest
|
|
46
|
+
|
|
47
|
+
type JsonResponse<T> =
|
|
48
|
+
| { ok: true; value: T }
|
|
49
|
+
| { ok: false; error: { code: string; message: string } }
|
|
50
|
+
|
|
51
|
+
/** Accept state-changing requests only from the DSH Web application's origin. */
|
|
52
|
+
export function sameOriginPost(req: IncomingMessage): boolean {
|
|
53
|
+
const fetchSite = req.headers['sec-fetch-site']
|
|
54
|
+
if (fetchSite === 'cross-site') return false
|
|
55
|
+
const origin = req.headers.origin
|
|
56
|
+
if (origin === undefined) return fetchSite === 'same-origin' || fetchSite === 'same-site' || fetchSite === 'none'
|
|
57
|
+
const host = req.headers.host
|
|
58
|
+
if (host === undefined) return false
|
|
59
|
+
try {
|
|
60
|
+
const parsed = new URL(origin)
|
|
61
|
+
return (parsed.protocol === 'http:' || parsed.protocol === 'https:') && parsed.host === host
|
|
62
|
+
} catch {
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function isRecord(value: unknown): value is Record<string, unknown> {
|
|
68
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function json<T>(res: ServerResponse, status: number, body: JsonResponse<T>): void {
|
|
72
|
+
const bytes = Buffer.from(JSON.stringify(body))
|
|
73
|
+
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
|
74
|
+
res.setHeader('Content-Length', String(bytes.length))
|
|
75
|
+
res.setHeader('Cache-Control', 'no-store')
|
|
76
|
+
res.setHeader('X-Content-Type-Options', 'nosniff')
|
|
77
|
+
res.writeHead(status)
|
|
78
|
+
res.end(bytes)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function requestError(res: ServerResponse, status: number, code: string, message: string): void {
|
|
82
|
+
json(res, status, { ok: false, error: { code, message } })
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Serve the packaged project logo without exposing the rest of the filesystem. */
|
|
86
|
+
async function serveLogo(_req: IncomingMessage, res: ServerResponse): Promise<void> {
|
|
87
|
+
try {
|
|
88
|
+
const body = await readFile(new URL('../assets/logo.svg', import.meta.url))
|
|
89
|
+
res.setHeader('Content-Type', 'image/svg+xml; charset=utf-8')
|
|
90
|
+
res.setHeader('Content-Length', String(body.length))
|
|
91
|
+
res.setHeader('Cache-Control', 'public, max-age=3600')
|
|
92
|
+
res.setHeader('X-Content-Type-Options', 'nosniff')
|
|
93
|
+
res.writeHead(200)
|
|
94
|
+
res.end(body)
|
|
95
|
+
} catch {
|
|
96
|
+
requestError(res, 404, 'logo-unavailable', 'Project logo is unavailable')
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function readJson(req: IncomingMessage, maxBytes = 16 * 1024): Promise<unknown> {
|
|
101
|
+
const contentType = req.headers['content-type']?.split(';', 1)[0]?.trim().toLowerCase()
|
|
102
|
+
if (contentType !== 'application/json') throw new TypeError('Content-Type must be application/json')
|
|
103
|
+
const chunks: Buffer[] = []
|
|
104
|
+
let bytes = 0
|
|
105
|
+
for await (const chunk of req) {
|
|
106
|
+
const part = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)
|
|
107
|
+
bytes += part.length
|
|
108
|
+
if (bytes > maxBytes) throw new RangeError(`request body exceeds ${maxBytes} bytes`)
|
|
109
|
+
chunks.push(part)
|
|
110
|
+
}
|
|
111
|
+
if (chunks.length === 0) throw new TypeError('request body is empty')
|
|
112
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8')) as unknown
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function parseRequest(value: unknown): UITweaksRequest {
|
|
116
|
+
if (!isRecord(value) || typeof value.action !== 'string') throw new TypeError('action is required')
|
|
117
|
+
if (typeof value.expectedRevision !== 'number' || !Number.isSafeInteger(value.expectedRevision) || (value.expectedRevision as number) < 0) {
|
|
118
|
+
throw new TypeError('expectedRevision must be a non-negative integer')
|
|
119
|
+
}
|
|
120
|
+
const field = value.field
|
|
121
|
+
if (typeof field !== 'string' || field.length === 0) throw new TypeError('field must be a non-empty string')
|
|
122
|
+
if (value.action === 'unset') {
|
|
123
|
+
return { action: 'unset', field, expectedRevision: value.expectedRevision as number }
|
|
124
|
+
}
|
|
125
|
+
if (value.action === 'set') {
|
|
126
|
+
return { action: 'set', field, value: value.value, expectedRevision: value.expectedRevision as number }
|
|
127
|
+
}
|
|
128
|
+
throw new TypeError(`unsupported action: ${value.action}`)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function messageOf(error: unknown): string {
|
|
132
|
+
if (error instanceof Error) return error.message
|
|
133
|
+
return String(error)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Same-origin Settings read/write handler. */
|
|
137
|
+
export class UITweaksWebBackend {
|
|
138
|
+
constructor(private readonly ctx: Context) {}
|
|
139
|
+
|
|
140
|
+
private descriptor() {
|
|
141
|
+
const row = this.ctx.settings.describe().find(candidate => candidate.ns === UI_TWEAKS_SETTINGS_NAMESPACE)
|
|
142
|
+
if (row === undefined) throw new Error('ui-tweaks settings namespace is not registered')
|
|
143
|
+
return row
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private snapshot(): UITweaksSnapshot {
|
|
147
|
+
const descriptor = this.descriptor()
|
|
148
|
+
return {
|
|
149
|
+
writable: this.ctx.settings.writable,
|
|
150
|
+
value: descriptor.value,
|
|
151
|
+
revision: descriptor.revision,
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Handle the exact Settings route. */
|
|
156
|
+
async handle(req: IncomingMessage, res: ServerResponse): Promise<void> {
|
|
157
|
+
if (req.method === 'GET') {
|
|
158
|
+
try {
|
|
159
|
+
json(res, 200, { ok: true, value: this.snapshot() })
|
|
160
|
+
} catch (error) {
|
|
161
|
+
this.ctx.logger.warn('dsh-ui-tweaks Settings snapshot failed: %s', messageOf(error))
|
|
162
|
+
requestError(res, 503, 'settings-unavailable', 'UI Tweaks settings are unavailable')
|
|
163
|
+
}
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
if (req.method !== 'POST') {
|
|
167
|
+
res.setHeader('Allow', 'GET, POST')
|
|
168
|
+
requestError(res, 405, 'method-not-allowed', 'Use GET or POST')
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
if (!sameOriginPost(req)) {
|
|
172
|
+
requestError(res, 403, 'origin-rejected', 'The request must originate from this ChatCode CLI Web application')
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
let parsed: UITweaksRequest
|
|
176
|
+
try {
|
|
177
|
+
parsed = parseRequest(await readJson(req))
|
|
178
|
+
} catch (error) {
|
|
179
|
+
requestError(res, error instanceof RangeError ? 413 : 400, 'invalid-request', messageOf(error))
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
if (parsed.action === 'set') {
|
|
184
|
+
await this.ctx.settings.update(UI_TWEAKS_SETTINGS_NAMESPACE, { [parsed.field]: parsed.value }, parsed.expectedRevision)
|
|
185
|
+
} else {
|
|
186
|
+
await this.ctx.settings.mutate(UI_TWEAKS_SETTINGS_NAMESPACE, [{ op: 'unset', path: [parsed.field] }], parsed.expectedRevision)
|
|
187
|
+
}
|
|
188
|
+
json(res, 200, { ok: true, value: this.snapshot() })
|
|
189
|
+
} catch (error) {
|
|
190
|
+
const conflict = error instanceof SettingsConflictError
|
|
191
|
+
requestError(
|
|
192
|
+
res,
|
|
193
|
+
conflict ? 409 : 400,
|
|
194
|
+
conflict ? 'settings-conflict' : 'settings-rejected',
|
|
195
|
+
messageOf(error),
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Attach the Settings route whenever a webServer service is present.
|
|
203
|
+
* @param ctx - plugin context owning route effects.
|
|
204
|
+
* @param backend - Settings handler.
|
|
205
|
+
*/
|
|
206
|
+
export function installUITweaksWeb(ctx: Context, backend: UITweaksWebBackend): void {
|
|
207
|
+
ctx.inject(['webServer'], (webCtx) => {
|
|
208
|
+
webCtx.effect(() => {
|
|
209
|
+
const disposeSettings = webCtx.webServer.register({
|
|
210
|
+
kind: 'exact',
|
|
211
|
+
path: SETTINGS_ROUTE,
|
|
212
|
+
handler: (req, res) => backend.handle(req, res),
|
|
213
|
+
})
|
|
214
|
+
const disposeLogo = webCtx.webServer.register({
|
|
215
|
+
kind: 'exact',
|
|
216
|
+
path: LOGO_ROUTE,
|
|
217
|
+
handler: serveLogo,
|
|
218
|
+
})
|
|
219
|
+
return () => {
|
|
220
|
+
disposeLogo()
|
|
221
|
+
disposeSettings()
|
|
222
|
+
}
|
|
223
|
+
}, 'dsh-ui-tweaks: Web routes')
|
|
224
|
+
})
|
|
225
|
+
}
|
package/src/wire.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire helpers for the /sidebar JSON API: bounded body reading, response
|
|
3
|
+
* writing, and the shared error envelope. Every API method returns
|
|
4
|
+
* `{ok: true, value}` on success and `{ok: false, error: {code, message}}`
|
|
5
|
+
* (HTTP 4xx/5xx matching the code) on failure.
|
|
6
|
+
*/
|
|
7
|
+
import type { SidebarHttpRequest, SidebarHttpResponse } from './context-types.ts'
|
|
8
|
+
|
|
9
|
+
/** Machine-readable error codes of the sidebar API. */
|
|
10
|
+
export type SidebarErrorCode =
|
|
11
|
+
| 'bad-request'
|
|
12
|
+
| 'not-found'
|
|
13
|
+
| 'forbidden'
|
|
14
|
+
| 'method-error'
|
|
15
|
+
| 'too-large'
|
|
16
|
+
| 'fs-error'
|
|
17
|
+
| 'git-error'
|
|
18
|
+
| 'pty-error'
|
|
19
|
+
| 'pty-deps-missing'
|
|
20
|
+
| 'job-error'
|
|
21
|
+
| 'sidechat-error'
|
|
22
|
+
| 'subagents-unavailable'
|
|
23
|
+
| 'chatcode-unavailable'
|
|
24
|
+
| 'chatcode-unauthorized'
|
|
25
|
+
| 'chatcode-stats-unreachable'
|
|
26
|
+
| 'chatcode-stats-http'
|
|
27
|
+
| 'chatcode-stats-rejected'
|
|
28
|
+
| 'chatcode-update-fetch'
|
|
29
|
+
| 'chatcode-update-install'
|
|
30
|
+
| 'release-note-unreachable'
|
|
31
|
+
| 'release-note-http'
|
|
32
|
+
| 'release-note-rejected'
|
|
33
|
+
| 'settings-rejected'
|
|
34
|
+
| 'settings-conflict'
|
|
35
|
+
| 'internal'
|
|
36
|
+
|
|
37
|
+
/** One API failure with its wire code and HTTP status. */
|
|
38
|
+
export class SidebarError extends Error {
|
|
39
|
+
constructor(
|
|
40
|
+
readonly code: SidebarErrorCode,
|
|
41
|
+
message: string,
|
|
42
|
+
readonly status = 400,
|
|
43
|
+
) {
|
|
44
|
+
super(message)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Body size bound of one JSON request (defense against unbounded reads). */
|
|
49
|
+
const MAX_BODY_BYTES = 1 << 20
|
|
50
|
+
|
|
51
|
+
/** Success envelope of one API method. */
|
|
52
|
+
export interface SidebarOk<T> { ok: true; value: T }
|
|
53
|
+
|
|
54
|
+
/** Failure envelope of one API method. */
|
|
55
|
+
export interface SidebarErr { ok: false; error: { code: SidebarErrorCode; message: string } }
|
|
56
|
+
|
|
57
|
+
/** Read and parse the JSON request body (bounded; malformed → bad-request). */
|
|
58
|
+
export async function readJsonBody(req: SidebarHttpRequest): Promise<unknown> {
|
|
59
|
+
const chunks: Buffer[] = []
|
|
60
|
+
let total = 0
|
|
61
|
+
for await (const chunk of req) {
|
|
62
|
+
// The structural request yields string | Uint8Array; Buffer.from accepts
|
|
63
|
+
// both (and the real runtime chunks are node Buffers anyway).
|
|
64
|
+
const buffer = Buffer.from(chunk)
|
|
65
|
+
total += buffer.length
|
|
66
|
+
if (total > MAX_BODY_BYTES) {
|
|
67
|
+
throw new SidebarError('bad-request', 'request body too large')
|
|
68
|
+
}
|
|
69
|
+
chunks.push(buffer)
|
|
70
|
+
}
|
|
71
|
+
const text = Buffer.concat(chunks).toString('utf8')
|
|
72
|
+
if (text.trim() === '') return {}
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(text) as unknown
|
|
75
|
+
} catch {
|
|
76
|
+
throw new SidebarError('bad-request', 'request body is not valid JSON')
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Write a JSON response with the given status. */
|
|
81
|
+
export function writeJson(res: SidebarHttpResponse, status: number, body: unknown): void {
|
|
82
|
+
const payload = JSON.stringify(body)
|
|
83
|
+
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' })
|
|
84
|
+
res.end(payload)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Write the success envelope. */
|
|
88
|
+
export function writeOk(res: SidebarHttpResponse, value: unknown): void {
|
|
89
|
+
writeJson(res, 200, { ok: true, value })
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Write the failure envelope for any thrown value (unknown → internal 500). */
|
|
93
|
+
export function writeError(res: SidebarHttpResponse, error: unknown): void {
|
|
94
|
+
if (error instanceof SidebarError) {
|
|
95
|
+
writeJson(res, error.status, { ok: false, error: { code: error.code, message: error.message } })
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
99
|
+
writeJson(res, 500, { ok: false, error: { code: 'internal', message } })
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Narrow an unknown payload value to a string, else throw bad-request. */
|
|
103
|
+
export function requireString(payload: unknown, key: string): string {
|
|
104
|
+
const record = payload as Record<string, unknown> | null
|
|
105
|
+
const value = record?.[key]
|
|
106
|
+
if (typeof value !== 'string' || value === '') {
|
|
107
|
+
throw new SidebarError('bad-request', `missing or invalid "${key}"`)
|
|
108
|
+
}
|
|
109
|
+
return value
|
|
110
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(globalThis,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),n=i-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),l=o-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(l/e.css.cell.width)),rows:Math.max(1,Math.floor(n/e.css.cell.height))}}}})(),e})()));
|
|
2
|
+
//# sourceMappingURL=addon-fit.js.map
|
package/vendor/xterm.css
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
+
* https://github.com/chjj/term.js
|
|
5
|
+
* @license MIT
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* Originally forked from (with the author's permission):
|
|
26
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
+
* http://bellard.org/jslinux/
|
|
28
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
+
* The original design remains. The terminal itself
|
|
30
|
+
* has been extended to include xterm CSI codes, among
|
|
31
|
+
* other features.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Default styles for xterm.js
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
.xterm {
|
|
39
|
+
cursor: text;
|
|
40
|
+
position: relative;
|
|
41
|
+
user-select: none;
|
|
42
|
+
-ms-user-select: none;
|
|
43
|
+
-webkit-user-select: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.xterm.focus,
|
|
47
|
+
.xterm:focus {
|
|
48
|
+
outline: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.xterm .xterm-helpers {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
/**
|
|
55
|
+
* The z-index of the helpers must be higher than the canvases in order for
|
|
56
|
+
* IMEs to appear on top.
|
|
57
|
+
*/
|
|
58
|
+
z-index: 5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.xterm .xterm-helper-textarea {
|
|
62
|
+
padding: 0;
|
|
63
|
+
border: 0;
|
|
64
|
+
margin: 0;
|
|
65
|
+
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
|
|
66
|
+
position: absolute;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
left: -9999em;
|
|
69
|
+
top: 0;
|
|
70
|
+
width: 0;
|
|
71
|
+
height: 0;
|
|
72
|
+
z-index: -5;
|
|
73
|
+
/** Prevent wrapping so the IME appears against the textarea at the correct position */
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
resize: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.xterm .composition-view {
|
|
80
|
+
/* TODO: Composition position got messed up somewhere */
|
|
81
|
+
background: #000;
|
|
82
|
+
color: #FFF;
|
|
83
|
+
display: none;
|
|
84
|
+
position: absolute;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
z-index: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.xterm .composition-view.active {
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.xterm .xterm-viewport {
|
|
94
|
+
/* On OS X this is required in order for the scroll bar to appear fully opaque */
|
|
95
|
+
background-color: #000;
|
|
96
|
+
overflow-y: scroll;
|
|
97
|
+
cursor: default;
|
|
98
|
+
position: absolute;
|
|
99
|
+
right: 0;
|
|
100
|
+
left: 0;
|
|
101
|
+
top: 0;
|
|
102
|
+
bottom: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.xterm .xterm-screen {
|
|
106
|
+
position: relative;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.xterm .xterm-screen canvas {
|
|
110
|
+
position: absolute;
|
|
111
|
+
left: 0;
|
|
112
|
+
top: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.xterm .xterm-scroll-area {
|
|
116
|
+
visibility: hidden;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.xterm-char-measure-element {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
visibility: hidden;
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 0;
|
|
124
|
+
left: -9999em;
|
|
125
|
+
line-height: normal;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.xterm.enable-mouse-events {
|
|
129
|
+
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
|
|
130
|
+
cursor: default;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.xterm.xterm-cursor-pointer,
|
|
134
|
+
.xterm .xterm-cursor-pointer {
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.xterm.column-select.focus {
|
|
139
|
+
/* Column selection mode */
|
|
140
|
+
cursor: crosshair;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.xterm .xterm-accessibility:not(.debug),
|
|
144
|
+
.xterm .xterm-message {
|
|
145
|
+
position: absolute;
|
|
146
|
+
left: 0;
|
|
147
|
+
top: 0;
|
|
148
|
+
bottom: 0;
|
|
149
|
+
right: 0;
|
|
150
|
+
z-index: 10;
|
|
151
|
+
color: transparent;
|
|
152
|
+
pointer-events: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.xterm .xterm-accessibility-tree:not(.debug) *::selection {
|
|
156
|
+
color: transparent;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.xterm .xterm-accessibility-tree {
|
|
160
|
+
user-select: text;
|
|
161
|
+
white-space: pre;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.xterm .live-region {
|
|
165
|
+
position: absolute;
|
|
166
|
+
left: -9999px;
|
|
167
|
+
width: 1px;
|
|
168
|
+
height: 1px;
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.xterm-dim {
|
|
173
|
+
/* Dim should not apply to background, so the opacity of the foreground color is applied
|
|
174
|
+
* explicitly in the generated class and reset to 1 here */
|
|
175
|
+
opacity: 1 !important;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.xterm-underline-1 { text-decoration: underline; }
|
|
179
|
+
.xterm-underline-2 { text-decoration: double underline; }
|
|
180
|
+
.xterm-underline-3 { text-decoration: wavy underline; }
|
|
181
|
+
.xterm-underline-4 { text-decoration: dotted underline; }
|
|
182
|
+
.xterm-underline-5 { text-decoration: dashed underline; }
|
|
183
|
+
|
|
184
|
+
.xterm-overline {
|
|
185
|
+
text-decoration: overline;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
|
|
189
|
+
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
|
|
190
|
+
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
|
|
191
|
+
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
|
|
192
|
+
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
|
|
193
|
+
|
|
194
|
+
.xterm-strikethrough {
|
|
195
|
+
text-decoration: line-through;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.xterm-screen .xterm-decoration-container .xterm-decoration {
|
|
199
|
+
z-index: 6;
|
|
200
|
+
position: absolute;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
|
|
204
|
+
z-index: 7;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.xterm-decoration-overview-ruler {
|
|
208
|
+
z-index: 8;
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 0;
|
|
211
|
+
right: 0;
|
|
212
|
+
pointer-events: none;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.xterm-decoration-top {
|
|
216
|
+
z-index: 2;
|
|
217
|
+
position: relative;
|
|
218
|
+
}
|