@amalgm/shell 0.1.164-main.41474889901 → 0.1.164-main.41541851444
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/cli.js +34 -41
- package/dist/cli.js.map +1 -1
- package/dist/drive/fuse.d.ts +13 -116
- package/dist/drive/fuse.js +36 -145
- package/dist/drive/fuse.js.map +1 -1
- package/dist/drive/kernel.d.ts +17 -0
- package/dist/drive/kernel.js +32 -0
- package/dist/drive/kernel.js.map +1 -0
- package/dist/drive/layout.d.ts +2 -0
- package/dist/drive/layout.js +8 -4
- package/dist/drive/layout.js.map +1 -1
- package/dist/drive/mount.d.ts +16 -6
- package/dist/drive/mount.js +50 -24
- package/dist/drive/mount.js.map +1 -1
- package/dist/drive/mountpoint.d.ts +14 -0
- package/dist/drive/mountpoint.js +51 -0
- package/dist/drive/mountpoint.js.map +1 -0
- package/dist/drive/nfs/apple-double.d.ts +6 -0
- package/dist/drive/nfs/apple-double.js +140 -0
- package/dist/drive/nfs/apple-double.js.map +1 -0
- package/dist/drive/nfs/attributes.d.ts +64 -0
- package/dist/drive/nfs/attributes.js +97 -0
- package/dist/drive/nfs/attributes.js.map +1 -0
- package/dist/drive/nfs/handles.d.ts +44 -0
- package/dist/drive/nfs/handles.js +209 -0
- package/dist/drive/nfs/handles.js.map +1 -0
- package/dist/drive/nfs/mount3.d.ts +16 -0
- package/dist/drive/nfs/mount3.js +38 -0
- package/dist/drive/nfs/mount3.js.map +1 -0
- package/dist/drive/nfs/nfs3.d.ts +27 -0
- package/dist/drive/nfs/nfs3.js +458 -0
- package/dist/drive/nfs/nfs3.js.map +1 -0
- package/dist/drive/nfs/rpc.d.ts +66 -0
- package/dist/drive/nfs/rpc.js +122 -0
- package/dist/drive/nfs/rpc.js.map +1 -0
- package/dist/drive/nfs/server.d.ts +30 -0
- package/dist/drive/nfs/server.js +109 -0
- package/dist/drive/nfs/server.js.map +1 -0
- package/dist/drive/nfs/xdr.d.ts +44 -0
- package/dist/drive/nfs/xdr.js +111 -0
- package/dist/drive/nfs/xdr.js.map +1 -0
- package/dist/drive/nfs.d.ts +60 -0
- package/dist/drive/nfs.js +181 -0
- package/dist/drive/nfs.js.map +1 -0
- package/dist/drive/operations.d.ts +125 -0
- package/dist/drive/operations.js +141 -0
- package/dist/drive/operations.js.map +1 -0
- package/dist/error-facts.d.ts +24 -0
- package/dist/error-facts.js +35 -0
- package/dist/error-facts.js.map +1 -0
- package/dist/files-program/client.d.ts +122 -0
- package/dist/files-program/client.js +430 -0
- package/dist/files-program/client.js.map +1 -0
- package/dist/files-program/journeys.d.ts +15 -0
- package/dist/files-program/journeys.js +79 -0
- package/dist/files-program/journeys.js.map +1 -0
- package/dist/files-program/program.d.ts +1 -0
- package/dist/files-program/program.js +255 -0
- package/dist/files-program/program.js.map +1 -0
- package/dist/files-program/protocol.d.ts +154 -0
- package/dist/files-program/protocol.js +7 -0
- package/dist/files-program/protocol.js.map +1 -0
- package/dist/machine-host.d.ts +35 -32
- package/dist/machine-host.js +124 -195
- package/dist/machine-host.js.map +1 -1
- package/dist/runtime-node-flags.d.ts +6 -6
- package/dist/runtime-node-flags.js +6 -6
- package/dist/sharing-host.d.ts +6 -11
- package/dist/sharing-host.js +6 -10
- package/dist/sharing-host.js.map +1 -1
- package/dist/sync-cli.js +1 -1
- package/dist/sync-cli.js.map +1 -1
- package/npm-shrinkwrap.json +6 -6
- package/package.json +5 -5
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { RuntimeBinding } from "@amalgm/core/identity";
|
|
2
|
+
import { type ActivityHook } from "@amalgm/core/supervision";
|
|
3
|
+
import type { Receipt } from "@amalgm/live/drive";
|
|
4
|
+
import type { Actor, CommandName } from "@amalgm/live/sharing";
|
|
5
|
+
import type { EntityApplyStageEvidence } from "../apply-window-host.js";
|
|
6
|
+
import type { ConstructRecordChange } from "../construct-door.js";
|
|
7
|
+
import type { ServedDrive } from "../drive/mount.js";
|
|
8
|
+
import type { FilesStageObserver } from "../files-observability.js";
|
|
9
|
+
import type { SyncBlocked } from "../sync-setting.js";
|
|
10
|
+
import type { DetectScanEvidence, FlushOutcome, UserGroundCloseOptions, UserGroundClosed } from "../user-ground-host.js";
|
|
11
|
+
import type { WatchCoverageEvidence, WatchHealth } from "../watching/index.js";
|
|
12
|
+
import type { AddedWorkspace } from "./journeys.js";
|
|
13
|
+
import { type ConvergeEvidence, type ConvergeIdentity, type GroundInput, type InstallStageEvidence, type Traced, type WireInput } from "./protocol.js";
|
|
14
|
+
export interface FilesObservers {
|
|
15
|
+
readonly wireError?: (error: unknown) => void;
|
|
16
|
+
readonly backgroundError?: (error: unknown) => void;
|
|
17
|
+
readonly watchHealth?: (health: WatchHealth) => void;
|
|
18
|
+
readonly detectScan?: (evidence: DetectScanEvidence) => void;
|
|
19
|
+
readonly applyStage?: (evidence: EntityApplyStageEvidence) => void;
|
|
20
|
+
readonly filesStage?: FilesStageObserver;
|
|
21
|
+
readonly placed?: (receipt: Receipt) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface FilesProgramOptions {
|
|
24
|
+
/** The program's working folder: real disk, never the drive. */
|
|
25
|
+
readonly cwd: string;
|
|
26
|
+
readonly home: string;
|
|
27
|
+
readonly binding: RuntimeBinding;
|
|
28
|
+
readonly openWatchModule?: string;
|
|
29
|
+
readonly observers: FilesObservers;
|
|
30
|
+
readonly installStage?: (evidence: InstallStageEvidence) => Promise<void> | void;
|
|
31
|
+
/** Answers the program's asks of the Apps product, which runs here. */
|
|
32
|
+
readonly app: (method: string, args: readonly unknown[]) => Promise<unknown>;
|
|
33
|
+
}
|
|
34
|
+
export interface FilesCounts {
|
|
35
|
+
readonly unsent: ActivityHook;
|
|
36
|
+
readonly unsettled: ActivityHook;
|
|
37
|
+
}
|
|
38
|
+
export interface RemoteWire {
|
|
39
|
+
start(gatewayPort: number, runtimeToken: string): Promise<void>;
|
|
40
|
+
/** Stops forwarding to the runtime's gateway; the Wire stays open. */
|
|
41
|
+
configure(): Promise<void>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
instance(): Promise<string>;
|
|
44
|
+
}
|
|
45
|
+
export interface RemoteGround {
|
|
46
|
+
readonly id: number;
|
|
47
|
+
converge(identity: ConvergeIdentity): Promise<ConvergeEvidence>;
|
|
48
|
+
/** What it reported closing, or null when its program stopped first. */
|
|
49
|
+
close(options?: UserGroundCloseOptions): Promise<UserGroundClosed | null>;
|
|
50
|
+
flushWatch(): Promise<void>;
|
|
51
|
+
flush(): Promise<FlushOutcome>;
|
|
52
|
+
blocked(): Promise<SyncBlocked[]>;
|
|
53
|
+
watchEvidence(): Promise<WatchCoverageEvidence>;
|
|
54
|
+
add(workspaceId: string, destinationParent: string, trace: boolean): Promise<Traced<AddedWorkspace>>;
|
|
55
|
+
register(path: string, trace: boolean): Promise<Traced<Record<string, unknown>>>;
|
|
56
|
+
recordConstruct(change: ConstructRecordChange): Promise<void>;
|
|
57
|
+
share(name: CommandName, request: unknown, actor: Actor, linkBase: string): Promise<unknown>;
|
|
58
|
+
}
|
|
59
|
+
/** The drive as the runtime holds it; it is served in the Files program. */
|
|
60
|
+
export type RemoteDrive = Pick<ServedDrive, "home" | "mountpoint" | "shelf" | "folder" | "unmount">;
|
|
61
|
+
export declare class FilesProgram {
|
|
62
|
+
private readonly options;
|
|
63
|
+
private readonly init;
|
|
64
|
+
private readonly supervision;
|
|
65
|
+
private launch;
|
|
66
|
+
private ready;
|
|
67
|
+
private retry;
|
|
68
|
+
private stopped;
|
|
69
|
+
/** Why the last start or the running program failed, until one stands again. */
|
|
70
|
+
private failure;
|
|
71
|
+
private nextCall;
|
|
72
|
+
private nextHandle;
|
|
73
|
+
private readonly counts;
|
|
74
|
+
private app;
|
|
75
|
+
private wire;
|
|
76
|
+
private started;
|
|
77
|
+
private readonly grounds;
|
|
78
|
+
private drive;
|
|
79
|
+
constructor(options: FilesProgramOptions);
|
|
80
|
+
/** Why nothing this program established stands now, or null while it does;
|
|
81
|
+
* `parked` when it will not try again. Asking starts nothing and waits for
|
|
82
|
+
* nothing. */
|
|
83
|
+
down(): {
|
|
84
|
+
readonly reason: string;
|
|
85
|
+
readonly parked: boolean;
|
|
86
|
+
} | null;
|
|
87
|
+
/** Whether Apps runs, so whether the program may ask it about apps. */
|
|
88
|
+
products(app: boolean): Promise<void>;
|
|
89
|
+
/** Opens the runtime's one Wire in the program, closing any before it. */
|
|
90
|
+
openWire(input: WireInput): Promise<RemoteWire>;
|
|
91
|
+
/** Creates a ground on the program's Wire. Once converged, it is created
|
|
92
|
+
* and converged again in every program that follows, until it closes. */
|
|
93
|
+
createGround(input: GroundInput, counts: () => FilesCounts): Promise<RemoteGround>;
|
|
94
|
+
/** Serves the drive over a converged ground: through the person's mount
|
|
95
|
+
* when one stands, or mounting it. It is served again in every program
|
|
96
|
+
* that follows, until it unmounts. */
|
|
97
|
+
serveDrive(ground: RemoteGround, email: string, placing: () => ActivityHook): Promise<RemoteDrive>;
|
|
98
|
+
/** Lets the program go: it exits once its channel closes, and this ends only
|
|
99
|
+
* when it has, killed or not, so nothing it holds outlasts a stop. A drive it
|
|
100
|
+
* still serves answers that its server is gone until it is mounted again. */
|
|
101
|
+
close(): Promise<void>;
|
|
102
|
+
private unmountDrive;
|
|
103
|
+
private hand;
|
|
104
|
+
private forget;
|
|
105
|
+
/** The running program, waiting through a restart. A start that could not
|
|
106
|
+
* fork has already arranged the next one, which stays the one waited for. */
|
|
107
|
+
private current;
|
|
108
|
+
/** The running program, or null when none runs now. */
|
|
109
|
+
private live;
|
|
110
|
+
private call;
|
|
111
|
+
/** Tells the running program what the runtime now keeps. One not running, or
|
|
112
|
+
* stopping before it answers, has nothing to be told. */
|
|
113
|
+
private tell;
|
|
114
|
+
private send;
|
|
115
|
+
private start;
|
|
116
|
+
private lose;
|
|
117
|
+
/** The program is gone: what it said goes to nobody, and another follows.
|
|
118
|
+
* `ended` is when its run ended as Core should count it. */
|
|
119
|
+
private startAgain;
|
|
120
|
+
private receive;
|
|
121
|
+
private answer;
|
|
122
|
+
}
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime's side of its Files program (program.ts). Files runs as its
|
|
3
|
+
* own program because the drive's kernel requests are answered on the main
|
|
4
|
+
* thread of the process that mounted it, and a runtime that starts a program
|
|
5
|
+
* whose working folder is on the drive waits, on that same thread, for the
|
|
6
|
+
* program to start: a runtime serving its own drive would wait on itself.
|
|
7
|
+
*
|
|
8
|
+
* The runtime keeps what it established (the Wire, each converged ground, the
|
|
9
|
+
* drive) and, when the program stops, starts it again under Core's child
|
|
10
|
+
* supervision and establishes the same things in the same order. A call made
|
|
11
|
+
* while the program restarts waits for it. What only changes what the runtime
|
|
12
|
+
* keeps (a close, above all) does not: a program that stopped holds nothing to
|
|
13
|
+
* close, and the next starts from what the runtime keeps. Counts the program
|
|
14
|
+
* said go to nobody when it stops: while it is down nothing can say nothing
|
|
15
|
+
* would be lost. It says why it is down until it stands again, since what it
|
|
16
|
+
* established (Watch above all) does not stand meanwhile.
|
|
17
|
+
*
|
|
18
|
+
* A program that stands but no longer answers has stopped too. It is watched by
|
|
19
|
+
* the rule the service watches the runtime by, with the same patience, so a
|
|
20
|
+
* call made of it ends and it is replaced. A launch that never stood counts as
|
|
21
|
+
* no run at all, however long it took to fail.
|
|
22
|
+
*/
|
|
23
|
+
import { fork } from "node:child_process";
|
|
24
|
+
import { fileURLToPath } from "node:url";
|
|
25
|
+
import { ChildSupervisionMachine } from "@amalgm/core/supervision";
|
|
26
|
+
import { errorFacts, reviveError } from "../error-facts.js";
|
|
27
|
+
import { RUNTIME_NODE_FLAGS } from "../runtime-node-flags.js";
|
|
28
|
+
import { ALWAYS_ON_POLICY } from "../service/policy.js";
|
|
29
|
+
import { watchLiveness } from "../updates/bootstrap.js";
|
|
30
|
+
import { countHandle, FILES_PROGRAM_STOPPED, } from "./protocol.js";
|
|
31
|
+
const FILES_PROGRAM = fileURLToPath(new URL("./program.js", import.meta.url));
|
|
32
|
+
/** How long a closing program may take to exit once told to. */
|
|
33
|
+
const CLOSE_GRACE_MS = 5_000;
|
|
34
|
+
const LIVENESS = { ...ALWAYS_ON_POLICY.liveness, stableAfterMs: ALWAYS_ON_POLICY.restart.stableAfterMs };
|
|
35
|
+
export class FilesProgram {
|
|
36
|
+
options;
|
|
37
|
+
init;
|
|
38
|
+
supervision = new ChildSupervisionMachine();
|
|
39
|
+
launch = null;
|
|
40
|
+
ready = null;
|
|
41
|
+
retry = null;
|
|
42
|
+
stopped = null;
|
|
43
|
+
/** Why the last start or the running program failed, until one stands again. */
|
|
44
|
+
failure = null;
|
|
45
|
+
nextCall = 0;
|
|
46
|
+
nextHandle = 0;
|
|
47
|
+
counts = new Map();
|
|
48
|
+
app = false;
|
|
49
|
+
wire = null;
|
|
50
|
+
started = null;
|
|
51
|
+
grounds = new Map();
|
|
52
|
+
drive = null;
|
|
53
|
+
constructor(options) {
|
|
54
|
+
this.options = options;
|
|
55
|
+
this.init = {
|
|
56
|
+
home: options.home,
|
|
57
|
+
binding: options.binding,
|
|
58
|
+
...(options.openWatchModule ? { openWatchModule: options.openWatchModule } : {}),
|
|
59
|
+
observed: Object.keys(options.observers).filter((name) => options.observers[name]),
|
|
60
|
+
installStage: options.installStage !== undefined,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Why nothing this program established stands now, or null while it does;
|
|
64
|
+
* `parked` when it will not try again. Asking starts nothing and waits for
|
|
65
|
+
* nothing. */
|
|
66
|
+
down() {
|
|
67
|
+
if (this.stopped)
|
|
68
|
+
return { reason: this.stopped.message, parked: true };
|
|
69
|
+
return this.failure === null ? null : { reason: this.failure, parked: false };
|
|
70
|
+
}
|
|
71
|
+
/** Whether Apps runs, so whether the program may ask it about apps. */
|
|
72
|
+
async products(app) {
|
|
73
|
+
this.app = app;
|
|
74
|
+
await this.tell("products", app);
|
|
75
|
+
}
|
|
76
|
+
/** Opens the runtime's one Wire in the program, closing any before it. */
|
|
77
|
+
async openWire(input) {
|
|
78
|
+
this.wire = input;
|
|
79
|
+
this.started = null;
|
|
80
|
+
await this.call("wire.open", input);
|
|
81
|
+
const current = () => this.wire === input;
|
|
82
|
+
return {
|
|
83
|
+
start: async (port, token) => {
|
|
84
|
+
await this.call("wire.start", port, token);
|
|
85
|
+
if (current())
|
|
86
|
+
this.started = { port, token };
|
|
87
|
+
},
|
|
88
|
+
configure: async () => {
|
|
89
|
+
if (!current())
|
|
90
|
+
return;
|
|
91
|
+
this.started = null;
|
|
92
|
+
await this.tell("wire.configure");
|
|
93
|
+
},
|
|
94
|
+
close: async () => {
|
|
95
|
+
if (!current())
|
|
96
|
+
return;
|
|
97
|
+
this.wire = null;
|
|
98
|
+
this.started = null;
|
|
99
|
+
await this.tell("wire.close");
|
|
100
|
+
},
|
|
101
|
+
instance: () => this.call("wire.instance"),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Creates a ground on the program's Wire. Once converged, it is created
|
|
105
|
+
* and converged again in every program that follows, until it closes. */
|
|
106
|
+
async createGround(input, counts) {
|
|
107
|
+
const id = ++this.nextHandle;
|
|
108
|
+
this.grounds.set(id, { input, counts, identity: null });
|
|
109
|
+
this.hand(id, counts());
|
|
110
|
+
try {
|
|
111
|
+
await this.call("ground.create", id, input);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
this.forget(id);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
id,
|
|
119
|
+
converge: async (identity) => {
|
|
120
|
+
const evidence = await this.call("ground.converge", id, identity);
|
|
121
|
+
const held = this.grounds.get(id);
|
|
122
|
+
if (held)
|
|
123
|
+
held.identity = identity;
|
|
124
|
+
return evidence;
|
|
125
|
+
},
|
|
126
|
+
close: async (options = {}) => {
|
|
127
|
+
this.grounds.delete(id);
|
|
128
|
+
try {
|
|
129
|
+
return await this.tell("ground.close", id, options);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
this.forget(id);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
flushWatch: () => this.call("ground.flushWatch", id),
|
|
136
|
+
flush: () => this.call("ground.flush", id),
|
|
137
|
+
blocked: () => this.call("ground.blocked", id),
|
|
138
|
+
watchEvidence: () => this.call("ground.watchEvidence", id),
|
|
139
|
+
add: (workspaceId, destinationParent, trace) => this.call("ground.add", id, workspaceId, destinationParent, trace),
|
|
140
|
+
register: (path, trace) => this.call("ground.register", id, path, trace),
|
|
141
|
+
recordConstruct: (change) => this.call("ground.recordConstruct", id, change),
|
|
142
|
+
share: (name, request, actor, linkBase) => this.call("ground.share", id, name, request, actor, linkBase),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** Serves the drive over a converged ground: through the person's mount
|
|
146
|
+
* when one stands, or mounting it. It is served again in every program
|
|
147
|
+
* that follows, until it unmounts. */
|
|
148
|
+
async serveDrive(ground, email, placing) {
|
|
149
|
+
if (this.drive && this.drive.email !== email)
|
|
150
|
+
await this.unmountDrive(this.drive.id);
|
|
151
|
+
const id = this.drive?.id ?? ++this.nextHandle;
|
|
152
|
+
const handle = countHandle("drive", id, "placing");
|
|
153
|
+
this.counts.set(handle, placing());
|
|
154
|
+
let facts;
|
|
155
|
+
try {
|
|
156
|
+
facts = await this.call("drive.serve", id, ground.id, email);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (!this.drive)
|
|
160
|
+
this.counts.delete(handle);
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
this.drive = { id, ground: ground.id, email, placing };
|
|
164
|
+
return {
|
|
165
|
+
...facts,
|
|
166
|
+
folder: (address) => this.call("drive.folder", id, address),
|
|
167
|
+
unmount: () => this.unmountDrive(id),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** Lets the program go: it exits once its channel closes, and this ends only
|
|
171
|
+
* when it has, killed or not, so nothing it holds outlasts a stop. A drive it
|
|
172
|
+
* still serves answers that its server is gone until it is mounted again. */
|
|
173
|
+
async close() {
|
|
174
|
+
this.stopped ??= stoppedError("the Files program closed");
|
|
175
|
+
this.retry?.cancel();
|
|
176
|
+
const child = this.launch?.child;
|
|
177
|
+
if (!child || child.exitCode !== null || child.signalCode !== null)
|
|
178
|
+
return;
|
|
179
|
+
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
180
|
+
const kill = setTimeout(() => child.kill("SIGKILL"), CLOSE_GRACE_MS);
|
|
181
|
+
if (child.connected)
|
|
182
|
+
child.disconnect();
|
|
183
|
+
await exited;
|
|
184
|
+
clearTimeout(kill);
|
|
185
|
+
}
|
|
186
|
+
async unmountDrive(id) {
|
|
187
|
+
if (this.drive?.id !== id)
|
|
188
|
+
return;
|
|
189
|
+
this.drive = null;
|
|
190
|
+
this.counts.delete(countHandle("drive", id, "placing"));
|
|
191
|
+
await this.tell("drive.unmount", id);
|
|
192
|
+
}
|
|
193
|
+
hand(id, counts) {
|
|
194
|
+
this.counts.set(countHandle("ground", id, "unsent"), counts.unsent);
|
|
195
|
+
this.counts.set(countHandle("ground", id, "unsettled"), counts.unsettled);
|
|
196
|
+
}
|
|
197
|
+
forget(id) {
|
|
198
|
+
this.grounds.delete(id);
|
|
199
|
+
this.counts.delete(countHandle("ground", id, "unsent"));
|
|
200
|
+
this.counts.delete(countHandle("ground", id, "unsettled"));
|
|
201
|
+
}
|
|
202
|
+
/** The running program, waiting through a restart. A start that could not
|
|
203
|
+
* fork has already arranged the next one, which stays the one waited for. */
|
|
204
|
+
current() {
|
|
205
|
+
if (this.stopped)
|
|
206
|
+
return Promise.reject(this.stopped);
|
|
207
|
+
if (this.ready)
|
|
208
|
+
return this.ready;
|
|
209
|
+
const starting = this.start();
|
|
210
|
+
this.ready ??= starting;
|
|
211
|
+
return starting;
|
|
212
|
+
}
|
|
213
|
+
/** The running program, or null when none runs now. */
|
|
214
|
+
async live() {
|
|
215
|
+
const launch = this.launch;
|
|
216
|
+
if (!launch || launch.lost || this.stopped || !this.ready)
|
|
217
|
+
return null;
|
|
218
|
+
return this.ready.then((ready) => (ready.lost ? null : ready), () => null);
|
|
219
|
+
}
|
|
220
|
+
async call(method, ...args) {
|
|
221
|
+
return this.send(await this.current(), method, ...args);
|
|
222
|
+
}
|
|
223
|
+
/** Tells the running program what the runtime now keeps. One not running, or
|
|
224
|
+
* stopping before it answers, has nothing to be told. */
|
|
225
|
+
async tell(method, ...args) {
|
|
226
|
+
const launch = await this.live();
|
|
227
|
+
if (!launch)
|
|
228
|
+
return null;
|
|
229
|
+
try {
|
|
230
|
+
return await this.send(launch, method, ...args);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
if (error?.code !== FILES_PROGRAM_STOPPED)
|
|
234
|
+
throw error;
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
send(launch, method, ...args) {
|
|
239
|
+
if (launch.lost)
|
|
240
|
+
return Promise.reject(stoppedError("the Files program stopped"));
|
|
241
|
+
const id = ++this.nextCall;
|
|
242
|
+
return new Promise((resolve, reject) => {
|
|
243
|
+
launch.calls.set(id, { resolve: resolve, reject });
|
|
244
|
+
const request = { kind: "call", id, method, args };
|
|
245
|
+
try {
|
|
246
|
+
launch.child.send(request, (error) => {
|
|
247
|
+
if (error && launch.calls.delete(id))
|
|
248
|
+
reject(stoppedError(`the Files program stopped: ${error.message}`));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
launch.calls.delete(id);
|
|
253
|
+
reject(error);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
async start() {
|
|
258
|
+
const startedAt = Date.now();
|
|
259
|
+
this.supervision.launched(startedAt);
|
|
260
|
+
let child;
|
|
261
|
+
try {
|
|
262
|
+
child = fork(FILES_PROGRAM, [], {
|
|
263
|
+
serialization: "advanced",
|
|
264
|
+
execArgv: [...RUNTIME_NODE_FLAGS],
|
|
265
|
+
cwd: this.options.cwd,
|
|
266
|
+
env: process.env,
|
|
267
|
+
stdio: ["ignore", "inherit", "inherit", "ipc"],
|
|
268
|
+
detached: process.platform !== "win32",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
// No process, so no exit will ever say this.
|
|
273
|
+
const stopped = stoppedError(`the Files program stopped: ${error instanceof Error ? error.message : String(error)}`);
|
|
274
|
+
this.startAgain(stopped, startedAt);
|
|
275
|
+
throw stopped;
|
|
276
|
+
}
|
|
277
|
+
const launch = {
|
|
278
|
+
child,
|
|
279
|
+
calls: new Map(),
|
|
280
|
+
startedAt,
|
|
281
|
+
unwatch: watchLiveness(child, LIVENESS, { stable: () => undefined, failed: (reason) => this.lose(launch, reason) }),
|
|
282
|
+
stood: false,
|
|
283
|
+
lost: false,
|
|
284
|
+
};
|
|
285
|
+
this.launch = launch;
|
|
286
|
+
child.on("message", (message) => this.receive(launch, message));
|
|
287
|
+
child.once("exit", (code, signal) => this.lose(launch, `it exited (${signal ?? code})`));
|
|
288
|
+
child.once("error", (error) => this.lose(launch, error.message));
|
|
289
|
+
try {
|
|
290
|
+
await this.send(launch, "init", this.init);
|
|
291
|
+
await this.send(launch, "products", this.app);
|
|
292
|
+
if (this.wire)
|
|
293
|
+
await this.send(launch, "wire.open", this.wire);
|
|
294
|
+
if (this.started)
|
|
295
|
+
await this.send(launch, "wire.start", this.started.port, this.started.token);
|
|
296
|
+
for (const [id, ground] of this.grounds) {
|
|
297
|
+
if (!ground.identity)
|
|
298
|
+
continue;
|
|
299
|
+
this.hand(id, ground.counts());
|
|
300
|
+
await this.send(launch, "ground.create", id, ground.input);
|
|
301
|
+
await this.send(launch, "ground.converge", id, ground.identity);
|
|
302
|
+
}
|
|
303
|
+
const drive = this.drive;
|
|
304
|
+
// A drive over a ground that closed (a pause) stays down until a ground
|
|
305
|
+
// converges again and serves it.
|
|
306
|
+
if (drive && this.grounds.get(drive.ground)?.identity) {
|
|
307
|
+
this.counts.set(countHandle("drive", drive.id, "placing"), drive.placing());
|
|
308
|
+
await this.send(launch, "drive.serve", drive.id, drive.ground, drive.email);
|
|
309
|
+
}
|
|
310
|
+
this.supervision.probe(true, Date.now());
|
|
311
|
+
launch.stood = true;
|
|
312
|
+
this.failure = null;
|
|
313
|
+
return launch;
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
if (!launch.lost) {
|
|
317
|
+
this.failure = error instanceof Error ? error.message : String(error);
|
|
318
|
+
this.options.observers.backgroundError?.(error);
|
|
319
|
+
child.kill("SIGKILL");
|
|
320
|
+
}
|
|
321
|
+
throw error;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
lose(launch, reason) {
|
|
325
|
+
if (launch.lost)
|
|
326
|
+
return;
|
|
327
|
+
launch.lost = true;
|
|
328
|
+
launch.unwatch();
|
|
329
|
+
if (launch.child.exitCode === null && launch.child.signalCode === null)
|
|
330
|
+
launch.child.kill("SIGKILL");
|
|
331
|
+
const error = stoppedError(`the Files program stopped: ${reason}`);
|
|
332
|
+
for (const call of launch.calls.values())
|
|
333
|
+
call.reject(error);
|
|
334
|
+
launch.calls.clear();
|
|
335
|
+
if (this.stopped || launch !== this.launch)
|
|
336
|
+
return;
|
|
337
|
+
this.startAgain(error, launch.stood ? Date.now() : launch.startedAt);
|
|
338
|
+
}
|
|
339
|
+
/** The program is gone: what it said goes to nobody, and another follows.
|
|
340
|
+
* `ended` is when its run ended as Core should count it. */
|
|
341
|
+
startAgain(error, ended) {
|
|
342
|
+
// A ground the program never converged is not established; its creator
|
|
343
|
+
// learns that from the call that fails.
|
|
344
|
+
for (const [id, ground] of this.grounds) {
|
|
345
|
+
if (ground.identity)
|
|
346
|
+
ground.counts();
|
|
347
|
+
else
|
|
348
|
+
this.forget(id);
|
|
349
|
+
}
|
|
350
|
+
this.drive?.placing();
|
|
351
|
+
this.counts.clear();
|
|
352
|
+
this.failure ??= error.message;
|
|
353
|
+
this.options.observers.backgroundError?.(error);
|
|
354
|
+
const decision = this.supervision.exited(ended);
|
|
355
|
+
if (decision.action === "degrade") {
|
|
356
|
+
this.stopped = Object.assign(new Error(`the Files program stopped too often and is parked: ${decision.log}`), {
|
|
357
|
+
code: "files_degraded",
|
|
358
|
+
});
|
|
359
|
+
this.ready = null;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
this.ready = new Promise((resolve, reject) => {
|
|
363
|
+
const timer = setTimeout(() => {
|
|
364
|
+
this.retry = null;
|
|
365
|
+
this.start().then(resolve, reject);
|
|
366
|
+
}, decision.delayMs);
|
|
367
|
+
this.retry = {
|
|
368
|
+
cancel: () => {
|
|
369
|
+
clearTimeout(timer);
|
|
370
|
+
this.retry = null;
|
|
371
|
+
reject(this.stopped ?? error);
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
this.ready.catch(() => undefined);
|
|
376
|
+
}
|
|
377
|
+
receive(launch, message) {
|
|
378
|
+
if (launch.lost || launch !== this.launch)
|
|
379
|
+
return;
|
|
380
|
+
switch (message.kind) {
|
|
381
|
+
case "result":
|
|
382
|
+
case "failure": {
|
|
383
|
+
const call = launch.calls.get(message.id);
|
|
384
|
+
if (!call)
|
|
385
|
+
return;
|
|
386
|
+
launch.calls.delete(message.id);
|
|
387
|
+
if (message.kind === "result")
|
|
388
|
+
call.resolve(message.value);
|
|
389
|
+
else
|
|
390
|
+
call.reject(reviveError(message.error));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
case "ask":
|
|
394
|
+
void this.answer(launch, message.id, message.method === "installStage"
|
|
395
|
+
? async () => this.options.installStage?.(message.args[0])
|
|
396
|
+
: () => this.options.app(message.args[0], message.args[1]));
|
|
397
|
+
return;
|
|
398
|
+
case "event": {
|
|
399
|
+
const observer = this.options.observers[message.name];
|
|
400
|
+
observer?.(message.name === "wireError" || message.name === "backgroundError"
|
|
401
|
+
? reviveError(message.value)
|
|
402
|
+
: message.value);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
case "count":
|
|
406
|
+
this.counts.get(message.handle)?.(message.value);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
async answer(launch, id, question) {
|
|
410
|
+
let reply;
|
|
411
|
+
try {
|
|
412
|
+
reply = { kind: "answer", id, value: await question() };
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
reply = { kind: "refusal", id, error: errorFacts(error) };
|
|
416
|
+
}
|
|
417
|
+
if (launch.lost)
|
|
418
|
+
return;
|
|
419
|
+
try {
|
|
420
|
+
launch.child.send(reply, () => undefined);
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
launch.child.send({ kind: "refusal", id, error: errorFacts(error) }, () => undefined);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function stoppedError(message) {
|
|
428
|
+
return Object.assign(new Error(message), { code: FILES_PROGRAM_STOPPED });
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/files-program/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,IAAI,EAAqB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,uBAAuB,EAAqB,MAAM,0BAA0B,CAAC;AAOtF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD,OAAO,EACL,WAAW,EACX,qBAAqB,GActB,MAAM,eAAe,CAAC;AAEvB,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CA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AC,SAAS,CAAC,CAAC;QAAC,CAAC;IAC1G,CAAC;CACF;AAED,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FilesAddResult } from "@amalgm/live/files";
|
|
2
|
+
import { type FilesStageObserver } from "../files-observability.js";
|
|
3
|
+
import type { UserGroundHost } from "../user-ground-host.js";
|
|
4
|
+
import type { WatchCoverageEvidence } from "../watching/index.js";
|
|
5
|
+
/** The two Files journeys a person types, run where the ground lives: in the
|
|
6
|
+
* Files program (program.ts). Each holds the ground's one operation
|
|
7
|
+
* lane from its first step to its last. */
|
|
8
|
+
export type AddedWorkspace = FilesAddResult & {
|
|
9
|
+
readonly watch: WatchCoverageEvidence;
|
|
10
|
+
};
|
|
11
|
+
/** Materialize through Live and prove the same runtime owns ongoing Watch. */
|
|
12
|
+
export declare function addWorkspace(ground: UserGroundHost, observe: FilesStageObserver, workspaceId: string, destinationParent: string): Promise<AddedWorkspace>;
|
|
13
|
+
/** Route the complete user-visible register journey through Live's
|
|
14
|
+
* declaration and this already-running Files owner. */
|
|
15
|
+
export declare function registerWorkspace(ground: UserGroundHost, observe: FilesStageObserver, requestedPath: string): Promise<Record<string, unknown>>;
|