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

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 (126) hide show
  1. package/dist/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
  2. package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
  3. package/dist/auth-CNhbN5UM.mjs +4 -0
  4. package/dist/build-DmqwT-PR.mjs +4 -0
  5. package/dist/build-skPHsKkL.mjs +210 -0
  6. package/dist/build-skPHsKkL.mjs.map +1 -0
  7. package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-CuheCf3N.mjs} +38 -26
  8. package/dist/cli-connect-override-CuheCf3N.mjs.map +1 -0
  9. package/dist/cli.d.mts +2 -1
  10. package/dist/cli.mjs +31 -1175
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/connect-build-CyNALLxq.mjs +218 -0
  13. package/dist/connect-build-CyNALLxq.mjs.map +1 -0
  14. package/dist/{connect-config-BWGiW3IB.mjs → connect-config-B0WoJoZv.mjs} +19 -12
  15. package/dist/connect-config-B0WoJoZv.mjs.map +1 -0
  16. package/dist/connect-preview-Clue7SVp.mjs +122 -0
  17. package/dist/connect-preview-Clue7SVp.mjs.map +1 -0
  18. package/dist/{connect-studio-D6rfWCNB.mjs → connect-studio-B-HTpgG2.mjs} +15 -10
  19. package/dist/{connect-studio-D6rfWCNB.mjs.map → connect-studio-B-HTpgG2.mjs.map} +1 -1
  20. package/dist/connect-studio-ClS1PdVV.mjs +4 -0
  21. package/dist/dist-BsyiY0Fw.mjs +223 -0
  22. package/dist/dist-BsyiY0Fw.mjs.map +1 -0
  23. package/dist/explain-j11Vgf0Z.mjs +27 -0
  24. package/dist/explain-j11Vgf0Z.mjs.map +1 -0
  25. package/dist/feature-flags-xwqcHEWC.mjs +4 -0
  26. package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-CRfVwLJ9.mjs} +5 -3
  27. package/dist/generate-all-CRfVwLJ9.mjs.map +1 -0
  28. package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
  29. package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
  30. package/dist/generate-desktop-shell-DFOsRPgq.mjs +212 -0
  31. package/dist/generate-desktop-shell-DFOsRPgq.mjs.map +1 -0
  32. package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-ChkXjM1s.mjs} +19 -7
  33. package/dist/generate-document-model-ChkXjM1s.mjs.map +1 -0
  34. package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
  35. package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
  36. package/dist/generate-piece-QTt-ddt2.mjs +65 -0
  37. package/dist/generate-piece-QTt-ddt2.mjs.map +1 -0
  38. package/dist/generate-piece-action-DbxrzfKY.mjs +29 -0
  39. package/dist/generate-piece-action-DbxrzfKY.mjs.map +1 -0
  40. package/dist/generate-piece-trigger-CqVOcL9g.mjs +30 -0
  41. package/dist/generate-piece-trigger-CqVOcL9g.mjs.map +1 -0
  42. package/dist/{generate-processor-_WOx-mMe.mjs → generate-processor-DBtTkgo5.mjs} +15 -8
  43. package/dist/generate-processor-DBtTkgo5.mjs.map +1 -0
  44. package/dist/{generate-subgraph-BsHUstpl.mjs → generate-subgraph-DmcQWVbd.mjs} +12 -6
  45. package/dist/generate-subgraph-DmcQWVbd.mjs.map +1 -0
  46. package/dist/host-schemas-CL_wFpY7-BDyTA_z_.mjs +479 -0
  47. package/dist/host-schemas-CL_wFpY7-BDyTA_z_.mjs.map +1 -0
  48. package/dist/index-CApW1xbO.d.mts +3752 -0
  49. package/dist/index-CApW1xbO.d.mts.map +1 -0
  50. package/dist/{init-BZP6gvYd.mjs → init-ScuT3z7P.mjs} +7 -5
  51. package/dist/init-ScuT3z7P.mjs.map +1 -0
  52. package/dist/{inspect-DXjbQEV_.mjs → inspect-BpCB0TPo.mjs} +11 -4
  53. package/dist/inspect-BpCB0TPo.mjs.map +1 -0
  54. package/dist/install-added-dependencies-DVSbzler.mjs +33 -0
  55. package/dist/install-added-dependencies-DVSbzler.mjs.map +1 -0
  56. package/dist/{migrate-jGKfE02L.mjs → migrate-DK4HK7Dn.mjs} +4 -4
  57. package/dist/{migrate-jGKfE02L.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
  58. package/dist/ph-cli-commands-ByuH-lXH.mjs +1484 -0
  59. package/dist/ph-cli-commands-ByuH-lXH.mjs.map +1 -0
  60. package/dist/ph-cli-commands-sgvuh-kj.mjs +4 -0
  61. package/dist/plugins-PTnPaBIG.mjs +91 -0
  62. package/dist/plugins-PTnPaBIG.mjs.map +1 -0
  63. package/dist/reactor-env-BgyzjfYc.mjs +4 -0
  64. package/dist/reactor-env-Dx0Hxi5I.mjs +29 -0
  65. package/dist/reactor-env-Dx0Hxi5I.mjs.map +1 -0
  66. package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
  67. package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
  68. package/dist/run-sugar-D3C0Ptvv.mjs +39 -0
  69. package/dist/run-sugar-D3C0Ptvv.mjs.map +1 -0
  70. package/dist/runners/compound.d.mts +127 -0
  71. package/dist/runners/compound.d.mts.map +1 -0
  72. package/dist/runners/compound.mjs +72 -0
  73. package/dist/runners/compound.mjs.map +1 -0
  74. package/dist/runners/connect.d.mts +144 -0
  75. package/dist/runners/connect.d.mts.map +1 -0
  76. package/dist/runners/connect.mjs +185 -0
  77. package/dist/runners/connect.mjs.map +1 -0
  78. package/dist/runners/switchboard.d.mts +139 -0
  79. package/dist/runners/switchboard.d.mts.map +1 -0
  80. package/dist/runners/switchboard.mjs +142 -0
  81. package/dist/runners/switchboard.mjs.map +1 -0
  82. package/dist/schemas-BZZWQ72W.mjs +3962 -0
  83. package/dist/schemas-BZZWQ72W.mjs.map +1 -0
  84. package/dist/scripts/generate-commands-docs.ts +8 -0
  85. package/dist/scripts/manage-environment +0 -0
  86. package/dist/scripts/setup.sh +0 -0
  87. package/dist/start-run-1mjFpX7H.mjs +36 -0
  88. package/dist/start-run-1mjFpX7H.mjs.map +1 -0
  89. package/dist/superseded-config-9D7BdLvd.mjs +53 -0
  90. package/dist/superseded-config-9D7BdLvd.mjs.map +1 -0
  91. package/dist/switchboard-BUMqobK4.mjs +4 -0
  92. package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
  93. package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
  94. package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
  95. package/dist/{switchboard-reset-BcQXlcVf.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
  96. package/dist/switchboard-tQS3fhqa.mjs +132 -0
  97. package/dist/switchboard-tQS3fhqa.mjs.map +1 -0
  98. package/dist/{utils-BzwczAW-.mjs → utils-C3c5YG6v.mjs} +3 -3
  99. package/dist/{utils-C4isxXSO.mjs → utils-CvmDmCVd.mjs} +3 -3
  100. package/dist/{utils-C4isxXSO.mjs.map → utils-CvmDmCVd.mjs.map} +1 -1
  101. package/dist/{vetra-DkF6EJMY.mjs → vetra-BBcDGKgI.mjs} +66 -31
  102. package/dist/vetra-BBcDGKgI.mjs.map +1 -0
  103. package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs +19 -0
  104. package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs.map +1 -0
  105. package/package.json +42 -17
  106. package/dist/auth-BNkN6kS9.mjs +0 -4
  107. package/dist/build-C-A5-ipO.mjs +0 -4
  108. package/dist/build-uQXq6_HU.mjs +0 -71
  109. package/dist/build-uQXq6_HU.mjs.map +0 -1
  110. package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
  111. package/dist/connect-build-WL4axo4z.mjs +0 -43
  112. package/dist/connect-build-WL4axo4z.mjs.map +0 -1
  113. package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
  114. package/dist/connect-preview-D7ypzFDc.mjs +0 -28
  115. package/dist/connect-preview-D7ypzFDc.mjs.map +0 -1
  116. package/dist/connect-studio-BIQzyq5B.mjs +0 -5
  117. package/dist/generate-all-DrT4ZxHX.mjs.map +0 -1
  118. package/dist/generate-document-model-BJXyODfm.mjs.map +0 -1
  119. package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
  120. package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
  121. package/dist/init-BZP6gvYd.mjs.map +0 -1
  122. package/dist/inspect-DXjbQEV_.mjs.map +0 -1
  123. package/dist/switchboard-CJMoMzWx.mjs +0 -75
  124. package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
  125. package/dist/switchboard-iRFugh8I.mjs +0 -4
  126. package/dist/vetra-DkF6EJMY.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-processor-DBtTkgo5.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllProcessors(project);\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = dirname(dir);\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;AAqBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,OAAO;EAC9C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,sBAAsB,OAAO;MAC9B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,8BAA8B,KAAK,OAAO;CAClD,OAAO,IAAI,eACT,MAAM,kBACJ;EACE;EACA;EACA;EACA;CACF,GACA,OACF;MACK,IAAI,KAAK;EACd,MAAM,mBAAmB,QAAQ,GAAG;EACpC,MAAM,gBAAgB,qBAAqB,SAAS,gBAAgB;EACpE,MAAM,kBAAkB,eAAe,OAAO;CAChD,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"4c9267c1-f9f5-5d39-a420-380970da035c"}
@@ -1,5 +1,7 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="77a9d3dd-1c2f-521e-a7a5-22f044790308")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="199c47bd-ca2f-5628-a312-bbde798073fb")}catch(e){}}();
3
+ import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
4
+ import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
3
5
  import { dirname } from "node:path";
4
6
  import { detectFeatures, generateAllSubgraphs, generateSubgraph, syncFeatureDependencies } from "@powerhousedao/codegen";
5
7
  import { buildTsMorphProject, getSubgraphMetadata } from "@powerhousedao/codegen/utils";
@@ -18,8 +20,10 @@ async function startGenerateSubgraph(args, projectDir) {
18
20
  return;
19
21
  }
20
22
  if (all) await generateAllSubgraphs(project);
21
- else if (document) await generateSubgraphFromDocument(await getDocument(document), project);
22
- else if (name) await generateSubgraph(name, project);
23
+ else if (document) {
24
+ const doc = await getDocument(document);
25
+ await generateSubgraphFromDocument(doc, project);
26
+ } else if (name) await generateSubgraph(name, project);
23
27
  else if (dir) {
24
28
  const { subgraphName } = getSubgraphMetadata(project, dirname(dir));
25
29
  if (!subgraphName) throw new Error(`Failed to get data for subgraph in dir "${dir}"`);
@@ -29,10 +33,12 @@ async function startGenerateSubgraph(args, projectDir) {
29
33
  return;
30
34
  }
31
35
  await project.save();
32
- await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
36
+ warnSubgraphTypeConflicts(projectDir);
37
+ const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
38
+ await installAddedDependencies(added, projectDir, args.skipInstall);
33
39
  }
34
40
  //#endregion
35
41
  export { startGenerateSubgraph };
36
42
 
37
- //# sourceMappingURL=generate-subgraph-BsHUstpl.mjs.map
38
- //# debugId=77a9d3dd-1c2f-521e-a7a5-22f044790308
43
+ //# sourceMappingURL=generate-subgraph-DmcQWVbd.mjs.map
44
+ //# debugId=199c47bd-ca2f-5628-a312-bbde798073fb
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-subgraph-DmcQWVbd.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllSubgraphs(project);\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n await generateSubgraphFromDocument(doc, project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;;AAsBA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,OAAO;EAC7C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,qBAAqB,OAAO;MAC7B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,6BAA6B,KAAK,OAAO;CACjD,OAAO,IAAI,MACT,MAAM,iBAAiB,MAAM,OAAO;MAC/B,IAAI,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,GAAG,CAAC;EAClE,IAAI,CAAC,cACH,MAAM,IAAI,MAAM,2CAA2C,IAAI,EAAE;EAEnE,MAAM,iBAAiB,cAAc,OAAO;CAC9C,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;CACpC,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"199c47bd-ca2f-5628-a312-bbde798073fb"}
@@ -0,0 +1,479 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd229268-5450-5763-8f0c-b804b1c401cc")}catch(e){}}();
3
+ import { a as looseObject, c as strictObject, i as literal, l as string, n as array, o as number, r as boolean, s as record, t as _enum, u as union } from "./schemas-BZZWQ72W.mjs";
4
+ import { a as pluginEntrySchema } from "./plugins-PTnPaBIG.mjs";
5
+ import { createRequire } from "node:module";
6
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
7
+ import path from "node:path";
8
+ import { pathToFileURL } from "node:url";
9
+ import crypto from "node:crypto";
10
+ //#region ../../packages/host-core/dist/host-schemas-CL_wFpY7.mjs
11
+ /**
12
+ * Instance-fact projection for compound hosts: the drives a compound's
13
+ * reactor member created, projected into the Connect member's runtime-config
14
+ * override. Pure functions, moved from ph-cli's vetra service so the generic
15
+ * compound and the classic path share one implementation.
16
+ */
17
+ function isLocalDrive(drive) {
18
+ return "local" in drive;
19
+ }
20
+ const driveKey = (drive) => isLocalDrive(drive) ? `local:${drive.id}` : drive.url;
21
+ /**
22
+ * Concatenate groups of `connect.drives.defaultDrives` in the order given,
23
+ * de-duplicating by drive identity (URL for remote entries, id for local
24
+ * ones). The first occurrence of a drive wins, so earlier groups keep their
25
+ * position and metadata — e.g. the Vetra drive `ph vetra` starts stays first
26
+ * even when the project's `powerhouse.config.json` lists the same drive.
27
+ */
28
+ function mergeDefaultDrives(...groups) {
29
+ const seen = /* @__PURE__ */ new Set();
30
+ const out = [];
31
+ for (const group of groups) for (const drive of group) {
32
+ const key = driveKey(drive);
33
+ if (seen.has(key)) continue;
34
+ seen.add(key);
35
+ out.push(drive);
36
+ }
37
+ return out;
38
+ }
39
+ /**
40
+ * Rebase a local drive URL onto a public base: keeps the /d/<slug> path,
41
+ * swaps the loopback origin for the public base. Browser clients behind a
42
+ * reverse proxy can't reach http://localhost:<port>. Non-loopback URLs
43
+ * (e.g. a remote drive) are already public and pass through unchanged, as do
44
+ * unparseable ones.
45
+ */
46
+ function rebaseDriveUrl(driveUrl, publicBase) {
47
+ let url;
48
+ try {
49
+ url = new URL(driveUrl);
50
+ } catch {
51
+ return driveUrl;
52
+ }
53
+ if (![
54
+ "localhost",
55
+ "127.0.0.1",
56
+ "[::1]"
57
+ ].includes(url.hostname)) return driveUrl;
58
+ return `${publicBase.replace(/\/+$/, "")}${url.pathname}`;
59
+ }
60
+ /**
61
+ * The compound's drives projection: created drives first (rebased onto the
62
+ * public base when given), then the project's configured drives, de-duplicated
63
+ * — and `preserve-all`, because compound-injected drive lists change per
64
+ * launch context and must never detach drives the user added by hand.
65
+ */
66
+ function projectDrivesIntoConnect(input) {
67
+ return { drives: {
68
+ defaultDrives: mergeDefaultDrives(input.createdDriveUrls.filter((url) => typeof url === "string" && url.length > 0).map((url) => ({
69
+ url: input.publicBase ? rebaseDriveUrl(url, input.publicBase) : url,
70
+ name: null,
71
+ icon: null
72
+ })), input.configuredDefaultDrives ?? []),
73
+ preserveStrategy: "preserve-all"
74
+ } };
75
+ }
76
+ /**
77
+ * Loads and pre-validates a `hosts/<name>/host.js` definition.
78
+ *
79
+ * A host file is a static PROJECTION of powerhouse.config.json: plain ESM,
80
+ * default-exporting a data object. Three gates run before any runner sees it:
81
+ * 1. import lint — the only legal import is the project's
82
+ * powerhouse.config.json (host files are data, not programs);
83
+ * 2. static check — the exported object must survive a JSON round trip
84
+ * (functions, undefined, class instances, Dates etc. are rejected,
85
+ * reporting the offending path);
86
+ * 3. shape pre-check — `name`, `runner.module`, and the reactor XOR children
87
+ * rule. Full validation is the runner's `hostSchema` (phase 2).
88
+ *
89
+ * This module never exits the process — callers own error presentation.
90
+ */
91
+ const HOST_FILE = "host.js";
92
+ const CONFIG_IMPORT_SUFFIX = "powerhouse.config.json";
93
+ var HostLoadError = class extends Error {
94
+ constructor(message, hint) {
95
+ super(hint ? `${message}\n Hint: ${hint}` : message);
96
+ this.name = "HostLoadError";
97
+ }
98
+ };
99
+ /** A `hosts/` folder with no `<name>/host.js` inside is "empty" — the guard
100
+ * state: callers warn loudly and fall back to legacy rather than activating
101
+ * the new architecture off a stray `mkdir hosts`. */
102
+ function probeHostsFolder(projectRoot) {
103
+ const dir = path.join(projectRoot, "hosts");
104
+ if (!existsSync(dir) || !statSync(dir).isDirectory()) return { kind: "absent" };
105
+ const hosts = readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(path.join(dir, entry.name, HOST_FILE))).map((entry) => entry.name).sort();
106
+ return hosts.length === 0 ? {
107
+ kind: "empty",
108
+ dir
109
+ } : {
110
+ kind: "present",
111
+ dir,
112
+ hosts
113
+ };
114
+ }
115
+ /** Sibling host imports: `../<host>/host.js` — source material for derived
116
+ * compositions (full-inclusion wrappers compute over them with plain JS). */
117
+ const SIBLING_IMPORT = /^\.\.\/([A-Za-z0-9_-]+)\/host\.js$/;
118
+ /** Rejects every import except the project's powerhouse.config.json and
119
+ * SIBLING host files (R1: derived compositions), plus any dynamic
120
+ * `import(...)` or `require(...)`. Source-level enforcement: the JSON round
121
+ * trip below is the hard gate; this one produces the better error. Returns
122
+ * the sibling host names the file imports, for cycle detection. */
123
+ function lintHostImports(source, file) {
124
+ const siblings = [];
125
+ for (const match of source.matchAll(/^\s*import\b[^;'"]*?from\s+["']([^"']+)["']/gm)) {
126
+ const specifier = match[1];
127
+ if (specifier.endsWith(CONFIG_IMPORT_SUFFIX)) continue;
128
+ const sibling = SIBLING_IMPORT.exec(specifier);
129
+ if (sibling) {
130
+ siblings.push(sibling[1]);
131
+ continue;
132
+ }
133
+ throw new HostLoadError(`${file} imports "${specifier}" — a host file may only import the project's powerhouse.config.json or sibling hosts/<name>/host.js files.`, "Host files are static projections; code belongs in plugins or the runner.");
134
+ }
135
+ if (/^\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.`);
136
+ if (/\bimport\s*\(/.test(source) || /\brequire\s*\(/.test(source)) throw new HostLoadError(`${file} uses dynamic import()/require() — host files are static data.`);
137
+ return siblings;
138
+ }
139
+ /** Walks the sibling-import graph from `hostName`, linting every visited file
140
+ * and failing on a cycle (an ESM circular would otherwise surface as an
141
+ * undefined default export with no useful message). */
142
+ function lintHostImportGraph(hostsDir, hostName) {
143
+ const state = /* @__PURE__ */ new Map();
144
+ const visit = (name, chain) => {
145
+ const mark = state.get(name);
146
+ if (mark === "done") return;
147
+ if (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.");
148
+ const file = path.join(hostsDir, name, HOST_FILE);
149
+ if (!existsSync(file)) throw new HostLoadError(`hosts/${chain[chain.length - 1] ?? name} imports sibling "hosts/${name}/host.js", which does not exist.`);
150
+ state.set(name, "visiting");
151
+ const siblings = lintHostImports(readFileSync(file, "utf8"), file);
152
+ for (const sibling of siblings) visit(sibling, [...chain, name]);
153
+ state.set(name, "done");
154
+ };
155
+ visit(hostName, []);
156
+ }
157
+ /** Returns the path of the first value that would not survive a JSON round
158
+ * trip, or undefined when the object is fully static. */
159
+ function findNonStaticValue(value, trail = "") {
160
+ if (value === null) return void 0;
161
+ const kind = typeof value;
162
+ if (kind === "string" || kind === "number" || kind === "boolean") return;
163
+ if (kind !== "object") return `${trail || "<root>"} (${kind})`;
164
+ if (Array.isArray(value)) {
165
+ for (let i = 0; i < value.length; i++) {
166
+ const hit = findNonStaticValue(value[i], `${trail}[${i}]`);
167
+ if (hit) return hit;
168
+ }
169
+ return;
170
+ }
171
+ const proto = Object.getPrototypeOf(value);
172
+ if (proto !== Object.prototype && proto !== null) return `${trail || "<root>"} (non-plain object)`;
173
+ for (const [key, child] of Object.entries(value)) {
174
+ const hit = findNonStaticValue(child, trail ? `${trail}.${key}` : key);
175
+ if (hit) return hit;
176
+ }
177
+ }
178
+ function assertHostShape(host, file) {
179
+ if (typeof host.name !== "string" || host.name.length === 0) throw new HostLoadError(`${file}: \`name\` must be a non-empty string.`);
180
+ const runner = host.runner;
181
+ if (runner === null || typeof runner !== "object" || typeof runner.module !== "string") throw new HostLoadError(`${file}: \`runner\` must be an object with a \`module\` specifier string.`);
182
+ if (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.`);
183
+ }
184
+ async function loadHost(projectRoot, hostName) {
185
+ const probe = probeHostsFolder(projectRoot);
186
+ if (probe.kind === "absent") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, "Scaffold one with `ph init --uniform-runners` (or create hosts/<name>/host.js).");
187
+ if (probe.kind === "empty") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, "An empty hosts/ folder does not activate the uniform-runners architecture; add a host definition or remove the folder.");
188
+ if (!probe.hosts.includes(hostName)) throw new HostLoadError(`Unknown host "${hostName}". Available hosts: ${probe.hosts.join(", ")}.`);
189
+ const file = path.join(probe.dir, hostName, HOST_FILE);
190
+ lintHostImportGraph(probe.dir, hostName);
191
+ const host = (await import(pathToFileURL(file).href)).default;
192
+ if (host === null || typeof host !== "object" || Array.isArray(host)) throw new HostLoadError(`${file} must default-export the host object (\`export default { name, runner, ... }\`).`);
193
+ const nonStatic = findNonStaticValue(host);
194
+ if (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.");
195
+ assertHostShape(host, file);
196
+ return {
197
+ name: hostName,
198
+ dir: path.dirname(file),
199
+ file,
200
+ host
201
+ };
202
+ }
203
+ /**
204
+ * Resolves a host's `runner.module` specifier from the PROJECT's dependency
205
+ * tree (not ph-cli's), imports it, and checks the runner-module contract:
206
+ * `{ run, hostSchema, kind, ...optionalVerbs }`. Phase-0 home is ph-cli; the
207
+ * uniform-runners plan moves this into @powerhousedao/host-core with the
208
+ * generic compound (phase 1).
209
+ */
210
+ var RunnerError = class extends Error {
211
+ constructor(message, hint) {
212
+ super(hint ? `${message}\n Hint: ${hint}` : message);
213
+ this.name = "RunnerError";
214
+ }
215
+ };
216
+ /** Exports that are part of the contract but are not verbs. */
217
+ const NON_VERB_EXPORTS = /* @__PURE__ */ new Set([
218
+ "hostSchema",
219
+ "kind",
220
+ "default"
221
+ ]);
222
+ async function resolveRunnerModule(projectRoot, specifier) {
223
+ const projectRequire = createRequire(pathToFileURL(path.join(projectRoot, "package.json")).href);
224
+ let resolved;
225
+ try {
226
+ resolved = projectRequire.resolve(specifier);
227
+ } catch {
228
+ throw new RunnerError(`Cannot resolve runner module "${specifier}" from ${projectRoot}.`, "The runner must be a dependency of the project (install it, then retry).");
229
+ }
230
+ const module = await import(pathToFileURL(resolved).href);
231
+ if (typeof module.run !== "function") throw new RunnerError(`Runner "${specifier}" does not export a \`run\` function (required verb).`);
232
+ const hostSchema = module.hostSchema;
233
+ if (!hostSchema || typeof hostSchema.safeParse !== "function") throw new RunnerError(`Runner "${specifier}" does not export a \`hostSchema\` — runners validate their own host shape.`);
234
+ if (typeof module.kind !== "string") throw new RunnerError(`Runner "${specifier}" does not export \`kind\` (e.g. "reactor" | "compound").`);
235
+ return module;
236
+ }
237
+ function listVerbs(runner) {
238
+ return Object.entries(runner).filter(([name, value]) => typeof value === "function" && !NON_VERB_EXPORTS.has(name)).map(([name]) => name).sort();
239
+ }
240
+ function getVerb(runner, specifier, verb) {
241
+ const candidate = runner[verb];
242
+ if (typeof candidate !== "function" || NON_VERB_EXPORTS.has(verb)) throw new RunnerError(`Runner "${specifier}" does not support the verb "${verb}". Supported verbs: ${listVerbs(runner).join(", ")}.`);
243
+ return candidate;
244
+ }
245
+ function validateHost(runner, specifier, host, file) {
246
+ const result = runner.hostSchema.safeParse(host);
247
+ if (!result.success) throw new RunnerError(`${file} failed validation against the hostSchema of "${specifier}":\n${(result.error?.issues ?? []).map((issue) => ` - ${issue.path.join(".") || "<root>"}: ${issue.message}`).join("\n") || " (no details reported)"}`);
248
+ }
249
+ /**
250
+ * R1 — core drive declarations. A reactor without drives is not a running
251
+ * reactor, so declaring + seeding them is HOST RUNTIME work (not a plugin):
252
+ * onReactorReady → idempotent slug-keyed seeding → onDrivesReady. Plugins
253
+ * CONTRIBUTE declarations into the same merged list (Contributions.drives);
254
+ * `--explain drives` prints the merged set with provenance.
255
+ *
256
+ * Field semantics (union of the three existing creation sites — vetra,
257
+ * preview, workflows — plus Connect's PHConnectDefaultDrive):
258
+ * - slug: the SEEDING KEY (idempotence); id optional (stable identity),
259
+ * projectHash derives both from the project path (generateProjectDriveId
260
+ * semantics: `${slug}-${sha256(projectPath).slice(0, 8)}`).
261
+ * - preferredEditor: binds the drive to its drive app — stored at
262
+ * header.meta.preferredEditor; Connect config's `app` is the legacy alias.
263
+ * - remote.url: an attachment to a drive served elsewhere (Connect default
264
+ * drives, switchboard remoteDrives); local fields are ignored for remotes.
265
+ */
266
+ const driveDeclarationSchema = strictObject({
267
+ slug: string().min(1),
268
+ id: string().min(1).optional(),
269
+ /** Derive id (and the served slug) from the project path, like
270
+ * generateProjectDriveId — same ids classic `ph vetra` produces. */
271
+ projectHash: boolean().optional(),
272
+ name: string().min(1).optional(),
273
+ icon: string().optional(),
274
+ preferredEditor: string().optional(),
275
+ sharingType: _enum([
276
+ "public",
277
+ "private",
278
+ "shared"
279
+ ]).optional(),
280
+ availableOffline: boolean().optional(),
281
+ remote: strictObject({ url: string().min(1) }).optional()
282
+ });
283
+ const drivesSchema = array(driveDeclarationSchema);
284
+ function projectDriveId(projectRoot, slug) {
285
+ return `${slug}-${crypto.createHash("sha256").update(projectRoot).digest("hex").substring(0, 8)}`;
286
+ }
287
+ function resolveDriveDeclaration(projectRoot, decl) {
288
+ const id = decl.projectHash ? projectDriveId(projectRoot, decl.slug) : decl.id ?? decl.slug;
289
+ const slug = decl.projectHash ? id : decl.slug;
290
+ if (decl.remote) return {
291
+ kind: "remote",
292
+ id,
293
+ slug,
294
+ name: decl.name ?? decl.slug,
295
+ remoteUrl: decl.remote.url,
296
+ sharingType: decl.sharingType ?? "public",
297
+ availableOffline: decl.availableOffline ?? true
298
+ };
299
+ return {
300
+ kind: "local",
301
+ id,
302
+ slug,
303
+ name: decl.name ?? decl.slug,
304
+ icon: decl.icon,
305
+ preferredEditor: decl.preferredEditor,
306
+ sharingType: decl.sharingType ?? "public",
307
+ availableOffline: decl.availableOffline ?? true
308
+ };
309
+ }
310
+ /** Idempotent, slug-keyed: an existing slug is left untouched (never
311
+ * recreated, never mutated — preserveStrategy refinements live here later). */
312
+ async function seedDrives(client, drives) {
313
+ const result = {
314
+ created: [],
315
+ existing: [],
316
+ attached: []
317
+ };
318
+ for (const drive of drives) {
319
+ if (drive.kind === "remote") {
320
+ await client.attachRemoteDrive(drive.remoteUrl);
321
+ result.attached.push(drive.slug);
322
+ continue;
323
+ }
324
+ if (await client.findDriveBySlug(drive.slug) !== void 0) {
325
+ result.existing.push(drive.slug);
326
+ continue;
327
+ }
328
+ await client.createDrive(drive);
329
+ result.created.push(drive.slug);
330
+ }
331
+ return result;
332
+ }
333
+ /** Merge host-declared drives with plugin contributions, slug-keyed — the
334
+ * host file wins on conflicts (it is the most explicit source). */
335
+ function mergeDrivePlan(projectRoot, hostDeclared, contributed) {
336
+ const plan = /* @__PURE__ */ new Map();
337
+ for (const { declaration, source } of contributed) {
338
+ const drive = resolveDriveDeclaration(projectRoot, declaration);
339
+ plan.set(drive.slug, {
340
+ drive,
341
+ source
342
+ });
343
+ }
344
+ for (const declaration of hostDeclared) {
345
+ const drive = resolveDriveDeclaration(projectRoot, declaration);
346
+ plan.set(drive.slug, {
347
+ drive,
348
+ source: "host"
349
+ });
350
+ }
351
+ return [...plan.values()];
352
+ }
353
+ function explainDrivePlan(plan) {
354
+ if (plan.length === 0) return "(no drives declared)";
355
+ return ["drives:", ...plan.map(({ drive, source }) => {
356
+ const kind = drive.kind === "remote" ? `remote ${drive.remoteUrl}` : "local";
357
+ const editor = drive.preferredEditor ? ` editor=${drive.preferredEditor}` : "";
358
+ return ` ${drive.slug} (${kind}, id=${drive.id}${editor}) [${source}]`;
359
+ })].join("\n");
360
+ }
361
+ /**
362
+ * The shared zod schemas for host.js blocks (D2.a). The `reactor` block
363
+ * validates STRICTLY (D2.d — phase 0's tolerated-unknown-keys notice ends
364
+ * here): a typo'd protocol key must fail, not silently not-apply, because
365
+ * these are fleet-consensus settings. `config` stays loose — it is
366
+ * runner-defined by design.
367
+ */
368
+ const profileSchema = strictObject({
369
+ appId: string().min(1).optional(),
370
+ name: string().min(1).optional(),
371
+ description: string().optional(),
372
+ icon: string().optional()
373
+ }).optional();
374
+ const reactorProtocolSchema = strictObject({
375
+ featureFlags: strictObject({
376
+ documentDecisions: boolean().optional(),
377
+ authEnforcement: boolean().optional(),
378
+ authGroups: boolean().optional(),
379
+ authConditions: boolean().optional()
380
+ }).optional(),
381
+ createSignaturePolicy: _enum(["legacy", "v2-required"]).optional(),
382
+ unsupportedStoredDocuments: _enum(["refuse", "read-only"]).optional()
383
+ });
384
+ const reactorBackendSchema = strictObject({
385
+ kind: _enum([
386
+ "in-process",
387
+ "worker",
388
+ "remote"
389
+ ]).optional(),
390
+ storage: strictObject({
391
+ kind: _enum([
392
+ "idb",
393
+ "memory",
394
+ "path",
395
+ "postgres"
396
+ ]),
397
+ dataDir: string().optional(),
398
+ url: string().optional()
399
+ }).optional(),
400
+ readModel: strictObject({ url: string().optional() }).optional(),
401
+ packages: strictObject({
402
+ cdnUrl: string().optional(),
403
+ specs: array(string()).optional(),
404
+ dynamic: boolean().optional()
405
+ }).optional(),
406
+ remote: strictObject({
407
+ host: string().optional(),
408
+ url: string().optional()
409
+ }).optional(),
410
+ projection: strictObject({
411
+ enabled: boolean().optional(),
412
+ dbPoolSize: number().int().positive().optional()
413
+ }).optional(),
414
+ executors: strictObject({ numWorkers: union([number().int().positive(), literal("auto")]).optional() }).optional()
415
+ });
416
+ const reactorSchema = strictObject({
417
+ backends: record(string(), reactorBackendSchema).optional(),
418
+ placement: strictObject({
419
+ primary: string().optional(),
420
+ default: looseObject({}).optional()
421
+ }).optional(),
422
+ protocol: reactorProtocolSchema.optional(),
423
+ /** DEPRECATED (dies in R2): workflows become a listed plugin — presence is
424
+ * activation. Kept parsing until the switchboard rewire lands. */
425
+ workflows: boolean().optional(),
426
+ renown: strictObject({
427
+ url: string().optional(),
428
+ networkId: string().optional(),
429
+ chainId: number().int().optional()
430
+ }).optional(),
431
+ packages: strictObject({ registryUrl: string().optional() }).optional(),
432
+ namespace: string().min(1).optional(),
433
+ auth: strictObject({
434
+ enabled: boolean().optional(),
435
+ admins: array(string()).optional(),
436
+ renown: looseObject({}).optional()
437
+ }).optional(),
438
+ drives: drivesSchema.optional()
439
+ });
440
+ /** Common runner options every host.runner carries; runner modules extend it
441
+ * loosely with their own process options. */
442
+ const runnerBaseSchema = looseObject({
443
+ module: string().min(1),
444
+ defaultVerb: string().optional(),
445
+ port: number().int().positive().optional(),
446
+ /** Bind address; each runner documents its default (0.0.0.0 for servers,
447
+ * localhost for vite dev, 127.0.0.1 for serve). */
448
+ host: string().min(1).optional(),
449
+ /** THE COMPOSITION: the plugin entries this host boots with. Presence is
450
+ * activation; see plugins.ts for entry semantics. */
451
+ plugins: array(pluginEntrySchema).optional()
452
+ });
453
+ /** A compound's children map (mutually exclusive with `reactor` — the XOR is
454
+ * structural, enforced by the loader; schemas validate each side's shape). */
455
+ const childrenSchema = record(string(), strictObject({
456
+ host: string().min(1),
457
+ runner: looseObject({}).optional(),
458
+ config: looseObject({}).optional(),
459
+ reactor: reactorSchema.optional()
460
+ }));
461
+ looseObject({
462
+ name: string().min(1),
463
+ runner: runnerBaseSchema,
464
+ config: looseObject({}).optional(),
465
+ profile: profileSchema,
466
+ reactor: reactorSchema.optional()
467
+ });
468
+ looseObject({
469
+ name: string().min(1),
470
+ runner: runnerBaseSchema,
471
+ children: childrenSchema,
472
+ config: looseObject({}).optional(),
473
+ profile: profileSchema
474
+ });
475
+ //#endregion
476
+ export { mergeDefaultDrives as a, profileSchema as c, rebaseDriveUrl as d, resolveDriveDeclaration as f, validateHost as h, loadHost as i, projectDrivesIntoConnect as l, seedDrives as m, explainDrivePlan as n, mergeDrivePlan as o, resolveRunnerModule as p, getVerb as r, probeHostsFolder as s, childrenSchema as t, reactorSchema as u };
477
+
478
+ //# sourceMappingURL=host-schemas-CL_wFpY7-BDyTA_z_.mjs.map
479
+ //# debugId=bd229268-5450-5763-8f0c-b804b1c401cc
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-schemas-CL_wFpY7-BDyTA_z_.mjs","sources":["../../../packages/host-core/dist/host-schemas-CL_wFpY7.mjs"],"sourcesContent":["import { pluginEntrySchema } from \"./plugins.mjs\";\nimport { createRequire } from \"node:module\";\nimport fs, { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\nimport crypto from \"node:crypto\";\n//#region src/connect-projection.ts\n/**\n* Instance-fact projection for compound hosts: the drives a compound's\n* reactor member created, projected into the Connect member's runtime-config\n* override. Pure functions, moved from ph-cli's vetra service so the generic\n* compound and the classic path share one implementation.\n*/\nfunction isLocalDrive(drive) {\n\treturn \"local\" in drive;\n}\nconst driveKey = (drive) => isLocalDrive(drive) ? `local:${drive.id}` : drive.url;\n/**\n* Concatenate groups of `connect.drives.defaultDrives` in the order given,\n* de-duplicating by drive identity (URL for remote entries, id for local\n* ones). The first occurrence of a drive wins, so earlier groups keep their\n* position and metadata — e.g. the Vetra drive `ph vetra` starts stays first\n* even when the project's `powerhouse.config.json` lists the same drive.\n*/\nfunction mergeDefaultDrives(...groups) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tconst out = [];\n\tfor (const group of groups) for (const drive of group) {\n\t\tconst key = driveKey(drive);\n\t\tif (seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tout.push(drive);\n\t}\n\treturn out;\n}\n/**\n* Rebase a local drive URL onto a public base: keeps the /d/<slug> path,\n* swaps the loopback origin for the public base. Browser clients behind a\n* reverse proxy can't reach http://localhost:<port>. Non-loopback URLs\n* (e.g. a remote drive) are already public and pass through unchanged, as do\n* unparseable ones.\n*/\nfunction rebaseDriveUrl(driveUrl, publicBase) {\n\tlet url;\n\ttry {\n\t\turl = new URL(driveUrl);\n\t} catch {\n\t\treturn driveUrl;\n\t}\n\tif (![\n\t\t\"localhost\",\n\t\t\"127.0.0.1\",\n\t\t\"[::1]\"\n\t].includes(url.hostname)) return driveUrl;\n\treturn `${publicBase.replace(/\\/+$/, \"\")}${url.pathname}`;\n}\n/**\n* The compound's drives projection: created drives first (rebased onto the\n* public base when given), then the project's configured drives, de-duplicated\n* — and `preserve-all`, because compound-injected drive lists change per\n* launch context and must never detach drives the user added by hand.\n*/\nfunction projectDrivesIntoConnect(input) {\n\treturn { drives: {\n\t\tdefaultDrives: mergeDefaultDrives(input.createdDriveUrls.filter((url) => typeof url === \"string\" && url.length > 0).map((url) => ({\n\t\t\turl: input.publicBase ? rebaseDriveUrl(url, input.publicBase) : url,\n\t\t\tname: null,\n\t\t\ticon: null\n\t\t})), input.configuredDefaultDrives ?? []),\n\t\tpreserveStrategy: \"preserve-all\"\n\t} };\n}\n//#endregion\n//#region src/host-loader.ts\n/**\n* Loads and pre-validates a `hosts/<name>/host.js` definition.\n*\n* A host file is a static PROJECTION of powerhouse.config.json: plain ESM,\n* default-exporting a data object. Three gates run before any runner sees it:\n* 1. import lint — the only legal import is the project's\n* powerhouse.config.json (host files are data, not programs);\n* 2. static check — the exported object must survive a JSON round trip\n* (functions, undefined, class instances, Dates etc. are rejected,\n* reporting the offending path);\n* 3. shape pre-check — `name`, `runner.module`, and the reactor XOR children\n* rule. Full validation is the runner's `hostSchema` (phase 2).\n*\n* This module never exits the process — callers own error presentation.\n*/\nconst HOST_FILE = \"host.js\";\nconst CONFIG_IMPORT_SUFFIX = \"powerhouse.config.json\";\nvar HostLoadError = class extends Error {\n\tconstructor(message, hint) {\n\t\tsuper(hint ? `${message}\\n Hint: ${hint}` : message);\n\t\tthis.name = \"HostLoadError\";\n\t}\n};\n/** A `hosts/` folder with no `<name>/host.js` inside is \"empty\" — the guard\n* state: callers warn loudly and fall back to legacy rather than activating\n* the new architecture off a stray `mkdir hosts`. */\nfunction probeHostsFolder(projectRoot) {\n\tconst dir = path.join(projectRoot, \"hosts\");\n\tif (!existsSync(dir) || !statSync(dir).isDirectory()) return { kind: \"absent\" };\n\tconst hosts = readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync(path.join(dir, entry.name, HOST_FILE))).map((entry) => entry.name).sort();\n\treturn hosts.length === 0 ? {\n\t\tkind: \"empty\",\n\t\tdir\n\t} : {\n\t\tkind: \"present\",\n\t\tdir,\n\t\thosts\n\t};\n}\n/** Sibling host imports: `../<host>/host.js` — source material for derived\n* compositions (full-inclusion wrappers compute over them with plain JS). */\nconst SIBLING_IMPORT = /^\\.\\.\\/([A-Za-z0-9_-]+)\\/host\\.js$/;\n/** Rejects every import except the project's powerhouse.config.json and\n* SIBLING host files (R1: derived compositions), plus any dynamic\n* `import(...)` or `require(...)`. Source-level enforcement: the JSON round\n* trip below is the hard gate; this one produces the better error. Returns\n* the sibling host names the file imports, for cycle detection. */\nfunction lintHostImports(source, file) {\n\tconst siblings = [];\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\tsiblings.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 or sibling hosts/<name>/host.js files.`, \"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\treturn siblings;\n}\n/** Walks the sibling-import graph from `hostName`, linting every visited file\n* and failing on a cycle (an ESM circular would otherwise surface as an\n* undefined default export with no useful message). */\nfunction lintHostImportGraph(hostsDir, hostName) {\n\tconst state = /* @__PURE__ */ new Map();\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 siblings = lintHostImports(readFileSync(file, \"utf8\"), file);\n\t\tfor (const sibling of siblings) visit(sibling, [...chain, name]);\n\t\tstate.set(name, \"done\");\n\t};\n\tvisit(hostName, []);\n}\n/** Returns the path of the first value that would not survive a JSON round\n* trip, or undefined when the object is fully static. */\nfunction findNonStaticValue(value, trail = \"\") {\n\tif (value === null) return void 0;\n\tconst kind = typeof value;\n\tif (kind === \"string\" || kind === \"number\" || kind === \"boolean\") return;\n\tif (kind !== \"object\") return `${trail || \"<root>\"} (${kind})`;\n\tif (Array.isArray(value)) {\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tconst hit = findNonStaticValue(value[i], `${trail}[${i}]`);\n\t\t\tif (hit) return hit;\n\t\t}\n\t\treturn;\n\t}\n\tconst proto = Object.getPrototypeOf(value);\n\tif (proto !== Object.prototype && proto !== null) return `${trail || \"<root>\"} (non-plain object)`;\n\tfor (const [key, child] of Object.entries(value)) {\n\t\tconst hit = findNonStaticValue(child, trail ? `${trail}.${key}` : key);\n\t\tif (hit) return hit;\n\t}\n}\nfunction assertHostShape(host, file) {\n\tif (typeof host.name !== \"string\" || host.name.length === 0) throw new HostLoadError(`${file}: \\`name\\` must be a non-empty string.`);\n\tconst runner = host.runner;\n\tif (runner === null || typeof runner !== \"object\" || typeof runner.module !== \"string\") throw new HostLoadError(`${file}: \\`runner\\` must be an object with a \\`module\\` specifier string.`);\n\tif (host.reactor !== void 0 && host.children !== void 0) throw new HostLoadError(`${file}: \\`reactor\\` and \\`children\\` are mutually exclusive — a host is a reactor runner or a compound runner, never both.`);\n}\nasync function loadHost(projectRoot, hostName) {\n\tconst probe = probeHostsFolder(projectRoot);\n\tif (probe.kind === \"absent\") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, \"Scaffold one with `ph init --uniform-runners` (or create hosts/<name>/host.js).\");\n\tif (probe.kind === \"empty\") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, \"An empty hosts/ folder does not activate the uniform-runners architecture; add a host definition or remove the folder.\");\n\tif (!probe.hosts.includes(hostName)) throw new HostLoadError(`Unknown host \"${hostName}\". Available hosts: ${probe.hosts.join(\", \")}.`);\n\tconst file = path.join(probe.dir, hostName, HOST_FILE);\n\tlintHostImportGraph(probe.dir, hostName);\n\tconst host = (await import(pathToFileURL(file).href)).default;\n\tif (host === null || typeof host !== \"object\" || Array.isArray(host)) throw new HostLoadError(`${file} must default-export the host object (\\`export default { name, runner, ... }\\`).`);\n\tconst nonStatic = findNonStaticValue(host);\n\tif (nonStatic) throw new HostLoadError(`${file} exports a non-static value at \\`${nonStatic}\\` — host files must survive a JSON round trip.`, \"Runtime behavior belongs in the runner; host files only carry data.\");\n\tassertHostShape(host, file);\n\treturn {\n\t\tname: hostName,\n\t\tdir: path.dirname(file),\n\t\tfile,\n\t\thost\n\t};\n}\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, ...optionalVerbs }`. Phase-0 home is ph-cli; the\n* uniform-runners plan moves this into @powerhousedao/host-core with the\n* generic compound (phase 1).\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/** Exports that are part of the contract but are not verbs. */\nconst NON_VERB_EXPORTS = /* @__PURE__ */ new Set([\n\t\"hostSchema\",\n\t\"kind\",\n\t\"default\"\n]);\nasync function resolveRunnerModule(projectRoot, specifier) {\n\tconst projectRequire = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href);\n\tlet resolved;\n\ttry {\n\t\tresolved = projectRequire.resolve(specifier);\n\t} catch {\n\t\tthrow new RunnerError(`Cannot resolve runner module \"${specifier}\" from ${projectRoot}.`, \"The runner must be a dependency of the project (install it, then retry).\");\n\t}\n\tconst module = await import(pathToFileURL(resolved).href);\n\tif (typeof module.run !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`run\\` function (required verb).`);\n\tconst hostSchema = module.hostSchema;\n\tif (!hostSchema || typeof hostSchema.safeParse !== \"function\") throw new RunnerError(`Runner \"${specifier}\" does not export a \\`hostSchema\\` — runners validate their own host shape.`);\n\tif (typeof module.kind !== \"string\") throw new RunnerError(`Runner \"${specifier}\" does not export \\`kind\\` (e.g. \"reactor\" | \"compound\").`);\n\treturn module;\n}\nfunction listVerbs(runner) {\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\" || NON_VERB_EXPORTS.has(verb)) throw new RunnerError(`Runner \"${specifier}\" does not support the verb \"${verb}\". Supported verbs: ${listVerbs(runner).join(\", \")}.`);\n\treturn candidate;\n}\nfunction validateHost(runner, specifier, host, file) {\n\tconst result = runner.hostSchema.safeParse(host);\n\tif (!result.success) throw new RunnerError(`${file} failed validation against the hostSchema of \"${specifier}\":\\n${(result.error?.issues ?? []).map((issue) => ` - ${issue.path.join(\".\") || \"<root>\"}: ${issue.message}`).join(\"\\n\") || \" (no details reported)\"}`);\n}\n//#endregion\n//#region src/run-record.ts\nconst runDir = (projectDir) => path.join(projectDir, \".ph\", \"run\");\nconst recordPath = (projectDir, hostName) => path.join(runDir(projectDir), `${hostName}.json`);\nfunction readRunRecord(projectDir, hostName) {\n\ttry {\n\t\treturn JSON.parse(fs.readFileSync(recordPath(projectDir, hostName), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction writeRunRecord(projectDir, record) {\n\tconst target = recordPath(projectDir, record.hostName);\n\tfs.mkdirSync(path.dirname(target), { recursive: true });\n\tfs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\\n`);\n}\nfunction clearRunRecord(projectDir, hostName) {\n\ttry {\n\t\tfs.rmSync(recordPath(projectDir, hostName));\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/**\n* Decide whether the recorded instance is this project's live host.\n*\n* pid liveness alone proves nothing (pids are reused), and 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 pid) is reported so the caller can clear it; a\n* foreign one (live pid, different project) is left alone.\n*/\nfunction probeRun(projectDir, hostName, projectName) {\n\tconst record = readRunRecord(projectDir, hostName);\n\tif (!record) return { status: \"none\" };\n\tif (!isPidAlive(record.pid)) 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/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}/pglite` and the RUNNER resolves it at\n* start. In the CLI the default userData is `<projectRoot>/.ph/user-data`;\n* a shell (Tauri) overrides it via PH_USER_DATA_DIR to the OS profile dir.\n*/\nfunction defaultUserDataDir(projectRoot, env = process.env) {\n\treturn env.PH_USER_DATA_DIR ?? path.join(projectRoot, \".ph\", \"user-data\");\n}\nconst PLACEHOLDER = /\\$\\{userData\\}/g;\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\tif (typeof value === \"string\") return value.replace(PLACEHOLDER, userData);\n\tif (Array.isArray(value)) return value.map((v) => resolveUserDataPlaceholders(v, userData));\n\tif (value !== null && typeof value === \"object\") {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = resolveUserDataPlaceholders(v, userData);\n\t\treturn out;\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/compound.ts\nfunction memberEntries(host) {\n\tconst children = host.children ?? {};\n\treturn Object.entries(children);\n}\nfunction orderedMembers(host, wiring) {\n\tconst entries = memberEntries(host);\n\tif (!wiring.startOrder) return entries;\n\tconst byName = new Map(entries);\n\tconst out = [];\n\tfor (const name of wiring.startOrder) {\n\t\tconst m = byName.get(name);\n\t\tif (m) {\n\t\t\tout.push([name, m]);\n\t\t\tbyName.delete(name);\n\t\t}\n\t}\n\tfor (const [name, m] of entries) if (byName.has(name)) out.push([name, m]);\n\treturn out;\n}\n/** Build the member host object the member runner sees: the member's own\n* host.js with the wrapper applied. R1 semantics (rewire plan): a wrapper\n* SECTION is a FULL STATEMENT — `reactor` and `config`, when present on the\n* wrapper, replace the member's wholesale (host files derive keeps explicitly\n* by spreading the sibling import: `{ ...switchboard.reactor, drives }`).\n* `runner` stays key-merged: wrappers never restate `module`/`defaultVerb`,\n* they override individual keys (port, host, plugins — the plugins LIST\n* itself is a full statement computed in the file). */\nasync function resolveMemberHost(projectRoot, member, userData, configPatch) {\n\tconst base = (await loadHost(projectRoot, member.host)).host;\n\treturn resolveUserDataPlaceholders({\n\t\t...base,\n\t\trunner: {\n\t\t\t...base.runner,\n\t\t\t...member.runner ?? {}\n\t\t},\n\t\tconfig: {\n\t\t\t...member.config !== void 0 ? member.config : base.config ?? {},\n\t\t\t...configPatch ?? {}\n\t\t},\n\t\treactor: member.reactor !== void 0 ? member.reactor : base.reactor\n\t}, userData);\n}\nfunction isConnectMember(member) {\n\treturn member.host === \"connect\";\n}\nfunction isReactorFactMember(member) {\n\treturn member.host === \"switchboard\";\n}\nasync function runCompound(host, ctx, options) {\n\tconst projectRoot = ctx.projectRoot;\n\tconst wiring = host.config ?? {};\n\tconst verb = ctx.verb;\n\tconst probe = probeRun(projectRoot, host.name, options.projectName);\n\tif (probe.status === \"live\") throw new Error(`${host.name} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`);\n\tif (probe.status === \"foreign\") throw new Error(`.ph/run/${host.name}.json describes a live \"${probe.record.projectName}\", but this project is \"${options.projectName}\". Refusing to start a second instance.`);\n\tconst userData = defaultUserDataDir(projectRoot, ctx.env);\n\tconst started = [];\n\tconst reactorFacts = { driveUrls: [] };\n\tconst shutdown = async () => {\n\t\tfor (const m of [...started].reverse()) try {\n\t\t\tawait m.handle.shutdown?.();\n\t\t} catch {}\n\t\tif (wiring.runtimeRecord !== false) clearRunRecord(projectRoot, host.name);\n\t};\n\tfor (const [name, member] of orderedMembers(host, wiring)) {\n\t\tlet configPatch;\n\t\tif (isConnectMember(member) && wiring.projectDrivesIntoConnect && reactorFacts.driveUrls.length > 0) {\n\t\t\tconst configuredDefaultDrives = (member.config?.drives)?.defaultDrives;\n\t\t\tconfigPatch = projectDrivesIntoConnect({\n\t\t\t\tcreatedDriveUrls: reactorFacts.driveUrls,\n\t\t\t\tconfiguredDefaultDrives,\n\t\t\t\tpublicBase: wiring.drivesPublicBase\n\t\t\t});\n\t\t}\n\t\tconst memberHost = await resolveMemberHost(projectRoot, member, userData, configPatch);\n\t\tif (isConnectMember(member) && wiring.cspRegistrySync) memberHost.runner = {\n\t\t\t...memberHost.runner,\n\t\t\tcspRegistrySync: true\n\t\t};\n\t\tconst specifier = memberHost.runner.module;\n\t\tconst runner = await resolveRunnerModule(projectRoot, specifier);\n\t\tvalidateHost(runner, specifier, memberHost, `hosts/${member.host}/host.js`);\n\t\tconst handle = await getVerb(runner, specifier, verb === \"run\" ? memberHost.runner.defaultVerb ?? \"run\" : verb)(memberHost, ctx) ?? {};\n\t\tif (handle.ready) await handle.ready;\n\t\tstarted.push({\n\t\t\tname,\n\t\t\thandle\n\t\t});\n\t\tif (isReactorFactMember(member) && handle.driveUrls) reactorFacts.driveUrls.push(...handle.driveUrls);\n\t}\n\tif (wiring.runtimeRecord !== false) {\n\t\tconst members = {};\n\t\tfor (const m of started) members[m.name] = {\n\t\t\tport: m.handle.port,\n\t\t\turl: m.handle.endpoints?.graphql ?? m.handle.endpoints?.connect\n\t\t};\n\t\twriteRunRecord(projectRoot, {\n\t\t\tpid: process.pid,\n\t\t\thostName: host.name,\n\t\t\tprojectName: options.projectName,\n\t\t\tstartedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\tmembers,\n\t\t\textra: options.recordExtra\n\t\t});\n\t}\n\tif (options.installSignalHandlers !== false) {\n\t\tconst onSignal = (code) => {\n\t\t\tshutdown().finally(() => process.exit(code));\n\t\t};\n\t\tprocess.on(\"exit\", () => {\n\t\t\tif (wiring.runtimeRecord !== false) clearRunRecord(projectRoot, host.name);\n\t\t});\n\t\tprocess.on(\"SIGINT\", () => onSignal(130));\n\t\tprocess.on(\"SIGTERM\", () => onSignal(143));\n\t}\n\treturn {\n\t\tstarted,\n\t\tshutdown\n\t};\n}\n//#endregion\n//#region src/drives.ts\n/**\n* R1 — core drive declarations. A reactor without drives is not a running\n* reactor, so declaring + seeding them is HOST RUNTIME work (not a plugin):\n* onReactorReady → idempotent slug-keyed seeding → onDrivesReady. Plugins\n* CONTRIBUTE declarations into the same merged list (Contributions.drives);\n* `--explain drives` prints the merged set with provenance.\n*\n* Field semantics (union of the three existing creation sites — vetra,\n* preview, workflows — plus Connect's PHConnectDefaultDrive):\n* - slug: the SEEDING KEY (idempotence); id optional (stable identity),\n* projectHash derives both from the project path (generateProjectDriveId\n* semantics: `${slug}-${sha256(projectPath).slice(0, 8)}`).\n* - preferredEditor: binds the drive to its drive app — stored at\n* header.meta.preferredEditor; Connect config's `app` is the legacy alias.\n* - remote.url: an attachment to a drive served elsewhere (Connect default\n* drives, switchboard remoteDrives); local fields are ignored for remotes.\n*/\nconst driveDeclarationSchema = z.strictObject({\n\tslug: z.string().min(1),\n\tid: z.string().min(1).optional(),\n\t/** Derive id (and the served slug) from the project path, like\n\t* generateProjectDriveId — same ids classic `ph vetra` produces. */\n\tprojectHash: z.boolean().optional(),\n\tname: z.string().min(1).optional(),\n\ticon: z.string().optional(),\n\tpreferredEditor: z.string().optional(),\n\tsharingType: z.enum([\n\t\t\"public\",\n\t\t\"private\",\n\t\t\"shared\"\n\t]).optional(),\n\tavailableOffline: z.boolean().optional(),\n\tremote: z.strictObject({ url: z.string().min(1) }).optional()\n});\nconst drivesSchema = z.array(driveDeclarationSchema);\nfunction projectDriveId(projectRoot, slug) {\n\treturn `${slug}-${crypto.createHash(\"sha256\").update(projectRoot).digest(\"hex\").substring(0, 8)}`;\n}\nfunction resolveDriveDeclaration(projectRoot, decl) {\n\tconst id = decl.projectHash ? projectDriveId(projectRoot, decl.slug) : decl.id ?? decl.slug;\n\tconst slug = decl.projectHash ? id : decl.slug;\n\tif (decl.remote) return {\n\t\tkind: \"remote\",\n\t\tid,\n\t\tslug,\n\t\tname: decl.name ?? decl.slug,\n\t\tremoteUrl: decl.remote.url,\n\t\tsharingType: decl.sharingType ?? \"public\",\n\t\tavailableOffline: decl.availableOffline ?? true\n\t};\n\treturn {\n\t\tkind: \"local\",\n\t\tid,\n\t\tslug,\n\t\tname: decl.name ?? decl.slug,\n\t\ticon: decl.icon,\n\t\tpreferredEditor: decl.preferredEditor,\n\t\tsharingType: decl.sharingType ?? \"public\",\n\t\tavailableOffline: decl.availableOffline ?? true\n\t};\n}\n/** Idempotent, slug-keyed: an existing slug is left untouched (never\n* recreated, never mutated — preserveStrategy refinements live here later). */\nasync function seedDrives(client, drives) {\n\tconst result = {\n\t\tcreated: [],\n\t\texisting: [],\n\t\tattached: []\n\t};\n\tfor (const drive of drives) {\n\t\tif (drive.kind === \"remote\") {\n\t\t\tawait client.attachRemoteDrive(drive.remoteUrl);\n\t\t\tresult.attached.push(drive.slug);\n\t\t\tcontinue;\n\t\t}\n\t\tif (await client.findDriveBySlug(drive.slug) !== void 0) {\n\t\t\tresult.existing.push(drive.slug);\n\t\t\tcontinue;\n\t\t}\n\t\tawait client.createDrive(drive);\n\t\tresult.created.push(drive.slug);\n\t}\n\treturn result;\n}\n/** Merge host-declared drives with plugin contributions, slug-keyed — the\n* host file wins on conflicts (it is the most explicit source). */\nfunction mergeDrivePlan(projectRoot, hostDeclared, contributed) {\n\tconst plan = /* @__PURE__ */ new Map();\n\tfor (const { declaration, source } of contributed) {\n\t\tconst drive = resolveDriveDeclaration(projectRoot, declaration);\n\t\tplan.set(drive.slug, {\n\t\t\tdrive,\n\t\t\tsource\n\t\t});\n\t}\n\tfor (const declaration of hostDeclared) {\n\t\tconst drive = resolveDriveDeclaration(projectRoot, declaration);\n\t\tplan.set(drive.slug, {\n\t\t\tdrive,\n\t\t\tsource: \"host\"\n\t\t});\n\t}\n\treturn [...plan.values()];\n}\nfunction explainDrivePlan(plan) {\n\tif (plan.length === 0) return \"(no drives declared)\";\n\treturn [\"drives:\", ...plan.map(({ drive, source }) => {\n\t\tconst kind = drive.kind === \"remote\" ? `remote ${drive.remoteUrl}` : \"local\";\n\t\tconst editor = drive.preferredEditor ? ` editor=${drive.preferredEditor}` : \"\";\n\t\treturn ` ${drive.slug} (${kind}, id=${drive.id}${editor}) [${source}]`;\n\t})].join(\"\\n\");\n}\n//#endregion\n//#region src/host-schemas.ts\n/**\n* The shared zod schemas for host.js blocks (D2.a). The `reactor` block\n* validates STRICTLY (D2.d — phase 0's tolerated-unknown-keys notice ends\n* here): a typo'd protocol key must fail, not silently not-apply, because\n* these are fleet-consensus settings. `config` stays loose — it is\n* runner-defined by design.\n*/\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}).optional();\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}).optional(),\n\tcreateSignaturePolicy: z.enum([\"legacy\", \"v2-required\"]).optional(),\n\tunsupportedStoredDocuments: z.enum([\"refuse\", \"read-only\"]).optional()\n});\nconst reactorBackendSchema = z.strictObject({\n\tkind: z.enum([\n\t\t\"in-process\",\n\t\t\"worker\",\n\t\t\"remote\"\n\t]).optional(),\n\tstorage: z.strictObject({\n\t\tkind: z.enum([\n\t\t\t\"idb\",\n\t\t\t\"memory\",\n\t\t\t\"path\",\n\t\t\t\"postgres\"\n\t\t]),\n\t\tdataDir: z.string().optional(),\n\t\turl: z.string().optional()\n\t}).optional(),\n\treadModel: z.strictObject({ url: z.string().optional() }).optional(),\n\tpackages: z.strictObject({\n\t\tcdnUrl: z.string().optional(),\n\t\tspecs: z.array(z.string()).optional(),\n\t\tdynamic: z.boolean().optional()\n\t}).optional(),\n\tremote: z.strictObject({\n\t\thost: z.string().optional(),\n\t\turl: z.string().optional()\n\t}).optional(),\n\tprojection: z.strictObject({\n\t\tenabled: z.boolean().optional(),\n\t\tdbPoolSize: z.number().int().positive().optional()\n\t}).optional(),\n\texecutors: z.strictObject({ numWorkers: z.union([z.number().int().positive(), z.literal(\"auto\")]).optional() }).optional()\n});\nconst reactorSchema = z.strictObject({\n\tbackends: z.record(z.string(), reactorBackendSchema).optional(),\n\tplacement: z.strictObject({\n\t\tprimary: z.string().optional(),\n\t\tdefault: z.looseObject({}).optional()\n\t}).optional(),\n\tprotocol: reactorProtocolSchema.optional(),\n\t/** DEPRECATED (dies in R2): workflows become a listed plugin — presence is\n\t* activation. Kept parsing until the switchboard rewire lands. */\n\tworkflows: z.boolean().optional(),\n\trenown: z.strictObject({\n\t\turl: z.string().optional(),\n\t\tnetworkId: z.string().optional(),\n\t\tchainId: z.number().int().optional()\n\t}).optional(),\n\tpackages: z.strictObject({ registryUrl: z.string().optional() }).optional(),\n\tnamespace: z.string().min(1).optional(),\n\tauth: z.strictObject({\n\t\tenabled: z.boolean().optional(),\n\t\tadmins: z.array(z.string()).optional(),\n\t\trenown: z.looseObject({}).optional()\n\t}).optional(),\n\tdrives: drivesSchema.optional()\n});\n/** Common runner options every host.runner carries; runner modules extend it\n* loosely with their own process options. */\nconst runnerBaseSchema = z.looseObject({\n\tmodule: z.string().min(1),\n\tdefaultVerb: z.string().optional(),\n\tport: z.number().int().positive().optional(),\n\t/** Bind address; each runner documents its default (0.0.0.0 for servers,\n\t* localhost for vite dev, 127.0.0.1 for serve). */\n\thost: z.string().min(1).optional(),\n\t/** THE COMPOSITION: the plugin entries this host boots with. Presence is\n\t* activation; see plugins.ts for entry semantics. */\n\tplugins: z.array(pluginEntrySchema).optional()\n});\n/** A compound's children map (mutually exclusive with `reactor` — the XOR is\n* structural, enforced by the loader; schemas validate each side's shape). */\nconst childrenSchema = z.record(z.string(), z.strictObject({\n\thost: z.string().min(1),\n\trunner: z.looseObject({}).optional(),\n\tconfig: z.looseObject({}).optional(),\n\treactor: reactorSchema.optional()\n}));\n/** Composed generic host shapes — the basis for the emitted editor schemas\n* (D2.a). Runner packages extend these with their own runner options; `config`\n* stays loose by design. */\nconst reactorHostSchema = z.looseObject({\n\tname: z.string().min(1),\n\trunner: runnerBaseSchema,\n\tconfig: z.looseObject({}).optional(),\n\tprofile: profileSchema,\n\treactor: reactorSchema.optional()\n});\nconst compoundHostSchema = z.looseObject({\n\tname: z.string().min(1),\n\trunner: runnerBaseSchema,\n\tchildren: childrenSchema,\n\tconfig: z.looseObject({}).optional(),\n\tprofile: profileSchema\n});\nconst SCHEMA_BASE = \"https://powerhouse.inc/schemas\";\n/** The emitted-schema set, keyed by published filename. Pure — the\n* emit-schemas script writes these to disk and the drift test re-derives\n* them, per the runtime-config-schema pattern. */\nfunction emittedHostSchemas() {\n\tconst emit = (name, schema) => ({\n\t\t$id: `${SCHEMA_BASE}/${name}.schema.json`,\n\t\t...z.toJSONSchema(schema, { io: \"input\" })\n\t});\n\treturn {\n\t\t\"host-reactor.schema.json\": emit(\"host-reactor\", reactorHostSchema),\n\t\t\"host-compound.schema.json\": emit(\"host-compound\", compoundHostSchema)\n\t};\n}\n//#endregion\nexport { HostLoadError as A, readRunRecord as C, listVerbs as D, getVerb as E, mergeDefaultDrives as F, projectDrivesIntoConnect as I, rebaseDriveUrl as L, lintHostImports as M, loadHost as N, resolveRunnerModule as O, probeHostsFolder as P, probeRun as S, RunnerError as T, runCompound as _, reactorBackendSchema as a, clearRunRecord as b, reactorSchema as c, drivesSchema as d, explainDrivePlan as f, seedDrives as g, resolveDriveDeclaration as h, profileSchema as i, findNonStaticValue as j, validateHost as k, runnerBaseSchema as l, projectDriveId as m, compoundHostSchema as n, reactorHostSchema as o, mergeDrivePlan as p, emittedHostSchemas as r, reactorProtocolSchema as s, childrenSchema as t, driveDeclarationSchema as u, defaultUserDataDir as v, writeRunRecord as w, isPidAlive as x, resolveUserDataPlaceholders as y };\n\n//# sourceMappingURL=host-schemas-CL_wFpY7.mjs.map"],"names":["z.strictObject","z.string","z.boolean","z.enum","z.array","z.number","z.union","z.literal","z.record","z.looseObject"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAS,aAAa,OAAO;CAC5B,OAAO,WAAW;AACnB;AACA,MAAM,YAAY,UAAU,aAAa,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM;;;;;;;;AAQ9E,SAAS,mBAAmB,GAAG,QAAQ;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,MAAM,MAAM,CAAC;CACb,KAAK,MAAM,SAAS,QAAQ,KAAK,MAAM,SAAS,OAAO;EACtD,MAAM,MAAM,SAAS,KAAK;EAC1B,IAAI,KAAK,IAAI,GAAG,GAAG;EACnB,KAAK,IAAI,GAAG;EACZ,IAAI,KAAK,KAAK;CACf;CACA,OAAO;AACR;;;;;;;;AAQA,SAAS,eAAe,UAAU,YAAY;CAC7C,IAAI;CACJ,IAAI;EACH,MAAM,IAAI,IAAI,QAAQ;CACvB,QAAQ;EACP,OAAO;CACR;CACA,IAAI,CAAC;EACJ;EACA;EACA;CACD,CAAC,CAAC,SAAS,IAAI,QAAQ,GAAG,OAAO;CACjC,OAAO,GAAG,WAAW,QAAQ,QAAQ,EAAE,IAAI,IAAI;AAChD;;;;;;;AAOA,SAAS,yBAAyB,OAAO;CACxC,OAAO,EAAE,QAAQ;EAChB,eAAe,mBAAmB,MAAM,iBAAiB,QAAQ,QAAQ,OAAO,QAAQ,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS;GACjI,KAAK,MAAM,aAAa,eAAe,KAAK,MAAM,UAAU,IAAI;GAChE,MAAM;GACN,MAAM;EACP,EAAE,GAAG,MAAM,2BAA2B,CAAC,CAAC;EACxC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