@fnndsc/calypso 0.21.4 → 0.22.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/daemon/engine.d.ts +13 -0
- package/dist/daemon/lane.d.ts +37 -0
- package/dist/daemon/lane.js +66 -0
- package/dist/daemon/lane.js.map +1 -0
- package/dist/daemon/launch.d.ts +6 -0
- package/dist/daemon/launch.js +15 -0
- package/dist/daemon/launch.js.map +1 -1
- package/dist/daemon/server.d.ts +40 -6
- package/dist/daemon/server.js +125 -46
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/terminals.d.ts +159 -0
- package/dist/daemon/terminals.js +264 -0
- package/dist/daemon/terminals.js.map +1 -0
- package/dist/notes.json +1 -1
- package/package.json +7 -4
package/dist/daemon/engine.d.ts
CHANGED
|
@@ -42,6 +42,19 @@ export interface HostedEngine {
|
|
|
42
42
|
* @returns True when the active command accepted the request.
|
|
43
43
|
*/
|
|
44
44
|
line_cancel?(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The running command steps aside to wait on a person: the engine saves
|
|
47
|
+
* and clears its per-command state, so the next command starts clean.
|
|
48
|
+
*
|
|
49
|
+
* @returns What it left behind, handed back to `turn_resume`.
|
|
50
|
+
*/
|
|
51
|
+
turn_leave?(): unknown;
|
|
52
|
+
/**
|
|
53
|
+
* A command that stepped aside resumes: the engine puts its state back.
|
|
54
|
+
*
|
|
55
|
+
* @param state - What `turn_leave` returned for it.
|
|
56
|
+
*/
|
|
57
|
+
turn_resume?(state: unknown): void;
|
|
45
58
|
/**
|
|
46
59
|
* Computes completion candidates for a partial input line.
|
|
47
60
|
*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The lane: the session runs one command at a time, and the lane is
|
|
3
|
+
* whose turn it is.
|
|
4
|
+
*
|
|
5
|
+
* Commands share one session (its directory, its context, its index), so
|
|
6
|
+
* they take turns, first come first served. A command holds the lane while
|
|
7
|
+
* it works and gives it up while it waits on a person (a question, an
|
|
8
|
+
* editor): waiting is not working, and the session is free for the next
|
|
9
|
+
* command until the answer comes, when the asker takes its place in line
|
|
10
|
+
* again.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
/** A first-come, first-served turn. */
|
|
15
|
+
export declare class Lane {
|
|
16
|
+
private held;
|
|
17
|
+
private readonly line;
|
|
18
|
+
/**
|
|
19
|
+
* Waits for the turn.
|
|
20
|
+
*
|
|
21
|
+
* @returns Resolves holding the lane.
|
|
22
|
+
*/
|
|
23
|
+
acquire(): Promise<void>;
|
|
24
|
+
/** Gives up the turn: the next in line takes it, or the lane is free. */
|
|
25
|
+
release(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Runs work in its turn and gives the turn up after, however it ends.
|
|
28
|
+
*
|
|
29
|
+
* @param work - The work.
|
|
30
|
+
* @returns What the work returns.
|
|
31
|
+
*/
|
|
32
|
+
run<T>(work: () => Promise<T>): Promise<T>;
|
|
33
|
+
/** How many wait for the turn. */
|
|
34
|
+
get waiting(): number;
|
|
35
|
+
/** Whether someone has the turn. */
|
|
36
|
+
get busy(): boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The lane: the session runs one command at a time, and the lane is
|
|
3
|
+
* whose turn it is.
|
|
4
|
+
*
|
|
5
|
+
* Commands share one session (its directory, its context, its index), so
|
|
6
|
+
* they take turns, first come first served. A command holds the lane while
|
|
7
|
+
* it works and gives it up while it waits on a person (a question, an
|
|
8
|
+
* editor): waiting is not working, and the session is free for the next
|
|
9
|
+
* command until the answer comes, when the asker takes its place in line
|
|
10
|
+
* again.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
/** A first-come, first-served turn. */
|
|
15
|
+
export class Lane {
|
|
16
|
+
held = false;
|
|
17
|
+
line = [];
|
|
18
|
+
/**
|
|
19
|
+
* Waits for the turn.
|
|
20
|
+
*
|
|
21
|
+
* @returns Resolves holding the lane.
|
|
22
|
+
*/
|
|
23
|
+
acquire() {
|
|
24
|
+
if (!this.held) {
|
|
25
|
+
this.held = true;
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
this.line.push(resolve);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Gives up the turn: the next in line takes it, or the lane is free. */
|
|
33
|
+
release() {
|
|
34
|
+
const next = this.line.shift();
|
|
35
|
+
if (next !== undefined) {
|
|
36
|
+
next();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.held = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Runs work in its turn and gives the turn up after, however it ends.
|
|
44
|
+
*
|
|
45
|
+
* @param work - The work.
|
|
46
|
+
* @returns What the work returns.
|
|
47
|
+
*/
|
|
48
|
+
async run(work) {
|
|
49
|
+
await this.acquire();
|
|
50
|
+
try {
|
|
51
|
+
return await work();
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
this.release();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** How many wait for the turn. */
|
|
58
|
+
get waiting() {
|
|
59
|
+
return this.line.length;
|
|
60
|
+
}
|
|
61
|
+
/** Whether someone has the turn. */
|
|
62
|
+
get busy() {
|
|
63
|
+
return this.held;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=lane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane.js","sourceRoot":"","sources":["../../src/daemon/lane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,uCAAuC;AACvC,MAAM,OAAO,IAAI;IACP,IAAI,GAAY,KAAK,CAAC;IACb,IAAI,GAAsB,EAAE,CAAC;IAE9C;;;;OAIG;IACI,OAAO;QACZ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAmB,EAAQ,EAAE;YACrD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yEAAyE;IAClE,OAAO;QACZ,MAAM,IAAI,GAA6B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,EAAE,CAAC;QACT,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAI,IAAsB;QACxC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAED,kCAAkC;IAClC,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,oCAAoC;IACpC,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/daemon/launch.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CalypsoDaemon } from './server.js';
|
|
|
2
2
|
import type { BrasaEngine } from '@fnndsc/brasa/core';
|
|
3
3
|
import type { ProgressEvent } from '@fnndsc/menu';
|
|
4
4
|
import type { OutputSink, Surface } from '@fnndsc/menu/surface';
|
|
5
|
+
import { type SurfaceLaunch } from './consoleSession.js';
|
|
5
6
|
import { type HostControlPolicy } from './hostControl.js';
|
|
6
7
|
/** What a launched daemon hands back to its host (the console face's feed). */
|
|
7
8
|
export interface DaemonLaunchInfo {
|
|
@@ -61,5 +62,10 @@ export interface DaemonLaunchOptions {
|
|
|
61
62
|
* enclosing checkout come first. calypso itself depends on no surface.
|
|
62
63
|
*/
|
|
63
64
|
webRoot?: string | null;
|
|
65
|
+
/**
|
|
66
|
+
* How to run the chell a browser's terminal holds: chell passes itself;
|
|
67
|
+
* the standalone calypso binary runs the `chell` on the path.
|
|
68
|
+
*/
|
|
69
|
+
surfaceLaunch?: SurfaceLaunch;
|
|
64
70
|
}
|
|
65
71
|
export declare function daemon_launch(engine: BrasaEngine, beforeListen?: () => Promise<void>, options?: DaemonLaunchOptions): Promise<DaemonLaunchInfo>;
|
package/dist/daemon/launch.js
CHANGED
|
@@ -22,6 +22,8 @@ import { backend_get } from '@fnndsc/brasa/core';
|
|
|
22
22
|
import { stackBanner_rows, stackBannerRow_paint, versions_get, buildHash_get } from '@fnndsc/brasa/core';
|
|
23
23
|
import { identity_normalise, berth_write, berthOwn_read, berth_path, berthUrl_isAlive, closing_take } from './berth.js';
|
|
24
24
|
import { attachFile_write, attachFile_remove } from './attachFile.js';
|
|
25
|
+
import { CHELL_ON_PATH } from './consoleSession.js';
|
|
26
|
+
import { Terminals, ptySpawn_load } from './terminals.js';
|
|
25
27
|
import { HOST_CONTROL_OFF, hostControl_describe, hostControl_guard, hostControl_tiers, hostPipe_run, hostShell_run } from './hostControl.js';
|
|
26
28
|
/** The daemon sink forwards live command output to the executing surface. */
|
|
27
29
|
export class DaemonSink {
|
|
@@ -220,6 +222,19 @@ export async function daemon_launch(engine, beforeListen, options = {}) {
|
|
|
220
222
|
// restarts the session at the next login rather than mount an older kernel.
|
|
221
223
|
const berth = { identity, url, token, pid: process.pid, versions: { ...versions_get() }, booted: new Date().toISOString() };
|
|
222
224
|
berth_write(berth);
|
|
225
|
+
// Terminals: a browser's console as a chell under a pty, attached back
|
|
226
|
+
// over loopback (or the one address bound, when that is not a wildcard).
|
|
227
|
+
// A machine where node-pty did not build offers none; its surfaces keep
|
|
228
|
+
// their transcript console.
|
|
229
|
+
const ptySpawn = await ptySpawn_load();
|
|
230
|
+
if (ptySpawn !== null) {
|
|
231
|
+
const terminalHost = bindHost === '0.0.0.0' ? '127.0.0.1' : bindHost;
|
|
232
|
+
daemon.terminals_set(new Terminals({
|
|
233
|
+
spawn: ptySpawn,
|
|
234
|
+
launch: options.surfaceLaunch ?? CHELL_ON_PATH,
|
|
235
|
+
target: { identity, url: `ws://${terminalHost}:${port}`, token },
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
223
238
|
const attachHint = sessionIdentity.connected ? ` ${identity}` : '';
|
|
224
239
|
// The boot animation keeps repainting this terminal, and scrollback dies with
|
|
225
240
|
// the next clear. The same addresses go to a file so they can be read back
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/daemon/launch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAqB,MAAM,aAAa,CAAC;AAC9H,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5C,OAAO,EAAE,WAAW,EAAsC,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAEp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BAAkB,OAAO,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACL,QAAQ;QACR,GAAG;QACH,KAAK;QACL,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC;QAC/B,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,WAAW,IAAI,IAAI,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI;QACnF,MAAM;QACN,WAAW;QACX,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/daemon/server.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HostedEngine } from './engine.js';
|
|
2
2
|
import type { ProgressEvent, PromptContext, PromptKind, PromptPath, FileDeliverRequest, ClosingCause } from '@fnndsc/menu';
|
|
3
|
+
import type { Terminals } from './terminals.js';
|
|
3
4
|
/**
|
|
4
5
|
* The hosting process's stack identity, sent to surfaces in the attach ack.
|
|
5
6
|
* Injected by the host (which resolves it from brasa) rather than resolved
|
|
@@ -144,8 +145,6 @@ export declare class CalypsoDaemon {
|
|
|
144
145
|
/** The last executed command's measured facts, sticky across pushes. */
|
|
145
146
|
private lastCommand;
|
|
146
147
|
private readonly telemetryProvider;
|
|
147
|
-
/** Commands queued behind the one running: the lane's depth. */
|
|
148
|
-
private queueWaiting;
|
|
149
148
|
/** The line holding the lane, and since when; null while the lane is idle. */
|
|
150
149
|
private currentLine;
|
|
151
150
|
private currentStartedAt;
|
|
@@ -158,6 +157,8 @@ export declare class CalypsoDaemon {
|
|
|
158
157
|
private readonly backend;
|
|
159
158
|
/** Whether the daemon's own code on disk has moved on since it started. */
|
|
160
159
|
private stale;
|
|
160
|
+
/** The terminals this daemon offers, or null when it offers none (no pty here). */
|
|
161
|
+
private terminals;
|
|
161
162
|
private readonly codeCheck;
|
|
162
163
|
private readonly hostControl;
|
|
163
164
|
/** The one session all surfaces share; returned in each attach ack. */
|
|
@@ -172,11 +173,14 @@ export declare class CalypsoDaemon {
|
|
|
172
173
|
private wss;
|
|
173
174
|
private httpServer;
|
|
174
175
|
/**
|
|
175
|
-
* Execution
|
|
176
|
-
* at a time
|
|
177
|
-
* ask
|
|
176
|
+
* Execution takes turns across the whole session (lane.ts): one command
|
|
177
|
+
* works at a time, so a prompt raised mid-command has one unambiguous
|
|
178
|
+
* surface to ask, the one holding the lane. A command waiting on a person
|
|
179
|
+
* gives the lane up until the answer comes (`person_await`).
|
|
178
180
|
*/
|
|
179
|
-
private
|
|
181
|
+
private readonly lane;
|
|
182
|
+
/** The questions open now, by the surface asked: what, and since when. */
|
|
183
|
+
private readonly questionsOpen;
|
|
180
184
|
/** The session's retained regard: the last indication from any surface. */
|
|
181
185
|
private regard;
|
|
182
186
|
/** Unsubscribes from the engine's ambient events; null until started. */
|
|
@@ -203,6 +207,13 @@ export declare class CalypsoDaemon {
|
|
|
203
207
|
* and the scrollback size.
|
|
204
208
|
*/
|
|
205
209
|
constructor(options: DaemonOptions);
|
|
210
|
+
/**
|
|
211
|
+
* Offers terminals: a surface's console as a chell under a pty
|
|
212
|
+
* (terminals.ts). Set once the daemon knows its own address.
|
|
213
|
+
*
|
|
214
|
+
* @param terminals - The terminals, or null to offer none.
|
|
215
|
+
*/
|
|
216
|
+
terminals_set(terminals: Terminals | null): void;
|
|
206
217
|
/**
|
|
207
218
|
* Records whether the daemon's own code still matches its disk, and tells
|
|
208
219
|
* every attached surface when that changes.
|
|
@@ -384,6 +395,29 @@ export declare class CalypsoDaemon {
|
|
|
384
395
|
* @param message - The execute request.
|
|
385
396
|
*/
|
|
386
397
|
private execute_run;
|
|
398
|
+
/**
|
|
399
|
+
* The current-command slot, as it stands.
|
|
400
|
+
*
|
|
401
|
+
* @returns Who holds the lane, for which command.
|
|
402
|
+
*/
|
|
403
|
+
private slot_take;
|
|
404
|
+
/**
|
|
405
|
+
* Puts a slot back.
|
|
406
|
+
*
|
|
407
|
+
* @param slot - The slot.
|
|
408
|
+
*/
|
|
409
|
+
private slot_restore;
|
|
410
|
+
/**
|
|
411
|
+
* Waits on a person without holding the session: the request is sent, the
|
|
412
|
+
* lane given up and the slot put aside, so the next command takes its
|
|
413
|
+
* turn; when the person answers, the command queues for the lane again
|
|
414
|
+
* and resumes with its own slot.
|
|
415
|
+
*
|
|
416
|
+
* @param ask - Sends the request (under the asking command's slot) and
|
|
417
|
+
* resolves with the person's answer.
|
|
418
|
+
* @returns The answer.
|
|
419
|
+
*/
|
|
420
|
+
private person_await;
|
|
387
421
|
/**
|
|
388
422
|
* Raises a prompt on the surface running the current command, returning its
|
|
389
423
|
* answer. The host installs an engine-side input broker that calls this; the
|
package/dist/daemon/server.js
CHANGED
|
@@ -32,6 +32,7 @@ import { token_matches } from './token.js';
|
|
|
32
32
|
import { RequestBroker } from './broker.js';
|
|
33
33
|
import { CONTRACT_VERSION } from '@fnndsc/menu';
|
|
34
34
|
import { clientMessage_parse, attach_parse } from '@fnndsc/menu';
|
|
35
|
+
import { Lane } from './lane.js';
|
|
35
36
|
import { DownloadLedger, downloadId_valid } from './downloads.js';
|
|
36
37
|
/**
|
|
37
38
|
* The largest file `POST /vfs` will take, in bytes.
|
|
@@ -46,6 +47,8 @@ const VFS_POST_LIMIT = 256 * 1024 * 1024;
|
|
|
46
47
|
/** The surface tag on session-bus envelopes the daemon itself originates. */
|
|
47
48
|
export const DAEMON_SURFACE = 'daemon';
|
|
48
49
|
const SCROLLBACK_DEFAULT = 200;
|
|
50
|
+
/** The slot while nobody holds the lane. */
|
|
51
|
+
const SLOT_EMPTY = { origin: null, id: null, instrument: false, line: null, startedAt: 0 };
|
|
49
52
|
/**
|
|
50
53
|
* A WebSocket daemon hosting one engine for attached surfaces, with a session
|
|
51
54
|
* bus broadcasting activity across them.
|
|
@@ -60,8 +63,6 @@ export class CalypsoDaemon {
|
|
|
60
63
|
/** The last executed command's measured facts, sticky across pushes. */
|
|
61
64
|
lastCommand;
|
|
62
65
|
telemetryProvider;
|
|
63
|
-
/** Commands queued behind the one running: the lane's depth. */
|
|
64
|
-
queueWaiting = 0;
|
|
65
66
|
/** The line holding the lane, and since when; null while the lane is idle. */
|
|
66
67
|
currentLine = null;
|
|
67
68
|
currentStartedAt = 0;
|
|
@@ -74,6 +75,8 @@ export class CalypsoDaemon {
|
|
|
74
75
|
backend;
|
|
75
76
|
/** Whether the daemon's own code on disk has moved on since it started. */
|
|
76
77
|
stale = false;
|
|
78
|
+
/** The terminals this daemon offers, or null when it offers none (no pty here). */
|
|
79
|
+
terminals = null;
|
|
77
80
|
codeCheck;
|
|
78
81
|
hostControl;
|
|
79
82
|
/** The one session all surfaces share; returned in each attach ack. */
|
|
@@ -92,11 +95,14 @@ export class CalypsoDaemon {
|
|
|
92
95
|
wss = null;
|
|
93
96
|
httpServer = null;
|
|
94
97
|
/**
|
|
95
|
-
* Execution
|
|
96
|
-
* at a time
|
|
97
|
-
* ask
|
|
98
|
+
* Execution takes turns across the whole session (lane.ts): one command
|
|
99
|
+
* works at a time, so a prompt raised mid-command has one unambiguous
|
|
100
|
+
* surface to ask, the one holding the lane. A command waiting on a person
|
|
101
|
+
* gives the lane up until the answer comes (`person_await`).
|
|
98
102
|
*/
|
|
99
|
-
|
|
103
|
+
lane = new Lane();
|
|
104
|
+
/** The questions open now, by the surface asked: what, and since when. */
|
|
105
|
+
questionsOpen = new Map();
|
|
100
106
|
/** The session's retained regard: the last indication from any surface. */
|
|
101
107
|
regard = null;
|
|
102
108
|
/** Unsubscribes from the engine's ambient events; null until started. */
|
|
@@ -139,6 +145,15 @@ export class CalypsoDaemon {
|
|
|
139
145
|
this.hostControl = options.hostControl ?? [];
|
|
140
146
|
this.codeCheck = options.codeCheck;
|
|
141
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Offers terminals: a surface's console as a chell under a pty
|
|
150
|
+
* (terminals.ts). Set once the daemon knows its own address.
|
|
151
|
+
*
|
|
152
|
+
* @param terminals - The terminals, or null to offer none.
|
|
153
|
+
*/
|
|
154
|
+
terminals_set(terminals) {
|
|
155
|
+
this.terminals = terminals;
|
|
156
|
+
}
|
|
142
157
|
/**
|
|
143
158
|
* Records whether the daemon's own code still matches its disk, and tells
|
|
144
159
|
* every attached surface when that changes.
|
|
@@ -173,7 +188,9 @@ export class CalypsoDaemon {
|
|
|
173
188
|
running: this.currentLine !== null && !this.currentInstrument
|
|
174
189
|
? { line: this.currentLine, sinceMs: Math.round(performance.now() - this.currentStartedAt), surface: this.currentOrigin?.id ?? '' }
|
|
175
190
|
: null,
|
|
176
|
-
waiting: this.
|
|
191
|
+
waiting: this.lane.waiting,
|
|
192
|
+
// Questions open: each one's command has stepped out of the lane.
|
|
193
|
+
questions: [...this.questionsOpen].map(([surface, open]) => ({ surface: surface.id, message: open.message, sinceMs: Math.round(performance.now() - open.at) })),
|
|
177
194
|
};
|
|
178
195
|
// Who else is here: a restart asked from one surface names the rest.
|
|
179
196
|
// A surface that runs host shells is a terminal; one that does not, a browser.
|
|
@@ -257,6 +274,8 @@ export class CalypsoDaemon {
|
|
|
257
274
|
* @returns A promise resolving when the server has closed.
|
|
258
275
|
*/
|
|
259
276
|
stop() {
|
|
277
|
+
// A terminal's chell is a child of this process: it goes with it.
|
|
278
|
+
this.terminals?.stop();
|
|
260
279
|
if (this.telemetryTimer !== null) {
|
|
261
280
|
clearInterval(this.telemetryTimer);
|
|
262
281
|
this.telemetryTimer = null;
|
|
@@ -529,6 +548,11 @@ export class CalypsoDaemon {
|
|
|
529
548
|
*/
|
|
530
549
|
connection_handle(socket, request) {
|
|
531
550
|
let surface = null;
|
|
551
|
+
// This socket as a terminal's viewer: output and exits go back down it.
|
|
552
|
+
const viewer = {
|
|
553
|
+
data: (terminalId, data) => this.send(socket, { type: 'terminalData', terminalId, data }),
|
|
554
|
+
exit: (terminalId, code) => this.send(socket, { type: 'terminalExit', terminalId, code }),
|
|
555
|
+
};
|
|
532
556
|
// A front that holds the token for a browser — the porter — puts it on
|
|
533
557
|
// the upgrade URL it proxies, the way `/vfs?token=` already travels; the
|
|
534
558
|
// page then attaches with an empty token and is judged by the URL's.
|
|
@@ -555,26 +579,10 @@ export class CalypsoDaemon {
|
|
|
555
579
|
const value = message.value;
|
|
556
580
|
const attached = surface;
|
|
557
581
|
if (value.type === 'execute') {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
// so queuing them behind it would deadlock: the answer waits on
|
|
563
|
-
// the browsing, the browsing waits on the answer.
|
|
564
|
-
//
|
|
565
|
-
// Safe because of what an instrument is: a pane's own read, which
|
|
566
|
-
// never asks (refused above) and never moves the session. A
|
|
567
|
-
// command that changes state is never instrument traffic.
|
|
568
|
-
void this.execute_run(attached, value);
|
|
569
|
-
}
|
|
570
|
-
else {
|
|
571
|
-
// One shared queue: commands from every surface run one at a time.
|
|
572
|
-
this.queueWaiting += 1;
|
|
573
|
-
this.queue = this.queue.then(() => {
|
|
574
|
-
this.queueWaiting -= 1;
|
|
575
|
-
return this.execute_run(attached, value);
|
|
576
|
-
});
|
|
577
|
-
}
|
|
582
|
+
// One lane for every surface: commands take turns, and a command
|
|
583
|
+
// waiting on a person stands aside (person_await), so a pane's own
|
|
584
|
+
// reads, or another surface's command, run while a question is open.
|
|
585
|
+
void this.lane.run(() => this.execute_run(attached, value));
|
|
578
586
|
}
|
|
579
587
|
else if (value.type === 'cancel') {
|
|
580
588
|
this.cancel_run(attached, value);
|
|
@@ -622,11 +630,31 @@ export class CalypsoDaemon {
|
|
|
622
630
|
else if (value.type === 'watch' || value.type === 'unwatch') {
|
|
623
631
|
this.watch_receive(attached, value.subject, value.type === 'watch');
|
|
624
632
|
}
|
|
633
|
+
else if (value.type === 'terminalOpen') {
|
|
634
|
+
if (this.terminals === null) {
|
|
635
|
+
this.send(socket, { type: 'terminalOpened', terminalId: '', replay: '', refused: 'this daemon offers no terminals (node-pty is not built here)' });
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
const opened = this.terminals.open(viewer, value.cols, value.rows, value.terminalId);
|
|
639
|
+
this.send(socket, { type: 'terminalOpened', terminalId: opened.terminalId, replay: opened.replay });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
else if (value.type === 'terminalInput') {
|
|
643
|
+
this.terminals?.input(viewer, value.terminalId, value.data);
|
|
644
|
+
}
|
|
645
|
+
else if (value.type === 'terminalResize') {
|
|
646
|
+
this.terminals?.resize(viewer, value.terminalId, value.cols, value.rows);
|
|
647
|
+
}
|
|
648
|
+
else if (value.type === 'terminalClose') {
|
|
649
|
+
this.terminals?.close(viewer, value.terminalId);
|
|
650
|
+
}
|
|
625
651
|
else {
|
|
626
652
|
this.send(socket, { type: 'error', reason: 'already attached' });
|
|
627
653
|
}
|
|
628
654
|
});
|
|
629
655
|
socket.on('close', () => {
|
|
656
|
+
// Its terminals keep running, unwatched, for a reattach.
|
|
657
|
+
this.terminals?.detach(viewer);
|
|
630
658
|
if (surface) {
|
|
631
659
|
this.surfaces.delete(surface);
|
|
632
660
|
// A detached surface holds no watches: whatever it kept live is
|
|
@@ -704,6 +732,7 @@ export class CalypsoDaemon {
|
|
|
704
732
|
// says CALYPSO DAEMON OUT OF DATE only on this, never on its own
|
|
705
733
|
// build alone (an ARGUS-only release changes no daemon code).
|
|
706
734
|
stale: this.stale,
|
|
735
|
+
terminals: this.terminals !== null,
|
|
707
736
|
});
|
|
708
737
|
this.codeCheck?.();
|
|
709
738
|
this.scrollback_replay(socket);
|
|
@@ -791,7 +820,9 @@ export class CalypsoDaemon {
|
|
|
791
820
|
if (!this.promptProvider) {
|
|
792
821
|
return;
|
|
793
822
|
}
|
|
794
|
-
const
|
|
823
|
+
const provided = await this.promptProvider(this.lastCommand);
|
|
824
|
+
// The session's open questions are the daemon's to count, not the backend's.
|
|
825
|
+
const context = this.questionsOpen.size > 0 ? { ...provided, questions: this.questionsOpen.size } : provided;
|
|
795
826
|
this.promptWarmupActive = context.procWarmup !== undefined;
|
|
796
827
|
if (target) {
|
|
797
828
|
this.send(target.socket, { type: 'promptline', context });
|
|
@@ -841,15 +872,8 @@ export class CalypsoDaemon {
|
|
|
841
872
|
async execute_run(origin, message) {
|
|
842
873
|
// The command runs with this surface as the prompt target, so any prompt
|
|
843
874
|
// the engine raises is asked of the surface that submitted the command.
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
// command's output must still find its way home when the inner one
|
|
847
|
-
// finishes.
|
|
848
|
-
const outerOrigin = this.currentOrigin;
|
|
849
|
-
const outerId = this.currentId;
|
|
850
|
-
const outerInstrument = this.currentInstrument;
|
|
851
|
-
const outerLine = this.currentLine;
|
|
852
|
-
const outerStartedAt = this.currentStartedAt;
|
|
875
|
+
// The slot is the lane holder's: set when the command takes its turn,
|
|
876
|
+
// put aside while it waits on a person, and cleared when it finishes.
|
|
853
877
|
this.currentOrigin = origin;
|
|
854
878
|
this.currentId = message.id;
|
|
855
879
|
this.currentInstrument = message.instrument === true;
|
|
@@ -897,11 +921,56 @@ export class CalypsoDaemon {
|
|
|
897
921
|
}
|
|
898
922
|
}
|
|
899
923
|
finally {
|
|
900
|
-
this.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
924
|
+
this.slot_restore(SLOT_EMPTY);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* The current-command slot, as it stands.
|
|
929
|
+
*
|
|
930
|
+
* @returns Who holds the lane, for which command.
|
|
931
|
+
*/
|
|
932
|
+
slot_take() {
|
|
933
|
+
return { origin: this.currentOrigin, id: this.currentId, instrument: this.currentInstrument, line: this.currentLine, startedAt: this.currentStartedAt };
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Puts a slot back.
|
|
937
|
+
*
|
|
938
|
+
* @param slot - The slot.
|
|
939
|
+
*/
|
|
940
|
+
slot_restore(slot) {
|
|
941
|
+
this.currentOrigin = slot.origin;
|
|
942
|
+
this.currentId = slot.id;
|
|
943
|
+
this.currentInstrument = slot.instrument;
|
|
944
|
+
this.currentLine = slot.line;
|
|
945
|
+
this.currentStartedAt = slot.startedAt;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Waits on a person without holding the session: the request is sent, the
|
|
949
|
+
* lane given up and the slot put aside, so the next command takes its
|
|
950
|
+
* turn; when the person answers, the command queues for the lane again
|
|
951
|
+
* and resumes with its own slot.
|
|
952
|
+
*
|
|
953
|
+
* @param ask - Sends the request (under the asking command's slot) and
|
|
954
|
+
* resolves with the person's answer.
|
|
955
|
+
* @returns The answer.
|
|
956
|
+
*/
|
|
957
|
+
async person_await(ask) {
|
|
958
|
+
const answered = ask();
|
|
959
|
+
const mine = this.slot_take();
|
|
960
|
+
// The engine's per-command state goes with the command (its exit code,
|
|
961
|
+
// a pipe's untaken input, its cancellation), so the next command starts
|
|
962
|
+
// clean and this one finds its own on return.
|
|
963
|
+
const engineTurn = this.engine.turn_leave?.();
|
|
964
|
+
this.slot_restore(SLOT_EMPTY);
|
|
965
|
+
this.lane.release();
|
|
966
|
+
try {
|
|
967
|
+
return await answered;
|
|
968
|
+
}
|
|
969
|
+
finally {
|
|
970
|
+
await this.lane.acquire();
|
|
971
|
+
this.slot_restore(mine);
|
|
972
|
+
if (engineTurn !== undefined)
|
|
973
|
+
this.engine.turn_resume?.(engineTurn);
|
|
905
974
|
}
|
|
906
975
|
}
|
|
907
976
|
/**
|
|
@@ -935,7 +1004,15 @@ export class CalypsoDaemon {
|
|
|
935
1004
|
// question whose command they have forgotten issuing.
|
|
936
1005
|
return Promise.reject(new Error('another question is already open on this surface'));
|
|
937
1006
|
}
|
|
938
|
-
|
|
1007
|
+
// An open question is the session's to show: every surface's prompt
|
|
1008
|
+
// context counts it, and `who` says who asked what.
|
|
1009
|
+
this.questionsOpen.set(origin, { message: request.message, at: performance.now() });
|
|
1010
|
+
void this.promptline_push();
|
|
1011
|
+
const settled = () => {
|
|
1012
|
+
this.questionsOpen.delete(origin);
|
|
1013
|
+
void this.promptline_push();
|
|
1014
|
+
};
|
|
1015
|
+
return this.person_await(() => this.prompts.open(origin.socket, (promptId) => {
|
|
939
1016
|
this.send(origin.socket, {
|
|
940
1017
|
type: 'prompt',
|
|
941
1018
|
promptId,
|
|
@@ -945,7 +1022,7 @@ export class CalypsoDaemon {
|
|
|
945
1022
|
...(request.path === undefined ? {} : { path: request.path }),
|
|
946
1023
|
...(request.commit === undefined ? {} : { commit: request.commit }),
|
|
947
1024
|
});
|
|
948
|
-
});
|
|
1025
|
+
}).finally(settled));
|
|
949
1026
|
}
|
|
950
1027
|
/**
|
|
951
1028
|
* Streams structured progress from the executing command to its origin
|
|
@@ -1041,9 +1118,10 @@ export class CalypsoDaemon {
|
|
|
1041
1118
|
if (!origin) {
|
|
1042
1119
|
return Promise.reject(new Error('no active command to edit for'));
|
|
1043
1120
|
}
|
|
1044
|
-
|
|
1121
|
+
// Someone is editing: the session is free meanwhile.
|
|
1122
|
+
return this.person_await(() => this.edits.open(origin.socket, (editId) => {
|
|
1045
1123
|
this.send(origin.socket, { type: 'edit', editId, content, extension, ...(path === undefined ? {} : { path }) });
|
|
1046
|
-
});
|
|
1124
|
+
}));
|
|
1047
1125
|
}
|
|
1048
1126
|
/**
|
|
1049
1127
|
* Reports what the surface running the current command can do on its own
|
|
@@ -1064,6 +1142,7 @@ export class CalypsoDaemon {
|
|
|
1064
1142
|
id: each.id,
|
|
1065
1143
|
kind: each.capabilities.shellCommands ? 'chell' : 'browser',
|
|
1066
1144
|
you: each === this.currentOrigin,
|
|
1145
|
+
...(this.questionsOpen.has(each) ? { asking: this.questionsOpen.get(each).message } : {}),
|
|
1067
1146
|
}));
|
|
1068
1147
|
}
|
|
1069
1148
|
capabilities_current() {
|