@powerhousedao/host-core 6.2.3-dev.100
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/LICENSE +661 -0
- package/dist/compound-DO_mvh0O.mjs +3296 -0
- package/dist/compound-DO_mvh0O.mjs.map +1 -0
- package/dist/compound-eW-6nGxK.d.mts +2509 -0
- package/dist/compound-eW-6nGxK.d.mts.map +1 -0
- package/dist/env-substitution-BXGohOGN.mjs +660 -0
- package/dist/env-substitution-BXGohOGN.mjs.map +1 -0
- package/dist/env-substitution-C_fVirPh.d.mts +17 -0
- package/dist/env-substitution-C_fVirPh.d.mts.map +1 -0
- package/dist/host-schemas-BM7F21lf.d.mts +2193 -0
- package/dist/host-schemas-BM7F21lf.d.mts.map +1 -0
- package/dist/index.d.mts +1304 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1181 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugins-Uk84BRay.d.mts +182 -0
- package/dist/plugins-Uk84BRay.d.mts.map +1 -0
- package/dist/plugins.d.mts +3 -0
- package/dist/plugins.mjs +174 -0
- package/dist/plugins.mjs.map +1 -0
- package/dist/projection.d.mts +651 -0
- package/dist/projection.d.mts.map +1 -0
- package/dist/projection.mjs +1633 -0
- package/dist/projection.mjs.map +1 -0
- package/dist/runners/compound.d.mts +286 -0
- package/dist/runners/compound.d.mts.map +1 -0
- package/dist/runners/compound.mjs +42 -0
- package/dist/runners/compound.mjs.map +1 -0
- package/dist/schema.d.mts +146 -0
- package/dist/schema.d.mts.map +1 -0
- package/dist/schema.mjs +98 -0
- package/dist/schema.mjs.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { $ as HostDefinition, n as RunCompoundResult, y as RunnerContext } from "../compound-eW-6nGxK.mjs";
|
|
2
|
+
//#region src/runners/compound.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The GENERIC compound runner module (phase 3): supervises the members a
|
|
5
|
+
* compound host declares via the runCompound engine. Verb semantics: `run`
|
|
6
|
+
* starts members at `runner.defaultVerb ?? "run"`; `dev`/`build`/`serve`
|
|
7
|
+
* start members at that same verb — an explicit `ph run <host> <verb>` beats
|
|
8
|
+
* defaultVerb structurally. A member whose runner lacks the forwarded verb
|
|
9
|
+
* fails the compound loudly with that member's verb list (never skipped).
|
|
10
|
+
*
|
|
11
|
+
* Vetra does NOT run through this yet (phase-1 scope decision: its drive
|
|
12
|
+
* provisioning arrives as plugin contributions); the first real consumer is
|
|
13
|
+
* the desktop-shaped host (switchboard `run` + connect `serve`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const kind = "compound";
|
|
16
|
+
export declare const hostSchema: import("zod").ZodObject<{
|
|
17
|
+
name: import("zod").ZodString;
|
|
18
|
+
runner: import("zod").ZodObject<{
|
|
19
|
+
module: import("zod").ZodString;
|
|
20
|
+
defaultVerb: import("zod").ZodOptional<import("zod").ZodString>;
|
|
21
|
+
port: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
22
|
+
host: import("zod").ZodOptional<import("zod").ZodString>;
|
|
23
|
+
plugins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
24
|
+
module: import("zod").ZodString;
|
|
25
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
26
|
+
verbs: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"*">, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
27
|
+
config: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
28
|
+
}, import("zod/v4/core").$strict>]>>>;
|
|
29
|
+
}, import("zod/v4/core").$loose>;
|
|
30
|
+
children: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
31
|
+
host: import("zod").ZodString;
|
|
32
|
+
runner: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
33
|
+
module: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
defaultVerb: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
35
|
+
host: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
36
|
+
plugins: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
37
|
+
module: import("zod").ZodString;
|
|
38
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
39
|
+
verbs: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"*">, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
40
|
+
config: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
41
|
+
}, import("zod/v4/core").$strict>]>>>>;
|
|
42
|
+
port: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
43
|
+
}, import("zod/v4/core").$loose>>;
|
|
44
|
+
config: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
45
|
+
reactor: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
46
|
+
backends: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
47
|
+
kind: import("zod").ZodEnum<{
|
|
48
|
+
"in-process": "in-process";
|
|
49
|
+
remote: "remote";
|
|
50
|
+
worker: "worker";
|
|
51
|
+
}>;
|
|
52
|
+
storage: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
53
|
+
kind: import("zod").ZodEnum<{
|
|
54
|
+
idb: "idb";
|
|
55
|
+
memory: "memory";
|
|
56
|
+
path: "path";
|
|
57
|
+
postgres: "postgres";
|
|
58
|
+
}>;
|
|
59
|
+
dataDir: import("zod").ZodOptional<import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodString, import("@powerhousedao/shared/host-tokens").EnvToken>>;
|
|
60
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
|
+
}, import("zod/v4/core").$strict>>;
|
|
62
|
+
readModel: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
63
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
64
|
+
}, import("zod/v4/core").$strict>>;
|
|
65
|
+
packages: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
66
|
+
cdnUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
67
|
+
specs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
68
|
+
dynamic: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
69
|
+
}, import("zod/v4/core").$strict>>;
|
|
70
|
+
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
71
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodString]>>;
|
|
72
|
+
requestTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
73
|
+
breaker: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<false>, import("zod").ZodObject<{
|
|
74
|
+
failures: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
75
|
+
openMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
76
|
+
}, import("zod/v4/core").$strict>]>>;
|
|
77
|
+
realtime: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
78
|
+
}, import("zod/v4/core").$strict>>;
|
|
79
|
+
}, import("zod/v4/core").$strict>>>;
|
|
80
|
+
placement: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
81
|
+
primary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
82
|
+
drives: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
83
|
+
newDrives: import("zod").ZodOptional<import("zod").ZodString>;
|
|
84
|
+
}, import("zod/v4/core").$strict>>;
|
|
85
|
+
router: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
86
|
+
probeTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
87
|
+
provisionalRouteMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
88
|
+
}, import("zod/v4/core").$strict>>;
|
|
89
|
+
protocol: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
90
|
+
featureFlags: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
91
|
+
documentDecisions: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
92
|
+
authEnforcement: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
93
|
+
authGroups: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
94
|
+
authConditions: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
95
|
+
undoV3: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
96
|
+
}, import("zod/v4/core").$strict>>;
|
|
97
|
+
createSignaturePolicy: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
98
|
+
legacy: "legacy";
|
|
99
|
+
"v2-required": "v2-required";
|
|
100
|
+
}>>;
|
|
101
|
+
unsupportedStoredDocuments: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
102
|
+
"read-only": "read-only";
|
|
103
|
+
refuse: "refuse";
|
|
104
|
+
}>>;
|
|
105
|
+
}, import("zod/v4/core").$strict>>;
|
|
106
|
+
workflows: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
107
|
+
renown: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
108
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
109
|
+
networkId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
110
|
+
chainId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
111
|
+
}, import("zod/v4/core").$strict>>;
|
|
112
|
+
namespace: import("zod").ZodOptional<import("zod").ZodString>;
|
|
113
|
+
drives: import("zod").ZodOptional<import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodArray<import("zod").ZodObject<{
|
|
114
|
+
slug: import("zod").ZodString;
|
|
115
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
116
|
+
projectHash: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"id">]>>;
|
|
117
|
+
documentType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
118
|
+
"powerhouse/document-drive": "powerhouse/document-drive";
|
|
119
|
+
"powerhouse/reactor-drive": "powerhouse/reactor-drive";
|
|
120
|
+
}>>;
|
|
121
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
122
|
+
icon: import("zod").ZodOptional<import("zod").ZodString>;
|
|
123
|
+
preferredEditor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
124
|
+
sharingType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
125
|
+
private: "private";
|
|
126
|
+
public: "public";
|
|
127
|
+
shared: "shared";
|
|
128
|
+
}>>;
|
|
129
|
+
availableOffline: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
130
|
+
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
131
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodString>;
|
|
132
|
+
}, import("zod/v4/core").$strict>>;
|
|
133
|
+
}, import("zod/v4/core").$strict>>>>;
|
|
134
|
+
}, import("zod/v4/core").$strict>>;
|
|
135
|
+
}, import("zod/v4/core").$strict>>;
|
|
136
|
+
profile: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
137
|
+
appId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
138
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
139
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
140
|
+
icon: import("zod").ZodOptional<import("zod").ZodString>;
|
|
141
|
+
}, import("zod/v4/core").$strict>>;
|
|
142
|
+
config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
143
|
+
startOrder: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
144
|
+
runtimeRecord: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
145
|
+
cspRegistrySync: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
146
|
+
}, import("zod/v4/core").$strict>>;
|
|
147
|
+
}, import("zod/v4/core").$strict>;
|
|
148
|
+
export declare const declaredHostSchema: import("zod").ZodObject<{
|
|
149
|
+
name: import("zod").ZodString;
|
|
150
|
+
runner: import("zod").ZodObject<{
|
|
151
|
+
module: import("zod").ZodString;
|
|
152
|
+
defaultVerb: import("zod").ZodOptional<import("zod").ZodString>;
|
|
153
|
+
port: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
154
|
+
host: import("zod").ZodOptional<import("zod").ZodString>;
|
|
155
|
+
plugins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
156
|
+
module: import("zod").ZodString;
|
|
157
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
158
|
+
verbs: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"*">, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
159
|
+
config: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
160
|
+
}, import("zod/v4/core").$strict>]>>>;
|
|
161
|
+
}, import("zod/v4/core").$loose>;
|
|
162
|
+
children: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
163
|
+
host: import("zod").ZodString;
|
|
164
|
+
runner: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
165
|
+
module: import("zod").ZodOptional<import("zod").ZodString>;
|
|
166
|
+
defaultVerb: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
167
|
+
host: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
168
|
+
plugins: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
169
|
+
module: import("zod").ZodString;
|
|
170
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
171
|
+
verbs: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"*">, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
172
|
+
config: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
173
|
+
}, import("zod/v4/core").$strict>]>>>>;
|
|
174
|
+
port: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
175
|
+
}, import("zod/v4/core").$loose>>;
|
|
176
|
+
config: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
177
|
+
reactor: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
178
|
+
backends: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
179
|
+
kind: import("zod").ZodEnum<{
|
|
180
|
+
"in-process": "in-process";
|
|
181
|
+
remote: "remote";
|
|
182
|
+
worker: "worker";
|
|
183
|
+
}>;
|
|
184
|
+
storage: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
185
|
+
kind: import("zod").ZodEnum<{
|
|
186
|
+
idb: "idb";
|
|
187
|
+
memory: "memory";
|
|
188
|
+
path: "path";
|
|
189
|
+
postgres: "postgres";
|
|
190
|
+
}>;
|
|
191
|
+
dataDir: import("zod").ZodOptional<import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodString, import("@powerhousedao/shared/host-tokens").EnvToken>>;
|
|
192
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
193
|
+
}, import("zod/v4/core").$strict>>;
|
|
194
|
+
readModel: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
195
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
196
|
+
}, import("zod/v4/core").$strict>>;
|
|
197
|
+
packages: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
198
|
+
cdnUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
199
|
+
specs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
200
|
+
dynamic: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
201
|
+
}, import("zod/v4/core").$strict>>;
|
|
202
|
+
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
203
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodString]>>;
|
|
204
|
+
requestTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
205
|
+
breaker: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<false>, import("zod").ZodObject<{
|
|
206
|
+
failures: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
207
|
+
openMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
208
|
+
}, import("zod/v4/core").$strict>]>>;
|
|
209
|
+
realtime: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
210
|
+
}, import("zod/v4/core").$strict>>;
|
|
211
|
+
}, import("zod/v4/core").$strict>>>;
|
|
212
|
+
placement: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
213
|
+
primary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
214
|
+
drives: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
215
|
+
newDrives: import("zod").ZodOptional<import("zod").ZodString>;
|
|
216
|
+
}, import("zod/v4/core").$strict>>;
|
|
217
|
+
router: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
218
|
+
probeTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
219
|
+
provisionalRouteMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
220
|
+
}, import("zod/v4/core").$strict>>;
|
|
221
|
+
protocol: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
222
|
+
featureFlags: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
223
|
+
documentDecisions: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
224
|
+
authEnforcement: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
225
|
+
authGroups: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
226
|
+
authConditions: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
227
|
+
undoV3: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
228
|
+
}, import("zod/v4/core").$strict>>;
|
|
229
|
+
createSignaturePolicy: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
230
|
+
legacy: "legacy";
|
|
231
|
+
"v2-required": "v2-required";
|
|
232
|
+
}>>;
|
|
233
|
+
unsupportedStoredDocuments: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
234
|
+
"read-only": "read-only";
|
|
235
|
+
refuse: "refuse";
|
|
236
|
+
}>>;
|
|
237
|
+
}, import("zod/v4/core").$strict>>;
|
|
238
|
+
workflows: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
239
|
+
renown: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
240
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
241
|
+
networkId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
242
|
+
chainId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
243
|
+
}, import("zod/v4/core").$strict>>;
|
|
244
|
+
namespace: import("zod").ZodOptional<import("zod").ZodString>;
|
|
245
|
+
drives: import("zod").ZodOptional<import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodArray<import("zod").ZodObject<{
|
|
246
|
+
slug: import("zod").ZodString;
|
|
247
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
248
|
+
projectHash: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"id">]>>;
|
|
249
|
+
documentType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
250
|
+
"powerhouse/document-drive": "powerhouse/document-drive";
|
|
251
|
+
"powerhouse/reactor-drive": "powerhouse/reactor-drive";
|
|
252
|
+
}>>;
|
|
253
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
254
|
+
icon: import("zod").ZodOptional<import("zod").ZodString>;
|
|
255
|
+
preferredEditor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
256
|
+
sharingType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
257
|
+
private: "private";
|
|
258
|
+
public: "public";
|
|
259
|
+
shared: "shared";
|
|
260
|
+
}>>;
|
|
261
|
+
availableOffline: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
262
|
+
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
263
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodString>;
|
|
264
|
+
}, import("zod/v4/core").$strict>>;
|
|
265
|
+
}, import("zod/v4/core").$strict>>>>;
|
|
266
|
+
}, import("zod/v4/core").$strict>>;
|
|
267
|
+
}, import("zod/v4/core").$strict>>;
|
|
268
|
+
profile: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
269
|
+
appId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
270
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
271
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
272
|
+
icon: import("zod").ZodOptional<import("zod").ZodString>;
|
|
273
|
+
}, import("zod/v4/core").$strict>>;
|
|
274
|
+
config: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
275
|
+
startOrder: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
276
|
+
runtimeRecord: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
277
|
+
cspRegistrySync: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
278
|
+
}, import("zod/v4/core").$strict>>;
|
|
279
|
+
}, import("zod/v4/core").$strict>;
|
|
280
|
+
export declare function run(host: HostDefinition, ctx: RunnerContext): Promise<RunCompoundResult>;
|
|
281
|
+
export declare function dev(host: HostDefinition, ctx: RunnerContext): Promise<RunCompoundResult>;
|
|
282
|
+
export declare function build(host: HostDefinition, ctx: RunnerContext): Promise<RunCompoundResult>;
|
|
283
|
+
export declare function serve(host: HostDefinition, ctx: RunnerContext): Promise<RunCompoundResult>;
|
|
284
|
+
//#endregion
|
|
285
|
+
export {};
|
|
286
|
+
//# sourceMappingURL=compound.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound.d.mts","names":[],"sources":["../../src/runners/compound.ts"],"mappings":";;;;;;;;;;;;;;qBA2Ba;qBAEA,0BAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA4B;qBACtC,kCAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAoC;wBAiB7C,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,MACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,MACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { C as readProjectName, Lt as genericCompoundHostSchema, Mt as declaredGenericCompoundHostSchema, a as stopStreamOf, i as runCompound, t as compoundStartVerb } from "../compound-DO_mvh0O.mjs";
|
|
2
|
+
//#region src/runners/compound.ts
|
|
3
|
+
/**
|
|
4
|
+
* The GENERIC compound runner module (phase 3): supervises the members a
|
|
5
|
+
* compound host declares via the runCompound engine. Verb semantics: `run`
|
|
6
|
+
* starts members at `runner.defaultVerb ?? "run"`; `dev`/`build`/`serve`
|
|
7
|
+
* start members at that same verb — an explicit `ph run <host> <verb>` beats
|
|
8
|
+
* defaultVerb structurally. A member whose runner lacks the forwarded verb
|
|
9
|
+
* fails the compound loudly with that member's verb list (never skipped).
|
|
10
|
+
*
|
|
11
|
+
* Vetra does NOT run through this yet (phase-1 scope decision: its drive
|
|
12
|
+
* provisioning arrives as plugin contributions); the first real consumer is
|
|
13
|
+
* the desktop-shaped host (switchboard `run` + connect `serve`).
|
|
14
|
+
*/
|
|
15
|
+
const kind = "compound";
|
|
16
|
+
const hostSchema = genericCompoundHostSchema;
|
|
17
|
+
const declaredHostSchema = declaredGenericCompoundHostSchema;
|
|
18
|
+
async function startAt(host, ctx, memberVerb) {
|
|
19
|
+
return runCompound(host, {
|
|
20
|
+
...ctx,
|
|
21
|
+
verb: memberVerb
|
|
22
|
+
}, {
|
|
23
|
+
projectName: readProjectName(ctx.projectRoot),
|
|
24
|
+
stopStream: stopStreamOf(process.env, () => process.stdin)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function run(host, ctx) {
|
|
28
|
+
return startAt(host, ctx, compoundStartVerb("run", host.runner));
|
|
29
|
+
}
|
|
30
|
+
async function dev(host, ctx) {
|
|
31
|
+
return startAt(host, ctx, "dev");
|
|
32
|
+
}
|
|
33
|
+
async function build(host, ctx) {
|
|
34
|
+
return startAt(host, ctx, "build");
|
|
35
|
+
}
|
|
36
|
+
async function serve(host, ctx) {
|
|
37
|
+
return startAt(host, ctx, "serve");
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { build, declaredHostSchema, dev, hostSchema, kind, run, serve };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=compound.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound.mjs","names":[],"sources":["../../src/runners/compound.ts"],"sourcesContent":["import {\n declaredGenericCompoundHostSchema,\n genericCompoundHostSchema,\n type HostDefinition,\n} from \"../host-schemas.js\";\nimport {\n compoundStartVerb,\n runCompound,\n stopStreamOf,\n type RunCompoundResult,\n} from \"../compound.js\";\nimport { readProjectName } from \"../run-record.js\";\nimport type { RunnerContext } from \"../runner-resolver.js\";\n\n/**\n * The GENERIC compound runner module (phase 3): supervises the members a\n * compound host declares via the runCompound engine. Verb semantics: `run`\n * starts members at `runner.defaultVerb ?? \"run\"`; `dev`/`build`/`serve`\n * start members at that same verb — an explicit `ph run <host> <verb>` beats\n * defaultVerb structurally. A member whose runner lacks the forwarded verb\n * fails the compound loudly with that member's verb list (never skipped).\n *\n * Vetra does NOT run through this yet (phase-1 scope decision: its drive\n * provisioning arrives as plugin contributions); the first real consumer is\n * the desktop-shaped host (switchboard `run` + connect `serve`).\n */\n\nexport const kind = \"compound\";\n\nexport const hostSchema = genericCompoundHostSchema;\nexport const declaredHostSchema = declaredGenericCompoundHostSchema;\n\nasync function startAt(\n host: HostDefinition,\n ctx: RunnerContext,\n memberVerb: string,\n): Promise<RunCompoundResult> {\n return runCompound(\n host,\n { ...ctx, verb: memberVerb },\n {\n projectName: readProjectName(ctx.projectRoot),\n stopStream: stopStreamOf(process.env, () => process.stdin),\n },\n );\n}\n\nexport async function run(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<RunCompoundResult> {\n return startAt(host, ctx, compoundStartVerb(\"run\", host.runner));\n}\n\nexport async function dev(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<RunCompoundResult> {\n return startAt(host, ctx, \"dev\");\n}\n\nexport async function build(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<RunCompoundResult> {\n return startAt(host, ctx, \"build\");\n}\n\nexport async function serve(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<RunCompoundResult> {\n return startAt(host, ctx, \"serve\");\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAa,OAAO;AAEpB,MAAa,aAAa;AAC1B,MAAa,qBAAqB;AAElC,eAAe,QACb,MACA,KACA,YAC4B;CAC5B,OAAO,YACL,MACA;EAAE,GAAG;EAAK,MAAM;CAAW,GAC3B;EACE,aAAa,gBAAgB,IAAI,WAAW;EAC5C,YAAY,aAAa,QAAQ,WAAW,QAAQ,KAAK;CAC3D,CACF;AACF;AAEA,eAAsB,IACpB,MACA,KAC4B;CAC5B,OAAO,QAAQ,MAAM,KAAK,kBAAkB,OAAO,KAAK,MAAM,CAAC;AACjE;AAEA,eAAsB,IACpB,MACA,KAC4B;CAC5B,OAAO,QAAQ,MAAM,KAAK,KAAK;AACjC;AAEA,eAAsB,MACpB,MACA,KAC4B;CAC5B,OAAO,QAAQ,MAAM,KAAK,OAAO;AACnC;AAEA,eAAsB,MACpB,MACA,KAC4B;CAC5B,OAAO,QAAQ,MAAM,KAAK,OAAO;AACnC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { $ as MapToken, A as declaredHostSchemas, B as reactorBackendSchema, C as RunnerKind, Ct as tokenKeyOf, D as compoundWiringSchema, E as compoundHostSchema, F as hostNameSchema, G as refineStartOrder, H as reactorProtocolSchema, I as makeHostSchemas, J as ArrayMapToken, K as runnerBaseSchema, L as placementKeyIssues, M as emitHostJsonSchema, N as emittedHostSchemas, O as connectReactorIssues, P as genericCompoundHostSchema, Q as KeyToken, R as profileSchema, S as RunnerBase, St as ref, T as childrenSchema, Tt as tokenable, U as reactorSchema, V as reactorHostSchema, W as refineConnectReactor, X as EnvToken, Y as ConcatToken, Z as ItemToken, _ as ReactorHostInput, _t as isToken, a as CompoundWiring, at as TOKEN_KEYS, b as ReactorRemoteConfig, bt as mapTokenSchema, c as HOST_NAME_PATTERN, ct as TokenFor, d as PlacementKeyIssue, dt as TokenableSchema, et as OutputPath, f as Profile, ft as concatTokenSchema, g as ReactorHost, gt as forbidRef, h as ReactorConfig, ht as findToken, i as CompoundHostInput, it as TOKEN_ESCAPE_KEY, j as defineHostSchemas, k as declaredGenericCompoundHostSchema, l as HostDefinition, lt as TokenKey, m as ReactorBackendKind, mt as envTokenable, n as ChildWrapper, nt as RecordMapToken, o as HOST_NAME_MAX_LENGTH, ot as Template, p as ReactorBackend, pt as envTokenSchema, q as runnerKindSchema, r as CompoundHost, rt as RefFn, s as HOST_NAME_MESSAGE, st as Token, t as CONNECT_PRIMARY_MESSAGE, tt as OutputToken, u as HostSchemas, ut as TokenMode, v as ReactorPackageConfig, vt as itemTokenSchema, w as childWrapperSchema, wt as tokenSchema, x as ReactorStorageConfig, xt as outputTokenSchema, y as ReactorProtocol, yt as keyTokenSchema, z as reactorBackendKindSchema } from "./host-schemas-BM7F21lf.mjs";
|
|
2
|
+
import { D as PHHostOutputs, E as PHHost, O as PluginEntry, c as PluginEntryData, v as pluginEntryObjectSchema, y as pluginEntrySchema } from "./plugins-Uk84BRay.mjs";
|
|
3
|
+
import { n as substituteBuiltinEnv, t as BuiltinEnv } from "./env-substitution-C_fVirPh.mjs";
|
|
4
|
+
import { SwitchboardDrive, driveAddressMessage, switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/host-export-schema.d.ts
|
|
7
|
+
/** `ph host export`: a declared host plus its members, keyed by folder. */
|
|
8
|
+
export declare const hostExportSchema: z.ZodObject<{
|
|
9
|
+
format: z.ZodLiteral<"ph-host-export">;
|
|
10
|
+
version: z.ZodLiteral<1>;
|
|
11
|
+
project: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
root: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
host: z.ZodCustom<HostDefinition, HostDefinition>;
|
|
17
|
+
members: z.ZodRecord<z.ZodString, z.ZodCustom<HostDefinition, HostDefinition>>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
type HostExport = z.input<typeof hostExportSchema>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/drive-schema.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The schema half of drives.ts, zod only so `./schema` stays neutral.
|
|
24
|
+
* - slug: the SEEDING KEY (idempotence); id optional (stable identity).
|
|
25
|
+
* - preferredEditor: stored at header.meta.preferredEditor; Connect config's
|
|
26
|
+
* `app` is the legacy alias.
|
|
27
|
+
* - remote.url: a drive served elsewhere; local fields are ignored for it.
|
|
28
|
+
* Token-able (`$output` on a producer's `drives.<slug>.url`).
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildDriveDeclarationSchema(urlField: (schema: z.ZodString) => TokenableSchema<z.ZodString>): z.ZodObject<{
|
|
31
|
+
slug: z.ZodString;
|
|
32
|
+
id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
projectHash: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"id">]>>;
|
|
34
|
+
documentType: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
"powerhouse/document-drive": "powerhouse/document-drive";
|
|
36
|
+
"powerhouse/reactor-drive": "powerhouse/reactor-drive";
|
|
37
|
+
}>>;
|
|
38
|
+
name: z.ZodOptional<z.ZodString>;
|
|
39
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
40
|
+
preferredEditor: z.ZodOptional<z.ZodString>;
|
|
41
|
+
sharingType: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
private: "private";
|
|
43
|
+
public: "public";
|
|
44
|
+
shared: "shared";
|
|
45
|
+
}>>;
|
|
46
|
+
availableOffline: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
remote: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
url: TokenableSchema<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const driveDeclarationSchema: z.ZodObject<{
|
|
52
|
+
slug: z.ZodString;
|
|
53
|
+
id: z.ZodOptional<z.ZodString>;
|
|
54
|
+
projectHash: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"id">]>>;
|
|
55
|
+
documentType: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
"powerhouse/document-drive": "powerhouse/document-drive";
|
|
57
|
+
"powerhouse/reactor-drive": "powerhouse/reactor-drive";
|
|
58
|
+
}>>;
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
61
|
+
preferredEditor: z.ZodOptional<z.ZodString>;
|
|
62
|
+
sharingType: z.ZodOptional<z.ZodEnum<{
|
|
63
|
+
private: "private";
|
|
64
|
+
public: "public";
|
|
65
|
+
shared: "shared";
|
|
66
|
+
}>>;
|
|
67
|
+
availableOffline: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
remote: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
url: TokenableSchema<z.ZodString>;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
type DriveDeclaration = z.infer<typeof driveDeclarationSchema>;
|
|
73
|
+
export declare const drivesSchema: z.ZodArray<z.ZodObject<{
|
|
74
|
+
slug: z.ZodString;
|
|
75
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
|
+
projectHash: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"id">]>>;
|
|
77
|
+
documentType: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
"powerhouse/document-drive": "powerhouse/document-drive";
|
|
79
|
+
"powerhouse/reactor-drive": "powerhouse/reactor-drive";
|
|
80
|
+
}>>;
|
|
81
|
+
name: z.ZodOptional<z.ZodString>;
|
|
82
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
83
|
+
preferredEditor: z.ZodOptional<z.ZodString>;
|
|
84
|
+
sharingType: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
private: "private";
|
|
86
|
+
public: "public";
|
|
87
|
+
shared: "shared";
|
|
88
|
+
}>>;
|
|
89
|
+
availableOffline: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
remote: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
url: TokenableSchema<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
/** The project-hashed drive id (`${slug}-${sha256(projectRoot)[0..8]}`) with
|
|
95
|
+
* the hash function injected, so neutral consumers (a browser monitor) can
|
|
96
|
+
* pass `crypto.subtle`-derived or precomputed hex. drives.ts binds it to
|
|
97
|
+
* node:crypto as `projectDriveId`. */
|
|
98
|
+
export declare function projectDriveIdWith(sha256Hex: (input: string) => string, projectRoot: string, slug: string): string;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/runner-handle.d.ts
|
|
101
|
+
/**
|
|
102
|
+
* What a server verb returns to its supervisor (typed-host-configs 3.1/3.6):
|
|
103
|
+
* `RunnerHandle<O>`. Consumers read a started host only through `outputs`
|
|
104
|
+
* (and `$output` tokens over them). A verb that returns nothing (one-shot,
|
|
105
|
+
* or self-sustaining) is an empty handle.
|
|
106
|
+
*/
|
|
107
|
+
interface RunnerHandle<O = Record<string, unknown>> {
|
|
108
|
+
outputs: O;
|
|
109
|
+
/** Resolves when the member is serving. */
|
|
110
|
+
ready: Promise<void>;
|
|
111
|
+
/** Reverse-order compound teardown (and standalone signal handling). */
|
|
112
|
+
shutdown(): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
/** The data half of a handle, validated by the compound. `ready`/`shutdown`
|
|
115
|
+
* are functions and promises, so they are checked as TS fields, not here. */
|
|
116
|
+
export declare const runnerHandleSchema: z.ZodObject<{
|
|
117
|
+
outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
118
|
+
}, z.core.$loose>;
|
|
119
|
+
type RunnerHandleData = z.infer<typeof runnerHandleSchema>;
|
|
120
|
+
/** A verb's return value, normalized: validated data plus the live fields
|
|
121
|
+
* when present. */
|
|
122
|
+
interface StartedHandle extends RunnerHandleData {
|
|
123
|
+
outputs: Record<string, unknown>;
|
|
124
|
+
ready?: PromiseLike<unknown>;
|
|
125
|
+
shutdown?: () => unknown;
|
|
126
|
+
}
|
|
127
|
+
/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)
|
|
128
|
+
* is an empty handle; anything else must match runnerHandleSchema. */
|
|
129
|
+
export declare function toStartedHandle(value: unknown, where: string): StartedHandle;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/host-issues.d.ts
|
|
132
|
+
/** Where in the `ph run` pipeline a host check found an issue. */
|
|
133
|
+
type CheckStage = "load" | "declared" | "resolve" | "resolved" | "boot";
|
|
134
|
+
interface HostIssue {
|
|
135
|
+
stage: CheckStage;
|
|
136
|
+
/** A compound's issues come from its members' files too. */
|
|
137
|
+
file: string;
|
|
138
|
+
/** Empty when the issue concerns the file as a whole. */
|
|
139
|
+
path: string;
|
|
140
|
+
message: string;
|
|
141
|
+
hint?: string;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { type ArrayMapToken, type BuiltinEnv, CONNECT_PRIMARY_MESSAGE, type CheckStage, type ChildWrapper, type CompoundHost, type CompoundHostInput, type CompoundWiring, type ConcatToken, type DriveDeclaration, type EnvToken, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, type HostDefinition, type HostExport, type HostIssue, type HostSchemas, type ItemToken, type KeyToken, type MapToken, type OutputPath, type OutputToken, type PHHost, type PHHostOutputs, type PlacementKeyIssue, type PluginEntry, type PluginEntryData, type Profile, type ReactorBackend, type ReactorBackendKind, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RunnerBase, type RunnerHandle, type RunnerHandleData, type RunnerKind, type StartedHandle, type SwitchboardDrive, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenableSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, connectReactorIssues, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, hostNameSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, placementKeyIssues, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineConnectReactor, refineStartOrder, runnerBaseSchema, runnerKindSchema, substituteBuiltinEnv, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable };
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=schema.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.mts","names":[],"sources":["../src/host-export-schema.ts","../src/drive-schema.ts","../src/runner-handle.ts","../src/host-issues.ts"],"mappings":";;;;;;;qBAoCa,kBAAgB,EAAA;;;;;;;;;;GAuCzB,EAAA,KAAA;KAEQ,aAAa,EAAE,aAAa;;;;;;;;;;;wBClExB,4BACd,WAAW,QAAQ,EAAE,cAAc,gBAAgB,EAAE,aAAU,EAAA;;;;;;;;;;;;;;;;;;;;GAsBhE,EAAA,KAAA;qBAEY,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;GAAyC,EAAA,KAAA;KAEhE,mBAAmB,EAAE,aAAa;qBAEjC,cAAY,EAAA,SAAA,EAAA;;;;;;;;;;;;;;;;;;;;GAAkC,EAAA,KAAA;;;;;wBAM3C,mBACd,YAAY,0BACZ,qBACA;;;;;;;;;UCzCe,aAAa,IAAI;EAChC,SAAS;;EAET,OAAO;;EAEP,YAAY;;;;qBAKD,oBAAkB,EAAA;;GAE7B,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;UAI7B,sBAAsB;EACrC,SAAS;EACT,QAAQ;EACR;;;;wBAiBc,gBAAgB,gBAAgB,gBAAgB;;;;KC7CpD;UAEK;EACf,OAAO;;EAEP;;EAEA;EACA;EACA"}
|
package/dist/schema.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { A as runnerKindSchema, B as findToken, C as reactorBackendSchema, D as refineConnectReactor, E as reactorSchema, F as TOKEN_ESCAPE_KEY, G as mapTokenSchema, H as isToken, I as TOKEN_KEYS, J as tokenKeyOf, K as outputTokenSchema, L as concatTokenSchema, M as driveDeclarationSchema, N as drivesSchema, O as refineStartOrder, P as projectDriveIdWith, R as envTokenSchema, S as reactorBackendKindSchema, T as reactorProtocolSchema, U as itemTokenSchema, V as forbidRef, W as keyTokenSchema, X as tokenable, Y as tokenSchema, _ as genericCompoundHostSchema, a as HOST_NAME_MESSAGE, b as placementKeyIssues, c as childrenSchema, d as connectReactorIssues, f as declaredGenericCompoundHostSchema, g as emittedHostSchemas, h as emitHostJsonSchema, i as HOST_NAME_MAX_LENGTH, j as buildDriveDeclarationSchema, k as runnerBaseSchema, l as compoundHostSchema, m as defineHostSchemas, n as substituteBuiltinEnv, o as HOST_NAME_PATTERN, p as declaredHostSchemas, q as ref, r as CONNECT_PRIMARY_MESSAGE, s as childWrapperSchema, u as compoundWiringSchema, v as hostNameSchema, w as reactorHostSchema, x as profileSchema, y as makeHostSchemas, z as envTokenable } from "./env-substitution-BXGohOGN.mjs";
|
|
2
|
+
import { pluginEntryObjectSchema, pluginEntrySchema } from "./plugins.mjs";
|
|
3
|
+
import { driveAddressMessage, switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/host-export-schema.ts
|
|
6
|
+
function isRecord$1(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function childFolders(host) {
|
|
10
|
+
if (!isRecord$1(host) || !isRecord$1(host.children)) return [];
|
|
11
|
+
return Object.entries(host.children).flatMap(([key, child]) => isRecord$1(child) && typeof child.host === "string" ? [[key, child.host]] : []);
|
|
12
|
+
}
|
|
13
|
+
const declaredHostSchema = z.custom().superRefine((host, ctx) => {
|
|
14
|
+
const result = (isRecord$1(host) && "children" in host ? declaredHostSchemas.compoundHostSchema : declaredHostSchemas.reactorHostSchema).safeParse(host);
|
|
15
|
+
if (result.success) return;
|
|
16
|
+
for (const issue of result.error.issues) ctx.addIssue({
|
|
17
|
+
code: "custom",
|
|
18
|
+
message: issue.message,
|
|
19
|
+
path: issue.path
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
/** `ph host export`: a declared host plus its members, keyed by folder. */
|
|
23
|
+
const hostExportSchema = z.strictObject({
|
|
24
|
+
format: z.literal("ph-host-export"),
|
|
25
|
+
version: z.literal(1),
|
|
26
|
+
project: z.strictObject({
|
|
27
|
+
name: z.string().min(1),
|
|
28
|
+
root: z.string().min(1)
|
|
29
|
+
}),
|
|
30
|
+
name: z.string().min(1),
|
|
31
|
+
host: declaredHostSchema,
|
|
32
|
+
members: z.record(z.string(), declaredHostSchema)
|
|
33
|
+
}).superRefine((value, ctx) => {
|
|
34
|
+
const reached = /* @__PURE__ */ new Set();
|
|
35
|
+
const pending = [[["host"], value.host]];
|
|
36
|
+
for (let next = pending.shift(); next; next = pending.shift()) {
|
|
37
|
+
const [at, host] = next;
|
|
38
|
+
for (const [key, folder] of childFolders(host)) {
|
|
39
|
+
if (!(folder in value.members)) {
|
|
40
|
+
ctx.addIssue({
|
|
41
|
+
code: "custom",
|
|
42
|
+
path: [
|
|
43
|
+
...at,
|
|
44
|
+
"children",
|
|
45
|
+
key,
|
|
46
|
+
"host"
|
|
47
|
+
],
|
|
48
|
+
message: `Member folder "${folder}" is missing from members.`
|
|
49
|
+
});
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (reached.has(folder)) continue;
|
|
53
|
+
reached.add(folder);
|
|
54
|
+
pending.push([["members", folder], value.members[folder]]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const folder of Object.keys(value.members)) {
|
|
58
|
+
if (reached.has(folder)) continue;
|
|
59
|
+
ctx.addIssue({
|
|
60
|
+
code: "custom",
|
|
61
|
+
path: ["members", folder],
|
|
62
|
+
message: `Member "${folder}" is not reached from the host's children.`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/runner-handle.ts
|
|
68
|
+
/** The data half of a handle, validated by the compound. `ready`/`shutdown`
|
|
69
|
+
* are functions and promises, so they are checked as TS fields, not here. */
|
|
70
|
+
const runnerHandleSchema = z.looseObject({ outputs: z.record(z.string(), z.unknown()).optional() });
|
|
71
|
+
function isRecord(value) {
|
|
72
|
+
return typeof value === "object" && value !== null;
|
|
73
|
+
}
|
|
74
|
+
function isPromiseLike(value) {
|
|
75
|
+
return isRecord(value) && typeof value.then === "function";
|
|
76
|
+
}
|
|
77
|
+
function isCallable(value) {
|
|
78
|
+
return typeof value === "function";
|
|
79
|
+
}
|
|
80
|
+
/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)
|
|
81
|
+
* is an empty handle; anything else must match runnerHandleSchema. */
|
|
82
|
+
function toStartedHandle(value, where) {
|
|
83
|
+
if (value === void 0 || value === null) return { outputs: {} };
|
|
84
|
+
const parsed = runnerHandleSchema.safeParse(value);
|
|
85
|
+
if (!parsed.success) throw new Error(`${where} returned an invalid runner handle:\n${z.prettifyError(parsed.error)}`);
|
|
86
|
+
const live = isRecord(value) ? value : {};
|
|
87
|
+
const shutdown = live.shutdown;
|
|
88
|
+
return {
|
|
89
|
+
...parsed.data,
|
|
90
|
+
outputs: parsed.data.outputs ?? {},
|
|
91
|
+
...isPromiseLike(live.ready) ? { ready: live.ready } : {},
|
|
92
|
+
...isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { CONNECT_PRIMARY_MESSAGE, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, TOKEN_ESCAPE_KEY, TOKEN_KEYS, buildDriveDeclarationSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, connectReactorIssues, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, driveDeclarationSchema, drivesSchema, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, hostExportSchema, hostNameSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, placementKeyIssues, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, projectDriveIdWith, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineConnectReactor, refineStartOrder, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, substituteBuiltinEnv, switchboardOfDrive, toStartedHandle, tokenKeyOf, tokenSchema, tokenable };
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":["isRecord"],"sources":["../src/host-export-schema.ts","../src/runner-handle.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { declaredHostSchemas, type HostDefinition } from \"./host-schemas.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction childFolders(host: unknown): [key: string, folder: string][] {\n if (!isRecord(host) || !isRecord(host.children)) return [];\n return Object.entries(host.children).flatMap(([key, child]) =>\n isRecord(child) && typeof child.host === \"string\"\n ? [[key, child.host] as [string, string]]\n : [],\n );\n}\n\n// Picked by structure, as the loader does, so issues name the field.\nconst declaredHostSchema = z\n .custom<HostDefinition>()\n .superRefine((host, ctx) => {\n const schema =\n isRecord(host) && \"children\" in host\n ? declaredHostSchemas.compoundHostSchema\n : declaredHostSchemas.reactorHostSchema;\n const result = schema.safeParse(host);\n if (result.success) return;\n for (const issue of result.error.issues) {\n ctx.addIssue({\n code: \"custom\",\n message: issue.message,\n path: issue.path,\n });\n }\n });\n\n/** `ph host export`: a declared host plus its members, keyed by folder. */\nexport const hostExportSchema = z\n .strictObject({\n format: z.literal(\"ph-host-export\"),\n version: z.literal(1),\n project: z.strictObject({\n name: z.string().min(1),\n root: z.string().min(1),\n }),\n name: z.string().min(1),\n host: declaredHostSchema,\n members: z.record(z.string(), declaredHostSchema),\n })\n .superRefine((value, ctx) => {\n const reached = new Set<string>();\n const pending: [at: string[], host: unknown][] = [[[\"host\"], value.host]];\n for (let next = pending.shift(); next; next = pending.shift()) {\n const [at, host] = next;\n for (const [key, folder] of childFolders(host)) {\n if (!(folder in value.members)) {\n ctx.addIssue({\n code: \"custom\",\n path: [...at, \"children\", key, \"host\"],\n message: `Member folder \"${folder}\" is missing from members.`,\n });\n continue;\n }\n if (reached.has(folder)) continue;\n reached.add(folder);\n pending.push([[\"members\", folder], value.members[folder]]);\n }\n }\n for (const folder of Object.keys(value.members)) {\n if (reached.has(folder)) continue;\n ctx.addIssue({\n code: \"custom\",\n path: [\"members\", folder],\n message: `Member \"${folder}\" is not reached from the host's children.`,\n });\n }\n });\n\nexport type HostExport = z.input<typeof hostExportSchema>;\n","import { z } from \"zod\";\n\n/**\n * What a server verb returns to its supervisor (typed-host-configs 3.1/3.6):\n * `RunnerHandle<O>`. Consumers read a started host only through `outputs`\n * (and `$output` tokens over them). A verb that returns nothing (one-shot,\n * or self-sustaining) is an empty handle.\n */\nexport interface RunnerHandle<O = Record<string, unknown>> {\n outputs: O;\n /** Resolves when the member is serving. */\n ready: Promise<void>;\n /** Reverse-order compound teardown (and standalone signal handling). */\n shutdown(): Promise<void>;\n}\n\n/** The data half of a handle, validated by the compound. `ready`/`shutdown`\n * are functions and promises, so they are checked as TS fields, not here. */\nexport const runnerHandleSchema = z.looseObject({\n outputs: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type RunnerHandleData = z.infer<typeof runnerHandleSchema>;\n\n/** A verb's return value, normalized: validated data plus the live fields\n * when present. */\nexport interface StartedHandle extends RunnerHandleData {\n outputs: Record<string, unknown>;\n ready?: PromiseLike<unknown>;\n shutdown?: () => unknown;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return isRecord(value) && typeof value.then === \"function\";\n}\n\nfunction isCallable(value: unknown): value is (this: unknown) => unknown {\n return typeof value === \"function\";\n}\n\n/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)\n * is an empty handle; anything else must match runnerHandleSchema. */\nexport function toStartedHandle(value: unknown, where: string): StartedHandle {\n if (value === undefined || value === null) return { outputs: {} };\n const parsed = runnerHandleSchema.safeParse(value);\n if (!parsed.success) {\n throw new Error(\n `${where} returned an invalid runner handle:\\n${z.prettifyError(parsed.error)}`,\n );\n }\n const live = isRecord(value) ? value : {};\n const shutdown = live.shutdown;\n return {\n ...parsed.data,\n outputs: parsed.data.outputs ?? {},\n ...(isPromiseLike(live.ready) ? { ready: live.ready } : {}),\n ...(isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}),\n };\n}\n"],"mappings":"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"}
|