@powerhousedao/ph-run 6.3.0-dev.3 → 6.3.0-dev.4

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.
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
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]="817c0983-d2e8-5816-9e98-f01321351283")}catch(e){}}();
4
- import { t as startRun } from "./start-run-DUfxuOde.mjs";
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]="5ef621f3-b04f-5341-b995-e12e9ae12b91")}catch(e){}}();
4
+ import { n as stopRunningHost, t as startRun } from "./start-run-ThPGz0sW.mjs";
5
5
  import { splitRunArgv } from "@powerhousedao/host-core";
6
6
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
7
7
  //#region src/cli.ts
@@ -14,7 +14,11 @@ import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
14
14
  async function main(args) {
15
15
  assertNodeVersion();
16
16
  const { host, verb, own, argv } = splitRunArgv(args.slice(1));
17
- if (args[0] !== "run" || !host) throw new Error("Usage: ph-run run <host> [verb] [--debug] [runner arguments]");
17
+ if (args[0] !== "run" || !host) throw new Error("Usage: ph-run run <host> [verb] [--debug] [--stop] [runner arguments]");
18
+ if (own.includes("--stop")) {
19
+ await stopRunningHost({ host });
20
+ return;
21
+ }
18
22
  await startRun({
19
23
  host,
20
24
  verb,
@@ -30,4 +34,4 @@ await main(process.argv.slice(2)).catch((error) => {
30
34
  export {};
31
35
 
32
36
  //# sourceMappingURL=cli.mjs.map
33
- //# debugId=817c0983-d2e8-5816-9e98-f01321351283
37
+ //# debugId=5ef621f3-b04f-5341-b995-e12e9ae12b91
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { splitRunArgv } from \"@powerhousedao/host-core\";\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { startRun } from \"./services/run/start-run.js\";\n\n/**\n * `ph-run run <host> [verb] [runner arguments]`: what `ph run` does and nothing else `ph` does, so\n * a packaged app can run a host with none of the tools that build one. It takes\n * `run` as its first word so a supervisor can start either of the two the same\n * way.\n */\nasync function main(args: string[]) {\n assertNodeVersion();\n const { host, verb, own, argv } = splitRunArgv(args.slice(1));\n if (args[0] !== \"run\" || !host) {\n throw new Error(\n \"Usage: ph-run run <host> [verb] [--debug] [runner arguments]\",\n );\n }\n await startRun({ host, verb, debug: own.includes(\"--debug\"), argv });\n}\n\nawait main(process.argv.slice(2)).catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,eAAe,KAAK,MAAgB;CAClC,kBAAkB;CAClB,MAAM,EAAE,MAAM,MAAM,KAAK,SAAS,aAAa,KAAK,MAAM,CAAC,CAAC;CAC5D,IAAI,KAAK,OAAO,SAAS,CAAC,MACxB,MAAM,IAAI,MACR,8DACF;CAEF,MAAM,SAAS;EAAE;EAAM;EAAM,OAAO,IAAI,SAAS,SAAS;EAAG;CAAK,CAAC;AACrE;AAEA,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,UAAmB;CAC1D,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC5D,QAAQ,KAAK,CAAC;AAChB,CAAC","debug_id":"817c0983-d2e8-5816-9e98-f01321351283"}
1
+ {"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { splitRunArgv } from \"@powerhousedao/host-core\";\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { startRun, stopRunningHost } from \"./services/run/start-run.js\";\n\n/**\n * `ph-run run <host> [verb] [runner arguments]`: what `ph run` does and nothing else `ph` does, so\n * a packaged app can run a host with none of the tools that build one. It takes\n * `run` as its first word so a supervisor can start either of the two the same\n * way.\n */\nasync function main(args: string[]) {\n assertNodeVersion();\n const { host, verb, own, argv } = splitRunArgv(args.slice(1));\n if (args[0] !== \"run\" || !host) {\n throw new Error(\n \"Usage: ph-run run <host> [verb] [--debug] [--stop] [runner arguments]\",\n );\n }\n if (own.includes(\"--stop\")) {\n await stopRunningHost({ host });\n return;\n }\n await startRun({ host, verb, debug: own.includes(\"--debug\"), argv });\n}\n\nawait main(process.argv.slice(2)).catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,eAAe,KAAK,MAAgB;CAClC,kBAAkB;CAClB,MAAM,EAAE,MAAM,MAAM,KAAK,SAAS,aAAa,KAAK,MAAM,CAAC,CAAC;CAC5D,IAAI,KAAK,OAAO,SAAS,CAAC,MACxB,MAAM,IAAI,MACR,uEACF;CAEF,IAAI,IAAI,SAAS,QAAQ,GAAG;EAC1B,MAAM,gBAAgB,EAAE,KAAK,CAAC;EAC9B;CACF;CACA,MAAM,SAAS;EAAE;EAAM;EAAM,OAAO,IAAI,SAAS,SAAS;EAAG;CAAK,CAAC;AACrE;AAEA,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,UAAmB;CAC1D,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC5D,QAAQ,KAAK,CAAC;AAChB,CAAC","debug_id":"5ef621f3-b04f-5341-b995-e12e9ae12b91"}
@@ -30,6 +30,14 @@ export interface StartRunArgs {
30
30
  * they address the stores `run` opens, but take no lock and write no record.
31
31
  */
32
32
  export declare function startRun(args: StartRunArgs): Promise<unknown>;
33
+ /**
34
+ * `ph run <host> --stop`: asks the project's running host to stop the way
35
+ * Ctrl-C in its terminal does, and waits until it has. It never kills.
36
+ */
37
+ export declare function stopRunningHost(args: {
38
+ host: string;
39
+ projectRoot?: string;
40
+ }): Promise<void>;
33
41
  //#endregion
34
42
  export {};
35
43
  //# sourceMappingURL=start-run.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-run.d.mts","names":[],"sources":["../../../src/services/run/start-run.ts"],"mappings":";iBA2BiB;EACf;EACA;EACA;EACA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;wBAyBoB,SAAS,MAAM,eAAe"}
1
+ {"version":3,"file":"start-run.d.mts","names":[],"sources":["../../../src/services/run/start-run.ts"],"mappings":";iBA6BiB;EACf;EACA;EACA;EACA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;wBAyBoB,SAAS,MAAM,eAAe;;;;;wBAiH9B,gBAAgB;EACpC;EACA;IACE"}
@@ -1,4 +1,4 @@
1
- import { t as startRun } from "../../start-run-DUfxuOde.mjs";
2
- export { startRun };
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]="080f07a4-5dc5-59f8-8354-a5d7ef85959a")}catch(e){}}();
4
- //# debugId=080f07a4-5dc5-59f8-8354-a5d7ef85959a
1
+ import { n as stopRunningHost, t as startRun } from "../../start-run-ThPGz0sW.mjs";
2
+ export { startRun, stopRunningHost };
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]="3a790ca8-5120-50f3-b9dc-055f4538599f")}catch(e){}}();
4
+ //# debugId=3a790ca8-5120-50f3-b9dc-055f4538599f
@@ -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]="36fe1082-219d-5821-8060-2d3182e61f3b")}catch(e){}}();
3
- import { ONE_SHOT_VERBS, RunnerError, STORE_VERBS, checkRunnerArgv, clearRunRecord, emptyMaps, getVerb, isSchemaLike, loadHost, loadProducers, outputRefsOf, probeRun, processResolveEnv, producerOutputsSchemas, readProjectName, readRunRecord, resolveHostOutputs, resolveRunnerModule, runRecordOutputSource, toStartedHandle, validateDeclaredHost, validateHost, writeRunRecord } from "@powerhousedao/host-core";
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]="23913c47-b9f3-584a-aad7-7ac2645cf64f")}catch(e){}}();
3
+ import { ONE_SHOT_VERBS, RunnerError, STORE_VERBS, checkRunnerArgv, clearRunRecord, emptyMaps, getVerb, installStopChannel, isSchemaLike, loadHost, loadProducers, outputRefsOf, probeRun, processResolveEnv, producerOutputsSchemas, readProjectName, readRunRecord, resolveHostOutputs, resolveRunnerModule, runRecordOutputSource, stopRun, toStartedHandle, validateDeclaredHost, validateHost, writeRunRecord } from "@powerhousedao/host-core";
4
4
  //#region src/services/run/start-run.ts
5
5
  /**
6
6
  * `ph run <host> [verb]`: dispatch the verb (default `run`) of the host's
@@ -40,6 +40,7 @@ async function startRun(args) {
40
40
  const storeVerb = STORE_VERBS.has(verb);
41
41
  if (storeVerb && runner.kind === "compound") throw new RunnerError(`${loaded.host.name} is a compound host, and "${verb}" works on the stores of one reactor host.`, `Run it on the member that has them, e.g. \`ph run switchboard ${verb}\`.`);
42
42
  const fn = getVerb(runner, specifier, verb);
43
+ if (!ONE_SHOT_VERBS.has(verb) && !storeVerb) installStopChannel();
43
44
  const file = loaded.file;
44
45
  if (args.debug) console.log({
45
46
  host: loaded.host.name,
@@ -96,6 +97,25 @@ async function startRun(args) {
96
97
  });
97
98
  return result;
98
99
  }
100
+ /**
101
+ * `ph run <host> --stop`: asks the project's running host to stop the way
102
+ * Ctrl-C in its terminal does, and waits until it has. It never kills.
103
+ */
104
+ async function stopRunningHost(args) {
105
+ const projectRoot = args.projectRoot ?? process.cwd();
106
+ const result = await stopRun(projectRoot, args.host);
107
+ switch (result.status) {
108
+ case "none":
109
+ console.log(`${args.host} is not running for this project.`);
110
+ return;
111
+ case "stopped":
112
+ console.log(`Stopped ${args.host} (pid ${result.pid}).`);
113
+ return;
114
+ case "foreign": throw new RunnerError(`.ph/run/${args.host}.json describes a live "${result.projectName}" (pid ${result.pid}), not this project.`, "Stop it from its own project.");
115
+ case "unreachable": throw new RunnerError(`${args.host} (pid ${result.pid}) takes no stop request: it was started by a version without one.`, "Press Ctrl-C in its terminal. Ending the process any other way leaves its stores as a crash does.");
116
+ case "timeout": throw new RunnerError(`${args.host} (pid ${result.pid}) was asked to stop and is still running.`, "It may still be shutting down: run the command again to keep waiting.");
117
+ }
118
+ }
99
119
  function assertNotRunning(projectRoot, hostName, projectName) {
100
120
  const probe = probeRun(projectRoot, hostName, projectName);
101
121
  if (probe.status === "live" && probe.record.pid !== process.pid) throw new Error(`${hostName} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`);
@@ -138,7 +158,7 @@ async function publishOutputs(runner, result, target) {
138
158
  });
139
159
  }
140
160
  //#endregion
141
- export { startRun as t };
161
+ export { stopRunningHost as n, startRun as t };
142
162
 
143
- //# sourceMappingURL=start-run-DUfxuOde.mjs.map
144
- //# debugId=36fe1082-219d-5821-8060-2d3182e61f3b
163
+ //# sourceMappingURL=start-run-ThPGz0sW.mjs.map
164
+ //# debugId=23913c47-b9f3-584a-aad7-7ac2645cf64f
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-run-ThPGz0sW.mjs","sources":["../src/services/run/start-run.ts"],"sourcesContent":["import {\n checkRunnerArgv,\n clearRunRecord,\n emptyMaps,\n getVerb,\n installStopChannel,\n isSchemaLike,\n loadHost,\n loadProducers,\n ONE_SHOT_VERBS,\n outputRefsOf,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n readRunRecord,\n resolveHostOutputs,\n resolveRunnerModule,\n runRecordOutputSource,\n RunnerError,\n stopRun,\n STORE_VERBS,\n toStartedHandle,\n validateDeclaredHost,\n validateHost,\n writeRunRecord,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\nexport interface StartRunArgs {\n host: string;\n verb?: string;\n projectRoot?: string;\n debug?: boolean;\n /** What follows `ph run <host> [verb]`: the runner's own arguments. */\n argv?: string[];\n}\n\n/**\n * `ph run <host> [verb]`: dispatch the verb (default `run`) of the host's\n * declared runner. There is deliberately no type→runner registry — what a\n * host does is written in its own file.\n *\n * The pipeline (typed-host-configs 3.5): declared validation (token shapes,\n * `$output` paths against the producers' outputsSchemas, the runner's\n * declaredHostSchema), the live-instance lock, resolution (`$output` from\n * the producers' live run records, `$env` from this process, the\n * `${userData}` sugar), resolved validation, then the verb with the parsed\n * host. A compound runner gets its declared host: its members resolve their\n * own tokens as they start. Ahead of all of it, observability loads when the\n * env configures it (services/observability.ts).\n *\n * A reactor runner that exports `outputsSchema` has its handle's outputs\n * published in a v2 `.ph/run/<name>.json` record once ready; this is the only\n * standalone writer (mastra included). Compounds write their own record with\n * the members in it; one-shot verbs (`build`) return nothing and write none.\n *\n * Store verbs (`migrate`, `migrate-status`, `reset`) resolve like `run`, so\n * they address the stores `run` opens, but take no lock and write no record.\n */\nexport async function startRun(args: StartRunArgs): Promise<unknown> {\n // Before the host loads: loading it can import its runner and plugins, and\n // OpenTelemetry only patches http/express/pg/graphql that load after it.\n // Decided on the env, since reading the host is what must come second.\n if (!ONE_SHOT_VERBS.has(args.verb ?? \"run\")) {\n const { loadObservability } = await import(\"../observability.js\");\n await loadObservability();\n }\n // Loading a host loads its plugins, and React settles on its development or\n // production build the first time it's loaded. `vite build` sets NODE_ENV only\n // after that, so a build would run one half of React with the other half's\n // renderer (TypeError: dispatcher.getOwner is not a function).\n if (ONE_SHOT_VERBS.has(args.verb ?? \"run\")) {\n process.env.NODE_ENV ??= \"production\";\n }\n const projectRoot = args.projectRoot ?? process.cwd();\n const loaded = await loadHost(projectRoot, args.host);\n const { warnSupersededConfigKeys } = await import(\"./superseded-config.js\");\n warnSupersededConfigKeys(projectRoot);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(projectRoot, specifier);\n const verb = args.verb ?? \"run\";\n const storeVerb = STORE_VERBS.has(verb);\n if (storeVerb && runner.kind === \"compound\") {\n throw new RunnerError(\n `${loaded.host.name} is a compound host, and \"${verb}\" works on the stores of one reactor host.`,\n `Run it on the member that has them, e.g. \\`ph run switchboard ${verb}\\`.`,\n );\n }\n const fn = getVerb(runner, specifier, verb);\n // Before the verb starts anything: `ph run <host> --stop` reaches it from\n // here on, on Windows too.\n if (!ONE_SHOT_VERBS.has(verb) && !storeVerb) installStopChannel();\n const file = loaded.file;\n if (args.debug) {\n console.log({ host: loaded.host.name, runner: specifier, verb });\n }\n\n if (runner.kind === \"compound\") {\n validateDeclaredHost(runner, specifier, loaded.host, file);\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n // Unchecked here: the compound hands each member the ones it accepts.\n const argv = args.argv ?? [];\n return fn(host, {\n projectRoot,\n verb,\n env: process.env,\n ...(argv.length > 0 ? { argv } : {}),\n });\n }\n\n // Before anything starts: an argument the runner does not accept fails.\n const argv = checkRunnerArgv(args.argv ?? [], {\n host: args.host,\n runner: specifier,\n schema: runner.argsSchema,\n });\n const ctx = {\n projectRoot,\n verb,\n env: process.env,\n ...(argv.length > 0 ? { argv } : {}),\n };\n const projectName = readProjectName(projectRoot);\n const producers = await loadProducers(projectRoot, outputRefsOf(loaded.host));\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n const oneShot = ONE_SHOT_VERBS.has(verb);\n if (oneShot) {\n // `build` reads no other host's outputs: no producer needs to run.\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n return fn(emptyMaps(host, loaded.host), ctx);\n }\n const publishes = isSchemaLike(runner.outputsSchema);\n // Before the verb starts anything: a second live instance would take\n // over the first one's record (and clear it on exit).\n // A store verb starts no instance: it neither takes nor trips the lock.\n // Except `reset`, which would delete the stores under a live one.\n if (publishes && (!storeVerb || verb === \"reset\")) {\n assertNotRunning(projectRoot, loaded.host.name, projectName);\n }\n const resolved = resolveHostOutputs(loaded.host, {\n outputs: runRecordOutputSource(projectRoot, {\n consumer: args.host,\n producers,\n projectName,\n }),\n ...processResolveEnv(projectRoot),\n where: `hosts/${args.host}/host.js`,\n });\n const host = validateHost(runner, specifier, resolved, file);\n const result = await fn(host, ctx);\n if (publishes && result !== undefined && result !== null) {\n await publishOutputs(runner, result, {\n projectRoot,\n projectName,\n hostName: loaded.host.name,\n specifier,\n verb,\n });\n }\n return result;\n}\n\n/**\n * `ph run <host> --stop`: asks the project's running host to stop the way\n * Ctrl-C in its terminal does, and waits until it has. It never kills.\n */\nexport async function stopRunningHost(args: {\n host: string;\n projectRoot?: string;\n}): Promise<void> {\n const projectRoot = args.projectRoot ?? process.cwd();\n const result = await stopRun(projectRoot, args.host);\n switch (result.status) {\n case \"none\":\n console.log(`${args.host} is not running for this project.`);\n return;\n case \"stopped\":\n console.log(`Stopped ${args.host} (pid ${result.pid}).`);\n return;\n case \"foreign\":\n throw new RunnerError(\n `.ph/run/${args.host}.json describes a live \"${result.projectName}\" (pid ${result.pid}), not this project.`,\n \"Stop it from its own project.\",\n );\n case \"unreachable\":\n throw new RunnerError(\n `${args.host} (pid ${result.pid}) takes no stop request: it was started by a version without one.`,\n \"Press Ctrl-C in its terminal. Ending the process any other way leaves its stores as a crash does.\",\n );\n case \"timeout\":\n throw new RunnerError(\n `${args.host} (pid ${result.pid}) was asked to stop and is still running.`,\n \"It may still be shutting down: run the command again to keep waiting.\",\n );\n }\n}\n\nfunction assertNotRunning(\n projectRoot: string,\n hostName: string,\n projectName: string,\n): void {\n const probe = probeRun(projectRoot, hostName, projectName);\n if (probe.status === \"live\" && probe.record.pid !== process.pid) {\n throw new Error(\n `${hostName} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`,\n );\n }\n if (probe.status === \"foreign\") {\n throw new Error(\n `.ph/run/${hostName}.json describes a live \"${probe.record.projectName}\", but this project is \"${projectName}\". Refusing to start a second instance.`,\n );\n }\n}\n\ninterface PublishTarget {\n projectRoot: string;\n projectName: string;\n hostName: string;\n specifier: string;\n verb: string;\n}\n\n/** Await `ready`, validate the outputs, write the v2 record and clear it on\n * exit. A handle that never gets ready or reports invalid outputs is shut\n * down before the error propagates. */\nasync function publishOutputs(\n runner: RunnerModule,\n result: unknown,\n target: PublishTarget,\n): Promise<void> {\n const where = `${target.specifier} ${target.verb}`;\n const handle = toStartedHandle(result, where);\n const name = target.projectName;\n let outputs: unknown;\n try {\n if (!isSchemaLike(runner.outputsSchema)) return;\n // Checked again after the start: an instance that started meanwhile.\n assertNotRunning(target.projectRoot, target.hostName, name);\n if (handle.ready) await handle.ready;\n const parsed = runner.outputsSchema.safeParse(handle.outputs);\n if (!parsed.success) {\n const issues = parsed.error.issues\n .map(\n (issue) =>\n ` - ${issue.path.map(String).join(\".\") || \"<root>\"}: ${issue.message}`,\n )\n .join(\"\\n\");\n throw new Error(\n `${where} reported outputs that fail its outputsSchema:\\n${issues}`,\n );\n }\n outputs = parsed.data;\n } catch (error) {\n await handle.shutdown?.();\n throw error;\n }\n\n writeRunRecord(target.projectRoot, {\n version: 2,\n host: target.hostName,\n projectName: name,\n kind: \"reactor\",\n verb: target.verb,\n pid: process.pid,\n startedAt: new Date().toISOString(),\n outputs: outputs as Record<string, unknown>,\n });\n // No SIGINT/SIGTERM handler: the switchboard reactor's own handler kills\n // the reactor before draining the api, and a parallel shutdown() would\n // break that order. Without an exit event the record keeps a dead pid,\n // which probeRun reports as stale.\n process.on(\"exit\", () => {\n if (readRunRecord(target.projectRoot, target.hostName)?.pid === process.pid)\n clearRunRecord(target.projectRoot, target.hostName);\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,eAAsB,SAAS,MAAsC;CAInE,IAAI,CAAC,eAAe,IAAI,KAAK,QAAQ,KAAK,GAAG;EAC3C,MAAM,EAAE,sBAAsB,MAAM,OAAO;EAC3C,MAAM,kBAAkB;CAC1B;CAKA,IAAI,eAAe,IAAI,KAAK,QAAQ,KAAK,GACvC,QAAQ,IAAI,aAAa;CAE3B,MAAM,cAAc,KAAK,eAAe,QAAQ,IAAI;CACpD,MAAM,SAAS,MAAM,SAAS,aAAa,KAAK,IAAI;CACpD,MAAM,EAAE,6BAA6B,MAAM,OAAO;CAClD,yBAAyB,WAAW;CACpC,MAAM,YAAY,OAAO,KAAK,OAAO;CACrC,MAAM,SAAS,MAAM,oBAAoB,aAAa,SAAS;CAC/D,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,YAAY,YAAY,IAAI,IAAI;CACtC,IAAI,aAAa,OAAO,SAAS,YAC/B,MAAM,IAAI,YACR,GAAG,OAAO,KAAK,KAAK,4BAA4B,KAAK,6CACrD,iEAAiE,KAAK,IACxE;CAEF,MAAM,KAAK,QAAQ,QAAQ,WAAW,IAAI;CAG1C,IAAI,CAAC,eAAe,IAAI,IAAI,KAAK,CAAC,WAAW,mBAAmB;CAChE,MAAM,OAAO,OAAO;CACpB,IAAI,KAAK,OACP,QAAQ,IAAI;EAAE,MAAM,OAAO,KAAK;EAAM,QAAQ;EAAW;CAAK,CAAC;CAGjE,IAAI,OAAO,SAAS,YAAY;EAC9B,qBAAqB,QAAQ,WAAW,OAAO,MAAM,I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,UAAU,IAAI;EAC1D,IAAI,OAAO,OAAO,MAAM,OAAO;EAC/B,MAAM,SAAS,OAAO,cAAc,UAAU,OAAO,OAAO;EAC5D,IAAI,CAAC,OAAO,SAAS;GACnB,MAAM,SAAS,OAAO,MAAM,OACzB,KACE,UACC,OAAO,MAAM,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,KAAK,SAAS,IAAI,MAAM,SAClE,CAAC,CACA,KAAK,IAAI;GACZ,MAAM,IAAI,MACR,GAAG,MAAM,kDAAkD,QAC7D;EACF;EACA,UAAU,OAAO;CACnB,SAAS,OAAO;EACd,MAAM,OAAO,WAAW;EACxB,MAAM;CACR;CAEA,eAAe,OAAO,aAAa;EACjC,SAAS;EACT,MAAM,OAAO;EACb,aAAa;EACb,MAAM;EACN,MAAM,OAAO;EACb,KAAK,QAAQ;EACb,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;EACzB;CACX,CAAC;CAKD,QAAQ,GAAG,cAAc;EACvB,IAAI,cAAc,OAAO,aAAa,OAAO,QAAQ,CAAC,EAAE,QAAQ,QAAQ,KACtE,eAAe,OAAO,aAAa,OAAO,QAAQ;CACtD,CAAC;AACH","debug_id":"23913c47-b9f3-584a-aad7-7ac2645cf64f"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-run",
3
- "version": "6.3.0-dev.3",
3
+ "version": "6.3.0-dev.4",
4
4
  "description": "Runs a project's hosts, with none of the tools that build one",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -72,13 +72,13 @@
72
72
  "dist"
73
73
  ],
74
74
  "dependencies": {
75
- "@powerhousedao/config": "6.3.0-dev.3",
76
- "@powerhousedao/host-core": "6.3.0-dev.3",
77
- "@powerhousedao/reactor": "6.3.0-dev.3",
78
- "@powerhousedao/shared": "6.3.0-dev.3",
79
- "@powerhousedao/switchboard": "6.3.0-dev.3",
75
+ "@powerhousedao/config": "6.3.0-dev.4",
76
+ "@powerhousedao/host-core": "6.3.0-dev.4",
77
+ "@powerhousedao/reactor": "6.3.0-dev.4",
78
+ "@powerhousedao/shared": "6.3.0-dev.4",
79
+ "@powerhousedao/switchboard": "6.3.0-dev.4",
80
80
  "cmd-ts": "0.15.0",
81
- "document-model": "6.3.0-dev.3",
81
+ "document-model": "6.3.0-dev.4",
82
82
  "dotenv": "16.4.7",
83
83
  "sirv": "^3.0.2",
84
84
  "zod": "^4.5.4"
@@ -1 +0,0 @@
1
- {"version":3,"file":"start-run-DUfxuOde.mjs","sources":["../src/services/run/start-run.ts"],"sourcesContent":["import {\n checkRunnerArgv,\n clearRunRecord,\n emptyMaps,\n getVerb,\n isSchemaLike,\n loadHost,\n loadProducers,\n ONE_SHOT_VERBS,\n outputRefsOf,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n readRunRecord,\n resolveHostOutputs,\n resolveRunnerModule,\n runRecordOutputSource,\n RunnerError,\n STORE_VERBS,\n toStartedHandle,\n validateDeclaredHost,\n validateHost,\n writeRunRecord,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\nexport interface StartRunArgs {\n host: string;\n verb?: string;\n projectRoot?: string;\n debug?: boolean;\n /** What follows `ph run <host> [verb]`: the runner's own arguments. */\n argv?: string[];\n}\n\n/**\n * `ph run <host> [verb]`: dispatch the verb (default `run`) of the host's\n * declared runner. There is deliberately no type→runner registry — what a\n * host does is written in its own file.\n *\n * The pipeline (typed-host-configs 3.5): declared validation (token shapes,\n * `$output` paths against the producers' outputsSchemas, the runner's\n * declaredHostSchema), the live-instance lock, resolution (`$output` from\n * the producers' live run records, `$env` from this process, the\n * `${userData}` sugar), resolved validation, then the verb with the parsed\n * host. A compound runner gets its declared host: its members resolve their\n * own tokens as they start. Ahead of all of it, observability loads when the\n * env configures it (services/observability.ts).\n *\n * A reactor runner that exports `outputsSchema` has its handle's outputs\n * published in a v2 `.ph/run/<name>.json` record once ready; this is the only\n * standalone writer (mastra included). Compounds write their own record with\n * the members in it; one-shot verbs (`build`) return nothing and write none.\n *\n * Store verbs (`migrate`, `migrate-status`, `reset`) resolve like `run`, so\n * they address the stores `run` opens, but take no lock and write no record.\n */\nexport async function startRun(args: StartRunArgs): Promise<unknown> {\n // Before the host loads: loading it can import its runner and plugins, and\n // OpenTelemetry only patches http/express/pg/graphql that load after it.\n // Decided on the env, since reading the host is what must come second.\n if (!ONE_SHOT_VERBS.has(args.verb ?? \"run\")) {\n const { loadObservability } = await import(\"../observability.js\");\n await loadObservability();\n }\n // Loading a host loads its plugins, and React settles on its development or\n // production build the first time it's loaded. `vite build` sets NODE_ENV only\n // after that, so a build would run one half of React with the other half's\n // renderer (TypeError: dispatcher.getOwner is not a function).\n if (ONE_SHOT_VERBS.has(args.verb ?? \"run\")) {\n process.env.NODE_ENV ??= \"production\";\n }\n const projectRoot = args.projectRoot ?? process.cwd();\n const loaded = await loadHost(projectRoot, args.host);\n const { warnSupersededConfigKeys } = await import(\"./superseded-config.js\");\n warnSupersededConfigKeys(projectRoot);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(projectRoot, specifier);\n const verb = args.verb ?? \"run\";\n const storeVerb = STORE_VERBS.has(verb);\n if (storeVerb && runner.kind === \"compound\") {\n throw new RunnerError(\n `${loaded.host.name} is a compound host, and \"${verb}\" works on the stores of one reactor host.`,\n `Run it on the member that has them, e.g. \\`ph run switchboard ${verb}\\`.`,\n );\n }\n const fn = getVerb(runner, specifier, verb);\n const file = loaded.file;\n if (args.debug) {\n console.log({ host: loaded.host.name, runner: specifier, verb });\n }\n\n if (runner.kind === \"compound\") {\n validateDeclaredHost(runner, specifier, loaded.host, file);\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n // Unchecked here: the compound hands each member the ones it accepts.\n const argv = args.argv ?? [];\n return fn(host, {\n projectRoot,\n verb,\n env: process.env,\n ...(argv.length > 0 ? { argv } : {}),\n });\n }\n\n // Before anything starts: an argument the runner does not accept fails.\n const argv = checkRunnerArgv(args.argv ?? [], {\n host: args.host,\n runner: specifier,\n schema: runner.argsSchema,\n });\n const ctx = {\n projectRoot,\n verb,\n env: process.env,\n ...(argv.length > 0 ? { argv } : {}),\n };\n const projectName = readProjectName(projectRoot);\n const producers = await loadProducers(projectRoot, outputRefsOf(loaded.host));\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n const oneShot = ONE_SHOT_VERBS.has(verb);\n if (oneShot) {\n // `build` reads no other host's outputs: no producer needs to run.\n const host = validateHost(runner, specifier, loaded.host, file, {\n tokens: \"allow\",\n });\n return fn(emptyMaps(host, loaded.host), ctx);\n }\n const publishes = isSchemaLike(runner.outputsSchema);\n // Before the verb starts anything: a second live instance would take\n // over the first one's record (and clear it on exit).\n // A store verb starts no instance: it neither takes nor trips the lock.\n // Except `reset`, which would delete the stores under a live one.\n if (publishes && (!storeVerb || verb === \"reset\")) {\n assertNotRunning(projectRoot, loaded.host.name, projectName);\n }\n const resolved = resolveHostOutputs(loaded.host, {\n outputs: runRecordOutputSource(projectRoot, {\n consumer: args.host,\n producers,\n projectName,\n }),\n ...processResolveEnv(projectRoot),\n where: `hosts/${args.host}/host.js`,\n });\n const host = validateHost(runner, specifier, resolved, file);\n const result = await fn(host, ctx);\n if (publishes && result !== undefined && result !== null) {\n await publishOutputs(runner, result, {\n projectRoot,\n projectName,\n hostName: loaded.host.name,\n specifier,\n verb,\n });\n }\n return result;\n}\n\nfunction assertNotRunning(\n projectRoot: string,\n hostName: string,\n projectName: string,\n): void {\n const probe = probeRun(projectRoot, hostName, projectName);\n if (probe.status === \"live\" && probe.record.pid !== process.pid) {\n throw new Error(\n `${hostName} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`,\n );\n }\n if (probe.status === \"foreign\") {\n throw new Error(\n `.ph/run/${hostName}.json describes a live \"${probe.record.projectName}\", but this project is \"${projectName}\". Refusing to start a second instance.`,\n );\n }\n}\n\ninterface PublishTarget {\n projectRoot: string;\n projectName: string;\n hostName: string;\n specifier: string;\n verb: string;\n}\n\n/** Await `ready`, validate the outputs, write the v2 record and clear it on\n * exit. A handle that never gets ready or reports invalid outputs is shut\n * down before the error propagates. */\nasync function publishOutputs(\n runner: RunnerModule,\n result: unknown,\n target: PublishTarget,\n): Promise<void> {\n const where = `${target.specifier} ${target.verb}`;\n const handle = toStartedHandle(result, where);\n const name = target.projectName;\n let outputs: unknown;\n try {\n if (!isSchemaLike(runner.outputsSchema)) return;\n // Checked again after the start: an instance that started meanwhile.\n assertNotRunning(target.projectRoot, target.hostName, name);\n if (handle.ready) await handle.ready;\n const parsed = runner.outputsSchema.safeParse(handle.outputs);\n if (!parsed.success) {\n const issues = parsed.error.issues\n .map(\n (issue) =>\n ` - ${issue.path.map(String).join(\".\") || \"<root>\"}: ${issue.message}`,\n )\n .join(\"\\n\");\n throw new Error(\n `${where} reported outputs that fail its outputsSchema:\\n${issues}`,\n );\n }\n outputs = parsed.data;\n } catch (error) {\n await handle.shutdown?.();\n throw error;\n }\n\n writeRunRecord(target.projectRoot, {\n version: 2,\n host: target.hostName,\n projectName: name,\n kind: \"reactor\",\n verb: target.verb,\n pid: process.pid,\n startedAt: new Date().toISOString(),\n outputs: outputs as Record<string, unknown>,\n });\n // No SIGINT/SIGTERM handler: the switchboard reactor's own handler kills\n // the reactor before draining the api, and a parallel shutdown() would\n // break that order. Without an exit event the record keeps a dead pid,\n // which probeRun reports as stale.\n process.on(\"exit\", () => {\n if (readRunRecord(target.projectRoot, target.hostName)?.pid === process.pid)\n clearRunRecord(target.projectRoot, target.hostName);\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,eAAsB,SAAS,MAAsC;CAInE,IAAI,CAAC,eAAe,IAAI,KAAK,QAAQ,KAAK,GAAG;EAC3C,MAAM,EAAE,sBAAsB,MAAM,OAAO;EAC3C,MAAM,kBAAkB;CAC1B;CAKA,IAAI,eAAe,IAAI,KAAK,QAAQ,KAAK,G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