@powerhousedao/ph-run 0.0.0-stage → 6.2.3-dev.89
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/classic-args-BYccyIIC.mjs +33 -0
- package/dist/classic-args-BYccyIIC.mjs.map +1 -0
- package/dist/classic-args-Dm0_3O5p.d.mts +194 -0
- package/dist/classic-args-Dm0_3O5p.d.mts.map +1 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +29 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/connect-plugin-configs-CPRA8hQJ.mjs +47 -0
- package/dist/connect-plugin-configs-CPRA8hQJ.mjs.map +1 -0
- package/dist/connect-serve-0fIQ7xCs.mjs +187 -0
- package/dist/connect-serve-0fIQ7xCs.mjs.map +1 -0
- package/dist/connect-serve-B2u6WAdw.d.mts +62 -0
- package/dist/connect-serve-B2u6WAdw.d.mts.map +1 -0
- package/dist/member-config-BcEWRVq4.mjs +152 -0
- package/dist/member-config-BcEWRVq4.mjs.map +1 -0
- package/dist/runners/connect.d.mts +1263 -0
- package/dist/runners/connect.d.mts.map +1 -0
- package/dist/runners/connect.mjs +268 -0
- package/dist/runners/connect.mjs.map +1 -0
- package/dist/runners/member-config.d.mts +786 -0
- package/dist/runners/member-config.d.mts.map +1 -0
- package/dist/runners/member-config.mjs +2 -0
- package/dist/runners/switchboard.d.mts +1736 -0
- package/dist/runners/switchboard.d.mts.map +1 -0
- package/dist/runners/switchboard.mjs +704 -0
- package/dist/runners/switchboard.mjs.map +1 -0
- package/dist/services/classic-args.d.mts +3 -0
- package/dist/services/classic-args.mjs +2 -0
- package/dist/services/connect-serve.d.mts +3 -0
- package/dist/services/connect-serve.mjs +2 -0
- package/dist/services/connect-server.d.mts +26 -0
- package/dist/services/connect-server.d.mts.map +1 -0
- package/dist/services/connect-server.mjs +215 -0
- package/dist/services/connect-server.mjs.map +1 -0
- package/dist/services/run/start-run.d.mts +29 -0
- package/dist/services/run/start-run.d.mts.map +1 -0
- package/dist/services/run/start-run.mjs +2 -0
- package/dist/services/switchboard.d.mts +79 -0
- package/dist/services/switchboard.d.mts.map +1 -0
- package/dist/services/switchboard.mjs +188 -0
- package/dist/services/switchboard.mjs.map +1 -0
- package/dist/start-run-DWn2cVyi.mjs +122 -0
- package/dist/start-run-DWn2cVyi.mjs.map +1 -0
- package/dist/superseded-config-CpHrCuNq.mjs +50 -0
- package/dist/superseded-config-CpHrCuNq.mjs.map +1 -0
- package/package.json +93 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;;;;qBAuCa;qBA0CA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B,EAAA,KAAA;qBAC/C,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AQS,UACpB,OAAO,oBACP,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa;;;wBAmCF,MACpB,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa;;qBAMX,YAAG;qBAEH"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { defineHostSchemas, entryActiveForVerb, findDeadConnectConfig, isStructuralMultiReactor, mergeDefaultDrives, normalizePluginEntries, placeConnectDrives, projectDrivesIntoConnect, projectReactorToConnect, refineConnectReactor, remoteBackendUrls, resolveDriveDeclaration } from "@powerhousedao/host-core";
|
|
2
|
+
import { DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
|
|
3
|
+
import { connectConfigSchemaWith } from "@powerhousedao/shared/connect/connect-config-schema";
|
|
4
|
+
import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
|
|
5
|
+
import { withOriginPlaceholders } from "@powerhousedao/shared/connect/origin-placeholder";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/runners/connect.ts
|
|
8
|
+
/**
|
|
9
|
+
* BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a
|
|
10
|
+
* hosts/connect/host.js definition onto the SAME service the classic
|
|
11
|
+
* `ph connect studio` (dev/run), `ph connect build` and `ph connect preview`
|
|
12
|
+
* (serve) commands call — no forked behavior.
|
|
13
|
+
*/
|
|
14
|
+
const kind = "reactor";
|
|
15
|
+
/** The connect host: the host-core reactor host with every runner option
|
|
16
|
+
* this module reads declared (strict: an unknown runner key fails), and
|
|
17
|
+
* `config` typed by Connect's own zod schema (the authored `connect` block),
|
|
18
|
+
* whose URL fields that name another host's outputs
|
|
19
|
+
* (`drives.defaultDrives[].url`, `renown.switchboardUrl`) are token-able.
|
|
20
|
+
* One definition, two schemas: `declaredHostSchema` (token-able fields take
|
|
21
|
+
* output tokens; types host files) and `hostSchema` (resolved; checked
|
|
22
|
+
* right before the verb). */
|
|
23
|
+
const schemas = defineHostSchemas((s) => s.reactorHostSchema.extend({
|
|
24
|
+
runner: s.runnerBaseSchema.extend({
|
|
25
|
+
/** Open a browser tab once listening (dev/serve). */
|
|
26
|
+
openBrowser: z.boolean().optional(),
|
|
27
|
+
/** Fail instead of moving to the next free port when `port` is taken. */
|
|
28
|
+
strictPort: z.boolean().optional(),
|
|
29
|
+
/** The Connect build output dir (`build` writes it, `serve` serves it). */
|
|
30
|
+
outDir: z.string().min(1).optional(),
|
|
31
|
+
/** Patch the baked CSP for the runtime registry (`serve`); a
|
|
32
|
+
* compound's wiring sets it on its connect member. */
|
|
33
|
+
cspRegistrySync: z.boolean().optional(),
|
|
34
|
+
/** The host's routes folder, project-relative; false for none.
|
|
35
|
+
* Default: hosts/connect/routes. */
|
|
36
|
+
routes: z.union([z.string(), z.literal(false)]).optional(),
|
|
37
|
+
/** The switchboard this Connect is served next to: its server
|
|
38
|
+
* (dev and serve) proxies the switchboard's paths (`/graphql`,
|
|
39
|
+
* `/d/*`, `/attachments`, `/mcp`, `/api/*`) to `target`, and the
|
|
40
|
+
* served config names that switchboard as `${origin}`, resolved by
|
|
41
|
+
* the browser against the page's origin. So one config holds from
|
|
42
|
+
* the developer's `localhost` and from a published site alike, with
|
|
43
|
+
* every call on the page's own origin. Typically a sibling's
|
|
44
|
+
* `origin` output token. */
|
|
45
|
+
proxy: z.strictObject({ target: s.tokenable(z.url()) }).optional()
|
|
46
|
+
}).strict(),
|
|
47
|
+
config: connectConfigSchemaWith(s.tokenable).optional()
|
|
48
|
+
}).superRefine(refineConnectReactor));
|
|
49
|
+
const declaredHostSchema = schemas.declaredHostSchema;
|
|
50
|
+
const hostSchema = schemas.hostSchema;
|
|
51
|
+
/** What a started Connect (`dev`/`run`/`serve`) produces: the origin it
|
|
52
|
+
* actually listens on and the app URL (origin plus base path). */
|
|
53
|
+
const outputsSchema = z.strictObject({
|
|
54
|
+
origin: z.url(),
|
|
55
|
+
endpoints: z.strictObject({ connect: z.url() })
|
|
56
|
+
});
|
|
57
|
+
/** A started Connect as a runner handle. vite has already listened when the
|
|
58
|
+
* service returns, so `ready` is settled; the outputs carry the URL vite
|
|
59
|
+
* resolved (the port it actually bound), falling back to the requested one. */
|
|
60
|
+
function connectHandle(server, requested) {
|
|
61
|
+
const fallback = `http://${requested.host}:${requested.port}/`;
|
|
62
|
+
const app = server.resolvedUrls?.local[0] ?? fallback;
|
|
63
|
+
let closing;
|
|
64
|
+
return {
|
|
65
|
+
outputs: outputsSchema.parse({
|
|
66
|
+
origin: new URL(app).origin,
|
|
67
|
+
endpoints: { connect: app }
|
|
68
|
+
}),
|
|
69
|
+
ready: Promise.resolve(),
|
|
70
|
+
shutdown: () => closing ??= server.close()
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** host.js reactor.drives -> the served drives.defaultDrives shapes: locals
|
|
74
|
+
* carry id/name/icon and the preferredEditor under its Connect alias `app`;
|
|
75
|
+
* remotes carry their URL. */
|
|
76
|
+
function declaredDrivesToDefaults(projectRoot, declarations) {
|
|
77
|
+
return declarations.map((declaration) => {
|
|
78
|
+
const drive = resolveDriveDeclaration(projectRoot, declaration);
|
|
79
|
+
if (drive.kind === "remote") return {
|
|
80
|
+
url: drive.remoteUrl,
|
|
81
|
+
name: drive.name,
|
|
82
|
+
icon: drive.icon ?? null
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
local: true,
|
|
86
|
+
id: drive.id ?? drive.slug,
|
|
87
|
+
name: drive.name,
|
|
88
|
+
icon: drive.icon ?? null,
|
|
89
|
+
...drive.preferredEditor ? { app: drive.preferredEditor } : {}
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The served override. With `runner.proxy`, every URL on the proxied
|
|
95
|
+
* switchboard's origin (drives, backends, plugin configs, however they were
|
|
96
|
+
* written or resolved from output tokens) is served as `${origin}…`: the
|
|
97
|
+
* browser reaches the switchboard through the page's own origin, which this
|
|
98
|
+
* Connect's server proxies, so the config holds wherever the page is loaded
|
|
99
|
+
* from. A host may also write `${origin}/…` itself; that passes through.
|
|
100
|
+
*/
|
|
101
|
+
function callerOverride(host, ctx, verb = "dev") {
|
|
102
|
+
const override = callerOverrideRaw(host, ctx, verb);
|
|
103
|
+
const target = host.runner.proxy?.target;
|
|
104
|
+
return override && target ? withOriginPlaceholders(override, target) : override;
|
|
105
|
+
}
|
|
106
|
+
function callerOverrideRaw(host, ctx, verb = "dev") {
|
|
107
|
+
const base = { ...host.config };
|
|
108
|
+
const reactor = host.reactor;
|
|
109
|
+
const renownUrl = ctx?.env.RENOWN_URL?.trim();
|
|
110
|
+
const renownSwitchboardUrl = ctx?.env.SWITCHBOARD_URL?.trim();
|
|
111
|
+
if (renownUrl || renownSwitchboardUrl) base.renown = {
|
|
112
|
+
...base.renown,
|
|
113
|
+
...renownUrl ? { url: renownUrl } : {},
|
|
114
|
+
...renownSwitchboardUrl ? { switchboardUrl: renownSwitchboardUrl } : {}
|
|
115
|
+
};
|
|
116
|
+
const entries = host.runner.plugins;
|
|
117
|
+
const composition = entries === void 0 ? void 0 : normalizePluginEntries(entries, `hosts/${host.name}/host.js`).filter((entry) => entryActiveForVerb(entry, verb)).map((entry) => ({
|
|
118
|
+
module: entry.module,
|
|
119
|
+
config: entry.config
|
|
120
|
+
}));
|
|
121
|
+
if (entries !== void 0) {
|
|
122
|
+
const all = normalizePluginEntries(entries, `hosts/${host.name}/host.js`);
|
|
123
|
+
console.log(`[connect] composition plan (verb=${verb}): ${composition?.length ?? 0} active of ${all.length} declared`);
|
|
124
|
+
for (const entry of all) {
|
|
125
|
+
const active = entryActiveForVerb(entry, verb);
|
|
126
|
+
const scope = entry.verbs === "*" ? "" : ` verbs=[${entry.verbs.join(",")}]`;
|
|
127
|
+
const cfg = Object.keys(entry.config);
|
|
128
|
+
console.log(`[connect] ${active ? "•" : "○"} ${entry.module}${scope}` + (cfg.length ? ` config: {${cfg.join(", ")}}` : "") + (active ? "" : " (inactive for this verb)"));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const warning of findDeadConnectConfig(host.config, entries, verb, `hosts/${host.name}/host.js`)) console.warn(warning.message);
|
|
132
|
+
const declared = reactor?.drives;
|
|
133
|
+
const declaredDefaults = declared && ctx ? declaredDrivesToDefaults(ctx.projectRoot, declared) : void 0;
|
|
134
|
+
const reactorRenown = reactor?.renown;
|
|
135
|
+
const reactorNamespace = reactor?.namespace;
|
|
136
|
+
base.drives = declaredDefaults ? {
|
|
137
|
+
...base.drives,
|
|
138
|
+
defaultDrives: mergeDefaultDrives(declaredDefaults, base.drives?.defaultDrives ?? []),
|
|
139
|
+
preserveStrategy: base.drives?.preserveStrategy ?? "preserve-all"
|
|
140
|
+
} : base.drives;
|
|
141
|
+
if (composition) base.composition = composition;
|
|
142
|
+
if (reactorRenown) base.renown = {
|
|
143
|
+
...reactorRenown,
|
|
144
|
+
...base.renown
|
|
145
|
+
};
|
|
146
|
+
if (reactorNamespace !== void 0) base.instance = {
|
|
147
|
+
...base.instance,
|
|
148
|
+
namespace: base.instance?.namespace ?? reactorNamespace
|
|
149
|
+
};
|
|
150
|
+
const { connect } = projectReactorToConnect(reactor);
|
|
151
|
+
const structural = isStructuralMultiReactor(reactor);
|
|
152
|
+
if (!connect.reactor && !connect.instance && !connect.app && !structural) return host.config !== void 0 || composition || declaredDefaults ? base : void 0;
|
|
153
|
+
const projected = structural ? projectDrivesIntoConnect({
|
|
154
|
+
createdDriveUrls: remoteBackendUrls(reactor),
|
|
155
|
+
configuredDefaultDrives: base.drives?.defaultDrives
|
|
156
|
+
}).drives : base.drives;
|
|
157
|
+
const placed = placeConnectDrives(reactor, projected?.defaultDrives ?? []);
|
|
158
|
+
const drives = projected?.defaultDrives === void 0 ? projected : {
|
|
159
|
+
...projected,
|
|
160
|
+
defaultDrives: placed.defaultDrives
|
|
161
|
+
};
|
|
162
|
+
const instance = Object.keys(reactor?.backends ?? {}).length > 0 ? {
|
|
163
|
+
...base.instance,
|
|
164
|
+
...connect.instance,
|
|
165
|
+
...placed.collections ? { collections: placed.collections } : {}
|
|
166
|
+
} : {
|
|
167
|
+
...connect.instance,
|
|
168
|
+
...base.instance
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
...base,
|
|
172
|
+
reactor: {
|
|
173
|
+
...connect.reactor,
|
|
174
|
+
...base.reactor
|
|
175
|
+
},
|
|
176
|
+
instance,
|
|
177
|
+
app: {
|
|
178
|
+
...connect.app,
|
|
179
|
+
...base.app
|
|
180
|
+
},
|
|
181
|
+
...drives ? { drives: {
|
|
182
|
+
...base.drives,
|
|
183
|
+
...drives
|
|
184
|
+
} } : {}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Start a server; under a supervising compound (`ctx.parent`), drop the
|
|
189
|
+
* process-exiting signal listeners it installed (vite's dev and preview
|
|
190
|
+
* servers exit on SIGTERM): the compound owns the exit and stops members in
|
|
191
|
+
* reverse dependency order through their handles.
|
|
192
|
+
*/
|
|
193
|
+
async function startUnderSupervisor(ctx, start) {
|
|
194
|
+
if (!ctx.parent) return start();
|
|
195
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
196
|
+
const before = new Map(signals.map((signal) => [signal, new Set(process.listeners(signal))]));
|
|
197
|
+
try {
|
|
198
|
+
return await start();
|
|
199
|
+
} finally {
|
|
200
|
+
for (const signal of signals) for (const listener of process.listeners(signal)) if (!before.get(signal)?.has(listener)) process.off(signal, listener);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** Fail at `ph run`, naming the plugin and key, when a composed Connect
|
|
204
|
+
* plugin's entry config does not match its schema. */
|
|
205
|
+
async function validateComposition(host, ctx) {
|
|
206
|
+
const { validateConnectPluginConfigs } = await import("../connect-plugin-configs-CPRA8hQJ.mjs");
|
|
207
|
+
await validateConnectPluginConfigs(ctx.projectRoot, host.runner.plugins, ctx.verb, `hosts/${host.name}/host.js`);
|
|
208
|
+
}
|
|
209
|
+
/** A project file the build resolved: the built dist has it (as icon.ico or
|
|
210
|
+
* a data URI); served, its path would mean nothing. */
|
|
211
|
+
function isBuiltImage(ref) {
|
|
212
|
+
const src = typeof ref === "object" && ref !== null && "src" in ref ? ref.src : ref;
|
|
213
|
+
return typeof src === "string" && !isPassthroughImageRef(src);
|
|
214
|
+
}
|
|
215
|
+
function withoutBuiltImages(config) {
|
|
216
|
+
const branding = config?.branding;
|
|
217
|
+
if (!branding) return config;
|
|
218
|
+
const { favicon: _, ...served } = branding;
|
|
219
|
+
if (isBuiltImage(served.icon)) delete served.icon;
|
|
220
|
+
if (isBuiltImage(served.loader)) delete served.loader;
|
|
221
|
+
return {
|
|
222
|
+
...config,
|
|
223
|
+
branding: served
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** `serve` on a given server. The host's connect config (including a
|
|
227
|
+
* supervising compound's projected drives and the reactor projection) rides a
|
|
228
|
+
* serve override: the baked powerhouse.config.json merges with it at request
|
|
229
|
+
* time, and `runner.cspRegistrySync` (set by the compound's wiring) patches the
|
|
230
|
+
* baked CSP's script-src for the runtime registry. Together these replace the
|
|
231
|
+
* ph-win-desktop sidecar's hand-rolled static server (desktop shape). */
|
|
232
|
+
async function serveWith(start, host, ctx) {
|
|
233
|
+
await validateComposition(host, ctx);
|
|
234
|
+
const runner = host.runner;
|
|
235
|
+
const port = runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;
|
|
236
|
+
const bind = runner.host ?? "127.0.0.1";
|
|
237
|
+
const args = {
|
|
238
|
+
port,
|
|
239
|
+
outDir: runner.outDir ?? DEFAULT_CONNECT_OUTDIR,
|
|
240
|
+
open: runner.openBrowser === true,
|
|
241
|
+
strictPort: runner.strictPort === true,
|
|
242
|
+
cors: true,
|
|
243
|
+
printUrls: true,
|
|
244
|
+
bindCLIShortcuts: false,
|
|
245
|
+
host: bind
|
|
246
|
+
};
|
|
247
|
+
const override = withoutBuiltImages(callerOverride(host, ctx, ctx.verb));
|
|
248
|
+
return connectHandle(await startUnderSupervisor(ctx, () => start(args, {
|
|
249
|
+
connect: override,
|
|
250
|
+
cspRegistrySync: runner.cspRegistrySync === true
|
|
251
|
+
}, void 0, { proxy: runner.proxy?.target })), {
|
|
252
|
+
host: bind,
|
|
253
|
+
port
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/** Serves a built Connect (run `build` first) with nothing but what a running
|
|
257
|
+
* app has. ph-cli's runner adds the verbs that need build tools. */
|
|
258
|
+
async function serve(host, ctx) {
|
|
259
|
+
const { runConnectServer } = await import("../services/connect-server.mjs");
|
|
260
|
+
return serveWith(runConnectServer, host, ctx);
|
|
261
|
+
}
|
|
262
|
+
/** With no Studio here, running Connect is serving its build. */
|
|
263
|
+
const run = serve;
|
|
264
|
+
const verbs = ["run", "serve"];
|
|
265
|
+
//#endregion
|
|
266
|
+
export { callerOverride, connectHandle, declaredHostSchema, hostSchema, kind, outputsSchema, run, serve, serveWith, startUnderSupervisor, validateComposition, verbs, withoutBuiltImages };
|
|
267
|
+
|
|
268
|
+
//# sourceMappingURL=connect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.mjs","names":[],"sources":["../../src/runners/connect.ts"],"sourcesContent":["import {\n DEFAULT_CONNECT_OUTDIR,\n DEFAULT_CONNECT_STUDIO_PORT,\n type PHConnectCompositionEntry,\n type PHConnectDefaultDrive,\n type PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { connectConfigSchemaWith } from \"@powerhousedao/shared/connect/connect-config-schema\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport { withOriginPlaceholders } from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport {\n defineHostSchemas,\n entryActiveForVerb,\n findDeadConnectConfig,\n isStructuralMultiReactor,\n mergeDefaultDrives,\n normalizePluginEntries,\n placeConnectDrives,\n resolveDriveDeclaration,\n type DriveDeclaration,\n projectDrivesIntoConnect,\n projectReactorToConnect,\n refineConnectReactor,\n remoteBackendUrls,\n type ReactorConfig,\n type RunnerContext,\n type RunnerHandle,\n} from \"@powerhousedao/host-core\";\nimport { z } from \"zod\";\nimport type { ConnectPreviewArgs } from \"../services/classic-args.js\";\nimport type { ConnectServeOverride } from \"../services/connect-serve.js\";\n\n/**\n * BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a\n * hosts/connect/host.js definition onto the SAME service the classic\n * `ph connect studio` (dev/run), `ph connect build` and `ph connect preview`\n * (serve) commands call — no forked behavior.\n */\n\nexport const kind = \"reactor\";\n\n/** The connect host: the host-core reactor host with every runner option\n * this module reads declared (strict: an unknown runner key fails), and\n * `config` typed by Connect's own zod schema (the authored `connect` block),\n * whose URL fields that name another host's outputs\n * (`drives.defaultDrives[].url`, `renown.switchboardUrl`) are token-able.\n * One definition, two schemas: `declaredHostSchema` (token-able fields take\n * output tokens; types host files) and `hostSchema` (resolved; checked\n * right before the verb). */\nconst schemas = defineHostSchemas((s) =>\n s.reactorHostSchema\n .extend({\n runner: s.runnerBaseSchema\n .extend({\n /** Open a browser tab once listening (dev/serve). */\n openBrowser: z.boolean().optional(),\n /** Fail instead of moving to the next free port when `port` is taken. */\n strictPort: z.boolean().optional(),\n /** The Connect build output dir (`build` writes it, `serve` serves it). */\n outDir: z.string().min(1).optional(),\n /** Patch the baked CSP for the runtime registry (`serve`); a\n * compound's wiring sets it on its connect member. */\n cspRegistrySync: z.boolean().optional(),\n /** The host's routes folder, project-relative; false for none.\n * Default: hosts/connect/routes. */\n routes: z.union([z.string(), z.literal(false)]).optional(),\n /** The switchboard this Connect is served next to: its server\n * (dev and serve) proxies the switchboard's paths (`/graphql`,\n * `/d/*`, `/attachments`, `/mcp`, `/api/*`) to `target`, and the\n * served config names that switchboard as `${origin}`, resolved by\n * the browser against the page's origin. So one config holds from\n * the developer's `localhost` and from a published site alike, with\n * every call on the page's own origin. Typically a sibling's\n * `origin` output token. */\n proxy: z.strictObject({ target: s.tokenable(z.url()) }).optional(),\n })\n .strict(),\n config: connectConfigSchemaWith(s.tokenable).optional(),\n })\n .superRefine(refineConnectReactor),\n);\nexport const declaredHostSchema = schemas.declaredHostSchema;\nexport const hostSchema = schemas.hostSchema;\n\n/** What a connect host.js author writes. */\nexport type ConnectHost = z.input<typeof declaredHostSchema>;\n/** What a verb receives (defaults applied). */\nexport type ConnectHostParsed = z.output<typeof hostSchema>;\n\n/** What a started Connect (`dev`/`run`/`serve`) produces: the origin it\n * actually listens on and the app URL (origin plus base path). */\nexport const outputsSchema = z.strictObject({\n origin: z.url(),\n endpoints: z.strictObject({ connect: z.url() }),\n});\nexport type ConnectOutputs = z.infer<typeof outputsSchema>;\n\ndeclare global {\n interface PHHostRunners {\n \"@powerhousedao/ph-cli/runners/connect\": {\n host: ConnectHost;\n outputs: ConnectOutputs;\n };\n }\n}\n\n/** The slice of a vite dev/preview server a handle needs. */\nexport interface ListeningServer {\n resolvedUrls: { local: string[] } | null;\n close(): Promise<void>;\n}\n\n/** A started Connect as a runner handle. vite has already listened when the\n * service returns, so `ready` is settled; the outputs carry the URL vite\n * resolved (the port it actually bound), falling back to the requested one. */\nexport function connectHandle(\n server: ListeningServer,\n requested: { host: string; port: number },\n): RunnerHandle<ConnectOutputs> {\n const fallback = `http://${requested.host}:${requested.port}/`;\n const app = server.resolvedUrls?.local[0] ?? fallback;\n let closing: Promise<void> | undefined;\n return {\n outputs: outputsSchema.parse({\n origin: new URL(app).origin,\n endpoints: { connect: app },\n }),\n ready: Promise.resolve(),\n shutdown: () => (closing ??= server.close()),\n };\n}\n\n/** host.js reactor.drives -> the served drives.defaultDrives shapes: locals\n * carry id/name/icon and the preferredEditor under its Connect alias `app`;\n * remotes carry their URL. */\nfunction declaredDrivesToDefaults(\n projectRoot: string,\n declarations: readonly DriveDeclaration[],\n): PHConnectDefaultDrive[] {\n return declarations.map((declaration) => {\n const drive = resolveDriveDeclaration(projectRoot, declaration);\n if (drive.kind === \"remote\") {\n return {\n url: drive.remoteUrl!,\n name: drive.name,\n icon: drive.icon ?? null,\n };\n }\n return {\n local: true as const,\n // A local drive is skipped on later boots by this id, so it stays fixed.\n id: drive.id ?? drive.slug,\n name: drive.name,\n icon: drive.icon ?? null,\n ...(drive.preferredEditor ? { app: drive.preferredEditor } : {}),\n };\n });\n}\n\n/**\n * The served override. With `runner.proxy`, every URL on the proxied\n * switchboard's origin (drives, backends, plugin configs, however they were\n * written or resolved from output tokens) is served as `${origin}…`: the\n * browser reaches the switchboard through the page's own origin, which this\n * Connect's server proxies, so the config holds wherever the page is loaded\n * from. A host may also write `${origin}/…` itself; that passes through.\n */\nexport function callerOverride(\n host: ConnectHostParsed,\n ctx?: RunnerContext,\n verb = \"dev\",\n): PHConnectRuntimeConfig | undefined {\n const override = callerOverrideRaw(host, ctx, verb);\n const target = host.runner.proxy?.target;\n return override && target\n ? withOriginPlaceholders(override, target)\n : override;\n}\n\nfunction callerOverrideRaw(\n host: ConnectHostParsed,\n ctx?: RunnerContext,\n verb = \"dev\",\n): PHConnectRuntimeConfig | undefined {\n // A copy: the projection below adds served-only keys (composition, …).\n const base: PHConnectRuntimeConfig = { ...host.config };\n const reactor: ReactorConfig | undefined = host.reactor;\n\n // The Renown instance a person chose at start, under the names the\n // switchboard reads, so the two can't disagree.\n const renownUrl = ctx?.env.RENOWN_URL?.trim();\n const renownSwitchboardUrl = ctx?.env.SWITCHBOARD_URL?.trim();\n if (renownUrl || renownSwitchboardUrl) {\n base.renown = {\n ...base.renown,\n ...(renownUrl ? { url: renownUrl } : {}),\n ...(renownSwitchboardUrl ? { switchboardUrl: renownSwitchboardUrl } : {}),\n };\n }\n\n // R3: the composition (verb-filtered, projected as DATA — the browser\n // pipeline resolves and runs the entries), declared drives, and the\n // reactor-core identity/namespace keys.\n const entries = host.runner.plugins;\n const composition: PHConnectCompositionEntry[] | undefined =\n entries === undefined\n ? undefined\n : normalizePluginEntries(entries, `hosts/${host.name}/host.js`)\n .filter((entry) => entryActiveForVerb(entry, verb))\n .map((entry) => ({ module: entry.module, config: entry.config }));\n // Entry configs arrive RESOLVED: output tokens (e.g. the workflows\n // plugin's `drive: switchboard.drives.workflows.url`) were replaced by\n // `ph run` (standalone: the producer's run record; in a compound: the\n // member's live outputs) before validateHost let this verb run.\n if (entries !== undefined) {\n // Change 2: show the composition plan on the `ph run connect` terminal.\n // The pipeline itself runs in the browser (hook execution logs to the\n // browser console); here we report WHAT will be served and for which verb.\n const all = normalizePluginEntries(entries, `hosts/${host.name}/host.js`);\n console.log(\n `[connect] composition plan (verb=${verb}): ${composition?.length ?? 0} active of ${all.length} declared`,\n );\n for (const entry of all) {\n const active = entryActiveForVerb(entry, verb);\n const scope =\n entry.verbs === \"*\" ? \"\" : ` verbs=[${entry.verbs.join(\",\")}]`;\n const cfg = Object.keys(entry.config);\n console.log(\n `[connect] ${active ? \"•\" : \"○\"} ${entry.module}${scope}` +\n (cfg.length ? ` config: {${cfg.join(\", \")}}` : \"\") +\n (active ? \"\" : \" (inactive for this verb)\"),\n );\n }\n }\n // Config a Connect plugin owns, set on the host while that plugin is not\n // composed for this verb: Connect serves the plugin-absent value instead.\n for (const warning of findDeadConnectConfig(\n host.config,\n entries,\n verb,\n `hosts/${host.name}/host.js`,\n )) {\n console.warn(warning.message);\n }\n const declared = reactor?.drives;\n const declaredDefaults =\n declared && ctx\n ? declaredDrivesToDefaults(ctx.projectRoot, declared)\n : undefined;\n const reactorRenown = reactor?.renown;\n const reactorNamespace = reactor?.namespace;\n base.drives = declaredDefaults\n ? {\n ...base.drives,\n defaultDrives: mergeDefaultDrives(\n declaredDefaults,\n base.drives?.defaultDrives ?? [],\n ),\n preserveStrategy: base.drives?.preserveStrategy ?? \"preserve-all\",\n }\n : base.drives;\n if (composition) base.composition = composition;\n if (reactorRenown) base.renown = { ...reactorRenown, ...base.renown };\n if (reactorNamespace !== undefined)\n base.instance = {\n ...base.instance,\n namespace: base.instance?.namespace ?? reactorNamespace,\n } as typeof base.instance;\n const { connect } = projectReactorToConnect(reactor);\n const structural = isStructuralMultiReactor(reactor);\n if (!connect.reactor && !connect.instance && !connect.app && !structural) {\n // `base` IS host.config when the host has one; a host without a config\n // block still carries its composition and drives (set on `base` above).\n // With none of the three, there is no override: a classic build.\n return host.config !== undefined || composition || declaredDefaults\n ? base\n : undefined;\n }\n const projected = structural\n ? projectDrivesIntoConnect({\n createdDriveUrls: remoteBackendUrls(reactor),\n configuredDefaultDrives: base.drives?.defaultDrives,\n }).drives\n : base.drives;\n const placed = placeConnectDrives(reactor, projected?.defaultDrives ?? []);\n const drives =\n projected?.defaultDrives === undefined\n ? projected\n : { ...projected, defaultDrives: placed.defaultDrives };\n // When the host DECLARES backends, instance facts derive from them and win\n // over config defaults (declaring `kind: \"worker\"` is more explicit intent\n // than a scaffold's `reactorWorker: false`); without backends the P2 rule\n // stands — an explicit connect.* value wins over descriptive projection.\n const declaresBackends = Object.keys(reactor?.backends ?? {}).length > 0;\n const instance = declaresBackends\n ? {\n ...base.instance,\n ...connect.instance,\n ...(placed.collections ? { collections: placed.collections } : {}),\n }\n : { ...connect.instance, ...base.instance };\n return {\n ...base,\n reactor: { ...connect.reactor, ...base.reactor },\n instance: instance as never,\n app: { ...connect.app, ...base.app },\n ...(drives ? { drives: { ...base.drives, ...drives } } : {}),\n };\n}\n\n/**\n * Start a server; under a supervising compound (`ctx.parent`), drop the\n * process-exiting signal listeners it installed (vite's dev and preview\n * servers exit on SIGTERM): the compound owns the exit and stops members in\n * reverse dependency order through their handles.\n */\nexport async function startUnderSupervisor<T>(\n ctx: RunnerContext,\n start: () => Promise<T>,\n): Promise<T> {\n if (!ctx.parent) return start();\n const signals = [\"SIGINT\", \"SIGTERM\"] as const;\n const before = new Map(\n signals.map((signal) => [signal, new Set(process.listeners(signal))]),\n );\n try {\n return await start();\n } finally {\n for (const signal of signals) {\n for (const listener of process.listeners(signal)) {\n if (!before.get(signal)?.has(listener)) {\n process.off(signal, listener);\n }\n }\n }\n }\n}\n\n/** Fail at `ph run`, naming the plugin and key, when a composed Connect\n * plugin's entry config does not match its schema. */\nexport async function validateComposition(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<void> {\n const { validateConnectPluginConfigs } =\n await import(\"./connect-plugin-configs.js\");\n await validateConnectPluginConfigs(\n ctx.projectRoot,\n host.runner.plugins,\n ctx.verb,\n `hosts/${host.name}/host.js`,\n );\n}\n\n/** A project file the build resolved: the built dist has it (as icon.ico or\n * a data URI); served, its path would mean nothing. */\nfunction isBuiltImage(ref: unknown): boolean {\n const src =\n typeof ref === \"object\" && ref !== null && \"src\" in ref ? ref.src : ref;\n return typeof src === \"string\" && !isPassthroughImageRef(src);\n}\n\n// The served config keeps the build's images: the favicon and any branding\n// image given as a project path were resolved into the dist, and merged over\n// it a path would replace the built data URI with a URL that 404s.\nexport function withoutBuiltImages(config: PHConnectRuntimeConfig | undefined) {\n const branding = config?.branding;\n if (!branding) return config;\n const { favicon: _, ...served } = branding;\n if (isBuiltImage(served.icon)) delete served.icon;\n if (isBuiltImage(served.loader)) delete served.loader;\n return { ...config, branding: served };\n}\n\n/** A server for a built Connect, given what to serve and how. */\nexport type ConnectServerStart = (\n args: ConnectPreviewArgs,\n override?: ConnectServeOverride,\n dirname?: string,\n options?: { proxy?: string },\n) => Promise<ListeningServer>;\n\n/** `serve` on a given server. The host's connect config (including a\n * supervising compound's projected drives and the reactor projection) rides a\n * serve override: the baked powerhouse.config.json merges with it at request\n * time, and `runner.cspRegistrySync` (set by the compound's wiring) patches the\n * baked CSP's script-src for the runtime registry. Together these replace the\n * ph-win-desktop sidecar's hand-rolled static server (desktop shape). */\nexport async function serveWith(\n start: ConnectServerStart,\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n await validateComposition(host, ctx);\n const runner = host.runner;\n const port = runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;\n const bind = runner.host ?? \"127.0.0.1\";\n const args: Partial<ConnectPreviewArgs> = {\n port,\n outDir: runner.outDir ?? DEFAULT_CONNECT_OUTDIR,\n open: runner.openBrowser === true,\n strictPort: runner.strictPort === true,\n cors: true,\n printUrls: true,\n bindCLIShortcuts: false,\n // Explicit IPv4 loopback (runner.host overrides): vite's default\n // \"localhost\" can bind ::1 only on Windows, and a supervising shell\n // (ph-win) probes 127.0.0.1 — the sidecar this replaces bound 127.0.0.1.\n host: bind,\n };\n const override = withoutBuiltImages(callerOverride(host, ctx, ctx.verb));\n const server = await startUnderSupervisor<ListeningServer>(ctx, () =>\n start(\n args as ConnectPreviewArgs,\n {\n connect: override,\n cspRegistrySync: runner.cspRegistrySync === true,\n },\n undefined,\n { proxy: runner.proxy?.target },\n ),\n );\n return connectHandle(server, { host: bind, port });\n}\n\n/** Serves a built Connect (run `build` first) with nothing but what a running\n * app has. ph-cli's runner adds the verbs that need build tools. */\nexport async function serve(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n const { runConnectServer } = await import(\"../services/connect-server.js\");\n return serveWith(runConnectServer, host, ctx);\n}\n\n/** With no Studio here, running Connect is serving its build. */\nexport const run = serve;\n\nexport const verbs = [\"run\", \"serve\"];\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAa,OAAO;;;;;;;;;AAUpB,MAAM,UAAU,mBAAmB,MACjC,EAAE,kBACC,OAAO;CACN,QAAQ,EAAE,iBACP,OAAO;;EAEN,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS;;EAElC,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS;;EAEjC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;;;EAGnC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,SAAS;;;EAGtC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;;;;;;;;;EASzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;CACnE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