dsh-remote-vs 0.23.0 → 0.25.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.
Files changed (81) hide show
  1. package/README.en.md +49 -15
  2. package/README.md +40 -14
  3. package/lib/client.js +45978 -43338
  4. package/lib/index.js +388 -90
  5. package/lib/p2-router-fs.js +1 -1
  6. package/lib/types/client/CodeEditor.d.ts +17 -0
  7. package/lib/types/client/EditorPane.d.ts +16 -5
  8. package/lib/types/client/FloatingPlaceholder.d.ts +16 -5
  9. package/lib/types/client/RemoteEditorView.d.ts +13 -10
  10. package/lib/types/client/RemoteRoot.d.ts +5 -5
  11. package/lib/types/client/SettingsHosts.d.ts +3 -0
  12. package/lib/types/client/TerminalSnippets.d.ts +36 -0
  13. package/lib/types/client/TerminalView.d.ts +1 -1
  14. package/lib/types/client/XTerm.d.ts +33 -0
  15. package/lib/types/client/api.d.ts +4 -1
  16. package/lib/types/client/auto-open-remote.d.ts +41 -0
  17. package/lib/types/client/editor-capability.d.ts +27 -0
  18. package/lib/types/client/i18n.d.ts +1 -1
  19. package/lib/types/client/store.d.ts +59 -4
  20. package/lib/types/client/terminal-input.d.ts +23 -0
  21. package/lib/types/client/terminal-snippets.d.ts +86 -0
  22. package/lib/types/client/use-remote-chat-target.d.ts +2 -0
  23. package/lib/types/client/view-settings.d.ts +40 -0
  24. package/lib/types/client/vsc/breadcrumb.d.ts +30 -0
  25. package/lib/types/client/vsc/editor-caret.d.ts +32 -0
  26. package/lib/types/client/vsc/editor-langs.d.ts +9 -0
  27. package/lib/types/client/vsc/editor-settings.d.ts +55 -0
  28. package/lib/types/client/vsc/image-preview.d.ts +36 -0
  29. package/lib/types/client/vsc/kit.d.ts +2 -0
  30. package/lib/types/client/vsc/terminal-clipboard.d.ts +15 -0
  31. package/lib/types/client/vsc/terminal-line.d.ts +25 -0
  32. package/lib/types/client/vsc/terminal-links.d.ts +62 -0
  33. package/lib/types/client/vsc/terminal-theme.d.ts +22 -0
  34. package/lib/types/client/vsc/terminal-writer.d.ts +52 -0
  35. package/lib/types/paths.d.ts +9 -0
  36. package/lib/types/pool.d.ts +25 -0
  37. package/lib/types/protocol.d.ts +35 -0
  38. package/lib/types/routes.d.ts +7 -0
  39. package/lib/types/terminal.d.ts +25 -1
  40. package/lib/types/view-settings.d.ts +26 -0
  41. package/lib/{worlds-DXdP4SMn.js → worlds-B7gEDBzC.js} +13 -1
  42. package/package.json +36 -36
  43. package/src/client/CodeEditor.tsx +54 -2
  44. package/src/client/EditorPane.tsx +485 -107
  45. package/src/client/FloatingPlaceholder.tsx +34 -5
  46. package/src/client/RemoteEditorView.tsx +14 -11
  47. package/src/client/RemoteRoot.tsx +20 -125
  48. package/src/client/SettingsHosts.tsx +81 -3
  49. package/src/client/TerminalSnippets.tsx +357 -0
  50. package/src/client/TerminalView.tsx +50 -1
  51. package/src/client/XTerm.tsx +228 -58
  52. package/src/client/api.ts +7 -0
  53. package/src/client/auto-open-remote.ts +439 -0
  54. package/src/client/editor-capability.ts +42 -0
  55. package/src/client/i18n.ts +158 -6
  56. package/src/client/index.tsx +30 -6
  57. package/src/client/store.tsx +165 -13
  58. package/src/client/terminal-input.ts +44 -0
  59. package/src/client/terminal-snippets.ts +216 -0
  60. package/src/client/use-remote-chat-target.ts +1 -1
  61. package/src/client/view-settings.ts +99 -0
  62. package/src/client/vsc/breadcrumb.tsx +251 -0
  63. package/src/client/vsc/editor-caret.ts +30 -0
  64. package/src/client/vsc/editor-langs.ts +20 -0
  65. package/src/client/vsc/editor-settings.ts +146 -0
  66. package/src/client/vsc/editor-theme.ts +4 -5
  67. package/src/client/vsc/image-preview.tsx +110 -0
  68. package/src/client/vsc/kit.tsx +20 -1
  69. package/src/client/vsc/terminal-clipboard.ts +19 -0
  70. package/src/client/vsc/terminal-line.ts +101 -0
  71. package/src/client/vsc/terminal-links.ts +166 -0
  72. package/src/client/vsc/terminal-theme.ts +71 -0
  73. package/src/client/vsc/terminal-writer.ts +112 -0
  74. package/src/client/vsc/vsc.css +687 -48
  75. package/src/index.ts +6 -0
  76. package/src/paths.ts +13 -0
  77. package/src/pool.ts +99 -27
  78. package/src/protocol.ts +45 -0
  79. package/src/routes.ts +47 -0
  80. package/src/terminal.ts +160 -6
  81. package/src/view-settings.ts +133 -0
@@ -1,4 +1,4 @@
1
- import { r as isWindowsAbsolute, x as aliasRoot } from "./worlds-DXdP4SMn.js";
1
+ import { r as isWindowsAbsolute, x as aliasRoot } from "./worlds-B7gEDBzC.js";
2
2
  import { FileSystem, FsError } from "@deepseek-ai/dsh-fs";
3
3
  //#region src/p2/router-fs.ts
4
4
  /**
@@ -20,6 +20,8 @@ export interface CodeEditorViewState {
20
20
  head: number;
21
21
  }[];
22
22
  }
23
+ export { caretOf, type CodeEditorCaret } from './vsc/editor-caret.ts';
24
+ import { type CodeEditorCaret as CodeEditorCaretType } from './vsc/editor-caret.ts';
23
25
  export interface CodeEditorHandle {
24
26
  getContent: () => string;
25
27
  isDirty: () => boolean;
@@ -61,6 +63,21 @@ export declare const CodeEditor: import("react").ForwardRefExoticComponent<{
61
63
  readOnly?: boolean;
62
64
  /** Parent sub-tab visibility (views stay mounted; remeasure on show). */
63
65
  visible?: boolean;
66
+ /**
67
+ * Soft wrap long lines.
68
+ *
69
+ * `undefined` = the historical behaviour (wrap on) for callers that do not
70
+ * own the preference (diff panes); `false` turns it off.
71
+ */
72
+ wrap?: boolean;
73
+ /**
74
+ * Reports the 1-based caret line/column plus the selected character count.
75
+ *
76
+ * The status bar needs it and CodeMirror only exposes selection changes
77
+ * through an update listener, so the editor reports instead of the parent
78
+ * polling a ref. Called once with the initial position, then on every move.
79
+ */
80
+ onCaretChange?: (caret: CodeEditorCaretType) => void;
64
81
  /** Chat-insert target: absent/disabled hides the selection popup. */
65
82
  ctx?: Context;
66
83
  sessionId?: string | undefined;
@@ -1,11 +1,22 @@
1
1
  /**
2
2
  * The editor area: one tab strip for code files, previews and diffs, an info
3
- * row, and the body dispatch.
3
+ * row, the body, and (in the full-width conversation-view variant) a status bar.
4
4
  *
5
- * The `@文件` insertion and the selection→conversation popup are preserved
6
- * from the previous editor: `CodeEditor` still receives the chat target, and
7
- * every code pane is the same CodeMirror buffer with Ctrl+S wired to the
8
- * remote write route.
5
+ * The chrome follows the local sidebar plugin's editor (same tab strip, info
6
+ * row, empty states, status bar, image preview and editor background tokens),
7
+ * while every remote-only capability stays exactly where it was: the remote
8
+ * read/write routes, the save-conflict banner and its on-demand difference, the
9
+ * diff tabs, markdown/HTML previews, session change marks and the offline
10
+ * read-only degradation.
11
+ *
12
+ * Three variants share this component, chosen from the store's effective
13
+ * surface — never from a prop, so a surface can never mount two live buffers:
14
+ * - `sidebar`: the docked pane — a FULL-COLUMN rail page and the default seat
15
+ * (opening a file switches the rail to it; closing the last file switches
16
+ * back to the directory);
17
+ * - `center`: the conversation-view tab next to 对话 / 轨迹 (optional, full
18
+ * width, breadcrumb + status bar);
19
+ * - `float`: the frame-wide floating window (its own font zoom applies).
9
20
  */
10
21
  import { type ReactNode } from 'react';
11
22
  /**
@@ -1,9 +1,20 @@
1
1
  /**
2
2
  * What the centre conversation view and the sidebar fallback show while the
3
- * editor is popped out: the editor itself is a single instance and lives in the
4
- * floating window, so these surfaces must not mount a second one (that would
5
- * be two live CodeMirror buffers for one tab — the exact defect `EditorPane`'s
6
- * header warns about). A dock button keeps the surface from looking broken.
3
+ * editor lives somewhere else: the editor itself is a single instance, so these
4
+ * surfaces must not mount a second one (that would be two live CodeMirror
5
+ * buffers for one tab — the exact defect `EditorPane`'s header warns about).
6
+ *
7
+ * Three such places exist now that the DOCKED sidebar pane is the default seat:
8
+ * - `float`: the editor is popped out into the frame-wide window;
9
+ * - `sidebar`: the editor is docked in the sidebar column, and the
10
+ * conversation-view tab is only its optional full-width seat;
11
+ * - `center`: the reverse — the conversation tab owns the editor, and the
12
+ * sidebar's editor page explains how to bring it back.
13
+ * A button per mode keeps the surface from looking broken.
7
14
  */
8
15
  import type { ReactNode } from 'react';
9
- export declare function FloatingEditorPlaceholder(): ReactNode;
16
+ /** Which seat currently owns the editor. */
17
+ export type PlaceholderMode = 'float' | 'sidebar' | 'center';
18
+ export declare function FloatingEditorPlaceholder(props: {
19
+ mode?: PlaceholderMode;
20
+ }): ReactNode;
@@ -1,11 +1,12 @@
1
1
  /**
2
- * The conversation-view tab: the same editor tab strip, previews and diff as
3
- * the sidebar, mounted next to 对话 / 轨迹 at full width.
2
+ * The conversation-view tab: the same editor (tab strip, previews, diff, status
3
+ * bar) mounted next to 对话 / 轨迹 at full width.
4
4
  *
5
- * Registered into the `conversation.view` slot when that slot exists; the
6
- * sidebar then keeps the whole column for the explorer. Both surfaces read
7
- * the same module-level store, so a diff opened from source control appears
8
- * here, and a save here repaints the sidebar's change list.
5
+ * This is the OPTIONAL seat now: the docked sidebar pane is the default one, so
6
+ * a file click lands there and this tab shows a "docked in the sidebar"
7
+ * placeholder until the editor's own surface button moves it here. Both seats
8
+ * read the same module-level store, so a diff opened from source control
9
+ * appears here too and a save here repaints the sidebar's change list.
9
10
  *
10
11
  * While the editor floats (`editorSurface === 'float'`) this tab is NOT the
11
12
  * editor's mount any more, so it renders a placeholder instead: mounting a
@@ -14,10 +15,12 @@
14
15
  import type { Context } from '@deepseek-ai/cordis';
15
16
  import type { ReactNode } from 'react';
16
17
  /**
17
- * The conversation-view body. The editor surface flag is owned by the client
18
- * entry (registration success decides it), NOT by this component: the view
19
- * may be unmounted while another conversation tab is selected, and flipping
20
- * the flag here would make the sidebar's rail flicker on every tab switch.
18
+ * The conversation-view body. The editor surface flag is the STORE's (the
19
+ * docked pane is the default; this view renders only while the user has moved
20
+ * the editor here), and deliberately not derived from this component's own
21
+ * mount: the view is unmounted while another conversation tab is selected, so
22
+ * inferring the surface from mount/unmount would flip the sidebar's rail — and
23
+ * its editor — on every host tab switch.
21
24
  */
22
25
  export declare function RemoteEditorView(props: {
23
26
  ctx: Context;
@@ -2,11 +2,11 @@
2
2
  * Sidebar surface (better-sidebar tab, or the native right-Sidebar fallback):
3
3
  * a VS Code-style activity rail plus one column that shows the active view.
4
4
  *
5
- * The editor itself lives in the conversation view next to 轨迹 whenever that
6
- * registration succeeds (`editorSurface === 'center'`), so the tree keeps the
7
- * whole column; on a host where the conversation slot is unavailable the old
8
- * split (panel above the editor) still applies and nothing becomes
9
- * unreachable.
5
+ * The DOCKED editor is the default seat (`editorSurface === 'sidebar'`) and it
6
+ * is a FULL-COLUMN rail page — one view at a time, like the local sidebar
7
+ * plugin: opening a file switches the column to the editor, and closing its last
8
+ * file switches back to the directory. The conversation-view tab next to 轨迹 is
9
+ * the OPTIONAL full-width seat the editor's own button switches to.
10
10
  */
11
11
  import type { Context } from '@deepseek-ai/cordis';
12
12
  import { type ReactNode } from 'react';
@@ -2,6 +2,9 @@
2
2
  * Settings section occupants (`settings.section`, ids `remote-hosts` and
3
3
  * `remote-workspaces`): the full host manager plus the binding list/wizard,
4
4
  * living in the DSH Settings dialog instead of the Remote tab.
5
+ * The `remote-hosts` page also carries the plugin's two view preferences at the
6
+ * bottom (auto-open the remote workspace, and its share of the frame width) —
7
+ * see `auto-open-remote.ts` for the behaviour they drive.
5
8
  * Self-contained: each section fetches its own data so they work without any
6
9
  * injected face or sidebar.
7
10
  *
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The "常用指令" panel above the terminal: a personal library of NAME + COMMAND
3
+ * pairs that paste into the active terminal's command line WITHOUT pressing
4
+ * Enter (misclick safety: the user still reviews and runs it).
5
+ *
6
+ * Why it is a popover rather than a dock: the terminal needs the whole column
7
+ * for output; the list is opened deliberately, used once, and dismissed. The
8
+ * panel is portaled with fixed coordinates so the terminal's own scroller and
9
+ * the sidebar's `overflow: hidden` cannot clip it.
10
+ *
11
+ * Snapshot + subscribe come from `terminal-snippets.ts` (one list shared with the
12
+ * Ctrl+B quick-add shortcut, which `XTerm` reports as a counter prop).
13
+ */
14
+ import { type ReactNode } from 'react';
15
+ /** Props of the panel (plus the button that opens it). */
16
+ export interface TerminalSnippetsProps {
17
+ /** Translator. */
18
+ t: (key: string) => string;
19
+ /** Insert one command into the active terminal; false when none is mounted. */
20
+ onInsert: (command: string) => boolean;
21
+ /** Bumped by the Ctrl+B shortcut; each change opens the ADD dialog. */
22
+ addRequest: number;
23
+ /**
24
+ * Draft the Ctrl+B form starts with (the terminal selection, else the line
25
+ * reconstructed from keystrokes). Empty for the panel's own "+" button.
26
+ */
27
+ addContent: string;
28
+ }
29
+ /**
30
+ * The panel.
31
+ *
32
+ * Kept in one component on purpose: the button, the popover, the form and their
33
+ * shared focus/dismissal rules are one interaction, and splitting them would
34
+ * need a context for four pieces of state.
35
+ */
36
+ export declare function TerminalSnippets(props: TerminalSnippetsProps): ReactNode;
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { type ReactNode } from 'react';
11
11
  import type { RemoteHostSummary } from '../protocol.ts';
12
- import type { TerminalRequest } from './store.tsx';
12
+ import { type TerminalRequest } from './store.tsx';
13
13
  /** First mount claims the panel, so a single-surface profile renders at once. */
14
14
  export declare function claimTerminalOwnerIfNone(id: symbol): void;
15
15
  /** Whether `id` is the surface that currently owns the terminal panel. */
@@ -20,4 +20,37 @@ export declare function XTerm(props: {
20
20
  initialInput?: string;
21
21
  /** Translator for the right-click menu (copy / paste / select all). */
22
22
  t: (key: string) => string;
23
+ /** Tab identity, used by the snippet panel to target THIS terminal. */
24
+ tabId: string;
25
+ /**
26
+ * Ctrl/Cmd+B inside the terminal: open the "add snippet" form.
27
+ *
28
+ * Receives a best-effort draft so the form can pre-fill its command: the
29
+ * current terminal SELECTION when there is one (the user picked exactly what
30
+ * they want), else the line reconstructed from this session's keystrokes.
31
+ *
32
+ * Absent → the keystroke stays the shell's (readline's backward-char), which
33
+ * is what a host that did not wire the panel should keep.
34
+ */
35
+ onQuickAddSnippet?: (draft: {
36
+ selection?: string;
37
+ line?: string;
38
+ }) => void;
39
+ /**
40
+ * Remote home directory of this tab's host, when known.
41
+ *
42
+ * Used to resolve a `~/x` token printed by the shell. The SSH user's home is
43
+ * the only honest source — the terminal protocol carries no home directory.
44
+ */
45
+ home?: string;
46
+ /**
47
+ * Ctrl/Cmd + click on a path printed in the terminal.
48
+ *
49
+ * Receives the path AS PRINTED plus the hints that make sense of a relative
50
+ * one: the shell's cwd when it reports it (OSC 7) and the remote home.
51
+ */
52
+ onPathClick?: (token: string, context: {
53
+ cwd?: string;
54
+ home?: string;
55
+ }) => void;
23
56
  }): ReactNode;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Typed fetch wrapper over the /api/dsh-remote JSON API (full P0 surface).
3
3
  */
4
- import { type GitBranch, type GitCommit, type GitShow, type GitStatus, type HelperAvailability, type ImportReport, type RemoteChangesDiff, type RemoteChangesSummary, type RemoteConnectionStatus, type RemoteDeployState, type RemoteExecResult, type RemoteFileEntry, type RemoteForwardRequest, type RemoteForwardState, type RemoteHostSummary, type RemoteListenPortsResult, type RemotePluginMeta, type RemoteProbe, type RemoteRead, type RemoteRoutingStatus, type RemoteTimeouts, type RemoteWorkspaceBinding, type RemoteWriteConflict, type RemoteWriteResult } from '../protocol.ts';
4
+ import { type GitBranch, type GitCommit, type GitShow, type GitStatus, type HelperAvailability, type ImportReport, type RemoteChangesDiff, type RemoteChangesSummary, type RemoteConnectionStatus, type RemoteDeployState, type RemoteExecResult, type RemoteFileEntry, type RemoteForwardRequest, type RemoteForwardState, type RemoteHostSummary, type RemoteListenPortsResult, type RemotePluginMeta, type RemoteProbe, type RemoteRead, type RemoteRoutingStatus, type RemoteTimeouts, type RemoteViewSettings, type RemoteWorkspaceBinding, type RemoteWriteConflict, type RemoteWriteResult } from '../protocol.ts';
5
5
  export declare class RemoteApiError extends Error {
6
6
  readonly status: number;
7
7
  /**
@@ -218,6 +218,9 @@ export declare const api: {
218
218
  diff: (sessionId: string, path: string, repoSubdir?: string) => Promise<RemoteChangesDiff | null>;
219
219
  };
220
220
  setRoutingMode: (mode: "off" | "shadow" | "enforce") => Promise<"off" | "shadow" | "enforce">;
221
+ getViewSettings: () => Promise<RemoteViewSettings>;
222
+ /** Flat patch: unknown keys are ignored, unusable values keep the stored one. */
223
+ setViewSettings: (patch: Partial<RemoteViewSettings>) => Promise<RemoteViewSettings>;
221
224
  deployStatus: (alias: string) => Promise<{
222
225
  deploy: RemoteDeployState;
223
226
  helpers: HelperAvailability[];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Frame-wide behaviour behind the two view preferences from Settings → 远程主机
3
+ * (`REMOTE_API.viewSettings`):
4
+ *
5
+ * - `autoOpenRemoteWorkspace` — the first time a session THIS PLUGIN considers
6
+ * remote appears on screen in this page lifetime, open the plugin's own
7
+ * right-panel page. Once per session, never for a local session, and never
8
+ * revisited after a manual close (the "already handled" bookkeeping lives in
9
+ * this closure and dies with the page);
10
+ * - `remoteWorkspaceWidthRatio` — when that page is opened, the right column
11
+ * ends up at that share of the window width (and a save while the panel is
12
+ * open applies immediately).
13
+ *
14
+ * It lives OUTSIDE every component on purpose: the page it opens is usually
15
+ * CLOSED, so no seat of ours is mounted when the trigger happens — the settings
16
+ * dialog, the conversation view and the explorer tab can all be unmounted while
17
+ * a new remote session appears.
18
+ *
19
+ * "Remote" is decided from this plugin's own knowledge only:
20
+ * - the on-screen session comes from `ctx.sidebarRight.mounted`, the same
21
+ * sanctioned source the `@file` buttons use;
22
+ * - a session is remote when its host-confirmed workspace path — or, failing
23
+ * that, its live working directory — is one of the alias directories this
24
+ * plugin materialized for a binding. That is exactly the resolution the click
25
+ * router already performs (`bindingForSessionCwd`), fed by this plugin's own
26
+ * `/workspaces` route. No other plugin's API is involved.
27
+ *
28
+ * The width has NO public API in DSH: the supported user path is the column's
29
+ * drag handle, so it is driven there — a synthetic pointer sequence on
30
+ * `[data-side="rightbar"]` (see `resizeRightbar`), with the pointer-capture
31
+ * methods neutralised for exactly one dispatch and restored immediately after
32
+ * (leaving them overridden would break the user's own drag for the rest of the
33
+ * page's life).
34
+ */
35
+ import type { Context } from '@deepseek-ai/cordis';
36
+ /**
37
+ * Install the behaviour; returns the teardown for the client entry's effect.
38
+ *
39
+ * @param ctx - client plugin context (only soft service reads).
40
+ */
41
+ export declare function installAutoOpenRemote(ctx: Context): () => void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Whether this page has ANY seat that can render the plugin's editor.
3
+ *
4
+ * Why not "is an `EditorPane` mounted right now": the editor panels are
5
+ * lazy/keep-alive (the sidebar's editor page is only rendered after the rail has
6
+ * visited it, and the conversation-view seat only exists while its host tab is
7
+ * selected). That made the first file click after a page load fall back to the
8
+ * host's native preview — which cannot resolve remote paths at all — even though
9
+ * our editor was one click away. The question the interceptor must answer is
10
+ * "could this file be shown in our editor in this page", i.e. a seat exists.
11
+ *
12
+ * Seats are registered exactly where a surface is registered:
13
+ * - the better-sidebar tab (`index.tsx` `goBetter`),
14
+ * - the native right-sidebar page (`registerNativeExplorer` returning a
15
+ * disposer),
16
+ * - the conversation-view tab (`conversation.view` registration).
17
+ *
18
+ * Pure module (no React/DOM) so the gate can drive register/unregister.
19
+ */
20
+ /** One seat became available (a tab/view registration succeeded). */
21
+ export declare function noteEditorSeatAvailable(): void;
22
+ /** One seat went away (a registration was disposed); never negative. */
23
+ export declare function noteEditorSeatGone(): void;
24
+ /** How many seats exist right now. */
25
+ export declare function editorSeatCount(): number;
26
+ /** Test-only reset (the gate drives the counter directly). */
27
+ export declare function resetEditorSeatsForTests(): void;
@@ -11,7 +11,7 @@
11
11
  * them here keeps the check meaningful in both directions: every entry must
12
12
  * exist in both dictionaries, and nothing else may be unreferenced.
13
13
  */
14
- export declare const DYNAMIC_KEYS: readonly ["common.loading", "editor.saving", "editor.unsaved", "editor.saved", "scm.hunkStaged", "scm.hunkUnstaged", "scm.hunkReverted", "history.details", "history.content", "history.diff", "downloads.running", "downloads.indeterminate", "downloads.sizeUnknown", "downloads.handedOff", "term.disconnected", "term.closed", "term.copy", "term.paste", "term.selectAll", "connection.ok", "connection.error", "connection.idle", "connection.actionFailed", "doctor.state.ok", "doctor.state.missing", "doctor.state.unknown", "doctor.item.os", "doctor.item.libc", "doctor.item.git", "doctor.item.rg", "doctor.item.tar", "doctor.item.setsid", "doctor.item.disk", "doctor.item.nproc", "doctor.item.memory", "doctor.item.helpers", "doctor.item.sshd"];
14
+ export declare const DYNAMIC_KEYS: readonly ["common.loading", "editor.saving", "editor.unsaved", "editor.saved", "scm.hunkStaged", "scm.hunkUnstaged", "scm.hunkReverted", "history.details", "history.content", "history.diff", "downloads.running", "downloads.indeterminate", "downloads.sizeUnknown", "downloads.handedOff", "term.disconnected", "term.closed", "term.copy", "term.paste", "term.selectAll", "connection.ok", "connection.error", "connection.idle", "connection.actionFailed", "doctor.state.ok", "doctor.state.missing", "doctor.state.unknown", "doctor.item.os", "doctor.item.libc", "doctor.item.git", "doctor.item.rg", "doctor.item.tar", "doctor.item.setsid", "doctor.item.disk", "doctor.item.nproc", "doctor.item.memory", "doctor.item.helpers", "doctor.item.sshd", "editor.crumbRoot", "editor.crumbLabel", "editor.crumbUp", "editor.crumbEmpty", "editor.imageHint", "editor.imageFitHint", "editor.imageFailedHint", "editor.imageTooLargeTitle", "editor.imageTooLargeHint"];
15
15
  export type Lang = 'zh' | 'en';
16
16
  export declare function detectLang(): Lang;
17
17
  export declare function makeT(lang: Lang): (key: string) => string;
@@ -274,6 +274,17 @@ export interface ExplorerValue {
274
274
  openFloatingEditor: () => void;
275
275
  /** 停靠回主界面(底层的中心视图或侧栏表面)。 */
276
276
  dockFloatingEditor: () => void;
277
+ /**
278
+ * Show the SAME editor in the conversation-view tab (full width).
279
+ *
280
+ * The docked sidebar pane is the default seat; the centre tab is an optional
281
+ * second seat for the same buffer. Flipping the surface unmounts one mount and
282
+ * mounts the other, so the live buffer is captured first (see
283
+ * `captureLiveBuffer`).
284
+ */
285
+ openEditorInCenter: () => void;
286
+ /** Dock the editor back into the sidebar (the reverse of `openEditorInCenter`). */
287
+ dockEditorSidebar: () => void;
277
288
  openDiff: (rel: string, staged: boolean, untracked?: boolean) => void;
278
289
  openCommitFile: (hash: string, rel: string, origPath?: string) => void;
279
290
  activateTab: (id: string) => void;
@@ -359,6 +370,28 @@ export declare function requestSearch(request: {
359
370
  * @param dir - absolute remote DIRECTORY (a file's parent for a file hit).
360
371
  */
361
372
  export declare function revealInExplorer(dir: string): void;
373
+ /** Outcome of one terminal path click (see `jumpToTerminalPath`). */
374
+ export type TerminalPathJump = 'revealed' | 'missing' | 'outside' | 'blocked';
375
+ /**
376
+ * Jump from a path printed in the TERMINAL to that folder in the directory tree
377
+ * (Ctrl+Click in the terminal; the wiring lives in `XTerm`/`TerminalView`).
378
+ *
379
+ * The token is only text, so the absolute path is decided by a short candidate
380
+ * chain (`vsc/terminal-links.ts`) and then CONFIRMED against the host: the first
381
+ * candidate that exists wins, and its directory (the path itself for a folder,
382
+ * its parent for a file) is revealed in the tree. A hit outside every binding on
383
+ * that host is reported instead of silently jumping somewhere unrelated — the
384
+ * tree can only show what a binding covers.
385
+ *
386
+ * @param alias - host the terminal TAB is connected to (not the panel's host
387
+ * picker: a tab can outlive a picker change).
388
+ * @param token - the path as printed in the terminal.
389
+ * @param hints - shell cwd (OSC 7) and remote home, for relative/`~` tokens.
390
+ */
391
+ export declare function jumpToTerminalPath(alias: string, token: string, hints?: {
392
+ home?: string;
393
+ cwd?: string;
394
+ }): Promise<TerminalPathJump>;
362
395
  /**
363
396
  * Open a fresh terminal tab whose shell lands in `dir` — on the CURRENT
364
397
  * workspace's host.
@@ -632,10 +665,15 @@ export declare function openRemoteFileInBinding(bindingId: string, remotePath: s
632
665
  * Whether the plugin's own rich editor is the place a remote file click should
633
666
  * land (the click interceptor's gate, see `remote-file-open.ts`).
634
667
  *
635
- * The centre conversation view is the normal case; while the editor floats it
636
- * is the floating window instead — the file still belongs in OUR editor, not in
637
- * the host's native preview. On the sidebar-fallback layout (`sidebar`) the
638
- * interceptor stays off, exactly as before this feature.
668
+ * True while at least one SEAT exists that can render our editor in this page
669
+ * (see `editor-capability.ts`): the docked sidebar pane is the default seat and
670
+ * the conversation-view tab is the optional second one. "Registered" rather than
671
+ * "currently mounted" on purpose — the panels are lazy/keep-alive, so a fresh
672
+ * page has no mounted pane until the rail visits it, and asking for a mount
673
+ * would send the first click to the host's native preview, which cannot resolve
674
+ * a remote path at all. A host where no seat registers falls back to that native
675
+ * preview, which is the only thing it can do. Unknown bindings are still
676
+ * answered by `openRemoteFileInBinding` returning false.
639
677
  */
640
678
  export declare function isEditorTakeoverActive(): boolean;
641
679
  /** Open (or focus) a working-tree diff of one repository path. */
@@ -696,6 +734,23 @@ export declare function dismissConflict(id: string): void;
696
734
  export declare function reloadTab(id: string): Promise<void>;
697
735
  /** Note where the editor pane is mounted (set by the client entry). */
698
736
  export declare function setEditorSurface(surface: 'center' | 'sidebar'): void;
737
+ /**
738
+ * Move the editor into the conversation-view tab (full width).
739
+ *
740
+ * The live buffer is captured BEFORE the surface flips: the flip unmounts the
741
+ * mount that owns it (see `captureLiveBuffer`'s header), and without that
742
+ * handoff the edits typed since the load would disappear. The host tab is then
743
+ * selected so the user actually sees where the editor went.
744
+ */
745
+ export declare function openEditorInCenter(): void;
746
+ /**
747
+ * Dock the editor back into the sidebar (the reverse of `openEditorInCenter`).
748
+ *
749
+ * The docked pane is the default seat and owns the whole sidebar column, so
750
+ * `revealEditor` switches the rail to the editor page (from whatever view was
751
+ * showing) and the tree stays one click away.
752
+ */
753
+ export declare function dockEditorSidebar(): void;
699
754
  /**
700
755
  * Record that the host's frame-wide overlay slot actually rendered the
701
756
  * floating window host (see `FloatingEditorWindow`).
@@ -0,0 +1,23 @@
1
+ /**
2
+ * One registry for "type this into that terminal's command line".
3
+ *
4
+ * The snippet panel lives in the terminal's HEADER while the xterm instance is
5
+ * owned by a child component, so the panel needs an imperative handle without
6
+ * lifting xterm state into React (a re-render per keystroke would be absurd).
7
+ * Each mounted `XTerm` registers a paste function under its tab id and removes
8
+ * it on unmount; the panel asks for the ACTIVE tab.
9
+ *
10
+ * Deliberately NOT exported as a React hook: callers are event handlers inside
11
+ * a portal, not render code.
12
+ */
13
+ /** Register one mounted terminal; returns the unregister. */
14
+ export declare function registerTerminalPaste(tabId: string, paste: (text: string) => void): () => void;
15
+ /**
16
+ * Insert one command into the given terminal without sending it.
17
+ *
18
+ * @returns false when that tab has no mounted terminal any more (a closed tab, a
19
+ * panel that is not rendered) — the caller says so instead of pretending.
20
+ */
21
+ export declare function pasteIntoTerminal(tabId: string | undefined, text: string): boolean;
22
+ /** How many terminals are registered (diagnostics; also handy for the gate). */
23
+ export declare function registeredTerminalCount(): number;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Common-command snippets: the little "常用指令" library above the terminal.
3
+ *
4
+ * A snippet is a NAME plus the COMMAND it stands for. Clicking one in the panel
5
+ * pastes the command into the active terminal's command line WITHOUT pressing
6
+ * Enter — the user reviews and runs it themselves, so a misclick cannot execute
7
+ * `rm -rf`.
8
+ *
9
+ * Storage is per browser (localStorage), like the port-forward rules and the
10
+ * editor preferences: this is a personal convenience list, not workspace state,
11
+ * and the host is told nothing about it. The pure half is exported so the gate
12
+ * can drive parsing / CRUD / ordering without a DOM, and the module-level store
13
+ * (snapshot + subscribe) is what makes the popover and the Ctrl+B shortcut share
14
+ * one list.
15
+ */
16
+ /** One saved command. */
17
+ export interface TerminalSnippet {
18
+ /** Stable identity (never reused, so drag/reorder cannot swap rows). */
19
+ id: string;
20
+ /** Short label shown in the list. */
21
+ name: string;
22
+ /** The command text pasted into the terminal (not executed). */
23
+ command: string;
24
+ }
25
+ /** localStorage key (one JSON array, so the list cannot half-update). */
26
+ export declare const SNIPPETS_KEY = "dsh-remote-vs.term.snippets";
27
+ /** Hard caps: a snippet list is a convenience, not a dataset. */
28
+ export declare const SNIPPETS_MAX = 200;
29
+ export declare const SNIPPET_NAME_MAX = 80;
30
+ export declare const SNIPPET_COMMAND_MAX = 4000;
31
+ /** A fresh identity for one snippet. */
32
+ export declare function createSnippetId(): string;
33
+ /**
34
+ * Normalize one user-entered snippet; `undefined` when it is unusable.
35
+ *
36
+ * Both fields are required (an unnamed command is unfindable, an empty command
37
+ * does nothing) and both are trimmed — a leading/trailing newline in a pasted
38
+ * command would otherwise send an empty line and RUN the command, which is
39
+ * exactly what this feature promises not to do.
40
+ */
41
+ export declare function sanitizeSnippetInput(input: {
42
+ name?: string;
43
+ command?: string;
44
+ }): {
45
+ name: string;
46
+ command: string;
47
+ } | undefined;
48
+ /** Parse the persisted JSON; anything malformed is dropped, never repaired silently. */
49
+ export declare function parseSnippets(raw: string | null | undefined): TerminalSnippet[];
50
+ /** Serialize only the known fields. */
51
+ export declare function serializeSnippets(list: readonly TerminalSnippet[]): string;
52
+ /** Append one snippet (newest last); returns the SAME array when it is invalid. */
53
+ export declare function addSnippet(list: readonly TerminalSnippet[], input: {
54
+ name?: string;
55
+ command?: string;
56
+ }, id?: string): SnippetList;
57
+ /** Replace one snippet's fields; an invalid edit leaves the list untouched. */
58
+ export declare function updateSnippet(list: readonly TerminalSnippet[], id: string, input: {
59
+ name?: string;
60
+ command?: string;
61
+ }): SnippetList;
62
+ /** Drop one snippet. */
63
+ export declare function removeSnippet(list: readonly TerminalSnippet[], id: string): SnippetList;
64
+ /**
65
+ * Move one snippet to another index (drag & drop), clamping both ends.
66
+ *
67
+ * Returning the SAME list for a no-op keeps the store's "did it change" test
68
+ * cheap and stops a drag that lands on its own row from re-rendering everything.
69
+ */
70
+ export declare function moveSnippet(list: readonly TerminalSnippet[], from: number, to: number): SnippetList;
71
+ /** A list type that is either the caller's unchanged value or a new array. */
72
+ type SnippetList = readonly TerminalSnippet[];
73
+ /** Current list (identity-stable while unchanged, safe for useSyncExternalStore). */
74
+ export declare function snippetsSnapshot(): readonly TerminalSnippet[];
75
+ /** Subscribe to snippet changes; returns the unsubscribe. */
76
+ export declare function subscribeSnippets(listener: () => void): () => void;
77
+ /**
78
+ * Apply one pure transition and persist it when it really changed.
79
+ *
80
+ * The updater must be pure and return either the same array (no change → no
81
+ * notification, no write) or a new one; every CRUD helper above already does.
82
+ */
83
+ export declare function updateSnippets(updater: (list: readonly TerminalSnippet[]) => readonly TerminalSnippet[]): void;
84
+ /** Reset the module store (the gate drives it directly; production never calls it). */
85
+ export declare function resetSnippetsForTests(list?: readonly TerminalSnippet[]): void;
86
+ export {};
@@ -5,6 +5,8 @@ export interface RemoteChatTarget {
5
5
  /** The canonical host dir of the workspace that session belongs to. */
6
6
  sessionWorkspacePath: string | undefined;
7
7
  }
8
+ /** The on-screen session id, or undefined (no seat mounted / no feed). */
9
+ export declare function mountedSessionId(ctx: Context): string | undefined;
8
10
  /** Host-confirmed workspace path for one session (exact membership). */
9
11
  export declare function workspacePathOf(ctx: Context, sessionId: string): string | undefined;
10
12
  /**
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Client cache of the two view preferences (`/api/dsh-remote/view-settings`).
3
+ *
4
+ * Two very different consumers read the same values and must agree:
5
+ * - the Settings page renders the controls and writes them;
6
+ * - the frame-wide auto-open behaviour (`auto-open-remote.ts`) reads them while
7
+ * the Settings page is closed — often it is the ONLY reader, because a page
8
+ * that never opened Settings still has to know whether to open the panel.
9
+ *
10
+ * So the cache lives at module scope with a one-listener-set subscription: a
11
+ * save from the Settings page is visible to the behaviour in the SAME page
12
+ * without a reload. Every read is soft — an older host without the route answers
13
+ * nothing, `loadViewSettings` reports `undefined`, and the caller keeps its
14
+ * defaults instead of crashing the surface that asked.
15
+ */
16
+ import { type RemoteViewSettings } from '../protocol.ts';
17
+ /** Where one published value came from: a load answers the page, a save is a user action. */
18
+ export type ViewSettingsSource = 'load' | 'save';
19
+ /** The last known preferences, or `undefined` until the first successful load. */
20
+ export declare function currentViewSettings(): RemoteViewSettings | undefined;
21
+ /**
22
+ * Subscribe to every loaded/saved value; returns the unsubscribe.
23
+ *
24
+ * The source matters: only a SAVE is an explicit user action, and only that may
25
+ * resize a panel the user already has open (a page-load answer must not).
26
+ */
27
+ export declare function subscribeViewSettings(listener: (settings: RemoteViewSettings, source: ViewSettingsSource) => void): () => void;
28
+ /**
29
+ * Load the preferences once (cached), or force a reload.
30
+ *
31
+ * @param force - ignore the cache (the retry path behind a failed first load).
32
+ * @returns the current values, or `undefined` when the host cannot answer.
33
+ */
34
+ export declare function loadViewSettings(force?: boolean): Promise<RemoteViewSettings | undefined>;
35
+ /**
36
+ * Persist a flat patch and publish the answer.
37
+ *
38
+ * @throws RemoteApiError when the host refuses (the settings page shows it).
39
+ */
40
+ export declare function saveViewSettings(patch: Partial<RemoteViewSettings>): Promise<RemoteViewSettings>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Breadcrumb above the editor in the full-width (conversation view) variant.
3
+ *
4
+ * Every path segment is clickable and opens a VS Code-style sibling picker: a
5
+ * directory segment lists itself, the file segment lists its parent directory,
6
+ * so "open the file next to this one" costs one click instead of a trip to the
7
+ * tree (whose expansion state lives in another view and cannot be expressed in
8
+ * a URL).
9
+ *
10
+ * Read-only: it only calls `fileOp.list` on the remote. The remote path is the
11
+ * Host's own business — no second validation layer here.
12
+ */
13
+ import { type ReactNode } from 'react';
14
+ /** Props of {@link Breadcrumb}. */
15
+ export interface BreadcrumbProps {
16
+ /** i18n lookup (falls back to inline copy when a key is missing). */
17
+ t: (key: string) => string;
18
+ /** SSH host alias the workspace lives on (the file route's first argument). */
19
+ alias: string;
20
+ /** Remote workspace root, absolute. */
21
+ root: string;
22
+ /** Display name of the workspace root. */
23
+ rootName: string;
24
+ /** Absolute path of the file on screen. */
25
+ path: string;
26
+ /** Open one remote file in the editor. */
27
+ onOpen: (fullPath: string) => void;
28
+ }
29
+ /** Breadcrumb: path segments + sibling dropdown. */
30
+ export declare function Breadcrumb(props: BreadcrumbProps): ReactNode;