@powerhousedao/ph-cli 6.2.3-dev.86 → 6.2.3-dev.87
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/dist/{check-o9kpHrG_.mjs → check-BhShHuOZ.mjs} +24 -15
- package/dist/check-BhShHuOZ.mjs.map +1 -0
- package/dist/{cli-connect-override-B8h8Dom0.mjs → cli-connect-override-Dm55uCjR.mjs} +4 -4
- package/dist/{cli-connect-override-B8h8Dom0.mjs.map → cli-connect-override-Dm55uCjR.mjs.map} +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/{compound-GhJAA2dK-Cj36zhoQ.mjs → compound-BZb3tR_c-CAf7DitW.mjs} +85 -7
- package/dist/compound-BZb3tR_c-CAf7DitW.mjs.map +1 -0
- package/dist/{connect-build-DhGOa9DG.mjs → connect-build-DMKUu9mw.mjs} +4 -4
- package/dist/{connect-build-DhGOa9DG.mjs.map → connect-build-DMKUu9mw.mjs.map} +1 -1
- package/dist/{connect-config-CSD0KpbH.mjs → connect-config-B4yKClFe.mjs} +4 -4
- package/dist/{connect-config-CSD0KpbH.mjs.map → connect-config-B4yKClFe.mjs.map} +1 -1
- package/dist/{connect-plugin-configs-tVn11Qb_.mjs → connect-plugin-configs-DazgTR0p.mjs} +4 -4
- package/dist/{connect-plugin-configs-tVn11Qb_.mjs.map → connect-plugin-configs-DazgTR0p.mjs.map} +1 -1
- package/dist/{connect-studio-CQwzYwYe.mjs → connect-studio-CJ8ImldI.mjs} +3 -3
- package/dist/{connect-studio-DMy3hxYS.mjs → connect-studio-DaaQOVBr.mjs} +4 -4
- package/dist/{connect-studio-DMy3hxYS.mjs.map → connect-studio-DaaQOVBr.mjs.map} +1 -1
- package/dist/{dist-BfUgk19n.mjs → dist-tZHpCFn_.mjs} +93 -22
- package/dist/dist-tZHpCFn_.mjs.map +1 -0
- package/dist/{explain-DD_ZC-9c.mjs → explain-4PQGC1BH.mjs} +5 -5
- package/dist/{explain-DD_ZC-9c.mjs.map → explain-4PQGC1BH.mjs.map} +1 -1
- package/dist/{export-DdkU6JMT.mjs → export-BfSsraKe.mjs} +4 -4
- package/dist/{export-DdkU6JMT.mjs.map → export-BfSsraKe.mjs.map} +1 -1
- package/dist/{generate-all-BVRk64NX.mjs → generate-all-CoLL-TJu.mjs} +4 -4
- package/dist/{generate-all-BVRk64NX.mjs.map → generate-all-CoLL-TJu.mjs.map} +1 -1
- package/dist/{get-version-D1U-KyKb.mjs → get-version-LkF4EEfW.mjs} +4 -4
- package/dist/{get-version-D1U-KyKb.mjs.map → get-version-LkF4EEfW.mjs.map} +1 -1
- package/dist/{index-Cfca-03e.d.mts → index-V0t4klsV.d.mts} +13 -2
- package/dist/{index-Cfca-03e.d.mts.map → index-V0t4klsV.d.mts.map} +1 -1
- package/dist/{mcp-tMRVrU0l.mjs → mcp-BU5B2Gym.mjs} +4 -4
- package/dist/{mcp-tMRVrU0l.mjs.map → mcp-BU5B2Gym.mjs.map} +1 -1
- package/dist/{member-config-CLziqSGm.mjs → member-config-DJUsoeHe.mjs} +4 -4
- package/dist/{member-config-CLziqSGm.mjs.map → member-config-DJUsoeHe.mjs.map} +1 -1
- package/dist/{ph-cli-commands-DoB_GolD.mjs → ph-cli-commands-Cc10rqFd.mjs} +13 -13
- package/dist/{ph-cli-commands-DoB_GolD.mjs.map → ph-cli-commands-Cc10rqFd.mjs.map} +1 -1
- package/dist/ph-cli-commands-DjuwYy0A.mjs +4 -0
- package/dist/{run-sugar-DWPDmuRj.mjs → run-sugar-fbWJGtkS.mjs} +4 -4
- package/dist/{run-sugar-DWPDmuRj.mjs.map → run-sugar-fbWJGtkS.mjs.map} +1 -1
- package/dist/runners/connect.d.mts +45 -1
- package/dist/runners/connect.d.mts.map +1 -1
- package/dist/runners/connect.mjs +8 -8
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/switchboard.d.mts +23 -1
- package/dist/runners/switchboard.d.mts.map +1 -1
- package/dist/runners/switchboard.mjs +4 -4
- package/dist/{start-run-CuQEMKRZ.mjs → start-run-x-6Ccna-.mjs} +4 -4
- package/dist/{start-run-CuQEMKRZ.mjs.map → start-run-x-6Ccna-.mjs.map} +1 -1
- package/dist/{vetra-rqgE32xv.mjs → vetra-BRyjbepO.mjs} +6 -6
- package/dist/{vetra-rqgE32xv.mjs.map → vetra-BRyjbepO.mjs.map} +1 -1
- package/package.json +14 -14
- package/dist/check-o9kpHrG_.mjs.map +0 -1
- package/dist/compound-GhJAA2dK-Cj36zhoQ.mjs.map +0 -1
- package/dist/dist-BfUgk19n.mjs.map +0 -1
- package/dist/ph-cli-commands-BZDpcccA.mjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as output$1, E as ZodUnknown, S as ZodString, T as ZodUnion, _ as ZodNullable, a as ItemToken, b as ZodOptional, c as RunnerHandle, d as input, f as output, g as ZodLiteral, h as ZodEnum, i as EnvToken, k as $strict, l as TokenableSchema, m as ZodBoolean, o as OutputToken, p as ZodArray, r as ConcatToken, s as RunnerContext, u as external_d_exports, v as ZodNumber, w as ZodURL, x as ZodRecord, y as ZodObject } from "../index-
|
|
1
|
+
import { D as output$1, E as ZodUnknown, S as ZodString, T as ZodUnion, _ as ZodNullable, a as ItemToken, b as ZodOptional, c as RunnerHandle, d as input, f as output, g as ZodLiteral, h as ZodEnum, i as EnvToken, k as $strict, l as TokenableSchema, m as ZodBoolean, o as OutputToken, p as ZodArray, r as ConcatToken, s as RunnerContext, u as external_d_exports, v as ZodNumber, w as ZodURL, x as ZodRecord, y as ZodObject } from "../index-V0t4klsV.mjs";
|
|
2
2
|
import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
|
|
3
3
|
//#region src/runners/connect.d.ts
|
|
4
4
|
/**
|
|
@@ -43,11 +43,22 @@ export declare const declaredHostSchema: ZodObject<{
|
|
|
43
43
|
}, $strict>>;
|
|
44
44
|
remote: ZodOptional<ZodObject<{
|
|
45
45
|
url: TokenableSchema<ZodUnion<readonly [ZodURL, ZodString]>>;
|
|
46
|
+
requestTimeoutMs: ZodOptional<ZodNumber>;
|
|
47
|
+
breaker: ZodOptional<ZodUnion<readonly [ZodLiteral<false>, ZodObject<{
|
|
48
|
+
failures: ZodOptional<ZodNumber>;
|
|
49
|
+
openMs: ZodOptional<ZodNumber>;
|
|
50
|
+
}, $strict>]>>;
|
|
51
|
+
realtime: ZodOptional<ZodBoolean>;
|
|
46
52
|
}, $strict>>;
|
|
47
53
|
}, $strict>>>;
|
|
48
54
|
placement: ZodOptional<ZodObject<{
|
|
49
55
|
primary: ZodOptional<ZodString>;
|
|
50
56
|
drives: ZodOptional<ZodRecord<ZodString, ZodString>>;
|
|
57
|
+
newDrives: ZodOptional<ZodString>;
|
|
58
|
+
}, $strict>>;
|
|
59
|
+
router: ZodOptional<ZodObject<{
|
|
60
|
+
probeTimeoutMs: ZodOptional<ZodNumber>;
|
|
61
|
+
provisionalRouteMs: ZodOptional<ZodNumber>;
|
|
51
62
|
}, $strict>>;
|
|
52
63
|
protocol: ZodOptional<ZodObject<{
|
|
53
64
|
featureFlags: ZodOptional<ZodObject<{
|
|
@@ -394,11 +405,22 @@ export declare const hostSchema: ZodObject<{
|
|
|
394
405
|
}, $strict>>;
|
|
395
406
|
remote: ZodOptional<ZodObject<{
|
|
396
407
|
url: TokenableSchema<ZodUnion<readonly [ZodURL, ZodString]>>;
|
|
408
|
+
requestTimeoutMs: ZodOptional<ZodNumber>;
|
|
409
|
+
breaker: ZodOptional<ZodUnion<readonly [ZodLiteral<false>, ZodObject<{
|
|
410
|
+
failures: ZodOptional<ZodNumber>;
|
|
411
|
+
openMs: ZodOptional<ZodNumber>;
|
|
412
|
+
}, $strict>]>>;
|
|
413
|
+
realtime: ZodOptional<ZodBoolean>;
|
|
397
414
|
}, $strict>>;
|
|
398
415
|
}, $strict>>>;
|
|
399
416
|
placement: ZodOptional<ZodObject<{
|
|
400
417
|
primary: ZodOptional<ZodString>;
|
|
401
418
|
drives: ZodOptional<ZodRecord<ZodString, ZodString>>;
|
|
419
|
+
newDrives: ZodOptional<ZodString>;
|
|
420
|
+
}, $strict>>;
|
|
421
|
+
router: ZodOptional<ZodObject<{
|
|
422
|
+
probeTimeoutMs: ZodOptional<ZodNumber>;
|
|
423
|
+
provisionalRouteMs: ZodOptional<ZodNumber>;
|
|
402
424
|
}, $strict>>;
|
|
403
425
|
protocol: ZodOptional<ZodObject<{
|
|
404
426
|
featureFlags: ZodOptional<ZodObject<{
|
|
@@ -877,11 +899,22 @@ export declare function withoutBuiltImages(config: PHConnectRuntimeConfig | unde
|
|
|
877
899
|
remoteBackends?: {
|
|
878
900
|
name: string;
|
|
879
901
|
url: string;
|
|
902
|
+
requestTimeoutMs?: number | undefined;
|
|
903
|
+
breaker?: false | {
|
|
904
|
+
failures?: number | undefined;
|
|
905
|
+
openMs?: number | undefined;
|
|
906
|
+
} | undefined;
|
|
907
|
+
realtime?: boolean | undefined;
|
|
880
908
|
}[] | undefined;
|
|
881
909
|
collections?: Record<string, {
|
|
882
910
|
backend: string;
|
|
883
911
|
sync?: boolean | undefined;
|
|
884
912
|
}> | undefined;
|
|
913
|
+
router?: {
|
|
914
|
+
newDrives?: string | undefined;
|
|
915
|
+
probeTimeoutMs?: number | undefined;
|
|
916
|
+
provisionalRouteMs?: number | undefined;
|
|
917
|
+
} | undefined;
|
|
885
918
|
} | undefined;
|
|
886
919
|
pwa?: {
|
|
887
920
|
globPatterns?: string[] | undefined;
|
|
@@ -1078,11 +1111,22 @@ export declare function withoutBuiltImages(config: PHConnectRuntimeConfig | unde
|
|
|
1078
1111
|
remoteBackends?: {
|
|
1079
1112
|
name: string;
|
|
1080
1113
|
url: string;
|
|
1114
|
+
requestTimeoutMs?: number | undefined;
|
|
1115
|
+
breaker?: false | {
|
|
1116
|
+
failures?: number | undefined;
|
|
1117
|
+
openMs?: number | undefined;
|
|
1118
|
+
} | undefined;
|
|
1119
|
+
realtime?: boolean | undefined;
|
|
1081
1120
|
}[] | undefined;
|
|
1082
1121
|
collections?: Record<string, {
|
|
1083
1122
|
backend: string;
|
|
1084
1123
|
sync?: boolean | undefined;
|
|
1085
1124
|
}> | undefined;
|
|
1125
|
+
router?: {
|
|
1126
|
+
newDrives?: string | undefined;
|
|
1127
|
+
probeTimeoutMs?: number | undefined;
|
|
1128
|
+
provisionalRouteMs?: number | undefined;
|
|
1129
|
+
} | undefined;
|
|
1086
1130
|
} | undefined;
|
|
1087
1131
|
pwa?: {
|
|
1088
1132
|
globPatterns?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;qBA2Ca;qBA0CA,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B;qBAC/C,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB;;YAGhC,cAAc,aAAe;;YAE7B,oBAAoB,cAAgB;;;qBAInC,eAAa;;;;;GAGxB;YACU,iBAAiB,gBAAe;QAEpC;YACI;IACR;MACE,MAAM;MACN,SAAS;;;;wBA4QC,mBAAmB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiBrB,IACpB,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa;;;qBAiBX,YAAG;;wBAGM,MACpB,MAAM,mBACN,KAAK,gBACJ;;;;;;;;;wBAuBmB,MACpB,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa"}
|
package/dist/runners/connect.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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]="
|
|
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]="7e762e19-af26-598e-9f31-f860190f9514")}catch(e){}}();
|
|
3
3
|
import { d as string, f as union, i as boolean, m as url, o as literal, u as strictObject } from "../schemas-ByfuhvAb.mjs";
|
|
4
|
-
import { N as normalizePluginEntries, _ as entryActiveForVerb, m as defineHostSchemas, y as findDeadConnectConfig } from "../compound-
|
|
5
|
-
import { _ as resolveDriveDeclaration, a as isStructuralMultiReactor, c as placeConnectDrives, d as projectReactorToConnect, g as remoteBackendUrls, o as mergeDefaultDrives, u as projectDrivesIntoConnect } from "../dist-
|
|
4
|
+
import { G as refineConnectReactor, N as normalizePluginEntries, _ as entryActiveForVerb, m as defineHostSchemas, y as findDeadConnectConfig } from "../compound-BZb3tR_c-CAf7DitW.mjs";
|
|
5
|
+
import { _ as resolveDriveDeclaration, a as isStructuralMultiReactor, c as placeConnectDrives, d as projectReactorToConnect, g as remoteBackendUrls, o as mergeDefaultDrives, u as projectDrivesIntoConnect } from "../dist-tZHpCFn_.mjs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
|
|
8
8
|
import { connectConfigSchemaWith } from "@powerhousedao/shared/connect/connect-config-schema";
|
|
@@ -49,7 +49,7 @@ const schemas = defineHostSchemas((s) => s.reactorHostSchema.extend({
|
|
|
49
49
|
proxy: strictObject({ target: s.tokenable(url()) }).optional()
|
|
50
50
|
}).strict(),
|
|
51
51
|
config: connectConfigSchemaWith(s.tokenable).optional()
|
|
52
|
-
}));
|
|
52
|
+
}).superRefine(refineConnectReactor));
|
|
53
53
|
const declaredHostSchema = schemas.declaredHostSchema;
|
|
54
54
|
const hostSchema = schemas.hostSchema;
|
|
55
55
|
/** What a started Connect (`dev`/`run`/`serve`) produces: the origin it
|
|
@@ -214,7 +214,7 @@ async function startUnderSupervisor(ctx, start) {
|
|
|
214
214
|
/** Fail at `ph run`, naming the plugin and key, when a composed Connect
|
|
215
215
|
* plugin's entry config does not match its schema. */
|
|
216
216
|
async function validateComposition(host, ctx) {
|
|
217
|
-
const { validateConnectPluginConfigs } = await import("../connect-plugin-configs-
|
|
217
|
+
const { validateConnectPluginConfigs } = await import("../connect-plugin-configs-DazgTR0p.mjs");
|
|
218
218
|
await validateConnectPluginConfigs(ctx.projectRoot, host.runner.plugins, ctx.verb, `hosts/${host.name}/host.js`);
|
|
219
219
|
}
|
|
220
220
|
/** A project file the build resolved: the built dist has it (as icon.ico or
|
|
@@ -237,7 +237,7 @@ function withoutBuiltImages(config) {
|
|
|
237
237
|
const viteCacheOf = (host, ctx) => join(ctx.projectRoot, "node_modules", `.vite-${host.name.replace(/[^\w.-]/g, "_")}`);
|
|
238
238
|
async function dev(host, ctx) {
|
|
239
239
|
await validateComposition(host, ctx);
|
|
240
|
-
const { runConnectStudio } = await import("../connect-studio-
|
|
240
|
+
const { runConnectStudio } = await import("../connect-studio-CJ8ImldI.mjs");
|
|
241
241
|
const args = toStudioArgs(host);
|
|
242
242
|
return connectHandle(await startUnderSupervisor(ctx, () => runConnectStudio(args, void 0, callerOverride(host, ctx, ctx.verb), {
|
|
243
243
|
routes: host.runner.routes,
|
|
@@ -254,7 +254,7 @@ const run = dev;
|
|
|
254
254
|
/** P3.3 — `build`: the SAME service as classic `ph connect build`. */
|
|
255
255
|
async function build(host, ctx) {
|
|
256
256
|
await validateComposition(host, ctx);
|
|
257
|
-
const { runConnectBuild } = await import("../connect-build-
|
|
257
|
+
const { runConnectBuild } = await import("../connect-build-DMKUu9mw.mjs");
|
|
258
258
|
await runConnectBuild({ outDir: host.runner.outDir ?? DEFAULT_CONNECT_OUTDIR }, callerOverride(host, ctx, ctx.verb), { routes: host.runner.routes });
|
|
259
259
|
}
|
|
260
260
|
/** P3.3 — `serve`: the SAME vite preview server as classic
|
|
@@ -294,4 +294,4 @@ async function serve(host, ctx) {
|
|
|
294
294
|
export { build, declaredHostSchema, dev, hostSchema, kind, outputsSchema, run, serve, withoutBuiltImages };
|
|
295
295
|
|
|
296
296
|
//# sourceMappingURL=connect.mjs.map
|
|
297
|
-
//# debugId=
|
|
297
|
+
//# debugId=7e762e19-af26-598e-9f31-f860190f9514
|
|
@@ -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 remoteBackendUrls,\n type ReactorConfig,\n type RunnerContext,\n type RunnerHandle,\n} from \"@powerhousedao/host-core\";\nimport { join } from \"node:path\";\nimport { z } from \"zod\";\nimport type {\n ConnectBuildArgs,\n ConnectPreviewArgs,\n ConnectStudioArgs,\n} from \"../types.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.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);\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. */\ninterface 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. */\nfunction 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/** The studio arg surface is wide (commonArgs + server args); the service only\n * reads a known subset, and the repo's own tests build these objects the same\n * way (Partial + cast — see connect-build.test.ts `mk()`). */\nfunction toStudioArgs(host: ConnectHostParsed): ConnectStudioArgs {\n const runner = host.runner;\n const args: Partial<ConnectStudioArgs> = {\n port: runner.port ?? DEFAULT_CONNECT_STUDIO_PORT,\n // The bind address (runnerBaseSchema `host`); unset keeps vite's default.\n ...(runner.host ? { host: runner.host } : {}),\n open: runner.openBrowser === true,\n strictPort: runner.strictPort === true,\n printUrls: true,\n bindCLIShortcuts: false,\n };\n return args as ConnectStudioArgs;\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 id: drive.id,\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 */\nfunction 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 // 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 */\nasync 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. */\nasync 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// Per host: Studio and other hosts' dev servers run side by side in one project.\nconst viteCacheOf = (host: ConnectHostParsed, ctx: RunnerContext) =>\n join(\n ctx.projectRoot,\n \"node_modules\",\n `.vite-${host.name.replace(/[^\\w.-]/g, \"_\")}`,\n );\n\nexport async function dev(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n await validateComposition(host, ctx);\n const { runConnectStudio } = await import(\"../services/connect-studio.js\");\n const args = toStudioArgs(host);\n const server = await startUnderSupervisor(ctx, () =>\n runConnectStudio(args, undefined, callerOverride(host, ctx, ctx.verb), {\n routes: host.runner.routes,\n cacheDir: viteCacheOf(host, ctx),\n proxy: host.runner.proxy?.target,\n }),\n );\n // vite's dev server binds its default host (\"localhost\") here.\n return connectHandle(server, { host: \"localhost\", port: args.port });\n}\n\n/** `run` is dev-studio until the plugin phases give hosts a production\n * runtime; `serve` (below) is the static production server. */\nexport const run = dev;\n\n/** P3.3 — `build`: the SAME service as classic `ph connect build`. */\nexport async function build(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<void> {\n await validateComposition(host, ctx);\n const { runConnectBuild } = await import(\"../services/connect-build.js\");\n const args: Partial<ConnectBuildArgs> = {\n // Classic `ph connect`'s default: `dist/` is the package `ph build` writes.\n outDir: host.runner.outDir ?? DEFAULT_CONNECT_OUTDIR,\n };\n // The host's config bakes in: its title, favicon, manifest, base path and loading shell.\n await runConnectBuild(\n args as ConnectBuildArgs,\n callerOverride(host, ctx, ctx.verb),\n { routes: host.runner.routes },\n );\n}\n\n/** P3.3 — `serve`: the SAME vite preview server as classic\n * `ph connect preview` (static serve of a built Connect; run `build` first).\n * The host's connect config (including a supervising compound's projected\n * drives and the reactor projection) rides a serve override: the baked\n * powerhouse.config.json merges with it at request time, and\n * `runner.cspRegistrySync` (set by the compound's wiring) patches the baked\n * 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 serve(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n await validateComposition(host, ctx);\n const { runConnectPreview } = await import(\"../services/connect-preview.js\");\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(ctx, () =>\n runConnectPreview(\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"],"names":["z.boolean","z.string","z.union","z.literal","z.strictObject","z.url"],"mappings":";;;;;;;;;;;;;;;;;AA0CA,MAAa,OAAO;;;;;;;;;AAUpB,MAAM,UAAU,mBAAmB,MACjC,EAAE,kBAAkB,OAAO;CACzB,QAAQ,EAAE,iBACP,OAAO;;EAEN,aAAaA,QAAU,CAAC,CAAC,SAAS;;EAElC,YAA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AQ,OAAO,UAAU;EACzB,MAAM,OAAO,gBAAgB;EAC7B,YAAY,OAAO,eAAe;EAClC,MAAM;EACN,WAAW;EACX,kBAAkB;EAIlB,MAAM;CACR;CACA,MAAM,WAAW,mBAAmB,eAAe,MAAM,KAAK,IAAI,IAAI,CAAC;CAYvE,OAAO,cAAc,MAXA,qBAAqB,WACxC,kBACE,MACA;EACE,SAAS;EACT,iBAAiB,OAAO,oBAAoB;CAC9C,GACA,KAAA,GACA,EAAE,OAAO,OAAO,OAAO,OAAO,CAChC,CACF,GAC6B;EAAE,MAAM;EAAM;CAAK,CAAC;AACnD","debug_id":"157d6b2b-5c01-569b-97ac-5411de6453f9"}
|
|
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 refineConnectReactor,\n remoteBackendUrls,\n type ReactorConfig,\n type RunnerContext,\n type RunnerHandle,\n} from \"@powerhousedao/host-core\";\nimport { join } from \"node:path\";\nimport { z } from \"zod\";\nimport type {\n ConnectBuildArgs,\n ConnectPreviewArgs,\n ConnectStudioArgs,\n} from \"../types.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. */\ninterface 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. */\nfunction 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/** The studio arg surface is wide (commonArgs + server args); the service only\n * reads a known subset, and the repo's own tests build these objects the same\n * way (Partial + cast — see connect-build.test.ts `mk()`). */\nfunction toStudioArgs(host: ConnectHostParsed): ConnectStudioArgs {\n const runner = host.runner;\n const args: Partial<ConnectStudioArgs> = {\n port: runner.port ?? DEFAULT_CONNECT_STUDIO_PORT,\n // The bind address (runnerBaseSchema `host`); unset keeps vite's default.\n ...(runner.host ? { host: runner.host } : {}),\n open: runner.openBrowser === true,\n strictPort: runner.strictPort === true,\n printUrls: true,\n bindCLIShortcuts: false,\n };\n return args as ConnectStudioArgs;\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 id: drive.id,\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 */\nfunction 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 // 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 */\nasync 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. */\nasync 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// Per host: Studio and other hosts' dev servers run side by side in one project.\nconst viteCacheOf = (host: ConnectHostParsed, ctx: RunnerContext) =>\n join(\n ctx.projectRoot,\n \"node_modules\",\n `.vite-${host.name.replace(/[^\\w.-]/g, \"_\")}`,\n );\n\nexport async function dev(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n await validateComposition(host, ctx);\n const { runConnectStudio } = await import(\"../services/connect-studio.js\");\n const args = toStudioArgs(host);\n const server = await startUnderSupervisor(ctx, () =>\n runConnectStudio(args, undefined, callerOverride(host, ctx, ctx.verb), {\n routes: host.runner.routes,\n cacheDir: viteCacheOf(host, ctx),\n proxy: host.runner.proxy?.target,\n }),\n );\n // vite's dev server binds its default host (\"localhost\") here.\n return connectHandle(server, { host: \"localhost\", port: args.port });\n}\n\n/** `run` is dev-studio until the plugin phases give hosts a production\n * runtime; `serve` (below) is the static production server. */\nexport const run = dev;\n\n/** P3.3 — `build`: the SAME service as classic `ph connect build`. */\nexport async function build(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<void> {\n await validateComposition(host, ctx);\n const { runConnectBuild } = await import(\"../services/connect-build.js\");\n const args: Partial<ConnectBuildArgs> = {\n // Classic `ph connect`'s default: `dist/` is the package `ph build` writes.\n outDir: host.runner.outDir ?? DEFAULT_CONNECT_OUTDIR,\n };\n // The host's config bakes in: its title, favicon, manifest, base path and loading shell.\n await runConnectBuild(\n args as ConnectBuildArgs,\n callerOverride(host, ctx, ctx.verb),\n { routes: host.runner.routes },\n );\n}\n\n/** P3.3 — `serve`: the SAME vite preview server as classic\n * `ph connect preview` (static serve of a built Connect; run `build` first).\n * The host's connect config (including a supervising compound's projected\n * drives and the reactor projection) rides a serve override: the baked\n * powerhouse.config.json merges with it at request time, and\n * `runner.cspRegistrySync` (set by the compound's wiring) patches the baked\n * 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 serve(\n host: ConnectHostParsed,\n ctx: RunnerContext,\n): Promise<RunnerHandle<ConnectOutputs>> {\n await validateComposition(host, ctx);\n const { runConnectPreview } = await import(\"../services/connect-preview.js\");\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(ctx, () =>\n runConnectPreview(\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"],"names":["z.boolean","z.string","z.union","z.literal","z.strictObject","z.url"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAa,OAAO;;;;;;;;;AAUpB,M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EAAE,sBAAsB,MAAM,OAAO;CAC3C,MAAM,SAAS,KAAK;CACpB,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,OAAoC;EACxC;EACA,QAAQ,OAAO,UAAU;EACzB,MAAM,OAAO,gBAAgB;EAC7B,YAAY,OAAO,eAAe;EAClC,MAAM;EACN,WAAW;EACX,kBAAkB;EAIlB,MAAM;CACR;CACA,MAAM,WAAW,mBAAmB,eAAe,MAAM,KAAK,IAAI,IAAI,CAAC;CAYvE,OAAO,cAAc,MAXA,qBAAqB,WACxC,kBACE,MACA;EACE,SAAS;EACT,iBAAiB,OAAO,oBAAoB;CAC9C,GACA,KAAA,GACA,EAAE,OAAO,OAAO,OAAO,OAAO,CAChC,CACF,GAC6B;EAAE,MAAM;EAAM;CAAK,CAAC;AACnD","debug_id":"7e762e19-af26-598e-9f31-f860190f9514"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ZodType, D as output$1, E as ZodUnknown, O as $ZodTypeInternals, S as ZodString, T as ZodUnion, b as ZodOptional, c as RunnerHandle, d as input, f as output, g as ZodLiteral, h as ZodEnum, i as EnvToken, k as $strict, l as TokenableSchema, m as ZodBoolean, n as BootIssue, p as ZodArray, s as RunnerContext, t as BootCheckContext, u as external_d_exports, v as ZodNumber, w as ZodURL, x as ZodRecord, y as ZodObject } from "../index-
|
|
1
|
+
import { C as ZodType, D as output$1, E as ZodUnknown, O as $ZodTypeInternals, S as ZodString, T as ZodUnion, b as ZodOptional, c as RunnerHandle, d as input, f as output, g as ZodLiteral, h as ZodEnum, i as EnvToken, k as $strict, l as TokenableSchema, m as ZodBoolean, n as BootIssue, p as ZodArray, s as RunnerContext, t as BootCheckContext, u as external_d_exports, v as ZodNumber, w as ZodURL, x as ZodRecord, y as ZodObject } from "../index-V0t4klsV.mjs";
|
|
2
2
|
import { ParsedCmdResult } from "@powerhousedao/shared/clis";
|
|
3
3
|
//#region src/commands/switchboard.d.ts
|
|
4
4
|
declare const switchboard: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
@@ -97,11 +97,22 @@ export declare const declaredHostSchema: ZodObject<{
|
|
|
97
97
|
}, $strict>>;
|
|
98
98
|
remote: ZodOptional<ZodObject<{
|
|
99
99
|
url: TokenableSchema<ZodUnion<readonly [ZodURL, ZodString]>>;
|
|
100
|
+
requestTimeoutMs: ZodOptional<ZodNumber>;
|
|
101
|
+
breaker: ZodOptional<ZodUnion<readonly [ZodLiteral<false>, ZodObject<{
|
|
102
|
+
failures: ZodOptional<ZodNumber>;
|
|
103
|
+
openMs: ZodOptional<ZodNumber>;
|
|
104
|
+
}, $strict>]>>;
|
|
105
|
+
realtime: ZodOptional<ZodBoolean>;
|
|
100
106
|
}, $strict>>;
|
|
101
107
|
}, $strict>>>;
|
|
102
108
|
placement: ZodOptional<ZodObject<{
|
|
103
109
|
primary: ZodOptional<ZodString>;
|
|
104
110
|
drives: ZodOptional<ZodRecord<ZodString, ZodString>>;
|
|
111
|
+
newDrives: ZodOptional<ZodString>;
|
|
112
|
+
}, $strict>>;
|
|
113
|
+
router: ZodOptional<ZodObject<{
|
|
114
|
+
probeTimeoutMs: ZodOptional<ZodNumber>;
|
|
115
|
+
provisionalRouteMs: ZodOptional<ZodNumber>;
|
|
105
116
|
}, $strict>>;
|
|
106
117
|
protocol: ZodOptional<ZodObject<{
|
|
107
118
|
featureFlags: ZodOptional<ZodObject<{
|
|
@@ -901,11 +912,22 @@ export declare const hostSchema: ZodObject<{
|
|
|
901
912
|
}, $strict>>;
|
|
902
913
|
remote: ZodOptional<ZodObject<{
|
|
903
914
|
url: TokenableSchema<ZodUnion<readonly [ZodURL, ZodString]>>;
|
|
915
|
+
requestTimeoutMs: ZodOptional<ZodNumber>;
|
|
916
|
+
breaker: ZodOptional<ZodUnion<readonly [ZodLiteral<false>, ZodObject<{
|
|
917
|
+
failures: ZodOptional<ZodNumber>;
|
|
918
|
+
openMs: ZodOptional<ZodNumber>;
|
|
919
|
+
}, $strict>]>>;
|
|
920
|
+
realtime: ZodOptional<ZodBoolean>;
|
|
904
921
|
}, $strict>>;
|
|
905
922
|
}, $strict>>>;
|
|
906
923
|
placement: ZodOptional<ZodObject<{
|
|
907
924
|
primary: ZodOptional<ZodString>;
|
|
908
925
|
drives: ZodOptional<ZodRecord<ZodString, ZodString>>;
|
|
926
|
+
newDrives: ZodOptional<ZodString>;
|
|
927
|
+
}, $strict>>;
|
|
928
|
+
router: ZodOptional<ZodObject<{
|
|
929
|
+
probeTimeoutMs: ZodOptional<ZodNumber>;
|
|
930
|
+
provisionalRouteMs: ZodOptional<ZodNumber>;
|
|
909
931
|
}, $strict>>;
|
|
910
932
|
protocol: ZodOptional<ZodObject<{
|
|
911
933
|
featureFlags: ZodOptional<ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchboard.d.mts","names":[],"sources":["../../src/commands/switchboard.ts","../../src/types.ts","../../src/runners/switchboard.ts"],"mappings":";;;cAGa,aAAW,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6CtB,6CAAA,iDAAA,mDAAA;;;KCkBU,kBAAkB,uBAAuB;;;;;;;;;qBCxBxC;qBAoCA,oBAAkB
|
|
1
|
+
{"version":3,"file":"switchboard.d.mts","names":[],"sources":["../../src/commands/switchboard.ts","../../src/types.ts","../../src/runners/switchboard.ts"],"mappings":";;;cAGa,aAAW,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6CtB,6CAAA,iDAAA,mDAAA;;;KCkBU,kBAAkB,uBAAuB;;;;;;;;;qBCxBxC;qBAoCA,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB;;YAGhC,kBAAkB,aAAe;;YAEjC,wBAAwB,cAAgB;;qBAGvC,8BAA4B;;;GAGvC;;;;;;;qBAQW,eAAa;;;;;;;;;;GAOxB;YACU,qBAAqB,gBAAe;QAExC;YACI;IACR;MACE,MAAM;MACN,SAAS;;;;;YAMH,wBAAwB,KAAK;EACvC;;;;;;;;;;;;;;wBAqGoB,aACpB,aACA,mBACA,eAAe,kBACf,mBAAkB,QACjB;;YAqBS,oBAAoB,aAAa;wBA4SvB,IACpB,MAAM,uBACN,KAAK,gBACJ,QAAQ;qBAIE,cAAK;wBAEI,IACpB,MAAM,uBACN,KAAK,gBACJ,QAAQ;;wBAKW,UACpB,MAAM,uBACN,KAAK,mBACJ,QAAQ;;;wBA+CW,MACpB,MAAM,uBACN,MAAM,gBACL"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
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]="8ac355ed-0009-5ab4-98c0-9155899b7f68")}catch(e){}}();
|
|
3
3
|
import { c as number$1, d as string$1, g as prettifyError, i as boolean$1, l as record, m as url, u as strictObject } from "../schemas-ByfuhvAb.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { _ as resolveDriveDeclaration, f as protocolConflicts, s as mergeDrivePlan, v as seedDrives } from "../dist-
|
|
6
|
-
import { a as reactorBlockConflicts, c as switchboardDevMode, i as prepareMemberStorage, n as memberSwitchboardConfig, o as readModelAsReactorStore, r as memberSwitchboardConfigSchema, t as memberEnvOf } from "../member-config-
|
|
4
|
+
import { J as resolveHostPlugins, g as drivesSchema, m as defineHostSchemas } from "../compound-BZb3tR_c-CAf7DitW.mjs";
|
|
5
|
+
import { _ as resolveDriveDeclaration, f as protocolConflicts, s as mergeDrivePlan, v as seedDrives } from "../dist-tZHpCFn_.mjs";
|
|
6
|
+
import { a as reactorBlockConflicts, c as switchboardDevMode, i as prepareMemberStorage, n as memberSwitchboardConfig, o as readModelAsReactorStore, r as memberSwitchboardConfigSchema, t as memberEnvOf } from "../member-config-DJUsoeHe.mjs";
|
|
7
7
|
import { command, runSafely } from "cmd-ts";
|
|
8
8
|
import { switchboardArgs } from "@powerhousedao/shared/clis/args";
|
|
9
9
|
import path from "node:path";
|
|
@@ -642,7 +642,7 @@ async function start(host, ctx, devMode) {
|
|
|
642
642
|
const slug = localHostDrives.length > 0 ? localHostDrives[0].drive.slug : defaultSlug;
|
|
643
643
|
const driveUrl = driveUrlOf(slug);
|
|
644
644
|
if (entries === void 0 && switchboard.workflowsEnabled) {
|
|
645
|
-
const { seedWorkflowsDrive } = await import("../vetra-
|
|
645
|
+
const { seedWorkflowsDrive } = await import("../vetra-BRyjbepO.mjs");
|
|
646
646
|
const { generateProjectDriveId } = await import("../utils-DAux4Ga7.mjs");
|
|
647
647
|
const url = await seeding(seedWorkflowsDrive(switchboard.reactor, port));
|
|
648
648
|
if (url) drives.workflows = {
|
|
@@ -1,6 +1,6 @@
|
|
|
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]="
|
|
3
|
-
import { A as loadProducers, B as processResolveEnv, E as isSchemaLike,
|
|
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]="036766c0-5c44-509a-ac61-5b3e33feafdc")}catch(e){}}();
|
|
3
|
+
import { A as loadProducers, B as processResolveEnv, E as isSchemaLike, P as outputRefsOf, S as getVerb, U as readProjectName, V as producerOutputsSchemas, W as readRunRecord, X as resolveRunnerModule, Z as runRecordOutputSource, at as writeRunRecord, it as validateHost, k as loadHost, l as clearRunRecord, q as resolveHostOutputs, r as ONE_SHOT_VERBS, rt as validateDeclaredHost, tt as toStartedHandle, z as probeRun } from "./compound-BZb3tR_c-CAf7DitW.mjs";
|
|
4
4
|
//#region src/services/run/start-run.ts
|
|
5
5
|
/**
|
|
6
6
|
* `ph run <host> [verb]`: dispatch the verb (default `run`) of the host's
|
|
@@ -120,5 +120,5 @@ async function publishOutputs(runner, result, target) {
|
|
|
120
120
|
//#endregion
|
|
121
121
|
export { startRun };
|
|
122
122
|
|
|
123
|
-
//# sourceMappingURL=start-run-
|
|
124
|
-
//# debugId=
|
|
123
|
+
//# sourceMappingURL=start-run-x-6Ccna-.mjs.map
|
|
124
|
+
//# debugId=036766c0-5c44-509a-ac61-5b3e33feafdc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-run-
|
|
1
|
+
{"version":3,"file":"start-run-x-6Ccna-.mjs","sources":["../src/services/run/start-run.ts"],"sourcesContent":["import {\n clearRunRecord,\n getVerb,\n isSchemaLike,\n loadHost,\n loadProducers,\n ONE_SHOT_VERBS,\n outputRefsOf,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n readRunRecord,\n resolveHostOutputs,\n resolveRunnerModule,\n runRecordOutputSource,\n toStartedHandle,\n validateDeclaredHost,\n validateHost,\n writeRunRecord,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\nexport interface StartRunArgs {\n host: string;\n verb?: string;\n projectRoot?: string;\n debug?: boolean;\n}\n\n/**\n * `ph run <host> [verb]`: dispatch the verb (default `run`) of the host's\n * declared runner. There is deliberately no type→runner registry — what a\n * host does is written in its own file.\n *\n * The pipeline (typed-host-configs 3.5): declared validation (token shapes,\n * `$output` paths against the producers' outputsSchemas, the runner's\n * declaredHostSchema), the live-instance lock, resolution (`$output` from\n * the producers' live run records, `$env` from this process, the\n * `${userData}` sugar), resolved validation, then the verb with the parsed\n * host. A compound runner gets its declared host: its members resolve their\n * own tokens as they start.\n *\n * A reactor runner that exports `outputsSchema` has its handle's outputs\n * published in a v2 `.ph/run/<name>.json` record once ready; this is the only\n * standalone writer (mastra included). Compounds write their own record with\n * the members in it; one-shot verbs (`build`) return nothing and write none.\n */\nexport async function startRun(args: StartRunArgs): Promise<unknown> {\n const projectRoot = args.projectRoot ?? process.cwd();\n const loaded = await loadHost(projectRoot, args.host);\n const { warnSupersededConfigKeys } = await import(\"./superseded-config.js\");\n warnSupersededConfigKeys(projectRoot);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(projectRoot, specifier);\n const verb = args.verb ?? \"run\";\n const fn = getVerb(runner, specifier, verb);\n const file = loaded.file;\n if (args.debug) {\n console.log({ host: loaded.host.name, runner: specifier, verb });\n }\n\n if (runner.kind === \"compound\") {\n validateDeclaredHost(runner, specifier, loaded.host, file);\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n return fn(host, { projectRoot, verb, env: process.env });\n }\n\n const projectName = readProjectName(projectRoot);\n const producers = await loadProducers(projectRoot, outputRefsOf(loaded.host));\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n const oneShot = ONE_SHOT_VERBS.has(verb);\n if (oneShot) {\n // `build` reads no other host's outputs: no producer needs to run.\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n return fn(host, { projectRoot, verb, env: process.env });\n }\n const publishes = isSchemaLike(runner.outputsSchema);\n // Before the verb starts anything: a second live instance would take\n // over the first one's record (and clear it on exit).\n if (publishes) assertNotRunning(projectRoot, loaded.host.name, projectName);\n const resolved = resolveHostOutputs(loaded.host, {\n outputs: runRecordOutputSource(projectRoot, {\n consumer: args.host,\n producers,\n projectName,\n }),\n ...processResolveEnv(projectRoot),\n where: `hosts/${args.host}/host.js`,\n });\n const host = validateHost(runner, specifier, resolved, file);\n const result = await fn(host, { projectRoot, verb, env: process.env });\n if (publishes && result !== undefined && result !== null) {\n await publishOutputs(runner, result, {\n projectRoot,\n projectName,\n hostName: loaded.host.name,\n specifier,\n verb,\n });\n }\n return result;\n}\n\nfunction assertNotRunning(\n projectRoot: string,\n hostName: string,\n projectName: string,\n): void {\n const probe = probeRun(projectRoot, hostName, projectName);\n if (probe.status === \"live\" && probe.record.pid !== process.pid) {\n throw new Error(\n `${hostName} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`,\n );\n }\n if (probe.status === \"foreign\") {\n throw new Error(\n `.ph/run/${hostName}.json describes a live \"${probe.record.projectName}\", but this project is \"${projectName}\". Refusing to start a second instance.`,\n );\n }\n}\n\ninterface PublishTarget {\n projectRoot: string;\n projectName: string;\n hostName: string;\n specifier: string;\n verb: string;\n}\n\n/** Await `ready`, validate the outputs, write the v2 record and clear it on\n * exit. A handle that never gets ready or reports invalid outputs is shut\n * down before the error propagates. */\nasync function publishOutputs(\n runner: RunnerModule,\n result: unknown,\n target: PublishTarget,\n): Promise<void> {\n const where = `${target.specifier} ${target.verb}`;\n const handle = toStartedHandle(result, where);\n const name = target.projectName;\n let outputs: unknown;\n try {\n if (!isSchemaLike(runner.outputsSchema)) return;\n // Checked again after the start: an instance that started meanwhile.\n assertNotRunning(target.projectRoot, target.hostName, name);\n if (handle.ready) await handle.ready;\n const parsed = runner.outputsSchema.safeParse(handle.outputs);\n if (!parsed.success) {\n const issues = parsed.error.issues\n .map(\n (issue) =>\n ` - ${issue.path.map(String).join(\".\") || \"<root>\"}: ${issue.message}`,\n )\n .join(\"\\n\");\n throw new Error(\n `${where} reported outputs that fail its outputsSchema:\\n${issues}`,\n );\n }\n outputs = parsed.data;\n } catch (error) {\n await handle.shutdown?.();\n throw error;\n }\n\n writeRunRecord(target.projectRoot, {\n version: 2,\n host: target.hostName,\n projectName: name,\n kind: \"reactor\",\n verb: target.verb,\n pid: process.pid,\n startedAt: new Date().toISOString(),\n outputs: outputs as Record<string, unknown>,\n });\n // No SIGINT/SIGTERM handler: the switchboard reactor's own handler kills\n // the reactor before draining the api, and a parallel shutdown() would\n // break that order. Without an exit event the record keeps a dead pid,\n // which probeRun reports as stale.\n process.on(\"exit\", () => {\n if (readRunRecord(target.projectRoot, target.hostName)?.pid === process.pid)\n clearRunRecord(target.projectRoot, target.hostName);\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAsB,SAAS,MAAsC;CACnE,MAAM,cAAc,KAAK,eAAe,QAAQ,IAAI;CACpD,MAAM,SAAS,MAAM,SAAS,aAAa,KAAK,IAAI;CACpD,MAAM,EAAE,6BAA6B,MAAM,OAAO;CAClD,yBAAyB,WAAW;CACpC,MAAM,YAAY,OAAO,KAAK,OAAO;CACrC,MAAM,SAAS,MAAM,oBAAoB,aAAa,SAAS;CAC/D,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,KAAK,QAAQ,QAAQ,WAAW,IAAI;CAC1C,MAAM,OAAO,OAAO;CACpB,IAAI,KAAK,OACP,QAAQ,IAAI;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feafdc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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]="
|
|
3
|
-
import { h as rebaseDriveUrl, o as mergeDefaultDrives } from "./dist-
|
|
4
|
-
import { a as parseDefaultDrivesUrl, i as wasFlagExplicitlyPassed } from "./cli-connect-override-
|
|
5
|
-
import { t as runConnectStudio } from "./connect-studio-
|
|
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]="2b0946bc-18e9-59f5-b0cc-a043b34d6f44")}catch(e){}}();
|
|
3
|
+
import { h as rebaseDriveUrl, o as mergeDefaultDrives } from "./dist-tZHpCFn_.mjs";
|
|
4
|
+
import { a as parseDefaultDrivesUrl, i as wasFlagExplicitlyPassed } from "./cli-connect-override-Dm55uCjR.mjs";
|
|
5
|
+
import { t as runConnectStudio } from "./connect-studio-DaaQOVBr.mjs";
|
|
6
6
|
import { a as generateProjectDriveId, t as POWERHOUSE_CONFIG_FILE } from "./utils-9KyRM0mf.mjs";
|
|
7
7
|
import { a as stopVetra, c as probeVetraRuntime, d as writeVetraRuntime, o as clearVetraRuntime, s as legacyMcpConfigs, u as syncMcpPort } from "./vetra-launch-DQDZxGTV.mjs";
|
|
8
8
|
import { a as POWERHOUSE_DRIVE_ICON, r as startSwitchboard$1 } from "./switchboard-JcKcWTaT.mjs";
|
|
@@ -558,5 +558,5 @@ async function startVetra(args) {
|
|
|
558
558
|
//#endregion
|
|
559
559
|
export { seedWorkflowsDrive, startVetra };
|
|
560
560
|
|
|
561
|
-
//# sourceMappingURL=vetra-
|
|
562
|
-
//# debugId=
|
|
561
|
+
//# sourceMappingURL=vetra-BRyjbepO.mjs.map
|
|
562
|
+
//# debugId=2b0946bc-18e9-59f5-b0cc-a043b34d6f44
|