@celljs/ta-protocol 4.8.0 → 4.9.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 +2 -2
- package/README.md +2 -2
- package/esm/common/access-protocol.d.ts +73 -0
- package/esm/common/access-protocol.js +9 -0
- package/esm/common/gateway-protocol.d.ts +81 -0
- package/esm/common/gateway-protocol.js +3 -0
- package/esm/common/index.d.ts +2 -0
- package/esm/common/index.js +2 -0
- package/esm/common/location.d.ts +5 -0
- package/esm/common/location.js +12 -0
- package/esm/common/package-protocol.d.ts +60 -1
- package/esm/common/package-protocol.js +12 -0
- package/esm/common/relay-protocol.d.ts +17 -0
- package/esm/common/settings-protocol.d.ts +2 -0
- package/esm/common/ta-extension-host.d.ts +9 -0
- package/esm/common/ta-extension-host.js +6 -0
- package/esm/common/ta-protocol.d.ts +110 -4
- package/esm/common/ta-protocol.js +33 -0
- package/esm/common/workspace-protocol.d.ts +12 -1
- package/esm/common/workspace-protocol.js +16 -0
- package/lib/common/access-protocol.d.ts +74 -0
- package/lib/common/access-protocol.js +12 -0
- package/lib/common/gateway-protocol.d.ts +82 -0
- package/lib/common/gateway-protocol.js +6 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +2 -0
- package/lib/common/location.d.ts +5 -0
- package/lib/common/location.js +12 -0
- package/lib/common/package-protocol.d.ts +60 -1
- package/lib/common/package-protocol.js +13 -1
- package/lib/common/relay-protocol.d.ts +17 -0
- package/lib/common/settings-protocol.d.ts +2 -0
- package/lib/common/ta-extension-host.d.ts +9 -0
- package/lib/common/ta-extension-host.js +7 -1
- package/lib/common/ta-protocol.d.ts +110 -4
- package/lib/common/ta-protocol.js +34 -1
- package/lib/common/workspace-protocol.d.ts +12 -1
- package/lib/common/workspace-protocol.js +17 -1
- package/package.json +3 -2
- package/esm/common/auth-protocol.js.map +0 -1
- package/esm/common/index.js.map +0 -1
- package/esm/common/location.js.map +0 -1
- package/esm/common/package-protocol.js.map +0 -1
- package/esm/common/pi-types.js.map +0 -1
- package/esm/common/relay-protocol.js.map +0 -1
- package/esm/common/remote-protocol.js.map +0 -1
- package/esm/common/settings-protocol.js.map +0 -1
- package/esm/common/ta-extension-host.js.map +0 -1
- package/esm/common/ta-protocol.js.map +0 -1
- package/esm/common/workspace-protocol.js.map +0 -1
- package/lib/common/auth-protocol.d.ts.map +0 -1
- package/lib/common/auth-protocol.js.map +0 -1
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js.map +0 -1
- package/lib/common/location.d.ts.map +0 -1
- package/lib/common/location.js.map +0 -1
- package/lib/common/location.spec.d.ts +0 -2
- package/lib/common/location.spec.d.ts.map +0 -1
- package/lib/common/location.spec.js +0 -58
- package/lib/common/location.spec.js.map +0 -1
- package/lib/common/package-protocol.d.ts.map +0 -1
- package/lib/common/package-protocol.js.map +0 -1
- package/lib/common/pi-types.d.ts.map +0 -1
- package/lib/common/pi-types.js.map +0 -1
- package/lib/common/relay-protocol.d.ts.map +0 -1
- package/lib/common/relay-protocol.js.map +0 -1
- package/lib/common/remote-protocol.d.ts.map +0 -1
- package/lib/common/remote-protocol.js.map +0 -1
- package/lib/common/settings-protocol.d.ts.map +0 -1
- package/lib/common/settings-protocol.js.map +0 -1
- package/lib/common/ta-extension-host.d.ts.map +0 -1
- package/lib/common/ta-extension-host.js.map +0 -1
- package/lib/common/ta-protocol.d.ts.map +0 -1
- package/lib/common/ta-protocol.js.map +0 -1
- package/lib/common/ta-protocol.spec.d.ts +0 -2
- package/lib/common/ta-protocol.spec.d.ts.map +0 -1
- package/lib/common/ta-protocol.spec.js +0 -41
- package/lib/common/ta-protocol.spec.js.map +0 -1
- package/lib/common/workspace-protocol.d.ts.map +0 -1
- package/lib/common/workspace-protocol.js.map +0 -1
- package/src/common/auth-protocol.ts +0 -56
- package/src/common/index.ts +0 -10
- package/src/common/location.spec.ts +0 -62
- package/src/common/location.ts +0 -177
- package/src/common/package-protocol.ts +0 -99
- package/src/common/pi-types.ts +0 -11
- package/src/common/relay-protocol.ts +0 -28
- package/src/common/remote-protocol.ts +0 -76
- package/src/common/settings-protocol.ts +0 -73
- package/src/common/ta-extension-host.ts +0 -97
- package/src/common/ta-protocol.spec.ts +0 -48
- package/src/common/ta-protocol.ts +0 -352
- package/src/common/workspace-protocol.ts +0 -120
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { TaServer } from './ta-protocol';
|
|
2
|
-
|
|
3
|
-
/** Where the page loads the bytes of workspace files from: see {@link TaWorkspaceServer.fileUrl}. */
|
|
4
|
-
export const TA_FILES_PATH = '/api/files';
|
|
5
|
-
|
|
6
|
-
export const TaWorkspaceServer = Symbol('TaWorkspaceServer');
|
|
7
|
-
export const TA_WORKSPACE_SERVICE = 'TaWorkspaceServer';
|
|
8
|
-
export const TaTerminalServer = Symbol('TaTerminalServer');
|
|
9
|
-
export const TA_TERMINAL_SERVICE = 'TaTerminalServer';
|
|
10
|
-
|
|
11
|
-
/** An entry of a directory of the workspace. */
|
|
12
|
-
export interface TaDirEntry {
|
|
13
|
-
name: string;
|
|
14
|
-
/** Relative to the directory the call names as `cwd`, with `/`. */
|
|
15
|
-
path: string;
|
|
16
|
-
kind: 'file' | 'directory';
|
|
17
|
-
size?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TaFileContent {
|
|
21
|
-
path: string;
|
|
22
|
-
size: number;
|
|
23
|
-
/** Not text: `text` is left out. */
|
|
24
|
-
binary: boolean;
|
|
25
|
-
/** Larger than the limit (1 MB): `text` holds the start. */
|
|
26
|
-
truncated: boolean;
|
|
27
|
-
text?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TaRunCommandOptions {
|
|
31
|
-
/** Default: the server's directory. */
|
|
32
|
-
cwd?: string;
|
|
33
|
-
/** Written to the standard input, which is then closed. */
|
|
34
|
-
input?: string;
|
|
35
|
-
/** Default 30 s, at most 120 s; the process is killed then. */
|
|
36
|
-
timeoutMs?: number;
|
|
37
|
-
/** Of each of stdout and stderr; default 1 MB, at most 8 MB. */
|
|
38
|
-
maxBytes?: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The most bytes of a part of {@link TaWorkspaceServer.uploadFile}: a larger file goes in parts of this size,
|
|
43
|
-
* well within what a message of the WebSocket may hold once in base64.
|
|
44
|
-
*/
|
|
45
|
-
export const TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
|
|
46
|
-
|
|
47
|
-
export interface TaUploadOptions {
|
|
48
|
-
/** Default: the server's directory. */
|
|
49
|
-
cwd?: string;
|
|
50
|
-
/** After what the file holds: each part of a file sent in parts but the first. */
|
|
51
|
-
append?: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface TaCommandOutput {
|
|
55
|
-
stdout: string;
|
|
56
|
-
stderr: string;
|
|
57
|
-
/** null when it was killed (`timedOut`) or ended by a signal. */
|
|
58
|
-
exitCode: number | null;
|
|
59
|
-
/** An output was longer than `maxBytes`: it holds the start. */
|
|
60
|
-
truncated: boolean;
|
|
61
|
-
timedOut: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The files of a directory of the machine of `ta serve` and programs run there, on the same WebSocket as
|
|
66
|
-
* {@link TaServer}. Paths are relative to `cwd` (default: the server's directory) and may not leave it;
|
|
67
|
-
* the work runs in the execution environment of `cwd`, as the tools of a session do.
|
|
68
|
-
*/
|
|
69
|
-
export interface TaWorkspaceServer {
|
|
70
|
-
/** Directories first, then by name; `.git` is left out. */
|
|
71
|
-
listDirectory(path: string, cwd?: string): Promise<TaDirEntry[]>;
|
|
72
|
-
readFile(path: string, cwd?: string): Promise<TaFileContent>;
|
|
73
|
-
/** Writes the text of a file; its directory must be there. */
|
|
74
|
-
writeFile(path: string, text: string, cwd?: string): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Writes bytes, in base64, to a file (one uploaded): the folders on its way are made, and a file there is
|
|
77
|
-
* replaced. A file larger than {@link TA_UPLOAD_PART_BYTES} goes in parts, each after the first with `append`.
|
|
78
|
-
*/
|
|
79
|
-
uploadFile(path: string, data: string, options?: TaUploadOptions): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* A URL of this server, under {@link TA_FILES_PATH}, that answers the bytes of a file of `cwd`, for
|
|
82
|
-
* what the page shows as it is: an image, a video, a page with what it loads next to it. The URL needs
|
|
83
|
-
* no token, so that a page loads the files beside it with relative URLs; each `cwd` has its own
|
|
84
|
-
* secret part. Pages are answered sandboxed: they run in an origin of their own, not the server's.
|
|
85
|
-
*/
|
|
86
|
-
fileUrl(path: string, cwd?: string): Promise<string>;
|
|
87
|
-
/** Paths of files whose name matches `query` loosely, best first; ignored files are left out. */
|
|
88
|
-
findFiles(query: string, cwd?: string, limit?: number): Promise<string[]>;
|
|
89
|
-
/**
|
|
90
|
-
* Runs a program with its arguments, without a shell, in the execution environment of `cwd`, and
|
|
91
|
-
* answers its output once it ends: what packages build on (git, rg) instead of a method each.
|
|
92
|
-
*/
|
|
93
|
-
runCommand(command: string, args: string[], options?: TaRunCommandOptions): Promise<TaCommandOutput>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface TaTerminalInfo {
|
|
97
|
-
terminalId: string;
|
|
98
|
-
cwd: string;
|
|
99
|
-
shell: string;
|
|
100
|
-
/** False: plain pipes (no `script` on the server, or Windows): full-screen programs do not draw right. */
|
|
101
|
-
pty: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface TaOpenTerminalOptions {
|
|
105
|
-
/** Default: the server's directory. */
|
|
106
|
-
cwd?: string;
|
|
107
|
-
cols: number;
|
|
108
|
-
rows: number;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** The shells of a connection, on the same WebSocket as {@link TaServer}. */
|
|
112
|
-
export interface TaTerminalServer {
|
|
113
|
-
/** A shell of this connection; its output comes by TaClient.onTerminalData. It closes 30 s after the connection drops. */
|
|
114
|
-
openTerminal(options: TaOpenTerminalOptions): Promise<TaTerminalInfo>;
|
|
115
|
-
writeTerminal(terminalId: string, data: string): Promise<void>;
|
|
116
|
-
resizeTerminal(terminalId: string, cols: number, rows: number): Promise<void>;
|
|
117
|
-
closeTerminal(terminalId: string): Promise<void>;
|
|
118
|
-
/** The terminals of this connection that are still open. */
|
|
119
|
-
listTerminals(): Promise<TaTerminalInfo[]>;
|
|
120
|
-
}
|