@powerhousedao/host-core 6.2.3-dev.94 → 6.2.3-dev.96

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.
@@ -2938,42 +2938,63 @@ function producerOutputsSchemas(producers) {
2938
2938
  return runnerOutputsSchema(info.runner, info.specifier, `host "${ref.host}"`);
2939
2939
  };
2940
2940
  }
2941
+ /** Further `.ph` roots whose live run records a standalone `$output` reads
2942
+ * (`path.delimiter`-separated): a launcher that gives each child its own
2943
+ * PH_USER_DATA_DIR names its siblings' here. Locks never read them. */
2944
+ const OUTPUT_DATA_DIRS_ENV = "PH_OUTPUT_DATA_DIRS";
2945
+ /** The other roots, each once, never the process's own. */
2946
+ function siblingEnvs(projectRoot, env) {
2947
+ const own = path.resolve(defaultUserDataDir(projectRoot, env));
2948
+ return [...new Set((env["PH_OUTPUT_DATA_DIRS"] ?? "").split(path.delimiter).filter((dir) => dir !== "").map((dir) => path.resolve(dir)))].filter((dir) => dir !== own).map((dir) => ({ PH_USER_DATA_DIR: dir }));
2949
+ }
2941
2950
  /**
2942
2951
  * Standalone `$output` source: the producer's live v2 run record. Its own
2943
- * standalone record first (keyed by the producer's `name`); else a live
2944
- * compound of this project with exactly one member running that host. A
2945
- * missing, stale, foreign or output-less record means "not running", and the
2946
- * lookup fails naming the producer and how to start it (no fallback to the
2947
- * producer's declared config, no waiting).
2952
+ * standalone record under the process's `.ph` root first (keyed by the
2953
+ * producer's `name`); else exactly one of: a standalone record under a
2954
+ * PH_OUTPUT_DATA_DIRS root, or a member running that host in a live compound
2955
+ * of this project under any root. A missing, stale, foreign or output-less
2956
+ * record means "not running", and the lookup fails naming the producer and
2957
+ * how to start it (no fallback to the producer's declared config, no
2958
+ * waiting).
2948
2959
  */
2949
2960
  function runRecordOutputSource(projectRoot, options) {
2950
2961
  const { consumer, producers, projectName } = options;
2962
+ const env = options.env ?? process.env;
2963
+ const siblings = siblingEnvs(projectRoot, env);
2951
2964
  return { lookup(ref) {
2952
2965
  const notRunning = `${consumer} needs outputs from host "${ref.host}", which is not running. Start it first: ph run ${ref.host} (or run a compound that includes it).`;
2953
2966
  const info = producers.get(ref.host);
2954
2967
  const schema = info && !("error" in info) ? info.runner.outputsSchema : void 0;
2955
2968
  const withSchema = schema !== void 0 && schema !== null ? { schema } : {};
2969
+ const standalone = [];
2956
2970
  if (ref.member === void 0 && info && !("error" in info)) {
2957
- const probe = probeRun(projectRoot, info.name, projectName);
2971
+ const probe = probeRun(projectRoot, info.name, projectName, env);
2958
2972
  if (probe.status === "live" && probe.record.outputs) return {
2959
2973
  status: "available",
2960
2974
  outputs: probe.record.outputs,
2961
2975
  ...withSchema
2962
2976
  };
2977
+ for (const sibling of siblings) {
2978
+ const other = probeRun(projectRoot, info.name, projectName, sibling);
2979
+ if (other.status === "live" && other.record.outputs) standalone.push({
2980
+ label: `"${info.name}" (pid ${other.record.pid})`,
2981
+ outputs: other.record.outputs
2982
+ });
2983
+ }
2963
2984
  }
2964
- const members = listRunRecords(projectRoot).filter((record) => record.members !== void 0 && record.projectName === projectName && isPidAlive(record.pid)).flatMap((record) => Object.entries(record.members ?? {}).filter(([key, member]) => member.host === ref.host && (ref.member === void 0 || key === ref.member)).map(([key, member]) => ({
2965
- compound: record.host,
2966
- key,
2967
- member
2985
+ const members = [env, ...siblings].flatMap((root) => listRunRecords(projectRoot, root)).filter((record) => record.members !== void 0 && record.projectName === projectName && isPidAlive(record.pid)).flatMap((record) => Object.entries(record.members ?? {}).filter(([key, member]) => member.host === ref.host && (ref.member === void 0 || key === ref.member)).map(([key, member]) => ({
2986
+ label: `member "${key}" of "${record.host}"`,
2987
+ outputs: member.outputs
2968
2988
  })));
2969
- if (members.length === 1) return {
2989
+ const found = [...standalone, ...members];
2990
+ if (found.length === 1) return {
2970
2991
  status: "available",
2971
- outputs: members[0].member.outputs,
2992
+ outputs: found[0].outputs,
2972
2993
  ...withSchema
2973
2994
  };
2974
- if (members.length > 1) return {
2995
+ if (found.length > 1) return {
2975
2996
  status: "unavailable",
2976
- message: `${consumer} needs outputs from host "${ref.host}", which runs as ${members.map((m) => `member "${m.key}" of "${m.compound}"`).join(" and ")}; stop all but one, or run ${ref.host} on its own.`
2997
+ message: `${consumer} needs outputs from host "${ref.host}", which runs as ${found.map((m) => m.label).join(" and ")}; stop all but one, or run ${ref.host} on its own.`
2977
2998
  };
2978
2999
  return {
2979
3000
  status: "unavailable",
@@ -3270,6 +3291,6 @@ async function prepareMember(projectRoot, key, member) {
3270
3291
  };
3271
3292
  }
3272
3293
  //#endregion
3273
- export { describeMapElements as $, drivesSchema as $t, describeHostOutputs as A, resolveOrder as An, connectReactorIssues as At, CONNECT_RUNNER as B, placementKeyIssues as Bt, readRunRecord as C, hostTypeSatisfies as Cn, HOST_NAME_MAX_LENGTH as Ct, HostLoadError as D, pluginEntryObjectSchema as Dn, childrenSchema as Dt, runRecordSchema as E, normalizePluginEntry as En, childWrapperSchema as Et, loadHost as F, emittedHostSchemas as Ft, isSchemaLike as G, reactorProtocolSchema as Gt, RunnerError as H, reactorBackendKindSchema as Ht, probeHostsFolder as I, genericCompoundHostSchema as It, listVerbs as J, refineStartOrder as Jt, kindShapeIssues as K, reactorSchema as Kt, readOutputsFileHash as L, hostNameSchema as Lt, lintHostImportGraph as M, runObserveHookSequential as Mn, declaredHostSchemas as Mt, lintHostImports as N, runProvideHook as Nn, defineHostSchemas as Nt, OUTPUTS_FILE as O, pluginEntrySchema as On, compoundHostSchema as Ot, lintOutputsFile as P, runTransformHook as Pn, emitHostJsonSchema as Pt, TokenResolutionError as Q, driveDeclarationSchema as Qt, scanHostImports as R, makeHostSchemas as Rt, readProjectName as S, entryActiveForVerb as Sn, CONNECT_PRIMARY_MESSAGE as St, runRecordMemberSchema as T, normalizePluginEntries as Tn, HOST_NAME_PATTERN as Tt, getVerb as U, reactorBackendSchema as Ut, ONE_SHOT_VERBS as V, profileSchema as Vt, hostSchemaIssues as W, reactorHostSchema as Wt, validateDeclaredHost as X, runnerKindSchema as Xt, resolveRunnerModule as Y, runnerBaseSchema as Yt, validateHost as Z, buildDriveDeclarationSchema as Zt, applyChildWrapper as _, CONNECT_PLUGIN_OWNED_SLICES as _n, describeToken as _t, stopStreamOf as a, envTokenable as an, BUILTIN_ENV_NAMES as at, listRunRecords as b, resolvePluginContributions as bn, renderTokens as bt, toStartedHandle as c, isToken as cn, findRemovedForms as ct, processResolveEnv as d, mapTokenSchema as dn, envSitesOf as dt, projectDriveIdWith as en, resolveHostOutputs as et, producerOutputsSchemas as f, outputTokenSchema as fn, outputRefsOf as ft, resolveUserDataPlaceholders as g, tokenable as gn, collectTokenSites as gt, defaultUserDataDir as h, tokenSchema as hn, schemaAtPath as ht, runCompound as i, envTokenSchema as in, planCompound as it, findNonStaticValue as j, runObserveHook as jn, declaredGenericCompoundHostSchema as jt, computeOutputsHash as k, registerHostType as kn, compoundWiringSchema as kt, compoundOutputSource as l, itemTokenSchema as ln, checkOutputPaths as lt, runnerOutputsSchema as m, tokenKeyOf as mn, refKey as mt, memberVerbOf as n, TOKEN_KEYS as nn, PlanError as nt, takesCspRegistrySync as o, findToken as on, isBuiltinEnvName as ot, runRecordOutputSource as p, ref as pn, outputSitesOf as pt, knownVerbIssues as q, refineConnectReactor as qt, prepareMember as r, concatTokenSchema as rn, memberForRef as rt, runnerHandleSchema as s, forbidRef as sn, substituteBuiltinEnv as st, compoundStartVerb as t, TOKEN_ESCAPE_KEY as tn, unsetEnvMessage as tt, loadProducers as u, keyTokenSchema as un, checkTokenSites as ut, clearRunRecord as v, findDeadConnectConfig as vn, formatPath as vt, writeRunRecord as w, mergeContributions as wn, HOST_NAME_MESSAGE as wt, probeRun as x, PluginError as xn, unwrapEscapes as xt, isPidAlive as y, resolveHostPlugins as yn, isPlainObject as yt, stripComments as z, originOrUrlSchema as zt };
3294
+ export { TokenResolutionError as $, driveDeclarationSchema as $t, computeOutputsHash as A, registerHostType as An, compoundWiringSchema as At, stripComments as B, originOrUrlSchema as Bt, readProjectName as C, entryActiveForVerb as Cn, CONNECT_PRIMARY_MESSAGE as Ct, runRecordSchema as D, normalizePluginEntry as Dn, childWrapperSchema as Dt, runRecordMemberSchema as E, normalizePluginEntries as En, HOST_NAME_PATTERN as Et, lintOutputsFile as F, runTransformHook as Fn, emitHostJsonSchema as Ft, hostSchemaIssues as G, reactorHostSchema as Gt, ONE_SHOT_VERBS as H, profileSchema as Ht, loadHost as I, emittedHostSchemas as It, knownVerbIssues as J, refineConnectReactor as Jt, isSchemaLike as K, reactorProtocolSchema as Kt, probeHostsFolder as L, genericCompoundHostSchema as Lt, findNonStaticValue as M, runObserveHook as Mn, declaredGenericCompoundHostSchema as Mt, lintHostImportGraph as N, runObserveHookSequential as Nn, declaredHostSchemas as Nt, HostLoadError as O, pluginEntryObjectSchema as On, childrenSchema as Ot, lintHostImports as P, runProvideHook as Pn, defineHostSchemas as Pt, validateHost as Q, buildDriveDeclarationSchema as Qt, readOutputsFileHash as R, hostNameSchema as Rt, probeRun as S, PluginError as Sn, unwrapEscapes as St, writeRunRecord as T, mergeContributions as Tn, HOST_NAME_MESSAGE as Tt, RunnerError as U, reactorBackendKindSchema as Ut, CONNECT_RUNNER as V, placementKeyIssues as Vt, getVerb as W, reactorBackendSchema as Wt, resolveRunnerModule as X, runnerBaseSchema as Xt, listVerbs as Y, refineStartOrder as Yt, validateDeclaredHost as Z, runnerKindSchema as Zt, resolveUserDataPlaceholders as _, tokenable as _n, collectTokenSites as _t, stopStreamOf as a, envTokenSchema as an, planCompound as at, isPidAlive as b, resolveHostPlugins as bn, isPlainObject as bt, toStartedHandle as c, forbidRef as cn, substituteBuiltinEnv as ct, loadProducers as d, keyTokenSchema as dn, checkTokenSites as dt, drivesSchema as en, describeMapElements as et, processResolveEnv as f, mapTokenSchema as fn, envSitesOf as ft, defaultUserDataDir as g, tokenSchema as gn, schemaAtPath as gt, runnerOutputsSchema as h, tokenKeyOf as hn, refKey as ht, runCompound as i, concatTokenSchema as in, memberForRef as it, describeHostOutputs as j, resolveOrder as jn, connectReactorIssues as jt, OUTPUTS_FILE as k, pluginEntrySchema as kn, compoundHostSchema as kt, compoundOutputSource as l, isToken as ln, findRemovedForms as lt, runRecordOutputSource as m, ref as mn, outputSitesOf as mt, memberVerbOf as n, TOKEN_ESCAPE_KEY as nn, unsetEnvMessage as nt, takesCspRegistrySync as o, envTokenable as on, BUILTIN_ENV_NAMES as ot, producerOutputsSchemas as p, outputTokenSchema as pn, outputRefsOf as pt, kindShapeIssues as q, reactorSchema as qt, prepareMember as r, TOKEN_KEYS as rn, PlanError as rt, runnerHandleSchema as s, findToken as sn, isBuiltinEnvName as st, compoundStartVerb as t, projectDriveIdWith as tn, resolveHostOutputs as tt, OUTPUT_DATA_DIRS_ENV as u, itemTokenSchema as un, checkOutputPaths as ut, applyChildWrapper as v, CONNECT_PLUGIN_OWNED_SLICES as vn, describeToken as vt, readRunRecord as w, hostTypeSatisfies as wn, HOST_NAME_MAX_LENGTH as wt, listRunRecords as x, resolvePluginContributions as xn, renderTokens as xt, clearRunRecord as y, findDeadConnectConfig as yn, formatPath as yt, scanHostImports as z, makeHostSchemas as zt };
3274
3295
 
3275
- //# sourceMappingURL=compound-Cv5yxdLC.mjs.map
3296
+ //# sourceMappingURL=compound-DO_mvh0O.mjs.map