@powerhousedao/ph-cli 6.2.3-dev.7 → 6.2.3-dev.71
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/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
- package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
- package/dist/auth-CNhbN5UM.mjs +4 -0
- package/dist/build-C78yPntL.mjs +4 -0
- package/dist/build-Dj8qfSSe.mjs +349 -0
- package/dist/build-Dj8qfSSe.mjs.map +1 -0
- package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-CEJhQWRX.mjs} +39 -27
- package/dist/cli-connect-override-CEJhQWRX.mjs.map +1 -0
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +31 -1175
- package/dist/cli.mjs.map +1 -1
- package/dist/compound-B6RZMA0Y-Cv3XMQ3Y.mjs +2459 -0
- package/dist/compound-B6RZMA0Y-Cv3XMQ3Y.mjs.map +1 -0
- package/dist/connect-build-BfhOGbha.mjs +253 -0
- package/dist/connect-build-BfhOGbha.mjs.map +1 -0
- package/dist/{connect-config-BWGiW3IB.mjs → connect-config-DblqJgxR.mjs} +19 -12
- package/dist/connect-config-DblqJgxR.mjs.map +1 -0
- package/dist/connect-plugin-configs-D2fwYpMw.mjs +50 -0
- package/dist/connect-plugin-configs-D2fwYpMw.mjs.map +1 -0
- package/dist/connect-preview-8-qLgWKt.mjs +215 -0
- package/dist/connect-preview-8-qLgWKt.mjs.map +1 -0
- package/dist/{connect-studio-D6rfWCNB.mjs → connect-studio-DX7r4iyI.mjs} +18 -11
- package/dist/connect-studio-DX7r4iyI.mjs.map +1 -0
- package/dist/connect-studio-DmjcV8I2.mjs +4 -0
- package/dist/dist-CCLkwpTS.mjs +313 -0
- package/dist/dist-CCLkwpTS.mjs.map +1 -0
- package/dist/explain-DUXbB9jf.mjs +241 -0
- package/dist/explain-DUXbB9jf.mjs.map +1 -0
- package/dist/feature-flags-xwqcHEWC.mjs +4 -0
- package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-Dgyy_kT-.mjs} +9 -3
- package/dist/generate-all-Dgyy_kT-.mjs.map +1 -0
- package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
- package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
- package/dist/generate-desktop-shell-Bj_3bJDL.mjs +317 -0
- package/dist/generate-desktop-shell-Bj_3bJDL.mjs.map +1 -0
- package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-BfFIQ35q.mjs} +19 -7
- package/dist/generate-document-model-BfFIQ35q.mjs.map +1 -0
- package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
- package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
- package/dist/generate-hosts-BFmPIW2X.mjs +18 -0
- package/dist/generate-hosts-BFmPIW2X.mjs.map +1 -0
- package/dist/generate-hosts-RWj7WPHZ.mjs +4 -0
- package/dist/generate-piece-QTt-ddt2.mjs +65 -0
- package/dist/generate-piece-QTt-ddt2.mjs.map +1 -0
- package/dist/generate-piece-action-DbxrzfKY.mjs +29 -0
- package/dist/generate-piece-action-DbxrzfKY.mjs.map +1 -0
- package/dist/generate-piece-trigger-CqVOcL9g.mjs +30 -0
- package/dist/generate-piece-trigger-CqVOcL9g.mjs.map +1 -0
- package/dist/{generate-processor-_WOx-mMe.mjs → generate-processor-DBtTkgo5.mjs} +15 -8
- package/dist/generate-processor-DBtTkgo5.mjs.map +1 -0
- package/dist/{generate-subgraph-BsHUstpl.mjs → generate-subgraph-CVlTo7qk.mjs} +12 -6
- package/dist/generate-subgraph-CVlTo7qk.mjs.map +1 -0
- package/dist/index-BIbx17vt.d.mts +4459 -0
- package/dist/index-BIbx17vt.d.mts.map +1 -0
- package/dist/{init-BZP6gvYd.mjs → init-ScuT3z7P.mjs} +7 -5
- package/dist/init-ScuT3z7P.mjs.map +1 -0
- package/dist/{inspect-DXjbQEV_.mjs → inspect-zWJnBDMJ.mjs} +11 -4
- package/dist/inspect-zWJnBDMJ.mjs.map +1 -0
- package/dist/install-added-dependencies-DVSbzler.mjs +33 -0
- package/dist/install-added-dependencies-DVSbzler.mjs.map +1 -0
- package/dist/{migrate-jGKfE02L.mjs → migrate-DK4HK7Dn.mjs} +4 -4
- package/dist/{migrate-jGKfE02L.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
- package/dist/ph-cli-commands-BhzvcuzR.mjs +4 -0
- package/dist/ph-cli-commands-pyxDifSE.mjs +1493 -0
- package/dist/ph-cli-commands-pyxDifSE.mjs.map +1 -0
- package/dist/precompress-P6cJDPVC.mjs +77 -0
- package/dist/precompress-P6cJDPVC.mjs.map +1 -0
- package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
- package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
- package/dist/run-sugar-Ns53R6lU.mjs +39 -0
- package/dist/run-sugar-Ns53R6lU.mjs.map +1 -0
- package/dist/runners/connect.d.mts +1173 -0
- package/dist/runners/connect.d.mts.map +1 -0
- package/dist/runners/connect.mjs +270 -0
- package/dist/runners/connect.mjs.map +1 -0
- package/dist/runners/switchboard.d.mts +340 -0
- package/dist/runners/switchboard.d.mts.map +1 -0
- package/dist/runners/switchboard.mjs +294 -0
- package/dist/runners/switchboard.mjs.map +1 -0
- package/dist/schemas-D5N5U_Mf.mjs +5738 -0
- package/dist/schemas-D5N5U_Mf.mjs.map +1 -0
- package/dist/scripts/emit-runner-schemas.ts +24 -0
- package/dist/scripts/generate-commands-docs.ts +8 -0
- package/dist/scripts/manage-environment +0 -0
- package/dist/scripts/setup.sh +0 -0
- package/dist/start-run-BIaYSpHh.mjs +124 -0
- package/dist/start-run-BIaYSpHh.mjs.map +1 -0
- package/dist/superseded-config-CbSTFun2.mjs +53 -0
- package/dist/superseded-config-CbSTFun2.mjs.map +1 -0
- package/dist/switchboard-C5zgkRl2.mjs +4 -0
- package/dist/switchboard-h4-XgP1h.mjs +129 -0
- package/dist/switchboard-h4-XgP1h.mjs.map +1 -0
- package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
- package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
- package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-MtTB_GAI.mjs} +8 -6
- package/dist/switchboard-reset-MtTB_GAI.mjs.map +1 -0
- package/dist/{utils-C4isxXSO.mjs → utils-9KyRM0mf.mjs} +6 -34
- package/dist/{utils-C4isxXSO.mjs.map → utils-9KyRM0mf.mjs.map} +1 -1
- package/dist/utils-DAux4Ga7.mjs +4 -0
- package/dist/{vetra-DkF6EJMY.mjs → vetra-CnrGDPX0.mjs} +70 -35
- package/dist/vetra-CnrGDPX0.mjs.map +1 -0
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +19 -0
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +1 -0
- package/package.json +39 -18
- package/dist/auth-BNkN6kS9.mjs +0 -4
- package/dist/build-C-A5-ipO.mjs +0 -4
- package/dist/build-uQXq6_HU.mjs +0 -71
- package/dist/build-uQXq6_HU.mjs.map +0 -1
- package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
- package/dist/connect-build-WL4axo4z.mjs +0 -43
- package/dist/connect-build-WL4axo4z.mjs.map +0 -1
- package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
- package/dist/connect-preview-D7ypzFDc.mjs +0 -28
- package/dist/connect-preview-D7ypzFDc.mjs.map +0 -1
- package/dist/connect-studio-BIQzyq5B.mjs +0 -5
- package/dist/connect-studio-D6rfWCNB.mjs.map +0 -1
- package/dist/generate-all-DrT4ZxHX.mjs.map +0 -1
- package/dist/generate-document-model-BJXyODfm.mjs.map +0 -1
- package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
- package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
- package/dist/init-BZP6gvYd.mjs.map +0 -1
- package/dist/inspect-DXjbQEV_.mjs.map +0 -1
- package/dist/switchboard-CJMoMzWx.mjs +0 -75
- package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
- package/dist/switchboard-iRFugh8I.mjs +0 -4
- package/dist/switchboard-reset-BcQXlcVf.mjs.map +0 -1
- package/dist/utils-BzwczAW-.mjs +0 -4
- package/dist/vetra-DkF6EJMY.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;qBAsCa;qBA+BA,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;;;;wBAyPC,mBAAmB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBASrB,IACpB,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa;;;qBAeX,YAAG;;wBAGM,MACpB,MAAM,mBACN,KAAK,gBACJ;;;;;;;;;wBAsBmB,MACpB,MAAM,mBACN,KAAK,gBACJ,QAAQ,aAAa"}
|
|
@@ -0,0 +1,270 @@
|
|
|
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]="174aad3d-12e7-549b-a91d-d3e4901eaea1")}catch(e){}}();
|
|
3
|
+
import { c as strictObject, f as url, i as literal, l as string, r as boolean, u as union } from "../schemas-D5N5U_Mf.mjs";
|
|
4
|
+
import { c as defineHostSchemas, d as entryActiveForVerb, p as findDeadConnectConfig, x as normalizePluginEntries } from "../compound-B6RZMA0Y-Cv3XMQ3Y.mjs";
|
|
5
|
+
import { c as projectReactorToConnect, d as remoteBackendUrls, f as resolveDriveDeclaration, i as mergeDefaultDrives, r as isStructuralMultiReactor, s as projectDrivesIntoConnect } from "../dist-CCLkwpTS.mjs";
|
|
6
|
+
import { DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
|
|
7
|
+
import { connectConfigSchemaWith } from "@powerhousedao/shared/connect/connect-config-schema";
|
|
8
|
+
import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
|
|
9
|
+
//#region src/runners/connect.ts
|
|
10
|
+
/**
|
|
11
|
+
* BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a
|
|
12
|
+
* hosts/connect/host.js definition onto the SAME service the classic
|
|
13
|
+
* `ph connect studio` (dev/run), `ph connect build` and `ph connect preview`
|
|
14
|
+
* (serve) commands call — no forked behavior.
|
|
15
|
+
*/
|
|
16
|
+
const kind = "reactor";
|
|
17
|
+
/** The connect host: the host-core reactor host with every runner option
|
|
18
|
+
* this module reads declared (strict: an unknown runner key fails), and
|
|
19
|
+
* `config` typed by Connect's own zod schema (the authored `connect` block),
|
|
20
|
+
* whose URL fields that name another host's outputs
|
|
21
|
+
* (`drives.defaultDrives[].url`, `renown.switchboardUrl`) are token-able.
|
|
22
|
+
* One definition, two schemas: `declaredHostSchema` (token-able fields take
|
|
23
|
+
* output tokens; types host files) and `hostSchema` (resolved; checked
|
|
24
|
+
* right before the verb). */
|
|
25
|
+
const schemas = defineHostSchemas((s) => s.reactorHostSchema.extend({
|
|
26
|
+
runner: s.runnerBaseSchema.extend({
|
|
27
|
+
/** Open a browser tab once listening (dev/serve). */
|
|
28
|
+
openBrowser: boolean().optional(),
|
|
29
|
+
/** Fail instead of moving to the next free port when `port` is taken. */
|
|
30
|
+
strictPort: boolean().optional(),
|
|
31
|
+
/** The Connect build output dir (`build` writes it, `serve` serves it). */
|
|
32
|
+
outDir: string().min(1).optional(),
|
|
33
|
+
/** Patch the baked CSP for the runtime registry (`serve`); a
|
|
34
|
+
* compound's wiring sets it on its connect member. */
|
|
35
|
+
cspRegistrySync: boolean().optional(),
|
|
36
|
+
/** The host's routes folder, project-relative; false for none.
|
|
37
|
+
* Default: hosts/connect/routes. */
|
|
38
|
+
routes: union([string(), literal(false)]).optional()
|
|
39
|
+
}).strict(),
|
|
40
|
+
config: connectConfigSchemaWith(s.tokenable).optional()
|
|
41
|
+
}));
|
|
42
|
+
const declaredHostSchema = schemas.declaredHostSchema;
|
|
43
|
+
const hostSchema = schemas.hostSchema;
|
|
44
|
+
/** What a started Connect (`dev`/`run`/`serve`) produces: the origin it
|
|
45
|
+
* actually listens on and the app URL (origin plus base path). */
|
|
46
|
+
const outputsSchema = strictObject({
|
|
47
|
+
origin: url(),
|
|
48
|
+
endpoints: strictObject({ connect: url() })
|
|
49
|
+
});
|
|
50
|
+
/** A started Connect as a runner handle. vite has already listened when the
|
|
51
|
+
* service returns, so `ready` is settled; the outputs carry the URL vite
|
|
52
|
+
* resolved (the port it actually bound), falling back to the requested one. */
|
|
53
|
+
function connectHandle(server, requested) {
|
|
54
|
+
const fallback = `http://${requested.host}:${requested.port}/`;
|
|
55
|
+
const app = server.resolvedUrls?.local[0] ?? fallback;
|
|
56
|
+
let closing;
|
|
57
|
+
return {
|
|
58
|
+
outputs: outputsSchema.parse({
|
|
59
|
+
origin: new URL(app).origin,
|
|
60
|
+
endpoints: { connect: app }
|
|
61
|
+
}),
|
|
62
|
+
ready: Promise.resolve(),
|
|
63
|
+
shutdown: () => closing ??= server.close()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** The studio arg surface is wide (commonArgs + server args); the service only
|
|
67
|
+
* reads a known subset, and the repo's own tests build these objects the same
|
|
68
|
+
* way (Partial + cast — see connect-build.test.ts `mk()`). */
|
|
69
|
+
function toStudioArgs(host) {
|
|
70
|
+
const runner = host.runner;
|
|
71
|
+
return {
|
|
72
|
+
port: runner.port ?? DEFAULT_CONNECT_STUDIO_PORT,
|
|
73
|
+
open: runner.openBrowser === true,
|
|
74
|
+
strictPort: runner.strictPort === true,
|
|
75
|
+
printUrls: true,
|
|
76
|
+
bindCLIShortcuts: false
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** Merge the reactor-block projection (protocol → connect.reactor,
|
|
80
|
+
* backend kind → instance.reactorWorker, workflows → app.workflowsEnabled)
|
|
81
|
+
* into the host's connect config, which rides the studio caller-override.
|
|
82
|
+
* The host config wins on conflict (an explicit connect.* value is intent) —
|
|
83
|
+
* EXCEPT structural multi-reactor (P4.2): declaring a remote backend next to
|
|
84
|
+
* a local one IS the intent, so it beats a scaffold-default
|
|
85
|
+
* instance.multiReactor: false, and the remote's drive url merges FIRST into
|
|
86
|
+
* drives.defaultDrives (the first url entry is what the routing client dials). */
|
|
87
|
+
/** host.js reactor.drives -> the served drives.defaultDrives shapes: locals
|
|
88
|
+
* carry id/name/icon and the preferredEditor under its Connect alias `app`;
|
|
89
|
+
* remotes carry their URL. */
|
|
90
|
+
function declaredDrivesToDefaults(projectRoot, declarations) {
|
|
91
|
+
return declarations.map((declaration) => {
|
|
92
|
+
const drive = resolveDriveDeclaration(projectRoot, declaration);
|
|
93
|
+
if (drive.kind === "remote") return {
|
|
94
|
+
url: drive.remoteUrl,
|
|
95
|
+
name: drive.name,
|
|
96
|
+
icon: drive.icon ?? null
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
local: true,
|
|
100
|
+
id: drive.id,
|
|
101
|
+
name: drive.name,
|
|
102
|
+
icon: drive.icon ?? null,
|
|
103
|
+
...drive.preferredEditor ? { app: drive.preferredEditor } : {}
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function callerOverride(host, ctx, verb = "dev") {
|
|
108
|
+
const base = { ...host.config };
|
|
109
|
+
const reactor = host.reactor;
|
|
110
|
+
const entries = host.runner.plugins;
|
|
111
|
+
const composition = entries === void 0 ? void 0 : normalizePluginEntries(entries, `hosts/${host.name}/host.js`).filter((entry) => entryActiveForVerb(entry, verb)).map((entry) => ({
|
|
112
|
+
module: entry.module,
|
|
113
|
+
config: entry.config
|
|
114
|
+
}));
|
|
115
|
+
if (entries !== void 0) {
|
|
116
|
+
const all = normalizePluginEntries(entries, `hosts/${host.name}/host.js`);
|
|
117
|
+
console.log(`[connect] composition plan (verb=${verb}): ${composition?.length ?? 0} active of ${all.length} declared`);
|
|
118
|
+
for (const entry of all) {
|
|
119
|
+
const active = entryActiveForVerb(entry, verb);
|
|
120
|
+
const scope = entry.verbs === "*" ? "" : ` verbs=[${entry.verbs.join(",")}]`;
|
|
121
|
+
const cfg = Object.keys(entry.config);
|
|
122
|
+
console.log(`[connect] ${active ? "•" : "○"} ${entry.module}${scope}` + (cfg.length ? ` config: {${cfg.join(", ")}}` : "") + (active ? "" : " (inactive for this verb)"));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const warning of findDeadConnectConfig(host.config, entries, verb, `hosts/${host.name}/host.js`)) console.warn(warning.message);
|
|
126
|
+
const declared = reactor?.drives;
|
|
127
|
+
const declaredDefaults = declared && ctx ? declaredDrivesToDefaults(ctx.projectRoot, declared) : void 0;
|
|
128
|
+
const reactorRenown = reactor?.renown;
|
|
129
|
+
const reactorNamespace = reactor?.namespace;
|
|
130
|
+
base.drives = declaredDefaults ? {
|
|
131
|
+
...base.drives,
|
|
132
|
+
defaultDrives: mergeDefaultDrives(declaredDefaults, base.drives?.defaultDrives ?? []),
|
|
133
|
+
preserveStrategy: base.drives?.preserveStrategy ?? "preserve-all"
|
|
134
|
+
} : base.drives;
|
|
135
|
+
if (composition) base.composition = composition;
|
|
136
|
+
if (reactorRenown) base.renown = {
|
|
137
|
+
...reactorRenown,
|
|
138
|
+
...base.renown
|
|
139
|
+
};
|
|
140
|
+
if (reactorNamespace !== void 0) base.instance = {
|
|
141
|
+
...base.instance,
|
|
142
|
+
namespace: base.instance?.namespace ?? reactorNamespace
|
|
143
|
+
};
|
|
144
|
+
const { connect } = projectReactorToConnect(reactor);
|
|
145
|
+
const structural = isStructuralMultiReactor(reactor);
|
|
146
|
+
if (!connect.reactor && !connect.instance && !connect.app && !structural) return host.config !== void 0 || composition || declaredDefaults ? base : void 0;
|
|
147
|
+
const drives = structural ? projectDrivesIntoConnect({
|
|
148
|
+
createdDriveUrls: remoteBackendUrls(reactor),
|
|
149
|
+
configuredDefaultDrives: base.drives?.defaultDrives
|
|
150
|
+
}).drives : base.drives;
|
|
151
|
+
const instance = Object.keys(reactor?.backends ?? {}).length > 0 ? {
|
|
152
|
+
...base.instance,
|
|
153
|
+
...connect.instance,
|
|
154
|
+
...structural ? { multiReactor: true } : {}
|
|
155
|
+
} : {
|
|
156
|
+
...connect.instance,
|
|
157
|
+
...base.instance
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
...base,
|
|
161
|
+
reactor: {
|
|
162
|
+
...connect.reactor,
|
|
163
|
+
...base.reactor
|
|
164
|
+
},
|
|
165
|
+
instance,
|
|
166
|
+
app: {
|
|
167
|
+
...connect.app,
|
|
168
|
+
...base.app
|
|
169
|
+
},
|
|
170
|
+
...drives ? { drives: {
|
|
171
|
+
...base.drives,
|
|
172
|
+
...drives
|
|
173
|
+
} } : {}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Start a server; under a supervising compound (`ctx.parent`), drop the
|
|
178
|
+
* process-exiting signal listeners it installed (vite's dev and preview
|
|
179
|
+
* servers exit on SIGTERM): the compound owns the exit and stops members in
|
|
180
|
+
* reverse dependency order through their handles.
|
|
181
|
+
*/
|
|
182
|
+
async function startUnderSupervisor(ctx, start) {
|
|
183
|
+
if (!ctx.parent) return start();
|
|
184
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
185
|
+
const before = new Map(signals.map((signal) => [signal, new Set(process.listeners(signal))]));
|
|
186
|
+
try {
|
|
187
|
+
return await start();
|
|
188
|
+
} finally {
|
|
189
|
+
for (const signal of signals) for (const listener of process.listeners(signal)) if (!before.get(signal)?.has(listener)) process.off(signal, listener);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** Fail at `ph run`, naming the plugin and key, when a composed Connect
|
|
193
|
+
* plugin's entry config does not match its schema. */
|
|
194
|
+
async function validateComposition(host, ctx) {
|
|
195
|
+
const { validateConnectPluginConfigs } = await import("../connect-plugin-configs-D2fwYpMw.mjs");
|
|
196
|
+
await validateConnectPluginConfigs(ctx.projectRoot, host.runner.plugins, ctx.verb, `hosts/${host.name}/host.js`);
|
|
197
|
+
}
|
|
198
|
+
/** A project file the build resolved: the built dist has it (as icon.ico or
|
|
199
|
+
* a data URI); served, its path would mean nothing. */
|
|
200
|
+
function isBuiltImage(ref) {
|
|
201
|
+
const src = typeof ref === "object" && ref !== null && "src" in ref ? ref.src : ref;
|
|
202
|
+
return typeof src === "string" && !isPassthroughImageRef(src);
|
|
203
|
+
}
|
|
204
|
+
function withoutBuiltImages(config) {
|
|
205
|
+
const branding = config?.branding;
|
|
206
|
+
if (!branding) return config;
|
|
207
|
+
const { favicon: _, ...served } = branding;
|
|
208
|
+
if (isBuiltImage(served.icon)) delete served.icon;
|
|
209
|
+
if (isBuiltImage(served.loader)) delete served.loader;
|
|
210
|
+
return {
|
|
211
|
+
...config,
|
|
212
|
+
branding: served
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
async function dev(host, ctx) {
|
|
216
|
+
await validateComposition(host, ctx);
|
|
217
|
+
const { runConnectStudio } = await import("../connect-studio-DmjcV8I2.mjs");
|
|
218
|
+
const args = toStudioArgs(host);
|
|
219
|
+
return connectHandle(await startUnderSupervisor(ctx, () => runConnectStudio(args, void 0, callerOverride(host, ctx, ctx.verb), { routes: host.runner.routes })), {
|
|
220
|
+
host: "localhost",
|
|
221
|
+
port: args.port
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/** `run` is dev-studio until the plugin phases give hosts a production
|
|
225
|
+
* runtime; `serve` (below) is the static production server. */
|
|
226
|
+
const run = dev;
|
|
227
|
+
/** P3.3 — `build`: the SAME service as classic `ph connect build`. */
|
|
228
|
+
async function build(host, ctx) {
|
|
229
|
+
await validateComposition(host, ctx);
|
|
230
|
+
const { runConnectBuild } = await import("../connect-build-BfhOGbha.mjs");
|
|
231
|
+
await runConnectBuild({ outDir: host.runner.outDir ?? "dist" }, callerOverride(host, ctx, ctx.verb), { routes: host.runner.routes });
|
|
232
|
+
}
|
|
233
|
+
/** P3.3 — `serve`: the SAME vite preview server as classic
|
|
234
|
+
* `ph connect preview` (static serve of a built Connect; run `build` first).
|
|
235
|
+
* The host's connect config (including a supervising compound's projected
|
|
236
|
+
* drives and the reactor projection) rides a serve override: the baked
|
|
237
|
+
* powerhouse.config.json merges with it at request time, and
|
|
238
|
+
* `runner.cspRegistrySync` (set by the compound's wiring) patches the baked
|
|
239
|
+
* CSP's script-src for the runtime registry — together these replace the
|
|
240
|
+
* ph-win-desktop sidecar's hand-rolled static server (desktop shape). */
|
|
241
|
+
async function serve(host, ctx) {
|
|
242
|
+
await validateComposition(host, ctx);
|
|
243
|
+
const { runConnectPreview } = await import("../connect-preview-8-qLgWKt.mjs");
|
|
244
|
+
const runner = host.runner;
|
|
245
|
+
const port = runner.port ?? DEFAULT_CONNECT_STUDIO_PORT;
|
|
246
|
+
const bind = runner.host ?? "127.0.0.1";
|
|
247
|
+
const args = {
|
|
248
|
+
port,
|
|
249
|
+
outDir: runner.outDir ?? "dist",
|
|
250
|
+
open: runner.openBrowser === true,
|
|
251
|
+
strictPort: runner.strictPort === true,
|
|
252
|
+
cors: true,
|
|
253
|
+
printUrls: true,
|
|
254
|
+
bindCLIShortcuts: false,
|
|
255
|
+
host: bind
|
|
256
|
+
};
|
|
257
|
+
const override = withoutBuiltImages(callerOverride(host, ctx, ctx.verb));
|
|
258
|
+
return connectHandle(await startUnderSupervisor(ctx, () => runConnectPreview(args, {
|
|
259
|
+
connect: override,
|
|
260
|
+
cspRegistrySync: runner.cspRegistrySync === true
|
|
261
|
+
})), {
|
|
262
|
+
host: bind,
|
|
263
|
+
port
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
export { build, declaredHostSchema, dev, hostSchema, kind, outputsSchema, run, serve, withoutBuiltImages };
|
|
268
|
+
|
|
269
|
+
//# sourceMappingURL=connect.mjs.map
|
|
270
|
+
//# debugId=174aad3d-12e7-549b-a91d-d3e4901eaea1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.mjs","sources":["../../src/runners/connect.ts"],"sourcesContent":["import {\n DEFAULT_CONNECT_STUDIO_PORT,\n type PHConnectCompositionEntry,\n type PHConnectDefaultDrive,\n type PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { connectConfigSchemaWith } from \"@powerhousedao/shared/connect/connect-config-schema\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport {\n defineHostSchemas,\n entryActiveForVerb,\n findDeadConnectConfig,\n isStructuralMultiReactor,\n mergeDefaultDrives,\n normalizePluginEntries,\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 { 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 })\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 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). */\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\nfunction callerOverride(\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 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\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\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 }),\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 outDir: host.runner.outDir ?? \"dist\",\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 ?? \"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: bind,\n };\n const override = withoutBuiltImages(callerOverride(host, ctx, ctx.verb));\n const server = await startUnderSupervisor(ctx, () =>\n runConnectPreview(args as ConnectPreviewArgs, {\n connect: override,\n cspRegistrySync: runner.cspRegistrySync === true,\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":";;;;;;;;;;;;;;;AAsCA,MAAa,OAAO;;;;;;;;;AAUpB,MAAM,UAAU,mBAAmB,MACjC,EAAE,kBAAkB,OAAO;CACzB,QAAQ,EAAE,iBACP,OAAO;;EAEN,aAAaA,QAAU,CAAC,CAAC,SAAS;;EAElC,YAAYA,QAAU,CAAC,CAAC,SAAS;;EAEjC,QAAQC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;;;EAGnC,iBAAiBD,QAAU,CAAC,CAAC,SAAS;;;EAGtC,QAAQE,MAAQ,CAACD,OAAS,GAAGE,QAAU,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;CAC3D,CAAC,CAAC,CACD,OAAO;CACV,QAAQ,wBAAwB,EAAE,SAAS,CAAC,CAAC,SAAS;AACxD,CAAC,CACH;AACA,MAAa,qBAAqB,QAAQ;AAC1C,MAAa,aAAa,QAAQ;;;AASlC,MAAa,gBAAgBC,aAAe;CAC1C,QAAQC,IAAM;CACd,WAAWD,aAAe,EAAE,SAASC,IAAM,EAAE,CAAC;AAChD,CAAC;;;;AAqBD,SAAS,cACP,QACA,WAC8B;CAC9B,MAAM,WAAW,UAAU,UAAU,KAAK,GAAG,UAAU,KAAK;CAC5D,MAAM,MAAM,OAAO,cAAc,MAAM,MAAM;CAC7C,IAAI;CACJ,OAAO;EACL,SAAS,cAAc,MAAM;GAC3B,QAAQ,IAAI,IAAI,GAAG,CAAC,CAAC;GACrB,WAAW,EAAE,SAAS,IAAI;EAC5B,CAAC;EACD,OAAO,QAAQ,QAAQ;EACvB,gBAAiB,YAAY,OAAO,MAAM;CAC5C;AACF;;;;AAKA,SA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EACT,iBAAiB,OAAO,oBAAoB;CAC9C,CAAC,CACH,GAC6B;EAAE,MAAM;EAAM;CAAK,CAAC;AACnD","debug_id":"174aad3d-12e7-549b-a91d-d3e4901eaea1"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { C as ZodUnknown, E as $strict, S as ZodUnion, T as $loose, _ as ZodObject, a as RunnerContext, b as ZodString, c as external_d_exports, d as ZodArray, f as ZodBoolean, g as ZodNumber, l as input, m as ZodLiteral, n as EnvToken, o as RunnerHandle, p as ZodEnum, s as TokenableSchema, u as output, v as ZodOptional, w as output$1, x as ZodURL, y as ZodRecord } from "../index-BIbx17vt.mjs";
|
|
2
|
+
import { ParsedCmdResult } from "@powerhousedao/shared/clis";
|
|
3
|
+
//#region src/commands/switchboard.d.ts
|
|
4
|
+
declare const switchboard: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
5
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
6
|
+
debug: boolean | undefined;
|
|
7
|
+
https: boolean | undefined;
|
|
8
|
+
httpsKeyFile: string | undefined;
|
|
9
|
+
httpsCertFile: string | undefined;
|
|
10
|
+
dev: boolean | undefined;
|
|
11
|
+
remoteDrives: string[];
|
|
12
|
+
disableLocalPackages: boolean;
|
|
13
|
+
packages: string | undefined;
|
|
14
|
+
port: number;
|
|
15
|
+
basePath: string | undefined;
|
|
16
|
+
keypairPath: string | undefined;
|
|
17
|
+
vetraDriveId: string;
|
|
18
|
+
dbPath: string | undefined;
|
|
19
|
+
useIdentity: boolean | undefined;
|
|
20
|
+
requireIdentity: boolean | undefined;
|
|
21
|
+
migrate: boolean | undefined;
|
|
22
|
+
migrateStatus: boolean | undefined;
|
|
23
|
+
reset: boolean | undefined;
|
|
24
|
+
yes: boolean | undefined;
|
|
25
|
+
mcp: boolean;
|
|
26
|
+
useVetraDrive: boolean;
|
|
27
|
+
}>>;
|
|
28
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
29
|
+
debug: boolean | undefined;
|
|
30
|
+
https: boolean | undefined;
|
|
31
|
+
httpsKeyFile: string | undefined;
|
|
32
|
+
httpsCertFile: string | undefined;
|
|
33
|
+
dev: boolean | undefined;
|
|
34
|
+
remoteDrives: string[];
|
|
35
|
+
disableLocalPackages: boolean;
|
|
36
|
+
packages: string | undefined;
|
|
37
|
+
port: number;
|
|
38
|
+
basePath: string | undefined;
|
|
39
|
+
keypairPath: string | undefined;
|
|
40
|
+
vetraDriveId: string;
|
|
41
|
+
dbPath: string | undefined;
|
|
42
|
+
useIdentity: boolean | undefined;
|
|
43
|
+
requireIdentity: boolean | undefined;
|
|
44
|
+
migrate: boolean | undefined;
|
|
45
|
+
migrateStatus: boolean | undefined;
|
|
46
|
+
reset: boolean | undefined;
|
|
47
|
+
yes: boolean | undefined;
|
|
48
|
+
mcp: boolean;
|
|
49
|
+
useVetraDrive: boolean;
|
|
50
|
+
}, Promise<void>> & {
|
|
51
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<Promise<void>>>;
|
|
52
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/types.d.ts
|
|
55
|
+
type SwitchboardArgs = ParsedCmdResult<typeof switchboard>;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/runners/switchboard.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a
|
|
60
|
+
* hosts/switchboard/host.js definition onto the SAME `startSwitchboard`
|
|
61
|
+
* service the classic command calls. `run` = production loaders, `dev` =
|
|
62
|
+
* Vite package loader (worker pools refused by the server, as always).
|
|
63
|
+
*/
|
|
64
|
+
export declare const kind = "reactor";
|
|
65
|
+
export declare const declaredHostSchema: ZodObject<{
|
|
66
|
+
name: ZodString;
|
|
67
|
+
profile: ZodOptional<ZodObject<{
|
|
68
|
+
appId: ZodOptional<ZodString>;
|
|
69
|
+
name: ZodOptional<ZodString>;
|
|
70
|
+
description: ZodOptional<ZodString>;
|
|
71
|
+
icon: ZodOptional<ZodString>;
|
|
72
|
+
}, $strict>>;
|
|
73
|
+
reactor: ZodOptional<ZodObject<{
|
|
74
|
+
backends: ZodOptional<ZodRecord<ZodString, ZodObject<{
|
|
75
|
+
kind: ZodEnum<{
|
|
76
|
+
"in-process": "in-process";
|
|
77
|
+
remote: "remote";
|
|
78
|
+
worker: "worker";
|
|
79
|
+
}>;
|
|
80
|
+
storage: ZodOptional<ZodObject<{
|
|
81
|
+
kind: ZodEnum<{
|
|
82
|
+
idb: "idb";
|
|
83
|
+
memory: "memory";
|
|
84
|
+
path: "path";
|
|
85
|
+
postgres: "postgres";
|
|
86
|
+
}>;
|
|
87
|
+
dataDir: ZodOptional<TokenableSchema<ZodString, EnvToken>>;
|
|
88
|
+
url: ZodOptional<ZodString>;
|
|
89
|
+
}, $strict>>;
|
|
90
|
+
readModel: ZodOptional<ZodObject<{
|
|
91
|
+
url: ZodOptional<ZodString>;
|
|
92
|
+
}, $strict>>;
|
|
93
|
+
packages: ZodOptional<ZodObject<{
|
|
94
|
+
cdnUrl: ZodOptional<ZodString>;
|
|
95
|
+
specs: ZodOptional<ZodArray<ZodString>>;
|
|
96
|
+
dynamic: ZodOptional<ZodBoolean>;
|
|
97
|
+
}, $strict>>;
|
|
98
|
+
remote: ZodOptional<ZodObject<{
|
|
99
|
+
url: TokenableSchema<ZodURL>;
|
|
100
|
+
}, $strict>>;
|
|
101
|
+
projection: ZodOptional<ZodObject<{
|
|
102
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
103
|
+
dbPoolSize: ZodOptional<ZodNumber>;
|
|
104
|
+
}, $strict>>;
|
|
105
|
+
executors: ZodOptional<ZodObject<{
|
|
106
|
+
numWorkers: ZodOptional<ZodUnion<readonly [ZodNumber, ZodLiteral<"auto">]>>;
|
|
107
|
+
}, $strict>>;
|
|
108
|
+
}, $strict>>>;
|
|
109
|
+
placement: ZodOptional<ZodObject<{
|
|
110
|
+
primary: ZodOptional<ZodString>;
|
|
111
|
+
default: ZodOptional<ZodObject<{}, $loose>>;
|
|
112
|
+
}, $strict>>;
|
|
113
|
+
protocol: ZodOptional<ZodObject<{
|
|
114
|
+
featureFlags: ZodOptional<ZodObject<{
|
|
115
|
+
documentDecisions: ZodOptional<ZodBoolean>;
|
|
116
|
+
authEnforcement: ZodOptional<ZodBoolean>;
|
|
117
|
+
authGroups: ZodOptional<ZodBoolean>;
|
|
118
|
+
authConditions: ZodOptional<ZodBoolean>;
|
|
119
|
+
}, $strict>>;
|
|
120
|
+
createSignaturePolicy: ZodOptional<ZodEnum<{
|
|
121
|
+
legacy: "legacy";
|
|
122
|
+
"v2-required": "v2-required";
|
|
123
|
+
}>>;
|
|
124
|
+
unsupportedStoredDocuments: ZodOptional<ZodEnum<{
|
|
125
|
+
"read-only": "read-only";
|
|
126
|
+
refuse: "refuse";
|
|
127
|
+
}>>;
|
|
128
|
+
}, $strict>>;
|
|
129
|
+
workflows: ZodOptional<ZodBoolean>;
|
|
130
|
+
renown: ZodOptional<ZodObject<{
|
|
131
|
+
url: ZodOptional<ZodString>;
|
|
132
|
+
networkId: ZodOptional<ZodString>;
|
|
133
|
+
chainId: ZodOptional<ZodNumber>;
|
|
134
|
+
}, $strict>>;
|
|
135
|
+
packages: ZodOptional<ZodObject<{
|
|
136
|
+
registryUrl: ZodOptional<ZodString>;
|
|
137
|
+
}, $strict>>;
|
|
138
|
+
namespace: ZodOptional<ZodString>;
|
|
139
|
+
auth: ZodOptional<ZodObject<{
|
|
140
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
141
|
+
admins: ZodOptional<ZodArray<ZodString>>;
|
|
142
|
+
renown: ZodOptional<ZodObject<{}, $loose>>;
|
|
143
|
+
}, $strict>>;
|
|
144
|
+
drives: ZodOptional<TokenableSchema<ZodArray<ZodObject<{
|
|
145
|
+
slug: ZodString;
|
|
146
|
+
id: ZodOptional<ZodString>;
|
|
147
|
+
projectHash: ZodOptional<ZodUnion<readonly [ZodBoolean, ZodLiteral<"id">]>>;
|
|
148
|
+
name: ZodOptional<ZodString>;
|
|
149
|
+
icon: ZodOptional<ZodString>;
|
|
150
|
+
preferredEditor: ZodOptional<ZodString>;
|
|
151
|
+
sharingType: ZodOptional<ZodEnum<{
|
|
152
|
+
private: "private";
|
|
153
|
+
public: "public";
|
|
154
|
+
shared: "shared";
|
|
155
|
+
}>>;
|
|
156
|
+
availableOffline: ZodOptional<ZodBoolean>;
|
|
157
|
+
remote: ZodOptional<ZodObject<{
|
|
158
|
+
url: TokenableSchema<ZodString>;
|
|
159
|
+
}, $strict>>;
|
|
160
|
+
}, $strict>>>>;
|
|
161
|
+
}, $strict>>;
|
|
162
|
+
runner: ZodObject<{
|
|
163
|
+
module: ZodString;
|
|
164
|
+
defaultVerb: ZodOptional<ZodString>;
|
|
165
|
+
port: ZodOptional<ZodNumber>;
|
|
166
|
+
host: ZodOptional<ZodString>;
|
|
167
|
+
plugins: ZodOptional<ZodArray<ZodUnion<readonly [ZodString, ZodObject<{
|
|
168
|
+
module: ZodString;
|
|
169
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
170
|
+
verbs: ZodOptional<ZodUnion<readonly [ZodLiteral<"*">, ZodArray<ZodString>]>>;
|
|
171
|
+
config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
|
|
172
|
+
}, $strict>]>>>;
|
|
173
|
+
dev: ZodOptional<ZodBoolean>;
|
|
174
|
+
outDir: ZodOptional<ZodString>;
|
|
175
|
+
}, $strict>;
|
|
176
|
+
config: ZodOptional<ZodObject<{}, $strict>>;
|
|
177
|
+
}, $strict>;
|
|
178
|
+
export declare const hostSchema: ZodObject<{
|
|
179
|
+
name: ZodString;
|
|
180
|
+
profile: ZodOptional<ZodObject<{
|
|
181
|
+
appId: ZodOptional<ZodString>;
|
|
182
|
+
name: ZodOptional<ZodString>;
|
|
183
|
+
description: ZodOptional<ZodString>;
|
|
184
|
+
icon: ZodOptional<ZodString>;
|
|
185
|
+
}, $strict>>;
|
|
186
|
+
reactor: ZodOptional<ZodObject<{
|
|
187
|
+
backends: ZodOptional<ZodRecord<ZodString, ZodObject<{
|
|
188
|
+
kind: ZodEnum<{
|
|
189
|
+
"in-process": "in-process";
|
|
190
|
+
remote: "remote";
|
|
191
|
+
worker: "worker";
|
|
192
|
+
}>;
|
|
193
|
+
storage: ZodOptional<ZodObject<{
|
|
194
|
+
kind: ZodEnum<{
|
|
195
|
+
idb: "idb";
|
|
196
|
+
memory: "memory";
|
|
197
|
+
path: "path";
|
|
198
|
+
postgres: "postgres";
|
|
199
|
+
}>;
|
|
200
|
+
dataDir: ZodOptional<TokenableSchema<ZodString, EnvToken>>;
|
|
201
|
+
url: ZodOptional<ZodString>;
|
|
202
|
+
}, $strict>>;
|
|
203
|
+
readModel: ZodOptional<ZodObject<{
|
|
204
|
+
url: ZodOptional<ZodString>;
|
|
205
|
+
}, $strict>>;
|
|
206
|
+
packages: ZodOptional<ZodObject<{
|
|
207
|
+
cdnUrl: ZodOptional<ZodString>;
|
|
208
|
+
specs: ZodOptional<ZodArray<ZodString>>;
|
|
209
|
+
dynamic: ZodOptional<ZodBoolean>;
|
|
210
|
+
}, $strict>>;
|
|
211
|
+
remote: ZodOptional<ZodObject<{
|
|
212
|
+
url: TokenableSchema<ZodURL>;
|
|
213
|
+
}, $strict>>;
|
|
214
|
+
projection: ZodOptional<ZodObject<{
|
|
215
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
216
|
+
dbPoolSize: ZodOptional<ZodNumber>;
|
|
217
|
+
}, $strict>>;
|
|
218
|
+
executors: ZodOptional<ZodObject<{
|
|
219
|
+
numWorkers: ZodOptional<ZodUnion<readonly [ZodNumber, ZodLiteral<"auto">]>>;
|
|
220
|
+
}, $strict>>;
|
|
221
|
+
}, $strict>>>;
|
|
222
|
+
placement: ZodOptional<ZodObject<{
|
|
223
|
+
primary: ZodOptional<ZodString>;
|
|
224
|
+
default: ZodOptional<ZodObject<{}, $loose>>;
|
|
225
|
+
}, $strict>>;
|
|
226
|
+
protocol: ZodOptional<ZodObject<{
|
|
227
|
+
featureFlags: ZodOptional<ZodObject<{
|
|
228
|
+
documentDecisions: ZodOptional<ZodBoolean>;
|
|
229
|
+
authEnforcement: ZodOptional<ZodBoolean>;
|
|
230
|
+
authGroups: ZodOptional<ZodBoolean>;
|
|
231
|
+
authConditions: ZodOptional<ZodBoolean>;
|
|
232
|
+
}, $strict>>;
|
|
233
|
+
createSignaturePolicy: ZodOptional<ZodEnum<{
|
|
234
|
+
legacy: "legacy";
|
|
235
|
+
"v2-required": "v2-required";
|
|
236
|
+
}>>;
|
|
237
|
+
unsupportedStoredDocuments: ZodOptional<ZodEnum<{
|
|
238
|
+
"read-only": "read-only";
|
|
239
|
+
refuse: "refuse";
|
|
240
|
+
}>>;
|
|
241
|
+
}, $strict>>;
|
|
242
|
+
workflows: ZodOptional<ZodBoolean>;
|
|
243
|
+
renown: ZodOptional<ZodObject<{
|
|
244
|
+
url: ZodOptional<ZodString>;
|
|
245
|
+
networkId: ZodOptional<ZodString>;
|
|
246
|
+
chainId: ZodOptional<ZodNumber>;
|
|
247
|
+
}, $strict>>;
|
|
248
|
+
packages: ZodOptional<ZodObject<{
|
|
249
|
+
registryUrl: ZodOptional<ZodString>;
|
|
250
|
+
}, $strict>>;
|
|
251
|
+
namespace: ZodOptional<ZodString>;
|
|
252
|
+
auth: ZodOptional<ZodObject<{
|
|
253
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
254
|
+
admins: ZodOptional<ZodArray<ZodString>>;
|
|
255
|
+
renown: ZodOptional<ZodObject<{}, $loose>>;
|
|
256
|
+
}, $strict>>;
|
|
257
|
+
drives: ZodOptional<TokenableSchema<ZodArray<ZodObject<{
|
|
258
|
+
slug: ZodString;
|
|
259
|
+
id: ZodOptional<ZodString>;
|
|
260
|
+
projectHash: ZodOptional<ZodUnion<readonly [ZodBoolean, ZodLiteral<"id">]>>;
|
|
261
|
+
name: ZodOptional<ZodString>;
|
|
262
|
+
icon: ZodOptional<ZodString>;
|
|
263
|
+
preferredEditor: ZodOptional<ZodString>;
|
|
264
|
+
sharingType: ZodOptional<ZodEnum<{
|
|
265
|
+
private: "private";
|
|
266
|
+
public: "public";
|
|
267
|
+
shared: "shared";
|
|
268
|
+
}>>;
|
|
269
|
+
availableOffline: ZodOptional<ZodBoolean>;
|
|
270
|
+
remote: ZodOptional<ZodObject<{
|
|
271
|
+
url: TokenableSchema<ZodString>;
|
|
272
|
+
}, $strict>>;
|
|
273
|
+
}, $strict>>>>;
|
|
274
|
+
}, $strict>>;
|
|
275
|
+
runner: ZodObject<{
|
|
276
|
+
module: ZodString;
|
|
277
|
+
defaultVerb: ZodOptional<ZodString>;
|
|
278
|
+
port: ZodOptional<ZodNumber>;
|
|
279
|
+
host: ZodOptional<ZodString>;
|
|
280
|
+
plugins: ZodOptional<ZodArray<ZodUnion<readonly [ZodString, ZodObject<{
|
|
281
|
+
module: ZodString;
|
|
282
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
283
|
+
verbs: ZodOptional<ZodUnion<readonly [ZodLiteral<"*">, ZodArray<ZodString>]>>;
|
|
284
|
+
config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
|
|
285
|
+
}, $strict>]>>>;
|
|
286
|
+
dev: ZodOptional<ZodBoolean>;
|
|
287
|
+
outDir: ZodOptional<ZodString>;
|
|
288
|
+
}, $strict>;
|
|
289
|
+
config: ZodOptional<ZodObject<{}, $strict>>;
|
|
290
|
+
}, $strict>;
|
|
291
|
+
/** What a switchboard host.js author writes. */
|
|
292
|
+
export type SwitchboardHost = input<typeof declaredHostSchema>;
|
|
293
|
+
/** What a verb receives (defaults applied). */
|
|
294
|
+
export type SwitchboardHostParsed = output<typeof hostSchema>;
|
|
295
|
+
/** One drive the switchboard serves: its document id and its URL. */
|
|
296
|
+
export declare const switchboardDriveOutputSchema: ZodObject<{
|
|
297
|
+
id: ZodString;
|
|
298
|
+
url: ZodURL;
|
|
299
|
+
}, $strict>;
|
|
300
|
+
/** What a started switchboard produces. `origin` carries the port the server
|
|
301
|
+
* actually bound. `drives` is keyed by the DECLARED slug (a `projectHash:
|
|
302
|
+
* true` drive is reachable as `vetra`, its URL uses the hashed slug it is
|
|
303
|
+
* served under) and includes plugin-created drives (e.g. `workflows`) and
|
|
304
|
+
* the server's implicit default drive. `endpoints.mcp` is present when MCP
|
|
305
|
+
* is mounted. */
|
|
306
|
+
export declare const outputsSchema: ZodObject<{
|
|
307
|
+
origin: ZodURL;
|
|
308
|
+
endpoints: ZodObject<{
|
|
309
|
+
graphql: ZodURL;
|
|
310
|
+
mcp: ZodOptional<ZodURL>;
|
|
311
|
+
}, $strict>;
|
|
312
|
+
drives: ZodRecord<ZodString, ZodObject<{
|
|
313
|
+
id: ZodString;
|
|
314
|
+
url: ZodURL;
|
|
315
|
+
}, $strict>>;
|
|
316
|
+
}, $strict>;
|
|
317
|
+
export type SwitchboardOutputs = output$1<typeof outputsSchema>;
|
|
318
|
+
declare global {
|
|
319
|
+
interface PHHostRunners {
|
|
320
|
+
"@powerhousedao/ph-cli/runners/switchboard": {
|
|
321
|
+
host: SwitchboardHost;
|
|
322
|
+
outputs: SwitchboardOutputs;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/** The classic arg shape with the one switch a composition may leave unset. */
|
|
327
|
+
export type SwitchboardRunnerArgs = Omit<SwitchboardArgs, "mcp"> & {
|
|
328
|
+
mcp: boolean | undefined;
|
|
329
|
+
};
|
|
330
|
+
/** What a started switchboard returns. */
|
|
331
|
+
export type SwitchboardHandle = RunnerHandle<SwitchboardOutputs>;
|
|
332
|
+
export declare function run(host: SwitchboardHostParsed, ctx: RunnerContext): Promise<SwitchboardHandle>;
|
|
333
|
+
export declare const serve: typeof run;
|
|
334
|
+
export declare function dev(host: SwitchboardHostParsed, ctx: RunnerContext): Promise<SwitchboardHandle>;
|
|
335
|
+
/** Build the project's reactor package (the SAME service as `ph build`) — what
|
|
336
|
+
* this switchboard serves. Starts no server; orthogonal to run/serve/dev. */
|
|
337
|
+
export declare function build(host: SwitchboardHostParsed, _ctx: RunnerContext): Promise<void>;
|
|
338
|
+
//#endregion
|
|
339
|
+
export {};
|
|
340
|
+
//# sourceMappingURL=switchboard.d.mts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDtB,6CAAA,iDAAA,mDAAA;;;KCWU,kBAAkB,uBAAuB;;;;;;;;;qBCrCxC;qBAqBA,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B;qBAC/C,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;YAwHU,oBAAoB,aAAa;wBAoNvB,IACpB,MAAM,uBACN,KAAK,gBACJ,QAAQ;qBAIE,cAAK;wBAEI,IACpB,MAAM,uBACN,KAAK,gBACJ,QAAQ;;;wBAMW,MACpB,MAAM,uBACN,MAAM,gBACL"}
|