@fish-under-sea/dsh-ssh-fish 2.2.3 → 2.3.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 +4 -4
- package/README.md +4 -4
- package/package.json +1 -1
- package/README.i18n.yaml +0 -6
- package/README.zh.md +0 -31
- package/lib/client.js +0 -17100
- package/lib/client.js.map +0 -1
- package/lib/index.js +0 -3625
- package/lib/types/client/api.d.ts +0 -162
- package/lib/types/client/index.d.ts +0 -37
- package/lib/types/client/locales.d.ts +0 -175
- package/lib/types/client/native-panel.d.ts +0 -70
- package/lib/types/client/panel/ClusterTab.d.ts +0 -7
- package/lib/types/client/panel/HostFormDialog.d.ts +0 -12
- package/lib/types/client/panel/HostsTab.d.ts +0 -25
- package/lib/types/client/panel/SshPanel.d.ts +0 -14
- package/lib/types/client/panel/TerminalTab.d.ts +0 -27
- package/lib/types/client/panel/TransferTab.d.ts +0 -7
- package/lib/types/client/panel/TunnelsTab.d.ts +0 -19
- package/lib/types/client/panel/controller.d.ts +0 -253
- package/lib/types/client/panel/helpers.d.ts +0 -45
- package/lib/types/client/panel/xterm.css.d.ts +0 -2
- package/lib/types/client/settings-binding.d.ts +0 -61
- package/lib/types/dsh-home.d.ts +0 -16
- package/lib/types/engine/cluster.d.ts +0 -19
- package/lib/types/engine/connection-pool.d.ts +0 -163
- package/lib/types/engine/proxy-command.d.ts +0 -36
- package/lib/types/engine/pty.d.ts +0 -32
- package/lib/types/engine/sftp.d.ts +0 -20
- package/lib/types/engine/terminal-sessions.d.ts +0 -67
- package/lib/types/engine/tunnel.d.ts +0 -36
- package/lib/types/engine.d.ts +0 -96
- package/lib/types/http.d.ts +0 -59
- package/lib/types/index.d.ts +0 -93
- package/lib/types/loopback.d.ts +0 -64
- package/lib/types/mount-once.d.ts +0 -55
- package/lib/types/protocol.d.ts +0 -256
- package/lib/types/routes.d.ts +0 -33
- package/lib/types/ssh-config.d.ts +0 -34
- package/lib/types/store.d.ts +0 -78
- package/lib/types/tool-surface.d.ts +0 -72
- package/lib/types/tools.d.ts +0 -43
package/lib/types/protocol.d.ts
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire contract between the host half (routes.ts) and the browser half
|
|
3
|
-
* (client/api.ts). Pure types only — imported by both halves, bundled into
|
|
4
|
-
* each, no runtime identity to share.
|
|
5
|
-
*/
|
|
6
|
-
/** Authentication flavors a host entry may carry. */
|
|
7
|
-
export type SshAuthKind = 'key' | 'password' | 'agent';
|
|
8
|
-
/** One stored host entry (the $DSH_HOME/dsh-ssh.json store shape). */
|
|
9
|
-
export interface SshHostEntry {
|
|
10
|
-
/** Stable, user-chosen identifier used by every operation. */
|
|
11
|
-
alias: string;
|
|
12
|
-
/** Hostname or IP of the target. */
|
|
13
|
-
host: string;
|
|
14
|
-
/** SSH port (default 22). */
|
|
15
|
-
port: number;
|
|
16
|
-
/** Login user. */
|
|
17
|
-
user: string;
|
|
18
|
-
/** Authentication. */
|
|
19
|
-
auth: {
|
|
20
|
-
kind: SshAuthKind;
|
|
21
|
-
/** Absolute path to the private key for 'key' auth. */
|
|
22
|
-
keyPath?: string;
|
|
23
|
-
/** Passphrase for an encrypted key. */
|
|
24
|
-
passphrase?: string;
|
|
25
|
-
/** Password for 'password' auth. */
|
|
26
|
-
password?: string;
|
|
27
|
-
/**
|
|
28
|
-
* ssh-agent endpoint for 'agent' auth. A socket path, the special value
|
|
29
|
-
* 'pageant' (PuTTY Pageant on Windows), or undefined for auto-detect
|
|
30
|
-
* (SSH_AUTH_SOCK, then the native OpenSSH named pipe on Windows).
|
|
31
|
-
*/
|
|
32
|
-
agentPath?: string;
|
|
33
|
-
};
|
|
34
|
-
/** Jump chain: local aliases connected through in order (ProxyJump). */
|
|
35
|
-
proxyJump: string[];
|
|
36
|
-
/**
|
|
37
|
-
* OpenSSH-compatible ProxyCommand: a shell command whose stdio becomes the
|
|
38
|
-
* connection transport. Tokens %h (host) / %p (port) / %r (user) / %n (alias)
|
|
39
|
-
* expand before exec and %% is a literal percent; an empty value or 'none'
|
|
40
|
-
* means "no proxy command". Mutually exclusive with a non-empty proxyJump.
|
|
41
|
-
*/
|
|
42
|
-
proxyCommand?: string;
|
|
43
|
-
/** Free-form note. */
|
|
44
|
-
description?: string;
|
|
45
|
-
/** Deployment environment label (development / production / ...). */
|
|
46
|
-
environment?: string;
|
|
47
|
-
/** Free-form tags. */
|
|
48
|
-
tags: string[];
|
|
49
|
-
/** Physical location note. */
|
|
50
|
-
location?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Opt-in ssh-agent forwarding (OpenSSH ForwardAgent / ssh -A): the host's
|
|
53
|
-
* sessions request agent forwarding so the remote can sign with this
|
|
54
|
-
* machine's agent. Default off; stored only when enabled.
|
|
55
|
-
*/
|
|
56
|
-
forwardAgent?: boolean;
|
|
57
|
-
createdAt: number;
|
|
58
|
-
updatedAt: number;
|
|
59
|
-
}
|
|
60
|
-
/** Public (secret-free) projection of an entry, safe for the browser/agent. */
|
|
61
|
-
export interface SshHostSummary {
|
|
62
|
-
alias: string;
|
|
63
|
-
host: string;
|
|
64
|
-
port: number;
|
|
65
|
-
user: string;
|
|
66
|
-
auth: SshAuthKind;
|
|
67
|
-
/** Whether the key path exists on the host machine (key auth only). */
|
|
68
|
-
keyReady: boolean;
|
|
69
|
-
proxyJump: string[];
|
|
70
|
-
/** Configured ProxyCommand, echoed to the browser so the form can edit it. */
|
|
71
|
-
proxyCommand?: string;
|
|
72
|
-
description?: string;
|
|
73
|
-
environment?: string;
|
|
74
|
-
tags: string[];
|
|
75
|
-
location?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Whether agent forwarding is enabled. Always projected as a definite
|
|
78
|
-
* boolean: the browser and the tool bridge need a value even for entries
|
|
79
|
-
* stored before the feature existed.
|
|
80
|
-
*/
|
|
81
|
-
forwardAgent: boolean;
|
|
82
|
-
createdAt: number;
|
|
83
|
-
updatedAt: number;
|
|
84
|
-
}
|
|
85
|
-
/** Result of one non-interactive command execution. */
|
|
86
|
-
export interface ExecResult {
|
|
87
|
-
success: boolean;
|
|
88
|
-
/** Remote exit code, or null when the channel died without one. */
|
|
89
|
-
exitCode: number | null;
|
|
90
|
-
timedOut: boolean;
|
|
91
|
-
stdout: string;
|
|
92
|
-
stderr: string;
|
|
93
|
-
/** Wall-clock duration of the round trip in ms. */
|
|
94
|
-
durationMs: number;
|
|
95
|
-
/** Connection error message when the command never ran. */
|
|
96
|
-
error?: string;
|
|
97
|
-
}
|
|
98
|
-
/** One server entry in a cluster run. */
|
|
99
|
-
export interface ClusterResult {
|
|
100
|
-
alias: string;
|
|
101
|
-
ok: boolean;
|
|
102
|
-
exitCode?: number | null;
|
|
103
|
-
timedOut?: boolean;
|
|
104
|
-
stdout?: string;
|
|
105
|
-
stderr?: string;
|
|
106
|
-
durationMs?: number;
|
|
107
|
-
error?: string;
|
|
108
|
-
}
|
|
109
|
-
/** SFTP transfer progress frame (upload stream). */
|
|
110
|
-
export interface TransferProgress {
|
|
111
|
-
phase: 'connecting' | 'transferring' | 'done' | 'error';
|
|
112
|
-
file: string;
|
|
113
|
-
transferred: number;
|
|
114
|
-
total: number;
|
|
115
|
-
percent: number;
|
|
116
|
-
speedBps?: number;
|
|
117
|
-
error?: string;
|
|
118
|
-
}
|
|
119
|
-
/** One active local port-forward tunnel. */
|
|
120
|
-
export interface TunnelInfo {
|
|
121
|
-
id: string;
|
|
122
|
-
alias: string;
|
|
123
|
-
localPort: number;
|
|
124
|
-
remoteHost: string;
|
|
125
|
-
remotePort: number;
|
|
126
|
-
state: 'forwarding' | 'connecting' | 'failed';
|
|
127
|
-
error?: string;
|
|
128
|
-
startedAt: number;
|
|
129
|
-
}
|
|
130
|
-
/** One directory listing entry (remote file browser). */
|
|
131
|
-
export interface RemoteDirEntry {
|
|
132
|
-
name: string;
|
|
133
|
-
type: 'dir' | 'file' | 'other';
|
|
134
|
-
size: number;
|
|
135
|
-
mtimeMs: number;
|
|
136
|
-
mode?: number;
|
|
137
|
-
}
|
|
138
|
-
/** Test-connection outcome. */
|
|
139
|
-
export interface TestResult {
|
|
140
|
-
ok: boolean;
|
|
141
|
-
latencyMs?: number;
|
|
142
|
-
error?: string;
|
|
143
|
-
}
|
|
144
|
-
/** Host edit payload (create/update); 'alias' comes from the URL for updates. */
|
|
145
|
-
export interface HostPayload {
|
|
146
|
-
alias?: string;
|
|
147
|
-
host: string;
|
|
148
|
-
port?: number;
|
|
149
|
-
user: string;
|
|
150
|
-
/**
|
|
151
|
-
* Authentication. Required on create; on update an omitted auth keeps the
|
|
152
|
-
* stored secrets (the browser never receives them back).
|
|
153
|
-
*/
|
|
154
|
-
auth?: SshHostEntry['auth'];
|
|
155
|
-
proxyJump?: string[];
|
|
156
|
-
/**
|
|
157
|
-
* ProxyCommand to store. An empty string or 'none' clears a stored value;
|
|
158
|
-
* omitting the key leaves it untouched (PATCH semantics).
|
|
159
|
-
*/
|
|
160
|
-
proxyCommand?: string;
|
|
161
|
-
description?: string;
|
|
162
|
-
environment?: string;
|
|
163
|
-
tags?: string[];
|
|
164
|
-
location?: string;
|
|
165
|
-
/**
|
|
166
|
-
* Agent forwarding for this host. Omitted on update keeps the stored value;
|
|
167
|
-
* false clears it (PATCH semantics).
|
|
168
|
-
*/
|
|
169
|
-
forwardAgent?: boolean;
|
|
170
|
-
}
|
|
171
|
-
/** Why one ssh_config Host block was not imported. */
|
|
172
|
-
export type ImportSkipReason = 'wildcard' | 'existing' | 'match' | 'invalid';
|
|
173
|
-
/** One skipped ssh_config block and the reason it could not be imported. */
|
|
174
|
-
export interface ImportSkipBlock {
|
|
175
|
-
/** Host pattern (or '`Match …`' label) that was skipped. */
|
|
176
|
-
name: string;
|
|
177
|
-
reason: ImportSkipReason;
|
|
178
|
-
}
|
|
179
|
-
/** Import outcome from ~/.ssh/config. */
|
|
180
|
-
export interface ImportResult {
|
|
181
|
-
parsed: number;
|
|
182
|
-
added: number;
|
|
183
|
-
skipped: number;
|
|
184
|
-
/** Every skipped block with its reason, in scan order and deduplicated by name. */
|
|
185
|
-
skippedBlocks: ImportSkipBlock[];
|
|
186
|
-
}
|
|
187
|
-
/** JSON error body used by every route. */
|
|
188
|
-
export interface ApiErrorBody {
|
|
189
|
-
error: string;
|
|
190
|
-
}
|
|
191
|
-
/** WebSocket terminal protocol frames (host -> client and client -> host). */
|
|
192
|
-
export type TerminalServerFrame =
|
|
193
|
-
/** The shell is up; `sessionId` reattaches to it after a view detach. */
|
|
194
|
-
{
|
|
195
|
-
type: 'ready';
|
|
196
|
-
alias: string;
|
|
197
|
-
sessionId: string;
|
|
198
|
-
} | {
|
|
199
|
-
type: 'output';
|
|
200
|
-
data: string;
|
|
201
|
-
} | {
|
|
202
|
-
type: 'exit';
|
|
203
|
-
code: number | null;
|
|
204
|
-
error?: string;
|
|
205
|
-
} | {
|
|
206
|
-
type: 'auth_prompt';
|
|
207
|
-
name: string;
|
|
208
|
-
instructions: string;
|
|
209
|
-
prompts: Array<{
|
|
210
|
-
prompt: string;
|
|
211
|
-
echo: boolean;
|
|
212
|
-
}>;
|
|
213
|
-
};
|
|
214
|
-
export type TerminalClientFrame = {
|
|
215
|
-
type: 'input';
|
|
216
|
-
data: string;
|
|
217
|
-
} | {
|
|
218
|
-
type: 'resize';
|
|
219
|
-
cols: number;
|
|
220
|
-
rows: number;
|
|
221
|
-
} | {
|
|
222
|
-
type: 'auth_response';
|
|
223
|
-
responses: string[];
|
|
224
|
-
}
|
|
225
|
-
/** Leave the socket while the host keeps the shell alive for a reattach. */
|
|
226
|
-
| {
|
|
227
|
-
type: 'detach';
|
|
228
|
-
}
|
|
229
|
-
/** End the session outright (the view's disconnect control). */
|
|
230
|
-
| {
|
|
231
|
-
type: 'close';
|
|
232
|
-
};
|
|
233
|
-
/** Route paths the client calls (shared literals). */
|
|
234
|
-
export declare const SSH_API_BASE: "/api/dsh-ssh";
|
|
235
|
-
export declare const SSH_API: {
|
|
236
|
-
readonly hosts: string;
|
|
237
|
-
readonly importSshConfig: string;
|
|
238
|
-
readonly test: string;
|
|
239
|
-
readonly exec: string;
|
|
240
|
-
readonly cluster: string;
|
|
241
|
-
readonly upload: string;
|
|
242
|
-
readonly download: string;
|
|
243
|
-
readonly ls: string;
|
|
244
|
-
readonly tunnel: string;
|
|
245
|
-
readonly terminal: string;
|
|
246
|
-
};
|
|
247
|
-
/** NDJSON transfer stream line shapes (upload). */
|
|
248
|
-
export type TransferStreamLine = {
|
|
249
|
-
type: 'progress';
|
|
250
|
-
progress: TransferProgress;
|
|
251
|
-
} | {
|
|
252
|
-
type: 'result';
|
|
253
|
-
ok: boolean;
|
|
254
|
-
transferredBytes?: number;
|
|
255
|
-
error?: string;
|
|
256
|
-
};
|
package/lib/types/routes.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The /api/dsh-ssh route family: host CRUD, exec, cluster, SFTP transfer
|
|
3
|
-
* (NDJSON progress stream for uploads, binary stream for downloads), remote
|
|
4
|
-
* listing, tunnels, and the WebSocket PTY terminal upgrade. Every route
|
|
5
|
-
* carries a loopback-only trust fence (plus browser same-origin markers) —
|
|
6
|
-
* these endpoints execute commands on remote servers, so LAN-exposed dsh web
|
|
7
|
-
* deployments must not serve them.
|
|
8
|
-
*/
|
|
9
|
-
import type { WebRoute, WebUpgradeRoute } from '@deepseek-ai/dsh-host-webserver';
|
|
10
|
-
import type { SshEngine } from './engine.ts';
|
|
11
|
-
import { TerminalSessionRegistry } from './engine/terminal-sessions.ts';
|
|
12
|
-
import type { HostStore } from './store.ts';
|
|
13
|
-
/** Route family dependencies. */
|
|
14
|
-
export interface SshRoutesDeps {
|
|
15
|
-
/** The host store (CRUD). */
|
|
16
|
-
store: HostStore;
|
|
17
|
-
/** The engine (ops). */
|
|
18
|
-
engine: SshEngine;
|
|
19
|
-
/** Temp dir for upload/download staging (tests inject a sandbox). */
|
|
20
|
-
stagingDir?: string;
|
|
21
|
-
/** Upload byte cap override (tests); defaults to MAX_UPLOAD_BYTES. */
|
|
22
|
-
maxUploadBytes?: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Build every /api/dsh-ssh route (exact paths) plus the terminal upgrade.
|
|
26
|
-
* @param deps - store, engine, staging dir.
|
|
27
|
-
* @returns routes and the upgrade route.
|
|
28
|
-
*/
|
|
29
|
-
export declare function makeRoutes(deps: SshRoutesDeps): {
|
|
30
|
-
routes: WebRoute[];
|
|
31
|
-
upgrade: WebUpgradeRoute;
|
|
32
|
-
terminalSessions: TerminalSessionRegistry;
|
|
33
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal `~/.ssh/config` reader for the one-shot host import: Host blocks with
|
|
3
|
-
* `Include` expansion and explicit skip reasons. Values stay raw strings; the
|
|
4
|
-
* store maps them onto a HostPayload.
|
|
5
|
-
*
|
|
6
|
-
* Deliberate simplifications (documented in the package README):
|
|
7
|
-
* - `Match` blocks are skipped — their options are conditional and must never
|
|
8
|
-
* merge into the Host block above them.
|
|
9
|
-
* - A multi-pattern `Host a b` line only exposes its first pattern.
|
|
10
|
-
* - Include pathnames accept `~`, globs, and several whitespace-separated
|
|
11
|
-
* pathnames, but not environment variables, `%` tokens, or quoting.
|
|
12
|
-
* - Relative Include pathnames resolve against the directory of the config
|
|
13
|
-
* file the import started from (OpenSSH: `~/.ssh` for a user config).
|
|
14
|
-
* - A file that already contributed lines is never read twice, which doubles
|
|
15
|
-
* as the Include cycle guard.
|
|
16
|
-
*/
|
|
17
|
-
import type { ImportSkipBlock } from './protocol.ts';
|
|
18
|
-
/** One parsed Host block. */
|
|
19
|
-
export interface SshBlock {
|
|
20
|
-
/** Raw Host line value (may hold several whitespace-separated patterns). */
|
|
21
|
-
pattern: string;
|
|
22
|
-
/** Lowercased option key/value pairs; the last occurrence of a key wins. */
|
|
23
|
-
props: Record<string, string>;
|
|
24
|
-
}
|
|
25
|
-
/** One config file read, with every Include expanded in place. */
|
|
26
|
-
export interface SshConfigRead {
|
|
27
|
-
blocks: SshBlock[];
|
|
28
|
-
skipped: ImportSkipBlock[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Parse one ssh_config file (Include expanded) into Host blocks plus the
|
|
32
|
-
* `Match` blocks that were deliberately skipped.
|
|
33
|
-
*/
|
|
34
|
-
export declare function readSshConfigBlocks(configPath: string): SshConfigRead;
|
package/lib/types/store.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host config store: one JSON file (`$DSH_HOME/dsh-ssh.json`, defaulting
|
|
3
|
-
* to `~/.dsh`) holding every
|
|
4
|
-
* SSH host entry, written atomically (tmp + rename). Also parses the user's
|
|
5
|
-
* standard `~/.ssh/config` for one-shot import. Secrets (passwords,
|
|
6
|
-
* passphrases) live in this user-owned file in plaintext — same trust model
|
|
7
|
-
* as ssh-skill's annotated ssh-config comments; document it, never log it.
|
|
8
|
-
*/
|
|
9
|
-
import type { HostPayload, ImportResult, SshHostEntry, SshHostSummary } from './protocol.ts';
|
|
10
|
-
/** Store file location: $DSH_HOME/dsh-ssh.json (defaults to ~/.dsh). */
|
|
11
|
-
export declare function storePath(): string;
|
|
12
|
-
/** The user's standard OpenSSH config path. */
|
|
13
|
-
export declare function sshConfigPath(): string;
|
|
14
|
-
/** Validate the wire shape of a host payload; returns a message or undefined. */
|
|
15
|
-
export declare function validateHostPayload(payload: unknown): string | undefined;
|
|
16
|
-
/** Validate an alias for creation. */
|
|
17
|
-
export declare function validateAlias(alias: string): string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* The host store. Pure file I/O — no cordis dependency, unit-testable.
|
|
20
|
-
*/
|
|
21
|
-
export declare class HostStore {
|
|
22
|
-
/** The JSON file path. */
|
|
23
|
-
readonly path: string;
|
|
24
|
-
/** Optional override of the ~/.ssh/config path (tests). */
|
|
25
|
-
private readonly sshConfigOverride;
|
|
26
|
-
/**
|
|
27
|
-
* @param path - store file path (defaults to the standard location).
|
|
28
|
-
* @param sshConfigOverride - ssh config path override (tests only).
|
|
29
|
-
*/
|
|
30
|
-
constructor(path?: string, sshConfigOverride?: string);
|
|
31
|
-
/** Load all entries (empty store when the file is absent). */
|
|
32
|
-
list(): SshHostEntry[];
|
|
33
|
-
/** Find one entry by alias. */
|
|
34
|
-
find(alias: string): SshHostEntry | undefined;
|
|
35
|
-
/** Secret-free projection for the browser and agent surfaces. */
|
|
36
|
-
summarize(entry: SshHostEntry): SshHostSummary;
|
|
37
|
-
/** Create one entry. Throws on alias collision or invalid payload. */
|
|
38
|
-
create(payload: HostPayload): SshHostEntry;
|
|
39
|
-
/** Update the fields present in `patch`; unknown aliases throw. */
|
|
40
|
-
update(alias: string, patch: Partial<HostPayload>): SshHostEntry;
|
|
41
|
-
/** Remove one entry. */
|
|
42
|
-
delete(alias: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Import hosts from `~/.ssh/config`: Host blocks with a single non-wildcard
|
|
45
|
-
* pattern become entries (a missing HostName falls back to the pattern
|
|
46
|
-
* itself; key auth via IdentityFile; jump hosts via ProxyJump; ProxyCommand
|
|
47
|
-
* kept verbatim). `Include` files are expanded, and `Match` blocks,
|
|
48
|
-
* wildcard patterns, and aliases that already exist are skipped with a
|
|
49
|
-
* reason instead of silently disappearing.
|
|
50
|
-
* @returns import statistics.
|
|
51
|
-
*/
|
|
52
|
-
importFromSshConfig(): ImportResult;
|
|
53
|
-
private skippedBlocks;
|
|
54
|
-
/**
|
|
55
|
-
* Last parsed store keyed by file identity. list/find ride every acquire
|
|
56
|
-
* and GUI refresh; re-reading and re-parsing the whole file each call is
|
|
57
|
-
* wasted work when the file has not changed. Any save invalidates.
|
|
58
|
-
*/
|
|
59
|
-
private cache;
|
|
60
|
-
private load;
|
|
61
|
-
private save;
|
|
62
|
-
}
|
|
63
|
-
/** Normalize an agent endpoint for storage: trim, expand `~`, and resolve the SSH_AUTH_SOCK token. */
|
|
64
|
-
export declare function normalizeAgentPath(agentPath: string | undefined): string | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* Normalize a ProxyCommand for storage: trim, and treat an empty value or
|
|
67
|
-
* OpenSSH's `none` keyword as "no proxy command" (an explicit clear).
|
|
68
|
-
*/
|
|
69
|
-
export declare function normalizeProxyCommand(raw: string | undefined): string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Read an ssh_config `ForwardAgent` value into the stored boolean flag. Only
|
|
72
|
-
* an explicit yes/true/on enables forwarding; an absent value, no/false/off,
|
|
73
|
-
* and anything unrecognized leave it off instead of failing the import — an
|
|
74
|
-
* unknown keyword must never cost the user the whole Host block.
|
|
75
|
-
*/
|
|
76
|
-
export declare function parseForwardAgentValue(raw: string | undefined): boolean;
|
|
77
|
-
/** Expand a leading `~` in a filesystem path. */
|
|
78
|
-
export declare function expandHome(path: string): string;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Family-shared tool-surface conventions for the packages that register
|
|
3
|
-
* model-facing tools.
|
|
4
|
-
*
|
|
5
|
-
* One home for the prompt-section placement and the visibility gate this
|
|
6
|
-
* family previously restated per package.
|
|
7
|
-
*
|
|
8
|
-
* Modelled on the official tool packages:
|
|
9
|
-
* - `@deepseek-ai/dsh-tool-subagent` renders its section through
|
|
10
|
-
* `tools.get(name, context.scope) === undefined ? '' : text`, so guidance
|
|
11
|
-
* disappears together with a restricted tool.
|
|
12
|
-
* - 21 of the 22 official tool packages register their tools GLOBALLY and gate
|
|
13
|
-
* them with a setting, not per agent. Only the Agent Teams tool package —
|
|
14
|
-
* whose tools belong to one membership — installs into each `agent.ctx`.
|
|
15
|
-
* This family follows the majority: registration stays global so the
|
|
16
|
-
* registry's per-scope `restrict()` mask (which filters inherited global
|
|
17
|
-
* tools and REJECTS scope-local names) can still withhold these tools.
|
|
18
|
-
*
|
|
19
|
-
* Structural types only: this copy lands in packages that do not all depend on
|
|
20
|
-
* the same SDK service packages.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Prompt-section order for each package's tool guidance.
|
|
24
|
-
*
|
|
25
|
-
* These sit in the family band between the deployment persona and the SDK's
|
|
26
|
-
* `PLAN_POLICY` (500). Values are owned here rather than written per package so
|
|
27
|
-
* the host plugins whose guidance shares one prompt cannot drift into an
|
|
28
|
-
* accidental tie.
|
|
29
|
-
*/
|
|
30
|
-
export declare const PLUGIN_TOOL_SECTION_ORDERS: {
|
|
31
|
-
readonly ssh: 150;
|
|
32
|
-
readonly 'task-board': 200;
|
|
33
|
-
readonly agents: 220;
|
|
34
|
-
};
|
|
35
|
-
/** One plugin id keyed by {@link PLUGIN_TOOL_SECTION_ORDERS}. */
|
|
36
|
-
export type PluginToolSectionId = keyof typeof PLUGIN_TOOL_SECTION_ORDERS;
|
|
37
|
-
/**
|
|
38
|
-
* Order of an external provider extension's own guidance section, right after
|
|
39
|
-
* the band of the plugin it extends.
|
|
40
|
-
*
|
|
41
|
-
* An extension names itself, not the plugin it plugs into, so its order stays
|
|
42
|
-
* out of {@link PLUGIN_TOOL_SECTION_ORDERS}: every package's copy of this module
|
|
43
|
-
* then carries no provider id. The slot still has one owner and cannot collide
|
|
44
|
-
* with a host plugin's band.
|
|
45
|
-
*/
|
|
46
|
-
export declare const EXTENSION_TOOL_SECTION_ORDER = 210;
|
|
47
|
-
/**
|
|
48
|
-
* The scoped tool lookup a section provider needs: the registry read for one
|
|
49
|
-
* assembly's scope. Matches `ctx.tools.get(name, scope)`.
|
|
50
|
-
*/
|
|
51
|
-
export interface ScopedToolLookup {
|
|
52
|
-
get(name: string, scope?: unknown): unknown;
|
|
53
|
-
}
|
|
54
|
-
/** One assembly context carrying the scope the section is rendered for. */
|
|
55
|
-
export interface SectionScopeContext {
|
|
56
|
-
scope?: unknown;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Build a section provider that renders \`text\` only while at least one of
|
|
60
|
-
* \`toolNames\` is visible to the rendering scope.
|
|
61
|
-
*
|
|
62
|
-
* The native convention: a tool that a restriction, a preset, or a missing
|
|
63
|
-
* registry removed must not leave guidance behind telling the model to call it.
|
|
64
|
-
* An unreadable registry renders the text unchanged — guidance that outlives a
|
|
65
|
-
* momentary read failure is recoverable; guidance for a tool that is gone is
|
|
66
|
-
* not.
|
|
67
|
-
* @param tools - the scoped tool registry, when the deployment serves one.
|
|
68
|
-
* @param toolNames - registered names the guidance describes.
|
|
69
|
-
* @param text - the guidance rendered while they are reachable.
|
|
70
|
-
* @returns the section text provider.
|
|
71
|
-
*/
|
|
72
|
-
export declare function visibleToolText(tools: ScopedToolLookup | undefined, toolNames: readonly string[], text: string): (context: SectionScopeContext) => string;
|
package/lib/types/tools.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent tools: the DSH-native counterpart of ssh-skill's CLI. Every tool
|
|
3
|
-
* talks to the same engine the web UI uses, so a host configured in the GUI
|
|
4
|
-
* is immediately operable by any agent, and vice versa.
|
|
5
|
-
*/
|
|
6
|
-
import type { SshEngine } from './engine.ts';
|
|
7
|
-
import type { SshAuthKind, SshHostSummary } from './protocol.ts';
|
|
8
|
-
/**
|
|
9
|
-
* One host row for the agent surface. The ProxyCommand STRING is deliberately
|
|
10
|
-
* projected to a boolean: the command may embed credentials for a bastion
|
|
11
|
-
* client, and the model only needs to know that the host goes through one.
|
|
12
|
-
*/
|
|
13
|
-
export interface AgentHostRow {
|
|
14
|
-
alias: string;
|
|
15
|
-
host: string;
|
|
16
|
-
port: number;
|
|
17
|
-
user: string;
|
|
18
|
-
auth: SshAuthKind;
|
|
19
|
-
keyReady: boolean;
|
|
20
|
-
proxyJump: string[];
|
|
21
|
-
proxyCommandConfigured: boolean;
|
|
22
|
-
forwardAgent: boolean;
|
|
23
|
-
description?: string;
|
|
24
|
-
environment?: string;
|
|
25
|
-
tags: string[];
|
|
26
|
-
location?: string;
|
|
27
|
-
createdAt: number;
|
|
28
|
-
updatedAt: number;
|
|
29
|
-
}
|
|
30
|
-
/** Project one summary onto the agent-facing row shape. */
|
|
31
|
-
export declare function toAgentHostRow(host: SshHostSummary): AgentHostRow;
|
|
32
|
-
/** The host-list tool. */
|
|
33
|
-
export declare function sshListTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
34
|
-
/** The command-execution tool. */
|
|
35
|
-
export declare function sshExecTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
36
|
-
/** The upload tool. */
|
|
37
|
-
export declare function sshUploadTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
38
|
-
/** The download tool. */
|
|
39
|
-
export declare function sshDownloadTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
40
|
-
/** The tunnel tool. */
|
|
41
|
-
export declare function sshTunnelTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
42
|
-
/** The cluster tool. */
|
|
43
|
-
export declare function sshClusterTool(engine: SshEngine): import("@deepseek-ai/dsh-tools").ToolDefinition;
|