@powerhousedao/ph-cli 6.2.3-dev.6 → 6.2.3-dev.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
  2. package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
  3. package/dist/auth-CNhbN5UM.mjs +4 -0
  4. package/dist/build-DmqwT-PR.mjs +4 -0
  5. package/dist/build-skPHsKkL.mjs +210 -0
  6. package/dist/build-skPHsKkL.mjs.map +1 -0
  7. package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-65mFEDEB.mjs} +38 -26
  8. package/dist/cli-connect-override-65mFEDEB.mjs.map +1 -0
  9. package/dist/cli.d.mts +2 -1
  10. package/dist/cli.mjs +31 -1175
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/connect-build-D9zrBKG4.mjs +218 -0
  13. package/dist/connect-build-D9zrBKG4.mjs.map +1 -0
  14. package/dist/{connect-config-BWGiW3IB.mjs → connect-config-C1tf7DqD.mjs} +19 -12
  15. package/dist/connect-config-C1tf7DqD.mjs.map +1 -0
  16. package/dist/connect-preview-Clue7SVp.mjs +122 -0
  17. package/dist/connect-preview-Clue7SVp.mjs.map +1 -0
  18. package/dist/connect-studio-BbsQuED_.mjs +4 -0
  19. package/dist/{connect-studio-D6rfWCNB.mjs → connect-studio-Q93rzqnC.mjs} +15 -10
  20. package/dist/{connect-studio-D6rfWCNB.mjs.map → connect-studio-Q93rzqnC.mjs.map} +1 -1
  21. package/dist/dist-D-CZUgtS.mjs +222 -0
  22. package/dist/dist-D-CZUgtS.mjs.map +1 -0
  23. package/dist/explain-BHB_4rJ3.mjs +27 -0
  24. package/dist/explain-BHB_4rJ3.mjs.map +1 -0
  25. package/dist/feature-flags-xwqcHEWC.mjs +4 -0
  26. package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-CRfVwLJ9.mjs} +5 -3
  27. package/dist/generate-all-CRfVwLJ9.mjs.map +1 -0
  28. package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
  29. package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
  30. package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-ChkXjM1s.mjs} +19 -7
  31. package/dist/generate-document-model-ChkXjM1s.mjs.map +1 -0
  32. package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
  33. package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
  34. package/dist/generate-piece-QTt-ddt2.mjs +65 -0
  35. package/dist/generate-piece-QTt-ddt2.mjs.map +1 -0
  36. package/dist/generate-piece-action-DbxrzfKY.mjs +29 -0
  37. package/dist/generate-piece-action-DbxrzfKY.mjs.map +1 -0
  38. package/dist/generate-piece-trigger-CqVOcL9g.mjs +30 -0
  39. package/dist/generate-piece-trigger-CqVOcL9g.mjs.map +1 -0
  40. package/dist/{generate-processor-_WOx-mMe.mjs → generate-processor-DBtTkgo5.mjs} +15 -8
  41. package/dist/generate-processor-DBtTkgo5.mjs.map +1 -0
  42. package/dist/{generate-subgraph-BsHUstpl.mjs → generate-subgraph-DmcQWVbd.mjs} +12 -6
  43. package/dist/generate-subgraph-DmcQWVbd.mjs.map +1 -0
  44. package/dist/host-schemas-CL_wFpY7-DOvIjrBA.mjs +478 -0
  45. package/dist/host-schemas-CL_wFpY7-DOvIjrBA.mjs.map +1 -0
  46. package/dist/index-CApW1xbO.d.mts +3752 -0
  47. package/dist/index-CApW1xbO.d.mts.map +1 -0
  48. package/dist/{init-BZP6gvYd.mjs → init-ScuT3z7P.mjs} +7 -5
  49. package/dist/init-ScuT3z7P.mjs.map +1 -0
  50. package/dist/{inspect-DXjbQEV_.mjs → inspect-BpCB0TPo.mjs} +11 -4
  51. package/dist/inspect-BpCB0TPo.mjs.map +1 -0
  52. package/dist/install-added-dependencies-DVSbzler.mjs +33 -0
  53. package/dist/install-added-dependencies-DVSbzler.mjs.map +1 -0
  54. package/dist/{migrate-jGKfE02L.mjs → migrate-DK4HK7Dn.mjs} +4 -4
  55. package/dist/{migrate-jGKfE02L.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
  56. package/dist/ph-cli-commands-BxKtXZgb.mjs +4 -0
  57. package/dist/ph-cli-commands-DGOKk392.mjs +1452 -0
  58. package/dist/ph-cli-commands-DGOKk392.mjs.map +1 -0
  59. package/dist/plugins-DtJUVtyg.mjs +4046 -0
  60. package/dist/plugins-DtJUVtyg.mjs.map +1 -0
  61. package/dist/reactor-env-CchCHhA0.mjs +4 -0
  62. package/dist/reactor-env-DHBr4V4W.mjs +29 -0
  63. package/dist/reactor-env-DHBr4V4W.mjs.map +1 -0
  64. package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
  65. package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
  66. package/dist/run-sugar-Dq3ZrLL_.mjs +39 -0
  67. package/dist/run-sugar-Dq3ZrLL_.mjs.map +1 -0
  68. package/dist/runners/compound.d.mts +127 -0
  69. package/dist/runners/compound.d.mts.map +1 -0
  70. package/dist/runners/compound.mjs +72 -0
  71. package/dist/runners/compound.mjs.map +1 -0
  72. package/dist/runners/connect.d.mts +144 -0
  73. package/dist/runners/connect.d.mts.map +1 -0
  74. package/dist/runners/connect.mjs +184 -0
  75. package/dist/runners/connect.mjs.map +1 -0
  76. package/dist/runners/switchboard.d.mts +139 -0
  77. package/dist/runners/switchboard.d.mts.map +1 -0
  78. package/dist/runners/switchboard.mjs +141 -0
  79. package/dist/runners/switchboard.mjs.map +1 -0
  80. package/dist/scripts/generate-commands-docs.ts +8 -0
  81. package/dist/scripts/manage-environment +0 -0
  82. package/dist/scripts/setup.sh +0 -0
  83. package/dist/start-run-DsZRHbM1.mjs +36 -0
  84. package/dist/start-run-DsZRHbM1.mjs.map +1 -0
  85. package/dist/superseded-config-9D7BdLvd.mjs +53 -0
  86. package/dist/superseded-config-9D7BdLvd.mjs.map +1 -0
  87. package/dist/switchboard-BUMqobK4.mjs +4 -0
  88. package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
  89. package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
  90. package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
  91. package/dist/{switchboard-reset-BcQXlcVf.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
  92. package/dist/switchboard-tQS3fhqa.mjs +132 -0
  93. package/dist/switchboard-tQS3fhqa.mjs.map +1 -0
  94. package/dist/{utils-BzwczAW-.mjs → utils-C3c5YG6v.mjs} +3 -3
  95. package/dist/{utils-C4isxXSO.mjs → utils-CvmDmCVd.mjs} +3 -3
  96. package/dist/{utils-C4isxXSO.mjs.map → utils-CvmDmCVd.mjs.map} +1 -1
  97. package/dist/{vetra-DkF6EJMY.mjs → vetra-BNJZ5LHN.mjs} +66 -31
  98. package/dist/vetra-BNJZ5LHN.mjs.map +1 -0
  99. package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs +19 -0
  100. package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs.map +1 -0
  101. package/package.json +41 -17
  102. package/dist/auth-BNkN6kS9.mjs +0 -4
  103. package/dist/build-C-A5-ipO.mjs +0 -4
  104. package/dist/build-uQXq6_HU.mjs +0 -71
  105. package/dist/build-uQXq6_HU.mjs.map +0 -1
  106. package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
  107. package/dist/connect-build-WL4axo4z.mjs +0 -43
  108. package/dist/connect-build-WL4axo4z.mjs.map +0 -1
  109. package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
  110. package/dist/connect-preview-D7ypzFDc.mjs +0 -28
  111. package/dist/connect-preview-D7ypzFDc.mjs.map +0 -1
  112. package/dist/connect-studio-BIQzyq5B.mjs +0 -5
  113. package/dist/generate-all-DrT4ZxHX.mjs.map +0 -1
  114. package/dist/generate-document-model-BJXyODfm.mjs.map +0 -1
  115. package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
  116. package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
  117. package/dist/init-BZP6gvYd.mjs.map +0 -1
  118. package/dist/inspect-DXjbQEV_.mjs.map +0 -1
  119. package/dist/switchboard-CJMoMzWx.mjs +0 -75
  120. package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
  121. package/dist/switchboard-iRFugh8I.mjs +0 -4
  122. package/dist/vetra-DkF6EJMY.mjs.map +0 -1
@@ -0,0 +1,184 @@
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]="1f6361f6-3ddd-5ba7-8f53-515c32863b92")}catch(e){}}();
3
+ import { a as pluginEntrySchema, c as boolean, d as number, i as normalizePluginEntries, m as string, n as entryActiveForVerb, s as array, u as looseObject } from "../plugins-DtJUVtyg.mjs";
4
+ import { a as mergeDefaultDrives, c as profileSchema, f as resolveDriveDeclaration, l as projectDrivesIntoConnect, u as reactorSchema } from "../host-schemas-CL_wFpY7-DOvIjrBA.mjs";
5
+ import { i as projectReactorToConnect, n as isStructuralMultiReactor, o as remoteBackendUrls } from "../dist-D-CZUgtS.mjs";
6
+ import { DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
7
+ //#region src/runners/connect.ts
8
+ /**
9
+ * BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a
10
+ * hosts/connect/host.js definition onto the SAME service the classic
11
+ * `ph connect studio` command calls — no forked behavior. Real verbs
12
+ * (`build`, `serve`) arrive with later phases; their absence here is
13
+ * deliberate and surfaces through the verb-listing error.
14
+ */
15
+ const kind = "reactor";
16
+ /** Phase-2 schema (D2.d): `reactor` and `profile` validate strictly via the
17
+ * shared host-core schemas — a typo'd protocol key fails instead of silently
18
+ * not applying. `config` stays loose: it is runner-defined by design. */
19
+ const hostSchema = looseObject({
20
+ name: string().min(1),
21
+ runner: looseObject({
22
+ module: string(),
23
+ port: number().int().positive().optional(),
24
+ host: string().optional(),
25
+ https: boolean().optional(),
26
+ openBrowser: boolean().optional(),
27
+ plugins: array(pluginEntrySchema).optional()
28
+ }),
29
+ config: looseObject({}).optional(),
30
+ profile: profileSchema,
31
+ reactor: reactorSchema.optional()
32
+ });
33
+ /** The studio arg surface is wide (commonArgs + server args); the service only
34
+ * reads a known subset, and the repo's own tests build these objects the same
35
+ * way (Partial + cast — see connect-build.test.ts `mk()`). */
36
+ function toStudioArgs(host) {
37
+ const runner = host.runner;
38
+ return {
39
+ port: typeof runner.port === "number" ? runner.port : DEFAULT_CONNECT_STUDIO_PORT,
40
+ open: runner.openBrowser === true,
41
+ strictPort: runner.strictPort === true,
42
+ printUrls: true,
43
+ bindCLIShortcuts: false
44
+ };
45
+ }
46
+ /** Merge the reactor-block projection (protocol → connect.reactor,
47
+ * backend kind → instance.reactorWorker, workflows → app.workflowsEnabled)
48
+ * into the host's connect config, which rides the studio caller-override.
49
+ * The host config wins on conflict (an explicit connect.* value is intent) —
50
+ * EXCEPT structural multi-reactor (P4.2): declaring a remote backend next to
51
+ * a local one IS the intent, so it beats a scaffold-default
52
+ * instance.multiReactor: false, and the remote's drive url merges FIRST into
53
+ * drives.defaultDrives (the first url entry is what the routing client dials). */
54
+ /** host.js reactor.drives -> the served drives.defaultDrives shapes: locals
55
+ * carry id/name/icon and the preferredEditor under its Connect alias `app`;
56
+ * remotes carry their URL. */
57
+ function declaredDrivesToDefaults(projectRoot, declarations) {
58
+ return declarations.map((declaration) => {
59
+ const drive = resolveDriveDeclaration(projectRoot, declaration);
60
+ if (drive.kind === "remote") return {
61
+ url: drive.remoteUrl,
62
+ name: drive.name,
63
+ icon: drive.icon ?? null
64
+ };
65
+ return {
66
+ local: true,
67
+ id: drive.id,
68
+ name: drive.name,
69
+ icon: drive.icon ?? null,
70
+ ...drive.preferredEditor ? { app: drive.preferredEditor } : {}
71
+ };
72
+ });
73
+ }
74
+ function callerOverride(host, ctx, verb = "dev") {
75
+ const base = host.config ?? {};
76
+ const reactor = host.reactor;
77
+ const entries = host.runner.plugins;
78
+ const composition = entries === void 0 ? void 0 : normalizePluginEntries(entries, `hosts/${host.name}/host.js`).filter((entry) => entryActiveForVerb(entry, verb)).map((entry) => ({
79
+ module: entry.module,
80
+ config: entry.config
81
+ }));
82
+ if (entries !== void 0) {
83
+ const all = normalizePluginEntries(entries, `hosts/${host.name}/host.js`);
84
+ console.log(`[connect] composition plan (verb=${verb}): ${composition?.length ?? 0} active of ${all.length} declared`);
85
+ for (const entry of all) {
86
+ const active = entryActiveForVerb(entry, verb);
87
+ const scope = entry.verbs === "*" ? "" : ` verbs=[${entry.verbs.join(",")}]`;
88
+ const cfg = Object.keys(entry.config ?? {});
89
+ console.log(`[connect] ${active ? "•" : "○"} ${entry.module}${scope}` + (cfg.length ? ` config: {${cfg.join(", ")}}` : "") + (active ? "" : " (inactive for this verb)"));
90
+ }
91
+ }
92
+ const declared = reactor?.drives;
93
+ const declaredDefaults = declared && ctx ? declaredDrivesToDefaults(ctx.projectRoot, declared) : void 0;
94
+ const reactorRenown = reactor?.renown;
95
+ const reactorNamespace = reactor?.namespace;
96
+ base.drives = declaredDefaults ? {
97
+ ...base.drives,
98
+ defaultDrives: mergeDefaultDrives(declaredDefaults, base.drives?.defaultDrives ?? []),
99
+ preserveStrategy: base.drives?.preserveStrategy ?? "preserve-all"
100
+ } : base.drives;
101
+ if (composition) base.composition = composition;
102
+ if (reactorRenown) base.renown = {
103
+ ...reactorRenown,
104
+ ...base.renown
105
+ };
106
+ if (reactorNamespace !== void 0) base.instance = {
107
+ ...base.instance,
108
+ namespace: base.instance?.namespace ?? reactorNamespace
109
+ };
110
+ const { connect } = projectReactorToConnect(reactor);
111
+ const structural = isStructuralMultiReactor(reactor);
112
+ if (!connect.reactor && !connect.instance && !connect.app && !structural) return host.config;
113
+ const drives = structural ? projectDrivesIntoConnect({
114
+ createdDriveUrls: remoteBackendUrls(reactor),
115
+ configuredDefaultDrives: base.drives?.defaultDrives
116
+ }).drives : base.drives;
117
+ const instance = Object.keys(reactor?.backends ?? {}).length > 0 ? {
118
+ ...base.instance,
119
+ ...connect.instance,
120
+ ...structural ? { multiReactor: true } : {}
121
+ } : {
122
+ ...connect.instance,
123
+ ...base.instance
124
+ };
125
+ return {
126
+ ...base,
127
+ reactor: {
128
+ ...connect.reactor,
129
+ ...base.reactor
130
+ },
131
+ instance,
132
+ app: {
133
+ ...connect.app,
134
+ ...base.app
135
+ },
136
+ ...drives ? { drives: {
137
+ ...base.drives,
138
+ ...drives
139
+ } } : {}
140
+ };
141
+ }
142
+ async function dev(host, ctx) {
143
+ const { runConnectStudio } = await import("../connect-studio-BbsQuED_.mjs");
144
+ await runConnectStudio(toStudioArgs(host), void 0, callerOverride(host, ctx, ctx.verb ?? "dev"));
145
+ }
146
+ /** `run` is dev-studio until the plugin phases give hosts a production
147
+ * runtime; `serve` (below) is the static production server. */
148
+ const run = dev;
149
+ /** P3.3 — `build`: the SAME service as classic `ph connect build`. */
150
+ async function build(host, _ctx) {
151
+ const { runConnectBuild } = await import("../connect-build-D9zrBKG4.mjs");
152
+ const runner = host.runner;
153
+ await runConnectBuild({ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist" });
154
+ }
155
+ /** P3.3 — `serve`: the SAME vite preview server as classic
156
+ * `ph connect preview` (static serve of a built Connect; run `build` first).
157
+ * The host's connect config (including a supervising compound's projected
158
+ * drives and the reactor projection) rides a serve override: the baked
159
+ * powerhouse.config.json merges with it at request time, and
160
+ * `runner.cspRegistrySync` (set by the compound's wiring) patches the baked
161
+ * CSP's script-src for the runtime registry — together these replace the
162
+ * ph-win-desktop sidecar's hand-rolled static server (desktop shape). */
163
+ async function serve(host, ctx) {
164
+ const { runConnectPreview } = await import("../connect-preview-Clue7SVp.mjs");
165
+ const runner = host.runner;
166
+ await runConnectPreview({
167
+ port: typeof runner.port === "number" ? runner.port : DEFAULT_CONNECT_STUDIO_PORT,
168
+ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist",
169
+ open: runner.openBrowser === true,
170
+ strictPort: runner.strictPort === true,
171
+ cors: true,
172
+ printUrls: true,
173
+ bindCLIShortcuts: false,
174
+ host: typeof runner.host === "string" ? runner.host : "127.0.0.1"
175
+ }, {
176
+ connect: callerOverride(host, ctx, ctx.verb ?? "serve"),
177
+ cspRegistrySync: runner.cspRegistrySync === true
178
+ });
179
+ }
180
+ //#endregion
181
+ export { build, dev, hostSchema, kind, run, serve };
182
+
183
+ //# sourceMappingURL=connect.mjs.map
184
+ //# debugId=1f6361f6-3ddd-5ba7-8f53-515c32863b92
@@ -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 {\n entryActiveForVerb,\n isStructuralMultiReactor,\n mergeDefaultDrives,\n normalizePluginEntries,\n pluginEntrySchema,\n profileSchema,\n resolveDriveDeclaration,\n type DriveDeclaration,\n type PluginEntry,\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 host: z.string().optional(),\n https: z.boolean().optional(),\n openBrowser: z.boolean().optional(),\n // THE COMPOSITION (rewire R3): plugin entries, presence is activation.\n plugins: z.array(pluginEntrySchema).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). */\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: HostDefinition,\n ctx?: RunnerContext,\n verb = \"dev\",\n): PHConnectRuntimeConfig | undefined {\n const base = (host.config ?? {}) as PHConnectRuntimeConfig;\n const reactor = host.reactor as ReactorConfig | undefined;\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 as { plugins?: PluginEntry[] }).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 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 === \"*\"\n ? \"\"\n : ` verbs=[${(entry.verbs as string[]).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 const declared = (reactor as { drives?: DriveDeclaration[] } | undefined)\n ?.drives;\n const declaredDefaults =\n declared && ctx\n ? declaredDrivesToDefaults(ctx.projectRoot, declared)\n : undefined;\n const reactorRenown = (reactor as { renown?: unknown } | undefined)?.renown;\n const reactorNamespace = (reactor as { namespace?: string } | undefined)\n ?.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)\n base.renown = { ...(reactorRenown as object), ...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 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(\n toStudioArgs(host),\n undefined,\n callerOverride(host, ctx, ctx.verb ?? \"dev\"),\n );\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, ctx, ctx.verb ?? \"serve\");\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","z.array"],"mappings":";;;;;;;;;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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,MAAM,KAAK,IAAI,QAAQ,OAErC;EAChB,iBAAiB,OAAO,oBAAoB;CAC9C,CAAC;AACH","debug_id":"1f6361f6-3ddd-5ba7-8f53-515c32863b92"}
@@ -0,0 +1,139 @@
1
+ import { a as ZodBoolean, c as ZodNumber, d as ZodRecord, f as ZodString, g as $strict, h as $loose, i as ZodArray, l as ZodObject, m as ZodUnknown, n as RunnerContext, o as ZodEnum, p as ZodUnion, r as external_d_exports, s as ZodLiteral, t as HostDefinition, u as ZodOptional } from "../index-CApW1xbO.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<ZodArray<ZodUnion<readonly [ZodString, ZodObject<{
19
+ module: ZodString;
20
+ enabled: ZodOptional<ZodBoolean>;
21
+ verbs: ZodOptional<ZodUnion<readonly [ZodLiteral<"*">, ZodArray<ZodString>]>>;
22
+ config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
23
+ }, $strict>]>>>;
24
+ }, $loose>;
25
+ config: ZodOptional<ZodObject<{}, $loose>>;
26
+ profile: ZodOptional<ZodObject<{
27
+ appId: ZodOptional<ZodString>;
28
+ name: ZodOptional<ZodString>;
29
+ description: ZodOptional<ZodString>;
30
+ icon: ZodOptional<ZodString>;
31
+ }, $strict>>;
32
+ reactor: ZodOptional<ZodObject<{
33
+ backends: ZodOptional<ZodRecord<ZodString, ZodObject<{
34
+ kind: ZodOptional<ZodEnum<{
35
+ "in-process": "in-process";
36
+ remote: "remote";
37
+ worker: "worker";
38
+ }>>;
39
+ storage: ZodOptional<ZodObject<{
40
+ kind: ZodEnum<{
41
+ idb: "idb";
42
+ memory: "memory";
43
+ path: "path";
44
+ postgres: "postgres";
45
+ }>;
46
+ dataDir: ZodOptional<ZodString>;
47
+ url: ZodOptional<ZodString>;
48
+ }, $strict>>;
49
+ readModel: ZodOptional<ZodObject<{
50
+ url: ZodOptional<ZodString>;
51
+ }, $strict>>;
52
+ packages: ZodOptional<ZodObject<{
53
+ cdnUrl: ZodOptional<ZodString>;
54
+ specs: ZodOptional<ZodArray<ZodString>>;
55
+ dynamic: ZodOptional<ZodBoolean>;
56
+ }, $strict>>;
57
+ remote: ZodOptional<ZodObject<{
58
+ host: ZodOptional<ZodString>;
59
+ url: ZodOptional<ZodString>;
60
+ }, $strict>>;
61
+ projection: ZodOptional<ZodObject<{
62
+ enabled: ZodOptional<ZodBoolean>;
63
+ dbPoolSize: ZodOptional<ZodNumber>;
64
+ }, $strict>>;
65
+ executors: ZodOptional<ZodObject<{
66
+ numWorkers: ZodOptional<ZodUnion<readonly [ZodNumber, ZodLiteral<"auto">]>>;
67
+ }, $strict>>;
68
+ }, $strict>>>;
69
+ placement: ZodOptional<ZodObject<{
70
+ primary: ZodOptional<ZodString>;
71
+ default: ZodOptional<ZodObject<{}, $loose>>;
72
+ }, $strict>>;
73
+ protocol: ZodOptional<ZodObject<{
74
+ featureFlags: ZodOptional<ZodObject<{
75
+ documentDecisions: ZodOptional<ZodBoolean>;
76
+ authEnforcement: ZodOptional<ZodBoolean>;
77
+ authGroups: ZodOptional<ZodBoolean>;
78
+ authConditions: ZodOptional<ZodBoolean>;
79
+ }, $strict>>;
80
+ createSignaturePolicy: ZodOptional<ZodEnum<{
81
+ legacy: "legacy";
82
+ "v2-required": "v2-required";
83
+ }>>;
84
+ unsupportedStoredDocuments: ZodOptional<ZodEnum<{
85
+ "read-only": "read-only";
86
+ refuse: "refuse";
87
+ }>>;
88
+ }, $strict>>;
89
+ workflows: ZodOptional<ZodBoolean>;
90
+ renown: ZodOptional<ZodObject<{
91
+ url: ZodOptional<ZodString>;
92
+ networkId: ZodOptional<ZodString>;
93
+ chainId: ZodOptional<ZodNumber>;
94
+ }, $strict>>;
95
+ packages: ZodOptional<ZodObject<{
96
+ registryUrl: ZodOptional<ZodString>;
97
+ }, $strict>>;
98
+ namespace: ZodOptional<ZodString>;
99
+ auth: ZodOptional<ZodObject<{
100
+ enabled: ZodOptional<ZodBoolean>;
101
+ admins: ZodOptional<ZodArray<ZodString>>;
102
+ renown: ZodOptional<ZodObject<{}, $loose>>;
103
+ }, $strict>>;
104
+ drives: ZodOptional<ZodArray<ZodObject<{
105
+ slug: ZodString;
106
+ id: ZodOptional<ZodString>;
107
+ projectHash: ZodOptional<ZodBoolean>;
108
+ name: ZodOptional<ZodString>;
109
+ icon: ZodOptional<ZodString>;
110
+ preferredEditor: ZodOptional<ZodString>;
111
+ sharingType: ZodOptional<ZodEnum<{
112
+ private: "private";
113
+ public: "public";
114
+ shared: "shared";
115
+ }>>;
116
+ availableOffline: ZodOptional<ZodBoolean>;
117
+ remote: ZodOptional<ZodObject<{
118
+ url: ZodString;
119
+ }, $strict>>;
120
+ }, $strict>>>;
121
+ }, $strict>>;
122
+ }, $loose>;
123
+ /** What a started switchboard reports to a supervising compound: its port and
124
+ * the drive it serves (projected into a connect member's defaultDrives). */
125
+ export interface SwitchboardHandle {
126
+ port: number;
127
+ driveUrls: string[];
128
+ endpoints: Record<string, string>;
129
+ ready: Promise<void>;
130
+ }
131
+ export declare function run(host: HostDefinition, ctx: RunnerContext): Promise<SwitchboardHandle>;
132
+ export declare const serve: typeof run;
133
+ export declare function dev(host: HostDefinition, ctx: RunnerContext): Promise<SwitchboardHandle>;
134
+ /** Build the project's reactor package (the SAME service as `ph build`) — what
135
+ * this switchboard serves. Starts no server; orthogonal to run/serve/dev. */
136
+ export declare function build(host: HostDefinition, _ctx: RunnerContext): Promise<void>;
137
+ //#endregion
138
+ export {};
139
+ //# sourceMappingURL=switchboard.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchboard.d.mts","names":[],"sources":["../../src/runners/switchboard.ts"],"mappings":";;;;;;;;;qBAgCa;;qBAGA,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcrB;;;iBAoDe;EACf;EACA;EACA,WAAW;EACX,OAAO;;wBAgJa,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;qBAIE,cAAK;wBAEI,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;;;wBAMW,MACpB,MAAM,gBACN,MAAM,gBACL"}
@@ -0,0 +1,141 @@
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]="52e85d4a-8b51-5c40-9ded-a2bdeeda2782")}catch(e){}}();
3
+ import { a as pluginEntrySchema, c as boolean, d as number, m as string, s as array, u as looseObject } from "../plugins-DtJUVtyg.mjs";
4
+ import { c as profileSchema, f as resolveDriveDeclaration, m as seedDrives, u as reactorSchema } from "../host-schemas-CL_wFpY7-DOvIjrBA.mjs";
5
+ import { s as resolveHostPlugins } from "../dist-D-CZUgtS.mjs";
6
+ import { t as applyReactorEnvProjection } from "../reactor-env-DHBr4V4W.mjs";
7
+ import { DEFAULT_SWITCHBOARD_PORT, DEFAULT_VETRA_DRIVE_ID } from "@powerhousedao/shared/clis";
8
+ //#region src/runners/switchboard.ts
9
+ /**
10
+ * BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a
11
+ * hosts/switchboard/host.js definition onto the SAME `startSwitchboard`
12
+ * service the classic command calls. `run` = production loaders, `dev` =
13
+ * Vite package loader (worker pools refused by the server, as always).
14
+ * There is deliberately no `build` verb — the switchboard has none.
15
+ */
16
+ const kind = "reactor";
17
+ /** Phase-2 schema (D2.d): `reactor`/`profile` strict via host-core. */
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
+ plugins: array(pluginEntrySchema).optional()
25
+ }),
26
+ config: looseObject({}).optional(),
27
+ profile: profileSchema,
28
+ reactor: reactorSchema.optional()
29
+ });
30
+ function toSwitchboardArgs(host, devMode, dbPath, composed) {
31
+ const runner = host.runner;
32
+ return {
33
+ port: typeof runner.port === "number" ? runner.port : DEFAULT_SWITCHBOARD_PORT,
34
+ vetraDriveId: DEFAULT_VETRA_DRIVE_ID,
35
+ mcp: composed ? void 0 : true,
36
+ useVetraDrive: false,
37
+ remoteDrives: [],
38
+ dev: devMode || runner.dev === true,
39
+ ...dbPath ? { dbPath } : {}
40
+ };
41
+ }
42
+ /** The slug of the drive the switchboard creates by default
43
+ * (apps/switchboard config); `runner.driveSlug` overrides. */
44
+ const DEFAULT_DRIVE_SLUG = "powerhouse";
45
+ /** Poll the default drive endpoint until the server answers — the compound's
46
+ * readiness gate: Connect auto-connects the drive on first load, so the drive
47
+ * must answer before the connect member serves (the sidecar's
48
+ * waitForSwitchboard, moved behind the handle contract). */
49
+ async function waitForDrive(url, timeoutMs) {
50
+ const deadline = Date.now() + timeoutMs;
51
+ for (;;) {
52
+ try {
53
+ if ((await fetch(url, { signal: AbortSignal.timeout(3e3) })).ok) return;
54
+ } catch {}
55
+ if (Date.now() > deadline) throw new Error(`Switchboard drive ${url} did not answer within ${timeoutMs}ms.`);
56
+ await new Promise((resolve) => setTimeout(resolve, 400));
57
+ }
58
+ }
59
+ /** Adapter from the switchboard's reactor client onto the host-core seeder.
60
+ * addDefaultDrive is slug-idempotent itself, so findDriveBySlug delegates. */
61
+ function seederClient(reactor, port) {
62
+ return {
63
+ findDriveBySlug: () => Promise.resolve(void 0),
64
+ createDrive: async (drive) => {
65
+ const { addDefaultDrive } = await import("@powerhousedao/switchboard/utils");
66
+ await addDefaultDrive(reactor, {
67
+ id: drive.id,
68
+ slug: drive.slug,
69
+ global: {
70
+ name: drive.name,
71
+ icon: drive.icon
72
+ },
73
+ ...drive.preferredEditor ? { preferredEditor: drive.preferredEditor } : {},
74
+ local: {
75
+ availableOffline: drive.availableOffline,
76
+ listeners: [],
77
+ sharingType: drive.sharingType,
78
+ triggers: []
79
+ }
80
+ }, port);
81
+ },
82
+ attachRemoteDrive: () => Promise.resolve()
83
+ };
84
+ }
85
+ async function start(host, ctx, devMode) {
86
+ const options = applyReactorEnvProjection(host.reactor, `hosts/${host.name}/host.js`);
87
+ const { startSwitchboard } = await import("../switchboard-BUMqobK4.mjs");
88
+ const entriesDeclared = host.runner.plugins !== void 0;
89
+ const args = toSwitchboardArgs(host, devMode, options.dbPath, entriesDeclared);
90
+ const entries = host.runner.plugins;
91
+ let pluginComposition;
92
+ if (entries !== void 0) {
93
+ process.env.FEATURE_PLUGIN_HOST_ENABLED = "1";
94
+ pluginComposition = await resolveHostPlugins(ctx.projectRoot, "switchboard", ctx.verb ?? (devMode ? "dev" : "run"), entries, `hosts/${host.name}/host.js`);
95
+ }
96
+ const resolvedDrives = (host.reactor?.drives ?? []).map((declaration) => resolveDriveDeclaration(ctx.projectRoot, declaration));
97
+ const switchboard = await startSwitchboard({
98
+ ...args,
99
+ ...pluginComposition ? { pluginComposition } : {},
100
+ ...resolvedDrives.length > 0 ? {
101
+ drive: void 0,
102
+ remoteDrives: resolvedDrives.filter((d) => d.kind === "remote").map((d) => d.remoteUrl)
103
+ } : {}
104
+ });
105
+ const port = args.port;
106
+ const localDrives = resolvedDrives.filter((d) => d.kind === "local");
107
+ if (localDrives.length > 0 && switchboard) await seedDrives(seederClient(switchboard.reactor, port), localDrives);
108
+ const driveUrl = `http://localhost:${port}/d/${localDrives.length > 0 ? localDrives[0].slug : typeof host.runner.driveSlug === "string" ? host.runner.driveSlug : DEFAULT_DRIVE_SLUG}`;
109
+ const driveUrls = localDrives.length > 0 ? localDrives.map((d) => `http://localhost:${port}/d/${d.slug}`) : [driveUrl];
110
+ if (switchboard?.workflowsEnabled) {
111
+ const { seedWorkflowsDrive } = await import("../vetra-BNJZ5LHN.mjs");
112
+ driveUrls.push(await seedWorkflowsDrive(switchboard.reactor, port));
113
+ }
114
+ const ready = waitForDrive(driveUrl, 18e4);
115
+ ready.catch(() => void 0);
116
+ return {
117
+ port,
118
+ driveUrls,
119
+ endpoints: { graphql: `http://localhost:${port}/graphql` },
120
+ ready
121
+ };
122
+ }
123
+ async function run(host, ctx) {
124
+ return start(host, ctx, false);
125
+ }
126
+ const serve = run;
127
+ async function dev(host, ctx) {
128
+ return start(host, ctx, true);
129
+ }
130
+ /** Build the project's reactor package (the SAME service as `ph build`) — what
131
+ * this switchboard serves. Starts no server; orthogonal to run/serve/dev. */
132
+ async function build(host, _ctx) {
133
+ const { runBuild } = await import("../build-DmqwT-PR.mjs");
134
+ const runner = host.runner;
135
+ await runBuild({ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist" });
136
+ }
137
+ //#endregion
138
+ export { build, dev, hostSchema, kind, run, serve };
139
+
140
+ //# sourceMappingURL=switchboard.mjs.map
141
+ //# debugId=52e85d4a-8b51-5c40-9ded-a2bdeeda2782
@@ -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 {\n pluginEntrySchema,\n resolveDriveDeclaration,\n resolveHostPlugins,\n seedDrives,\n type DriveDeclaration,\n type DriveSeederClient,\n type ResolvedDrive,\n} from \"@powerhousedao/host-core\";\nimport { applyReactorEnvProjection } from \"./reactor-env.js\";\nimport { z } from \"zod\";\nimport type { BuildArgs, 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 // THE COMPOSITION (rewire R2): plugin entries, presence is activation.\n // (The classic packages-CSV meaning of this field is retired — packages\n // load via reactor.backends.*.packages / the package manager.)\n plugins: z.array(pluginEntrySchema).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 composed: boolean,\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 // A declared composition owns the carved switches; the plugins set them.\n // Classic path keeps the bridge defaults.\n mcp: composed ? undefined : 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\n/** Adapter from the switchboard's reactor client onto the host-core seeder.\n * addDefaultDrive is slug-idempotent itself, so findDriveBySlug delegates. */\nfunction seederClient(reactor: unknown, port: number): DriveSeederClient {\n return {\n findDriveBySlug: () => Promise.resolve(undefined),\n createDrive: async (drive: ResolvedDrive) => {\n const { addDefaultDrive } =\n await import(\"@powerhousedao/switchboard/utils\");\n await addDefaultDrive(\n reactor as Parameters<typeof addDefaultDrive>[0],\n {\n id: drive.id,\n slug: drive.slug,\n global: { name: drive.name, icon: drive.icon },\n ...(drive.preferredEditor\n ? { preferredEditor: drive.preferredEditor }\n : {}),\n local: {\n availableOffline: drive.availableOffline,\n listeners: [],\n sharingType: drive.sharingType,\n triggers: [],\n },\n } as Parameters<typeof addDefaultDrive>[1],\n port,\n );\n },\n attachRemoteDrive: () => Promise.resolve(), // remotes ride options.remoteDrives\n };\n}\n\nasync function start(\n host: HostDefinition,\n ctx: RunnerContext,\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 entriesDeclared =\n (host.runner as { plugins?: unknown }).plugins !== undefined;\n const args = toSwitchboardArgs(\n host,\n devMode,\n options.dbPath,\n entriesDeclared,\n );\n\n // R2 step 2: a declared composition activates the plugin pipeline — the\n // runner resolves the entries against the PROJECT dependency tree and the\n // flag drives server-side activation. No plugins key = classic path.\n const entries = (host.runner as { plugins?: unknown }).plugins as\n | Parameters<typeof resolveHostPlugins>[3]\n | undefined;\n let pluginComposition;\n if (entries !== undefined) {\n process.env.FEATURE_PLUGIN_HOST_ENABLED = \"1\";\n pluginComposition = await resolveHostPlugins(\n ctx.projectRoot,\n \"switchboard\",\n ctx.verb ?? (devMode ? \"dev\" : \"run\"),\n entries,\n `hosts/${host.name}/host.js`,\n );\n }\n\n // Core drive declarations (reactor.drives): locals seed after boot via the\n // host-core seeder; remotes ride the existing remoteDrives option; the\n // implicit default powerhouse drive is replaced by the declared set.\n const declarations = (\n host.reactor as { drives?: DriveDeclaration[] } | undefined\n )?.drives;\n const resolvedDrives = (declarations ?? []).map((declaration) =>\n resolveDriveDeclaration(ctx.projectRoot, declaration),\n );\n const serverArgs = {\n ...args,\n ...(pluginComposition ? { pluginComposition } : {}),\n ...(resolvedDrives.length > 0\n ? {\n drive: undefined,\n remoteDrives: resolvedDrives\n .filter((d) => d.kind === \"remote\")\n .map((d) => d.remoteUrl!),\n }\n : {}),\n };\n\n const switchboard = await startSwitchboard(serverArgs as typeof args);\n const port = args.port;\n\n const localDrives = resolvedDrives.filter((d) => d.kind === \"local\");\n if (localDrives.length > 0 && switchboard) {\n await seedDrives(seederClient(switchboard.reactor, port), localDrives);\n }\n\n const slug =\n localDrives.length > 0\n ? localDrives[0].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 =\n localDrives.length > 0\n ? localDrives.map((d) => `http://localhost:${port}/d/${d.slug}`)\n : [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\n// The four verbs are orthogonal: each does ONE job.\n// - `run`/`serve`: START the server in production mode (serves the built\n// project package). `serve` is run's alias — a server IS its served stack,\n// and it lets the compound forward one `serve` verb to every member.\n// - `dev`: START the server in dev mode (watch / the Vite package loader).\n// - `build`: PRODUCE the project package this switchboard serves, and start\n// NOTHING. The analog of `ph connect build` on the server side: legacy\n// `ph switchboard build` never existed, but the project still has a build.\n// `build` is what lets a compound forward a single `build` verb to all members\n// (desktop/cli) without the switchboard member failing on an unknown verb.\n\nexport async function run(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<SwitchboardHandle> {\n return start(host, ctx, false);\n}\n\nexport const serve = run;\n\nexport async function dev(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<SwitchboardHandle> {\n return start(host, ctx, true);\n}\n\n/** Build the project's reactor package (the SAME service as `ph build`) — what\n * this switchboard serves. Starts no server; orthogonal to run/serve/dev. */\nexport async function build(\n host: HostDefinition,\n _ctx: RunnerContext,\n): Promise<void> {\n const { runBuild } = await import(\"../services/build.js\");\n const runner = host.runner;\n const args: Partial<BuildArgs> = {\n outDir: typeof runner.outDir === \"string\" ? runner.outDir : \"dist\",\n };\n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e,QAAQ,MAAM,EAAE,SAAS,OAAO;CACnE,IAAI,YAAY,SAAS,KAAK,aAC5B,MAAM,WAAW,aAAa,YAAY,SAAS,IAAI,GAAG,WAAW;CASvE,MAAM,WAAW,oBAAoB,KAAK,KALxC,YAAY,SAAS,IACjB,YAAY,EAAE,CAAC,OACf,OAAO,KAAK,OAAO,cAAc,WAC/B,KAAK,OAAO,YACZ;CAER,MAAM,YACJ,YAAY,SAAS,IACjB,YAAY,KAAK,MAAM,oBAAoB,KAAK,KAAK,EAAE,MAAM,IAC7D,CAAC,QAAQ;CAKf,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;AAaA,eAAsB,IACpB,MACA,KAC4B;CAC5B,OAAO,MAAM,MAAM,KAAK,KAAK;AAC/B;AAEA,MAAa,QAAQ;AAErB,eAAsB,IACpB,MACA,KAC4B;CAC5B,OAAO,MAAM,MAAM,KAAK,IAAI;AAC9B;;;AAIA,eAAsB,MACpB,MACA,MACe;CACf,MAAM,EAAE,aAAa,MAAM,OAAO;CAClC,MAAM,SAAS,KAAK;CAIpB,MAAM,SAAS,EAFb,QAAQ,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS,OAE5C,CAAc;AAClC","debug_id":"52e85d4a-8b51-5c40-9ded-a2bdeeda2782"}
@@ -1,11 +1,15 @@
1
1
  import { writeCliDocsMarkdownFile } from "@powerhousedao/codegen/file-builders";
2
2
  import { accessToken } from "../src/commands/access-token.js";
3
+ import { build as buildCmd } from "../src/commands/build.js";
3
4
  import { build, connect, preview, studio } from "../src/commands/connect.js";
4
5
  import { generateAllCmd } from "../src/commands/generate-all.js";
5
6
  import { generateAppCmd } from "../src/commands/generate-app.js";
6
7
  import { generateDocumentModelCmd } from "../src/commands/generate-document-model.js";
7
8
  import { generateEditorCmd } from "../src/commands/generate-editor.js";
8
9
  import { generateMigrationFileCmd } from "../src/commands/generate-migration-file.js";
10
+ import { generatePieceActionCmd } from "../src/commands/generate-piece-action.js";
11
+ import { generatePieceTriggerCmd } from "../src/commands/generate-piece-trigger.js";
12
+ import { generatePieceCmd } from "../src/commands/generate-piece.js";
9
13
  import { generateProcessorCmd } from "../src/commands/generate-processor.js";
10
14
  import { generateSubgraphCmd } from "../src/commands/generate-subgraph.js";
11
15
  import { generate } from "../src/commands/generate.js";
@@ -27,8 +31,12 @@ const commands = [
27
31
  { name: "app", command: generateAppCmd },
28
32
  { name: "processor", command: generateProcessorCmd },
29
33
  { name: "subgraph", command: generateSubgraphCmd },
34
+ { name: "piece", command: generatePieceCmd },
35
+ { name: "piece-action", command: generatePieceActionCmd },
36
+ { name: "piece-trigger", command: generatePieceTriggerCmd },
30
37
  { name: "migration-file", command: generateMigrationFileCmd },
31
38
  { name: "vetra", command: vetra },
39
+ { name: "build", command: buildCmd },
32
40
  { name: "connect", command: connect },
33
41
  { name: "connect studio", command: studio },
34
42
  { name: "connect build", command: build },
File without changes
File without changes
@@ -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]="0e3475df-d57b-5f60-a7a1-34f013270484")}catch(e){}}();
3
+ import { h as validateHost, i as loadHost, p as resolveRunnerModule, r as getVerb } from "./host-schemas-CL_wFpY7-DOvIjrBA.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-DsZRHbM1.mjs.map
36
+ //# debugId=0e3475df-d57b-5f60-a7a1-34f013270484
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-run-DsZRHbM1.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":"0e3475df-d57b-5f60-a7a1-34f013270484"}