dsh-remote-vs 0.25.0 → 0.27.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/README.en.md +12 -15
- package/README.md +11 -12
- package/THIRD-PARTY-NOTICES.md +193 -0
- package/lib/client.js +7313 -79961
- package/lib/index.js +1529 -964
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/client/CodeEditor.d.ts +22 -0
- package/lib/types/client/OutlinePanel.d.ts +22 -0
- package/lib/types/client/ProcessesSection.d.ts +19 -0
- package/lib/types/client/RemoteExplorer.d.ts +53 -0
- package/lib/types/client/api.d.ts +42 -3
- package/lib/types/client/blame-model.d.ts +77 -0
- package/lib/types/client/changes/review-state.d.ts +19 -0
- package/lib/types/client/connection.d.ts +16 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/outline-model.d.ts +59 -0
- package/lib/types/client/request-gate.d.ts +110 -0
- package/lib/types/client/scm/DiffView.d.ts +45 -7
- package/lib/types/client/scm/actions.d.ts +43 -4
- package/lib/types/client/store.d.ts +71 -0
- package/lib/types/client/vsc/FindWidget.d.ts +6 -0
- package/lib/types/client/vsc/blame.d.ts +19 -0
- package/lib/types/client/vsc/change-marks.d.ts +16 -6
- package/lib/types/client/vsc/editor-keymap.d.ts +35 -1
- package/lib/types/client/vsc/kit.d.ts +11 -2
- package/lib/types/client/vsc/preview-document.d.ts +46 -0
- package/lib/types/client/vsc/preview-model.d.ts +31 -0
- package/lib/types/client/vsc/preview-services.d.ts +24 -0
- package/lib/types/client/vsc/save-shortcut.d.ts +21 -0
- package/lib/types/client/vsc/terminal-theme.d.ts +28 -2
- package/lib/types/forward.d.ts +12 -0
- package/lib/types/fs-ops.d.ts +42 -0
- package/lib/types/git-ops.d.ts +18 -0
- package/lib/types/http.d.ts +2 -0
- package/lib/types/keygen.d.ts +9 -0
- package/lib/types/monitor.d.ts +8 -0
- package/lib/types/notices.d.ts +16 -1
- package/lib/types/p2/helper-rpc.d.ts +45 -0
- package/lib/types/processes.d.ts +43 -0
- package/lib/types/protocol.d.ts +34 -0
- package/lib/types/routes.d.ts +2 -0
- package/lib/types/store.d.ts +7 -0
- package/lib/types/terminal.d.ts +8 -0
- package/lib/types/view-settings.d.ts +5 -0
- package/lib/{worlds-B7gEDBzC.js → worlds-RG8K5eom.js} +113 -15
- package/package.json +3 -1
- package/src/client/CodeEditor.tsx +194 -9
- package/src/client/DirectoryFlow.tsx +16 -0
- package/src/client/DoctorPanel.tsx +70 -7
- package/src/client/EditorPane.tsx +574 -42
- package/src/client/HostsView.tsx +12 -3
- package/src/client/MonitorView.tsx +16 -5
- package/src/client/OutlinePanel.tsx +287 -0
- package/src/client/ProcessesSection.tsx +292 -0
- package/src/client/RemoteDirectoryPicker.tsx +12 -0
- package/src/client/RemoteExplorer.tsx +929 -40
- package/src/client/RemoteRoot.tsx +147 -22
- package/src/client/SearchView.tsx +8 -0
- package/src/client/TerminalSnippets.tsx +83 -8
- package/src/client/api.ts +114 -13
- package/src/client/blame-model.ts +242 -0
- package/src/client/changes/ChangesDock.tsx +188 -6
- package/src/client/changes/changes.css +10 -3
- package/src/client/changes/review-state.ts +34 -0
- package/src/client/connection.ts +29 -0
- package/src/client/downloads.ts +49 -4
- package/src/client/i18n.ts +276 -8
- package/src/client/index.tsx +4 -0
- package/src/client/outline-model.ts +775 -0
- package/src/client/request-gate.ts +221 -0
- package/src/client/scm/CommitPane.tsx +20 -2
- package/src/client/scm/DiffView.tsx +343 -117
- package/src/client/scm/HistoryPanel.tsx +61 -3
- package/src/client/scm/RepoPicker.tsx +1 -1
- package/src/client/scm/ScmPanel.tsx +391 -87
- package/src/client/scm/actions.ts +150 -14
- package/src/client/store.tsx +426 -14
- package/src/client/ui.tsx +4 -0
- package/src/client/vsc/FindWidget.tsx +24 -9
- package/src/client/vsc/blame.ts +147 -0
- package/src/client/vsc/breadcrumb.tsx +91 -3
- package/src/client/vsc/change-marks.ts +93 -44
- package/src/client/vsc/editor-keymap.ts +59 -1
- package/src/client/vsc/file-icons.tsx +17 -3
- package/src/client/vsc/kit.tsx +29 -20
- package/src/client/vsc/preview-document.tsx +323 -0
- package/src/client/vsc/preview-model.ts +216 -0
- package/src/client/vsc/preview-services.ts +118 -0
- package/src/client/vsc/save-shortcut.ts +47 -1
- package/src/client/vsc/terminal-theme.ts +44 -18
- package/src/client/vsc/vsc.css +6509 -5458
- package/src/forward.ts +47 -9
- package/src/fs-ops.ts +124 -4
- package/src/git-ops.ts +54 -3
- package/src/http.ts +35 -4
- package/src/keygen.ts +55 -4
- package/src/monitor.ts +13 -0
- package/src/notices.ts +23 -1
- package/src/p2/helper-rpc.ts +113 -7
- package/src/p2/worlds.ts +14 -1
- package/src/processes.ts +177 -0
- package/src/protocol.ts +37 -0
- package/src/routes.ts +330 -43
- package/src/sftp.ts +51 -14
- package/src/store.ts +10 -0
- package/src/terminal.ts +73 -26
- package/src/view-settings.ts +50 -10
- package/lib/types/client/Dialog.d.ts +0 -14
- package/src/client/Dialog.tsx +0 -76
|
@@ -8,13 +8,33 @@
|
|
|
8
8
|
* messages a user can act on (missing identity, no upstream, conflicts, ...).
|
|
9
9
|
*/
|
|
10
10
|
import { REMOTE_API } from '../../protocol.ts';
|
|
11
|
-
import type { GitBranch, GitCommitFile, GitRemote, GitStash, GitStatusDetail, RemoteExecResult, RemoteRead } from '../../protocol.ts';
|
|
11
|
+
import type { GitBranch, GitCommit, GitCommitFile, GitRemote, GitStash, GitStatusDetail, RemoteExecResult, RemoteRead } from '../../protocol.ts';
|
|
12
|
+
import { type BlameLine, type FileHistoryCommit } from '../blame-model.ts';
|
|
12
13
|
import { type PushTarget } from '../exec-output.ts';
|
|
13
14
|
/** Error carrying a message already fit for the UI. */
|
|
14
15
|
export declare class GitOpError extends Error {
|
|
15
16
|
}
|
|
16
17
|
/** Join a remote directory with a repo-relative path. */
|
|
17
18
|
export declare function joinRemote(dir: string, rel: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Per-command options for {@link run} / {@link tryRun}.
|
|
21
|
+
*
|
|
22
|
+
* `background` puts the command on the request gate's git channel: it waits
|
|
23
|
+
* while a foreground request is in flight and only one such command runs at a
|
|
24
|
+
* time. ONLY the repository-wide READ paths use it (`probeRepoRoot`,
|
|
25
|
+
* `loadStatusDetail`, `loadHead`), because those are the walks a workspace
|
|
26
|
+
* switch starts and the ones that must never make the directory listing queue
|
|
27
|
+
* behind them. Every verb the user is waiting on (stage, commit, push, the
|
|
28
|
+
* bounded probes, the search) stays foreground and is unaffected.
|
|
29
|
+
*
|
|
30
|
+
* `signal` cancels the command: the HTTP request is aborted (and, while still
|
|
31
|
+
* queued, is taken out of the queue) — the store's `readGit` uses it to release
|
|
32
|
+
* the connections of a workspace the user just left.
|
|
33
|
+
*/
|
|
34
|
+
export interface RunOptions {
|
|
35
|
+
background?: boolean;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
18
38
|
/** The repository that encloses a workspace directory (undefined when none). */
|
|
19
39
|
export declare function resolveRepoRoot(alias: string, workspaceRoot: string): Promise<string | undefined>;
|
|
20
40
|
/**
|
|
@@ -41,11 +61,11 @@ export type RepoRootProbe = {
|
|
|
41
61
|
error: string;
|
|
42
62
|
};
|
|
43
63
|
/** The repository root, or WHY the probe could not answer. */
|
|
44
|
-
export declare function probeRepoRoot(alias: string, workspaceRoot: string): Promise<RepoRootProbe>;
|
|
64
|
+
export declare function probeRepoRoot(alias: string, workspaceRoot: string, signal?: AbortSignal): Promise<RepoRootProbe>;
|
|
45
65
|
/** Repositories under a workspace root (the workspace itself sorts first). */
|
|
46
66
|
export declare function findRepos(alias: string, workspaceRoot: string): Promise<string[]>;
|
|
47
67
|
/** Every changed path plus the ignored half. */
|
|
48
|
-
export declare function loadStatusDetail(alias: string, root: string): Promise<GitStatusDetail>;
|
|
68
|
+
export declare function loadStatusDetail(alias: string, root: string, signal?: AbortSignal): Promise<GitStatusDetail>;
|
|
49
69
|
/**
|
|
50
70
|
* Pathspec-limited status probe: the raw `-z` stdout for JUST these paths.
|
|
51
71
|
*
|
|
@@ -73,7 +93,7 @@ export declare function probeStatusPaths(alias: string, root: string, paths: rea
|
|
|
73
93
|
*/
|
|
74
94
|
export declare function probeStatusDir(alias: string, root: string, dir: string): Promise<string>;
|
|
75
95
|
/** Current branch with its ahead/behind counters (detached HEAD tolerated). */
|
|
76
|
-
export declare function loadHead(alias: string, root: string): Promise<{
|
|
96
|
+
export declare function loadHead(alias: string, root: string, signal?: AbortSignal): Promise<{
|
|
77
97
|
branch: string;
|
|
78
98
|
detached: boolean;
|
|
79
99
|
ahead: number;
|
|
@@ -137,12 +157,31 @@ export declare function loadCommitPatch(alias: string, root: string, hash: strin
|
|
|
137
157
|
text: string;
|
|
138
158
|
truncated: boolean;
|
|
139
159
|
}>;
|
|
160
|
+
/** One viewport window of `git blame` for a repo-relative path. */
|
|
161
|
+
export declare function loadBlame(alias: string, root: string, path: string, from: number, to: number, options?: RunOptions): Promise<BlameLine[]>;
|
|
162
|
+
/**
|
|
163
|
+
* Commits that touched one path. `--follow` makes renames visible as history
|
|
164
|
+
* of the CURRENT name, which is exactly what the editor's file-history menu
|
|
165
|
+
* promises; the rows use the same shape as the repository log.
|
|
166
|
+
*/
|
|
167
|
+
export declare function loadFileHistory(alias: string, root: string, path: string, max?: number): Promise<FileHistoryCommit[]>;
|
|
168
|
+
/** One commit header when the hash is older than the loaded log window. */
|
|
169
|
+
export declare function loadCommit(alias: string, root: string, hash: string): Promise<GitCommit | undefined>;
|
|
140
170
|
/** Local + remote-tracking branches. */
|
|
141
171
|
export declare function loadBranches(alias: string, root: string, current: string): Promise<GitBranch[]>;
|
|
142
172
|
/** Configured remotes. */
|
|
143
173
|
export declare function loadRemotes(alias: string, root: string): Promise<GitRemote[]>;
|
|
144
174
|
/** The stash stack. */
|
|
145
175
|
export declare function loadStashes(alias: string, root: string): Promise<GitStash[]>;
|
|
176
|
+
/**
|
|
177
|
+
* Initialize a repository in place (`git init`).
|
|
178
|
+
*
|
|
179
|
+
* The panel's "not a repository" state used to be a dead end (the only offer
|
|
180
|
+
* was "browse somewhere else") while the command builder had no caller at all.
|
|
181
|
+
* The caller refreshes the status afterwards — that read re-probes the
|
|
182
|
+
* directory, so the panel moves to the normal view without another discovery.
|
|
183
|
+
*/
|
|
184
|
+
export declare function initRepo(alias: string, root: string): Promise<string>;
|
|
146
185
|
/** Stage paths (additions, edits, deletions, renames). */
|
|
147
186
|
export declare function stagePaths(alias: string, root: string, paths: readonly string[]): Promise<void>;
|
|
148
187
|
/** Unstage paths without touching the worktree. */
|
|
@@ -152,6 +152,12 @@ export interface TerminalRequest {
|
|
|
152
152
|
/** Absolute remote directory the fresh shell should `cd` into. */
|
|
153
153
|
dir: string;
|
|
154
154
|
}
|
|
155
|
+
/** One "show this commit in the history rail" request. */
|
|
156
|
+
export interface CommitFocusRequest {
|
|
157
|
+
/** Monotonic id so selecting the same commit twice still re-triggers. */
|
|
158
|
+
id: number;
|
|
159
|
+
hash: string;
|
|
160
|
+
}
|
|
155
161
|
/** Stored repository sub-directory for one binding ('' = the workspace root). */
|
|
156
162
|
export declare function readRepoSubdir(workspaceId: string): string;
|
|
157
163
|
/** Everything a view can read, plus the actions. */
|
|
@@ -202,6 +208,8 @@ export interface ExplorerValue {
|
|
|
202
208
|
revealRequest: RevealRequest | undefined;
|
|
203
209
|
/** Pending "open a terminal here" request (consumed by the terminal panel). */
|
|
204
210
|
terminalRequest: TerminalRequest | undefined;
|
|
211
|
+
/** Pending "select this commit in the history rail" request. */
|
|
212
|
+
commitFocus: CommitFocusRequest | undefined;
|
|
205
213
|
setView: (view: RailView) => void;
|
|
206
214
|
/** Switch to the search panel (optionally scoped to a folder) — the tree's
|
|
207
215
|
"find in folder" entry point. */
|
|
@@ -221,6 +229,8 @@ export interface ExplorerValue {
|
|
|
221
229
|
* search results' "open in terminal" entry.
|
|
222
230
|
*/
|
|
223
231
|
openTerminalAt: (dir: string) => void;
|
|
232
|
+
/** Open the history rail with this commit selected (blame / file history). */
|
|
233
|
+
focusCommit: (hash: string) => void;
|
|
224
234
|
/**
|
|
225
235
|
* The USER's pick — the workspace dropdowns and the wizard's "open files".
|
|
226
236
|
*
|
|
@@ -328,6 +338,59 @@ export interface ExplorerValue {
|
|
|
328
338
|
}
|
|
329
339
|
/** Subscribe to the explorer store. */
|
|
330
340
|
export declare function useExplorer(): ExplorerValue;
|
|
341
|
+
/**
|
|
342
|
+
* Shallow equality for selector results — one level deep, `Object.is` per field.
|
|
343
|
+
*
|
|
344
|
+
* Selectors naturally build a fresh `{ repoRoot, head, … }` object out of the
|
|
345
|
+
* snapshot, and a plain `Object.is` would then see a new reference on every
|
|
346
|
+
* publish and repaint the panel anyway (defeating the whole point). Passing this
|
|
347
|
+
* as `equal` compares the FIELDS, so "the snapshot was rebuilt but none of the
|
|
348
|
+
* fields I read changed" answers `true` and the previous value (and render) is
|
|
349
|
+
* kept. Arrays are compared as objects, i.e. by index.
|
|
350
|
+
*
|
|
351
|
+
* Shallow is deliberate: every selected field is either a primitive or a
|
|
352
|
+
* REFERENCE the store already owns (`status`, `buckets`, `tabs`, `untrackedDirs`
|
|
353
|
+
* …). Comparing those by reference is a real value check — the store only
|
|
354
|
+
* replaces them when they actually change.
|
|
355
|
+
*/
|
|
356
|
+
export declare function shallowEqual(a: unknown, b: unknown): boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Subscribe to ONE slice of the explorer store.
|
|
359
|
+
*
|
|
360
|
+
* Why this exists: `useExplorer()` hands out the whole `ExplorerValue`, and
|
|
361
|
+
* every `publish()` builds a NEW snapshot object — so every subscriber repaints
|
|
362
|
+
* on every mutation, including mutations its panel does not read (a save bumps
|
|
363
|
+
* the tab array, a git refresh replaces `status`, a rail switch changes `view`).
|
|
364
|
+
* With the panels kept MOUNTED, one publish therefore repainted every panel,
|
|
365
|
+
* and the SCM panel's change list (up to 4000 rows) was rebuilt for a change in
|
|
366
|
+
* an unrelated field.
|
|
367
|
+
*
|
|
368
|
+
* This hook re-renders its component ONLY when the selected value changes:
|
|
369
|
+
* - `publish()` still notifies every listener (that is how the store stays a
|
|
370
|
+
* single source of truth), but React asks this hook for a fresh value and
|
|
371
|
+
* `Object.is`-compares it with the last rendered one; equal means no render;
|
|
372
|
+
* - the selector runs at most once per (snapshot, selector) pair, and its
|
|
373
|
+
* result is kept in a per-hook cache, so an equal result keeps the PREVIOUS
|
|
374
|
+
* reference (downstream `useMemo`s keyed on it stay valid).
|
|
375
|
+
*
|
|
376
|
+
* Constraints, all from `useSyncExternalStore`:
|
|
377
|
+
* - the value returned for an UNCHANGED snapshot must be stable. This hook
|
|
378
|
+
* guarantees it (cache keyed on the snapshot identity), which is also why a
|
|
379
|
+
* selector may safely return a fresh object — with `shallowEqual` it is
|
|
380
|
+
* compared and the old reference is kept, and without `equal` it is cached
|
|
381
|
+
* and only recomputed when the snapshot itself changes;
|
|
382
|
+
* - `selector` must be PURE and should read only the snapshot. It may be an
|
|
383
|
+
* inline arrow (the hook tracks its identity, so a selector that closes over
|
|
384
|
+
* props is recomputed when it changes), but a module-level selector is
|
|
385
|
+
* cheaper: its identity is stable, so between publishes the cache answers
|
|
386
|
+
* without running it at all;
|
|
387
|
+
* - `selector` must not mutate the snapshot.
|
|
388
|
+
*
|
|
389
|
+
* @param selector - pure read of the fields this component needs.
|
|
390
|
+
* @param equal - comparison used to decide whether the new selection is the
|
|
391
|
+
* same value; defaults to `Object.is`. Pass `shallowEqual` for object slices.
|
|
392
|
+
*/
|
|
393
|
+
export declare function useExplorerSelector<T>(selector: (snapshot: ExplorerValue) => T, equal?: (a: T, b: T) => boolean): T;
|
|
331
394
|
/** The repo-relative path of an absolute remote path ('' when outside). */
|
|
332
395
|
export declare function repoRelative(repoRoot: string | undefined, fullPath: string): string;
|
|
333
396
|
/** Install the context and load hosts/workspaces once per page. */
|
|
@@ -407,6 +470,14 @@ export declare function jumpToTerminalPath(alias: string, token: string, hints?:
|
|
|
407
470
|
* @param dir - absolute remote directory.
|
|
408
471
|
*/
|
|
409
472
|
export declare function openTerminalAt(dir: string): void;
|
|
473
|
+
/**
|
|
474
|
+
* Open the history rail and select one commit.
|
|
475
|
+
*
|
|
476
|
+
* Blame cells and the file-history menu only know a hash; the history panel owns
|
|
477
|
+
* the list and the detail pane, so the selection travels as a request (the same
|
|
478
|
+
* pattern as `revealInExplorer` / `openTerminalAt`).
|
|
479
|
+
*/
|
|
480
|
+
export declare function focusCommit(hash: string): void;
|
|
410
481
|
/**
|
|
411
482
|
* Select the binding every view works against — the USER's choice.
|
|
412
483
|
*
|
|
@@ -59,6 +59,12 @@ export declare function stepFind(view: EditorView, forward: boolean, state?: Fin
|
|
|
59
59
|
export declare function FindWidget(props: {
|
|
60
60
|
view: EditorView | undefined;
|
|
61
61
|
open: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The page's dictionary translator. Required, not defaulted: the widget has
|
|
64
|
+
* no language of its own, and a silent Chinese fallback is exactly the
|
|
65
|
+
* hardcoded copy this prop replaced.
|
|
66
|
+
*/
|
|
67
|
+
t: (key: string) => string;
|
|
62
68
|
/** A selection carried in by Ctrl+F (`id` bumps to re-trigger). */
|
|
63
69
|
seed: {
|
|
64
70
|
text: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline blame gutter for the CodeMirror editor.
|
|
3
|
+
*
|
|
4
|
+
* The data is fetched by the editor pane (one `-L` window at a time) and handed
|
|
5
|
+
* in as a line→commit map; this module only paints it. Keeping the fetch out of
|
|
6
|
+
* here is deliberate: the same model is used by the gate without CodeMirror,
|
|
7
|
+
* and a scroll must not be able to start a request from inside a gutter
|
|
8
|
+
* callback.
|
|
9
|
+
*/
|
|
10
|
+
import { type Extension } from '@codemirror/state';
|
|
11
|
+
import { type BlameLine } from '../blame-model.ts';
|
|
12
|
+
/**
|
|
13
|
+
* Build the gutter extension. Rebuilt by the editor's compartment whenever a
|
|
14
|
+
* blame window lands; `nowSeconds` is pinned so every cell in one render has
|
|
15
|
+
* the same clock.
|
|
16
|
+
*/
|
|
17
|
+
export declare function blameExtension(entries: ReadonlyMap<number, BlameLine>, onOpen?: (entry: BlameLine) => void): Extension;
|
|
18
|
+
/** Internal export for the editor to forward viewport changes. */
|
|
19
|
+
export declare function blameViewportReporter(report: (first: number, last: number) => void): Extension;
|
|
@@ -22,6 +22,13 @@ import { StateField, type EditorState, type Extension } from '@codemirror/state'
|
|
|
22
22
|
import { EditorView, ViewPlugin, type DecorationSet, type ViewUpdate } from '@codemirror/view';
|
|
23
23
|
/** 改动点的三种形态。 */
|
|
24
24
|
export type ChangeKind = 'add' | 'mod' | 'del';
|
|
25
|
+
/**
|
|
26
|
+
* 字典翻译函数,由调用方传入(`CodeEditor` 把页面语言解析好的那个 `t` 交下来)。
|
|
27
|
+
*
|
|
28
|
+
* 本模块自己不选语言:同样的 `t` 与同样的数据永远画出同样的 DOM,纯函数性得以
|
|
29
|
+
* 保持;语言变了由调用方重装扩展(`changeMarksExtension(t)`)。
|
|
30
|
+
*/
|
|
31
|
+
export type Translate = (key: string) => string;
|
|
25
32
|
/**
|
|
26
33
|
* 新增/修改行里"真正变化的字符区间":相对所属行的列偏移,**0-based、半开区间**。
|
|
27
34
|
*
|
|
@@ -145,23 +152,26 @@ export declare function changeBlockAt(state: EditorState, line: number): {
|
|
|
145
152
|
declare class ChangeMarkHighlighter {
|
|
146
153
|
decorations: DecorationSet;
|
|
147
154
|
private readonly view;
|
|
148
|
-
|
|
155
|
+
/** 解析标记文案的翻译函数;由 `changeMarkPlugin(t)` 装进来。 */
|
|
156
|
+
private readonly t;
|
|
157
|
+
constructor(view: EditorView, t: Translate);
|
|
149
158
|
update(update: ViewUpdate): void;
|
|
150
159
|
private rebuild;
|
|
151
160
|
}
|
|
152
161
|
/**
|
|
153
162
|
* 视口内行装饰的 ViewPlugin。
|
|
154
163
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
164
|
+
* 用工厂而不是模块级常量:标记与 chip 的文案由调用方的 `t` 解析。仍然导出是为了
|
|
165
|
+
* 让自检脚本能直接读 `view.plugin(changeMarkPlugin(t)).decorations.size` ——
|
|
166
|
+
* "只装饰视口内的行"这件事在 DOM 上看不出来(CodeMirror 本来就让 DOM 只保留可见
|
|
167
|
+
* 行),只有读这份 RangeSet 的条数才有判别力。
|
|
158
168
|
*/
|
|
159
|
-
export declare
|
|
169
|
+
export declare function changeMarkPlugin(t: Translate): ViewPlugin<ChangeMarkHighlighter>;
|
|
160
170
|
/**
|
|
161
171
|
* 编辑器侧的完整扩展:数据字段 + 作废标记 + 左侧 gutter + 行背景。
|
|
162
172
|
*
|
|
163
173
|
* `CodeEditor` 只在调用方真的传了 `changeSet` 时把它装进编辑器(Compartment),
|
|
164
174
|
* 没传时不装 —— 这样"没有会话改动"的文件连一条 gutter 都不会多出来。
|
|
165
175
|
*/
|
|
166
|
-
export declare
|
|
176
|
+
export declare function changeMarksExtension(t: Translate): Extension;
|
|
167
177
|
export {};
|
|
@@ -22,7 +22,15 @@
|
|
|
22
22
|
import type { EditorView, KeyBinding } from '@codemirror/view';
|
|
23
23
|
/** The editor actions the key bindings dispatch into. */
|
|
24
24
|
export interface EditorKeyHandlers {
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Ctrl/Cmd+S → the pane's save path.
|
|
27
|
+
*
|
|
28
|
+
* MUST be a no-op while a modal layer is open: `CodeEditor` (the only caller)
|
|
29
|
+
* checks `isModalLayerOpen()` before saving. The binding itself stays pure —
|
|
30
|
+
* this module imports no DOM — but because CodeMirror handles the key first and
|
|
31
|
+
* prevents the default, the window listener in `save-shortcut.ts` never gets to
|
|
32
|
+
* apply its own gate to this path.
|
|
33
|
+
*/
|
|
26
34
|
save(): void;
|
|
27
35
|
/** Ctrl/Cmd+F → seed our find widget from the selection and open it. */
|
|
28
36
|
openFindForSelection(view: EditorView): void;
|
|
@@ -32,7 +40,33 @@ export interface EditorKeyHandlers {
|
|
|
32
40
|
stepHunk(delta: 1 | -1): boolean;
|
|
33
41
|
/** Escape → close the find widget; false when it was not open. */
|
|
34
42
|
closeFind(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Ctrl/Cmd+G → ask for a line number and jump there.
|
|
45
|
+
*
|
|
46
|
+
* The prompt is the caller's (`promptDialog`), so this module stays free of
|
|
47
|
+
* DOM/React; the binding always claims the key (browsers use Ctrl+G for
|
|
48
|
+
* "find next", which has nothing to do inside a code editor).
|
|
49
|
+
*/
|
|
50
|
+
gotoLine(view: EditorView): void;
|
|
51
|
+
/**
|
|
52
|
+
* Ctrl/Cmd+D → select the next occurrence of the current selection.
|
|
53
|
+
*
|
|
54
|
+
* Returns the command's own answer: `false` (nothing to expand, or a mixed
|
|
55
|
+
* selection) must fall through to the browser instead of being swallowed —
|
|
56
|
+
* the same rule the hunk bindings follow.
|
|
57
|
+
*/
|
|
58
|
+
selectNextOccurrence(view: EditorView): boolean;
|
|
35
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the "go to line" answer to a 1-based line number inside `total`.
|
|
62
|
+
*
|
|
63
|
+
* Accepts what VS Code's box accepts for the LINE half: `42`, ` 42 `, `42:7`
|
|
64
|
+
* (the column half is ignored — this editor jumps to a line, the status bar
|
|
65
|
+
* reports the column). Anything else (empty, `0`, text) is `undefined`, and a
|
|
66
|
+
* number past the end CLAMPS to the last line instead of failing: the answer
|
|
67
|
+
* usually comes from a file the user is reading, not from its exact length.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseGotoLine(text: string, total: number): number | undefined;
|
|
36
70
|
/**
|
|
37
71
|
* Build the editor keymap.
|
|
38
72
|
*
|
|
@@ -124,8 +124,6 @@ export declare function ExplorerFolderIcon(props: {
|
|
|
124
124
|
className?: string;
|
|
125
125
|
}): ReactNode;
|
|
126
126
|
export declare function isImageFile(path: string): boolean;
|
|
127
|
-
export declare function isMarkdownFile(path: string): boolean;
|
|
128
|
-
export declare function isHtmlFile(path: string): boolean;
|
|
129
127
|
export declare function mimeFor(path: string): string;
|
|
130
128
|
/** True for a file that always opens as a preview, never as a diff. */
|
|
131
129
|
export declare function isPreviewOnlyFile(path: string): boolean;
|
|
@@ -182,6 +180,17 @@ export declare function toast(text: string, error?: boolean): void;
|
|
|
182
180
|
* confirm dialog would paint twice.
|
|
183
181
|
*/
|
|
184
182
|
export declare function DialogHost(): ReactNode;
|
|
183
|
+
/**
|
|
184
|
+
* Focusable elements inside one dialog, in DOM order.
|
|
185
|
+
*
|
|
186
|
+
* The modal is portaled to the END of `<body>`, so without a Tab trap a
|
|
187
|
+
* keyboard user tabs through the whole page to reach its buttons. Exported for
|
|
188
|
+
* the other portaled layers that need the same walk (the terminal snippet
|
|
189
|
+
* popover); `DoctorPanel` keeps its own copy because it deliberately does not
|
|
190
|
+
* import this module (its copy path must not use the silently-failing
|
|
191
|
+
* `copyText`, which `check-doctor.mjs` pins).
|
|
192
|
+
*/
|
|
193
|
+
export declare function focusables(root: HTMLElement | null): HTMLElement[];
|
|
185
194
|
export interface MenuEntry {
|
|
186
195
|
label: string;
|
|
187
196
|
onSelect: () => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document previews for remote files.
|
|
3
|
+
*
|
|
4
|
+
* Text sources (Markdown/HTML/SVG/CSV) are rendered from the editor buffer. PDF,
|
|
5
|
+
* audio/video and Office bytes never pass through `fs.read` (it is a UTF-8 API
|
|
6
|
+
* with a 4 MiB cap): they are streamed from the existing `/download` route into
|
|
7
|
+
* a blob URL, and Office is first converted to PDF by a LibreOffice already
|
|
8
|
+
* present on the REMOTE host. When that engine is missing the notice says so;
|
|
9
|
+
* the plugin never claims a corrupt file.
|
|
10
|
+
*/
|
|
11
|
+
import { type ReactNode } from 'react';
|
|
12
|
+
/** Never assemble a larger preview body than this in the tab. */
|
|
13
|
+
export declare const MAX_PREVIEW_BYTES: number;
|
|
14
|
+
export declare function officeExtensionOf(path: string): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Convert one remote Office document to PDF on the remote host.
|
|
17
|
+
*
|
|
18
|
+
* Paths and the extension are quoted/validated here; the only value that ends
|
|
19
|
+
* up in the shell is the remote path. A missing engine is reported as
|
|
20
|
+
* `@@RVS_NO_SOFFICE` (notice), not as a corrupt document.
|
|
21
|
+
*/
|
|
22
|
+
export declare function officeConvertCommand(path: string): string;
|
|
23
|
+
/** Fetch one remote file body through the streaming download route. */
|
|
24
|
+
export declare function fetchRemoteBytes(alias: string, path: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
25
|
+
export declare function BytePreview(props: {
|
|
26
|
+
alias: string;
|
|
27
|
+
path: string;
|
|
28
|
+
/** DSH session; lets the host workspaceFiles/officeKit remotes resolve the
|
|
29
|
+
* same remote workspace before the plugin's own download fallback. */
|
|
30
|
+
sessionId?: string;
|
|
31
|
+
kind: 'pdf' | 'office' | 'media';
|
|
32
|
+
revision: number;
|
|
33
|
+
t: (key: string) => string;
|
|
34
|
+
}): ReactNode;
|
|
35
|
+
export declare function SvgPreview(props: {
|
|
36
|
+
path: string;
|
|
37
|
+
text: string;
|
|
38
|
+
truncated: boolean;
|
|
39
|
+
t: (key: string) => string;
|
|
40
|
+
}): ReactNode;
|
|
41
|
+
export declare function TablePreview(props: {
|
|
42
|
+
path: string;
|
|
43
|
+
text: string;
|
|
44
|
+
truncated: boolean;
|
|
45
|
+
t: (key: string) => string;
|
|
46
|
+
}): ReactNode;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote document preview classification and table parsing.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions only (no React/DOM/fetch): the editor shell, the preview
|
|
5
|
+
* component and the gate all read the same classification, and CSV/TSV parsing
|
|
6
|
+
* can be tested in Node.
|
|
7
|
+
*/
|
|
8
|
+
export type PreviewKind = 'text' | 'image' | 'markdown' | 'html' | 'svg' | 'table' | 'pdf' | 'office' | 'media';
|
|
9
|
+
export declare function extensionOf(path: string): string;
|
|
10
|
+
export declare function previewKindOf(path: string): PreviewKind;
|
|
11
|
+
export declare function isBytePreview(kind: PreviewKind): kind is 'pdf' | 'office' | 'media';
|
|
12
|
+
export declare function hasTextSource(kind: PreviewKind): boolean;
|
|
13
|
+
export declare function previewKindLabel(kind: PreviewKind): string | undefined;
|
|
14
|
+
export declare function mediaTypeOf(path: string): {
|
|
15
|
+
kind: 'audio' | 'video';
|
|
16
|
+
mime: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
export declare function tableDelimiterOf(path: string): string;
|
|
19
|
+
export interface TableLimits {
|
|
20
|
+
maxRows: number;
|
|
21
|
+
maxColumns: number;
|
|
22
|
+
maxCells: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const DEFAULT_TABLE_LIMITS: TableLimits;
|
|
25
|
+
export interface TableData {
|
|
26
|
+
rows: string[][];
|
|
27
|
+
columns: number;
|
|
28
|
+
truncated: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** RFC 4180 parser with explicit row/column/cell bounds. */
|
|
31
|
+
export declare function parseDelimited(text: string, delimiter: string, limits?: TableLimits): TableData;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host Client-Remote access for document previews.
|
|
3
|
+
*
|
|
4
|
+
* The reference local-workbench implementation reads bytes through
|
|
5
|
+
* `remote.workspaceFiles.readBytes` and converts Office through
|
|
6
|
+
* `remote.officeKit.render`. dsh-remote-vs replaces the global `fs` with a
|
|
7
|
+
* transparent RouterFs, so those services can route a remote session's
|
|
8
|
+
* workspace; this module keeps them as SOFT services (ctx.get) and reports
|
|
9
|
+
* `unavailable` when a profile does not mount them.
|
|
10
|
+
*/
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
export type PreviewFailureReason = 'unavailable' | 'too-large' | 'not-found' | 'remote' | 'failed';
|
|
13
|
+
export type PreviewBytesResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
data: Uint8Array;
|
|
16
|
+
size: number;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
reason: PreviewFailureReason;
|
|
20
|
+
detail: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function installPreviewServices(ctx: Context): () => void;
|
|
23
|
+
export declare function readWorkspaceBytes(sessionId: string, path: string, signal?: AbortSignal): Promise<PreviewBytesResult>;
|
|
24
|
+
export declare function renderOfficePdf(sessionId: string, path: string, signal?: AbortSignal): Promise<PreviewBytesResult>;
|
|
@@ -32,6 +32,18 @@ export interface SaveShortcutEvent {
|
|
|
32
32
|
defaultPrevented: boolean;
|
|
33
33
|
target: EventTarget | null;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Areas where Ctrl+S belongs to somebody else.
|
|
37
|
+
*
|
|
38
|
+
* A terminal (xterm) forwards keys to the remote shell and a themed dialog's
|
|
39
|
+
* input is mid-edit; hijacking the key there would be a surprise, and for the
|
|
40
|
+
* shell it would also steal a control character (`^S`).
|
|
41
|
+
*
|
|
42
|
+
* Exported so the plugin's OTHER window-level shortcut (Ctrl+P in `RemoteRoot`)
|
|
43
|
+
* draws the same line instead of re-inventing a narrower one — it used to
|
|
44
|
+
* exclude only `.xterm` and hijacked the host's chat composer.
|
|
45
|
+
*/
|
|
46
|
+
export declare const FOREIGN_TARGET = ".xterm, textarea, input, [contenteditable=\"true\"]";
|
|
35
47
|
/**
|
|
36
48
|
* Is this the save shortcut this module should act on?
|
|
37
49
|
*
|
|
@@ -41,6 +53,15 @@ export interface SaveShortcutEvent {
|
|
|
41
53
|
export declare function isSaveShortcut(event: SaveShortcutEvent): boolean;
|
|
42
54
|
/** A registered save target: `undefined` = this surface has nothing to save. */
|
|
43
55
|
export type SaveShortcutResolver = () => (() => void) | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Is a modal layer (host approval / settings, our own dialog, an open menu) on
|
|
58
|
+
* screen right now?
|
|
59
|
+
*
|
|
60
|
+
* Called from the DOM listener entry points only: `isSaveShortcut` stays a pure
|
|
61
|
+
* predicate on the event. Without it Ctrl+S silently saved the remote file
|
|
62
|
+
* underneath a pending host approval dialog — a write the user never confirmed.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isModalLayerOpen(): boolean;
|
|
44
65
|
/**
|
|
45
66
|
* Install the window-level save shortcut for one surface.
|
|
46
67
|
*
|
|
@@ -14,9 +14,35 @@
|
|
|
14
14
|
* the gate (`@xterm/xterm`'s entry pulls CSS/UMD code).
|
|
15
15
|
*/
|
|
16
16
|
import type { ITheme } from '@xterm/xterm';
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The dark scheme palette.
|
|
19
|
+
*
|
|
20
|
+
* Contrast is measured against `background` (#0e0e13): the VS Code Dark+ ANSI
|
|
21
|
+
* set, with red / blue / magenta / brightBlack lifted just past 4.5:1 (`black`
|
|
22
|
+
* is left at #000000 on purpose — ANSI black is a background-fill colour by
|
|
23
|
+
* convention and is not read as text; 1.09:1). `brightCyan` is lifted off the
|
|
24
|
+
* plain cyan (#29b8db sat only ΔE76 6.0 from #11a8cd — the pair read as one
|
|
25
|
+
* colour) to #4dd0e1: ΔE76 18.5, 10.5:1 on the terminal surface.
|
|
26
|
+
*/
|
|
18
27
|
export declare const DARK_TERMINAL_THEME: ITheme;
|
|
19
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The light scheme palette.
|
|
30
|
+
*
|
|
31
|
+
* Re-taken for a WHITE background (2026-11-23): the Dark+ ANSI set this used to
|
|
32
|
+
* copy measured 1.0–3.6:1 on #ffffff (brightWhite was white-on-white = 1.00,
|
|
33
|
+
* brightYellow 1.17). Text here is targeted at ≥4.5:1, and every colour is.
|
|
34
|
+
*
|
|
35
|
+
* "Bright" cannot mean "lighter" on white, so the bright group is the more
|
|
36
|
+
* saturated sibling of its hue rather than a lighter one; where a hue had to be
|
|
37
|
+
* re-picked the normal/bright pair keeps a visible difference. `brightWhite` is
|
|
38
|
+
* the one colour that has no readable white-ish form: it is #767676, the
|
|
39
|
+
* lightest neutral of the ramp, which keeps "bright white" distinguishable from
|
|
40
|
+
* `white`/`brightBlack` while reaching 4.54:1 (VS Code Light+ ships #e5e5e5,
|
|
41
|
+
* 1.05:1 — unreadable). `black` stays #000000 (ANSI background-fill convention).
|
|
42
|
+
* `brightCyan` moves to the teal step #0f766e: the previous #0e7490 sat ΔE76
|
|
43
|
+
* 4.0 from `cyan` (#0b6d84) and read as the same colour; the new value is ΔE76
|
|
44
|
+
* 20.5 away at 5.47:1.
|
|
45
|
+
*/
|
|
20
46
|
export declare const LIGHT_TERMINAL_THEME: ITheme;
|
|
21
47
|
/** The palette for one scheme. */
|
|
22
48
|
export declare function terminalTheme(dark: boolean): ITheme;
|
package/lib/types/forward.d.ts
CHANGED
|
@@ -61,6 +61,18 @@ export declare class ForwardManager {
|
|
|
61
61
|
* first listener orphaned — unreachable from the panel and never closed.
|
|
62
62
|
*/
|
|
63
63
|
private readonly starting;
|
|
64
|
+
/**
|
|
65
|
+
* Rules stopped while their listener was still BINDING.
|
|
66
|
+
*
|
|
67
|
+
* A pending bind is not in `forwards` yet, so `stop()`, `stopAlias()`,
|
|
68
|
+
* `stopAll()` and `dispose()` used to see nothing to close: the listener the
|
|
69
|
+
* OS was about to hand out stayed bound with no panel row left to stop it
|
|
70
|
+
* (click a forward, immediately disable the plugin or delete the host, and
|
|
71
|
+
* `127.0.0.1:<port>` stayed taken until the Host restarted). The id sits here
|
|
72
|
+
* until the bind settles; a settling bind that finds its id records itself as
|
|
73
|
+
* stopped and closes the fresh listener instead of entering `forwards`.
|
|
74
|
+
*/
|
|
75
|
+
private readonly stoppedWhileBinding;
|
|
64
76
|
/** Set on unload so a bind that settles afterwards closes itself. */
|
|
65
77
|
private disposed;
|
|
66
78
|
constructor(deps: ForwardManagerDeps);
|
package/lib/types/fs-ops.d.ts
CHANGED
|
@@ -6,3 +6,45 @@ export declare function joinAbs(dir: string, name: string): string;
|
|
|
6
6
|
export declare function copyIntoCommand(from: string, intoDir: string, name?: string): string;
|
|
7
7
|
/** Move one path into a directory (`mv`), optionally under a new name. */
|
|
8
8
|
export declare function moveToCommand(from: string, intoDir: string, name?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Validate one removal target: absolute, no `..`, no control characters, and
|
|
11
|
+
* never the filesystem root.
|
|
12
|
+
*
|
|
13
|
+
* `assertAbsPath` legitimately accepts `/` (one character away from `rm -rf -- /`)
|
|
14
|
+
* and rewrites `\` to `/` for Windows-shaped input. A remote POSIX name may
|
|
15
|
+
* legitimately contain a literal backslash, and rewriting it would delete a
|
|
16
|
+
* DIFFERENT path, so removal validation keeps every character as-is and only
|
|
17
|
+
* rejects what cannot be deleted safely.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertRemovablePath(path: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Build the POSIX sh script that removes `paths`, in order.
|
|
22
|
+
*
|
|
23
|
+
* Each entry prints an indexed marker before and after its own `rm`, so the
|
|
24
|
+
* client can show which path is on the wire, count settled entries and retry
|
|
25
|
+
* exactly the ones that failed. The script ends with `exit 0` on purpose: one
|
|
26
|
+
* failed path is not a failed batch — the markers own the per-path truth (see
|
|
27
|
+
* `parseDeleteMarker`), and the caller falls back to the per-entry route for
|
|
28
|
+
* whatever they report as FAIL.
|
|
29
|
+
*/
|
|
30
|
+
export declare function batchRemoveScript(paths: string[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* Split one multi-selection into bounded batches, dropping duplicate paths.
|
|
33
|
+
*
|
|
34
|
+
* Order is preserved (markers are index-based within a batch); the inputs are
|
|
35
|
+
* validated here, before anything touches the remote, so an unquotable path
|
|
36
|
+
* rejects the whole delete instead of starting a half-executed batch.
|
|
37
|
+
*/
|
|
38
|
+
export declare function splitBatchRemovePaths(paths: string[]): string[][];
|
|
39
|
+
/**
|
|
40
|
+
* Parse one marker line printed by `batchRemoveScript`.
|
|
41
|
+
*
|
|
42
|
+
* Strict on purpose: remote `rm` diagnostics ("rm: cannot remove …") and a
|
|
43
|
+
* mangled marker must never be mistaken for a settled entry. The index is a
|
|
44
|
+
* plain non-negative integer (no sign, no decimal) because it indexes the
|
|
45
|
+
* batch's path list.
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseDeleteMarker(line: string): {
|
|
48
|
+
kind: 'item' | 'ok' | 'fail';
|
|
49
|
+
index: number;
|
|
50
|
+
} | undefined;
|
package/lib/types/git-ops.d.ts
CHANGED
|
@@ -137,6 +137,24 @@ export declare function commitPatchCommand(workdir: string, ref: string): string
|
|
|
137
137
|
export declare function commitFileDiffCommand(workdir: string, ref: string, paths: readonly string[]): string;
|
|
138
138
|
/** One file's content at a revision (`rev` may also be `:0` for the index). */
|
|
139
139
|
export declare function fileAtRevCommand(workdir: string, rev: string, path: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* One inclusive line window of `git blame` for a repo-relative file.
|
|
142
|
+
*
|
|
143
|
+
* The window is part of the command (not a post-filter): blame is one of the
|
|
144
|
+
* reads that can be very expensive on a large file, and the editor only ever
|
|
145
|
+
* needs the lines around the viewport. `--line-porcelain` repeats the commit
|
|
146
|
+
* header for every line, so the parser is stateless (see `blame-model.ts`).
|
|
147
|
+
*/
|
|
148
|
+
export declare function blameCommand(workdir: string, path: string, from: number, to: number): string;
|
|
149
|
+
/**
|
|
150
|
+
* Commits that touched one file, newest first, with rename following.
|
|
151
|
+
*
|
|
152
|
+
* `--follow` works only for a single path; the format matches `parseLog`, so
|
|
153
|
+
* the existing history row type is reused without a second parser.
|
|
154
|
+
*/
|
|
155
|
+
export declare function fileHistoryCommand(workdir: string, path: string, max?: number): string;
|
|
156
|
+
/** One commit's header fields, even when it is older than the log window. */
|
|
157
|
+
export declare function commitMetaCommand(workdir: string, ref: string): string;
|
|
140
158
|
/** Local + remote-tracking branches with their upstream and tip. */
|
|
141
159
|
export declare function allBranchesCommand(workdir: string): string;
|
|
142
160
|
/** Every configured remote with its URLs. */
|
package/lib/types/http.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export declare function readJsonBody(req: IncomingMessage, opts?: {
|
|
|
44
44
|
maxBytes?: number;
|
|
45
45
|
objectOnly?: boolean;
|
|
46
46
|
}): Promise<unknown | null>;
|
|
47
|
+
/** Declare which host the response being written concerns (`null` = no host). */
|
|
48
|
+
export declare function scopeHostNotices(res: ServerResponse, alias: string | null): void;
|
|
47
49
|
/** Write one JSON response. */
|
|
48
50
|
export declare function writeJson(res: ServerResponse, status: number, body: unknown, headers?: OutgoingHttpHeaders): void;
|
|
49
51
|
/**
|
package/lib/types/keygen.d.ts
CHANGED
|
@@ -7,6 +7,15 @@ export interface BootstrapResult {
|
|
|
7
7
|
flipped: boolean;
|
|
8
8
|
detail: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Normalize one `.pub` line to `ssh-ed25519 <base64> dsh-remote-vs/<alias>`.
|
|
12
|
+
*
|
|
13
|
+
* Throws when the line is not a well-formed ed25519 public key, so the caller
|
|
14
|
+
* sees a clear "this file is not a key" error instead of a remote login that
|
|
15
|
+
* fails later. The returned text is the only form that may enter the shell
|
|
16
|
+
* command: its comment is ours, and both remaining fields are shell-inert.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatPublicKey(raw: string, alias: string): string;
|
|
10
19
|
/** Ensure the managed keypair exists; return the private key path. */
|
|
11
20
|
export declare function ensureKeypair(alias: string, dir?: string): Promise<{
|
|
12
21
|
privatePath: string;
|