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

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 (59) hide show
  1. package/dist/{build-skPHsKkL.mjs → build-BM-zayLm.mjs} +7 -3
  2. package/dist/build-BM-zayLm.mjs.map +1 -0
  3. package/dist/build-BZGpUn8f.mjs +4 -0
  4. package/dist/{cli-connect-override-65mFEDEB.mjs → cli-connect-override-DP5vRA7N.mjs} +4 -4
  5. package/dist/{cli-connect-override-65mFEDEB.mjs.map → cli-connect-override-DP5vRA7N.mjs.map} +1 -1
  6. package/dist/cli.mjs +4 -4
  7. package/dist/{connect-build-D9zrBKG4.mjs → connect-build-xRrXk9-p.mjs} +31 -10
  8. package/dist/connect-build-xRrXk9-p.mjs.map +1 -0
  9. package/dist/{connect-config-C1tf7DqD.mjs → connect-config-BvS0chVq.mjs} +4 -4
  10. package/dist/{connect-config-C1tf7DqD.mjs.map → connect-config-BvS0chVq.mjs.map} +1 -1
  11. package/dist/{connect-preview-Clue7SVp.mjs → connect-preview-BW6XnRtj.mjs} +42 -11
  12. package/dist/connect-preview-BW6XnRtj.mjs.map +1 -0
  13. package/dist/{connect-studio-Q93rzqnC.mjs → connect-studio-8EyDblpG.mjs} +4 -4
  14. package/dist/{connect-studio-Q93rzqnC.mjs.map → connect-studio-8EyDblpG.mjs.map} +1 -1
  15. package/dist/{connect-studio-BbsQuED_.mjs → connect-studio-NxCVdXDv.mjs} +3 -3
  16. package/dist/{dist-D-CZUgtS.mjs → dist-BqeDFgEy.mjs} +5 -4
  17. package/dist/{dist-D-CZUgtS.mjs.map → dist-BqeDFgEy.mjs.map} +1 -1
  18. package/dist/{explain-BHB_4rJ3.mjs → explain-D6gLYBd0.mjs} +4 -4
  19. package/dist/{explain-BHB_4rJ3.mjs.map → explain-D6gLYBd0.mjs.map} +1 -1
  20. package/dist/generate-desktop-shell-itIzf77U.mjs +212 -0
  21. package/dist/generate-desktop-shell-itIzf77U.mjs.map +1 -0
  22. package/dist/{host-schemas-CL_wFpY7-DOvIjrBA.mjs → host-schemas-CL_wFpY7-B_pY14Jy.mjs} +5 -4
  23. package/dist/{host-schemas-CL_wFpY7-DOvIjrBA.mjs.map → host-schemas-CL_wFpY7-B_pY14Jy.mjs.map} +1 -1
  24. package/dist/{index-CApW1xbO.d.mts → index-CspiP73o.d.mts} +840 -297
  25. package/dist/index-CspiP73o.d.mts.map +1 -0
  26. package/dist/{ph-cli-commands-DGOKk392.mjs → ph-cli-commands-CLJP7yKV.mjs} +44 -12
  27. package/dist/ph-cli-commands-CLJP7yKV.mjs.map +1 -0
  28. package/dist/ph-cli-commands-NHDoX5i7.mjs +4 -0
  29. package/dist/plugins-CHVv4qup.mjs +91 -0
  30. package/dist/plugins-CHVv4qup.mjs.map +1 -0
  31. package/dist/{reactor-env-DHBr4V4W.mjs → reactor-env-BbR86_Li.mjs} +4 -4
  32. package/dist/{reactor-env-DHBr4V4W.mjs.map → reactor-env-BbR86_Li.mjs.map} +1 -1
  33. package/dist/reactor-env-D_EvBtLB.mjs +4 -0
  34. package/dist/{run-sugar-Dq3ZrLL_.mjs → run-sugar-DveBlJqh.mjs} +4 -4
  35. package/dist/{run-sugar-Dq3ZrLL_.mjs.map → run-sugar-DveBlJqh.mjs.map} +1 -1
  36. package/dist/runners/compound.d.mts +1 -1
  37. package/dist/runners/compound.mjs +4 -4
  38. package/dist/runners/connect.d.mts +1 -1
  39. package/dist/runners/connect.mjs +9 -8
  40. package/dist/runners/connect.mjs.map +1 -1
  41. package/dist/runners/switchboard.d.mts +1 -1
  42. package/dist/runners/switchboard.mjs +9 -8
  43. package/dist/runners/switchboard.mjs.map +1 -1
  44. package/dist/{plugins-DtJUVtyg.mjs → schemas-BQSPev1x.mjs} +2546 -1055
  45. package/dist/schemas-BQSPev1x.mjs.map +1 -0
  46. package/dist/{start-run-DsZRHbM1.mjs → start-run-CASbiOWI.mjs} +4 -4
  47. package/dist/{start-run-DsZRHbM1.mjs.map → start-run-CASbiOWI.mjs.map} +1 -1
  48. package/dist/{vetra-BNJZ5LHN.mjs → vetra-BV5F0YeG.mjs} +6 -6
  49. package/dist/{vetra-BNJZ5LHN.mjs.map → vetra-BV5F0YeG.mjs.map} +1 -1
  50. package/package.json +14 -13
  51. package/dist/build-DmqwT-PR.mjs +0 -4
  52. package/dist/build-skPHsKkL.mjs.map +0 -1
  53. package/dist/connect-build-D9zrBKG4.mjs.map +0 -1
  54. package/dist/connect-preview-Clue7SVp.mjs.map +0 -1
  55. package/dist/index-CApW1xbO.d.mts.map +0 -1
  56. package/dist/ph-cli-commands-BxKtXZgb.mjs +0 -4
  57. package/dist/ph-cli-commands-DGOKk392.mjs.map +0 -1
  58. package/dist/plugins-DtJUVtyg.mjs.map +0 -1
  59. package/dist/reactor-env-CchCHhA0.mjs +0 -4
@@ -0,0 +1,91 @@
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]="ec3590f7-8584-54b0-816f-264913d6e29f")}catch(e){}}();
3
+ import { c as strictObject, d as unknown, i as literal, l as string, n as array, r as boolean, s as record, u as union } from "./schemas-BQSPev1x.mjs";
4
+ //#region ../../packages/host-core/dist/plugins.mjs
5
+ /**
6
+ * R1 — the host plugin framework (bridge-runners-to-plugins plan,
7
+ * customization-references/host-core as the blueprint).
8
+ *
9
+ * A plugin is hooks + contributions; hooks are boot wiring (main realm only),
10
+ * contributions are declarative, serializable surface. Host RUNTIMES define
11
+ * the hook vocabulary and interleave their own wiring between stages — they
12
+ * are never plugins themselves.
13
+ *
14
+ * host.js carries the COMPOSITION as `runner.plugins` entries:
15
+ * string | { module, enabled?, verbs?, config? }
16
+ * Presence is activation (enabled defaults true); `verbs` scopes an entry to
17
+ * matching run verbs; `config` is validated against the plugin's declared
18
+ * zod schema. Entries resolve from the PROJECT's dependency tree exactly
19
+ * like runner modules.
20
+ */
21
+ var PluginError = class extends Error {
22
+ constructor(message, hint) {
23
+ super(hint ? `${message}\n Hint: ${hint}` : message);
24
+ this.name = "PluginError";
25
+ }
26
+ };
27
+ const pluginEntryObjectSchema = strictObject({
28
+ module: string().min(1),
29
+ /** Presence is activation BY DEFAULT; false is the explicit off-switch. */
30
+ enabled: boolean().optional(),
31
+ /** "*" (default) or the run verbs this entry is active for. */
32
+ verbs: union([literal("*"), array(string().min(1)).min(1)]).optional(),
33
+ /** Validated against the plugin's declared configSchema at resolution. */
34
+ config: record(string(), unknown()).optional()
35
+ });
36
+ const pluginEntrySchema = union([string().min(1), pluginEntryObjectSchema]);
37
+ function normalizePluginEntry(entry) {
38
+ if (typeof entry === "string") return {
39
+ module: entry,
40
+ enabled: true,
41
+ verbs: "*",
42
+ config: {}
43
+ };
44
+ return {
45
+ module: entry.module,
46
+ enabled: entry.enabled ?? true,
47
+ verbs: entry.verbs ?? "*",
48
+ config: entry.config ?? {}
49
+ };
50
+ }
51
+ /** Module is the identity key: a duplicate makes override targeting and
52
+ * ordering ambiguous, so it fails loudly. */
53
+ function normalizePluginEntries(entries, where) {
54
+ const normalized = entries.map(normalizePluginEntry);
55
+ const seen = /* @__PURE__ */ new Set();
56
+ for (const entry of normalized) {
57
+ if (seen.has(entry.module)) throw new PluginError(`${where}: plugin "${entry.module}" is listed twice.`, "Module specifiers are the identity key of a composition; a plugin meant to run twice needs distinct subpath specifiers.");
58
+ seen.add(entry.module);
59
+ }
60
+ return normalized;
61
+ }
62
+ function entryActiveForVerb(entry, verb) {
63
+ if (!entry.enabled) return false;
64
+ return entry.verbs === "*" || entry.verbs.includes(verb);
65
+ }
66
+ /**
67
+ * The appliesTo hierarchy. "reactor" is the base every reactor host extends;
68
+ * "compound" is its own branch (plugins over the member set — e.g. the clint
69
+ * proxy). Host runtimes register their id with a parent; compatibility walks
70
+ * the parent chain.
71
+ */
72
+ const HOST_TYPE_PARENTS = {
73
+ reactor: null,
74
+ compound: null,
75
+ connect: "reactor",
76
+ switchboard: "reactor",
77
+ mastra: "reactor"
78
+ };
79
+ function hostTypeSatisfies(hostType, appliesTo) {
80
+ let current = hostType;
81
+ while (current !== null) {
82
+ if (current === appliesTo) return true;
83
+ current = current in HOST_TYPE_PARENTS ? HOST_TYPE_PARENTS[current] : null;
84
+ }
85
+ return false;
86
+ }
87
+ //#endregion
88
+ export { pluginEntrySchema as a, normalizePluginEntries as i, entryActiveForVerb as n, hostTypeSatisfies as r, PluginError as t };
89
+
90
+ //# sourceMappingURL=plugins-CHVv4qup.mjs.map
91
+ //# debugId=ec3590f7-8584-54b0-816f-264913d6e29f
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins-CHVv4qup.mjs","sources":["../../../packages/host-core/dist/plugins.mjs"],"sourcesContent":["import { z } from \"zod\";\n//#region src/plugins.ts\n/**\n* R1 — the host plugin framework (bridge-runners-to-plugins plan,\n* customization-references/host-core as the blueprint).\n*\n* A plugin is hooks + contributions; hooks are boot wiring (main realm only),\n* contributions are declarative, serializable surface. Host RUNTIMES define\n* the hook vocabulary and interleave their own wiring between stages — they\n* are never plugins themselves.\n*\n* host.js carries the COMPOSITION as `runner.plugins` entries:\n* string | { module, enabled?, verbs?, config? }\n* Presence is activation (enabled defaults true); `verbs` scopes an entry to\n* matching run verbs; `config` is validated against the plugin's declared\n* zod schema. Entries resolve from the PROJECT's dependency tree exactly\n* like runner modules.\n*/\nvar PluginError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"PluginError\";\n\t}\n};\nconst pluginEntryObjectSchema = z.strictObject({\n\tmodule: z.string().min(1),\n\t/** Presence is activation BY DEFAULT; false is the explicit off-switch. */\n\tenabled: z.boolean().optional(),\n\t/** \"*\" (default) or the run verbs this entry is active for. */\n\tverbs: z.union([z.literal(\"*\"), z.array(z.string().min(1)).min(1)]).optional(),\n\t/** Validated against the plugin's declared configSchema at resolution. */\n\tconfig: z.record(z.string(), z.unknown()).optional()\n});\nconst pluginEntrySchema = z.union([z.string().min(1), pluginEntryObjectSchema]);\nfunction normalizePluginEntry(entry) {\n\tif (typeof entry === \"string\") return {\n\t\tmodule: entry,\n\t\tenabled: true,\n\t\tverbs: \"*\",\n\t\tconfig: {}\n\t};\n\treturn {\n\t\tmodule: entry.module,\n\t\tenabled: entry.enabled ?? true,\n\t\tverbs: entry.verbs ?? \"*\",\n\t\tconfig: entry.config ?? {}\n\t};\n}\n/** Module is the identity key: a duplicate makes override targeting and\n* ordering ambiguous, so it fails loudly. */\nfunction normalizePluginEntries(entries, where) {\n\tconst normalized = entries.map(normalizePluginEntry);\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const entry of normalized) {\n\t\tif (seen.has(entry.module)) throw new PluginError(`${where}: plugin \"${entry.module}\" is listed twice.`, \"Module specifiers are the identity key of a composition; a plugin meant to run twice needs distinct subpath specifiers.\");\n\t\tseen.add(entry.module);\n\t}\n\treturn normalized;\n}\nfunction entryActiveForVerb(entry, verb) {\n\tif (!entry.enabled) return false;\n\treturn entry.verbs === \"*\" || entry.verbs.includes(verb);\n}\n/**\n* The appliesTo hierarchy. \"reactor\" is the base every reactor host extends;\n* \"compound\" is its own branch (plugins over the member set — e.g. the clint\n* proxy). Host runtimes register their id with a parent; compatibility walks\n* the parent chain.\n*/\nconst HOST_TYPE_PARENTS = {\n\treactor: null,\n\tcompound: null,\n\tconnect: \"reactor\",\n\tswitchboard: \"reactor\",\n\tmastra: \"reactor\"\n};\nfunction registerHostType(id, parent) {\n\tif (id in HOST_TYPE_PARENTS && HOST_TYPE_PARENTS[id] !== parent) throw new PluginError(`Host type \"${id}\" is already registered with parent \"${String(HOST_TYPE_PARENTS[id])}\".`);\n\tHOST_TYPE_PARENTS[id] = parent;\n}\nfunction hostTypeSatisfies(hostType, appliesTo) {\n\tlet current = hostType;\n\twhile (current !== null) {\n\t\tif (current === appliesTo) return true;\n\t\tcurrent = current in HOST_TYPE_PARENTS ? HOST_TYPE_PARENTS[current] : null;\n\t}\n\treturn false;\n}\n/** Registration order, bucketed pre → normal → post (stable within buckets),\n* then dependsOn topo-sorted within the bucketed order. */\nfunction resolveOrder(plugins) {\n\tconst buckets = {\n\t\tpre: [],\n\t\tnormal: [],\n\t\tpost: []\n\t};\n\tfor (const plugin of plugins) buckets[plugin.enforce ?? \"normal\"].push(plugin);\n\tconst bucketed = [\n\t\t...buckets.pre,\n\t\t...buckets.normal,\n\t\t...buckets.post\n\t];\n\tconst byName = new Map(bucketed.map((p) => [p.name, p]));\n\tfor (const plugin of bucketed) for (const dep of plugin.dependsOn ?? []) if (!byName.has(dep)) throw new PluginError(`Plugin \"${plugin.name}\" depends on missing plugin \"${dep}\".`, \"dependsOn names PLUGINS only — the host runtime is implied and never named.\");\n\tconst ordered = [];\n\tconst state = /* @__PURE__ */ new Map();\n\tconst visit = (plugin, chain) => {\n\t\tconst mark = state.get(plugin.name);\n\t\tif (mark === \"done\") return;\n\t\tif (mark === \"visiting\") throw new PluginError(`Plugin dependency cycle: ${[...chain, plugin.name].join(\" -> \")}.`);\n\t\tstate.set(plugin.name, \"visiting\");\n\t\tfor (const dep of plugin.dependsOn ?? []) visit(byName.get(dep), [...chain, plugin.name]);\n\t\tstate.set(plugin.name, \"done\");\n\t\tordered.push(plugin);\n\t};\n\tfor (const plugin of bucketed) visit(plugin, []);\n\treturn ordered;\n}\nasync function runProvideHook(name, plugins, ctx) {\n\tconst impls = plugins.filter((p) => typeof p.hooks?.[name] === \"function\");\n\tif (impls.length > 1) throw new PluginError(`Hook \"${name}\" is provided by ${impls.map((p) => `\"${p.name}\"`).join(\" and \")} — provide hooks have one winner.`);\n\tconst impl = impls[0]?.hooks?.[name];\n\treturn impl ? await impl(ctx) : void 0;\n}\nasync function runTransformHook(name, plugins, ctx, seed) {\n\tlet value = seed;\n\tfor (const plugin of plugins) {\n\t\tconst impl = plugin.hooks?.[name];\n\t\tif (typeof impl === \"function\") value = await impl(value, ctx);\n\t}\n\treturn value;\n}\n/** Sequential observe, in plugin order — for lifecycle moments whose order\n* is load-bearing (teardown: the switchboard stops privacy before workflows\n* before the api, per the carve map). */\nasync function runObserveHookSequential(name, plugins, ctx) {\n\tfor (const plugin of plugins) {\n\t\tconst impl = plugin.hooks?.[name];\n\t\tif (typeof impl === \"function\") await impl(ctx);\n\t}\n}\nasync function runObserveHook(name, plugins, ctx) {\n\tawait Promise.all(plugins.map(async (plugin) => {\n\t\tconst impl = plugin.hooks?.[name];\n\t\tif (typeof impl === \"function\") await impl(ctx);\n\t}));\n}\n/** Array kinds concatenate in provenance-then-order sequence (built-in first,\n* so later sources read as overrides where consumers want last-wins). */\nfunction mergeContributions(resolved) {\n\tconst rank = {\n\t\t\"built-in\": 0,\n\t\tlocal: 1,\n\t\tdependency: 2\n\t};\n\tconst sorted = [...resolved].sort((a, b) => rank[a.provenance] - rank[b.provenance]);\n\tconst merged = {};\n\tfor (const { plugin, provenance } of sorted) for (const [kind, values] of Object.entries(plugin.contributions ?? {})) {\n\t\tif (!values) continue;\n\t\tconst bucket = merged[kind] ??= [];\n\t\tfor (const value of values) bucket.push({\n\t\t\tvalue,\n\t\t\tsource: {\n\t\t\t\tpluginName: plugin.name,\n\t\t\t\tprovenance\n\t\t\t}\n\t\t});\n\t}\n\treturn merged;\n}\n//#endregion\nexport { PluginError, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntryObjectSchema, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook };\n\n//# sourceMappingURL=plugins.mjs.map"],"names":["z.strictObject","z.string","z.boolean","z.union","z.literal","z.array","z.record","z.unknown"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,IAAI,cAAc,cAAc,MAAM;CACrC,YAAY,SAAS,MAAM;EAC1B,MAAM,OAAO,GAAG,QAAQ,YAAY,SAAS,OAAO;E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W;CAC/C,IAAI,UAAU;CACd,OAAO,YAAY,MAAM;EACxB,IAAI,YAAY,WAAW,OAAO;EAClC,UAAU,WAAW,oBAAoB,kBAAkB,WAAW;CACvE;CACA,OAAO;AACR","debug_id":"ec3590f7-8584-54b0-816f-264913d6e29f"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ea21d78-2054-5ebb-8412-c8846f3a8b2c")}catch(e){}}();
3
- import { a as projectReactorToSwitchboard, r as primaryBackend, t as assertProtocolConsistency } from "./dist-D-CZUgtS.mjs";
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]="90838cee-88f3-58a3-9266-9c600f90bfaf")}catch(e){}}();
3
+ import { a as projectReactorToSwitchboard, r as primaryBackend, t as assertProtocolConsistency } from "./dist-BqeDFgEy.mjs";
4
4
  import fs from "node:fs";
5
5
  //#region src/runners/reactor-env.ts
6
6
  /**
@@ -25,5 +25,5 @@ function applyReactorEnvProjection(reactor, hostFileLabel) {
25
25
  //#endregion
26
26
  export { applyReactorEnvProjection as t };
27
27
 
28
- //# sourceMappingURL=reactor-env-DHBr4V4W.mjs.map
29
- //# debugId=9ea21d78-2054-5ebb-8412-c8846f3a8b2c
28
+ //# sourceMappingURL=reactor-env-BbR86_Li.mjs.map
29
+ //# debugId=90838cee-88f3-58a3-9266-9c600f90bfaf
@@ -1 +1 @@
1
- {"version":3,"file":"reactor-env-DHBr4V4W.mjs","sources":["../src/runners/reactor-env.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport {\n assertProtocolConsistency,\n primaryBackend,\n projectReactorToSwitchboard,\n type ReactorConfig,\n} from \"@powerhousedao/host-core\";\n\n/**\n * Apply a host's reactor block to the CURRENT process env, the way the\n * in-process switchboard server reads it at boot (D2.c: env derivation\n * immediately before the member starts; sequential boots make this safe).\n * Single-sourcing teeth first: a pre-set env contradicting the protocol block\n * fails loudly. Then set-if-absent, so an operator's explicit (agreeing) env\n * still wins during the transition. Returns the non-env options (dbPath).\n *\n * Lives OUTSIDE the runner modules on purpose: every export of a runner\n * module reads as a dispatchable verb, and this is not one.\n */\nexport function applyReactorEnvProjection(\n reactor: ReactorConfig | undefined,\n hostFileLabel: string,\n): { dbPath?: string } {\n const { env, options } = projectReactorToSwitchboard(reactor);\n assertProtocolConsistency(reactor?.protocol, process.env, hostFileLabel);\n for (const [name, value] of Object.entries(env)) {\n if (process.env[name] === undefined) process.env[name] = value;\n }\n // A path-storage data dir must exist before the server boots — its own\n // mkdir is not recursive (the ph-win sidecar did this too).\n const storage = primaryBackend(reactor)?.storage;\n if (storage?.kind === \"path\" && storage.dataDir) {\n fs.mkdirSync(storage.dataDir, { recursive: true });\n }\n return options;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAgB,0BACd,SACA,eACqB;CACrB,MAAM,EAAE,KAAK,YAAY,4BAA4B,OAAO;CAC5D,0BAA0B,SAAS,UAAU,QAAQ,KAAK,aAAa;CACvE,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,GAAG,GAC5C,IAAI,QAAQ,IAAI,UAAU,KAAA,GAAW,QAAQ,IAAI,QAAQ;CAI3D,MAAM,UAAU,eAAe,OAAO,CAAC,EAAE;CACzC,IAAI,SAAS,SAAS,UAAU,QAAQ,SACtC,GAAG,UAAU,QAAQ,SAAS,EAAE,WAAW,KAAK,CAAC;CAEnD,OAAO;AACT","debug_id":"9ea21d78-2054-5ebb-8412-c8846f3a8b2c"}
1
+ {"version":3,"file":"reactor-env-BbR86_Li.mjs","sources":["../src/runners/reactor-env.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport {\n assertProtocolConsistency,\n primaryBackend,\n projectReactorToSwitchboard,\n type ReactorConfig,\n} from \"@powerhousedao/host-core\";\n\n/**\n * Apply a host's reactor block to the CURRENT process env, the way the\n * in-process switchboard server reads it at boot (D2.c: env derivation\n * immediately before the member starts; sequential boots make this safe).\n * Single-sourcing teeth first: a pre-set env contradicting the protocol block\n * fails loudly. Then set-if-absent, so an operator's explicit (agreeing) env\n * still wins during the transition. Returns the non-env options (dbPath).\n *\n * Lives OUTSIDE the runner modules on purpose: every export of a runner\n * module reads as a dispatchable verb, and this is not one.\n */\nexport function applyReactorEnvProjection(\n reactor: ReactorConfig | undefined,\n hostFileLabel: string,\n): { dbPath?: string } {\n const { env, options } = projectReactorToSwitchboard(reactor);\n assertProtocolConsistency(reactor?.protocol, process.env, hostFileLabel);\n for (const [name, value] of Object.entries(env)) {\n if (process.env[name] === undefined) process.env[name] = value;\n }\n // A path-storage data dir must exist before the server boots — its own\n // mkdir is not recursive (the ph-win sidecar did this too).\n const storage = primaryBackend(reactor)?.storage;\n if (storage?.kind === \"path\" && storage.dataDir) {\n fs.mkdirSync(storage.dataDir, { recursive: true });\n }\n return options;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAgB,0BACd,SACA,eACqB;CACrB,MAAM,EAAE,KAAK,YAAY,4BAA4B,OAAO;CAC5D,0BAA0B,SAAS,UAAU,QAAQ,KAAK,aAAa;CACvE,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,GAAG,GAC5C,IAAI,QAAQ,IAAI,UAAU,KAAA,GAAW,QAAQ,IAAI,QAAQ;CAI3D,MAAM,UAAU,eAAe,OAAO,CAAC,EAAE;CACzC,IAAI,SAAS,SAAS,UAAU,QAAQ,SACtC,GAAG,UAAU,QAAQ,SAAS,EAAE,WAAW,KAAK,CAAC;CAEnD,OAAO;AACT","debug_id":"90838cee-88f3-58a3-9266-9c600f90bfaf"}
@@ -0,0 +1,4 @@
1
+ import { t as applyReactorEnvProjection } from "./reactor-env-BbR86_Li.mjs";
2
+ export { applyReactorEnvProjection };
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7a38c642-6903-5338-8c2e-e7d956d10306")}catch(e){}}();
4
+ //# debugId=7a38c642-6903-5338-8c2e-e7d956d10306
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d3abb843-86e4-5e80-bbdc-d25a99e0d7d3")}catch(e){}}();
3
- import { s as probeHostsFolder } from "./host-schemas-CL_wFpY7-DOvIjrBA.mjs";
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]="39b8ffa0-efd8-5cc5-acb9-42b46ae64498")}catch(e){}}();
3
+ import { s as probeHostsFolder } from "./host-schemas-CL_wFpY7-B_pY14Jy.mjs";
4
4
  //#region src/utils/run-sugar.ts
5
5
  /**
6
6
  * `ph <host-name> [verb]` sugar: when the first arg is not a registered
@@ -35,5 +35,5 @@ function applyRunSugar(args, knownCommands, projectRoot) {
35
35
  //#endregion
36
36
  export { applyRunSugar };
37
37
 
38
- //# sourceMappingURL=run-sugar-Dq3ZrLL_.mjs.map
39
- //# debugId=d3abb843-86e4-5e80-bbdc-d25a99e0d7d3
38
+ //# sourceMappingURL=run-sugar-DveBlJqh.mjs.map
39
+ //# debugId=39b8ffa0-efd8-5cc5-acb9-42b46ae64498
@@ -1 +1 @@
1
- {"version":3,"file":"run-sugar-Dq3ZrLL_.mjs","sources":["../src/utils/run-sugar.ts"],"sourcesContent":["import { probeHostsFolder } from \"@powerhousedao/host-core\";\n\nexport interface RunSugarResult {\n args: string[];\n /** Set when hosts/ exists but is empty — the guard state: warn loudly, stay legacy. */\n warning?: string;\n}\n\n/**\n * `ph <host-name> [verb]` sugar: when the first arg is not a registered\n * command and names a host in the project's hosts/ folder, splice in `run`\n * (mirrors the connect→`connect studio` default-subcommand rewrite).\n * Built-in commands win collisions by construction — the known-command check\n * runs first. Callers only invoke this when the uniform-runners flag is on.\n */\n/** Classic commands that route through `ph run` in a hosts project — BARE\n * invocations only: extra flags are not representable on `ph run` yet, and\n * the classic path calls the same service, so flagged invocations stay\n * classic until the host-core compound takes over (phase 1). */\nconst CLASSIC_ALIASES = new Set([\"vetra\"]);\n\nexport function applyRunSugar(\n args: string[],\n knownCommands: ReadonlySet<string>,\n projectRoot: string,\n): RunSugarResult {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args };\n }\n if (knownCommands.has(first)) {\n if (CLASSIC_ALIASES.has(first) && args.length === 1) {\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", first] };\n }\n }\n return { args };\n }\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"empty\") {\n return {\n args,\n warning:\n `hosts/ exists at ${probe.dir} but contains no <name>/host.js — ` +\n \"uniform-runners stays inactive (legacy command handling).\",\n };\n }\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", ...args] };\n }\n return { args };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,kCAAkB,IAAI,IAAI,CAAC,OAAO,CAAC;AAEzC,SAAgB,cACd,MACA,eACA,aACgB;CAChB,MAAM,QAAQ,KAAK;CACnB,IAAI,CAAC,SAAS,MAAM,WAAW,GAAG,GAChC,OAAO,EAAE,KAAK;CAEhB,IAAI,cAAc,IAAI,KAAK,GAAG;EAC5B,IAAI,gBAAgB,IAAI,KAAK,KAAK,KAAK,WAAW,GAAG;GACnD,MAAM,QAAQ,iBAAiB,WAAW;GAC1C,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,EAAE;EAElC;EACA,OAAO,EAAE,KAAK;CAChB;CACA,MAAM,QAAQ,iBAAiB,WAAW;CAC1C,IAAI,MAAM,SAAS,SACjB,OAAO;EACL;EACA,SACE,oBAAoB,MAAM,IAAI;CAElC;CAEF,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE;CAElC,OAAO,EAAE,KAAK;AAChB","debug_id":"d3abb843-86e4-5e80-bbdc-d25a99e0d7d3"}
1
+ {"version":3,"file":"run-sugar-DveBlJqh.mjs","sources":["../src/utils/run-sugar.ts"],"sourcesContent":["import { probeHostsFolder } from \"@powerhousedao/host-core\";\n\nexport interface RunSugarResult {\n args: string[];\n /** Set when hosts/ exists but is empty — the guard state: warn loudly, stay legacy. */\n warning?: string;\n}\n\n/**\n * `ph <host-name> [verb]` sugar: when the first arg is not a registered\n * command and names a host in the project's hosts/ folder, splice in `run`\n * (mirrors the connect→`connect studio` default-subcommand rewrite).\n * Built-in commands win collisions by construction — the known-command check\n * runs first. Callers only invoke this when the uniform-runners flag is on.\n */\n/** Classic commands that route through `ph run` in a hosts project — BARE\n * invocations only: extra flags are not representable on `ph run` yet, and\n * the classic path calls the same service, so flagged invocations stay\n * classic until the host-core compound takes over (phase 1). */\nconst CLASSIC_ALIASES = new Set([\"vetra\"]);\n\nexport function applyRunSugar(\n args: string[],\n knownCommands: ReadonlySet<string>,\n projectRoot: string,\n): RunSugarResult {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args };\n }\n if (knownCommands.has(first)) {\n if (CLASSIC_ALIASES.has(first) && args.length === 1) {\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", first] };\n }\n }\n return { args };\n }\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"empty\") {\n return {\n args,\n warning:\n `hosts/ exists at ${probe.dir} but contains no <name>/host.js — ` +\n \"uniform-runners stays inactive (legacy command handling).\",\n };\n }\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", ...args] };\n }\n return { args };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,kCAAkB,IAAI,IAAI,CAAC,OAAO,CAAC;AAEzC,SAAgB,cACd,MACA,eACA,aACgB;CAChB,MAAM,QAAQ,KAAK;CACnB,IAAI,CAAC,SAAS,MAAM,WAAW,GAAG,GAChC,OAAO,EAAE,KAAK;CAEhB,IAAI,cAAc,IAAI,KAAK,GAAG;EAC5B,IAAI,gBAAgB,IAAI,KAAK,KAAK,KAAK,WAAW,GAAG;GACnD,MAAM,QAAQ,iBAAiB,WAAW;GAC1C,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,EAAE;EAElC;EACA,OAAO,EAAE,KAAK;CAChB;CACA,MAAM,QAAQ,iBAAiB,WAAW;CAC1C,IAAI,MAAM,SAAS,SACjB,OAAO;EACL;EACA,SACE,oBAAoB,MAAM,IAAI;CAElC;CAEF,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE;CAElC,OAAO,EAAE,KAAK;AAChB","debug_id":"39b8ffa0-efd8-5cc5-acb9-42b46ae64498"}
@@ -1,4 +1,4 @@
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, 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";
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, 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-CspiP73o.mjs";
2
2
  //#region src/runners/compound.d.ts
3
3
  /**
4
4
  * BRIDGE compound runner (uniform-runners phase 0): args derivation, not
@@ -1,7 +1,7 @@
1
1
 
2
2
  !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="33908ac1-e0c2-5b7a-b255-a5d71dbe11d6")}catch(e){}}();
3
- import { m as string, u as looseObject } from "../plugins-DtJUVtyg.mjs";
4
- import { c as profileSchema, i as loadHost, t as childrenSchema } from "../host-schemas-CL_wFpY7-DOvIjrBA.mjs";
3
+ import { a as looseObject, l as string } from "../schemas-BQSPev1x.mjs";
4
+ import { c as profileSchema, i as loadHost, t as childrenSchema } from "../host-schemas-CL_wFpY7-B_pY14Jy.mjs";
5
5
  //#region src/runners/compound.ts
6
6
  /**
7
7
  * BRIDGE compound runner (uniform-runners phase 0): args derivation, not
@@ -56,13 +56,13 @@ async function run(host, ctx) {
56
56
  ...sbMember.host.reactor ?? {},
57
57
  ...sbWrapper?.reactor ?? {}
58
58
  };
59
- const { applyReactorEnvProjection } = await import("../reactor-env-CchCHhA0.mjs");
59
+ const { applyReactorEnvProjection } = await import("../reactor-env-D_EvBtLB.mjs");
60
60
  applyReactorEnvProjection(sbReactor, `hosts/${switchboardRef.host}/host.js`);
61
61
  const args = {
62
62
  connectPort,
63
63
  switchboardPort
64
64
  };
65
- const { startVetra } = await import("../vetra-BNJZ5LHN.mjs");
65
+ const { startVetra } = await import("../vetra-BV5F0YeG.mjs");
66
66
  await startVetra(args);
67
67
  }
68
68
  //#endregion
@@ -1,4 +1,4 @@
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";
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-CspiP73o.mjs";
2
2
  //#region src/runners/connect.d.ts
3
3
  /**
4
4
  * BRIDGE runner for Connect hosts (uniform-runners phase 0): maps a
@@ -1,8 +1,9 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="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";
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]="d719951d-9c03-52c7-ab89-60c9ed3ca97c")}catch(e){}}();
3
+ import { a as looseObject, l as string, n as array, o as number, r as boolean } from "../schemas-BQSPev1x.mjs";
4
+ import { a as pluginEntrySchema, i as normalizePluginEntries, n as entryActiveForVerb } from "../plugins-CHVv4qup.mjs";
5
+ import { a as mergeDefaultDrives, c as profileSchema, f as resolveDriveDeclaration, l as projectDrivesIntoConnect, u as reactorSchema } from "../host-schemas-CL_wFpY7-B_pY14Jy.mjs";
6
+ import { i as projectReactorToConnect, n as isStructuralMultiReactor, o as remoteBackendUrls } from "../dist-BqeDFgEy.mjs";
6
7
  import { DEFAULT_CONNECT_STUDIO_PORT } from "@powerhousedao/shared/clis";
7
8
  //#region src/runners/connect.ts
8
9
  /**
@@ -140,7 +141,7 @@ function callerOverride(host, ctx, verb = "dev") {
140
141
  };
141
142
  }
142
143
  async function dev(host, ctx) {
143
- const { runConnectStudio } = await import("../connect-studio-BbsQuED_.mjs");
144
+ const { runConnectStudio } = await import("../connect-studio-NxCVdXDv.mjs");
144
145
  await runConnectStudio(toStudioArgs(host), void 0, callerOverride(host, ctx, ctx.verb ?? "dev"));
145
146
  }
146
147
  /** `run` is dev-studio until the plugin phases give hosts a production
@@ -148,7 +149,7 @@ async function dev(host, ctx) {
148
149
  const run = dev;
149
150
  /** P3.3 — `build`: the SAME service as classic `ph connect build`. */
150
151
  async function build(host, _ctx) {
151
- const { runConnectBuild } = await import("../connect-build-D9zrBKG4.mjs");
152
+ const { runConnectBuild } = await import("../connect-build-xRrXk9-p.mjs");
152
153
  const runner = host.runner;
153
154
  await runConnectBuild({ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist" });
154
155
  }
@@ -161,7 +162,7 @@ async function build(host, _ctx) {
161
162
  * CSP's script-src for the runtime registry — together these replace the
162
163
  * ph-win-desktop sidecar's hand-rolled static server (desktop shape). */
163
164
  async function serve(host, ctx) {
164
- const { runConnectPreview } = await import("../connect-preview-Clue7SVp.mjs");
165
+ const { runConnectPreview } = await import("../connect-preview-BW6XnRtj.mjs");
165
166
  const runner = host.runner;
166
167
  await runConnectPreview({
167
168
  port: typeof runner.port === "number" ? runner.port : DEFAULT_CONNECT_STUDIO_PORT,
@@ -181,4 +182,4 @@ async function serve(host, ctx) {
181
182
  export { build, dev, hostSchema, kind, run, serve };
182
183
 
183
184
  //# sourceMappingURL=connect.mjs.map
184
- //# debugId=1f6361f6-3ddd-5ba7-8f53-515c32863b92
185
+ //# debugId=d719951d-9c03-52c7-ab89-60c9ed3ca97c
@@ -1 +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":";;;;;;;;;;;;;;AAuCA,MAAa,OAAO;;;;AAKpB,MAAa,aAAaA,YAAc;CACtC,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC;CACtB,QAAQD,YAAc;EACpB,QAAQC,OAAS;EACjB,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EAC3C,MAAMD,OAAS,CAAC,CAAC,SAAS;EAC1B,OAAOE,QAAU,CAAC,CAAC,SAAS;EAC5B,aAAaA,QAAU,CAAC,CAAC,SAAS;EAElC,SAASC,MAAQ,iBAAiB,CAAC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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":";;;;;;;;;;;;;;;AAuCA,MAAa,OAAO;;;;AAKpB,MAAa,aAAaA,YAAc;CACtC,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC;CACtB,QAAQD,YAAc;EACpB,QAAQC,OAAS;EACjB,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EAC3C,MAAMD,OAAS,CAAC,CAAC,SAAS;EAC1B,OAAOE,QAAU,CAAC,CAAC,SAAS;EAC5B,aAAaA,QAAU,CAAC,CAAC,SAAS;EAElC,SAASC,MAAQ,iBAAiB,CAAC,CAAC,SAAS;CAC/C,CAAC;CACD,QAAQJ,YAAc,CAAC,CAAC,CAAC,CAAC,SAAS;CACnC,SAAS;CACT,SAAS,cAAc,SAAS;AAClC,CAAC;;;;AAKD,SAAS,aAAa,MAAyC;CAC7D,MAAM,SAAS,KAAK;CAWpB,OAAO;EATL,MACE,OAAO,OAAO,SAAS,WACnB,OAAO,OACP;EACN,MAAM,OAAO,gBAAgB;EAC7B,YAAY,OAAO,eAAe;EAClC,WAAW;EACX,kB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G;EAAO,EAAE,IAAI,CAAC;CAC5D;AACF;AAEA,eAAsB,IACpB,MACA,KACe;CACf,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,iBACJ,aAAa,IAAI,GACjB,KAAA,GACA,eAAe,MAAM,KAAK,IAAI,QAAQ,KAAK,CAC7C;AACF;;;AAIA,MAAa,MAAM;;AAGnB,eAAsB,MACpB,MACA,MACe;CACf,MAAM,EAAE,oBAAoB,MAAM,OAAO;CACzC,MAAM,SAAS,KAAK;CAIpB,MAAM,gBAAgB,EAFpB,QAAQ,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS,OAErC,CAAqB;AAChD;;;;;;;;;AAUA,eAAsB,MACpB,MACA,KACe;CACf,MAAM,EAAE,sBAAsB,MAAM,OAAO;CAC3C,MAAM,SAAS,KAAK;CAkBpB,MAAM,kBAAkB;EAhBtB,MACE,OAAO,OAAO,SAAS,WACnB,OAAO,OACP;EACN,QAAQ,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;EAC5D,MAAM,OAAO,gBAAgB;EAC7B,YAAY,OAAO,eAAe;EAClC,MAAM;EACN,WAAW;EACX,kBAAkB;EAIlB,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;CAG7B,GAAyB;EAClD,SAFe,eAAe,MAAM,KAAK,IAAI,QAAQ,OAErC;EAChB,iBAAiB,OAAO,oBAAoB;CAC9C,CAAC;AACH","debug_id":"d719951d-9c03-52c7-ab89-60c9ed3ca97c"}
@@ -1,4 +1,4 @@
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";
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-CspiP73o.mjs";
2
2
  //#region src/runners/switchboard.d.ts
3
3
  /**
4
4
  * BRIDGE runner for Switchboard hosts (uniform-runners phase 0): maps a
@@ -1,9 +1,10 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="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";
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]="4c7bfb64-88a2-57bf-b4d9-3418e87fcd29")}catch(e){}}();
3
+ import { a as looseObject, l as string, n as array, o as number, r as boolean } from "../schemas-BQSPev1x.mjs";
4
+ import { a as pluginEntrySchema } from "../plugins-CHVv4qup.mjs";
5
+ import { c as profileSchema, f as resolveDriveDeclaration, m as seedDrives, u as reactorSchema } from "../host-schemas-CL_wFpY7-B_pY14Jy.mjs";
6
+ import { s as resolveHostPlugins } from "../dist-BqeDFgEy.mjs";
7
+ import { t as applyReactorEnvProjection } from "../reactor-env-BbR86_Li.mjs";
7
8
  import { DEFAULT_SWITCHBOARD_PORT, DEFAULT_VETRA_DRIVE_ID } from "@powerhousedao/shared/clis";
8
9
  //#region src/runners/switchboard.ts
9
10
  /**
@@ -108,7 +109,7 @@ async function start(host, ctx, devMode) {
108
109
  const driveUrl = `http://localhost:${port}/d/${localDrives.length > 0 ? localDrives[0].slug : typeof host.runner.driveSlug === "string" ? host.runner.driveSlug : DEFAULT_DRIVE_SLUG}`;
109
110
  const driveUrls = localDrives.length > 0 ? localDrives.map((d) => `http://localhost:${port}/d/${d.slug}`) : [driveUrl];
110
111
  if (switchboard?.workflowsEnabled) {
111
- const { seedWorkflowsDrive } = await import("../vetra-BNJZ5LHN.mjs");
112
+ const { seedWorkflowsDrive } = await import("../vetra-BV5F0YeG.mjs");
112
113
  driveUrls.push(await seedWorkflowsDrive(switchboard.reactor, port));
113
114
  }
114
115
  const ready = waitForDrive(driveUrl, 18e4);
@@ -130,7 +131,7 @@ async function dev(host, ctx) {
130
131
  /** Build the project's reactor package (the SAME service as `ph build`) — what
131
132
  * this switchboard serves. Starts no server; orthogonal to run/serve/dev. */
132
133
  async function build(host, _ctx) {
133
- const { runBuild } = await import("../build-DmqwT-PR.mjs");
134
+ const { runBuild } = await import("../build-BZGpUn8f.mjs");
134
135
  const runner = host.runner;
135
136
  await runBuild({ outDir: typeof runner.outDir === "string" ? runner.outDir : "dist" });
136
137
  }
@@ -138,4 +139,4 @@ async function build(host, _ctx) {
138
139
  export { build, dev, hostSchema, kind, run, serve };
139
140
 
140
141
  //# sourceMappingURL=switchboard.mjs.map
141
- //# debugId=52e85d4a-8b51-5c40-9ded-a2bdeeda2782
142
+ //# debugId=4c7bfb64-88a2-57bf-b4d9-3418e87fcd29
@@ -1 +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 await runBuild(args as BuildArgs);\n}\n"],"names":["z.looseObject","z.string","z.number","z.boolean","z.array"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAa,OAAO;;AAGpB,MAAa,aAAaA,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AM,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
+ {"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 await runBuild(args as BuildArgs);\n}\n"],"names":["z.looseObject","z.string","z.number","z.boolean","z.array"],"mappings":";;;;;;;;;;;;;;;;AAgCA,MAAa,OAAO;;AAGpB,MAAa,aAAaA,YAAc;CACtC,MAAMC,OAAS,CAAC,CAAC,IAAI,CAAC;CACtB,QAAQD,YAAc;EACpB,QAAQC,OAAS;EACjB,MAAMC,OAAS,C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