@fnndsc/calypso 0.29.15 → 0.30.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/dist/calypso.js +19 -8
- package/dist/calypso.js.map +1 -1
- package/dist/daemon/attachFile.d.ts +26 -19
- package/dist/daemon/attachFile.js +42 -51
- package/dist/daemon/attachFile.js.map +1 -1
- package/dist/daemon/attachOrigin.d.ts +69 -0
- package/dist/daemon/attachOrigin.js +125 -0
- package/dist/daemon/attachOrigin.js.map +1 -0
- package/dist/daemon/berth.d.ts +265 -26
- package/dist/daemon/berth.js +521 -158
- package/dist/daemon/berth.js.map +1 -1
- package/dist/daemon/claims.js +19 -9
- package/dist/daemon/claims.js.map +1 -1
- package/dist/daemon/commandLane.d.ts +317 -0
- package/dist/daemon/commandLane.js +409 -0
- package/dist/daemon/commandLane.js.map +1 -0
- package/dist/daemon/console.d.ts +0 -2
- package/dist/daemon/console.js +7 -10
- package/dist/daemon/console.js.map +1 -1
- package/dist/daemon/consoleSession.js +4 -1
- package/dist/daemon/consoleSession.js.map +1 -1
- package/dist/daemon/elevation.d.ts +0 -3
- package/dist/daemon/elevation.js +1 -3
- package/dist/daemon/elevation.js.map +1 -1
- package/dist/daemon/face.d.ts +18 -4
- package/dist/daemon/face.js +77 -32
- package/dist/daemon/face.js.map +1 -1
- package/dist/daemon/hostControl.d.ts +114 -1
- package/dist/daemon/hostControl.js +104 -4
- package/dist/daemon/hostControl.js.map +1 -1
- package/dist/daemon/hostPtyRelay.d.ts +118 -0
- package/dist/daemon/hostPtyRelay.js +186 -0
- package/dist/daemon/hostPtyRelay.js.map +1 -0
- package/dist/daemon/httpRoutes.d.ts +257 -0
- package/dist/daemon/httpRoutes.js +537 -0
- package/dist/daemon/httpRoutes.js.map +1 -0
- package/dist/daemon/instance.d.ts +37 -0
- package/dist/daemon/instance.js +59 -0
- package/dist/daemon/instance.js.map +1 -0
- package/dist/daemon/launch.d.ts +17 -0
- package/dist/daemon/launch.js +198 -194
- package/dist/daemon/launch.js.map +1 -1
- package/dist/daemon/launchBanner.d.ts +76 -0
- package/dist/daemon/launchBanner.js +80 -0
- package/dist/daemon/launchBanner.js.map +1 -0
- package/dist/daemon/rival.d.ts +65 -0
- package/dist/daemon/rival.js +67 -0
- package/dist/daemon/rival.js.map +1 -0
- package/dist/daemon/server.d.ts +104 -190
- package/dist/daemon/server.js +358 -866
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/settings.d.ts +42 -0
- package/dist/daemon/settings.js +43 -0
- package/dist/daemon/settings.js.map +1 -0
- package/dist/daemon/surface.d.ts +103 -0
- package/dist/daemon/surface.js +71 -0
- package/dist/daemon/surface.js.map +1 -0
- package/dist/daemon/surfaceReplies.d.ts +109 -0
- package/dist/daemon/surfaceReplies.js +108 -0
- package/dist/daemon/surfaceReplies.js.map +1 -0
- package/dist/daemon/terminals.js +5 -2
- package/dist/daemon/terminals.js.map +1 -1
- package/dist/daemon/token.d.ts +41 -5
- package/dist/daemon/token.js +43 -12
- package/dist/daemon/token.js.map +1 -1
- package/dist/daemon/uploadHold.d.ts +85 -0
- package/dist/daemon/uploadHold.js +205 -0
- package/dist/daemon/uploadHold.js.map +1 -0
- package/dist/daemon/vfsHeaders.d.ts +11 -0
- package/dist/daemon/vfsHeaders.js +60 -0
- package/dist/daemon/vfsHeaders.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +9 -4
- package/dist/daemon/discovery.d.ts +0 -23
- package/dist/daemon/discovery.js +0 -57
- package/dist/daemon/discovery.js.map +0 -1
package/dist/daemon/server.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* engine. A surface attaches with the contract version and the attach token
|
|
7
7
|
* (compared in constant time); once attached it drives the engine with
|
|
8
8
|
* `execute` and `complete` messages and receives `result` and completion
|
|
9
|
-
* replies. Command execution
|
|
10
|
-
* and what keeps each command's error boundary correct.
|
|
9
|
+
* replies. Command execution takes turns on the session (commandLane.ts) —
|
|
10
|
+
* shell semantics, and what keeps each command's error boundary correct.
|
|
11
11
|
*
|
|
12
12
|
* All attached surfaces share one session. A **session bus** broadcasts every
|
|
13
13
|
* result envelope to the *other* attached surfaces (tagged with the surface
|
|
@@ -22,13 +22,29 @@
|
|
|
22
22
|
* own CUBE session, established by the launcher exactly as the CLI does;
|
|
23
23
|
* surfaces authenticate to the daemon, not to CUBE.
|
|
24
24
|
*
|
|
25
|
+
* Key components:
|
|
26
|
+
* - CalypsoDaemon: the daemon: attach, the message routes, the session bus, and the engine's surface seams.
|
|
27
|
+
* - DaemonOptions: what a daemon is made with.
|
|
28
|
+
* - PromptRelay: a question on its way to a surface.
|
|
29
|
+
* - DAEMON_SURFACE: the bus tag of what the daemon itself originates.
|
|
30
|
+
*
|
|
31
|
+
* Typical usage:
|
|
32
|
+
* ```ts
|
|
33
|
+
* const daemon: CalypsoDaemon = new CalypsoDaemon({ engine, token });
|
|
34
|
+
* const port: number = await daemon.start();
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Dependencies: ws; the wire contract of `@fnndsc/menu`; commandLane.ts (the running lines), httpRoutes.ts (plain
|
|
38
|
+
* HTTP), surfaceReplies.ts (requests open on surfaces), hostPtyRelay.ts, terminals.ts.
|
|
39
|
+
*
|
|
25
40
|
* @module
|
|
26
41
|
*/
|
|
42
|
+
import type { ProgressEvent, PromptContext, PromptKind, PromptPath, FileDeliverRequest, ClosingCause } from '@fnndsc/menu';
|
|
27
43
|
import type { ElevationDoor } from './elevation.js';
|
|
28
44
|
import type { HostedEngine } from './engine.js';
|
|
29
|
-
import type {
|
|
45
|
+
import type { InstanceFacts } from './instance.js';
|
|
46
|
+
import { type DeliverOutcome, type EditOutcome } from './surfaceReplies.js';
|
|
30
47
|
import type { PtySpawn, Terminals } from './terminals.js';
|
|
31
|
-
import type { CommandEnvelope } from '@fnndsc/cumin';
|
|
32
48
|
/**
|
|
33
49
|
* The hosting process's stack identity, sent to surfaces in the attach ack.
|
|
34
50
|
* Injected by the host (which resolves it from brasa) rather than resolved
|
|
@@ -53,27 +69,6 @@ export interface DaemonStackInfo {
|
|
|
53
69
|
salsa?: string;
|
|
54
70
|
cumin?: string;
|
|
55
71
|
}
|
|
56
|
-
/** How long a stopped command has to end before the session abandons it. */
|
|
57
|
-
export declare const STOP_GRACE_MS: number;
|
|
58
|
-
/** How long a STOP pressed while its command waits still applies when the command starts. */
|
|
59
|
-
export declare const STOP_PENDING_MS: number;
|
|
60
|
-
/**
|
|
61
|
-
* Where a delivered file landed, returned by {@link CalypsoDaemon.deliver_current}.
|
|
62
|
-
*
|
|
63
|
-
* @property location - The surface's honest account of the destination.
|
|
64
|
-
* @property bytes - How many bytes it delivered.
|
|
65
|
-
*/
|
|
66
|
-
export interface DeliverOutcome {
|
|
67
|
-
location: string;
|
|
68
|
-
bytes: number;
|
|
69
|
-
}
|
|
70
|
-
/** The result of a surface's local edit, returned by {@link CalypsoDaemon.edit_current}. */
|
|
71
|
-
export interface EditOutcome {
|
|
72
|
-
content: string;
|
|
73
|
-
changed: boolean;
|
|
74
|
-
/** The surface opened an editor that stays open; its saves are lines of their own. */
|
|
75
|
-
opened?: boolean;
|
|
76
|
-
}
|
|
77
72
|
/** The default number of envelopes retained for scrollback replay. */
|
|
78
73
|
/** The surface tag on session-bus envelopes the daemon itself originates. */
|
|
79
74
|
export declare const DAEMON_SURFACE: string;
|
|
@@ -116,24 +111,6 @@ export interface TelemetrySnapshot {
|
|
|
116
111
|
erroredFeeds: number;
|
|
117
112
|
};
|
|
118
113
|
}
|
|
119
|
-
/**
|
|
120
|
-
* A line's exit status, as `$?` holds it and a remote `chell -c` exits with.
|
|
121
|
-
* A line that threw, or answered an error, fails with its own status when it
|
|
122
|
-
* set one and 1 otherwise; a line whose answers are all ok still ends with
|
|
123
|
-
* the status it set (`berth close` that closed nothing ends 1).
|
|
124
|
-
*
|
|
125
|
-
* @param envelopes - What the line answered; undefined when it threw.
|
|
126
|
-
* @param failureReason - Why it threw, when it did.
|
|
127
|
-
* @param lineExit - The status the engine left when the line ended.
|
|
128
|
-
* @returns The status.
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* lineExit_derive([{ status: 'ok', rendered: 'nothing closed\n' }], undefined, 1); // 1
|
|
133
|
-
* lineExit_derive([{ status: 'error', rendered: '' }], undefined, 0); // 1
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export declare function lineExit_derive(envelopes: CommandEnvelope[] | undefined, failureReason: string | undefined, lineExit: number | undefined): number;
|
|
137
114
|
export interface DaemonOptions {
|
|
138
115
|
engine: HostedEngine;
|
|
139
116
|
token: string;
|
|
@@ -151,8 +128,12 @@ export interface DaemonOptions {
|
|
|
151
128
|
/** The session's backend id, reported on attach so a surface draws its composition. */
|
|
152
129
|
backend?: string;
|
|
153
130
|
webRoot?: string;
|
|
131
|
+
/** The most bytes of uploads held at once; `CALYPSO_UPLOAD_HELD`, else 512 MiB, when not given. */
|
|
132
|
+
uploadHeld?: number;
|
|
154
133
|
/** The host-control tiers this daemon declares (empty or absent when off). */
|
|
155
134
|
hostControl?: string[];
|
|
135
|
+
/** The words this daemon's engine runs itself, told to a surface at attach; read each time one attaches. */
|
|
136
|
+
engineCommands_list?: () => readonly string[];
|
|
156
137
|
/** The door a surface can be raised at with the person's password (`elevate`); absent, a session stays as it was started. */
|
|
157
138
|
elevation?: ElevationDoor;
|
|
158
139
|
/**
|
|
@@ -187,6 +168,10 @@ export interface PromptRelay {
|
|
|
187
168
|
wants?: PromptKind;
|
|
188
169
|
path?: PromptPath;
|
|
189
170
|
commit?: string;
|
|
171
|
+
/** What the question is for, as a name a surface may know. */
|
|
172
|
+
purpose?: string;
|
|
173
|
+
/** What it is about, by name. */
|
|
174
|
+
subject?: Record<string, string>;
|
|
190
175
|
}
|
|
191
176
|
/**
|
|
192
177
|
* A WebSocket daemon hosting one engine for attached surfaces, with a session
|
|
@@ -213,14 +198,14 @@ export declare class CalypsoDaemon {
|
|
|
213
198
|
private stale;
|
|
214
199
|
/** The terminals this daemon offers, or null when it offers none (no pty here). */
|
|
215
200
|
private terminals;
|
|
216
|
-
/**
|
|
217
|
-
private
|
|
218
|
-
/** The `!` commands running on host ptys, by id, with the surface they draw on. */
|
|
219
|
-
private readonly hostPtys;
|
|
201
|
+
/** The `!` commands running on host ptys of the daemon's own (hostPtyRelay.ts). */
|
|
202
|
+
private readonly hostPtyRelay;
|
|
220
203
|
private readonly codeCheck;
|
|
221
204
|
/** Where the daemon's own operational lines go. */
|
|
222
205
|
private readonly log;
|
|
223
206
|
private readonly hostControl;
|
|
207
|
+
/** The words this daemon's engine runs itself, told at attach. */
|
|
208
|
+
private readonly engineCommands;
|
|
224
209
|
private readonly elevation;
|
|
225
210
|
/** The one session all surfaces share; returned in each attach ack. */
|
|
226
211
|
private readonly sessionId;
|
|
@@ -230,55 +215,26 @@ export declare class CalypsoDaemon {
|
|
|
230
215
|
surfaces_count(): number;
|
|
231
216
|
/** Whether a foreground command is executing right now. */
|
|
232
217
|
busy_get(): boolean;
|
|
233
|
-
|
|
218
|
+
/** The plain HTTP side: the file route, the session's facts, the web root (httpRoutes.ts). */
|
|
219
|
+
private readonly http;
|
|
234
220
|
private wss;
|
|
235
221
|
private httpServer;
|
|
236
|
-
/**
|
|
237
|
-
|
|
238
|
-
* works at a time, so a prompt raised mid-command has one unambiguous
|
|
239
|
-
* surface to ask, the one holding the lane. A command waiting on a person
|
|
240
|
-
* gives the lane up until the answer comes (`person_await`).
|
|
241
|
-
*/
|
|
242
|
-
private readonly lane;
|
|
222
|
+
/** The running lines: their turns, their slots, the waits on a person, and STOP (commandLane.ts). */
|
|
223
|
+
private readonly commandLane;
|
|
243
224
|
/** The questions open now, by the surface asked: what, and since when. */
|
|
244
225
|
private readonly questionsOpen;
|
|
245
226
|
/** The session's retained regard: the last indication from any surface. */
|
|
246
227
|
private regard;
|
|
247
228
|
/** Unsubscribes from the engine's ambient events; null until started. */
|
|
248
229
|
private ambientStop;
|
|
249
|
-
/**
|
|
250
|
-
|
|
251
|
-
* its own slot, and whatever it raises (output, a question, a pipe
|
|
252
|
-
* segment) goes to its own surface.
|
|
253
|
-
*/
|
|
254
|
-
private readonly slotScope;
|
|
255
|
-
/** The lines running now, waiting aside or not, in the order they started. */
|
|
256
|
-
private readonly running;
|
|
257
|
-
/** Names each line for the engine. */
|
|
258
|
-
private lineCount;
|
|
259
|
-
/** Surfaces whose STOP found their command still waiting its turn, and when. */
|
|
260
|
-
private readonly stopPending;
|
|
261
|
-
/** The surface of the line the code runs inside, or null outside any. */
|
|
262
|
-
private get currentOrigin();
|
|
263
|
-
/** The surface's id for the line the code runs inside, or null outside any. */
|
|
264
|
-
private get currentId();
|
|
265
|
-
/** Whether the line the code runs inside is surface-internal. */
|
|
266
|
-
private get currentInstrument();
|
|
267
|
-
private readonly prompts;
|
|
268
|
-
private readonly pipes;
|
|
269
|
-
private readonly shells;
|
|
270
|
-
/** The downloads this daemon is serving, for their progress (downloads.ts). */
|
|
271
|
-
private readonly downloads;
|
|
272
|
-
private readonly edits;
|
|
273
|
-
/** Lines run by a surface's own language, by the surface that claims them. */
|
|
274
|
-
private readonly surfaceLines;
|
|
230
|
+
/** The requests open on surfaces, and the replies that settle them (surfaceReplies.ts). */
|
|
231
|
+
private readonly replies;
|
|
275
232
|
/** Each surface's terminal viewer: which terminals it draws. */
|
|
276
233
|
private readonly viewerOf;
|
|
277
234
|
/** The browser that last did something: the one a claimed line goes to when no terminal of its own typed it. */
|
|
278
235
|
private browserActive;
|
|
279
236
|
/** Subjects a surface claimed whole this session, so a line in one is refused by name when none is attached. */
|
|
280
237
|
private readonly claimedSeen;
|
|
281
|
-
private readonly deliveries;
|
|
282
238
|
/**
|
|
283
239
|
* @param options - The engine to host, the attach token, the bind address,
|
|
284
240
|
* and the scrollback size.
|
|
@@ -300,6 +256,14 @@ export declare class CalypsoDaemon {
|
|
|
300
256
|
* daemon.ptySpawn_set(await ptySpawn_load());
|
|
301
257
|
*/
|
|
302
258
|
ptySpawn_set(spawn: PtySpawn | null): void;
|
|
259
|
+
/**
|
|
260
|
+
* Sets the facts this daemon proves itself by at `/instance`, the ones its berth record holds.
|
|
261
|
+
*
|
|
262
|
+
* @param facts - The launch's probe key, identity, pid and boot time.
|
|
263
|
+
* @example
|
|
264
|
+
* daemon.instance_set({ probeKey, identity, pid: process.pid, booted });
|
|
265
|
+
*/
|
|
266
|
+
instance_set(facts: InstanceFacts): void;
|
|
303
267
|
/**
|
|
304
268
|
* Records whether the daemon's own code still matches its disk, and tells
|
|
305
269
|
* every attached surface when that changes.
|
|
@@ -330,91 +294,46 @@ export declare class CalypsoDaemon {
|
|
|
330
294
|
*/
|
|
331
295
|
stop(): Promise<void>;
|
|
332
296
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* the attach answer says the same once it attaches. The attach token gates
|
|
336
|
-
* it as it gates `/vfs` (a wrong one is not found).
|
|
337
|
-
*
|
|
338
|
-
* @param request - The incoming HTTP request.
|
|
339
|
-
* @param response - The response to write.
|
|
340
|
-
*/
|
|
341
|
-
private backend_serve;
|
|
342
|
-
/**
|
|
343
|
-
* Says which joblets run now (`line &`): `{"joblets": [{number, line,
|
|
344
|
-
* waiting}]}`. A host about to restart the session (porter, for a new
|
|
345
|
-
* release) asks first, since a restart ends them (#1273). Gated by the
|
|
346
|
-
* attach token, as `/backend` is.
|
|
297
|
+
* Handles one surface connection: an attach handshake, then its messages
|
|
298
|
+
* routed, with the surface removed from the bus on close.
|
|
347
299
|
*
|
|
348
|
-
* @param
|
|
349
|
-
* @param
|
|
300
|
+
* @param socket - The connected surface.
|
|
301
|
+
* @param request - The upgrade request, whose URL may carry the token.
|
|
350
302
|
*/
|
|
351
|
-
private
|
|
303
|
+
private connection_handle;
|
|
352
304
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* The route exists so browser surfaces can render file content natively
|
|
356
|
-
* (an image in a panel) instead of through the terminal stream. It is
|
|
357
|
-
* gated by the same attach token as the wire (compared in constant time)
|
|
358
|
-
* and requires the hosted engine to provide `file_read`; refusals and
|
|
359
|
-
* failures answer 404 so the response does not confirm what exists.
|
|
305
|
+
* Routes one message of an attached surface: a reply settles its request, a line runs, and the rest go to what
|
|
306
|
+
* owns them.
|
|
360
307
|
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
* operator's disk the way every other download does.
|
|
365
|
-
*
|
|
366
|
-
* @param request - The incoming HTTP request.
|
|
367
|
-
* @param response - The response to write.
|
|
308
|
+
* @param attached - The surface that sent it.
|
|
309
|
+
* @param viewer - Its socket as a terminal's viewer.
|
|
310
|
+
* @param value - The message.
|
|
368
311
|
*/
|
|
369
|
-
private
|
|
312
|
+
private message_route;
|
|
370
313
|
/**
|
|
371
|
-
*
|
|
372
|
-
* the store gave one (so a browser draws its own progress), the body
|
|
373
|
-
* piped, nothing held whole. A 3.7 GB DICOM used to be read into one
|
|
374
|
-
* buffer behind a 30 s deadline and answered 404. A failure to open the
|
|
375
|
-
* file answers with the kernel's status and reason. The status waits for
|
|
376
|
-
* CUBE's first byte, so a file whose bytes never start is a 502 that says
|
|
377
|
-
* why. A break after bytes have gone cuts the socket, which the porter and
|
|
378
|
-
* the browser see as a body that stopped rather than a short file. Either
|
|
379
|
-
* break is one line in the daemon's log (vfsBreak.ts): the path, the bytes
|
|
380
|
-
* sent of the size CUBE stated, the time taken and the cause.
|
|
381
|
-
*
|
|
382
|
-
* @param open - The engine's stream seam.
|
|
383
|
-
* @param filePath - The file asked for.
|
|
384
|
-
* @param query - The request's query (`download=1` names an attachment).
|
|
385
|
-
* @param response - The response to write.
|
|
386
|
-
* @param refuse - Answers a refusal before any byte is sent.
|
|
314
|
+
* Routes a line a surface sent: to the surface whose own language it is, or onto the lane.
|
|
387
315
|
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* stream for the save that follows (downloads.ts).
|
|
316
|
+
* @param attached - The surface that sent it.
|
|
317
|
+
* @param value - The execute request.
|
|
391
318
|
*/
|
|
392
|
-
private
|
|
319
|
+
private execute_route;
|
|
393
320
|
/**
|
|
394
|
-
* Takes
|
|
395
|
-
*
|
|
396
|
-
* A browser cannot reach the machine the daemon runs on, so `upload` is
|
|
397
|
-
* not a verb it can speak: the bytes travel here and the ENGINE puts them
|
|
398
|
-
* in the store, which keeps the write on the kernel's own path rather
|
|
399
|
-
* than letting a surface talk to CUBE.
|
|
321
|
+
* Takes a surface's `terminal*` message: it opens, types into, sizes or closes a terminal it draws.
|
|
400
322
|
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* @param request - The incoming request, whose body is the file.
|
|
406
|
-
* @param response - The response to write.
|
|
407
|
-
* @param query - The parsed query string (path and token).
|
|
408
|
-
* @param refuse - How this route says no.
|
|
323
|
+
* @param socket - The surface's socket.
|
|
324
|
+
* @param viewer - Its socket as a terminal's viewer.
|
|
325
|
+
* @param value - The message.
|
|
326
|
+
* @returns False when the message is not a `terminal*` one.
|
|
409
327
|
*/
|
|
410
|
-
private
|
|
328
|
+
private terminalMessage_route;
|
|
411
329
|
/**
|
|
412
|
-
*
|
|
413
|
-
*
|
|
330
|
+
* Lets a surface go when its socket closes: its terminals keep running, its host programs and (for a shell) its
|
|
331
|
+
* commands hear the hang-up, and it leaves the bus.
|
|
414
332
|
*
|
|
415
|
-
* @param
|
|
333
|
+
* @param surface - The surface, or null when it never attached.
|
|
334
|
+
* @param viewer - Its socket as a terminal's viewer.
|
|
416
335
|
*/
|
|
417
|
-
private
|
|
336
|
+
private surface_detach;
|
|
418
337
|
/**
|
|
419
338
|
* Whether the running command was typed in a browser's terminal.
|
|
420
339
|
*
|
|
@@ -476,7 +395,6 @@ export declare class CalypsoDaemon {
|
|
|
476
395
|
*
|
|
477
396
|
* @param origin - Surface asking to cancel a command.
|
|
478
397
|
* @param message - Correlated command identifier to cancel.
|
|
479
|
-
* @returns Nothing. The running command reports its normal final envelope.
|
|
480
398
|
*/
|
|
481
399
|
private cancel_run;
|
|
482
400
|
/**
|
|
@@ -484,7 +402,6 @@ export declare class CalypsoDaemon {
|
|
|
484
402
|
* or one typed in a terminal it owns, whatever the command is.
|
|
485
403
|
*
|
|
486
404
|
* @param origin - The surface pressing STOP.
|
|
487
|
-
* @param _message - The request.
|
|
488
405
|
*/
|
|
489
406
|
private stop_run;
|
|
490
407
|
/**
|
|
@@ -505,13 +422,6 @@ export declare class CalypsoDaemon {
|
|
|
505
422
|
* @returns The surface whose STOP reaches it.
|
|
506
423
|
*/
|
|
507
424
|
private stopper_resolve;
|
|
508
|
-
/**
|
|
509
|
-
* Stops the running command: its signal is aborted (a command that checks
|
|
510
|
-
* it ends, a host process it started is killed), and one still running
|
|
511
|
-
* after {@link STOP_GRACE_MS} is abandoned, so the session is free again
|
|
512
|
-
* whatever the command was waiting on.
|
|
513
|
-
*/
|
|
514
|
-
private command_stop;
|
|
515
425
|
/**
|
|
516
426
|
* Validates an attach handshake: contract version, then constant-time
|
|
517
427
|
* token check. On success the surface is acknowledged, registered on the
|
|
@@ -524,6 +434,13 @@ export declare class CalypsoDaemon {
|
|
|
524
434
|
* @returns The registered surface, or null when the attach was refused.
|
|
525
435
|
*/
|
|
526
436
|
private attach_handle;
|
|
437
|
+
/**
|
|
438
|
+
* Remembers the subjects a surface claims whole, so a line in one is refused by name once no surface claiming it
|
|
439
|
+
* is attached.
|
|
440
|
+
*
|
|
441
|
+
* @param claims - What the surface claims.
|
|
442
|
+
*/
|
|
443
|
+
private claimedWhole_note;
|
|
527
444
|
/**
|
|
528
445
|
* Opens or closes a surface's watch on a subject and answers with the
|
|
529
446
|
* subject's state. A daemon whose engine cannot watch says so rather than
|
|
@@ -577,30 +494,25 @@ export declare class CalypsoDaemon {
|
|
|
577
494
|
*/
|
|
578
495
|
private bus_publish;
|
|
579
496
|
/**
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
497
|
+
* Notes a line that ended, for the prompt context, and refreshes the prompt. A remote REPL draws its next prompt
|
|
498
|
+
* as soon as `result` resolves the command, so the line awaits this before it is answered: the prompt cannot lag
|
|
499
|
+
* one command behind state changes such as `cd`. Returns the push itself, so the line waits on nothing more.
|
|
583
500
|
*
|
|
584
|
-
* @param
|
|
585
|
-
* @
|
|
586
|
-
|
|
587
|
-
private lineWant_get;
|
|
588
|
-
/**
|
|
589
|
-
* Runs one line in its turn: it waits until nothing running holds what it
|
|
590
|
-
* changes, then runs in a slot of its own.
|
|
591
|
-
*
|
|
592
|
-
* @param origin - The surface that submitted the request.
|
|
593
|
-
* @param message - The execute request.
|
|
501
|
+
* @param slot - The line's slot, holding its turn.
|
|
502
|
+
* @param exitCode - Its exit status.
|
|
503
|
+
* @returns The prompt push.
|
|
594
504
|
*/
|
|
595
|
-
private
|
|
505
|
+
private line_end;
|
|
596
506
|
/**
|
|
597
|
-
*
|
|
598
|
-
* publishes each envelope to the session bus.
|
|
507
|
+
* Answers a line that ended: replies to the requester with the result, and
|
|
508
|
+
* publishes each envelope to the session bus. Runs inside the line's slot,
|
|
509
|
+
* while it still holds its turn.
|
|
599
510
|
*
|
|
600
511
|
* @param slot - The line's slot, holding its turn.
|
|
601
512
|
* @param message - The execute request.
|
|
513
|
+
* @param outcome - What the line came to.
|
|
602
514
|
*/
|
|
603
|
-
private
|
|
515
|
+
private line_answer;
|
|
604
516
|
/**
|
|
605
517
|
* Takes a hold for work no line of a surface runs (a joblet): it waits in
|
|
606
518
|
* the same lane as every line, and runs beside the lines it shares
|
|
@@ -610,16 +522,6 @@ export declare class CalypsoDaemon {
|
|
|
610
522
|
* @returns Gives the hold back; a second call does nothing.
|
|
611
523
|
*/
|
|
612
524
|
hold_take(holds: string[] | 'all'): Promise<() => void>;
|
|
613
|
-
/**
|
|
614
|
-
* Waits on a person without holding the session: the request is sent and
|
|
615
|
-
* what the line holds given up, so other lines run; when the person
|
|
616
|
-
* answers, the line queues for its turn again.
|
|
617
|
-
*
|
|
618
|
-
* @param ask - Sends the request (under the asking command's slot) and
|
|
619
|
-
* resolves with the person's answer.
|
|
620
|
-
* @returns The answer.
|
|
621
|
-
*/
|
|
622
|
-
private person_await;
|
|
623
525
|
/**
|
|
624
526
|
* Waits aside: the running command steps out of the lane while it waits
|
|
625
527
|
* on something that is not the session's work (a task's next line), so
|
|
@@ -684,6 +586,16 @@ export declare class CalypsoDaemon {
|
|
|
684
586
|
* @throws {Error} When no command is executing or the surface disconnects.
|
|
685
587
|
*/
|
|
686
588
|
pipe_current(command: string, input: Buffer): Promise<Buffer>;
|
|
589
|
+
/**
|
|
590
|
+
* Why a request for a program on a surface's machine may not go where it would: to a surface other than the one
|
|
591
|
+
* that sent the running line (a browser holding the terminal that typed it). That surface did not send the line
|
|
592
|
+
* and has nothing to run it against, so the daemon refuses here, before anything is sent, and the line says why.
|
|
593
|
+
*
|
|
594
|
+
* @param acting - The surface the request would go to.
|
|
595
|
+
* @param what - What would run, for the words.
|
|
596
|
+
* @returns The refusal, or null when it goes to the line's own surface.
|
|
597
|
+
*/
|
|
598
|
+
private elsewhere_refusal;
|
|
687
599
|
/**
|
|
688
600
|
* Runs a host-shell command on the surface running the current command.
|
|
689
601
|
* The daemon never spawns the process itself.
|
|
@@ -719,11 +631,13 @@ export declare class CalypsoDaemon {
|
|
|
719
631
|
* @param extension - An optional filename extension for syntax mode.
|
|
720
632
|
* @param path - The file being edited, for an editor that stays open and
|
|
721
633
|
* saves back to it (a browser's editor pane).
|
|
634
|
+
* @param named - The file as the line typed it, so a surface on another
|
|
635
|
+
* machine holds the edit to its own line's operand.
|
|
722
636
|
* @returns The edited content and whether it changed, or that an editor
|
|
723
637
|
* which stays open took it.
|
|
724
638
|
* @throws {Error} When no command is executing or the surface disconnects.
|
|
725
639
|
*/
|
|
726
|
-
edit_current(content: string, extension: string | undefined, path?: string): Promise<EditOutcome>;
|
|
640
|
+
edit_current(content: string, extension: string | undefined, path?: string, named?: string): Promise<EditOutcome>;
|
|
727
641
|
/**
|
|
728
642
|
* Reports what the surface running the current command can do on its own
|
|
729
643
|
* machine. A daemon has no capabilities of its own to offer: every one it
|