@deepseek-ai/dsh-ssh 0.1.6-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +104 -0
- package/README.zh.md +104 -0
- package/lib/helper.js +826 -0
- package/lib/index.js +359 -0
- package/lib/protocol-C43fD--H.js +276 -0
- package/lib/protocol.js +2 -0
- package/lib/schemas-DBIgsx0q.js +177 -0
- package/lib/schemas.js +2 -0
- package/lib/stream-security-DJlQsPG-.js +75 -0
- package/lib/types/helper-entry.d.ts +2 -0
- package/lib/types/helper-processes.d.ts +79 -0
- package/lib/types/helper.d.ts +18 -0
- package/lib/types/index.d.ts +93 -0
- package/lib/types/protocol.d.ts +50 -0
- package/lib/types/schemas.d.ts +203 -0
- package/lib/types/stream-security.d.ts +19 -0
- package/package.json +83 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/** Strict JSON validation for SSH helper requests and remote observations. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { Branded } from '@deepseek-ai/dsh-brand';
|
|
4
|
+
/** Identity of one prepared or running process in its owning SSH helper. */
|
|
5
|
+
export type SshProcessId = Branded<'SshProcessId'>;
|
|
6
|
+
/** Identity of one open text iterator in its owning SSH helper. */
|
|
7
|
+
export type SshTextStreamId = Branded<'SshTextStreamId'>;
|
|
8
|
+
/** Admit a process identity from the private helper protocol. */
|
|
9
|
+
export declare const processIdSchema: z.ZodPipe<z.ZodUUID, z.ZodTransform<SshProcessId, string>>;
|
|
10
|
+
/** Admit a text iterator identity from the private helper protocol. */
|
|
11
|
+
export declare const textStreamIdSchema: z.ZodPipe<z.ZodUUID, z.ZodTransform<SshTextStreamId, string>>;
|
|
12
|
+
/** A remote POSIX absolute path; spelling is preserved until remote canonicalization. */
|
|
13
|
+
export declare const remotePath: z.ZodString;
|
|
14
|
+
/** Filesystem identity returned by the remote filesystem provider. */
|
|
15
|
+
export declare const targetSchema: z.ZodObject<{
|
|
16
|
+
targetKey: z.ZodString;
|
|
17
|
+
displayPath: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
/** Remote metadata observation. */
|
|
20
|
+
export declare const infoSchema: z.ZodObject<{
|
|
21
|
+
version: z.ZodString;
|
|
22
|
+
type: z.ZodEnum<{
|
|
23
|
+
file: "file";
|
|
24
|
+
directory: "directory";
|
|
25
|
+
other: "other";
|
|
26
|
+
}>;
|
|
27
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
/** Metadata that preserves a final symlink. */
|
|
30
|
+
export declare const pathInfoSchema: z.ZodObject<{
|
|
31
|
+
version: z.ZodString;
|
|
32
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
type: z.ZodEnum<{
|
|
34
|
+
file: "file";
|
|
35
|
+
directory: "directory";
|
|
36
|
+
other: "other";
|
|
37
|
+
symlink: "symlink";
|
|
38
|
+
}>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
/** A resolved file-effect policy; the remote helper owns path canonicalization. */
|
|
41
|
+
export declare const policySchema: z.ZodObject<{
|
|
42
|
+
mode: z.ZodEnum<{
|
|
43
|
+
"read-only": "read-only";
|
|
44
|
+
"workspace-write": "workspace-write";
|
|
45
|
+
"danger-full-access": "danger-full-access";
|
|
46
|
+
}>;
|
|
47
|
+
workspaceRoot: z.ZodString;
|
|
48
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
/** Complete directory entries. */
|
|
51
|
+
export declare const entriesSchema: z.ZodArray<z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
type: z.ZodEnum<{
|
|
54
|
+
file: "file";
|
|
55
|
+
directory: "directory";
|
|
56
|
+
other: "other";
|
|
57
|
+
}>;
|
|
58
|
+
target: z.ZodObject<{
|
|
59
|
+
targetKey: z.ZodString;
|
|
60
|
+
displayPath: z.ZodString;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
version: z.ZodOptional<z.ZodString>;
|
|
63
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strict>>;
|
|
65
|
+
/** Guarded write intent. */
|
|
66
|
+
export declare const intentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"createIfAbsent">;
|
|
68
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"replaceIfVersion">;
|
|
70
|
+
version: z.ZodString;
|
|
71
|
+
}, z.core.$strict>], "kind">;
|
|
72
|
+
/** Literal text edit. */
|
|
73
|
+
export declare const editSchema: z.ZodObject<{
|
|
74
|
+
oldString: z.ZodString;
|
|
75
|
+
newString: z.ZodString;
|
|
76
|
+
replaceAll: z.ZodBoolean;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
/** Atomic write observation. */
|
|
79
|
+
export declare const writeResultSchema: z.ZodObject<{
|
|
80
|
+
operation: z.ZodEnum<{
|
|
81
|
+
create: "create";
|
|
82
|
+
update: "update";
|
|
83
|
+
}>;
|
|
84
|
+
version: z.ZodString;
|
|
85
|
+
before: z.ZodNullable<z.ZodString>;
|
|
86
|
+
after: z.ZodString;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
/** Atomic edit observation. */
|
|
89
|
+
export declare const editResultSchema: z.ZodObject<{
|
|
90
|
+
version: z.ZodString;
|
|
91
|
+
before: z.ZodString;
|
|
92
|
+
after: z.ZodString;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
/** Explicit child environment; null encodes an environment tombstone. */
|
|
95
|
+
export declare const environmentSchema: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
96
|
+
/** Ordinary or terminal process requested by a trusted SSH client. */
|
|
97
|
+
export declare const spawnSchema: z.ZodObject<{
|
|
98
|
+
argv: z.ZodArray<z.ZodString>;
|
|
99
|
+
cwd: z.ZodString;
|
|
100
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
101
|
+
graceMs: z.ZodNumber;
|
|
102
|
+
stdio: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
stdin: z.ZodUnion<readonly [z.ZodLiteral<"ignore">, z.ZodLiteral<"pipe">, z.ZodObject<{
|
|
104
|
+
data: z.ZodString;
|
|
105
|
+
}, z.core.$strict>]>;
|
|
106
|
+
stdout: z.ZodUnion<readonly [z.ZodLiteral<"pipe">, z.ZodLiteral<"inherit">, z.ZodObject<{
|
|
107
|
+
maxBytes: z.ZodNumber;
|
|
108
|
+
spill: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
maxBytes: z.ZodNumber;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
}, z.core.$strict>]>;
|
|
112
|
+
stderr: z.ZodUnion<readonly [z.ZodLiteral<"pipe">, z.ZodLiteral<"inherit">, z.ZodObject<{
|
|
113
|
+
maxBytes: z.ZodNumber;
|
|
114
|
+
spill: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
maxBytes: z.ZodNumber;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
}, z.core.$strict>]>;
|
|
118
|
+
control: z.ZodOptional<z.ZodLiteral<"pipe">>;
|
|
119
|
+
}, z.core.$strict>>;
|
|
120
|
+
terminal: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
terminalType: z.ZodString;
|
|
122
|
+
rows: z.ZodNumber;
|
|
123
|
+
cols: z.ZodNumber;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
/** Connection handshake binds sockets and workspace to one helper process. */
|
|
127
|
+
export declare const helloSchema: z.ZodObject<{
|
|
128
|
+
protocol: z.ZodLiteral<1>;
|
|
129
|
+
hash: z.ZodString;
|
|
130
|
+
platform: z.ZodEnum<{
|
|
131
|
+
linux: "linux";
|
|
132
|
+
darwin: "darwin";
|
|
133
|
+
}>;
|
|
134
|
+
nodeVersion: z.ZodString;
|
|
135
|
+
node: z.ZodString;
|
|
136
|
+
root: z.ZodString;
|
|
137
|
+
workspace: z.ZodString;
|
|
138
|
+
bootstrapHash: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
/** A prepared process publishes its sockets before target code may execute. */
|
|
141
|
+
export declare const streamEndpointSchema: z.ZodObject<{
|
|
142
|
+
path: z.ZodString;
|
|
143
|
+
capability: z.ZodString;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
/** A stream capability reaches only the authenticated SSH client and its helper. */
|
|
146
|
+
export type SshStreamEndpoint = z.infer<typeof streamEndpointSchema>;
|
|
147
|
+
/** Prepared process and its independently authenticated stream endpoints. */
|
|
148
|
+
export declare const preparedSchema: z.ZodObject<{
|
|
149
|
+
id: z.ZodPipe<z.ZodUUID, z.ZodTransform<SshProcessId, string>>;
|
|
150
|
+
streams: z.ZodRecord<z.ZodEnum<{
|
|
151
|
+
stdin: "stdin";
|
|
152
|
+
stdout: "stdout";
|
|
153
|
+
stderr: "stderr";
|
|
154
|
+
control: "control";
|
|
155
|
+
terminal: "terminal";
|
|
156
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
157
|
+
path: z.ZodString;
|
|
158
|
+
capability: z.ZodString;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
/** Direct process exit facts. */
|
|
162
|
+
export declare const outcomeSchema: z.ZodObject<{
|
|
163
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
164
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
/** A bounded raw tail positioned in whole-stream byte coordinates. */
|
|
167
|
+
export declare const outputSnapshotSchema: z.ZodObject<{
|
|
168
|
+
tail: z.ZodBase64;
|
|
169
|
+
totalBytes: z.ZodNumber;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
/**
|
|
172
|
+
* Bound one encoded tail and its RPC envelope by the declared collection budget.
|
|
173
|
+
* @param maxBytes - the collector's retained raw-byte limit.
|
|
174
|
+
* @returns the private snapshot frame limit, capped by the helper protocol ceiling.
|
|
175
|
+
*/
|
|
176
|
+
export declare function outputSnapshotFrameLimit(maxBytes: number): number;
|
|
177
|
+
/** Direct exit, retained output snapshots, and optional complete spill locations. */
|
|
178
|
+
export declare const doneSchema: z.ZodObject<{
|
|
179
|
+
outcome: z.ZodObject<{
|
|
180
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
181
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
182
|
+
}, z.core.$strict>;
|
|
183
|
+
spills: z.ZodObject<{
|
|
184
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
185
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
collected: z.ZodObject<{
|
|
188
|
+
stdout: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
tail: z.ZodBase64;
|
|
190
|
+
totalBytes: z.ZodNumber;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
stderr: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
tail: z.ZodBase64;
|
|
194
|
+
totalBytes: z.ZodNumber;
|
|
195
|
+
}, z.core.$strict>>;
|
|
196
|
+
}, z.core.$strict>;
|
|
197
|
+
}, z.core.$strict>;
|
|
198
|
+
/** Remote terminal foreground observation. */
|
|
199
|
+
export declare const foregroundSchema: z.ZodNullable<z.ZodObject<{
|
|
200
|
+
processGroupId: z.ZodNumber;
|
|
201
|
+
inputWaiting: z.ZodBoolean;
|
|
202
|
+
}, z.core.$strict>>;
|
|
203
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** TLS-PSK authenticates forwarded streams even when a remote pathname is replaced. */
|
|
2
|
+
import { type TLSSocket } from 'node:tls';
|
|
3
|
+
import type { Socket } from 'node:net';
|
|
4
|
+
/** Certificate-free PSK authentication and AEAD records; no unauthenticated cipher fallback. */
|
|
5
|
+
export declare const SSH_STREAM_TLS_OPTIONS: {
|
|
6
|
+
readonly ciphers: "PSK-AES256-GCM-SHA384";
|
|
7
|
+
readonly minVersion: "TLSv1.2";
|
|
8
|
+
readonly maxVersion: "TLSv1.2";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Authenticate a forwarded socket with its private administrative-channel key.
|
|
12
|
+
* @param socket - the connected OpenSSH forwarding socket.
|
|
13
|
+
* @param capability - the per-stream 256-bit key encoded as hexadecimal.
|
|
14
|
+
* @param timeoutMs - deadline for completing TLS authentication.
|
|
15
|
+
* @param signal - cancellation of authentication and the resulting TLS stream.
|
|
16
|
+
* @returns an authenticated paused stream; the key is never transmitted as data.
|
|
17
|
+
*/
|
|
18
|
+
export declare function authenticateStream(socket: Socket, capability: string, timeoutMs: number, signal?: AbortSignal): Promise<TLSSocket>;
|
|
19
|
+
//# sourceMappingURL=stream-security.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-ssh",
|
|
3
|
+
"description": "Shared OpenSSH connection and versioned POSIX remote helper",
|
|
4
|
+
"version": "0.1.6-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/ssh/ssh"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
"./helper": {
|
|
24
|
+
"types": "./lib/types/helper-entry.d.ts",
|
|
25
|
+
"default": "./lib/helper.js"
|
|
26
|
+
},
|
|
27
|
+
"./protocol": {
|
|
28
|
+
"types": "./lib/types/protocol.d.ts",
|
|
29
|
+
"default": "./lib/protocol.js"
|
|
30
|
+
},
|
|
31
|
+
"./schemas": {
|
|
32
|
+
"types": "./lib/types/schemas.d.ts",
|
|
33
|
+
"default": "./lib/schemas.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"lib/index.js",
|
|
38
|
+
"lib/helper.js",
|
|
39
|
+
"lib/protocol.js",
|
|
40
|
+
"lib/schemas.js",
|
|
41
|
+
"lib/protocol-*.js",
|
|
42
|
+
"lib/schemas-*.js",
|
|
43
|
+
"lib/stream-security-*.js",
|
|
44
|
+
"lib/types/**/*.d.ts"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
49
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-fs-sandbox": "^0.1.6-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-sandbox-local": "^0.1.6-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-brand": "^0.1.6-alpha.1"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"zod": "^4.4.3",
|
|
62
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
66
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.1",
|
|
67
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.1",
|
|
68
|
+
"@deepseek-ai/dsh-fs-sandbox": "^0.1.6-alpha.1",
|
|
69
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
70
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
71
|
+
"@deepseek-ai/dsh-sandbox-local": "^0.1.6-alpha.1",
|
|
72
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.1",
|
|
73
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.1",
|
|
74
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.1",
|
|
75
|
+
"@deepseek-ai/dsh-fs-ssh": "^0.1.6-alpha.1",
|
|
76
|
+
"@deepseek-ai/dsh-subprocess-ssh": "^0.1.6-alpha.1",
|
|
77
|
+
"@deepseek-ai/dsh-lsp": "^0.1.6-alpha.1",
|
|
78
|
+
"@deepseek-ai/dsh-brand": "^0.1.6-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-lsp-stdio": "^0.1.6-alpha.1",
|
|
80
|
+
"@deepseek-ai/dsh-ptc-runtime-node": "^0.1.6-alpha.1",
|
|
81
|
+
"@deepseek-ai/dsh-sandbox-ssh": "^0.1.6-alpha.1"
|
|
82
|
+
}
|
|
83
|
+
}
|