@celljs/ta-protocol 4.17.0 → 4.18.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/esm/common/access-protocol.d.ts +41 -0
- package/esm/common/access-protocol.js +7 -0
- package/esm/common/app-protocol.d.ts +7 -2
- package/esm/common/app-protocol.js +14 -0
- package/esm/common/deployment-protocol.d.ts +13 -0
- package/esm/common/deployment-protocol.js +36 -0
- package/esm/common/index.d.ts +2 -0
- package/esm/common/index.js +2 -0
- package/esm/common/message-protocol.d.ts +43 -4
- package/esm/common/message-protocol.js +97 -12
- package/esm/common/room-protocol.d.ts +45 -0
- package/esm/common/said-protocol.d.ts +76 -0
- package/esm/common/said-protocol.js +239 -0
- package/esm/common/screen-share-protocol.d.ts +304 -0
- package/esm/common/screen-share-protocol.js +88 -0
- package/esm/common/settings-protocol.d.ts +8 -0
- package/esm/common/settings-protocol.js +2 -0
- package/esm/common/ta-extension-host.d.ts +33 -0
- package/esm/common/ta-extension-host.js +6 -0
- package/esm/common/ta-protocol.d.ts +3 -0
- package/esm/common/team-protocol.d.ts +13 -2
- package/esm/common/team-protocol.js +27 -2
- package/esm/common/voice-protocol.d.ts +45 -0
- package/esm/common/voice-protocol.js +54 -0
- package/lib/common/access-protocol.d.ts +41 -0
- package/lib/common/access-protocol.js +8 -1
- package/lib/common/app-protocol.d.ts +7 -2
- package/lib/common/app-protocol.js +14 -0
- package/lib/common/deployment-protocol.d.ts +13 -0
- package/lib/common/deployment-protocol.js +36 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +2 -0
- package/lib/common/message-protocol.d.ts +43 -4
- package/lib/common/message-protocol.js +98 -13
- package/lib/common/room-protocol.d.ts +45 -0
- package/lib/common/said-protocol.d.ts +77 -0
- package/lib/common/said-protocol.js +242 -0
- package/lib/common/screen-share-protocol.d.ts +305 -0
- package/lib/common/screen-share-protocol.js +91 -0
- package/lib/common/settings-protocol.d.ts +8 -0
- package/lib/common/settings-protocol.js +3 -1
- package/lib/common/ta-extension-host.d.ts +33 -0
- package/lib/common/ta-extension-host.js +7 -1
- package/lib/common/ta-protocol.d.ts +3 -0
- package/lib/common/team-protocol.d.ts +13 -2
- package/lib/common/team-protocol.js +28 -3
- package/lib/common/voice-protocol.d.ts +45 -0
- package/lib/common/voice-protocol.js +55 -1
- package/package.json +1 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
export declare const TaScreenShareServer: unique symbol;
|
|
2
|
+
export declare const TA_SCREEN_SHARE_SERVICE = "TaScreenShareServer";
|
|
3
|
+
/**
|
|
4
|
+
* What a call refused for a remote desktop says, in English: the kernel and ta-team say it the same
|
|
5
|
+
* (docs/design/ta-desktop-remote.md 6.7).
|
|
6
|
+
*/
|
|
7
|
+
export declare const TA_DESKTOP_LOCKED_MESSAGE = "Not while someone else works a desktop of this Ta.";
|
|
8
|
+
/**
|
|
9
|
+
* A desktop Ta can show and work (docs/design/ta-desktop-remote.md 4.1): a VNC server reached from the machine of
|
|
10
|
+
* `via`, '' for the machine of ta serve or `ssh://<host>` for a host of ssh directories, at `host`:`port` as that
|
|
11
|
+
* machine sees it (127.0.0.1:5900, its own screen, by default). `name` is what the user called it.
|
|
12
|
+
*/
|
|
13
|
+
export interface TaDesktopTarget {
|
|
14
|
+
via: string;
|
|
15
|
+
host?: string;
|
|
16
|
+
port?: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The connection of RFB to a desktop. */
|
|
20
|
+
export type TaDesktopLink = 'connecting' | 'live' | 'locked' | 'asleep' | 'lost';
|
|
21
|
+
/** A screen of a desktop: one of ExtendedDesktopSize, or the whole framebuffer as one. */
|
|
22
|
+
export interface TaDesktopScreen {
|
|
23
|
+
/** The id ExtendedDesktopSize gives, in decimal; `whole` for a framebuffer of one screen. */
|
|
24
|
+
id: string;
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
/** Pixels of the framebuffer a point of its system: 2 for a Retina Mac (guessed), else 1. */
|
|
30
|
+
scale: number;
|
|
31
|
+
/** The one at (0, 0), else the first. */
|
|
32
|
+
primary: boolean;
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Who works a desktop: one page at a time; the others look (docs/design/ta-desktop-remote.md 6.4). */
|
|
36
|
+
export interface TaDesktopControl {
|
|
37
|
+
/** The principal: TA_OWNER, or one let in (from the third stage). */
|
|
38
|
+
by: string;
|
|
39
|
+
name: string;
|
|
40
|
+
/** What the page is on: `phone`, `tablet` or `computer`. */
|
|
41
|
+
device: string;
|
|
42
|
+
/** It is the page this answer goes to. */
|
|
43
|
+
self: boolean;
|
|
44
|
+
since: number;
|
|
45
|
+
/** It goes back to looking at this time without input. */
|
|
46
|
+
until: number;
|
|
47
|
+
}
|
|
48
|
+
/** A page looking at a desktop. Without its viewerId: that reads its frames and sends its input. */
|
|
49
|
+
export interface TaDesktopWatcher {
|
|
50
|
+
by: string;
|
|
51
|
+
name: string;
|
|
52
|
+
device: string;
|
|
53
|
+
self: boolean;
|
|
54
|
+
since: number;
|
|
55
|
+
}
|
|
56
|
+
/** What a desktop can do, known once connected. */
|
|
57
|
+
export interface TaDesktopCapabilities {
|
|
58
|
+
keyboard: 'keysym' | 'scancode';
|
|
59
|
+
/** Whether it takes Unicode keysyms; null until the first character beyond ASCII went. */
|
|
60
|
+
unicodeKeys: boolean | null;
|
|
61
|
+
clipboardWrite: boolean;
|
|
62
|
+
/** Always false in the first stage. */
|
|
63
|
+
clipboardRead: boolean;
|
|
64
|
+
/** The pointer's picture comes apart, drawn by the page. */
|
|
65
|
+
cursor: boolean;
|
|
66
|
+
/** ExtendedDesktopSize: its screens, and changes of size. */
|
|
67
|
+
screens: boolean;
|
|
68
|
+
system?: 'mac' | 'windows' | 'linux';
|
|
69
|
+
}
|
|
70
|
+
/** A desktop of the list (TaScreenShareServer.listDesktops). */
|
|
71
|
+
export interface TaDesktopInfo {
|
|
72
|
+
/** `<via>|<host>:<port>`, written whole: how calls and records name it. */
|
|
73
|
+
id: string;
|
|
74
|
+
target: TaDesktopTarget;
|
|
75
|
+
/** Always some: the target's name, else this computer, the ssh host or host:port. */
|
|
76
|
+
name: string;
|
|
77
|
+
/** This computer, a host of ssh directories, or one of the network (`via` '' and a host not of loopback). */
|
|
78
|
+
source: 'this' | 'ssh' | 'lan';
|
|
79
|
+
state: 'idle' | 'connecting' | 'viewing' | 'controlled';
|
|
80
|
+
link?: TaDesktopLink;
|
|
81
|
+
screens?: TaDesktopScreen[];
|
|
82
|
+
control: TaDesktopControl | null;
|
|
83
|
+
viewers: TaDesktopWatcher[];
|
|
84
|
+
/** The viewer of the calling connection: its id and the last frame it made. */
|
|
85
|
+
mine?: {
|
|
86
|
+
viewerId: string;
|
|
87
|
+
built: number;
|
|
88
|
+
};
|
|
89
|
+
capabilities?: TaDesktopCapabilities;
|
|
90
|
+
}
|
|
91
|
+
/** What a page looks at, and how big it draws it (docs/design/ta-desktop-remote.md 5.2). */
|
|
92
|
+
export interface TaDesktopView {
|
|
93
|
+
/** Larger than the last: a view that comes late is dropped. */
|
|
94
|
+
revision: number;
|
|
95
|
+
/** Which screen; the primary one when not given. */
|
|
96
|
+
screen?: string;
|
|
97
|
+
/** A part of the framebuffer; the whole screen when not given. */
|
|
98
|
+
rect?: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
w: number;
|
|
102
|
+
h: number;
|
|
103
|
+
};
|
|
104
|
+
/** Pixels of the device the page draws it in: the server scales the part to them (at most the part itself). */
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
quality?: 'auto' | 'crisp' | 'smooth';
|
|
108
|
+
}
|
|
109
|
+
/** One opened view of a desktop by a page (TaScreenShareServer.openDesktop). */
|
|
110
|
+
export interface TaDesktopViewer {
|
|
111
|
+
/** Random, never used again: a new one is a new count of frames. */
|
|
112
|
+
viewerId: string;
|
|
113
|
+
/** The first frame to claim; it is whole. */
|
|
114
|
+
next: number;
|
|
115
|
+
size: {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
screens: TaDesktopScreen[];
|
|
119
|
+
};
|
|
120
|
+
control: TaDesktopControl | null;
|
|
121
|
+
capabilities: TaDesktopCapabilities;
|
|
122
|
+
}
|
|
123
|
+
/** A picture of part of the view: a JPEG, at its place in the pixels of the view. */
|
|
124
|
+
export interface TaDesktopTile {
|
|
125
|
+
x: number;
|
|
126
|
+
y: number;
|
|
127
|
+
w: number;
|
|
128
|
+
h: number;
|
|
129
|
+
/** Base64. */
|
|
130
|
+
jpeg: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The answer to claiming frame `want` (TaScreenShareServer.readDesktopFrames, docs/design/ta-desktop-remote.md 5.4):
|
|
134
|
+
* a frame, or `idle` (claim it again), `stale` (claim from seq + 1, which is whole) or `unknown` (open again).
|
|
135
|
+
*/
|
|
136
|
+
export interface TaDesktopFrames {
|
|
137
|
+
seq: number;
|
|
138
|
+
/** The frame it is drawn over: seq - 1; 0 for a whole one. */
|
|
139
|
+
base?: number;
|
|
140
|
+
idle?: true;
|
|
141
|
+
stale?: true;
|
|
142
|
+
unknown?: true;
|
|
143
|
+
/** Milliseconds from the claim to the start of the frame's encoding. */
|
|
144
|
+
waited: number;
|
|
145
|
+
size?: {
|
|
146
|
+
width: number;
|
|
147
|
+
height: number;
|
|
148
|
+
screens: TaDesktopScreen[];
|
|
149
|
+
};
|
|
150
|
+
/** The part the tiles show and the pixels they are in. */
|
|
151
|
+
view?: {
|
|
152
|
+
rect: {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
w: number;
|
|
156
|
+
h: number;
|
|
157
|
+
};
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
};
|
|
161
|
+
/** The picture of the pointer, a PNG in base64; null when hidden. Only when it changed. */
|
|
162
|
+
cursor?: {
|
|
163
|
+
hotX: number;
|
|
164
|
+
hotY: number;
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
png: string;
|
|
168
|
+
} | null;
|
|
169
|
+
/** The pointer of whoever else works it. */
|
|
170
|
+
pointer?: {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
};
|
|
174
|
+
tiles: TaDesktopTile[];
|
|
175
|
+
/** Only when it changed. */
|
|
176
|
+
control?: TaDesktopControl | null;
|
|
177
|
+
/** Only when it changed. */
|
|
178
|
+
state?: TaDesktopLink;
|
|
179
|
+
/** Why it was lost, in English. */
|
|
180
|
+
error?: string;
|
|
181
|
+
}
|
|
182
|
+
/** What a page does to the desktop it works: positions in the framebuffer. */
|
|
183
|
+
export type TaDesktopInput = {
|
|
184
|
+
kind: 'pointer';
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
buttons: number;
|
|
188
|
+
} | {
|
|
189
|
+
kind: 'wheel';
|
|
190
|
+
x: number;
|
|
191
|
+
y: number;
|
|
192
|
+
dx: number;
|
|
193
|
+
dy: number;
|
|
194
|
+
} | {
|
|
195
|
+
kind: 'key';
|
|
196
|
+
keysym: number;
|
|
197
|
+
down: boolean;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* The sign-in a desktop asks for, in one form: the account and the password of the Screen Sharing of macOS
|
|
201
|
+
* (`account`), or the password of VNC alone.
|
|
202
|
+
*/
|
|
203
|
+
export interface TaDesktopPrompt {
|
|
204
|
+
promptId: string;
|
|
205
|
+
desktop: string;
|
|
206
|
+
/** The name of the desktop, for the form. */
|
|
207
|
+
name: string;
|
|
208
|
+
/** It wants an account too (Apple Remote Desktop): the user of the Mac, as they sign in to it. */
|
|
209
|
+
account: boolean;
|
|
210
|
+
/** The account to put in the field: the user of this computer, or the one given last. */
|
|
211
|
+
user?: string;
|
|
212
|
+
/** The desktop refused the one given last (or kept): it is asked again. */
|
|
213
|
+
refused?: boolean;
|
|
214
|
+
/** A password the vault may keep for the next time (answerDesktop's `remember`): there when a package keeps sign-ins. */
|
|
215
|
+
remember?: boolean;
|
|
216
|
+
}
|
|
217
|
+
/** What a page answers a prompt with. */
|
|
218
|
+
export interface TaDesktopSignIn {
|
|
219
|
+
username?: string;
|
|
220
|
+
password: string;
|
|
221
|
+
}
|
|
222
|
+
export type TaDesktopEvent = {
|
|
223
|
+
type: 'prompt';
|
|
224
|
+
prompt: TaDesktopPrompt;
|
|
225
|
+
} | {
|
|
226
|
+
type: 'prompt_closed';
|
|
227
|
+
promptId: string;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* The desktops of other computers, seen and worked from a page (docs/design/ta-desktop-remote.md 5): the connection
|
|
231
|
+
* is ta serve's, through the ExecEnvironment of the machine it goes from; a page only gets pictures and sends input.
|
|
232
|
+
*/
|
|
233
|
+
export interface TaScreenShareServer {
|
|
234
|
+
/** This computer, the hosts of ssh directories and the desktops added, and who looks at and works each. */
|
|
235
|
+
listDesktops(): Promise<TaDesktopInfo[]>;
|
|
236
|
+
/** The screens of a desktop, connecting to it when no page does. */
|
|
237
|
+
listDesktopScreens(target: TaDesktopTarget): Promise<TaDesktopScreen[]>;
|
|
238
|
+
/** Adds a desktop of a VNC server a computer reaches at host:port (through `via`). */
|
|
239
|
+
addDesktop(target: TaDesktopTarget): Promise<TaDesktopInfo>;
|
|
240
|
+
removeDesktop(desktopId: string): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Starts looking at a desktop, connecting to it when no page does. The same `clientMessageId` (the page computes it
|
|
243
|
+
* from itself and the desktop) gives the same viewer while it lives. `device`: what the page is on.
|
|
244
|
+
*/
|
|
245
|
+
openDesktop(options: {
|
|
246
|
+
target: TaDesktopTarget;
|
|
247
|
+
view: TaDesktopView;
|
|
248
|
+
clientMessageId: string;
|
|
249
|
+
device?: string;
|
|
250
|
+
}): Promise<TaDesktopViewer>;
|
|
251
|
+
closeDesktop(viewerId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Claims frame `want` (docs/design/ta-desktop-remote.md 5.4): kept, it comes again; the next waits for a change;
|
|
254
|
+
* one beyond waits for the one before; one dropped or beyond built + 4 is `stale`; 10 s without change `idle`; a
|
|
255
|
+
* viewer gone `unknown`. The same (viewerId, want) always gets the same answer.
|
|
256
|
+
*/
|
|
257
|
+
readDesktopFrames(viewerId: string, want: number): Promise<TaDesktopFrames>;
|
|
258
|
+
setDesktopView(viewerId: string, view: TaDesktopView): Promise<void>;
|
|
259
|
+
/** Input of the viewer in control; `seq`, larger each batch, is taken once. */
|
|
260
|
+
sendDesktopInput(viewerId: string, batch: {
|
|
261
|
+
seq: number;
|
|
262
|
+
events: TaDesktopInput[];
|
|
263
|
+
}): Promise<void>;
|
|
264
|
+
/** Puts text into the clipboard of the desktop, taken once by its id; `press` then presses the keys that paste. */
|
|
265
|
+
pasteToDesktop(viewerId: string, input: {
|
|
266
|
+
text: string;
|
|
267
|
+
press?: boolean;
|
|
268
|
+
clientMessageId: string;
|
|
269
|
+
}): Promise<void>;
|
|
270
|
+
/** The text of the clipboard of the desktop: none in the first stage. */
|
|
271
|
+
readDesktopClipboard(viewerId: string): Promise<string | undefined>;
|
|
272
|
+
/** Takes control: a page of the owner at once (`asked` false). */
|
|
273
|
+
takeDesktopControl(viewerId: string): Promise<{
|
|
274
|
+
control: TaDesktopControl | null;
|
|
275
|
+
asked: boolean;
|
|
276
|
+
}>;
|
|
277
|
+
releaseDesktopControl(viewerId: string): Promise<void>;
|
|
278
|
+
/** Ends every viewer of every desktop, at once. */
|
|
279
|
+
endAllDesktops(): Promise<void>;
|
|
280
|
+
/** Prompts open now; later ones come by TaClient.onScreenShareEvent. */
|
|
281
|
+
watchDesktops(): Promise<TaDesktopPrompt[]>;
|
|
282
|
+
/**
|
|
283
|
+
* Answers a prompt; null cancels. The first answer counts. `remember` on a password a prompt offers to keep
|
|
284
|
+
* (TaDesktopPrompt.remember): kept once the desktop took it, and given by itself from then on.
|
|
285
|
+
*/
|
|
286
|
+
answerDesktop(promptId: string, answer: TaDesktopSignIn | null, remember?: boolean): Promise<boolean>;
|
|
287
|
+
}
|
|
288
|
+
export declare namespace TaDesktopUtil {
|
|
289
|
+
const DEFAULT_PORT = 5900;
|
|
290
|
+
/** `<via>|<host>:<port>`: one id for one desktop however it is written, its name aside. */
|
|
291
|
+
function id(target: TaDesktopTarget): string;
|
|
292
|
+
function host(target: TaDesktopTarget): string;
|
|
293
|
+
function port(target: TaDesktopTarget): number;
|
|
294
|
+
/** The target of an id, undefined for one that is none. */
|
|
295
|
+
function parse(id: string): TaDesktopTarget | undefined;
|
|
296
|
+
/** VNC ports of a display (5900 + n) and others a server may listen on; never one of a well-known service. */
|
|
297
|
+
function validPort(port: unknown): port is number;
|
|
298
|
+
/** A host name or an IP address, nothing a shell or a URL could read as more. */
|
|
299
|
+
/** A host of this machine's loopback. */
|
|
300
|
+
function loopback(host: string): boolean;
|
|
301
|
+
function validHost(host: unknown): host is string;
|
|
302
|
+
}
|
|
303
|
+
/** X11 keysyms of the keys a page sends by name (KeyboardEvent.key); a character is its code point (Latin-1) or 0x01000000 + it. */
|
|
304
|
+
export declare const TA_DESKTOP_KEYSYMS: Readonly<Record<string, number>>;
|
|
305
|
+
//# sourceMappingURL=screen-share-protocol.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TA_DESKTOP_KEYSYMS = exports.TaDesktopUtil = exports.TA_DESKTOP_LOCKED_MESSAGE = exports.TA_SCREEN_SHARE_SERVICE = exports.TaScreenShareServer = void 0;
|
|
4
|
+
exports.TaScreenShareServer = Symbol('TaScreenShareServer');
|
|
5
|
+
exports.TA_SCREEN_SHARE_SERVICE = 'TaScreenShareServer';
|
|
6
|
+
/**
|
|
7
|
+
* What a call refused for a remote desktop says, in English: the kernel and ta-team say it the same
|
|
8
|
+
* (docs/design/ta-desktop-remote.md 6.7).
|
|
9
|
+
*/
|
|
10
|
+
exports.TA_DESKTOP_LOCKED_MESSAGE = 'Not while someone else works a desktop of this Ta.';
|
|
11
|
+
var TaDesktopUtil;
|
|
12
|
+
(function (TaDesktopUtil) {
|
|
13
|
+
TaDesktopUtil.DEFAULT_PORT = 5900;
|
|
14
|
+
/** `<via>|<host>:<port>`: one id for one desktop however it is written, its name aside. */
|
|
15
|
+
function id(target) {
|
|
16
|
+
var _a;
|
|
17
|
+
return `${(_a = target.via) !== null && _a !== void 0 ? _a : ''}|${host(target)}:${port(target)}`;
|
|
18
|
+
}
|
|
19
|
+
TaDesktopUtil.id = id;
|
|
20
|
+
function host(target) {
|
|
21
|
+
var _a;
|
|
22
|
+
return ((_a = target.host) !== null && _a !== void 0 ? _a : '').trim() || '127.0.0.1';
|
|
23
|
+
}
|
|
24
|
+
TaDesktopUtil.host = host;
|
|
25
|
+
function port(target) {
|
|
26
|
+
var _a;
|
|
27
|
+
return (_a = target.port) !== null && _a !== void 0 ? _a : TaDesktopUtil.DEFAULT_PORT;
|
|
28
|
+
}
|
|
29
|
+
TaDesktopUtil.port = port;
|
|
30
|
+
/** The target of an id, undefined for one that is none. */
|
|
31
|
+
function parse(id) {
|
|
32
|
+
const match = /^([^|]*)\|(.+):(\d+)$/.exec(String(id !== null && id !== void 0 ? id : ''));
|
|
33
|
+
if (!match) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const port = Number(match[3]);
|
|
37
|
+
return port > 0 && port < 65536 ? { via: match[1], host: match[2], port } : undefined;
|
|
38
|
+
}
|
|
39
|
+
TaDesktopUtil.parse = parse;
|
|
40
|
+
/** VNC ports of a display (5900 + n) and others a server may listen on; never one of a well-known service. */
|
|
41
|
+
function validPort(port) {
|
|
42
|
+
return typeof port === 'number' && Number.isInteger(port) && port >= 1024 && port < 65536;
|
|
43
|
+
}
|
|
44
|
+
TaDesktopUtil.validPort = validPort;
|
|
45
|
+
/** A host name or an IP address, nothing a shell or a URL could read as more. */
|
|
46
|
+
/** A host of this machine's loopback. */
|
|
47
|
+
function loopback(host) {
|
|
48
|
+
return /^(127\.\d+\.\d+\.\d+|localhost|::1|\[::1\])$/i.test(host);
|
|
49
|
+
}
|
|
50
|
+
TaDesktopUtil.loopback = loopback;
|
|
51
|
+
function validHost(host) {
|
|
52
|
+
return typeof host === 'string' && /^[A-Za-z0-9.:\-[\]]{1,253}$/.test(host);
|
|
53
|
+
}
|
|
54
|
+
TaDesktopUtil.validHost = validHost;
|
|
55
|
+
})(TaDesktopUtil || (exports.TaDesktopUtil = TaDesktopUtil = {}));
|
|
56
|
+
/** X11 keysyms of the keys a page sends by name (KeyboardEvent.key); a character is its code point (Latin-1) or 0x01000000 + it. */
|
|
57
|
+
exports.TA_DESKTOP_KEYSYMS = {
|
|
58
|
+
Backspace: 0xff08,
|
|
59
|
+
Tab: 0xff09,
|
|
60
|
+
Enter: 0xff0d,
|
|
61
|
+
Escape: 0xff1b,
|
|
62
|
+
Delete: 0xffff,
|
|
63
|
+
Home: 0xff50,
|
|
64
|
+
ArrowLeft: 0xff51,
|
|
65
|
+
ArrowUp: 0xff52,
|
|
66
|
+
ArrowRight: 0xff53,
|
|
67
|
+
ArrowDown: 0xff54,
|
|
68
|
+
PageUp: 0xff55,
|
|
69
|
+
PageDown: 0xff56,
|
|
70
|
+
End: 0xff57,
|
|
71
|
+
Insert: 0xff63,
|
|
72
|
+
F1: 0xffbe,
|
|
73
|
+
F2: 0xffbf,
|
|
74
|
+
F3: 0xffc0,
|
|
75
|
+
F4: 0xffc1,
|
|
76
|
+
F5: 0xffc2,
|
|
77
|
+
F6: 0xffc3,
|
|
78
|
+
F7: 0xffc4,
|
|
79
|
+
F8: 0xffc5,
|
|
80
|
+
F9: 0xffc6,
|
|
81
|
+
F10: 0xffc7,
|
|
82
|
+
F11: 0xffc8,
|
|
83
|
+
F12: 0xffc9,
|
|
84
|
+
Shift: 0xffe1,
|
|
85
|
+
Control: 0xffe3,
|
|
86
|
+
Meta: 0xffe7,
|
|
87
|
+
Alt: 0xffe9,
|
|
88
|
+
Super: 0xffeb,
|
|
89
|
+
CapsLock: 0xffe5,
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=screen-share-protocol.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const TaSettingsServer: unique symbol;
|
|
2
2
|
export declare const TA_SETTINGS_SERVICE = "TaSettingsServer";
|
|
3
|
+
/** The api of the models of other coding agents (ta-agents) begins so: `acp-<agent id>`. */
|
|
4
|
+
export declare const TA_AGENT_API_PREFIX = "acp-";
|
|
3
5
|
/** Where a setting of ta is kept: pi's `settings.json` of the user (the agent directory), or of a project (`.ta/` of its directory), which wins. */
|
|
4
6
|
export type TaSettingsScope = 'user' | 'project';
|
|
5
7
|
/** A setting of ta that clients show and change; the key is its path in pi's `settings.json`. */
|
|
@@ -28,6 +30,12 @@ export interface TaSettingsSnapshot {
|
|
|
28
30
|
projectTrusted: boolean;
|
|
29
31
|
/** `<provider>/<model id>` of the models with credentials, for the model setting. */
|
|
30
32
|
models: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Those of `models` that are other coding agents (ta-agents, their api `TA_AGENT_API_PREFIX`…): they work with
|
|
35
|
+
* their own tools, so they cannot run a conversation that may use only some of Ta's (a call's front, a turn for
|
|
36
|
+
* others in a room).
|
|
37
|
+
*/
|
|
38
|
+
agents?: string[];
|
|
31
39
|
/** The names of those of `models` that have one other than their id. */
|
|
32
40
|
modelNames?: Record<string, string>;
|
|
33
41
|
/** By id, the names of the providers of `models` (`Kimi For Coding` for `kimi-coding`), as the lists of models group them. */
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TA_SETTINGS = exports.TA_SETTINGS_SERVICE = exports.TaSettingsServer = void 0;
|
|
3
|
+
exports.TA_SETTINGS = exports.TA_AGENT_API_PREFIX = exports.TA_SETTINGS_SERVICE = exports.TaSettingsServer = void 0;
|
|
4
4
|
exports.TaSettingsServer = Symbol('TaSettingsServer');
|
|
5
5
|
exports.TA_SETTINGS_SERVICE = 'TaSettingsServer';
|
|
6
|
+
/** The api of the models of other coding agents (ta-agents) begins so: `acp-<agent id>`. */
|
|
7
|
+
exports.TA_AGENT_API_PREFIX = 'acp-';
|
|
6
8
|
/** The settings of ta that clients change, as pi names them; other keys of the files are left as they are. */
|
|
7
9
|
exports.TA_SETTINGS = [
|
|
8
10
|
{ key: 'model', type: 'model' },
|
|
@@ -26,6 +26,8 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
|
|
|
26
26
|
readonly relays: TaExtensionRelays;
|
|
27
27
|
/** The voice services of calls, as packages add types of them (docs/design/ta-voice.md). */
|
|
28
28
|
readonly voices: TaExtensionVoices;
|
|
29
|
+
/** Where sign-ins Ta itself uses are kept, as a package keeps them (the vault): the password of a remote desktop. */
|
|
30
|
+
readonly credentials: TaExtensionCredentials;
|
|
29
31
|
/** pi's messages of a session file, of the branch it is on (its first message first), without opening it. */
|
|
30
32
|
sessionMessages(sessionFile: string): Promise<unknown[]>;
|
|
31
33
|
/** The role a session file was opened with last (TaOpenSessionOptions.appendSystemPrompt), without opening it; undefined without one. */
|
|
@@ -60,6 +62,31 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
|
|
|
60
62
|
*/
|
|
61
63
|
updateSettings(update: (settings: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
|
|
62
64
|
}
|
|
65
|
+
/** A sign-in Ta gives on the user's behalf: the account of the Screen Sharing of macOS, or the password of VNC. */
|
|
66
|
+
export interface TaCredential {
|
|
67
|
+
username?: string;
|
|
68
|
+
password: string;
|
|
69
|
+
}
|
|
70
|
+
/** What a sign-in is for, for the page that lists what is kept. */
|
|
71
|
+
export interface TaCredentialAbout {
|
|
72
|
+
/** `desktop`: a remote desktop. */
|
|
73
|
+
feature: 'desktop';
|
|
74
|
+
/** The name of what it signs in to: the computer. */
|
|
75
|
+
name: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Where Ta keeps sign-ins it gives by itself, by an id of its own (`desktop:<id of the desktop>`). Never for the
|
|
79
|
+
* model, nor a command, nor a page: ta serve alone reads them.
|
|
80
|
+
*/
|
|
81
|
+
export interface TaCredentialStore {
|
|
82
|
+
get(id: string): Promise<TaCredential | undefined>;
|
|
83
|
+
set(id: string, credential: TaCredential, about: TaCredentialAbout): Promise<void>;
|
|
84
|
+
remove(id: string): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
/** Sign-ins for the server side of packages: one package keeps them (the vault), gone again with what register returns. */
|
|
87
|
+
export interface TaExtensionCredentials {
|
|
88
|
+
register(store: TaCredentialStore): () => void;
|
|
89
|
+
}
|
|
63
90
|
/** relays.json for the server side of packages: which service a feature uses, and choosing one for it. */
|
|
64
91
|
export interface TaExtensionRelays {
|
|
65
92
|
/** The service a feature uses now: a relay of Ta, or a folder (only `sync` goes to one). */
|
|
@@ -329,6 +356,12 @@ export interface TaNotice {
|
|
|
329
356
|
* conversations, what they asked before) leaves such a session out: what it says goes to others.
|
|
330
357
|
*/
|
|
331
358
|
export declare const TA_WITH_OTHERS_MARK = "[ta:speaks-with-others]";
|
|
359
|
+
/**
|
|
360
|
+
* In the role of a session a package opened that tells the user of its turns itself (the conversation of a goal,
|
|
361
|
+
* ta-goals): ta-notify tells of its turns only when they fail or ask, as of a session of a `group`, which this one is
|
|
362
|
+
* not, so that it stays a conversation of the lists.
|
|
363
|
+
*/
|
|
364
|
+
export declare const TA_TELLS_OF_ITS_TURNS_MARK = "[ta:tells-of-its-turns]";
|
|
332
365
|
/**
|
|
333
366
|
* Starts the `<context>` of a message of the user that asks Ta to keep how a conversation got its work done, so that it
|
|
334
367
|
* need not be told again (Keep of ta-recall, in the + of the message box): Ta picks the form that fits. A package that
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaAskUtil = exports.TA_ASK_ENTRY = exports.TA_BRIEF_SOURCE = exports.TA_KEEP_MARK = exports.TA_WITH_OTHERS_MARK = exports.TA_NOTICES = exports.TA_DOUBLE_TASKS = exports.TA_DOUBLE_LOOK = exports.TA_DOUBLE_FILE = exports.TA_FILE_WRITE_EVENT = exports.TaHostUtil = exports.TA_HOST_EVENT = exports.TA_WEBHOOK_MAX_BYTES = void 0;
|
|
3
|
+
exports.TaAskUtil = exports.TA_ASK_ENTRY = exports.TA_BRIEF_SOURCE = exports.TA_KEEP_MARK = exports.TA_TELLS_OF_ITS_TURNS_MARK = exports.TA_WITH_OTHERS_MARK = exports.TA_NOTICES = exports.TA_DOUBLE_TASKS = exports.TA_DOUBLE_LOOK = exports.TA_DOUBLE_FILE = exports.TA_FILE_WRITE_EVENT = exports.TaHostUtil = exports.TA_HOST_EVENT = exports.TA_WEBHOOK_MAX_BYTES = void 0;
|
|
4
4
|
/** The largest body a webhook takes; a larger one is refused (413). */
|
|
5
5
|
exports.TA_WEBHOOK_MAX_BYTES = 256 * 1024;
|
|
6
6
|
/**
|
|
@@ -108,6 +108,12 @@ exports.TA_NOTICES = { name: '@celljs/ta-notify', key: 'notices' };
|
|
|
108
108
|
* conversations, what they asked before) leaves such a session out: what it says goes to others.
|
|
109
109
|
*/
|
|
110
110
|
exports.TA_WITH_OTHERS_MARK = '[ta:speaks-with-others]';
|
|
111
|
+
/**
|
|
112
|
+
* In the role of a session a package opened that tells the user of its turns itself (the conversation of a goal,
|
|
113
|
+
* ta-goals): ta-notify tells of its turns only when they fail or ask, as of a session of a `group`, which this one is
|
|
114
|
+
* not, so that it stays a conversation of the lists.
|
|
115
|
+
*/
|
|
116
|
+
exports.TA_TELLS_OF_ITS_TURNS_MARK = '[ta:tells-of-its-turns]';
|
|
111
117
|
/**
|
|
112
118
|
* Starts the `<context>` of a message of the user that asks Ta to keep how a conversation got its work done, so that it
|
|
113
119
|
* need not be told again (Keep of ta-recall, in the + of the message box): Ta picks the form that fits. A package that
|
|
@@ -4,6 +4,7 @@ import type { ImageContent, RpcCommand, RpcExtensionUIRequest, RpcExtensionUIRes
|
|
|
4
4
|
import type { TaSessionPerson } from './presence-protocol';
|
|
5
5
|
import type { TaRemoteEvent } from './remote-protocol';
|
|
6
6
|
import type { TaRoomEvent } from './room-protocol';
|
|
7
|
+
import type { TaDesktopEvent } from './screen-share-protocol';
|
|
7
8
|
import type { TaAsking } from './ta-extension-host';
|
|
8
9
|
import type { TaMemberInfo } from './team-protocol';
|
|
9
10
|
import type { TaVoiceEvent } from './voice-protocol';
|
|
@@ -483,6 +484,8 @@ export interface TaClient {
|
|
|
483
484
|
onRoomEvent(event: TaRoomEvent): Promise<void>;
|
|
484
485
|
/** What a voice this connection opened for a call tells (TaVoiceServer.openVoice). */
|
|
485
486
|
onVoiceEvent(event: TaVoiceEvent): Promise<void>;
|
|
487
|
+
/** What the desktops ask (a password), once this connection called TaScreenShareServer.watchDesktops. */
|
|
488
|
+
onScreenShareEvent(event: TaDesktopEvent): Promise<void>;
|
|
486
489
|
/**
|
|
487
490
|
* ta serve asks this page something (TaPageServer.attach said it answers `kind`): what it answers, or an error. Only
|
|
488
491
|
* a page of the person whose run asks is asked (docs/design/ta-app-use.md 4.1).
|
|
@@ -16,7 +16,7 @@ export interface TaSharedRef {
|
|
|
16
16
|
/** What an action is done on. */
|
|
17
17
|
export interface TaResource {
|
|
18
18
|
/** `session`: a conversation, by its file; `dir`: a directory or a file in it, by its path; `agent`, `channel`: one of ta-channels, by its id. */
|
|
19
|
-
kind: 'session' | 'dir' | 'agent' | 'channel';
|
|
19
|
+
kind: 'session' | 'dir' | 'agent' | 'channel' | 'desktop';
|
|
20
20
|
/** The session file, the path, or the id of the agent or channel. */
|
|
21
21
|
id: string;
|
|
22
22
|
/** A session: where it works. */
|
|
@@ -128,14 +128,25 @@ export interface TaActionInfo {
|
|
|
128
128
|
scoped?: boolean;
|
|
129
129
|
/** Reaches beyond what Ta checks (a command can touch any file): only for people trusted. */
|
|
130
130
|
risky?: boolean;
|
|
131
|
+
/** `single`: given only on its own to one person, never by a role (docs/design/ta-desktop-remote.md 6.2). */
|
|
132
|
+
grant?: 'role' | 'single';
|
|
131
133
|
}
|
|
132
|
-
export type TaActionArea = 'chat' | 'agent' | 'channel' | 'task' | 'files' | 'commands' | 'hosts' | 'models' | 'cron' | 'extensions' | 'settings' | 'members' | 'audit';
|
|
134
|
+
export type TaActionArea = 'chat' | 'agent' | 'channel' | 'task' | 'files' | 'commands' | 'hosts' | 'models' | 'cron' | 'extensions' | 'settings' | 'members' | 'audit' | 'desktop';
|
|
133
135
|
/** Every action of Ta itself; packages add their own (`pi.permissions` of their package.json). */
|
|
134
136
|
export declare const TA_ACTIONS: readonly TaActionInfo[];
|
|
137
|
+
/**
|
|
138
|
+
* Actions of the owner alone (docs/design/ta-desktop-remote.md 6.2): their words for records and notices, never in
|
|
139
|
+
* TA_ACTIONS, so that no role or grant gives them; TaActionUtil.grantable says no to every one of their areas.
|
|
140
|
+
*/
|
|
141
|
+
export declare const TA_OWNER_ACTIONS: readonly TaActionInfo[];
|
|
135
142
|
export declare namespace TaActionUtil {
|
|
136
143
|
function info(id: string): TaActionInfo | undefined;
|
|
137
144
|
/** Its title in a language such as `zh-CN`; the id for an action of no catalog. */
|
|
138
145
|
function title(id: string, language: string): string;
|
|
146
|
+
/** Whether an action may be given to someone at all, by a role or on its own: one of TA_ACTIONS, of no area of the owner's. */
|
|
147
|
+
function grantable(id: string): boolean;
|
|
148
|
+
/** Whether an action may be in a role: grantable, and not one given only on its own (`grant: 'single'`). */
|
|
149
|
+
function inRoles(id: string): boolean;
|
|
139
150
|
/** Whether `path` is `dir` or inside it; both absolute, `/` separated. */
|
|
140
151
|
function inside(dir: string, path: string): boolean;
|
|
141
152
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* may do anything.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TaActionUtil = exports.TA_ACTIONS = exports.TA_ACCESS_REQUEST_EVENT = exports.TaPermissionUtil = exports.TA_UNDECLARED = exports.TA_INVITE_PREFIX = exports.TA_OWNER = void 0;
|
|
9
|
+
exports.TaActionUtil = exports.TA_OWNER_ACTIONS = exports.TA_ACTIONS = exports.TA_ACCESS_REQUEST_EVENT = exports.TaPermissionUtil = exports.TA_UNDECLARED = exports.TA_INVITE_PREFIX = exports.TA_OWNER = void 0;
|
|
10
10
|
const language_1 = require("./language");
|
|
11
11
|
/** The user of the Ta: its own pages, devices and token. Everyone else is let in by a package. */
|
|
12
12
|
exports.TA_OWNER = 'owner';
|
|
@@ -70,7 +70,8 @@ exports.TA_ACTIONS = [
|
|
|
70
70
|
action('commands.terminal', 'Open terminals', '打开终端', '開啟終端機', 'ターミナルを開く', { scoped: true, risky: true }),
|
|
71
71
|
action('hosts.use', 'Use remote hosts', '使用远程主机', '使用遠端主機', 'リモートホストを使用', { risky: true }),
|
|
72
72
|
action('models.use', 'Use the models', '使用模型', '使用模型', 'モデルを使用'),
|
|
73
|
-
|
|
73
|
+
// In no role: who has it may send the owner's conversations to a service of their own (docs/design/ta-desktop-remote.md 6.2).
|
|
74
|
+
action('models.manage', 'Sign in to models', '登录和更换模型账号', '登入和更換模型帳號', 'モデルアカウントにサインイン・変更', { grant: 'single' }),
|
|
74
75
|
action('cron.view', 'See scheduled tasks', '查看定时任务', '檢視定時任務', 'スケジュールタスクを確認'),
|
|
75
76
|
action('cron.manage', 'Change scheduled tasks', '管理定时任务', '管理定時任務', 'スケジュールタスクを管理'),
|
|
76
77
|
action('extensions.use', 'Use extensions', '使用扩展', '使用擴充功能', '拡張機能を使用'),
|
|
@@ -83,9 +84,21 @@ exports.TA_ACTIONS = [
|
|
|
83
84
|
action('members.roles', 'Change roles and members', '管理角色和成员', '管理角色和成員', 'ロールとメンバーを管理'),
|
|
84
85
|
action('audit.view', 'See the record', '查看记录', '檢視記錄', 'レコードを確認'),
|
|
85
86
|
];
|
|
87
|
+
/**
|
|
88
|
+
* Actions of the owner alone (docs/design/ta-desktop-remote.md 6.2): their words for records and notices, never in
|
|
89
|
+
* TA_ACTIONS, so that no role or grant gives them; TaActionUtil.grantable says no to every one of their areas.
|
|
90
|
+
*/
|
|
91
|
+
exports.TA_OWNER_ACTIONS = [
|
|
92
|
+
action('desktop.view', 'See remote desktops', '查看远程桌面', '檢視遠端桌面', 'リモートデスクトップを見る', { risky: true }),
|
|
93
|
+
action('desktop.control', 'Work remote desktops', '操作远程桌面', '操作遠端桌面', 'リモートデスクトップを操作', { risky: true }),
|
|
94
|
+
];
|
|
95
|
+
/** The areas of TA_OWNER_ACTIONS: nothing of them is given to anyone, whatever a role or team.json says. */
|
|
96
|
+
const OWNER_AREAS = ['desktop'];
|
|
86
97
|
var TaActionUtil;
|
|
87
98
|
(function (TaActionUtil) {
|
|
88
99
|
const byId = new Map(exports.TA_ACTIONS.map(one => [one.id, one]));
|
|
100
|
+
/** Titles of the owner's actions too, for records and notices. */
|
|
101
|
+
const titled = new Map([...exports.TA_ACTIONS, ...exports.TA_OWNER_ACTIONS].map(one => [one.id, one]));
|
|
89
102
|
function info(id) {
|
|
90
103
|
return byId.get(id);
|
|
91
104
|
}
|
|
@@ -94,7 +107,7 @@ var TaActionUtil;
|
|
|
94
107
|
function title(id, language) {
|
|
95
108
|
var _a;
|
|
96
109
|
var _b, _c;
|
|
97
|
-
const title = (_a =
|
|
110
|
+
const title = (_a = titled.get(id)) === null || _a === void 0 ? void 0 : _a.title;
|
|
98
111
|
if (!title) {
|
|
99
112
|
return id;
|
|
100
113
|
}
|
|
@@ -106,6 +119,18 @@ var TaActionUtil;
|
|
|
106
119
|
});
|
|
107
120
|
}
|
|
108
121
|
TaActionUtil.title = title;
|
|
122
|
+
/** Whether an action may be given to someone at all, by a role or on its own: one of TA_ACTIONS, of no area of the owner's. */
|
|
123
|
+
function grantable(id) {
|
|
124
|
+
const info = byId.get(id);
|
|
125
|
+
return !!info && !OWNER_AREAS.includes(info.area);
|
|
126
|
+
}
|
|
127
|
+
TaActionUtil.grantable = grantable;
|
|
128
|
+
/** Whether an action may be in a role: grantable, and not one given only on its own (`grant: 'single'`). */
|
|
129
|
+
function inRoles(id) {
|
|
130
|
+
var _a;
|
|
131
|
+
return grantable(id) && ((_a = byId.get(id)) === null || _a === void 0 ? void 0 : _a.grant) !== 'single';
|
|
132
|
+
}
|
|
133
|
+
TaActionUtil.inRoles = inRoles;
|
|
109
134
|
/** Whether `path` is `dir` or inside it; both absolute, `/` separated. */
|
|
110
135
|
function inside(dir, path) {
|
|
111
136
|
const base = dir.replace(/\/+$/, '');
|