@powerhousedao/ph-cli 6.3.0-dev.1 → 6.3.0-dev.11

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 (86) hide show
  1. package/dist/build-BxoiFvnE.mjs +4 -0
  2. package/dist/{build-CWm9MOFJ.mjs → build-C9gXPccv.mjs} +10 -6
  3. package/dist/build-C9gXPccv.mjs.map +1 -0
  4. package/dist/{check-D0b-uWwK.mjs → check-B8oqVMg7.mjs} +4 -4
  5. package/dist/{check-D0b-uWwK.mjs.map → check-B8oqVMg7.mjs.map} +1 -1
  6. package/dist/{check-BZOXiSys.mjs → check-Bdvm8hz0.mjs} +3 -3
  7. package/dist/{check-C9kQub0h.mjs → check-CBZ44SDf.mjs} +4 -4
  8. package/dist/{check-C9kQub0h.mjs.map → check-CBZ44SDf.mjs.map} +1 -1
  9. package/dist/{classic-warnings-kQsFGSeA.mjs → classic-warnings-BR0S6lr5.mjs} +4 -4
  10. package/dist/{classic-warnings-kQsFGSeA.mjs.map → classic-warnings-BR0S6lr5.mjs.map} +1 -1
  11. package/dist/{cli-connect-override-31gBnNxd.mjs → cli-connect-override-D22yFWlC.mjs} +4 -4
  12. package/dist/{cli-connect-override-31gBnNxd.mjs.map → cli-connect-override-D22yFWlC.mjs.map} +1 -1
  13. package/dist/cli.mjs +5 -5
  14. package/dist/{compound-CDrU3CLt-gW8JNJQK.mjs → compound-DKi56SSx-CXQHhS6t.mjs} +5 -4
  15. package/dist/{compound-CDrU3CLt-gW8JNJQK.mjs.map → compound-DKi56SSx-CXQHhS6t.mjs.map} +1 -1
  16. package/dist/{connect-build-is3cmf0E.mjs → connect-build-BqRWG3tZ.mjs} +5 -5
  17. package/dist/{connect-build-is3cmf0E.mjs.map → connect-build-BqRWG3tZ.mjs.map} +1 -1
  18. package/dist/{connect-config-Dj3E8CaW.mjs → connect-config-CVU4xhti.mjs} +4 -4
  19. package/dist/{connect-config-Dj3E8CaW.mjs.map → connect-config-CVU4xhti.mjs.map} +1 -1
  20. package/dist/{connect-studio-CBtduPet.mjs → connect-studio-BnfhpIv8.mjs} +10 -7
  21. package/dist/connect-studio-BnfhpIv8.mjs.map +1 -0
  22. package/dist/{connect-studio-BNSe_8PI.mjs → connect-studio-D58ByAAn.mjs} +3 -3
  23. package/dist/definitions-worker.mjs +1 -1
  24. package/dist/{dist-seTzvoSw.mjs → dist-DXcB8fAF.mjs} +67 -5
  25. package/dist/dist-DXcB8fAF.mjs.map +1 -0
  26. package/dist/{explain-DTa32gEY.mjs → explain-8OEXF2Dy.mjs} +5 -5
  27. package/dist/{explain-DTa32gEY.mjs.map → explain-8OEXF2Dy.mjs.map} +1 -1
  28. package/dist/{export-YEBE-Gvl.mjs → export-DqbcbFU5.mjs} +4 -4
  29. package/dist/{export-YEBE-Gvl.mjs.map → export-DqbcbFU5.mjs.map} +1 -1
  30. package/dist/{generate-all-DKuaLgz1.mjs → generate-all-0YOnlZM0.mjs} +4 -4
  31. package/dist/{generate-all-DKuaLgz1.mjs.map → generate-all-0YOnlZM0.mjs.map} +1 -1
  32. package/dist/{generate-desktop-shell-Dh9_bhLa.mjs → generate-desktop-shell-BovoRsR6.mjs} +5 -5
  33. package/dist/generate-desktop-shell-BovoRsR6.mjs.map +1 -0
  34. package/dist/{generate-document-model-OQPfeHs-.mjs → generate-document-model-BiD6ovXc.mjs} +4 -4
  35. package/dist/generate-document-model-BiD6ovXc.mjs.map +1 -0
  36. package/dist/{get-version-CrerlHgg.mjs → get-version-DQ6JaxAS.mjs} +4 -4
  37. package/dist/{get-version-CrerlHgg.mjs.map → get-version-DQ6JaxAS.mjs.map} +1 -1
  38. package/dist/{index-Dy3U1WqW.d.mts → index-H3AYe65i.d.mts} +2 -1
  39. package/dist/index-H3AYe65i.d.mts.map +1 -0
  40. package/dist/{init-CJB6RiIy.mjs → init-Ltg4cJzm.mjs} +9 -7
  41. package/dist/init-Ltg4cJzm.mjs.map +1 -0
  42. package/dist/{mcp-DJKiREkL.mjs → mcp-DTGhGK20.mjs} +6 -6
  43. package/dist/{mcp-DJKiREkL.mjs.map → mcp-DTGhGK20.mjs.map} +1 -1
  44. package/dist/{migrate-Bg-HBsYa.mjs → migrate-B9Im3uim.mjs} +7 -6
  45. package/dist/migrate-B9Im3uim.mjs.map +1 -0
  46. package/dist/migrate-document-models-BsHvClbh.mjs +489 -0
  47. package/dist/migrate-document-models-BsHvClbh.mjs.map +1 -0
  48. package/dist/migrate-subgraphs-CGIPAnQB.mjs +710 -0
  49. package/dist/migrate-subgraphs-CGIPAnQB.mjs.map +1 -0
  50. package/dist/migrate-subgraphs-DrTVwm8g.mjs +4 -0
  51. package/dist/{ph-cli-commands-C6cJJQlA.mjs → ph-cli-commands-Bea3C3iI.mjs} +63 -29
  52. package/dist/ph-cli-commands-Bea3C3iI.mjs.map +1 -0
  53. package/dist/ph-cli-commands-iEIgXAIf.mjs +4 -0
  54. package/dist/{run-sugar-ByAIbE2x.mjs → run-sugar-DpznOP1e.mjs} +4 -4
  55. package/dist/{run-sugar-ByAIbE2x.mjs.map → run-sugar-DpznOP1e.mjs.map} +1 -1
  56. package/dist/runners/connect.d.mts +1 -1
  57. package/dist/runners/connect.mjs +2 -2
  58. package/dist/runners/switchboard.d.mts +1 -1
  59. package/dist/runners/switchboard.mjs +3 -3
  60. package/dist/{verify-CIWOkZZV.mjs → verify-BRofKAkt.mjs} +4 -4
  61. package/dist/{verify-CIWOkZZV.mjs.map → verify-BRofKAkt.mjs.map} +1 -1
  62. package/dist/{vetra-CmTg8Lja.mjs → vetra-CVNZ46pK.mjs} +9 -8
  63. package/dist/vetra-CVNZ46pK.mjs.map +1 -0
  64. package/dist/{vetra-host-C0Q0oMUW.mjs → vetra-host-ChTpJiBJ.mjs} +5 -5
  65. package/dist/{vetra-host-C0Q0oMUW.mjs.map → vetra-host-ChTpJiBJ.mjs.map} +1 -1
  66. package/dist/{vetra-instance-B0bXPj7g.mjs → vetra-instance-CzhYIjxL.mjs} +4 -4
  67. package/dist/{vetra-instance-B0bXPj7g.mjs.map → vetra-instance-CzhYIjxL.mjs.map} +1 -1
  68. package/dist/{vetra-launch-T_uLKaR3.mjs → vetra-launch-qi10Unax.mjs} +7 -6
  69. package/dist/vetra-launch-qi10Unax.mjs.map +1 -0
  70. package/package.json +17 -17
  71. package/dist/build-1BN9BD49.mjs +0 -4
  72. package/dist/build-CWm9MOFJ.mjs.map +0 -1
  73. package/dist/connect-studio-CBtduPet.mjs.map +0 -1
  74. package/dist/dist-seTzvoSw.mjs.map +0 -1
  75. package/dist/generate-desktop-shell-Dh9_bhLa.mjs.map +0 -1
  76. package/dist/generate-document-model-OQPfeHs-.mjs.map +0 -1
  77. package/dist/index-Dy3U1WqW.d.mts.map +0 -1
  78. package/dist/init-CJB6RiIy.mjs.map +0 -1
  79. package/dist/migrate-Bg-HBsYa.mjs.map +0 -1
  80. package/dist/migrate-subgraphs-Bm3zpsO9.mjs +0 -214
  81. package/dist/migrate-subgraphs-Bm3zpsO9.mjs.map +0 -1
  82. package/dist/migrate-subgraphs-De_rX4Hv.mjs +0 -4
  83. package/dist/ph-cli-commands-C6cJJQlA.mjs.map +0 -1
  84. package/dist/ph-cli-commands-CCCVUIzM.mjs +0 -4
  85. package/dist/vetra-CmTg8Lja.mjs.map +0 -1
  86. package/dist/vetra-launch-T_uLKaR3.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compound-CDrU3CLt-gW8JNJQK.mjs","sources":["../../../packages/host-core/dist/compound-CDrU3CLt.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { createHash } from \"node:crypto\";\nimport fs, { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\nimport { TOKEN_ESCAPE_KEY, TOKEN_KEYS, concatTokenSchema, envTokenSchema, envTokenable, findToken, forbidRef, isToken, itemTokenSchema, keyTokenSchema, mapTokenSchema, outputTokenSchema, ref, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable } from \"@powerhousedao/shared/host-tokens\";\nimport { isOriginPlaceholderUrl } from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport { execFileSync } from \"node:child_process\";\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\n//#region src/plugins-resolve.ts\n/**\n* NODE-ONLY plugin resolution (split from plugins.ts so the pure runner core\n* stays browser-safe for ConnectCore — R3). Resolves host.js entries from the\n* PROJECT dependency tree, exactly like runner modules.\n*/\nfunction isHostPluginShape(value) {\n\treturn value !== null && typeof value === \"object\" && typeof value.name === \"string\";\n}\n/**\n* Resolve host.js plugin entries into live plugins for one host boot:\n* verb-filter → module resolution from the project tree (default condition,\n* like runners) → factory/object contract → config validation → appliesTo.\n*/\nasync function resolveHostPlugins(projectRoot, hostType, verb, entries, where) {\n\tconst normalized = normalizePluginEntries(entries, where);\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst resolved = [];\n\tfor (const entry of normalized) {\n\t\tif (!entryActiveForVerb(entry, verb)) continue;\n\t\tlet file;\n\t\ttry {\n\t\t\tfile = projectRequire.resolve(entry.module);\n\t\t} catch {\n\t\t\tthrow new PluginError(`${where}: cannot resolve plugin \"${entry.module}\" from ${projectRoot}.`, \"Plugins resolve from the project dependency tree, exactly like runner modules.\");\n\t\t}\n\t\tconst exported = (await import(pathToFileURL(file).href)).default;\n\t\tlet plugin;\n\t\tif (typeof exported === \"function\") plugin = exported(entry.config);\n\t\telse if (isHostPluginShape(exported)) {\n\t\t\tif (Object.keys(entry.config).length > 0 && !exported.configSchema) throw new PluginError(`${where}: plugin \"${entry.module}\" takes no config, but the entry passes one.`);\n\t\t\tplugin = exported;\n\t\t} else throw new PluginError(`${where}: \"${entry.module}\" does not default-export a plugin object or factory.`, \"Export `{ name, hooks?, contributions? }` or `(config) => plugin`.\");\n\t\tif (plugin.configSchema) {\n\t\t\tconst parsed = plugin.configSchema.safeParse(entry.config);\n\t\t\tif (!parsed.success) throw new PluginError(`${where}: config for plugin \"${plugin.name}\" is invalid:\\n` + z.prettifyError(parsed.error));\n\t\t}\n\t\tconst appliesTo = plugin.appliesTo ?? \"reactor\";\n\t\tif (!hostTypeSatisfies(hostType, appliesTo)) throw new PluginError(`${where}: plugin \"${plugin.name}\" applies to \"${appliesTo}\" hosts, but this host is \"${hostType}\".`);\n\t\tresolved.push({\n\t\t\tentry,\n\t\t\tplugin,\n\t\t\tprovenance: \"dependency\"\n\t\t});\n\t}\n\treturn resolved;\n}\n/**\n* LENIENT resolution for diagnostics (`ph run <host> --explain drives`):\n* collects the drive contributions of the entries active for `verb`. Unlike\n* resolveHostPlugins it does not know the host type (so appliesTo is not\n* checked) and does not fail on a specifier the project tree cannot resolve\n* — the entry is listed under `unresolved` instead. Config is still validated\n* against the plugin's schema, so a bad entry surfaces here too.\n*/\nasync function resolvePluginContributions(projectRoot, verb, entries, where) {\n\tconst normalized = normalizePluginEntries(entries, where);\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst plan = {\n\t\tdrives: [],\n\t\tunresolved: []\n\t};\n\tfor (const entry of normalized) {\n\t\tif (!entryActiveForVerb(entry, verb)) continue;\n\t\tlet file;\n\t\ttry {\n\t\t\tfile = projectRequire.resolve(entry.module);\n\t\t} catch {\n\t\t\tplan.unresolved.push(entry.module);\n\t\t\tcontinue;\n\t\t}\n\t\tconst exported = (await import(pathToFileURL(file).href)).default;\n\t\tlet plugin;\n\t\tif (typeof exported === \"function\") plugin = exported(entry.config);\n\t\telse if (isHostPluginShape(exported)) plugin = exported;\n\t\telse {\n\t\t\tplan.unresolved.push(entry.module);\n\t\t\tcontinue;\n\t\t}\n\t\tif (plugin.configSchema) {\n\t\t\tconst parsed = plugin.configSchema.safeParse(entry.config);\n\t\t\tif (!parsed.success) throw new PluginError(`${where}: config for plugin \"${plugin.name}\" is invalid:\\n` + z.prettifyError(parsed.error));\n\t\t}\n\t\tfor (const declaration of plugin.contributions?.drives ?? []) plan.drives.push({\n\t\t\tdeclaration,\n\t\t\tsource: plugin.name\n\t\t});\n\t}\n\treturn plan;\n}\n/**\n* The connect config slices each built-in Connect plugin owns, by specifier\n* (typed-host-configs 1.6). Under a declared composition Connect zeroes a\n* slice whose plugin is absent — presence is activation — so an authored\n* value there is dead config. Connect's built-ins are browser modules with no\n* Node-resolvable identity, so their ownership is declared here as data; a\n* Connect test pins it to plugin-host's zeroing.\n*/\nconst CONNECT_PLUGIN_OWNED_SLICES = {\n\t\"@powerhousedao/connect/plugins/generic\": { slices: [\n\t\t{\n\t\t\tpath: \"drives.allowAddDrive\",\n\t\t\tabsent: false,\n\t\t\tentryKey: \"allowAddDrive\"\n\t\t},\n\t\t{\n\t\t\tpath: \"drives.sections\",\n\t\t\tabsent: {\n\t\t\t\tremote: {\n\t\t\t\t\tenabled: false,\n\t\t\t\t\tallowAdd: false,\n\t\t\t\t\tallowDelete: false\n\t\t\t\t},\n\t\t\t\tlocal: {\n\t\t\t\t\tenabled: false,\n\t\t\t\t\tallowAdd: false,\n\t\t\t\t\tallowDelete: false\n\t\t\t\t}\n\t\t\t},\n\t\t\tentryKey: \"sections\"\n\t\t},\n\t\t{\n\t\t\tpath: \"drives.icons\",\n\t\t\tabsent: null,\n\t\t\tentryKey: \"icons\"\n\t\t},\n\t\t{\n\t\t\tpath: \"home.background\",\n\t\t\tabsent: null,\n\t\t\tentryKey: \"homeBackground\"\n\t\t}\n\t] },\n\t\"@powerhousedao/connect/plugins/sentry\": { slices: [{\n\t\tpath: \"sentry.dsn\",\n\t\tabsent: null,\n\t\tentryKey: \"dsn\"\n\t}] },\n\t\"@powerhousedao/connect/plugins/openpanel\": {\n\t\tslices: [\n\t\t\t{\n\t\t\t\tpath: \"openPanel.clientId\",\n\t\t\t\tabsent: \"\",\n\t\t\t\tentryKey: \"clientId\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"openPanel.trackUiEvents\",\n\t\t\t\tabsent: false,\n\t\t\t\tentryKey: \"trackUiEvents\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"openPanel.trackOperations\",\n\t\t\t\tabsent: false,\n\t\t\t\tentryKey: \"trackOperations\"\n\t\t\t}\n\t\t],\n\t\tinertUnless: \"openPanel.clientId\"\n\t},\n\t\"@powerhousedao/connect/plugins/assistant\": { slices: [{\n\t\tpath: \"ai.assistantEnabled\",\n\t\tabsent: false\n\t}] },\n\t\"@powerhousedao/vetra-studio/connect\": { slices: [{\n\t\tpath: \"app.studioMode\",\n\t\tabsent: false\n\t}] },\n\t\"@powerhousedao/connect/plugins/workflows\": { slices: [{\n\t\tpath: \"app.workflowsEnabled\",\n\t\tabsent: false\n\t}] }\n};\nfunction valueAt$1(root, dotted) {\n\tlet current = root;\n\tfor (const key of dotted.split(\".\")) {\n\t\tif (current === null || typeof current !== \"object\") return void 0;\n\t\tcurrent = current[key];\n\t}\n\treturn current;\n}\n/** Whether Connect already serves what the author wrote: every authored leaf\n* equals the served one. An unset leaf asks for nothing, so a partial object\n* (`sections: { remote: { enabled: false } }`) is satisfied by the zeroed\n* slice. */\nfunction alreadyServed(authored, served) {\n\tif (authored === void 0 || Object.is(authored, served)) return true;\n\tif (authored === null || served === null || typeof authored !== \"object\" || typeof served !== \"object\" || Array.isArray(authored) !== Array.isArray(served)) return false;\n\tif (Array.isArray(authored) && authored.length !== served.length) return false;\n\tconst want = authored;\n\tconst have = served;\n\treturn Object.keys(want).every((key) => alreadyServed(want[key], have[key]));\n}\n/**\n* The composition that serves `config` as Connect serves it with none, for a\n* host that declares no `runner.plugins`. `config` is the connect block\n* Connect would be served without a composition.\n*\n* A built-in configured through its entry is always in it, its entry holding\n* the values `config` has at the slices it owns: composed in, the plugin\n* serves those values again (an unset one falls back to the same default).\n* A built-in whose presence is its switch is in it only where `config`\n* already has that switch on, since composing it in would turn it on.\n*/\nfunction defaultConnectComposition(config) {\n\tconst composition = [];\n\tfor (const [module, { slices }] of Object.entries(CONNECT_PLUGIN_OWNED_SLICES)) {\n\t\tconst entry = {};\n\t\tlet configured = false;\n\t\tlet switchedOn = false;\n\t\tfor (const { path: slicePath, absent, entryKey } of slices) {\n\t\t\tconst value = valueAt$1(config, slicePath);\n\t\t\tif (entryKey === void 0) {\n\t\t\t\tswitchedOn ||= !alreadyServed(value, absent);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconfigured = true;\n\t\t\tif (value !== void 0 && value !== null) entry[entryKey] = value;\n\t\t}\n\t\tif (configured || switchedOn) composition.push({\n\t\t\tmodule,\n\t\t\tconfig: entry\n\t\t});\n\t}\n\treturn composition;\n}\n/**\n* Dead-config warnings for a Connect host (typed-host-configs 1.6): an\n* authored connect config value whose owning plugin is not in the\n* composition active for `verb`. Connect zeroes such a slice, so the value\n* has no effect — e.g. Sektar's `connect.drives.allowAddDrive: true` without\n* the generic plugin.\n*\n* Nothing is reported when the host declares no composition\n* (`runner.plugins` absent: the classic boot serves the config as is), or\n* when Connect already serves every leaf of the authored value. Warnings, not\n* errors: the host still boots, it just does not do what the value says.\n*/\nfunction findDeadConnectConfig(config, entries, verb, where) {\n\tif (!config || entries === void 0) return [];\n\tconst active = new Set(normalizePluginEntries(entries, where).filter((entry) => entryActiveForVerb(entry, verb)).map((entry) => entry.module));\n\tconst warnings = [];\n\tfor (const [owner, { slices, inertUnless }] of Object.entries(CONNECT_PLUGIN_OWNED_SLICES)) {\n\t\tif (active.has(owner)) continue;\n\t\tif (inertUnless !== void 0) {\n\t\t\tconst gate = slices.find((slice) => slice.path === inertUnless);\n\t\t\tif (alreadyServed(valueAt$1(config, inertUnless), gate?.absent)) continue;\n\t\t}\n\t\tfor (const { path: slicePath, absent, entryKey } of slices) {\n\t\t\tconst value = valueAt$1(config, slicePath);\n\t\t\tif (alreadyServed(value, absent)) continue;\n\t\t\tconst move = entryKey === void 0 ? `compose \"${owner}\" (presence is the switch)` : `compose \"${owner}\" and set \\`${entryKey}\\` in its entry config`;\n\t\t\twarnings.push({\n\t\t\t\tpath: slicePath,\n\t\t\t\tvalue,\n\t\t\t\tserved: absent,\n\t\t\t\towner,\n\t\t\t\tmessage: `${where}: config.${slicePath} is dead config: it is owned by plugin \"${owner}\", which this host does not compose for verb \"${verb}\", so Connect serves ${JSON.stringify(absent)} instead of ${JSON.stringify(value)}.\\n Hint: ${move}, or delete the value.`\n\t\t\t});\n\t\t}\n\t}\n\treturn warnings;\n}\n//#endregion\n//#region src/drive-schema.ts\n/**\n* The schema half of drives.ts, zod only so `./schema` stays neutral.\n* - slug: the SEEDING KEY (idempotence); id optional (stable identity).\n* - preferredEditor: stored at header.meta.preferredEditor; Connect config's\n* `app` is the legacy alias.\n* - remote.url: a drive served elsewhere; local fields are ignored for it.\n* Token-able (`$output` on a producer's `drives.<slug>.url`).\n*/\nfunction buildDriveDeclarationSchema(urlField) {\n\treturn z.strictObject({\n\t\tslug: z.string().min(1),\n\t\tid: z.string().min(1).optional(),\n\t\t/** Derive the id from the project path, like generateProjectDriveId — the\n\t\t* same ids classic `ph vetra` produces. `true` serves the drive under the\n\t\t* hashed slug too (the vetra drive's slug IS its hashed id); `\"id\"` hashes\n\t\t* only the id and keeps the declared slug (the classic Workflows drive:\n\t\t* `/d/workflows`, id `workflows-<hash>`). */\n\t\tprojectHash: z.union([z.boolean(), z.literal(\"id\")]).optional(),\n\t\t/** What a missing drive is created as. Default powerhouse/document-drive. */\n\t\tdocumentType: z.enum([\"powerhouse/document-drive\", \"powerhouse/reactor-drive\"]).optional(),\n\t\tname: z.string().min(1).optional(),\n\t\ticon: z.string().optional(),\n\t\tpreferredEditor: z.string().optional(),\n\t\tsharingType: z.enum([\n\t\t\t\"public\",\n\t\t\t\"private\",\n\t\t\t\"shared\"\n\t\t]).optional(),\n\t\tavailableOffline: z.boolean().optional(),\n\t\tremote: z.strictObject({ url: urlField(z.string().min(1)) }).optional()\n\t});\n}\nconst driveDeclarationSchema = buildDriveDeclarationSchema(tokenable);\nconst drivesSchema = z.array(driveDeclarationSchema);\n/** The project-hashed drive id (`${slug}-${sha256(projectRoot)[0..8]}`) with\n* the hash function injected, so neutral consumers (a browser monitor) can\n* pass `crypto.subtle`-derived or precomputed hex. drives.ts binds it to\n* node:crypto as `projectDriveId`. */\nfunction projectDriveIdWith(sha256Hex, projectRoot, slug) {\n\treturn `${slug}-${sha256Hex(projectRoot).substring(0, 8)}`;\n}\n//#endregion\n//#region src/host-schemas.ts\n/**\n* The zod single source for host.js blocks (typed-host-configs G1). Every\n* host type is z.input/z.output of these schemas; nothing is hand-mirrored.\n* Top-level host objects and the `reactor` block are STRICT (a typo fails);\n* `runner` stays loose until each runner declares its options (T2), and\n* `config` is runner-defined.\n*\n* Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`\n* (required, a switchboard drive address), `reactor.drives` (whole list, e.g. `$map`),\n* `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.\n*/\n/** A host's `name` keys its run record, `.ph/run/<name>.json`, so it must be\n* one safe path segment. */\nconst HOST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nconst HOST_NAME_MAX_LENGTH = 128;\nconst HOST_NAME_MESSAGE = \"A host name is used as a file name, so use only letters, digits, '.', '_' and '-', start with a letter or digit, and keep it to 128 characters.\";\nconst hostNameSchema = z.string().min(1).max(128, HOST_NAME_MESSAGE).regex(HOST_NAME_PATTERN, HOST_NAME_MESSAGE);\n/**\n* A URL, or one written against the page origin (`${origin}/graphql`): the\n* browser resolves the placeholder when it loads Connect's config, for a\n* member whose own server proxies the switchboard's paths.\n*/\nconst originOrUrlSchema = z.union([z.url(), z.string().refine(isOriginPlaceholderUrl, { message: \"a URL, or ${origin}/<path> for a proxied sibling\" })]);\nconst profileSchema = z.strictObject({\n\tappId: z.string().min(1).optional(),\n\tname: z.string().min(1).optional(),\n\tdescription: z.string().optional(),\n\ticon: z.string().optional()\n});\nconst reactorProtocolSchema = z.strictObject({\n\tfeatureFlags: z.strictObject({\n\t\tdocumentDecisions: z.boolean().optional(),\n\t\tauthEnforcement: z.boolean().optional(),\n\t\tauthGroups: z.boolean().optional(),\n\t\tauthConditions: z.boolean().optional(),\n\t\tundoV3: z.boolean().optional()\n\t}).optional(),\n\tcreateSignaturePolicy: z.enum([\"legacy\", \"v2-required\"]).optional(),\n\tunsupportedStoredDocuments: z.enum([\"refuse\", \"read-only\"]).optional()\n});\nconst runnerKindSchema = z.enum([\"reactor\", \"compound\"]);\nconst reactorBackendKindSchema = z.enum([\n\t\"in-process\",\n\t\"worker\",\n\t\"remote\"\n]);\nconst samePath = (a, b) => {\n\tconst norm = (p) => p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").replace(/^\\.\\//, \"\");\n\treturn norm(a) === norm(b);\n};\n/** Compound wiring: the generic compound runner's `config` block.\n* (`projectDrivesIntoConnect` and `drivesPublicBase` were removed in T3: a\n* member consumes another member's drives through `$output` tokens.) */\nconst compoundWiringSchema = z.strictObject({\n\t/** Member start order; must name declared children and agree with the\n\t* output-token dependencies (resolve/plan.ts). Optional: without it the\n\t* order is derived from the tokens. Unnamed members start after the named\n\t* ones, in declaration order. */\n\tstartOrder: z.array(z.string().min(1)).optional(),\n\t/** Write .ph/run/<host>.json (default true). */\n\truntimeRecord: z.boolean().optional(),\n\t/** Patch the baked CSP for the runtime registry on a served Connect\n\t* member (forwarded as `runner.cspRegistrySync` to every member whose\n\t* runner is `@powerhousedao/ph-cli/runners/connect`). */\n\tcspRegistrySync: z.boolean().optional()\n});\n/** `config.startOrder ⊆ keys(children)`, checked where both are visible.\n* Apply it LAST (`.superRefine(refineStartOrder)`) to a runner's final host\n* schema: zod refuses to `.extend()` a refined object. */\nfunction refineStartOrder(host, ctx) {\n\tconst startOrder = host.config?.startOrder;\n\tif (!Array.isArray(startOrder)) return;\n\tconst members = Object.keys(host.children);\n\tstartOrder.forEach((name, index) => {\n\t\tif (startOrder.indexOf(name) !== index) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\n\t\t\t\t\t\"config\",\n\t\t\t\t\t\"startOrder\",\n\t\t\t\t\tindex\n\t\t\t\t],\n\t\t\t\tmessage: `startOrder names \"${String(name)}\" twice; each member starts once.`\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (typeof name === \"string\" && members.includes(name)) return;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"config\",\n\t\t\t\t\"startOrder\",\n\t\t\t\tindex\n\t\t\t],\n\t\t\tmessage: `startOrder names \"${String(name)}\", which is not a member. Members: ${members.join(\", \") || \"(none)\"}.`\n\t\t});\n\t});\n}\nconst ALLOW_TOKENS = {\n\tany: tokenable,\n\tenv: envTokenable\n};\nconst FORBID_TOKENS = {\n\tany: (schema) => z.union([schema]),\n\tenv: (schema) => z.union([schema])\n};\n/** The replacement a non-drive `remote.url` message names. */\nfunction useDriveUrl(host = \"switchboard\", member) {\n\treturn `remote: { url: ${host}.drives.<slug>.url } with ${host} from ../${host}/outputs.js, or remote: { url: { $output: { host: \"${host}\"${member ? `, member: \"${member}\"` : \"\"}, path: [\"drives\", \"<slug>\", \"url\"] } } }`;\n}\n/** The `$output` of a declared `remote.url` that reads `endpoints.graphql`. */\nfunction endpointsGraphqlRef(url) {\n\tif (typeof url !== \"object\" || url === null || !(\"$output\" in url)) return;\n\tconst ref = url.$output;\n\tif (typeof ref !== \"object\" || ref === null) return void 0;\n\tconst { host, member, path } = ref;\n\tif (typeof host !== \"string\" || !Array.isArray(path)) return void 0;\n\tif (path.join(\".\") !== \"endpoints.graphql\") return void 0;\n\treturn {\n\t\thost,\n\t\t...typeof member === \"string\" ? { member } : {}\n\t};\n}\n/** The slug a drive link names: a `drives.<slug>.url` token's slug or a\n* literal address's served slug; undefined when only runtime knows it. */\nfunction linkedSlug(url) {\n\tif (typeof url === \"string\") return switchboardOfDrive(url)?.slug;\n\tconst ref = typeof url === \"object\" && url !== null && \"$output\" in url ? url.$output : void 0;\n\tconst path = Array.isArray(ref?.path) ? ref.path : [];\n\treturn path.length === 3 && path[0] === \"drives\" && typeof path[1] === \"string\" && path[2] === \"url\" ? path[1] : void 0;\n}\n/** The drives a declared host names (home drives, `reactor.drives`, plugin\n* `config.drive` links), or undefined when one is known only at runtime. */\nfunction knownDriveSlugs(host) {\n\tconst reactor = host.reactor ?? {};\n\tconst slugs = [];\n\tfor (const backend of Object.values(reactor.backends ?? {})) {\n\t\tif (backend.kind !== \"remote\") continue;\n\t\tconst slug = linkedSlug(backend.remote?.url);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\tif (reactor.drives !== void 0) {\n\t\tif (!Array.isArray(reactor.drives)) return void 0;\n\t\tfor (const drive of reactor.drives) if (typeof drive.slug === \"string\") slugs.push(drive.slug);\n\t}\n\tconst plugins = Array.isArray(host.runner?.plugins) ? host.runner.plugins : [];\n\tfor (const entry of plugins) {\n\t\tconst config = typeof entry === \"object\" && entry !== null && \"config\" in entry ? entry.config : void 0;\n\t\tif (typeof config !== \"object\" || config === null) continue;\n\t\tif (!(\"drive\" in config) || config.drive === void 0) continue;\n\t\tconst slug = linkedSlug(config.drive);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\tfor (const drive of connectDefaultDrives(host.config)) {\n\t\tif (typeof drive !== \"object\" || drive === null || !(\"url\" in drive)) continue;\n\t\tconst slug = linkedSlug(drive.url);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\treturn slugs;\n}\n/** A Connect host's `config.drives.defaultDrives`, unchecked. */\nfunction connectDefaultDrives(config) {\n\tconst drives = typeof config === \"object\" && config !== null && \"drives\" in config ? config.drives : void 0;\n\tconst list = typeof drives === \"object\" && drives !== null && \"defaultDrives\" in drives ? drives.defaultDrives : void 0;\n\treturn Array.isArray(list) ? list : [];\n}\n/** Declared form, at host level so plugin drives are seen: a placement key\n* must name a drive the host names, when every drive is knowable. A host\n* with no remote backend is not checked: its plugins may contribute drives\n* (a switchboard's workflows drive) that no field names. */\nfunction refineDeclaredPlacementKeys(host, ctx) {\n\tconst placed = Object.keys(host.reactor?.placement?.drives ?? {});\n\tif (placed.length === 0) return;\n\tif (!Object.values(host.reactor?.backends ?? {}).some((b) => b.kind === \"remote\")) return;\n\tconst known = knownDriveSlugs(host);\n\tif (!known) return;\n\tconst names = (slug, served) => served === slug || served.startsWith(`${slug}-`) && /^[0-9a-f]{8}$/.test(served.slice(slug.length + 1));\n\tfor (const slug of placed) {\n\t\tif (known.some((served) => names(slug, served))) continue;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"reactor\",\n\t\t\t\t\"placement\",\n\t\t\t\t\"drives\",\n\t\t\t\tslug\n\t\t\t],\n\t\t\tmessage: `placement.drives.${slug} names no drive this host links to or declares (${[...new Set(known)].join(\", \") || \"none\"}).`\n\t\t});\n\t}\n}\n/** Resolved-form checks across backends, drives and placement: one base is\n* one remote backend, and a drive placed on a remote is on its switchboard. */\nfunction refineResolvedReactor(reactor, ctx) {\n\tconst backends = reactor.backends ?? {};\n\tconst baseOf = /* @__PURE__ */ new Map();\n\tconst byBase = /* @__PURE__ */ new Map();\n\tconst linked = /* @__PURE__ */ new Map();\n\tconst link = (slug, base) => linked.set(slug, (linked.get(slug) ?? /* @__PURE__ */ new Set()).add(base));\n\tfor (const [name, backend] of Object.entries(backends)) {\n\t\tconst url = backend.remote?.url;\n\t\tif (backend.kind !== \"remote\" || typeof url !== \"string\") continue;\n\t\tconst home = switchboardOfDrive(url);\n\t\tif (!home) continue;\n\t\tbaseOf.set(name, home.base);\n\t\tlink(home.slug, home.base);\n\t\tconst first = byBase.get(home.base);\n\t\tif (first === void 0) {\n\t\t\tbyBase.set(home.base, name);\n\t\t\tcontinue;\n\t\t}\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"backends\",\n\t\t\t\tname,\n\t\t\t\t\"remote\",\n\t\t\t\t\"url\"\n\t\t\t],\n\t\t\tmessage: `backends \"${first}\" and \"${name}\" both open drives on the same switchboard (${home.base}). Keep \"${first}\", and list the second drive under reactor.drives with its remote.url instead.`\n\t\t});\n\t}\n\tconst kept = /* @__PURE__ */ new Set();\n\t(Array.isArray(reactor.drives) ? reactor.drives : []).forEach((drive, index) => {\n\t\tif (!drive.remote) {\n\t\t\tkept.add(drive.slug);\n\t\t\treturn;\n\t\t}\n\t\tconst at = switchboardOfDrive(drive.remote.url);\n\t\tif (at || drive.remote.url === \"\") {\n\t\t\tif (at) link(drive.slug, at.base);\n\t\t\treturn;\n\t\t}\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"drives\",\n\t\t\t\tindex,\n\t\t\t\t\"remote\",\n\t\t\t\t\"url\"\n\t\t\t],\n\t\t\tmessage: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${drive.remote.url}: sync needs the drive. Use url: switchboard.drives.<slug>.url, or url: { $output: { host: \"switchboard\", path: [\"drives\", \"<slug>\", \"url\"] } }.`\n\t\t});\n\t});\n\tconst nameOf = (base) => byBase.get(base) ?? base;\n\tfor (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {\n\t\tconst at = [\n\t\t\t\"placement\",\n\t\t\t\"drives\",\n\t\t\tslug\n\t\t];\n\t\tconst on = [...linked.get(slug) ?? []];\n\t\tif (on.length > 0 && kept.has(slug)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `Drive \"${slug}\" is both this reactor's own drive and on ${on.map(nameOf).join(\" and \")}. Rename one, or link only one.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (on.length > 1) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `Drive \"${slug}\" is on both ${on.map(nameOf).join(\" and \")}. Rename one, or link only one.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = baseOf.get(name);\n\t\tif (base === void 0) continue;\n\t\tif (on.length === 0) {\n\t\t\tif (!kept.has(slug)) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `placement.drives.${slug} opens drive \"${slug}\" on \"${name}\", but this reactor keeps that drive itself. Only a drive on a switchboard can open there without a copy.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (on[0] === base) continue;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: at,\n\t\t\tmessage: `placement.drives.${slug} opens drive \"${slug}\" on \"${name}\" (${base}), but the drive is on ${on[0]}. Place it on the backend for that switchboard.`\n\t\t});\n\t}\n}\n/** `remote` keys that tune a connection, so only a remote backend has them. */\nconst REMOTE_ONLY_KEYS = [\n\t\"requestTimeoutMs\",\n\t\"breaker\",\n\t\"realtime\"\n];\n/**\n* Builds the host schema set. \"allow\" (declared form) accepts `T | Token` in\n* every token-able field; \"forbid\" (resolved form) accepts `T` only.\n*/\nfunction buildHostSchemas(tokenField) {\n\tconst resolved = tokenField === FORBID_TOKENS;\n\tconst reactorBackendSchema = z.strictObject({\n\t\tkind: reactorBackendKindSchema,\n\t\tstorage: z.strictObject({\n\t\t\tkind: z.enum([\n\t\t\t\t\"idb\",\n\t\t\t\t\"memory\",\n\t\t\t\t\"path\",\n\t\t\t\t\"postgres\"\n\t\t\t]),\n\t\t\t/** `\"${userData}/…\"` sugar or `{ $env: \"NAME\" }`. */\n\t\t\tdataDir: tokenField.env(z.string()).optional(),\n\t\t\turl: z.string().optional()\n\t\t}).optional(),\n\t\treadModel: z.strictObject({ url: z.string().optional() }).optional(),\n\t\tpackages: z.strictObject({\n\t\t\tcdnUrl: z.string().optional(),\n\t\t\tspecs: z.array(z.string()).optional(),\n\t\t\t/** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n\t\t\tdynamic: z.boolean().optional()\n\t\t}).optional(),\n\t\tremote: z.strictObject({\n\t\t\turl: tokenField.any(originOrUrlSchema),\n\t\t\t/** Give up on one request to this switchboard after this long. Default 30_000. */\n\t\t\trequestTimeoutMs: z.number().int().positive().optional(),\n\t\t\t/** After `failures` failed requests in a row, send nothing for\n\t\t\t* `openMs`. Default { failures: 3, openMs: 30_000 }. `false`:\n\t\t\t* never stop trying. */\n\t\t\tbreaker: z.union([z.literal(false), z.strictObject({\n\t\t\t\tfailures: z.number().int().min(1).optional(),\n\t\t\t\topenMs: z.number().int().nonnegative().optional()\n\t\t\t})]).optional(),\n\t\t\t/** Live updates over a socket (the router's GraphQL\n\t\t\t* subscriptions, not drive sync). Default true. */\n\t\t\trealtime: z.boolean().optional()\n\t\t}).optional()\n\t}).superRefine((backend, ctx) => {\n\t\tif (backend.kind === \"remote\" && !backend.remote) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `a \"remote\" backend needs remote.url, a switchboard drive address: ${useDriveUrl()}.`\n\t\t});\n\t\tif (backend.kind !== \"remote\" && backend.remote) for (const key of REMOTE_ONLY_KEYS) {\n\t\t\tif (backend.remote[key] === void 0) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"remote\", key],\n\t\t\t\tmessage: `remote.${key} applies only to a \"remote\" backend; this one is \"${backend.kind}\".`\n\t\t\t});\n\t\t}\n\t\tconst url = backend.remote?.url;\n\t\tconst graphqlRef = resolved ? void 0 : endpointsGraphqlRef(url);\n\t\tif (graphqlRef) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `remote.url reads ${graphqlRef.host}'s endpoints.graphql; it must be a switchboard drive address (<switchboard>/d/<slug>): sync needs the drive. Use ${useDriveUrl(graphqlRef.host, graphqlRef.member)}.`\n\t\t});\n\t\tif (resolved && typeof url === \"string\" && !switchboardOfDrive(url)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${url}: sync needs the drive. Use ${useDriveUrl()}.`\n\t\t});\n\t\tconst store = backend.storage;\n\t\tconst storeDir = store?.kind === \"path\" ? store.dataDir : void 0;\n\t\tconst readModel = backend.readModel?.url;\n\t\tif (typeof storeDir === \"string\" && readModel && samePath(storeDir, readModel)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"readModel\", \"url\"],\n\t\t\tmessage: `readModel.url must not be the reactor's storage dir (${readModel}): two PGlite instances on one data dir corrupt it. Omit readModel.url to get the classic <root>/.ph/read-storage next to the reactor store.`\n\t\t});\n\t});\n\tconst reactorSchema = z.strictObject({\n\t\tbackends: z.record(z.string(), reactorBackendSchema).optional(),\n\t\tplacement: z.strictObject({\n\t\t\tprimary: z.string().optional(),\n\t\t\t/** Declared drive slug → backend name. A local backend keeps a\n\t\t\t* synced copy; the drive's own remote backend opens it there with\n\t\t\t* no copy. An unlisted drive keeps a synced copy. */\n\t\t\tdrives: z.record(z.string().min(1), z.string().min(1)).optional(),\n\t\t\t/** The backend new drives (and documents outside a drive) are\n\t\t\t* created on. A switchboard keeps no copy in this browser.\n\t\t\t* Default: the browser reactor, else the only switchboard. */\n\t\t\tnewDrives: z.string().min(1).optional()\n\t\t}).optional(),\n\t\trouter: z.strictObject({\n\t\t\t/** Wait this long for a reactor to say whether it holds a\n\t\t\t* document. 0: no bound. Default 3_000. */\n\t\t\tprobeTimeoutMs: z.number().int().nonnegative().optional(),\n\t\t\t/** Look again after this long for a document found on a later\n\t\t\t* backend. Default 30_000. */\n\t\t\tprovisionalRouteMs: z.number().int().nonnegative().optional()\n\t\t}).optional(),\n\t\tprotocol: reactorProtocolSchema.optional(),\n\t\t/** DEPRECATED (dies in R2): workflows become a listed plugin. */\n\t\tworkflows: z.boolean().optional(),\n\t\trenown: z.strictObject({\n\t\t\turl: z.string().optional(),\n\t\t\tnetworkId: z.string().optional(),\n\t\t\tchainId: z.number().int().optional()\n\t\t}).optional(),\n\t\tnamespace: z.string().min(1).optional(),\n\t\tdrives: tokenField.any(z.array(buildDriveDeclarationSchema(tokenField.any))).optional()\n\t}).superRefine((reactor, ctx) => {\n\t\tconst backends = reactor.backends ?? {};\n\t\tfor (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {\n\t\t\tif (Object.hasOwn(backends, name)) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\n\t\t\t\t\t\"placement\",\n\t\t\t\t\t\"drives\",\n\t\t\t\t\tslug\n\t\t\t\t],\n\t\t\t\tmessage: `placement.drives.${slug} names backend \"${name}\", which is not in backends (${Object.keys(backends).join(\", \") || \"none\"}).`\n\t\t\t});\n\t\t}\n\t\tconst newDrives = reactor.placement?.newDrives;\n\t\tif (newDrives !== void 0 && !Object.hasOwn(backends, newDrives)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"placement\", \"newDrives\"],\n\t\t\tmessage: `placement.newDrives names backend \"${newDrives}\", which is not in backends (${Object.keys(backends).join(\", \") || \"none\"}).`\n\t\t});\n\t\tif (resolved) refineResolvedReactor(reactor, ctx);\n\t});\n\t/** Common runner options; runner modules extend it with their own. */\n\tconst runnerBaseSchema = z.looseObject({\n\t\tmodule: z.string().min(1),\n\t\tdefaultVerb: z.string().min(1).optional(),\n\t\tport: z.number().int().positive().optional(),\n\t\t/** Bind address; each runner documents its default. */\n\t\thost: z.string().min(1).optional(),\n\t\t/** THE COMPOSITION: plugin entries; presence is activation. */\n\t\tplugins: z.array(pluginEntrySchema).optional()\n\t});\n\t/** A compound member wrapper. Sections are FULL STATEMENTS except `runner`,\n\t* which key-merges over the member's own. Plugins live in `runner.plugins`\n\t* (as on a standalone host); there is no wrapper-level `plugins`. */\n\tconst childWrapperSchema = z.strictObject({\n\t\thost: z.string().min(1),\n\t\trunner: runnerBaseSchema.partial().extend({ port: z.number().int().min(0).max(65535).optional() }).optional(),\n\t\tconfig: z.looseObject({}).optional(),\n\t\treactor: reactorSchema.optional()\n\t});\n\tconst childrenSchema = z.record(z.string(), childWrapperSchema);\n\treturn {\n\t\treactorBackendSchema,\n\t\treactorSchema,\n\t\trunnerBaseSchema,\n\t\tchildWrapperSchema,\n\t\tchildrenSchema,\n\t\treactorHostSchema: z.strictObject({\n\t\t\tname: hostNameSchema,\n\t\t\trunner: runnerBaseSchema,\n\t\t\tconfig: z.looseObject({}).optional(),\n\t\t\tprofile: profileSchema.optional(),\n\t\t\treactor: reactorSchema.optional()\n\t\t}),\n\t\tcompoundHostSchema: z.strictObject({\n\t\t\tname: hostNameSchema,\n\t\t\trunner: runnerBaseSchema,\n\t\t\tchildren: childrenSchema,\n\t\t\tconfig: z.looseObject({}).optional(),\n\t\t\tprofile: profileSchema.optional()\n\t\t}),\n\t\t/** This set's field wrapper, for a runner's OWN token-able fields inside\n\t\t* `defineHostSchemas`: declared, `T | Token` in and `T` out; resolved,\n\t\t* `T` only. Both modes share one static type. */\n\t\ttokenable: tokenField.any,\n\t\t/** As `tokenable`, but the only token accepted is `$env`. */\n\t\tenvTokenable: tokenField.env\n\t};\n}\n/** The host schema set in declared (\"allow\": token-able fields take tokens)\n* or resolved (\"forbid\") form. */\nfunction makeHostSchemas(options) {\n\treturn buildHostSchemas(options.tokens === \"allow\" ? ALLOW_TOKENS : FORBID_TOKENS);\n}\n/** The issues a host-level refinement raises, outside a zod parse. */\nfunction collectIssues(host, refine) {\n\tif (typeof host !== \"object\" || host === null || !(\"reactor\" in host)) return [];\n\tconst issues = [];\n\trefine(host, { addIssue: (issue) => {\n\t\tissues.push({\n\t\t\tpath: (issue.path ?? []).filter((part) => typeof part !== \"symbol\"),\n\t\t\tmessage: issue.message ?? \"\"\n\t\t});\n\t} });\n\treturn issues;\n}\n/** withPlacementKeys' check, for a merged declared host parsed some other way. */\nfunction placementKeyIssues(host) {\n\treturn collectIssues(host, refineDeclaredPlacementKeys);\n}\nconst CONNECT_PRIMARY_MESSAGE = \"Connect doesn't use placement.primary. To choose where new drives go, use placement.newDrives.\";\n/**\n* A Connect host's placement rules, in either form. The router's primary is\n* the browser reactor, else the `newDrives` switchboard, else the only one,\n* so `placement.primary` means nothing here, and a Connect with several\n* switchboards and no browser reactor must say where new drives go. Apply it\n* last to the Connect runner's schema: `.superRefine(refineConnectReactor)`.\n*/\nfunction refineConnectReactor(host, ctx) {\n\tconst reactor = host.reactor;\n\tif (!reactor) return;\n\tif (reactor.placement?.primary !== void 0) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [\n\t\t\t\"reactor\",\n\t\t\t\"placement\",\n\t\t\t\"primary\"\n\t\t],\n\t\tmessage: CONNECT_PRIMARY_MESSAGE\n\t});\n\tconst backends = Object.entries(reactor.backends ?? {});\n\tconst remotes = backends.filter(([, backend]) => backend.kind === \"remote\").map(([name]) => name);\n\tif (remotes.length > 1 && remotes.length === backends.length && reactor.placement?.newDrives === void 0) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [\n\t\t\t\"reactor\",\n\t\t\t\"placement\",\n\t\t\t\"newDrives\"\n\t\t],\n\t\tmessage: `This Connect keeps no reactor in the browser and links ${remotes.length} switchboards (${remotes.join(\", \")}). Set placement.newDrives to the one new drives are created on.`\n\t});\n}\n/** refineConnectReactor's check, for a Connect host parsed some other way. */\nfunction connectReactorIssues(host) {\n\treturn collectIssues(host, refineConnectReactor);\n}\n/** Adds the host-level placement key check to a runner's declared schema. */\nfunction withPlacementKeys(schema) {\n\tif (!(schema instanceof z.ZodType)) return schema;\n\treturn schema.superRefine((host, ctx) => {\n\t\tif (typeof host === \"object\" && host !== null && \"reactor\" in host) refineDeclaredPlacementKeys(host, ctx);\n\t});\n}\n/**\n* One runner definition, two schemas (3.5): `build` runs over the DECLARED\n* set (tokens allowed; its z.input types host files) and the RESOLVED set\n* (no tokens; `validateHost` checks it before the verb). Export both, type\n* the host as `z.input<typeof declaredHostSchema>`, refine last inside the\n* builder (zod can't extend a refined object), and wrap the runner's own\n* token-able fields with `s.tokenable` / `s.envTokenable`.\n*/\nfunction defineHostSchemas(build) {\n\treturn {\n\t\tdeclaredHostSchema: withPlacementKeys(build(declaredSchemas)),\n\t\thostSchema: build(resolvedSchemas)\n\t};\n}\nconst declaredSchemas = makeHostSchemas({ tokens: \"allow\" });\nconst resolvedSchemas = makeHostSchemas({ tokens: \"forbid\" });\nconst declaredHostSchemas = declaredSchemas;\nconst reactorBackendSchema = resolvedSchemas.reactorBackendSchema;\nconst reactorSchema = resolvedSchemas.reactorSchema;\nconst runnerBaseSchema = resolvedSchemas.runnerBaseSchema;\nconst childWrapperSchema = resolvedSchemas.childWrapperSchema;\nconst childrenSchema = resolvedSchemas.childrenSchema;\nconst reactorHostSchema = resolvedSchemas.reactorHostSchema;\nconst compoundHostSchema = resolvedSchemas.compoundHostSchema;\n/** The generic compound runner's host: the base with its wiring config. */\nconst genericCompound = defineHostSchemas((s) => s.compoundHostSchema.extend({ config: compoundWiringSchema.optional() }).superRefine(refineStartOrder));\nconst genericCompoundHostSchema = genericCompound.hostSchema;\nconst declaredGenericCompoundHostSchema = genericCompound.declaredHostSchema;\nconst SCHEMA_BASE = \"https://powerhouse.inc/schemas\";\n/** One host schema as an editor JSON Schema with a stable `$id` — the\n* per-runner emission helper (runner packages emit their own hostSchema). */\nfunction emitHostJsonSchema(name, schema) {\n\treturn {\n\t\t$id: `${SCHEMA_BASE}/${name}.schema.json`,\n\t\t...z.toJSONSchema(schema, { io: \"input\" })\n\t};\n}\n/** The emitted-schema set, keyed by published filename. Pure — the\n* emit-schemas script writes these and the drift test re-derives them. */\nfunction emittedHostSchemas() {\n\treturn {\n\t\t\"host-reactor.schema.json\": emitHostJsonSchema(\"host-reactor\", declaredSchemas.reactorHostSchema),\n\t\t\"host-compound.schema.json\": emitHostJsonSchema(\"host-compound\", declaredSchemas.compoundHostSchema)\n\t};\n}\n//#endregion\n//#region src/resolve/walk.ts\nfunction isPlainObject(value) {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\n/** `a.b[2].c` (or `<root>`). */\nfunction formatPath(path) {\n\tlet out = \"\";\n\tfor (const segment of path) if (typeof segment === \"number\") out += `[${segment}]`;\n\telse out += out ? `.${segment}` : segment;\n\treturn out || \"<root>\";\n}\n/** Is this object a `$$` escape (`{ $$: literal }`)? */\nfunction isEscape(value) {\n\tconst keys = Object.keys(value);\n\treturn keys.length === 1 && keys[0] === TOKEN_ESCAPE_KEY;\n}\n/** Every token in `value`, in document order. `$concat` parts and `$map`\n* operands (`over`, then the `to` template) are visited: they may hold tokens\n* themselves. Each site carries the `$map` scopes it sits in. A `$$` escape\n* hides its operand. */\nfunction collectTokenSites(value) {\n\tconst sites = [];\n\tvisit(value, [], \"root\", [], sites);\n\treturn sites;\n}\nfunction visit(value, path, position, scopes, sites) {\n\tconst key = tokenKeyOf(value);\n\tif (key && isPlainObject(value)) {\n\t\tsites.push({\n\t\t\tpath,\n\t\t\tkey,\n\t\t\ttoken: value,\n\t\t\tposition,\n\t\t\tscopes\n\t\t});\n\t\tconst operand = value[key];\n\t\tif (key === \"$concat\" && Array.isArray(operand)) operand.forEach((part, index) => visit(part, [\n\t\t\t...path,\n\t\t\t\"$concat\",\n\t\t\tindex\n\t\t], \"concat\", scopes, sites));\n\t\tif (key === \"$map\" && isPlainObject(operand)) {\n\t\t\tconst at = [...path, \"$map\"];\n\t\t\tif (\"over\" in operand) visit(operand.over, [...at, \"over\"], \"over\", scopes, sites);\n\t\t\tif (\"to\" in operand) {\n\t\t\t\tconst scope = {\n\t\t\t\t\tpath,\n\t\t\t\t\ttoken: value,\n\t\t\t\t\t...typeof operand.as === \"string\" ? { as: operand.as } : {}\n\t\t\t\t};\n\t\t\t\tvisit(operand.to, [...at, \"to\"], \"template\", [...scopes, scope], sites);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tvalue.forEach((child, index) => visit(child, [...path, index], \"element\", scopes, sites));\n\t\treturn;\n\t}\n\tif (!isPlainObject(value) || isEscape(value)) return;\n\tfor (const [childKey, child] of Object.entries(value)) visit(child, [...path, childKey], \"property\", scopes, sites);\n}\n/** An `$item` path as text: `url`, `drives.x`, `<element>` for `[]`. */\nfunction pathText(path) {\n\tif (path.length === 0) return \"<element>\";\n\treturn formatPath(path.filter((p) => typeof p === \"string\" || typeof p === \"number\"));\n}\n/** A one-line human rendering of a token, for `--explain` and messages. */\nfunction describeToken(token) {\n\tconst key = tokenKeyOf(token);\n\tif (!key || !isPlainObject(token)) return JSON.stringify(token);\n\tconst operand = token[key];\n\tif (key === \"$output\" && isPlainObject(operand)) return `$output ${typeof operand.host === \"string\" ? operand.host : \"?\"}${typeof operand.member === \"string\" ? ` (member ${operand.member})` : \"\"} › ${Array.isArray(operand.path) ? formatPath(operand.path.filter((p) => typeof p === \"string\" || typeof p === \"number\")) : \"?\"}`;\n\tif (key === \"$env\") {\n\t\tif (typeof operand === \"string\") return `$env ${operand}`;\n\t\tif (isPlainObject(operand) && typeof operand.name === \"string\") return `$env ${operand.name} (optional)`;\n\t}\n\tif (key === \"$item\") {\n\t\tconst named = isPlainObject(operand) ? operand : void 0;\n\t\tconst raw = named ? named.path : operand;\n\t\tconst path = Array.isArray(raw) ? pathText(raw) : \"?\";\n\t\treturn `$item${named && typeof named.as === \"string\" ? `(${named.as})` : \"\"} ${path}`;\n\t}\n\tif (key === \"$key\") return typeof operand === \"string\" ? `$key(${operand})` : \"$key\";\n\tif (key === \"$map\" && isPlainObject(operand)) {\n\t\tconst as = typeof operand.as === \"string\" ? ` as ${operand.as}` : \"\";\n\t\tconst into = operand.into === \"record\" ? \" into record\" : \"\";\n\t\treturn `$map over [${describeToken(operand.over)}]${as}${into} → ${JSON.stringify(render(operand.to))}`;\n\t}\n\tif (key === \"$concat\" && Array.isArray(operand)) return `$concat ${operand.map((part) => typeof part === \"string\" ? JSON.stringify(part) : typeof part === \"number\" ? String(part) : `[${describeToken(part)}]`).join(\" + \")}`;\n\treturn `${key} ${JSON.stringify(operand)}`;\n}\n/** A display copy of `value` with every token replaced by `«description»`\n* (for printing declared hosts, e.g. `--explain drives`). */\nfunction renderTokens(value) {\n\treturn render(value);\n}\nfunction render(value) {\n\tif (tokenKeyOf(value)) return `«${describeToken(value)}»`;\n\tif (Array.isArray(value)) return value.map(render);\n\tif (!isPlainObject(value) || isEscape(value)) return value;\n\tconst out = {};\n\tfor (const [key, child] of Object.entries(value)) out[key] = render(child);\n\treturn out;\n}\n/** A copy of `value` with every `$$` escape replaced by its operand (the\n* literal it protects). Run after the no-token walk. */\nfunction unwrapEscapes(value) {\n\treturn unwrap(value);\n}\nfunction unwrap(value) {\n\tif (Array.isArray(value)) return value.map(unwrap);\n\tif (!isPlainObject(value)) return value;\n\tif (isEscape(value)) return structuredClone(value[TOKEN_ESCAPE_KEY]);\n\tconst out = {};\n\tfor (const [key, child] of Object.entries(value)) out[key] = unwrap(child);\n\treturn out;\n}\n//#endregion\n//#region src/resolve/declared.ts\nfunction refOf(site) {\n\tconst operand = site.token.$output;\n\tif (!isPlainObject(operand) || typeof operand.host !== \"string\") return;\n\treturn typeof operand.member === \"string\" ? {\n\t\thost: operand.host,\n\t\tmember: operand.member\n\t} : { host: operand.host };\n}\nfunction pathOf(site) {\n\tconst operand = site.token.$output;\n\tif (!isPlainObject(operand) || !Array.isArray(operand.path)) return [];\n\treturn operand.path.filter((p) => typeof p === \"string\" || typeof p === \"number\");\n}\nfunction refKey(ref) {\n\treturn ref.member ? `${ref.host}#${ref.member}` : ref.host;\n}\n/** The distinct producers a host's `$output` tokens name, in document order. */\nfunction outputRefsOf(host) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const site of collectTokenSites(host)) {\n\t\tif (site.key !== \"$output\") continue;\n\t\tconst ref = refOf(site);\n\t\tif (ref && !seen.has(refKey(ref))) seen.set(refKey(ref), ref);\n\t}\n\treturn [...seen.values()];\n}\n/** Every `$output` token with its host path and producer (for the plan and\n* `--explain outputs`). */\nfunction outputSitesOf(host) {\n\treturn collectTokenSites(host).flatMap((site) => {\n\t\tif (site.key !== \"$output\") return [];\n\t\tconst ref = refOf(site);\n\t\treturn ref ? [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tref,\n\t\t\toutputPath: pathOf(site)\n\t\t}] : [];\n\t});\n}\n/** Every `$env` token with its host path (for `--explain outputs`). */\nfunction envSitesOf(host) {\n\treturn collectTokenSites(host).flatMap((site) => {\n\t\tif (site.key !== \"$env\") return [];\n\t\tconst operand = site.token.$env;\n\t\tif (typeof operand === \"string\") return [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tname: operand,\n\t\t\toptional: false\n\t\t}];\n\t\tif (isPlainObject(operand) && typeof operand.name === \"string\") return [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tname: operand.name,\n\t\t\toptional: true\n\t\t}];\n\t\treturn [];\n\t});\n}\n/** The binding name an `$item`/`$key` site names (undefined: innermost). */\nfunction bindingNameOf(site) {\n\tconst operand = site.token[site.key];\n\tif (site.key === \"$key\") return typeof operand === \"string\" ? operand : void 0;\n\tif (site.key === \"$item\" && isPlainObject(operand)) return typeof operand.as === \"string\" ? operand.as : void 0;\n}\n/** The enclosing `$map` an `$item`/`$key` site binds to, or why none. */\nfunction scopeOf(site) {\n\tconst name = bindingNameOf(site);\n\tif (site.scopes.length === 0) return { error: `${site.key} is used outside any $map; it reads the element a $map template is rendering, so it is legal only inside a $map's \\`to\\` (or a nested $map's \\`over\\`).` };\n\tif (name === void 0) return site.scopes[site.scopes.length - 1];\n\tfor (let i = site.scopes.length - 1; i >= 0; i--) if (site.scopes[i].as === name) return site.scopes[i];\n\tconst named = site.scopes.flatMap((s) => s.as ? [`\"${s.as}\"`] : []);\n\treturn { error: `${describeToken(site.token)} names the $map binding \"${name}\", which no enclosing $map declares (enclosing bindings: ${named.join(\", \") || \"none; add as: \\\"\" + name + \"\\\" to the outer $map\"}).` };\n}\n/** Item path of an `$item` site. */\nfunction itemPathOf(site) {\n\tconst operand = site.token.$item;\n\tconst raw = isPlainObject(operand) ? operand.path : operand;\n\treturn Array.isArray(raw) ? raw.filter((p) => typeof p === \"string\" || typeof p === \"number\") : [];\n}\n/** Operator shapes and placement: malformed operands, `$item`/`$key`\n* outside any `$map` or naming an unknown binding, and\n* `{ $env: { name, optional: true } }` anywhere but the direct value of an\n* object property (it omits that property when unset). */\nfunction checkTokenSites(host) {\n\tconst issues = [];\n\tfor (const site of collectTokenSites(host)) {\n\t\tconst path = formatPath(site.path);\n\t\tif (!tokenSchema.safeParse(site.token).success) {\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `malformed ${site.key} token ${JSON.stringify(site.token)}. Shapes: { $output: { host, member?, path: [...] } }, { $concat: [string | number | token, ...] }, { $env: \"NAME\" } or { $env: { name: \"NAME\", optional: true } }, { $map: { over: $output | $item, as?: \"name\", to: template, into?: \"record\" } }, { $item: [path] } or { $item: { as: \"name\", path: [...] } }, { $key: true } or { $key: \"name\" }.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key === \"$item\" || site.key === \"$key\") {\n\t\t\tconst scope = scopeOf(site);\n\t\t\tif (\"error\" in scope) issues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: scope.error\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst operand = site.token.$env;\n\t\tif (site.key === \"$env\" && isPlainObject(operand) && site.position !== \"property\") {\n\t\t\tconst where = site.position === \"concat\" ? \"a $concat part\" : site.position === \"element\" ? \"an array element\" : site.position === \"template\" ? \"the whole $map template\" : \"the whole host\";\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `{ $env: { name, optional: true } } is legal only as the direct value of an object property (it omits that property when ${String(operand.name)} is unset), not as ${where}. Use { $env: ${JSON.stringify(operand.name)} } here.`\n\t\t\t});\n\t\t}\n\t}\n\treturn issues;\n}\nfunction defOf(schema) {\n\tif (!isPlainObjectLike(schema)) return void 0;\n\tconst internals = schema._zod;\n\tif (!isPlainObjectLike(internals)) return void 0;\n\tconst def = internals.def;\n\tif (!isPlainObjectLike(def) || typeof def.type !== \"string\") return void 0;\n\treturn {\n\t\t...def,\n\t\ttype: def.type\n\t};\n}\nfunction isPlainObjectLike(value) {\n\treturn (typeof value === \"object\" || typeof value === \"function\") && value !== null;\n}\nconst WRAPPERS = /* @__PURE__ */ new Set([\n\t\"optional\",\n\t\"nullable\",\n\t\"default\",\n\t\"prefault\",\n\t\"readonly\",\n\t\"nonoptional\",\n\t\"catch\",\n\t\"success\"\n]);\n/** The schema at `path` inside a zod schema (walking objects, records,\n* arrays, tuples, unions and wrappers), or why the path does not exist. */\nfunction schemaAtPath(schema, path) {\n\tlet current = schema;\n\tfor (let i = 0; i <= path.length; i++) {\n\t\tfor (let guard = 0; guard < 32; guard++) {\n\t\t\tconst def = defOf(current);\n\t\t\tif (!def) break;\n\t\t\tif (WRAPPERS.has(def.type)) current = def.innerType;\n\t\t\telse if (def.type === \"lazy\" && typeof def.getter === \"function\") {\n\t\t\t\tconst getter = def.getter;\n\t\t\t\tcurrent = getter();\n\t\t\t} else if (def.type === \"pipe\") {\n\t\t\t\tconst out = defOf(def.out);\n\t\t\t\tcurrent = out && out.type !== \"transform\" ? def.out : def.in;\n\t\t\t} else break;\n\t\t}\n\t\tif (i === path.length) return {\n\t\t\tok: true,\n\t\t\tschema: current\n\t\t};\n\t\tconst segment = path[i];\n\t\tconst def = defOf(current);\n\t\tif (!def) return {\n\t\t\tok: false,\n\t\t\tat: i,\n\t\t\treason: \"is not a schema\"\n\t\t};\n\t\tswitch (def.type) {\n\t\t\tcase \"any\":\n\t\t\tcase \"unknown\": return {\n\t\t\t\tok: true,\n\t\t\t\tschema: current\n\t\t\t};\n\t\t\tcase \"object\": {\n\t\t\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\t\t\tif (typeof segment === \"string\" && segment in shape) {\n\t\t\t\t\tcurrent = shape[segment];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst catchall = defOf(def.catchall);\n\t\t\t\tif (catchall && catchall.type !== \"never\") {\n\t\t\t\t\tcurrent = def.catchall;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst keys = Object.keys(shape);\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: `has no key ${JSON.stringify(segment)} (keys: ${keys.join(\", \") || \"none\"})`\n\t\t\t\t};\n\t\t\t}\n\t\t\tcase \"record\":\n\t\t\t\tif (typeof segment !== \"string\") return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"is a record (string keys)\"\n\t\t\t\t};\n\t\t\t\tcurrent = def.valueType;\n\t\t\t\tbreak;\n\t\t\tcase \"array\":\n\t\t\t\tif (typeof segment !== \"number\") return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"is an array (numeric index)\"\n\t\t\t\t};\n\t\t\t\tcurrent = def.element;\n\t\t\t\tbreak;\n\t\t\tcase \"tuple\": {\n\t\t\t\tconst items = Array.isArray(def.items) ? def.items : [];\n\t\t\t\tif (typeof segment !== \"number\" || segment >= items.length) return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: `is a ${items.length}-tuple`\n\t\t\t\t};\n\t\t\t\tcurrent = items[segment];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"union\": {\n\t\t\t\tconst options = Array.isArray(def.options) ? def.options : [];\n\t\t\t\tfor (const option of options) {\n\t\t\t\t\tconst hit = schemaAtPath(option, path.slice(i));\n\t\t\t\t\tif (hit.ok) return hit;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"matches no union member\"\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault: return {\n\t\t\t\tok: false,\n\t\t\t\tat: i,\n\t\t\t\treason: `is a ${def.type}, not a container`\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tok: true,\n\t\tschema: current\n\t};\n}\n/** Whether the object schema at `path` names `key` in its shape (a\n* catchall does not count): what a runner's schema explicitly declares,\n* e.g. `runner.cspRegistrySync`. A union declares a key any member does. */\nfunction declaresKey(schema, path, key) {\n\tconst at = schemaAtPath(schema, path);\n\tif (!at.ok) return false;\n\tconst def = defOf(at.schema);\n\tif (def?.type === \"object\") return isPlainObjectLike(def.shape) && key in def.shape;\n\tif (def?.type === \"union\" && Array.isArray(def.options)) return def.options.some((option) => declaresKey(option, [], key));\n\treturn false;\n}\n/** Whether a (property) schema admits an absent value on the OUTPUT side:\n* `.optional()` does; `.default()`/`.prefault()` fill it in, and\n* `.nonoptional()` forbids it. */\nfunction mayBeAbsent(schema) {\n\tlet current = schema;\n\tfor (let guard = 0; guard < 32; guard++) {\n\t\tconst internals = isPlainObjectLike(current) ? current._zod : void 0;\n\t\tif (isPlainObjectLike(internals) && internals.optout === \"optional\") return true;\n\t\tconst def = defOf(current);\n\t\tif (!def) return false;\n\t\tif (def.type === \"optional\") return true;\n\t\tif (def.type === \"default\" || def.type === \"prefault\" || def.type === \"nonoptional\" || !WRAPPERS.has(def.type)) return false;\n\t\tcurrent = def.innerType;\n\t}\n\treturn false;\n}\n/** Whether `key` may be absent from a value of the object schema `schema`:\n* an optional property, or (in a union) one some member makes optional or\n* lacks. A record value or an array element is never optional. */\nfunction optionalKeyIn(schema, key) {\n\tconst unwrapped = schemaAtPath(schema, []);\n\tconst def = unwrapped.ok ? defOf(unwrapped.schema) : void 0;\n\tif (def?.type === \"object\") {\n\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\treturn key in shape && mayBeAbsent(shape[key]);\n\t}\n\tif (def?.type === \"union\" && Array.isArray(def.options)) return def.options.some((option) => {\n\t\tconst inner = schemaAtPath(option, []);\n\t\tconst optionDef = inner.ok ? defOf(inner.schema) : void 0;\n\t\tconst shape = optionDef?.type === \"object\" && isPlainObjectLike(optionDef.shape) ? optionDef.shape : void 0;\n\t\treturn shape !== void 0 && (!(key in shape) || mayBeAbsent(shape[key]));\n\t});\n\treturn false;\n}\n/**\n* Whether the field `path[at]` is OPTIONAL in `schema` (a producer's\n* `outputsSchema`, or a `$map` element schema), given that `path[0..at-1]`\n* exists: the codegen'd `OutputToken<T | undefined>` / `ItemToken<T |\n* undefined>` positions, whose rendered property the resolver omits when\n* the field is absent. False for a record key, an array index, or a path\n* the schema does not describe.\n*/\nfunction isOptionalField(schema, path, at) {\n\tconst key = path[at];\n\tif (typeof key !== \"string\") return false;\n\tconst parent = schemaAtPath(schema, path.slice(0, at));\n\treturn parent.ok && optionalKeyIn(parent.schema, key);\n}\n/** The element schema of a collection schema (array element, record\n* value), or undefined when the schema does not say. */\nfunction elementSchemaOf(schema) {\n\tconst collection = collectionOf(schema);\n\treturn collection.kind === \"array\" || collection.kind === \"record\" ? collection.element : void 0;\n}\n/** The collection kind of a schema (unwrapped): array, record, unknown (no\n* check possible) or something else. */\nfunction collectionOf(schema) {\n\tconst unwrapped = schemaAtPath(schema, []);\n\tconst def = unwrapped.ok ? defOf(unwrapped.schema) : void 0;\n\tif (!def) return { kind: \"unknown\" };\n\tif (def.type === \"array\") return {\n\t\tkind: \"array\",\n\t\telement: def.element\n\t};\n\tif (def.type === \"record\") return {\n\t\tkind: \"record\",\n\t\telement: def.valueType\n\t};\n\tif (def.type === \"object\") {\n\t\tconst catchall = defOf(def.catchall);\n\t\tif (catchall && catchall.type !== \"never\") {\n\t\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\t\treturn Object.keys(shape).length === 0 ? {\n\t\t\t\tkind: \"record\",\n\t\t\t\telement: def.catchall\n\t\t\t} : {\n\t\t\t\tkind: \"record\",\n\t\t\t\telement: void 0\n\t\t\t};\n\t\t}\n\t}\n\tif (def.type === \"tuple\") return {\n\t\tkind: \"array\",\n\t\telement: void 0\n\t};\n\tif (def.type === \"any\" || def.type === \"unknown\" || def.type === \"union\") return { kind: \"unknown\" };\n\treturn {\n\t\tkind: \"other\",\n\t\ttype: def.type\n\t};\n}\n/** Every `$output` token's producer exists and its path is valid against\n* the producer's `outputsSchema`; every `$map`'s `over` is a collection\n* there (a record under `into: \"record\"`), and every `$item` path exists\n* in the element schema of the map it binds. */\nfunction checkOutputPaths(host, outputsSchemaOf) {\n\tconst issues = [];\n\tconst elements = /* @__PURE__ */ new Map();\n\tconst elementOf = (scope) => \"error\" in scope ? void 0 : elements.get(scope.token);\n\tfor (const site of collectTokenSites(host)) {\n\t\tif (!tokenSchema.safeParse(site.token).success) continue;\n\t\tif (site.key === \"$map\") {\n\t\t\telements.set(site.token, checkMap(site, outputsSchemaOf, elementOf, issues));\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key === \"$item\") {\n\t\t\tconst scope = scopeOf(site);\n\t\t\tconst element = elementOf(scope);\n\t\t\tif (!element || element.element === void 0 || \"error\" in scope) continue;\n\t\t\tconst itemPath = itemPathOf(site);\n\t\t\tconst hit = schemaAtPath(element.element, itemPath);\n\t\t\tif (!hit.ok) {\n\t\t\t\tconst parent = itemPath.slice(0, hit.at);\n\t\t\t\tissues.push({\n\t\t\t\t\tpath: formatPath(site.path),\n\t\t\t\t\tmessage: `${describeToken(site.token)}: the element${parent.length ? `'s ${formatPath(parent)}` : \"\"} of the $map at ${formatPath(scope.path)}${scope.as ? ` (as \"${scope.as}\")` : \"\"} ${hit.reason} (element of ${element.label}).`\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key !== \"$output\") continue;\n\t\tconst ref = refOf(site);\n\t\tif (!ref) continue;\n\t\tconst path = formatPath(site.path);\n\t\tconst lookup = outputsSchemaOf(ref);\n\t\tif (\"error\" in lookup) {\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: lookup.error\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst outputPath = pathOf(site);\n\t\tconst hit = schemaAtPath(lookup.schema, outputPath);\n\t\tif (!hit.ok) {\n\t\t\tconst parent = outputPath.slice(0, hit.at);\n\t\t\tconst where = parent.length ? `outputs.${formatPath(parent)}` : \"the outputs\";\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `${describeToken(site.token)}: ${where} ${hit.reason} in the outputsSchema of ${lookup.label}.`\n\t\t\t});\n\t\t}\n\t}\n\treturn issues;\n}\n/** A `$map`'s `over` against its schema: a collection (a record under\n* `into: \"record\"`). Returns the element schema for the map's `$item`s. */\nfunction checkMap(site, outputsSchemaOf, elementOf, issues) {\n\tconst operand = site.token.$map;\n\tif (!isPlainObject(operand)) return void 0;\n\tconst over = operand.over;\n\tconst into = operand.into === \"record\";\n\tlet schema;\n\tlet label;\n\tif (isPlainObject(over) && \"$output\" in over) {\n\t\tconst overSite = {\n\t\t\t...site,\n\t\t\tkey: \"$output\",\n\t\t\ttoken: over\n\t\t};\n\t\tconst ref = refOf(overSite);\n\t\tif (!ref) return void 0;\n\t\tconst lookup = outputsSchemaOf(ref);\n\t\tif (\"error\" in lookup) return void 0;\n\t\tconst hit = schemaAtPath(lookup.schema, pathOf(overSite));\n\t\tif (!hit.ok) return void 0;\n\t\tschema = hit.schema;\n\t\tlabel = `${describeToken(over)} in the outputsSchema of ${lookup.label}`;\n\t} else if (isPlainObject(over) && \"$item\" in over) {\n\t\tconst overSite = {\n\t\t\t...site,\n\t\t\tkey: \"$item\",\n\t\t\ttoken: over\n\t\t};\n\t\tconst outer = elementOf(scopeOf(overSite));\n\t\tif (!outer || outer.element === void 0) return void 0;\n\t\tconst hit = schemaAtPath(outer.element, itemPathOf(overSite));\n\t\tif (!hit.ok) return void 0;\n\t\tschema = hit.schema;\n\t\tlabel = `${describeToken(over)} (element of ${outer.label})`;\n\t} else return;\n\tconst path = formatPath(site.path);\n\tconst collection = collectionOf(schema);\n\tif (collection.kind === \"unknown\") return void 0;\n\tif (collection.kind === \"other\") {\n\t\tissues.push({\n\t\t\tpath,\n\t\t\tmessage: `$map over ${label} is a ${collection.type}, not an array or a record; a $map iterates a collection.`\n\t\t});\n\t\treturn;\n\t}\n\tif (into && collection.kind === \"array\") {\n\t\tissues.push({\n\t\t\tpath,\n\t\t\tmessage: `$map with into: \"record\" maps over ${label}, which is an array: an array has no keys to keep. Drop into: \"record\" (the result is an array) or map over a record.`\n\t\t});\n\t\treturn;\n\t}\n\treturn {\n\t\telement: collection.element,\n\t\tlabel\n\t};\n}\n//#endregion\n//#region src/resolve/removed-forms.ts\nfunction outputToken(host, path, member) {\n\treturn `{ $output: { host: \"${host}\"${member ? `, member: \"${member}\"` : \"\"}, path: [${path.map((p) => JSON.stringify(p)).join(\", \")}] } }`;\n}\nfunction isDriveReference(value) {\n\tif (!isPlainObject(value)) return false;\n\tconst keys = Object.keys(value).sort();\n\treturn keys.length === 2 && keys[0] === \"from\" && keys[1] === \"slug\" && typeof value.from === \"string\" && typeof value.slug === \"string\";\n}\nfunction checkReactor(reactor, base, found) {\n\tif (!isPlainObject(reactor) || !isPlainObject(reactor.backends)) return;\n\tfor (const [name, backend] of Object.entries(reactor.backends)) {\n\t\tif (!isPlainObject(backend) || !isPlainObject(backend.remote)) continue;\n\t\tconst host = backend.remote.host;\n\t\tif (host === void 0) continue;\n\t\tconst producer = typeof host === \"string\" ? host : \"switchboard\";\n\t\tfound.push({\n\t\t\tpath: `${base}reactor.backends.${name}.remote.host`,\n\t\t\tmessage: `remote: { host } was removed; use a drive address: remote: { url: ${producer}.drives.<slug>.url } with ${producer} from ../${producer}/outputs.js, or remote: { url: ${outputToken(producer, [\n\t\t\t\t\"drives\",\n\t\t\t\t\"<slug>\",\n\t\t\t\t\"url\"\n\t\t\t])} }.`\n\t\t});\n\t}\n}\nfunction checkPlugins(runner, base, memberHosts, found) {\n\tif (!isPlainObject(runner) || !Array.isArray(runner.plugins)) return;\n\trunner.plugins.forEach((entry, index) => {\n\t\tif (!isPlainObject(entry) || !isPlainObject(entry.config)) return;\n\t\tfor (const [key, value] of Object.entries(entry.config)) {\n\t\t\tif (!isDriveReference(value)) continue;\n\t\t\tconst host = memberHosts[value.from] ?? value.from;\n\t\t\tconst member = memberHosts[value.from] ? value.from : void 0;\n\t\t\tfound.push({\n\t\t\t\tpath: `${base}runner.plugins[${index}].config.${key}`,\n\t\t\t\tmessage: `${key}: { from, slug } was removed; use ${host}.drives.${value.slug}.url from ../${host}/outputs.js, or ${outputToken(host, [\n\t\t\t\t\t\"drives\",\n\t\t\t\t\tvalue.slug,\n\t\t\t\t\t\"url\"\n\t\t\t\t])}${member ? ` (add member: \"${member}\" if two members run host \"${host}\")` : \"\"}.`\n\t\t\t});\n\t\t}\n\t});\n}\n/** Every removed form in a host file (reactor or compound), in document\n* order. Compound wrappers are checked too. */\nfunction findRemovedForms(host) {\n\tconst found = [];\n\tif (!isPlainObject(host)) return found;\n\tconst children = isPlainObject(host.children) ? host.children : void 0;\n\tconst memberHosts = {};\n\tfor (const [key, wrapper] of Object.entries(children ?? {})) if (isPlainObject(wrapper) && typeof wrapper.host === \"string\") memberHosts[key] = wrapper.host;\n\tcheckReactor(host.reactor, \"\", found);\n\tcheckPlugins(host.runner, \"\", memberHosts, found);\n\tfor (const [key, wrapper] of Object.entries(children ?? {})) {\n\t\tif (!isPlainObject(wrapper)) continue;\n\t\tcheckReactor(wrapper.reactor, `children.${key}.`, found);\n\t\tcheckPlugins(wrapper.runner, `children.${key}.`, memberHosts, found);\n\t}\n\tif (children && isPlainObject(host.config)) for (const key of [\"projectDrivesIntoConnect\", \"drivesPublicBase\"]) {\n\t\tif (host.config[key] === void 0) continue;\n\t\tfound.push({\n\t\t\tpath: `config.${key}`,\n\t\t\tmessage: `config.${key} was removed; declare the drives on the member that consumes them, by output token: reactor.drives: [{ slug: \"<slug>\", remote: { url: ${outputToken(\"switchboard\", [\n\t\t\t\t\"drives\",\n\t\t\t\t\"<slug>\",\n\t\t\t\t\"url\"\n\t\t\t])} } }].`\n\t\t});\n\t}\n\treturn found;\n}\n//#endregion\n//#region src/env-substitution.ts\n/** The always-resolvable `$env` names (also the `\"${name}\"` sugar). */\nconst BUILTIN_ENV_NAMES = [\"userData\", \"projectRoot\"];\nfunction isBuiltinEnvName(name) {\n\treturn BUILTIN_ENV_NAMES.includes(name);\n}\nconst BUILTIN = new RegExp(`\\\\$\\\\{(${BUILTIN_ENV_NAMES.join(\"|\")})\\\\}`, \"g\");\nfunction substitute(text, env) {\n\treturn text.replace(BUILTIN, (match, name) => env[name] ?? match);\n}\n/** Deep-substitute the built-ins that `env` provides in every string; an\n* absent built-in is left as written. The input is never mutated. */\nfunction substituteBuiltinEnv(value, env) {\n\treturn substituteValue(value, env);\n}\nfunction substituteValue(value, env) {\n\tif (typeof value === \"string\") return substitute(value, env);\n\tif (Array.isArray(value)) return value.map((v) => substituteValue(v, env));\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteValue(v, env);\n\t\treturn out;\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/resolve/plan.ts\n/**\n* The dependency plan (pipeline step 4): which compound member consumes\n* which member's outputs, and the start order that follows. Producers start\n* before consumers; `config.startOrder` is optional and, when given, must\n* agree with the tokens. Cycles fail. Pure.\n*/\nvar PlanError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"PlanError\";\n\t}\n};\n/** The member a ref names: the unique member running `ref.host`, or the\n* member `ref.member` when given (it must run `ref.host`). */\nfunction memberForRef(ref, members) {\n\tif (ref.member !== void 0) {\n\t\tconst named = members.find((m) => m.key === ref.member);\n\t\tif (!named) return { error: `names member \"${ref.member}\", which this compound does not declare (members: ${members.map((m) => m.key).join(\", \")}).` };\n\t\tif (named.host !== ref.host) return { error: `names member \"${ref.member}\" of host \"${ref.host}\", but that member runs host \"${named.host}\".` };\n\t\treturn { key: named.key };\n\t}\n\tconst running = members.filter((m) => m.host === ref.host);\n\tif (running.length === 1) return { key: running[0].key };\n\tif (running.length === 0) return { error: `names host \"${ref.host}\", which no member of this compound runs (members run: ${[...new Set(members.map((m) => m.host))].join(\", \")}).` };\n\treturn { error: `names host \"${ref.host}\", which members ${running.map((m) => `\"${m.key}\"`).join(\" and \")} both run; add member: \"<key>\" to pick one.` };\n}\nfunction edgesOf(members) {\n\tconst edges = [];\n\tconst problems = [];\n\tfor (const member of members) {\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\tfor (const { ref, path } of member.refs) {\n\t\t\tconst target = memberForRef(ref, members);\n\t\t\tif (\"error\" in target) {\n\t\t\t\tproblems.push(`${member.key}: ${path} ${target.error}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (target.key === member.key) {\n\t\t\t\tproblems.push(`${member.key}: ${path} reads ${refKey(ref)}'s outputs, which is this member itself.`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (seen.has(target.key)) continue;\n\t\t\tseen.add(target.key);\n\t\t\tedges.push({\n\t\t\t\tconsumer: member.key,\n\t\t\t\tproducer: target.key,\n\t\t\t\tpath\n\t\t\t});\n\t\t}\n\t}\n\tif (problems.length > 0) throw new PlanError(problems.join(\"\\n\"));\n\treturn edges;\n}\n/** Declared start order: the named members first, then the rest in\n* declaration order. */\nfunction declaredOrder(members, startOrder) {\n\tconst keys = members.map((m) => m.key);\n\tconst named = [...new Set(startOrder)].filter((k) => keys.includes(k));\n\treturn [...named, ...keys.filter((k) => !named.includes(k))];\n}\nfunction planCompound(members, startOrder) {\n\tconst edges = edgesOf(members);\n\tif (startOrder) {\n\t\tconst order = declaredOrder(members, startOrder);\n\t\tconst index = new Map(order.map((k, i) => [k, i]));\n\t\tconst bad = edges.filter((e) => (index.get(e.producer) ?? 0) > (index.get(e.consumer) ?? 0));\n\t\tif (bad.length > 0) throw new PlanError(bad.map((e) => `config.startOrder starts \"${e.consumer}\" before \"${e.producer}\", but ${e.consumer}.${e.path} consumes \"${e.producer}\"'s outputs. Reorder startOrder (or omit it: the order follows the tokens).`).join(\"\\n\"));\n\t\treturn {\n\t\t\torder,\n\t\t\tedges,\n\t\t\tsource: \"startOrder\"\n\t\t};\n\t}\n\tconst pending = new Map(members.map((m) => [m.key, /* @__PURE__ */ new Set()]));\n\tfor (const e of edges) pending.get(e.consumer)?.add(e.producer);\n\tconst order = [];\n\twhile (order.length < members.length) {\n\t\tconst next = members.find((m) => !order.includes(m.key) && pending.get(m.key)?.size === 0);\n\t\tif (!next) {\n\t\t\tconst stuck = members.filter((m) => !order.includes(m.key));\n\t\t\tthrow new PlanError(`output tokens form a cycle between ${stuck.map((m) => `\"${m.key}\"`).join(\", \")}: ${edges.filter((e) => stuck.some((m) => m.key === e.consumer) && stuck.some((m) => m.key === e.producer)).map((e) => `${e.consumer} (${e.path}) needs ${e.producer}`).join(\"; \")}.`);\n\t\t}\n\t\torder.push(next.key);\n\t\tfor (const set of pending.values()) set.delete(next.key);\n\t}\n\treturn {\n\t\torder,\n\t\tedges,\n\t\tsource: \"tokens\"\n\t};\n}\n//#endregion\n//#region src/resolve/resolve.ts\nvar TokenResolutionError = class extends Error {\n\t/** The host path that failed and the reason, without the file prefix. */\n\tdetail;\n\tconstructor(message, detail) {\n\t\tsuper(message);\n\t\tthis.name = \"TokenResolutionError\";\n\t\tif (detail) this.detail = detail;\n\t}\n};\n/** Why a required `$env` cannot resolve. */\nfunction unsetEnvMessage(name) {\n\treturn `reads $env ${name}, which is not set. Set ${name} in the environment of the process that resolves this host (or declare { $env: { name: \"${name}\", optional: true } } to omit the property when unset).`;\n}\n/** A resolved `{ $env: { name, optional: true } }` whose variable is unset,\n* or an `$output`/`$item` reading an absent optional field: its enclosing\n* property is omitted. */\nconst OMIT = Symbol(\"omit\");\n/** `reactor.drives[\"workflows\"]` (or `…[2]` for an array element). */\nfunction elementText(binding) {\n\tconst key = typeof binding.key === \"number\" ? `[${binding.key}]` : `[${JSON.stringify(binding.key)}]`;\n\treturn `${formatPath(binding.path)}${key}`;\n}\n/** Provenance of `$map`-rendered arrays: element index → the input key\n* (record key, or array index) it was rendered from. Lets resolved\n* validation name the element key, not just the result index. */\nconst renderedKeys = /* @__PURE__ */ new WeakMap();\n/**\n* The `$map` elements an issue path (from resolved validation of a resolved\n* host) passes through, as text: `$map element \"workflows\"`. Undefined when\n* the path crosses no `$map`-rendered array. Walk the SAME object\n* `resolveHostOutputs` returned (provenance is by identity).\n*/\nfunction describeMapElements(host, path) {\n\tconst found = [];\n\tlet current = host;\n\tfor (const segment of path) if (Array.isArray(current) && typeof segment === \"number\") {\n\t\tconst key = renderedKeys.get(current)?.[segment];\n\t\tif (key !== void 0) found.push(`$map element ${typeof key === \"number\" ? `[${key}]` : JSON.stringify(key)}`);\n\t\tcurrent = current[segment];\n\t} else if (isPlainObject(current) && typeof segment === \"string\") current = current[segment];\n\telse break;\n\treturn found.length ? found.join(\" › \") : void 0;\n}\n/** A deep copy of a resolved (JSON-shaped) value that keeps the `$map`\n* provenance of its rendered arrays (structuredClone would drop it). */\nfunction cloneWithProvenance(value) {\n\tif (Array.isArray(value)) {\n\t\tconst copy = value.map(cloneWithProvenance);\n\t\tconst keys = renderedKeys.get(value);\n\t\tif (keys) renderedKeys.set(copy, keys);\n\t\treturn copy;\n\t}\n\tif (isPlainObject(value)) {\n\t\tconst copy = {};\n\t\tfor (const [key, child] of Object.entries(value)) copy[key] = cloneWithProvenance(child);\n\t\treturn copy;\n\t}\n\treturn value;\n}\n/** The value at `path` inside `root` (output data: records and arrays). */\nfunction walkPath(root, path) {\n\tlet current = root;\n\tfor (let i = 0; i < path.length; i++) {\n\t\tconst segment = path[i];\n\t\tconst next = Array.isArray(current) ? typeof segment === \"number\" ? current[segment] : void 0 : isPlainObject(current) && typeof segment === \"string\" ? current[segment] : void 0;\n\t\tif (next === void 0) {\n\t\t\tconst has = isPlainObject(current) ? Object.keys(current).join(\", \") || \"nothing\" : Array.isArray(current) ? `${current.length} elements` : JSON.stringify(current);\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tat: i,\n\t\t\t\thas\n\t\t\t};\n\t\t}\n\t\tcurrent = next;\n\t}\n\treturn {\n\t\tok: true,\n\t\tvalue: current\n\t};\n}\n/** The schema at `path` inside `schema`, when both are known. */\nfunction schemaOf(schema, path) {\n\tif (schema === void 0) return void 0;\n\tconst hit = schemaAtPath(schema, path);\n\treturn hit.ok ? hit.schema : void 0;\n}\nfunction pathSegments(path) {\n\treturn path.filter((p) => typeof p === \"string\" || typeof p === \"number\");\n}\nvar Resolver = class {\n\tsources;\n\tself;\n\tdeferred = [];\n\t/** What the last OMIT stood for, for the \"nothing to omit\" errors. */\n\tomitted = \"an optional $env\";\n\tconstructor(sources, self) {\n\t\tthis.sources = sources;\n\t\tthis.self = self;\n\t}\n\t/** The member keys a token reads (`$output` on a member's host), when\n\t* resolving a compound's own fields with `deferSelf`. */\n\tselfRefs(token, trail) {\n\t\tif (!this.self) return [];\n\t\tconst keys = /* @__PURE__ */ new Set();\n\t\tfor (const site of collectTokenSites(token)) {\n\t\t\tconst operand = site.token.$output;\n\t\t\tif (site.key !== \"$output\" || !isPlainObject(operand)) continue;\n\t\t\tif (typeof operand.host !== \"string\") continue;\n\t\t\tconst ref = typeof operand.member === \"string\" ? {\n\t\t\t\thost: operand.host,\n\t\t\t\tmember: operand.member\n\t\t\t} : { host: operand.host };\n\t\t\tif (this.self === \"outputs\") {\n\t\t\t\tkeys.add(refKey(ref));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!this.self.members.some((m) => m.host === ref.host)) continue;\n\t\t\tconst target = memberForRef(ref, this.self.members);\n\t\t\tif (\"error\" in target) this.fail([...trail, ...site.path], `in a compound ${target.error}`);\n\t\t\tkeys.add(target.key);\n\t\t}\n\t\treturn [...keys];\n\t}\n\tfail(trail, message, scope = []) {\n\t\tconst where = this.sources.where ? `${this.sources.where}: ` : \"\";\n\t\tconst inside = scope.length ? ` (rendering $map element ${scope.map(elementText).join(\" › \")})` : \"\";\n\t\tconst path = formatPath(trail);\n\t\tthrow new TokenResolutionError(`${where}\\`${path}\\` ${message}${inside}`, {\n\t\t\tpath,\n\t\t\treason: `${message}${inside}`\n\t\t});\n\t}\n\tvalue(value, trail, scope = []) {\n\t\tif (typeof value === \"string\") return this.sources.builtins ? substituteBuiltinEnv(value, this.sources.builtins) : value;\n\t\tif (Array.isArray(value)) return value.map((child, index) => {\n\t\t\tconst out = this.value(child, [...trail, index], scope);\n\t\t\tif (out === OMIT) this.fail([...trail, index], `is ${this.omitted} inside an array.`, scope);\n\t\t\treturn out;\n\t\t});\n\t\tif (!isPlainObject(value)) return value;\n\t\tif (isEscape(value)) return structuredClone(value);\n\t\tif (tokenKeyOf(value)) {\n\t\t\tconst members = scope.length === 0 ? this.selfRefs(value, trail) : [];\n\t\t\tif (members.length > 0) {\n\t\t\t\tthis.deferred.push({\n\t\t\t\t\ttrail,\n\t\t\t\t\ttoken: value,\n\t\t\t\t\tmembers\n\t\t\t\t});\n\t\t\t\treturn structuredClone(value);\n\t\t\t}\n\t\t\treturn this.token(value, trail, scope);\n\t\t}\n\t\tconst out = {};\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\tif (typeof this.self === \"object\" && trail.length === 0 && key === \"children\") {\n\t\t\t\tout[key] = child;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = this.value(child, [...trail, key], scope);\n\t\t\tif (resolved !== OMIT) out[key] = resolved;\n\t\t}\n\t\treturn out;\n\t}\n\ttoken(token, trail, scope = []) {\n\t\tif (!tokenSchema.safeParse(token).success) this.fail(trail, `is a malformed token: ${JSON.stringify(token)}.`, scope);\n\t\tswitch (tokenKeyOf(token)) {\n\t\t\tcase \"$output\": return this.output(token, trail, scope);\n\t\t\tcase \"$env\": return this.env(token.$env, trail, scope);\n\t\t\tcase \"$concat\": return this.concat(token.$concat, trail, scope);\n\t\t\tcase \"$map\": return this.map(token.$map, trail, scope);\n\t\t\tcase \"$item\": return this.item(token.$item, trail, scope);\n\t\t\tcase \"$key\": return this.key(token.$key, trail, scope);\n\t\t\tdefault: return this.fail(trail, `is not a token.`, scope);\n\t\t}\n\t}\n\t/** The binding an `$item`/`$key` names: the innermost map, or the\n\t* enclosing map whose `as` is `name`. */\n\tbinding(name, operator, trail, scope) {\n\t\tif (scope.length === 0) return this.fail(trail, `uses ${operator} outside any $map; ${operator} reads the element a $map template is rendering.`);\n\t\tif (name === void 0) return scope[scope.length - 1];\n\t\tfor (let i = scope.length - 1; i >= 0; i--) if (scope[i].as === name) return scope[i];\n\t\tconst named = scope.flatMap((b) => b.as ? [`\"${b.as}\"`] : []);\n\t\treturn this.fail(trail, `uses ${operator} with binding \"${name}\", which no enclosing $map declares (as: ${named.join(\", \") || \"none\"}).`, scope);\n\t}\n\tmap(operand, trail, scope) {\n\t\tif (!isPlainObject(operand)) return this.fail(trail, \"is a malformed $map token.\", scope);\n\t\tconst into = operand.into === \"record\";\n\t\tconst as = typeof operand.as === \"string\" ? operand.as : void 0;\n\t\tconst read = this.readWithSchema(operand.over, [\n\t\t\t...trail,\n\t\t\t\"$map\",\n\t\t\t\"over\"\n\t\t], scope);\n\t\tconst over = read.value;\n\t\tif (over === OMIT) return OMIT;\n\t\tconst element = read.schema === void 0 ? void 0 : elementSchemaOf(read.schema);\n\t\tconst render = (key, item) => {\n\t\t\tconst inner = [...scope, {\n\t\t\t\tpath: trail,\n\t\t\t\tkey,\n\t\t\t\titem,\n\t\t\t\t...as !== void 0 ? { as } : {},\n\t\t\t\t...element !== void 0 ? { schema: element } : {}\n\t\t\t}];\n\t\t\tconst at = [\n\t\t\t\t...trail,\n\t\t\t\t\"$map\",\n\t\t\t\t\"to\"\n\t\t\t];\n\t\t\tconst out = this.value(operand.to, at, inner);\n\t\t\tif (out === OMIT) return this.fail(at, `is ${this.omitted} as the whole $map template; there is no property to omit.`, inner);\n\t\t\treturn out;\n\t\t};\n\t\tif (Array.isArray(over)) {\n\t\t\tif (into) return this.fail(trail, `is a $map with into: \"record\", but its over (${describeToken(operand.over)}) resolved to an array, which has no keys to keep. Drop into: \"record\" (the result is an array) or map over a record.`, scope);\n\t\t\tconst rendered = over.map((item, index) => render(index, item));\n\t\t\trenderedKeys.set(rendered, over.map((_, index) => index));\n\t\t\treturn rendered;\n\t\t}\n\t\tif (isPlainObject(over)) {\n\t\t\tconst keys = Object.keys(over).sort();\n\t\t\tif (!into) {\n\t\t\t\tconst rendered = keys.map((key) => render(key, over[key]));\n\t\t\t\trenderedKeys.set(rendered, keys);\n\t\t\t\treturn rendered;\n\t\t\t}\n\t\t\tconst out = {};\n\t\t\tfor (const key of keys) out[key] = render(key, over[key]);\n\t\t\treturn out;\n\t\t}\n\t\treturn this.fail(trail, `is a $map whose over (${describeToken(operand.over)}) resolved to ${JSON.stringify(over)}${into ? `; into: \"record\" needs a record` : \", which is not an array or a record\"}.`, scope);\n\t}\n\titem(operand, trail, scope) {\n\t\treturn this.readItem(operand, trail, scope).value;\n\t}\n\t/** A `$map`'s `over` with the schema describing it, when it reads a\n\t* schema'd `$output` (or an `$item` of a schema'd element). */\n\treadWithSchema(value, trail, scope) {\n\t\tconst key = tokenKeyOf(value);\n\t\tif (isPlainObject(value) && (key === \"$output\" || key === \"$item\") && tokenSchema.safeParse(value).success) return key === \"$output\" ? this.readOutput(value, trail, scope) : this.readItem(value.$item, trail, scope);\n\t\treturn { value: this.value(value, trail, scope) };\n\t}\n\tomit(what) {\n\t\tthis.omitted = what;\n\t\treturn { value: OMIT };\n\t}\n\treadItem(operand, trail, scope) {\n\t\tconst named = isPlainObject(operand) ? operand : void 0;\n\t\tconst name = named && typeof named.as === \"string\" ? named.as : void 0;\n\t\tconst raw = named ? named.path : operand;\n\t\tconst path = pathSegments(Array.isArray(raw) ? raw : []);\n\t\tconst binding = this.binding(name, \"$item\", trail, scope);\n\t\tconst hit = walkPath(binding.item, path);\n\t\tif (!hit.ok) {\n\t\t\tif (binding.schema !== void 0 && isOptionalField(binding.schema, path, hit.at)) return this.omit(\"an absent optional $item field\");\n\t\t\tconst missing = formatPath(path.slice(0, hit.at + 1));\n\t\t\treturn this.fail(trail, `reads $item ${formatPath(path)}, but $map element ${elementText(binding)} has no ${missing} (it has: ${hit.has}).`, scope);\n\t\t}\n\t\treturn {\n\t\t\tvalue: structuredClone(hit.value),\n\t\t\tschema: schemaOf(binding.schema, path)\n\t\t};\n\t}\n\tkey(operand, trail, scope) {\n\t\tconst name = typeof operand === \"string\" ? operand : void 0;\n\t\treturn this.binding(name, \"$key\", trail, scope).key;\n\t}\n\toutput(token, trail, scope = []) {\n\t\treturn this.readOutput(token, trail, scope).value;\n\t}\n\treadOutput(token, trail, scope) {\n\t\tconst operand = token.$output;\n\t\tif (!isPlainObject(operand) || typeof operand.host !== \"string\") return this.fail(trail, \"is a malformed $output token.\", scope);\n\t\tconst ref = typeof operand.member === \"string\" ? {\n\t\t\thost: operand.host,\n\t\t\tmember: operand.member\n\t\t} : { host: operand.host };\n\t\tconst path = pathSegments(Array.isArray(operand.path) ? operand.path : []);\n\t\tif (!this.sources.outputs) return this.fail(trail, `reads ${describeToken(token)}, but no outputs are available here.`, scope);\n\t\tconst lookup = this.sources.outputs.lookup(ref);\n\t\tif (lookup.status === \"unavailable\") {\n\t\t\tconst where = this.sources.where ? `${this.sources.where}: ` : \"\";\n\t\t\tconst path = formatPath(trail);\n\t\t\tconst reason = `${lookup.message}\\n (needed by \\`${path}\\`: ${describeToken(token)})`;\n\t\t\tthrow new TokenResolutionError(`${where}${reason}`, {\n\t\t\t\tpath,\n\t\t\t\treason\n\t\t\t});\n\t\t}\n\t\tconst hit = walkPath(lookup.outputs, path);\n\t\tif (!hit.ok) {\n\t\t\tif (lookup.schema !== void 0 && isOptionalField(lookup.schema, path, hit.at)) return this.omit(\"an absent optional output\");\n\t\t\tconst parent = path.slice(0, hit.at);\n\t\t\tconst container = parent.length ? `outputs.${formatPath(parent)}` : \"its outputs\";\n\t\t\tconst missing = formatPath(path.slice(0, hit.at + 1));\n\t\t\treturn this.fail(trail, `reads ${describeToken(token)}, but host \"${ref.host}\" has no output at ${missing} (${container} has: ${hit.has}).`, scope);\n\t\t}\n\t\treturn {\n\t\t\tvalue: structuredClone(hit.value),\n\t\t\tschema: schemaOf(lookup.schema, path)\n\t\t};\n\t}\n\tenv(operand, trail, scope = []) {\n\t\tconst optional = isPlainObject(operand);\n\t\tconst name = optional ? operand.name : operand;\n\t\tif (typeof name !== \"string\") return this.fail(trail, \"is a malformed $env token.\", scope);\n\t\tconst builtins = this.sources.builtins;\n\t\tif (isBuiltinEnvName(name) && builtins?.[name]) return builtins[name];\n\t\tconst value = this.sources.env?.[name];\n\t\tif (value !== void 0) return value;\n\t\tif (optional) return this.omit(\"an optional $env\").value;\n\t\treturn this.fail(trail, unsetEnvMessage(name), scope);\n\t}\n\tconcat(parts, trail, scope = []) {\n\t\tif (!Array.isArray(parts)) return this.fail(trail, \"is a malformed $concat token.\", scope);\n\t\treturn parts.map((part, index) => {\n\t\t\tconst at = [\n\t\t\t\t...trail,\n\t\t\t\t\"$concat\",\n\t\t\t\tindex\n\t\t\t];\n\t\t\tconst value = this.value(part, at, scope);\n\t\t\tif (value === OMIT) return this.fail(at, `is ${this.omitted} inside $concat.`, scope);\n\t\t\tif (typeof value === \"string\") return value;\n\t\t\tif (typeof value === \"number\") return String(value);\n\t\t\treturn this.fail(at, `resolved to ${JSON.stringify(value)}; every $concat part must be a string or a number.`, scope);\n\t\t}).join(\"\");\n\t}\n};\nfunction resolveHostOutputs(host, sources, options) {\n\tconst resolver = new Resolver(sources, options?.deferSelf);\n\tconst out = resolver.value(host, []);\n\tif (out === OMIT) resolver.fail([], `is ${resolver.omitted} with nothing to omit it from.`);\n\tconst partial = out;\n\tif (!options) return partial;\n\tconst sites = resolver.deferred;\n\treturn {\n\t\thost: partial,\n\t\tdeferred: sites.map((d) => ({\n\t\t\tpath: formatPath(d.trail),\n\t\t\tmembers: d.members\n\t\t})),\n\t\tneeds: [...new Set(sites.flatMap((d) => d.members))],\n\t\tfinish(outputs) {\n\t\t\tconst done = cloneWithProvenance(partial);\n\t\t\tconst late = new Resolver({\n\t\t\t\t...sources,\n\t\t\t\toutputs\n\t\t\t});\n\t\t\tfor (const site of sites) {\n\t\t\t\tconst value = late.token(site.token, site.trail);\n\t\t\t\tif (value === OMIT && typeof site.trail.at(-1) === \"number\") late.fail(site.trail, `is ${late.omitted} inside an array.`);\n\t\t\t\tsetAt(done, site.trail, value === OMIT ? void 0 : value, value === OMIT);\n\t\t\t}\n\t\t\treturn done;\n\t\t}\n\t};\n}\n/**\n* What a one-shot verb (build) gets for a `$map`: no outputs exist there, so\n* every map in `declared` renders no elements (`[]`, or `{}` with into:\n* \"record\") at its path in `host`, the declared-form parse of `declared`.\n* Other tokens stay, as they do in token-able fields.\n*/\nfunction emptyMaps(host, declared) {\n\tconst maps = collectTokenSites(declared).filter((site) => site.key === \"$map\" && site.scopes.length === 0 && site.position !== \"concat\");\n\tif (maps.length === 0) return host;\n\tconst out = cloneWithProvenance(host);\n\tfor (const { path, token } of maps) {\n\t\tconst operand = token.$map;\n\t\tsetAt(out, path, isPlainObject(operand) && operand.into === \"record\" ? {} : [], false);\n\t}\n\treturn out;\n}\nfunction setAt(root, trail, value, omit) {\n\tlet current = root;\n\tfor (const key of trail.slice(0, -1)) if (Array.isArray(current) && typeof key === \"number\") current = current[key];\n\telse if (isPlainObject(current) && typeof key === \"string\") current = current[key];\n\telse return;\n\tconst last = trail[trail.length - 1];\n\tif (Array.isArray(current) && typeof last === \"number\") current[last] = value;\n\telse if (isPlainObject(current) && typeof last === \"string\") {\n\t\tif (omit) delete current[last];\n\t\telse current[last] = value;\n\t}\n}\n//#endregion\n//#region src/runner-resolver.ts\n/**\n* Resolves a host's `runner.module` specifier from the PROJECT's dependency\n* tree (not ph-cli's), imports it, and checks the runner-module contract:\n* `{ run, hostSchema, kind, outputsSchema?, verbs?, ...optionalVerbs }`.\n*/\nvar RunnerError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"RunnerError\";\n\t}\n};\n/** Whether a value is zod-shaped (has a `safeParse` function): a runner's\n* `outputsSchema`, a plugin's config schema. */\nfunction isSchemaLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"safeParse\" in value && typeof value.safeParse === \"function\";\n}\n/** The Connect runner's specifier: compounds forward `cspRegistrySync` to\n* it, and `--explain` prints its dead-config warnings. */\nconst CONNECT_RUNNER = \"@powerhousedao/ph-cli/runners/connect\";\n/** Exports that are part of the contract but are not verbs. */\nconst NON_VERB_EXPORTS = /* @__PURE__ */ new Set([\n\t\"hostSchema\",\n\t\"declaredHostSchema\",\n\t\"outputsSchema\",\n\t\"verbs\",\n\t\"argsSchema\",\n\t\"kind\",\n\t\"checkBoot\",\n\t\"default\"\n]);\n/** ph-cli's runners are ph-run's plus the verbs that build. A packaged app has\n* only ph-run, and its host files, generated against ph-cli's, name ph-cli's. */\nfunction runnerFallback(specifier) {\n\tconst name = /^@powerhousedao\\/ph-cli\\/(runners\\/.+)$/.exec(specifier)?.[1];\n\treturn name ? `@powerhousedao/ph-run/${name}` : void 0;\n}\nasync function resolveRunnerModule(projectRoot, specifier) {\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst resolveFirst = (candidates) => {\n\t\tconst [first, ...rest] = candidates;\n\t\ttry {\n\t\t\treturn projectRequire.resolve(first);\n\t\t} catch (error) {\n\t\t\tif (rest.length === 0) throw error;\n\t\t\treturn resolveFirst(rest);\n\t\t}\n\t};\n\tlet resolved;\n\ttry {\n\t\tconst fallback = runnerFallback(specifier);\n\t\tresolved = resolveFirst(fallback ? [specifier, fallback] : [specifier]);\n\t} catch {\n\t\tthrow new RunnerError(`Cannot resolve runner module \"${specifier}\" from ${projectRoot}.`, \"The runner must be a dependency of the project (install it, then retry).\");\n\t}\n\tconst module = await import(pathToFileURL(resolved).href);\n\tif (typeof module.run !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`run\\` function (required verb).`);\n\tconst hostSchema = module.hostSchema;\n\tif (!hostSchema || typeof hostSchema.safeParse !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`hostSchema\\` — runners validate their own host shape.`);\n\tconst declared = module.declaredHostSchema;\n\tif (declared !== void 0 && typeof declared.safeParse !== \"function\") throw new RunnerError(`Runner \"${specifier}\" exports a \\`declaredHostSchema\\` without safeParse.`);\n\tif (module.checkBoot !== void 0 && typeof module.checkBoot !== \"function\") throw new RunnerError(`Runner \"${specifier}\" exports a \\`checkBoot\\` that is not a function.`);\n\tconst verbs = module.verbs;\n\tif (verbs !== void 0 && (!Array.isArray(verbs) || !verbs.every((verb) => typeof verb === \"string\" && typeof module[verb] === \"function\"))) throw new RunnerError(`Runner \"${specifier}\" exports \\`verbs\\` ${JSON.stringify(verbs)}, which must list names of exported functions.`);\n\tif (!runnerKindSchema.safeParse(module.kind).success) throw new RunnerError(`Runner \"${specifier}\" does not export a valid \\`kind\\` (got ${JSON.stringify(module.kind)}; expected \"reactor\" | \"compound\").`);\n\treturn module;\n}\n/** Verbs that produce something and start nothing (`build`): no outputs, no\n* record, no lock — and no token resolution, since what they read (output\n* dirs, packages) never comes from another host's outputs. Their verb gets\n* the declared host (tokens may remain in token-able fields; a `$map` is\n* the empty collection, see `emptyMaps`). */\nconst ONE_SHOT_VERBS = /* @__PURE__ */ new Set([\"build\"]);\n/** Verbs that work on a host's stores and start nothing (`migrate`,\n* `migrate-status`, `reset`). Their host is resolved as for `run`, so they\n* address the stores `run` opens; they take no lock and return nothing, so\n* no record is written. A compound does not forward them. */\nconst STORE_VERBS = /* @__PURE__ */ new Set([\n\t\"migrate\",\n\t\"migrate-status\",\n\t\"reset\"\n]);\nfunction listVerbs(runner) {\n\tif (runner.verbs) return runner.verbs.filter((name) => typeof runner[name] === \"function\").toSorted();\n\treturn Object.entries(runner).filter(([name, value]) => typeof value === \"function\" && !NON_VERB_EXPORTS.has(name)).map(([name]) => name).sort();\n}\nfunction getVerb(runner, specifier, verb) {\n\tconst candidate = runner[verb];\n\tif (typeof candidate !== \"function\" || !listVerbs(runner).includes(verb)) throw new RunnerError(`Runner \"${specifier}\" does not support the verb \"${verb}\". Supported verbs: ${listVerbs(runner).join(\", \")}.`);\n\treturn candidate;\n}\nfunction isRecord$2(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** reactor XOR children, decided by the runner's declared `kind`. */\nfunction kindShapeIssues(kind, specifier, host) {\n\tif (kind === \"reactor\" && host.children !== void 0) return [{\n\t\tpath: \"children\",\n\t\tmessage: `\"${specifier}\" is a reactor runner, so the host must not declare \\`children\\`.`,\n\t\thint: \"`children` belongs to compound hosts; a reactor host configures its own `reactor` block.\"\n\t}];\n\tif (kind === \"compound\" && host.reactor !== void 0) return [{\n\t\tpath: \"reactor\",\n\t\tmessage: `\"${specifier}\" is a compound runner, so the host must not declare \\`reactor\\`.`,\n\t\thint: \"A compound's reactors are its members': configure them in the member host or a wrapper's `reactor` override.\"\n\t}];\n\treturn [];\n}\nfunction assertKindShape(kind, specifier, host, file) {\n\tconst issue = kindShapeIssues(kind, specifier, host).at(0);\n\tif (issue) throw new RunnerError(`${file}: ${issue.message}`, issue.hint);\n}\n/** `runner.defaultVerb` and every plugin entry's `verbs` must name verbs\n* this runner exports. */\nfunction knownVerbIssues(runner, specifier, host) {\n\tconst options = host.runner;\n\tif (!isRecord$2(options)) return [];\n\tconst verbs = listVerbs(runner);\n\tconst unknownVerb = (verb) => typeof verb === \"string\" && !verbs.includes(verb);\n\tconst issues = [];\n\tif (unknownVerb(options.defaultVerb)) issues.push({\n\t\tpath: \"runner.defaultVerb\",\n\t\tmessage: `runner.defaultVerb \"${options.defaultVerb}\" is not a verb of \"${specifier}\". Supported verbs: ${verbs.join(\", \")}.`\n\t});\n\t(Array.isArray(options.plugins) ? options.plugins : []).forEach((entry, index) => {\n\t\tif (!isRecord$2(entry) || !Array.isArray(entry.verbs)) return;\n\t\tconst scoped = entry.verbs;\n\t\tfor (const bad of scoped.filter(unknownVerb)) issues.push({\n\t\t\tpath: `runner.plugins[${index}].verbs`,\n\t\t\tmessage: `plugin \"${String(entry.module)}\" is scoped to verb \"${bad}\", which \"${specifier}\" does not export. Supported verbs: ${verbs.join(\", \")}.`\n\t\t});\n\t});\n\treturn issues;\n}\nfunction formatIssues(issues) {\n\treturn issues.map((i) => ` - ${i.path}: ${i.message}`).join(\"\\n\");\n}\nfunction valueAt(host, path) {\n\tlet current = host;\n\tfor (const key of path) if (Array.isArray(current) && typeof key === \"number\") current = current[key];\n\telse if (isRecord$2(current) && typeof key === \"string\") current = current[key];\n\telse return;\n\treturn current;\n}\n/**\n* Resolved validation (pipeline step 6): validate a RESOLVED host against\n* its runner's `hostSchema` and return the PARSED host (what the verb\n* receives). Run `resolveHostOutputs` first; a token still present fails\n* with its path.\n*/\nfunction validateHost(runner, specifier, host, file, options = {}) {\n\treturn parseHost(runner, options.tokens === \"allow\" ? runner.declaredHostSchema ?? runner.hostSchema : runner.hostSchema, specifier, host, file, options);\n}\n/** What `validateHost` checks, as data: nothing throws. */\nfunction hostSchemaIssues(runner, schema, specifier, host, options = {}) {\n\tconst issues = [];\n\tif (isRecord$2(host)) {\n\t\tissues.push(...kindShapeIssues(runner.kind, specifier, host));\n\t\tif (options.tokens !== \"allow\") {\n\t\t\tconst token = findToken(host);\n\t\t\tif (token) issues.push({\n\t\t\t\tpath: token.path,\n\t\t\t\tmessage: `\\`${token.path}\\` is an unresolved output token (${token.key}).`,\n\t\t\t\thint: \"Resolve the host (resolveHostOutputs) before validating it for a verb; `ph run` does this.\"\n\t\t\t});\n\t\t}\n\t\tissues.push(...knownVerbIssues(runner, specifier, host));\n\t}\n\tconst result = schema.safeParse(unwrapEscapes(host));\n\tif (result.success) return {\n\t\tissues,\n\t\tdata: result.data\n\t};\n\treturn {\n\t\tissues,\n\t\tschemaIssues: result.error.issues.map((issue) => {\n\t\t\tconst element = describeMapElements(host, issue.path);\n\t\t\tconst dotted = (issue.path.map(String).join(\".\") || \"<root>\") + (element ? ` (${element})` : \"\");\n\t\t\tconst message = issue.code !== \"custom\" && tokenKeyOf(valueAt(host, issue.path)) ? \"this field does not take an output token (it is not token-able); spell the value literally.\" : issue.message;\n\t\t\treturn {\n\t\t\t\tpath: formatPath(issue.path.filter((key) => typeof key === \"string\" || typeof key === \"number\")),\n\t\t\t\tmessage: element ? `${message} (${element})` : message,\n\t\t\t\tprinted: `${dotted}: ${message}`\n\t\t\t};\n\t\t})\n\t};\n}\nfunction parseHost(runner, schema, specifier, host, file, options) {\n\tconst checked = hostSchemaIssues(runner, schema, specifier, host, options);\n\tconst first = checked.issues.at(0);\n\tif (first) throw new RunnerError(`${file}: ${first.message}`, first.hint);\n\tif (checked.schemaIssues) throw new RunnerError(`${file} failed validation against the hostSchema of \"${specifier}\":\\n${checked.schemaIssues.map((issue) => ` - ${issue.printed}`).join(\"\\n\") || \" (no details reported)\"}`);\n\treturn checked.data;\n}\n/**\n* Declared validation (pipeline step 3): the removed cross-host forms\n* (each error names its token form), token shapes and `$env` `optional`\n* placement, `$output` paths against the producers' `outputsSchema`s, then\n* the runner's `declaredHostSchema` (tokens allowed in token-able fields).\n* Reads no environment value and needs no producer running. Throws on the\n* first failing stage; resolve, then `validateHost`, before a verb runs.\n*/\nfunction validateDeclaredHost(runner, specifier, host, file, options = {}) {\n\tconst removed = findRemovedForms(host);\n\tif (removed.length > 0) throw new RunnerError(`${file}: removed form:\\n${formatIssues(removed)}`);\n\tconst issues = checkTokenSites(host);\n\tif (options.outputsSchemaOf) issues.push(...checkOutputPaths(host, options.outputsSchemaOf));\n\tif (issues.length > 0) throw new RunnerError(`${file}: invalid output token:\\n${formatIssues(issues)}`);\n\tif (isRecord$2(host)) assertKindShape(runner.kind, specifier, host, file);\n\tif (!runner.declaredHostSchema) return;\n\tparseHost(runner, runner.declaredHostSchema, specifier, host, file, { tokens: \"allow\" });\n}\n//#endregion\n//#region src/host-loader.ts\n/**\n* Loads and pre-validates a `hosts/<name>/host.js` definition.\n*\n* A host file is a static PROJECTION of powerhouse.config.json: plain ESM,\n* default-exporting a data object. Three gates run before any runner sees it:\n* 1. import lint — the only legal imports are the project's\n* powerhouse.config.json, sibling `../<host>/host.js` files and sibling\n* generated `../<host>/outputs.js` token trees (host files are data, not\n* programs; `process.` is banned, environment values go through `$env`).\n* An imported outputs.js whose schema hash no longer matches its\n* producer fails here (\"run `ph generate hosts`\");\n* 2. static check — the exported object must survive a JSON round trip\n* (functions, undefined, class instances, Dates etc. are rejected,\n* reporting the offending path);\n* 3. shape pre-check — `name`, `runner.module`, and the reactor XOR children\n* rule. Full validation is the runner's `hostSchema` (phase 2).\n*\n* This module never exits the process — callers own error presentation.\n*/\nconst HOST_FILE = \"host.js\";\nconst CONFIG_IMPORT_SUFFIX = \"powerhouse.config.json\";\nvar HostLoadError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"HostLoadError\";\n\t}\n};\n/** A `hosts/` folder with no `<name>/host.js` inside is \"empty\" — the guard\n* state: callers warn loudly and fall back to legacy rather than activating\n* the new architecture off a stray `mkdir hosts`. */\nfunction probeHostsFolder(projectRoot) {\n\tconst dir = path.join(projectRoot, \"hosts\");\n\tif (!existsSync(dir) || !statSync(dir).isDirectory()) return { kind: \"absent\" };\n\tconst hosts = readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(path.join(dir, entry.name, HOST_FILE))).map((entry) => entry.name).sort();\n\treturn hosts.length === 0 ? {\n\t\tkind: \"empty\",\n\t\tdir\n\t} : {\n\t\tkind: \"present\",\n\t\tdir,\n\t\thosts\n\t};\n}\n/** Sibling imports: `../<host>/host.js` — source material for derived\n* compositions (full-inclusion wrappers compute over them with plain JS) —\n* and `../<host>/outputs.js`, the generated `$output` token tree. */\nconst SIBLING_IMPORT = /^\\.\\.\\/([A-Za-z0-9_-]+)\\/(host\\.js|outputs\\.js)$/;\n/** The generated per-host token tree (`ph generate hosts`). */\nconst OUTPUTS_FILE = \"outputs.js\";\nconst GENERATE_HINT = \"Run `ph generate hosts` to (re)generate hosts/<name>/outputs.js from the producer's runner outputsSchema and declared drives.\";\n/**\n* One pass over JS source that blanks every comment and, with\n* `literals: \"blank\"`, the CONTENTS of string literals and template-literal\n* text (quotes, backticks and `${`/`}` kept). A template's `${…}` holes are\n* code: they are scanned like the rest (strings, nested templates and braces\n* inside them included). Every newline survives, so line-anchored checks and\n* line numbers still match the original source. Regex literals are not\n* recognised (host files are data; a regex is not one).\n*/\nfunction scanSource(source, literals) {\n\tconst blank = (text) => text.replace(/[^\\n]/g, \" \");\n\tconst literal = (text) => literals === \"blank\" ? blank(text) : text;\n\tlet out = \"\";\n\tlet i = 0;\n\tconst holes = [];\n\t/** Template text from `i` (just after a backtick or a hole's `}`) up to\n\t* and including its closing backtick, or up to and including the next\n\t* `${` (pushing a hole). */\n\tconst templateText = () => {\n\t\tlet j = i;\n\t\twhile (j < source.length) {\n\t\t\tconst ch = source[j];\n\t\t\tif (ch === \"\\\\\") {\n\t\t\t\tj += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (ch === \"`\") break;\n\t\t\tif (ch === \"$\" && source[j + 1] === \"{\") break;\n\t\t\tj++;\n\t\t}\n\t\tout += literal(source.slice(i, Math.min(j, source.length)));\n\t\tif (j >= source.length) i = source.length;\n\t\telse if (source[j] === \"`\") {\n\t\t\tout += \"`\";\n\t\t\ti = j + 1;\n\t\t} else {\n\t\t\tout += \"${\";\n\t\t\tholes.push(0);\n\t\t\ti = j + 2;\n\t\t}\n\t};\n\twhile (i < source.length) {\n\t\tconst ch = source[i];\n\t\tconst next = source[i + 1];\n\t\tif (ch === \"/\" && next === \"/\") {\n\t\t\tconst end = source.indexOf(\"\\n\", i);\n\t\t\tconst stop = end === -1 ? source.length : end;\n\t\t\tout += blank(source.slice(i, stop));\n\t\t\ti = stop;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"/\" && next === \"*\") {\n\t\t\tconst end = source.indexOf(\"*/\", i + 2);\n\t\t\tconst stop = end === -1 ? source.length : end + 2;\n\t\t\tout += blank(source.slice(i, stop));\n\t\t\ti = stop;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"\\\"\" || ch === \"'\") {\n\t\t\tlet j = i + 1;\n\t\t\twhile (j < source.length && source[j] !== ch && source[j] !== \"\\n\") j += source[j] === \"\\\\\" ? 2 : 1;\n\t\t\tconst close = source[j] === ch ? ch : \"\";\n\t\t\tout += ch + literal(source.slice(i + 1, Math.min(j, source.length)));\n\t\t\tout += close;\n\t\t\ti = close ? j + 1 : j;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"`\") {\n\t\t\tout += \"`\";\n\t\t\ti++;\n\t\t\ttemplateText();\n\t\t\tcontinue;\n\t\t}\n\t\tif (holes.length > 0 && ch === \"{\") holes[holes.length - 1]++;\n\t\tif (holes.length > 0 && ch === \"}\") {\n\t\t\tif (holes[holes.length - 1] === 0) {\n\t\t\t\tholes.pop();\n\t\t\t\tout += \"}\";\n\t\t\t\ti++;\n\t\t\t\ttemplateText();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tholes[holes.length - 1]--;\n\t\t}\n\t\tout += ch;\n\t\ti++;\n\t}\n\treturn out;\n}\n/** Blank out `//` and block comments, keeping string and template literals\n* (URLs contain `//`) and every newline, so line-anchored checks still see\n* the code's own lines. A JSDoc `import(\"…\")` type is a comment, not code. */\nfunction stripComments(source) {\n\treturn scanSource(source, \"keep\");\n}\n/** Blank out comments and the contents of string literals and\n* template-literal text, so a word inside a string (a URL, a description,\n* an apostrophe in template text) is neither mistaken for code nor able to\n* hide code. Template `${…}` holes are code and are kept. */\nfunction blankLiterals(source) {\n\treturn scanSource(source, \"blank\");\n}\nconst PROCESS_ACCESS = /(?<![.\\w$])process\\s*(?:\\?\\.|\\.|\\[)/;\n/** Host files and generated outputs.js are data: reading the environment\n* through `process.` is banned (typed-host-configs decision 9). Environment\n* values go through `$env`, which resolves at start in the resolving\n* process. Comments are already stripped, so a mention there is fine. */\nfunction rejectProcessAccess(source, file) {\n\tconst match = PROCESS_ACCESS.exec(blankLiterals(source));\n\tif (!match) return;\n\tconst line = source.slice(0, match.index).split(\"\\n\").length;\n\tthrow new HostLoadError(`${file}:${line} reads \\`process.\\` — host files cannot read the environment directly.`, \"Use an $env token instead: { $env: \\\"NAME\\\" } (fails when unset), or { $env: { name: \\\"NAME\\\", optional: true } } as a property value to omit the property when unset. It resolves when the host starts.\");\n}\n/** Lints a host file and returns what it imports. Rejects every import\n* except the project's powerhouse.config.json, SIBLING host files (R1:\n* derived compositions) and sibling generated outputs.js token trees; any\n* dynamic `import(...)` or `require(...)`; and any `process.` access.\n* Source-level enforcement: the JSON round trip below is the hard gate; this\n* one produces the better error. */\nfunction scanHostImports(rawSource, file) {\n\tconst source = stripComments(rawSource);\n\tconst imports = {\n\t\thosts: [],\n\t\toutputs: []\n\t};\n\tfor (const match of source.matchAll(/^\\s*import\\b[^;'\"]*?from\\s+[\"']([^\"']+)[\"']/gm)) {\n\t\tconst specifier = match[1];\n\t\tif (specifier.endsWith(CONFIG_IMPORT_SUFFIX)) continue;\n\t\tconst sibling = SIBLING_IMPORT.exec(specifier);\n\t\tif (sibling) {\n\t\t\t(sibling[2] === HOST_FILE ? imports.hosts : imports.outputs).push(sibling[1]);\n\t\t\tcontinue;\n\t\t}\n\t\tthrow new HostLoadError(`${file} imports \"${specifier}\" — a host file may only import the project's powerhouse.config.json, sibling hosts/<name>/host.js files or generated hosts/<name>/${OUTPUTS_FILE} token trees.`, \"Host files are static projections; code belongs in plugins or the runner.\");\n\t}\n\tif (/^\\s*import\\s+[\"']/m.test(source)) throw new HostLoadError(`${file} contains a side-effect import — a host file may only import the project's powerhouse.config.json or sibling host files.`);\n\tif (/\\bimport\\s*\\(/.test(source) || /\\brequire\\s*\\(/.test(source)) throw new HostLoadError(`${file} uses dynamic import()/require() — host files are static data.`);\n\trejectProcessAccess(source, file);\n\treturn imports;\n}\n/** {@link scanHostImports}, returning only the sibling host names (for cycle\n* detection). */\nfunction lintHostImports(rawSource, file) {\n\treturn scanHostImports(rawSource, file).hosts;\n}\n/** A generated `outputs.js` is plain data: no imports of any kind, no\n* dynamic import/require, no `process.`. */\nfunction lintOutputsFile(rawSource, file) {\n\tconst source = stripComments(rawSource);\n\tif (/^\\s*import\\b/m.test(source) || /^\\s*export\\b[^;]*?\\bfrom\\s+[\"']/m.test(source) || /\\bimport\\s*\\(/.test(source) || /\\brequire\\s*\\(/.test(source)) throw new HostLoadError(`${file} imports a module — a generated ${OUTPUTS_FILE} is plain data.`, \"Regenerate it with `ph generate hosts` instead of editing it.\");\n\trejectProcessAccess(source, file);\n}\n/** Walks the sibling-import graph from `hostName`, linting every visited file\n* (and every outputs.js it imports) and failing on a cycle (an ESM circular\n* would otherwise surface as an undefined default export with no useful\n* message). Returns the hosts whose outputs.js the graph imports, sorted. */\nfunction lintHostImportGraph(hostsDir, hostName) {\n\tconst state = /* @__PURE__ */ new Map();\n\tconst producers = /* @__PURE__ */ new Set();\n\tconst visit = (name, chain) => {\n\t\tconst mark = state.get(name);\n\t\tif (mark === \"done\") return;\n\t\tif (mark === \"visiting\") throw new HostLoadError(`Host import cycle: ${[...chain, name].map((n) => `hosts/${n}`).join(\" -> \")}.`, \"Hoist the shared data into one host (or powerhouse.config.json) instead of importing both ways.\");\n\t\tconst file = path.join(hostsDir, name, HOST_FILE);\n\t\tif (!existsSync(file)) throw new HostLoadError(`hosts/${chain[chain.length - 1] ?? name} imports sibling \"hosts/${name}/host.js\", which does not exist.`);\n\t\tstate.set(name, \"visiting\");\n\t\tconst imports = scanHostImports(readFileSync(file, \"utf8\"), file);\n\t\tfor (const producer of imports.outputs) {\n\t\t\tif (producers.has(producer)) continue;\n\t\t\tconst outputsFile = path.join(hostsDir, producer, OUTPUTS_FILE);\n\t\t\tif (!existsSync(outputsFile)) throw new HostLoadError(`hosts/${name}/host.js imports \"hosts/${producer}/${OUTPUTS_FILE}\", which does not exist.`, GENERATE_HINT);\n\t\t\tlintOutputsFile(readFileSync(outputsFile, \"utf8\"), outputsFile);\n\t\t\tproducers.add(producer);\n\t\t}\n\t\tfor (const sibling of imports.hosts) visit(sibling, [...chain, name]);\n\t\tstate.set(name, \"done\");\n\t};\n\tvisit(hostName, []);\n\treturn [...producers].sort();\n}\n/** Returns the path of the first value that would not survive a JSON round\n* trip, or undefined when the object is fully static. */\nfunction findNonStaticValue(value, trail = \"\") {\n\tif (value === null) return void 0;\n\tconst kind = typeof value;\n\tif (kind === \"string\" || kind === \"number\" || kind === \"boolean\") return;\n\tif (kind !== \"object\") return `${trail || \"<root>\"} (${kind})`;\n\tif (Array.isArray(value)) {\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tconst hit = findNonStaticValue(value[i], `${trail}[${i}]`);\n\t\t\tif (hit) return hit;\n\t\t}\n\t\treturn;\n\t}\n\tconst proto = Object.getPrototypeOf(value);\n\tif (proto !== Object.prototype && proto !== null) return `${trail || \"<root>\"} (non-plain object)`;\n\tfor (const [key, child] of Object.entries(value)) {\n\t\tconst hit = findNonStaticValue(child, trail ? `${trail}.${key}` : key);\n\t\tif (hit) return hit;\n\t}\n}\nfunction assertHostShape(host, file) {\n\tif (typeof host.name !== \"string\" || host.name.length === 0) throw new HostLoadError(`${file}: \\`name\\` must be a non-empty string.`);\n\tconst runner = host.runner;\n\tif (runner === null || typeof runner !== \"object\" || typeof runner.module !== \"string\") throw new HostLoadError(`${file}: \\`runner\\` must be an object with a \\`module\\` specifier string.`);\n\tif (host.reactor !== void 0 && host.children !== void 0) throw new HostLoadError(`${file}: \\`reactor\\` and \\`children\\` are mutually exclusive — a host is a reactor runner or a compound runner, never both.`);\n}\nasync function loadHost(projectRoot, hostName) {\n\treturn importHost(projectRoot, hostName, true);\n}\nasync function importHost(projectRoot, hostName, checkOutputs) {\n\tconst probe = probeHostsFolder(projectRoot);\n\tif (probe.kind === \"absent\") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, \"New projects get one from `ph init`; in an existing project, create hosts/<name>/host.js.\");\n\tif (probe.kind === \"empty\") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, \"An empty hosts/ folder defines no hosts; add a host definition or remove the folder.\");\n\tif (!probe.hosts.includes(hostName)) throw new HostLoadError(`Unknown host \"${hostName}\". Available hosts: ${probe.hosts.join(\", \")}.`);\n\tconst file = path.join(probe.dir, hostName, HOST_FILE);\n\tconst producers = lintHostImportGraph(probe.dir, hostName);\n\tif (checkOutputs) for (const producer of producers) await assertOutputsFileFresh(projectRoot, probe.dir, hostName, producer);\n\tconst host = (await import(pathToFileURL(file).href)).default;\n\tif (host === null || typeof host !== \"object\" || Array.isArray(host)) throw new HostLoadError(`${file} must default-export the host object (\\`export default { name, runner, ... }\\`).`);\n\tconst nonStatic = findNonStaticValue(host);\n\tif (nonStatic) throw new HostLoadError(`${file} exports a non-static value at \\`${nonStatic}\\` — host files must survive a JSON round trip.`, \"Runtime behavior belongs in the runner; host files only carry data.\");\n\tassertHostShape(host, file);\n\treturn {\n\t\tname: hostName,\n\t\tdir: path.dirname(file),\n\t\tfile,\n\t\thost\n\t};\n}\nconst OUTPUTS_HASH_EXPORT = /^export const outputsHash = \"([^\"]+)\";$/m;\n/** The hash a generated outputs.js carries, or undefined. */\nfunction readOutputsFileHash(source) {\n\treturn OUTPUTS_HASH_EXPORT.exec(source)?.[1];\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value !== null && typeof value === \"object\") return `{${Object.entries(value).filter(([, child]) => child !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, child]) => `${JSON.stringify(key)}:${canonicalJson(child)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\n/** sha256 over the canonical JSON of the generator's inputs. The host name\n* is one: every token in the file carries it, so a copied or renamed host\n* folder makes its outputs.js stale. */\nfunction computeOutputsHash(input) {\n\treturn `sha256:${createHash(\"sha256\").update(canonicalJson({\n\t\tv: 1,\n\t\thost: input.host,\n\t\trunnerModule: input.runnerModule,\n\t\toutputsSchema: input.outputsSchema,\n\t\tdrives: [...new Set(input.drives)].sort()\n\t})).digest(\"hex\").slice(0, 32)}`;\n}\nfunction isZodSchema(value) {\n\treturn value !== null && typeof value === \"object\" && \"_zod\" in value;\n}\nfunction isRecord$1(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n/** Local (non-remote) slugs from a drive declaration list. */\nfunction localDriveSlugs(drives) {\n\tif (!Array.isArray(drives)) return [];\n\treturn drives.flatMap((drive) => isRecord$1(drive) && typeof drive.slug === \"string\" && drive.remote === void 0 ? [drive.slug] : []);\n}\n/**\n* Describes the outputs a host's creation produces, for `ph generate hosts`\n* and the loader's staleness check: the runner's `outputsSchema` as JSON\n* Schema and the host's declared local drives (the keys `drives.<slug>` of a\n* switchboard-like runner). Returns undefined when the runner exports no\n* `outputsSchema` (the host produces nothing a token can reference).\n*\n* Plugin-contributed drives are collected across every verb (verb scoping\n* is ignored: a drive any verb serves is referenceable). Plugins the project\n* tree cannot resolve contribute nothing, exactly as at boot. The implicit\n* default drive a switchboard serves when it declares none is NOT a known\n* key (it is not declared); reach it with a literal `$output` token.\n*/\nasync function describeHostOutputs(projectRoot, hostName) {\n\tconst { host, file } = await importHost(projectRoot, hostName, false);\n\tconst runnerModule = host.runner.module;\n\tconst schema = (await resolveRunnerModule(projectRoot, runnerModule)).outputsSchema;\n\tif (!isZodSchema(schema)) return void 0;\n\tconst { $schema: _dialect, ...outputsSchema } = z.toJSONSchema(schema, {\n\t\tio: \"output\",\n\t\tunrepresentable: \"any\"\n\t});\n\tconst reactor = host.reactor;\n\tconst drives = localDriveSlugs(isRecord$1(reactor) ? reactor.drives : []);\n\tconst entries = (host.runner.plugins ?? []).map((entry) => typeof entry === \"string\" ? entry : {\n\t\t...entry,\n\t\tverbs: \"*\"\n\t});\n\tif (entries.length > 0) {\n\t\tconst plan = await resolvePluginContributions(projectRoot, \"*\", entries, path.relative(projectRoot, file));\n\t\tdrives.push(...localDriveSlugs(plan.drives.map((drive) => drive.declaration)));\n\t}\n\tconst sortedDrives = [...new Set(drives)].sort();\n\treturn {\n\t\thost: hostName,\n\t\trunnerModule,\n\t\toutputsSchema,\n\t\tdrives: sortedDrives,\n\t\thash: computeOutputsHash({\n\t\t\thost: hostName,\n\t\t\trunnerModule,\n\t\t\toutputsSchema,\n\t\t\tdrives: sortedDrives\n\t\t})\n\t};\n}\nasync function assertOutputsFileFresh(projectRoot, hostsDir, consumer, producer) {\n\tconst rel = `hosts/${producer}/${OUTPUTS_FILE}`;\n\tconst actual = readOutputsFileHash(readFileSync(path.join(hostsDir, producer, OUTPUTS_FILE), \"utf8\"));\n\tif (!existsSync(path.join(hostsDir, producer, HOST_FILE))) throw new HostLoadError(`hosts/${consumer} imports ${rel}, but there is no hosts/${producer}/host.js to produce it.`, \"Delete the orphaned outputs.js and fix the import.\");\n\tconst description = await describeHostOutputs(projectRoot, producer);\n\tif (!description) throw new HostLoadError(`hosts/${consumer} imports ${rel}, but hosts/${producer}'s runner declares no outputsSchema, so it produces no outputs.`);\n\tif (actual !== description.hash) throw new HostLoadError(`${rel} is stale (its producer's outputsSchema or declared drives changed since it was generated); run \\`ph generate hosts\\`.`, actual === void 0 ? `${rel} carries no outputsHash export; it was not generated by \\`ph generate hosts\\`.` : `expected ${description.hash}, found ${actual}.`);\n}\n//#endregion\n//#region src/runner-args.ts\nconst isStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === \"string\");\nconst isStringRecord = (value) => typeof value === \"object\" && value !== null && !Array.isArray(value) && Object.values(value).every((item) => typeof item === \"string\");\nfunction isRunnerArgsSchema(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst schema = value;\n\treturn isStrings(schema.options) && isStrings(schema.flags) && (schema.memberOptions === void 0 || isStringRecord(schema.memberOptions)) && (schema.retired === void 0 || isStringRecord(schema.retired));\n}\nconst OWN_FLAGS = /* @__PURE__ */ new Set([\n\t\"--debug\",\n\t\"--help\",\n\t\"-h\"\n]);\n/**\n* Splits what follows `ph run`. The host and the verb come before the\n* runner's arguments: `ph run` does not know which of those take a value, so\n* a bare word after the first of them belongs to the runner. A literal `--`\n* hands over everything after it.\n*/\nfunction splitRunArgv(args) {\n\tconst result = {\n\t\town: [],\n\t\targv: []\n\t};\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\tif (arg === \"--\") {\n\t\t\tresult.argv.push(...args.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\t\tif (OWN_FLAGS.has(arg) || arg.startsWith(\"--explain=\")) result.own.push(arg);\n\t\telse if (arg === \"--explain\") {\n\t\t\tresult.own.push(...args.slice(i, i + 2));\n\t\t\ti++;\n\t\t} else if (arg.startsWith(\"-\") || result.argv.length > 0) result.argv.push(arg);\n\t\telse if (result.host === void 0) result.host = arg;\n\t\telse if (result.verb === void 0) result.verb = arg;\n\t\telse result.argv.push(arg);\n\t}\n\treturn result;\n}\nfunction entriesOf(argv, takesValue, where) {\n\tconst entries = [];\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst token = argv[i];\n\t\tif (token === \"--\") continue;\n\t\tconst equals = token.startsWith(\"-\") ? token.indexOf(\"=\") : -1;\n\t\tconst name = equals === -1 ? token : token.slice(0, equals);\n\t\tif (equals === -1 && takesValue(name)) {\n\t\t\tif (i + 1 >= argv.length) throw new RunnerError(`${where}: ${name} needs a value.`);\n\t\t\tentries.push({\n\t\t\t\tname,\n\t\t\t\ttokens: [token, argv[i + 1]]\n\t\t\t});\n\t\t\ti++;\n\t\t} else entries.push({\n\t\t\tname,\n\t\t\ttokens: [token]\n\t\t});\n\t}\n\treturn entries;\n}\nfunction warnRetired(name, instead) {\n\tconsole.warn(`${name} is retired and has no effect: ${instead}`);\n}\nconst acceptedBy = (schema) => [...schema.options, ...schema.flags];\n/**\n* The arguments a standalone runner receives as `ctx.argv`: `argv` checked\n* against the runner's schema, retired switches warned about and dropped.\n* Nothing is dropped silently: an argument the runner does not accept, or any\n* argument for a runner without a schema, fails.\n*/\nfunction checkRunnerArgv(argv, target) {\n\tif (argv.length === 0) return [];\n\tconst where = `hosts/${target.host}`;\n\tconst schema = target.schema;\n\tif (!isRunnerArgsSchema(schema)) throw new RunnerError(`${where}: its runner ${target.runner} accepts no arguments, but got: ${argv.join(\" \")}`, \"Set these in the host file instead.\");\n\tconst options = new Set(schema.options);\n\tconst accepted = new Set(acceptedBy(schema));\n\tconst kept = [];\n\tconst unknown = [];\n\tfor (const entry of entriesOf(argv, (name) => options.has(name), where)) {\n\t\tconst instead = schema.retired?.[entry.name];\n\t\tif (accepted.has(entry.name)) kept.push(...entry.tokens);\n\t\telse if (instead !== void 0) warnRetired(entry.name, instead);\n\t\telse unknown.push(entry.name);\n\t}\n\tif (unknown.length > 0) throw new RunnerError(`${where}: its runner ${target.runner} does not accept ${unknown.join(\", \")}.`, `It accepts: ${[...accepted].join(\", \") || \"no arguments\"}.`);\n\treturn kept;\n}\n/**\n* A compound's arguments, per member key: each member gets the ones its\n* runner accepts. A member option arrives under its member name\n* (`--switchboard-port 4001` reaches that member as `--port 4001`). An\n* argument no member accepts fails, as does one that would set the same\n* option on several members.\n*/\nfunction splitCompoundArgv(argv, host, members) {\n\tconst perMember = new Map(members.map((m) => [m.key, []]));\n\tif (argv.length === 0) return perMember;\n\tconst where = `hosts/${host}`;\n\tconst schemas = members.flatMap((m) => isRunnerArgsSchema(m.schema) ? [{\n\t\tkey: m.key,\n\t\tschema: m.schema\n\t}] : []);\n\tconst memberNames = /* @__PURE__ */ new Map();\n\tfor (const { schema } of schemas) for (const [alias, option] of Object.entries(schema.memberOptions ?? {})) {\n\t\tconst aliases = memberNames.get(option) ?? [];\n\t\tif (!aliases.includes(alias)) aliases.push(alias);\n\t\tmemberNames.set(option, aliases);\n\t}\n\tconst takesValue = (name) => schemas.some(({ schema }) => schema.options.includes(name) || schema.memberOptions?.[name] !== void 0);\n\tconst warned = /* @__PURE__ */ new Set();\n\tconst unknown = [];\n\tfor (const entry of entriesOf(argv, takesValue, where)) {\n\t\tconst { name, tokens } = entry;\n\t\tconst named = schemas.filter(({ schema }) => schema.memberOptions?.[name] !== void 0);\n\t\tif (named.length > 1) throw new RunnerError(`${where}: ${name} matches the members ${named.map((m) => m.key).join(\", \")}.`, \"Set the option in each member's host file instead.\");\n\t\tif (named.length === 1) {\n\t\t\tconst { key, schema } = named[0];\n\t\t\tconst first = (schema.memberOptions?.[name] ?? name) + tokens[0].slice(name.length);\n\t\t\tperMember.get(key)?.push(first, ...tokens.slice(1));\n\t\t\tcontinue;\n\t\t}\n\t\tconst aliases = memberNames.get(name);\n\t\tif (aliases) throw new RunnerError(`${where}: ${name} does not say which member it is for.`, `Use ${aliases.join(\" or \")}.`);\n\t\tconst takers = schemas.filter(({ schema }) => acceptedBy(schema).includes(name));\n\t\tif (takers.length > 0) {\n\t\t\tfor (const { key } of takers) perMember.get(key)?.push(...tokens);\n\t\t\tcontinue;\n\t\t}\n\t\tconst retired = schemas.find(({ schema }) => schema.retired?.[name] !== void 0);\n\t\tif (retired) {\n\t\t\tif (!warned.has(name)) {\n\t\t\t\twarned.add(name);\n\t\t\t\twarnRetired(name, retired.schema.retired?.[name] ?? \"\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tunknown.push(name);\n\t}\n\tif (unknown.length > 0) {\n\t\tconst accepted = members.map((m) => {\n\t\t\tif (!isRunnerArgsSchema(m.schema)) return ` - ${m.key} (${m.runner}): no arguments`;\n\t\t\tconst schema = m.schema;\n\t\t\tconst scoped = new Set(Object.values(schema.memberOptions ?? {}));\n\t\t\tconst names = [...Object.keys(schema.memberOptions ?? {}), ...acceptedBy(schema).filter((name) => !scoped.has(name))];\n\t\t\treturn ` - ${m.key} (${m.runner}): ${names.join(\", \") || \"no arguments\"}`;\n\t\t});\n\t\tthrow new RunnerError(`${where}: no member accepts ${unknown.join(\", \")}. The members accept:\\n${accepted.join(\"\\n\")}`);\n\t}\n\treturn perMember;\n}\n//#endregion\n//#region src/run-record-schema.ts\n/**\n* `.ph/run/<host>.json`, version 2 (typed-host-configs 3.6): what a running\n* host and its members produced. Validated on read; a v1 (or any invalid)\n* record reads as \"not running\". `projectName` is kept beyond the plan's\n* sketch because the live/foreign probe needs it. `host` is the host's\n* `name` (the file key), not its folder.\n*/\nconst outputsSchema = z.record(z.string(), z.unknown());\nconst runRecordMemberSchema = z.strictObject({\n\t/** The member's host folder (`children.<key>.host`). */\n\thost: z.string().min(1),\n\trunnerModule: z.string().min(1),\n\tkind: runnerKindSchema,\n\tverb: z.string().min(1),\n\toutputs: outputsSchema\n});\nconst runRecordSchema = z.strictObject({\n\tversion: z.literal(2),\n\thost: hostNameSchema,\n\tprojectName: z.string(),\n\tkind: runnerKindSchema,\n\tverb: z.string().min(1),\n\tpid: z.number().int(),\n\tstartedAt: z.string(),\n\t/** Standalone hosts: the runner's outputs. */\n\toutputs: outputsSchema.optional(),\n\t/** Compounds: one entry per started member, keyed by member name. */\n\tmembers: z.record(z.string(), runRecordMemberSchema).optional(),\n\t/** Host-specific extras (e.g. mcpUrl) a runner wants in the record. */\n\textra: z.record(z.string(), z.unknown()).optional()\n});\n//#endregion\n//#region src/run-record.ts\nconst runDir = (projectDir, env = process.env) => path.join(resolvePhDir(projectDir, env), \"run\");\nfunction recordPath(projectDir, hostName, env) {\n\tconst dir = runDir(projectDir, env);\n\tconst file = path.resolve(dir, `${hostName}.json`);\n\tif (!hostNameSchema.safeParse(hostName).success || path.dirname(file) !== path.resolve(dir)) throw new Error(`\"${hostName}\" can't name a run record. ${HOST_NAME_MESSAGE}`);\n\treturn file;\n}\nfunction readRunRecord(projectDir, hostName, env = process.env) {\n\tlet raw;\n\ttry {\n\t\traw = JSON.parse(fs.readFileSync(recordPath(projectDir, hostName, env), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n\tconst parsed = runRecordSchema.safeParse(raw);\n\treturn parsed.success ? parsed.data : void 0;\n}\n/** Every valid v2 record under `.ph/run/` (invalid and v1 files skipped). */\nfunction listRunRecords(projectDir, env = process.env) {\n\tlet files;\n\ttry {\n\t\tfiles = fs.readdirSync(runDir(projectDir, env));\n\t} catch {\n\t\treturn [];\n\t}\n\treturn files.filter((file) => file.endsWith(\".json\")).flatMap((file) => {\n\t\tconst record = readRunRecord(projectDir, file.slice(0, -5), env);\n\t\treturn record ? [record] : [];\n\t});\n}\n/** The project identity the live/foreign probe compares: package.json\n* `name`, else the folder name. */\nfunction readProjectName(projectDir) {\n\ttry {\n\t\tconst pkg = JSON.parse(fs.readFileSync(path.join(projectDir, \"package.json\"), \"utf8\"));\n\t\tif (typeof pkg.name === \"string\" && pkg.name) return pkg.name;\n\t} catch {}\n\treturn path.basename(path.resolve(projectDir));\n}\nfunction writeRunRecord(projectDir, record) {\n\tconst target = recordPath(projectDir, record.host);\n\tconst valid = runRecordSchema.parse(record);\n\tfs.mkdirSync(path.dirname(target), { recursive: true });\n\tfs.writeFileSync(target, `${JSON.stringify(valid, null, 2)}\\n`);\n}\nfunction clearRunRecord(projectDir, hostName, env = process.env) {\n\ttry {\n\t\tfs.rmSync(recordPath(projectDir, hostName, env));\n\t} catch {}\n}\nfunction isPidAlive(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error.code === \"EPERM\";\n\t}\n}\n/** When a process started, in ms since the epoch; undefined when the\n* platform does not tell (the process is gone, the tool is missing). */\nfunction processStartedAtMs(pid) {\n\ttry {\n\t\tif (process.platform === \"linux\") {\n\t\t\tconst stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n\t\t\tconst ticks = Number(stat.slice(stat.lastIndexOf(\")\") + 2).split(\" \")[19]);\n\t\t\tconst boot = /^btime (\\d+)$/m.exec(fs.readFileSync(\"/proc/stat\", \"utf8\"));\n\t\t\tif (!boot || !Number.isFinite(ticks)) return void 0;\n\t\t\treturn (Number(boot[1]) + ticks / 100) * 1e3;\n\t\t}\n\t\tconst [command, args] = process.platform === \"win32\" ? [\"powershell.exe\", [\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-Command\",\n\t\t\t`(Get-Process -Id ${pid}).StartTime.ToUniversalTime().ToString('o')`\n\t\t]] : [\"ps\", [\n\t\t\t\"-o\",\n\t\t\t\"lstart=\",\n\t\t\t\"-p\",\n\t\t\tString(pid)\n\t\t]];\n\t\tconst out = execFileSync(command, args, {\n\t\t\tencoding: \"utf8\",\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n\t\t\t\t\"ignore\"\n\t\t\t],\n\t\t\ttimeout: 1e4,\n\t\t\twindowsHide: true,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tLC_ALL: \"C\"\n\t\t\t}\n\t\t}).trim();\n\t\tconst started = Date.parse(out);\n\t\treturn Number.isFinite(started) ? started : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\nconst START_SLACK_MS = 5e3;\nconst confirmedRecords = /* @__PURE__ */ new Set();\n/** True when the recorded pid now names another process: one that started\n* after the record was written. False when that cannot be told. */\nfunction isPidReused(record) {\n\tif (record.pid === process.pid) return false;\n\tconst recordedAt = Date.parse(record.startedAt);\n\tif (!Number.isFinite(recordedAt)) return false;\n\tconst key = `${record.pid}:${record.startedAt}`;\n\tif (confirmedRecords.has(key)) return false;\n\tconst startedAt = processStartedAtMs(record.pid);\n\tif (startedAt === void 0) return false;\n\tif (startedAt > recordedAt + START_SLACK_MS) return true;\n\tconfirmedRecords.add(key);\n\treturn false;\n}\n/**\n* Decide whether the recorded instance is this project's live host.\n*\n* pid liveness alone proves nothing (pids are reused): a live pid counts\n* only when its process started before the record was written. The recorded\n* projectName is what separates \"my instance\" from \"a different project that\n* happens to hold this storage root\" — the confusion the vetra lock exists to\n* prevent. A stale record (dead or reused pid) is reported so the caller can\n* clear it; a foreign one (live pid, different project) is left alone.\n*/\nfunction probeRun(projectDir, hostName, projectName, env = process.env) {\n\tconst record = readRunRecord(projectDir, hostName, env);\n\tif (!record) return { status: \"none\" };\n\tif (!isPidAlive(record.pid) || isPidReused(record)) return {\n\t\tstatus: \"stale\",\n\t\trecord\n\t};\n\tif (record.projectName !== projectName) return {\n\t\tstatus: \"foreign\",\n\t\trecord\n\t};\n\treturn {\n\t\tstatus: \"live\",\n\t\trecord\n\t};\n}\n//#endregion\n//#region src/child-wrapper.ts\n/** Generic compound rule: `reactor`/`config` replace, `runner` key-merges. */\nfunction applyChildWrapper(base, wrapper) {\n\tconst reactor = wrapper.reactor ?? base.reactor;\n\tconst config = wrapper.config ?? base.config;\n\treturn {\n\t\t...base,\n\t\trunner: {\n\t\t\t...base.runner,\n\t\t\t...wrapper.runner\n\t\t},\n\t\t...config !== void 0 ? { config } : {},\n\t\t...reactor !== void 0 ? { reactor } : {}\n\t};\n}\n//#endregion\n//#region src/placeholders.ts\n/**\n* `${userData}` resolution for host files (desktop shape): storage paths in a\n* host must not derive from the instance name (renames must stay safe), so\n* the host file writes `${userData}/.ph/reactor-storage` and the RUNNER\n* resolves it at start. `${userData}` is a PROJECT-SHAPED root: its `.ph`\n* subtree carries the same names the classic commands use under\n* `<project>/.ph` (see `resolvePhDir`). In the CLI it IS the project root, so\n* `ph run desktop` in a project shares the one `.ph` tree `ph vetra` uses;\n* a shell (Tauri) points it at the OS profile via PH_USER_DATA_DIR, and the\n* whole `.ph` tree — stores, identity, run records — follows.\n*/\nfunction defaultUserDataDir(projectRoot, env = process.env) {\n\treturn env.PH_USER_DATA_DIR ?? path.resolve(projectRoot);\n}\n/** Deep-substitute `${userData}` in every string of a JSON-shaped value.\n* Non-strings pass through; the input is never mutated. */\nfunction resolveUserDataPlaceholders(value, userData) {\n\treturn substituteBuiltinEnv(value, { userData });\n}\n//#endregion\n//#region src/resolve/node.ts\n/** Load every producer host a set of refs names (each once). */\nasync function loadProducers(projectRoot, refs) {\n\tconst producers = /* @__PURE__ */ new Map();\n\tfor (const { host: folder } of refs) {\n\t\tif (producers.has(folder)) continue;\n\t\ttry {\n\t\t\tconst loaded = await loadHost(projectRoot, folder);\n\t\t\tconst specifier = loaded.host.runner.module;\n\t\t\tproducers.set(folder, {\n\t\t\t\tfolder,\n\t\t\t\tname: loaded.host.name,\n\t\t\t\tspecifier,\n\t\t\t\trunner: await resolveRunnerModule(projectRoot, specifier)\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tproducers.set(folder, { error: `names host \"${folder}\", which cannot be loaded: ${error instanceof Error ? error.message : String(error)}` });\n\t\t}\n\t}\n\treturn producers;\n}\n/** The outputs schema of a runner module, or why it has none. */\nfunction runnerOutputsSchema(runner, specifier, label) {\n\tconst schema = runner.outputsSchema;\n\tif (schema === void 0 || schema === null) return { error: `${label} runs \"${specifier}\", which exports no outputsSchema, so it produces no outputs a token can read.` };\n\treturn {\n\t\tschema,\n\t\tlabel: `\"${specifier}\" (${label})`\n\t};\n}\n/** Declared-validation lookup for a standalone host's producers. */\nfunction producerOutputsSchemas(producers) {\n\treturn (ref) => {\n\t\tconst info = producers.get(ref.host);\n\t\tif (!info) return { error: `names host \"${ref.host}\", which was not loaded.` };\n\t\tif (\"error\" in info) return { error: info.error };\n\t\treturn runnerOutputsSchema(info.runner, info.specifier, `host \"${ref.host}\"`);\n\t};\n}\n/** Further `.ph` roots whose live run records a standalone `$output` reads\n* (`path.delimiter`-separated): a launcher that gives each child its own\n* PH_USER_DATA_DIR names its siblings' here. Locks never read them. */\nconst OUTPUT_DATA_DIRS_ENV = \"PH_OUTPUT_DATA_DIRS\";\n/** The other roots, each once, never the process's own. */\nfunction siblingEnvs(projectRoot, env) {\n\tconst own = path.resolve(defaultUserDataDir(projectRoot, env));\n\treturn [...new Set((env[\"PH_OUTPUT_DATA_DIRS\"] ?? \"\").split(path.delimiter).filter((dir) => dir !== \"\").map((dir) => path.resolve(dir)))].filter((dir) => dir !== own).map((dir) => ({ PH_USER_DATA_DIR: dir }));\n}\n/**\n* Standalone `$output` source: the producer's live v2 run record. Its own\n* standalone record under the process's `.ph` root first (keyed by the\n* producer's `name`); else exactly one of: a standalone record under a\n* PH_OUTPUT_DATA_DIRS root, or a member running that host in a live compound\n* of this project under any root. A missing, stale, foreign or output-less\n* record means \"not running\", and the lookup fails naming the producer and\n* how to start it (no fallback to the producer's declared config, no\n* waiting).\n*/\nfunction runRecordOutputSource(projectRoot, options) {\n\tconst { consumer, producers, projectName } = options;\n\tconst env = options.env ?? process.env;\n\tconst siblings = siblingEnvs(projectRoot, env);\n\treturn { lookup(ref) {\n\t\tconst notRunning = `${consumer} needs outputs from host \"${ref.host}\", which is not running. Start it first: ph run ${ref.host} (or run a compound that includes it).`;\n\t\tconst info = producers.get(ref.host);\n\t\tconst schema = info && !(\"error\" in info) ? info.runner.outputsSchema : void 0;\n\t\tconst withSchema = schema !== void 0 && schema !== null ? { schema } : {};\n\t\tconst standalone = [];\n\t\tif (ref.member === void 0 && info && !(\"error\" in info)) {\n\t\t\tconst probe = probeRun(projectRoot, info.name, projectName, env);\n\t\t\tif (probe.status === \"live\" && probe.record.outputs) return {\n\t\t\t\tstatus: \"available\",\n\t\t\t\toutputs: probe.record.outputs,\n\t\t\t\t...withSchema\n\t\t\t};\n\t\t\tfor (const sibling of siblings) {\n\t\t\t\tconst other = probeRun(projectRoot, info.name, projectName, sibling);\n\t\t\t\tif (other.status === \"live\" && other.record.outputs) standalone.push({\n\t\t\t\t\tlabel: `\"${info.name}\" (pid ${other.record.pid})`,\n\t\t\t\t\toutputs: other.record.outputs\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst members = [env, ...siblings].flatMap((root) => listRunRecords(projectRoot, root)).filter((record) => record.members !== void 0 && record.projectName === projectName && isPidAlive(record.pid)).flatMap((record) => Object.entries(record.members ?? {}).filter(([key, member]) => member.host === ref.host && (ref.member === void 0 || key === ref.member)).map(([key, member]) => ({\n\t\t\tlabel: `member \"${key}\" of \"${record.host}\"`,\n\t\t\toutputs: member.outputs\n\t\t})));\n\t\tconst found = [...standalone, ...members];\n\t\tif (found.length === 1) return {\n\t\t\tstatus: \"available\",\n\t\t\toutputs: found[0].outputs,\n\t\t\t...withSchema\n\t\t};\n\t\tif (found.length > 1) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `${consumer} needs outputs from host \"${ref.host}\", which runs as ${found.map((m) => m.label).join(\" and \")}; stop all but one, or run ${ref.host} on its own.`\n\t\t};\n\t\treturn {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: notRunning\n\t\t};\n\t} };\n}\n/** The resolving process's `$env` inputs: its environment plus the\n* always-resolvable built-ins (`userData` honours PH_USER_DATA_DIR). */\nfunction processResolveEnv(projectRoot, env = process.env) {\n\treturn {\n\t\tenv,\n\t\tbuiltins: {\n\t\t\tuserData: defaultUserDataDir(projectRoot, env),\n\t\t\tprojectRoot: path.resolve(projectRoot)\n\t\t}\n\t};\n}\n//#endregion\n//#region src/resolve/sources.ts\n/**\n* The compound output source: a member's `$output` tokens read the live\n* `RunnerHandle.outputs` of the members started before it. `schemas` (member\n* key → its runner's `outputsSchema`) lets an absent optional output field\n* omit the consuming property. Pure (the run-record source for standalone\n* hosts is node: ./node.ts).\n*/\nfunction compoundOutputSource(members, started, compound, schemas) {\n\treturn { lookup(ref) {\n\t\tconst target = memberForRef(ref, members);\n\t\tif (\"error\" in target) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `compound \"${compound}\": a token ${target.error}`\n\t\t};\n\t\tif (!started.has(target.key)) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `compound \"${compound}\": member \"${target.key}\" (host \"${ref.host}\") has not started yet; a producer must start before its consumers.`\n\t\t};\n\t\tconst schema = schemas?.get(target.key);\n\t\treturn {\n\t\t\tstatus: \"available\",\n\t\t\toutputs: started.get(target.key),\n\t\t\t...schema !== void 0 ? { schema } : {}\n\t\t};\n\t} };\n}\n//#endregion\n//#region src/runner-handle.ts\n/** The data half of a handle, validated by the compound. `ready`/`shutdown`\n* are functions and promises, so they are checked as TS fields, not here. */\nconst runnerHandleSchema = z.looseObject({ outputs: z.record(z.string(), z.unknown()).optional() });\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction isPromiseLike(value) {\n\treturn isRecord(value) && typeof value.then === \"function\";\n}\nfunction isCallable(value) {\n\treturn typeof value === \"function\";\n}\n/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)\n* is an empty handle; anything else must match runnerHandleSchema. */\nfunction toStartedHandle(value, where) {\n\tif (value === void 0 || value === null) return { outputs: {} };\n\tconst parsed = runnerHandleSchema.safeParse(value);\n\tif (!parsed.success) throw new Error(`${where} returned an invalid runner handle:\\n${z.prettifyError(parsed.error)}`);\n\tconst live = isRecord(value) ? value : {};\n\tconst shutdown = live.shutdown;\n\treturn {\n\t\t...parsed.data,\n\t\toutputs: parsed.data.outputs ?? {},\n\t\t...isPromiseLike(live.ready) ? { ready: live.ready } : {},\n\t\t...isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}\n\t};\n}\n//#endregion\n//#region src/compound.ts\nasync function memberDraft(projectRoot, member) {\n\treturn applyChildWrapper((await loadHost(projectRoot, member.host)).host, member);\n}\n/** Whether a member receives the compound's `cspRegistrySync` wiring (as\n* `runner.cspRegistrySync`): its runner declares that option (any specifier\n* that reaches the Connect runner), or it names the Connect runner. A\n* member's role is its runner, not its folder. */\nfunction takesCspRegistrySync(m) {\n\treturn m.specifier === \"@powerhousedao/ph-cli/runners/connect\" || declaresKey(m.runner.hostSchema, [\"runner\"], \"cspRegistrySync\");\n}\n/**\n* Windows has no SIGTERM, so a supervisor asks a stack to stop through its\n* stdin: a line, or the pipe closing, which also covers the supervisor dying.\n* Only when it asks to: a stack started from a script may have no stdin.\n*/\nfunction stopStreamOf(env, stdin) {\n\treturn env[\"PH_STOP_ON_STDIN\"] === \"1\" ? stdin() : void 0;\n}\nfunction whenStreamStops(stream, stop) {\n\tlet stopped = false;\n\tconst once = () => {\n\t\tif (stopped) return;\n\t\tstopped = true;\n\t\tstop();\n\t};\n\tfor (const event of [\n\t\t\"data\",\n\t\t\"end\",\n\t\t\"close\",\n\t\t\"error\"\n\t]) stream.once(event, once);\n\tstream.resume();\n}\n/** The verb the generic compound starts its members at for its own `verb`:\n* `run` follows the compound's defaultVerb. */\nfunction compoundStartVerb(verb, runner) {\n\treturn verb === \"run\" ? runner.defaultVerb ?? \"run\" : verb;\n}\n/** At compound verb \"run\" each member runs its own (merged) defaultVerb —\n* what lets a desktop compound pair a switchboard at `run` with a connect at\n* `serve`. An explicit forwarded verb stays uniform across members. */\nfunction memberVerbOf(compoundVerb, runner) {\n\treturn compoundVerb === \"run\" ? runner.defaultVerb ?? \"run\" : compoundVerb;\n}\nasync function runCompound(hostInput, ctx, options) {\n\tconst compoundFile = `hosts/${hostInput.name}`;\n\tconst removed = findRemovedForms(hostInput);\n\tif (removed.length > 0) throw new RunnerError(`${compoundFile}: removed form:\\n${removed.map((r) => ` - ${r.path}: ${r.message}`).join(\"\\n\")}`);\n\tconst parsed = declaredGenericCompoundHostSchema.safeParse(hostInput);\n\tif (!parsed.success) throw new Error(`${compoundFile}: invalid compound host:\\n${z.prettifyError(parsed.error)}`);\n\tconst host = parsed.data;\n\tconst projectRoot = ctx.projectRoot;\n\tconst wiring = host.config ?? {};\n\tconst verb = ctx.verb;\n\tconst oneShotCompound = ONE_SHOT_VERBS.has(verb);\n\tconst keepsRecord = wiring.runtimeRecord !== false && !oneShotCompound;\n\tlet stopRequested = false;\n\tlet stopFromStream = () => {\n\t\tstopRequested = true;\n\t};\n\tif (options.stopStream && !oneShotCompound) {\n\t\twhenStreamStops(options.stopStream, () => stopFromStream());\n\t\tconst outputs = options.supervisedOutputs ?? [process.stdout, process.stderr];\n\t\tfor (const output of outputs) output.on(\"error\", () => void 0);\n\t}\n\tconst probe = oneShotCompound ? void 0 : probeRun(projectRoot, host.name, options.projectName);\n\tif (probe?.status === \"live\") throw new Error(`${host.name} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`);\n\tif (probe?.status === \"foreign\") throw new Error(`.ph/run/${host.name}.json describes a live \"${probe.record.projectName}\", but this project is \"${options.projectName}\". Refusing to start a second instance.`);\n\tconst prepared = await prepareMembers(projectRoot, host.children);\n\tconst plan = planCompound(prepared.map((m) => ({\n\t\tkey: m.key,\n\t\thost: m.member.host,\n\t\trefs: outputSitesOf(m.draft).map(({ ref, path }) => ({\n\t\t\tref,\n\t\t\tpath\n\t\t}))\n\t})), wiring.startOrder);\n\tconst byKey = new Map(prepared.map((m) => [m.key, m]));\n\tconst members = prepared.map((m) => ({\n\t\tkey: m.key,\n\t\thost: m.member.host\n\t}));\n\tfor (const m of prepared) validateDeclaredHost(m.runner, m.specifier, m.draft, m.file, { outputsSchemaOf: (ref) => {\n\t\tconst target = memberForRef(ref, members);\n\t\tif (\"error\" in target) return { error: target.error };\n\t\tconst producer = byKey.get(target.key);\n\t\treturn producer ? runnerOutputsSchema(producer.runner, producer.specifier, `member \"${target.key}\"`) : { error: `names member \"${target.key}\", which was not prepared.` };\n\t} });\n\tconst memberArgv = splitCompoundArgv(ctx.argv ?? [], hostInput.name, prepared.map((m) => ({\n\t\tkey: m.key,\n\t\trunner: m.specifier,\n\t\tschema: m.runner.argsSchema\n\t})));\n\tif (wiring.cspRegistrySync && !prepared.some(takesCspRegistrySync)) console.warn(`${compoundFile}: config.cspRegistrySync is set, but no member's runner declares runner.cspRegistrySync (members run: ${prepared.map((m) => m.specifier).join(\", \")}); the baked Connect CSP is not patched for the runtime registry.`);\n\tconst started = [];\n\tconst liveOutputs = /* @__PURE__ */ new Map();\n\tconst outputs = compoundOutputSource(members, liveOutputs, host.name, new Map(prepared.map((m) => [m.key, m.runner.outputsSchema])));\n\tconst resolveEnv = processResolveEnv(projectRoot, ctx.env);\n\tlet stopping;\n\tconst shutdown = () => stopping ??= (async () => {\n\t\tfor (const m of [...started].reverse()) try {\n\t\t\tawait m.handle.shutdown?.();\n\t\t} catch {}\n\t\tif (keepsRecord) clearRunRecord(projectRoot, host.name);\n\t})();\n\ttry {\n\t\tfor (const name of plan.order) {\n\t\t\tconst m = byKey.get(name);\n\t\t\tif (!m) continue;\n\t\t\tconst memberVerb = memberVerbOf(verb, m.draft.runner);\n\t\t\tconst oneShot = ONE_SHOT_VERBS.has(memberVerb);\n\t\t\tconst resolved = oneShot ? substituteBuiltinEnv(m.draft, resolveEnv.builtins ?? {}) : resolveHostOutputs(m.draft, {\n\t\t\t\toutputs,\n\t\t\t\t...resolveEnv,\n\t\t\t\twhere: m.file\n\t\t\t});\n\t\t\tif (wiring.cspRegistrySync && takesCspRegistrySync(m)) resolved.runner = {\n\t\t\t\t...resolved.runner,\n\t\t\t\tcspRegistrySync: true\n\t\t\t};\n\t\t\tconst validated = validateHost(m.runner, m.specifier, resolved, m.file, oneShot ? { tokens: \"allow\" } : {});\n\t\t\tconst fn = getVerb(m.runner, m.specifier, memberVerb);\n\t\t\tconst where = `${name} (${m.specifier} ${memberVerb})`;\n\t\t\tconst argv = memberArgv.get(name) ?? [];\n\t\t\tconst handle = toStartedHandle(await fn(oneShot ? emptyMaps(validated, resolved) : validated, {\n\t\t\t\tprojectRoot,\n\t\t\t\tenv: ctx.env,\n\t\t\t\tverb: memberVerb,\n\t\t\t\tparent: {\n\t\t\t\t\thost: host.name,\n\t\t\t\t\tverb\n\t\t\t\t},\n\t\t\t\t...argv.length > 0 ? { argv } : {}\n\t\t\t}), where);\n\t\t\tstarted.push({\n\t\t\t\tname,\n\t\t\t\tmember: m.member,\n\t\t\t\tspecifier: m.specifier,\n\t\t\t\tkind: m.runner.kind,\n\t\t\t\tverb: memberVerb,\n\t\t\t\thandle,\n\t\t\t\toutputs: handle.outputs\n\t\t\t});\n\t\t\tif (handle.ready) await handle.ready;\n\t\t\tlet memberOutputs = handle.outputs;\n\t\t\tif (!oneShot && isSchemaLike(m.runner.outputsSchema)) {\n\t\t\t\tconst checked = m.runner.outputsSchema.safeParse(handle.outputs);\n\t\t\t\tif (!checked.success) throw new Error(`${where} reported outputs that fail its outputsSchema:\\n${checked.error.issues.map((i) => ` - ${i.path.map(String).join(\".\") || \"<root>\"}: ${i.message}`).join(\"\\n\")}`);\n\t\t\t\tif (!isPlainObject(checked.data)) throw new Error(`${where}: its outputsSchema parsed the outputs to ${JSON.stringify(checked.data)}, not an object.`);\n\t\t\t\tmemberOutputs = checked.data;\n\t\t\t}\n\t\t\tstarted[started.length - 1].outputs = memberOutputs;\n\t\t\tliveOutputs.set(name, memberOutputs);\n\t\t}\n\t} catch (error) {\n\t\tawait shutdown();\n\t\tthrow error;\n\t}\n\tif (keepsRecord) {\n\t\tconst recordMembers = {};\n\t\tfor (const m of started) recordMembers[m.name] = {\n\t\t\thost: m.member.host,\n\t\t\trunnerModule: m.specifier,\n\t\t\tkind: m.kind,\n\t\t\tverb: m.verb,\n\t\t\toutputs: m.outputs\n\t\t};\n\t\twriteRunRecord(projectRoot, {\n\t\t\tversion: 2,\n\t\t\thost: host.name,\n\t\t\tprojectName: options.projectName,\n\t\t\tkind: \"compound\",\n\t\t\tverb,\n\t\t\tpid: process.pid,\n\t\t\tstartedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\tmembers: recordMembers,\n\t\t\t...options.recordExtra ? { extra: options.recordExtra } : {}\n\t\t});\n\t}\n\tconst exit = options.exit ?? ((code) => process.exit(code));\n\tlet signalled;\n\tconst handleSignal = (signal) => {\n\t\tif (signalled) return signalled;\n\t\tconst code = signal === \"SIGINT\" ? 130 : 143;\n\t\tsignalled = shutdown().finally(() => exit(code));\n\t\treturn signalled;\n\t};\n\tif (options.installSignalHandlers !== false) {\n\t\tprocess.on(\"exit\", () => {\n\t\t\tif (keepsRecord) clearRunRecord(projectRoot, host.name);\n\t\t});\n\t\tprocess.on(\"SIGINT\", () => void handleSignal(\"SIGINT\"));\n\t\tprocess.on(\"SIGTERM\", () => void handleSignal(\"SIGTERM\"));\n\t}\n\tstopFromStream = () => {\n\t\tconst limit = options.stopStreamLimitMs ?? 15e3;\n\t\tsetTimeout(() => exit(143), limit).unref();\n\t\thandleSignal(\"SIGTERM\");\n\t};\n\tif (stopRequested) stopFromStream();\n\treturn {\n\t\tstarted,\n\t\tshutdown,\n\t\thandleSignal\n\t};\n}\n/** Load every member's draft and runner, in declaration order. */\nasync function prepareMembers(projectRoot, children) {\n\tconst out = [];\n\tfor (const [key, member] of Object.entries(children)) out.push(await prepareMember(projectRoot, key, member));\n\treturn out;\n}\n/** One member's draft and runner. */\nasync function prepareMember(projectRoot, key, member) {\n\tconst draft = await memberDraft(projectRoot, member);\n\tconst specifier = draft.runner.module;\n\treturn {\n\t\tkey,\n\t\tmember,\n\t\tdraft,\n\t\tspecifier,\n\t\trunner: await resolveRunnerModule(projectRoot, specifier),\n\t\tfile: `hosts/${member.host}/host.js`\n\t};\n}\n//#endregion\nexport { knownVerbIssues as $, reactorSchema as $t, splitCompoundArgv as A, entryActiveForVerb as An, HOST_NAME_MAX_LENGTH as At, loadHost as B, runObserveHookSequential as Bn, defineHostSchemas as Bt, readProjectName as C, tokenable as Cn, collectTokenSites as Ct, runRecordSchema as D, resolveHostPlugins as Dn, renderTokens as Dt, runRecordMemberSchema as E, findDeadConnectConfig as En, isPlainObject as Et, describeHostOutputs as F, pluginEntryObjectSchema as Fn, compoundHostSchema as Ft, CONNECT_RUNNER as G, makeHostSchemas as Gt, readOutputsFileHash as H, runTransformHook as Hn, emittedHostSchemas as Ht, findNonStaticValue as I, pluginEntrySchema as In, compoundWiringSchema as It, STORE_VERBS as J, profileSchema as Jt, ONE_SHOT_VERBS as K, originOrUrlSchema as Kt, lintHostImportGraph as L, registerHostType as Ln, connectReactorIssues as Lt, HostLoadError as M, mergeContributions as Mn, HOST_NAME_PATTERN as Mt, OUTPUTS_FILE as N, normalizePluginEntries as Nn, childWrapperSchema as Nt, checkRunnerArgv as O, resolvePluginContributions as On, unwrapEscapes as Ot, computeOutputsHash as P, normalizePluginEntry as Pn, childrenSchema as Pt, kindShapeIssues as Q, reactorProtocolSchema as Qt, lintHostImports as R, resolveOrder as Rn, declaredGenericCompoundHostSchema as Rt, probeRun as S, tokenSchema as Sn, schemaAtPath as St, writeRunRecord as T, defaultConnectComposition as Tn, formatPath as Tt, scanHostImports as U, genericCompoundHostSchema as Ut, probeHostsFolder as V, runProvideHook as Vn, emitHostJsonSchema as Vt, stripComments as W, hostNameSchema as Wt, hostSchemaIssues as X, reactorBackendSchema as Xt, getVerb as Y, reactorBackendKindSchema as Yt, isSchemaLike as Z, reactorHostSchema as Zt, resolveUserDataPlaceholders as _, keyTokenSchema as _n, checkTokenSites as _t, stopStreamOf as a, driveDeclarationSchema as an, describeMapElements as at, isPidAlive as b, ref as bn, outputSitesOf as bt, toStartedHandle as c, TOKEN_ESCAPE_KEY as cn, unsetEnvMessage as ct, loadProducers as d, envTokenSchema as dn, planCompound as dt, refineConnectReactor as en, listVerbs as et, processResolveEnv as f, envTokenable as fn, BUILTIN_ENV_NAMES as ft, defaultUserDataDir as g, itemTokenSchema as gn, checkOutputPaths as gt, runnerOutputsSchema as h, isToken as hn, findRemovedForms as ht, runCompound as i, buildDriveDeclarationSchema as in, TokenResolutionError as it, splitRunArgv as j, hostTypeSatisfies as jn, HOST_NAME_MESSAGE as jt, isRunnerArgsSchema as k, PluginError as kn, CONNECT_PRIMARY_MESSAGE as kt, compoundOutputSource as l, TOKEN_KEYS as ln, PlanError as lt, runRecordOutputSource as m, forbidRef as mn, substituteBuiltinEnv as mt, memberVerbOf as n, runnerBaseSchema as nn, validateDeclaredHost as nt, takesCspRegistrySync as o, drivesSchema as on, emptyMaps as ot, producerOutputsSchemas as p, findToken as pn, isBuiltinEnvName as pt, RunnerError as q, placementKeyIssues as qt, prepareMember as r, runnerKindSchema as rn, validateHost as rt, runnerHandleSchema as s, projectDriveIdWith as sn, resolveHostOutputs as st, compoundStartVerb as t, refineStartOrder as tn, resolveRunnerModule as tt, OUTPUT_DATA_DIRS_ENV as u, concatTokenSchema as un, memberForRef as ut, applyChildWrapper as v, mapTokenSchema as vn, envSitesOf as vt, readRunRecord as w, CONNECT_PLUGIN_OWNED_SLICES as wn, describeToken as wt, listRunRecords as x, tokenKeyOf as xn, refKey as xt, clearRunRecord as y, outputTokenSchema as yn, outputRefsOf as yt, lintOutputsFile as z, runObserveHook as zn, declaredHostSchemas as zt };\n\n//# sourceMappingURL=compound-CDrU3CLt.mjs.map"],"names":["z.strictObject","z.string","z.boolean","z.union","z.literal","z.array","z.record","z.unknown","z.prettifyError","z.enum","z.url","z.number","z.looseObject","z.ZodType","z.toJSONSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAI,cAAc,cAAc,MAAM;CACrC,YAAY,SAAS,MAAM;EAC1B,MAAM,OAAO,GAAG,QAAQ,YAAY,SAAS,OAAO;EACpD,KAAK,OAAO;CACb;AACD;AACA,MAAM,0BAA0BA,aAAe;CAC9C,QAAQC,OAAS,CAAC,CAAC,IAAI,CAAC;;CAExB,SAASC,QAAU,CAAC,CAAC,SAAS;;CAE9B,OAAOC,MAAQ,CAACC,QAAU,GAAG,GAAGC,MAAQJ,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;;CAE7E,QAAQK,OAASL,OAAS,GAAGM,QAAU,CAAC,CAAC,CAAC,SAAS;AACpD,CAAC;AACD,MAAM,oBAAoBJ,MAAQ,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;CAC3C,OAAO,iBAAiB,QAAQ,OAAO,eAAe,QAAQ;AAC/D;;AA0KA,eAAe,cAAc,aAAa,KAAK,QAAQ;CACtD,MAAM,QAAQ,MAAM,YAAY,aAAa,MAAM;CACnD,MAAM,YAAY,MAAM,OAAO;CAC/B,OAAO;EACN;EACA;EACA;EACA;EACA,QAAQ,MAAM,oBAAoB,aAAa,SAAS;EACxD,MAAM,SAAS,OAAO,KAAK;CAC5B;AACD","debug_id":"d43c0b0e-6360-5620-9abd-7ec5d960264a"}
1
+ {"version":3,"file":"compound-DKi56SSx-CXQHhS6t.mjs","sources":["../../../packages/host-core/dist/compound-DKi56SSx.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { createHash } from \"node:crypto\";\nimport fs, { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\nimport { TOKEN_ESCAPE_KEY, TOKEN_KEYS, concatTokenSchema, envTokenSchema, envTokenable, findToken, forbidRef, isToken, itemTokenSchema, keyTokenSchema, mapTokenSchema, outputTokenSchema, ref, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable } from \"@powerhousedao/shared/host-tokens\";\nimport { isOriginPlaceholderUrl } from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport { execFileSync } from \"node:child_process\";\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\n//#region src/plugins-resolve.ts\n/**\n* NODE-ONLY plugin resolution (split from plugins.ts so the pure runner core\n* stays browser-safe for ConnectCore — R3). Resolves host.js entries from the\n* PROJECT dependency tree, exactly like runner modules.\n*/\nfunction isHostPluginShape(value) {\n\treturn value !== null && typeof value === \"object\" && typeof value.name === \"string\";\n}\n/**\n* Resolve host.js plugin entries into live plugins for one host boot:\n* verb-filter → module resolution from the project tree (default condition,\n* like runners) → factory/object contract → config validation → appliesTo.\n*/\nasync function resolveHostPlugins(projectRoot, hostType, verb, entries, where) {\n\tconst normalized = normalizePluginEntries(entries, where);\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst resolved = [];\n\tfor (const entry of normalized) {\n\t\tif (!entryActiveForVerb(entry, verb)) continue;\n\t\tlet file;\n\t\ttry {\n\t\t\tfile = projectRequire.resolve(entry.module);\n\t\t} catch {\n\t\t\tthrow new PluginError(`${where}: cannot resolve plugin \"${entry.module}\" from ${projectRoot}.`, \"Plugins resolve from the project dependency tree, exactly like runner modules.\");\n\t\t}\n\t\tconst exported = (await import(pathToFileURL(file).href)).default;\n\t\tlet plugin;\n\t\tif (typeof exported === \"function\") plugin = exported(entry.config);\n\t\telse if (isHostPluginShape(exported)) {\n\t\t\tif (Object.keys(entry.config).length > 0 && !exported.configSchema) throw new PluginError(`${where}: plugin \"${entry.module}\" takes no config, but the entry passes one.`);\n\t\t\tplugin = exported;\n\t\t} else throw new PluginError(`${where}: \"${entry.module}\" does not default-export a plugin object or factory.`, \"Export `{ name, hooks?, contributions? }` or `(config) => plugin`.\");\n\t\tif (plugin.configSchema) {\n\t\t\tconst parsed = plugin.configSchema.safeParse(entry.config);\n\t\t\tif (!parsed.success) throw new PluginError(`${where}: config for plugin \"${plugin.name}\" is invalid:\\n` + z.prettifyError(parsed.error));\n\t\t}\n\t\tconst appliesTo = plugin.appliesTo ?? \"reactor\";\n\t\tif (!hostTypeSatisfies(hostType, appliesTo)) throw new PluginError(`${where}: plugin \"${plugin.name}\" applies to \"${appliesTo}\" hosts, but this host is \"${hostType}\".`);\n\t\tresolved.push({\n\t\t\tentry,\n\t\t\tplugin,\n\t\t\tprovenance: \"dependency\"\n\t\t});\n\t}\n\treturn resolved;\n}\n/**\n* LENIENT resolution for diagnostics (`ph run <host> --explain drives`):\n* collects the drive contributions of the entries active for `verb`. Unlike\n* resolveHostPlugins it does not know the host type (so appliesTo is not\n* checked) and does not fail on a specifier the project tree cannot resolve\n* — the entry is listed under `unresolved` instead. Config is still validated\n* against the plugin's schema, so a bad entry surfaces here too.\n*/\nasync function resolvePluginContributions(projectRoot, verb, entries, where) {\n\tconst normalized = normalizePluginEntries(entries, where);\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst plan = {\n\t\tdrives: [],\n\t\tunresolved: []\n\t};\n\tfor (const entry of normalized) {\n\t\tif (!entryActiveForVerb(entry, verb)) continue;\n\t\tlet file;\n\t\ttry {\n\t\t\tfile = projectRequire.resolve(entry.module);\n\t\t} catch {\n\t\t\tplan.unresolved.push(entry.module);\n\t\t\tcontinue;\n\t\t}\n\t\tconst exported = (await import(pathToFileURL(file).href)).default;\n\t\tlet plugin;\n\t\tif (typeof exported === \"function\") plugin = exported(entry.config);\n\t\telse if (isHostPluginShape(exported)) plugin = exported;\n\t\telse {\n\t\t\tplan.unresolved.push(entry.module);\n\t\t\tcontinue;\n\t\t}\n\t\tif (plugin.configSchema) {\n\t\t\tconst parsed = plugin.configSchema.safeParse(entry.config);\n\t\t\tif (!parsed.success) throw new PluginError(`${where}: config for plugin \"${plugin.name}\" is invalid:\\n` + z.prettifyError(parsed.error));\n\t\t}\n\t\tfor (const declaration of plugin.contributions?.drives ?? []) plan.drives.push({\n\t\t\tdeclaration,\n\t\t\tsource: plugin.name\n\t\t});\n\t}\n\treturn plan;\n}\n/**\n* The connect config slices each built-in Connect plugin owns, by specifier\n* (typed-host-configs 1.6). Under a declared composition Connect zeroes a\n* slice whose plugin is absent — presence is activation — so an authored\n* value there is dead config. Connect's built-ins are browser modules with no\n* Node-resolvable identity, so their ownership is declared here as data; a\n* Connect test pins it to plugin-host's zeroing.\n*/\nconst CONNECT_PLUGIN_OWNED_SLICES = {\n\t\"@powerhousedao/connect/plugins/generic\": { slices: [\n\t\t{\n\t\t\tpath: \"drives.allowAddDrive\",\n\t\t\tabsent: false,\n\t\t\tentryKey: \"allowAddDrive\"\n\t\t},\n\t\t{\n\t\t\tpath: \"drives.sections\",\n\t\t\tabsent: {\n\t\t\t\tremote: {\n\t\t\t\t\tenabled: false,\n\t\t\t\t\tallowAdd: false,\n\t\t\t\t\tallowDelete: false\n\t\t\t\t},\n\t\t\t\tlocal: {\n\t\t\t\t\tenabled: false,\n\t\t\t\t\tallowAdd: false,\n\t\t\t\t\tallowDelete: false\n\t\t\t\t}\n\t\t\t},\n\t\t\tentryKey: \"sections\"\n\t\t},\n\t\t{\n\t\t\tpath: \"drives.icons\",\n\t\t\tabsent: null,\n\t\t\tentryKey: \"icons\"\n\t\t},\n\t\t{\n\t\t\tpath: \"home.background\",\n\t\t\tabsent: null,\n\t\t\tentryKey: \"homeBackground\"\n\t\t}\n\t] },\n\t\"@powerhousedao/connect/plugins/sentry\": { slices: [{\n\t\tpath: \"sentry.dsn\",\n\t\tabsent: null,\n\t\tentryKey: \"dsn\"\n\t}] },\n\t\"@powerhousedao/connect/plugins/openpanel\": {\n\t\tslices: [\n\t\t\t{\n\t\t\t\tpath: \"openPanel.clientId\",\n\t\t\t\tabsent: \"\",\n\t\t\t\tentryKey: \"clientId\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"openPanel.trackUiEvents\",\n\t\t\t\tabsent: false,\n\t\t\t\tentryKey: \"trackUiEvents\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"openPanel.trackOperations\",\n\t\t\t\tabsent: false,\n\t\t\t\tentryKey: \"trackOperations\"\n\t\t\t}\n\t\t],\n\t\tinertUnless: \"openPanel.clientId\"\n\t},\n\t\"@powerhousedao/connect/plugins/assistant\": { slices: [{\n\t\tpath: \"ai.assistantEnabled\",\n\t\tabsent: false\n\t}] },\n\t\"@powerhousedao/vetra-studio/connect\": { slices: [{\n\t\tpath: \"app.studioMode\",\n\t\tabsent: false\n\t}] },\n\t\"@powerhousedao/connect/plugins/workflows\": { slices: [{\n\t\tpath: \"app.workflowsEnabled\",\n\t\tabsent: false\n\t}] }\n};\nfunction valueAt$1(root, dotted) {\n\tlet current = root;\n\tfor (const key of dotted.split(\".\")) {\n\t\tif (current === null || typeof current !== \"object\") return void 0;\n\t\tcurrent = current[key];\n\t}\n\treturn current;\n}\n/** Whether Connect already serves what the author wrote: every authored leaf\n* equals the served one. An unset leaf asks for nothing, so a partial object\n* (`sections: { remote: { enabled: false } }`) is satisfied by the zeroed\n* slice. */\nfunction alreadyServed(authored, served) {\n\tif (authored === void 0 || Object.is(authored, served)) return true;\n\tif (authored === null || served === null || typeof authored !== \"object\" || typeof served !== \"object\" || Array.isArray(authored) !== Array.isArray(served)) return false;\n\tif (Array.isArray(authored) && authored.length !== served.length) return false;\n\tconst want = authored;\n\tconst have = served;\n\treturn Object.keys(want).every((key) => alreadyServed(want[key], have[key]));\n}\n/**\n* The composition that serves `config` as Connect serves it with none, for a\n* host that declares no `runner.plugins`. `config` is the connect block\n* Connect would be served without a composition.\n*\n* A built-in configured through its entry is always in it, its entry holding\n* the values `config` has at the slices it owns: composed in, the plugin\n* serves those values again (an unset one falls back to the same default).\n* A built-in whose presence is its switch is in it only where `config`\n* already has that switch on, since composing it in would turn it on.\n*/\nfunction defaultConnectComposition(config) {\n\tconst composition = [];\n\tfor (const [module, { slices }] of Object.entries(CONNECT_PLUGIN_OWNED_SLICES)) {\n\t\tconst entry = {};\n\t\tlet configured = false;\n\t\tlet switchedOn = false;\n\t\tfor (const { path: slicePath, absent, entryKey } of slices) {\n\t\t\tconst value = valueAt$1(config, slicePath);\n\t\t\tif (entryKey === void 0) {\n\t\t\t\tswitchedOn ||= !alreadyServed(value, absent);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconfigured = true;\n\t\t\tif (value !== void 0 && value !== null) entry[entryKey] = value;\n\t\t}\n\t\tif (configured || switchedOn) composition.push({\n\t\t\tmodule,\n\t\t\tconfig: entry\n\t\t});\n\t}\n\treturn composition;\n}\n/**\n* Dead-config warnings for a Connect host (typed-host-configs 1.6): an\n* authored connect config value whose owning plugin is not in the\n* composition active for `verb`. Connect zeroes such a slice, so the value\n* has no effect — e.g. Sektar's `connect.drives.allowAddDrive: true` without\n* the generic plugin.\n*\n* Nothing is reported when the host declares no composition\n* (`runner.plugins` absent: the classic boot serves the config as is), or\n* when Connect already serves every leaf of the authored value. Warnings, not\n* errors: the host still boots, it just does not do what the value says.\n*/\nfunction findDeadConnectConfig(config, entries, verb, where) {\n\tif (!config || entries === void 0) return [];\n\tconst active = new Set(normalizePluginEntries(entries, where).filter((entry) => entryActiveForVerb(entry, verb)).map((entry) => entry.module));\n\tconst warnings = [];\n\tfor (const [owner, { slices, inertUnless }] of Object.entries(CONNECT_PLUGIN_OWNED_SLICES)) {\n\t\tif (active.has(owner)) continue;\n\t\tif (inertUnless !== void 0) {\n\t\t\tconst gate = slices.find((slice) => slice.path === inertUnless);\n\t\t\tif (alreadyServed(valueAt$1(config, inertUnless), gate?.absent)) continue;\n\t\t}\n\t\tfor (const { path: slicePath, absent, entryKey } of slices) {\n\t\t\tconst value = valueAt$1(config, slicePath);\n\t\t\tif (alreadyServed(value, absent)) continue;\n\t\t\tconst move = entryKey === void 0 ? `compose \"${owner}\" (presence is the switch)` : `compose \"${owner}\" and set \\`${entryKey}\\` in its entry config`;\n\t\t\twarnings.push({\n\t\t\t\tpath: slicePath,\n\t\t\t\tvalue,\n\t\t\t\tserved: absent,\n\t\t\t\towner,\n\t\t\t\tmessage: `${where}: config.${slicePath} is dead config: it is owned by plugin \"${owner}\", which this host does not compose for verb \"${verb}\", so Connect serves ${JSON.stringify(absent)} instead of ${JSON.stringify(value)}.\\n Hint: ${move}, or delete the value.`\n\t\t\t});\n\t\t}\n\t}\n\treturn warnings;\n}\n//#endregion\n//#region src/drive-schema.ts\n/**\n* The schema half of drives.ts, zod only so `./schema` stays neutral.\n* - slug: the SEEDING KEY (idempotence); id optional (stable identity).\n* - preferredEditor: stored at header.meta.preferredEditor; Connect config's\n* `app` is the legacy alias.\n* - remote.url: a drive served elsewhere; local fields are ignored for it.\n* Token-able (`$output` on a producer's `drives.<slug>.url`).\n*/\nfunction buildDriveDeclarationSchema(urlField) {\n\treturn z.strictObject({\n\t\tslug: z.string().min(1),\n\t\tid: z.string().min(1).optional(),\n\t\t/** Derive the id from the project path, like generateProjectDriveId — the\n\t\t* same ids classic `ph vetra` produces. `true` serves the drive under the\n\t\t* hashed slug too (the vetra drive's slug IS its hashed id); `\"id\"` hashes\n\t\t* only the id and keeps the declared slug (the classic Workflows drive:\n\t\t* `/d/workflows`, id `workflows-<hash>`). */\n\t\tprojectHash: z.union([z.boolean(), z.literal(\"id\")]).optional(),\n\t\t/** What a missing drive is created as. Default powerhouse/document-drive. */\n\t\tdocumentType: z.enum([\"powerhouse/document-drive\", \"powerhouse/reactor-drive\"]).optional(),\n\t\tname: z.string().min(1).optional(),\n\t\ticon: z.string().optional(),\n\t\tpreferredEditor: z.string().optional(),\n\t\tsharingType: z.enum([\n\t\t\t\"public\",\n\t\t\t\"private\",\n\t\t\t\"shared\"\n\t\t]).optional(),\n\t\tavailableOffline: z.boolean().optional(),\n\t\tremote: z.strictObject({ url: urlField(z.string().min(1)) }).optional()\n\t});\n}\nconst driveDeclarationSchema = buildDriveDeclarationSchema(tokenable);\nconst drivesSchema = z.array(driveDeclarationSchema);\n/** The project-hashed drive id (`${slug}-${sha256(projectRoot)[0..8]}`) with\n* the hash function injected, so neutral consumers (a browser monitor) can\n* pass `crypto.subtle`-derived or precomputed hex. drives.ts binds it to\n* node:crypto as `projectDriveId`. */\nfunction projectDriveIdWith(sha256Hex, projectRoot, slug) {\n\treturn `${slug}-${sha256Hex(projectRoot).substring(0, 8)}`;\n}\n//#endregion\n//#region src/host-schemas.ts\n/**\n* The zod single source for host.js blocks (typed-host-configs G1). Every\n* host type is z.input/z.output of these schemas; nothing is hand-mirrored.\n* Top-level host objects and the `reactor` block are STRICT (a typo fails);\n* `runner` stays loose until each runner declares its options (T2), and\n* `config` is runner-defined.\n*\n* Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`\n* (required, a switchboard drive address), `reactor.drives` (whole list, e.g. `$map`),\n* `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.\n*/\n/** A host's `name` keys its run record, `.ph/run/<name>.json`, so it must be\n* one safe path segment. */\nconst HOST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nconst HOST_NAME_MAX_LENGTH = 128;\nconst HOST_NAME_MESSAGE = \"A host name is used as a file name, so use only letters, digits, '.', '_' and '-', start with a letter or digit, and keep it to 128 characters.\";\nconst hostNameSchema = z.string().min(1).max(128, HOST_NAME_MESSAGE).regex(HOST_NAME_PATTERN, HOST_NAME_MESSAGE);\n/**\n* A URL, or one written against the page origin (`${origin}/graphql`): the\n* browser resolves the placeholder when it loads Connect's config, for a\n* member whose own server proxies the switchboard's paths.\n*/\nconst originOrUrlSchema = z.union([z.url(), z.string().refine(isOriginPlaceholderUrl, { message: \"a URL, or ${origin}/<path> for a proxied sibling\" })]);\nconst profileSchema = z.strictObject({\n\tappId: z.string().min(1).optional(),\n\tname: z.string().min(1).optional(),\n\tdescription: z.string().optional(),\n\ticon: z.string().optional()\n});\nconst reactorProtocolSchema = z.strictObject({\n\tfeatureFlags: z.strictObject({\n\t\tdocumentDecisions: z.boolean().optional(),\n\t\tauthEnforcement: z.boolean().optional(),\n\t\tauthGroups: z.boolean().optional(),\n\t\tauthConditions: z.boolean().optional(),\n\t\tundoV3: z.boolean().optional()\n\t}).optional(),\n\tcreateSignaturePolicy: z.enum([\"legacy\", \"v2-required\"]).optional(),\n\tunsupportedStoredDocuments: z.enum([\"refuse\", \"read-only\"]).optional()\n});\nconst runnerKindSchema = z.enum([\"reactor\", \"compound\"]);\nconst reactorBackendKindSchema = z.enum([\n\t\"in-process\",\n\t\"worker\",\n\t\"remote\"\n]);\nconst samePath = (a, b) => {\n\tconst norm = (p) => p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").replace(/^\\.\\//, \"\");\n\treturn norm(a) === norm(b);\n};\n/** Compound wiring: the generic compound runner's `config` block.\n* (`projectDrivesIntoConnect` and `drivesPublicBase` were removed in T3: a\n* member consumes another member's drives through `$output` tokens.) */\nconst compoundWiringSchema = z.strictObject({\n\t/** Member start order; must name declared children and agree with the\n\t* output-token dependencies (resolve/plan.ts). Optional: without it the\n\t* order is derived from the tokens. Unnamed members start after the named\n\t* ones, in declaration order. */\n\tstartOrder: z.array(z.string().min(1)).optional(),\n\t/** Write .ph/run/<host>.json (default true). */\n\truntimeRecord: z.boolean().optional(),\n\t/** Patch the baked CSP for the runtime registry on a served Connect\n\t* member (forwarded as `runner.cspRegistrySync` to every member whose\n\t* runner is `@powerhousedao/ph-cli/runners/connect`). */\n\tcspRegistrySync: z.boolean().optional()\n});\n/** `config.startOrder ⊆ keys(children)`, checked where both are visible.\n* Apply it LAST (`.superRefine(refineStartOrder)`) to a runner's final host\n* schema: zod refuses to `.extend()` a refined object. */\nfunction refineStartOrder(host, ctx) {\n\tconst startOrder = host.config?.startOrder;\n\tif (!Array.isArray(startOrder)) return;\n\tconst members = Object.keys(host.children);\n\tstartOrder.forEach((name, index) => {\n\t\tif (startOrder.indexOf(name) !== index) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\n\t\t\t\t\t\"config\",\n\t\t\t\t\t\"startOrder\",\n\t\t\t\t\tindex\n\t\t\t\t],\n\t\t\t\tmessage: `startOrder names \"${String(name)}\" twice; each member starts once.`\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (typeof name === \"string\" && members.includes(name)) return;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"config\",\n\t\t\t\t\"startOrder\",\n\t\t\t\tindex\n\t\t\t],\n\t\t\tmessage: `startOrder names \"${String(name)}\", which is not a member. Members: ${members.join(\", \") || \"(none)\"}.`\n\t\t});\n\t});\n}\nconst ALLOW_TOKENS = {\n\tany: tokenable,\n\tenv: envTokenable\n};\nconst FORBID_TOKENS = {\n\tany: (schema) => z.union([schema]),\n\tenv: (schema) => z.union([schema])\n};\n/** The replacement a non-drive `remote.url` message names. */\nfunction useDriveUrl(host = \"switchboard\", member) {\n\treturn `remote: { url: ${host}.drives.<slug>.url } with ${host} from ../${host}/outputs.js, or remote: { url: { $output: { host: \"${host}\"${member ? `, member: \"${member}\"` : \"\"}, path: [\"drives\", \"<slug>\", \"url\"] } } }`;\n}\n/** The `$output` of a declared `remote.url` that reads `endpoints.graphql`. */\nfunction endpointsGraphqlRef(url) {\n\tif (typeof url !== \"object\" || url === null || !(\"$output\" in url)) return;\n\tconst ref = url.$output;\n\tif (typeof ref !== \"object\" || ref === null) return void 0;\n\tconst { host, member, path } = ref;\n\tif (typeof host !== \"string\" || !Array.isArray(path)) return void 0;\n\tif (path.join(\".\") !== \"endpoints.graphql\") return void 0;\n\treturn {\n\t\thost,\n\t\t...typeof member === \"string\" ? { member } : {}\n\t};\n}\n/** The slug a drive link names: a `drives.<slug>.url` token's slug or a\n* literal address's served slug; undefined when only runtime knows it. */\nfunction linkedSlug(url) {\n\tif (typeof url === \"string\") return switchboardOfDrive(url)?.slug;\n\tconst ref = typeof url === \"object\" && url !== null && \"$output\" in url ? url.$output : void 0;\n\tconst path = Array.isArray(ref?.path) ? ref.path : [];\n\treturn path.length === 3 && path[0] === \"drives\" && typeof path[1] === \"string\" && path[2] === \"url\" ? path[1] : void 0;\n}\n/** The drives a declared host names (home drives, `reactor.drives`, plugin\n* `config.drive` links), or undefined when one is known only at runtime. */\nfunction knownDriveSlugs(host) {\n\tconst reactor = host.reactor ?? {};\n\tconst slugs = [];\n\tfor (const backend of Object.values(reactor.backends ?? {})) {\n\t\tif (backend.kind !== \"remote\") continue;\n\t\tconst slug = linkedSlug(backend.remote?.url);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\tif (reactor.drives !== void 0) {\n\t\tif (!Array.isArray(reactor.drives)) return void 0;\n\t\tfor (const drive of reactor.drives) if (typeof drive.slug === \"string\") slugs.push(drive.slug);\n\t}\n\tconst plugins = Array.isArray(host.runner?.plugins) ? host.runner.plugins : [];\n\tfor (const entry of plugins) {\n\t\tconst config = typeof entry === \"object\" && entry !== null && \"config\" in entry ? entry.config : void 0;\n\t\tif (typeof config !== \"object\" || config === null) continue;\n\t\tif (!(\"drive\" in config) || config.drive === void 0) continue;\n\t\tconst slug = linkedSlug(config.drive);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\tfor (const drive of connectDefaultDrives(host.config)) {\n\t\tif (typeof drive !== \"object\" || drive === null || !(\"url\" in drive)) continue;\n\t\tconst slug = linkedSlug(drive.url);\n\t\tif (slug === void 0) return void 0;\n\t\tslugs.push(slug);\n\t}\n\treturn slugs;\n}\n/** A Connect host's `config.drives.defaultDrives`, unchecked. */\nfunction connectDefaultDrives(config) {\n\tconst drives = typeof config === \"object\" && config !== null && \"drives\" in config ? config.drives : void 0;\n\tconst list = typeof drives === \"object\" && drives !== null && \"defaultDrives\" in drives ? drives.defaultDrives : void 0;\n\treturn Array.isArray(list) ? list : [];\n}\n/** Declared form, at host level so plugin drives are seen: a placement key\n* must name a drive the host names, when every drive is knowable. A host\n* with no remote backend is not checked: its plugins may contribute drives\n* (a switchboard's workflows drive) that no field names. */\nfunction refineDeclaredPlacementKeys(host, ctx) {\n\tconst placed = Object.keys(host.reactor?.placement?.drives ?? {});\n\tif (placed.length === 0) return;\n\tif (!Object.values(host.reactor?.backends ?? {}).some((b) => b.kind === \"remote\")) return;\n\tconst known = knownDriveSlugs(host);\n\tif (!known) return;\n\tconst names = (slug, served) => served === slug || served.startsWith(`${slug}-`) && /^[0-9a-f]{8}$/.test(served.slice(slug.length + 1));\n\tfor (const slug of placed) {\n\t\tif (known.some((served) => names(slug, served))) continue;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"reactor\",\n\t\t\t\t\"placement\",\n\t\t\t\t\"drives\",\n\t\t\t\tslug\n\t\t\t],\n\t\t\tmessage: `placement.drives.${slug} names no drive this host links to or declares (${[...new Set(known)].join(\", \") || \"none\"}).`\n\t\t});\n\t}\n}\n/** Resolved-form checks across backends, drives and placement: one base is\n* one remote backend, and a drive placed on a remote is on its switchboard. */\nfunction refineResolvedReactor(reactor, ctx) {\n\tconst backends = reactor.backends ?? {};\n\tconst baseOf = /* @__PURE__ */ new Map();\n\tconst byBase = /* @__PURE__ */ new Map();\n\tconst linked = /* @__PURE__ */ new Map();\n\tconst link = (slug, base) => linked.set(slug, (linked.get(slug) ?? /* @__PURE__ */ new Set()).add(base));\n\tfor (const [name, backend] of Object.entries(backends)) {\n\t\tconst url = backend.remote?.url;\n\t\tif (backend.kind !== \"remote\" || typeof url !== \"string\") continue;\n\t\tconst home = switchboardOfDrive(url);\n\t\tif (!home) continue;\n\t\tbaseOf.set(name, home.base);\n\t\tlink(home.slug, home.base);\n\t\tconst first = byBase.get(home.base);\n\t\tif (first === void 0) {\n\t\t\tbyBase.set(home.base, name);\n\t\t\tcontinue;\n\t\t}\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"backends\",\n\t\t\t\tname,\n\t\t\t\t\"remote\",\n\t\t\t\t\"url\"\n\t\t\t],\n\t\t\tmessage: `backends \"${first}\" and \"${name}\" both open drives on the same switchboard (${home.base}). Keep \"${first}\", and list the second drive under reactor.drives with its remote.url instead.`\n\t\t});\n\t}\n\tconst kept = /* @__PURE__ */ new Set();\n\t(Array.isArray(reactor.drives) ? reactor.drives : []).forEach((drive, index) => {\n\t\tif (!drive.remote) {\n\t\t\tkept.add(drive.slug);\n\t\t\treturn;\n\t\t}\n\t\tconst at = switchboardOfDrive(drive.remote.url);\n\t\tif (at || drive.remote.url === \"\") {\n\t\t\tif (at) link(drive.slug, at.base);\n\t\t\treturn;\n\t\t}\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\n\t\t\t\t\"drives\",\n\t\t\t\tindex,\n\t\t\t\t\"remote\",\n\t\t\t\t\"url\"\n\t\t\t],\n\t\t\tmessage: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${drive.remote.url}: sync needs the drive. Use url: switchboard.drives.<slug>.url, or url: { $output: { host: \"switchboard\", path: [\"drives\", \"<slug>\", \"url\"] } }.`\n\t\t});\n\t});\n\tconst nameOf = (base) => byBase.get(base) ?? base;\n\tfor (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {\n\t\tconst at = [\n\t\t\t\"placement\",\n\t\t\t\"drives\",\n\t\t\tslug\n\t\t];\n\t\tconst on = [...linked.get(slug) ?? []];\n\t\tif (on.length > 0 && kept.has(slug)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `Drive \"${slug}\" is both this reactor's own drive and on ${on.map(nameOf).join(\" and \")}. Rename one, or link only one.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (on.length > 1) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `Drive \"${slug}\" is on both ${on.map(nameOf).join(\" and \")}. Rename one, or link only one.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = baseOf.get(name);\n\t\tif (base === void 0) continue;\n\t\tif (on.length === 0) {\n\t\t\tif (!kept.has(slug)) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: at,\n\t\t\t\tmessage: `placement.drives.${slug} opens drive \"${slug}\" on \"${name}\", but this reactor keeps that drive itself. Only a drive on a switchboard can open there without a copy.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (on[0] === base) continue;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: at,\n\t\t\tmessage: `placement.drives.${slug} opens drive \"${slug}\" on \"${name}\" (${base}), but the drive is on ${on[0]}. Place it on the backend for that switchboard.`\n\t\t});\n\t}\n}\n/** `remote` keys that tune a connection, so only a remote backend has them. */\nconst REMOTE_ONLY_KEYS = [\n\t\"requestTimeoutMs\",\n\t\"breaker\",\n\t\"realtime\"\n];\n/**\n* Builds the host schema set. \"allow\" (declared form) accepts `T | Token` in\n* every token-able field; \"forbid\" (resolved form) accepts `T` only.\n*/\nfunction buildHostSchemas(tokenField) {\n\tconst resolved = tokenField === FORBID_TOKENS;\n\tconst reactorBackendSchema = z.strictObject({\n\t\tkind: reactorBackendKindSchema,\n\t\tstorage: z.strictObject({\n\t\t\tkind: z.enum([\n\t\t\t\t\"idb\",\n\t\t\t\t\"memory\",\n\t\t\t\t\"path\",\n\t\t\t\t\"postgres\"\n\t\t\t]),\n\t\t\t/** `\"${userData}/…\"` sugar or `{ $env: \"NAME\" }`. */\n\t\t\tdataDir: tokenField.env(z.string()).optional(),\n\t\t\turl: z.string().optional()\n\t\t}).optional(),\n\t\treadModel: z.strictObject({ url: z.string().optional() }).optional(),\n\t\tpackages: z.strictObject({\n\t\t\tcdnUrl: z.string().optional(),\n\t\t\tspecs: z.array(z.string()).optional(),\n\t\t\t/** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n\t\t\tdynamic: z.boolean().optional()\n\t\t}).optional(),\n\t\tremote: z.strictObject({\n\t\t\turl: tokenField.any(originOrUrlSchema),\n\t\t\t/** Give up on one request to this switchboard after this long. Default 30_000. */\n\t\t\trequestTimeoutMs: z.number().int().positive().optional(),\n\t\t\t/** After `failures` failed requests in a row, send nothing for\n\t\t\t* `openMs`. Default { failures: 3, openMs: 30_000 }. `false`:\n\t\t\t* never stop trying. */\n\t\t\tbreaker: z.union([z.literal(false), z.strictObject({\n\t\t\t\tfailures: z.number().int().min(1).optional(),\n\t\t\t\topenMs: z.number().int().nonnegative().optional()\n\t\t\t})]).optional(),\n\t\t\t/** Live updates over a socket (the router's GraphQL\n\t\t\t* subscriptions, not drive sync). Default true. */\n\t\t\trealtime: z.boolean().optional()\n\t\t}).optional()\n\t}).superRefine((backend, ctx) => {\n\t\tif (backend.kind === \"remote\" && !backend.remote) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `a \"remote\" backend needs remote.url, a switchboard drive address: ${useDriveUrl()}.`\n\t\t});\n\t\tif (backend.kind !== \"remote\" && backend.remote) for (const key of REMOTE_ONLY_KEYS) {\n\t\t\tif (backend.remote[key] === void 0) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"remote\", key],\n\t\t\t\tmessage: `remote.${key} applies only to a \"remote\" backend; this one is \"${backend.kind}\".`\n\t\t\t});\n\t\t}\n\t\tconst url = backend.remote?.url;\n\t\tconst graphqlRef = resolved ? void 0 : endpointsGraphqlRef(url);\n\t\tif (graphqlRef) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `remote.url reads ${graphqlRef.host}'s endpoints.graphql; it must be a switchboard drive address (<switchboard>/d/<slug>): sync needs the drive. Use ${useDriveUrl(graphqlRef.host, graphqlRef.member)}.`\n\t\t});\n\t\tif (resolved && typeof url === \"string\" && !switchboardOfDrive(url)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"remote\", \"url\"],\n\t\t\tmessage: `remote.url must be a switchboard drive address (<switchboard>/d/<slug>), not ${url}: sync needs the drive. Use ${useDriveUrl()}.`\n\t\t});\n\t\tconst store = backend.storage;\n\t\tconst storeDir = store?.kind === \"path\" ? store.dataDir : void 0;\n\t\tconst readModel = backend.readModel?.url;\n\t\tif (typeof storeDir === \"string\" && readModel && samePath(storeDir, readModel)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"readModel\", \"url\"],\n\t\t\tmessage: `readModel.url must not be the reactor's storage dir (${readModel}): two PGlite instances on one data dir corrupt it. Omit readModel.url to get the classic <root>/.ph/read-storage next to the reactor store.`\n\t\t});\n\t});\n\tconst reactorSchema = z.strictObject({\n\t\tbackends: z.record(z.string(), reactorBackendSchema).optional(),\n\t\tplacement: z.strictObject({\n\t\t\tprimary: z.string().optional(),\n\t\t\t/** Declared drive slug → backend name. A local backend keeps a\n\t\t\t* synced copy; the drive's own remote backend opens it there with\n\t\t\t* no copy. An unlisted drive keeps a synced copy. */\n\t\t\tdrives: z.record(z.string().min(1), z.string().min(1)).optional(),\n\t\t\t/** The backend new drives (and documents outside a drive) are\n\t\t\t* created on. A switchboard keeps no copy in this browser.\n\t\t\t* Default: the browser reactor, else the only switchboard. */\n\t\t\tnewDrives: z.string().min(1).optional()\n\t\t}).optional(),\n\t\trouter: z.strictObject({\n\t\t\t/** Wait this long for a reactor to say whether it holds a\n\t\t\t* document. 0: no bound. Default 3_000. */\n\t\t\tprobeTimeoutMs: z.number().int().nonnegative().optional(),\n\t\t\t/** Look again after this long for a document found on a later\n\t\t\t* backend. Default 30_000. */\n\t\t\tprovisionalRouteMs: z.number().int().nonnegative().optional()\n\t\t}).optional(),\n\t\tprotocol: reactorProtocolSchema.optional(),\n\t\t/** DEPRECATED (dies in R2): workflows become a listed plugin. */\n\t\tworkflows: z.boolean().optional(),\n\t\trenown: z.strictObject({\n\t\t\turl: z.string().optional(),\n\t\t\tnetworkId: z.string().optional(),\n\t\t\tchainId: z.number().int().optional()\n\t\t}).optional(),\n\t\tnamespace: z.string().min(1).optional(),\n\t\tdrives: tokenField.any(z.array(buildDriveDeclarationSchema(tokenField.any))).optional()\n\t}).superRefine((reactor, ctx) => {\n\t\tconst backends = reactor.backends ?? {};\n\t\tfor (const [slug, name] of Object.entries(reactor.placement?.drives ?? {})) {\n\t\t\tif (Object.hasOwn(backends, name)) continue;\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\n\t\t\t\t\t\"placement\",\n\t\t\t\t\t\"drives\",\n\t\t\t\t\tslug\n\t\t\t\t],\n\t\t\t\tmessage: `placement.drives.${slug} names backend \"${name}\", which is not in backends (${Object.keys(backends).join(\", \") || \"none\"}).`\n\t\t\t});\n\t\t}\n\t\tconst newDrives = reactor.placement?.newDrives;\n\t\tif (newDrives !== void 0 && !Object.hasOwn(backends, newDrives)) ctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"placement\", \"newDrives\"],\n\t\t\tmessage: `placement.newDrives names backend \"${newDrives}\", which is not in backends (${Object.keys(backends).join(\", \") || \"none\"}).`\n\t\t});\n\t\tif (resolved) refineResolvedReactor(reactor, ctx);\n\t});\n\t/** Common runner options; runner modules extend it with their own. */\n\tconst runnerBaseSchema = z.looseObject({\n\t\tmodule: z.string().min(1),\n\t\tdefaultVerb: z.string().min(1).optional(),\n\t\tport: z.number().int().positive().optional(),\n\t\t/** Bind address; each runner documents its default. */\n\t\thost: z.string().min(1).optional(),\n\t\t/** THE COMPOSITION: plugin entries; presence is activation. */\n\t\tplugins: z.array(pluginEntrySchema).optional()\n\t});\n\t/** A compound member wrapper. Sections are FULL STATEMENTS except `runner`,\n\t* which key-merges over the member's own. Plugins live in `runner.plugins`\n\t* (as on a standalone host); there is no wrapper-level `plugins`. */\n\tconst childWrapperSchema = z.strictObject({\n\t\thost: z.string().min(1),\n\t\trunner: runnerBaseSchema.partial().extend({ port: z.number().int().min(0).max(65535).optional() }).optional(),\n\t\tconfig: z.looseObject({}).optional(),\n\t\treactor: reactorSchema.optional()\n\t});\n\tconst childrenSchema = z.record(z.string(), childWrapperSchema);\n\treturn {\n\t\treactorBackendSchema,\n\t\treactorSchema,\n\t\trunnerBaseSchema,\n\t\tchildWrapperSchema,\n\t\tchildrenSchema,\n\t\treactorHostSchema: z.strictObject({\n\t\t\tname: hostNameSchema,\n\t\t\trunner: runnerBaseSchema,\n\t\t\tconfig: z.looseObject({}).optional(),\n\t\t\tprofile: profileSchema.optional(),\n\t\t\treactor: reactorSchema.optional()\n\t\t}),\n\t\tcompoundHostSchema: z.strictObject({\n\t\t\tname: hostNameSchema,\n\t\t\trunner: runnerBaseSchema,\n\t\t\tchildren: childrenSchema,\n\t\t\tconfig: z.looseObject({}).optional(),\n\t\t\tprofile: profileSchema.optional()\n\t\t}),\n\t\t/** This set's field wrapper, for a runner's OWN token-able fields inside\n\t\t* `defineHostSchemas`: declared, `T | Token` in and `T` out; resolved,\n\t\t* `T` only. Both modes share one static type. */\n\t\ttokenable: tokenField.any,\n\t\t/** As `tokenable`, but the only token accepted is `$env`. */\n\t\tenvTokenable: tokenField.env\n\t};\n}\n/** The host schema set in declared (\"allow\": token-able fields take tokens)\n* or resolved (\"forbid\") form. */\nfunction makeHostSchemas(options) {\n\treturn buildHostSchemas(options.tokens === \"allow\" ? ALLOW_TOKENS : FORBID_TOKENS);\n}\n/** The issues a host-level refinement raises, outside a zod parse. */\nfunction collectIssues(host, refine) {\n\tif (typeof host !== \"object\" || host === null || !(\"reactor\" in host)) return [];\n\tconst issues = [];\n\trefine(host, { addIssue: (issue) => {\n\t\tissues.push({\n\t\t\tpath: (issue.path ?? []).filter((part) => typeof part !== \"symbol\"),\n\t\t\tmessage: issue.message ?? \"\"\n\t\t});\n\t} });\n\treturn issues;\n}\n/** withPlacementKeys' check, for a merged declared host parsed some other way. */\nfunction placementKeyIssues(host) {\n\treturn collectIssues(host, refineDeclaredPlacementKeys);\n}\nconst CONNECT_PRIMARY_MESSAGE = \"Connect doesn't use placement.primary. To choose where new drives go, use placement.newDrives.\";\n/**\n* A Connect host's placement rules, in either form. The router's primary is\n* the browser reactor, else the `newDrives` switchboard, else the only one,\n* so `placement.primary` means nothing here, and a Connect with several\n* switchboards and no browser reactor must say where new drives go. Apply it\n* last to the Connect runner's schema: `.superRefine(refineConnectReactor)`.\n*/\nfunction refineConnectReactor(host, ctx) {\n\tconst reactor = host.reactor;\n\tif (!reactor) return;\n\tif (reactor.placement?.primary !== void 0) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [\n\t\t\t\"reactor\",\n\t\t\t\"placement\",\n\t\t\t\"primary\"\n\t\t],\n\t\tmessage: CONNECT_PRIMARY_MESSAGE\n\t});\n\tconst backends = Object.entries(reactor.backends ?? {});\n\tconst remotes = backends.filter(([, backend]) => backend.kind === \"remote\").map(([name]) => name);\n\tif (remotes.length > 1 && remotes.length === backends.length && reactor.placement?.newDrives === void 0) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [\n\t\t\t\"reactor\",\n\t\t\t\"placement\",\n\t\t\t\"newDrives\"\n\t\t],\n\t\tmessage: `This Connect keeps no reactor in the browser and links ${remotes.length} switchboards (${remotes.join(\", \")}). Set placement.newDrives to the one new drives are created on.`\n\t});\n}\n/** refineConnectReactor's check, for a Connect host parsed some other way. */\nfunction connectReactorIssues(host) {\n\treturn collectIssues(host, refineConnectReactor);\n}\n/** Adds the host-level placement key check to a runner's declared schema. */\nfunction withPlacementKeys(schema) {\n\tif (!(schema instanceof z.ZodType)) return schema;\n\treturn schema.superRefine((host, ctx) => {\n\t\tif (typeof host === \"object\" && host !== null && \"reactor\" in host) refineDeclaredPlacementKeys(host, ctx);\n\t});\n}\n/**\n* One runner definition, two schemas (3.5): `build` runs over the DECLARED\n* set (tokens allowed; its z.input types host files) and the RESOLVED set\n* (no tokens; `validateHost` checks it before the verb). Export both, type\n* the host as `z.input<typeof declaredHostSchema>`, refine last inside the\n* builder (zod can't extend a refined object), and wrap the runner's own\n* token-able fields with `s.tokenable` / `s.envTokenable`.\n*/\nfunction defineHostSchemas(build) {\n\treturn {\n\t\tdeclaredHostSchema: withPlacementKeys(build(declaredSchemas)),\n\t\thostSchema: build(resolvedSchemas)\n\t};\n}\nconst declaredSchemas = makeHostSchemas({ tokens: \"allow\" });\nconst resolvedSchemas = makeHostSchemas({ tokens: \"forbid\" });\nconst declaredHostSchemas = declaredSchemas;\nconst reactorBackendSchema = resolvedSchemas.reactorBackendSchema;\nconst reactorSchema = resolvedSchemas.reactorSchema;\nconst runnerBaseSchema = resolvedSchemas.runnerBaseSchema;\nconst childWrapperSchema = resolvedSchemas.childWrapperSchema;\nconst childrenSchema = resolvedSchemas.childrenSchema;\nconst reactorHostSchema = resolvedSchemas.reactorHostSchema;\nconst compoundHostSchema = resolvedSchemas.compoundHostSchema;\n/** The generic compound runner's host: the base with its wiring config. */\nconst genericCompound = defineHostSchemas((s) => s.compoundHostSchema.extend({ config: compoundWiringSchema.optional() }).superRefine(refineStartOrder));\nconst genericCompoundHostSchema = genericCompound.hostSchema;\nconst declaredGenericCompoundHostSchema = genericCompound.declaredHostSchema;\nconst SCHEMA_BASE = \"https://powerhouse.inc/schemas\";\n/** One host schema as an editor JSON Schema with a stable `$id` — the\n* per-runner emission helper (runner packages emit their own hostSchema). */\nfunction emitHostJsonSchema(name, schema) {\n\treturn {\n\t\t$id: `${SCHEMA_BASE}/${name}.schema.json`,\n\t\t...z.toJSONSchema(schema, { io: \"input\" })\n\t};\n}\n/** The emitted-schema set, keyed by published filename. Pure — the\n* emit-schemas script writes these and the drift test re-derives them. */\nfunction emittedHostSchemas() {\n\treturn {\n\t\t\"host-reactor.schema.json\": emitHostJsonSchema(\"host-reactor\", declaredSchemas.reactorHostSchema),\n\t\t\"host-compound.schema.json\": emitHostJsonSchema(\"host-compound\", declaredSchemas.compoundHostSchema)\n\t};\n}\n//#endregion\n//#region src/resolve/walk.ts\nfunction isPlainObject(value) {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\n/** `a.b[2].c` (or `<root>`). */\nfunction formatPath(path) {\n\tlet out = \"\";\n\tfor (const segment of path) if (typeof segment === \"number\") out += `[${segment}]`;\n\telse out += out ? `.${segment}` : segment;\n\treturn out || \"<root>\";\n}\n/** Is this object a `$$` escape (`{ $$: literal }`)? */\nfunction isEscape(value) {\n\tconst keys = Object.keys(value);\n\treturn keys.length === 1 && keys[0] === TOKEN_ESCAPE_KEY;\n}\n/** Every token in `value`, in document order. `$concat` parts and `$map`\n* operands (`over`, then the `to` template) are visited: they may hold tokens\n* themselves. Each site carries the `$map` scopes it sits in. A `$$` escape\n* hides its operand. */\nfunction collectTokenSites(value) {\n\tconst sites = [];\n\tvisit(value, [], \"root\", [], sites);\n\treturn sites;\n}\nfunction visit(value, path, position, scopes, sites) {\n\tconst key = tokenKeyOf(value);\n\tif (key && isPlainObject(value)) {\n\t\tsites.push({\n\t\t\tpath,\n\t\t\tkey,\n\t\t\ttoken: value,\n\t\t\tposition,\n\t\t\tscopes\n\t\t});\n\t\tconst operand = value[key];\n\t\tif (key === \"$concat\" && Array.isArray(operand)) operand.forEach((part, index) => visit(part, [\n\t\t\t...path,\n\t\t\t\"$concat\",\n\t\t\tindex\n\t\t], \"concat\", scopes, sites));\n\t\tif (key === \"$map\" && isPlainObject(operand)) {\n\t\t\tconst at = [...path, \"$map\"];\n\t\t\tif (\"over\" in operand) visit(operand.over, [...at, \"over\"], \"over\", scopes, sites);\n\t\t\tif (\"to\" in operand) {\n\t\t\t\tconst scope = {\n\t\t\t\t\tpath,\n\t\t\t\t\ttoken: value,\n\t\t\t\t\t...typeof operand.as === \"string\" ? { as: operand.as } : {}\n\t\t\t\t};\n\t\t\t\tvisit(operand.to, [...at, \"to\"], \"template\", [...scopes, scope], sites);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tvalue.forEach((child, index) => visit(child, [...path, index], \"element\", scopes, sites));\n\t\treturn;\n\t}\n\tif (!isPlainObject(value) || isEscape(value)) return;\n\tfor (const [childKey, child] of Object.entries(value)) visit(child, [...path, childKey], \"property\", scopes, sites);\n}\n/** An `$item` path as text: `url`, `drives.x`, `<element>` for `[]`. */\nfunction pathText(path) {\n\tif (path.length === 0) return \"<element>\";\n\treturn formatPath(path.filter((p) => typeof p === \"string\" || typeof p === \"number\"));\n}\n/** A one-line human rendering of a token, for `--explain` and messages. */\nfunction describeToken(token) {\n\tconst key = tokenKeyOf(token);\n\tif (!key || !isPlainObject(token)) return JSON.stringify(token);\n\tconst operand = token[key];\n\tif (key === \"$output\" && isPlainObject(operand)) return `$output ${typeof operand.host === \"string\" ? operand.host : \"?\"}${typeof operand.member === \"string\" ? ` (member ${operand.member})` : \"\"} › ${Array.isArray(operand.path) ? formatPath(operand.path.filter((p) => typeof p === \"string\" || typeof p === \"number\")) : \"?\"}`;\n\tif (key === \"$env\") {\n\t\tif (typeof operand === \"string\") return `$env ${operand}`;\n\t\tif (isPlainObject(operand) && typeof operand.name === \"string\") return `$env ${operand.name} (optional)`;\n\t}\n\tif (key === \"$item\") {\n\t\tconst named = isPlainObject(operand) ? operand : void 0;\n\t\tconst raw = named ? named.path : operand;\n\t\tconst path = Array.isArray(raw) ? pathText(raw) : \"?\";\n\t\treturn `$item${named && typeof named.as === \"string\" ? `(${named.as})` : \"\"} ${path}`;\n\t}\n\tif (key === \"$key\") return typeof operand === \"string\" ? `$key(${operand})` : \"$key\";\n\tif (key === \"$map\" && isPlainObject(operand)) {\n\t\tconst as = typeof operand.as === \"string\" ? ` as ${operand.as}` : \"\";\n\t\tconst into = operand.into === \"record\" ? \" into record\" : \"\";\n\t\treturn `$map over [${describeToken(operand.over)}]${as}${into} → ${JSON.stringify(render(operand.to))}`;\n\t}\n\tif (key === \"$concat\" && Array.isArray(operand)) return `$concat ${operand.map((part) => typeof part === \"string\" ? JSON.stringify(part) : typeof part === \"number\" ? String(part) : `[${describeToken(part)}]`).join(\" + \")}`;\n\treturn `${key} ${JSON.stringify(operand)}`;\n}\n/** A display copy of `value` with every token replaced by `«description»`\n* (for printing declared hosts, e.g. `--explain drives`). */\nfunction renderTokens(value) {\n\treturn render(value);\n}\nfunction render(value) {\n\tif (tokenKeyOf(value)) return `«${describeToken(value)}»`;\n\tif (Array.isArray(value)) return value.map(render);\n\tif (!isPlainObject(value) || isEscape(value)) return value;\n\tconst out = {};\n\tfor (const [key, child] of Object.entries(value)) out[key] = render(child);\n\treturn out;\n}\n/** A copy of `value` with every `$$` escape replaced by its operand (the\n* literal it protects). Run after the no-token walk. */\nfunction unwrapEscapes(value) {\n\treturn unwrap(value);\n}\nfunction unwrap(value) {\n\tif (Array.isArray(value)) return value.map(unwrap);\n\tif (!isPlainObject(value)) return value;\n\tif (isEscape(value)) return structuredClone(value[TOKEN_ESCAPE_KEY]);\n\tconst out = {};\n\tfor (const [key, child] of Object.entries(value)) out[key] = unwrap(child);\n\treturn out;\n}\n//#endregion\n//#region src/resolve/declared.ts\nfunction refOf(site) {\n\tconst operand = site.token.$output;\n\tif (!isPlainObject(operand) || typeof operand.host !== \"string\") return;\n\treturn typeof operand.member === \"string\" ? {\n\t\thost: operand.host,\n\t\tmember: operand.member\n\t} : { host: operand.host };\n}\nfunction pathOf(site) {\n\tconst operand = site.token.$output;\n\tif (!isPlainObject(operand) || !Array.isArray(operand.path)) return [];\n\treturn operand.path.filter((p) => typeof p === \"string\" || typeof p === \"number\");\n}\nfunction refKey(ref) {\n\treturn ref.member ? `${ref.host}#${ref.member}` : ref.host;\n}\n/** The distinct producers a host's `$output` tokens name, in document order. */\nfunction outputRefsOf(host) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const site of collectTokenSites(host)) {\n\t\tif (site.key !== \"$output\") continue;\n\t\tconst ref = refOf(site);\n\t\tif (ref && !seen.has(refKey(ref))) seen.set(refKey(ref), ref);\n\t}\n\treturn [...seen.values()];\n}\n/** Every `$output` token with its host path and producer (for the plan and\n* `--explain outputs`). */\nfunction outputSitesOf(host) {\n\treturn collectTokenSites(host).flatMap((site) => {\n\t\tif (site.key !== \"$output\") return [];\n\t\tconst ref = refOf(site);\n\t\treturn ref ? [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tref,\n\t\t\toutputPath: pathOf(site)\n\t\t}] : [];\n\t});\n}\n/** Every `$env` token with its host path (for `--explain outputs`). */\nfunction envSitesOf(host) {\n\treturn collectTokenSites(host).flatMap((site) => {\n\t\tif (site.key !== \"$env\") return [];\n\t\tconst operand = site.token.$env;\n\t\tif (typeof operand === \"string\") return [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tname: operand,\n\t\t\toptional: false\n\t\t}];\n\t\tif (isPlainObject(operand) && typeof operand.name === \"string\") return [{\n\t\t\tpath: formatPath(site.path),\n\t\t\tname: operand.name,\n\t\t\toptional: true\n\t\t}];\n\t\treturn [];\n\t});\n}\n/** The binding name an `$item`/`$key` site names (undefined: innermost). */\nfunction bindingNameOf(site) {\n\tconst operand = site.token[site.key];\n\tif (site.key === \"$key\") return typeof operand === \"string\" ? operand : void 0;\n\tif (site.key === \"$item\" && isPlainObject(operand)) return typeof operand.as === \"string\" ? operand.as : void 0;\n}\n/** The enclosing `$map` an `$item`/`$key` site binds to, or why none. */\nfunction scopeOf(site) {\n\tconst name = bindingNameOf(site);\n\tif (site.scopes.length === 0) return { error: `${site.key} is used outside any $map; it reads the element a $map template is rendering, so it is legal only inside a $map's \\`to\\` (or a nested $map's \\`over\\`).` };\n\tif (name === void 0) return site.scopes[site.scopes.length - 1];\n\tfor (let i = site.scopes.length - 1; i >= 0; i--) if (site.scopes[i].as === name) return site.scopes[i];\n\tconst named = site.scopes.flatMap((s) => s.as ? [`\"${s.as}\"`] : []);\n\treturn { error: `${describeToken(site.token)} names the $map binding \"${name}\", which no enclosing $map declares (enclosing bindings: ${named.join(\", \") || \"none; add as: \\\"\" + name + \"\\\" to the outer $map\"}).` };\n}\n/** Item path of an `$item` site. */\nfunction itemPathOf(site) {\n\tconst operand = site.token.$item;\n\tconst raw = isPlainObject(operand) ? operand.path : operand;\n\treturn Array.isArray(raw) ? raw.filter((p) => typeof p === \"string\" || typeof p === \"number\") : [];\n}\n/** Operator shapes and placement: malformed operands, `$item`/`$key`\n* outside any `$map` or naming an unknown binding, and\n* `{ $env: { name, optional: true } }` anywhere but the direct value of an\n* object property (it omits that property when unset). */\nfunction checkTokenSites(host) {\n\tconst issues = [];\n\tfor (const site of collectTokenSites(host)) {\n\t\tconst path = formatPath(site.path);\n\t\tif (!tokenSchema.safeParse(site.token).success) {\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `malformed ${site.key} token ${JSON.stringify(site.token)}. Shapes: { $output: { host, member?, path: [...] } }, { $concat: [string | number | token, ...] }, { $env: \"NAME\" } or { $env: { name: \"NAME\", optional: true } }, { $map: { over: $output | $item, as?: \"name\", to: template, into?: \"record\" } }, { $item: [path] } or { $item: { as: \"name\", path: [...] } }, { $key: true } or { $key: \"name\" }.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key === \"$item\" || site.key === \"$key\") {\n\t\t\tconst scope = scopeOf(site);\n\t\t\tif (\"error\" in scope) issues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: scope.error\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst operand = site.token.$env;\n\t\tif (site.key === \"$env\" && isPlainObject(operand) && site.position !== \"property\") {\n\t\t\tconst where = site.position === \"concat\" ? \"a $concat part\" : site.position === \"element\" ? \"an array element\" : site.position === \"template\" ? \"the whole $map template\" : \"the whole host\";\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `{ $env: { name, optional: true } } is legal only as the direct value of an object property (it omits that property when ${String(operand.name)} is unset), not as ${where}. Use { $env: ${JSON.stringify(operand.name)} } here.`\n\t\t\t});\n\t\t}\n\t}\n\treturn issues;\n}\nfunction defOf(schema) {\n\tif (!isPlainObjectLike(schema)) return void 0;\n\tconst internals = schema._zod;\n\tif (!isPlainObjectLike(internals)) return void 0;\n\tconst def = internals.def;\n\tif (!isPlainObjectLike(def) || typeof def.type !== \"string\") return void 0;\n\treturn {\n\t\t...def,\n\t\ttype: def.type\n\t};\n}\nfunction isPlainObjectLike(value) {\n\treturn (typeof value === \"object\" || typeof value === \"function\") && value !== null;\n}\nconst WRAPPERS = /* @__PURE__ */ new Set([\n\t\"optional\",\n\t\"nullable\",\n\t\"default\",\n\t\"prefault\",\n\t\"readonly\",\n\t\"nonoptional\",\n\t\"catch\",\n\t\"success\"\n]);\n/** The schema at `path` inside a zod schema (walking objects, records,\n* arrays, tuples, unions and wrappers), or why the path does not exist. */\nfunction schemaAtPath(schema, path) {\n\tlet current = schema;\n\tfor (let i = 0; i <= path.length; i++) {\n\t\tfor (let guard = 0; guard < 32; guard++) {\n\t\t\tconst def = defOf(current);\n\t\t\tif (!def) break;\n\t\t\tif (WRAPPERS.has(def.type)) current = def.innerType;\n\t\t\telse if (def.type === \"lazy\" && typeof def.getter === \"function\") {\n\t\t\t\tconst getter = def.getter;\n\t\t\t\tcurrent = getter();\n\t\t\t} else if (def.type === \"pipe\") {\n\t\t\t\tconst out = defOf(def.out);\n\t\t\t\tcurrent = out && out.type !== \"transform\" ? def.out : def.in;\n\t\t\t} else break;\n\t\t}\n\t\tif (i === path.length) return {\n\t\t\tok: true,\n\t\t\tschema: current\n\t\t};\n\t\tconst segment = path[i];\n\t\tconst def = defOf(current);\n\t\tif (!def) return {\n\t\t\tok: false,\n\t\t\tat: i,\n\t\t\treason: \"is not a schema\"\n\t\t};\n\t\tswitch (def.type) {\n\t\t\tcase \"any\":\n\t\t\tcase \"unknown\": return {\n\t\t\t\tok: true,\n\t\t\t\tschema: current\n\t\t\t};\n\t\t\tcase \"object\": {\n\t\t\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\t\t\tif (typeof segment === \"string\" && segment in shape) {\n\t\t\t\t\tcurrent = shape[segment];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst catchall = defOf(def.catchall);\n\t\t\t\tif (catchall && catchall.type !== \"never\") {\n\t\t\t\t\tcurrent = def.catchall;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst keys = Object.keys(shape);\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: `has no key ${JSON.stringify(segment)} (keys: ${keys.join(\", \") || \"none\"})`\n\t\t\t\t};\n\t\t\t}\n\t\t\tcase \"record\":\n\t\t\t\tif (typeof segment !== \"string\") return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"is a record (string keys)\"\n\t\t\t\t};\n\t\t\t\tcurrent = def.valueType;\n\t\t\t\tbreak;\n\t\t\tcase \"array\":\n\t\t\t\tif (typeof segment !== \"number\") return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"is an array (numeric index)\"\n\t\t\t\t};\n\t\t\t\tcurrent = def.element;\n\t\t\t\tbreak;\n\t\t\tcase \"tuple\": {\n\t\t\t\tconst items = Array.isArray(def.items) ? def.items : [];\n\t\t\t\tif (typeof segment !== \"number\" || segment >= items.length) return {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: `is a ${items.length}-tuple`\n\t\t\t\t};\n\t\t\t\tcurrent = items[segment];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"union\": {\n\t\t\t\tconst options = Array.isArray(def.options) ? def.options : [];\n\t\t\t\tfor (const option of options) {\n\t\t\t\t\tconst hit = schemaAtPath(option, path.slice(i));\n\t\t\t\t\tif (hit.ok) return hit;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tat: i,\n\t\t\t\t\treason: \"matches no union member\"\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault: return {\n\t\t\t\tok: false,\n\t\t\t\tat: i,\n\t\t\t\treason: `is a ${def.type}, not a container`\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tok: true,\n\t\tschema: current\n\t};\n}\n/** Whether the object schema at `path` names `key` in its shape (a\n* catchall does not count): what a runner's schema explicitly declares,\n* e.g. `runner.cspRegistrySync`. A union declares a key any member does. */\nfunction declaresKey(schema, path, key) {\n\tconst at = schemaAtPath(schema, path);\n\tif (!at.ok) return false;\n\tconst def = defOf(at.schema);\n\tif (def?.type === \"object\") return isPlainObjectLike(def.shape) && key in def.shape;\n\tif (def?.type === \"union\" && Array.isArray(def.options)) return def.options.some((option) => declaresKey(option, [], key));\n\treturn false;\n}\n/** Whether a (property) schema admits an absent value on the OUTPUT side:\n* `.optional()` does; `.default()`/`.prefault()` fill it in, and\n* `.nonoptional()` forbids it. */\nfunction mayBeAbsent(schema) {\n\tlet current = schema;\n\tfor (let guard = 0; guard < 32; guard++) {\n\t\tconst internals = isPlainObjectLike(current) ? current._zod : void 0;\n\t\tif (isPlainObjectLike(internals) && internals.optout === \"optional\") return true;\n\t\tconst def = defOf(current);\n\t\tif (!def) return false;\n\t\tif (def.type === \"optional\") return true;\n\t\tif (def.type === \"default\" || def.type === \"prefault\" || def.type === \"nonoptional\" || !WRAPPERS.has(def.type)) return false;\n\t\tcurrent = def.innerType;\n\t}\n\treturn false;\n}\n/** Whether `key` may be absent from a value of the object schema `schema`:\n* an optional property, or (in a union) one some member makes optional or\n* lacks. A record value or an array element is never optional. */\nfunction optionalKeyIn(schema, key) {\n\tconst unwrapped = schemaAtPath(schema, []);\n\tconst def = unwrapped.ok ? defOf(unwrapped.schema) : void 0;\n\tif (def?.type === \"object\") {\n\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\treturn key in shape && mayBeAbsent(shape[key]);\n\t}\n\tif (def?.type === \"union\" && Array.isArray(def.options)) return def.options.some((option) => {\n\t\tconst inner = schemaAtPath(option, []);\n\t\tconst optionDef = inner.ok ? defOf(inner.schema) : void 0;\n\t\tconst shape = optionDef?.type === \"object\" && isPlainObjectLike(optionDef.shape) ? optionDef.shape : void 0;\n\t\treturn shape !== void 0 && (!(key in shape) || mayBeAbsent(shape[key]));\n\t});\n\treturn false;\n}\n/**\n* Whether the field `path[at]` is OPTIONAL in `schema` (a producer's\n* `outputsSchema`, or a `$map` element schema), given that `path[0..at-1]`\n* exists: the codegen'd `OutputToken<T | undefined>` / `ItemToken<T |\n* undefined>` positions, whose rendered property the resolver omits when\n* the field is absent. False for a record key, an array index, or a path\n* the schema does not describe.\n*/\nfunction isOptionalField(schema, path, at) {\n\tconst key = path[at];\n\tif (typeof key !== \"string\") return false;\n\tconst parent = schemaAtPath(schema, path.slice(0, at));\n\treturn parent.ok && optionalKeyIn(parent.schema, key);\n}\n/** The element schema of a collection schema (array element, record\n* value), or undefined when the schema does not say. */\nfunction elementSchemaOf(schema) {\n\tconst collection = collectionOf(schema);\n\treturn collection.kind === \"array\" || collection.kind === \"record\" ? collection.element : void 0;\n}\n/** The collection kind of a schema (unwrapped): array, record, unknown (no\n* check possible) or something else. */\nfunction collectionOf(schema) {\n\tconst unwrapped = schemaAtPath(schema, []);\n\tconst def = unwrapped.ok ? defOf(unwrapped.schema) : void 0;\n\tif (!def) return { kind: \"unknown\" };\n\tif (def.type === \"array\") return {\n\t\tkind: \"array\",\n\t\telement: def.element\n\t};\n\tif (def.type === \"record\") return {\n\t\tkind: \"record\",\n\t\telement: def.valueType\n\t};\n\tif (def.type === \"object\") {\n\t\tconst catchall = defOf(def.catchall);\n\t\tif (catchall && catchall.type !== \"never\") {\n\t\t\tconst shape = isPlainObjectLike(def.shape) ? def.shape : {};\n\t\t\treturn Object.keys(shape).length === 0 ? {\n\t\t\t\tkind: \"record\",\n\t\t\t\telement: def.catchall\n\t\t\t} : {\n\t\t\t\tkind: \"record\",\n\t\t\t\telement: void 0\n\t\t\t};\n\t\t}\n\t}\n\tif (def.type === \"tuple\") return {\n\t\tkind: \"array\",\n\t\telement: void 0\n\t};\n\tif (def.type === \"any\" || def.type === \"unknown\" || def.type === \"union\") return { kind: \"unknown\" };\n\treturn {\n\t\tkind: \"other\",\n\t\ttype: def.type\n\t};\n}\n/** Every `$output` token's producer exists and its path is valid against\n* the producer's `outputsSchema`; every `$map`'s `over` is a collection\n* there (a record under `into: \"record\"`), and every `$item` path exists\n* in the element schema of the map it binds. */\nfunction checkOutputPaths(host, outputsSchemaOf) {\n\tconst issues = [];\n\tconst elements = /* @__PURE__ */ new Map();\n\tconst elementOf = (scope) => \"error\" in scope ? void 0 : elements.get(scope.token);\n\tfor (const site of collectTokenSites(host)) {\n\t\tif (!tokenSchema.safeParse(site.token).success) continue;\n\t\tif (site.key === \"$map\") {\n\t\t\telements.set(site.token, checkMap(site, outputsSchemaOf, elementOf, issues));\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key === \"$item\") {\n\t\t\tconst scope = scopeOf(site);\n\t\t\tconst element = elementOf(scope);\n\t\t\tif (!element || element.element === void 0 || \"error\" in scope) continue;\n\t\t\tconst itemPath = itemPathOf(site);\n\t\t\tconst hit = schemaAtPath(element.element, itemPath);\n\t\t\tif (!hit.ok) {\n\t\t\t\tconst parent = itemPath.slice(0, hit.at);\n\t\t\t\tissues.push({\n\t\t\t\t\tpath: formatPath(site.path),\n\t\t\t\t\tmessage: `${describeToken(site.token)}: the element${parent.length ? `'s ${formatPath(parent)}` : \"\"} of the $map at ${formatPath(scope.path)}${scope.as ? ` (as \"${scope.as}\")` : \"\"} ${hit.reason} (element of ${element.label}).`\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (site.key !== \"$output\") continue;\n\t\tconst ref = refOf(site);\n\t\tif (!ref) continue;\n\t\tconst path = formatPath(site.path);\n\t\tconst lookup = outputsSchemaOf(ref);\n\t\tif (\"error\" in lookup) {\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: lookup.error\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst outputPath = pathOf(site);\n\t\tconst hit = schemaAtPath(lookup.schema, outputPath);\n\t\tif (!hit.ok) {\n\t\t\tconst parent = outputPath.slice(0, hit.at);\n\t\t\tconst where = parent.length ? `outputs.${formatPath(parent)}` : \"the outputs\";\n\t\t\tissues.push({\n\t\t\t\tpath,\n\t\t\t\tmessage: `${describeToken(site.token)}: ${where} ${hit.reason} in the outputsSchema of ${lookup.label}.`\n\t\t\t});\n\t\t}\n\t}\n\treturn issues;\n}\n/** A `$map`'s `over` against its schema: a collection (a record under\n* `into: \"record\"`). Returns the element schema for the map's `$item`s. */\nfunction checkMap(site, outputsSchemaOf, elementOf, issues) {\n\tconst operand = site.token.$map;\n\tif (!isPlainObject(operand)) return void 0;\n\tconst over = operand.over;\n\tconst into = operand.into === \"record\";\n\tlet schema;\n\tlet label;\n\tif (isPlainObject(over) && \"$output\" in over) {\n\t\tconst overSite = {\n\t\t\t...site,\n\t\t\tkey: \"$output\",\n\t\t\ttoken: over\n\t\t};\n\t\tconst ref = refOf(overSite);\n\t\tif (!ref) return void 0;\n\t\tconst lookup = outputsSchemaOf(ref);\n\t\tif (\"error\" in lookup) return void 0;\n\t\tconst hit = schemaAtPath(lookup.schema, pathOf(overSite));\n\t\tif (!hit.ok) return void 0;\n\t\tschema = hit.schema;\n\t\tlabel = `${describeToken(over)} in the outputsSchema of ${lookup.label}`;\n\t} else if (isPlainObject(over) && \"$item\" in over) {\n\t\tconst overSite = {\n\t\t\t...site,\n\t\t\tkey: \"$item\",\n\t\t\ttoken: over\n\t\t};\n\t\tconst outer = elementOf(scopeOf(overSite));\n\t\tif (!outer || outer.element === void 0) return void 0;\n\t\tconst hit = schemaAtPath(outer.element, itemPathOf(overSite));\n\t\tif (!hit.ok) return void 0;\n\t\tschema = hit.schema;\n\t\tlabel = `${describeToken(over)} (element of ${outer.label})`;\n\t} else return;\n\tconst path = formatPath(site.path);\n\tconst collection = collectionOf(schema);\n\tif (collection.kind === \"unknown\") return void 0;\n\tif (collection.kind === \"other\") {\n\t\tissues.push({\n\t\t\tpath,\n\t\t\tmessage: `$map over ${label} is a ${collection.type}, not an array or a record; a $map iterates a collection.`\n\t\t});\n\t\treturn;\n\t}\n\tif (into && collection.kind === \"array\") {\n\t\tissues.push({\n\t\t\tpath,\n\t\t\tmessage: `$map with into: \"record\" maps over ${label}, which is an array: an array has no keys to keep. Drop into: \"record\" (the result is an array) or map over a record.`\n\t\t});\n\t\treturn;\n\t}\n\treturn {\n\t\telement: collection.element,\n\t\tlabel\n\t};\n}\n//#endregion\n//#region src/resolve/removed-forms.ts\nfunction outputToken(host, path, member) {\n\treturn `{ $output: { host: \"${host}\"${member ? `, member: \"${member}\"` : \"\"}, path: [${path.map((p) => JSON.stringify(p)).join(\", \")}] } }`;\n}\nfunction isDriveReference(value) {\n\tif (!isPlainObject(value)) return false;\n\tconst keys = Object.keys(value).sort();\n\treturn keys.length === 2 && keys[0] === \"from\" && keys[1] === \"slug\" && typeof value.from === \"string\" && typeof value.slug === \"string\";\n}\nfunction checkReactor(reactor, base, found) {\n\tif (!isPlainObject(reactor) || !isPlainObject(reactor.backends)) return;\n\tfor (const [name, backend] of Object.entries(reactor.backends)) {\n\t\tif (!isPlainObject(backend) || !isPlainObject(backend.remote)) continue;\n\t\tconst host = backend.remote.host;\n\t\tif (host === void 0) continue;\n\t\tconst producer = typeof host === \"string\" ? host : \"switchboard\";\n\t\tfound.push({\n\t\t\tpath: `${base}reactor.backends.${name}.remote.host`,\n\t\t\tmessage: `remote: { host } was removed; use a drive address: remote: { url: ${producer}.drives.<slug>.url } with ${producer} from ../${producer}/outputs.js, or remote: { url: ${outputToken(producer, [\n\t\t\t\t\"drives\",\n\t\t\t\t\"<slug>\",\n\t\t\t\t\"url\"\n\t\t\t])} }.`\n\t\t});\n\t}\n}\nfunction checkPlugins(runner, base, memberHosts, found) {\n\tif (!isPlainObject(runner) || !Array.isArray(runner.plugins)) return;\n\trunner.plugins.forEach((entry, index) => {\n\t\tif (!isPlainObject(entry) || !isPlainObject(entry.config)) return;\n\t\tfor (const [key, value] of Object.entries(entry.config)) {\n\t\t\tif (!isDriveReference(value)) continue;\n\t\t\tconst host = memberHosts[value.from] ?? value.from;\n\t\t\tconst member = memberHosts[value.from] ? value.from : void 0;\n\t\t\tfound.push({\n\t\t\t\tpath: `${base}runner.plugins[${index}].config.${key}`,\n\t\t\t\tmessage: `${key}: { from, slug } was removed; use ${host}.drives.${value.slug}.url from ../${host}/outputs.js, or ${outputToken(host, [\n\t\t\t\t\t\"drives\",\n\t\t\t\t\tvalue.slug,\n\t\t\t\t\t\"url\"\n\t\t\t\t])}${member ? ` (add member: \"${member}\" if two members run host \"${host}\")` : \"\"}.`\n\t\t\t});\n\t\t}\n\t});\n}\n/** Every removed form in a host file (reactor or compound), in document\n* order. Compound wrappers are checked too. */\nfunction findRemovedForms(host) {\n\tconst found = [];\n\tif (!isPlainObject(host)) return found;\n\tconst children = isPlainObject(host.children) ? host.children : void 0;\n\tconst memberHosts = {};\n\tfor (const [key, wrapper] of Object.entries(children ?? {})) if (isPlainObject(wrapper) && typeof wrapper.host === \"string\") memberHosts[key] = wrapper.host;\n\tcheckReactor(host.reactor, \"\", found);\n\tcheckPlugins(host.runner, \"\", memberHosts, found);\n\tfor (const [key, wrapper] of Object.entries(children ?? {})) {\n\t\tif (!isPlainObject(wrapper)) continue;\n\t\tcheckReactor(wrapper.reactor, `children.${key}.`, found);\n\t\tcheckPlugins(wrapper.runner, `children.${key}.`, memberHosts, found);\n\t}\n\tif (children && isPlainObject(host.config)) for (const key of [\"projectDrivesIntoConnect\", \"drivesPublicBase\"]) {\n\t\tif (host.config[key] === void 0) continue;\n\t\tfound.push({\n\t\t\tpath: `config.${key}`,\n\t\t\tmessage: `config.${key} was removed; declare the drives on the member that consumes them, by output token: reactor.drives: [{ slug: \"<slug>\", remote: { url: ${outputToken(\"switchboard\", [\n\t\t\t\t\"drives\",\n\t\t\t\t\"<slug>\",\n\t\t\t\t\"url\"\n\t\t\t])} } }].`\n\t\t});\n\t}\n\treturn found;\n}\n//#endregion\n//#region src/env-substitution.ts\n/** The always-resolvable `$env` names (also the `\"${name}\"` sugar). */\nconst BUILTIN_ENV_NAMES = [\"userData\", \"projectRoot\"];\nfunction isBuiltinEnvName(name) {\n\treturn BUILTIN_ENV_NAMES.includes(name);\n}\nconst BUILTIN = new RegExp(`\\\\$\\\\{(${BUILTIN_ENV_NAMES.join(\"|\")})\\\\}`, \"g\");\nfunction substitute(text, env) {\n\treturn text.replace(BUILTIN, (match, name) => env[name] ?? match);\n}\n/** Deep-substitute the built-ins that `env` provides in every string; an\n* absent built-in is left as written. The input is never mutated. */\nfunction substituteBuiltinEnv(value, env) {\n\treturn substituteValue(value, env);\n}\nfunction substituteValue(value, env) {\n\tif (typeof value === \"string\") return substitute(value, env);\n\tif (Array.isArray(value)) return value.map((v) => substituteValue(v, env));\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteValue(v, env);\n\t\treturn out;\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/resolve/plan.ts\n/**\n* The dependency plan (pipeline step 4): which compound member consumes\n* which member's outputs, and the start order that follows. Producers start\n* before consumers; `config.startOrder` is optional and, when given, must\n* agree with the tokens. Cycles fail. Pure.\n*/\nvar PlanError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"PlanError\";\n\t}\n};\n/** The member a ref names: the unique member running `ref.host`, or the\n* member `ref.member` when given (it must run `ref.host`). */\nfunction memberForRef(ref, members) {\n\tif (ref.member !== void 0) {\n\t\tconst named = members.find((m) => m.key === ref.member);\n\t\tif (!named) return { error: `names member \"${ref.member}\", which this compound does not declare (members: ${members.map((m) => m.key).join(\", \")}).` };\n\t\tif (named.host !== ref.host) return { error: `names member \"${ref.member}\" of host \"${ref.host}\", but that member runs host \"${named.host}\".` };\n\t\treturn { key: named.key };\n\t}\n\tconst running = members.filter((m) => m.host === ref.host);\n\tif (running.length === 1) return { key: running[0].key };\n\tif (running.length === 0) return { error: `names host \"${ref.host}\", which no member of this compound runs (members run: ${[...new Set(members.map((m) => m.host))].join(\", \")}).` };\n\treturn { error: `names host \"${ref.host}\", which members ${running.map((m) => `\"${m.key}\"`).join(\" and \")} both run; add member: \"<key>\" to pick one.` };\n}\nfunction edgesOf(members) {\n\tconst edges = [];\n\tconst problems = [];\n\tfor (const member of members) {\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\tfor (const { ref, path } of member.refs) {\n\t\t\tconst target = memberForRef(ref, members);\n\t\t\tif (\"error\" in target) {\n\t\t\t\tproblems.push(`${member.key}: ${path} ${target.error}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (target.key === member.key) {\n\t\t\t\tproblems.push(`${member.key}: ${path} reads ${refKey(ref)}'s outputs, which is this member itself.`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (seen.has(target.key)) continue;\n\t\t\tseen.add(target.key);\n\t\t\tedges.push({\n\t\t\t\tconsumer: member.key,\n\t\t\t\tproducer: target.key,\n\t\t\t\tpath\n\t\t\t});\n\t\t}\n\t}\n\tif (problems.length > 0) throw new PlanError(problems.join(\"\\n\"));\n\treturn edges;\n}\n/** Declared start order: the named members first, then the rest in\n* declaration order. */\nfunction declaredOrder(members, startOrder) {\n\tconst keys = members.map((m) => m.key);\n\tconst named = [...new Set(startOrder)].filter((k) => keys.includes(k));\n\treturn [...named, ...keys.filter((k) => !named.includes(k))];\n}\nfunction planCompound(members, startOrder) {\n\tconst edges = edgesOf(members);\n\tif (startOrder) {\n\t\tconst order = declaredOrder(members, startOrder);\n\t\tconst index = new Map(order.map((k, i) => [k, i]));\n\t\tconst bad = edges.filter((e) => (index.get(e.producer) ?? 0) > (index.get(e.consumer) ?? 0));\n\t\tif (bad.length > 0) throw new PlanError(bad.map((e) => `config.startOrder starts \"${e.consumer}\" before \"${e.producer}\", but ${e.consumer}.${e.path} consumes \"${e.producer}\"'s outputs. Reorder startOrder (or omit it: the order follows the tokens).`).join(\"\\n\"));\n\t\treturn {\n\t\t\torder,\n\t\t\tedges,\n\t\t\tsource: \"startOrder\"\n\t\t};\n\t}\n\tconst pending = new Map(members.map((m) => [m.key, /* @__PURE__ */ new Set()]));\n\tfor (const e of edges) pending.get(e.consumer)?.add(e.producer);\n\tconst order = [];\n\twhile (order.length < members.length) {\n\t\tconst next = members.find((m) => !order.includes(m.key) && pending.get(m.key)?.size === 0);\n\t\tif (!next) {\n\t\t\tconst stuck = members.filter((m) => !order.includes(m.key));\n\t\t\tthrow new PlanError(`output tokens form a cycle between ${stuck.map((m) => `\"${m.key}\"`).join(\", \")}: ${edges.filter((e) => stuck.some((m) => m.key === e.consumer) && stuck.some((m) => m.key === e.producer)).map((e) => `${e.consumer} (${e.path}) needs ${e.producer}`).join(\"; \")}.`);\n\t\t}\n\t\torder.push(next.key);\n\t\tfor (const set of pending.values()) set.delete(next.key);\n\t}\n\treturn {\n\t\torder,\n\t\tedges,\n\t\tsource: \"tokens\"\n\t};\n}\n//#endregion\n//#region src/resolve/resolve.ts\nvar TokenResolutionError = class extends Error {\n\t/** The host path that failed and the reason, without the file prefix. */\n\tdetail;\n\tconstructor(message, detail) {\n\t\tsuper(message);\n\t\tthis.name = \"TokenResolutionError\";\n\t\tif (detail) this.detail = detail;\n\t}\n};\n/** Why a required `$env` cannot resolve. */\nfunction unsetEnvMessage(name) {\n\treturn `reads $env ${name}, which is not set. Set ${name} in the environment of the process that resolves this host (or declare { $env: { name: \"${name}\", optional: true } } to omit the property when unset).`;\n}\n/** A resolved `{ $env: { name, optional: true } }` whose variable is unset,\n* or an `$output`/`$item` reading an absent optional field: its enclosing\n* property is omitted. */\nconst OMIT = Symbol(\"omit\");\n/** `reactor.drives[\"workflows\"]` (or `…[2]` for an array element). */\nfunction elementText(binding) {\n\tconst key = typeof binding.key === \"number\" ? `[${binding.key}]` : `[${JSON.stringify(binding.key)}]`;\n\treturn `${formatPath(binding.path)}${key}`;\n}\n/** Provenance of `$map`-rendered arrays: element index → the input key\n* (record key, or array index) it was rendered from. Lets resolved\n* validation name the element key, not just the result index. */\nconst renderedKeys = /* @__PURE__ */ new WeakMap();\n/**\n* The `$map` elements an issue path (from resolved validation of a resolved\n* host) passes through, as text: `$map element \"workflows\"`. Undefined when\n* the path crosses no `$map`-rendered array. Walk the SAME object\n* `resolveHostOutputs` returned (provenance is by identity).\n*/\nfunction describeMapElements(host, path) {\n\tconst found = [];\n\tlet current = host;\n\tfor (const segment of path) if (Array.isArray(current) && typeof segment === \"number\") {\n\t\tconst key = renderedKeys.get(current)?.[segment];\n\t\tif (key !== void 0) found.push(`$map element ${typeof key === \"number\" ? `[${key}]` : JSON.stringify(key)}`);\n\t\tcurrent = current[segment];\n\t} else if (isPlainObject(current) && typeof segment === \"string\") current = current[segment];\n\telse break;\n\treturn found.length ? found.join(\" › \") : void 0;\n}\n/** A deep copy of a resolved (JSON-shaped) value that keeps the `$map`\n* provenance of its rendered arrays (structuredClone would drop it). */\nfunction cloneWithProvenance(value) {\n\tif (Array.isArray(value)) {\n\t\tconst copy = value.map(cloneWithProvenance);\n\t\tconst keys = renderedKeys.get(value);\n\t\tif (keys) renderedKeys.set(copy, keys);\n\t\treturn copy;\n\t}\n\tif (isPlainObject(value)) {\n\t\tconst copy = {};\n\t\tfor (const [key, child] of Object.entries(value)) copy[key] = cloneWithProvenance(child);\n\t\treturn copy;\n\t}\n\treturn value;\n}\n/** The value at `path` inside `root` (output data: records and arrays). */\nfunction walkPath(root, path) {\n\tlet current = root;\n\tfor (let i = 0; i < path.length; i++) {\n\t\tconst segment = path[i];\n\t\tconst next = Array.isArray(current) ? typeof segment === \"number\" ? current[segment] : void 0 : isPlainObject(current) && typeof segment === \"string\" ? current[segment] : void 0;\n\t\tif (next === void 0) {\n\t\t\tconst has = isPlainObject(current) ? Object.keys(current).join(\", \") || \"nothing\" : Array.isArray(current) ? `${current.length} elements` : JSON.stringify(current);\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tat: i,\n\t\t\t\thas\n\t\t\t};\n\t\t}\n\t\tcurrent = next;\n\t}\n\treturn {\n\t\tok: true,\n\t\tvalue: current\n\t};\n}\n/** The schema at `path` inside `schema`, when both are known. */\nfunction schemaOf(schema, path) {\n\tif (schema === void 0) return void 0;\n\tconst hit = schemaAtPath(schema, path);\n\treturn hit.ok ? hit.schema : void 0;\n}\nfunction pathSegments(path) {\n\treturn path.filter((p) => typeof p === \"string\" || typeof p === \"number\");\n}\nvar Resolver = class {\n\tsources;\n\tself;\n\tdeferred = [];\n\t/** What the last OMIT stood for, for the \"nothing to omit\" errors. */\n\tomitted = \"an optional $env\";\n\tconstructor(sources, self) {\n\t\tthis.sources = sources;\n\t\tthis.self = self;\n\t}\n\t/** The member keys a token reads (`$output` on a member's host), when\n\t* resolving a compound's own fields with `deferSelf`. */\n\tselfRefs(token, trail) {\n\t\tif (!this.self) return [];\n\t\tconst keys = /* @__PURE__ */ new Set();\n\t\tfor (const site of collectTokenSites(token)) {\n\t\t\tconst operand = site.token.$output;\n\t\t\tif (site.key !== \"$output\" || !isPlainObject(operand)) continue;\n\t\t\tif (typeof operand.host !== \"string\") continue;\n\t\t\tconst ref = typeof operand.member === \"string\" ? {\n\t\t\t\thost: operand.host,\n\t\t\t\tmember: operand.member\n\t\t\t} : { host: operand.host };\n\t\t\tif (this.self === \"outputs\") {\n\t\t\t\tkeys.add(refKey(ref));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!this.self.members.some((m) => m.host === ref.host)) continue;\n\t\t\tconst target = memberForRef(ref, this.self.members);\n\t\t\tif (\"error\" in target) this.fail([...trail, ...site.path], `in a compound ${target.error}`);\n\t\t\tkeys.add(target.key);\n\t\t}\n\t\treturn [...keys];\n\t}\n\tfail(trail, message, scope = []) {\n\t\tconst where = this.sources.where ? `${this.sources.where}: ` : \"\";\n\t\tconst inside = scope.length ? ` (rendering $map element ${scope.map(elementText).join(\" › \")})` : \"\";\n\t\tconst path = formatPath(trail);\n\t\tthrow new TokenResolutionError(`${where}\\`${path}\\` ${message}${inside}`, {\n\t\t\tpath,\n\t\t\treason: `${message}${inside}`\n\t\t});\n\t}\n\tvalue(value, trail, scope = []) {\n\t\tif (typeof value === \"string\") return this.sources.builtins ? substituteBuiltinEnv(value, this.sources.builtins) : value;\n\t\tif (Array.isArray(value)) return value.map((child, index) => {\n\t\t\tconst out = this.value(child, [...trail, index], scope);\n\t\t\tif (out === OMIT) this.fail([...trail, index], `is ${this.omitted} inside an array.`, scope);\n\t\t\treturn out;\n\t\t});\n\t\tif (!isPlainObject(value)) return value;\n\t\tif (isEscape(value)) return structuredClone(value);\n\t\tif (tokenKeyOf(value)) {\n\t\t\tconst members = scope.length === 0 ? this.selfRefs(value, trail) : [];\n\t\t\tif (members.length > 0) {\n\t\t\t\tthis.deferred.push({\n\t\t\t\t\ttrail,\n\t\t\t\t\ttoken: value,\n\t\t\t\t\tmembers\n\t\t\t\t});\n\t\t\t\treturn structuredClone(value);\n\t\t\t}\n\t\t\treturn this.token(value, trail, scope);\n\t\t}\n\t\tconst out = {};\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\tif (typeof this.self === \"object\" && trail.length === 0 && key === \"children\") {\n\t\t\t\tout[key] = child;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = this.value(child, [...trail, key], scope);\n\t\t\tif (resolved !== OMIT) out[key] = resolved;\n\t\t}\n\t\treturn out;\n\t}\n\ttoken(token, trail, scope = []) {\n\t\tif (!tokenSchema.safeParse(token).success) this.fail(trail, `is a malformed token: ${JSON.stringify(token)}.`, scope);\n\t\tswitch (tokenKeyOf(token)) {\n\t\t\tcase \"$output\": return this.output(token, trail, scope);\n\t\t\tcase \"$env\": return this.env(token.$env, trail, scope);\n\t\t\tcase \"$concat\": return this.concat(token.$concat, trail, scope);\n\t\t\tcase \"$map\": return this.map(token.$map, trail, scope);\n\t\t\tcase \"$item\": return this.item(token.$item, trail, scope);\n\t\t\tcase \"$key\": return this.key(token.$key, trail, scope);\n\t\t\tdefault: return this.fail(trail, `is not a token.`, scope);\n\t\t}\n\t}\n\t/** The binding an `$item`/`$key` names: the innermost map, or the\n\t* enclosing map whose `as` is `name`. */\n\tbinding(name, operator, trail, scope) {\n\t\tif (scope.length === 0) return this.fail(trail, `uses ${operator} outside any $map; ${operator} reads the element a $map template is rendering.`);\n\t\tif (name === void 0) return scope[scope.length - 1];\n\t\tfor (let i = scope.length - 1; i >= 0; i--) if (scope[i].as === name) return scope[i];\n\t\tconst named = scope.flatMap((b) => b.as ? [`\"${b.as}\"`] : []);\n\t\treturn this.fail(trail, `uses ${operator} with binding \"${name}\", which no enclosing $map declares (as: ${named.join(\", \") || \"none\"}).`, scope);\n\t}\n\tmap(operand, trail, scope) {\n\t\tif (!isPlainObject(operand)) return this.fail(trail, \"is a malformed $map token.\", scope);\n\t\tconst into = operand.into === \"record\";\n\t\tconst as = typeof operand.as === \"string\" ? operand.as : void 0;\n\t\tconst read = this.readWithSchema(operand.over, [\n\t\t\t...trail,\n\t\t\t\"$map\",\n\t\t\t\"over\"\n\t\t], scope);\n\t\tconst over = read.value;\n\t\tif (over === OMIT) return OMIT;\n\t\tconst element = read.schema === void 0 ? void 0 : elementSchemaOf(read.schema);\n\t\tconst render = (key, item) => {\n\t\t\tconst inner = [...scope, {\n\t\t\t\tpath: trail,\n\t\t\t\tkey,\n\t\t\t\titem,\n\t\t\t\t...as !== void 0 ? { as } : {},\n\t\t\t\t...element !== void 0 ? { schema: element } : {}\n\t\t\t}];\n\t\t\tconst at = [\n\t\t\t\t...trail,\n\t\t\t\t\"$map\",\n\t\t\t\t\"to\"\n\t\t\t];\n\t\t\tconst out = this.value(operand.to, at, inner);\n\t\t\tif (out === OMIT) return this.fail(at, `is ${this.omitted} as the whole $map template; there is no property to omit.`, inner);\n\t\t\treturn out;\n\t\t};\n\t\tif (Array.isArray(over)) {\n\t\t\tif (into) return this.fail(trail, `is a $map with into: \"record\", but its over (${describeToken(operand.over)}) resolved to an array, which has no keys to keep. Drop into: \"record\" (the result is an array) or map over a record.`, scope);\n\t\t\tconst rendered = over.map((item, index) => render(index, item));\n\t\t\trenderedKeys.set(rendered, over.map((_, index) => index));\n\t\t\treturn rendered;\n\t\t}\n\t\tif (isPlainObject(over)) {\n\t\t\tconst keys = Object.keys(over).sort();\n\t\t\tif (!into) {\n\t\t\t\tconst rendered = keys.map((key) => render(key, over[key]));\n\t\t\t\trenderedKeys.set(rendered, keys);\n\t\t\t\treturn rendered;\n\t\t\t}\n\t\t\tconst out = {};\n\t\t\tfor (const key of keys) out[key] = render(key, over[key]);\n\t\t\treturn out;\n\t\t}\n\t\treturn this.fail(trail, `is a $map whose over (${describeToken(operand.over)}) resolved to ${JSON.stringify(over)}${into ? `; into: \"record\" needs a record` : \", which is not an array or a record\"}.`, scope);\n\t}\n\titem(operand, trail, scope) {\n\t\treturn this.readItem(operand, trail, scope).value;\n\t}\n\t/** A `$map`'s `over` with the schema describing it, when it reads a\n\t* schema'd `$output` (or an `$item` of a schema'd element). */\n\treadWithSchema(value, trail, scope) {\n\t\tconst key = tokenKeyOf(value);\n\t\tif (isPlainObject(value) && (key === \"$output\" || key === \"$item\") && tokenSchema.safeParse(value).success) return key === \"$output\" ? this.readOutput(value, trail, scope) : this.readItem(value.$item, trail, scope);\n\t\treturn { value: this.value(value, trail, scope) };\n\t}\n\tomit(what) {\n\t\tthis.omitted = what;\n\t\treturn { value: OMIT };\n\t}\n\treadItem(operand, trail, scope) {\n\t\tconst named = isPlainObject(operand) ? operand : void 0;\n\t\tconst name = named && typeof named.as === \"string\" ? named.as : void 0;\n\t\tconst raw = named ? named.path : operand;\n\t\tconst path = pathSegments(Array.isArray(raw) ? raw : []);\n\t\tconst binding = this.binding(name, \"$item\", trail, scope);\n\t\tconst hit = walkPath(binding.item, path);\n\t\tif (!hit.ok) {\n\t\t\tif (binding.schema !== void 0 && isOptionalField(binding.schema, path, hit.at)) return this.omit(\"an absent optional $item field\");\n\t\t\tconst missing = formatPath(path.slice(0, hit.at + 1));\n\t\t\treturn this.fail(trail, `reads $item ${formatPath(path)}, but $map element ${elementText(binding)} has no ${missing} (it has: ${hit.has}).`, scope);\n\t\t}\n\t\treturn {\n\t\t\tvalue: structuredClone(hit.value),\n\t\t\tschema: schemaOf(binding.schema, path)\n\t\t};\n\t}\n\tkey(operand, trail, scope) {\n\t\tconst name = typeof operand === \"string\" ? operand : void 0;\n\t\treturn this.binding(name, \"$key\", trail, scope).key;\n\t}\n\toutput(token, trail, scope = []) {\n\t\treturn this.readOutput(token, trail, scope).value;\n\t}\n\treadOutput(token, trail, scope) {\n\t\tconst operand = token.$output;\n\t\tif (!isPlainObject(operand) || typeof operand.host !== \"string\") return this.fail(trail, \"is a malformed $output token.\", scope);\n\t\tconst ref = typeof operand.member === \"string\" ? {\n\t\t\thost: operand.host,\n\t\t\tmember: operand.member\n\t\t} : { host: operand.host };\n\t\tconst path = pathSegments(Array.isArray(operand.path) ? operand.path : []);\n\t\tif (!this.sources.outputs) return this.fail(trail, `reads ${describeToken(token)}, but no outputs are available here.`, scope);\n\t\tconst lookup = this.sources.outputs.lookup(ref);\n\t\tif (lookup.status === \"unavailable\") {\n\t\t\tconst where = this.sources.where ? `${this.sources.where}: ` : \"\";\n\t\t\tconst path = formatPath(trail);\n\t\t\tconst reason = `${lookup.message}\\n (needed by \\`${path}\\`: ${describeToken(token)})`;\n\t\t\tthrow new TokenResolutionError(`${where}${reason}`, {\n\t\t\t\tpath,\n\t\t\t\treason\n\t\t\t});\n\t\t}\n\t\tconst hit = walkPath(lookup.outputs, path);\n\t\tif (!hit.ok) {\n\t\t\tif (lookup.schema !== void 0 && isOptionalField(lookup.schema, path, hit.at)) return this.omit(\"an absent optional output\");\n\t\t\tconst parent = path.slice(0, hit.at);\n\t\t\tconst container = parent.length ? `outputs.${formatPath(parent)}` : \"its outputs\";\n\t\t\tconst missing = formatPath(path.slice(0, hit.at + 1));\n\t\t\treturn this.fail(trail, `reads ${describeToken(token)}, but host \"${ref.host}\" has no output at ${missing} (${container} has: ${hit.has}).`, scope);\n\t\t}\n\t\treturn {\n\t\t\tvalue: structuredClone(hit.value),\n\t\t\tschema: schemaOf(lookup.schema, path)\n\t\t};\n\t}\n\tenv(operand, trail, scope = []) {\n\t\tconst optional = isPlainObject(operand);\n\t\tconst name = optional ? operand.name : operand;\n\t\tif (typeof name !== \"string\") return this.fail(trail, \"is a malformed $env token.\", scope);\n\t\tconst builtins = this.sources.builtins;\n\t\tif (isBuiltinEnvName(name) && builtins?.[name]) return builtins[name];\n\t\tconst value = this.sources.env?.[name];\n\t\tif (value !== void 0) return value;\n\t\tif (optional) return this.omit(\"an optional $env\").value;\n\t\treturn this.fail(trail, unsetEnvMessage(name), scope);\n\t}\n\tconcat(parts, trail, scope = []) {\n\t\tif (!Array.isArray(parts)) return this.fail(trail, \"is a malformed $concat token.\", scope);\n\t\treturn parts.map((part, index) => {\n\t\t\tconst at = [\n\t\t\t\t...trail,\n\t\t\t\t\"$concat\",\n\t\t\t\tindex\n\t\t\t];\n\t\t\tconst value = this.value(part, at, scope);\n\t\t\tif (value === OMIT) return this.fail(at, `is ${this.omitted} inside $concat.`, scope);\n\t\t\tif (typeof value === \"string\") return value;\n\t\t\tif (typeof value === \"number\") return String(value);\n\t\t\treturn this.fail(at, `resolved to ${JSON.stringify(value)}; every $concat part must be a string or a number.`, scope);\n\t\t}).join(\"\");\n\t}\n};\nfunction resolveHostOutputs(host, sources, options) {\n\tconst resolver = new Resolver(sources, options?.deferSelf);\n\tconst out = resolver.value(host, []);\n\tif (out === OMIT) resolver.fail([], `is ${resolver.omitted} with nothing to omit it from.`);\n\tconst partial = out;\n\tif (!options) return partial;\n\tconst sites = resolver.deferred;\n\treturn {\n\t\thost: partial,\n\t\tdeferred: sites.map((d) => ({\n\t\t\tpath: formatPath(d.trail),\n\t\t\tmembers: d.members\n\t\t})),\n\t\tneeds: [...new Set(sites.flatMap((d) => d.members))],\n\t\tfinish(outputs) {\n\t\t\tconst done = cloneWithProvenance(partial);\n\t\t\tconst late = new Resolver({\n\t\t\t\t...sources,\n\t\t\t\toutputs\n\t\t\t});\n\t\t\tfor (const site of sites) {\n\t\t\t\tconst value = late.token(site.token, site.trail);\n\t\t\t\tif (value === OMIT && typeof site.trail.at(-1) === \"number\") late.fail(site.trail, `is ${late.omitted} inside an array.`);\n\t\t\t\tsetAt(done, site.trail, value === OMIT ? void 0 : value, value === OMIT);\n\t\t\t}\n\t\t\treturn done;\n\t\t}\n\t};\n}\n/**\n* What a one-shot verb (build) gets for a `$map`: no outputs exist there, so\n* every map in `declared` renders no elements (`[]`, or `{}` with into:\n* \"record\") at its path in `host`, the declared-form parse of `declared`.\n* Other tokens stay, as they do in token-able fields.\n*/\nfunction emptyMaps(host, declared) {\n\tconst maps = collectTokenSites(declared).filter((site) => site.key === \"$map\" && site.scopes.length === 0 && site.position !== \"concat\");\n\tif (maps.length === 0) return host;\n\tconst out = cloneWithProvenance(host);\n\tfor (const { path, token } of maps) {\n\t\tconst operand = token.$map;\n\t\tsetAt(out, path, isPlainObject(operand) && operand.into === \"record\" ? {} : [], false);\n\t}\n\treturn out;\n}\nfunction setAt(root, trail, value, omit) {\n\tlet current = root;\n\tfor (const key of trail.slice(0, -1)) if (Array.isArray(current) && typeof key === \"number\") current = current[key];\n\telse if (isPlainObject(current) && typeof key === \"string\") current = current[key];\n\telse return;\n\tconst last = trail[trail.length - 1];\n\tif (Array.isArray(current) && typeof last === \"number\") current[last] = value;\n\telse if (isPlainObject(current) && typeof last === \"string\") {\n\t\tif (omit) delete current[last];\n\t\telse current[last] = value;\n\t}\n}\n//#endregion\n//#region src/runner-resolver.ts\n/**\n* Resolves a host's `runner.module` specifier from the PROJECT's dependency\n* tree (not ph-cli's), imports it, and checks the runner-module contract:\n* `{ run, hostSchema, kind, outputsSchema?, verbs?, ...optionalVerbs }`.\n*/\nvar RunnerError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"RunnerError\";\n\t}\n};\n/** Whether a value is zod-shaped (has a `safeParse` function): a runner's\n* `outputsSchema`, a plugin's config schema. */\nfunction isSchemaLike(value) {\n\treturn typeof value === \"object\" && value !== null && \"safeParse\" in value && typeof value.safeParse === \"function\";\n}\n/** The Connect runner's specifier: compounds forward `cspRegistrySync` to\n* it, and `--explain` prints its dead-config warnings. */\nconst CONNECT_RUNNER = \"@powerhousedao/ph-cli/runners/connect\";\n/** Exports that are part of the contract but are not verbs. */\nconst NON_VERB_EXPORTS = /* @__PURE__ */ new Set([\n\t\"hostSchema\",\n\t\"declaredHostSchema\",\n\t\"outputsSchema\",\n\t\"verbs\",\n\t\"argsSchema\",\n\t\"kind\",\n\t\"checkBoot\",\n\t\"default\"\n]);\n/** ph-cli's runners are ph-run's plus the verbs that build. A packaged app has\n* only ph-run, and its host files, generated against ph-cli's, name ph-cli's. */\nfunction runnerFallback(specifier) {\n\tconst name = /^@powerhousedao\\/ph-cli\\/(runners\\/.+)$/.exec(specifier)?.[1];\n\treturn name ? `@powerhousedao/ph-run/${name}` : void 0;\n}\nasync function resolveRunnerModule(projectRoot, specifier) {\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tconst resolveFirst = (candidates) => {\n\t\tconst [first, ...rest] = candidates;\n\t\ttry {\n\t\t\treturn projectRequire.resolve(first);\n\t\t} catch (error) {\n\t\t\tif (rest.length === 0) throw error;\n\t\t\treturn resolveFirst(rest);\n\t\t}\n\t};\n\tlet resolved;\n\ttry {\n\t\tconst fallback = runnerFallback(specifier);\n\t\tresolved = resolveFirst(fallback ? [specifier, fallback] : [specifier]);\n\t} catch {\n\t\tthrow new RunnerError(`Cannot resolve runner module \"${specifier}\" from ${projectRoot}.`, \"The runner must be a dependency of the project (install it, then retry).\");\n\t}\n\tconst module = await import(pathToFileURL(resolved).href);\n\tif (typeof module.run !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`run\\` function (required verb).`);\n\tconst hostSchema = module.hostSchema;\n\tif (!hostSchema || typeof hostSchema.safeParse !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`hostSchema\\` — runners validate their own host shape.`);\n\tconst declared = module.declaredHostSchema;\n\tif (declared !== void 0 && typeof declared.safeParse !== \"function\") throw new RunnerError(`Runner \"${specifier}\" exports a \\`declaredHostSchema\\` without safeParse.`);\n\tif (module.checkBoot !== void 0 && typeof module.checkBoot !== \"function\") throw new RunnerError(`Runner \"${specifier}\" exports a \\`checkBoot\\` that is not a function.`);\n\tconst verbs = module.verbs;\n\tif (verbs !== void 0 && (!Array.isArray(verbs) || !verbs.every((verb) => typeof verb === \"string\" && typeof module[verb] === \"function\"))) throw new RunnerError(`Runner \"${specifier}\" exports \\`verbs\\` ${JSON.stringify(verbs)}, which must list names of exported functions.`);\n\tif (!runnerKindSchema.safeParse(module.kind).success) throw new RunnerError(`Runner \"${specifier}\" does not export a valid \\`kind\\` (got ${JSON.stringify(module.kind)}; expected \"reactor\" | \"compound\").`);\n\treturn module;\n}\n/** Verbs that produce something and start nothing (`build`): no outputs, no\n* record, no lock — and no token resolution, since what they read (output\n* dirs, packages) never comes from another host's outputs. Their verb gets\n* the declared host (tokens may remain in token-able fields; a `$map` is\n* the empty collection, see `emptyMaps`). */\nconst ONE_SHOT_VERBS = /* @__PURE__ */ new Set([\"build\"]);\n/** Verbs that work on a host's stores and start nothing (`migrate`,\n* `migrate-status`, `reset`). Their host is resolved as for `run`, so they\n* address the stores `run` opens; they take no lock and return nothing, so\n* no record is written. A compound does not forward them. */\nconst STORE_VERBS = /* @__PURE__ */ new Set([\n\t\"migrate\",\n\t\"migrate-status\",\n\t\"reset\"\n]);\nfunction listVerbs(runner) {\n\tif (runner.verbs) return runner.verbs.filter((name) => typeof runner[name] === \"function\").toSorted();\n\treturn Object.entries(runner).filter(([name, value]) => typeof value === \"function\" && !NON_VERB_EXPORTS.has(name)).map(([name]) => name).sort();\n}\nfunction getVerb(runner, specifier, verb) {\n\tconst candidate = runner[verb];\n\tif (typeof candidate !== \"function\" || !listVerbs(runner).includes(verb)) throw new RunnerError(`Runner \"${specifier}\" does not support the verb \"${verb}\". Supported verbs: ${listVerbs(runner).join(\", \")}.`);\n\treturn candidate;\n}\nfunction isRecord$2(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** reactor XOR children, decided by the runner's declared `kind`. */\nfunction kindShapeIssues(kind, specifier, host) {\n\tif (kind === \"reactor\" && host.children !== void 0) return [{\n\t\tpath: \"children\",\n\t\tmessage: `\"${specifier}\" is a reactor runner, so the host must not declare \\`children\\`.`,\n\t\thint: \"`children` belongs to compound hosts; a reactor host configures its own `reactor` block.\"\n\t}];\n\tif (kind === \"compound\" && host.reactor !== void 0) return [{\n\t\tpath: \"reactor\",\n\t\tmessage: `\"${specifier}\" is a compound runner, so the host must not declare \\`reactor\\`.`,\n\t\thint: \"A compound's reactors are its members': configure them in the member host or a wrapper's `reactor` override.\"\n\t}];\n\treturn [];\n}\nfunction assertKindShape(kind, specifier, host, file) {\n\tconst issue = kindShapeIssues(kind, specifier, host).at(0);\n\tif (issue) throw new RunnerError(`${file}: ${issue.message}`, issue.hint);\n}\n/** `runner.defaultVerb` and every plugin entry's `verbs` must name verbs\n* this runner exports. */\nfunction knownVerbIssues(runner, specifier, host) {\n\tconst options = host.runner;\n\tif (!isRecord$2(options)) return [];\n\tconst verbs = listVerbs(runner);\n\tconst unknownVerb = (verb) => typeof verb === \"string\" && !verbs.includes(verb);\n\tconst issues = [];\n\tif (unknownVerb(options.defaultVerb)) issues.push({\n\t\tpath: \"runner.defaultVerb\",\n\t\tmessage: `runner.defaultVerb \"${options.defaultVerb}\" is not a verb of \"${specifier}\". Supported verbs: ${verbs.join(\", \")}.`\n\t});\n\t(Array.isArray(options.plugins) ? options.plugins : []).forEach((entry, index) => {\n\t\tif (!isRecord$2(entry) || !Array.isArray(entry.verbs)) return;\n\t\tconst scoped = entry.verbs;\n\t\tfor (const bad of scoped.filter(unknownVerb)) issues.push({\n\t\t\tpath: `runner.plugins[${index}].verbs`,\n\t\t\tmessage: `plugin \"${String(entry.module)}\" is scoped to verb \"${bad}\", which \"${specifier}\" does not export. Supported verbs: ${verbs.join(\", \")}.`\n\t\t});\n\t});\n\treturn issues;\n}\nfunction formatIssues(issues) {\n\treturn issues.map((i) => ` - ${i.path}: ${i.message}`).join(\"\\n\");\n}\nfunction valueAt(host, path) {\n\tlet current = host;\n\tfor (const key of path) if (Array.isArray(current) && typeof key === \"number\") current = current[key];\n\telse if (isRecord$2(current) && typeof key === \"string\") current = current[key];\n\telse return;\n\treturn current;\n}\n/**\n* Resolved validation (pipeline step 6): validate a RESOLVED host against\n* its runner's `hostSchema` and return the PARSED host (what the verb\n* receives). Run `resolveHostOutputs` first; a token still present fails\n* with its path.\n*/\nfunction validateHost(runner, specifier, host, file, options = {}) {\n\treturn parseHost(runner, options.tokens === \"allow\" ? runner.declaredHostSchema ?? runner.hostSchema : runner.hostSchema, specifier, host, file, options);\n}\n/** What `validateHost` checks, as data: nothing throws. */\nfunction hostSchemaIssues(runner, schema, specifier, host, options = {}) {\n\tconst issues = [];\n\tif (isRecord$2(host)) {\n\t\tissues.push(...kindShapeIssues(runner.kind, specifier, host));\n\t\tif (options.tokens !== \"allow\") {\n\t\t\tconst token = findToken(host);\n\t\t\tif (token) issues.push({\n\t\t\t\tpath: token.path,\n\t\t\t\tmessage: `\\`${token.path}\\` is an unresolved output token (${token.key}).`,\n\t\t\t\thint: \"Resolve the host (resolveHostOutputs) before validating it for a verb; `ph run` does this.\"\n\t\t\t});\n\t\t}\n\t\tissues.push(...knownVerbIssues(runner, specifier, host));\n\t}\n\tconst result = schema.safeParse(unwrapEscapes(host));\n\tif (result.success) return {\n\t\tissues,\n\t\tdata: result.data\n\t};\n\treturn {\n\t\tissues,\n\t\tschemaIssues: result.error.issues.map((issue) => {\n\t\t\tconst element = describeMapElements(host, issue.path);\n\t\t\tconst dotted = (issue.path.map(String).join(\".\") || \"<root>\") + (element ? ` (${element})` : \"\");\n\t\t\tconst message = issue.code !== \"custom\" && tokenKeyOf(valueAt(host, issue.path)) ? \"this field does not take an output token (it is not token-able); spell the value literally.\" : issue.message;\n\t\t\treturn {\n\t\t\t\tpath: formatPath(issue.path.filter((key) => typeof key === \"string\" || typeof key === \"number\")),\n\t\t\t\tmessage: element ? `${message} (${element})` : message,\n\t\t\t\tprinted: `${dotted}: ${message}`\n\t\t\t};\n\t\t})\n\t};\n}\nfunction parseHost(runner, schema, specifier, host, file, options) {\n\tconst checked = hostSchemaIssues(runner, schema, specifier, host, options);\n\tconst first = checked.issues.at(0);\n\tif (first) throw new RunnerError(`${file}: ${first.message}`, first.hint);\n\tif (checked.schemaIssues) throw new RunnerError(`${file} failed validation against the hostSchema of \"${specifier}\":\\n${checked.schemaIssues.map((issue) => ` - ${issue.printed}`).join(\"\\n\") || \" (no details reported)\"}`);\n\treturn checked.data;\n}\n/**\n* Declared validation (pipeline step 3): the removed cross-host forms\n* (each error names its token form), token shapes and `$env` `optional`\n* placement, `$output` paths against the producers' `outputsSchema`s, then\n* the runner's `declaredHostSchema` (tokens allowed in token-able fields).\n* Reads no environment value and needs no producer running. Throws on the\n* first failing stage; resolve, then `validateHost`, before a verb runs.\n*/\nfunction validateDeclaredHost(runner, specifier, host, file, options = {}) {\n\tconst removed = findRemovedForms(host);\n\tif (removed.length > 0) throw new RunnerError(`${file}: removed form:\\n${formatIssues(removed)}`);\n\tconst issues = checkTokenSites(host);\n\tif (options.outputsSchemaOf) issues.push(...checkOutputPaths(host, options.outputsSchemaOf));\n\tif (issues.length > 0) throw new RunnerError(`${file}: invalid output token:\\n${formatIssues(issues)}`);\n\tif (isRecord$2(host)) assertKindShape(runner.kind, specifier, host, file);\n\tif (!runner.declaredHostSchema) return;\n\tparseHost(runner, runner.declaredHostSchema, specifier, host, file, { tokens: \"allow\" });\n}\n//#endregion\n//#region src/host-loader.ts\n/**\n* Loads and pre-validates a `hosts/<name>/host.js` definition.\n*\n* A host file is a static PROJECTION of powerhouse.config.json: plain ESM,\n* default-exporting a data object. Three gates run before any runner sees it:\n* 1. import lint — the only legal imports are the project's\n* powerhouse.config.json, sibling `../<host>/host.js` files and sibling\n* generated `../<host>/outputs.js` token trees (host files are data, not\n* programs; `process.` is banned, environment values go through `$env`).\n* An imported outputs.js whose schema hash no longer matches its\n* producer fails here (\"run `ph generate hosts`\");\n* 2. static check — the exported object must survive a JSON round trip\n* (functions, undefined, class instances, Dates etc. are rejected,\n* reporting the offending path);\n* 3. shape pre-check — `name`, `runner.module`, and the reactor XOR children\n* rule. Full validation is the runner's `hostSchema` (phase 2).\n*\n* This module never exits the process — callers own error presentation.\n*/\nconst HOST_FILE = \"host.js\";\nconst CONFIG_IMPORT_SUFFIX = \"powerhouse.config.json\";\nvar HostLoadError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"HostLoadError\";\n\t}\n};\n/** A `hosts/` folder with no `<name>/host.js` inside is \"empty\" — the guard\n* state: callers warn loudly and fall back to legacy rather than activating\n* the new architecture off a stray `mkdir hosts`. */\nfunction probeHostsFolder(projectRoot) {\n\tconst dir = path.join(projectRoot, \"hosts\");\n\tif (!existsSync(dir) || !statSync(dir).isDirectory()) return { kind: \"absent\" };\n\tconst hosts = readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(path.join(dir, entry.name, HOST_FILE))).map((entry) => entry.name).sort();\n\treturn hosts.length === 0 ? {\n\t\tkind: \"empty\",\n\t\tdir\n\t} : {\n\t\tkind: \"present\",\n\t\tdir,\n\t\thosts\n\t};\n}\n/** Sibling imports: `../<host>/host.js` — source material for derived\n* compositions (full-inclusion wrappers compute over them with plain JS) —\n* and `../<host>/outputs.js`, the generated `$output` token tree. */\nconst SIBLING_IMPORT = /^\\.\\.\\/([A-Za-z0-9_-]+)\\/(host\\.js|outputs\\.js)$/;\n/** The generated per-host token tree (`ph generate hosts`). */\nconst OUTPUTS_FILE = \"outputs.js\";\nconst GENERATE_HINT = \"Run `ph generate hosts` to (re)generate hosts/<name>/outputs.js from the producer's runner outputsSchema and declared drives.\";\n/**\n* One pass over JS source that blanks every comment and, with\n* `literals: \"blank\"`, the CONTENTS of string literals and template-literal\n* text (quotes, backticks and `${`/`}` kept). A template's `${…}` holes are\n* code: they are scanned like the rest (strings, nested templates and braces\n* inside them included). Every newline survives, so line-anchored checks and\n* line numbers still match the original source. Regex literals are not\n* recognised (host files are data; a regex is not one).\n*/\nfunction scanSource(source, literals) {\n\tconst blank = (text) => text.replace(/[^\\n]/g, \" \");\n\tconst literal = (text) => literals === \"blank\" ? blank(text) : text;\n\tlet out = \"\";\n\tlet i = 0;\n\tconst holes = [];\n\t/** Template text from `i` (just after a backtick or a hole's `}`) up to\n\t* and including its closing backtick, or up to and including the next\n\t* `${` (pushing a hole). */\n\tconst templateText = () => {\n\t\tlet j = i;\n\t\twhile (j < source.length) {\n\t\t\tconst ch = source[j];\n\t\t\tif (ch === \"\\\\\") {\n\t\t\t\tj += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (ch === \"`\") break;\n\t\t\tif (ch === \"$\" && source[j + 1] === \"{\") break;\n\t\t\tj++;\n\t\t}\n\t\tout += literal(source.slice(i, Math.min(j, source.length)));\n\t\tif (j >= source.length) i = source.length;\n\t\telse if (source[j] === \"`\") {\n\t\t\tout += \"`\";\n\t\t\ti = j + 1;\n\t\t} else {\n\t\t\tout += \"${\";\n\t\t\tholes.push(0);\n\t\t\ti = j + 2;\n\t\t}\n\t};\n\twhile (i < source.length) {\n\t\tconst ch = source[i];\n\t\tconst next = source[i + 1];\n\t\tif (ch === \"/\" && next === \"/\") {\n\t\t\tconst end = source.indexOf(\"\\n\", i);\n\t\t\tconst stop = end === -1 ? source.length : end;\n\t\t\tout += blank(source.slice(i, stop));\n\t\t\ti = stop;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"/\" && next === \"*\") {\n\t\t\tconst end = source.indexOf(\"*/\", i + 2);\n\t\t\tconst stop = end === -1 ? source.length : end + 2;\n\t\t\tout += blank(source.slice(i, stop));\n\t\t\ti = stop;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"\\\"\" || ch === \"'\") {\n\t\t\tlet j = i + 1;\n\t\t\twhile (j < source.length && source[j] !== ch && source[j] !== \"\\n\") j += source[j] === \"\\\\\" ? 2 : 1;\n\t\t\tconst close = source[j] === ch ? ch : \"\";\n\t\t\tout += ch + literal(source.slice(i + 1, Math.min(j, source.length)));\n\t\t\tout += close;\n\t\t\ti = close ? j + 1 : j;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === \"`\") {\n\t\t\tout += \"`\";\n\t\t\ti++;\n\t\t\ttemplateText();\n\t\t\tcontinue;\n\t\t}\n\t\tif (holes.length > 0 && ch === \"{\") holes[holes.length - 1]++;\n\t\tif (holes.length > 0 && ch === \"}\") {\n\t\t\tif (holes[holes.length - 1] === 0) {\n\t\t\t\tholes.pop();\n\t\t\t\tout += \"}\";\n\t\t\t\ti++;\n\t\t\t\ttemplateText();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tholes[holes.length - 1]--;\n\t\t}\n\t\tout += ch;\n\t\ti++;\n\t}\n\treturn out;\n}\n/** Blank out `//` and block comments, keeping string and template literals\n* (URLs contain `//`) and every newline, so line-anchored checks still see\n* the code's own lines. A JSDoc `import(\"…\")` type is a comment, not code. */\nfunction stripComments(source) {\n\treturn scanSource(source, \"keep\");\n}\n/** Blank out comments and the contents of string literals and\n* template-literal text, so a word inside a string (a URL, a description,\n* an apostrophe in template text) is neither mistaken for code nor able to\n* hide code. Template `${…}` holes are code and are kept. */\nfunction blankLiterals(source) {\n\treturn scanSource(source, \"blank\");\n}\nconst PROCESS_ACCESS = /(?<![.\\w$])process\\s*(?:\\?\\.|\\.|\\[)/;\n/** Host files and generated outputs.js are data: reading the environment\n* through `process.` is banned (typed-host-configs decision 9). Environment\n* values go through `$env`, which resolves at start in the resolving\n* process. Comments are already stripped, so a mention there is fine. */\nfunction rejectProcessAccess(source, file) {\n\tconst match = PROCESS_ACCESS.exec(blankLiterals(source));\n\tif (!match) return;\n\tconst line = source.slice(0, match.index).split(\"\\n\").length;\n\tthrow new HostLoadError(`${file}:${line} reads \\`process.\\` — host files cannot read the environment directly.`, \"Use an $env token instead: { $env: \\\"NAME\\\" } (fails when unset), or { $env: { name: \\\"NAME\\\", optional: true } } as a property value to omit the property when unset. It resolves when the host starts.\");\n}\n/** Lints a host file and returns what it imports. Rejects every import\n* except the project's powerhouse.config.json, SIBLING host files (R1:\n* derived compositions) and sibling generated outputs.js token trees; any\n* dynamic `import(...)` or `require(...)`; and any `process.` access.\n* Source-level enforcement: the JSON round trip below is the hard gate; this\n* one produces the better error. */\nfunction scanHostImports(rawSource, file) {\n\tconst source = stripComments(rawSource);\n\tconst imports = {\n\t\thosts: [],\n\t\toutputs: []\n\t};\n\tfor (const match of source.matchAll(/^\\s*import\\b[^;'\"]*?from\\s+[\"']([^\"']+)[\"']/gm)) {\n\t\tconst specifier = match[1];\n\t\tif (specifier.endsWith(CONFIG_IMPORT_SUFFIX)) continue;\n\t\tconst sibling = SIBLING_IMPORT.exec(specifier);\n\t\tif (sibling) {\n\t\t\t(sibling[2] === HOST_FILE ? imports.hosts : imports.outputs).push(sibling[1]);\n\t\t\tcontinue;\n\t\t}\n\t\tthrow new HostLoadError(`${file} imports \"${specifier}\" — a host file may only import the project's powerhouse.config.json, sibling hosts/<name>/host.js files or generated hosts/<name>/${OUTPUTS_FILE} token trees.`, \"Host files are static projections; code belongs in plugins or the runner.\");\n\t}\n\tif (/^\\s*import\\s+[\"']/m.test(source)) throw new HostLoadError(`${file} contains a side-effect import — a host file may only import the project's powerhouse.config.json or sibling host files.`);\n\tif (/\\bimport\\s*\\(/.test(source) || /\\brequire\\s*\\(/.test(source)) throw new HostLoadError(`${file} uses dynamic import()/require() — host files are static data.`);\n\trejectProcessAccess(source, file);\n\treturn imports;\n}\n/** {@link scanHostImports}, returning only the sibling host names (for cycle\n* detection). */\nfunction lintHostImports(rawSource, file) {\n\treturn scanHostImports(rawSource, file).hosts;\n}\n/** A generated `outputs.js` is plain data: no imports of any kind, no\n* dynamic import/require, no `process.`. */\nfunction lintOutputsFile(rawSource, file) {\n\tconst source = stripComments(rawSource);\n\tif (/^\\s*import\\b/m.test(source) || /^\\s*export\\b[^;]*?\\bfrom\\s+[\"']/m.test(source) || /\\bimport\\s*\\(/.test(source) || /\\brequire\\s*\\(/.test(source)) throw new HostLoadError(`${file} imports a module — a generated ${OUTPUTS_FILE} is plain data.`, \"Regenerate it with `ph generate hosts` instead of editing it.\");\n\trejectProcessAccess(source, file);\n}\n/** Walks the sibling-import graph from `hostName`, linting every visited file\n* (and every outputs.js it imports) and failing on a cycle (an ESM circular\n* would otherwise surface as an undefined default export with no useful\n* message). Returns the hosts whose outputs.js the graph imports, sorted. */\nfunction lintHostImportGraph(hostsDir, hostName) {\n\tconst state = /* @__PURE__ */ new Map();\n\tconst producers = /* @__PURE__ */ new Set();\n\tconst visit = (name, chain) => {\n\t\tconst mark = state.get(name);\n\t\tif (mark === \"done\") return;\n\t\tif (mark === \"visiting\") throw new HostLoadError(`Host import cycle: ${[...chain, name].map((n) => `hosts/${n}`).join(\" -> \")}.`, \"Hoist the shared data into one host (or powerhouse.config.json) instead of importing both ways.\");\n\t\tconst file = path.join(hostsDir, name, HOST_FILE);\n\t\tif (!existsSync(file)) throw new HostLoadError(`hosts/${chain[chain.length - 1] ?? name} imports sibling \"hosts/${name}/host.js\", which does not exist.`);\n\t\tstate.set(name, \"visiting\");\n\t\tconst imports = scanHostImports(readFileSync(file, \"utf8\"), file);\n\t\tfor (const producer of imports.outputs) {\n\t\t\tif (producers.has(producer)) continue;\n\t\t\tconst outputsFile = path.join(hostsDir, producer, OUTPUTS_FILE);\n\t\t\tif (!existsSync(outputsFile)) throw new HostLoadError(`hosts/${name}/host.js imports \"hosts/${producer}/${OUTPUTS_FILE}\", which does not exist.`, GENERATE_HINT);\n\t\t\tlintOutputsFile(readFileSync(outputsFile, \"utf8\"), outputsFile);\n\t\t\tproducers.add(producer);\n\t\t}\n\t\tfor (const sibling of imports.hosts) visit(sibling, [...chain, name]);\n\t\tstate.set(name, \"done\");\n\t};\n\tvisit(hostName, []);\n\treturn [...producers].sort();\n}\n/** Returns the path of the first value that would not survive a JSON round\n* trip, or undefined when the object is fully static. */\nfunction findNonStaticValue(value, trail = \"\") {\n\tif (value === null) return void 0;\n\tconst kind = typeof value;\n\tif (kind === \"string\" || kind === \"number\" || kind === \"boolean\") return;\n\tif (kind !== \"object\") return `${trail || \"<root>\"} (${kind})`;\n\tif (Array.isArray(value)) {\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tconst hit = findNonStaticValue(value[i], `${trail}[${i}]`);\n\t\t\tif (hit) return hit;\n\t\t}\n\t\treturn;\n\t}\n\tconst proto = Object.getPrototypeOf(value);\n\tif (proto !== Object.prototype && proto !== null) return `${trail || \"<root>\"} (non-plain object)`;\n\tfor (const [key, child] of Object.entries(value)) {\n\t\tconst hit = findNonStaticValue(child, trail ? `${trail}.${key}` : key);\n\t\tif (hit) return hit;\n\t}\n}\nfunction assertHostShape(host, file) {\n\tif (typeof host.name !== \"string\" || host.name.length === 0) throw new HostLoadError(`${file}: \\`name\\` must be a non-empty string.`);\n\tconst runner = host.runner;\n\tif (runner === null || typeof runner !== \"object\" || typeof runner.module !== \"string\") throw new HostLoadError(`${file}: \\`runner\\` must be an object with a \\`module\\` specifier string.`);\n\tif (host.reactor !== void 0 && host.children !== void 0) throw new HostLoadError(`${file}: \\`reactor\\` and \\`children\\` are mutually exclusive — a host is a reactor runner or a compound runner, never both.`);\n}\nasync function loadHost(projectRoot, hostName) {\n\treturn importHost(projectRoot, hostName, true);\n}\nasync function importHost(projectRoot, hostName, checkOutputs) {\n\tconst probe = probeHostsFolder(projectRoot);\n\tif (probe.kind === \"absent\") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, \"New projects get one from `ph init`; in an existing project, create hosts/<name>/host.js.\");\n\tif (probe.kind === \"empty\") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, \"An empty hosts/ folder defines no hosts; add a host definition or remove the folder.\");\n\tif (!probe.hosts.includes(hostName)) throw new HostLoadError(`Unknown host \"${hostName}\". Available hosts: ${probe.hosts.join(\", \")}.`);\n\tconst file = path.join(probe.dir, hostName, HOST_FILE);\n\tconst producers = lintHostImportGraph(probe.dir, hostName);\n\tif (checkOutputs) for (const producer of producers) await assertOutputsFileFresh(projectRoot, probe.dir, hostName, producer);\n\tconst host = (await import(pathToFileURL(file).href)).default;\n\tif (host === null || typeof host !== \"object\" || Array.isArray(host)) throw new HostLoadError(`${file} must default-export the host object (\\`export default { name, runner, ... }\\`).`);\n\tconst nonStatic = findNonStaticValue(host);\n\tif (nonStatic) throw new HostLoadError(`${file} exports a non-static value at \\`${nonStatic}\\` — host files must survive a JSON round trip.`, \"Runtime behavior belongs in the runner; host files only carry data.\");\n\tassertHostShape(host, file);\n\treturn {\n\t\tname: hostName,\n\t\tdir: path.dirname(file),\n\t\tfile,\n\t\thost\n\t};\n}\nconst OUTPUTS_HASH_EXPORT = /^export const outputsHash = \"([^\"]+)\";$/m;\n/** The hash a generated outputs.js carries, or undefined. */\nfunction readOutputsFileHash(source) {\n\treturn OUTPUTS_HASH_EXPORT.exec(source)?.[1];\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value !== null && typeof value === \"object\") return `{${Object.entries(value).filter(([, child]) => child !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, child]) => `${JSON.stringify(key)}:${canonicalJson(child)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\n/** sha256 over the canonical JSON of the generator's inputs. The host name\n* is one: every token in the file carries it, so a copied or renamed host\n* folder makes its outputs.js stale. */\nfunction computeOutputsHash(input) {\n\treturn `sha256:${createHash(\"sha256\").update(canonicalJson({\n\t\tv: 1,\n\t\thost: input.host,\n\t\trunnerModule: input.runnerModule,\n\t\toutputsSchema: input.outputsSchema,\n\t\tdrives: [...new Set(input.drives)].sort()\n\t})).digest(\"hex\").slice(0, 32)}`;\n}\nfunction isZodSchema(value) {\n\treturn value !== null && typeof value === \"object\" && \"_zod\" in value;\n}\nfunction isRecord$1(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n/** Local (non-remote) slugs from a drive declaration list. */\nfunction localDriveSlugs(drives) {\n\tif (!Array.isArray(drives)) return [];\n\treturn drives.flatMap((drive) => isRecord$1(drive) && typeof drive.slug === \"string\" && drive.remote === void 0 ? [drive.slug] : []);\n}\n/**\n* Describes the outputs a host's creation produces, for `ph generate hosts`\n* and the loader's staleness check: the runner's `outputsSchema` as JSON\n* Schema and the host's declared local drives (the keys `drives.<slug>` of a\n* switchboard-like runner). Returns undefined when the runner exports no\n* `outputsSchema` (the host produces nothing a token can reference).\n*\n* Plugin-contributed drives are collected across every verb (verb scoping\n* is ignored: a drive any verb serves is referenceable). Plugins the project\n* tree cannot resolve contribute nothing, exactly as at boot. The implicit\n* default drive a switchboard serves when it declares none is NOT a known\n* key (it is not declared); reach it with a literal `$output` token.\n*/\nasync function describeHostOutputs(projectRoot, hostName) {\n\tconst { host, file } = await importHost(projectRoot, hostName, false);\n\tconst runnerModule = host.runner.module;\n\tconst schema = (await resolveRunnerModule(projectRoot, runnerModule)).outputsSchema;\n\tif (!isZodSchema(schema)) return void 0;\n\tconst { $schema: _dialect, ...outputsSchema } = z.toJSONSchema(schema, {\n\t\tio: \"output\",\n\t\tunrepresentable: \"any\"\n\t});\n\tconst reactor = host.reactor;\n\tconst drives = localDriveSlugs(isRecord$1(reactor) ? reactor.drives : []);\n\tconst entries = (host.runner.plugins ?? []).map((entry) => typeof entry === \"string\" ? entry : {\n\t\t...entry,\n\t\tverbs: \"*\"\n\t});\n\tif (entries.length > 0) {\n\t\tconst plan = await resolvePluginContributions(projectRoot, \"*\", entries, path.relative(projectRoot, file));\n\t\tdrives.push(...localDriveSlugs(plan.drives.map((drive) => drive.declaration)));\n\t}\n\tconst sortedDrives = [...new Set(drives)].sort();\n\treturn {\n\t\thost: hostName,\n\t\trunnerModule,\n\t\toutputsSchema,\n\t\tdrives: sortedDrives,\n\t\thash: computeOutputsHash({\n\t\t\thost: hostName,\n\t\t\trunnerModule,\n\t\t\toutputsSchema,\n\t\t\tdrives: sortedDrives\n\t\t})\n\t};\n}\nasync function assertOutputsFileFresh(projectRoot, hostsDir, consumer, producer) {\n\tconst rel = `hosts/${producer}/${OUTPUTS_FILE}`;\n\tconst actual = readOutputsFileHash(readFileSync(path.join(hostsDir, producer, OUTPUTS_FILE), \"utf8\"));\n\tif (!existsSync(path.join(hostsDir, producer, HOST_FILE))) throw new HostLoadError(`hosts/${consumer} imports ${rel}, but there is no hosts/${producer}/host.js to produce it.`, \"Delete the orphaned outputs.js and fix the import.\");\n\tconst description = await describeHostOutputs(projectRoot, producer);\n\tif (!description) throw new HostLoadError(`hosts/${consumer} imports ${rel}, but hosts/${producer}'s runner declares no outputsSchema, so it produces no outputs.`);\n\tif (actual !== description.hash) throw new HostLoadError(`${rel} is stale (its producer's outputsSchema or declared drives changed since it was generated); run \\`ph generate hosts\\`.`, actual === void 0 ? `${rel} carries no outputsHash export; it was not generated by \\`ph generate hosts\\`.` : `expected ${description.hash}, found ${actual}.`);\n}\n//#endregion\n//#region src/runner-args.ts\nconst isStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === \"string\");\nconst isStringRecord = (value) => typeof value === \"object\" && value !== null && !Array.isArray(value) && Object.values(value).every((item) => typeof item === \"string\");\nfunction isRunnerArgsSchema(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst schema = value;\n\treturn isStrings(schema.options) && isStrings(schema.flags) && (schema.memberOptions === void 0 || isStringRecord(schema.memberOptions)) && (schema.retired === void 0 || isStringRecord(schema.retired));\n}\nconst OWN_FLAGS = /* @__PURE__ */ new Set([\n\t\"--debug\",\n\t\"--stop\",\n\t\"--help\",\n\t\"-h\"\n]);\n/**\n* Splits what follows `ph run`. The host and the verb come before the\n* runner's arguments: `ph run` does not know which of those take a value, so\n* a bare word after the first of them belongs to the runner. A literal `--`\n* hands over everything after it.\n*/\nfunction splitRunArgv(args) {\n\tconst result = {\n\t\town: [],\n\t\targv: []\n\t};\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\tif (arg === \"--\") {\n\t\t\tresult.argv.push(...args.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\t\tif (OWN_FLAGS.has(arg) || arg.startsWith(\"--explain=\")) result.own.push(arg);\n\t\telse if (arg === \"--explain\") {\n\t\t\tresult.own.push(...args.slice(i, i + 2));\n\t\t\ti++;\n\t\t} else if (arg.startsWith(\"-\") || result.argv.length > 0) result.argv.push(arg);\n\t\telse if (result.host === void 0) result.host = arg;\n\t\telse if (result.verb === void 0) result.verb = arg;\n\t\telse result.argv.push(arg);\n\t}\n\treturn result;\n}\nfunction entriesOf(argv, takesValue, where) {\n\tconst entries = [];\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst token = argv[i];\n\t\tif (token === \"--\") continue;\n\t\tconst equals = token.startsWith(\"-\") ? token.indexOf(\"=\") : -1;\n\t\tconst name = equals === -1 ? token : token.slice(0, equals);\n\t\tif (equals === -1 && takesValue(name)) {\n\t\t\tif (i + 1 >= argv.length) throw new RunnerError(`${where}: ${name} needs a value.`);\n\t\t\tentries.push({\n\t\t\t\tname,\n\t\t\t\ttokens: [token, argv[i + 1]]\n\t\t\t});\n\t\t\ti++;\n\t\t} else entries.push({\n\t\t\tname,\n\t\t\ttokens: [token]\n\t\t});\n\t}\n\treturn entries;\n}\nfunction warnRetired(name, instead) {\n\tconsole.warn(`${name} is retired and has no effect: ${instead}`);\n}\nconst acceptedBy = (schema) => [...schema.options, ...schema.flags];\n/**\n* The arguments a standalone runner receives as `ctx.argv`: `argv` checked\n* against the runner's schema, retired switches warned about and dropped.\n* Nothing is dropped silently: an argument the runner does not accept, or any\n* argument for a runner without a schema, fails.\n*/\nfunction checkRunnerArgv(argv, target) {\n\tif (argv.length === 0) return [];\n\tconst where = `hosts/${target.host}`;\n\tconst schema = target.schema;\n\tif (!isRunnerArgsSchema(schema)) throw new RunnerError(`${where}: its runner ${target.runner} accepts no arguments, but got: ${argv.join(\" \")}`, \"Set these in the host file instead.\");\n\tconst options = new Set(schema.options);\n\tconst accepted = new Set(acceptedBy(schema));\n\tconst kept = [];\n\tconst unknown = [];\n\tfor (const entry of entriesOf(argv, (name) => options.has(name), where)) {\n\t\tconst instead = schema.retired?.[entry.name];\n\t\tif (accepted.has(entry.name)) kept.push(...entry.tokens);\n\t\telse if (instead !== void 0) warnRetired(entry.name, instead);\n\t\telse unknown.push(entry.name);\n\t}\n\tif (unknown.length > 0) throw new RunnerError(`${where}: its runner ${target.runner} does not accept ${unknown.join(\", \")}.`, `It accepts: ${[...accepted].join(\", \") || \"no arguments\"}.`);\n\treturn kept;\n}\n/**\n* A compound's arguments, per member key: each member gets the ones its\n* runner accepts. A member option arrives under its member name\n* (`--switchboard-port 4001` reaches that member as `--port 4001`). An\n* argument no member accepts fails, as does one that would set the same\n* option on several members.\n*/\nfunction splitCompoundArgv(argv, host, members) {\n\tconst perMember = new Map(members.map((m) => [m.key, []]));\n\tif (argv.length === 0) return perMember;\n\tconst where = `hosts/${host}`;\n\tconst schemas = members.flatMap((m) => isRunnerArgsSchema(m.schema) ? [{\n\t\tkey: m.key,\n\t\tschema: m.schema\n\t}] : []);\n\tconst memberNames = /* @__PURE__ */ new Map();\n\tfor (const { schema } of schemas) for (const [alias, option] of Object.entries(schema.memberOptions ?? {})) {\n\t\tconst aliases = memberNames.get(option) ?? [];\n\t\tif (!aliases.includes(alias)) aliases.push(alias);\n\t\tmemberNames.set(option, aliases);\n\t}\n\tconst takesValue = (name) => schemas.some(({ schema }) => schema.options.includes(name) || schema.memberOptions?.[name] !== void 0);\n\tconst warned = /* @__PURE__ */ new Set();\n\tconst unknown = [];\n\tfor (const entry of entriesOf(argv, takesValue, where)) {\n\t\tconst { name, tokens } = entry;\n\t\tconst named = schemas.filter(({ schema }) => schema.memberOptions?.[name] !== void 0);\n\t\tif (named.length > 1) throw new RunnerError(`${where}: ${name} matches the members ${named.map((m) => m.key).join(\", \")}.`, \"Set the option in each member's host file instead.\");\n\t\tif (named.length === 1) {\n\t\t\tconst { key, schema } = named[0];\n\t\t\tconst first = (schema.memberOptions?.[name] ?? name) + tokens[0].slice(name.length);\n\t\t\tperMember.get(key)?.push(first, ...tokens.slice(1));\n\t\t\tcontinue;\n\t\t}\n\t\tconst aliases = memberNames.get(name);\n\t\tif (aliases) throw new RunnerError(`${where}: ${name} does not say which member it is for.`, `Use ${aliases.join(\" or \")}.`);\n\t\tconst takers = schemas.filter(({ schema }) => acceptedBy(schema).includes(name));\n\t\tif (takers.length > 0) {\n\t\t\tfor (const { key } of takers) perMember.get(key)?.push(...tokens);\n\t\t\tcontinue;\n\t\t}\n\t\tconst retired = schemas.find(({ schema }) => schema.retired?.[name] !== void 0);\n\t\tif (retired) {\n\t\t\tif (!warned.has(name)) {\n\t\t\t\twarned.add(name);\n\t\t\t\twarnRetired(name, retired.schema.retired?.[name] ?? \"\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tunknown.push(name);\n\t}\n\tif (unknown.length > 0) {\n\t\tconst accepted = members.map((m) => {\n\t\t\tif (!isRunnerArgsSchema(m.schema)) return ` - ${m.key} (${m.runner}): no arguments`;\n\t\t\tconst schema = m.schema;\n\t\t\tconst scoped = new Set(Object.values(schema.memberOptions ?? {}));\n\t\t\tconst names = [...Object.keys(schema.memberOptions ?? {}), ...acceptedBy(schema).filter((name) => !scoped.has(name))];\n\t\t\treturn ` - ${m.key} (${m.runner}): ${names.join(\", \") || \"no arguments\"}`;\n\t\t});\n\t\tthrow new RunnerError(`${where}: no member accepts ${unknown.join(\", \")}. The members accept:\\n${accepted.join(\"\\n\")}`);\n\t}\n\treturn perMember;\n}\n//#endregion\n//#region src/run-record-schema.ts\n/**\n* `.ph/run/<host>.json`, version 2 (typed-host-configs 3.6): what a running\n* host and its members produced. Validated on read; a v1 (or any invalid)\n* record reads as \"not running\". `projectName` is kept beyond the plan's\n* sketch because the live/foreign probe needs it. `host` is the host's\n* `name` (the file key), not its folder.\n*/\nconst outputsSchema = z.record(z.string(), z.unknown());\nconst runRecordMemberSchema = z.strictObject({\n\t/** The member's host folder (`children.<key>.host`). */\n\thost: z.string().min(1),\n\trunnerModule: z.string().min(1),\n\tkind: runnerKindSchema,\n\tverb: z.string().min(1),\n\toutputs: outputsSchema\n});\nconst runRecordSchema = z.strictObject({\n\tversion: z.literal(2),\n\thost: hostNameSchema,\n\tprojectName: z.string(),\n\tkind: runnerKindSchema,\n\tverb: z.string().min(1),\n\tpid: z.number().int(),\n\tstartedAt: z.string(),\n\t/** Standalone hosts: the runner's outputs. */\n\toutputs: outputsSchema.optional(),\n\t/** Compounds: one entry per started member, keyed by member name. */\n\tmembers: z.record(z.string(), runRecordMemberSchema).optional(),\n\t/** Host-specific extras (e.g. mcpUrl) a runner wants in the record. */\n\textra: z.record(z.string(), z.unknown()).optional()\n});\n//#endregion\n//#region src/run-record.ts\nconst runDir = (projectDir, env = process.env) => path.join(resolvePhDir(projectDir, env), \"run\");\nfunction recordPath(projectDir, hostName, env) {\n\tconst dir = runDir(projectDir, env);\n\tconst file = path.resolve(dir, `${hostName}.json`);\n\tif (!hostNameSchema.safeParse(hostName).success || path.dirname(file) !== path.resolve(dir)) throw new Error(`\"${hostName}\" can't name a run record. ${HOST_NAME_MESSAGE}`);\n\treturn file;\n}\nfunction readRunRecord(projectDir, hostName, env = process.env) {\n\tlet raw;\n\ttry {\n\t\traw = JSON.parse(fs.readFileSync(recordPath(projectDir, hostName, env), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n\tconst parsed = runRecordSchema.safeParse(raw);\n\treturn parsed.success ? parsed.data : void 0;\n}\n/** Every valid v2 record under `.ph/run/` (invalid and v1 files skipped). */\nfunction listRunRecords(projectDir, env = process.env) {\n\tlet files;\n\ttry {\n\t\tfiles = fs.readdirSync(runDir(projectDir, env));\n\t} catch {\n\t\treturn [];\n\t}\n\treturn files.filter((file) => file.endsWith(\".json\")).flatMap((file) => {\n\t\tconst record = readRunRecord(projectDir, file.slice(0, -5), env);\n\t\treturn record ? [record] : [];\n\t});\n}\n/** The project identity the live/foreign probe compares: package.json\n* `name`, else the folder name. */\nfunction readProjectName(projectDir) {\n\ttry {\n\t\tconst pkg = JSON.parse(fs.readFileSync(path.join(projectDir, \"package.json\"), \"utf8\"));\n\t\tif (typeof pkg.name === \"string\" && pkg.name) return pkg.name;\n\t} catch {}\n\treturn path.basename(path.resolve(projectDir));\n}\nfunction writeRunRecord(projectDir, record) {\n\tconst target = recordPath(projectDir, record.host);\n\tconst valid = runRecordSchema.parse(record);\n\tfs.mkdirSync(path.dirname(target), { recursive: true });\n\tfs.writeFileSync(target, `${JSON.stringify(valid, null, 2)}\\n`);\n}\nfunction clearRunRecord(projectDir, hostName, env = process.env) {\n\ttry {\n\t\tfs.rmSync(recordPath(projectDir, hostName, env));\n\t} catch {}\n}\nfunction isPidAlive(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error.code === \"EPERM\";\n\t}\n}\n/** When a process started, in ms since the epoch; undefined when the\n* platform does not tell (the process is gone, the tool is missing). */\nfunction processStartedAtMs(pid) {\n\ttry {\n\t\tif (process.platform === \"linux\") {\n\t\t\tconst stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n\t\t\tconst ticks = Number(stat.slice(stat.lastIndexOf(\")\") + 2).split(\" \")[19]);\n\t\t\tconst boot = /^btime (\\d+)$/m.exec(fs.readFileSync(\"/proc/stat\", \"utf8\"));\n\t\t\tif (!boot || !Number.isFinite(ticks)) return void 0;\n\t\t\treturn (Number(boot[1]) + ticks / 100) * 1e3;\n\t\t}\n\t\tconst [command, args] = process.platform === \"win32\" ? [\"powershell.exe\", [\n\t\t\t\"-NoProfile\",\n\t\t\t\"-NonInteractive\",\n\t\t\t\"-Command\",\n\t\t\t`(Get-Process -Id ${pid}).StartTime.ToUniversalTime().ToString('o')`\n\t\t]] : [\"ps\", [\n\t\t\t\"-o\",\n\t\t\t\"lstart=\",\n\t\t\t\"-p\",\n\t\t\tString(pid)\n\t\t]];\n\t\tconst out = execFileSync(command, args, {\n\t\t\tencoding: \"utf8\",\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n\t\t\t\t\"ignore\"\n\t\t\t],\n\t\t\ttimeout: 1e4,\n\t\t\twindowsHide: true,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tLC_ALL: \"C\"\n\t\t\t}\n\t\t}).trim();\n\t\tconst started = Date.parse(out);\n\t\treturn Number.isFinite(started) ? started : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\nconst START_SLACK_MS = 5e3;\nconst confirmedRecords = /* @__PURE__ */ new Set();\n/** True when the recorded pid now names another process: one that started\n* after the record was written. False when that cannot be told. */\nfunction isPidReused(record) {\n\tif (record.pid === process.pid) return false;\n\tconst recordedAt = Date.parse(record.startedAt);\n\tif (!Number.isFinite(recordedAt)) return false;\n\tconst key = `${record.pid}:${record.startedAt}`;\n\tif (confirmedRecords.has(key)) return false;\n\tconst startedAt = processStartedAtMs(record.pid);\n\tif (startedAt === void 0) return false;\n\tif (startedAt > recordedAt + START_SLACK_MS) return true;\n\tconfirmedRecords.add(key);\n\treturn false;\n}\n/**\n* Decide whether the recorded instance is this project's live host.\n*\n* pid liveness alone proves nothing (pids are reused): a live pid counts\n* only when its process started before the record was written. The recorded\n* projectName is what separates \"my instance\" from \"a different project that\n* happens to hold this storage root\" — the confusion the vetra lock exists to\n* prevent. A stale record (dead or reused pid) is reported so the caller can\n* clear it; a foreign one (live pid, different project) is left alone.\n*/\nfunction probeRun(projectDir, hostName, projectName, env = process.env) {\n\tconst record = readRunRecord(projectDir, hostName, env);\n\tif (!record) return { status: \"none\" };\n\tif (!isPidAlive(record.pid) || isPidReused(record)) return {\n\t\tstatus: \"stale\",\n\t\trecord\n\t};\n\tif (record.projectName !== projectName) return {\n\t\tstatus: \"foreign\",\n\t\trecord\n\t};\n\treturn {\n\t\tstatus: \"live\",\n\t\trecord\n\t};\n}\n//#endregion\n//#region src/child-wrapper.ts\n/** Generic compound rule: `reactor`/`config` replace, `runner` key-merges. */\nfunction applyChildWrapper(base, wrapper) {\n\tconst reactor = wrapper.reactor ?? base.reactor;\n\tconst config = wrapper.config ?? base.config;\n\treturn {\n\t\t...base,\n\t\trunner: {\n\t\t\t...base.runner,\n\t\t\t...wrapper.runner\n\t\t},\n\t\t...config !== void 0 ? { config } : {},\n\t\t...reactor !== void 0 ? { reactor } : {}\n\t};\n}\n//#endregion\n//#region src/placeholders.ts\n/**\n* `${userData}` resolution for host files (desktop shape): storage paths in a\n* host must not derive from the instance name (renames must stay safe), so\n* the host file writes `${userData}/.ph/reactor-storage` and the RUNNER\n* resolves it at start. `${userData}` is a PROJECT-SHAPED root: its `.ph`\n* subtree carries the same names the classic commands use under\n* `<project>/.ph` (see `resolvePhDir`). In the CLI it IS the project root, so\n* `ph run desktop` in a project shares the one `.ph` tree `ph vetra` uses;\n* a shell (Tauri) points it at the OS profile via PH_USER_DATA_DIR, and the\n* whole `.ph` tree — stores, identity, run records — follows.\n*/\nfunction defaultUserDataDir(projectRoot, env = process.env) {\n\treturn env.PH_USER_DATA_DIR ?? path.resolve(projectRoot);\n}\n/** Deep-substitute `${userData}` in every string of a JSON-shaped value.\n* Non-strings pass through; the input is never mutated. */\nfunction resolveUserDataPlaceholders(value, userData) {\n\treturn substituteBuiltinEnv(value, { userData });\n}\n//#endregion\n//#region src/resolve/node.ts\n/** Load every producer host a set of refs names (each once). */\nasync function loadProducers(projectRoot, refs) {\n\tconst producers = /* @__PURE__ */ new Map();\n\tfor (const { host: folder } of refs) {\n\t\tif (producers.has(folder)) continue;\n\t\ttry {\n\t\t\tconst loaded = await loadHost(projectRoot, folder);\n\t\t\tconst specifier = loaded.host.runner.module;\n\t\t\tproducers.set(folder, {\n\t\t\t\tfolder,\n\t\t\t\tname: loaded.host.name,\n\t\t\t\tspecifier,\n\t\t\t\trunner: await resolveRunnerModule(projectRoot, specifier)\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tproducers.set(folder, { error: `names host \"${folder}\", which cannot be loaded: ${error instanceof Error ? error.message : String(error)}` });\n\t\t}\n\t}\n\treturn producers;\n}\n/** The outputs schema of a runner module, or why it has none. */\nfunction runnerOutputsSchema(runner, specifier, label) {\n\tconst schema = runner.outputsSchema;\n\tif (schema === void 0 || schema === null) return { error: `${label} runs \"${specifier}\", which exports no outputsSchema, so it produces no outputs a token can read.` };\n\treturn {\n\t\tschema,\n\t\tlabel: `\"${specifier}\" (${label})`\n\t};\n}\n/** Declared-validation lookup for a standalone host's producers. */\nfunction producerOutputsSchemas(producers) {\n\treturn (ref) => {\n\t\tconst info = producers.get(ref.host);\n\t\tif (!info) return { error: `names host \"${ref.host}\", which was not loaded.` };\n\t\tif (\"error\" in info) return { error: info.error };\n\t\treturn runnerOutputsSchema(info.runner, info.specifier, `host \"${ref.host}\"`);\n\t};\n}\n/** Further `.ph` roots whose live run records a standalone `$output` reads\n* (`path.delimiter`-separated): a launcher that gives each child its own\n* PH_USER_DATA_DIR names its siblings' here. Locks never read them. */\nconst OUTPUT_DATA_DIRS_ENV = \"PH_OUTPUT_DATA_DIRS\";\n/** The other roots, each once, never the process's own. */\nfunction siblingEnvs(projectRoot, env) {\n\tconst own = path.resolve(defaultUserDataDir(projectRoot, env));\n\treturn [...new Set((env[\"PH_OUTPUT_DATA_DIRS\"] ?? \"\").split(path.delimiter).filter((dir) => dir !== \"\").map((dir) => path.resolve(dir)))].filter((dir) => dir !== own).map((dir) => ({ PH_USER_DATA_DIR: dir }));\n}\n/**\n* Standalone `$output` source: the producer's live v2 run record. Its own\n* standalone record under the process's `.ph` root first (keyed by the\n* producer's `name`); else exactly one of: a standalone record under a\n* PH_OUTPUT_DATA_DIRS root, or a member running that host in a live compound\n* of this project under any root. A missing, stale, foreign or output-less\n* record means \"not running\", and the lookup fails naming the producer and\n* how to start it (no fallback to the producer's declared config, no\n* waiting).\n*/\nfunction runRecordOutputSource(projectRoot, options) {\n\tconst { consumer, producers, projectName } = options;\n\tconst env = options.env ?? process.env;\n\tconst siblings = siblingEnvs(projectRoot, env);\n\treturn { lookup(ref) {\n\t\tconst notRunning = `${consumer} needs outputs from host \"${ref.host}\", which is not running. Start it first: ph run ${ref.host} (or run a compound that includes it).`;\n\t\tconst info = producers.get(ref.host);\n\t\tconst schema = info && !(\"error\" in info) ? info.runner.outputsSchema : void 0;\n\t\tconst withSchema = schema !== void 0 && schema !== null ? { schema } : {};\n\t\tconst standalone = [];\n\t\tif (ref.member === void 0 && info && !(\"error\" in info)) {\n\t\t\tconst probe = probeRun(projectRoot, info.name, projectName, env);\n\t\t\tif (probe.status === \"live\" && probe.record.outputs) return {\n\t\t\t\tstatus: \"available\",\n\t\t\t\toutputs: probe.record.outputs,\n\t\t\t\t...withSchema\n\t\t\t};\n\t\t\tfor (const sibling of siblings) {\n\t\t\t\tconst other = probeRun(projectRoot, info.name, projectName, sibling);\n\t\t\t\tif (other.status === \"live\" && other.record.outputs) standalone.push({\n\t\t\t\t\tlabel: `\"${info.name}\" (pid ${other.record.pid})`,\n\t\t\t\t\toutputs: other.record.outputs\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst members = [env, ...siblings].flatMap((root) => listRunRecords(projectRoot, root)).filter((record) => record.members !== void 0 && record.projectName === projectName && isPidAlive(record.pid)).flatMap((record) => Object.entries(record.members ?? {}).filter(([key, member]) => member.host === ref.host && (ref.member === void 0 || key === ref.member)).map(([key, member]) => ({\n\t\t\tlabel: `member \"${key}\" of \"${record.host}\"`,\n\t\t\toutputs: member.outputs\n\t\t})));\n\t\tconst found = [...standalone, ...members];\n\t\tif (found.length === 1) return {\n\t\t\tstatus: \"available\",\n\t\t\toutputs: found[0].outputs,\n\t\t\t...withSchema\n\t\t};\n\t\tif (found.length > 1) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `${consumer} needs outputs from host \"${ref.host}\", which runs as ${found.map((m) => m.label).join(\" and \")}; stop all but one, or run ${ref.host} on its own.`\n\t\t};\n\t\treturn {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: notRunning\n\t\t};\n\t} };\n}\n/** The resolving process's `$env` inputs: its environment plus the\n* always-resolvable built-ins (`userData` honours PH_USER_DATA_DIR). */\nfunction processResolveEnv(projectRoot, env = process.env) {\n\treturn {\n\t\tenv,\n\t\tbuiltins: {\n\t\t\tuserData: defaultUserDataDir(projectRoot, env),\n\t\t\tprojectRoot: path.resolve(projectRoot)\n\t\t}\n\t};\n}\n//#endregion\n//#region src/resolve/sources.ts\n/**\n* The compound output source: a member's `$output` tokens read the live\n* `RunnerHandle.outputs` of the members started before it. `schemas` (member\n* key → its runner's `outputsSchema`) lets an absent optional output field\n* omit the consuming property. Pure (the run-record source for standalone\n* hosts is node: ./node.ts).\n*/\nfunction compoundOutputSource(members, started, compound, schemas) {\n\treturn { lookup(ref) {\n\t\tconst target = memberForRef(ref, members);\n\t\tif (\"error\" in target) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `compound \"${compound}\": a token ${target.error}`\n\t\t};\n\t\tif (!started.has(target.key)) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\tmessage: `compound \"${compound}\": member \"${target.key}\" (host \"${ref.host}\") has not started yet; a producer must start before its consumers.`\n\t\t};\n\t\tconst schema = schemas?.get(target.key);\n\t\treturn {\n\t\t\tstatus: \"available\",\n\t\t\toutputs: started.get(target.key),\n\t\t\t...schema !== void 0 ? { schema } : {}\n\t\t};\n\t} };\n}\n//#endregion\n//#region src/runner-handle.ts\n/** The data half of a handle, validated by the compound. `ready`/`shutdown`\n* are functions and promises, so they are checked as TS fields, not here. */\nconst runnerHandleSchema = z.looseObject({ outputs: z.record(z.string(), z.unknown()).optional() });\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction isPromiseLike(value) {\n\treturn isRecord(value) && typeof value.then === \"function\";\n}\nfunction isCallable(value) {\n\treturn typeof value === \"function\";\n}\n/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)\n* is an empty handle; anything else must match runnerHandleSchema. */\nfunction toStartedHandle(value, where) {\n\tif (value === void 0 || value === null) return { outputs: {} };\n\tconst parsed = runnerHandleSchema.safeParse(value);\n\tif (!parsed.success) throw new Error(`${where} returned an invalid runner handle:\\n${z.prettifyError(parsed.error)}`);\n\tconst live = isRecord(value) ? value : {};\n\tconst shutdown = live.shutdown;\n\treturn {\n\t\t...parsed.data,\n\t\toutputs: parsed.data.outputs ?? {},\n\t\t...isPromiseLike(live.ready) ? { ready: live.ready } : {},\n\t\t...isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}\n\t};\n}\n//#endregion\n//#region src/compound.ts\nasync function memberDraft(projectRoot, member) {\n\treturn applyChildWrapper((await loadHost(projectRoot, member.host)).host, member);\n}\n/** Whether a member receives the compound's `cspRegistrySync` wiring (as\n* `runner.cspRegistrySync`): its runner declares that option (any specifier\n* that reaches the Connect runner), or it names the Connect runner. A\n* member's role is its runner, not its folder. */\nfunction takesCspRegistrySync(m) {\n\treturn m.specifier === \"@powerhousedao/ph-cli/runners/connect\" || declaresKey(m.runner.hostSchema, [\"runner\"], \"cspRegistrySync\");\n}\n/**\n* Windows has no SIGTERM, so a supervisor asks a stack to stop through its\n* stdin: a line, or the pipe closing, which also covers the supervisor dying.\n* Only when it asks to: a stack started from a script may have no stdin.\n*/\nfunction stopStreamOf(env, stdin) {\n\treturn env[\"PH_STOP_ON_STDIN\"] === \"1\" ? stdin() : void 0;\n}\nfunction whenStreamStops(stream, stop) {\n\tlet stopped = false;\n\tconst once = () => {\n\t\tif (stopped) return;\n\t\tstopped = true;\n\t\tstop();\n\t};\n\tfor (const event of [\n\t\t\"data\",\n\t\t\"end\",\n\t\t\"close\",\n\t\t\"error\"\n\t]) stream.once(event, once);\n\tstream.resume();\n}\n/** The verb the generic compound starts its members at for its own `verb`:\n* `run` follows the compound's defaultVerb. */\nfunction compoundStartVerb(verb, runner) {\n\treturn verb === \"run\" ? runner.defaultVerb ?? \"run\" : verb;\n}\n/** At compound verb \"run\" each member runs its own (merged) defaultVerb —\n* what lets a desktop compound pair a switchboard at `run` with a connect at\n* `serve`. An explicit forwarded verb stays uniform across members. */\nfunction memberVerbOf(compoundVerb, runner) {\n\treturn compoundVerb === \"run\" ? runner.defaultVerb ?? \"run\" : compoundVerb;\n}\nasync function runCompound(hostInput, ctx, options) {\n\tconst compoundFile = `hosts/${hostInput.name}`;\n\tconst removed = findRemovedForms(hostInput);\n\tif (removed.length > 0) throw new RunnerError(`${compoundFile}: removed form:\\n${removed.map((r) => ` - ${r.path}: ${r.message}`).join(\"\\n\")}`);\n\tconst parsed = declaredGenericCompoundHostSchema.safeParse(hostInput);\n\tif (!parsed.success) throw new Error(`${compoundFile}: invalid compound host:\\n${z.prettifyError(parsed.error)}`);\n\tconst host = parsed.data;\n\tconst projectRoot = ctx.projectRoot;\n\tconst wiring = host.config ?? {};\n\tconst verb = ctx.verb;\n\tconst oneShotCompound = ONE_SHOT_VERBS.has(verb);\n\tconst keepsRecord = wiring.runtimeRecord !== false && !oneShotCompound;\n\tlet stopRequested = false;\n\tlet stopFromStream = () => {\n\t\tstopRequested = true;\n\t};\n\tif (options.stopStream && !oneShotCompound) {\n\t\twhenStreamStops(options.stopStream, () => stopFromStream());\n\t\tconst outputs = options.supervisedOutputs ?? [process.stdout, process.stderr];\n\t\tfor (const output of outputs) output.on(\"error\", () => void 0);\n\t}\n\tconst probe = oneShotCompound ? void 0 : probeRun(projectRoot, host.name, options.projectName);\n\tif (probe?.status === \"live\") throw new Error(`${host.name} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`);\n\tif (probe?.status === \"foreign\") throw new Error(`.ph/run/${host.name}.json describes a live \"${probe.record.projectName}\", but this project is \"${options.projectName}\". Refusing to start a second instance.`);\n\tconst prepared = await prepareMembers(projectRoot, host.children);\n\tconst plan = planCompound(prepared.map((m) => ({\n\t\tkey: m.key,\n\t\thost: m.member.host,\n\t\trefs: outputSitesOf(m.draft).map(({ ref, path }) => ({\n\t\t\tref,\n\t\t\tpath\n\t\t}))\n\t})), wiring.startOrder);\n\tconst byKey = new Map(prepared.map((m) => [m.key, m]));\n\tconst members = prepared.map((m) => ({\n\t\tkey: m.key,\n\t\thost: m.member.host\n\t}));\n\tfor (const m of prepared) validateDeclaredHost(m.runner, m.specifier, m.draft, m.file, { outputsSchemaOf: (ref) => {\n\t\tconst target = memberForRef(ref, members);\n\t\tif (\"error\" in target) return { error: target.error };\n\t\tconst producer = byKey.get(target.key);\n\t\treturn producer ? runnerOutputsSchema(producer.runner, producer.specifier, `member \"${target.key}\"`) : { error: `names member \"${target.key}\", which was not prepared.` };\n\t} });\n\tconst memberArgv = splitCompoundArgv(ctx.argv ?? [], hostInput.name, prepared.map((m) => ({\n\t\tkey: m.key,\n\t\trunner: m.specifier,\n\t\tschema: m.runner.argsSchema\n\t})));\n\tif (wiring.cspRegistrySync && !prepared.some(takesCspRegistrySync)) console.warn(`${compoundFile}: config.cspRegistrySync is set, but no member's runner declares runner.cspRegistrySync (members run: ${prepared.map((m) => m.specifier).join(\", \")}); the baked Connect CSP is not patched for the runtime registry.`);\n\tconst started = [];\n\tconst liveOutputs = /* @__PURE__ */ new Map();\n\tconst outputs = compoundOutputSource(members, liveOutputs, host.name, new Map(prepared.map((m) => [m.key, m.runner.outputsSchema])));\n\tconst resolveEnv = processResolveEnv(projectRoot, ctx.env);\n\tlet stopping;\n\tconst shutdown = () => stopping ??= (async () => {\n\t\tfor (const m of [...started].reverse()) try {\n\t\t\tawait m.handle.shutdown?.();\n\t\t} catch {}\n\t\tif (keepsRecord) clearRunRecord(projectRoot, host.name);\n\t})();\n\ttry {\n\t\tfor (const name of plan.order) {\n\t\t\tconst m = byKey.get(name);\n\t\t\tif (!m) continue;\n\t\t\tconst memberVerb = memberVerbOf(verb, m.draft.runner);\n\t\t\tconst oneShot = ONE_SHOT_VERBS.has(memberVerb);\n\t\t\tconst resolved = oneShot ? substituteBuiltinEnv(m.draft, resolveEnv.builtins ?? {}) : resolveHostOutputs(m.draft, {\n\t\t\t\toutputs,\n\t\t\t\t...resolveEnv,\n\t\t\t\twhere: m.file\n\t\t\t});\n\t\t\tif (wiring.cspRegistrySync && takesCspRegistrySync(m)) resolved.runner = {\n\t\t\t\t...resolved.runner,\n\t\t\t\tcspRegistrySync: true\n\t\t\t};\n\t\t\tconst validated = validateHost(m.runner, m.specifier, resolved, m.file, oneShot ? { tokens: \"allow\" } : {});\n\t\t\tconst fn = getVerb(m.runner, m.specifier, memberVerb);\n\t\t\tconst where = `${name} (${m.specifier} ${memberVerb})`;\n\t\t\tconst argv = memberArgv.get(name) ?? [];\n\t\t\tconst handle = toStartedHandle(await fn(oneShot ? emptyMaps(validated, resolved) : validated, {\n\t\t\t\tprojectRoot,\n\t\t\t\tenv: ctx.env,\n\t\t\t\tverb: memberVerb,\n\t\t\t\tparent: {\n\t\t\t\t\thost: host.name,\n\t\t\t\t\tverb\n\t\t\t\t},\n\t\t\t\t...argv.length > 0 ? { argv } : {}\n\t\t\t}), where);\n\t\t\tstarted.push({\n\t\t\t\tname,\n\t\t\t\tmember: m.member,\n\t\t\t\tspecifier: m.specifier,\n\t\t\t\tkind: m.runner.kind,\n\t\t\t\tverb: memberVerb,\n\t\t\t\thandle,\n\t\t\t\toutputs: handle.outputs\n\t\t\t});\n\t\t\tif (handle.ready) await handle.ready;\n\t\t\tlet memberOutputs = handle.outputs;\n\t\t\tif (!oneShot && isSchemaLike(m.runner.outputsSchema)) {\n\t\t\t\tconst checked = m.runner.outputsSchema.safeParse(handle.outputs);\n\t\t\t\tif (!checked.success) throw new Error(`${where} reported outputs that fail its outputsSchema:\\n${checked.error.issues.map((i) => ` - ${i.path.map(String).join(\".\") || \"<root>\"}: ${i.message}`).join(\"\\n\")}`);\n\t\t\t\tif (!isPlainObject(checked.data)) throw new Error(`${where}: its outputsSchema parsed the outputs to ${JSON.stringify(checked.data)}, not an object.`);\n\t\t\t\tmemberOutputs = checked.data;\n\t\t\t}\n\t\t\tstarted[started.length - 1].outputs = memberOutputs;\n\t\t\tliveOutputs.set(name, memberOutputs);\n\t\t}\n\t} catch (error) {\n\t\tawait shutdown();\n\t\tthrow error;\n\t}\n\tif (keepsRecord) {\n\t\tconst recordMembers = {};\n\t\tfor (const m of started) recordMembers[m.name] = {\n\t\t\thost: m.member.host,\n\t\t\trunnerModule: m.specifier,\n\t\t\tkind: m.kind,\n\t\t\tverb: m.verb,\n\t\t\toutputs: m.outputs\n\t\t};\n\t\twriteRunRecord(projectRoot, {\n\t\t\tversion: 2,\n\t\t\thost: host.name,\n\t\t\tprojectName: options.projectName,\n\t\t\tkind: \"compound\",\n\t\t\tverb,\n\t\t\tpid: process.pid,\n\t\t\tstartedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\tmembers: recordMembers,\n\t\t\t...options.recordExtra ? { extra: options.recordExtra } : {}\n\t\t});\n\t}\n\tconst exit = options.exit ?? ((code) => process.exit(code));\n\tlet signalled;\n\tconst handleSignal = (signal) => {\n\t\tif (signalled) return signalled;\n\t\tconst code = signal === \"SIGINT\" ? 130 : 143;\n\t\tsignalled = shutdown().finally(() => exit(code));\n\t\treturn signalled;\n\t};\n\tif (options.installSignalHandlers !== false) {\n\t\tprocess.on(\"exit\", () => {\n\t\t\tif (keepsRecord) clearRunRecord(projectRoot, host.name);\n\t\t});\n\t\tprocess.on(\"SIGINT\", () => void handleSignal(\"SIGINT\"));\n\t\tprocess.on(\"SIGTERM\", () => void handleSignal(\"SIGTERM\"));\n\t}\n\tstopFromStream = () => {\n\t\tconst limit = options.stopStreamLimitMs ?? 15e3;\n\t\tsetTimeout(() => exit(143), limit).unref();\n\t\thandleSignal(\"SIGTERM\");\n\t};\n\tif (stopRequested) stopFromStream();\n\treturn {\n\t\tstarted,\n\t\tshutdown,\n\t\thandleSignal\n\t};\n}\n/** Load every member's draft and runner, in declaration order. */\nasync function prepareMembers(projectRoot, children) {\n\tconst out = [];\n\tfor (const [key, member] of Object.entries(children)) out.push(await prepareMember(projectRoot, key, member));\n\treturn out;\n}\n/** One member's draft and runner. */\nasync function prepareMember(projectRoot, key, member) {\n\tconst draft = await memberDraft(projectRoot, member);\n\tconst specifier = draft.runner.module;\n\treturn {\n\t\tkey,\n\t\tmember,\n\t\tdraft,\n\t\tspecifier,\n\t\trunner: await resolveRunnerModule(projectRoot, specifier),\n\t\tfile: `hosts/${member.host}/host.js`\n\t};\n}\n//#endregion\nexport { knownVerbIssues as $, reactorSchema as $t, splitCompoundArgv as A, entryActiveForVerb as An, HOST_NAME_MAX_LENGTH as At, loadHost as B, runObserveHookSequential as Bn, defineHostSchemas as Bt, readProjectName as C, tokenable as Cn, collectTokenSites as Ct, runRecordSchema as D, resolveHostPlugins as Dn, renderTokens as Dt, runRecordMemberSchema as E, findDeadConnectConfig as En, isPlainObject as Et, describeHostOutputs as F, pluginEntryObjectSchema as Fn, compoundHostSchema as Ft, CONNECT_RUNNER as G, makeHostSchemas as Gt, readOutputsFileHash as H, runTransformHook as Hn, emittedHostSchemas as Ht, findNonStaticValue as I, pluginEntrySchema as In, compoundWiringSchema as It, STORE_VERBS as J, profileSchema as Jt, ONE_SHOT_VERBS as K, originOrUrlSchema as Kt, lintHostImportGraph as L, registerHostType as Ln, connectReactorIssues as Lt, HostLoadError as M, mergeContributions as Mn, HOST_NAME_PATTERN as Mt, OUTPUTS_FILE as N, normalizePluginEntries as Nn, childWrapperSchema as Nt, checkRunnerArgv as O, resolvePluginContributions as On, unwrapEscapes as Ot, computeOutputsHash as P, normalizePluginEntry as Pn, childrenSchema as Pt, kindShapeIssues as Q, reactorProtocolSchema as Qt, lintHostImports as R, resolveOrder as Rn, declaredGenericCompoundHostSchema as Rt, probeRun as S, tokenSchema as Sn, schemaAtPath as St, writeRunRecord as T, defaultConnectComposition as Tn, formatPath as Tt, scanHostImports as U, genericCompoundHostSchema as Ut, probeHostsFolder as V, runProvideHook as Vn, emitHostJsonSchema as Vt, stripComments as W, hostNameSchema as Wt, hostSchemaIssues as X, reactorBackendSchema as Xt, getVerb as Y, reactorBackendKindSchema as Yt, isSchemaLike as Z, reactorHostSchema as Zt, resolveUserDataPlaceholders as _, keyTokenSchema as _n, checkTokenSites as _t, stopStreamOf as a, driveDeclarationSchema as an, describeMapElements as at, isPidAlive as b, ref as bn, outputSitesOf as bt, toStartedHandle as c, TOKEN_ESCAPE_KEY as cn, unsetEnvMessage as ct, loadProducers as d, envTokenSchema as dn, planCompound as dt, refineConnectReactor as en, listVerbs as et, processResolveEnv as f, envTokenable as fn, BUILTIN_ENV_NAMES as ft, defaultUserDataDir as g, itemTokenSchema as gn, checkOutputPaths as gt, runnerOutputsSchema as h, isToken as hn, findRemovedForms as ht, runCompound as i, buildDriveDeclarationSchema as in, TokenResolutionError as it, splitRunArgv as j, hostTypeSatisfies as jn, HOST_NAME_MESSAGE as jt, isRunnerArgsSchema as k, PluginError as kn, CONNECT_PRIMARY_MESSAGE as kt, compoundOutputSource as l, TOKEN_KEYS as ln, PlanError as lt, runRecordOutputSource as m, forbidRef as mn, substituteBuiltinEnv as mt, memberVerbOf as n, runnerBaseSchema as nn, validateDeclaredHost as nt, takesCspRegistrySync as o, drivesSchema as on, emptyMaps as ot, producerOutputsSchemas as p, findToken as pn, isBuiltinEnvName as pt, RunnerError as q, placementKeyIssues as qt, prepareMember as r, runnerKindSchema as rn, validateHost as rt, runnerHandleSchema as s, projectDriveIdWith as sn, resolveHostOutputs as st, compoundStartVerb as t, refineStartOrder as tn, resolveRunnerModule as tt, OUTPUT_DATA_DIRS_ENV as u, concatTokenSchema as un, memberForRef as ut, applyChildWrapper as v, mapTokenSchema as vn, envSitesOf as vt, readRunRecord as w, CONNECT_PLUGIN_OWNED_SLICES as wn, describeToken as wt, listRunRecords as x, tokenKeyOf as xn, refKey as xt, clearRunRecord as y, outputTokenSchema as yn, outputRefsOf as yt, lintOutputsFile as z, runObserveHook as zn, declaredHostSchemas as zt };\n\n//# sourceMappingURL=compound-DKi56SSx.mjs.map"],"names":["z.strictObject","z.string","z.boolean","z.union","z.literal","z.array","z.record","z.unknown","z.prettifyError","z.enum","z.url","z.number","z.looseObject","z.ZodType","z.toJSONSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAI,cAAc,cAAc,MAAM;CACrC,YAAY,SAAS,MAAM;EAC1B,MAAM,OAAO,GAAG,QAAQ,YAAY,SAAS,OAAO;EACpD,KAAK,OAAO;CACb;AACD;AACA,MAAM,0BAA0BA,aAAe;CAC9C,QAAQC,OAAS,CAAC,CAAC,IAAI,CAAC;;CAExB,SAASC,QAAU,CAAC,CAAC,SAAS;;CAE9B,OAAOC,MAAQ,CAACC,QAAU,GAAG,GAAGC,MAAQJ,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;;CAE7E,QAAQK,OAASL,OAAS,GAAGM,QAAU,CAAC,CAAC,CAAC,SAAS;AACpD,CAAC;AACD,MAAM,oBAAoBJ,MAAQ,CAACF,OAAS,CAAC,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC;AAC9E,SAAS,qBAAqB,OAAO;CACpC,IAAI,OAAO,UAAU,UAAU,OAAO;EACrC,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ,CAAC;CACV;CACA,OAAO;EACN,QAAQ,MAAM;EACd,SAAS,MAAM,WAAW;EAC1B,OAAO,MAAM,SAAS;EACtB,QAAQ,MAAM,UAAU,CAAC;CAC1B;AACD;;;AAGA,SAAS,uBAAuB,SAAS,OAAO;CAC/C,MAAM,aAAa,QAAQ,IAAI,oBAAoB;CACnD,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,SAAS,YAAY;EAC/B,IAAI,KAAK,IAAI,MAAM,MAAM,GAAG,MAAM,IAAI,YAAY,GAAG,MAAM,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