@celljs/ta-protocol 4.16.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 +120 -0
- package/esm/common/app-protocol.js +213 -0
- package/esm/common/delegate-protocol.d.ts +30 -0
- package/esm/common/delegate-protocol.js +52 -0
- package/esm/common/deployment-protocol.d.ts +72 -0
- package/esm/common/deployment-protocol.js +171 -0
- package/esm/common/error-protocol.d.ts +42 -0
- package/esm/common/error-protocol.js +45 -0
- package/esm/common/event-protocol.d.ts +63 -0
- package/esm/common/event-protocol.js +2 -0
- package/esm/common/gateway-protocol.d.ts +29 -0
- package/esm/common/index.d.ts +11 -0
- package/esm/common/index.js +11 -0
- package/esm/common/message-protocol.d.ts +134 -0
- package/esm/common/message-protocol.js +322 -0
- package/esm/common/page-protocol.d.ts +56 -0
- package/esm/common/page-protocol.js +12 -0
- package/esm/common/path-map.d.ts +24 -0
- package/esm/common/path-map.js +127 -0
- package/esm/common/presence-protocol.js +1 -1
- package/esm/common/redactor.d.ts +12 -0
- package/esm/common/redactor.js +49 -11
- package/esm/common/relay-protocol.d.ts +20 -0
- package/esm/common/room-protocol.d.ts +52 -1
- 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 +64 -1
- package/esm/common/ta-extension-host.js +8 -0
- package/esm/common/ta-protocol.d.ts +53 -175
- package/esm/common/ta-protocol.js +0 -234
- package/esm/common/team-protocol.d.ts +13 -2
- package/esm/common/team-protocol.js +27 -2
- package/esm/common/voice-protocol.d.ts +184 -0
- package/esm/common/voice-protocol.js +57 -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 +121 -0
- package/lib/common/app-protocol.js +216 -0
- package/lib/common/delegate-protocol.d.ts +31 -0
- package/lib/common/delegate-protocol.js +55 -0
- package/lib/common/deployment-protocol.d.ts +73 -0
- package/lib/common/deployment-protocol.js +175 -0
- package/lib/common/error-protocol.d.ts +43 -0
- package/lib/common/error-protocol.js +48 -0
- package/lib/common/event-protocol.d.ts +64 -0
- package/lib/common/event-protocol.js +3 -0
- package/lib/common/gateway-protocol.d.ts +29 -0
- package/lib/common/index.d.ts +11 -0
- package/lib/common/index.js +11 -0
- package/lib/common/message-protocol.d.ts +135 -0
- package/lib/common/message-protocol.js +325 -0
- package/lib/common/page-protocol.d.ts +57 -0
- package/lib/common/page-protocol.js +15 -0
- package/lib/common/path-map.d.ts +25 -0
- package/lib/common/path-map.js +130 -0
- package/lib/common/presence-protocol.js +7 -7
- package/lib/common/redactor.d.ts +12 -0
- package/lib/common/redactor.js +49 -11
- package/lib/common/relay-protocol.d.ts +20 -0
- package/lib/common/room-protocol.d.ts +52 -1
- 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 +64 -1
- package/lib/common/ta-extension-host.js +9 -1
- package/lib/common/ta-protocol.d.ts +53 -175
- package/lib/common/ta-protocol.js +1 -235
- package/lib/common/team-protocol.d.ts +13 -2
- package/lib/common/team-protocol.js +28 -3
- package/lib/common/voice-protocol.d.ts +185 -0
- package/lib/common/voice-protocol.js +60 -0
- package/package.json +1 -1
|
@@ -0,0 +1,304 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const TaScreenShareServer = Symbol('TaScreenShareServer');
|
|
2
|
+
export 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 const TA_DESKTOP_LOCKED_MESSAGE = 'Not while someone else works a desktop of this Ta.';
|
|
8
|
+
export var TaDesktopUtil;
|
|
9
|
+
(function (TaDesktopUtil) {
|
|
10
|
+
TaDesktopUtil.DEFAULT_PORT = 5900;
|
|
11
|
+
/** `<via>|<host>:<port>`: one id for one desktop however it is written, its name aside. */
|
|
12
|
+
function id(target) {
|
|
13
|
+
var _a;
|
|
14
|
+
return `${(_a = target.via) !== null && _a !== void 0 ? _a : ''}|${host(target)}:${port(target)}`;
|
|
15
|
+
}
|
|
16
|
+
TaDesktopUtil.id = id;
|
|
17
|
+
function host(target) {
|
|
18
|
+
var _a;
|
|
19
|
+
return ((_a = target.host) !== null && _a !== void 0 ? _a : '').trim() || '127.0.0.1';
|
|
20
|
+
}
|
|
21
|
+
TaDesktopUtil.host = host;
|
|
22
|
+
function port(target) {
|
|
23
|
+
var _a;
|
|
24
|
+
return (_a = target.port) !== null && _a !== void 0 ? _a : TaDesktopUtil.DEFAULT_PORT;
|
|
25
|
+
}
|
|
26
|
+
TaDesktopUtil.port = port;
|
|
27
|
+
/** The target of an id, undefined for one that is none. */
|
|
28
|
+
function parse(id) {
|
|
29
|
+
const match = /^([^|]*)\|(.+):(\d+)$/.exec(String(id !== null && id !== void 0 ? id : ''));
|
|
30
|
+
if (!match) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const port = Number(match[3]);
|
|
34
|
+
return port > 0 && port < 65536 ? { via: match[1], host: match[2], port } : undefined;
|
|
35
|
+
}
|
|
36
|
+
TaDesktopUtil.parse = parse;
|
|
37
|
+
/** VNC ports of a display (5900 + n) and others a server may listen on; never one of a well-known service. */
|
|
38
|
+
function validPort(port) {
|
|
39
|
+
return typeof port === 'number' && Number.isInteger(port) && port >= 1024 && port < 65536;
|
|
40
|
+
}
|
|
41
|
+
TaDesktopUtil.validPort = validPort;
|
|
42
|
+
/** A host name or an IP address, nothing a shell or a URL could read as more. */
|
|
43
|
+
/** A host of this machine's loopback. */
|
|
44
|
+
function loopback(host) {
|
|
45
|
+
return /^(127\.\d+\.\d+\.\d+|localhost|::1|\[::1\])$/i.test(host);
|
|
46
|
+
}
|
|
47
|
+
TaDesktopUtil.loopback = loopback;
|
|
48
|
+
function validHost(host) {
|
|
49
|
+
return typeof host === 'string' && /^[A-Za-z0-9.:\-[\]]{1,253}$/.test(host);
|
|
50
|
+
}
|
|
51
|
+
TaDesktopUtil.validHost = validHost;
|
|
52
|
+
})(TaDesktopUtil || (TaDesktopUtil = {}));
|
|
53
|
+
/** X11 keysyms of the keys a page sends by name (KeyboardEvent.key); a character is its code point (Latin-1) or 0x01000000 + it. */
|
|
54
|
+
export const TA_DESKTOP_KEYSYMS = {
|
|
55
|
+
Backspace: 0xff08,
|
|
56
|
+
Tab: 0xff09,
|
|
57
|
+
Enter: 0xff0d,
|
|
58
|
+
Escape: 0xff1b,
|
|
59
|
+
Delete: 0xffff,
|
|
60
|
+
Home: 0xff50,
|
|
61
|
+
ArrowLeft: 0xff51,
|
|
62
|
+
ArrowUp: 0xff52,
|
|
63
|
+
ArrowRight: 0xff53,
|
|
64
|
+
ArrowDown: 0xff54,
|
|
65
|
+
PageUp: 0xff55,
|
|
66
|
+
PageDown: 0xff56,
|
|
67
|
+
End: 0xff57,
|
|
68
|
+
Insert: 0xff63,
|
|
69
|
+
F1: 0xffbe,
|
|
70
|
+
F2: 0xffbf,
|
|
71
|
+
F3: 0xffc0,
|
|
72
|
+
F4: 0xffc1,
|
|
73
|
+
F5: 0xffc2,
|
|
74
|
+
F6: 0xffc3,
|
|
75
|
+
F7: 0xffc4,
|
|
76
|
+
F8: 0xffc5,
|
|
77
|
+
F9: 0xffc6,
|
|
78
|
+
F10: 0xffc7,
|
|
79
|
+
F11: 0xffc8,
|
|
80
|
+
F12: 0xffc9,
|
|
81
|
+
Shift: 0xffe1,
|
|
82
|
+
Control: 0xffe3,
|
|
83
|
+
Meta: 0xffe7,
|
|
84
|
+
Alt: 0xffe9,
|
|
85
|
+
Super: 0xffeb,
|
|
86
|
+
CapsLock: 0xffe5,
|
|
87
|
+
};
|
|
88
|
+
//# 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,5 +1,7 @@
|
|
|
1
1
|
export const TaSettingsServer = Symbol('TaSettingsServer');
|
|
2
2
|
export const TA_SETTINGS_SERVICE = 'TaSettingsServer';
|
|
3
|
+
/** The api of the models of other coding agents (ta-agents) begins so: `acp-<agent id>`. */
|
|
4
|
+
export const TA_AGENT_API_PREFIX = 'acp-';
|
|
3
5
|
/** The settings of ta that clients change, as pi names them; other keys of the files are left as they are. */
|
|
4
6
|
export const TA_SETTINGS = [
|
|
5
7
|
{ key: 'model', type: 'model' },
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { TaSignInProvider } from './access-protocol.js';
|
|
2
|
+
import type { TaHostCommands } from './app-protocol.js';
|
|
2
3
|
import type { TaPackageServer } from './package-protocol.js';
|
|
4
|
+
import type { TaHostPages } from './page-protocol.js';
|
|
3
5
|
import type { TaPresencePerson } from './presence-protocol.js';
|
|
4
6
|
import type { TaRelayFeature, TaRelayService, TaRelayStore, TaRelayType, TaShares } from './relay-protocol.js';
|
|
5
7
|
import type { TaRooms } from './room-protocol.js';
|
|
6
8
|
import type { TaServer } from './ta-protocol.js';
|
|
7
9
|
import type { TaAuthorizer, TaMemberInfo, TaResource, TaSharedData, TaSharedRef } from './team-protocol.js';
|
|
10
|
+
import type { TaExtensionVoices } from './voice-protocol.js';
|
|
8
11
|
/**
|
|
9
12
|
* What `ta serve` gives the server side of a package: the sessions and the data of packages, in its own
|
|
10
13
|
* process, without a token. A subset of TaServer and TaPackageServer: it can open, drive, stop and close
|
|
11
14
|
* sessions (best those it opened: closing one takes it from every client), not remove anything.
|
|
12
15
|
*/
|
|
13
|
-
export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'closeSession' | 'setSessionName' | 'prompt' | 'followUp' | 'abort' | 'getState' | 'getLastAssistantText'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages' | 'callPackageHost' | 'installPackage' | 'removePackage'> {
|
|
16
|
+
export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'closeSession' | 'setSessionName' | 'prompt' | 'followUp' | 'abort' | 'getState' | 'getLastAssistantText' | 'relocateDirectory'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages' | 'callPackageHost' | 'installPackage' | 'removePackage'> {
|
|
14
17
|
/** The agent directory of Ta (`~/.ta/agent`): its `extensions/` holds the packages of the user. */
|
|
15
18
|
readonly agentDir: string;
|
|
16
19
|
/** Where the conversation of a session file works, as clients name it (a path or an `ssh://` location), without opening it; undefined when it cannot be read. */
|
|
@@ -21,8 +24,14 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
|
|
|
21
24
|
readonly rooms: TaRooms;
|
|
22
25
|
/** The services of relays.json, as the user chose them for each feature (docs/design/ta-relays.md). */
|
|
23
26
|
readonly relays: TaExtensionRelays;
|
|
27
|
+
/** The voice services of calls, as packages add types of them (docs/design/ta-voice.md). */
|
|
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;
|
|
24
31
|
/** pi's messages of a session file, of the branch it is on (its first message first), without opening it. */
|
|
25
32
|
sessionMessages(sessionFile: string): Promise<unknown[]>;
|
|
33
|
+
/** The role a session file was opened with last (TaOpenSessionOptions.appendSystemPrompt), without opening it; undefined without one. */
|
|
34
|
+
sessionRole(sessionFile: string): Promise<string | undefined>;
|
|
26
35
|
/**
|
|
27
36
|
* A new conversation of `cwd` holding these messages of pi (an assistant's among them), named `name`: its session
|
|
28
37
|
* file, to open with `openSession`. As a conversation brought from elsewhere (a link of another Ta).
|
|
@@ -39,6 +48,13 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
|
|
|
39
48
|
presence(): TaPresence;
|
|
40
49
|
/** The people let into this Ta besides its user, and what they may do (docs/design/ta-team.md). */
|
|
41
50
|
readonly team: TaHostTeam;
|
|
51
|
+
/**
|
|
52
|
+
* The catalog of what can be done to Ta without its pages (docs/design/ta-app-use.md 2): an action a package
|
|
53
|
+
* registers goes when the package stops.
|
|
54
|
+
*/
|
|
55
|
+
readonly commands: TaHostCommands;
|
|
56
|
+
/** The pages of Ta open now, to ask one of them what its web extension answers (docs/design/ta-app-use.md 4.1). */
|
|
57
|
+
readonly pages: TaHostPages;
|
|
42
58
|
/**
|
|
43
59
|
* Rewrites pi's `settings.json` of the user as pi does, under its lock: `update` gets the settings read under the
|
|
44
60
|
* lock and returns them whole; the open sessions read them again. For what changes settings of the user that are no
|
|
@@ -46,6 +62,31 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
|
|
|
46
62
|
*/
|
|
47
63
|
updateSettings(update: (settings: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
|
|
48
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
|
+
}
|
|
49
90
|
/** relays.json for the server side of packages: which service a feature uses, and choosing one for it. */
|
|
50
91
|
export interface TaExtensionRelays {
|
|
51
92
|
/** The service a feature uses now: a relay of Ta, or a folder (only `sync` goes to one). */
|
|
@@ -79,7 +120,23 @@ export interface TaExtensionRelays {
|
|
|
79
120
|
export interface TaPackageService {
|
|
80
121
|
/** `ta serve` stops, or the package is turned off. */
|
|
81
122
|
dispose?(): void | Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* A POST to `/api/hooks/<directory name of the package>/<path>` of ta serve, from a script or a service of this
|
|
125
|
+
* machine: reached WITHOUT the token of ta serve, so the package checks a secret of its own in `path` and throws
|
|
126
|
+
* for one it does not know (the caller gets a 404). Its answer is sent back as JSON.
|
|
127
|
+
*/
|
|
128
|
+
webhook?(request: TaWebhookRequest): unknown | Promise<unknown>;
|
|
82
129
|
}
|
|
130
|
+
/** What a webhook of a package was sent (TaPackageService.webhook). */
|
|
131
|
+
export interface TaWebhookRequest {
|
|
132
|
+
/** After the name of the package, without a leading slash, without the query. */
|
|
133
|
+
path: string;
|
|
134
|
+
/** The body, as text, at most TA_WEBHOOK_MAX_BYTES. */
|
|
135
|
+
body: string;
|
|
136
|
+
contentType?: string;
|
|
137
|
+
}
|
|
138
|
+
/** The largest body a webhook takes; a larger one is refused (413). */
|
|
139
|
+
export declare const TA_WEBHOOK_MAX_BYTES: number;
|
|
83
140
|
/**
|
|
84
141
|
* The default export of a module that a package names in `pi.host` of its package.json. `ta serve` runs it
|
|
85
142
|
* once when it starts (or when the package is turned on), for built-in packages; `ta` without `serve`
|
|
@@ -299,6 +356,12 @@ export interface TaNotice {
|
|
|
299
356
|
* conversations, what they asked before) leaves such a session out: what it says goes to others.
|
|
300
357
|
*/
|
|
301
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]";
|
|
302
365
|
/**
|
|
303
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
|
|
304
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,3 +1,5 @@
|
|
|
1
|
+
/** The largest body a webhook takes; a larger one is refused (413). */
|
|
2
|
+
export const TA_WEBHOOK_MAX_BYTES = 256 * 1024;
|
|
1
3
|
/**
|
|
2
4
|
* The event of pi's `pi.events` by which a pi extension asks for the host of its package:
|
|
3
5
|
* `pi.events.emit(TA_HOST_EVENT, { name, resolve, heard })`. Under `ta serve` `heard` is called as the event
|
|
@@ -103,6 +105,12 @@ export const TA_NOTICES = { name: '@celljs/ta-notify', key: 'notices' };
|
|
|
103
105
|
* conversations, what they asked before) leaves such a session out: what it says goes to others.
|
|
104
106
|
*/
|
|
105
107
|
export const TA_WITH_OTHERS_MARK = '[ta:speaks-with-others]';
|
|
108
|
+
/**
|
|
109
|
+
* In the role of a session a package opened that tells the user of its turns itself (the conversation of a goal,
|
|
110
|
+
* 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
|
|
111
|
+
* not, so that it stays a conversation of the lists.
|
|
112
|
+
*/
|
|
113
|
+
export const TA_TELLS_OF_ITS_TURNS_MARK = '[ta:tells-of-its-turns]';
|
|
106
114
|
/**
|
|
107
115
|
* Starts the `<context>` of a message of the user that asks Ta to keep how a conversation got its work done, so that it
|
|
108
116
|
* need not be told again (Keep of ta-recall, in the + of the message box): Ta picks the form that fits. A package that
|