dsh-ssh-file 0.0.0-stage → 1.2.2

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/lib/remote.js ADDED
@@ -0,0 +1,9 @@
1
+ // Client-face remote contribution for dsh-remote-workspace.
2
+ import { DESCRIPTORS, PACKAGE } from './descriptors.js';
3
+
4
+ export const TYPERT_REMOTE = {
5
+ package: PACKAGE,
6
+ descriptors: DESCRIPTORS,
7
+ };
8
+
9
+ export default TYPERT_REMOTE;
package/lib/schemas.js ADDED
@@ -0,0 +1,130 @@
1
+ // Shared zod v4 schemas for the dsh-ssh-file host face.
2
+ import { z } from 'zod';
3
+
4
+ export function resultSchema(obj) {
5
+ return z.union([
6
+ z.object({ ok: z.literal(true), value: obj }),
7
+ z.object({ ok: z.literal(false), error: z.object({ code: z.string(), message: z.string() }) }),
8
+ ]);
9
+ }
10
+
11
+ export const errorSchema = z.object({ code: z.string(), message: z.string() });
12
+
13
+ export const sftpEntrySchema = z.object({
14
+ name: z.string(),
15
+ isDirectory: z.boolean(),
16
+ size: z.number(),
17
+ mtime: z.number(),
18
+ mode: z.number(),
19
+ });
20
+
21
+ // ── profiles ────────────────────────────────────────────────────────────────
22
+
23
+ export const profileInfoSchema = z.object({
24
+ profileId: z.string(),
25
+ name: z.string(),
26
+ host: z.string(),
27
+ port: z.number(),
28
+ username: z.string(),
29
+ authKind: z.union([z.literal('password'), z.literal('key')]),
30
+ connected: z.boolean(),
31
+ defaultProjectPath: z.string().optional(),
32
+ });
33
+
34
+ export const profileListRequestSchema = z.object({});
35
+ export const profileListResultSchema = resultSchema(z.object({ profiles: z.array(profileInfoSchema) }));
36
+
37
+ export const profileSaveRequestSchema = z.object({
38
+ profileId: z.string().optional(),
39
+ name: z.string(),
40
+ host: z.string(),
41
+ port: z.number().optional(),
42
+ username: z.string(),
43
+ authKind: z.union([z.literal('password'), z.literal('key')]),
44
+ password: z.string().optional(),
45
+ privateKey: z.string().optional(),
46
+ passphrase: z.string().optional(),
47
+ defaultProjectPath: z.string().optional(),
48
+ });
49
+ export const profileSaveResultSchema = resultSchema(z.object({ profile: profileInfoSchema }));
50
+
51
+ export const profileDeleteRequestSchema = z.object({ profileId: z.string() });
52
+ export const profileDeleteResultSchema = resultSchema(z.object({ deleted: z.boolean() }));
53
+
54
+ export const profileConnectRequestSchema = z.object({
55
+ profileId: z.string(),
56
+ reuseExisting: z.boolean().optional(),
57
+ });
58
+ export const profileConnectResultSchema = resultSchema(z.object({
59
+ connectionId: z.string(),
60
+ host: z.string(),
61
+ port: z.number(),
62
+ username: z.string(),
63
+ name: z.string().optional(),
64
+ }));
65
+
66
+ export const profileDisconnectRequestSchema = z.object({ profileId: z.string() });
67
+ export const profileDisconnectResultSchema = resultSchema(z.object({ disconnected: z.number() }));
68
+
69
+ // ── sftp ────────────────────────────────────────────────────────────────────
70
+
71
+ export const sftpListRequestSchema = z.object({ connectionId: z.string(), path: z.string() });
72
+ export const sftpListResultSchema = resultSchema(z.object({ path: z.string(), entries: z.array(sftpEntrySchema) }));
73
+
74
+ export const sftpMkdirRequestSchema = z.object({ connectionId: z.string(), path: z.string() });
75
+ export const sftpMkdirResultSchema = resultSchema(z.object({ path: z.string() }));
76
+
77
+ // ── bindings ────────────────────────────────────────────────────────────────
78
+
79
+ export const bindingSchema = z.object({
80
+ workspacePath: z.string(),
81
+ profileId: z.string(),
82
+ profileName: z.string(),
83
+ host: z.string(),
84
+ port: z.number(),
85
+ username: z.string(),
86
+ remotePath: z.string(),
87
+ autoConnect: z.boolean(),
88
+ connected: z.boolean(),
89
+ missingResource: z.boolean().optional(),
90
+ });
91
+
92
+ export const bindingListRequestSchema = z.object({});
93
+ export const bindingListResultSchema = resultSchema(z.object({
94
+ bindings: z.array(bindingSchema),
95
+ workspaces: z.array(z.object({ path: z.string(), title: z.string() })),
96
+ }));
97
+
98
+ export const bindingSaveRequestSchema = z.object({
99
+ workspacePath: z.string(),
100
+ profileId: z.string(),
101
+ remotePath: z.string(),
102
+ autoConnect: z.boolean().optional(),
103
+ });
104
+ export const bindingSaveResultSchema = resultSchema(z.object({ binding: bindingSchema }));
105
+
106
+ export const bindingDeleteRequestSchema = z.object({ workspacePath: z.string() });
107
+ export const bindingDeleteResultSchema = resultSchema(z.object({ removed: z.boolean() }));
108
+
109
+ export const ensureLocalMirrorFolderRequestSchema = z.object({ name: z.string() });
110
+ export const ensureLocalMirrorFolderResultSchema = resultSchema(z.object({ path: z.string() }));
111
+
112
+ export const sessionBindingRequestSchema = z.object({ sessionId: z.string() });
113
+ export const sessionBindingResultSchema = resultSchema(z.object({
114
+ bindings: z.array(bindingSchema),
115
+ matchWorkspacePath: z.string().nullable(),
116
+ cwd: z.string().nullable(),
117
+ }));
118
+
119
+ // ── remote file panel (editor read/write) ───────────────────────────────────
120
+
121
+ export const fileReadRequestSchema = z.object({ connectionId: z.string(), path: z.string() });
122
+ export const fileReadResultSchema = resultSchema(z.object({
123
+ path: z.string(),
124
+ data: z.string(),
125
+ bytes: z.number(),
126
+ truncated: z.boolean(),
127
+ }));
128
+
129
+ export const fileWriteRequestSchema = z.object({ connectionId: z.string(), path: z.string(), data: z.string() });
130
+ export const fileWriteResultSchema = resultSchema(z.object({ path: z.string(), bytes: z.number() }));
package/lib/typert.js ADDED
@@ -0,0 +1,81 @@
1
+ // Host-face typert model contribution for dsh-remote-workspace.
2
+ import { createRequire as __dshCreateRequire } from 'node:module';
3
+ const require = __dshCreateRequire(import.meta.url);
4
+ import { DESCRIPTORS, PACKAGE } from './descriptors.js';
5
+ import { errorSchema } from './schemas.js';
6
+
7
+ const TYPERT = {
8
+ package: PACKAGE,
9
+ face: 'host',
10
+ schemas: [
11
+ // 0.1.6-alpha.2 loader requires create(); alpha.1 registry reads .schema — ship both.
12
+ { name: 'remoteWorkspaceError', schema: errorSchema, create: () => errorSchema },
13
+ ],
14
+ invocations: DESCRIPTORS,
15
+ model: {
16
+ events: [],
17
+ objects: [],
18
+ services: [
19
+ {
20
+ description: 'Remote workspace service for the Web UI: saved SSH server profiles, SFTP directory browsing, and DSH-workspace-to-remote-path bindings. Backed by ssh2 in the host process.',
21
+ summary: 'SSH server profiles and remote workspace bindings.',
22
+ tags: [],
23
+ jsDoc: '/**\n * Saved SSH servers, SFTP browsing, and remote workspace bindings.\n */',
24
+ key: 'remoteWorkspace',
25
+ exportName: 'RemoteWorkspaceService',
26
+ members: [
27
+ { kind: 'method', name: 'profileList', signature: 'async profileList(request: ProfileListRequest): Promise<ProfileListResult>' },
28
+ { kind: 'method', name: 'profileSave', signature: 'async profileSave(request: ProfileSaveRequest): Promise<ProfileSaveResult>' },
29
+ { kind: 'method', name: 'profileDelete', signature: 'async profileDelete(request: ProfileDeleteRequest): Promise<ProfileDeleteResult>' },
30
+ { kind: 'method', name: 'profileConnect', signature: 'async profileConnect(request: ProfileConnectRequest): Promise<ProfileConnectResult>' },
31
+ { kind: 'method', name: 'profileDisconnect', signature: 'async profileDisconnect(request: ProfileDisconnectRequest): Promise<ProfileDisconnectResult>' },
32
+ { kind: 'method', name: 'sftpList', signature: 'async sftpList(request: SftpListRequest): Promise<SftpListResult>' },
33
+ { kind: 'method', name: 'sftpMkdir', signature: 'async sftpMkdir(request: SftpMkdirRequest): Promise<SftpMkdirResult>' },
34
+ { kind: 'method', name: 'bindingList', signature: 'async bindingList(request: BindingListRequest): Promise<BindingListResult>' },
35
+ { kind: 'method', name: 'bindingSave', signature: 'async bindingSave(request: BindingSaveRequest): Promise<BindingSaveResult>' },
36
+ { kind: 'method', name: 'bindingDelete', signature: 'async bindingDelete(request: BindingDeleteRequest): Promise<BindingDeleteResult>' },
37
+ { kind: 'method', name: 'ensureLocalMirrorFolder', signature: 'async ensureLocalMirrorFolder(request: EnsureLocalMirrorFolderRequest): Promise<EnsureLocalMirrorFolderResult>' },
38
+ { kind: 'method', name: 'fileRead', signature: 'async fileRead(request: FileReadRequest): Promise<FileReadResult>' },
39
+ { kind: 'method', name: 'fileWrite', signature: 'async fileWrite(request: FileWriteRequest): Promise<FileWriteResult>' },
40
+ { kind: 'method', name: 'sessionBinding', signature: 'async sessionBinding(request: SessionBindingRequest): Promise<SessionBindingResult>' },
41
+ ],
42
+ types: [
43
+ { name: 'SshResult', declaration: 'export type SshResult<T> = { ok: true; value: T } | { ok: false; error: { code: string; message: string } };' },
44
+ { name: 'ProfileInfo', declaration: 'export interface ProfileInfo { readonly profileId: string; readonly name: string; readonly host: string; readonly port: number; readonly username: string; readonly authKind: "password" | "key"; readonly connected: boolean; readonly defaultProjectPath?: string; }' },
45
+ { name: 'ProfileListRequest', declaration: 'export interface ProfileListRequest {};' },
46
+ { name: 'ProfileListResult', declaration: 'export type ProfileListResult = SshResult<{ profiles: ProfileInfo[] }>;' },
47
+ { name: 'ProfileSaveRequest', declaration: 'export interface ProfileSaveRequest { readonly profileId?: string; readonly name: string; readonly host: string; readonly port?: number; readonly username: string; readonly authKind: "password" | "key"; readonly password?: string; readonly privateKey?: string; readonly passphrase?: string; readonly defaultProjectPath?: string; }' },
48
+ { name: 'ProfileSaveResult', declaration: 'export type ProfileSaveResult = SshResult<{ profile: ProfileInfo }>;' },
49
+ { name: 'ProfileDeleteRequest', declaration: 'export interface ProfileDeleteRequest { readonly profileId: string; }' },
50
+ { name: 'ProfileDeleteResult', declaration: 'export type ProfileDeleteResult = SshResult<{ deleted: boolean }>;' },
51
+ { name: 'ProfileConnectRequest', declaration: 'export interface ProfileConnectRequest { readonly profileId: string; readonly reuseExisting?: boolean; }' },
52
+ { name: 'ProfileConnectResult', declaration: 'export type ProfileConnectResult = SshResult<{ connectionId: string; host: string; port: number; username: string; name?: string }>;' },
53
+ { name: 'ProfileDisconnectRequest', declaration: 'export interface ProfileDisconnectRequest { readonly profileId: string; }' },
54
+ { name: 'ProfileDisconnectResult', declaration: 'export type ProfileDisconnectResult = SshResult<{ disconnected: number }>;' },
55
+ { name: 'SftpEntry', declaration: 'export interface SftpEntry { readonly name: string; readonly isDirectory: boolean; readonly size: number; readonly mtime: number; readonly mode: number; }' },
56
+ { name: 'SftpListRequest', declaration: 'export interface SftpListRequest { readonly connectionId: string; readonly path: string; }' },
57
+ { name: 'SftpListResult', declaration: 'export type SftpListResult = SshResult<{ path: string; entries: SftpEntry[] }>;' },
58
+ { name: 'SftpMkdirRequest', declaration: 'export interface SftpMkdirRequest { readonly connectionId: string; readonly path: string; }' },
59
+ { name: 'SftpMkdirResult', declaration: 'export type SftpMkdirResult = SshResult<{ path: string }>;' },
60
+ { name: 'Binding', declaration: 'export interface Binding { readonly workspacePath: string; readonly profileId: string; readonly profileName: string; readonly host: string; readonly port: number; readonly username: string; readonly remotePath: string; readonly autoConnect: boolean; readonly connected: boolean; readonly missingResource?: boolean; }' },
61
+ { name: 'BindingListRequest', declaration: 'export interface BindingListRequest {};' },
62
+ { name: 'BindingListResult', declaration: 'export type BindingListResult = SshResult<{ bindings: Binding[]; workspaces: Array<{ path: string; title: string }> }>;' },
63
+ { name: 'BindingSaveRequest', declaration: 'export interface BindingSaveRequest { readonly workspacePath: string; readonly profileId: string; readonly remotePath: string; readonly autoConnect?: boolean; }' },
64
+ { name: 'BindingSaveResult', declaration: 'export type BindingSaveResult = SshResult<{ binding: Binding }>;' },
65
+ { name: 'BindingDeleteRequest', declaration: 'export interface BindingDeleteRequest { readonly workspacePath: string; }' },
66
+ { name: 'BindingDeleteResult', declaration: 'export type BindingDeleteResult = SshResult<{ removed: boolean }>;' },
67
+ { name: 'SessionBindingRequest', declaration: 'export interface SessionBindingRequest { readonly sessionId: string; }' },
68
+ { name: 'SessionBindingResult', declaration: 'export type SessionBindingResult = SshResult<{ bindings: Binding[]; matchWorkspacePath: string | null; cwd: string | null }>;' },
69
+ { name: 'EnsureLocalMirrorFolderRequest', declaration: 'export interface EnsureLocalMirrorFolderRequest { readonly name: string; }' },
70
+ { name: 'EnsureLocalMirrorFolderResult', declaration: 'export type EnsureLocalMirrorFolderResult = SshResult<{ path: string }>;' },
71
+ { name: 'FileReadRequest', declaration: 'export interface FileReadRequest { readonly connectionId: string; readonly path: string; }' },
72
+ { name: 'FileReadResult', declaration: 'export type FileReadResult = SshResult<{ path: string; data: string; bytes: number; truncated: boolean }>;' },
73
+ { name: 'FileWriteRequest', declaration: 'export interface FileWriteRequest { readonly connectionId: string; readonly path: string; readonly data: string; }' },
74
+ { name: 'FileWriteResult', declaration: 'export type FileWriteResult = SshResult<{ path: string; bytes: number }>;' },
75
+ ],
76
+ },
77
+ ],
78
+ },
79
+ };
80
+
81
+ export { TYPERT, TYPERT as default };
package/locale/en.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "meta.title": "Remote Workspace",
3
+ "meta.description": "Save SSH servers, bind DSH workspaces to remote directories, and give the agent remote file/command tools."
4
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "meta.title": "远程工作区",
3
+ "meta.description": "保存 SSH 服务器,把 DSH 工作区绑定到远程目录,并为智能体提供远程文件与命令工具。"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "dsh-ssh-file",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "SSH file workspace for DeepSeek Harness: bind DSH workspaces to remote server directories and let the agent read/write remote files and run remote commands via SFTP/SSH. Standalone — no dsh-ssh-ops required.",
4
+ "icon": "./icon.svg",
5
+ "version": "1.2.2",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "lib/index.js",
9
+ "keywords": [
10
+ "deepseek",
11
+ "harness",
12
+ "dsh",
13
+ "dsh-plugin",
14
+ "ssh",
15
+ "sftp",
16
+ "remote",
17
+ "workspace"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org/"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/CocoSkyler/dsh-ssh-file.git"
26
+ },
27
+ "author": "CocoSkyler",
28
+ "homepage": "https://github.com/CocoSkyler/dsh-ssh-file#readme",
29
+ "exports": {
30
+ ".": {
31
+ "default": "./lib/index.js"
32
+ },
33
+ "./typert": {
34
+ "default": "./lib/typert.js"
35
+ },
36
+ "./remote": {
37
+ "default": "./lib/remote.js"
38
+ },
39
+ "./client": {
40
+ "default": "./lib/client.js"
41
+ },
42
+ "./locale/*.json": "./locale/*.json",
43
+ "./package.json": "./package.json"
44
+ },
45
+ "files": [
46
+ "lib",
47
+ "cordis.patch.yml",
48
+ "icon.svg",
49
+ "locale/*.json",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "dsh": {
54
+ "bundle": {
55
+ "patch": "./cordis.patch.yml"
56
+ },
57
+ "client": {
58
+ "platform": "web",
59
+ "inject": [
60
+ "@deepseek-ai/dsh-client-runtime",
61
+ "@deepseek-ai/dsh-client-ui-conversation",
62
+ "@deepseek-ai/dsh-client-ui-workspace"
63
+ ]
64
+ }
65
+ },
66
+ "dependencies": {
67
+ "ssh2": "^1.16.0",
68
+ "zod": "^4.6.7"
69
+ },
70
+ "engines": {
71
+ "dsh": ">=0.2.0"
72
+ },
73
+ "peerDependencies": {
74
+ "@deepseek-ai/dsh-credentials": ">=0.1.5-alpha.1",
75
+ "@deepseek-ai/dsh-storage-domain": ">=0.1.5-alpha.1",
76
+ "@deepseek-ai/dsh-tools": ">=0.1.5-alpha.1",
77
+ "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-alpha.1"
78
+ }
79
+ }