@powerhousedao/host-core 6.4.0-next.3 → 6.4.0-next.4

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.
Files changed (44) hide show
  1. package/dist/{compound-L62ALvYc.d.mts → compound-BLhEewO6.d.mts} +8 -2
  2. package/dist/compound-BLhEewO6.d.mts.map +1 -0
  3. package/dist/{compound-Q9sZSEZF.mjs → compound-g6x_KkWp.mjs} +133 -1208
  4. package/dist/compound-g6x_KkWp.mjs.map +1 -0
  5. package/dist/control-channel-DVn4dvfQ.d.mts +206 -0
  6. package/dist/control-channel-DVn4dvfQ.d.mts.map +1 -0
  7. package/dist/control-channel.d.mts +2 -2
  8. package/dist/control-channel.mjs +358 -47
  9. package/dist/control-channel.mjs.map +1 -1
  10. package/dist/host-entry-B8n_590_.mjs +188 -0
  11. package/dist/host-entry-B8n_590_.mjs.map +1 -0
  12. package/dist/index.d.mts +68 -102
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs +6 -3
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/instance-C6uugZ32.d.mts +165 -0
  17. package/dist/instance-C6uugZ32.d.mts.map +1 -0
  18. package/dist/instance.d.mts +3 -0
  19. package/dist/instance.mjs +145 -0
  20. package/dist/instance.mjs.map +1 -0
  21. package/dist/kill-tree.d.mts +2 -0
  22. package/dist/kill-tree.d.mts.map +1 -1
  23. package/dist/kill-tree.mjs +1 -1
  24. package/dist/kill-tree.mjs.map +1 -1
  25. package/dist/run-record-C6oTZF_C.mjs +1077 -0
  26. package/dist/run-record-C6oTZF_C.mjs.map +1 -0
  27. package/dist/runners/compound.d.mts +1 -1
  28. package/dist/runners/compound.mjs +2 -1
  29. package/dist/runners/compound.mjs.map +1 -1
  30. package/dist/spawn-host-DWroRe1S.d.mts +107 -0
  31. package/dist/spawn-host-DWroRe1S.d.mts.map +1 -0
  32. package/dist/supervisor-record.d.mts +88 -0
  33. package/dist/supervisor-record.d.mts.map +1 -0
  34. package/dist/supervisor-record.mjs +127 -0
  35. package/dist/supervisor-record.mjs.map +1 -0
  36. package/dist/supervisor.d.mts +205 -0
  37. package/dist/supervisor.d.mts.map +1 -0
  38. package/dist/supervisor.mjs +905 -0
  39. package/dist/supervisor.mjs.map +1 -0
  40. package/package.json +21 -3
  41. package/dist/compound-L62ALvYc.d.mts.map +0 -1
  42. package/dist/compound-Q9sZSEZF.mjs.map +0 -1
  43. package/dist/control-channel-eqvyUF03.d.mts +0 -123
  44. package/dist/control-channel-eqvyUF03.d.mts.map +0 -1
@@ -1,123 +0,0 @@
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
@@ -1 +0,0 @@
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"}