@powerhousedao/ph-cli 6.4.0-next.1 → 6.4.0-next.3

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 (107) hide show
  1. package/README.md +6 -5
  2. package/dist/{build-C490lBnu.mjs → build-B-rPwjM8.mjs} +7 -7
  3. package/dist/{build-C490lBnu.mjs.map → build-B-rPwjM8.mjs.map} +1 -1
  4. package/dist/build-DuwAPWMY.mjs +4 -0
  5. package/dist/{check-DIK1LTss.mjs → check-B7C3Vi_b.mjs} +4 -4
  6. package/dist/{check-DIK1LTss.mjs.map → check-B7C3Vi_b.mjs.map} +1 -1
  7. package/dist/{check-D84ta1Dh.mjs → check-DM7UdFTK.mjs} +4 -4
  8. package/dist/{check-D84ta1Dh.mjs.map → check-DM7UdFTK.mjs.map} +1 -1
  9. package/dist/{check-F3nwJiG-.mjs → check-DeUTd514.mjs} +3 -3
  10. package/dist/{cli-connect-override-BMU4Qldg.mjs → cli-connect-override-Bx_g3-ZE.mjs} +4 -4
  11. package/dist/{cli-connect-override-BMU4Qldg.mjs.map → cli-connect-override-Bx_g3-ZE.mjs.map} +1 -1
  12. package/dist/cli.mjs +8 -8
  13. package/dist/cli.mjs.map +1 -1
  14. package/dist/{compound-BWLJ0KBw-8hKyrfjG.mjs → compound-Q9sZSEZF-DQvtoigb.mjs} +6 -6
  15. package/dist/compound-Q9sZSEZF-DQvtoigb.mjs.map +1 -0
  16. package/dist/{connect-build-DW1fFVbU.mjs → connect-build-CaTxdYcc.mjs} +5 -5
  17. package/dist/{connect-build-DW1fFVbU.mjs.map → connect-build-CaTxdYcc.mjs.map} +1 -1
  18. package/dist/{connect-config-DVubBBLb.mjs → connect-config-A-U83U8U.mjs} +4 -4
  19. package/dist/{connect-config-DVubBBLb.mjs.map → connect-config-A-U83U8U.mjs.map} +1 -1
  20. package/dist/{connect-studio-CQC-LDSg.mjs → connect-studio-B2gugCJU.mjs} +4 -4
  21. package/dist/{connect-studio-CQC-LDSg.mjs.map → connect-studio-B2gugCJU.mjs.map} +1 -1
  22. package/dist/definitions-worker.mjs +1 -1
  23. package/dist/dev-host-RhWeATKB.mjs +19 -0
  24. package/dist/dev-host-RhWeATKB.mjs.map +1 -0
  25. package/dist/{dist-BFMRL5C0.mjs → dist-D_UjZsgt.mjs} +4 -4
  26. package/dist/dist-D_UjZsgt.mjs.map +1 -0
  27. package/dist/{explain-YPD3n6t8.mjs → explain-DbbHpa61.mjs} +5 -5
  28. package/dist/{explain-YPD3n6t8.mjs.map → explain-DbbHpa61.mjs.map} +1 -1
  29. package/dist/{export-DjQL6zkr.mjs → export-FduYVQEM.mjs} +4 -4
  30. package/dist/{export-DjQL6zkr.mjs.map → export-FduYVQEM.mjs.map} +1 -1
  31. package/dist/{files-D6_euBBn.mjs → files-DEHg350R.mjs} +4 -4
  32. package/dist/{files-D6_euBBn.mjs.map → files-DEHg350R.mjs.map} +1 -1
  33. package/dist/{generate-all-BLot_H9Z.mjs → generate-all-BE8UmbJv.mjs} +6 -21
  34. package/dist/generate-all-BE8UmbJv.mjs.map +1 -0
  35. package/dist/{generate-app-hm6CJ_4O.mjs → generate-app-C7n0j8Ak.mjs} +5 -18
  36. package/dist/generate-app-C7n0j8Ak.mjs.map +1 -0
  37. package/dist/{generate-document-model-BiD6ovXc.mjs → generate-document-model-DSYPTMZg.mjs} +9 -31
  38. package/dist/generate-document-model-DSYPTMZg.mjs.map +1 -0
  39. package/dist/{generate-editor-DBj_Pxwa.mjs → generate-editor-DKuRUeIt.mjs} +5 -18
  40. package/dist/generate-editor-DKuRUeIt.mjs.map +1 -0
  41. package/dist/{generate-processor-BVjOsfjJ.mjs → generate-processor-CwJvJDpd.mjs} +5 -18
  42. package/dist/generate-processor-CwJvJDpd.mjs.map +1 -0
  43. package/dist/{generate-subgraph-DJZCr0Tk.mjs → generate-subgraph-EQ2ZjMp9.mjs} +6 -25
  44. package/dist/generate-subgraph-EQ2ZjMp9.mjs.map +1 -0
  45. package/dist/{get-version-CcYVboCW.mjs → get-version-7oKMD8Gt.mjs} +4 -4
  46. package/dist/{get-version-CcYVboCW.mjs.map → get-version-7oKMD8Gt.mjs.map} +1 -1
  47. package/dist/{index-D3H9pQ8u.d.mts → index-Bs1PfL3W.d.mts} +17 -4
  48. package/dist/index-Bs1PfL3W.d.mts.map +1 -0
  49. package/dist/{mcp-B3l1mtBq.mjs → mcp-CcZT9zT9.mjs} +8 -8
  50. package/dist/mcp-CcZT9zT9.mjs.map +1 -0
  51. package/dist/{migrate-CzcBEypc.mjs → migrate-Ddr7YAtM.mjs} +4 -4
  52. package/dist/{migrate-CzcBEypc.mjs.map → migrate-Ddr7YAtM.mjs.map} +1 -1
  53. package/dist/{migrate-document-models-D0HSo4WN.mjs → migrate-document-models-X_mVTljj.mjs} +4 -4
  54. package/dist/{migrate-document-models-D0HSo4WN.mjs.map → migrate-document-models-X_mVTljj.mjs.map} +1 -1
  55. package/dist/migrate-subgraphs-DEqWkLoh.mjs +4 -0
  56. package/dist/{migrate-subgraphs-CfSMlcJD.mjs → migrate-subgraphs-Ffwwm7Oy.mjs} +5 -5
  57. package/dist/{migrate-subgraphs-CfSMlcJD.mjs.map → migrate-subgraphs-Ffwwm7Oy.mjs.map} +1 -1
  58. package/dist/{ph-cli-commands-CQXdWQ74.mjs → ph-cli-commands-D4Z6YSwd.mjs} +39 -104
  59. package/dist/ph-cli-commands-D4Z6YSwd.mjs.map +1 -0
  60. package/dist/ph-cli-commands-p9cO6MsE.mjs +4 -0
  61. package/dist/{run-sugar-hGKprsKz.mjs → run-sugar-CkuGJuPg.mjs} +16 -8
  62. package/dist/run-sugar-CkuGJuPg.mjs.map +1 -0
  63. package/dist/{run-sugar-BfnRBv7h.mjs → run-sugar-Dd_Mu058.mjs} +3 -3
  64. package/dist/runners/connect.d.mts +1 -1
  65. package/dist/runners/connect.mjs +2 -2
  66. package/dist/runners/switchboard.d.mts +1 -1
  67. package/dist/runners/switchboard.mjs +3 -3
  68. package/dist/{sugar-checks-CTCsK5DJ.mjs → sugar-checks-CAtgUIem.mjs} +16 -15
  69. package/dist/sugar-checks-CAtgUIem.mjs.map +1 -0
  70. package/dist/{verify-NK6a_7j8.mjs → verify-DXrs0JUp.mjs} +5 -5
  71. package/dist/{verify-NK6a_7j8.mjs.map → verify-DXrs0JUp.mjs.map} +1 -1
  72. package/dist/{vetra-gateway-BxcduYAI.mjs → vetra-gateway-BHuz7pvS.mjs} +5 -5
  73. package/dist/{vetra-gateway-BxcduYAI.mjs.map → vetra-gateway-BHuz7pvS.mjs.map} +1 -1
  74. package/dist/vetra-gateway-ag33E_Ta.mjs +4 -0
  75. package/dist/{vetra-host-BrLdIMRP.mjs → vetra-host-CYdbd3J3.mjs} +28 -11
  76. package/dist/vetra-host-CYdbd3J3.mjs.map +1 -0
  77. package/dist/{vetra-launcher-Dokr1aDK.mjs → vetra-launcher-B5L3yXPo.mjs} +16 -13
  78. package/dist/vetra-launcher-B5L3yXPo.mjs.map +1 -0
  79. package/dist/vetra-launcher-BUO9e74r.mjs +4 -0
  80. package/dist/{vetra-instance-CPNIsaxh.mjs → vetra-runtime-Bk6CW-BE.mjs} +7 -25
  81. package/dist/vetra-runtime-Bk6CW-BE.mjs.map +1 -0
  82. package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs +131 -0
  83. package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map +1 -0
  84. package/package.json +15 -16
  85. package/dist/build-DblrRe4z.mjs +0 -4
  86. package/dist/compound-BWLJ0KBw-8hKyrfjG.mjs.map +0 -1
  87. package/dist/dist-BFMRL5C0.mjs.map +0 -1
  88. package/dist/generate-all-BLot_H9Z.mjs.map +0 -1
  89. package/dist/generate-app-hm6CJ_4O.mjs.map +0 -1
  90. package/dist/generate-document-model-BiD6ovXc.mjs.map +0 -1
  91. package/dist/generate-editor-DBj_Pxwa.mjs.map +0 -1
  92. package/dist/generate-processor-BVjOsfjJ.mjs.map +0 -1
  93. package/dist/generate-subgraph-DJZCr0Tk.mjs.map +0 -1
  94. package/dist/index-D3H9pQ8u.d.mts.map +0 -1
  95. package/dist/mcp-B3l1mtBq.mjs.map +0 -1
  96. package/dist/migrate-subgraphs-Hc5w9Mpk.mjs +0 -4
  97. package/dist/ph-cli-commands-CQXdWQ74.mjs.map +0 -1
  98. package/dist/ph-cli-commands-YE0ciOSX.mjs +0 -4
  99. package/dist/run-sugar-hGKprsKz.mjs.map +0 -1
  100. package/dist/sugar-checks-CTCsK5DJ.mjs.map +0 -1
  101. package/dist/vetra-gateway-Bpe50oGk.mjs +0 -4
  102. package/dist/vetra-host-BrLdIMRP.mjs.map +0 -1
  103. package/dist/vetra-instance-CPNIsaxh.mjs.map +0 -1
  104. package/dist/vetra-launcher-BtDWQBuh.mjs +0 -4
  105. package/dist/vetra-launcher-Dokr1aDK.mjs.map +0 -1
  106. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +0 -19
  107. package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vetra-launcher-B5L3yXPo.mjs","sources":["../src/utils/vetra-launcher.ts"],"sourcesContent":["import { requestStop } from \"@powerhousedao/host-core\";\nimport { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport { spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { stripVTControlCharacters } from \"node:util\";\nimport { devHostOf } from \"./dev-host.js\";\nimport {\n clearVetraRuntime,\n isPortInUse,\n probeVetraRuntime,\n type VetraRuntimeRecord,\n} from \"./vetra-runtime.js\";\n\nexport type VetraCommand = {\n command: string;\n args: string[];\n /** How messages name it; `ph run <the project's dev host>` when left out. */\n label?: string;\n};\n\nexport type EnsureVetraOptions = {\n projectDir: string;\n projectName: string;\n /** The port a strict-port Vetra will bind. */\n switchboardPort: number;\n command: VetraCommand;\n timeoutMs: number;\n pollMs?: number;\n /** Told what it waits on while Vetra is not ready yet, about once a second. */\n onProgress?: (message: string) => void;\n};\n\nexport class VetraStartError extends Error {}\n\nconst LOG_TAIL_LINES = 60;\nconst PORT_GRACE_MS = 10_000;\nconst STOP_TIMEOUT_MS = 15_000;\nconst PROGRESS_EVERY_MS = 1000;\n\nconst lockPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra-start.lock\");\n\nexport const vetraLogPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra.log\");\n\n// Forward slashes, so messages read the same on every platform.\nconst shownLogPath = (projectDir: string) =>\n path.relative(projectDir, vetraLogPath(projectDir)).split(path.sep).join(\"/\");\n\n/**\n * What starts a project's dev stack: `ph run dev --strictPort` (hosts/vetra\n * in a project that has only that one), run by the ph-cli executing this\n * code. The host's own defaultVerb picks the verb. In a project without the\n * host it fails, and its output says why.\n */\nexport function currentPhCliRunVetraCommand(projectDir: string): VetraCommand {\n const host = devHostOf(projectDir);\n return {\n command: process.execPath,\n args: [process.argv[1], \"run\", host, \"--strictPort\"],\n label: `ph run ${host}`,\n };\n}\n\nfunction isPidAlive(pid: number | undefined): boolean {\n if (!pid) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\nconst sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));\n\ntype LockRecord = { pid: number; vetraPid?: number };\n\nfunction readLock(projectDir: string): LockRecord | undefined {\n try {\n return JSON.parse(\n fs.readFileSync(lockPath(projectDir), \"utf8\"),\n ) as LockRecord;\n } catch {\n return undefined;\n }\n}\n\nfunction isLockHeld(lock: LockRecord | undefined): boolean {\n return !!lock && (isPidAlive(lock.pid) || isPidAlive(lock.vetraPid));\n}\n\n/** Held while the launcher or the Vetra it started is alive. */\nfunction tryAcquireLock(projectDir: string): boolean {\n const target = lockPath(projectDir);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n for (let attempt = 0; attempt < 2; attempt++) {\n try {\n fs.writeFileSync(target, JSON.stringify({ pid: process.pid }), {\n flag: \"wx\",\n });\n return true;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n if (isLockHeld(readLock(projectDir))) return false;\n fs.rmSync(target, { force: true });\n }\n }\n return false;\n}\n\nfunction releaseLock(projectDir: string): void {\n if (readLock(projectDir)?.pid === process.pid) {\n fs.rmSync(lockPath(projectDir), { force: true });\n }\n}\n\nexport function readLogTail(projectDir: string): string {\n try {\n const text = fs.readFileSync(vetraLogPath(projectDir), \"utf8\");\n const lines = stripVTControlCharacters(text).trimEnd().split(\"\\n\");\n return lines.slice(-LOG_TAIL_LINES).join(\"\\n\");\n } catch {\n return \"\";\n }\n}\n\nfunction withOutput(message: string, projectDir: string): VetraStartError {\n const tail = readLogTail(projectDir);\n const where = shownLogPath(projectDir);\n return new VetraStartError(\n tail\n ? `${message}\\n\\nVetra output (last lines of ${where}):\\n${tail}`\n : message,\n );\n}\n\nfunction foreignError(record: VetraRuntimeRecord): VetraStartError {\n return new VetraStartError(\n `.ph/vetra-runtime.json describes a live Vetra for \"${record.projectName}\" (pid ${record.pid}), not this project. ` +\n `Refusing to start a second reactor. Delete .ph/vetra-runtime.json if that record is wrong.`,\n );\n}\n\nasync function waitForLive(\n options: EnsureVetraOptions,\n deadline: number,\n stillStarting: () => boolean,\n): Promise<VetraRuntimeRecord | undefined> {\n const { projectDir, projectName, pollMs = 250, onProgress } = options;\n const startedAt = Date.now();\n let reportedAt = startedAt;\n while (Date.now() < deadline) {\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"live\") return probe.record;\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status !== \"starting\" && !stillStarting()) return undefined;\n if (onProgress && Date.now() - reportedAt >= PROGRESS_EVERY_MS) {\n reportedAt = Date.now();\n const seconds = Math.round((reportedAt - startedAt) / 1000);\n onProgress(`Waiting for Vetra to be ready (${seconds}s)...`);\n }\n await sleep(pollMs);\n }\n return undefined;\n}\n\n/** This project's live dev stack, or a detached `ph run dev` started and awaited; never a second reactor. */\nexport async function ensureVetra(\n options: EnsureVetraOptions,\n): Promise<VetraRuntimeRecord> {\n const { projectDir, projectName, switchboardPort, timeoutMs } = options;\n const deadline = Date.now() + timeoutMs;\n const seconds = Math.round(timeoutMs / 1000);\n const report = options.onProgress ?? (() => {});\n\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"live\") return probe.record;\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status === \"starting\") {\n report(`Vetra (pid ${probe.record.pid}) is starting; waiting for it...`);\n const record = await waitForLive(options, deadline, () => false);\n if (record) return record;\n throw withOutput(\n `Vetra (pid ${probe.record.pid}) is running but did not answer /ready within ${seconds}s.`,\n projectDir,\n );\n }\n\n while (!tryAcquireLock(projectDir)) {\n // Another launcher is starting Vetra for this project.\n report(\"Another process is starting Vetra for this project; waiting...\");\n const record = await waitForLive(options, deadline, () =>\n isLockHeld(readLock(projectDir)),\n );\n if (record) return record;\n if (Date.now() >= deadline) {\n throw withOutput(\n `Another process is starting Vetra for this project and it did not become ready within ${seconds}s.`,\n projectDir,\n );\n }\n }\n\n let keepLock = false;\n try {\n const again = await probeVetraRuntime(projectDir, projectName);\n if (again.status === \"live\") return again.record;\n if (again.status === \"foreign\") throw foreignError(again.record);\n\n if (again.status === \"starting\" || (await isPortInUse(switchboardPort))) {\n // Maybe a Vetra that bound the port but has not written its record yet.\n const grace = Date.now() + PORT_GRACE_MS;\n const record = await waitForLive(\n options,\n deadline,\n () => Date.now() < grace,\n );\n if (record) return record;\n throw new VetraStartError(\n `Port ${switchboardPort} is in use, but .ph/vetra-runtime.json names no live Vetra for this project. ` +\n `Stop whatever holds the port, or move this project's port (reactor.port in powerhouse.config.json).`,\n );\n }\n\n const logFile = vetraLogPath(projectDir);\n report(`Starting Vetra; its output goes to ${shownLogPath(projectDir)}...`);\n const logFd = fs.openSync(logFile, \"w\");\n let exit: { code: number | null; signal: string | null } | undefined;\n let spawnError: Error | undefined;\n const child = spawn(options.command.command, options.command.args, {\n cwd: projectDir,\n detached: true,\n stdio: [\"ignore\", logFd, logFd],\n windowsHide: true,\n });\n fs.closeSync(logFd);\n child.once(\"error\", (error) => (spawnError = error));\n child.once(\"exit\", (code, signal) => (exit = { code, signal }));\n child.unref();\n if (child.pid) {\n fs.writeFileSync(\n lockPath(projectDir),\n JSON.stringify({ pid: process.pid, vetraPid: child.pid }),\n );\n }\n\n const record = await waitForLive(\n options,\n deadline,\n () => !exit && !spawnError,\n );\n if (record) return record;\n\n if (spawnError) {\n throw new VetraStartError(\n `Could not run \\`${options.command.command}\\`: ${spawnError.message}`,\n );\n }\n if (exit) {\n const how =\n exit.signal !== null\n ? `was killed by ${exit.signal}`\n : `exited with code ${exit.code}`;\n throw withOutput(\n `\\`${options.command.label ?? `ph run ${devHostOf(projectDir)}`}\\` ${how} before it was ready.`,\n projectDir,\n );\n }\n // Still booting: keep the lock on its pid so the next call waits instead of spawning.\n keepLock = true;\n throw withOutput(\n `Vetra (pid ${child.pid}) did not answer /ready on port ${switchboardPort} within ${seconds}s. ` +\n `It is still running; the next tool call waits for it again.`,\n projectDir,\n );\n } finally {\n if (!keepLock) releaseLock(projectDir);\n }\n}\n\nasync function waitForExit(\n record: VetraRuntimeRecord,\n deadline: number,\n): Promise<boolean> {\n while (Date.now() < deadline) {\n const gone =\n !isPidAlive(record.pid) && !(await isPortInUse(record.switchboardPort));\n if (gone) return true;\n await sleep(100);\n }\n return false;\n}\n\n/** Stops this project's running Vetra, if any; resolves to the record it stopped. */\nexport async function stopVetra(options: {\n projectDir: string;\n projectName: string;\n timeoutMs?: number;\n onProgress?: (message: string) => void;\n}): Promise<VetraRuntimeRecord | undefined> {\n const { projectDir, projectName, timeoutMs = STOP_TIMEOUT_MS } = options;\n const probe = await probeVetraRuntime(projectDir, projectName);\n if (probe.status === \"foreign\") throw foreignError(probe.record);\n if (probe.status !== \"live\" && probe.status !== \"starting\") return undefined;\n const { record } = probe;\n const signal = (name: NodeJS.Signals) => {\n try {\n process.kill(record.pid, name);\n } catch {\n // Already gone.\n }\n };\n options.onProgress?.(`Stopping Vetra (pid ${record.pid})...`);\n // On Windows SIGTERM is a kill: ask through the stop channel, and signal\n // only a Vetra that has none.\n if (!(await requestStop(record.pid))) signal(\"SIGTERM\");\n if (!(await waitForExit(record, Date.now() + timeoutMs))) {\n signal(\"SIGKILL\");\n if (!(await waitForExit(record, Date.now() + timeoutMs))) {\n throw new VetraStartError(\n `Vetra (pid ${record.pid}) did not stop within ${Math.round((2 * timeoutMs) / 1000)}s.`,\n );\n }\n }\n clearVetraRuntime(projectDir, record.pid);\n if (readLock(projectDir)?.vetraPid === record.pid) {\n fs.rmSync(lockPath(projectDir), { force: true });\n }\n return record;\n}\n\n/** Stops this project's Vetra and starts it again, detached, as {@link ensureVetra} does. */\nexport async function restartVetra(\n options: EnsureVetraOptions,\n): Promise<VetraRuntimeRecord> {\n const { projectDir, projectName, onProgress } = options;\n const stopped = await stopVetra({ projectDir, projectName, onProgress });\n if (stopped) onProgress?.(`Stopped Vetra (pid ${stopped.pid}).`);\n return ensureVetra(options);\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAiCA,IAAa,kBAAb,cAAqC,MAAM,CAAC;AAG5C,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAM,YAAY,eAChB,KAAK,KAAK,aAAa,UAAU,GAAG,kBAAkB;AAExD,MAAa,gBAAgB,eAC3B,KAAK,KAAK,aAAa,UAAU,GAAG,WAAW;AAGjD,MAAM,gBAAgB,eACpB,KAAK,SAAS,YAAY,aAAa,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;;;;;;;AAQ9E,SAAgB,4BAA4B,YAAkC;CAC5E,MAAM,OAAO,UAAU,UAAU;CACjC,OAAO;EACL,SAAS,QAAQ;EACjB,MAAM;GAAC,QAAQ,KAAK;GAAI;GAAO;GAAM;EAAc;EACnD,OAAO,UAAU;CACnB;AACF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Q,KAAK,OAAO,KAAK,IAAI;EAC/B,QAAQ,CAER;CACF;CACA,QAAQ,aAAa,uBAAuB,OAAO,IAAI,KAAK;CAG5D,IAAI,CAAE,MAAM,YAAY,OAAO,GAAG,GAAI,OAAO,SAAS;CACtD,IAAI,CAAE,MAAM,YAAY,QAAQ,KAAK,IAAI,IAAI,SAAS,GAAI;EACxD,OAAO,SAAS;EAChB,IAAI,CAAE,MAAM,YAAY,QAAQ,KAAK,IAAI,IAAI,SAAS,GACpD,MAAM,IAAI,gBACR,cAAc,OAAO,IAAI,wBAAwB,KAAK,MAAO,IAAI,YAAa,GAAI,EAAE,GACtF;CAEJ;CACA,kBAAkB,YAAY,OAAO,GAAG;CACxC,IAAI,SAAS,UAAU,CAAC,EAAE,aAAa,OAAO,KAC5C,GAAG,OAAO,SAAS,UAAU,GAAG,EAAE,OAAO,KAAK,CAAC;CAEjD,OAAO;AACT;;AAGA,eAAsB,aACpB,SAC6B;CAC7B,MAAM,EAAE,YAAY,aAAa,eAAe;CAChD,MAAM,UAAU,MAAM,UAAU;EAAE;EAAY;EAAa;CAAW,CAAC;CACvE,IAAI,SAAS,aAAa,sBAAsB,QAAQ,IAAI,GAAG;CAC/D,OAAO,YAAY,OAAO;AAC5B","debug_id":"a660c9f3-f25c-525d-96ae-8c85ff483998"}
@@ -0,0 +1,4 @@
1
+ import { o as stopVetra } from "./vetra-launcher-B5L3yXPo.mjs";
2
+ export { stopVetra };
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]="821e3f78-0a2b-5c3e-8da5-c2f428398306")}catch(e){}}();
4
+ //# debugId=821e3f78-0a2b-5c3e-8da5-c2f428398306
@@ -1,9 +1,9 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ca914e2a-3bcb-5ccb-b73b-6d381ea2e1e8")}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]="fc15a2c7-5c9c-5739-b1e2-0bad2ebaa456")}catch(e){}}();
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
- import { resolvePhDir } from "@powerhousedao/shared/clis/ph-dir";
6
5
  import net from "node:net";
6
+ import { resolvePhDir } from "@powerhousedao/shared/clis/ph-dir";
7
7
  //#region src/utils/vetra-runtime.ts
8
8
  const READY_TIMEOUT_MS = 2e3;
9
9
  const recordPath = (projectDir) => path.join(resolvePhDir(projectDir), "vetra-runtime.json");
@@ -20,8 +20,8 @@ function writeVetraRuntime(projectDir, record) {
20
20
  fs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\n`);
21
21
  }
22
22
  /**
23
- * The record this process publishes for the Vetra it started. `ph dev` and
24
- * `ph run vetra` both build it here, so the two write the same fields. The
23
+ * The record this process publishes for the dev stack it started. `ph dev`
24
+ * and `ph run dev` both build it here, so the two write the same fields. The
25
25
  * Switchboard's URLs follow from its port unless the caller knows them.
26
26
  */
27
27
  function vetraRuntimeRecord(input) {
@@ -169,25 +169,7 @@ function syncMcpPortNotices(projectDir, port) {
169
169
  return notices;
170
170
  }
171
171
  //#endregion
172
- //#region src/utils/vetra-instance.ts
173
- /**
174
- * One Vetra per project. `ph run vetra` records its stack in
175
- * `.ph/run/vetra.json` and, once ready, in `.ph/vetra-runtime.json`, which is
176
- * what a start asks here: whether a Vetra already holds the project.
177
- */
178
- /** The host folder `ph dev` runs, and the name its host file carries. */
179
- const VETRA_HOST = "vetra";
180
- /** Why `ph run vetra` must not start: a live Vetra holds the project. */
181
- async function vetraRuntimeRefusal(projectDir, projectName) {
182
- const probe = await probeVetraRuntime(projectDir, projectName);
183
- if (probe.status === "live" || probe.status === "starting") {
184
- if (probe.record.pid === process.pid) return void 0;
185
- return `Vetra is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`;
186
- }
187
- if (probe.status === "foreign") return `.ph/vetra-runtime.json describes a live Vetra for "${probe.record.projectName}", but this project is "${projectName}". Refusing to start a second instance. Delete .ph/vetra-runtime.json if that record is wrong.`;
188
- }
189
- //#endregion
190
- export { probeVetraRuntime as a, vetraRuntimeRecord as c, isPortInUse as i, writeVetraRuntime as l, vetraRuntimeRefusal as n, readVetraRuntime as o, clearVetraRuntime as r, syncMcpPortNotices as s, VETRA_HOST as t };
172
+ export { syncMcpPortNotices as a, readVetraRuntime as i, isPortInUse as n, vetraRuntimeRecord as o, probeVetraRuntime as r, writeVetraRuntime as s, clearVetraRuntime as t };
191
173
 
192
- //# sourceMappingURL=vetra-instance-CPNIsaxh.mjs.map
193
- //# debugId=ca914e2a-3bcb-5ccb-b73b-6d381ea2e1e8
174
+ //# sourceMappingURL=vetra-runtime-Bk6CW-BE.mjs.map
175
+ //# debugId=fc15a2c7-5c9c-5739-b1e2-0bad2ebaa456
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vetra-runtime-Bk6CW-BE.mjs","sources":["../src/utils/vetra-runtime.ts"],"sourcesContent":["import { resolvePhDir } from \"@powerhousedao/shared/clis/ph-dir\";\nimport fs from \"node:fs\";\nimport net from \"node:net\";\nimport path from \"node:path\";\n\nexport type VetraRuntimeRecord = {\n pid: number;\n projectName: string;\n switchboardPort: number;\n connectPort: number;\n /** The Switchboard's GraphQL endpoint; absent in records from before it was written. */\n switchboardUrl?: string;\n mcpUrl: string;\n /** Vetra Studio; absent with --disable-connect. */\n connectUrl?: string;\n startedAt: string;\n};\n\nexport type VetraProbe =\n | { status: \"none\" }\n | { status: \"stale\" }\n | { status: \"starting\"; record: VetraRuntimeRecord }\n | { status: \"live\"; record: VetraRuntimeRecord }\n | { status: \"foreign\"; record: VetraRuntimeRecord };\n\nconst READY_TIMEOUT_MS = 2000;\n\n// Under the project's .ph tree — relocated with it by PH_USER_DATA_DIR.\nconst recordPath = (projectDir: string) =>\n path.join(resolvePhDir(projectDir), \"vetra-runtime.json\");\n\nexport function readVetraRuntime(\n projectDir: string,\n): VetraRuntimeRecord | undefined {\n try {\n return JSON.parse(\n fs.readFileSync(recordPath(projectDir), \"utf8\"),\n ) as VetraRuntimeRecord;\n } catch {\n // Missing or corrupt: either way there is no usable record.\n return undefined;\n }\n}\n\nexport function writeVetraRuntime(\n projectDir: string,\n record: VetraRuntimeRecord,\n): void {\n const target = recordPath(projectDir);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, `${JSON.stringify(record, null, 2)}\\n`);\n}\n\n/**\n * The record this process publishes for the dev stack it started. `ph dev`\n * and `ph run dev` both build it here, so the two write the same fields. The\n * Switchboard's URLs follow from its port unless the caller knows them.\n */\nexport function vetraRuntimeRecord(input: {\n projectName: string;\n switchboardPort: number;\n connectPort: number;\n switchboardUrl?: string;\n mcpUrl?: string;\n /** Left out when no Vetra Studio runs. */\n connectUrl?: string;\n}): VetraRuntimeRecord {\n const { switchboardPort, connectUrl } = input;\n return {\n pid: process.pid,\n projectName: input.projectName,\n switchboardPort,\n connectPort: input.connectPort,\n switchboardUrl:\n input.switchboardUrl ?? `http://localhost:${switchboardPort}/graphql`,\n mcpUrl: input.mcpUrl ?? `http://localhost:${switchboardPort}/mcp`,\n ...(connectUrl ? { connectUrl } : {}),\n startedAt: new Date().toISOString(),\n };\n}\n\n/** Deletes the record; with `pid`, only the record of that process. */\nexport function clearVetraRuntime(projectDir: string, pid?: number): void {\n if (pid !== undefined && readVetraRuntime(projectDir)?.pid !== pid) return;\n try {\n fs.rmSync(recordPath(projectDir));\n } catch {\n // Already gone.\n }\n}\n\nfunction isPidAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // EPERM means the process exists but belongs to another user.\n return (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\nexport function isPortInUse(port: number): Promise<boolean> {\n return new Promise((resolve) => {\n const socket = net.connect({ port, host: \"localhost\" });\n socket.once(\"connect\", () => {\n socket.destroy();\n resolve(true);\n });\n socket.once(\"error\", () => resolve(false));\n });\n}\n\nasync function isReady(port: number): Promise<boolean> {\n try {\n const response = await fetch(`http://localhost:${port}/ready`, {\n signal: AbortSignal.timeout(READY_TIMEOUT_MS),\n });\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Decide whether the recorded instance is actually serving this project.\n *\n * All three checks are load-bearing. A pid can be reused by an unrelated\n * process, so a live pid proves nothing on its own. Another project's\n * switchboard would answer `/ready` on its own port, so a healthy `/ready`\n * proves nothing either. And the recorded `projectName` is what separates\n * \"my instance\" from \"someone else's instance that happens to hold this\n * port\" — which is precisely the confusion that let an agent write document\n * models into a different project's drive.\n *\n * A stale record is deleted so the next start is unblocked. A foreign one is\n * left alone: it describes something that is alive.\n */\nexport async function probeVetraRuntime(\n projectDir: string,\n projectName: string,\n): Promise<VetraProbe> {\n const record = readVetraRuntime(projectDir);\n if (!record) return { status: \"none\" };\n\n const alive = isPidAlive(record.pid);\n const ready = alive && (await isReady(record.switchboardPort));\n // The record lands once the port is bound; `/ready` turns 200 later.\n const starting =\n alive && !ready && (await isPortInUse(record.switchboardPort));\n if (!ready && !starting) {\n clearVetraRuntime(projectDir);\n return { status: \"stale\" };\n }\n\n if (record.projectName !== projectName) {\n return { status: \"foreign\", record };\n }\n return ready ? { status: \"live\", record } : { status: \"starting\", record };\n}\n\nconst MCP_FILES = [\n \".mcp.json\",\n path.join(\".cursor\", \"mcp.json\"),\n path.join(\".gemini\", \"settings.json\"),\n];\n\ntype McpConfig = { mcpServers?: Record<string, { url?: string }> };\ntype UrlMcpConfig = [string, McpConfig, { url?: string }];\n\n/** Each MCP config whose `reactor-mcp` entry still points at a URL. */\nfunction urlMcpConfigs(projectDir: string): UrlMcpConfig[] {\n const found: UrlMcpConfig[] = [];\n for (const rel of MCP_FILES) {\n const target = path.join(projectDir, rel);\n if (!fs.existsSync(target)) continue;\n let parsed: McpConfig;\n try {\n parsed = JSON.parse(fs.readFileSync(target, \"utf8\")) as McpConfig;\n } catch {\n // Hand-broken JSON is the author's to fix; don't clobber it.\n continue;\n }\n const server = parsed.mcpServers?.[\"reactor-mcp\"];\n if (server?.url) found.push([rel, parsed, server]);\n }\n return found;\n}\n\n/** The MCP configs `ph migrate` would move to the `ph mcp` launcher. */\nexport function legacyMcpConfigs(projectDir: string): string[] {\n return urlMcpConfigs(projectDir).map(([rel]) => rel);\n}\n\n/**\n * Point every URL-style `reactor-mcp` entry at `port`, returning the files\n * changed. Stdio entries (`ph mcp`) carry no port and are left alone; this\n * keeps projects that have not run `ph migrate` working.\n */\nexport function syncMcpPort(projectDir: string, port: number): string[] {\n const changed: string[] = [];\n const wanted = `http://localhost:${port}/mcp`;\n for (const [rel, parsed, server] of urlMcpConfigs(projectDir)) {\n if (server.url === wanted) continue;\n server.url = wanted;\n fs.writeFileSync(\n path.join(projectDir, rel),\n `${JSON.stringify(parsed, null, 2)}\\n`,\n );\n changed.push(rel);\n }\n return changed;\n}\n\n/**\n * {@link syncMcpPort} for a Vetra that just bound `port`, returning what to\n * tell the user. An MCP client resolved `.mcp.json` before this process\n * started and cannot re-read it, so a drifted literal means the agent is\n * pointed at the wrong port — possibly another project's reactor. Correct the\n * file and say so plainly; we cannot fix the already-open client ourselves.\n */\nexport function syncMcpPortNotices(projectDir: string, port: number): string[] {\n const notices: string[] = [];\n const driftedMcpFiles = syncMcpPort(projectDir, port);\n if (driftedMcpFiles.length > 0) {\n notices.push(\n `Updated ${driftedMcpFiles.join(\" and \")} to port ${port}. ` +\n `Reconnect your MCP client (/mcp) to pick it up. ` +\n `This edit is local — do not commit it.`,\n );\n }\n if (legacyMcpConfigs(projectDir).length > 0) {\n notices.push(\n \"reactor-mcp still points at a URL; run `ph migrate` to switch it to the `ph mcp` launcher.\",\n );\n }\n return notices;\n}\n"],"names":[],"mappings":";;;;;;;AAyBA,MAAM,mBAAmB;AAGzB,MAAM,cAAc,eAClB,KAAK,KAAK,aAAa,UAAU,GAAG,oBAAoB;AAE1D,SAAgB,iBACd,YACgC;CAChC,IAAI;EACF,OAAO,KAAK,MACV,GAAG,aAAa,WAAW,UAAU,GAAG,MAAM,CAChD;CACF,QAAQ;EAEN;CACF;AACF;AAEA,SAAgB,kBACd,YACA,QACM;CACN,MAAM,SAAS,WAAW,UAAU;CACpC,GAAG,UAAU,KAAK,QAAQ,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC;CACtD,GAAG,cAAc,QAAQ,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG;AACjE;;;;;;AAOA,SAAgB,mBAAmB,OAQZ;CACrB,MAAM,EAAE,iBAAiB,eAAe;CACxC,OAAO;EACL,KAAK,QAAQ;EACb,aAAa,MAAM;EACnB;EACA,aAAa,MAAM;EACnB,gBACE,MAAM,kBAAkB,oBAAoB,gBAAgB;EAC9D,QAAQ,MAAM,UAAU,oBAAoB,gBAAgB;EAC5D,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;EACnC,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;CACpC;AACF;;AAGA,SAAgB,kBAAkB,YAAoB,KAAoB;CACxE,IAAI,QAAQ,KAAA,KAAa,iBAAiB,UAAU,CAAC,EAAE,QAAQ,KAAK;CACpE,IAAI;EACF,GAAG,OAAO,WAAW,UAAU,CAAC;CAClC,QAAQ,CAER;AACF;AAEA,SAAS,WAAW,KAAsB;CACxC,IAAI;EACF,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACT,SAAS,OAAO;EAEd,OAAQ,MAAgC,SAAS;CACnD;AACF;AAEA,SAAgB,YAAY,MAAgC;CAC1D,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAS,IAAI,QAAQ;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ACF;EACA,MAAM,SAAS,OAAO,aAAa;EACnC,IAAI,QAAQ,KAAK,MAAM,KAAK;GAAC;GAAK;GAAQ;EAAM,CAAC;CACnD;CACA,OAAO;AACT;;AAGA,SAAgB,iBAAiB,YAA8B;CAC7D,OAAO,cAAc,UAAU,CAAC,CAAC,KAAK,CAAC,SAAS,GAAG;AACrD;;;;;;AAOA,SAAgB,YAAY,YAAoB,MAAwB;CACtE,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAS,oBAAoB,KAAK;CACxC,KAAK,MAAM,CAAC,KAAK,QAAQ,WAAW,cAAc,UAAU,GAAG;EAC7D,IAAI,OAAO,QAAQ,QAAQ;EAC3B,OAAO,MAAM;EACb,GAAG,cACD,KAAK,KAAK,YAAY,GAAG,GACzB,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GACrC;EACA,QAAQ,KAAK,GAAG;CAClB;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,mBAAmB,YAAoB,MAAwB;CAC7E,MAAM,UAAoB,CAAC;CAC3B,MAAM,kBAAkB,YAAY,YAAY,IAAI;CACpD,IAAI,gBAAgB,SAAS,GAC3B,QAAQ,KACN,WAAW,gBAAgB,KAAK,OAAO,EAAE,WAAW,KAAK,yFAG3D;CAEF,IAAI,iBAAiB,UAAU,CAAC,CAAC,SAAS,GACxC,QAAQ,KACN,4FACF;CAEF,OAAO;AACT","debug_id":"fc15a2c7-5c9c-5739-b1e2-0bad2ebaa456"}
@@ -0,0 +1,131 @@
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]="38188802-b52d-52b5-bc14-ea3ab113aee3")}catch(e){}}();
3
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { Kind, parse } from "graphql";
6
+ import { loadDocumentModelInDir, subgraphDirStyle } from "@powerhousedao/codegen/utils";
7
+ import { findPackageSubgraphConflicts } from "@powerhousedao/reactor-api/subgraph-types";
8
+ import { kebabCase } from "change-case";
9
+ //#region src/utils/subgraph-type-lint.ts
10
+ const GQL_TEMPLATE = /\bgql\s*`([^`]*)`/g;
11
+ const SUBGRAPH_NAME = /\bname\s*=\s*["'`]([^"'`]+)["'`]/;
12
+ const CODE_FIRST_NAME = /\bstatic\s+(?:override\s+)?(?:readonly\s+)?subgraphName(?:\s*:\s*string)?\s*=\s*["'`]([^"'`$]+)["'`]/;
13
+ const SUBGRAPH_EXPORT = /from\s+["']\.\/([^/"']+)\/index\.js["']/g;
14
+ function directories(path) {
15
+ try {
16
+ return readdirSync(path, { withFileTypes: true }).filter((entry) => entry.isDirectory());
17
+ } catch {
18
+ return [];
19
+ }
20
+ }
21
+ function read(path) {
22
+ try {
23
+ return readFileSync(path, "utf-8");
24
+ } catch {
25
+ return;
26
+ }
27
+ }
28
+ function readSchema(path) {
29
+ const source = read(path);
30
+ if (source === void 0) return void 0;
31
+ const blocks = Array.from(source.matchAll(GQL_TEMPLATE), ([, sdl]) => sdl);
32
+ if (blocks.length === 0 || blocks.some((sdl) => sdl.includes("${"))) return;
33
+ try {
34
+ return parse(blocks.join("\n"));
35
+ } catch {
36
+ return;
37
+ }
38
+ }
39
+ /** Subgraph directories in the order `subgraphs/index.ts` registers them. */
40
+ function subgraphDirs(subgraphsDir) {
41
+ const exported = Array.from((read(join(subgraphsDir, "index.ts")) ?? "").matchAll(SUBGRAPH_EXPORT), ([, dir]) => dir);
42
+ const position = (dir) => {
43
+ const index = exported.indexOf(dir);
44
+ return index === -1 ? exported.length : index;
45
+ };
46
+ return directories(subgraphsDir).map((entry) => entry.name).sort((a, b) => position(a) - position(b));
47
+ }
48
+ function describeRefusal({ name, reason, subgraphOnly }) {
49
+ const detail = reason.split("\n")[0].replace(/\.$/, "");
50
+ return subgraphOnly ? `The subgraph of document model "${name}" is refused by the server: ${detail}.` : `Document model "${name}" is refused by the server: ${detail}.`;
51
+ }
52
+ function describe(name, conflict) {
53
+ if (conflict.nameHeldBy === "package") return `Subgraph "${name}" is defined more than once, so the server serves only the last. Rename the others.`;
54
+ if (conflict.nameHeldBy) return `Subgraph "${name}" has the name of a ${conflict.nameHeldBy} subgraph, so the server refuses it. Rename the subgraph.`;
55
+ return `Subgraph "${name}" defines ${conflict.claims.map(({ claim, owner }) => `${claim} (owned by "${owner}")`).join(", ")}, so the supergraph leaves it out. Rename them in its schema.ts.`;
56
+ }
57
+ function loadModels(projectDir) {
58
+ return directories(join(projectDir, "document-models")).map(loadDocumentModelInDir).filter((model) => model !== void 0);
59
+ }
60
+ /** Why the server would refuse a new subgraph scaffolded as `name`, if it
61
+ * would; an existing one is left to {@link lintSubgraphTypes}. */
62
+ async function findSubgraphNameConflict(projectDir, name) {
63
+ const subgraphName = kebabCase(name);
64
+ if (existsSync(join(projectDir, "subgraphs", subgraphName, "index.ts"))) return;
65
+ const { conflicts } = await findPackageSubgraphConflicts([{
66
+ name: subgraphName,
67
+ typeDefs: {
68
+ kind: Kind.DOCUMENT,
69
+ definitions: []
70
+ }
71
+ }], loadModels(projectDir));
72
+ const holder = conflicts.get(subgraphName)?.nameHeldBy;
73
+ if (!holder || holder === "package") return void 0;
74
+ return `Subgraph name "${subgraphName}" is taken by a ${holder} subgraph, so the server would refuse this one. Choose another name, such as "${subgraphName}-api".`;
75
+ }
76
+ function codeFirstName(dir) {
77
+ const files = ["index.ts", ...readdirSync(dir, {
78
+ recursive: true,
79
+ encoding: "utf8"
80
+ }).filter((file) => file.endsWith(".ts") && file !== "index.ts").sort()];
81
+ for (const file of files) {
82
+ const name = CODE_FIRST_NAME.exec(read(join(dir, file)) ?? "")?.[1];
83
+ if (name !== void 0) return name;
84
+ }
85
+ }
86
+ /** A warning per model or subgraph the server would refuse or leave out. */
87
+ async function lintSubgraphTypes(projectDir) {
88
+ const models = loadModels(projectDir);
89
+ const subgraphsDir = join(projectDir, "subgraphs");
90
+ const subgraphs = [];
91
+ for (const dir of subgraphDirs(subgraphsDir)) {
92
+ if (subgraphDirStyle(subgraphsDir, dir) === "code-first") {
93
+ const name = codeFirstName(join(subgraphsDir, dir));
94
+ if (name !== void 0) subgraphs.push({
95
+ name,
96
+ typeDefs: {
97
+ kind: Kind.DOCUMENT,
98
+ definitions: []
99
+ }
100
+ });
101
+ continue;
102
+ }
103
+ const typeDefs = readSchema(join(subgraphsDir, dir, "schema.ts"));
104
+ if (!typeDefs) continue;
105
+ const index = read(join(subgraphsDir, dir, "index.ts")) ?? "";
106
+ subgraphs.push({
107
+ name: SUBGRAPH_NAME.exec(index)?.[1] ?? dir,
108
+ typeDefs
109
+ });
110
+ }
111
+ if (subgraphs.length === 0 && models.length === 0) return [];
112
+ const { conflicts, refusedModels } = await findPackageSubgraphConflicts(subgraphs, models);
113
+ return [...refusedModels.map(describeRefusal), ...Array.from(conflicts, ([name, conflict]) => describe(name, conflict))];
114
+ }
115
+ //#endregion
116
+ //#region src/utils/warn-subgraph-type-conflicts.ts
117
+ async function warnSubgraphTypeConflicts(projectDir) {
118
+ let warnings;
119
+ try {
120
+ warnings = await lintSubgraphTypes(projectDir);
121
+ } catch (error) {
122
+ console.warn("⚠ Failed to check subgraph type names:", error);
123
+ return;
124
+ }
125
+ for (const warning of warnings) console.warn(`⚠ ${warning}`);
126
+ }
127
+ //#endregion
128
+ export { findSubgraphNameConflict as n, warnSubgraphTypeConflicts as t };
129
+
130
+ //# sourceMappingURL=warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map
131
+ //# debugId=38188802-b52d-52b5-bc14-ea3ab113aee3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn-subgraph-type-conflicts-BZ4NwLx5.mjs","sources":["../src/utils/subgraph-type-lint.ts","../src/utils/warn-subgraph-type-conflicts.ts"],"sourcesContent":["import {\n loadDocumentModelInDir,\n subgraphDirStyle,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n findPackageSubgraphConflicts,\n type PackageSubgraph,\n type PackageSubgraphConflicts,\n type RefusedDocumentModel,\n} from \"@powerhousedao/reactor-api/subgraph-types\";\nimport { kebabCase } from \"change-case\";\nimport { type DocumentNode, Kind, parse } from \"graphql\";\nimport { type Dirent, existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n// Templates with substitutions are skipped: their SDL is only known at runtime.\nconst GQL_TEMPLATE = /\\bgql\\s*`([^`]*)`/g;\nconst SUBGRAPH_NAME = /\\bname\\s*=\\s*[\"'`]([^\"'`]+)[\"'`]/;\nconst CODE_FIRST_NAME =\n /\\bstatic\\s+(?:override\\s+)?(?:readonly\\s+)?subgraphName(?:\\s*:\\s*string)?\\s*=\\s*[\"'`]([^\"'`$]+)[\"'`]/;\nconst SUBGRAPH_EXPORT = /from\\s+[\"']\\.\\/([^/\"']+)\\/index\\.js[\"']/g;\n\nfunction directories(path: string): Dirent[] {\n try {\n return readdirSync(path, { withFileTypes: true }).filter((entry) =>\n entry.isDirectory(),\n );\n } catch {\n return [];\n }\n}\n\nfunction read(path: string): string | undefined {\n try {\n return readFileSync(path, \"utf-8\");\n } catch {\n return undefined;\n }\n}\n\nfunction readSchema(path: string): DocumentNode | undefined {\n const source = read(path);\n if (source === undefined) return undefined;\n const blocks = Array.from(source.matchAll(GQL_TEMPLATE), ([, sdl]) => sdl);\n if (blocks.length === 0 || blocks.some((sdl) => sdl.includes(\"${\"))) {\n return undefined;\n }\n try {\n return parse(blocks.join(\"\\n\"));\n } catch {\n // Invalid SDL fails where the subgraph loads, and is reported there.\n return undefined;\n }\n}\n\n/** Subgraph directories in the order `subgraphs/index.ts` registers them. */\nfunction subgraphDirs(subgraphsDir: string): string[] {\n const exported = Array.from(\n (read(join(subgraphsDir, \"index.ts\")) ?? \"\").matchAll(SUBGRAPH_EXPORT),\n ([, dir]) => dir,\n );\n const position = (dir: string) => {\n const index = exported.indexOf(dir);\n return index === -1 ? exported.length : index;\n };\n return directories(subgraphsDir)\n .map((entry) => entry.name)\n .sort((a, b) => position(a) - position(b));\n}\n\nfunction describeRefusal({\n name,\n reason,\n subgraphOnly,\n}: RefusedDocumentModel): string {\n const detail = reason.split(\"\\n\")[0].replace(/\\.$/, \"\");\n return subgraphOnly\n ? `The subgraph of document model \"${name}\" is refused by the server: ${detail}.`\n : `Document model \"${name}\" is refused by the server: ${detail}.`;\n}\n\nfunction describe(name: string, conflict: PackageSubgraphConflicts): string {\n if (conflict.nameHeldBy === \"package\") {\n return `Subgraph \"${name}\" is defined more than once, so the server serves only the last. Rename the others.`;\n }\n if (conflict.nameHeldBy) {\n return `Subgraph \"${name}\" has the name of a ${conflict.nameHeldBy} subgraph, so the server refuses it. Rename the subgraph.`;\n }\n const claims = conflict.claims\n .map(({ claim, owner }) => `${claim} (owned by \"${owner}\")`)\n .join(\", \");\n return `Subgraph \"${name}\" defines ${claims}, so the supergraph leaves it out. Rename them in its schema.ts.`;\n}\n\nfunction loadModels(projectDir: string) {\n return directories(join(projectDir, \"document-models\"))\n .map(loadDocumentModelInDir)\n .filter((model) => model !== undefined);\n}\n\n/** Why the server would refuse a new subgraph scaffolded as `name`, if it\n * would; an existing one is left to {@link lintSubgraphTypes}. */\nexport async function findSubgraphNameConflict(\n projectDir: string,\n name: string,\n): Promise<string | undefined> {\n const subgraphName = kebabCase(name);\n if (existsSync(join(projectDir, \"subgraphs\", subgraphName, \"index.ts\"))) {\n return undefined;\n }\n const { conflicts } = await findPackageSubgraphConflicts(\n [\n {\n name: subgraphName,\n typeDefs: { kind: Kind.DOCUMENT, definitions: [] },\n },\n ],\n loadModels(projectDir),\n );\n const holder = conflicts.get(subgraphName)?.nameHeldBy;\n if (!holder || holder === \"package\") return undefined;\n return `Subgraph name \"${subgraphName}\" is taken by a ${holder} subgraph, so the server would refuse this one. Choose another name, such as \"${subgraphName}-api\".`;\n}\n\nfunction codeFirstName(dir: string): string | undefined {\n const files = [\n \"index.ts\",\n ...readdirSync(dir, { recursive: true, encoding: \"utf8\" })\n .filter((file) => file.endsWith(\".ts\") && file !== \"index.ts\")\n .sort(),\n ];\n for (const file of files) {\n const name = CODE_FIRST_NAME.exec(read(join(dir, file)) ?? \"\")?.[1];\n if (name !== undefined) return name;\n }\n return undefined;\n}\n\n/** A warning per model or subgraph the server would refuse or leave out. */\nexport async function lintSubgraphTypes(projectDir: string): Promise<string[]> {\n const models = loadModels(projectDir);\n const subgraphsDir = join(projectDir, \"subgraphs\");\n const subgraphs: PackageSubgraph[] = [];\n for (const dir of subgraphDirs(subgraphsDir)) {\n if (subgraphDirStyle(subgraphsDir, dir) === \"code-first\") {\n // Its schema is `ph` descriptors, which `ph model check` reads; this\n // lint checks only its name, in index.ts or a module of its directory.\n const name = codeFirstName(join(subgraphsDir, dir));\n if (name !== undefined) {\n subgraphs.push({\n name,\n typeDefs: { kind: Kind.DOCUMENT, definitions: [] },\n });\n }\n continue;\n }\n const typeDefs = readSchema(join(subgraphsDir, dir, \"schema.ts\"));\n if (!typeDefs) continue;\n const index = read(join(subgraphsDir, dir, \"index.ts\")) ?? \"\";\n subgraphs.push({ name: SUBGRAPH_NAME.exec(index)?.[1] ?? dir, typeDefs });\n }\n if (subgraphs.length === 0 && models.length === 0) return [];\n\n const { conflicts, refusedModels } = await findPackageSubgraphConflicts(\n subgraphs,\n models,\n );\n return [\n ...refusedModels.map(describeRefusal),\n ...Array.from(conflicts, ([name, conflict]) => describe(name, conflict)),\n ];\n}\n","import { lintSubgraphTypes } from \"./subgraph-type-lint.js\";\n\nexport async function warnSubgraphTypeConflicts(\n projectDir: string,\n): Promise<void> {\n let warnings: string[];\n try {\n warnings = await lintSubgraphTypes(projectDir);\n } catch (error) {\n console.warn(\"⚠ Failed to check subgraph type names:\", error);\n return;\n }\n for (const warning of warnings) console.warn(`⚠ ${warning}`);\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,kBACJ;AACF,MAAM,kBAAkB;AAExB,SAAS,YAAY,MA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AK,YAAY,WAAW;CACjD,MAAM,YAA+B,CAAC;CACtC,KAAK,MAAM,OAAO,aAAa,YAAY,GAAG;EAC5C,IAAI,iBAAiB,cAAc,GAAG,MAAM,cAAc;GAGxD,MAAM,OAAO,cAAc,KAAK,cAAc,GAAG,CAAC;GAClD,IAAI,SAAS,KAAA,GACX,UAAU,KAAK;IACb;IACA,UAAU;KAAE,MAAM,KAAK;KAAU,aAAa,CAAC;IAAE;GACnD,CAAC;GAEH;EACF;EACA,MAAM,WAAW,WAAW,KAAK,cAAc,KAAK,WAAW,CAAC;EAChE,IAAI,CAAC,UAAU;EACf,MAAM,QAAQ,KAAK,KAAK,cAAc,KAAK,UAAU,CAAC,KAAK;EAC3D,UAAU,KAAK;GAAE,MAAM,cAAc,KAAK,KAAK,CAAC,GAAG,MAAM;GAAK;EAAS,CAAC;CAC1E;CACA,IAAI,UAAU,WAAW,KAAK,OAAO,WAAW,GAAG,OAAO,CAAC;CAE3D,MAAM,EAAE,WAAW,kBAAkB,MAAM,6BACzC,WACA,MACF;CACA,OAAO,CACL,GAAG,cAAc,IAAI,eAAe,GACpC,GAAG,MAAM,KAAK,YAAY,CAAC,MAAM,cAAc,SAAS,MAAM,QAAQ,CAAC,CACzE;AACF;;;ACzKA,eAAsB,0BACpB,YACe;CACf,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,kBAAkB,UAAU;CAC/C,SAAS,OAAO;EACd,QAAQ,KAAK,0CAA0C,KAAK;EAC5D;CACF;CACA,KAAK,MAAM,WAAW,UAAU,QAAQ,KAAK,KAAK,SAAS;AAC7D","debug_id":"38188802-b52d-52b5-bc14-ea3ab113aee3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "6.4.0-next.1",
3
+ "version": "6.4.0-next.3",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -40,18 +40,17 @@
40
40
  "dependencies": {
41
41
  "@modelcontextprotocol/sdk": "1.29.0",
42
42
  "@originjs/vite-plugin-commonjs": "^1.0.3",
43
- "@powerhousedao/builder-tools": "6.4.0-next.1",
44
- "@powerhousedao/codegen": "6.4.0-next.1",
45
- "@powerhousedao/common": "6.4.0-next.1",
46
- "@powerhousedao/config": "6.4.0-next.1",
47
- "@powerhousedao/ph-run": "6.4.0-next.1",
48
- "@powerhousedao/reactor": "6.4.0-next.1",
49
- "@powerhousedao/reactor-api": "6.4.0-next.1",
50
- "@powerhousedao/reactor-mcp": "6.4.0-next.1",
51
- "@powerhousedao/shared": "6.4.0-next.1",
52
- "@powerhousedao/switchboard": "6.4.0-next.1",
53
- "@powerhousedao/vetra": "6.4.0-next.1",
54
- "@renown/sdk": "6.4.0-next.1",
43
+ "@powerhousedao/builder-tools": "6.4.0-next.3",
44
+ "@powerhousedao/codegen": "6.4.0-next.3",
45
+ "@powerhousedao/common": "6.4.0-next.3",
46
+ "@powerhousedao/config": "6.4.0-next.3",
47
+ "@powerhousedao/ph-run": "6.4.0-next.3",
48
+ "@powerhousedao/reactor": "6.4.0-next.3",
49
+ "@powerhousedao/reactor-api": "6.4.0-next.3",
50
+ "@powerhousedao/reactor-mcp": "6.4.0-next.3",
51
+ "@powerhousedao/shared": "6.4.0-next.3",
52
+ "@powerhousedao/switchboard": "6.4.0-next.3",
53
+ "@renown/sdk": "6.4.0-next.3",
55
54
  "@sentry/node-core": "^10.52.0",
56
55
  "@tsdown/css": "0.23.0",
57
56
  "@vercel/nft": "^1.11.0",
@@ -60,7 +59,7 @@
60
59
  "change-case": "5.4.4",
61
60
  "cmd-ts": "0.15.0",
62
61
  "colorette": "2.0.20",
63
- "document-model": "6.4.0-next.1",
62
+ "document-model": "6.4.0-next.3",
64
63
  "dotenv": "16.4.7",
65
64
  "enquirer": "2.4.1",
66
65
  "graphql": "^16",
@@ -82,8 +81,8 @@
82
81
  "copyfiles": "2.4.1",
83
82
  "write-package": "7.2.0",
84
83
  "zod": "^4.5.4",
85
- "@powerhousedao/desktop": "6.4.0-next.1",
86
- "@powerhousedao/host-core": "6.4.0-next.1"
84
+ "@powerhousedao/desktop": "6.4.0-next.3",
85
+ "@powerhousedao/host-core": "6.4.0-next.3"
87
86
  },
88
87
  "scripts": {
89
88
  "tsc": "tsc",
@@ -1,4 +0,0 @@
1
- import { t as runBuild } from "./build-C490lBnu.mjs";
2
- export { runBuild };
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]="fe127d9f-ee69-574d-978c-1c21cc8d195d")}catch(e){}}();
4
- //# debugId=fe127d9f-ee69-574d-978c-1c21cc8d195d