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

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 (61) hide show
  1. package/dist/{cli-connect-override-DP5vRA7N.mjs → cli-connect-override-Cf7WutqU.mjs} +4 -4
  2. package/dist/{cli-connect-override-DP5vRA7N.mjs.map → cli-connect-override-Cf7WutqU.mjs.map} +1 -1
  3. package/dist/cli.mjs +4 -4
  4. package/dist/{connect-build-xRrXk9-p.mjs → connect-build-DO93w0f7.mjs} +9 -4
  5. package/dist/connect-build-DO93w0f7.mjs.map +1 -0
  6. package/dist/{connect-config-BvS0chVq.mjs → connect-config-9EZB_0H_.mjs} +4 -4
  7. package/dist/{connect-config-BvS0chVq.mjs.map → connect-config-9EZB_0H_.mjs.map} +1 -1
  8. package/dist/{connect-preview-BW6XnRtj.mjs → connect-preview-DqWtPruk.mjs} +62 -16
  9. package/dist/connect-preview-DqWtPruk.mjs.map +1 -0
  10. package/dist/{connect-studio-8EyDblpG.mjs → connect-studio-FEEyWfwB.mjs} +4 -4
  11. package/dist/{connect-studio-8EyDblpG.mjs.map → connect-studio-FEEyWfwB.mjs.map} +1 -1
  12. package/dist/{connect-studio-NxCVdXDv.mjs → connect-studio-k5vB41GX.mjs} +3 -3
  13. package/dist/dist-BqeDFgEy.mjs +2 -2
  14. package/dist/dist-BqeDFgEy.mjs.map +1 -1
  15. package/dist/{explain-D6gLYBd0.mjs → explain-BDHmXgw3.mjs} +4 -4
  16. package/dist/{explain-D6gLYBd0.mjs.map → explain-BDHmXgw3.mjs.map} +1 -1
  17. package/dist/{generate-all-CRfVwLJ9.mjs → generate-all-C_sPGBuk.mjs} +5 -5
  18. package/dist/{generate-all-CRfVwLJ9.mjs.map → generate-all-C_sPGBuk.mjs.map} +1 -1
  19. package/dist/{generate-desktop-shell-itIzf77U.mjs → generate-desktop-shell-BBSGpmud.mjs} +4 -4
  20. package/dist/generate-desktop-shell-BBSGpmud.mjs.map +1 -0
  21. package/dist/{generate-document-model-ChkXjM1s.mjs → generate-document-model-BfFIQ35q.mjs} +5 -5
  22. package/dist/{generate-document-model-ChkXjM1s.mjs.map → generate-document-model-BfFIQ35q.mjs.map} +1 -1
  23. package/dist/{generate-subgraph-DmcQWVbd.mjs → generate-subgraph-CVlTo7qk.mjs} +5 -5
  24. package/dist/{generate-subgraph-DmcQWVbd.mjs.map → generate-subgraph-CVlTo7qk.mjs.map} +1 -1
  25. package/dist/{host-schemas-CL_wFpY7-B_pY14Jy.mjs → host-schemas-CtPNRr5v-BQyKKFbS.mjs} +18 -4
  26. package/dist/host-schemas-CtPNRr5v-BQyKKFbS.mjs.map +1 -0
  27. package/dist/{ph-cli-commands-CLJP7yKV.mjs → ph-cli-commands-ifxjNJoa.mjs} +16 -16
  28. package/dist/{ph-cli-commands-CLJP7yKV.mjs.map → ph-cli-commands-ifxjNJoa.mjs.map} +1 -1
  29. package/dist/ph-cli-commands-qdvATJ2S.mjs +4 -0
  30. package/dist/precompress-P6cJDPVC.mjs +77 -0
  31. package/dist/precompress-P6cJDPVC.mjs.map +1 -0
  32. package/dist/{run-sugar-DveBlJqh.mjs → run-sugar-BdjKTPGO.mjs} +4 -4
  33. package/dist/{run-sugar-DveBlJqh.mjs.map → run-sugar-BdjKTPGO.mjs.map} +1 -1
  34. package/dist/runners/compound.mjs +2 -2
  35. package/dist/runners/connect.mjs +4 -4
  36. package/dist/runners/switchboard.d.mts +59 -0
  37. package/dist/runners/switchboard.d.mts.map +1 -1
  38. package/dist/runners/switchboard.mjs +49 -19
  39. package/dist/runners/switchboard.mjs.map +1 -1
  40. package/dist/{start-run-CASbiOWI.mjs → start-run-CmDxyMw0.mjs} +4 -4
  41. package/dist/{start-run-CASbiOWI.mjs.map → start-run-CmDxyMw0.mjs.map} +1 -1
  42. package/dist/switchboard-C5zgkRl2.mjs +4 -0
  43. package/dist/{switchboard-tQS3fhqa.mjs → switchboard-h4-XgP1h.mjs} +3 -6
  44. package/dist/switchboard-h4-XgP1h.mjs.map +1 -0
  45. package/dist/{switchboard-reset-CX_Lzw3O.mjs → switchboard-reset-MtTB_GAI.mjs} +7 -5
  46. package/dist/switchboard-reset-MtTB_GAI.mjs.map +1 -0
  47. package/dist/{vetra-BV5F0YeG.mjs → vetra-DPN1SpOC.mjs} +9 -9
  48. package/dist/vetra-DPN1SpOC.mjs.map +1 -0
  49. package/dist/{warn-subgraph-type-conflicts-Jd6SeN-M.mjs → warn-subgraph-type-conflicts-BOHBmThq.mjs} +5 -5
  50. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +1 -0
  51. package/package.json +15 -14
  52. package/dist/connect-build-xRrXk9-p.mjs.map +0 -1
  53. package/dist/connect-preview-BW6XnRtj.mjs.map +0 -1
  54. package/dist/generate-desktop-shell-itIzf77U.mjs.map +0 -1
  55. package/dist/host-schemas-CL_wFpY7-B_pY14Jy.mjs.map +0 -1
  56. package/dist/ph-cli-commands-NHDoX5i7.mjs +0 -4
  57. package/dist/switchboard-BUMqobK4.mjs +0 -4
  58. package/dist/switchboard-reset-CX_Lzw3O.mjs.map +0 -1
  59. package/dist/switchboard-tQS3fhqa.mjs.map +0 -1
  60. package/dist/vetra-BV5F0YeG.mjs.map +0 -1
  61. package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { t as runConnectStudio } from "./connect-studio-8EyDblpG.mjs";
1
+ import { t as runConnectStudio } from "./connect-studio-FEEyWfwB.mjs";
2
2
  export { runConnectStudio };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3c824362-e057-5e7d-a2f0-6ed7a89c44fb")}catch(e){}}();
4
- //# debugId=3c824362-e057-5e7d-a2f0-6ed7a89c44fb
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="415c3ab1-e7e4-58d5-9835-ef48ad007bd2")}catch(e){}}();
4
+ //# debugId=415c3ab1-e7e4-58d5-9835-ef48ad007bd2
@@ -1,5 +1,5 @@
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]="6a51a0f6-c572-5ca9-b96b-b353caf0bc75")}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]="3bfa3784-f13f-5957-9d59-c8f2a49c84e4")}catch(e){}}();
3
3
  import { f as prettifyError } from "./schemas-BQSPev1x.mjs";
4
4
  import { i as normalizePluginEntries, n as entryActiveForVerb, r as hostTypeSatisfies, t as PluginError } from "./plugins-CHVv4qup.mjs";
5
5
  import { createRequire } from "node:module";
@@ -220,4 +220,4 @@ async function resolveHostPlugins(projectRoot, hostType, verb, entries, where) {
220
220
  export { projectReactorToSwitchboard as a, projectReactorToConnect as i, isStructuralMultiReactor as n, remoteBackendUrls as o, primaryBackend as r, resolveHostPlugins as s, assertProtocolConsistency as t };
221
221
 
222
222
  //# sourceMappingURL=dist-BqeDFgEy.mjs.map
223
- //# debugId=6a51a0f6-c572-5ca9-b96b-b353caf0bc75
223
+ //# debugId=3bfa3784-f13f-5957-9d59-c8f2a49c84e4
@@ -1 +1 @@
1
- {"version":3,"file":"dist-BqeDFgEy.mjs","sources":["../../../packages/host-core/dist/index.mjs"],"sourcesContent":["import { A as HostLoadError, C as readRunRecord, D as listVerbs, E as getVerb, F as mergeDefaultDrives, I as projectDrivesIntoConnect, L as rebaseDriveUrl, M as lintHostImports, N as loadHost, O as resolveRunnerModule, P as probeHostsFolder, S as probeRun, T as RunnerError, _ as runCompound, a as reactorBackendSchema, b as clearRunRecord, c as reactorSchema, d as drivesSchema, f as explainDrivePlan, g as seedDrives, h as resolveDriveDeclaration, i as profileSchema, j as findNonStaticValue, k as validateHost, l as runnerBaseSchema, m as projectDriveId, n as compoundHostSchema, o as reactorHostSchema, p as mergeDrivePlan, r as emittedHostSchemas, s as reactorProtocolSchema, t as childrenSchema, u as driveDeclarationSchema, v as defaultUserDataDir, w as writeRunRecord, x as isPidAlive, y as resolveUserDataPlaceholders } from \"./host-schemas-CL_wFpY7.mjs\";\nimport { PluginError, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook } from \"./plugins.mjs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\n//#region src/backend-projection.ts\nfunction projectStorage(name, storage) {\n\tswitch (storage.kind) {\n\t\tcase \"idb\": return { kind: \"idb\" };\n\t\tcase \"memory\": return { kind: \"memory\" };\n\t\tcase \"path\":\n\t\t\tif (!storage.dataDir) throw new Error(`Backend \"${name}\": storage kind \"path\" requires dataDir.`);\n\t\t\treturn {\n\t\t\t\tkind: \"path\",\n\t\t\t\tdataDir: storage.dataDir\n\t\t\t};\n\t\tcase \"postgres\": throw new Error(`Backend \"${name}\": storage kind \"postgres\" is server-side only — a provisioned (in-process/worker) reactor cannot use it. Point a \"remote\" backend at the switchboard that owns that database instead.`);\n\t}\n}\n/** One backend → one descriptor. The protocol's featureFlags ride every\n* descriptor (they are fleet consensus, not per-backend). A remote backend\n* must carry remote.url — provision() requires it. */\nfunction backendToDescriptor(name, backend, protocol) {\n\tconst descriptor = {\n\t\tkind: backend.kind ?? \"in-process\",\n\t\tname\n\t};\n\tif (descriptor.kind === \"remote\") {\n\t\tconst url = backend.remote?.url;\n\t\tif (!url) throw new Error(`Backend \"${name}\" is kind \"remote\" but has no remote.url — a remote descriptor attaches to an already-running reactor by URL.`);\n\t\tdescriptor.remote = { url };\n\t\treturn descriptor;\n\t}\n\tif (backend.storage) descriptor.storage = projectStorage(name, backend.storage);\n\tif (backend.packages) descriptor.packages = backend.packages;\n\tif (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n\treturn descriptor;\n}\n/** All named backends, in placement-primary-first order (the order a\n* createReactorClients step would provision them). */\nfunction backendsToDescriptors(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return [];\n\tconst names = Object.keys(backends);\n\tconst primary = reactor.placement?.primary;\n\treturn (primary && names.includes(primary) ? [primary, ...names.filter((n) => n !== primary)] : names).map((name) => backendToDescriptor(name, backends[name], reactor.protocol));\n}\nconst LOCAL_KINDS = /* @__PURE__ */ new Set([\n\t\"in-process\",\n\t\"worker\",\n\tvoid 0\n]);\n/**\n* Structural multi-reactor (phase 4): true when the block names BOTH a local\n* backend (in-process/worker — the tab's own reactor) and a remote one. This\n* is the shape Connect's routing client serves; a lone remote backend is an\n* attach-only host (assistant/agent shape), not a routed tab.\n*/\nfunction isStructuralMultiReactor(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return false;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\treturn kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\");\n}\n/** The remote backends' urls, placement order — what the routing client dials. */\nfunction remoteBackendUrls(reactor) {\n\treturn backendsToDescriptors(reactor).filter((d) => d.kind === \"remote\").map((d) => d.remote?.url).filter((u) => typeof u === \"string\");\n}\n//#endregion\n//#region src/reactor-config.ts\n/** The single primary backend for phase-2 projection (multi-backend routing is\n* track R). Prefers placement.primary, else \"main\"/\"local\", else the first. */\nfunction primaryBackend(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst names = Object.keys(backends);\n\tif (names.length === 0) return void 0;\n\treturn backends[reactor.placement?.primary ?? (names.includes(\"main\") ? \"main\" : names.includes(\"local\") ? \"local\" : names[0])];\n}\nconst FLAG_ENV = {\n\tdocumentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n\tauthEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n\tauthGroups: \"REACTOR_AUTH_GROUPS\",\n\tauthConditions: \"REACTOR_AUTH_CONDITIONS\"\n};\n/** The env vars a protocol block maps onto, with their string values. Only\n* keys the block actually sets appear. */\nfunction protocolEnv(protocol) {\n\tconst env = {};\n\tif (!protocol) return env;\n\tfor (const [key, varName] of Object.entries(FLAG_ENV)) {\n\t\tconst value = protocol.featureFlags?.[key];\n\t\tif (value !== void 0) env[varName] = value ? \"true\" : \"false\";\n\t}\n\tif (protocol.createSignaturePolicy !== void 0) env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n\tif (protocol.unsupportedStoredDocuments !== void 0) env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;\n\treturn env;\n}\n/** Project the reactor block onto the switchboard's env + options. */\nfunction projectReactorToSwitchboard(reactor) {\n\tconst env = protocolEnv(reactor?.protocol);\n\tconst backend = primaryBackend(reactor);\n\tconst options = {};\n\tif (backend?.storage) {\n\t\tconst s = backend.storage;\n\t\tconst dbUrl = s.kind === \"postgres\" ? s.url : s.dataDir;\n\t\tif (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;\n\t}\n\tif (backend?.readModel?.url) options.dbPath = backend.readModel.url;\n\tif (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = \"true\";\n\tif (reactor?.workflows !== void 0) env.PH_WORKFLOWS_ENABLED = reactor.workflows ? \"1\" : \"0\";\n\treturn {\n\t\tenv,\n\t\toptions\n\t};\n}\nconst LOCAL_BACKEND_KINDS = /* @__PURE__ */ new Set([\n\t\"in-process\",\n\t\"worker\",\n\tvoid 0\n]);\n/**\n* Which reactor client the backend topology asks for:\n* - local (in-process/worker) AND remote backends -> `router`\n* - remote backend(s) only -> `remote`\n* - a worker backend -> `worker`\n* - anything else local -> `in-process`\n* `undefined` when no backends are declared — the caller then keeps the\n* legacy reactorWorker/multiReactor behaviour untouched.\n*/\nfunction reactorClientMode(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\tif (kinds.length === 0) return void 0;\n\tconst hasLocal = kinds.some((k) => LOCAL_BACKEND_KINDS.has(k));\n\tconst hasRemote = kinds.some((k) => k === \"remote\");\n\tif (hasLocal && hasRemote) return \"router\";\n\tif (hasRemote) return \"remote\";\n\treturn primaryBackend(reactor)?.kind === \"worker\" ? \"worker\" : \"in-process\";\n}\n/** Project the reactor block onto the Connect runtime config: protocol →\n* connect.reactor (same shape), backend topology → instance.reactorWorker\n* (legacy) + instance.reactorClient (the explicit 4-way selector),\n* workflows → app.workflowsEnabled. */\nfunction projectReactorToConnect(reactor) {\n\tconst connect = {};\n\tif (reactor?.protocol) connect.reactor = reactor.protocol;\n\tconst backend = primaryBackend(reactor);\n\tconst mode = reactorClientMode(reactor);\n\tif (backend?.kind !== void 0 || mode !== void 0) connect.instance = {\n\t\t...backend?.kind !== void 0 ? { reactorWorker: backend.kind === \"worker\" } : {},\n\t\t...mode !== void 0 ? { reactorClient: mode } : {}\n\t};\n\tif (reactor?.workflows !== void 0) connect.app = { workflowsEnabled: reactor.workflows };\n\treturn { connect };\n}\n/**\n* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n* the host's protocol block, fail loudly naming the var, the host value, and\n* the env value. An env var that merely matches, or is unset, is fine (phase-2\n* transition keeps an operator's explicit env as an escape hatch unless it\n* disagrees with the protocol — see the WBS precedence note).\n*/\nfunction assertProtocolConsistency(protocol, env, hostFile = \"the host file\") {\n\tif (!protocol) return;\n\tconst expected = protocolEnv(protocol);\n\tfor (const [varName, hostValue] of Object.entries(expected)) {\n\t\tconst envValue = env[varName];\n\t\tif (envValue !== void 0 && envValue !== hostValue) throw new Error(`reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — a mismatch would diverge replay. Remove the env override or align the host.`);\n\t}\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//#endregion\nexport { HostLoadError, PluginError, RunnerError, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, childrenSchema, clearRunRecord, compoundHostSchema, defaultUserDataDir, driveDeclarationSchema, drivesSchema, emittedHostSchemas, entryActiveForVerb, explainDrivePlan, findNonStaticValue, getVerb, hostTypeSatisfies, isPidAlive, isStructuralMultiReactor, lintHostImports, listVerbs, loadHost, mergeContributions, mergeDefaultDrives, mergeDrivePlan, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, primaryBackend, probeHostsFolder, probeRun, profileSchema, projectDriveId, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolEnv, reactorBackendSchema, reactorClientMode, reactorHostSchema, reactorProtocolSchema, reactorSchema, readRunRecord, rebaseDriveUrl, registerHostType, remoteBackendUrls, resolveDriveDeclaration, resolveHostPlugins, resolveOrder, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook, runnerBaseSchema, seedDrives, validateHost, writeRunRecord };\n\n//# sourceMappingURL=index.mjs.map"],"names":["z.prettifyError"],"mappings":";;;;;;;;AAOA,SAAS,eAAe,MAAM,SAAS;CACtC,QAAQ,QAAQ,MAAhB;EACC,KAAK,OAAO,OAAO,EAAE,MAAM,MAAM;EACjC,KAAK,UAAU,OAAO,EAAE,M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MAAM,OAAO,wDAAwD,oEAAoE;EACpL,IAAI,OAAO,cAAc;GACxB,MAAM,SAAS,OAAO,aAAa,UAAU,MAAM,MAAM;GACzD,IAAI,CAAC,OAAO,SAAS,MAAM,IAAI,YAAY,GAAG,MAAM,uBAAuB,OAAO,KAAK,mBAAmBA,cAAgB,OAAO,KAAK,CAAC;EACxI;EACA,MAAM,YAAY,OAAO,aAAa;EACtC,IAAI,CAAC,kBAAkB,UAAU,SAAS,GAAG,MAAM,IAAI,YAAY,GAAG,MAAM,YAAY,OAAO,KAAK,gBAAgB,UAAU,6BAA6B,SAAS,GAAG;EACvK,SAAS,KAAK;GACb;GACA;GACA,YAAY;EACb,CAAC;CACF;CACA,OAAO;AACR","debug_id":"6a51a0f6-c572-5ca9-b96b-b353caf0bc75"}
1
+ {"version":3,"file":"dist-BqeDFgEy.mjs","sources":["../../../packages/host-core/dist/index.mjs"],"sourcesContent":["import { A as HostLoadError, C as readRunRecord, D as listVerbs, E as getVerb, F as mergeDefaultDrives, I as projectDrivesIntoConnect, L as rebaseDriveUrl, M as lintHostImports, N as loadHost, O as resolveRunnerModule, P as probeHostsFolder, S as probeRun, T as RunnerError, _ as runCompound, a as reactorBackendSchema, b as clearRunRecord, c as reactorSchema, d as drivesSchema, f as explainDrivePlan, g as seedDrives, h as resolveDriveDeclaration, i as profileSchema, j as findNonStaticValue, k as validateHost, l as runnerBaseSchema, m as projectDriveId, n as compoundHostSchema, o as reactorHostSchema, p as mergeDrivePlan, r as emittedHostSchemas, s as reactorProtocolSchema, t as childrenSchema, u as driveDeclarationSchema, v as defaultUserDataDir, w as writeRunRecord, x as isPidAlive, y as resolveUserDataPlaceholders } from \"./host-schemas-CtPNRr5v.mjs\";\nimport { PluginError, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook } from \"./plugins.mjs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\n//#region src/backend-projection.ts\nfunction projectStorage(name, storage) {\n\tswitch (storage.kind) {\n\t\tcase \"idb\": return { kind: \"idb\" };\n\t\tcase \"memory\": return { kind: \"memory\" };\n\t\tcase \"path\":\n\t\t\tif (!storage.dataDir) throw new Error(`Backend \"${name}\": storage kind \"path\" requires dataDir.`);\n\t\t\treturn {\n\t\t\t\tkind: \"path\",\n\t\t\t\tdataDir: storage.dataDir\n\t\t\t};\n\t\tcase \"postgres\": throw new Error(`Backend \"${name}\": storage kind \"postgres\" is server-side only — a provisioned (in-process/worker) reactor cannot use it. Point a \"remote\" backend at the switchboard that owns that database instead.`);\n\t}\n}\n/** One backend → one descriptor. The protocol's featureFlags ride every\n* descriptor (they are fleet consensus, not per-backend). A remote backend\n* must carry remote.url — provision() requires it. */\nfunction backendToDescriptor(name, backend, protocol) {\n\tconst descriptor = {\n\t\tkind: backend.kind ?? \"in-process\",\n\t\tname\n\t};\n\tif (descriptor.kind === \"remote\") {\n\t\tconst url = backend.remote?.url;\n\t\tif (!url) throw new Error(`Backend \"${name}\" is kind \"remote\" but has no remote.url — a remote descriptor attaches to an already-running reactor by URL.`);\n\t\tdescriptor.remote = { url };\n\t\treturn descriptor;\n\t}\n\tif (backend.storage) descriptor.storage = projectStorage(name, backend.storage);\n\tif (backend.packages) descriptor.packages = backend.packages;\n\tif (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n\treturn descriptor;\n}\n/** All named backends, in placement-primary-first order (the order a\n* createReactorClients step would provision them). */\nfunction backendsToDescriptors(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return [];\n\tconst names = Object.keys(backends);\n\tconst primary = reactor.placement?.primary;\n\treturn (primary && names.includes(primary) ? [primary, ...names.filter((n) => n !== primary)] : names).map((name) => backendToDescriptor(name, backends[name], reactor.protocol));\n}\nconst LOCAL_KINDS = /* @__PURE__ */ new Set([\n\t\"in-process\",\n\t\"worker\",\n\tvoid 0\n]);\n/**\n* Structural multi-reactor (phase 4): true when the block names BOTH a local\n* backend (in-process/worker — the tab's own reactor) and a remote one. This\n* is the shape Connect's routing client serves; a lone remote backend is an\n* attach-only host (assistant/agent shape), not a routed tab.\n*/\nfunction isStructuralMultiReactor(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return false;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\treturn kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\");\n}\n/** The remote backends' urls, placement order — what the routing client dials. */\nfunction remoteBackendUrls(reactor) {\n\treturn backendsToDescriptors(reactor).filter((d) => d.kind === \"remote\").map((d) => d.remote?.url).filter((u) => typeof u === \"string\");\n}\n//#endregion\n//#region src/reactor-config.ts\n/** The single primary backend for phase-2 projection (multi-backend routing is\n* track R). Prefers placement.primary, else \"main\"/\"local\", else the first. */\nfunction primaryBackend(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst names = Object.keys(backends);\n\tif (names.length === 0) return void 0;\n\treturn backends[reactor.placement?.primary ?? (names.includes(\"main\") ? \"main\" : names.includes(\"local\") ? \"local\" : names[0])];\n}\nconst FLAG_ENV = {\n\tdocumentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n\tauthEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n\tauthGroups: \"REACTOR_AUTH_GROUPS\",\n\tauthConditions: \"REACTOR_AUTH_CONDITIONS\"\n};\n/** The env vars a protocol block maps onto, with their string values. Only\n* keys the block actually sets appear. */\nfunction protocolEnv(protocol) {\n\tconst env = {};\n\tif (!protocol) return env;\n\tfor (const [key, varName] of Object.entries(FLAG_ENV)) {\n\t\tconst value = protocol.featureFlags?.[key];\n\t\tif (value !== void 0) env[varName] = value ? \"true\" : \"false\";\n\t}\n\tif (protocol.createSignaturePolicy !== void 0) env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n\tif (protocol.unsupportedStoredDocuments !== void 0) env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;\n\treturn env;\n}\n/** Project the reactor block onto the switchboard's env + options. */\nfunction projectReactorToSwitchboard(reactor) {\n\tconst env = protocolEnv(reactor?.protocol);\n\tconst backend = primaryBackend(reactor);\n\tconst options = {};\n\tif (backend?.storage) {\n\t\tconst s = backend.storage;\n\t\tconst dbUrl = s.kind === \"postgres\" ? s.url : s.dataDir;\n\t\tif (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;\n\t}\n\tif (backend?.readModel?.url) options.dbPath = backend.readModel.url;\n\tif (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = \"true\";\n\tif (reactor?.workflows !== void 0) env.PH_WORKFLOWS_ENABLED = reactor.workflows ? \"1\" : \"0\";\n\treturn {\n\t\tenv,\n\t\toptions\n\t};\n}\nconst LOCAL_BACKEND_KINDS = /* @__PURE__ */ new Set([\n\t\"in-process\",\n\t\"worker\",\n\tvoid 0\n]);\n/**\n* Which reactor client the backend topology asks for:\n* - local (in-process/worker) AND remote backends -> `router`\n* - remote backend(s) only -> `remote`\n* - a worker backend -> `worker`\n* - anything else local -> `in-process`\n* `undefined` when no backends are declared — the caller then keeps the\n* legacy reactorWorker/multiReactor behaviour untouched.\n*/\nfunction reactorClientMode(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\tif (kinds.length === 0) return void 0;\n\tconst hasLocal = kinds.some((k) => LOCAL_BACKEND_KINDS.has(k));\n\tconst hasRemote = kinds.some((k) => k === \"remote\");\n\tif (hasLocal && hasRemote) return \"router\";\n\tif (hasRemote) return \"remote\";\n\treturn primaryBackend(reactor)?.kind === \"worker\" ? \"worker\" : \"in-process\";\n}\n/** Project the reactor block onto the Connect runtime config: protocol →\n* connect.reactor (same shape), backend topology → instance.reactorWorker\n* (legacy) + instance.reactorClient (the explicit 4-way selector),\n* workflows → app.workflowsEnabled. */\nfunction projectReactorToConnect(reactor) {\n\tconst connect = {};\n\tif (reactor?.protocol) connect.reactor = reactor.protocol;\n\tconst backend = primaryBackend(reactor);\n\tconst mode = reactorClientMode(reactor);\n\tif (backend?.kind !== void 0 || mode !== void 0) connect.instance = {\n\t\t...backend?.kind !== void 0 ? { reactorWorker: backend.kind === \"worker\" } : {},\n\t\t...mode !== void 0 ? { reactorClient: mode } : {}\n\t};\n\tif (reactor?.workflows !== void 0) connect.app = { workflowsEnabled: reactor.workflows };\n\treturn { connect };\n}\n/**\n* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n* the host's protocol block, fail loudly naming the var, the host value, and\n* the env value. An env var that merely matches, or is unset, is fine (phase-2\n* transition keeps an operator's explicit env as an escape hatch unless it\n* disagrees with the protocol — see the WBS precedence note).\n*/\nfunction assertProtocolConsistency(protocol, env, hostFile = \"the host file\") {\n\tif (!protocol) return;\n\tconst expected = protocolEnv(protocol);\n\tfor (const [varName, hostValue] of Object.entries(expected)) {\n\t\tconst envValue = env[varName];\n\t\tif (envValue !== void 0 && envValue !== hostValue) throw new Error(`reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — a mismatch would diverge replay. Remove the env override or align the host.`);\n\t}\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//#endregion\nexport { HostLoadError, PluginError, RunnerError, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, childrenSchema, clearRunRecord, compoundHostSchema, defaultUserDataDir, driveDeclarationSchema, drivesSchema, emittedHostSchemas, entryActiveForVerb, explainDrivePlan, findNonStaticValue, getVerb, hostTypeSatisfies, isPidAlive, isStructuralMultiReactor, lintHostImports, listVerbs, loadHost, mergeContributions, mergeDefaultDrives, mergeDrivePlan, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, primaryBackend, probeHostsFolder, probeRun, profileSchema, projectDriveId, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolEnv, reactorBackendSchema, reactorClientMode, reactorHostSchema, reactorProtocolSchema, reactorSchema, readRunRecord, rebaseDriveUrl, registerHostType, remoteBackendUrls, resolveDriveDeclaration, resolveHostPlugins, resolveOrder, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook, runnerBaseSchema, seedDrives, validateHost, writeRunRecord };\n\n//# sourceMappingURL=index.mjs.map"],"names":["z.prettifyError"],"mappings":";;;;;;;;AAOA,SAAS,eAAe,MAAM,SAAS;CACtC,QAAQ,QAAQ,MAAhB;EACC,KAAK,OAAO,OAAO,EAAE,MAAM,MAAM;EACjC,KAAK,UAAU,OAAO,EAAE,MAAM,SAAS;EACvC,KAAK;GACJ,IAAI,CAAC,QAAQ,SAAS,MAAM,IAAI,MAAM,YAAY,KAAK,yCAAyC;GAChG,OAAO;IACN,MAAM;IACN,SAAS,QAAQ;GAClB;EACD,KAAK,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,uLAAuL;CAC1O;AACD;;;;AAIA,SAAS,oBAAoB,MAAM,SAAS,UAAU;CACrD,MAAM,aAAa;EAClB,MAAM,QAAQ,QAAQ;EACtB;CACD;CACA,IAAI,WAAW,SAAS,UAAU;EACjC,MAAM,MAAM,QAAQ,QAAQ;EAC5B,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,YAAY,KAAK,8GAA8G;EACzJ,WAAW,SAAS,EAAE,IAAI;EAC1B,OAAO;CACR;CACA,IAAI,QAAQ,SAAS,WAAW,UAAU,eAAe,MAAM,QAAQ,OAAO;CAC9E,IAAI,QAAQ,UAAU,WAAW,WAAW,QAAQ;CACpD,IAAI,UAAU,cAAc,WAAW,eAAe,SAAS;CAC/D,OAAO;AACR;;;AAG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AAS,YAAY;EAC/B,IAAI,CAAC,mBAAmB,OAAO,IAAI,GAAG;EACtC,IAAI;EACJ,IAAI;GACH,OAAO,eAAe,QAAQ,MAAM,MAAM;EAC3C,QAAQ;GACP,MAAM,IAAI,YAAY,GAAG,MAAM,2BAA2B,MAAM,OAAO,SAAS,YAAY,IAAI,gFAAgF;EACjL;EACA,MAAM,YAAY,MAAM,OAAO,cAAc,IAAI,CAAC,CAAC,MAAA,CAAO;EAC1D,IAAI;EACJ,IAAI,OAAO,aAAa,YAAY,SAAS,SAAS,MAAM,MAAM;OAC7D,IAAI,kBAAkB,QAAQ,GAAG;GACrC,IAAI,OAAO,KAAK,MAAM,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,cAAc,MAAM,IAAI,YAAY,GAAG,MAAM,YAAY,MAAM,OAAO,6CAA6C;GACzK,SAAS;EACV,OAAO,MAAM,IAAI,YAAY,GAAG,MAAM,KAAK,MAAM,OAAO,wDAAwD,oEAAoE;EACpL,IAAI,OAAO,cAAc;GACxB,MAAM,SAAS,OAAO,aAAa,UAAU,MAAM,MAAM;GACzD,IAAI,CAAC,OAAO,SAAS,MAAM,IAAI,YAAY,GAAG,MAAM,uBAAuB,OAAO,KAAK,mBAAmBA,cAAgB,OAAO,KAAK,CAAC;EACxI;EACA,MAAM,YAAY,OAAO,aAAa;EACtC,IAAI,CAAC,kBAAkB,UAAU,SAAS,GAAG,MAAM,IAAI,YAAY,GAAG,MAAM,YAAY,OAAO,KAAK,gBAAgB,UAAU,6BAA6B,SAAS,GAAG;EACvK,SAAS,KAAK;GACb;GACA;GACA,YAAY;EACb,CAAC;CACF;CACA,OAAO;AACR","debug_id":"3bfa3784-f13f-5957-9d59-c8f2a49c84e4"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="789ae972-d2bc-5c3a-9ad5-3492a9af885a")}catch(e){}}();
3
- import { i as loadHost, n as explainDrivePlan, o as mergeDrivePlan } from "./host-schemas-CL_wFpY7-B_pY14Jy.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d14206d7-6f55-534b-955c-bdf3f2e281e0")}catch(e){}}();
3
+ import { i as loadHost, n as explainDrivePlan, o as mergeDrivePlan } from "./host-schemas-CtPNRr5v-BQyKKFbS.mjs";
4
4
  //#region src/services/run/explain.ts
5
5
  async function explainHost(options) {
6
6
  if (options.topic !== "drives") throw new Error(`Unknown --explain topic "${options.topic}" (supported: drives).`);
@@ -23,5 +23,5 @@ async function explainHost(options) {
23
23
  //#endregion
24
24
  export { explainHost };
25
25
 
26
- //# sourceMappingURL=explain-D6gLYBd0.mjs.map
27
- //# debugId=789ae972-d2bc-5c3a-9ad5-3492a9af885a
26
+ //# sourceMappingURL=explain-BDHmXgw3.mjs.map
27
+ //# debugId=d14206d7-6f55-534b-955c-bdf3f2e281e0
@@ -1 +1 @@
1
- {"version":3,"file":"explain-D6gLYBd0.mjs","sources":["../src/services/run/explain.ts"],"sourcesContent":["import {\n explainDrivePlan,\n loadHost,\n mergeDrivePlan,\n type DriveDeclaration,\n} from \"@powerhousedao/host-core\";\n\n/**\n * `ph run <host> --explain drives` (R1): print the merged drive plan with\n * provenance instead of running. Host-declared drives only for now — plugin\n * contributions join the merge when the pipelines land (R2+); the renderer\n * and provenance labels already carry them.\n */\n\ninterface ExplainOptions {\n host: string;\n topic: string;\n}\n\ninterface ReactorSection {\n drives?: DriveDeclaration[];\n}\n\ninterface ChildWrapper {\n host: string;\n reactor?: ReactorSection;\n}\n\nexport async function explainHost(options: ExplainOptions): Promise<void> {\n if (options.topic !== \"drives\") {\n throw new Error(\n `Unknown --explain topic \"${options.topic}\" (supported: drives).`,\n );\n }\n const projectRoot = process.cwd();\n const loaded = await loadHost(projectRoot, options.host);\n const host = loaded.host;\n\n if (host.children !== undefined) {\n // Compound: one plan per member, with the wrapper's full-statement\n // semantics (wrapper reactor replaces the member's when present).\n const children = host.children as Record<string, ChildWrapper>;\n for (const [name, wrapper] of Object.entries(children)) {\n const member = await loadHost(projectRoot, wrapper.host);\n const reactor = (wrapper.reactor ??\n member.host.reactor ??\n {}) as ReactorSection;\n console.log(`[${options.host} › ${name} (${wrapper.host})]`);\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, reactor.drives ?? [], [])),\n );\n }\n return;\n }\n\n const reactor = (host.reactor ?? {}) as ReactorSection;\n console.log(`[${options.host}]`);\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, reactor.drives ?? [], [])),\n );\n}\n"],"names":[],"mappings":";;;;AA4BA,eAAsB,YAAY,SAAwC;CACxE,IAAI,QAAQ,UAAU,UACpB,MAAM,IAAI,MACR,4BAA4B,QAAQ,MAAM,uBAC5C;CAEF,MAAM,cAAc,QAAQ,IAAI;CAEhC,MAAM,QAAO,MADQ,SAAS,aAAa,QAAQ,IAAI,EAAA,CACnC;CAEpB,IAAI,KAAK,aAAa,KAAA,GAAW;EAG/B,MAAM,WAAW,KAAK;EACtB,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,QAAQ,GAAG;GACtD,MAAM,SAAS,MAAM,SAAS,aAAa,QAAQ,IAAI;GACvD,MAAM,UAAW,QAAQ,WACvB,OAAO,KAAK,WACZ,CAAC;GACH,QAAQ,IAAI,IAAI,QAAQ,KAAK,KAAK,KAAK,IAAI,QAAQ,KAAK,GAAG;GAC3D,QAAQ,IACN,iBAAiB,eAAe,aAAa,QAAQ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CACxE;EACF;EACA;CACF;CAEA,MAAM,UAAW,KAAK,WAAW,CAAC;CAClC,QAAQ,IAAI,IAAI,QAAQ,KAAK,EAAE;CAC/B,QAAQ,IACN,iBAAiB,eAAe,aAAa,QAAQ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CACxE;AACF","debug_id":"789ae972-d2bc-5c3a-9ad5-3492a9af885a"}
1
+ {"version":3,"file":"explain-BDHmXgw3.mjs","sources":["../src/services/run/explain.ts"],"sourcesContent":["import {\n explainDrivePlan,\n loadHost,\n mergeDrivePlan,\n type DriveDeclaration,\n} from \"@powerhousedao/host-core\";\n\n/**\n * `ph run <host> --explain drives` (R1): print the merged drive plan with\n * provenance instead of running. Host-declared drives only for now — plugin\n * contributions join the merge when the pipelines land (R2+); the renderer\n * and provenance labels already carry them.\n */\n\ninterface ExplainOptions {\n host: string;\n topic: string;\n}\n\ninterface ReactorSection {\n drives?: DriveDeclaration[];\n}\n\ninterface ChildWrapper {\n host: string;\n reactor?: ReactorSection;\n}\n\nexport async function explainHost(options: ExplainOptions): Promise<void> {\n if (options.topic !== \"drives\") {\n throw new Error(\n `Unknown --explain topic \"${options.topic}\" (supported: drives).`,\n );\n }\n const projectRoot = process.cwd();\n const loaded = await loadHost(projectRoot, options.host);\n const host = loaded.host;\n\n if (host.children !== undefined) {\n // Compound: one plan per member, with the wrapper's full-statement\n // semantics (wrapper reactor replaces the member's when present).\n const children = host.children as Record<string, ChildWrapper>;\n for (const [name, wrapper] of Object.entries(children)) {\n const member = await loadHost(projectRoot, wrapper.host);\n const reactor = (wrapper.reactor ??\n member.host.reactor ??\n {}) as ReactorSection;\n console.log(`[${options.host} › ${name} (${wrapper.host})]`);\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, reactor.drives ?? [], [])),\n );\n }\n return;\n }\n\n const reactor = (host.reactor ?? {}) as ReactorSection;\n console.log(`[${options.host}]`);\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, reactor.drives ?? [], [])),\n );\n}\n"],"names":[],"mappings":";;;;AA4BA,eAAsB,YAAY,SAAwC;CACxE,IAAI,QAAQ,UAAU,UACpB,MAAM,IAAI,MACR,4BAA4B,QAAQ,MAAM,uBAC5C;CAEF,MAAM,cAAc,QAAQ,IAAI;CAEhC,MAAM,QAAO,MADQ,SAAS,aAAa,QAAQ,IAAI,EAAA,CACnC;CAEpB,IAAI,KAAK,aAAa,KAAA,GAAW;EAG/B,MAAM,WAAW,KAAK;EACtB,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,QAAQ,GAAG;GACtD,MAAM,SAAS,MAAM,SAAS,aAAa,QAAQ,IAAI;GACvD,MAAM,UAAW,QAAQ,WACvB,OAAO,KAAK,WACZ,CAAC;GACH,QAAQ,IAAI,IAAI,QAAQ,KAAK,KAAK,KAAK,IAAI,QAAQ,KAAK,GAAG;GAC3D,QAAQ,IACN,iBAAiB,eAAe,aAAa,QAAQ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CACxE;EACF;EACA;CACF;CAEA,MAAM,UAAW,KAAK,WAAW,CAAC;CAClC,QAAQ,IAAI,IAAI,QAAQ,KAAK,EAAE;CAC/B,QAAQ,IACN,iBAAiB,eAAe,aAAa,QAAQ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CACxE;AACF","debug_id":"d14206d7-6f55-534b-955c-bdf3f2e281e0"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2d046d0a-39ff-5107-97e9-021c7478cc58")}catch(e){}}();
3
- import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="22f0edf3-743a-5516-9b34-e32afe24f948")}catch(e){}}();
3
+ import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
4
4
  import { generateAll } from "@powerhousedao/codegen";
5
5
  import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
6
6
  import { extractAllDocuments, saveSpec } from "@powerhousedao/vetra/codegen";
@@ -23,10 +23,10 @@ async function startGenerateAll(args, projectDir) {
23
23
  }
24
24
  await generateAll(project);
25
25
  await project.save();
26
- warnSubgraphTypeConflicts(projectDir);
26
+ await warnSubgraphTypeConflicts(projectDir);
27
27
  }
28
28
  //#endregion
29
29
  export { startGenerateAll };
30
30
 
31
- //# sourceMappingURL=generate-all-CRfVwLJ9.mjs.map
32
- //# debugId=2d046d0a-39ff-5107-97e9-021c7478cc58
31
+ //# sourceMappingURL=generate-all-C_sPGBuk.mjs.map
32
+ //# debugId=22f0edf3-743a-5516-9b34-e32afe24f948
@@ -1 +1 @@
1
- {"version":3,"file":"generate-all-CRfVwLJ9.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { generateAll } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await generateAll(project);\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAKA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;AACtC","debug_id":"2d046d0a-39ff-5107-97e9-021c7478cc58"}
1
+ {"version":3,"file":"generate-all-C_sPGBuk.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { generateAll } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await generateAll(project);\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAKA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;AAC5C","debug_id":"22f0edf3-743a-5516-9b34-e32afe24f948"}
@@ -1,5 +1,5 @@
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]="0143deec-f1bb-5f26-a0fa-873d3d704206")}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]="2a851565-e57b-5da0-a2ab-2777204bb41a")}catch(e){}}();
3
3
  import { c as strictObject, l as string, n as array, o as number, r as boolean } from "./schemas-BQSPev1x.mjs";
4
4
  import "node:module";
5
5
  import fs from "node:fs";
@@ -7,7 +7,7 @@ import path from "node:path";
7
7
  import "node:child_process";
8
8
  import "node:url";
9
9
  import { deflateSync } from "node:zlib";
10
- //#region ../../packages/desktop/dist/shell-BL61-fyi.mjs
10
+ //#region ../../packages/desktop/dist/shell-DbRGck6R.mjs
11
11
  /**
12
12
  * `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:
13
13
  * the builder ships under THEIR identity without writing Rust). It is the ONE
@@ -208,5 +208,5 @@ function startGenerateDesktopShell(args, cwd) {
208
208
  //#endregion
209
209
  export { startGenerateDesktopShell };
210
210
 
211
- //# sourceMappingURL=generate-desktop-shell-itIzf77U.mjs.map
212
- //# debugId=0143deec-f1bb-5f26-a0fa-873d3d704206
211
+ //# sourceMappingURL=generate-desktop-shell-BBSGpmud.mjs.map
212
+ //# debugId=2a851565-e57b-5da0-a2ab-2777204bb41a
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-desktop-shell-BBSGpmud.mjs","sources":["../../../packages/desktop/dist/shell-DbRGck6R.mjs","../../../packages/desktop/dist/index.mjs","../src/services/generate-desktop-shell.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport { execSync, spawn, spawnSync } from \"node:child_process\";\nimport { pathToFileURL } from \"node:url\";\n//#region src/app-json.ts\n/**\n* `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:\n* the builder ships under THEIR identity without writing Rust). It is the ONE\n* file a builder edits; `shell-project.ts` projects it into a generated\n* `tauri-shell/` that depends on the published `ph-desktop-shell` crate. Every\n* field validates strictly so a typo fails with the field named, not silently.\n*/\nconst identifierSchema = z.string().min(1).regex(/^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/, \"identifier must be reverse-DNS (e.g. com.acme.app): dot-separated alphanumeric segments\");\nconst windowSchema = z.strictObject({\n\ttitle: z.string().min(1).optional(),\n\twidth: z.number().int().positive().optional(),\n\theight: z.number().int().positive().optional(),\n\tresizable: z.boolean().optional()\n}).optional();\nconst fileAssociationSchema = z.strictObject({\n\t/** Extensions WITHOUT the leading dot (\"phd\", not \".phd\"). */\n\text: z.array(z.string().min(1).regex(/^[^.]/, \"drop the leading dot\")).min(1),\n\tname: z.string().min(1),\n\tdescription: z.string().optional(),\n\tmimeType: z.string().optional()\n});\n/** Where the generated Cargo.toml resolves `ph-desktop-shell` from. Default\n* (omitted) = the published crates.io version. */\nconst shellSourceSchema = z.strictObject({\n\t/** Local checkout for shell development (the lab points here). */\n\tpath: z.string().min(1).optional(),\n\t/** Git source, pinned to a tag/rev, for pre-publication consumption. */\n\tgit: z.string().min(1).optional(),\n\ttag: z.string().min(1).optional(),\n\trev: z.string().min(1).optional(),\n\t/** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */\n\tversion: z.string().min(1).optional()\n}).refine((s) => !(s.path && s.git), { message: \"shell.source: set path OR git, not both\" }).optional();\nconst appJsonSchema = z.strictObject({\n\tidentifier: identifierSchema,\n\tproductName: z.string().min(1),\n\t/** Single source image (square PNG, 1024×1024 recommended); the icon set\n\t* for every platform is generated from it via `tauri icon`. */\n\ticon: z.string().min(1),\n\twindow: windowSchema,\n\tfileAssociations: z.array(fileAssociationSchema).optional(),\n\tshell: shellSourceSchema\n});\n/** Default crates.io version requirement for the shell crate (D7.b: the flip\n* to crates.io default once published — the crate is live). */\nconst DEFAULT_SHELL_CRATE_VERSION = \"0.1\";\nconst APP_JSON_FILE = \"app.json\";\n/** Read + validate hosts/<host>/app.json. Throws with the field named on a\n* bad value, and a clear message when the file is absent. */\nfunction loadAppJson(hostDir) {\n\tconst file = path.join(hostDir, APP_JSON_FILE);\n\tif (!fs.existsSync(file)) throw new Error(`No ${APP_JSON_FILE} in ${hostDir} — run \\`ph generate desktop-shell\\` to scaffold the builder identity, or set runner.shell.project to a prebuilt shell.`);\n\tlet raw;\n\ttry {\n\t\traw = JSON.parse(fs.readFileSync(file, \"utf8\"));\n\t} catch (error) {\n\t\tthrow new Error(`${file}: not valid JSON — ${String(error)}`, { cause: error });\n\t}\n\tconst result = appJsonSchema.safeParse(raw);\n\tif (!result.success) {\n\t\tconst issues = result.error.issues.map((i) => ` ${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"\\n\");\n\t\tthrow new Error(`${file} is invalid:\\n${issues}`);\n\t}\n\treturn result.data;\n}\n/** A filesystem/crate-safe slug of the product name — the generated binary\n* and Cargo package name. Falls back to the identifier's last segment. */\nfunction appSlug(app) {\n\tconst fromName = app.productName.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n\tif (fromName) return fromName;\n\treturn (app.identifier.split(\".\").pop() ?? \"app\").toLowerCase().replace(/[^a-z0-9]+/g, \"-\");\n}\n//#endregion\n//#region src/bundle-stack.ts\nfunction copyIfExists(from, to) {\n\tif (!fs.existsSync(from)) return false;\n\tfs.cpSync(from, to, { recursive: true });\n\treturn true;\n}\n/**\n* Recursively copy `src` → `dest`, skipping any path in `excludes`. Unlike\n* fs.cpSync this tolerates `dest` living INSIDE `src`: in mode 1 the generated\n* shell (and its `dist-stack`) sits under `hosts/<desktop>/`, so staging the\n* project's `hosts/` straight into the shell would be a copy-into-self that\n* cpSync rejects outright. Excluding the shell subtree both avoids that and\n* keeps the crate + node sidecar out of the shippable stack.\n*/\nfunction copyDirFiltered(src, dest, excludes) {\n\tif (!fs.existsSync(src)) return false;\n\tconst skip = new Set(excludes.map((e) => path.resolve(e)));\n\tconst walk = (s, d) => {\n\t\tif (skip.has(path.resolve(s))) return;\n\t\tif (fs.statSync(s).isDirectory()) {\n\t\t\tfs.mkdirSync(d, { recursive: true });\n\t\t\tfor (const entry of fs.readdirSync(s)) walk(path.join(s, entry), path.join(d, entry));\n\t\t} else fs.copyFileSync(s, d);\n\t};\n\twalk(src, dest);\n\treturn true;\n}\nfunction bundleStack(options) {\n\tconst log = options.logger ?? console.log;\n\tconst stackDir = path.join(options.shellProjectDir, \"dist-stack\");\n\tfor (const entry of [\n\t\t\"hosts\",\n\t\t\"agents\",\n\t\t\"dist\",\n\t\t\"powerhouse.config.json\",\n\t\t\"package.json\"\n\t]) fs.rmSync(path.join(stackDir, entry), {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tfs.mkdirSync(stackDir, { recursive: true });\n\tlog(` hosts/ ${copyDirFiltered(path.join(options.projectRoot, \"hosts\"), path.join(stackDir, \"hosts\"), options.excludeDirs ?? []) ? \"staged\" : \"absent — skipped\"}`);\n\tfor (const dir of [\"agents\", \"dist\"]) log(` ${dir}/ ${copyIfExists(path.join(options.projectRoot, dir), path.join(stackDir, dir)) ? \"staged\" : \"absent — skipped\"}`);\n\tconst stagedDesktopHost = path.join(stackDir, \"hosts\", \"desktop\", \"host.js\");\n\tif (fs.existsSync(stagedDesktopHost)) {\n\t\tconst source = fs.readFileSync(stagedDesktopHost, \"utf8\");\n\t\tif (source.includes(\"@powerhousedao/desktop/runner\")) {\n\t\t\tfs.writeFileSync(stagedDesktopHost, \"// STAGED COPY (bundle-stack): runner.module rewritten to the generic\\n// compound — the packaged shell is the window; there is no nested shell.\\n\" + source.replace(/@powerhousedao\\/desktop\\/runner/g, \"@powerhousedao/host-core/runners/compound\"));\n\t\t\tlog(\" hosts/desktop/host.js: runner rewritten to the generic compound (staged copy)\");\n\t\t}\n\t}\n\tcopyIfExists(path.join(options.projectRoot, \"powerhouse.config.json\"), path.join(stackDir, \"powerhouse.config.json\"));\n\tif (typeof options.connectPort === \"number\") {\n\t\tfs.writeFileSync(path.join(stackDir, \"shell.json\"), `${JSON.stringify({ connectPort: options.connectPort }, null, 2)}\\n`);\n\t\tlog(` shell.json: connectPort ${options.connectPort}`);\n\t}\n\tconst sourcePkg = JSON.parse(fs.readFileSync(path.join(options.projectRoot, \"package.json\"), \"utf8\"));\n\tconst version = options.phCliVersion ?? \"dev\";\n\tfs.writeFileSync(path.join(stackDir, \"package.json\"), `${JSON.stringify({\n\t\tname: sourcePkg.name ?? \"powerhouse-desktop-stack\",\n\t\tprivate: true,\n\t\ttype: \"module\",\n\t\tdependencies: { \"@powerhousedao/ph-cli\": version }\n\t}, null, 2)}\\n`);\n\tlet vendored = false;\n\tif (options.vendor !== false) {\n\t\tconst specs = `\"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}\" \"@powerhousedao/host-core@${version}\"`;\n\t\tlog(` vendoring ${specs} (hoisted, real files)…`);\n\t\tconst result = spawnSync(`npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`, {\n\t\t\tcwd: stackDir,\n\t\t\tstdio: \"pipe\",\n\t\t\tshell: true,\n\t\t\twindowsHide: true\n\t\t});\n\t\tif (result.status !== 0) throw new Error(`bundle-stack: vendoring failed (${result.status}):\\n${result.stderr.toString().slice(-800)}`);\n\t\tvendored = true;\n\t} else log(\" vendoring skipped (vendor: false) — existing tree left in place\");\n\treturn {\n\t\tstackDir,\n\t\tvendored\n\t};\n}\n//#endregion\n//#region src/shell-project.ts\n/**\n* P7.3 — project `hosts/desktop/app.json` into a generated `tauri-shell/`:\n* a STANDALONE tauri crate that depends on the published `ph-desktop-shell`\n* library, carries the builder's identity, and is built/run by the desktop\n* runner's dev/build verbs. The builder never writes Rust.\n*\n* Everything here mirrors the known-good reference app\n* (ph-desktop-shell/apps/powerhouse-desktop): the tauri plumbing (main.rs,\n* build.rs, capabilities, the loading page, externalBin + icon mechanics) is\n* copied verbatim; only identity/port fields are projected from app.json. The\n* projection is idempotent and stale-detected — a file is rewritten only when\n* its content changes, so Cargo.lock, the generated icon set, and tauri-build\n* output are never disturbed by a regen with an unchanged app.json.\n*/\nconst SHELL_DIR = \"tauri-shell\";\n/** The icon source the runner feeds to `tauri icon` (copied from app.icon). */\nconst ICON_SOURCE = \"app-icon.png\";\n/** `ph-desktop-shell` dependency line for the generated Cargo.toml, from\n* app.json's shell.source (path > git > crates.io version). */\nfunction shellDependency(source) {\n\tif (source?.path) {\n\t\tconst p = source.path.replace(/\\\\/g, \"/\");\n\t\treturn `ph-desktop-shell = { path = ${JSON.stringify(p)} }`;\n\t}\n\tif (source?.git) {\n\t\tconst parts = [`git = ${JSON.stringify(source.git)}`];\n\t\tif (source.tag) parts.push(`tag = ${JSON.stringify(source.tag)}`);\n\t\tif (source.rev) parts.push(`rev = ${JSON.stringify(source.rev)}`);\n\t\treturn `ph-desktop-shell = { ${parts.join(\", \")} }`;\n\t}\n\tconst version = source?.version ?? \"0.1\";\n\treturn `ph-desktop-shell = ${JSON.stringify(version)}`;\n}\nfunction cargoToml(app, binName) {\n\treturn `# GENERATED from ../app.json by @powerhousedao/desktop — do not edit by\n# hand; edit app.json and re-run \\`ph run desktop dev|build\\`. Cargo.lock is\n# preserved across regens.\n[package]\nname = ${JSON.stringify(binName)}\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[build-dependencies]\ntauri-build = { version = \"2\", features = [] }\n\n[dependencies]\ntauri = { version = \"2\", features = [\"tray-icon\", \"devtools\"] }\n# Plugins must be DIRECT deps of the app crate: tauri-build only sees\n# permission manifests (shell:allow-spawn etc.) from direct dependencies.\ntauri-plugin-shell = \"2\"\ntauri-plugin-single-instance = \"2\"\n${shellDependency(app.shell)}\n\n[[bin]]\nname = ${JSON.stringify(binName)}\npath = \"src/main.rs\"\n\n[profile.release]\ncodegen-units = 1\nlto = true\n`;\n}\nconst MAIN_RS = `// GENERATED — identity bakes from tauri.conf.json via generate_context!;\n// behavior is the shared ph-desktop-shell library. Edit ../app.json, not this.\n#![cfg_attr(not(debug_assertions), windows_subsystem = \"windows\")]\n\nfn main() {\n ph_desktop_shell::run(tauri::generate_context!(), Default::default());\n}\n`;\nconst BUILD_RS = `// GENERATED — mirrors the reference shell. Connect is served over\n// http://127.0.0.1 (a remote origin to Tauri), so the launch-queue commands\n// need an explicit ACL; declaring the command manifest here generates the\n// allow-<command> permissions that capabilities/*.json grant.\nfn main() {\n tauri_build::try_build(tauri_build::Attributes::new().app_manifest(\n tauri_build::AppManifest::new().commands(&[\n \"take_launch_files\",\n \"read_launch_file\",\n \"log_from_webview\",\n ]),\n ))\n .expect(\"failed to run tauri-build\");\n}\n`;\n/** The loading page's logo: app.json's icon SOURCE (1024² recommended), copied\n* beside ui/index.html — not one of the downsampled `tauri icon` outputs, so\n* it stays sharp on HiDPI screens. Generated, like the rest of ui/. */\nconst LOADING_LOGO = \"logo.png\";\n/** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */\nconst LOGO_CSS_PX = 128;\nfunction loadingHtml(productName, logo) {\n\tconst name = productName.replace(/[<&]/g, (c) => c === \"<\" ? \"&lt;\" : \"&amp;\");\n\tconst logoTag = logo ? `<img class=\"logo\" src=\"./${logo}\" width=\"${LOGO_CSS_PX}\" height=\"${LOGO_CSS_PX}\" alt=\"\" />\n ` : \"\";\n\treturn `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>${name}</title>\n <style>\n :root { color-scheme: light dark; }\n body {\n margin: 0; height: 100vh;\n display: flex; align-items: center; justify-content: center;\n font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n background: #0f1115; color: #e6e8eb;\n }\n .box {\n text-align: center;\n display: flex; flex-direction: column; align-items: center; gap: 20px;\n }\n .logo {\n width: ${LOGO_CSS_PX}px; height: ${LOGO_CSS_PX}px;\n object-fit: contain; display: block;\n }\n .dot {\n width: 10px; height: 10px; border-radius: 50%;\n background: #4ade80; display: inline-block; margin-right: 8px;\n animation: pulse 1.2s ease-in-out infinite;\n }\n @keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }\n @media (prefers-reduced-motion: reduce) { .dot { animation: none; } }\n </style>\n </head>\n <body>\n <div class=\"box\">\n ${logoTag}<div><span class=\"dot\"></span>Starting ${name}…</div>\n </div>\n </body>\n</html>\n`;\n}\nfunction tauriConf(input) {\n\tconst { app } = input;\n\tconst win = app.window ?? {};\n\tconst fileAssociations = app.fileAssociations && app.fileAssociations.length > 0 ? app.fileAssociations.map((fa) => ({\n\t\text: fa.ext,\n\t\tname: fa.name,\n\t\t...fa.description ? { description: fa.description } : {},\n\t\t...fa.mimeType ? { mimeType: fa.mimeType } : {}\n\t})) : void 0;\n\tconst conf = {\n\t\t$schema: \"https://schema.tauri.app/config/2\",\n\t\tproductName: app.productName,\n\t\tversion: \"0.1.0\",\n\t\tidentifier: app.identifier,\n\t\tbuild: { frontendDist: \"./ui\" },\n\t\tapp: {\n\t\t\twindows: [{\n\t\t\t\ttitle: win.title ?? app.productName,\n\t\t\t\twidth: win.width ?? 1440,\n\t\t\t\theight: win.height ?? 900,\n\t\t\t\tresizable: win.resizable ?? true,\n\t\t\t\tvisible: true,\n\t\t\t\tdragDropEnabled: false,\n\t\t\t\tcreate: false\n\t\t\t}],\n\t\t\tsecurity: { csp: null }\n\t\t},\n\t\tbundle: {\n\t\t\tactive: true,\n\t\t\ttargets: [\n\t\t\t\t\"nsis\",\n\t\t\t\t\"app\",\n\t\t\t\t\"dmg\"\n\t\t\t],\n\t\t\ticon: [\n\t\t\t\t\"icons/32x32.png\",\n\t\t\t\t\"icons/128x128.png\",\n\t\t\t\t\"icons/128x128@2x.png\",\n\t\t\t\t\"icons/icon.icns\",\n\t\t\t\t\"icons/icon.ico\"\n\t\t\t],\n\t\t\t...fileAssociations ? { fileAssociations } : {},\n\t\t\texternalBin: [\"binaries/node\"],\n\t\t\tresources: { \"./dist-stack\": \"stack\" }\n\t\t}\n\t};\n\treturn JSON.stringify(conf, null, 2) + \"\\n\";\n}\nfunction defaultCapability() {\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"default\",\n\t\tdescription: \"Lets the shell spawn the bundled node sidecar.\",\n\t\twindows: [\"main\"],\n\t\tpermissions: [\n\t\t\t\"core:default\",\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\",\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-spawn\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t},\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-execute\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t}\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nfunction connectCapability(connectPort) {\n\tconst origin = `http://127.0.0.1:${connectPort}`;\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"connect\",\n\t\tdescription: \"Connect is served over http://127.0.0.1 (a remote origin to Tauri); without this the launch-queue commands are rejected before they run.\",\n\t\twindows: [\"main\"],\n\t\tremote: { urls: [origin, `${origin}/*`] },\n\t\tpermissions: [\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\"\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/target\n/gen\n/icons\n/ui/logo.png\n/dist-stack\n/binaries\n`;\nconst DIST_STACK_README = `This directory is replaced at \\`ph run desktop build\\` with the shippable\nstack (hosts + powerhouse.config.json + built Connect + vendored ph-cli). It\nis bundled as the app's \\`stack\\` resource so the installed app runs with no\nenvironment. Kept as a placeholder so tauri's resource glob resolves in dev.\n`;\n/** Write a file only when its content differs; returns whether it changed. */\nfunction writeIfChanged(file, content) {\n\tif (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content) return false;\n\tfs.mkdirSync(path.dirname(file), { recursive: true });\n\tfs.writeFileSync(file, content);\n\treturn true;\n}\n/**\n* Materialize/refresh `<hostDir>/tauri-shell/` from app.json. Idempotent:\n* unchanged app.json rewrites nothing. Does NOT run `tauri icon` or fetch the\n* node binary — those are toolchain steps the runner performs at dev/build.\n*/\nfunction projectShell(input) {\n\tconst { hostDir, app, connectPort } = input;\n\tconst binName = appSlug(app);\n\tconst shellDir = path.join(hostDir, SHELL_DIR);\n\tconst iconSrc = path.resolve(hostDir, app.icon);\n\tconst iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;\n\tconst files = [\n\t\t[\"Cargo.toml\", cargoToml(app, binName)],\n\t\t[\"src/main.rs\", MAIN_RS],\n\t\t[\"build.rs\", BUILD_RS],\n\t\t[\"tauri.conf.json\", tauriConf(input)],\n\t\t[\"ui/index.html\", loadingHtml(app.productName, iconBytes ? LOADING_LOGO : null)],\n\t\t[\"capabilities/default.json\", defaultCapability()],\n\t\t[\"capabilities/connect.json\", connectCapability(connectPort)],\n\t\t[\".gitignore\", GITIGNORE],\n\t\t[\"dist-stack/README.md\", DIST_STACK_README]\n\t];\n\tlet changed = false;\n\tfor (const [rel, content] of files) if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;\n\tif (iconBytes) {\n\t\tfor (const dest of [path.join(shellDir, ICON_SOURCE), path.join(shellDir, \"ui\", LOADING_LOGO)]) if (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(iconBytes)) {\n\t\t\tfs.mkdirSync(path.dirname(dest), { recursive: true });\n\t\t\tfs.writeFileSync(dest, iconBytes);\n\t\t\tchanged = true;\n\t\t}\n\t}\n\treturn {\n\t\tshellDir,\n\t\tbinName,\n\t\tchanged\n\t};\n}\n//#endregion\n//#region src/shell-toolchain.ts\n/** The Node release triple for a build host — the sidecar filename tauri\n* resolves (`node-<triple>`). Pure, so the mapping is unit-tested. */\nfunction nodeSidecarTarget(platform, arch) {\n\tconst target = {\n\t\t\"win32 x64\": {\n\t\t\ttriple: \"x86_64-pc-windows-msvc\",\n\t\t\tdist: \"win-x64\",\n\t\t\tbin: \"node.exe\",\n\t\t\text: \".exe\"\n\t\t},\n\t\t\"darwin arm64\": {\n\t\t\ttriple: \"aarch64-apple-darwin\",\n\t\t\tdist: \"darwin-arm64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"darwin x64\": {\n\t\t\ttriple: \"x86_64-apple-darwin\",\n\t\t\tdist: \"darwin-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"linux x64\": {\n\t\t\ttriple: \"x86_64-unknown-linux-gnu\",\n\t\t\tdist: \"linux-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t}\n\t}[`${platform} ${arch}`];\n\tif (!target) throw new Error(`No Node sidecar mapping for ${platform} ${arch} — the desktop shell supports win32/x64, darwin/arm64, darwin/x64, linux/x64.`);\n\treturn target;\n}\n/** Fetch the stock Node the shell ships as its sidecar into `<shellDir>/\n* binaries`, named per target triple. No-op when already present. Ported from\n* the reference repo's fetch-node.mjs (the builder has no such script). */\nfunction fetchNodeSidecar(shellDir, version = process.versions.node, platform = process.platform, arch = process.arch) {\n\tconst target = nodeSidecarTarget(platform, arch);\n\tconst binariesDir = path.join(shellDir, \"binaries\");\n\tfs.mkdirSync(binariesDir, { recursive: true });\n\tconst dest = path.join(binariesDir, `node-${target.triple}${target.ext}`);\n\tif (fs.existsSync(dest)) return dest;\n\tif (platform === \"win32\") {\n\t\tconst url = `https://nodejs.org/dist/v${version}/win-x64/node.exe`;\n\t\texecSync(`curl -fsSL -o \"${dest}\" \"${url}\"`, { stdio: \"inherit\" });\n\t} else {\n\t\tconst name = `node-v${version}-${target.dist}`;\n\t\tconst url = `https://nodejs.org/dist/v${version}/${name}.tar.gz`;\n\t\texecSync(`curl -fsSL \"${url}\" | tar -xz -C \"${binariesDir}\" --strip-components=2 ${name}/${target.bin}`, {\n\t\t\tstdio: \"inherit\",\n\t\t\tshell: \"/bin/sh\"\n\t\t});\n\t\tfs.renameSync(path.join(binariesDir, \"node\"), dest);\n\t\tfs.chmodSync(dest, 493);\n\t}\n\treturn dest;\n}\n/** Default bundle targets for the build host (`cargo tauri build --bundles`).\n* macOS gets app+dmg, Windows nsis, Linux deb+appimage — a host only builds\n* installers it can produce. */\nfunction tauriBundlesForHost(platform = process.platform) {\n\tswitch (platform) {\n\t\tcase \"darwin\": return [\"app\", \"dmg\"];\n\t\tcase \"win32\": return [\"nsis\"];\n\t\tdefault: return [\"deb\", \"appimage\"];\n\t}\n}\n/** Spawn parameters that avoid DEP0190 (args array + shell:true): cargo on\n* Windows needs the shell for PATH/.exe + subcommand resolution — pass ONE\n* string, empty args; everything else runs argv directly (shell:false). The\n* joined tokens here are our own constants/paths, never user input. */\nfunction tauriSpawn(tauri, subcommand) {\n\tconst argv = [...tauri.prefix, ...subcommand];\n\tif (tauri.cmd === \"cargo\" && process.platform === \"win32\") return {\n\t\tcommand: [\"cargo\", ...argv].join(\" \"),\n\t\targs: [],\n\t\tshell: true\n\t};\n\treturn {\n\t\tcommand: tauri.cmd,\n\t\targs: argv,\n\t\tshell: false\n\t};\n}\nfunction probe(cmd, args) {\n\tconst onWin = process.platform === \"win32\";\n\ttry {\n\t\treturn spawnSync(onWin ? [cmd, ...args].join(\" \") : cmd, onWin ? [] : args, {\n\t\t\tstdio: \"ignore\",\n\t\t\tshell: onWin\n\t\t}).status === 0;\n\t} catch {\n\t\treturn false;\n\t}\n}\n/** Is a Rust `cargo` on PATH? (needed to compile the shell crate). */\nfunction hasCargo() {\n\treturn probe(\"cargo\", [\"--version\"]);\n}\n/** Resolve a Tauri CLI: a global `cargo tauri`, else a `@tauri-apps/cli`\n* resolvable from the project. Returns null when neither is available. */\nfunction resolveTauriCommand(projectRoot) {\n\tif (probe(\"cargo\", [\"tauri\", \"--version\"])) return {\n\t\tcmd: \"cargo\",\n\t\tprefix: [\"tauri\"],\n\t\tvia: \"cargo-tauri\"\n\t};\n\ttry {\n\t\tconst pkgJson = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@tauri-apps/cli/package.json\");\n\t\tconst pkgDir = path.dirname(pkgJson);\n\t\tconst bin = JSON.parse(fs.readFileSync(pkgJson, \"utf8\")).bin;\n\t\tconst rel = typeof bin === \"string\" ? bin : bin?.tauri;\n\t\tif (rel) return {\n\t\t\tcmd: process.execPath,\n\t\t\tprefix: [path.join(pkgDir, rel)],\n\t\t\tvia: \"node-cli\"\n\t\t};\n\t} catch {}\n\treturn null;\n}\nfunction detectToolchain(projectRoot) {\n\treturn {\n\t\tcargo: hasCargo(),\n\t\ttauri: resolveTauriCommand(projectRoot)\n\t};\n}\n/** Throw a clear, actionable error when the native toolchain is incomplete —\n* the desktop verbs call this before any cargo work so a missing executable\n* is an instruction, not a stack trace. */\nfunction preflightOrThrow(tc, hostName) {\n\tconst missing = [];\n\tif (!tc.cargo) missing.push(\" • Rust/cargo — install from https://rustup.rs (then restart your shell)\");\n\tif (!tc.tauri) missing.push(\" • Tauri CLI — `cargo install tauri-cli --version \\\"^2\\\"` (or add @tauri-apps/cli@^2 to your project's devDependencies)\");\n\tif (missing.length > 0 || !tc.tauri) throw new Error(`hosts/${hostName}: the desktop shell needs a native toolchain that is not installed:\\n${missing.join(\"\\n\")}\\nInstall the above, then re-run \\`ph run ${hostName} dev\\` / \\`ph run ${hostName} build\\`. (The headless stack — \\`ph run ${hostName}\\` — needs none of this.)`);\n\treturn tc.tauri;\n}\n/** `<tauri> icon <source>` — generates the per-platform icon set (icon.ico +\n* icon.icns + pngs) the bundle references and tauri-build requires. */\nfunction runTauriIcon(tauri, shellDir, iconSource) {\n\tconst { command, args, shell } = tauriSpawn(tauri, [\"icon\", iconSource]);\n\tconst r = spawnSync(command, args, {\n\t\tcwd: shellDir,\n\t\tstdio: \"inherit\",\n\t\tshell\n\t});\n\tif (r.status !== 0) throw new Error(`\\`tauri icon ${iconSource}\\` failed (exit ${r.status ?? \"?\"}) in ${shellDir} — check that app.icon is a square PNG.`);\n}\n//#endregion\n//#region src/shell.ts\nfunction resolveShell(projectRoot, options, env) {\n\tconst configured = options?.project ?? env.PH_DESKTOP_SHELL;\n\tif (!configured) throw new Error(\"No desktop shell configured: set runner.shell.project in the host file (path to a ph-win-desktop checkout) or the PH_DESKTOP_SHELL environment variable. `ph run desktop` (headless stack) needs neither.\");\n\tconst projectDir = path.resolve(projectRoot, configured);\n\tif (!fs.existsSync(path.join(projectDir, \"src-tauri\"))) throw new Error(`Desktop shell not found at ${projectDir} (no src-tauri/) — check runner.shell.project / PH_DESKTOP_SHELL.`);\n\treturn {\n\t\tprojectDir,\n\t\texe: [\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win\")\n\t\t].find((c) => fs.existsSync(c))\n\t};\n}\n/** Resolve the project's ph-cli entry from ITS dependency tree — the same\n* resolution `ph run` itself uses. */\nfunction resolvePhCliEntry(projectRoot) {\n\tconst pkgPath = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@powerhousedao/ph-cli/package.json\");\n\treturn path.join(path.dirname(pkgPath), \"dist\", \"cli.mjs\");\n}\n/** The env trio (plus flag and userData) the shell's uniform-runners mode\n* reads — wired by the RUNNER so nobody exports variables by hand. */\nfunction shellEnv(projectRoot, connectPort, env) {\n\treturn {\n\t\tFEATURE_UNIFORM_RUNNERS_ENABLED: \"1\",\n\t\tPH_RUN_PROJECT: projectRoot,\n\t\tPH_RUN_CLI: resolvePhCliEntry(projectRoot),\n\t\tPH_WIN_CONNECT_PORT: String(connectPort),\n\t\t...env.PH_USER_DATA_DIR ? { PH_USER_DATA_DIR: env.PH_USER_DATA_DIR } : {}\n\t};\n}\n/** Project host shell options onto a tauri `--config` merge patch (D6.d) —\n* the host file stays the single source for app identity on tauri-cli\n* invocations; a built exe has these baked. */\nfunction tauriConfigPatch(options) {\n\tif (!options) return void 0;\n\tconst patch = {};\n\tif (options.window) patch.app = { windows: [{\n\t\t...options.window.title ? { title: options.window.title } : {},\n\t\t...options.window.width ? { width: options.window.width } : {},\n\t\t...options.window.height ? { height: options.window.height } : {}\n\t}] };\n\tif (options.fileAssociations?.length) patch.bundle = { fileAssociations: [{\n\t\text: options.fileAssociations.map((e) => e.replace(/^\\./, \"\")),\n\t\tname: \"Powerhouse Document\"\n\t}] };\n\treturn Object.keys(patch).length > 0 ? patch : void 0;\n}\nfunction launchShell(shell, envVars, options) {\n\tif (shell.exe) return spawn(shell.exe, [], {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\twindowsHide: true\n\t});\n\tconst patch = tauriConfigPatch(options);\n\tconst args = [\"tauri\", \"dev\"];\n\tif (patch) args.push(\"--config\", JSON.stringify(patch));\n\treturn spawn(\"pnpm\", args, {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\tshell: true,\n\t\twindowsHide: true\n\t});\n}\n//#endregion\nexport { loadAppJson as S, bundleStack as _, tauriConfigPatch as a, appJsonSchema as b, nodeSidecarTarget as c, runTauriIcon as d, tauriBundlesForHost as f, projectShell as g, SHELL_DIR as h, shellEnv as i, preflightOrThrow as l, ICON_SOURCE as m, resolvePhCliEntry as n, detectToolchain as o, tauriSpawn as p, resolveShell as r, fetchNodeSidecar as s, launchShell as t, resolveTauriCommand as u, APP_JSON_FILE as v, appSlug as x, DEFAULT_SHELL_CRATE_VERSION as y };\n\n//# sourceMappingURL=shell-DbRGck6R.mjs.map","import { S as loadAppJson, _ as bundleStack, a as tauriConfigPatch, b as appJsonSchema, c as nodeSidecarTarget, d as runTauriIcon, f as tauriBundlesForHost, g as projectShell, h as SHELL_DIR, i as shellEnv, l as preflightOrThrow, m as ICON_SOURCE, n as resolvePhCliEntry, o as detectToolchain, r as resolveShell, s as fetchNodeSidecar, t as launchShell, u as resolveTauriCommand, v as APP_JSON_FILE, x as appSlug, y as DEFAULT_SHELL_CRATE_VERSION } from \"./shell-DbRGck6R.mjs\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { deflateSync } from \"node:zlib\";\n//#region src/scaffold.ts\n/** Minimal PNG encoder — a solid square so `tauri icon` always has a valid\n* source. Pure Node (zlib); no binary asset ships in the package. The builder\n* replaces it with their real 1024×1024 artwork. */\nfunction solidPng(size, rgba) {\n\tconst [r, g, b, a] = rgba;\n\tconst row = Buffer.alloc(1 + size * 4);\n\tfor (let x = 0; x < size; x++) {\n\t\tconst o = 1 + x * 4;\n\t\trow[o] = r;\n\t\trow[o + 1] = g;\n\t\trow[o + 2] = b;\n\t\trow[o + 3] = a;\n\t}\n\tconst raw = Buffer.concat(Array.from({ length: size }, () => row));\n\tconst idat = deflateSync(raw);\n\tconst chunk = (type, data) => {\n\t\tconst len = Buffer.alloc(4);\n\t\tlen.writeUInt32BE(data.length, 0);\n\t\tconst typeBuf = Buffer.from(type, \"ascii\");\n\t\tconst body = Buffer.concat([typeBuf, data]);\n\t\tconst crc = Buffer.alloc(4);\n\t\tcrc.writeUInt32BE(crc32(body) >>> 0, 0);\n\t\treturn Buffer.concat([\n\t\t\tlen,\n\t\t\tbody,\n\t\t\tcrc\n\t\t]);\n\t};\n\tconst ihdr = Buffer.alloc(13);\n\tihdr.writeUInt32BE(size, 0);\n\tihdr.writeUInt32BE(size, 4);\n\tihdr[8] = 8;\n\tihdr[9] = 6;\n\tihdr[10] = 0;\n\tihdr[11] = 0;\n\tihdr[12] = 0;\n\treturn Buffer.concat([\n\t\tBuffer.from([\n\t\t\t137,\n\t\t\t80,\n\t\t\t78,\n\t\t\t71,\n\t\t\t13,\n\t\t\t10,\n\t\t\t26,\n\t\t\t10\n\t\t]),\n\t\tchunk(\"IHDR\", ihdr),\n\t\tchunk(\"IDAT\", idat),\n\t\tchunk(\"IEND\", Buffer.alloc(0))\n\t]);\n}\nlet crcTable;\nfunction crc32(buf) {\n\tif (!crcTable) {\n\t\tcrcTable = [];\n\t\tfor (let n = 0; n < 256; n++) {\n\t\t\tlet c = n;\n\t\t\tfor (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;\n\t\t\tcrcTable[n] = c;\n\t\t}\n\t}\n\tlet crc = 4294967295;\n\tfor (let i = 0; i < buf.length; i++) crc = crcTable[(crc ^ buf[i]) & 255] ^ crc >>> 8;\n\treturn crc ^ 4294967295;\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/tauri-shell/target\n/tauri-shell/gen\n/tauri-shell/icons\n/tauri-shell/dist-stack\n/tauri-shell/binaries\n`;\nfunction scaffoldDesktopShell(hostDir, options) {\n\tconst created = [];\n\tconst skipped = [];\n\tfs.mkdirSync(hostDir, { recursive: true });\n\tconst iconFile = \"icon.png\";\n\tconst app = {\n\t\tidentifier: options.identifier,\n\t\tproductName: options.productName,\n\t\ticon: `./${iconFile}`,\n\t\twindow: {\n\t\t\ttitle: options.productName,\n\t\t\twidth: 1440,\n\t\t\theight: 900\n\t\t},\n\t\tfileAssociations: [{\n\t\t\text: [\"phd\"],\n\t\t\tname: \"Powerhouse Document\",\n\t\t\tmimeType: \"application/vnd.powerhouse.document+zip\"\n\t\t}]\n\t};\n\tappJsonSchema.parse(app);\n\tconst appJsonPath = path.join(hostDir, APP_JSON_FILE);\n\tif (fs.existsSync(appJsonPath) && !options.force) skipped.push(appJsonPath);\n\telse {\n\t\tfs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\\n`);\n\t\tcreated.push(appJsonPath);\n\t}\n\tconst iconPath = path.join(hostDir, iconFile);\n\tif (fs.existsSync(iconPath)) skipped.push(iconPath);\n\telse {\n\t\tfs.writeFileSync(iconPath, solidPng(1024, [\n\t\t\t79,\n\t\t\t70,\n\t\t\t229,\n\t\t\t255\n\t\t]));\n\t\tcreated.push(iconPath);\n\t}\n\tconst gitignorePath = path.join(hostDir, \".gitignore\");\n\tif (fs.existsSync(gitignorePath)) skipped.push(gitignorePath);\n\telse {\n\t\tfs.writeFileSync(gitignorePath, GITIGNORE);\n\t\tcreated.push(gitignorePath);\n\t}\n\treturn {\n\t\thostDir,\n\t\tcreated,\n\t\tskipped\n\t};\n}\n//#endregion\nexport { APP_JSON_FILE, DEFAULT_SHELL_CRATE_VERSION, ICON_SOURCE, SHELL_DIR, appJsonSchema, appSlug, bundleStack, detectToolchain, fetchNodeSidecar, launchShell, loadAppJson, nodeSidecarTarget, preflightOrThrow, projectShell, resolvePhCliEntry, resolveShell, resolveTauriCommand, runTauriIcon, scaffoldDesktopShell, shellEnv, solidPng, tauriBundlesForHost, tauriConfigPatch };\n\n//# sourceMappingURL=index.mjs.map","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { scaffoldDesktopShell } from \"@powerhousedao/desktop\";\n\nexport interface GenerateDesktopShellArgs {\n name?: string;\n identifier?: string;\n force?: boolean;\n}\n\n/** A reverse-DNS-safe segment from the project name (drop scope, slugify). */\nfunction projectSlug(pkgName: string | undefined): string {\n const bare = (pkgName ?? \"app\").replace(/^@[^/]+\\//, \"\");\n const seg = bare\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n return seg || \"app\";\n}\n\n/** `ph generate desktop-shell`: write hosts/desktop/app.json + a placeholder\n * icon + .gitignore. Defaults product name / identifier from the project. */\nexport function startGenerateDesktopShell(\n args: GenerateDesktopShellArgs,\n cwd: string,\n): void {\n let pkgName: string | undefined;\n try {\n const pkg = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n pkgName = pkg.name;\n } catch {\n // no package.json — fall back to defaults below\n }\n const slug = projectSlug(pkgName);\n const productName = args.name ?? pkgName?.replace(/^@[^/]+\\//, \"\") ?? \"App\";\n const identifier = args.identifier ?? `inc.powerhouse.desktop.${slug}`;\n\n const hostDir = path.join(cwd, \"hosts\", \"desktop\");\n const result = scaffoldDesktopShell(hostDir, {\n identifier,\n productName,\n force: args.force,\n });\n\n const rel = (p: string) => path.relative(cwd, p).replace(/\\\\/g, \"/\");\n for (const f of result.created) console.log(` created ${rel(f)}`);\n for (const f of result.skipped) {\n console.log(` skipped ${rel(f)} (exists — pass --force to overwrite)`);\n }\n if (!fs.existsSync(path.join(hostDir, \"host.js\"))) {\n console.log(\n `\\nNote: hosts/desktop/host.js not found. Add a desktop host (see the ` +\n `desktop topology from \\`ph init\\`) so \\`ph run desktop\\` can supervise ` +\n `the stack; app.json then gives it a native window.`,\n );\n }\n console.log(\n `\\nIdentity: ${productName} (${identifier}).\\n` +\n `• Replace hosts/desktop/icon.png with your 1024×1024 icon.\\n` +\n `• \\`ph run desktop dev\\` opens the native window (needs Rust + the Tauri CLI).\\n` +\n `• \\`ph run desktop build\\` produces installers for this OS.`,\n );\n}\n"],"names":["z.string","z.strictOb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AAI,WAAW,4MAI5C;AACF","debug_id":"2a851565-e57b-5da0-a2ab-2777204bb41a"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49439419-5f64-5ecf-a840-c46e50265dc2")}catch(e){}}();
3
- import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="47909a1f-ed7f-5d8f-b920-cc584f7f1d11")}catch(e){}}();
3
+ import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
4
4
  import { dirname, join } from "node:path";
5
5
  import { generateAllDocumentModels, generateDocumentModel, loadDocumentModel } from "@powerhousedao/codegen";
6
6
  import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
@@ -37,10 +37,10 @@ async function startGenerateDocumentModel(args, projectDir) {
37
37
  return;
38
38
  }
39
39
  await project.save();
40
- warnSubgraphTypeConflicts(projectDir);
40
+ await warnSubgraphTypeConflicts(projectDir);
41
41
  }
42
42
  //#endregion
43
43
  export { startGenerateDocumentModel };
44
44
 
45
- //# sourceMappingURL=generate-document-model-ChkXjM1s.mjs.map
46
- //# debugId=49439419-5f64-5ecf-a840-c46e50265dc2
45
+ //# sourceMappingURL=generate-document-model-BfFIQ35q.mjs.map
46
+ //# debugId=47909a1f-ed7f-5d8f-b920-cc584f7f1d11
@@ -1 +1 @@
1
- {"version":3,"file":"generate-document-model-ChkXjM1s.mjs","sources":["../src/services/generate-document-model.ts"],"sourcesContent":["import {\n generateAllDocumentModels,\n generateDocumentModel,\n loadDocumentModel,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n generateDocumentModelFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { dirname, join } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { 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 = extractDocumentModelDocuments(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 generateAllDocumentModels(project);\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await generateDocumentModelFromDocument(doc, project);\n } else {\n const state = await loadDocumentModel(document);\n await generateDocumentModel(state, project);\n }\n } else if (dir) {\n const documentModelDirName = dirname(dir);\n const documentModelFileName = `${documentModelDirName}.json`;\n const documentModelFilePath = join(dir, documentModelFileName);\n const state = await loadDocumentModel(documentModelFilePath);\n await generateDocumentModel(state, project);\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;;AAiBA,eAAsB,2BACpB,MACA,YACA;CACA,MAAM,EAAE,UAAU,KAAK,KAAK,SAAS,UAAU;CAC/C,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,8BAA8B,OAAO;EAClD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,0BAA0B,OAAO;MAClC,IAAI,UAAU;EACnB,IAAI,SAAS,SAAS,MAAM,GAAG;GAC7B,MAAM,MAAO,MAAM,YAAY,QAAQ;GACvC,MAAM,kCAAkC,KAAK,OAAO;EACtD,OAAO;GACL,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;GAC9C,MAAM,sBAAsB,OAAO,OAAO;EAC5C;CACF,OAAO,IAAI,KAAK;EAEd,MAAM,wBAAwB,GADD,QAAQ,GACe,EAAE;EACtD,MAAM,wBAAwB,KAAK,KAAK,qBAAqB;EAC7D,MAAM,QAAQ,MAAM,kBAAkB,qBAAqB;EAC3D,MAAM,sBAAsB,OAAO,OAAO;CAC5C,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;AACtC","debug_id":"49439419-5f64-5ecf-a840-c46e50265dc2"}
1
+ {"version":3,"file":"generate-document-model-BfFIQ35q.mjs","sources":["../src/services/generate-document-model.ts"],"sourcesContent":["import {\n generateAllDocumentModels,\n generateDocumentModel,\n loadDocumentModel,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n generateDocumentModelFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { dirname, join } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { 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 = extractDocumentModelDocuments(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 generateAllDocumentModels(project);\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await generateDocumentModelFromDocument(doc, project);\n } else {\n const state = await loadDocumentModel(document);\n await generateDocumentModel(state, project);\n }\n } else if (dir) {\n const documentModelDirName = dirname(dir);\n const documentModelFileName = `${documentModelDirName}.json`;\n const documentModelFilePath = join(dir, documentModelFileName);\n const state = await loadDocumentModel(documentModelFilePath);\n await generateDocumentModel(state, project);\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;;AAiBA,eAAsB,2BACpB,MACA,YACA;CACA,MAAM,EAAE,UAAU,KAAK,KAAK,SAAS,UAAU;CAC/C,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,8BAA8B,OAAO;EAClD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,0BAA0B,OAAO;MAClC,IAAI,UAAU;EACnB,IAAI,SAAS,SAAS,MAAM,GAAG;GAC7B,MAAM,MAAO,MAAM,YAAY,QAAQ;GACvC,MAAM,kCAAkC,KAAK,OAAO;EACtD,OAAO;GACL,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;GAC9C,MAAM,sBAAsB,OAAO,OAAO;EAC5C;CACF,OAAO,IAAI,KAAK;EAEd,MAAM,wBAAwB,GADD,QAAQ,GACe,EAAE;EACtD,MAAM,wBAAwB,KAAK,KAAK,qBAAqB;EAC7D,MAAM,QAAQ,MAAM,kBAAkB,qBAAqB;EAC3D,MAAM,sBAAsB,OAAO,OAAO;CAC5C,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;AAC5C","debug_id":"47909a1f-ed7f-5d8f-b920-cc584f7f1d11"}
@@ -1,7 +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]="199c47bd-ca2f-5628-a312-bbde798073fb")}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]="d05a8220-dc34-567a-ab62-d546d97acd40")}catch(e){}}();
3
3
  import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
4
- import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
4
+ import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
5
5
  import { dirname } from "node:path";
6
6
  import { detectFeatures, generateAllSubgraphs, generateSubgraph, syncFeatureDependencies } from "@powerhousedao/codegen";
7
7
  import { buildTsMorphProject, getSubgraphMetadata } from "@powerhousedao/codegen/utils";
@@ -33,12 +33,12 @@ async function startGenerateSubgraph(args, projectDir) {
33
33
  return;
34
34
  }
35
35
  await project.save();
36
- warnSubgraphTypeConflicts(projectDir);
36
+ await warnSubgraphTypeConflicts(projectDir);
37
37
  const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
38
38
  await installAddedDependencies(added, projectDir, args.skipInstall);
39
39
  }
40
40
  //#endregion
41
41
  export { startGenerateSubgraph };
42
42
 
43
- //# sourceMappingURL=generate-subgraph-DmcQWVbd.mjs.map
44
- //# debugId=199c47bd-ca2f-5628-a312-bbde798073fb
43
+ //# sourceMappingURL=generate-subgraph-CVlTo7qk.mjs.map
44
+ //# debugId=d05a8220-dc34-567a-ab62-d546d97acd40
@@ -1 +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"}
1
+ {"version":3,"file":"generate-subgraph-CVlTo7qk.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 await 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,MAAM,0BAA0B,UAAU;CAC1C,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"d05a8220-dc34-567a-ab62-d546d97acd40"}
@@ -1,13 +1,14 @@
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]="743f1b82-6dd0-55e7-988d-09d953939295")}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]="8b037b72-27ec-544b-9928-7e9ec61810d6")}catch(e){}}();
3
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-BQSPev1x.mjs";
4
4
  import { a as pluginEntrySchema } from "./plugins-CHVv4qup.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
7
7
  import path from "node:path";
8
8
  import { pathToFileURL } from "node:url";
9
+ import "@powerhousedao/shared/clis/ph-dir";
9
10
  import crypto from "node:crypto";
10
- //#region ../../packages/host-core/dist/host-schemas-CL_wFpY7.mjs
11
+ //#region ../../packages/host-core/dist/host-schemas-CtPNRr5v.mjs
11
12
  /**
12
13
  * Instance-fact projection for compound hosts: the drives a compound's
13
14
  * reactor member created, projected into the Connect member's runtime-config
@@ -381,6 +382,10 @@ const reactorProtocolSchema = strictObject({
381
382
  createSignaturePolicy: _enum(["legacy", "v2-required"]).optional(),
382
383
  unsupportedStoredDocuments: _enum(["refuse", "read-only"]).optional()
383
384
  });
385
+ const samePath = (a, b) => {
386
+ const norm = (p) => p.replace(/\\/g, "/").replace(/\/+$/, "").replace(/^\.\//, "");
387
+ return norm(a) === norm(b);
388
+ };
384
389
  const reactorBackendSchema = strictObject({
385
390
  kind: _enum([
386
391
  "in-process",
@@ -412,6 +417,15 @@ const reactorBackendSchema = strictObject({
412
417
  dbPoolSize: number().int().positive().optional()
413
418
  }).optional(),
414
419
  executors: strictObject({ numWorkers: union([number().int().positive(), literal("auto")]).optional() }).optional()
420
+ }).superRefine((backend, ctx) => {
421
+ const store = backend.storage;
422
+ const storeDir = store?.kind === "path" ? store.dataDir : void 0;
423
+ const readModel = backend.readModel?.url;
424
+ if (storeDir && readModel && samePath(storeDir, readModel)) ctx.addIssue({
425
+ code: "custom",
426
+ path: ["readModel", "url"],
427
+ message: `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.`
428
+ });
415
429
  });
416
430
  const reactorSchema = strictObject({
417
431
  backends: record(string(), reactorBackendSchema).optional(),
@@ -475,5 +489,5 @@ looseObject({
475
489
  //#endregion
476
490
  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
491
 
478
- //# sourceMappingURL=host-schemas-CL_wFpY7-B_pY14Jy.mjs.map
479
- //# debugId=743f1b82-6dd0-55e7-988d-09d953939295
492
+ //# sourceMappingURL=host-schemas-CtPNRr5v-BQyKKFbS.mjs.map
493
+ //# debugId=8b037b72-27ec-544b-9928-7e9ec61810d6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-schemas-CtPNRr5v-BQyKKFbS.mjs","sources":["../../../packages/host-core/dist/host-schemas-CtPNRr5v.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 { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\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(resolvePhDir(projectDir), \"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}/.ph/reactor-storage` and the RUNNER\n* resolves it at start. `${userData}` is a PROJECT-SHAPED root: its `.ph`\n* subtree carries the same names the classic commands use under\n* `<project>/.ph` (see `resolvePhDir`). In the CLI it IS the project root, so\n* `ph run desktop` in a project shares the one `.ph` tree `ph vetra` uses;\n* a shell (Tauri) points it at the OS profile via PH_USER_DATA_DIR, and the\n* whole `.ph` tree — stores, identity, run records — follows.\n*/\nfunction defaultUserDataDir(projectRoot, env = process.env) {\n\treturn env.PH_USER_DATA_DIR ?? path.resolve(projectRoot);\n}\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 samePath = (a, b) => {\n\tconst norm = (p) => p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").replace(/^\\.\\//, \"\");\n\treturn norm(a) === norm(b);\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}).superRefine((backend, ctx) => {\n\tconst store = backend.storage;\n\tconst storeDir = store?.kind === \"path\" ? store.dataDir : void 0;\n\tconst readModel = backend.readModel?.url;\n\tif (storeDir && readModel && samePath(storeDir, readModel)) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tpath: [\"readModel\", \"url\"],\n\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});\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-CtPNRr5v.mjs.map"],"names":["z.strictObject","z.string","z.boolean","z.enum","z.array","z.number","z.union","z.literal","z.record","z.looseObject"],"mappings":";;;;;;;;;;;;;;;;;AAeA,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,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