@powerhousedao/host-core 6.2.3-dev.94 → 6.2.3-dev.95
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/{compound-Cv5yxdLC.mjs → compound-DO_mvh0O.mjs} +37 -16
- package/dist/{compound-Cv5yxdLC.mjs.map → compound-DO_mvh0O.mjs.map} +1 -1
- package/dist/index.d.mts +18 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/runners/compound.mjs +1 -1
- package/package.json +3 -3
|
@@ -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
|
|
2944
|
-
*
|
|
2945
|
-
*
|
|
2946
|
-
*
|
|
2947
|
-
*
|
|
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
|
-
|
|
2966
|
-
|
|
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
|
-
|
|
2989
|
+
const found = [...standalone, ...members];
|
|
2990
|
+
if (found.length === 1) return {
|
|
2970
2991
|
status: "available",
|
|
2971
|
-
outputs:
|
|
2992
|
+
outputs: found[0].outputs,
|
|
2972
2993
|
...withSchema
|
|
2973
2994
|
};
|
|
2974
|
-
if (
|
|
2995
|
+
if (found.length > 1) return {
|
|
2975
2996
|
status: "unavailable",
|
|
2976
|
-
message: `${consumer} needs outputs from host "${ref.host}", which runs as ${
|
|
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 {
|
|
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-
|
|
3296
|
+
//# sourceMappingURL=compound-DO_mvh0O.mjs.map
|