@powerhousedao/ph-run 6.2.3-dev.99 → 6.3.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{classic-args-BYccyIIC.mjs → classic-args-BJMDXYLJ.mjs} +11 -5
  2. package/dist/{classic-args-BYccyIIC.mjs.map → classic-args-BJMDXYLJ.mjs.map} +1 -1
  3. package/dist/{classic-args-Dm0_3O5p.d.mts → classic-args-BKI4gEVD.d.mts} +4 -2
  4. package/dist/{classic-args-Dm0_3O5p.d.mts.map → classic-args-BKI4gEVD.d.mts.map} +1 -1
  5. package/dist/cli.mjs +9 -8
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/{connect-serve-1WAi0KJL.mjs → connect-serve-TZFWyrHe.mjs} +10 -5
  8. package/dist/connect-serve-TZFWyrHe.mjs.map +1 -0
  9. package/dist/{connect-serve-COWXf_41.d.mts → connect-serve-kfNeXmO2.d.mts} +5 -2
  10. package/dist/connect-serve-kfNeXmO2.d.mts.map +1 -0
  11. package/dist/{member-config-Bs3yOT6y.mjs → member-config-BvlBqovs.mjs} +5 -4
  12. package/dist/member-config-BvlBqovs.mjs.map +1 -0
  13. package/dist/observability-CrfdAtHw.mjs +25 -0
  14. package/dist/observability-CrfdAtHw.mjs.map +1 -0
  15. package/dist/runner-args-DduJxV1b.mjs +74 -0
  16. package/dist/runner-args-DduJxV1b.mjs.map +1 -0
  17. package/dist/runners/connect.d.mts +48 -3
  18. package/dist/runners/connect.d.mts.map +1 -1
  19. package/dist/runners/connect.mjs +76 -14
  20. package/dist/runners/connect.mjs.map +1 -1
  21. package/dist/runners/member-config.d.mts +30 -0
  22. package/dist/runners/member-config.d.mts.map +1 -1
  23. package/dist/runners/member-config.mjs +3 -3
  24. package/dist/runners/switchboard.d.mts +126 -1
  25. package/dist/runners/switchboard.d.mts.map +1 -1
  26. package/dist/runners/switchboard.mjs +96 -13
  27. package/dist/runners/switchboard.mjs.map +1 -1
  28. package/dist/services/classic-args.d.mts +2 -2
  29. package/dist/services/classic-args.mjs +4 -4
  30. package/dist/services/connect-serve.d.mts +1 -1
  31. package/dist/services/connect-serve.mjs +3 -3
  32. package/dist/services/connect-server.d.mts +5 -4
  33. package/dist/services/connect-server.d.mts.map +1 -1
  34. package/dist/services/connect-server.mjs +14 -6
  35. package/dist/services/connect-server.mjs.map +1 -1
  36. package/dist/services/run/start-run.d.mts +7 -1
  37. package/dist/services/run/start-run.d.mts.map +1 -1
  38. package/dist/services/run/start-run.mjs +3 -3
  39. package/dist/services/switchboard.d.mts +1 -1
  40. package/dist/{start-run-DWn2cVyi.mjs → start-run-DUfxuOde.mjs} +38 -19
  41. package/dist/start-run-DUfxuOde.mjs.map +1 -0
  42. package/dist/superseded-config-bNn_JyUj.mjs +31 -0
  43. package/dist/superseded-config-bNn_JyUj.mjs.map +1 -0
  44. package/package.json +7 -7
  45. package/dist/connect-serve-1WAi0KJL.mjs.map +0 -1
  46. package/dist/connect-serve-COWXf_41.d.mts.map +0 -1
  47. package/dist/member-config-Bs3yOT6y.mjs.map +0 -1
  48. package/dist/start-run-DWn2cVyi.mjs.map +0 -1
  49. package/dist/superseded-config-CpHrCuNq.mjs +0 -53
  50. package/dist/superseded-config-CpHrCuNq.mjs.map +0 -1
@@ -1,10 +1,15 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94e46473-59a0-58d6-8649-1332bc2a48c0")}catch(e){}}();
3
- import { defineHostSchemas, entryActiveForVerb, findDeadConnectConfig, isStructuralMultiReactor, mergeDefaultDrives, normalizePluginEntries, placeConnectDrives, projectDrivesIntoConnect, projectReactorToConnect, refineConnectReactor, remoteBackendUrls, resolveDriveDeclaration, unservedConnectStorage } from "@powerhousedao/host-core";
4
- import { DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4b31d9f9-ecf7-52d3-a09c-98ff55642081")}catch(e){}}();
3
+ import { i as reactorWorkflowsDeprecation, n as runnerArgsSchemaOf, r as connectChromeDeprecation, t as onlyPassed } from "../runner-args-DduJxV1b.mjs";
4
+ import { t as classicConnectPreviewArgs } from "../classic-args-BJMDXYLJ.mjs";
5
+ import { RunnerError, defaultConnectComposition, defineHostSchemas, entryActiveForVerb, findDeadConnectConfig, isStructuralMultiReactor, mergeDefaultDrives, normalizePluginEntries, placeConnectDrives, projectDrivesIntoConnect, projectReactorToConnect, refineConnectReactor, remoteBackendUrls, resolveDriveDeclaration, unservedConnectStorage } from "@powerhousedao/host-core";
6
+ import { DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
7
+ import { deepMerge, resolveSourceConnect } from "@powerhousedao/shared/connect";
5
8
  import { connectConfigSchemaWith } from "@powerhousedao/shared/connect/connect-config-schema";
6
9
  import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
7
10
  import { withOriginPlaceholders } from "@powerhousedao/shared/connect/origin-placeholder";
11
+ import { commonServerArgs, connectStudioArgs } from "@powerhousedao/shared/clis/args";
12
+ import { command, runSafely } from "cmd-ts";
8
13
  import { z } from "zod";
9
14
  //#region src/runners/connect.ts
10
15
  /**
@@ -80,7 +85,7 @@ function declaredDrivesToDefaults(projectRoot, declarations) {
80
85
  const drive = resolveDriveDeclaration(projectRoot, declaration);
81
86
  if (drive.kind === "remote") return {
82
87
  url: drive.remoteUrl,
83
- name: drive.name,
88
+ ...declaration.name ? { name: declaration.name } : {},
84
89
  icon: drive.icon ?? null
85
90
  };
86
91
  return {
@@ -131,6 +136,7 @@ function callerOverrideRaw(host, ctx, verb = "dev") {
131
136
  }
132
137
  }
133
138
  for (const warning of findDeadConnectConfig(host.config, entries, verb, `hosts/${host.name}/host.js`)) console.warn(warning.message);
139
+ for (const deprecation of [connectChromeDeprecation(host.config, entries !== void 0, `hosts/${host.name}/host.js`), reactorWorkflowsDeprecation(reactor, `hosts/${host.name}/host.js`, "@powerhousedao/connect/plugins/workflows")]) if (deprecation) console.warn(deprecation);
134
140
  const declared = reactor?.drives;
135
141
  const declaredDefaults = declared && ctx ? declaredDrivesToDefaults(ctx.projectRoot, declared) : void 0;
136
142
  const reactorRenown = reactor?.renown;
@@ -188,6 +194,27 @@ function callerOverrideRaw(host, ctx, verb = "dev") {
188
194
  } } : {}
189
195
  };
190
196
  }
197
+ /** Whether the host leaves its composition to Connect's default, which the
198
+ * terminal is told in place of a composition plan. */
199
+ function servesDefaultComposition(host) {
200
+ if (host.runner.plugins !== void 0) return false;
201
+ console.log(`[connect] hosts/${host.name}/host.js declares no runner.plugins: serving Connect's default composition.`);
202
+ return true;
203
+ }
204
+ /**
205
+ * `override` with Connect's default composition, for a host that declares no
206
+ * `runner.plugins` and is served by a build tool. The composition is worked
207
+ * out from the config Connect would be served without one: the project's
208
+ * powerhouse.config.json (`source`) under the override, under what the
209
+ * service lays over both (`over`: Studio's studio mode).
210
+ */
211
+ function withDefaultComposition(override, source, over = {}) {
212
+ const served = deepMerge(deepMerge(resolveSourceConnect(source), override ?? {}), over);
213
+ return {
214
+ ...override,
215
+ composition: defaultConnectComposition(served)
216
+ };
217
+ }
191
218
  /**
192
219
  * Start a server; under a supervising compound (`ctx.parent`), drop the
193
220
  * process-exiting signal listeners it installed (vite's dev and preview
@@ -227,6 +254,37 @@ function withoutBuiltImages(config) {
227
254
  branding: served
228
255
  };
229
256
  }
257
+ /** What a Connect accepts after `ph run <host> [verb]`: the classic
258
+ * `ph connect studio` definitions of the same names. */
259
+ const invocationArgs = {
260
+ port: connectStudioArgs.port,
261
+ host: commonServerArgs.host,
262
+ open: commonServerArgs.open,
263
+ cors: commonServerArgs.cors,
264
+ strictPort: commonServerArgs.strictPort
265
+ };
266
+ const invocation = command({
267
+ name: "connect",
268
+ args: invocationArgs,
269
+ handler: (args) => args
270
+ });
271
+ const WATCH_RETIRED = "it is no longer needed.";
272
+ const argsSchema = runnerArgsSchemaOf(invocationArgs, {
273
+ memberOptions: { "--connect-port": "--port" },
274
+ retired: {
275
+ "--watch": WATCH_RETIRED,
276
+ "-w": WATCH_RETIRED
277
+ }
278
+ });
279
+ /** This invocation's arguments (`ctx.argv`), parsed by the classic
280
+ * definitions; only the ones passed. They win over the host file. */
281
+ async function connectInvocationArgs(host, ctx) {
282
+ const argv = [...ctx.argv ?? []];
283
+ if (argv.length === 0) return {};
284
+ const result = await runSafely(invocation, argv);
285
+ if (result._tag === "error") throw new RunnerError(`hosts/${host.name}/host.js: ${result.error.config.message}`);
286
+ return onlyPassed(result.value, invocationArgs, argv);
287
+ }
230
288
  /** `serve` on a given server. The host's connect config (including a
231
289
  * supervising compound's projected drives and the reactor projection) rides a
232
290
  * serve override: the baked powerhouse.config.json merges with it at request
@@ -236,22 +294,26 @@ function withoutBuiltImages(config) {
236
294
  async function serveWith(start, host, ctx) {
237
295
  await validateComposition(host, ctx);
238
296
  const runner = host.runner;
239
- const port = runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;
240
- const bind = runner.host ?? "127.0.0.1";
297
+ const passed = await connectInvocationArgs(host, ctx);
298
+ const port = passed.port ?? runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;
299
+ const bind = passed.host ?? runner.host ?? "127.0.0.1";
300
+ const classic = await classicConnectPreviewArgs();
241
301
  const args = {
302
+ ...classic,
242
303
  port,
243
- outDir: runner.outDir ?? DEFAULT_CONNECT_OUTDIR,
244
- open: runner.openBrowser === true,
245
- strictPort: runner.strictPort === true,
246
- cors: true,
247
- printUrls: true,
304
+ outDir: runner.outDir ?? classic.outDir,
305
+ open: passed.open ?? runner.openBrowser === true,
306
+ strictPort: passed.strictPort ?? runner.strictPort === true,
307
+ cors: passed.cors ?? true,
248
308
  bindCLIShortcuts: false,
249
309
  host: bind
250
310
  };
251
311
  const override = withoutBuiltImages(callerOverride(host, ctx, ctx.verb));
312
+ const defaultComposition = servesDefaultComposition(host);
252
313
  return connectHandle(await startUnderSupervisor(ctx, () => start(args, {
253
314
  connect: override,
254
- cspRegistrySync: runner.cspRegistrySync === true
315
+ cspRegistrySync: runner.cspRegistrySync === true,
316
+ ...defaultComposition ? { defaultComposition } : {}
255
317
  }, void 0, { proxy: runner.proxy?.target })), {
256
318
  host: bind,
257
319
  port
@@ -267,7 +329,7 @@ async function serve(host, ctx) {
267
329
  const run = serve;
268
330
  const verbs = ["run", "serve"];
269
331
  //#endregion
270
- export { callerOverride, connectHandle, declaredHostSchema, hostSchema, kind, outputsSchema, run, serve, serveWith, startUnderSupervisor, validateComposition, verbs, withoutBuiltImages };
332
+ export { argsSchema, callerOverride, connectHandle, connectInvocationArgs, declaredHostSchema, hostSchema, kind, outputsSchema, run, serve, serveWith, servesDefaultComposition, startUnderSupervisor, validateComposition, verbs, withDefaultComposition, withoutBuiltImages };
271
333
 
272
334
  //# sourceMappingURL=connect.mjs.map
273
- //# debugId=94e46473-59a0-58d6-8649-1332bc2a48c0
335
+ //# debugId=4b31d9f9-ecf7-52d3-a09c-98ff55642081
@@ -1 +1 @@
1
- {"version":3,"file":"connect.mjs","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 unservedConnectStorage,\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 unserved = unservedConnectStorage(reactor);\n if (unserved)\n console.warn(`[connect] hosts/${host.name}/host.js: ${unserved}`);\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, drives, Renown and namespace (set\n // on `base` above). With none of them, there is no override: a classic\n // build.\n return host.config !== undefined ||\n composition ||\n declaredDefaults ||\n base.renown !== undefined ||\n base.instance !== undefined\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"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwCA,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;;EAE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473-59a0-58d6-8649-1332bc2a48c0"}
1
+ {"version":3,"file":"connect.mjs","sources":["../../src/runners/connect.ts"],"sourcesContent":["import {\n DEFAULT_CONNECT_STUDIO_PORT,\n type PHConnectCompositionEntry,\n type PHConnectDefaultDrive,\n type PHConnectRuntimeConfig,\n type PowerhouseConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { deepMerge, resolveSourceConnect } from \"@powerhousedao/shared/connect\";\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 defaultConnectComposition,\n defineHostSchemas,\n entryActiveForVerb,\n findDeadConnectConfig,\n isStructuralMultiReactor,\n mergeDefaultDrives,\n normalizePluginEntries,\n placeConnectDrives,\n resolveDriveDeclaration,\n type DriveDeclaration,\n projectDrivesIntoConnect,\n projectReactorToConnect,\n unservedConnectStorage,\n refineConnectReactor,\n remoteBackendUrls,\n RunnerError,\n type ReactorConfig,\n type RunnerContext,\n type RunnerHandle,\n} from \"@powerhousedao/host-core\";\nimport type { ParsedCmdResult } from \"@powerhousedao/shared/clis\";\nimport {\n commonServerArgs,\n connectStudioArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, runSafely } from \"cmd-ts\";\nimport { z } from \"zod\";\nimport {\n connectChromeDeprecation,\n reactorWorkflowsDeprecation,\n} from \"./host-deprecations.js\";\nimport { onlyPassed, runnerArgsSchemaOf } from \"./runner-args.js\";\nimport {\n classicConnectPreviewArgs,\n type ConnectPreviewArgs,\n} 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 // Only a declared name: Connect writes a default drive's name into\n // the drive, and the slug fallback would rename the served one.\n ...(declaration.name ? { name: declaration.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 // Still served, and gone in the next release.\n for (const deprecation of [\n connectChromeDeprecation(\n host.config,\n entries !== undefined,\n `hosts/${host.name}/host.js`,\n ),\n reactorWorkflowsDeprecation(\n reactor,\n `hosts/${host.name}/host.js`,\n \"@powerhousedao/connect/plugins/workflows\",\n ),\n ]) {\n if (deprecation) console.warn(deprecation);\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 unserved = unservedConnectStorage(reactor);\n if (unserved)\n console.warn(`[connect] hosts/${host.name}/host.js: ${unserved}`);\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, drives, Renown and namespace (set\n // on `base` above). With none of them, there is no override: a classic\n // build. `dev` and `serve` add the default composition to whatever this\n // returns, so only `build` still hands a service no composition; the\n // next release removes that.\n return host.config !== undefined ||\n composition ||\n declaredDefaults ||\n base.renown !== undefined ||\n base.instance !== undefined\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/** Whether the host leaves its composition to Connect's default, which the\n * terminal is told in place of a composition plan. */\nexport function servesDefaultComposition(host: ConnectHostParsed): boolean {\n if (host.runner.plugins !== undefined) return false;\n console.log(\n `[connect] hosts/${host.name}/host.js declares no runner.plugins: serving Connect's default composition.`,\n );\n return true;\n}\n\n/**\n * `override` with Connect's default composition, for a host that declares no\n * `runner.plugins` and is served by a build tool. The composition is worked\n * out from the config Connect would be served without one: the project's\n * powerhouse.config.json (`source`) under the override, under what the\n * service lays over both (`over`: Studio's studio mode).\n */\nexport function withDefaultComposition(\n override: PHConnectRuntimeConfig | undefined,\n source: Pick<PowerhouseConfig, \"connect\" | \"workflows\">,\n over: PHConnectRuntimeConfig = {},\n): PHConnectRuntimeConfig {\n const served = deepMerge(\n deepMerge(resolveSourceConnect(source), override ?? {}),\n over,\n );\n return { ...override, composition: defaultConnectComposition(served) };\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/** What a Connect accepts after `ph run <host> [verb]`: the classic\n * `ph connect studio` definitions of the same names. */\nconst invocationArgs = {\n port: connectStudioArgs.port,\n host: commonServerArgs.host,\n open: commonServerArgs.open,\n cors: commonServerArgs.cors,\n strictPort: commonServerArgs.strictPort,\n};\n\nconst invocation = command({\n name: \"connect\",\n args: invocationArgs,\n handler: (args) => args,\n});\n\nexport type ConnectInvocationArgs = Partial<ParsedCmdResult<typeof invocation>>;\n\nconst WATCH_RETIRED = \"it is no longer needed.\";\n\nexport const argsSchema = runnerArgsSchemaOf(invocationArgs, {\n // `ph vetra --connect-port`\n memberOptions: { \"--connect-port\": \"--port\" },\n retired: { \"--watch\": WATCH_RETIRED, \"-w\": WATCH_RETIRED },\n});\n\n/** This invocation's arguments (`ctx.argv`), parsed by the classic\n * definitions; only the ones passed. They win over the host file. */\nexport async function connectInvocationArgs(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<ConnectInvocationArgs> {\n const argv = [...(ctx.argv ?? [])];\n if (argv.length === 0) return {};\n const result = await runSafely(invocation, argv);\n if (result._tag === \"error\") {\n throw new RunnerError(\n `hosts/${host.name}/host.js: ${result.error.config.message}`,\n );\n }\n return onlyPassed(result.value, invocationArgs, argv);\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 passed = await connectInvocationArgs(host, ctx);\n // A served Connect answers where its Studio does, not on `ph connect\n // preview`'s own default port.\n const port = passed.port ?? runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;\n const bind = passed.host ?? runner.host ?? \"127.0.0.1\";\n // The classic `ph connect preview` arguments, with the keys this host and\n // this invocation own laid over them.\n const classic = await classicConnectPreviewArgs();\n const args: ConnectPreviewArgs = {\n ...classic,\n port,\n outDir: runner.outDir ?? classic.outDir,\n open: passed.open ?? runner.openBrowser === true,\n strictPort: passed.strictPort ?? runner.strictPort === true,\n cors: passed.cors ?? 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 // Without `runner.plugins` the server adds the default composition to the\n // config it serves, worked out from the build's config under this override.\n const defaultComposition = servesDefaultComposition(host);\n const server = await startUnderSupervisor<ListeningServer>(ctx, () =>\n start(\n args,\n {\n connect: override,\n cspRegistrySync: runner.cspRegistrySync === true,\n ...(defaultComposition ? { defaultComposition } : {}),\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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,OAAO;;;;;;;;;AAUpB,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,qBAAsC,WACzD,MACE,MACA;EACE,SAAS;EACT,iBAAiB,OAAO,oBAAoB;EAC5C,GAAI,qBAAqB,EAAE,mBAAmB,IAAI,CAAC;CACrD,GACA,KAAA,GACA,EAAE,OAAO,OAAO,OAAO,OAAO,CAChC,CACF,GAC6B;EAAE,MAAM;EAAM;CAAK,CAAC;AACnD;;;AAIA,eAAsB,MACpB,MACA,KACuC;CACvC,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,OAAO,UAAU,kBAAkB,MAAM,GAAG;AAC9C;;AAGA,MAAa,MAAM;AAEnB,MAAa,QAAQ,CAAC,OAAO,OAAO","debug_id":"4b31d9f9-ecf7-52d3-a09c-98ff55642081"}
@@ -122,6 +122,13 @@ export declare const memberSwitchboardConfigSchema: import("zod").ZodType<{
122
122
  wsRecheckMs?: number | undefined;
123
123
  ownerClaim?: boolean | undefined;
124
124
  offlineCredentials?: boolean | undefined;
125
+ access?: {
126
+ mode?: string | undefined;
127
+ gateUrl?: string | undefined;
128
+ gateToken?: string | undefined;
129
+ appId?: string | undefined;
130
+ graceMs?: number | undefined;
131
+ } | undefined;
125
132
  renown?: {
126
133
  source?: "kept" | "remote" | "self" | undefined;
127
134
  url?: string | undefined;
@@ -303,6 +310,13 @@ export declare const memberSwitchboardConfigSchema: import("zod").ZodType<{
303
310
  wsRecheckMs?: number | undefined;
304
311
  ownerClaim?: boolean | undefined;
305
312
  offlineCredentials?: boolean | undefined;
313
+ access?: {
314
+ mode?: string | undefined;
315
+ gateUrl?: string | undefined;
316
+ gateToken?: string | undefined;
317
+ appId?: string | undefined;
318
+ graceMs?: number | undefined;
319
+ } | undefined;
306
320
  renown?: {
307
321
  source?: "kept" | "remote" | "self" | undefined;
308
322
  url?: string | undefined;
@@ -484,6 +498,13 @@ export declare const memberSwitchboardConfigSchema: import("zod").ZodType<{
484
498
  wsRecheckMs?: number | undefined;
485
499
  ownerClaim?: boolean | undefined;
486
500
  offlineCredentials?: boolean | undefined;
501
+ access?: {
502
+ mode?: string | undefined;
503
+ gateUrl?: string | undefined;
504
+ gateToken?: string | undefined;
505
+ appId?: string | undefined;
506
+ graceMs?: number | undefined;
507
+ } | undefined;
487
508
  renown?: {
488
509
  source?: "kept" | "remote" | "self" | undefined;
489
510
  url?: string | undefined;
@@ -665,6 +686,13 @@ export declare const memberSwitchboardConfigSchema: import("zod").ZodType<{
665
686
  wsRecheckMs?: number | undefined;
666
687
  ownerClaim?: boolean | undefined;
667
688
  offlineCredentials?: boolean | undefined;
689
+ access?: {
690
+ mode?: string | undefined;
691
+ gateUrl?: string | undefined;
692
+ gateToken?: string | undefined;
693
+ appId?: string | undefined;
694
+ graceMs?: number | undefined;
695
+ } | undefined;
668
696
  renown?: {
669
697
  source?: "kept" | "remote" | "self" | undefined;
670
698
  url?: string | undefined;
@@ -774,6 +802,8 @@ export declare function readModelAsReactorStore(reactor: ReactorConfig | undefin
774
802
  * overrides its store, and no env var overrides its read model. Writes nothing.
775
803
  */
776
804
  export declare function memberSwitchboardConfig(member: SwitchboardMember, env: MemberEnv, options: {
805
+ /** The host declares `runner.plugins`. Without them the env decides:
806
+ * unset boots the server's default composition. */
777
807
  pluginHost: boolean;
778
808
  logger?: ILogger;
779
809
  /** Under everything else: values no flag or host file set. */
@@ -1 +1 @@
1
- {"version":3,"file":"member-config.d.mts","names":[],"sources":["../../src/runners/member-config.ts"],"mappings":";;;;KAqBK,MAAM,SAAS;;iBAGH;;EAEf,OAAO;;EAEP,QAAQ;;;wBAeM,mBAAmB,KAAK,KAAK,OAAO;;;;;;wBAsBpC,YAAY,KAAK,KAAK,eAA8B;;;;qBA2BvD,6CAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KACL;;wBAgBc,mBACd,kBACA;EAAU"}
@@ -1,4 +1,4 @@
1
- import { a as overlappingKeys, c as readModelAsReactorStore, i as missingPostgresUrl, l as rememberShellNames, n as memberSwitchboardConfig, o as prepareMemberStorage, r as memberSwitchboardConfigSchema, s as reactorBlockConflicts, t as memberEnvOf, u as switchboardDevMode } from "../member-config-Bs3yOT6y.mjs";
1
+ import { a as overlappingKeys, c as readModelAsReactorStore, i as missingPostgresUrl, l as rememberShellNames, n as memberSwitchboardConfig, o as prepareMemberStorage, r as memberSwitchboardConfigSchema, s as reactorBlockConflicts, t as memberEnvOf, u as switchboardDevMode } from "../member-config-BvlBqovs.mjs";
2
2
  export { memberEnvOf, memberSwitchboardConfig, memberSwitchboardConfigSchema, missingPostgresUrl, overlappingKeys, prepareMemberStorage, reactorBlockConflicts, readModelAsReactorStore, rememberShellNames, switchboardDevMode };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b755c6e4-2275-5fd0-b880-f614e8ab8f66")}catch(e){}}();
4
- //# debugId=b755c6e4-2275-5fd0-b880-f614e8ab8f66
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="820683cc-91dd-54c1-9716-3b8464904d1c")}catch(e){}}();
4
+ //# debugId=820683cc-91dd-54c1-9716-3b8464904d1c
@@ -1,5 +1,6 @@
1
- import { n as SwitchboardArgs } from "../classic-args-Dm0_3O5p.mjs";
1
+ import { n as SwitchboardArgs } from "../classic-args-BKI4gEVD.mjs";
2
2
  import { BootCheckContext, BootIssue, RunnerContext, RunnerHandle } from "@powerhousedao/host-core";
3
+ import { ParsedCmdResult } from "@powerhousedao/shared/clis";
3
4
  import { z } from "zod";
4
5
  //#region src/runners/switchboard.d.ts
5
6
  /**
@@ -118,6 +119,7 @@ export declare const declaredHostSchema: z.ZodObject<{
118
119
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
119
120
  }, z.core.$strict>]>>>;
120
121
  port: z.ZodOptional<z.ZodNumber>;
122
+ strictPort: z.ZodOptional<z.ZodBoolean>;
121
123
  dev: z.ZodOptional<z.ZodBoolean>;
122
124
  outDir: z.ZodOptional<z.ZodString>;
123
125
  }, z.core.$strict>;
@@ -223,6 +225,13 @@ export declare const declaredHostSchema: z.ZodObject<{
223
225
  wsRecheckMs?: number | undefined;
224
226
  ownerClaim?: boolean | undefined;
225
227
  offlineCredentials?: boolean | undefined;
228
+ access?: {
229
+ mode?: string | undefined;
230
+ gateUrl?: string | undefined;
231
+ gateToken?: string | undefined;
232
+ appId?: string | undefined;
233
+ graceMs?: number | undefined;
234
+ } | undefined;
226
235
  renown?: {
227
236
  source?: "kept" | "remote" | "self" | undefined;
228
237
  url?: string | undefined;
@@ -404,6 +413,13 @@ export declare const declaredHostSchema: z.ZodObject<{
404
413
  wsRecheckMs?: number | undefined;
405
414
  ownerClaim?: boolean | undefined;
406
415
  offlineCredentials?: boolean | undefined;
416
+ access?: {
417
+ mode?: string | undefined;
418
+ gateUrl?: string | undefined;
419
+ gateToken?: string | undefined;
420
+ appId?: string | undefined;
421
+ graceMs?: number | undefined;
422
+ } | undefined;
407
423
  renown?: {
408
424
  source?: "kept" | "remote" | "self" | undefined;
409
425
  url?: string | undefined;
@@ -585,6 +601,13 @@ export declare const declaredHostSchema: z.ZodObject<{
585
601
  wsRecheckMs?: number | undefined;
586
602
  ownerClaim?: boolean | undefined;
587
603
  offlineCredentials?: boolean | undefined;
604
+ access?: {
605
+ mode?: string | undefined;
606
+ gateUrl?: string | undefined;
607
+ gateToken?: string | undefined;
608
+ appId?: string | undefined;
609
+ graceMs?: number | undefined;
610
+ } | undefined;
588
611
  renown?: {
589
612
  source?: "kept" | "remote" | "self" | undefined;
590
613
  url?: string | undefined;
@@ -766,6 +789,13 @@ export declare const declaredHostSchema: z.ZodObject<{
766
789
  wsRecheckMs?: number | undefined;
767
790
  ownerClaim?: boolean | undefined;
768
791
  offlineCredentials?: boolean | undefined;
792
+ access?: {
793
+ mode?: string | undefined;
794
+ gateUrl?: string | undefined;
795
+ gateToken?: string | undefined;
796
+ appId?: string | undefined;
797
+ graceMs?: number | undefined;
798
+ } | undefined;
769
799
  renown?: {
770
800
  source?: "kept" | "remote" | "self" | undefined;
771
801
  url?: string | undefined;
@@ -958,6 +988,7 @@ export declare const hostSchema: z.ZodObject<{
958
988
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
959
989
  }, z.core.$strict>]>>>;
960
990
  port: z.ZodOptional<z.ZodNumber>;
991
+ strictPort: z.ZodOptional<z.ZodBoolean>;
961
992
  dev: z.ZodOptional<z.ZodBoolean>;
962
993
  outDir: z.ZodOptional<z.ZodString>;
963
994
  }, z.core.$strict>;
@@ -1063,6 +1094,13 @@ export declare const hostSchema: z.ZodObject<{
1063
1094
  wsRecheckMs?: number | undefined;
1064
1095
  ownerClaim?: boolean | undefined;
1065
1096
  offlineCredentials?: boolean | undefined;
1097
+ access?: {
1098
+ mode?: string | undefined;
1099
+ gateUrl?: string | undefined;
1100
+ gateToken?: string | undefined;
1101
+ appId?: string | undefined;
1102
+ graceMs?: number | undefined;
1103
+ } | undefined;
1066
1104
  renown?: {
1067
1105
  source?: "kept" | "remote" | "self" | undefined;
1068
1106
  url?: string | undefined;
@@ -1244,6 +1282,13 @@ export declare const hostSchema: z.ZodObject<{
1244
1282
  wsRecheckMs?: number | undefined;
1245
1283
  ownerClaim?: boolean | undefined;
1246
1284
  offlineCredentials?: boolean | undefined;
1285
+ access?: {
1286
+ mode?: string | undefined;
1287
+ gateUrl?: string | undefined;
1288
+ gateToken?: string | undefined;
1289
+ appId?: string | undefined;
1290
+ graceMs?: number | undefined;
1291
+ } | undefined;
1247
1292
  renown?: {
1248
1293
  source?: "kept" | "remote" | "self" | undefined;
1249
1294
  url?: string | undefined;
@@ -1425,6 +1470,13 @@ export declare const hostSchema: z.ZodObject<{
1425
1470
  wsRecheckMs?: number | undefined;
1426
1471
  ownerClaim?: boolean | undefined;
1427
1472
  offlineCredentials?: boolean | undefined;
1473
+ access?: {
1474
+ mode?: string | undefined;
1475
+ gateUrl?: string | undefined;
1476
+ gateToken?: string | undefined;
1477
+ appId?: string | undefined;
1478
+ graceMs?: number | undefined;
1479
+ } | undefined;
1428
1480
  renown?: {
1429
1481
  source?: "kept" | "remote" | "self" | undefined;
1430
1482
  url?: string | undefined;
@@ -1606,6 +1658,13 @@ export declare const hostSchema: z.ZodObject<{
1606
1658
  wsRecheckMs?: number | undefined;
1607
1659
  ownerClaim?: boolean | undefined;
1608
1660
  offlineCredentials?: boolean | undefined;
1661
+ access?: {
1662
+ mode?: string | undefined;
1663
+ gateUrl?: string | undefined;
1664
+ gateToken?: string | undefined;
1665
+ appId?: string | undefined;
1666
+ graceMs?: number | undefined;
1667
+ } | undefined;
1609
1668
  renown?: {
1610
1669
  source?: "kept" | "remote" | "self" | undefined;
1611
1670
  url?: string | undefined;
@@ -1724,6 +1783,60 @@ declare global {
1724
1783
  };
1725
1784
  }
1726
1785
  }
1786
+ declare const invocation: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
1787
+ parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
1788
+ port: number;
1789
+ strictPort: boolean | undefined;
1790
+ dbPath: string | undefined;
1791
+ https: boolean | undefined;
1792
+ httpsKeyFile: string | undefined;
1793
+ httpsCertFile: string | undefined;
1794
+ remoteDrives: string[];
1795
+ remoteDrive: string | undefined;
1796
+ interactive: boolean;
1797
+ yes: boolean | undefined;
1798
+ }>>;
1799
+ } & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
1800
+ port: number;
1801
+ strictPort: boolean | undefined;
1802
+ dbPath: string | undefined;
1803
+ https: boolean | undefined;
1804
+ httpsKeyFile: string | undefined;
1805
+ httpsCertFile: string | undefined;
1806
+ remoteDrives: string[];
1807
+ remoteDrive: string | undefined;
1808
+ interactive: boolean;
1809
+ yes: boolean | undefined;
1810
+ }, {
1811
+ port: number;
1812
+ strictPort: boolean | undefined;
1813
+ dbPath: string | undefined;
1814
+ https: boolean | undefined;
1815
+ httpsKeyFile: string | undefined;
1816
+ httpsCertFile: string | undefined;
1817
+ remoteDrives: string[];
1818
+ remoteDrive: string | undefined;
1819
+ interactive: boolean;
1820
+ yes: boolean | undefined;
1821
+ }> & {
1822
+ run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
1823
+ port: number;
1824
+ strictPort: boolean | undefined;
1825
+ dbPath: string | undefined;
1826
+ https: boolean | undefined;
1827
+ httpsKeyFile: string | undefined;
1828
+ httpsCertFile: string | undefined;
1829
+ remoteDrives: string[];
1830
+ remoteDrive: string | undefined;
1831
+ interactive: boolean;
1832
+ yes: boolean | undefined;
1833
+ }>>;
1834
+ } & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
1835
+ export type InvocationArgs = ParsedCmdResult<typeof invocation>;
1836
+ export declare const argsSchema: import("@powerhousedao/host-core").RunnerArgsSchema;
1837
+ /** This invocation's arguments (`ctx.argv`), parsed by the classic
1838
+ * definitions; only the ones passed. */
1839
+ export declare function invocationArgsOf(ctx: RunnerContext, hostFile: string): Promise<Partial<InvocationArgs>>;
1727
1840
  /** The classic arg shape with the one switch a composition may leave unset. */
1728
1841
  export type SwitchboardRunnerArgs = Omit<SwitchboardArgs, "mcp"> & {
1729
1842
  mcp: boolean | undefined;
@@ -1747,6 +1860,18 @@ export declare function run(host: SwitchboardHostParsed, ctx: RunnerContext): Pr
1747
1860
  export declare const serve: typeof run;
1748
1861
  export declare const verbs: string[];
1749
1862
  export declare function dev(host: SwitchboardHostParsed, ctx: RunnerContext): Promise<SwitchboardHandle>;
1863
+ /** Where a started switchboard keeps its two stores: a Postgres url or a
1864
+ * PGlite dir each; undefined is the server's default dir under `.ph`. */
1865
+ export interface SwitchboardStores {
1866
+ reactor: string | undefined;
1867
+ readModel: string | undefined;
1868
+ /** The relocated `.ph` root the default dirs sit under. */
1869
+ userDataDir: string | undefined;
1870
+ }
1871
+ /** The stores `run` would open for this host: the same env split and member
1872
+ * config as `start`, whose args name no store (`dbPath` is unset without
1873
+ * flags). Starts nothing and creates nothing. */
1874
+ export declare function resolveStores(host: SwitchboardHostParsed, ctx: RunnerContext): Promise<SwitchboardStores>;
1750
1875
  /** What the server would refuse at boot for this host, `ctx.verb` and `ctx.env` (`ph host check`). */
1751
1876
  export declare function checkBoot(host: SwitchboardHostParsed, ctx: BootCheckContext): Promise<BootIssue[]>;
1752
1877
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard.d.mts","names":[],"sources":["../../src/runners/switchboard.ts"],"mappings":";;;;;;;;;;qBA2Ca;qBAoCA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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