@powerhousedao/host-core 6.2.3-dev.89 → 6.2.3-dev.91
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-BZb3tR_c.mjs → compound-Cv5yxdLC.mjs} +61 -4
- package/dist/compound-Cv5yxdLC.mjs.map +1 -0
- package/dist/{compound-7I7qUIiG.d.mts → compound-eW-6nGxK.d.mts} +95 -1
- package/dist/compound-eW-6nGxK.d.mts.map +1 -0
- package/dist/{env-substitution-BbFg9lIW.mjs → env-substitution-BXGohOGN.mjs} +5 -2
- package/dist/env-substitution-BXGohOGN.mjs.map +1 -0
- package/dist/{host-schemas-CwNCJflE.d.mts → host-schemas-BM7F21lf.d.mts} +87 -1
- package/dist/host-schemas-BM7F21lf.d.mts.map +1 -0
- package/dist/index.d.mts +20 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{plugins-DZPDoyBt.d.mts → plugins-Uk84BRay.d.mts} +2 -2
- package/dist/{plugins-DZPDoyBt.d.mts.map → plugins-Uk84BRay.d.mts.map} +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/projection.d.mts +5 -1
- package/dist/projection.d.mts.map +1 -1
- package/dist/projection.mjs +11 -4
- package/dist/projection.mjs.map +1 -1
- package/dist/runners/compound.d.mts +11 -1
- package/dist/runners/compound.d.mts.map +1 -1
- package/dist/runners/compound.mjs +5 -2
- package/dist/runners/compound.mjs.map +1 -1
- package/dist/schema.d.mts +14 -2
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +1 -1
- package/package.json +3 -3
- package/dist/compound-7I7qUIiG.d.mts.map +0 -1
- package/dist/compound-BZb3tR_c.mjs.map +0 -1
- package/dist/env-substitution-BbFg9lIW.mjs.map +0 -1
- package/dist/host-schemas-CwNCJflE.d.mts.map +0 -1
|
@@ -424,6 +424,8 @@ function buildDriveDeclarationSchema(urlField) {
|
|
|
424
424
|
* only the id and keeps the declared slug (the classic Workflows drive:
|
|
425
425
|
* `/d/workflows`, id `workflows-<hash>`). */
|
|
426
426
|
projectHash: z.union([z.boolean(), z.literal("id")]).optional(),
|
|
427
|
+
/** What a missing drive is created as. Default powerhouse/document-drive. */
|
|
428
|
+
documentType: z.enum(["powerhouse/document-drive", "powerhouse/reactor-drive"]).optional(),
|
|
427
429
|
name: z.string().min(1).optional(),
|
|
428
430
|
icon: z.string().optional(),
|
|
429
431
|
preferredEditor: z.string().optional(),
|
|
@@ -481,7 +483,8 @@ const reactorProtocolSchema = z.strictObject({
|
|
|
481
483
|
documentDecisions: z.boolean().optional(),
|
|
482
484
|
authEnforcement: z.boolean().optional(),
|
|
483
485
|
authGroups: z.boolean().optional(),
|
|
484
|
-
authConditions: z.boolean().optional()
|
|
486
|
+
authConditions: z.boolean().optional(),
|
|
487
|
+
undoV3: z.boolean().optional()
|
|
485
488
|
}).optional(),
|
|
486
489
|
createSignaturePolicy: z.enum(["legacy", "v2-required"]).optional(),
|
|
487
490
|
unsupportedStoredDocuments: z.enum(["refuse", "read-only"]).optional()
|
|
@@ -2200,11 +2203,27 @@ const NON_VERB_EXPORTS = /* @__PURE__ */ new Set([
|
|
|
2200
2203
|
"checkBoot",
|
|
2201
2204
|
"default"
|
|
2202
2205
|
]);
|
|
2206
|
+
/** ph-cli's runners are ph-run's plus the verbs that build. A packaged app has
|
|
2207
|
+
* only ph-run, and its host files, generated against ph-cli's, name ph-cli's. */
|
|
2208
|
+
function runnerFallback(specifier) {
|
|
2209
|
+
const name = /^@powerhousedao\/ph-cli\/(runners\/.+)$/.exec(specifier)?.[1];
|
|
2210
|
+
return name ? `@powerhousedao/ph-run/${name}` : void 0;
|
|
2211
|
+
}
|
|
2203
2212
|
async function resolveRunnerModule(projectRoot, specifier) {
|
|
2204
2213
|
const projectRequire = createRequire(pathToFileURL(path.join(projectRoot, "package.json")).href);
|
|
2214
|
+
const resolveFirst = (candidates) => {
|
|
2215
|
+
const [first, ...rest] = candidates;
|
|
2216
|
+
try {
|
|
2217
|
+
return projectRequire.resolve(first);
|
|
2218
|
+
} catch (error) {
|
|
2219
|
+
if (rest.length === 0) throw error;
|
|
2220
|
+
return resolveFirst(rest);
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2205
2223
|
let resolved;
|
|
2206
2224
|
try {
|
|
2207
|
-
|
|
2225
|
+
const fallback = runnerFallback(specifier);
|
|
2226
|
+
resolved = resolveFirst(fallback ? [specifier, fallback] : [specifier]);
|
|
2208
2227
|
} catch {
|
|
2209
2228
|
throw new RunnerError(`Cannot resolve runner module "${specifier}" from ${projectRoot}.`, "The runner must be a dependency of the project (install it, then retry).");
|
|
2210
2229
|
}
|
|
@@ -3042,6 +3061,29 @@ async function memberDraft(projectRoot, member) {
|
|
|
3042
3061
|
function takesCspRegistrySync(m) {
|
|
3043
3062
|
return m.specifier === "@powerhousedao/ph-cli/runners/connect" || declaresKey(m.runner.hostSchema, ["runner"], "cspRegistrySync");
|
|
3044
3063
|
}
|
|
3064
|
+
/**
|
|
3065
|
+
* Windows has no SIGTERM, so a supervisor asks a stack to stop through its
|
|
3066
|
+
* stdin: a line, or the pipe closing, which also covers the supervisor dying.
|
|
3067
|
+
* Only when it asks to: a stack started from a script may have no stdin.
|
|
3068
|
+
*/
|
|
3069
|
+
function stopStreamOf(env, stdin) {
|
|
3070
|
+
return env["PH_STOP_ON_STDIN"] === "1" ? stdin() : void 0;
|
|
3071
|
+
}
|
|
3072
|
+
function whenStreamStops(stream, stop) {
|
|
3073
|
+
let stopped = false;
|
|
3074
|
+
const once = () => {
|
|
3075
|
+
if (stopped) return;
|
|
3076
|
+
stopped = true;
|
|
3077
|
+
stop();
|
|
3078
|
+
};
|
|
3079
|
+
for (const event of [
|
|
3080
|
+
"data",
|
|
3081
|
+
"end",
|
|
3082
|
+
"close",
|
|
3083
|
+
"error"
|
|
3084
|
+
]) stream.once(event, once);
|
|
3085
|
+
stream.resume();
|
|
3086
|
+
}
|
|
3045
3087
|
/** The verb the generic compound starts its members at for its own `verb`:
|
|
3046
3088
|
* `run` follows the compound's defaultVerb. */
|
|
3047
3089
|
function compoundStartVerb(verb, runner) {
|
|
@@ -3065,6 +3107,15 @@ async function runCompound(hostInput, ctx, options) {
|
|
|
3065
3107
|
const verb = ctx.verb;
|
|
3066
3108
|
const oneShotCompound = ONE_SHOT_VERBS.has(verb);
|
|
3067
3109
|
const keepsRecord = wiring.runtimeRecord !== false && !oneShotCompound;
|
|
3110
|
+
let stopRequested = false;
|
|
3111
|
+
let stopFromStream = () => {
|
|
3112
|
+
stopRequested = true;
|
|
3113
|
+
};
|
|
3114
|
+
if (options.stopStream && !oneShotCompound) {
|
|
3115
|
+
whenStreamStops(options.stopStream, () => stopFromStream());
|
|
3116
|
+
const outputs = options.supervisedOutputs ?? [process.stdout, process.stderr];
|
|
3117
|
+
for (const output of outputs) output.on("error", () => void 0);
|
|
3118
|
+
}
|
|
3068
3119
|
const probe = oneShotCompound ? void 0 : probeRun(projectRoot, host.name, options.projectName);
|
|
3069
3120
|
if (probe?.status === "live") throw new Error(`${host.name} is already running for this project (pid ${probe.record.pid}). Stop it before starting another.`);
|
|
3070
3121
|
if (probe?.status === "foreign") throw new Error(`.ph/run/${host.name}.json describes a live "${probe.record.projectName}", but this project is "${options.projectName}". Refusing to start a second instance.`);
|
|
@@ -3187,6 +3238,12 @@ async function runCompound(hostInput, ctx, options) {
|
|
|
3187
3238
|
process.on("SIGINT", () => void handleSignal("SIGINT"));
|
|
3188
3239
|
process.on("SIGTERM", () => void handleSignal("SIGTERM"));
|
|
3189
3240
|
}
|
|
3241
|
+
stopFromStream = () => {
|
|
3242
|
+
const limit = options.stopStreamLimitMs ?? 15e3;
|
|
3243
|
+
setTimeout(() => exit(143), limit).unref();
|
|
3244
|
+
handleSignal("SIGTERM");
|
|
3245
|
+
};
|
|
3246
|
+
if (stopRequested) stopFromStream();
|
|
3190
3247
|
return {
|
|
3191
3248
|
started,
|
|
3192
3249
|
shutdown,
|
|
@@ -3213,6 +3270,6 @@ async function prepareMember(projectRoot, key, member) {
|
|
|
3213
3270
|
};
|
|
3214
3271
|
}
|
|
3215
3272
|
//#endregion
|
|
3216
|
-
export {
|
|
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 };
|
|
3217
3274
|
|
|
3218
|
-
//# sourceMappingURL=compound-
|
|
3275
|
+
//# sourceMappingURL=compound-Cv5yxdLC.mjs.map
|