@powerhousedao/ph-cli 6.4.0-next.0 → 6.4.0-next.2

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 (89) hide show
  1. package/README.md +1 -1
  2. package/dist/build-BUpe1j4m.mjs +4 -0
  3. package/dist/{build-D8_USaRh.mjs → build-C7RBpPwa.mjs} +8 -8
  4. package/dist/{build-D8_USaRh.mjs.map → build-C7RBpPwa.mjs.map} +1 -1
  5. package/dist/{check-EpzhIKt1.mjs → check-1Hfe0lVO.mjs} +5 -5
  6. package/dist/{check-EpzhIKt1.mjs.map → check-1Hfe0lVO.mjs.map} +1 -1
  7. package/dist/{check-CVRb-CJD.mjs → check-ClxYRer4.mjs} +3 -3
  8. package/dist/{check-_K6EAsag.mjs → check-MBdw9Lbm.mjs} +4 -4
  9. package/dist/{check-_K6EAsag.mjs.map → check-MBdw9Lbm.mjs.map} +1 -1
  10. package/dist/{cli-connect-override-DwlViDdp.mjs → cli-connect-override-DsuuectH.mjs} +7 -7
  11. package/dist/cli-connect-override-DsuuectH.mjs.map +1 -0
  12. package/dist/cli.mjs +14 -8
  13. package/dist/cli.mjs.map +1 -1
  14. package/dist/{compound-n-bO0qKh-Dx7fgKWx.mjs → compound-Q9sZSEZF-zZWzQ7VC.mjs} +8 -8
  15. package/dist/compound-Q9sZSEZF-zZWzQ7VC.mjs.map +1 -0
  16. package/dist/{connect-build-BIkm5fcG.mjs → connect-build-DAnGPSF5.mjs} +6 -6
  17. package/dist/{connect-build-BIkm5fcG.mjs.map → connect-build-DAnGPSF5.mjs.map} +1 -1
  18. package/dist/{connect-config-CH0KQqyU.mjs → connect-config-C0QZ7zTf.mjs} +4 -4
  19. package/dist/{connect-config-CH0KQqyU.mjs.map → connect-config-C0QZ7zTf.mjs.map} +1 -1
  20. package/dist/{connect-studio-C-9WE2Bg.mjs → connect-studio-BUth3UYP.mjs} +4 -4
  21. package/dist/{connect-studio-C-9WE2Bg.mjs.map → connect-studio-BUth3UYP.mjs.map} +1 -1
  22. package/dist/definitions-worker.mjs +1 -1
  23. package/dist/{dist-Dbvm_SmC.mjs → dist-CRR5Anp2.mjs} +5 -5
  24. package/dist/dist-CRR5Anp2.mjs.map +1 -0
  25. package/dist/{explain-DB7uoJkY.mjs → explain-BfOC7Ngv.mjs} +5 -5
  26. package/dist/{explain-DB7uoJkY.mjs.map → explain-BfOC7Ngv.mjs.map} +1 -1
  27. package/dist/{export-DuYGBuQZ.mjs → export-CdTqYviH.mjs} +5 -5
  28. package/dist/{export-DuYGBuQZ.mjs.map → export-CdTqYviH.mjs.map} +1 -1
  29. package/dist/{generate-all-Mj_xGZZN.mjs → generate-all-HujZHqCG.mjs} +4 -4
  30. package/dist/{generate-all-Mj_xGZZN.mjs.map → generate-all-HujZHqCG.mjs.map} +1 -1
  31. package/dist/{generate-desktop-shell-DD9o4Rcl.mjs → generate-desktop-shell-CTrfzM9P.mjs} +4 -4
  32. package/dist/{generate-desktop-shell-DD9o4Rcl.mjs.map → generate-desktop-shell-CTrfzM9P.mjs.map} +1 -1
  33. package/dist/{get-version-DXnnvS_S.mjs → get-version-DAYhm6MX.mjs} +4 -4
  34. package/dist/{get-version-DXnnvS_S.mjs.map → get-version-DAYhm6MX.mjs.map} +1 -1
  35. package/dist/{index-V7TKBh-y.d.mts → index-Bs1PfL3W.d.mts} +18 -5
  36. package/dist/index-Bs1PfL3W.d.mts.map +1 -0
  37. package/dist/{init-Ltg4cJzm.mjs → init-IQ0VS0JK.mjs} +4 -4
  38. package/dist/{init-Ltg4cJzm.mjs.map → init-IQ0VS0JK.mjs.map} +1 -1
  39. package/dist/{mcp-DKqOFZlX.mjs → mcp-rtMGg307.mjs} +6 -6
  40. package/dist/{mcp-DKqOFZlX.mjs.map → mcp-rtMGg307.mjs.map} +1 -1
  41. package/dist/{migrate-CQpwBF1l.mjs → migrate-CWCJP19Q.mjs} +5 -5
  42. package/dist/{migrate-CQpwBF1l.mjs.map → migrate-CWCJP19Q.mjs.map} +1 -1
  43. package/dist/{migrate-document-models-DpXzLDuu.mjs → migrate-document-models-DTxM7D7p.mjs} +4 -4
  44. package/dist/{migrate-document-models-DpXzLDuu.mjs.map → migrate-document-models-DTxM7D7p.mjs.map} +1 -1
  45. package/dist/migrate-subgraphs-DcJjLMFd.mjs +4 -0
  46. package/dist/{migrate-subgraphs-CdfkO6l9.mjs → migrate-subgraphs-_yRnF7xt.mjs} +6 -6
  47. package/dist/{migrate-subgraphs-CdfkO6l9.mjs.map → migrate-subgraphs-_yRnF7xt.mjs.map} +1 -1
  48. package/dist/ph-cli-commands-CRwA1aVX.mjs +4 -0
  49. package/dist/{ph-cli-commands-Dq-tIYhy.mjs → ph-cli-commands-FLZClR4x.mjs} +39 -19
  50. package/dist/ph-cli-commands-FLZClR4x.mjs.map +1 -0
  51. package/dist/{run-sugar-DsG2RRgx.mjs → run-sugar-DUiDFl_T.mjs} +22 -15
  52. package/dist/run-sugar-DUiDFl_T.mjs.map +1 -0
  53. package/dist/{run-sugar-Bnab2Z3f.mjs → run-sugar-YDxw0iV9.mjs} +3 -3
  54. package/dist/runners/connect.d.mts +1 -1
  55. package/dist/runners/connect.mjs +4 -4
  56. package/dist/runners/connect.mjs.map +1 -1
  57. package/dist/runners/switchboard.d.mts +1 -1
  58. package/dist/runners/switchboard.mjs +4 -4
  59. package/dist/scripts/generate-commands-docs.ts +2 -0
  60. package/dist/{sugar-checks-DBk5q_uJ.mjs → sugar-checks-BFu3sfFJ.mjs} +11 -11
  61. package/dist/sugar-checks-BFu3sfFJ.mjs.map +1 -0
  62. package/dist/{switchboard-reset-CY6J0lWO.mjs → switchboard-reset-BP7KwUc_.mjs} +4 -4
  63. package/dist/{switchboard-reset-CY6J0lWO.mjs.map → switchboard-reset-BP7KwUc_.mjs.map} +1 -1
  64. package/dist/{verify-C_fL8YsF.mjs → verify-Dkb6K1fc.mjs} +4 -4
  65. package/dist/{verify-C_fL8YsF.mjs.map → verify-Dkb6K1fc.mjs.map} +1 -1
  66. package/dist/vetra-gateway-BMzq0mqX.mjs +173 -0
  67. package/dist/vetra-gateway-BMzq0mqX.mjs.map +1 -0
  68. package/dist/vetra-gateway-BP6Catg4.mjs +4 -0
  69. package/dist/{vetra-host-CDfny6E8.mjs → vetra-host-C37IGwBM.mjs} +7 -7
  70. package/dist/vetra-host-C37IGwBM.mjs.map +1 -0
  71. package/dist/{vetra-instance-DlXAeiU7.mjs → vetra-instance-CLUzbtbh.mjs} +6 -6
  72. package/dist/vetra-instance-CLUzbtbh.mjs.map +1 -0
  73. package/dist/vetra-launcher-CJ01qmS1.mjs +4 -0
  74. package/dist/{vetra-launcher-CYX10K2m.mjs → vetra-launcher-Dq0tWyNW.mjs} +5 -5
  75. package/dist/{vetra-launcher-CYX10K2m.mjs.map → vetra-launcher-Dq0tWyNW.mjs.map} +1 -1
  76. package/package.json +16 -16
  77. package/dist/build-FVWjguYr.mjs +0 -4
  78. package/dist/cli-connect-override-DwlViDdp.mjs.map +0 -1
  79. package/dist/compound-n-bO0qKh-Dx7fgKWx.mjs.map +0 -1
  80. package/dist/dist-Dbvm_SmC.mjs.map +0 -1
  81. package/dist/index-V7TKBh-y.d.mts.map +0 -1
  82. package/dist/migrate-subgraphs-CoUuwzmR.mjs +0 -4
  83. package/dist/ph-cli-commands-Daeqh5Me.mjs +0 -4
  84. package/dist/ph-cli-commands-Dq-tIYhy.mjs.map +0 -1
  85. package/dist/run-sugar-DsG2RRgx.mjs.map +0 -1
  86. package/dist/sugar-checks-DBk5q_uJ.mjs.map +0 -1
  87. package/dist/vetra-host-CDfny6E8.mjs.map +0 -1
  88. package/dist/vetra-instance-DlXAeiU7.mjs.map +0 -1
  89. package/dist/vetra-launcher-TDLXj0tY.mjs +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound-Q9sZSEZF-zZWzQ7VC.mjs","sources":["../../../packages/host-core/dist/compound-Q9sZSEZF.mjs"],"sourcesContent":["import { closeProcessControlChannel, controlRecordOf, ensureProcessControlChannel } from \"./control-channel.mjs\";\nimport { killTree } from \"./kill-tree.mjs\";\nimport { createRequire } from \"node:module\";\nimport { createHash } from \"node:crypto\";\nimport fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { Worker } from \"node:worker_threads\";\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, spawn } from \"node:child_process\";\nimport net from \"node:net\";\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 (`<slug>-<hash of the path>`) — the\n\t\t* same ids classic `ph vetra` produced. `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/connect-composition.ts\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 it is written, for a host that\n* declares no `runner.plugins`. `config` is the connect block Connect is\n* 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//#endregion\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/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/** An npm package name, as `<package>/<host>` names a package that supplies\n* hosts: `name` or `@scope/name`, each part letters, digits, '-', '.', '_'\n* and '~', not starting with '.' or '_'. Each part is one folder name, the\n* one the package has under node_modules. */\nconst PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9~-][A-Za-z0-9._~-]*\\/)?[A-Za-z0-9~-][A-Za-z0-9._~-]*$/;\n/** How a compound names a member's host: its folder under the project's\n* `hosts/` (or, in a package's compound, the package's first), or\n* `<package>/<host>` for one an installed package supplies. */\nconst HOST_REF_PATTERN = new RegExp(`^(?:${PACKAGE_NAME_PATTERN.source.slice(1, -1)}/)?${HOST_NAME_PATTERN.source.slice(1, -1)}$`);\nconst HOST_REF_MESSAGE = \"A member's host is a host folder (`switchboard`), or `<package>/<host>` (`@acme/tools/studio`) for one an installed package supplies.\";\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\"]);\n/** A compound member's process: its own, or the compound's (`shared`). */\nconst memberProcessSchema = z.enum([\"own\", \"shared\"]);\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\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).regex(HOST_REF_PATTERN, HOST_REF_MESSAGE),\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\t/** Where the member runs: `own`, a child process of the compound\n\t\t* (`ph run <host>`), stopped through its stdin; `shared`, in the\n\t\t* compound's own process. Default: `own` next to a foreground member\n\t\t* (the Cli runner), `shared` otherwise. */\n\t\tprocess: memberProcessSchema.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/host-ref.ts\n/**\n* How a host is addressed (decision D5). A bare name (`switchboard`) is the\n* project's own host, `<project>/hosts/switchboard/`, always: a package\n* cannot shadow it. `<package>/<host>` (`@powerhousedao/vetra-cli/studio`,\n* `tools/studio`) is a host an installed package supplies, in the `hosts/`\n* folder it ships: `<package>/hosts/studio/`. The host is the last segment,\n* so a host name has no `/`. Only inside a package's compound does a bare\n* member name look in that package first (`locateHost`'s `scope`).\n*/\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/** Splits a ref at its last `/`; refuses what names no host. */\nfunction parseHostRef(ref) {\n\tconst slash = ref.lastIndexOf(\"/\");\n\tif (slash === -1) return { host: ref };\n\tconst pkg = ref.slice(0, slash);\n\tconst host = ref.slice(slash + 1);\n\tif (/^@[^/]*$/.test(pkg) || ref.startsWith(\"@\") && host === \"\") throw new HostLoadError(`\"${ref}\" names a package, not a host.`, `A package's host is <package>/<host>, e.g. \\`ph run ${ref.replace(/\\/$/, \"\")}/<host>\\`.`);\n\tif (!PACKAGE_NAME_PATTERN.test(pkg)) throw new HostLoadError(`\"${ref}\" names no host: a host is <host> (the project's) or <package>/<host>, a host name has no \"/\", and \"${pkg}\" is no package name.`);\n\tif (host === \"\") throw new HostLoadError(`\"${ref}\" names package \"${pkg}\" but no host.`, `Write ${pkg}/<host>.`);\n\treturn {\n\t\tpackage: pkg,\n\t\thost\n\t};\n}\nfunction formatHostRef(ref) {\n\treturn ref.package === void 0 ? ref.host : `${ref.package}/${ref.host}`;\n}\n/** Where messages point for a host file: `hosts/<host>/host.js`, behind its\n* package for a package's (`@acme/tools/hosts/studio/host.js`). */\nfunction hostFileLabel(folder, hostPackage) {\n\tconst file = `hosts/${folder}/host.js`;\n\treturn hostPackage ? `${hostPackage.name}/${file}` : file;\n}\nfunction packageJsonName(dir) {\n\ttry {\n\t\tconst name = JSON.parse(readFileSync(path.join(dir, \"package.json\"), \"utf8\")).name;\n\t\treturn typeof name === \"string\" ? name : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* The real folder of the installed package `name`, found from `fromRoot` as\n* Node finds it: the first `<dir>/node_modules/<name>/package.json` on the\n* lookup paths of `<fromRoot>/package.json`, by its real path (a pnpm link\n* leads to the package's own folder, whose dependencies are its own). Not\n* through `exports`, which may not list `package.json`. Undefined when it is\n* not installed there.\n*/\nfunction resolvePackageRoot(fromRoot, name) {\n\tconst root = path.resolve(fromRoot);\n\tconst lookup = createRequire(pathToFileURL(path.join(root, \"package.json\")).href).resolve.paths(name) ?? [];\n\tfor (const dir of lookup) {\n\t\tconst candidate = path.join(dir, name);\n\t\tif (existsSync(path.join(candidate, \"package.json\"))) return realpathSync(candidate);\n\t}\n}\n/** The installed package `name`, found from the project root\n* (resolvePackageRoot). */\nfunction findHostPackage(projectRoot, name, host) {\n\tconst root = path.resolve(projectRoot);\n\tif (packageJsonName(root) === name) throw new HostLoadError(`\"${name}/${host}\": \"${name}\" is this project's own package.`, `Run the project's own host by its bare name: \\`ph run ${host}\\`.`);\n\tconst found = resolvePackageRoot(root, name);\n\tif (found !== void 0) return {\n\t\tname,\n\t\troot: found\n\t};\n\tthrow new HostLoadError(`Package \"${name}\" is not installed in this project, so it supplies no host \"${host}\".`, `Add ${name} as a dependency of the project (looked up from ${root}).`);\n}\n/** The `<name>/host.js` folders under `<root>/hosts`, sorted; undefined\n* when there is no hosts/ folder. */\nfunction hostFolders(root) {\n\tconst dir = path.join(root, \"hosts\");\n\tif (!existsSync(dir) || !statSync(dir).isDirectory()) return void 0;\n\treturn readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(path.join(dir, entry.name, \"host.js\"))).map((entry) => entry.name).sort();\n}\n/** A package's host, or why the package has none by that name. */\nfunction packageHostLocation(pkg, host) {\n\tconst folders = hostFolders(pkg.root);\n\tif (folders === void 0 || folders.length === 0) throw new HostLoadError(`Package \"${pkg.name}\" supplies no hosts: ${pkg.root} has no hosts/<name>/host.js, so \"${pkg.name}/${host}\" cannot run.`);\n\tif (!folders.includes(host)) throw new HostLoadError(`Package \"${pkg.name}\" supplies no host \"${host}\". Its hosts: ${folders.join(\", \")}.`);\n\treturn {\n\t\tref: formatHostRef({\n\t\t\tpackage: pkg.name,\n\t\t\thost\n\t\t}),\n\t\tfolder: host,\n\t\thostsDir: path.join(pkg.root, \"hosts\"),\n\t\tpackage: pkg\n\t};\n}\n/**\n* Where `ref` is. `<package>/<host>` is always the installed package's,\n* found from the project root (also when a package's compound writes it). A\n* bare name is the project's, except in a package's compound (`scope`): there\n* the package's own host of that name comes first. Throws a HostLoadError\n* naming the package and the host. A bare name the project lacks is left to\n* the loader's own message (undefined `package`, project `hostsDir`).\n*/\nfunction locateHost(projectRoot, ref, scope) {\n\tconst parsed = parseHostRef(ref);\n\tif (parsed.package !== void 0) return packageHostLocation(findHostPackage(projectRoot, parsed.package, parsed.host), parsed.host);\n\tconst own = {\n\t\tref: parsed.host,\n\t\tfolder: parsed.host,\n\t\thostsDir: path.join(projectRoot, \"hosts\")\n\t};\n\tif (!scope) return own;\n\tconst supplied = hostFolders(scope.root) ?? [];\n\tif (supplied.includes(parsed.host)) return packageHostLocation(scope, parsed.host);\n\tconst projects = hostFolders(projectRoot) ?? [];\n\tif (projects.includes(parsed.host)) return own;\n\tthrow new HostLoadError(`Unknown host \"${parsed.host}\": package \"${scope.name}\" supplies none (its hosts: ${supplied.join(\", \") || \"none\"}), and neither does the project (its hosts: ${projects.join(\", \") || \"none\"}).`);\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* 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 default composition 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/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)) return;\n\tif (reactor.workflows !== void 0) found.push({\n\t\tpath: `${base}reactor.workflows`,\n\t\tmessage: \"reactor.workflows was removed in 6.4; the workflows plugin under runner.plugins decides: list it to run workflows, leave it out to run none. On a switchboard, PH_WORKFLOWS_ENABLED=0 still switches them off.\"\n\t});\n\tif (!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 = [\n\t\"userData\",\n\t\"projectRoot\",\n\t\"package\"\n];\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 }`. For\n* a host an installed package supplies, the caller passes the package's\n* folder as the root (`moduleRootOf`).\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\"foreground\",\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, or of the package that supplies the host (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\tif (module.foreground !== void 0 && typeof module.foreground !== \"boolean\") throw new RunnerError(`Runner \"${specifier}\" exports a \\`foreground\\` that is not a boolean.`);\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/** Why a one-shot verb (build) does not run on a host an installed package\n* supplies (`ref`, as the project addresses it): the package ships its hosts\n* built, and a build here would write into the installed package (a\n* Connect's outDir) or build the project in its name. The package's own\n* repository builds them, where they are project hosts. */\nfunction packageBuildRefusal(ref, hostPackage, verb) {\n\treturn {\n\t\tpath: \"\",\n\t\tmessage: `${ref} is a host ${hostPackage.name} supplies, and a package's hosts are built by the package: \"${verb}\" does not run on it.`,\n\t\thint: `${hostPackage.name} ships them built; its own repository builds them, where they are project hosts. Build this project's own hosts by their bare names.`\n\t};\n}\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$3(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$3(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$3(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$3(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$3(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$3(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: the project's\n* own, or one an installed package supplies (`<package>/<host>`, host-ref.ts).\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\";\n/** A `hosts/` folder with no `<name>/host.js` inside is \"empty\": it defines\n* no host, so nothing runs from it, as from an absent one\n* ({@link withoutHostsMessage}). */\nfunction probeHostsFolder(projectRoot) {\n\tconst dir = path.join(projectRoot, \"hosts\");\n\tconst hosts = hostFolders(projectRoot);\n\tif (hosts === void 0) return { kind: \"absent\" };\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/**\n* Why `subject` cannot run in a project whose hosts/ folder is absent or\n* empty, and what adds the host files. One wording, for `ph run <host>` and\n* for the `ph dev`, `ph connect` and `ph switchboard` sugar.\n*/\nfunction withoutHostsMessage(probe, subject) {\n\treturn `${probe.kind === \"empty\" ? `hosts/ exists at ${probe.dir} but contains no <name>/host.js` : \"This project has no hosts/ folder\"}, so ${subject} cannot run. Run \\`ph migrate\\` to add the host files.`;\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}\n/** Where a loaded host's module specifiers resolve from: its package's\n* folder, else the project root. */\nfunction moduleRootOf(projectRoot, loaded) {\n\treturn loaded.package?.root ?? projectRoot;\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}\n/** `hostName` is a ref: the project's folder name, or `<package>/<host>`. */\nasync function loadHost(projectRoot, hostName, options = {}) {\n\treturn importHost(projectRoot, hostName, true, false, options.scope);\n}\n/**\n* `loadHost`, evaluated again: the host file and what it imports are read as\n* they are on disk now. A process keeps the first evaluation of a module, so\n* `loadHost` returns the host as it was when the process first loaded it; a\n* dev server that follows powerhouse.config.json asks for this one.\n*/\nasync function loadHostFresh(projectRoot, hostName, options = {}) {\n\treturn importHost(projectRoot, hostName, true, true, options.scope);\n}\nconst FRESH_IMPORT_WORKER = `\nconst { parentPort, workerData } = require(\"node:worker_threads\");\nimport(workerData.url).then(\n (module) => {\n try {\n parentPort.postMessage({ host: module.default });\n } catch (error) {\n parentPort.postMessage({ error: String(error) });\n }\n },\n (error) => parentPort.postMessage({ error: String(error) }),\n);\n`;\n/** The default export of a module, evaluated in a worker: a worker has its\n* own module graph, so the file and its imports are read again. Host files\n* export data, which is what reaches this thread. */\nfunction importDefaultFresh(url, file) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst worker = new Worker(FRESH_IMPORT_WORKER, {\n\t\t\teval: true,\n\t\t\tworkerData: { url }\n\t\t});\n\t\tconst fail = (reason) => reject(new HostLoadError(`${file} could not be read again: ${reason}`));\n\t\tworker.once(\"message\", (message) => {\n\t\t\tif (message.error !== void 0) fail(message.error);\n\t\t\telse resolve(message.host);\n\t\t\tworker.terminate();\n\t\t});\n\t\tworker.once(\"error\", (error) => fail(String(error)));\n\t\tworker.once(\"exit\", () => fail(\"its worker exited without an answer\"));\n\t});\n}\n/** Where `ref` is; for the project's own host, the loader's messages when\n* its hosts/ folder lacks it. */\nfunction locateLoadable(projectRoot, ref, scope) {\n\tconst location = locateHost(projectRoot, ref, scope);\n\tif (location.package) return location;\n\tconst probe = probeHostsFolder(projectRoot);\n\tif (probe.kind !== \"present\") throw new HostLoadError(withoutHostsMessage(probe, `the host \"${ref}\"`));\n\tif (!probe.hosts.includes(location.folder)) throw new HostLoadError(`Unknown host \"${ref}\". Available hosts: ${probe.hosts.join(\", \")}.`);\n\treturn location;\n}\nasync function importHost(projectRoot, hostName, checkOutputs, fresh = false, scope) {\n\tconst location = locateLoadable(projectRoot, hostName, scope);\n\tconst { folder, hostsDir } = location;\n\tconst file = path.join(hostsDir, folder, HOST_FILE);\n\tconst producers = lintHostImportGraph(hostsDir, folder);\n\tif (checkOutputs) for (const producer of producers) await assertOutputsFileFresh(projectRoot, location, producer);\n\tconst url = pathToFileURL(file).href;\n\tconst host = fresh ? await importDefaultFresh(url, file) : (await import(url)).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: folder,\n\t\tdir: path.dirname(file),\n\t\tfile,\n\t\thost,\n\t\tref: location.ref,\n\t\t...location.package ? { package: location.package } : {}\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$2(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$2(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 loaded = await importHost(projectRoot, hostName, false);\n\tconst { host, file } = loaded;\n\tconst moduleRoot = moduleRootOf(projectRoot, loaded);\n\tconst runnerModule = host.runner.module;\n\tconst schema = (await resolveRunnerModule(moduleRoot, 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$2(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(moduleRoot, \"*\", 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\tconst folder = loaded.name;\n\treturn {\n\t\thost: folder,\n\t\trunnerModule,\n\t\toutputsSchema,\n\t\tdrives: sortedDrives,\n\t\thash: computeOutputsHash({\n\t\t\thost: folder,\n\t\t\trunnerModule,\n\t\t\toutputsSchema,\n\t\t\tdrives: sortedDrives\n\t\t})\n\t};\n}\nasync function assertOutputsFileFresh(projectRoot, consumer, producer) {\n\tconst { hostsDir } = consumer;\n\tconst where = consumer.package ? `${consumer.package.name}/` : \"\";\n\tconst rel = `${where}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(`${where}hosts/${consumer.folder} imports ${rel}, but there is no ${hostFileLabel(producer, consumer.package)} to produce it.`, \"Delete the orphaned outputs.js and fix the import.\");\n\tconst description = await describeHostOutputs(projectRoot, formatHostRef({\n\t\tpackage: consumer.package?.name,\n\t\thost: producer\n\t}));\n\tif (!description) throw new HostLoadError(`${where}hosts/${consumer.folder} imports ${rel}, but ${where}hosts/${producer}'s runner declares no outputsSchema, so it produces no outputs.`);\n\tif (actual !== description.hash) throw new HostLoadError(consumer.package ? `${rel} is stale against the runner this project resolves for it (its outputsSchema or declared drives differ from those it was generated from): package \"${consumer.package.name}\" was built against another version of \"${description.runnerModule}\".` : `${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)) && (schema.passthrough === void 0 || typeof schema.passthrough === \"boolean\");\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. A `passthrough` runner gets\n* them all, in order.\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\tif (schema.passthrough) return [...argv];\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*\n* With a `foreground` member (the one that owns the terminal) the members\n* take only their member-named options, at the front; the first other\n* argument, or a literal `--`, starts the foreground member's own, checked\n* against its runner's schema (a passthrough runner takes them as typed).\n*/\nfunction splitCompoundArgv(argv, host, members, foreground) {\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 owner = members.find((m) => m.key === foreground);\n\tif (owner) {\n\t\tlet i = 0;\n\t\tfor (; i < argv.length; i++) {\n\t\t\tconst token = argv[i];\n\t\t\tif (token === \"--\") {\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst equals = token.startsWith(\"-\") ? token.indexOf(\"=\") : -1;\n\t\t\tconst name = equals === -1 ? token : token.slice(0, equals);\n\t\t\tconst named = schemas.filter(({ key, schema }) => key !== owner.key && schema.memberOptions?.[name] !== void 0);\n\t\t\tif (named.length === 0) break;\n\t\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\t\tconst { key, schema } = named[0];\n\t\t\tconst option = schema.memberOptions?.[name] ?? name;\n\t\t\tif (equals !== -1) perMember.get(key)?.push(option + token.slice(name.length));\n\t\t\telse if (i + 1 >= argv.length) throw new RunnerError(`${where}: ${name} needs a value.`);\n\t\t\telse {\n\t\t\t\tperMember.get(key)?.push(option, argv[i + 1]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tperMember.set(owner.key, checkRunnerArgv(argv.slice(i), {\n\t\t\thost,\n\t\t\trunner: owner.runner,\n\t\t\tschema: owner.schema\n\t\t}));\n\t\treturn perMember;\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. A host an installed package\n* supplies has its record in a folder named after the package,\n* `.ph/run/<package>/<host>.json`, and says which in `package`.\n*/\nconst outputsSchema = z.record(z.string(), z.unknown());\nconst runRecordMemberSchema = z.strictObject({\n\t/** The member's host as the project addresses it: its folder, or\n\t* `<package>/<host>` for one a package supplies. */\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\t/** The installed package that supplies the host; absent for the\n\t* project's own. */\n\tpackage: z.string().regex(PACKAGE_NAME_PATTERN).optional(),\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\n/** The key a host's record is filed under: its `name`, behind the package\n* that supplies it when it is not the project's own (`@acme/tools/studio`),\n* as `ph run` addresses the host. */\nfunction runRecordKey(name, hostPackage) {\n\treturn hostPackage === void 0 ? name : `${hostPackage}/${name}`;\n}\n/** The key of a record as read: where it is filed. */\nfunction recordKeyOf(record) {\n\treturn runRecordKey(record.host, record.package);\n}\nconst runDir = (projectDir, env = process.env) => path.join(resolvePhDir(projectDir, env), \"run\");\nfunction recordPath(projectDir, key, env) {\n\tconst dir = runDir(projectDir, env);\n\tconst slash = key.lastIndexOf(\"/\");\n\tconst hostName = key.slice(slash + 1);\n\tconst pkg = slash === -1 ? void 0 : key.slice(0, slash);\n\tconst folder = pkg === void 0 ? path.resolve(dir) : path.resolve(dir, ...pkg.split(\"/\"));\n\tconst file = path.resolve(folder, `${hostName}.json`);\n\tif (!hostNameSchema.safeParse(hostName).success || pkg !== void 0 && !PACKAGE_NAME_PATTERN.test(pkg) || path.dirname(file) !== folder) throw new Error(`\"${key}\" can't name a run record. ${HOST_NAME_MESSAGE}`);\n\treturn file;\n}\n/** The record keys under `.ph/run/`: `<name>.json` files, and those in a\n* package's folder (`<pkg>/` or `@scope/<pkg>/`). */\nfunction recordKeys(dir) {\n\tconst entries = (at) => {\n\t\ttry {\n\t\t\treturn fs.readdirSync(at, { withFileTypes: true });\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t};\n\tconst records = (at, prefix) => entries(at).filter((entry) => entry.isFile() && entry.name.endsWith(\".json\")).map((entry) => `${prefix}${entry.name.slice(0, -5)}`);\n\tconst keys = records(dir, \"\");\n\tfor (const entry of entries(dir)) {\n\t\tif (!entry.isDirectory()) continue;\n\t\tconst at = path.join(dir, entry.name);\n\t\tif (!entry.name.startsWith(\"@\")) {\n\t\t\tkeys.push(...records(at, `${entry.name}/`));\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const inner of entries(at)) {\n\t\t\tif (!inner.isDirectory()) continue;\n\t\t\tkeys.push(...records(path.join(at, inner.name), `${entry.name}/${inner.name}/`));\n\t\t}\n\t}\n\treturn keys;\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/`, package hosts' included (invalid\n* and v1 files skipped). */\nfunction listRunRecords(projectDir, env = process.env) {\n\treturn recordKeys(runDir(projectDir, env)).flatMap((key) => {\n\t\tconst record = readRunRecord(projectDir, key, 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, recordKeyOf(record));\n\tconst valid = runRecordSchema.parse(record);\n\tfs.mkdirSync(path.dirname(target), { recursive: true });\n\tconst text = `${JSON.stringify(valid, null, 2)}\\n`;\n\tif (valid.extra?.control === void 0) {\n\t\tfs.writeFileSync(target, text);\n\t\treturn;\n\t}\n\tfs.rmSync(target, { force: true });\n\tfs.writeFileSync(target, text, { mode: 384 });\n\tif (process.platform !== \"win32\") fs.chmodSync(target, 384);\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/stop-channel.ts\n/** Set by a supervisor that holds this process's stdin. */\nconst STOP_ON_STDIN_ENV = \"PH_STOP_ON_STDIN\";\n/**\n* Windows has no SIGTERM: `process.kill(pid, \"SIGTERM\")` ends the process at\n* once, so no handler runs and a stack's stores are left as a crash leaves\n* them. A started host therefore listens on a pipe named after its pid, and\n* a connection to it is delivered as the SIGTERM it stands for. Elsewhere\n* the signal itself does this, and there is no channel.\n*/\nfunction stopChannelPath(pid, platform = process.platform) {\n\treturn platform === \"win32\" ? `\\\\\\\\.\\\\pipe\\\\ph-stop-${pid}` : void 0;\n}\n/** Calls `onStop` for each connection to `channel`. The server holds no\n* process open, and one that cannot listen leaves the host running without\n* a channel rather than not running. */\nfunction listenForStop(channel, onStop) {\n\tconst server = net.createServer((socket) => {\n\t\tsocket.on(\"error\", () => void 0);\n\t\tsocket.end();\n\t\tonStop();\n\t});\n\tserver.on(\"error\", () => void 0);\n\tserver.listen(channel);\n\tserver.unref();\n\treturn server;\n}\nlet installed = false;\n/** What a host's process calls once before it starts anything: from then on\n* {@link requestStop} reaches its SIGTERM handlers on every platform. */\nfunction installStopChannel() {\n\tconst channel = stopChannelPath(process.pid);\n\tif (!channel || installed) return;\n\tinstalled = true;\n\tlistenForStop(channel, () => {\n\t\tif (!process.emit(\"SIGTERM\", \"SIGTERM\")) process.exit(143);\n\t});\n}\nconst ASK_TIMEOUT_MS = 2e3;\n/** Connects to a stop channel; true once the listener took the request. */\nfunction askToStop(channel, timeoutMs = ASK_TIMEOUT_MS) {\n\treturn new Promise((resolve) => {\n\t\tlet connected = false;\n\t\tconst socket = net.connect(channel);\n\t\tsocket.setTimeout(timeoutMs, () => socket.destroy());\n\t\tsocket.once(\"connect\", () => connected = true);\n\t\tsocket.on(\"error\", () => void 0);\n\t\tsocket.once(\"close\", () => resolve(connected));\n\t\tsocket.resume();\n\t});\n}\n/**\n* Asks the process to stop as SIGTERM would. False when it could not be\n* asked: on Windows a process without a stop channel (started by an older\n* version, or not a host), which only a kill ends.\n*/\nasync function requestStop(pid, platform = process.platform) {\n\tconst channel = stopChannelPath(pid, platform);\n\tif (channel) return askToStop(channel);\n\ttry {\n\t\tprocess.kill(pid, \"SIGTERM\");\n\t} catch {}\n\treturn true;\n}\nconst STOP_RUN_TIMEOUT_MS = 6e4;\n/** Asks the project's running `hostName` to stop and waits until its process\n* is gone. It never kills: a host that does not answer keeps running. */\nasync function stopRun(projectDir, hostName, options = {}) {\n\tconst env = options.env ?? process.env;\n\tconst probe = probeRun(projectDir, hostName, readProjectName(projectDir), env);\n\tif (probe.status === \"none\" || probe.status === \"stale\") return { status: \"none\" };\n\tconst { pid } = probe.record;\n\tif (probe.status === \"foreign\") return {\n\t\tstatus: \"foreign\",\n\t\tpid,\n\t\tprojectName: probe.record.projectName\n\t};\n\tif (!await requestStop(pid)) return {\n\t\tstatus: \"unreachable\",\n\t\tpid\n\t};\n\tconst deadline = Date.now() + (options.timeoutMs ?? 6e4);\n\twhile (isPidAlive(pid)) {\n\t\tif (Date.now() >= deadline) return {\n\t\t\tstatus: \"timeout\",\n\t\t\tpid\n\t\t};\n\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\t}\n\tif (readRunRecord(projectDir, hostName, env)?.pid === pid) clearRunRecord(projectDir, hostName, env);\n\treturn {\n\t\tstatus: \"stopped\",\n\t\tpid\n\t};\n}\n//#endregion\n//#region src/compound-member.ts\n/**\n* How a compound hands an own-process member its host. The member's\n* `host.js` alone is not the member: the compound's wrapper (reactor, config\n* and runner overrides) and its resolved tokens are. So the compound\n* resolves the member as it would in its own process and the child's\n* `ph run <folder>` runs that host instead of reading the file.\n*/\n/** Carries a {@link CompoundMemberHost} as JSON to the child's `ph run`. */\nconst COMPOUND_MEMBER_ENV = \"PH_COMPOUND_MEMBER\";\n/** The most an environment variable holds on Windows, in characters; counted\n* here with its name and `=`, and kept on every platform, so a stack that\n* starts on one starts on all. */\nconst ENV_VALUE_LIMIT = 32767;\nconst isRecord$1 = (value) => typeof value === \"object\" && value !== null && !Array.isArray(value);\n/**\n* The first value in `value` that a JSON round trip drops or changes: a\n* function, symbol or bigint, `undefined` or an empty slot in an array, a\n* number that is not finite, an instance of a class (a Date, a Map, …) or\n* any object with `toJSON`, a symbol key, a cycle. An object property that\n* is `undefined` is fine: JSON drops it, and an absent key reads the same.\n*/\nfunction jsonChange(value) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tconst walk = (item, path) => {\n\t\tswitch (typeof item) {\n\t\t\tcase \"string\":\n\t\t\tcase \"boolean\": return;\n\t\t\tcase \"number\": return Number.isFinite(item) ? void 0 : {\n\t\t\t\tpath,\n\t\t\t\twhat: `the number ${item}, which JSON writes as null`\n\t\t\t};\n\t\t\tcase \"undefined\": return {\n\t\t\t\tpath,\n\t\t\t\twhat: \"undefined, which JSON writes as null here\"\n\t\t\t};\n\t\t\tcase \"function\": return {\n\t\t\t\tpath,\n\t\t\t\twhat: \"a function, which JSON drops\"\n\t\t\t};\n\t\t\tcase \"symbol\": return {\n\t\t\t\tpath,\n\t\t\t\twhat: \"a symbol, which JSON drops\"\n\t\t\t};\n\t\t\tcase \"bigint\": return {\n\t\t\t\tpath,\n\t\t\t\twhat: \"a bigint, which JSON cannot write\"\n\t\t\t};\n\t\t}\n\t\tif (item === null) return void 0;\n\t\tconst object = item;\n\t\tif (ancestors.has(object)) return {\n\t\t\tpath,\n\t\t\twhat: \"a cycle, which JSON cannot write\"\n\t\t};\n\t\tconst prototype = Object.getPrototypeOf(object);\n\t\tif (Array.isArray(object) && prototype === Array.prototype) {\n\t\t\tancestors.add(object);\n\t\t\ttry {\n\t\t\t\tfor (let i = 0; i < object.length; i++) {\n\t\t\t\t\tif (!(i in object)) return {\n\t\t\t\t\t\tpath: [...path, i],\n\t\t\t\t\t\twhat: \"an empty slot, which JSON writes as null\"\n\t\t\t\t\t};\n\t\t\t\t\tconst found = walk(object[i], [...path, i]);\n\t\t\t\t\tif (found) return found;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t} finally {\n\t\t\t\tancestors.delete(object);\n\t\t\t}\n\t\t}\n\t\tif (object instanceof Date) return {\n\t\t\tpath,\n\t\t\twhat: \"a Date, which JSON writes as a string\"\n\t\t};\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\tconst name = object.constructor?.name;\n\t\t\treturn {\n\t\t\t\tpath,\n\t\t\t\twhat: `${typeof name === \"string\" && name ? `a ${name}` : \"an instance of a class\"}, which JSON writes as a plain object`\n\t\t\t};\n\t\t}\n\t\tif (typeof object.toJSON === \"function\") return {\n\t\t\tpath,\n\t\t\twhat: \"an object with toJSON, which JSON replaces\"\n\t\t};\n\t\tif (Object.getOwnPropertySymbols(object).length > 0) return {\n\t\t\tpath,\n\t\t\twhat: \"a symbol-keyed property, which JSON drops\"\n\t\t};\n\t\tancestors.add(object);\n\t\ttry {\n\t\t\tfor (const [key, entry] of Object.entries(object)) {\n\t\t\t\tif (entry === void 0) continue;\n\t\t\t\tconst found = walk(entry, [...path, key]);\n\t\t\t\tif (found) return found;\n\t\t\t}\n\t\t\treturn;\n\t\t} finally {\n\t\t\tancestors.delete(object);\n\t\t}\n\t};\n\treturn walk(value, []);\n}\n/**\n* The member's host as the JSON its child reads from COMPOUND_MEMBER_ENV.\n* Refuses one JSON would change, or too long for an environment variable,\n* naming the member, the value and the way out: the member runs in the\n* compound's process, where nothing is copied.\n*/\nfunction encodeCompoundMember(member) {\n\tconst where = `hosts/${member.compound}: member \"${member.member}\" cannot run in its own process`;\n\tconst hint = `Run it in the compound's process: children.${member.member}.process: \"shared\".`;\n\tconst change = jsonChange(member.host);\n\tif (change) throw new RunnerError(`${where}: its host holds ${change.what}, at ${formatPath(change.path)}; the child gets its host as JSON.`, hint);\n\tconst json = JSON.stringify(member);\n\tif (19 + json.length > 32767) throw new RunnerError(`${where}: its host is ${json.length} characters as JSON, and the child gets it in an environment variable, which holds at most ${ENV_VALUE_LIMIT} on Windows.`, hint);\n\treturn json;\n}\n/**\n* The member host a compound handed this process for `folder`, taken out of\n* `env` so nothing this process starts inherits it. Undefined when there is\n* none; throws when it is malformed or names another folder.\n*/\nfunction takeCompoundMember(env, folder) {\n\tconst raw = env[COMPOUND_MEMBER_ENV];\n\tif (raw === void 0) return void 0;\n\tdelete env[COMPOUND_MEMBER_ENV];\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tif (!isRecord$1(parsed) || typeof parsed.compound !== \"string\" || typeof parsed.member !== \"string\" || typeof parsed.folder !== \"string\" || !isRecord$1(parsed.host)) throw new Error(`${COMPOUND_MEMBER_ENV} does not hold a compound member's host.`);\n\tif (parsed.folder !== folder) throw new Error(`${COMPOUND_MEMBER_ENV} holds member \"${parsed.member}\" (hosts/${parsed.folder}) of compound \"${parsed.compound}\", not hosts/${folder}.`);\n\treturn parsed;\n}\n//#endregion\n//#region src/spawn-host.ts\n/** The tail line before which a timed-out or aborted run's output is its own. */\nconst SPAWN_STOPPING_NOTE = \"spawnHost: stopping it\";\nvar SpawnHostError = class extends Error {\n\tphase;\n\toutputTail;\n\texit;\n\tconstructor(message, phase, outputTail, exit) {\n\t\tsuper(outputTail ? `${message}\\n--- output tail ---\\n${outputTail}` : message);\n\t\tthis.phase = phase;\n\t\tthis.outputTail = outputTail;\n\t\tthis.exit = exit;\n\t\tthis.name = \"SpawnHostError\";\n\t}\n};\nconst READY_TIMEOUT_MS = 12e4;\nconst STOP_TIMEOUT_MS = 3e4;\nconst POLL_MS = 100;\nconst CLOSE_WAIT_MS = 1e3;\nconst BASE_ENV_KEYS = [\n\t\"PATH\",\n\t\"HOME\",\n\t\"TMPDIR\"\n];\nconst WIN32_ENV_KEYS = [\n\t\"SystemRoot\",\n\t\"USERPROFILE\",\n\t\"APPDATA\",\n\t\"LOCALAPPDATA\",\n\t\"TEMP\",\n\t\"TMP\",\n\t\"ComSpec\",\n\t\"PATHEXT\"\n];\n/** The child's whole env: without a `baseEnv`, no other `process.env` key\n* reaches it. */\nfunction childEnv(dataDir, env = {}, baseEnv) {\n\tif (\"PH_USER_DATA_DIR\" in env) throw new Error(\"spawnHost: set the data dir with `dataDir`, not env.PH_USER_DATA_DIR.\");\n\tif (baseEnv) {\n\t\tconst base = {};\n\t\tfor (const [key, value] of Object.entries(baseEnv)) if (value !== void 0) base[key] = value;\n\t\treturn {\n\t\t\t...base,\n\t\t\tPH_USER_DATA_DIR: dataDir,\n\t\t\t...env\n\t\t};\n\t}\n\tconst keys = process.platform === \"win32\" ? [...BASE_ENV_KEYS, ...WIN32_ENV_KEYS] : BASE_ENV_KEYS;\n\tconst base = {};\n\tfor (const key of keys) {\n\t\tconst value = process.env[key];\n\t\tif (value !== void 0) base[key] = value;\n\t}\n\treturn {\n\t\t...base,\n\t\tPH_USER_DATA_DIR: dataDir,\n\t\tPH_NO_TELEMETRY: \"1\",\n\t\tPH_NO_DOTENV: \"1\",\n\t\t...env\n\t};\n}\n/** The project's ph-cli, else its ph-run (a packaged app has only that). */\nfunction resolvePhCliEntry(projectRoot) {\n\tconst require_ = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tlet pkgPath;\n\ttry {\n\t\tpkgPath = require_.resolve(\"@powerhousedao/ph-cli/package.json\");\n\t} catch (error) {\n\t\ttry {\n\t\t\tpkgPath = require_.resolve(\"@powerhousedao/ph-run/package.json\");\n\t\t} catch {\n\t\t\tthrow error;\n\t\t}\n\t}\n\treturn path.join(path.dirname(pkgPath), \"dist\", \"cli.mjs\");\n}\n/** Readiness waits for a record; refuse a host/verb that writes none. */\nasync function assertWritesRecord(projectRoot, host, verb, definition) {\n\tif (verb !== void 0 && (ONE_SHOT_VERBS.has(verb) || STORE_VERBS.has(verb))) throw new Error(`spawnHost: \"${verb}\" is a one-shot verb; it writes no run record to wait for.`);\n\tconst declared = definition ?? (await loadHost(projectRoot, host)).host;\n\tconst specifier = declared.runner.module;\n\tconst supplier = locateHost(projectRoot, host).package;\n\tconst runner = await resolveRunnerModule(supplier?.root ?? projectRoot, specifier);\n\tif (runner.kind === \"compound\") {\n\t\tif (declared.config?.runtimeRecord === false) throw new Error(`spawnHost: hosts/${host} sets config.runtimeRecord: false, so it writes no run record to wait for.`);\n\t\treturn;\n\t}\n\tif (!isSchemaLike(runner.outputsSchema)) throw new Error(`spawnHost: hosts/${host} runs \"${specifier}\", which exports no outputsSchema, so it writes no run record to wait for.`);\n}\nconst sleep = (ms) => new Promise((resolve) => {\n\tsetTimeout(resolve, ms).unref();\n});\nconst live = /* @__PURE__ */ new Set();\nlet exitHookInstalled = false;\nfunction track(child) {\n\tlive.add(child);\n\tchild.once(\"exit\", () => live.delete(child));\n\tif (exitHookInstalled) return;\n\texitHookInstalled = true;\n\tprocess.once(\"exit\", () => {\n\t\tfor (const running of live) running.kill(\"SIGTERM\");\n\t});\n}\n/**\n* `ph run <host> [verb]` as a child; ready when its run record appears.\n*\n* The child shares this process's group, so a terminal Ctrl-C reaches both.\n* It runs the project's own ph-cli (else its ph-run): one older than\n* PH_NO_DOTENV reads the project's `.env` anyway.\n*/\nasync function spawnHost(options) {\n\tconst projectRoot = path.resolve(options.projectRoot);\n\tconst dataDir = path.resolve(options.dataDir);\n\tconst member = options.definition ? encodeCompoundMember({\n\t\t...options.definition,\n\t\tfolder: options.host\n\t}) : void 0;\n\tconst env = childEnv(dataDir, {\n\t\t...options.env,\n\t\t...options.stopOnStdin ? { [STOP_ON_STDIN_ENV]: \"1\" } : {},\n\t\t...member === void 0 ? {} : { [COMPOUND_MEMBER_ENV]: member }\n\t}, options.baseEnv);\n\tconst readerEnv = { PH_USER_DATA_DIR: dataDir };\n\tconst readyTimeoutMs = options.readyTimeoutMs ?? READY_TIMEOUT_MS;\n\tconst stopTimeoutMs = options.stopTimeoutMs ?? STOP_TIMEOUT_MS;\n\tconst { signal, stopOnStdin = false } = options;\n\tif (signal?.aborted) throw new SpawnHostError(\"spawnHost: aborted before start.\", \"aborted\", \"\");\n\tawait assertWritesRecord(projectRoot, options.host, options.verb, options.definition?.host);\n\tconst cli = options.cli ?? resolvePhCliEntry(projectRoot);\n\tfs.mkdirSync(dataDir, { recursive: true });\n\tconst log = options.logFile ? fs.createWriteStream(options.logFile, { flags: \"a\" }) : void 0;\n\tlet tail = \"\";\n\tlog?.on(\"error\", (error) => {\n\t\ttail = (tail + `logFile: ${error.message}\\n`).slice(-8192);\n\t});\n\tconst args = [\n\t\tcli,\n\t\t\"run\",\n\t\toptions.host\n\t];\n\tif (options.verb !== void 0) args.push(options.verb);\n\tif (options.argv && options.argv.length > 0) args.push(\"--\", ...options.argv);\n\tconst child = spawn(process.execPath, args, {\n\t\tcwd: projectRoot,\n\t\tenv,\n\t\tstdio: [\n\t\t\tstopOnStdin ? \"pipe\" : \"ignore\",\n\t\t\t\"pipe\",\n\t\t\t\"pipe\"\n\t\t],\n\t\twindowsHide: true\n\t});\n\tchild.stdin?.on(\"error\", () => void 0);\n\tif (!stopOnStdin) track(child);\n\tconst { stdout, stderr } = child;\n\tif (!stdout || !stderr) throw new Error(\"spawnHost: the child has no pipes.\");\n\tconst onChunk = (stream) => (chunk) => {\n\t\ttail = (tail + chunk).slice(-8192);\n\t\tlog?.write(chunk);\n\t\ttry {\n\t\t\toptions.onOutput?.(stream, chunk);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\ttail = (tail + `onOutput: ${message}\\n`).slice(-8192);\n\t\t}\n\t};\n\tstdout.setEncoding(\"utf8\").on(\"data\", onChunk(\"stdout\"));\n\tstderr.setEncoding(\"utf8\").on(\"data\", onChunk(\"stderr\"));\n\tlet forced = false;\n\tlet exit;\n\tconst exited = new Promise((resolve) => {\n\t\tconst done = (code, sig) => {\n\t\t\tif (exit) return;\n\t\t\texit = {\n\t\t\t\tcode,\n\t\t\t\tsignal: sig,\n\t\t\t\tforced\n\t\t\t};\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve(exit);\n\t\t};\n\t\tchild.once(\"exit\", done);\n\t\tchild.once(\"error\", (error) => {\n\t\t\ttail = (tail + `${error.message}\\n`).slice(-8192);\n\t\t\tif (child.pid === void 0) done(null, null);\n\t\t});\n\t});\n\tconst closed = new Promise((resolve) => {\n\t\tchild.once(\"close\", () => {\n\t\t\tlog?.end();\n\t\t\tresolve();\n\t\t});\n\t});\n\tconst pid = child.pid;\n\tconst ownRecords = () => pid === void 0 ? [] : listRunRecords(projectRoot, readerEnv).filter((r) => r.pid === pid);\n\tconst kill = (sig) => {\n\t\tif (pid === void 0) return;\n\t\ttry {\n\t\t\tprocess.kill(pid, sig);\n\t\t} catch {}\n\t};\n\tconst clearOwnRecords = () => {\n\t\tfor (const record of ownRecords()) clearRunRecord(projectRoot, recordKeyOf(record), readerEnv);\n\t};\n\tlet stopping;\n\tconst stop = () => {\n\t\tstopping ??= (async () => {\n\t\t\tif (!exit) {\n\t\t\t\tif (stopOnStdin) child.stdin?.end();\n\t\t\t\telse kill(\"SIGTERM\");\n\t\t\t\tlet timer;\n\t\t\t\tconst timedOut = await Promise.race([exited.then(() => false), new Promise((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => resolve(true), stopTimeoutMs);\n\t\t\t\t})]);\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tif (timedOut) {\n\t\t\t\t\tforced = true;\n\t\t\t\t\tif (stopOnStdin && pid !== void 0) killTree(pid, \"SIGKILL\");\n\t\t\t\t\telse kill(\"SIGKILL\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst result = await exited;\n\t\t\tclearOwnRecords();\n\t\t\treturn result;\n\t\t})();\n\t\treturn stopping;\n\t};\n\tfunction onAbort() {\n\t\tstop();\n\t}\n\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\tconst deadline = Date.now() + readyTimeoutMs;\n\tfor (;;) {\n\t\tconst aborted = signal?.aborted ?? false;\n\t\tif (exit && !aborted) {\n\t\t\tclearOwnRecords();\n\t\t\tlet timer;\n\t\t\tawait Promise.race([closed, new Promise((resolve) => {\n\t\t\t\ttimer = setTimeout(resolve, CLOSE_WAIT_MS);\n\t\t\t})]);\n\t\t\tclearTimeout(timer);\n\t\t\tconst how = exit.signal !== null ? `signal ${exit.signal}` : `code ${exit.code}`;\n\t\t\tthrow new SpawnHostError(`spawnHost: ph run ${options.host} exited (${how}) before writing its run record.`, \"exited\", tail, exit);\n\t\t}\n\t\tconst record = aborted ? void 0 : ownRecords().at(0);\n\t\tif (record) return {\n\t\t\tpid: record.pid,\n\t\t\tdataDir,\n\t\t\trecord,\n\t\t\toutputs: record.outputs,\n\t\t\tmembers: record.members,\n\t\t\texited,\n\t\t\tstop\n\t\t};\n\t\tif (aborted || Date.now() >= deadline) {\n\t\t\tconst phase = aborted ? \"aborted\" : \"timeout\";\n\t\t\tconst ended = tail === \"\" || tail.endsWith(\"\\n\") ? \"\" : \"\\n\";\n\t\t\tconst ran = `${tail}${ended}${SPAWN_STOPPING_NOTE}\\n`;\n\t\t\ttail = \"\";\n\t\t\tconst stopped = await stop();\n\t\t\tlet timer;\n\t\t\tawait Promise.race([closed, new Promise((resolve) => {\n\t\t\t\ttimer = setTimeout(resolve, CLOSE_WAIT_MS);\n\t\t\t})]);\n\t\t\tclearTimeout(timer);\n\t\t\tthrow new SpawnHostError(phase === \"aborted\" ? `spawnHost: aborted before ph run ${options.host} was ready.` : `spawnHost: ph run ${options.host} wrote no run record within ${readyTimeoutMs} ms.`, phase, ran + tail, stopped);\n\t\t}\n\t\tawait Promise.race([sleep(POLL_MS), exited]);\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 dev` 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). In a host a\n* package supplies (`scope`), a bare name is that package's host first. */\nasync function loadProducers(projectRoot, refs, scope) {\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, { scope });\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\t...loaded.ref !== void 0 ? { ref: loaded.ref } : {},\n\t\t\t\t...loaded.package ? { package: loaded.package } : {},\n\t\t\t\tspecifier,\n\t\t\t\trunner: await resolveRunnerModule(moduleRootOf(projectRoot, loaded), 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 info = producers.get(ref.host);\n\t\tconst loaded = info && !(\"error\" in info) ? info : void 0;\n\t\tconst address = loaded?.ref ?? ref.host;\n\t\tconst notRunning = `${consumer} needs outputs from host \"${address}\", which is not running. Start it first: ph run ${address} (or run a compound that includes it).`;\n\t\tconst schema = loaded?.runner.outputsSchema;\n\t\tconst withSchema = schema !== void 0 && schema !== null ? { schema } : {};\n\t\tconst standalone = [];\n\t\tif (ref.member === void 0 && loaded) {\n\t\t\tconst key = runRecordKey(loaded.name, loaded.package?.name);\n\t\t\tconst probe = probeRun(projectRoot, key, 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, key, projectName, sibling);\n\t\t\t\tif (other.status === \"live\" && other.record.outputs) standalone.push({\n\t\t\t\t\tlabel: `\"${loaded.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 === address && (ref.member === void 0 || key === ref.member)).map(([key, member]) => ({\n\t\t\tlabel: `member \"${key}\" of \"${runRecordKey(record.host, record.package)}\"`,\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 \"${address}\", which runs as ${found.map((m) => m.label).join(\" and \")}; stop all but one, or run ${address} 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).\n* `package` is the root of the package that supplies the host being\n* resolved (`hostPackage`), else the project root. */\nfunction processResolveEnv(projectRoot, env = process.env, hostPackage) {\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\tpackage: hostPackage?.root ?? 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\t...isPromiseLike(live.exited) ? { exited: live.exited } : {}\n\t};\n}\n//#endregion\n//#region src/compound.ts\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/** Past the shell's own limit: this only matters when no shell is left. */\nconst STOP_STREAM_LIMIT_MS = 15e3;\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/**\n* A standalone host's stop through its supervisor's stream (stdin, under\n* {@link STOP_ON_STDIN_ENV}): a line or the end of it is delivered as the\n* stop channel delivers a request, to the SIGTERM handlers, else as exit\n* 143. Held until `started()`: a stop while the verb starts takes effect\n* once it has, so a store is never left half-opened.\n*/\nfunction holdStopRequests(stream, options = {}) {\n\tconst exit = options.exit ?? ((code) => process.exit(code));\n\tconst signal = options.signal ?? (() => process.emit(\"SIGTERM\", \"SIGTERM\"));\n\tlet asked = false;\n\tlet up = false;\n\tconst deliver = () => {\n\t\tconst limit = options.limitMs ?? 15e3;\n\t\tsetTimeout(() => exit(143), limit).unref();\n\t\tif (!signal()) exit(143);\n\t};\n\twhenStreamStops(stream, () => {\n\t\tasked = true;\n\t\tif (up) deliver();\n\t});\n\tfor (const output of options.outputs ?? [process.stdout, process.stderr]) output.on(\"error\", () => void 0);\n\treturn { started() {\n\t\tif (up) return;\n\t\tup = true;\n\t\tif (asked) deliver();\n\t} };\n}\n/** How long an own-process member may take to write its run record: a\n* store's first boot can be slow, and an in-process member has no limit. */\nconst MEMBER_READY_TIMEOUT_MS = 6e5;\n/** An id as a file name (the services manager's rule: `:` is no file name\n* on NTFS). */\nconst fileSafe = (id) => id.replace(/[<>:\"/\\\\|?*]/g, \"+\");\n/**\n* A fresh log file for this run of an own-process member, named as the\n* services manager names a service's: `<phDir>/services/<member>/\n* <member>.<runId>.log`, or `<phDir>/services/<package>/<member>/…` for a\n* compound the package `hostPackage` supplies. Older runs beyond the newest\n* few are removed.\n*/\nfunction memberLogFile(projectRoot, env, member, hostPackage) {\n\tconst safe = fileSafe(member);\n\tconst dir = path.join(resolvePhDir(projectRoot, env), \"services\", ...hostPackage === void 0 ? [] : hostPackage.split(\"/\"), safe);\n\tfs.mkdirSync(dir, { recursive: true });\n\tconst escaped = safe.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\tconst pattern = new RegExp(`^${escaped}\\\\.(\\\\d+)\\\\.log$`);\n\tconst runId = (name) => Number(pattern.exec(name)?.[1]);\n\tconst runs = fs.readdirSync(dir).filter((name) => pattern.test(name)).sort((a, b) => runId(b) - runId(a));\n\tfor (const old of runs.slice(4)) try {\n\t\tfs.rmSync(path.join(dir, old));\n\t} catch {}\n\tlet id = Math.max(Date.now(), runs.length > 0 ? runId(runs[0]) + 1 : 0);\n\twhile (fs.existsSync(path.join(dir, `${safe}.${id}.log`))) id += 1;\n\treturn path.join(dir, `${safe}.${id}.log`);\n}\n/** Every URL among a member's outputs, by dotted path. */\nfunction urlEndpoints(outputs) {\n\tconst found = {};\n\tconst walk = (value, at) => {\n\t\tif (typeof value === \"string\") {\n\t\t\tif (/^[a-z][a-z\\d+.-]*:\\/\\//i.test(value)) found[at] = value;\n\t\t} else if (Array.isArray(value)) value.forEach((item, i) => walk(item, at ? `${at}.${i}` : String(i)));\n\t\telse if (isPlainObject(value)) for (const [key, item] of Object.entries(value)) walk(item, at ? `${at}.${key}` : key);\n\t};\n\twalk(outputs, \"\");\n\treturn found;\n}\n/**\n* The member whose runner owns the terminal (`foreground: true`) and the\n* order the compound starts its members in. Its rules: one such member at\n* most, in the compound's process, and last, so no member reads its outputs\n* and a `startOrder` that names it puts it at the end. `runCompound` refuses\n* the first broken one; `ph host check` reports them all.\n*/\nfunction planForeground(members, plan, wiring) {\n\tconst owners = members.filter((m) => m.runner.foreground === true);\n\tif (owners.length === 0) return {\n\t\torder: plan.order,\n\t\tissues: []\n\t};\n\tif (owners.length > 1) return {\n\t\torder: plan.order,\n\t\tissues: [{\n\t\t\tpath: \"children\",\n\t\t\tmessage: `members ${owners.map((m) => `\"${m.key}\"`).join(\", \")} each run a runner that owns the terminal; a compound has one.`\n\t\t}]\n\t};\n\tconst [owner] = owners;\n\tconst where = `member \"${owner.key}\" (${owner.specifier})`;\n\tconst issues = [];\n\tif (owner.member.process === \"own\") issues.push({\n\t\tpath: `children.${owner.key}.process`,\n\t\tmessage: `${where} owns the terminal, so it runs in the compound's process, not its own.`,\n\t\thint: `Remove children.${owner.key}.process.`\n\t});\n\tconst readers = plan.edges.filter((edge) => edge.producer === owner.key);\n\tif (readers.length > 0) issues.push({\n\t\tpath: \"children\",\n\t\tmessage: `${readers.map((edge) => `${edge.consumer}.${edge.path}`).join(\", \")} read the outputs of ${where}, which owns the terminal and starts last.`\n\t});\n\tconst named = wiring.startOrder;\n\tif (named?.includes(owner.key) && named.at(-1) !== owner.key) issues.push({\n\t\tpath: \"config.startOrder\",\n\t\tmessage: `config.startOrder starts ${where} before ${named.slice(named.indexOf(owner.key) + 1).join(\", \")}, but it owns the terminal and starts last.`,\n\t\thint: \"Put it last in startOrder, or leave it out.\"\n\t});\n\treturn {\n\t\tforeground: owner.key,\n\t\torder: [...plan.order.filter((key) => key !== owner.key), owner.key],\n\t\tissues\n\t};\n}\n/** Where a member runs: `own` (a child process) or `shared` (the\n* compound's). The foreground member and every member at a one-shot verb\n* share the compound's; next to a foreground member the default is `own`. */\nfunction memberProcessOf(member, options) {\n\tif (options.foreground || options.oneShot) return \"shared\";\n\treturn member.process ?? (options.besideForeground ? \"own\" : \"shared\");\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 scope = ctx.hostPackage;\n\tconst compoundFile = scope ? `${scope.name}/hosts/${hostInput.name}` : `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\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 recordKey = runRecordKey(host.name, scope?.name);\n\tconst probe = oneShotCompound ? void 0 : probeRun(projectRoot, recordKey, options.projectName);\n\tconst live = probe?.status === \"live\" ? probe.record : void 0;\n\tconst running = live ? /* @__PURE__ */ new Error(`${recordKey} is already running for this project (pid ${live.pid}). Stop it before starting another.`) : void 0;\n\tif (running && (ctx.argv ?? []).length === 0) throw running;\n\tif (probe?.status === \"foreign\") throw new Error(`.ph/run/${recordKey}.json describes a live \"${probe.record.projectName}\", but this project is \"${options.projectName}\". Refusing to start a second instance.`);\n\tlet prepared;\n\tlet order;\n\tlet foreground;\n\tlet memberArgv;\n\tconst byKey = /* @__PURE__ */ new Map();\n\ttry {\n\t\tprepared = await prepareMembers(projectRoot, host.children, scope);\n\t\tconst cycle = await memberCycle(projectRoot, prepared);\n\t\tif (cycle) throw new RunnerError(`${compoundFile}: compound member cycle: ${cycle.join(\" -> \")}.`, \"A compound cannot run itself, directly or through another compound.\");\n\t\tconst plan = planCompound(prepared.map((m) => ({\n\t\t\tkey: m.key,\n\t\t\thost: m.member.host,\n\t\t\trefs: outputSitesOf(m.draft).map(({ ref, path }) => ({\n\t\t\t\tref,\n\t\t\t\tpath\n\t\t\t}))\n\t\t})), wiring.startOrder);\n\t\tfor (const m of prepared) byKey.set(m.key, m);\n\t\tconst declared = prepared.map((m) => ({\n\t\t\tkey: m.key,\n\t\t\thost: m.member.host\n\t\t}));\n\t\tfor (const m of prepared) validateDeclaredHost(m.runner, m.specifier, m.draft, m.file, { outputsSchemaOf: (ref) => {\n\t\t\tconst target = memberForRef(ref, declared);\n\t\t\tif (\"error\" in target) return { error: target.error };\n\t\t\tconst producer = byKey.get(target.key);\n\t\t\treturn producer ? runnerOutputsSchema(producer.runner, producer.specifier, `member \"${target.key}\"`) : { error: `names member \"${target.key}\", which was not prepared.` };\n\t\t} });\n\t\tconst planned = planForeground(prepared, plan, wiring);\n\t\tconst broken = planned.issues.at(0);\n\t\tif (broken) throw new RunnerError(`${compoundFile}: ${broken.message}`, broken.hint);\n\t\tforeground = planned.foreground;\n\t\torder = planned.order;\n\t\tif (oneShotCompound) {\n\t\t\tconst [first] = scope ? [{\n\t\t\t\tref: recordKey,\n\t\t\t\thostPackage: scope,\n\t\t\t\twhere: compoundFile\n\t\t\t}] : prepared.flatMap((m) => m.hostPackage && m.key !== foreground ? [{\n\t\t\t\tref: m.ref,\n\t\t\t\thostPackage: m.hostPackage,\n\t\t\t\twhere: `${compoundFile} (member \"${m.key}\")`\n\t\t\t}] : []);\n\t\t\tif (first) {\n\t\t\t\tconst refusal = packageBuildRefusal(first.ref, first.hostPackage, verb);\n\t\t\t\tthrow new RunnerError(`${first.where}: ${refusal.message}`, refusal.hint);\n\t\t\t}\n\t\t}\n\t\tmemberArgv = splitCompoundArgv(ctx.argv ?? [], hostInput.name, prepared.map((m) => ({\n\t\t\tkey: m.key,\n\t\t\trunner: m.specifier,\n\t\t\tschema: m.runner.argsSchema\n\t\t})), foreground);\n\t} catch (error) {\n\t\tthrow running ?? error;\n\t}\n\tconst beside = running !== void 0;\n\tif (running && (foreground === void 0 || (memberArgv.get(foreground) ?? []).length === 0)) throw running;\n\tconst keepsRecord = wiring.runtimeRecord !== false && !oneShotCompound && !beside;\n\tconst members = prepared.map((m) => ({\n\t\tkey: m.key,\n\t\thost: m.member.host\n\t}));\n\tconst control = keepsRecord && foreground !== void 0 ? (await ensureProcessControlChannel())?.record : void 0;\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\tfor (const [key, member] of Object.entries(live?.members ?? {})) liveOutputs.set(key, member.outputs);\n\tconst outputs = compoundOutputSource(members, liveOutputs, host.name, new Map(prepared.map((m) => [m.key, m.runner.outputsSchema])));\n\tconst resolveEnvOf = (m) => processResolveEnv(projectRoot, ctx.env, m.hostPackage);\n\tconst statuses = /* @__PURE__ */ new Map();\n\tconst othersSeen = () => [...statuses.values()].filter((status) => status.name !== foreground).map((status) => ({\n\t\t...status,\n\t\tendpoints: { ...status.endpoints }\n\t}));\n\tlet stopping;\n\tconst shutdown = () => stopping ??= (async () => {\n\t\tfor (const m of [...started].reverse()) {\n\t\t\tconst status = statuses.get(m.name);\n\t\t\tif (status?.status === \"starting\" || status?.status === \"ready\") status.status = \"stopping\";\n\t\t\ttry {\n\t\t\t\tawait m.handle.shutdown?.();\n\t\t\t} catch {}\n\t\t\tif (status?.status === \"stopping\") status.status = \"stopped\";\n\t\t}\n\t\tif (keepsRecord) clearRunRecord(projectRoot, recordKey);\n\t\tif (control) await closeProcessControlChannel();\n\t})();\n\tconst death = {};\n\ttry {\n\t\tfor (const name of order) {\n\t\t\tif (death.message) throw new Error(death.message);\n\t\t\tconst m = byKey.get(name);\n\t\t\tif (!m) continue;\n\t\t\tconst isForeground = name === foreground;\n\t\t\tif (beside && !isForeground) continue;\n\t\t\tif (isForeground && oneShotCompound) continue;\n\t\t\tconst memberVerb = isForeground ? m.draft.runner.defaultVerb ?? \"run\" : memberVerbOf(verb, m.draft.runner);\n\t\t\tconst oneShot = ONE_SHOT_VERBS.has(memberVerb);\n\t\t\tconst memberProcess = memberProcessOf(m.member, {\n\t\t\t\tforeground: isForeground,\n\t\t\t\tbesideForeground: foreground !== void 0,\n\t\t\t\toneShot\n\t\t\t});\n\t\t\tconst resolveEnv = resolveEnvOf(m);\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 status = {\n\t\t\t\tname,\n\t\t\t\thost: m.ref,\n\t\t\t\tprocess: memberProcess,\n\t\t\t\tstatus: \"starting\",\n\t\t\t\tendpoints: {}\n\t\t\t};\n\t\t\tstatuses.set(name, status);\n\t\t\tlet handle;\n\t\t\tif (memberProcess === \"own\") {\n\t\t\t\tconst own = await startOwnProcess({\n\t\t\t\t\tprojectRoot,\n\t\t\t\t\tcompound: host.name,\n\t\t\t\t\tmember: name,\n\t\t\t\t\tfolder: m.ref,\n\t\t\t\t\tverb: memberVerb,\n\t\t\t\t\targv,\n\t\t\t\t\tenv: ctx.env,\n\t\t\t\t\thost: resolved,\n\t\t\t\t\techo: foreground === void 0,\n\t\t\t\t\t...scope ? { logPackage: scope.name } : {}\n\t\t\t\t});\n\t\t\t\thandle = own.handle;\n\t\t\t\tstatus.pid = own.pid;\n\t\t\t\tstatus.logFile = own.logFile;\n\t\t\t\town.exited.then((exit) => {\n\t\t\t\t\tif (status.status !== \"starting\" && status.status !== \"ready\") return;\n\t\t\t\t\tstatus.status = exit.code === 0 ? \"stopped\" : \"failed\";\n\t\t\t\t\tconst how = exit.signal !== null ? `signal ${exit.signal}` : `code ${exit.code}`;\n\t\t\t\t\tstatus.error = `exited (${how}) while the stack runs; its log: ${own.logFile}`;\n\t\t\t\t\tdeath.message ??= `${compoundFile}: member \"${name}\" ${status.error}`;\n\t\t\t\t\tdeath.ends?.();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\thandle = toStartedHandle(await fn(oneShot ? emptyMaps(validated, resolved) : validated, {\n\t\t\t\t\tprojectRoot,\n\t\t\t\t\t...m.hostPackage ? { hostPackage: m.hostPackage } : {},\n\t\t\t\t\tenv: ctx.env,\n\t\t\t\t\tverb: memberVerb,\n\t\t\t\t\tparent: {\n\t\t\t\t\t\thost: host.name,\n\t\t\t\t\t\tverb\n\t\t\t\t\t},\n\t\t\t\t\t...argv.length > 0 ? { argv } : {},\n\t\t\t\t\t...isForeground ? { foreground: {\n\t\t\t\t\t\tmembers: othersSeen,\n\t\t\t\t\t\tbeside,\n\t\t\t\t\t\tstack: recordKey,\n\t\t\t\t\t\t...beside && controlRecordOf(live) ? { control: controlRecordOf(live) } : {}\n\t\t\t\t\t} } : {}\n\t\t\t\t}), where);\n\t\t\t\tstatus.pid = process.pid;\n\t\t\t}\n\t\t\tstarted.push({\n\t\t\t\tname,\n\t\t\t\tmember: m.member,\n\t\t\t\tref: m.ref,\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\tif (status.status === \"starting\") status.status = \"ready\";\n\t\t\tstatus.endpoints = urlEndpoints(memberOutputs);\n\t\t}\n\t\tif (death.message) throw new Error(death.message);\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.ref,\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\t...scope ? { package: scope.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 || control ? { extra: {\n\t\t\t\t...options.recordExtra,\n\t\t\t\t...control ? { control } : {}\n\t\t\t} } : {}\n\t\t});\n\t}\n\tconst exit = options.exit ?? ((code) => process.exit(code));\n\tlet ending;\n\tconst end = (code, afterStop) => ending ??= shutdown().finally(() => {\n\t\tafterStop?.();\n\t\texit(code);\n\t});\n\tconst handleSignal = (signal) => end(signal === \"SIGINT\" ? 130 : 143);\n\tif (options.installSignalHandlers !== false) {\n\t\tprocess.on(\"exit\", () => {\n\t\t\tif (keepsRecord) clearRunRecord(projectRoot, recordKey);\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\tdeath.ends = () => void end(1, () => console.error(death.message));\n\tif (death.message) death.ends();\n\tconst exited = started.find((m) => m.name === foreground)?.handle.exited;\n\tif (exited) Promise.resolve(exited).then((code) => void end(typeof code === \"number\" ? code : 0), () => void end(1));\n\treturn {\n\t\tstarted,\n\t\tshutdown,\n\t\thandleSignal\n\t};\n}\n/**\n* An own-process member: `ph run <folder> <verb> -- <argv>` as an attached,\n* hidden child (spawnHost) with the compound's env, its resolved host and a\n* stdin it stops on; its output in this run's log file. Resolves once its\n* run record is written, which its `ph run` does after `ready`.\n*/\nasync function startOwnProcess(start) {\n\tconst logFile = memberLogFile(start.projectRoot, start.env, start.member, start.logPackage);\n\tconst spawned = await spawnHost({\n\t\tprojectRoot: start.projectRoot,\n\t\thost: start.folder,\n\t\tdataDir: defaultUserDataDir(start.projectRoot, start.env),\n\t\tverb: start.verb,\n\t\targv: start.argv,\n\t\tbaseEnv: start.env,\n\t\tdefinition: {\n\t\t\tcompound: start.compound,\n\t\t\tmember: start.member,\n\t\t\thost: start.host\n\t\t},\n\t\tstopOnStdin: true,\n\t\tlogFile,\n\t\treadyTimeoutMs: MEMBER_READY_TIMEOUT_MS,\n\t\t...start.echo ? { onOutput: (stream, chunk) => {\n\t\t\tprocess[stream].write(chunk);\n\t\t} } : {}\n\t});\n\treturn {\n\t\thandle: {\n\t\t\toutputs: spawned.outputs ?? {},\n\t\t\tshutdown: () => spawned.stop()\n\t\t},\n\t\tpid: spawned.pid,\n\t\tlogFile,\n\t\texited: spawned.exited\n\t};\n}\n/** Load every member's draft and runner, in declaration order. */\nasync function prepareMembers(projectRoot, children, scope) {\n\tconst out = [];\n\tfor (const [key, member] of Object.entries(children)) out.push(await prepareMember(projectRoot, key, member, scope));\n\treturn out;\n}\n/** One member's draft and runner. `scope`: the package whose compound names\n* the member, where a bare member host is looked up first; the runner\n* resolves from the package that supplies the member's host. */\nasync function prepareMember(projectRoot, key, member, scope) {\n\tconst loaded = await loadHost(projectRoot, member.host, { scope });\n\tconst draft = applyChildWrapper(loaded.host, 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(moduleRootOf(projectRoot, loaded), specifier),\n\t\tfile: hostFileLabel(loaded.name, loaded.package),\n\t\tref: loaded.ref ?? member.host,\n\t\t...loaded.package ? { hostPackage: loaded.package } : {}\n\t};\n}\n/**\n* A compound that is, through its compound members, a member of itself\n* would start itself without end: the chain of hosts, as the project\n* addresses them, when there is one. Each compound member's own members are\n* looked up as it looks them up (its package first, for a package's). A\n* reactor member ends a chain.\n*/\nasync function memberCycle(projectRoot, prepared) {\n\tconst walk = async (chain, children, scope) => {\n\t\tfor (const member of Object.values(children)) {\n\t\t\tconst loaded = await loadHost(projectRoot, member.host, { scope });\n\t\t\tconst ref = loaded.ref ?? member.host;\n\t\t\tif (chain.includes(ref)) return [...chain, ref];\n\t\t\tconst nested = loaded.host.children;\n\t\t\tif (!isPlainObject(nested)) continue;\n\t\t\tconst found = await walk([...chain, ref], nested, loaded.package);\n\t\t\tif (found) return found;\n\t\t}\n\t};\n\tfor (const m of prepared) {\n\t\tconst nested = m.draft.children;\n\t\tif (!isPlainObject(nested)) continue;\n\t\tconst found = await walk([m.ref], nested, m.hostPackage);\n\t\tif (found) return found;\n\t}\n}\n//#endregion\nexport { computeOutputsHash as $, runProvideHook as $n, resolveHostPlugins as $t, STOP_RUN_TIMEOUT_MS as A, placementKeyIssues as An, resolveHostOutputs as At, probeRun as B, runnerKindSchema as Bn, checkTokenSites as Bt, applyChildWrapper as C, emitHostJsonSchema as Cn, packageBuildRefusal as Ct, COMPOUND_MEMBER_ENV as D, makeHostSchemas as Dn, TokenResolutionError as Dt, spawnHost as E, hostNameSchema as En, validateHost as Et, stopChannelPath as F, reactorProtocolSchema as Fn, BUILTIN_ENV_NAMES as Ft, writeRunRecord as G, normalizePluginEntries as Gn, schemaAtPath as Gt, readRunRecord as H, entryActiveForVerb as Hn, outputRefsOf as Ht, stopRun as I, reactorSchema as In, isBuiltinEnvName as It, checkRunnerArgv as J, pluginEntrySchema as Jn, formatPath as Jt, runRecordMemberSchema as K, normalizePluginEntry as Kn, collectTokenSites as Kt, clearRunRecord as L, refineConnectReactor as Ln, substituteBuiltinEnv as Lt, installStopChannel as M, reactorBackendKindSchema as Mn, PlanError as Mt, listenForStop as N, reactorBackendSchema as Nn, memberForRef as Nt, takeCompoundMember as O, memberProcessSchema as On, describeMapElements as Ot, requestStop as P, reactorHostSchema as Pn, planCompound as Pt, OUTPUTS_FILE as Q, runObserveHookSequential as Qn, findDeadConnectConfig as Qt, isPidAlive as R, refineStartOrder as Rn, findRemovedForms as Rt, resolveUserDataPlaceholders as S, defineHostSchemas as Sn, tokenable as Sr, listVerbs as St, SpawnHostError as T, genericCompoundHostSchema as Tn, validateDeclaredHost as Tt, recordKeyOf as U, hostTypeSatisfies as Un, outputSitesOf as Ut, readProjectName as V, PluginError as Vn, envSitesOf as Vt, runRecordKey as W, mergeContributions as Wn, refKey as Wt, splitCompoundArgv as X, resolveOrder as Xn, renderTokens as Xt, isRunnerArgsSchema as Y, registerHostType as Yn, isPlainObject as Yt, splitRunArgv as Z, runObserveHook as Zn, unwrapEscapes as Zt, processResolveEnv as _, compoundHostSchema as _n, mapTokenSchema as _r, getVerb as _t, memberProcessOf as a, locateHost as an, drivesSchema as ar, loadHost as at, runnerOutputsSchema as b, declaredGenericCompoundHostSchema as bn, tokenKeyOf as br, kindShapeIssues as bt, prepareMember as c, CONNECT_PRIMARY_MESSAGE as cn, TOKEN_KEYS as cr, probeHostsFolder as ct, takesCspRegistrySync as d, HOST_NAME_PATTERN as dn, envTokenable as dr, stripComments as dt, resolvePluginContributions as en, runTransformHook as er, describeHostOutputs as et, runnerHandleSchema as f, HOST_REF_MESSAGE as fn, findToken as fr, withoutHostsMessage as ft, loadProducers as g, childrenSchema as gn, keyTokenSchema as gr, STORE_VERBS as gt, OUTPUT_DATA_DIRS_ENV as h, childWrapperSchema as hn, itemTokenSchema as hr, RunnerError as ht, memberCycle as i, hostFileLabel as in, driveDeclarationSchema as ir, lintOutputsFile as it, askToStop as j, profileSchema as jn, unsetEnvMessage as jt, STOP_ON_STDIN_ENV as k, originOrUrlSchema as kn, emptyMaps as kt, runCompound as l, HOST_NAME_MAX_LENGTH as ln, concatTokenSchema as lr, readOutputsFileHash as lt, compoundOutputSource as m, PACKAGE_NAME_PATTERN as mn, isToken as mr, ONE_SHOT_VERBS as mt, compoundStartVerb as n, findHostPackage as nn, defaultConnectComposition as nr, lintHostImportGraph as nt, memberVerbOf as o, parseHostRef as on, projectDriveIdWith as or, loadHostFresh as ot, toStartedHandle as p, HOST_REF_PATTERN as pn, forbidRef as pr, CONNECT_RUNNER as pt, runRecordSchema as q, pluginEntryObjectSchema as qn, describeToken as qt, holdStopRequests as r, formatHostRef as rn, buildDriveDeclarationSchema as rr, lintHostImports as rt, planForeground as s, resolvePackageRoot as sn, TOKEN_ESCAPE_KEY as sr, moduleRootOf as st, STOP_STREAM_LIMIT_MS as t, HostLoadError as tn, CONNECT_PLUGIN_OWNED_SLICES as tr, findNonStaticValue as tt, stopStreamOf as u, HOST_NAME_MESSAGE as un, envTokenSchema as ur, scanHostImports as ut, producerOutputsSchemas as v, compoundWiringSchema as vn, outputTokenSchema as vr, hostSchemaIssues as vt, SPAWN_STOPPING_NOTE as w, emittedHostSchemas as wn, resolveRunnerModule as wt, defaultUserDataDir as x, declaredHostSchemas as xn, tokenSchema as xr, knownVerbIssues as xt, runRecordOutputSource as y, connectReactorIssues as yn, ref as yr, isSchemaLike as yt, listRunRecords as z, runnerBaseSchema as zn, checkOutputPaths as zt };\n\n//# sourceMappingURL=compound-Q9sZSEZF.mjs.map"],"names":["z.strictObject","z.string","z.union","z.boolean","z.literal","z.enum","z.array","z.record","z.unknown","z.url","z.number","z.looseObject","z.ZodType","z.prettifyError","z.toJSONSchema"],"mappings":";;;;;;;;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