@powerhousedao/ph-cli 6.2.3-dev.55 → 6.2.3-dev.57
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/{cli-connect-override-b4kKqgOZ.mjs → cli-connect-override-DGXyoqdV.mjs} +5 -28
- package/dist/cli-connect-override-DGXyoqdV.mjs.map +1 -0
- package/dist/cli.mjs +15 -1396
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-BLxeFrSb.mjs → connect-build-EYGNSUc_.mjs} +5 -5
- package/dist/{connect-build-BLxeFrSb.mjs.map → connect-build-EYGNSUc_.mjs.map} +1 -1
- package/dist/{connect-config-DGfPEeP8.mjs → connect-config-BDmghUZF.mjs} +4 -4
- package/dist/{connect-config-DGfPEeP8.mjs.map → connect-config-BDmghUZF.mjs.map} +1 -1
- package/dist/connect-preview-Clue7SVp.mjs +122 -0
- package/dist/connect-preview-Clue7SVp.mjs.map +1 -0
- package/dist/{connect-studio-f3K1qPWd.mjs → connect-studio-CM4t2tWz.mjs} +3 -3
- package/dist/{connect-studio-_-O1-oef.mjs → connect-studio-sc-e0xBI.mjs} +4 -4
- package/dist/{connect-studio-_-O1-oef.mjs.map → connect-studio-sc-e0xBI.mjs.map} +1 -1
- package/dist/dist-BVyjAjXL.mjs +142 -0
- package/dist/dist-BVyjAjXL.mjs.map +1 -0
- package/dist/feature-flags-DhEVzlCC.mjs +23 -0
- package/dist/feature-flags-DhEVzlCC.mjs.map +1 -0
- package/dist/{generate-all-CIwP-3aa.mjs → generate-all-CRfVwLJ9.mjs} +5 -3
- package/dist/generate-all-CRfVwLJ9.mjs.map +1 -0
- package/dist/{generate-document-model-DhDQ_06X.mjs → generate-document-model-ChkXjM1s.mjs} +5 -3
- package/dist/generate-document-model-ChkXjM1s.mjs.map +1 -0
- package/dist/{generate-subgraph-Dm27O59o.mjs → generate-subgraph-DmcQWVbd.mjs} +5 -3
- package/dist/generate-subgraph-DmcQWVbd.mjs.map +1 -0
- package/dist/host-schemas-C_MLcYX6-B2qQIdZ-.mjs +4154 -0
- package/dist/host-schemas-C_MLcYX6-B2qQIdZ-.mjs.map +1 -0
- package/dist/index-s1ABBFjB.d.mts +3752 -0
- package/dist/index-s1ABBFjB.d.mts.map +1 -0
- package/dist/{init-CIEMyAug.mjs → init-B6dv9eCs.mjs} +6 -4
- package/dist/init-B6dv9eCs.mjs.map +1 -0
- package/dist/ph-cli-commands-B95L289j.mjs +1439 -0
- package/dist/ph-cli-commands-B95L289j.mjs.map +1 -0
- package/dist/ph-cli-commands-C-uB91lq.mjs +4 -0
- package/dist/reactor-env-BXG9PlMa.mjs +4 -0
- package/dist/reactor-env-CtavpGtJ.mjs +29 -0
- package/dist/reactor-env-CtavpGtJ.mjs.map +1 -0
- package/dist/run-sugar-Dqn7up5U.mjs +39 -0
- package/dist/run-sugar-Dqn7up5U.mjs.map +1 -0
- package/dist/runners/compound.d.mts +90 -0
- package/dist/runners/compound.d.mts.map +1 -0
- package/dist/runners/compound.mjs +71 -0
- package/dist/runners/compound.mjs.map +1 -0
- package/dist/runners/connect.d.mts +100 -0
- package/dist/runners/connect.d.mts.map +1 -0
- package/dist/runners/connect.mjs +129 -0
- package/dist/runners/connect.mjs.map +1 -0
- package/dist/runners/switchboard.d.mts +92 -0
- package/dist/runners/switchboard.d.mts.map +1 -0
- package/dist/runners/switchboard.mjs +88 -0
- package/dist/runners/switchboard.mjs.map +1 -0
- package/dist/start-run-CAgkeWI1.mjs +36 -0
- package/dist/start-run-CAgkeWI1.mjs.map +1 -0
- package/dist/superseded-config-9D7BdLvd.mjs +53 -0
- package/dist/superseded-config-9D7BdLvd.mjs.map +1 -0
- package/dist/{vetra-B1V1iWGR.mjs → vetra-BY-MHg9R.mjs} +9 -22
- package/dist/vetra-BY-MHg9R.mjs.map +1 -0
- package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs +19 -0
- package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs.map +1 -0
- package/package.json +34 -12
- package/dist/cli-connect-override-b4kKqgOZ.mjs.map +0 -1
- package/dist/connect-preview-CzDqR-JN.mjs +0 -32
- package/dist/connect-preview-CzDqR-JN.mjs.map +0 -1
- package/dist/generate-all-CIwP-3aa.mjs.map +0 -1
- package/dist/generate-document-model-DhDQ_06X.mjs.map +0 -1
- package/dist/generate-subgraph-Dm27O59o.mjs.map +0 -1
- package/dist/init-CIEMyAug.mjs.map +0 -1
- package/dist/vetra-B1V1iWGR.mjs.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
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]="6fb9c616-bc5a-5744-8e61-012c2da6a7a3")}catch(e){}}();
|
|
3
|
+
import { c as reactorSchema, f as boolean, h as string, m as number, o as profileSchema, p as looseObject, s as projectDrivesIntoConnect } from "../host-schemas-C_MLcYX6-B2qQIdZ-.mjs";
|
|
4
|
+
import { i as projectReactorToConnect, n as isStructuralMultiReactor, o as remoteBackendUrls } from "../dist-BVyjAjXL.mjs";
|
|
5
|
+
import { DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
|
|
6
|
+
//#region src/runners/connect.ts
|
|
7
|
+
/**
|
|
8
|
+
* BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a
|
|
9
|
+
* hosts/connect/host.js definition onto the SAME service the classic
|
|
10
|
+
* `ph connect studio` command calls — no forked behavior. Real verbs
|
|
11
|
+
* (`build`, `serve`) arrive with later phases; their absence here is
|
|
12
|
+
* deliberate and surfaces through the verb-listing error.
|
|
13
|
+
*/
|
|
14
|
+
const kind = "reactor";
|
|
15
|
+
/** Phase-2 schema (D2.d): `reactor` and `profile` validate strictly via the
|
|
16
|
+
* shared host-core schemas — a typo'd protocol key fails instead of silently
|
|
17
|
+
* not applying. `config` stays loose: it is runner-defined by design. */
|
|
18
|
+
const hostSchema = looseObject({
|
|
19
|
+
name: string().min(1),
|
|
20
|
+
runner: looseObject({
|
|
21
|
+
module: string(),
|
|
22
|
+
port: number().int().positive().optional(),
|
|
23
|
+
https: boolean().optional(),
|
|
24
|
+
openBrowser: boolean().optional(),
|
|
25
|
+
plugins: string().optional()
|
|
26
|
+
}),
|
|
27
|
+
config: looseObject({}).optional(),
|
|
28
|
+
profile: profileSchema,
|
|
29
|
+
reactor: reactorSchema.optional()
|
|
30
|
+
});
|
|
31
|
+
/** The studio arg surface is wide (commonArgs + server args); the service only
|
|
32
|
+
* reads a known subset, and the repo's own tests build these objects the same
|
|
33
|
+
* way (Partial + cast — see connect-build.test.ts `mk()`). */
|
|
34
|
+
function toStudioArgs(host) {
|
|
35
|
+
const runner = host.runner;
|
|
36
|
+
return {
|
|
37
|
+
port: typeof runner.port === "number" ? runner.port : DEFAULT_CONNECT_STUDIO_PORT,
|
|
38
|
+
open: runner.openBrowser === true,
|
|
39
|
+
strictPort: runner.strictPort === true,
|
|
40
|
+
printUrls: true,
|
|
41
|
+
bindCLIShortcuts: false
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Merge the reactor-block projection (protocol → connect.reactor,
|
|
45
|
+
* backend kind → instance.reactorWorker, workflows → app.workflowsEnabled)
|
|
46
|
+
* into the host's connect config, which rides the studio caller-override.
|
|
47
|
+
* The host config wins on conflict (an explicit connect.* value is intent) —
|
|
48
|
+
* EXCEPT structural multi-reactor (P4.2): declaring a remote backend next to
|
|
49
|
+
* a local one IS the intent, so it beats a scaffold-default
|
|
50
|
+
* instance.multiReactor: false, and the remote's drive url merges FIRST into
|
|
51
|
+
* drives.defaultDrives (the first url entry is what the routing client dials). */
|
|
52
|
+
function callerOverride(host) {
|
|
53
|
+
const base = host.config ?? {};
|
|
54
|
+
const reactor = host.reactor;
|
|
55
|
+
const { connect } = projectReactorToConnect(reactor);
|
|
56
|
+
const structural = isStructuralMultiReactor(reactor);
|
|
57
|
+
if (!connect.reactor && !connect.instance && !connect.app && !structural) return host.config;
|
|
58
|
+
const drives = structural ? projectDrivesIntoConnect({
|
|
59
|
+
createdDriveUrls: remoteBackendUrls(reactor),
|
|
60
|
+
configuredDefaultDrives: base.drives?.defaultDrives
|
|
61
|
+
}).drives : base.drives;
|
|
62
|
+
const instance = Object.keys(reactor?.backends ?? {}).length > 0 ? {
|
|
63
|
+
...base.instance,
|
|
64
|
+
...connect.instance,
|
|
65
|
+
...structural ? { multiReactor: true } : {}
|
|
66
|
+
} : {
|
|
67
|
+
...connect.instance,
|
|
68
|
+
...base.instance
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
...base,
|
|
72
|
+
reactor: {
|
|
73
|
+
...connect.reactor,
|
|
74
|
+
...base.reactor
|
|
75
|
+
},
|
|
76
|
+
instance,
|
|
77
|
+
app: {
|
|
78
|
+
...connect.app,
|
|
79
|
+
...base.app
|
|
80
|
+
},
|
|
81
|
+
...drives ? { drives: {
|
|
82
|
+
...base.drives,
|
|
83
|
+
...drives
|
|
84
|
+
} } : {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function dev(host, _ctx) {
|
|
88
|
+
const { runConnectStudio } = await import("../connect-studio-CM4t2tWz.mjs");
|
|
89
|
+
await runConnectStudio(toStudioArgs(host), void 0, callerOverride(host));
|
|
90
|
+
}
|
|
91
|
+
/** `run` is dev-studio until the plugin phases give hosts a production
|
|
92
|
+
* runtime; `serve` (below) is the static production server. */
|
|
93
|
+
const run = dev;
|
|
94
|
+
/** P3.3 — `build`: the SAME service as classic `ph connect build`. */
|
|
95
|
+
async function build(host, _ctx) {
|
|
96
|
+
const { runConnectBuild } = await import("../connect-build-EYGNSUc_.mjs");
|
|
97
|
+
const runner = host.runner;
|
|
98
|
+
await runConnectBuild({ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist" });
|
|
99
|
+
}
|
|
100
|
+
/** P3.3 — `serve`: the SAME vite preview server as classic
|
|
101
|
+
* `ph connect preview` (static serve of a built Connect; run `build` first).
|
|
102
|
+
* The host's connect config (including a supervising compound's projected
|
|
103
|
+
* drives and the reactor projection) rides a serve override: the baked
|
|
104
|
+
* powerhouse.config.json merges with it at request time, and
|
|
105
|
+
* `runner.cspRegistrySync` (set by the compound's wiring) patches the baked
|
|
106
|
+
* CSP's script-src for the runtime registry — together these replace the
|
|
107
|
+
* ph-win-desktop sidecar's hand-rolled static server (desktop shape). */
|
|
108
|
+
async function serve(host, _ctx) {
|
|
109
|
+
const { runConnectPreview } = await import("../connect-preview-Clue7SVp.mjs");
|
|
110
|
+
const runner = host.runner;
|
|
111
|
+
await runConnectPreview({
|
|
112
|
+
port: typeof runner.port === "number" ? runner.port : DEFAULT_CONNECT_STUDIO_PORT,
|
|
113
|
+
outDir: typeof runner.outDir === "string" ? runner.outDir : "dist",
|
|
114
|
+
open: runner.openBrowser === true,
|
|
115
|
+
strictPort: runner.strictPort === true,
|
|
116
|
+
cors: true,
|
|
117
|
+
printUrls: true,
|
|
118
|
+
bindCLIShortcuts: false,
|
|
119
|
+
host: typeof runner.host === "string" ? runner.host : "127.0.0.1"
|
|
120
|
+
}, {
|
|
121
|
+
connect: callerOverride(host),
|
|
122
|
+
cspRegistrySync: runner.cspRegistrySync === true
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { build, dev, hostSchema, kind, run, serve };
|
|
127
|
+
|
|
128
|
+
//# sourceMappingURL=connect.mjs.map
|
|
129
|
+
//# debugId=6fb9c616-bc5a-5744-8e61-012c2da6a7a3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.mjs","sources":["../../src/runners/connect.ts"],"sourcesContent":["import {\n DEFAULT_CONNECT_STUDIO_PORT,\n type PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport {\n isStructuralMultiReactor,\n profileSchema,\n projectDrivesIntoConnect,\n projectReactorToConnect,\n reactorSchema,\n remoteBackendUrls,\n type HostDefinition,\n type ReactorConfig,\n type RunnerContext,\n} from \"@powerhousedao/host-core\";\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` command calls — no forked behavior. Real verbs\n * (`build`, `serve`) arrive with later phases; their absence here is\n * deliberate and surfaces through the verb-listing error.\n */\n\nexport const kind = \"reactor\";\n\n/** Phase-2 schema (D2.d): `reactor` and `profile` validate strictly via the\n * shared host-core schemas — a typo'd protocol key fails instead of silently\n * not applying. `config` stays loose: it is runner-defined by design. */\nexport const hostSchema = z.looseObject({\n name: z.string().min(1),\n runner: z.looseObject({\n module: z.string(),\n port: z.number().int().positive().optional(),\n https: z.boolean().optional(),\n openBrowser: z.boolean().optional(),\n plugins: z.string().optional(),\n }),\n config: z.looseObject({}).optional(),\n profile: profileSchema,\n reactor: reactorSchema.optional(),\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: HostDefinition): ConnectStudioArgs {\n const runner = host.runner;\n const args: Partial<ConnectStudioArgs> = {\n port:\n typeof runner.port === \"number\"\n ? runner.port\n : DEFAULT_CONNECT_STUDIO_PORT,\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/** Merge the reactor-block projection (protocol → connect.reactor,\n * backend kind → instance.reactorWorker, workflows → app.workflowsEnabled)\n * into the host's connect config, which rides the studio caller-override.\n * The host config wins on conflict (an explicit connect.* value is intent) —\n * EXCEPT structural multi-reactor (P4.2): declaring a remote backend next to\n * a local one IS the intent, so it beats a scaffold-default\n * instance.multiReactor: false, and the remote's drive url merges FIRST into\n * drives.defaultDrives (the first url entry is what the routing client dials). */\nfunction callerOverride(\n host: HostDefinition,\n): PHConnectRuntimeConfig | undefined {\n const base = (host.config ?? {}) as PHConnectRuntimeConfig;\n const reactor = host.reactor as ReactorConfig | undefined;\n const { connect } = projectReactorToConnect(reactor);\n const structural = isStructuralMultiReactor(reactor);\n if (!connect.reactor && !connect.instance && !connect.app && !structural) {\n return host.config as PHConnectRuntimeConfig | undefined;\n }\n const drives = structural\n ? projectDrivesIntoConnect({\n createdDriveUrls: remoteBackendUrls(reactor),\n configuredDefaultDrives: base.drives?.defaultDrives,\n }).drives\n : base.drives;\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 ...(structural ? { multiReactor: true } : {}),\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\nexport async function dev(\n host: HostDefinition,\n _ctx: RunnerContext,\n): Promise<void> {\n const { runConnectStudio } = await import(\"../services/connect-studio.js\");\n await runConnectStudio(toStudioArgs(host), undefined, callerOverride(host));\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: HostDefinition,\n _ctx: RunnerContext,\n): Promise<void> {\n const { runConnectBuild } = await import(\"../services/connect-build.js\");\n const runner = host.runner;\n const args: Partial<ConnectBuildArgs> = {\n outDir: typeof runner.outDir === \"string\" ? runner.outDir : \"dist\",\n };\n await runConnectBuild(args as ConnectBuildArgs);\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: HostDefinition,\n _ctx: RunnerContext,\n): Promise<void> {\n const { runConnectPreview } = await import(\"../services/connect-preview.js\");\n const runner = host.runner;\n const args: Partial<ConnectPreviewArgs> = {\n port:\n typeof runner.port === \"number\"\n ? runner.port\n : DEFAULT_CONNECT_STUDIO_PORT,\n outDir: typeof runner.outDir === \"string\" ? runner.outDir : \"dist\",\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: typeof runner.host === \"string\" ? runner.host : \"127.0.0.1\",\n };\n const override = callerOverride(host);\n await runConnectPreview(args as ConnectPreviewArgs, {\n connect: override,\n cspRegistrySync: runner.cspRegistrySync === true,\n });\n}\n"],"names":["z.looseObject","z.string","z.number","z.boolean"],"mappings":";;;;;;;;;;;;;AA8BA,MAAa,OAAO;;;;AAKpB,MAAa,aAAaA,YAAc;CACtC,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC;CACtB,QAAQD,YAAc;EACpB,QAAQC,OAAS;EACjB,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EAC3C,OAAOC,QAAU,CAAC,CAAC,SAAS;EAC5B,aAAaA,QAAU,CAAC,CAAC,SAAS;EAClC,SAASF,OAAS,CAAC,CAAC,SAAS;CAC/B,CAAC;CACD,QAAQD,YAAc,CAAC,CAAC,CA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CAAC;AAC5E;;;AAIA,MAAa,MAAM;;AAGnB,eAAsB,MACpB,MACA,MACe;CACf,MAAM,EAAE,oBAAoB,MAAM,OAAO;CACzC,MAAM,SAAS,KAAK;CAIpB,MAAM,gBAAgB,EAFpB,QAAQ,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS,OAErC,CAAqB;AAChD;;;;;;;;;AAUA,eAAsB,MACpB,MACA,MACe;CACf,MAAM,EAAE,sBAAsB,MAAM,OAAO;CAC3C,MAAM,SAAS,KAAK;CAkBpB,MAAM,kBAAkB;EAhBtB,MACE,OAAO,OAAO,SAAS,WACnB,OAAO,OACP;EACN,QAAQ,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;EAC5D,MAAM,OAAO,gBAAgB;EAC7B,YAAY,OAAO,eAAe;EAClC,MAAM;EACN,WAAW;EACX,kBAAkB;EAIlB,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;CAG7B,GAAyB;EAClD,SAFe,eAAe,IAEd;EAChB,iBAAiB,OAAO,oBAAoB;CAC9C,CAAC;AACH","debug_id":"6fb9c616-bc5a-5744-8e61-012c2da6a7a3"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { a as ZodBoolean, c as ZodObject, d as ZodString, f as $loose, i as ZodArray, l as ZodOptional, n as RunnerContext, o as ZodEnum, p as $strict, r as external_d_exports, s as ZodNumber, t as HostDefinition, u as ZodRecord } from "../index-s1ABBFjB.mjs";
|
|
2
|
+
//#region src/runners/switchboard.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a
|
|
5
|
+
* hosts/switchboard/host.js definition onto the SAME `startSwitchboard`
|
|
6
|
+
* service the classic command calls. `run` = production loaders, `dev` =
|
|
7
|
+
* Vite package loader (worker pools refused by the server, as always).
|
|
8
|
+
* There is deliberately no `build` verb — the switchboard has none.
|
|
9
|
+
*/
|
|
10
|
+
export declare const kind = "reactor";
|
|
11
|
+
/** Phase-2 schema (D2.d): `reactor`/`profile` strict via host-core. */
|
|
12
|
+
export declare const hostSchema: ZodObject<{
|
|
13
|
+
name: ZodString;
|
|
14
|
+
runner: ZodObject<{
|
|
15
|
+
module: ZodString;
|
|
16
|
+
port: ZodOptional<ZodNumber>;
|
|
17
|
+
https: ZodOptional<ZodBoolean>;
|
|
18
|
+
plugins: ZodOptional<ZodString>;
|
|
19
|
+
}, $loose>;
|
|
20
|
+
config: ZodOptional<ZodObject<{}, $loose>>;
|
|
21
|
+
profile: ZodOptional<ZodObject<{
|
|
22
|
+
appId: ZodOptional<ZodString>;
|
|
23
|
+
name: ZodOptional<ZodString>;
|
|
24
|
+
description: ZodOptional<ZodString>;
|
|
25
|
+
icon: ZodOptional<ZodString>;
|
|
26
|
+
}, $strict>>;
|
|
27
|
+
reactor: ZodOptional<ZodObject<{
|
|
28
|
+
backends: ZodOptional<ZodRecord<ZodString, ZodObject<{
|
|
29
|
+
kind: ZodOptional<ZodEnum<{
|
|
30
|
+
"in-process": "in-process";
|
|
31
|
+
remote: "remote";
|
|
32
|
+
worker: "worker";
|
|
33
|
+
}>>;
|
|
34
|
+
storage: ZodOptional<ZodObject<{
|
|
35
|
+
kind: ZodEnum<{
|
|
36
|
+
idb: "idb";
|
|
37
|
+
memory: "memory";
|
|
38
|
+
path: "path";
|
|
39
|
+
postgres: "postgres";
|
|
40
|
+
}>;
|
|
41
|
+
dataDir: ZodOptional<ZodString>;
|
|
42
|
+
url: ZodOptional<ZodString>;
|
|
43
|
+
}, $strict>>;
|
|
44
|
+
readModel: ZodOptional<ZodObject<{
|
|
45
|
+
url: ZodOptional<ZodString>;
|
|
46
|
+
}, $strict>>;
|
|
47
|
+
packages: ZodOptional<ZodObject<{
|
|
48
|
+
cdnUrl: ZodOptional<ZodString>;
|
|
49
|
+
specs: ZodOptional<ZodArray<ZodString>>;
|
|
50
|
+
dynamic: ZodOptional<ZodBoolean>;
|
|
51
|
+
}, $strict>>;
|
|
52
|
+
remote: ZodOptional<ZodObject<{
|
|
53
|
+
host: ZodOptional<ZodString>;
|
|
54
|
+
url: ZodOptional<ZodString>;
|
|
55
|
+
}, $strict>>;
|
|
56
|
+
}, $strict>>>;
|
|
57
|
+
placement: ZodOptional<ZodObject<{
|
|
58
|
+
primary: ZodOptional<ZodString>;
|
|
59
|
+
default: ZodOptional<ZodObject<{}, $loose>>;
|
|
60
|
+
}, $strict>>;
|
|
61
|
+
workflows: ZodOptional<ZodBoolean>;
|
|
62
|
+
protocol: ZodOptional<ZodObject<{
|
|
63
|
+
featureFlags: ZodOptional<ZodObject<{
|
|
64
|
+
documentDecisions: ZodOptional<ZodBoolean>;
|
|
65
|
+
authEnforcement: ZodOptional<ZodBoolean>;
|
|
66
|
+
authGroups: ZodOptional<ZodBoolean>;
|
|
67
|
+
authConditions: ZodOptional<ZodBoolean>;
|
|
68
|
+
}, $strict>>;
|
|
69
|
+
createSignaturePolicy: ZodOptional<ZodEnum<{
|
|
70
|
+
legacy: "legacy";
|
|
71
|
+
"v2-required": "v2-required";
|
|
72
|
+
}>>;
|
|
73
|
+
unsupportedStoredDocuments: ZodOptional<ZodEnum<{
|
|
74
|
+
"read-only": "read-only";
|
|
75
|
+
refuse: "refuse";
|
|
76
|
+
}>>;
|
|
77
|
+
}, $strict>>;
|
|
78
|
+
}, $strict>>;
|
|
79
|
+
}, $loose>;
|
|
80
|
+
/** What a started switchboard reports to a supervising compound: its port and
|
|
81
|
+
* the drive it serves (projected into a connect member's defaultDrives). */
|
|
82
|
+
export interface SwitchboardHandle {
|
|
83
|
+
port: number;
|
|
84
|
+
driveUrls: string[];
|
|
85
|
+
endpoints: Record<string, string>;
|
|
86
|
+
ready: Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export declare function run(host: HostDefinition, _ctx: RunnerContext): Promise<SwitchboardHandle>;
|
|
89
|
+
export declare function dev(host: HostDefinition, _ctx: RunnerContext): Promise<SwitchboardHandle>;
|
|
90
|
+
//#endregion
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=switchboard.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switchboard.d.mts","names":[],"sources":["../../src/runners/switchboard.ts"],"mappings":";;;;;;;;;qBAuBa;;qBAGA,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWrB;;;iBAiDe;EACf;EACA;EACA,WAAW;EACX,OAAO;;wBA0Ca,IACpB,MAAM,gBACN,MAAM,gBACL,QAAQ;wBAIW,IACpB,MAAM,gBACN,MAAM,gBACL,QAAQ"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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]="2dfd55e8-8d04-59ce-8e66-b10ec33b6e26")}catch(e){}}();
|
|
3
|
+
import { c as reactorSchema, f as boolean, h as string, m as number, o as profileSchema, p as looseObject } from "../host-schemas-C_MLcYX6-B2qQIdZ-.mjs";
|
|
4
|
+
import { t as applyReactorEnvProjection } from "../reactor-env-CtavpGtJ.mjs";
|
|
5
|
+
import { DEFAULT_SWITCHBOARD_PORT, DEFAULT_VETRA_DRIVE_ID } from "@powerhousedao/shared/clis";
|
|
6
|
+
//#region src/runners/switchboard.ts
|
|
7
|
+
/**
|
|
8
|
+
* BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a
|
|
9
|
+
* hosts/switchboard/host.js definition onto the SAME `startSwitchboard`
|
|
10
|
+
* service the classic command calls. `run` = production loaders, `dev` =
|
|
11
|
+
* Vite package loader (worker pools refused by the server, as always).
|
|
12
|
+
* There is deliberately no `build` verb — the switchboard has none.
|
|
13
|
+
*/
|
|
14
|
+
const kind = "reactor";
|
|
15
|
+
/** Phase-2 schema (D2.d): `reactor`/`profile` strict via host-core. */
|
|
16
|
+
const hostSchema = looseObject({
|
|
17
|
+
name: string().min(1),
|
|
18
|
+
runner: looseObject({
|
|
19
|
+
module: string(),
|
|
20
|
+
port: number().int().positive().optional(),
|
|
21
|
+
https: boolean().optional(),
|
|
22
|
+
plugins: string().optional()
|
|
23
|
+
}),
|
|
24
|
+
config: looseObject({}).optional(),
|
|
25
|
+
profile: profileSchema,
|
|
26
|
+
reactor: reactorSchema.optional()
|
|
27
|
+
});
|
|
28
|
+
function toSwitchboardArgs(host, devMode, dbPath) {
|
|
29
|
+
const runner = host.runner;
|
|
30
|
+
return {
|
|
31
|
+
port: typeof runner.port === "number" ? runner.port : DEFAULT_SWITCHBOARD_PORT,
|
|
32
|
+
vetraDriveId: DEFAULT_VETRA_DRIVE_ID,
|
|
33
|
+
mcp: true,
|
|
34
|
+
useVetraDrive: false,
|
|
35
|
+
remoteDrives: [],
|
|
36
|
+
dev: devMode || runner.dev === true,
|
|
37
|
+
...dbPath ? { dbPath } : {}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The slug of the drive the switchboard creates by default
|
|
41
|
+
* (apps/switchboard config); `runner.driveSlug` overrides. */
|
|
42
|
+
const DEFAULT_DRIVE_SLUG = "powerhouse";
|
|
43
|
+
/** Poll the default drive endpoint until the server answers — the compound's
|
|
44
|
+
* readiness gate: Connect auto-connects the drive on first load, so the drive
|
|
45
|
+
* must answer before the connect member serves (the sidecar's
|
|
46
|
+
* waitForSwitchboard, moved behind the handle contract). */
|
|
47
|
+
async function waitForDrive(url, timeoutMs) {
|
|
48
|
+
const deadline = Date.now() + timeoutMs;
|
|
49
|
+
for (;;) {
|
|
50
|
+
try {
|
|
51
|
+
if ((await fetch(url, { signal: AbortSignal.timeout(3e3) })).ok) return;
|
|
52
|
+
} catch {}
|
|
53
|
+
if (Date.now() > deadline) throw new Error(`Switchboard drive ${url} did not answer within ${timeoutMs}ms.`);
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function start(host, devMode) {
|
|
58
|
+
const options = applyReactorEnvProjection(host.reactor, `hosts/${host.name}/host.js`);
|
|
59
|
+
const { startSwitchboard } = await import("../switchboard-BUMqobK4.mjs");
|
|
60
|
+
const args = toSwitchboardArgs(host, devMode, options.dbPath);
|
|
61
|
+
const switchboard = await startSwitchboard(args);
|
|
62
|
+
const port = args.port;
|
|
63
|
+
const driveUrl = `http://localhost:${port}/d/${typeof host.runner.driveSlug === "string" ? host.runner.driveSlug : DEFAULT_DRIVE_SLUG}`;
|
|
64
|
+
const driveUrls = [driveUrl];
|
|
65
|
+
if (switchboard?.workflowsEnabled) {
|
|
66
|
+
const { seedWorkflowsDrive } = await import("../vetra-BY-MHg9R.mjs");
|
|
67
|
+
driveUrls.push(await seedWorkflowsDrive(switchboard.reactor, port));
|
|
68
|
+
}
|
|
69
|
+
const ready = waitForDrive(driveUrl, 18e4);
|
|
70
|
+
ready.catch(() => void 0);
|
|
71
|
+
return {
|
|
72
|
+
port,
|
|
73
|
+
driveUrls,
|
|
74
|
+
endpoints: { graphql: `http://localhost:${port}/graphql` },
|
|
75
|
+
ready
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function run(host, _ctx) {
|
|
79
|
+
return start(host, false);
|
|
80
|
+
}
|
|
81
|
+
async function dev(host, _ctx) {
|
|
82
|
+
return start(host, true);
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { dev, hostSchema, kind, run };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=switchboard.mjs.map
|
|
88
|
+
//# debugId=2dfd55e8-8d04-59ce-8e66-b10ec33b6e26
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switchboard.mjs","sources":["../../src/runners/switchboard.ts"],"sourcesContent":["import {\n DEFAULT_SWITCHBOARD_PORT,\n DEFAULT_VETRA_DRIVE_ID,\n} from \"@powerhousedao/shared/clis\";\nimport {\n profileSchema,\n reactorSchema,\n type HostDefinition,\n type ReactorConfig,\n type RunnerContext,\n} from \"@powerhousedao/host-core\";\nimport { applyReactorEnvProjection } from \"./reactor-env.js\";\nimport { z } from \"zod\";\nimport type { SwitchboardArgs } from \"../types.js\";\n\n/**\n * BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a\n * hosts/switchboard/host.js definition onto the SAME `startSwitchboard`\n * service the classic command calls. `run` = production loaders, `dev` =\n * Vite package loader (worker pools refused by the server, as always).\n * There is deliberately no `build` verb — the switchboard has none.\n */\n\nexport const kind = \"reactor\";\n\n/** Phase-2 schema (D2.d): `reactor`/`profile` strict via host-core. */\nexport const hostSchema = z.looseObject({\n name: z.string().min(1),\n runner: z.looseObject({\n module: z.string(),\n port: z.number().int().positive().optional(),\n https: z.boolean().optional(),\n plugins: z.string().optional(),\n }),\n config: z.looseObject({}).optional(),\n profile: profileSchema,\n reactor: reactorSchema.optional(),\n});\n\nfunction toSwitchboardArgs(\n host: HostDefinition,\n devMode: boolean,\n dbPath: string | undefined,\n): SwitchboardArgs {\n const runner = host.runner;\n const args: Partial<SwitchboardArgs> = {\n port:\n typeof runner.port === \"number\" ? runner.port : DEFAULT_SWITCHBOARD_PORT,\n vetraDriveId: DEFAULT_VETRA_DRIVE_ID,\n mcp: true,\n useVetraDrive: false,\n remoteDrives: [],\n dev: devMode || runner.dev === true,\n ...(dbPath ? { dbPath } : {}),\n };\n return args as SwitchboardArgs;\n}\n\n/** The slug of the drive the switchboard creates by default\n * (apps/switchboard config); `runner.driveSlug` overrides. */\nconst DEFAULT_DRIVE_SLUG = \"powerhouse\";\n\n/** Poll the default drive endpoint until the server answers — the compound's\n * readiness gate: Connect auto-connects the drive on first load, so the drive\n * must answer before the connect member serves (the sidecar's\n * waitForSwitchboard, moved behind the handle contract). */\nasync function waitForDrive(url: string, timeoutMs: number): Promise<void> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n const res = await fetch(url, { signal: AbortSignal.timeout(3000) });\n if (res.ok) return;\n } catch {\n // not listening yet\n }\n if (Date.now() > deadline) {\n throw new Error(\n `Switchboard drive ${url} did not answer within ${timeoutMs}ms.`,\n );\n }\n await new Promise((resolve) => setTimeout(resolve, 400));\n }\n}\n\n/** What a started switchboard reports to a supervising compound: its port and\n * the drive it serves (projected into a connect member's defaultDrives). */\nexport interface SwitchboardHandle {\n port: number;\n driveUrls: string[];\n endpoints: Record<string, string>;\n ready: Promise<void>;\n}\n\nasync function start(\n host: HostDefinition,\n devMode: boolean,\n): Promise<SwitchboardHandle> {\n const options = applyReactorEnvProjection(\n host.reactor as ReactorConfig | undefined,\n `hosts/${host.name}/host.js`,\n );\n const { startSwitchboard } = await import(\"../services/switchboard.js\");\n const args = toSwitchboardArgs(host, devMode, options.dbPath);\n const switchboard = await startSwitchboard(args);\n const port = args.port;\n const slug =\n typeof host.runner.driveSlug === \"string\"\n ? host.runner.driveSlug\n : DEFAULT_DRIVE_SLUG;\n const driveUrl = `http://localhost:${port}/d/${slug}`;\n const driveUrls = [driveUrl];\n\n // Workflows on → seed the SAME project-hashed workflows drive the vetra\n // path seeds (opens in Workflow Studio); it rides the handle so a\n // supervising compound projects it into the connect member's drives.\n if (switchboard?.workflowsEnabled) {\n const { seedWorkflowsDrive } = await import(\"../services/vetra.js\");\n driveUrls.push(await seedWorkflowsDrive(switchboard.reactor, port));\n }\n\n const ready = waitForDrive(driveUrl, 180_000);\n // A supervisor awaits `ready` and sees the rejection; an unsupervised caller\n // (or a test with the service mocked) must not die of an unhandled one.\n ready.catch(() => undefined);\n return {\n port,\n driveUrls,\n endpoints: { graphql: `http://localhost:${port}/graphql` },\n ready,\n };\n}\n\nexport async function run(\n host: HostDefinition,\n _ctx: RunnerContext,\n): Promise<SwitchboardHandle> {\n return start(host, false);\n}\n\nexport async function dev(\n host: HostDefinition,\n _ctx: RunnerContext,\n): Promise<SwitchboardHandle> {\n return start(host, true);\n}\n"],"names":["z.looseObject","z.string","z.number","z.boolean"],"mappings":";;;;;;;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iBAAiB,IAAI;CAC/C,MAAM,OAAO,KAAK;CAKlB,MAAM,WAAW,oBAAoB,KAAK,KAHxC,OAAO,KAAK,OAAO,cAAc,WAC7B,KAAK,OAAO,YACZ;CAEN,MAAM,YAAY,CAAC,QAAQ;CAK3B,IAAI,aAAa,kBAAkB;EACjC,MAAM,EAAE,uBAAuB,MAAM,OAAO;EAC5C,UAAU,KAAK,MAAM,mBAAmB,YAAY,SAAS,IAAI,CAAC;CACpE;CAEA,MAAM,QAAQ,aAAa,UAAU,IAAO;CAG5C,MAAM,YAAY,KAAA,CAAS;CAC3B,OAAO;EACL;EACA;EACA,WAAW,EAAE,SAAS,oBAAoB,KAAK,UAAU;EACzD;CACF;AACF;AAEA,eAAsB,IACpB,MACA,MAC4B;CAC5B,OAAO,MAAM,MAAM,KAAK;AAC1B;AAEA,eAAsB,IACpB,MACA,MAC4B;CAC5B,OAAO,MAAM,MAAM,IAAI;AACzB","debug_id":"2dfd55e8-8d04-59ce-8e66-b10ec33b6e26"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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]="639c4b41-d3bf-56e1-9169-21c92ac4700e")}catch(e){}}();
|
|
3
|
+
import { d as validateHost, n as getVerb, r as loadHost, u as resolveRunnerModule } from "./host-schemas-C_MLcYX6-B2qQIdZ-.mjs";
|
|
4
|
+
//#region src/services/run/start-run.ts
|
|
5
|
+
/**
|
|
6
|
+
* `ph run <host> [verb]`: load hosts/<host>/host.js, resolve its declared
|
|
7
|
+
* runner from the project's dependency tree, validate, dispatch the verb
|
|
8
|
+
* (default `run`). There is deliberately no type→runner registry — what a
|
|
9
|
+
* host does is written in its own file.
|
|
10
|
+
*/
|
|
11
|
+
async function startRun(args) {
|
|
12
|
+
const projectRoot = args.projectRoot ?? process.cwd();
|
|
13
|
+
const loaded = await loadHost(projectRoot, args.host);
|
|
14
|
+
const { warnSupersededConfigKeys } = await import("./superseded-config-9D7BdLvd.mjs");
|
|
15
|
+
warnSupersededConfigKeys(projectRoot);
|
|
16
|
+
const specifier = loaded.host.runner.module;
|
|
17
|
+
const runner = await resolveRunnerModule(projectRoot, specifier);
|
|
18
|
+
validateHost(runner, specifier, loaded.host, loaded.file);
|
|
19
|
+
const verb = args.verb ?? "run";
|
|
20
|
+
const fn = getVerb(runner, specifier, verb);
|
|
21
|
+
if (args.debug) console.log({
|
|
22
|
+
host: loaded.host.name,
|
|
23
|
+
runner: specifier,
|
|
24
|
+
verb
|
|
25
|
+
});
|
|
26
|
+
return fn(loaded.host, {
|
|
27
|
+
projectRoot,
|
|
28
|
+
verb,
|
|
29
|
+
env: process.env
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { startRun };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=start-run-CAgkeWI1.mjs.map
|
|
36
|
+
//# debugId=639c4b41-d3bf-56e1-9169-21c92ac4700e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-run-CAgkeWI1.mjs","sources":["../src/services/run/start-run.ts"],"sourcesContent":["import { loadHost } from \"@powerhousedao/host-core\";\nimport {\n getVerb,\n resolveRunnerModule,\n validateHost,\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]`: load hosts/<host>/host.js, resolve its declared\n * runner from the project's dependency tree, validate, dispatch the verb\n * (default `run`). There is deliberately no type→runner registry — what a\n * host does is written in its own file.\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 validateHost(runner, specifier, loaded.host, loaded.file);\n const verb = args.verb ?? \"run\";\n const fn = getVerb(runner, specifier, verb);\n if (args.debug) {\n console.log({ host: loaded.host.name, runner: specifier, verb });\n }\n return fn(loaded.host, { projectRoot, verb, env: process.env });\n}\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,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,aAAa,QAAQ,WAAW,OAAO,MAAM,OAAO,IAAI;CACxD,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,KAAK,QAAQ,QAAQ,WAAW,IAAI;CAC1C,IAAI,KAAK,OACP,QAAQ,IAAI;EAAE,MAAM,OAAO,KAAK;EAAM,QAAQ;EAAW;CAAK,CAAC;CAEjE,OAAO,GAAG,OAAO,MAAM;EAAE;EAAa;EAAM,KAAK,QAAQ;CAAI,CAAC;AAChE","debug_id":"639c4b41-d3bf-56e1-9169-21c92ac4700e"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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]="0ed57c92-e10e-5f6c-a833-8f0a8c8d722c")}catch(e){}}();
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
//#region src/services/run/superseded-config.ts
|
|
6
|
+
/**
|
|
7
|
+
* P2.7 — the fixed legacy→hosts mapping table. With hosts/ active, these
|
|
8
|
+
* powerhouse.config.json keys are superseded by host.js structure and the run
|
|
9
|
+
* path ignores them; each present key warns ONCE per run, naming its new home.
|
|
10
|
+
*
|
|
11
|
+
* Keys the scaffolded host files REFERENCE (studio.port, reactor.port,
|
|
12
|
+
* vetra.connectPort, and the WHOLE connect.* block — handed to the runtime
|
|
13
|
+
* unchanged, connect.instance.* included) are expected to remain and are
|
|
14
|
+
* deliberately absent from this table.
|
|
15
|
+
*/
|
|
16
|
+
const SUPERSEDED = {
|
|
17
|
+
"studio.host": "hosts/connect/host.js → runner.host",
|
|
18
|
+
"studio.https": "hosts/connect/host.js → runner.https",
|
|
19
|
+
"studio.openBrowser": "hosts/connect/host.js → runner.openBrowser",
|
|
20
|
+
"reactor.https": "hosts/switchboard/host.js → runner.https",
|
|
21
|
+
"reactor.storage": "hosts/switchboard/host.js → reactor.backends.<name>.storage",
|
|
22
|
+
"switchboard.database.url": "hosts/switchboard/host.js → reactor.backends.<name>.storage.url"
|
|
23
|
+
};
|
|
24
|
+
function lookup(config, dottedKey) {
|
|
25
|
+
let cursor = config;
|
|
26
|
+
for (const part of dottedKey.split(".")) {
|
|
27
|
+
if (cursor === null || typeof cursor !== "object") return void 0;
|
|
28
|
+
cursor = cursor[part];
|
|
29
|
+
}
|
|
30
|
+
return cursor;
|
|
31
|
+
}
|
|
32
|
+
/** Warn once per run for each superseded key present in the project config.
|
|
33
|
+
* Returns the warned keys (for tests). Never throws — a malformed config is
|
|
34
|
+
* the loader's problem, not the warner's. */
|
|
35
|
+
function warnSupersededConfigKeys(projectRoot, warn = console.warn) {
|
|
36
|
+
let config;
|
|
37
|
+
try {
|
|
38
|
+
config = JSON.parse(fs.readFileSync(path.join(projectRoot, "powerhouse.config.json"), "utf8"));
|
|
39
|
+
} catch {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const warned = [];
|
|
43
|
+
for (const [key, newHome] of Object.entries(SUPERSEDED)) if (lookup(config, key) !== void 0) {
|
|
44
|
+
warned.push(key);
|
|
45
|
+
warn(`[ph run] powerhouse.config.json "${key}" is ignored in hosts projects — its home is now ${newHome}.`);
|
|
46
|
+
}
|
|
47
|
+
return warned;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { warnSupersededConfigKeys };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=superseded-config-9D7BdLvd.mjs.map
|
|
53
|
+
//# debugId=0ed57c92-e10e-5f6c-a833-8f0a8c8d722c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superseded-config-9D7BdLvd.mjs","sources":["../src/services/run/superseded-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * P2.7 — the fixed legacy→hosts mapping table. With hosts/ active, these\n * powerhouse.config.json keys are superseded by host.js structure and the run\n * path ignores them; each present key warns ONCE per run, naming its new home.\n *\n * Keys the scaffolded host files REFERENCE (studio.port, reactor.port,\n * vetra.connectPort, and the WHOLE connect.* block — handed to the runtime\n * unchanged, connect.instance.* included) are expected to remain and are\n * deliberately absent from this table.\n */\nconst SUPERSEDED: Record<string, string> = {\n \"studio.host\": \"hosts/connect/host.js → runner.host\",\n \"studio.https\": \"hosts/connect/host.js → runner.https\",\n \"studio.openBrowser\": \"hosts/connect/host.js → runner.openBrowser\",\n \"reactor.https\": \"hosts/switchboard/host.js → runner.https\",\n \"reactor.storage\":\n \"hosts/switchboard/host.js → reactor.backends.<name>.storage\",\n \"switchboard.database.url\":\n \"hosts/switchboard/host.js → reactor.backends.<name>.storage.url\",\n};\n\nfunction lookup(config: unknown, dottedKey: string): unknown {\n let cursor: unknown = config;\n for (const part of dottedKey.split(\".\")) {\n if (cursor === null || typeof cursor !== \"object\") return undefined;\n cursor = (cursor as Record<string, unknown>)[part];\n }\n return cursor;\n}\n\n/** Warn once per run for each superseded key present in the project config.\n * Returns the warned keys (for tests). Never throws — a malformed config is\n * the loader's problem, not the warner's. */\nexport function warnSupersededConfigKeys(\n projectRoot: string,\n warn: (message: string) => void = console.warn,\n): string[] {\n let config: unknown;\n try {\n config = JSON.parse(\n fs.readFileSync(path.join(projectRoot, \"powerhouse.config.json\"), \"utf8\"),\n );\n } catch {\n return [];\n }\n const warned: string[] = [];\n for (const [key, newHome] of Object.entries(SUPERSEDED)) {\n if (lookup(config, key) !== undefined) {\n warned.push(key);\n warn(\n `[ph run] powerhouse.config.json \"${key}\" is ignored in hosts projects — ` +\n `its home is now ${newHome}.`,\n );\n }\n }\n return warned;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,aAAqC;CACzC,eAAe;CACf,gBAAgB;CAChB,sBAAsB;CACtB,iBAAiB;CACjB,mBACE;CACF,4BACE;AACJ;AAEA,SAAS,OAAO,QAAiB,WAA4B;CAC3D,IAAI,SAAkB;CACtB,KAAK,MAAM,QAAQ,UAAU,MAAM,GAAG,GAAG;EACvC,IAAI,WAAW,QAAQ,OAAO,WAAW,UAAU,OAAO,KAAA;EAC1D,SAAU,OAAmC;CAC/C;CACA,OAAO;AACT;;;;AAKA,SAAgB,yBACd,aACA,OAAkC,QAAQ,MAChC;CACV,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MACZ,GAAG,aAAa,KAAK,KAAK,aAAa,wBAAwB,GAAG,MAAM,CAC1E;CACF,QAAQ;EACN,OAAO,CAAC;CACV;CACA,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,UAAU,GACpD,IAAI,OAAO,QAAQ,GAAG,MAAM,KAAA,GAAW;EACrC,OAAO,KAAK,GAAG;EACf,KACE,oCAAoC,IAAI,mDACnB,QAAQ,EAC/B;CACF;CAEF,OAAO;AACT","debug_id":"0ed57c92-e10e-5f6c-a833-8f0a8c8d722c"}
|
|
@@ -1,7 +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 {
|
|
4
|
-
import {
|
|
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]="a0386a84-5c57-5295-bfaa-1c726c58ff59")}catch(e){}}();
|
|
3
|
+
import { i as mergeDefaultDrives, l as rebaseDriveUrl } from "./host-schemas-C_MLcYX6-B2qQIdZ-.mjs";
|
|
4
|
+
import { a as parseDefaultDrivesUrl, i as wasFlagExplicitlyPassed } from "./cli-connect-override-DGXyoqdV.mjs";
|
|
5
|
+
import { t as runConnectStudio } from "./connect-studio-sc-e0xBI.mjs";
|
|
5
6
|
import { a as generateProjectDriveId } from "./utils-CvmDmCVd.mjs";
|
|
6
7
|
import { i as POWERHOUSE_DRIVE_ICON, r as startSwitchboard$1 } from "./switchboard-tQS3fhqa.mjs";
|
|
7
8
|
import fs from "node:fs";
|
|
@@ -356,20 +357,6 @@ function syncMcpPort(projectDir, port) {
|
|
|
356
357
|
const VETRA_DRIVE_NAME = "vetra";
|
|
357
358
|
const getDefaultVetraUrl = (port) => `http://localhost:${port}/d/${generateProjectDriveId(VETRA_DRIVE_NAME)}`;
|
|
358
359
|
const getDriveId = (driveUrl) => driveUrl?.split("/").pop() ?? generateProjectDriveId(VETRA_DRIVE_NAME);
|
|
359
|
-
const rebaseDriveUrl = (driveUrl, publicBase) => {
|
|
360
|
-
let url;
|
|
361
|
-
try {
|
|
362
|
-
url = new URL(driveUrl);
|
|
363
|
-
} catch {
|
|
364
|
-
return driveUrl;
|
|
365
|
-
}
|
|
366
|
-
if (![
|
|
367
|
-
"localhost",
|
|
368
|
-
"127.0.0.1",
|
|
369
|
-
"[::1]"
|
|
370
|
-
].includes(url.hostname)) return driveUrl;
|
|
371
|
-
return `${publicBase.replace(/\/+$/, "")}${url.pathname}`;
|
|
372
|
-
};
|
|
373
360
|
function createViteLogger(color) {
|
|
374
361
|
const customLogger = createLogger("info");
|
|
375
362
|
const loggerInfo = customLogger.info.bind(customLogger);
|
|
@@ -410,7 +397,7 @@ async function startVetraPreviewDrive(reactor, port, verbose) {
|
|
|
410
397
|
if (verbose) console.log(blue(`Vetra Switchboard: Preview drive: ${driveUrl}`));
|
|
411
398
|
return driveUrl;
|
|
412
399
|
}
|
|
413
|
-
async function
|
|
400
|
+
async function seedWorkflowsDrive(reactor, port, verbose) {
|
|
414
401
|
const workflowsDrive = {
|
|
415
402
|
id: generateProjectDriveId("workflows"),
|
|
416
403
|
slug: "workflows",
|
|
@@ -474,7 +461,7 @@ async function startLocalVetraSwitchboard(args, logger) {
|
|
|
474
461
|
}
|
|
475
462
|
let workflowsDriveUrl = null;
|
|
476
463
|
if (switchboard.workflowsEnabled) try {
|
|
477
|
-
workflowsDriveUrl = await
|
|
464
|
+
workflowsDriveUrl = await seedWorkflowsDrive(switchboard.reactor, actualSwitchboardPort, verbose);
|
|
478
465
|
} catch (error) {
|
|
479
466
|
console.error(error);
|
|
480
467
|
}
|
|
@@ -621,7 +608,7 @@ async function startVetra(args) {
|
|
|
621
608
|
}
|
|
622
609
|
}
|
|
623
610
|
//#endregion
|
|
624
|
-
export { startVetra };
|
|
611
|
+
export { seedWorkflowsDrive, startVetra };
|
|
625
612
|
|
|
626
|
-
//# sourceMappingURL=vetra-
|
|
627
|
-
//# debugId=
|
|
613
|
+
//# sourceMappingURL=vetra-BY-MHg9R.mjs.map
|
|
614
|
+
//# debugId=a0386a84-5c57-5295-bfaa-1c726c58ff59
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vetra-BY-MHg9R.mjs","sources":["../src/utils/configure-vetra-github-url.ts","../src/utils/resolve-switchboard-port.ts","../src/utils/vetra-runtime.ts","../src/services/vetra.ts"],"sourcesContent":["import {\n createVetraDocument,\n getVetraDocuments,\n setPackageGithubUrl,\n} from \"@powerhousedao/common/utils\";\nimport { red } from \"colorette\";\nimport { execSync } from \"node:child_process\";\nimport { createInterface } from \"node:readline\";\n\n/**\n * Get git remote URL (origin)\n * @returns Git remote URL or null if not configured\n */\nfunction getGitRemoteUrl(): string | null {\n try {\n const url = execSync(\"git remote get-url origin\", {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return url || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Prompt user to enter a custom GitHub URL\n */\nasync function promptForCustomUrl(): Promise<string | null> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n process.stdout.write(\"\\nEnter GitHub URL (or press Enter to skip): \");\n\n rl.on(\"line\", (answer: string) => {\n rl.close();\n const url = answer.trim();\n resolve(url || null);\n });\n });\n}\n\n/**\n * Prompt yes/no question\n */\nasync function promptYesNo(question: string): Promise<boolean> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n process.stdout.write(`\\n${question} (y/n): `);\n\n rl.on(\"line\", (answer: string) => {\n rl.close();\n const response = answer.trim().toLowerCase();\n resolve(response === \"y\" || response === \"yes\");\n });\n });\n}\n\n/**\n * Prompt user to select or enter GitHub URL\n * @param gitRemoteUrl - Git remote URL if available\n * @returns Selected URL or null if skipped\n */\nasync function promptForGithubUrl(\n gitRemoteUrl: string | null,\n): Promise<string | null> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n console.log(\"\\n\" + \"=\".repeat(50));\n console.log(\"🔍 Vetra Package Configuration\");\n console.log(\"=\".repeat(50));\n console.log(\n \"\\nWe detected a Vetra package document in your remote drive without a GitHub URL configured.\",\n );\n console.log(\"\\nWould you like to configure the GitHub URL now?\");\n\n if (gitRemoteUrl) {\n console.log(`\\nGit remote URL detected: ${gitRemoteUrl}`);\n console.log(\"\\nOptions:\");\n console.log(\"1. Use detected URL\");\n console.log(\"2. Enter a different URL\");\n console.log(\"3. Skip configuration\");\n\n process.stdout.write(\"\\nSelect an option (1-3): \");\n\n const handleAnswer = (answer: string) => {\n const choice = answer.trim();\n\n if (choice === \"1\") {\n rl.close();\n resolve(gitRemoteUrl);\n } else if (choice === \"2\") {\n rl.close();\n promptForCustomUrl()\n .then(resolve)\n .catch(() => resolve(null));\n } else if (choice === \"3\") {\n rl.close();\n resolve(null);\n } else {\n process.stdout.write(\"Invalid choice. Select an option (1-3): \");\n }\n };\n\n rl.on(\"line\", handleAnswer);\n } else {\n console.log(\"\\nNo git remote URL detected.\");\n console.log(\"\\nOptions:\");\n console.log(\"1. Enter GitHub URL manually\");\n console.log(\"2. Skip configuration\");\n\n process.stdout.write(\"\\nSelect an option (1-2): \");\n\n const handleAnswer = (answer: string) => {\n const choice = answer.trim();\n\n if (choice === \"1\") {\n rl.close();\n promptForCustomUrl()\n .then(resolve)\n .catch(() => resolve(null));\n } else if (choice === \"2\") {\n rl.close();\n resolve(null);\n } else {\n process.stdout.write(\"Invalid choice. Select an option (1-2): \");\n }\n };\n\n rl.on(\"line\", handleAnswer);\n }\n });\n}\n\n/**\n * Set git remote URL (origin)\n */\nfunction setGitRemoteUrl(url: string): void {\n try {\n execSync(`git remote add origin ${url}`, {\n stdio: \"inherit\",\n });\n console.log(`✅ Git remote origin set to: ${url}`);\n } catch {\n try {\n execSync(`git remote set-url origin ${url}`, {\n stdio: \"inherit\",\n });\n console.log(`✅ Git remote origin updated to: ${url}`);\n } catch {\n console.error(red(`❌ Failed to set git remote URL`));\n }\n }\n}\n\n/**\n * Validates documents and returns the target document to use\n * Warns if multiple documents found\n */\nfunction validateAndSelectDocument<T>(documents: T[]): T | null {\n if (documents.length === 0) {\n return null;\n }\n\n if (documents.length > 1) {\n console.warn(\n `⚠️ Warning: Multiple Vetra documents found (${documents.length}). Using first document.`,\n );\n }\n\n return documents[0];\n}\n\nasync function applyGithubUrlConfiguration(\n graphqlEndpoint: string,\n vetraDriveId: string,\n documentId: string,\n selectedUrl: string,\n shouldSetRemote: boolean,\n): Promise<void> {\n // Set package GitHub URL\n await setPackageGithubUrl(\n graphqlEndpoint,\n vetraDriveId,\n documentId,\n selectedUrl,\n );\n\n console.log(`✅ GitHub URL configured: ${selectedUrl}`);\n\n // Set git remote URL if requested\n if (shouldSetRemote) {\n setGitRemoteUrl(selectedUrl);\n }\n}\n\nfunction logVerbose(message: string, verbose?: boolean): void {\n if (verbose) {\n console.log(message);\n }\n}\n\n/**\n * Sleep for a specified number of milliseconds\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Configure GitHub URL for Vetra documents\n * @param switchboardPort - Port where switchboard is running\n * @param vetraDriveUrl - Remote drive URL\n * @param verbose - Enable verbose logging\n */\nexport async function configureVetraGithubUrl(\n switchboardPort: number,\n vetraDriveUrl: string,\n verbose?: boolean,\n): Promise<void> {\n logVerbose(\"Checking GitHub URL configuration...\", verbose);\n\n try {\n const graphqlEndpoint = `http://localhost:${switchboardPort}/graphql`;\n const vetraDriveId = vetraDriveUrl.split(\"/\").pop();\n if (!vetraDriveId) {\n throw new Error(\"Invalid vetraDriveUrl: unable to extract drive ID\");\n }\n\n const documents = await getVetraDocuments(graphqlEndpoint, vetraDriveId);\n\n // Skip if already configured\n if (documents.some((doc) => doc.githubUrl)) {\n logVerbose(\"GitHub URL already configured, skipping setup\", verbose);\n return;\n }\n\n // Get or create target document\n let targetDocumentId: string;\n const targetDocument = validateAndSelectDocument(documents);\n\n // Collect user input\n const gitRemoteUrl = getGitRemoteUrl();\n const selectedUrl = await promptForGithubUrl(gitRemoteUrl);\n\n if (!selectedUrl) {\n logVerbose(\"GitHub URL configuration skipped\", verbose);\n return;\n }\n\n let shouldSetRemote = false;\n if (selectedUrl !== gitRemoteUrl && !gitRemoteUrl) {\n shouldSetRemote = await promptYesNo(\"Set this as your git remote URL?\");\n }\n\n if (!targetDocument) {\n logVerbose(\"No Vetra documents found, creating new document...\", verbose);\n\n targetDocumentId = await createVetraDocument(\n graphqlEndpoint,\n vetraDriveId,\n \"vetra-package\",\n );\n\n logVerbose(`Created new document: ${targetDocumentId}`, verbose);\n } else {\n targetDocumentId = targetDocument.id;\n }\n\n await applyGithubUrlConfiguration(\n graphqlEndpoint,\n vetraDriveId,\n targetDocumentId,\n selectedUrl,\n shouldSetRemote,\n );\n } catch (error) {\n console.error(\n red(\n `⚠️ GitHub URL configuration failed: ${error instanceof Error ? error.message : String(error)}`,\n ),\n );\n logVerbose(String(error), verbose);\n }\n}\n","import { isPortAvailable } from \"@powerhousedao/switchboard/server\";\nimport { yellow } from \"colorette\";\n\nconst MAX_FALLBACK_ATTEMPTS = 20;\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nasync function findFreePort(start: number): Promise<number | null> {\n for (let i = 0; i < MAX_FALLBACK_ATTEMPTS; i++) {\n const candidate = start + i;\n if (await isPortAvailable(candidate)) return candidate;\n }\n return null;\n}\n\n/**\n * Resolve the port switchboard should bind to. If the requested port is free,\n * returns it unchanged. If it's in use, walks forward for the next free port\n * and — in an interactive terminal — asks the user to confirm the fallback.\n * In CI / piped contexts the fallback is applied automatically so scripts\n * don't hang on an unanswered prompt.\n *\n * Throws a process.exit(1) when the user declines the prompt or when no free\n * port is available in the search window.\n */\nexport async function resolveSwitchboardPort(\n requested: number,\n): Promise<number> {\n if (await isPortAvailable(requested)) return requested;\n\n const candidate = await findFreePort(requested + 1);\n if (candidate === null) {\n console.error(\n `Port ${requested} is in use and no free port was found in the range ${requested}-${requested + MAX_FALLBACK_ATTEMPTS - 1}.`,\n );\n process.exit(1);\n }\n\n if (!isInteractive()) {\n console.log(\n yellow(\n `Port ${requested} is in use. Falling back to port ${candidate} (non-interactive; skipping confirmation).`,\n ),\n );\n return candidate;\n }\n\n const enquirer = await import(\"enquirer\");\n\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `Port ${requested} is in use. Use port ${candidate} instead?`,\n initial: true,\n });\n confirmed = answer.confirmed;\n } catch {\n // user aborted the prompt (Ctrl-C); treat as decline\n confirmed = false;\n }\n\n if (!confirmed) {\n console.error(\n `Aborted. Free port ${requested} or pass --switchboard-port <port> to choose a different port.`,\n );\n process.exit(1);\n }\n\n return candidate;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport type VetraRuntimeRecord = {\n pid: number;\n projectName: string;\n switchboardPort: number;\n connectPort: number;\n mcpUrl: string;\n startedAt: string;\n};\n\nexport type VetraProbe =\n | { status: \"none\" }\n | { status: \"stale\" }\n | { status: \"live\"; record: VetraRuntimeRecord }\n | { status: \"foreign\"; record: VetraRuntimeRecord };\n\nconst RECORD_REL = path.join(\".ph\", \"vetra-runtime.json\");\nconst READY_TIMEOUT_MS = 2000;\n\nconst recordPath = (projectDir: string) => path.join(projectDir, RECORD_REL);\n\nexport function readVetraRuntime(\n projectDir: string,\n): VetraRuntimeRecord | undefined {\n try {\n return JSON.parse(\n fs.readFileSync(recordPath(projectDir), \"utf8\"),\n ) as VetraRuntimeRecord;\n } catch {\n // Missing or corrupt: either way there is no usable record.\n return undefined;\n }\n}\n\nexport function writeVetraRuntime(\n projectDir: string,\n record: VetraRuntimeRecord,\n): void {\n const target = recordPath(projectDir);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\\n`);\n}\n\nexport function clearVetraRuntime(projectDir: string): void {\n try {\n fs.rmSync(recordPath(projectDir));\n } catch {\n // Already gone.\n }\n}\n\nfunction isPidAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // EPERM means the process exists but belongs to another user.\n return (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\nasync function isReady(port: number): Promise<boolean> {\n try {\n const response = await fetch(`http://localhost:${port}/ready`, {\n signal: AbortSignal.timeout(READY_TIMEOUT_MS),\n });\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Decide whether the recorded instance is actually serving this project.\n *\n * All three checks are load-bearing. A pid can be reused by an unrelated\n * process, so a live pid proves nothing on its own. Another project's\n * switchboard would answer `/ready` on its own port, so a healthy `/ready`\n * proves nothing either. And the recorded `projectName` is what separates\n * \"my instance\" from \"someone else's instance that happens to hold this\n * port\" — which is precisely the confusion that let an agent write document\n * models into a different project's drive.\n *\n * A stale record is deleted so the next start is unblocked. A foreign one is\n * left alone: it describes something that is alive.\n */\nexport async function probeVetraRuntime(\n projectDir: string,\n projectName: string,\n): Promise<VetraProbe> {\n const record = readVetraRuntime(projectDir);\n if (!record) return { status: \"none\" };\n\n if (!isPidAlive(record.pid) || !(await isReady(record.switchboardPort))) {\n clearVetraRuntime(projectDir);\n return { status: \"stale\" };\n }\n\n if (record.projectName !== projectName) {\n return { status: \"foreign\", record };\n }\n return { status: \"live\", record };\n}\n\nconst MCP_FILES = [\".mcp.json\", path.join(\".cursor\", \"mcp.json\")];\n\n/**\n * Point every generated MCP config at `port`, returning the files changed.\n *\n * An MCP client resolves these files at session start and cannot read the\n * project config or `.env`, so when an override moves the port the literal\n * has to be corrected on disk. Rewrites in place rather than regenerating,\n * so any other servers or hand-added keys survive.\n */\nexport function syncMcpPort(projectDir: string, port: number): string[] {\n const changed: string[] = [];\n for (const rel of MCP_FILES) {\n const target = path.join(projectDir, rel);\n if (!fs.existsSync(target)) continue;\n\n let parsed: { mcpServers?: Record<string, { url?: string }> };\n try {\n parsed = JSON.parse(fs.readFileSync(target, \"utf8\")) as typeof parsed;\n } catch {\n // Hand-broken JSON is the author's to fix; don't clobber it.\n continue;\n }\n\n const server = parsed.mcpServers?.[\"reactor-mcp\"];\n if (!server?.url) continue;\n\n const wanted = `http://localhost:${port}/mcp`;\n if (server.url === wanted) continue;\n\n server.url = wanted;\n fs.writeFileSync(target, `${JSON.stringify(parsed, null, 2)}\\n`);\n changed.push(rel);\n }\n return changed;\n}\n","import type { VetraProcessorConfigType } from \"@powerhousedao/config\";\nimport { VETRA_PROCESSOR_CONFIG_KEY } from \"@powerhousedao/config\";\nimport type { IReactorClient } from \"@powerhousedao/reactor\";\nimport { getConfig } from \"@powerhousedao/shared/clis\";\nimport { addDefaultDrive } from \"@powerhousedao/switchboard/utils\";\nimport { join } from \"node:path\";\nimport { blue, green, red, yellow, type Color } from \"colorette\";\nimport type { ILogger } from \"document-model\";\nimport { childLogger, setLogLevel } from \"document-model\";\nimport { createLogger } from \"vite\";\nimport type { VetraArgs } from \"../types.js\";\nimport { generateProjectDriveId, POWERHOUSE_CONFIG_FILE } from \"../utils.js\";\nimport { wasFlagExplicitlyPassed } from \"../utils/cli-connect-override.js\";\nimport {\n configureVetraGithubUrl,\n sleep,\n} from \"../utils/configure-vetra-github-url.js\";\nimport { POWERHOUSE_DRIVE_ICON } from \"../utils/drive-icons.js\";\nimport { mergeDefaultDrives, rebaseDriveUrl } from \"@powerhousedao/host-core\";\nimport { parseDefaultDrivesUrl } from \"../utils/parse-default-drives.js\";\nimport { resolveSwitchboardPort } from \"../utils/resolve-switchboard-port.js\";\nimport {\n clearVetraRuntime,\n probeVetraRuntime,\n syncMcpPort,\n writeVetraRuntime,\n} from \"../utils/vetra-runtime.js\";\nimport { runConnectStudio } from \"./connect-studio.js\";\nimport { startSwitchboard } from \"./switchboard.js\";\n\nconst VETRA_DRIVE_NAME = \"vetra\";\n\nconst getDefaultVetraUrl = (port: number) =>\n `http://localhost:${port}/d/${generateProjectDriveId(VETRA_DRIVE_NAME)}`;\n\nconst getDriveId = (driveUrl: string | undefined): string =>\n driveUrl?.split(\"/\").pop() ?? generateProjectDriveId(VETRA_DRIVE_NAME);\n\n// rebaseDriveUrl moved to @powerhousedao/host-core (uniform-runners P1.4) —\n// one implementation shared by this classic path and the generic compound.\n\nfunction createViteLogger(color: Color) {\n const customLogger = createLogger(\"info\");\n const loggerInfo = customLogger.info.bind(customLogger);\n customLogger.info = (msg, options) => {\n loggerInfo(color(msg), options);\n };\n const loggerWarn = customLogger.warn.bind(customLogger);\n customLogger.warn = (msg, options) => {\n loggerWarn(yellow(msg), options);\n };\n const loggerError = customLogger.error.bind(customLogger);\n customLogger.error = (msg, options) => {\n loggerError(red(msg), options);\n };\n\n const loggerWarnOnce = customLogger.warnOnce.bind(customLogger);\n customLogger.warnOnce = (msg, options) => {\n loggerWarnOnce(yellow(msg), options);\n };\n return customLogger;\n}\n\nasync function startVetraPreviewDrive(\n reactor: IReactorClient,\n port: number,\n verbose?: boolean,\n): Promise<string> {\n const previewDriveId = generateProjectDriveId(\"preview\");\n\n const previewDrive = {\n id: previewDriveId,\n slug: previewDriveId,\n global: {\n name: \"Vetra Preview\",\n icon: POWERHOUSE_DRIVE_ICON,\n nodes: [],\n },\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\" as const,\n triggers: [],\n },\n };\n\n const driveUrl = await addDefaultDrive(reactor, previewDrive, port);\n\n if (verbose) {\n console.log(blue(`Vetra Switchboard: Preview drive: ${driveUrl}`));\n }\n return driveUrl;\n}\n\n// Opens in Workflow Studio; only seeded when the switchboard runs workflows.\n// Exported for the switchboard bridge runner: a hosts project with\n// reactor.workflows enabled seeds the SAME project-hashed drive this vetra\n// path does, until drive provisioning becomes a plugin contribution.\nexport async function seedWorkflowsDrive(\n reactor: IReactorClient,\n port: number,\n verbose?: boolean,\n): Promise<string> {\n const workflowsDrive = {\n id: generateProjectDriveId(\"workflows\"),\n slug: \"workflows\",\n global: { name: \"Workflows\" },\n preferredEditor: \"workflow-studio\",\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\" as const,\n triggers: [],\n },\n };\n\n const driveUrl = await addDefaultDrive(reactor, workflowsDrive, port);\n\n if (verbose) {\n console.log(blue(`Vetra Switchboard: Workflows drive: ${driveUrl}`));\n }\n return driveUrl;\n}\nasync function startLocalVetraSwitchboard(args: VetraArgs, logger?: ILogger) {\n const {\n connectPort,\n switchboardPort,\n dev,\n packages,\n disableLocalPackages,\n debug,\n httpsKeyFile,\n httpsCertFile,\n remoteDrive,\n interactive,\n watch,\n verbose,\n } = args;\n\n // Convert single remote drive to array if provided\n const remoteDrives = remoteDrive ? [remoteDrive] : [];\n\n const vetraProcessorConfig: VetraProcessorConfigType = {\n interactive,\n driveUrl: remoteDrive ?? getDefaultVetraUrl(connectPort),\n driveId: getDriveId(remoteDrive),\n };\n\n const processorConfig = new Map<string, unknown>();\n processorConfig.set(VETRA_PROCESSOR_CONFIG_KEY, vetraProcessorConfig);\n\n const vetraDriveId = generateProjectDriveId(VETRA_DRIVE_NAME);\n\n // When the user didn't opt into strict-port semantics, check for a port\n // conflict up front and ask for confirmation before binding a fallback.\n // Doing this in the CLI layer keeps the interactive prompt out of the\n // switchboard server package and aligns with the existing prerelease-tag\n // confirmation flow in `ph publish`.\n const resolvedSwitchboardPort = args.strictPort\n ? switchboardPort\n : await resolveSwitchboardPort(switchboardPort);\n\n try {\n const switchboard = await startSwitchboard(\n {\n ...args,\n useVetraDrive: true, // Use Vetra drive instead of Powerhouse drive\n mcp: true,\n port: resolvedSwitchboardPort,\n // We've already probed and (when interactive) confirmed the port with\n // the user, so keep the server from running its own fallback on top.\n strictPort: true,\n dev,\n packages,\n remoteDrives,\n vetraDriveId,\n disableLocalPackages,\n debug,\n httpsKeyFile,\n httpsCertFile,\n processorConfig,\n basePath: undefined,\n keypairPath: undefined,\n dbPath: args.dbPath,\n useIdentity: undefined,\n migrate: undefined,\n migrateStatus: undefined,\n reset: undefined,\n yes: undefined,\n requireIdentity: undefined,\n },\n logger,\n );\n\n const actualSwitchboardPort = switchboard.port;\n\n // Add preview drive (only in watch mode)\n let previewDriveUrl: string | null = null;\n if (watch) {\n try {\n previewDriveUrl = await startVetraPreviewDrive(\n switchboard.reactor,\n actualSwitchboardPort,\n verbose,\n );\n } catch (error) {\n console.error(error);\n }\n }\n\n let workflowsDriveUrl: string | null = null;\n if (switchboard.workflowsEnabled) {\n try {\n workflowsDriveUrl = await seedWorkflowsDrive(\n switchboard.reactor,\n actualSwitchboardPort,\n verbose,\n );\n } catch (error) {\n console.error(error);\n }\n }\n\n if (verbose) {\n console.log(blue(`Vetra Switchboard: Started successfully`));\n if (remoteDrive) {\n console.log(\n blue(`Vetra Switchboard: Syncing with remote drive: ${remoteDrive}`),\n );\n }\n } else {\n console.log();\n console.log(\n blue(\n `Vetra Switchboard: http://localhost:${actualSwitchboardPort}/graphql`,\n ),\n );\n console.log(blue(` ➜ Drive URL: ${switchboard.defaultDriveUrl}`));\n if (previewDriveUrl) {\n console.log(blue(` ➜ Preview Drive URL: ${previewDriveUrl}`));\n }\n if (workflowsDriveUrl) {\n console.log(blue(` ➜ Workflows Drive URL: ${workflowsDriveUrl}`));\n }\n }\n return {\n driveUrl: switchboard.defaultDriveUrl || \"\",\n previewDriveUrl: previewDriveUrl,\n workflowsDriveUrl,\n switchboardPort: actualSwitchboardPort,\n };\n } catch (error) {\n console.error(\n red(\n `Vetra Switchboard: ${error instanceof Error ? error.message : String(error)}`,\n ),\n );\n throw error instanceof Error ? error : new Error(String(error));\n }\n}\n\nexport async function startVetra(args: VetraArgs) {\n const {\n connectPort,\n verbose,\n remoteDrive,\n disableConnect,\n debug,\n httpsCertFile,\n httpsKeyFile,\n disableLocalPackages,\n host,\n open,\n cors,\n strictPort,\n printUrls,\n bindCLIShortcuts,\n watchTimeout,\n } = args;\n\n const switchboardLogger = childLogger([\"vetra\", \"switchboard\"]);\n\n // One Vetra per project. Two instances over one working tree would contend\n // for the same `.ph/read-model.db` and `.ph/reactor-storage`, and leave the\n // project with two drives that diverge.\n const projectDir = process.cwd();\n const { readPackageSync } = await import(\"read-pkg\");\n const projectName = readPackageSync({ cwd: projectDir }).name;\n const probe = await probeVetraRuntime(projectDir, projectName);\n\n if (probe.status === \"live\") {\n console.log();\n console.log(green(\"Vetra is already running for this project.\"));\n console.log(\n green(` ➜ Connect: http://localhost:${probe.record.connectPort}`),\n );\n console.log(\n green(\n ` ➜ Switchboard: http://localhost:${probe.record.switchboardPort}/graphql`,\n ),\n );\n console.log(\n `Stop that instance (pid ${probe.record.pid}) if you need to restart it.`,\n );\n return;\n }\n\n if (probe.status === \"foreign\") {\n console.error(\n red(\n `.ph/vetra-runtime.json describes a live Vetra for \"${probe.record.projectName}\", ` +\n `but this project is \"${projectName}\". Refusing to start a second instance. ` +\n `Delete .ph/vetra-runtime.json if that record is wrong.`,\n ),\n );\n process.exit(1);\n }\n\n try {\n // Set default log level to info if not already specified\n if (!process.env.LOG_LEVEL) {\n setLogLevel(\"info\");\n }\n\n if (verbose) {\n switchboardLogger.info(\"Starting Vetra Switchboard...\");\n if (remoteDrive) {\n const source = remoteDrive\n ? \"command line argument\"\n : \"powerhouse.config.json\";\n switchboardLogger.info(`Using vetraUrl from ${source}: ${remoteDrive}`);\n }\n }\n const switchboardResult = await startLocalVetraSwitchboard(\n {\n ...args,\n dev: true, // Vetra always runs in dev mode to load local packages\n httpsKeyFile,\n httpsCertFile,\n disableLocalPackages,\n debug,\n },\n switchboardLogger,\n );\n const driveUrl: string = switchboardResult.driveUrl || remoteDrive || \"\";\n const previewDriveUrl = switchboardResult.previewDriveUrl;\n const workflowsDriveUrl = switchboardResult.workflowsDriveUrl;\n const actualSwitchboardPort = switchboardResult.switchboardPort;\n\n // Record what we actually bound, so a second `ph vetra` can tell a live\n // instance from a stale file, and so an agent can see the real ports.\n writeVetraRuntime(projectDir, {\n pid: process.pid,\n projectName,\n switchboardPort: actualSwitchboardPort,\n connectPort,\n mcpUrl: `http://localhost:${actualSwitchboardPort}/mcp`,\n startedAt: new Date().toISOString(),\n });\n const releaseRuntimeRecord = () => clearVetraRuntime(projectDir);\n process.on(\"exit\", releaseRuntimeRecord);\n process.on(\"SIGINT\", () => {\n releaseRuntimeRecord();\n process.exit(130);\n });\n process.on(\"SIGTERM\", () => {\n releaseRuntimeRecord();\n process.exit(143);\n });\n\n // An MCP client resolved `.mcp.json` before this process started and\n // cannot re-read it, so a drifted literal means the agent is pointed at\n // the wrong port — possibly another project's reactor. Correct the file\n // and say so plainly; we cannot fix the already-open client ourselves.\n const driftedMcpFiles = syncMcpPort(projectDir, actualSwitchboardPort);\n if (driftedMcpFiles.length > 0) {\n console.log(\n yellow(\n `Updated ${driftedMcpFiles.join(\" and \")} to port ${actualSwitchboardPort}. ` +\n `Reconnect your MCP client (/mcp) to pick it up. ` +\n `This edit is local — do not commit it.`,\n ),\n );\n }\n\n // Configure GitHub URL if remote drive is set\n if (remoteDrive) {\n // give some time for the drive to process initial strands\n await sleep(3000);\n\n await configureVetraGithubUrl(\n actualSwitchboardPort,\n remoteDrive,\n verbose,\n );\n\n // give some time for the user to read log messages\n await sleep(2000);\n }\n\n if (verbose) {\n console.log(\"Starting Codegen Reactor...\");\n }\n\n // Start Connect pointing to the drive (unless disabled)\n if (!disableConnect) {\n // --drives-public-base: advertise proxy-reachable drive URLs to the\n // browser instead of the switchboard's localhost origin.\n const publicBase = args.drivesPublicBase;\n const browserDriveUrl = publicBase\n ? rebaseDriveUrl(driveUrl, publicBase)\n : driveUrl;\n const browserPreviewDriveUrl =\n previewDriveUrl && publicBase\n ? rebaseDriveUrl(previewDriveUrl, publicBase)\n : previewDriveUrl;\n const browserWorkflowsDriveUrl =\n workflowsDriveUrl && publicBase\n ? rebaseDriveUrl(workflowsDriveUrl, publicBase)\n : workflowsDriveUrl;\n\n // The resolved default-drive list: vetra's own drives first (the\n // Vetra drive, the preview drive in watch mode, and the Workflows\n // drive when workflows are on), then the\n // project's configured `connect.drives.defaultDrives` from\n // powerhouse.config.json (issue #3023). A drive vetra also starts is\n // listed only once. An explicit `--default-drives-url` is appended on\n // top of this list by buildStudioConnectOverride — it never replaces\n // the vetra drives.\n const vetraDriveEntries = [\n ...(browserDriveUrl\n ? [{ url: browserDriveUrl, name: null, icon: null }]\n : []),\n ...(browserPreviewDriveUrl\n ? [{ url: browserPreviewDriveUrl, name: null, icon: null }]\n : []),\n ...(browserWorkflowsDriveUrl\n ? [{ url: browserWorkflowsDriveUrl, name: null, icon: null }]\n : []),\n ];\n const configuredDefaultDrives =\n getConfig(join(projectDir, POWERHOUSE_CONFIG_FILE)).connect?.drives\n ?.defaultDrives ?? [];\n const resolvedDefaultDrives = mergeDefaultDrives(\n vetraDriveEntries,\n configuredDefaultDrives,\n );\n\n if (verbose) {\n console.log(\"Starting Connect...\");\n // Mirror buildStudioConnectOverride: an explicit\n // --default-drives-url is appended to the resolved list.\n const flagDefaultDrives = wasFlagExplicitlyPassed(\"default-drives-url\")\n ? parseDefaultDrivesUrl(args.defaultDrivesUrl ?? \"\")\n : [];\n const printedDefaultDrives = mergeDefaultDrives(\n resolvedDefaultDrives,\n flagDefaultDrives,\n );\n console.log(\n ` ➜ Connect will use default drives: ${printedDefaultDrives\n .map((d) => (\"url\" in d ? d.url : `local:${d.id}`))\n .join(\", \")}`,\n );\n }\n console.log();\n console.log(green(`Vetra Connect: http://localhost:${connectPort}`));\n\n const customViteLogger = createViteLogger(green);\n\n // Programmatic override forwarded to the Connect runtime config —\n // vetra always sets these regardless of what the user typed on the\n // command line. We pass it as the explicit third arg to\n // runConnectStudio so it survives the `wasFlagExplicitlyPassed`\n // gating (the user didn't pass --default-drives-url; vetra is setting\n // it itself).\n const vetraDrivesOverride = {\n drives: {\n defaultDrives: resolvedDefaultDrives,\n preserveStrategy: \"preserve-all\" as const,\n },\n };\n\n await runConnectStudio(\n {\n ...args,\n port: connectPort,\n disableLocalPackages,\n debug,\n host: host,\n open: open,\n cors: cors,\n strictPort: strictPort,\n printUrls: printUrls,\n bindCLIShortcuts: bindCLIShortcuts,\n watchTimeout: watchTimeout,\n },\n customViteLogger,\n vetraDrivesOverride,\n );\n }\n } catch (error) {\n console.error(error);\n }\n}\n"],"names":["startSwitchboard"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,kBAAiC;CACxC,IAAI;EAKF,OAJY,SAAS,6BAA6B;GAChD,UAAU;GACV,OA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