@powerhousedao/host-core 6.4.0-next.0 → 6.4.0-next.2

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.
@@ -0,0 +1,123 @@
1
+ import { z } from "zod";
2
+ //#region src/run-record-schema.d.ts
3
+ declare const runRecordMemberSchema: z.ZodObject<{
4
+ host: z.ZodString;
5
+ runnerModule: z.ZodString;
6
+ kind: z.ZodEnum<{
7
+ compound: "compound";
8
+ reactor: "reactor";
9
+ }>;
10
+ verb: z.ZodString;
11
+ outputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
12
+ }, z.core.$strict>;
13
+ declare const runRecordSchema: z.ZodObject<{
14
+ version: z.ZodLiteral<2>;
15
+ host: z.ZodString;
16
+ package: z.ZodOptional<z.ZodString>;
17
+ projectName: z.ZodString;
18
+ kind: z.ZodEnum<{
19
+ compound: "compound";
20
+ reactor: "reactor";
21
+ }>;
22
+ verb: z.ZodString;
23
+ pid: z.ZodNumber;
24
+ startedAt: z.ZodString;
25
+ outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ members: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
27
+ host: z.ZodString;
28
+ runnerModule: z.ZodString;
29
+ kind: z.ZodEnum<{
30
+ compound: "compound";
31
+ reactor: "reactor";
32
+ }>;
33
+ verb: z.ZodString;
34
+ outputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
+ }, z.core.$strict>>>;
36
+ extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
37
+ }, z.core.$strict>;
38
+ type RunRecord = z.infer<typeof runRecordSchema>;
39
+ type RunRecordMember = z.infer<typeof runRecordMemberSchema>;
40
+ //#endregion
41
+ //#region src/control-channel.d.ts
42
+ /**
43
+ * The control channel of a process that keeps running (a serving Cli, a
44
+ * compound with one): a local stream other processes of the same OS user
45
+ * send requests to, so a command typed in a second terminal acts on what
46
+ * runs in the first. A named pipe on Windows, a socket file elsewhere. Its
47
+ * address and token are in the process's run record (`extra.control`).
48
+ *
49
+ * Same user only. Elsewhere the socket is mode 0600 in a 0700 folder of the
50
+ * user. On Windows the pipe's default access lets only its creator,
51
+ * administrators and the system write to it; everyone may open it to read,
52
+ * so the server sends nothing before a request that carries the token.
53
+ *
54
+ * One request and one answer per line, as JSON:
55
+ * `{ protocol, id, token, method, params }` and
56
+ * `{ id, ok: true, result }` or `{ id, ok: false, error: { code, message } }`.
57
+ */
58
+ declare const CONTROL_PROTOCOL = 1;
59
+ /** A run record's `extra.control`. */
60
+ declare const controlRecordSchema: z.ZodObject<{
61
+ protocol: z.ZodNumber;
62
+ address: z.ZodString;
63
+ token: z.ZodString;
64
+ }, z.core.$strip>;
65
+ type ControlRecord = z.infer<typeof controlRecordSchema>;
66
+ type ControlErrorCode = "unauthorized" | "protocol" | "bad-request" | "unknown-method" | "failed" | "unreachable";
67
+ declare class ControlError extends Error {
68
+ readonly code: ControlErrorCode;
69
+ constructor(code: ControlErrorCode, message: string);
70
+ }
71
+ type ControlHandler = (params: unknown) => unknown;
72
+ interface ControlChannel {
73
+ /** What the run record holds. */
74
+ readonly record: ControlRecord;
75
+ /** Answers `method` from now on (replacing an earlier handler). */
76
+ handle(method: string, handler: ControlHandler): void;
77
+ /** Added to the answer to `hello`. */
78
+ describe(info: Record<string, unknown>): void;
79
+ close(): Promise<void>;
80
+ }
81
+ interface OpenControlChannelOptions {
82
+ /** The folder of the socket file (not on Windows). Default: a folder of
83
+ * the user under the system's temporary folder. */
84
+ socketDir?: string;
85
+ }
86
+ /** The control channel a live run of this record answers on, when it has
87
+ * one of a protocol this version speaks. */
88
+ declare function controlRecordOf(record: Pick<RunRecord, "extra"> | undefined): ControlRecord | undefined;
89
+ /**
90
+ * Opens a control channel for this process and resolves once it listens.
91
+ * The server holds no process open. `hello` is answered by the channel
92
+ * itself: `{ protocol, pid, mode: "ad hoc", methods }` and what `describe`
93
+ * added.
94
+ */
95
+ declare function openControlChannel(options?: OpenControlChannelOptions): Promise<ControlChannel>;
96
+ /**
97
+ * This process's control channel, opened on the first call. Undefined when
98
+ * it cannot be opened: the process then runs without one, as before.
99
+ */
100
+ declare function ensureProcessControlChannel(options?: OpenControlChannelOptions): Promise<ControlChannel | undefined>;
101
+ /** This process's control channel, when it has opened one. */
102
+ declare function processControlChannel(): ControlChannel | undefined;
103
+ /** Closes this process's control channel, if it has one. */
104
+ declare function closeProcessControlChannel(): Promise<void>;
105
+ interface CallControlOptions {
106
+ /** How long the answer may take (default: no limit; the request ends when
107
+ * the other process does). */
108
+ timeoutMs?: number;
109
+ /** How long connecting may take (default 2 s). */
110
+ connectTimeoutMs?: number;
111
+ /** Do not hold this process open for the answer. */
112
+ unref?: boolean;
113
+ }
114
+ /**
115
+ * One request to the control channel a run record names. Resolves with the
116
+ * result; rejects with a {@link ControlError}: `unreachable` when nothing
117
+ * answers there, else the code the other process refused with.
118
+ */
119
+ declare function callControl(control: ControlRecord, method: string, params?: unknown, options?: CallControlOptions): Promise<unknown>;
120
+ //#endregion
121
+ export { RunRecordMember as _, ControlErrorCode as a, OpenControlChannelOptions as c, controlRecordOf as d, controlRecordSchema as f, RunRecord as g, processControlChannel as h, ControlError as i, callControl as l, openControlChannel as m, CallControlOptions as n, ControlHandler as o, ensureProcessControlChannel as p, ControlChannel as r, ControlRecord as s, CONTROL_PROTOCOL as t, closeProcessControlChannel as u, runRecordMemberSchema as v, runRecordSchema as y };
122
+ export {};
123
+ //# sourceMappingURL=control-channel-eqvyUF03.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-channel-eqvyUF03.d.mts","names":[],"sources":["../src/run-record-schema.ts","../src/control-channel.ts"],"mappings":";;cAmBa,uBAAqB,EAAA;;;;;;;;;GAQhC,EAAA,KAAA;cAEW,iBAAe,EAAA;;;;;;;;;;;;;;;;;;;;;;;;GAiB1B,EAAA,KAAA;KAEU,YAAY,EAAE,aAAa;KAC3B,kBAAkB,EAAE,aAAa;;;;;;;;;;;;;;;;;;;cCxBhC;;cAGA,qBAAmB,EAAA;;;;GAI9B,EAAA,KAAA;KACU,gBAAgB,EAAE,aAAa;KAE/B;cAQC,qBAAqB;WAErB,MAAM;EADjB,YACW,MAAM,kBACf;;KAOQ,kBAAkB;UAEb;;WAEN,QAAQ;;EAEjB,OAAO,gBAAgB,SAAS;;EAEhC,SAAS,MAAM;EACf,SAAS;;UAGM;;;EAGf;;;;iBAOc,gBACd,QAAQ,KAAK,kCACZ;;;;;;;iBA0DmB,mBACpB,UAAS,4BACR,QAAQ;;;;;iBAiKW,4BACpB,UAAS,4BACR,QAAQ;;iBAeK,yBAAyB;;iBAKnB,8BAA8B;UAOnC;;;EAGf;;EAEA;;EAEA;;;;;;;iBAUc,YACd,SAAS,eACT,gBACA,kBACA,UAAS,qBACR"}
@@ -0,0 +1,3 @@
1
+ import { a as ControlErrorCode, c as OpenControlChannelOptions, d as controlRecordOf, f as controlRecordSchema, h as processControlChannel, i as ControlError, l as callControl, m as openControlChannel, n as CallControlOptions, o as ControlHandler, p as ensureProcessControlChannel, r as ControlChannel, s as ControlRecord, t as CONTROL_PROTOCOL, u as closeProcessControlChannel } from "./control-channel-eqvyUF03.mjs";
2
+ export { CONTROL_PROTOCOL, CallControlOptions, ControlChannel, ControlError, ControlErrorCode, ControlHandler, ControlRecord, OpenControlChannelOptions, callControl, closeProcessControlChannel, controlRecordOf, controlRecordSchema, ensureProcessControlChannel, openControlChannel, processControlChannel };
3
+ export {};
@@ -0,0 +1,317 @@
1
+ import crypto from "node:crypto";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { z } from "zod";
5
+ import net from "node:net";
6
+ import os from "node:os";
7
+ //#region src/control-channel.ts
8
+ /**
9
+ * The control channel of a process that keeps running (a serving Cli, a
10
+ * compound with one): a local stream other processes of the same OS user
11
+ * send requests to, so a command typed in a second terminal acts on what
12
+ * runs in the first. A named pipe on Windows, a socket file elsewhere. Its
13
+ * address and token are in the process's run record (`extra.control`).
14
+ *
15
+ * Same user only. Elsewhere the socket is mode 0600 in a 0700 folder of the
16
+ * user. On Windows the pipe's default access lets only its creator,
17
+ * administrators and the system write to it; everyone may open it to read,
18
+ * so the server sends nothing before a request that carries the token.
19
+ *
20
+ * One request and one answer per line, as JSON:
21
+ * `{ protocol, id, token, method, params }` and
22
+ * `{ id, ok: true, result }` or `{ id, ok: false, error: { code, message } }`.
23
+ */
24
+ const CONTROL_PROTOCOL = 1;
25
+ /** A run record's `extra.control`. */
26
+ const controlRecordSchema = z.object({
27
+ protocol: z.number().int(),
28
+ address: z.string().min(1),
29
+ token: z.string().min(1)
30
+ });
31
+ var ControlError = class extends Error {
32
+ code;
33
+ constructor(code, message) {
34
+ super(message);
35
+ this.code = code;
36
+ this.name = "ControlError";
37
+ }
38
+ };
39
+ const MAX_LINE_BYTES = 1048576;
40
+ /** The control channel a live run of this record answers on, when it has
41
+ * one of a protocol this version speaks. */
42
+ function controlRecordOf(record) {
43
+ const parsed = controlRecordSchema.safeParse(record?.extra?.control);
44
+ if (!parsed.success || parsed.data.protocol !== 1) return;
45
+ return parsed.data;
46
+ }
47
+ function sameToken(given, token) {
48
+ if (typeof given !== "string") return false;
49
+ const a = Buffer.from(given);
50
+ const b = Buffer.from(token);
51
+ return a.length === b.length && crypto.timingSafeEqual(a, b);
52
+ }
53
+ /** The user's folder for socket files: theirs alone, or none. */
54
+ function userSocketDir(given) {
55
+ const uid = process.getuid?.() ?? 0;
56
+ const dir = given ?? path.join(os.tmpdir(), `ph-control-${uid}`);
57
+ fs.mkdirSync(dir, {
58
+ recursive: true,
59
+ mode: 448
60
+ });
61
+ const stat = fs.lstatSync(dir);
62
+ if (!stat.isDirectory() || stat.uid !== uid) throw new Error(`${dir} is not a folder of this user.`);
63
+ if ((stat.mode & 63) !== 0) fs.chmodSync(dir, 448);
64
+ return dir;
65
+ }
66
+ /** Socket files whose process is gone (it was killed). */
67
+ function sweepSockets(dir) {
68
+ for (const name of fs.readdirSync(dir)) {
69
+ const pid = Number(/^(\d+)-[\da-f]+\.sock$/.exec(name)?.[1]);
70
+ if (!Number.isInteger(pid) || pid === process.pid) continue;
71
+ try {
72
+ process.kill(pid, 0);
73
+ } catch (error) {
74
+ if (error.code !== "ESRCH") continue;
75
+ fs.rmSync(path.join(dir, name), { force: true });
76
+ }
77
+ }
78
+ }
79
+ function listen(server, address) {
80
+ return new Promise((resolve, reject) => {
81
+ server.once("error", reject);
82
+ server.listen(address, () => {
83
+ server.off("error", reject);
84
+ resolve();
85
+ });
86
+ });
87
+ }
88
+ /**
89
+ * Opens a control channel for this process and resolves once it listens.
90
+ * The server holds no process open. `hello` is answered by the channel
91
+ * itself: `{ protocol, pid, mode: "ad hoc", methods }` and what `describe`
92
+ * added.
93
+ */
94
+ async function openControlChannel(options = {}) {
95
+ const token = crypto.randomBytes(32).toString("base64url");
96
+ const name = `${process.pid}-${crypto.randomBytes(8).toString("hex")}`;
97
+ const handlers = /* @__PURE__ */ new Map();
98
+ let description = {};
99
+ handlers.set("hello", () => ({
100
+ ...description,
101
+ protocol: 1,
102
+ pid: process.pid,
103
+ mode: "ad hoc",
104
+ methods: [...handlers.keys()]
105
+ }));
106
+ const answer = async (line) => {
107
+ let request;
108
+ try {
109
+ const parsed = JSON.parse(line);
110
+ if (typeof parsed !== "object" || parsed === null) throw new Error();
111
+ request = parsed;
112
+ } catch {
113
+ return refusal(void 0, "bad-request", "The request is not JSON.");
114
+ }
115
+ const { id } = request;
116
+ if (!sameToken(request.token, token)) return refusal(id, "unauthorized", "The token is missing or wrong.");
117
+ if (request.protocol !== 1) return refusal(id, "protocol", `This process speaks control protocol 1, not ${JSON.stringify(request.protocol)}.`);
118
+ const handler = typeof request.method === "string" ? handlers.get(request.method) : void 0;
119
+ if (!handler) return refusal(id, "unknown-method", `Nothing here answers "${String(request.method)}".`);
120
+ try {
121
+ return {
122
+ id,
123
+ ok: true,
124
+ result: await handler(request.params) ?? null
125
+ };
126
+ } catch (error) {
127
+ return refusal(id, "failed", error instanceof Error ? error.message : String(error));
128
+ }
129
+ };
130
+ const sockets = /* @__PURE__ */ new Set();
131
+ const server = net.createServer((socket) => {
132
+ sockets.add(socket);
133
+ socket.once("close", () => sockets.delete(socket));
134
+ socket.on("error", () => void 0);
135
+ socket.setEncoding("utf8");
136
+ let pending = "";
137
+ let queue = Promise.resolve();
138
+ socket.on("data", (chunk) => {
139
+ pending += chunk;
140
+ if (pending.length > MAX_LINE_BYTES) {
141
+ socket.destroy();
142
+ return;
143
+ }
144
+ for (;;) {
145
+ const end = pending.indexOf("\n");
146
+ if (end === -1) break;
147
+ const line = pending.slice(0, end);
148
+ pending = pending.slice(end + 1);
149
+ if (line.trim() === "") continue;
150
+ queue = queue.then(async () => {
151
+ const response = await answer(line);
152
+ if (socket.destroyed) return;
153
+ const refused = response.ok === false && response.error.code === "unauthorized";
154
+ const text = `${JSON.stringify(response)}\n`;
155
+ if (refused) socket.end(text);
156
+ else socket.write(text);
157
+ });
158
+ }
159
+ });
160
+ });
161
+ server.on("error", () => void 0);
162
+ let address;
163
+ let socketFile;
164
+ if (process.platform === "win32") {
165
+ address = `\\\\.\\pipe\\ph-control-${name}`;
166
+ await listen(server, address);
167
+ } else {
168
+ const dir = userSocketDir(options.socketDir);
169
+ sweepSockets(dir);
170
+ address = socketFile = path.join(dir, `${name}.sock`);
171
+ let umask;
172
+ try {
173
+ umask = process.umask(127);
174
+ } catch {}
175
+ try {
176
+ await listen(server, address);
177
+ } finally {
178
+ if (umask !== void 0) process.umask(umask);
179
+ }
180
+ fs.chmodSync(address, 384);
181
+ }
182
+ server.unref();
183
+ const removeSocket = () => {
184
+ if (socketFile) fs.rmSync(socketFile, { force: true });
185
+ };
186
+ process.once("exit", removeSocket);
187
+ let closing;
188
+ return {
189
+ record: {
190
+ protocol: 1,
191
+ address,
192
+ token
193
+ },
194
+ handle(method, handler) {
195
+ handlers.set(method, handler);
196
+ },
197
+ describe(info) {
198
+ description = {
199
+ ...description,
200
+ ...info
201
+ };
202
+ },
203
+ close: () => closing ??= new Promise((resolve) => {
204
+ process.off("exit", removeSocket);
205
+ for (const socket of sockets) socket.destroy();
206
+ server.close(() => {
207
+ removeSocket();
208
+ resolve();
209
+ });
210
+ })
211
+ };
212
+ }
213
+ function refusal(id, code, message) {
214
+ return {
215
+ id,
216
+ ok: false,
217
+ error: {
218
+ code,
219
+ message
220
+ }
221
+ };
222
+ }
223
+ const SLOT = Symbol.for("@powerhousedao/host-core/control-channel");
224
+ const slot = () => globalThis[SLOT] ??= {};
225
+ /**
226
+ * This process's control channel, opened on the first call. Undefined when
227
+ * it cannot be opened: the process then runs without one, as before.
228
+ */
229
+ async function ensureProcessControlChannel(options = {}) {
230
+ const held = slot();
231
+ if (held.channel) return held.channel;
232
+ held.opening ??= openControlChannel(options);
233
+ try {
234
+ held.channel = await held.opening;
235
+ return held.channel;
236
+ } catch {
237
+ return;
238
+ } finally {
239
+ held.opening = void 0;
240
+ }
241
+ }
242
+ /** This process's control channel, when it has opened one. */
243
+ function processControlChannel() {
244
+ return slot().channel;
245
+ }
246
+ /** Closes this process's control channel, if it has one. */
247
+ async function closeProcessControlChannel() {
248
+ const held = slot();
249
+ const channel = held.channel;
250
+ held.channel = void 0;
251
+ await channel?.close();
252
+ }
253
+ const CONNECT_TIMEOUT_MS = 2e3;
254
+ /**
255
+ * One request to the control channel a run record names. Resolves with the
256
+ * result; rejects with a {@link ControlError}: `unreachable` when nothing
257
+ * answers there, else the code the other process refused with.
258
+ */
259
+ function callControl(control, method, params, options = {}) {
260
+ return new Promise((resolve, reject) => {
261
+ const socket = net.connect(control.address);
262
+ if (options.unref) socket.unref();
263
+ let settled = false;
264
+ let pending = "";
265
+ const timers = [];
266
+ const settle = (finish) => {
267
+ if (settled) return;
268
+ settled = true;
269
+ for (const timer of timers) clearTimeout(timer);
270
+ socket.destroy();
271
+ finish();
272
+ };
273
+ const unreachable = (why) => settle(() => reject(new ControlError("unreachable", why)));
274
+ const limit = (ms, why) => {
275
+ const timer = setTimeout(() => unreachable(why), ms);
276
+ if (options.unref) timer.unref();
277
+ timers.push(timer);
278
+ return timer;
279
+ };
280
+ const connecting = limit(options.connectTimeoutMs ?? CONNECT_TIMEOUT_MS, `No answer at the control channel ${control.address}.`);
281
+ socket.setEncoding("utf8");
282
+ socket.once("connect", () => {
283
+ clearTimeout(connecting);
284
+ if (options.timeoutMs !== void 0) limit(options.timeoutMs, `"${method}" was not answered within ${options.timeoutMs} ms.`);
285
+ socket.write(`${JSON.stringify({
286
+ protocol: 1,
287
+ id: 1,
288
+ token: control.token,
289
+ method,
290
+ ...params === void 0 ? {} : { params }
291
+ })}\n`);
292
+ });
293
+ socket.on("data", (chunk) => {
294
+ pending += chunk;
295
+ const end = pending.indexOf("\n");
296
+ if (end === -1) return;
297
+ let response;
298
+ try {
299
+ response = JSON.parse(pending.slice(0, end));
300
+ } catch {
301
+ unreachable(`The control channel ${control.address} answered no JSON.`);
302
+ return;
303
+ }
304
+ if (response.ok === true) {
305
+ settle(() => resolve(response.result));
306
+ return;
307
+ }
308
+ settle(() => reject(new ControlError(response.error?.code ?? "failed", response.error?.message ?? `"${method}" failed.`)));
309
+ });
310
+ socket.once("error", (error) => unreachable(`Cannot reach the control channel ${control.address}: ${error.message}`));
311
+ socket.once("close", () => unreachable(`The process behind the control channel ${control.address} went away before it answered "${method}".`));
312
+ });
313
+ }
314
+ //#endregion
315
+ export { CONTROL_PROTOCOL, ControlError, callControl, closeProcessControlChannel, controlRecordOf, controlRecordSchema, ensureProcessControlChannel, openControlChannel, processControlChannel };
316
+
317
+ //# sourceMappingURL=control-channel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-channel.mjs","names":[],"sources":["../src/control-channel.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport net from \"node:net\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport type { RunRecord } from \"./run-record-schema.js\";\n\n/**\n * The control channel of a process that keeps running (a serving Cli, a\n * compound with one): a local stream other processes of the same OS user\n * send requests to, so a command typed in a second terminal acts on what\n * runs in the first. A named pipe on Windows, a socket file elsewhere. Its\n * address and token are in the process's run record (`extra.control`).\n *\n * Same user only. Elsewhere the socket is mode 0600 in a 0700 folder of the\n * user. On Windows the pipe's default access lets only its creator,\n * administrators and the system write to it; everyone may open it to read,\n * so the server sends nothing before a request that carries the token.\n *\n * One request and one answer per line, as JSON:\n * `{ protocol, id, token, method, params }` and\n * `{ id, ok: true, result }` or `{ id, ok: false, error: { code, message } }`.\n */\n\nexport const CONTROL_PROTOCOL = 1;\n\n/** A run record's `extra.control`. */\nexport const controlRecordSchema = z.object({\n protocol: z.number().int(),\n address: z.string().min(1),\n token: z.string().min(1),\n});\nexport type ControlRecord = z.infer<typeof controlRecordSchema>;\n\nexport type ControlErrorCode =\n | \"unauthorized\"\n | \"protocol\"\n | \"bad-request\"\n | \"unknown-method\"\n | \"failed\"\n | \"unreachable\";\n\nexport class ControlError extends Error {\n constructor(\n readonly code: ControlErrorCode,\n message: string,\n ) {\n super(message);\n this.name = \"ControlError\";\n }\n}\n\nexport type ControlHandler = (params: unknown) => unknown;\n\nexport interface ControlChannel {\n /** What the run record holds. */\n readonly record: ControlRecord;\n /** Answers `method` from now on (replacing an earlier handler). */\n handle(method: string, handler: ControlHandler): void;\n /** Added to the answer to `hello`. */\n describe(info: Record<string, unknown>): void;\n close(): Promise<void>;\n}\n\nexport interface OpenControlChannelOptions {\n /** The folder of the socket file (not on Windows). Default: a folder of\n * the user under the system's temporary folder. */\n socketDir?: string;\n}\n\nconst MAX_LINE_BYTES = 1024 * 1024;\n\n/** The control channel a live run of this record answers on, when it has\n * one of a protocol this version speaks. */\nexport function controlRecordOf(\n record: Pick<RunRecord, \"extra\"> | undefined,\n): ControlRecord | undefined {\n const parsed = controlRecordSchema.safeParse(record?.extra?.control);\n if (!parsed.success || parsed.data.protocol !== CONTROL_PROTOCOL) {\n return undefined;\n }\n return parsed.data;\n}\n\nfunction sameToken(given: unknown, token: string): boolean {\n if (typeof given !== \"string\") return false;\n const a = Buffer.from(given);\n const b = Buffer.from(token);\n return a.length === b.length && crypto.timingSafeEqual(a, b);\n}\n\n/** The user's folder for socket files: theirs alone, or none. */\nfunction userSocketDir(given?: string): string {\n const uid = process.getuid?.() ?? 0;\n const dir = given ?? path.join(os.tmpdir(), `ph-control-${uid}`);\n fs.mkdirSync(dir, { recursive: true, mode: 0o700 });\n const stat = fs.lstatSync(dir);\n if (!stat.isDirectory() || stat.uid !== uid) {\n throw new Error(`${dir} is not a folder of this user.`);\n }\n if ((stat.mode & 0o077) !== 0) fs.chmodSync(dir, 0o700);\n return dir;\n}\n\n/** Socket files whose process is gone (it was killed). */\nfunction sweepSockets(dir: string): void {\n for (const name of fs.readdirSync(dir)) {\n const pid = Number(/^(\\d+)-[\\da-f]+\\.sock$/.exec(name)?.[1]);\n if (!Number.isInteger(pid) || pid === process.pid) continue;\n try {\n process.kill(pid, 0);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ESRCH\") continue;\n fs.rmSync(path.join(dir, name), { force: true });\n }\n }\n}\n\nfunction listen(server: net.Server, address: string): Promise<void> {\n return new Promise((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(address, () => {\n server.off(\"error\", reject);\n resolve();\n });\n });\n}\n\n/**\n * Opens a control channel for this process and resolves once it listens.\n * The server holds no process open. `hello` is answered by the channel\n * itself: `{ protocol, pid, mode: \"ad hoc\", methods }` and what `describe`\n * added.\n */\nexport async function openControlChannel(\n options: OpenControlChannelOptions = {},\n): Promise<ControlChannel> {\n const token = crypto.randomBytes(32).toString(\"base64url\");\n const name = `${process.pid}-${crypto.randomBytes(8).toString(\"hex\")}`;\n const handlers = new Map<string, ControlHandler>();\n let description: Record<string, unknown> = {};\n handlers.set(\"hello\", () => ({\n ...description,\n protocol: CONTROL_PROTOCOL,\n pid: process.pid,\n mode: \"ad hoc\",\n methods: [...handlers.keys()],\n }));\n\n const answer = async (line: string): Promise<Record<string, unknown>> => {\n let request: Record<string, unknown>;\n try {\n const parsed: unknown = JSON.parse(line);\n if (typeof parsed !== \"object\" || parsed === null) throw new Error();\n request = parsed as Record<string, unknown>;\n } catch {\n return refusal(undefined, \"bad-request\", \"The request is not JSON.\");\n }\n const { id } = request;\n // Before anything else: nothing is said to a caller without the token.\n if (!sameToken(request.token, token)) {\n return refusal(id, \"unauthorized\", \"The token is missing or wrong.\");\n }\n if (request.protocol !== CONTROL_PROTOCOL) {\n return refusal(\n id,\n \"protocol\",\n `This process speaks control protocol ${CONTROL_PROTOCOL}, not ${JSON.stringify(request.protocol)}.`,\n );\n }\n const handler =\n typeof request.method === \"string\"\n ? handlers.get(request.method)\n : undefined;\n if (!handler) {\n return refusal(\n id,\n \"unknown-method\",\n `Nothing here answers \"${String(request.method)}\".`,\n );\n }\n try {\n return { id, ok: true, result: (await handler(request.params)) ?? null };\n } catch (error) {\n return refusal(\n id,\n \"failed\",\n error instanceof Error ? error.message : String(error),\n );\n }\n };\n\n const sockets = new Set<net.Socket>();\n const server = net.createServer((socket) => {\n sockets.add(socket);\n socket.once(\"close\", () => sockets.delete(socket));\n socket.on(\"error\", () => undefined);\n socket.setEncoding(\"utf8\");\n let pending = \"\";\n let queue = Promise.resolve();\n socket.on(\"data\", (chunk: string) => {\n pending += chunk;\n if (pending.length > MAX_LINE_BYTES) {\n socket.destroy();\n return;\n }\n for (;;) {\n const end = pending.indexOf(\"\\n\");\n if (end === -1) break;\n const line = pending.slice(0, end);\n pending = pending.slice(end + 1);\n if (line.trim() === \"\") continue;\n queue = queue.then(async () => {\n const response = await answer(line);\n if (socket.destroyed) return;\n const refused =\n response.ok === false &&\n (response.error as { code: string }).code === \"unauthorized\";\n const text = `${JSON.stringify(response)}\\n`;\n if (refused) socket.end(text);\n else socket.write(text);\n });\n }\n });\n });\n server.on(\"error\", () => undefined);\n\n let address: string;\n let socketFile: string | undefined;\n if (process.platform === \"win32\") {\n address = `\\\\\\\\.\\\\pipe\\\\ph-control-${name}`;\n await listen(server, address);\n } else {\n const dir = userSocketDir(options.socketDir);\n sweepSockets(dir);\n address = socketFile = path.join(dir, `${name}.sock`);\n // The file is the user's from the moment it exists.\n let umask: number | undefined;\n try {\n umask = process.umask(0o177);\n } catch {\n // a worker thread has no umask of its own; the folder is the user's\n }\n try {\n await listen(server, address);\n } finally {\n if (umask !== undefined) process.umask(umask);\n }\n fs.chmodSync(address, 0o600);\n }\n server.unref();\n\n const removeSocket = () => {\n if (socketFile) fs.rmSync(socketFile, { force: true });\n };\n process.once(\"exit\", removeSocket);\n\n let closing: Promise<void> | undefined;\n return {\n record: { protocol: CONTROL_PROTOCOL, address, token },\n handle(method, handler) {\n handlers.set(method, handler);\n },\n describe(info) {\n description = { ...description, ...info };\n },\n close: () =>\n (closing ??= new Promise<void>((resolve) => {\n process.off(\"exit\", removeSocket);\n for (const socket of sockets) socket.destroy();\n server.close(() => {\n removeSocket();\n resolve();\n });\n })),\n };\n}\n\nfunction refusal(\n id: unknown,\n code: ControlErrorCode,\n message: string,\n): Record<string, unknown> {\n return { id, ok: false, error: { code, message } };\n}\n\n// One channel per process, whichever copy of this module asks: a compound\n// and the Cli in front of it may each have loaded their own.\nconst SLOT = Symbol.for(\"@powerhousedao/host-core/control-channel\");\ntype Slot = { channel?: ControlChannel; opening?: Promise<ControlChannel> };\nconst slot = () =>\n ((globalThis as { [SLOT]?: Slot })[SLOT] ??= {}) satisfies Slot;\n\n/**\n * This process's control channel, opened on the first call. Undefined when\n * it cannot be opened: the process then runs without one, as before.\n */\nexport async function ensureProcessControlChannel(\n options: OpenControlChannelOptions = {},\n): Promise<ControlChannel | undefined> {\n const held = slot();\n if (held.channel) return held.channel;\n held.opening ??= openControlChannel(options);\n try {\n held.channel = await held.opening;\n return held.channel;\n } catch {\n return undefined;\n } finally {\n held.opening = undefined;\n }\n}\n\n/** This process's control channel, when it has opened one. */\nexport function processControlChannel(): ControlChannel | undefined {\n return slot().channel;\n}\n\n/** Closes this process's control channel, if it has one. */\nexport async function closeProcessControlChannel(): Promise<void> {\n const held = slot();\n const channel = held.channel;\n held.channel = undefined;\n await channel?.close();\n}\n\nexport interface CallControlOptions {\n /** How long the answer may take (default: no limit; the request ends when\n * the other process does). */\n timeoutMs?: number;\n /** How long connecting may take (default 2 s). */\n connectTimeoutMs?: number;\n /** Do not hold this process open for the answer. */\n unref?: boolean;\n}\n\nconst CONNECT_TIMEOUT_MS = 2_000;\n\n/**\n * One request to the control channel a run record names. Resolves with the\n * result; rejects with a {@link ControlError}: `unreachable` when nothing\n * answers there, else the code the other process refused with.\n */\nexport function callControl(\n control: ControlRecord,\n method: string,\n params?: unknown,\n options: CallControlOptions = {},\n): Promise<unknown> {\n return new Promise((resolve, reject) => {\n const socket = net.connect(control.address);\n if (options.unref) socket.unref();\n let settled = false;\n let pending = \"\";\n const timers: NodeJS.Timeout[] = [];\n const settle = (finish: () => void) => {\n if (settled) return;\n settled = true;\n for (const timer of timers) clearTimeout(timer);\n socket.destroy();\n finish();\n };\n const unreachable = (why: string) =>\n settle(() => reject(new ControlError(\"unreachable\", why)));\n const limit = (ms: number, why: string) => {\n const timer = setTimeout(() => unreachable(why), ms);\n if (options.unref) timer.unref();\n timers.push(timer);\n return timer;\n };\n const connecting = limit(\n options.connectTimeoutMs ?? CONNECT_TIMEOUT_MS,\n `No answer at the control channel ${control.address}.`,\n );\n socket.setEncoding(\"utf8\");\n socket.once(\"connect\", () => {\n clearTimeout(connecting);\n if (options.timeoutMs !== undefined) {\n limit(\n options.timeoutMs,\n `\"${method}\" was not answered within ${options.timeoutMs} ms.`,\n );\n }\n socket.write(\n `${JSON.stringify({\n protocol: CONTROL_PROTOCOL,\n id: 1,\n token: control.token,\n method,\n ...(params === undefined ? {} : { params }),\n })}\\n`,\n );\n });\n socket.on(\"data\", (chunk: string) => {\n pending += chunk;\n const end = pending.indexOf(\"\\n\");\n if (end === -1) return;\n let response: {\n ok?: unknown;\n result?: unknown;\n error?: { code?: ControlErrorCode; message?: string };\n };\n try {\n response = JSON.parse(pending.slice(0, end)) as typeof response;\n } catch {\n unreachable(`The control channel ${control.address} answered no JSON.`);\n return;\n }\n if (response.ok === true) {\n settle(() => resolve(response.result));\n return;\n }\n settle(() =>\n reject(\n new ControlError(\n response.error?.code ?? \"failed\",\n response.error?.message ?? `\"${method}\" failed.`,\n ),\n ),\n );\n });\n socket.once(\"error\", (error) =>\n unreachable(\n `Cannot reach the control channel ${control.address}: ${error.message}`,\n ),\n );\n socket.once(\"close\", () =>\n unreachable(\n `The process behind the control channel ${control.address} went away before it answered \"${method}\".`,\n ),\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CACzB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACzB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACzB,CAAC;AAWD,IAAa,eAAb,cAAkC,MAAM;CAE3B;CADX,YACE,MACA,SACA;EACA,MAAM,OAAO;EAHJ,KAAA,OAAA;EAIT,KAAK,OAAO;CACd;AACF;AAoBA,MAAM,iBAAiB;;;AAIvB,SAAgB,gBACd,QAC2B;CAC3B,MAAM,SAAS,oBAAoB,UAAU,QAAQ,OAAO,OAAO;CACnE,IAAI,CAAC,OAAO,WAAW,OAAO,KAAK,aAAA,GACjC;CAEF,OAAO,OAAO;AAChB;AAEA,SAAS,UAAU,OAAgB,OAAwB;CACzD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,IAAI,OAAO,KAAK,KAAK;CAC3B,MAAM,IAAI,OAAO,KAAK,KAAK;CAC3B,OAAO,EAAE,WAAW,EAAE,UAAU,OAAO,gBAAgB,GAAG,CAAC;AAC7D;;AAGA,SAAS,cAAc,OAAwB;CAC7C,MAAM,MAAM,QAAQ,SAAS,KAAK;CAClC,MAAM,MAAM,SAAS,KAAK,KAAK,GAAG,OAAO,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d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { $ as validateHost, $t as profileSchema, A as ForegroundContext, An as findToken, At as ReactorHostInput, B as RunnerVerb, Bn as tokenable, Bt as compoundWiringSchema, C as planCompound, Cn as TokenFor, Ct as PACKAGE_NAME_PATTERN, D as BootIssue, Dn as concatTokenSchema, Dt as ReactorBackendKind, E as BootCheckContext, En as TokenableSchema, Et as ReactorBackend, F as ONE_SHOT_VERBS, Fn as mapTokenSchema, Ft as RunnerBase, G as hostSchemaIssues, Gn as findHostPackage, Gt as emitHostJsonSchema, H as SchemaIssue, Hn as HostLocation, Ht as declaredGenericCompoundHostSchema, I as RunnerContext, In as outputTokenSchema, It as RunnerKind, J as knownVerbIssues, Jn as locateHost, Jt as hostNameSchema, K as isSchemaLike, Kn as formatHostRef, Kt as emittedHostSchemas, L as RunnerError, Ln as ref, Lt as childWrapperSchema, M as HostSchemaIssues, Mn as isToken, Mt as ReactorProtocol, N as HostSchemaLike, Nn as itemTokenSchema, Nt as ReactorRemoteConfig, O as CONNECT_RUNNER, On as envTokenSchema, Ot as ReactorConfig, P as MemberStatus, Pn as keyTokenSchema, Pt as ReactorStorageConfig, Q as validateDeclaredHost, Qt as placementKeyIssues, R as RunnerIssue, Rn as tokenKeyOf, Rt as childrenSchema, S as memberForRef, Sn as Token, St as MemberProcess, T as applyChildWrapper, Tn as TokenMode, Tt as Profile, U as ValidateHostOptions, Un as HostPackage, Ut as declaredHostSchemas, V as STORE_VERBS, Vn as HostLoadError, Vt as connectReactorIssues, W as getVerb, Wn as HostRef, Wt as defineHostSchemas, X as packageBuildRefusal, Xn as resolvePackageRoot, Xt as memberProcessSchema, Y as listVerbs, Yn as parseHostRef, Yt as makeHostSchemas, Z as resolveRunnerModule, Zt as originOrUrlSchema, _ as toStartedHandle, _n as RecordMapToken, _t as HOST_NAME_PATTERN, a as RunCompoundResult, an as refineConnectReactor, at as envSitesOf, b as PlanError, bn as TOKEN_KEYS, bt as HostDefinition, c as memberCycle, cn as runnerKindSchema, ct as refKey, d as runCompound, dn as EnvToken, dt as ChildWrapper, en as reactorBackendKindSchema, et as DeclaredIssue, f as stopStreamOf, fn as ItemToken, ft as CompoundHost, g as runnerHandleSchema, gn as OutputToken, gt as HOST_NAME_MESSAGE, h as StartedHandle, hn as OutputPath, ht as HOST_NAME_MAX_LENGTH, i as RunCompoundOptions, in as reactorSchema, it as checkTokenSites, j as HostSchemaIssue, jn as forbidRef, jt as ReactorPackageConfig, k as DeclaredHostOptions, kn as envTokenable, kt as ReactorHost, l as memberProcessOf, ln as ArrayMapToken, lt as schemaAtPath, m as RunnerHandleData, mn as MapToken, mt as CompoundWiring, n as ForegroundPlan, nn as reactorHostSchema, nt as OutputsSchemaLookup, o as STOP_STREAM_LIMIT_MS, on as refineStartOrder, ot as outputRefsOf, p as RunnerHandle, pn as KeyToken, pt as CompoundHostInput, q as kindShapeIssues, qn as hostFileLabel, qt as genericCompoundHostSchema, r as HoldStopOptions, rn as reactorProtocolSchema, rt as checkOutputPaths, s as holdStopRequests, sn as runnerBaseSchema, st as outputSitesOf, t as ForegroundCandidate, tn as reactorBackendSchema, tt as OutputRef, u as planForeground, un as ConcatToken, ut as CONNECT_PRIMARY_MESSAGE, v as CompoundPlan, vn as RefFn, vt as HOST_REF_MESSAGE, w as MemberDraft, wn as TokenKey, wt as PlacementKeyIssue, x as PlanMember, xn as Template, xt as HostSchemas, y as PlanEdge, yn as TOKEN_ESCAPE_KEY, yt as HOST_REF_PATTERN, z as RunnerModule, zn as tokenSchema, zt as compoundHostSchema } from "./compound-D2dh2VUh.mjs";
1
+ import { _ as RunRecordMember, a as ControlErrorCode, c as OpenControlChannelOptions, d as controlRecordOf, f as controlRecordSchema, g as RunRecord, h as processControlChannel, i as ControlError, l as callControl, m as openControlChannel, n as CallControlOptions, o as ControlHandler, p as ensureProcessControlChannel, r as ControlChannel, s as ControlRecord, t as CONTROL_PROTOCOL, u as closeProcessControlChannel, v as runRecordMemberSchema, y as runRecordSchema } from "./control-channel-eqvyUF03.mjs";
2
+ import { $ as validateHost, $t as profileSchema, A as ForegroundContext, An as findToken, At as ReactorHostInput, B as RunnerVerb, Bn as tokenable, Bt as compoundWiringSchema, C as planCompound, Cn as TokenFor, Ct as PACKAGE_NAME_PATTERN, D as BootIssue, Dn as concatTokenSchema, Dt as ReactorBackendKind, E as BootCheckContext, En as TokenableSchema, Et as ReactorBackend, F as ONE_SHOT_VERBS, Fn as mapTokenSchema, Ft as RunnerBase, G as hostSchemaIssues, Gn as findHostPackage, Gt as emitHostJsonSchema, H as SchemaIssue, Hn as HostLocation, Ht as declaredGenericCompoundHostSchema, I as RunnerContext, In as outputTokenSchema, It as RunnerKind, J as knownVerbIssues, Jn as locateHost, Jt as hostNameSchema, K as isSchemaLike, Kn as formatHostRef, Kt as emittedHostSchemas, L as RunnerError, Ln as ref, Lt as childWrapperSchema, M as HostSchemaIssues, Mn as isToken, Mt as ReactorProtocol, N as HostSchemaLike, Nn as itemTokenSchema, Nt as ReactorRemoteConfig, O as CONNECT_RUNNER, On as envTokenSchema, Ot as ReactorConfig, P as MemberStatus, Pn as keyTokenSchema, Pt as ReactorStorageConfig, Q as validateDeclaredHost, Qt as placementKeyIssues, R as RunnerIssue, Rn as tokenKeyOf, Rt as childrenSchema, S as memberForRef, Sn as Token, St as MemberProcess, T as applyChildWrapper, Tn as TokenMode, Tt as Profile, U as ValidateHostOptions, Un as HostPackage, Ut as declaredHostSchemas, V as STORE_VERBS, Vn as HostLoadError, Vt as connectReactorIssues, W as getVerb, Wn as HostRef, Wt as defineHostSchemas, X as packageBuildRefusal, Xn as resolvePackageRoot, Xt as memberProcessSchema, Y as listVerbs, Yn as parseHostRef, Yt as makeHostSchemas, Z as resolveRunnerModule, Zt as originOrUrlSchema, _ as toStartedHandle, _n as RecordMapToken, _t as HOST_NAME_PATTERN, a as RunCompoundResult, an as refineConnectReactor, at as envSitesOf, b as PlanError, bn as TOKEN_KEYS, bt as HostDefinition, c as memberCycle, cn as runnerKindSchema, ct as refKey, d as runCompound, dn as EnvToken, dt as ChildWrapper, en as reactorBackendKindSchema, et as DeclaredIssue, f as stopStreamOf, fn as ItemToken, ft as CompoundHost, g as runnerHandleSchema, gn as OutputToken, gt as HOST_NAME_MESSAGE, h as StartedHandle, hn as OutputPath, ht as HOST_NAME_MAX_LENGTH, i as RunCompoundOptions, in as reactorSchema, it as checkTokenSites, j as HostSchemaIssue, jn as forbidRef, jt as ReactorPackageConfig, k as DeclaredHostOptions, kn as envTokenable, kt as ReactorHost, l as memberProcessOf, ln as ArrayMapToken, lt as schemaAtPath, m as RunnerHandleData, mn as MapToken, mt as CompoundWiring, n as ForegroundPlan, nn as reactorHostSchema, nt as OutputsSchemaLookup, o as STOP_STREAM_LIMIT_MS, on as refineStartOrder, ot as outputRefsOf, p as RunnerHandle, pn as KeyToken, pt as CompoundHostInput, q as kindShapeIssues, qn as hostFileLabel, qt as genericCompoundHostSchema, r as HoldStopOptions, rn as reactorProtocolSchema, rt as checkOutputPaths, s as holdStopRequests, sn as runnerBaseSchema, st as outputSitesOf, t as ForegroundCandidate, tn as reactorBackendSchema, tt as OutputRef, u as planForeground, un as ConcatToken, ut as CONNECT_PRIMARY_MESSAGE, v as CompoundPlan, vn as RefFn, vt as HOST_REF_MESSAGE, w as MemberDraft, wn as TokenKey, wt as PlacementKeyIssue, x as PlanMember, xn as Template, xt as HostSchemas, y as PlanEdge, yn as TOKEN_ESCAPE_KEY, yt as HOST_REF_PATTERN, z as RunnerModule, zn as tokenSchema, zt as compoundHostSchema } from "./compound-L62ALvYc.mjs";
2
3
  import { killTree } from "./kill-tree.mjs";
3
4
  import { z } from "zod";
4
5
  import { SwitchboardDrive, driveAddressMessage, switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
@@ -23,7 +24,7 @@ export declare function probeHostsFolder(projectRoot: string): HostsFolderStatus
23
24
  /**
24
25
  * Why `subject` cannot run in a project whose hosts/ folder is absent or
25
26
  * empty, and what adds the host files. One wording, for `ph run <host>` and
26
- * for the `ph vetra`, `ph connect` and `ph switchboard` sugar.
27
+ * for the `ph dev`, `ph connect` and `ph switchboard` sugar.
27
28
  */
28
29
  export declare function withoutHostsMessage(probe: Exclude<HostsFolderStatus, {
29
30
  kind: "present";
@@ -212,45 +213,6 @@ interface CompoundArgvMember {
212
213
  */
213
214
  export declare function splitCompoundArgv(argv: readonly string[], host: string, members: readonly CompoundArgvMember[], foreground?: string): Map<string, string[]>;
214
215
  //#endregion
215
- //#region src/run-record-schema.d.ts
216
- export declare const runRecordMemberSchema: z.ZodObject<{
217
- host: z.ZodString;
218
- runnerModule: z.ZodString;
219
- kind: z.ZodEnum<{
220
- compound: "compound";
221
- reactor: "reactor";
222
- }>;
223
- verb: z.ZodString;
224
- outputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
225
- }, z.core.$strict>;
226
- export declare const runRecordSchema: z.ZodObject<{
227
- version: z.ZodLiteral<2>;
228
- host: z.ZodString;
229
- package: z.ZodOptional<z.ZodString>;
230
- projectName: z.ZodString;
231
- kind: z.ZodEnum<{
232
- compound: "compound";
233
- reactor: "reactor";
234
- }>;
235
- verb: z.ZodString;
236
- pid: z.ZodNumber;
237
- startedAt: z.ZodString;
238
- outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
239
- members: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
240
- host: z.ZodString;
241
- runnerModule: z.ZodString;
242
- kind: z.ZodEnum<{
243
- compound: "compound";
244
- reactor: "reactor";
245
- }>;
246
- verb: z.ZodString;
247
- outputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
248
- }, z.core.$strict>>>;
249
- extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
250
- }, z.core.$strict>;
251
- type RunRecord = z.infer<typeof runRecordSchema>;
252
- type RunRecordMember = z.infer<typeof runRecordMemberSchema>;
253
- //#endregion
254
216
  //#region src/run-record.d.ts
255
217
  /**
256
218
  * Record I/O for `.ph/run/<host>.json`, keyed by host name so N hosts
@@ -659,7 +621,7 @@ export declare function exportHost(projectRoot: string, name: string): Promise<H
659
621
  * resolves it at start. `${userData}` is a PROJECT-SHAPED root: its `.ph`
660
622
  * subtree carries the same names the classic commands use under
661
623
  * `<project>/.ph` (see `resolvePhDir`). In the CLI it IS the project root, so
662
- * `ph run desktop` in a project shares the one `.ph` tree `ph vetra` uses;
624
+ * `ph run desktop` in a project shares the one `.ph` tree `ph dev` uses;
663
625
  * a shell (Tauri) points it at the OS profile via PH_USER_DATA_DIR, and the
664
626
  * whole `.ph` tree — stores, identity, run records — follows.
665
627
  */
@@ -1237,7 +1199,7 @@ export declare function assertProtocolConsistency(protocol: ReactorProtocol | un
1237
1199
  * Concatenate groups of `connect.drives.defaultDrives` in the order given,
1238
1200
  * de-duplicating by drive identity (URL for remote entries, id for local
1239
1201
  * ones). The first occurrence of a drive wins, so earlier groups keep their
1240
- * position and metadata — e.g. the Vetra drive `ph vetra` starts stays first
1202
+ * position and metadata — e.g. the Vetra drive `ph dev` starts stays first
1241
1203
  * even when the project's `powerhouse.config.json` lists the same drive.
1242
1204
  */
1243
1205
  export declare function mergeDefaultDrives(...groups: PHConnectDefaultDrive[][]): PHConnectDefaultDrive[];
@@ -1515,6 +1477,6 @@ interface MemberInput extends Omit<ExpectHostInput, "members" | "plan"> {
1515
1477
  */
1516
1478
  export declare function expectHost(input: ExpectHostInput): HostExpectation;
1517
1479
  //#endregion
1518
- export { type ArrayMapToken, type BootCheckContext, type BootIssue, type BuiltinEnv, CONNECT_PRIMARY_MESSAGE, CONNECT_RUNNER, type CheckDeferred, type CheckHostOptions, type CheckHostResult, type CheckStage, type ChildWrapper, type CompoundArgvMember, type CompoundHost, type CompoundHostInput, type CompoundMemberHost, type CompoundPlan, type CompoundWiring, type ConcatToken, type ConnectPluginSlices, type ConnectReactorProjection, type ConnectRouterSettings, type ConnectStorageKind, type ConsumedOutput, type ContributedDrive, type ContributedDriveInput, type ContributionSource, type Contributions, type DeadConfigWarning, type DeclaredHostOptions, type DeclaredIssue, type DeferredResolution, type DeferredToken, type DriveDeclaration, type DrivePlanEntry, type DriveProjectionInput, type DriveSeederClient, type EnvToken, type ExpectHostInput, type ExpectedBackend, type ExpectedDrive, type ForegroundCandidate, type ForegroundContext, type ForegroundPlan, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, HOST_REF_MESSAGE, HOST_REF_PATTERN, type HoldStopOptions, type HostDefinition, type HostExit, type HostExpectation, type HostExport, type HostImports, type HostIssue, HostLoadError, type HostLocation, type HostOutputsDescription, type HostPackage, type HostPlugin, type HostPluginModule, type HostRef, type HostSchemaIssue, type HostSchemaIssues, type HostSchemaLike, type HostSchemas, type HostsFolderStatus, type ItemToken, type KeyToken, type LoadHostOptions, type LoadedHost, type MapToken, type MemberDraft, type MemberExpectation, type MemberInput, type MemberProcess, type MemberStatus, type MergedContribution, type NormalizedPluginEntry, ONE_SHOT_VERBS, ORIGIN_PLACEHOLDER, type Observe, type OutputLookup, type OutputPath, type OutputRef, type OutputSource, type OutputToken, type OutputsSchemaLookup, type OwnedConfigSlice, PACKAGE_NAME_PATTERN, type PHHost, type PHHostOutputs, type PlacedConnectDrives, type PlacementKeyIssue, type PlanEdge, PlanError, type PlanMember, type PluginContributionsPlan, type PluginEntry, type PluginEntryData, type ProducerInfo, type ProducerMap, type Profile, type ProjectedDescriptor, type ProjectedStorage, type Provide, type ReactorBackend, type ReactorBackendKind, type ReactorClientMode, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RemovedForm, type ResolveOptions, type ResolveSources, type ResolvedDrive, type ResolvedPlugin, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerArgsSchema, type RunnerArgvTarget, type RunnerBase, type RunnerContext, RunnerError, type RunnerHandle, type RunnerHandleData, type RunnerIssue, type RunnerKind, type RunnerModule, type RunnerVerb, STOP_STREAM_LIMIT_MS, STORE_VERBS, SWITCHBOARD_PROXY_PATHS, type SchemaIssue, type SeedResult, type SelfMembers, type ServedRemoteBackend, type SpawnHostOptions, type SpawnHostPhase, type SpawnedHost, type SplitRunArgv, type StartedHandle, type StopRunOptions, type StopRunResult, type SwitchboardDrive, type SwitchboardReactorLayer, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenPosition, type TokenSite, type TokenableSchema, type Transform, type ValidateHostOptions, applyChildWrapper, checkOutputPaths, checkTokenSites, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, connectReactorIssues, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, emitHostJsonSchema, emittedHostSchemas, envSitesOf, envTokenSchema, envTokenable, findHostPackage, findToken, forbidRef, formatHostRef, genericCompoundHostSchema, getVerb, holdStopRequests, hostFileLabel, hostNameSchema, hostSchemaIssues, isHtmlNavigation, isOriginPlaceholderUrl, isSchemaLike, isSwitchboardProxyPath, isToken, itemTokenSchema, keyTokenSchema, killTree, kindShapeIssues, knownVerbIssues, listVerbs, locateHost, makeHostSchemas, mapTokenSchema, memberCycle, memberForRef, memberProcessOf, memberProcessSchema, originOrUrlSchema, outputRefsOf, outputSitesOf, outputTokenSchema, packageBuildRefusal, parseHostRef, placementKeyIssues, planCompound, planForeground, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refKey, refineConnectReactor, refineStartOrder, resolveOriginPlaceholders, resolvePackageRoot, resolveRunnerModule, runCompound, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, schemaAtPath, stopStreamOf, switchboardOfDrive, toOriginPlaceholder, toStartedHandle, tokenKeyOf, tokenSchema, tokenable, validateDeclaredHost, validateHost, withOriginPlaceholders };
1480
+ export { type ArrayMapToken, type BootCheckContext, type BootIssue, type BuiltinEnv, CONNECT_PRIMARY_MESSAGE, CONNECT_RUNNER, CONTROL_PROTOCOL, type CallControlOptions, type CheckDeferred, type CheckHostOptions, type CheckHostResult, type CheckStage, type ChildWrapper, type CompoundArgvMember, type CompoundHost, type CompoundHostInput, type CompoundMemberHost, type CompoundPlan, type CompoundWiring, type ConcatToken, type ConnectPluginSlices, type ConnectReactorProjection, type ConnectRouterSettings, type ConnectStorageKind, type ConsumedOutput, type ContributedDrive, type ContributedDriveInput, type ContributionSource, type Contributions, type ControlChannel, ControlError, type ControlErrorCode, type ControlHandler, type ControlRecord, type DeadConfigWarning, type DeclaredHostOptions, type DeclaredIssue, type DeferredResolution, type DeferredToken, type DriveDeclaration, type DrivePlanEntry, type DriveProjectionInput, type DriveSeederClient, type EnvToken, type ExpectHostInput, type ExpectedBackend, type ExpectedDrive, type ForegroundCandidate, type ForegroundContext, type ForegroundPlan, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, HOST_REF_MESSAGE, HOST_REF_PATTERN, type HoldStopOptions, type HostDefinition, type HostExit, type HostExpectation, type HostExport, type HostImports, type HostIssue, HostLoadError, type HostLocation, type HostOutputsDescription, type HostPackage, type HostPlugin, type HostPluginModule, type HostRef, type HostSchemaIssue, type HostSchemaIssues, type HostSchemaLike, type HostSchemas, type HostsFolderStatus, type ItemToken, type KeyToken, type LoadHostOptions, type LoadedHost, type MapToken, type MemberDraft, type MemberExpectation, type MemberInput, type MemberProcess, type MemberStatus, type MergedContribution, type NormalizedPluginEntry, ONE_SHOT_VERBS, ORIGIN_PLACEHOLDER, type Observe, type OpenControlChannelOptions, type OutputLookup, type OutputPath, type OutputRef, type OutputSource, type OutputToken, type OutputsSchemaLookup, type OwnedConfigSlice, PACKAGE_NAME_PATTERN, type PHHost, type PHHostOutputs, type PlacedConnectDrives, type PlacementKeyIssue, type PlanEdge, PlanError, type PlanMember, type PluginContributionsPlan, type PluginEntry, type PluginEntryData, type ProducerInfo, type ProducerMap, type Profile, type ProjectedDescriptor, type ProjectedStorage, type Provide, type ReactorBackend, type ReactorBackendKind, type ReactorClientMode, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RemovedForm, type ResolveOptions, type ResolveSources, type ResolvedDrive, type ResolvedPlugin, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerArgsSchema, type RunnerArgvTarget, type RunnerBase, type RunnerContext, RunnerError, type RunnerHandle, type RunnerHandleData, type RunnerIssue, type RunnerKind, type RunnerModule, type RunnerVerb, STOP_STREAM_LIMIT_MS, STORE_VERBS, SWITCHBOARD_PROXY_PATHS, type SchemaIssue, type SeedResult, type SelfMembers, type ServedRemoteBackend, type SpawnHostOptions, type SpawnHostPhase, type SpawnedHost, type SplitRunArgv, type StartedHandle, type StopRunOptions, type StopRunResult, type SwitchboardDrive, type SwitchboardReactorLayer, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenPosition, type TokenSite, type TokenableSchema, type Transform, type ValidateHostOptions, applyChildWrapper, callControl, checkOutputPaths, checkTokenSites, childWrapperSchema, childrenSchema, closeProcessControlChannel, compoundHostSchema, compoundWiringSchema, concatTokenSchema, connectReactorIssues, controlRecordOf, controlRecordSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, emitHostJsonSchema, emittedHostSchemas, ensureProcessControlChannel, envSitesOf, envTokenSchema, envTokenable, findHostPackage, findToken, forbidRef, formatHostRef, genericCompoundHostSchema, getVerb, holdStopRequests, hostFileLabel, hostNameSchema, hostSchemaIssues, isHtmlNavigation, isOriginPlaceholderUrl, isSchemaLike, isSwitchboardProxyPath, isToken, itemTokenSchema, keyTokenSchema, killTree, kindShapeIssues, knownVerbIssues, listVerbs, locateHost, makeHostSchemas, mapTokenSchema, memberCycle, memberForRef, memberProcessOf, memberProcessSchema, openControlChannel, originOrUrlSchema, outputRefsOf, outputSitesOf, outputTokenSchema, packageBuildRefusal, parseHostRef, placementKeyIssues, planCompound, planForeground, processControlChannel, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refKey, refineConnectReactor, refineStartOrder, resolveOriginPlaceholders, resolvePackageRoot, resolveRunnerModule, runCompound, runRecordMemberSchema, runRecordSchema, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, schemaAtPath, stopStreamOf, switchboardOfDrive, toOriginPlaceholder, toStartedHandle, tokenKeyOf, tokenSchema, tokenable, validateDeclaredHost, validateHost, withOriginPlaceholders };
1519
1481
  export {};
1520
1482
  //# sourceMappingURL=index.d.mts.map