@powerhousedao/host-core 6.2.3-dev.98 → 6.3.0-dev.1

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.
@@ -2280,6 +2280,10 @@ interface RunnerContext {
2280
2280
  host: string;
2281
2281
  verb: string;
2282
2282
  };
2283
+ /** This invocation's arguments for this runner: what followed
2284
+ * `ph run <host> [verb]`, checked against the runner's `argsSchema`. They
2285
+ * win over the host file. A compound member gets its own share. */
2286
+ argv?: readonly string[];
2283
2287
  }
2284
2288
  /** A verb receives the PARSED host (its runner's hostSchema output), so
2285
2289
  * schema defaults and transforms reach it. */
@@ -2323,6 +2327,9 @@ interface RunnerModule<O = unknown> {
2323
2327
  /** The verb names, when the module exports functions that are not verbs
2324
2328
  * (helpers). Absent: every exported function is a verb. */
2325
2329
  verbs?: readonly string[];
2330
+ /** The arguments the runner accepts after `ph run <host> [verb]`
2331
+ * (`RunnerArgsSchema`). Absent: it accepts none, and any argument fails. */
2332
+ argsSchema?: unknown;
2326
2333
  /** What the verb would refuse at boot, given the parsed host and an
2327
2334
  * environment (`ph host check`). Starts nothing. */
2328
2335
  checkBoot?: (host: O, ctx: BootCheckContext) => readonly BootIssue[] | Promise<readonly BootIssue[]>;
@@ -2346,8 +2353,14 @@ declare function resolveRunnerModule(projectRoot: string, specifier: string): Pr
2346
2353
  /** Verbs that produce something and start nothing (`build`): no outputs, no
2347
2354
  * record, no lock — and no token resolution, since what they read (output
2348
2355
  * dirs, packages) never comes from another host's outputs. Their verb gets
2349
- * the declared host (tokens may remain in token-able fields). */
2356
+ * the declared host (tokens may remain in token-able fields; a `$map` is
2357
+ * the empty collection, see `emptyMaps`). */
2350
2358
  declare const ONE_SHOT_VERBS: ReadonlySet<string>;
2359
+ /** Verbs that work on a host's stores and start nothing (`migrate`,
2360
+ * `migrate-status`, `reset`). Their host is resolved as for `run`, so they
2361
+ * address the stores `run` opens; they take no lock and return nothing, so
2362
+ * no record is written. A compound does not forward them. */
2363
+ declare const STORE_VERBS: ReadonlySet<string>;
2351
2364
  declare function listVerbs<O>(runner: RunnerModule<O>): string[];
2352
2365
  declare function getVerb<O>(runner: RunnerModule<O>, specifier: string, verb: string): RunnerVerb<O>;
2353
2366
  /** A contract violation found while validating a host, without the file
@@ -2504,6 +2517,6 @@ interface RunCompoundResult {
2504
2517
  }
2505
2518
  declare function runCompound(hostInput: HostDefinition, ctx: RunnerContext, options: RunCompoundOptions): Promise<RunCompoundResult>;
2506
2519
  //#endregion
2507
- export { HostDefinition as $, TokenFor as $t, knownVerbIssues as A, reactorBackendKindSchema as At, envSitesOf as B, ConcatToken as Bt, RunnerVerb as C, emittedHostSchemas as Ct, hostSchemaIssues as D, originOrUrlSchema as Dt, getVerb as E, makeHostSchemas as Et, DeclaredIssue as F, refineConnectReactor as Ft, CONNECT_PRIMARY_MESSAGE as G, OutputPath as Gt, outputSitesOf as H, ItemToken as Ht, OutputRef as I, refineStartOrder as It, CompoundHostInput as J, RefFn as Jt, ChildWrapper as K, OutputToken as Kt, OutputsSchemaLookup as L, runnerBaseSchema as Lt, resolveRunnerModule as M, reactorHostSchema as Mt, validateDeclaredHost as N, reactorProtocolSchema as Nt, isSchemaLike as O, placementKeyIssues as Ot, validateHost as P, reactorSchema as Pt, HOST_NAME_PATTERN as Q, Token as Qt, checkOutputPaths as R, runnerKindSchema as Rt, RunnerModule as S, emitHostJsonSchema as St, ValidateHostOptions as T, hostNameSchema as Tt, refKey as U, KeyToken as Ut, outputRefsOf as V, EnvToken as Vt, schemaAtPath as W, MapToken as Wt, HOST_NAME_MAX_LENGTH as X, TOKEN_KEYS as Xt, CompoundWiring as Y, TOKEN_ESCAPE_KEY as Yt, HOST_NAME_MESSAGE as Z, Template as Zt, HostSchemaLike as _, compoundWiringSchema as _t, RunnerHandleData as a, envTokenable as an, ReactorConfig as at, RunnerError as b, declaredHostSchemas as bt, toStartedHandle as c, isToken as cn, ReactorPackageConfig as ct, BootCheckContext as d, mapTokenSchema as dn, ReactorStorageConfig as dt, TokenKey as en, HostSchemas as et, BootIssue as f, outputTokenSchema as fn, RunnerBase as ft, HostSchemaIssues as g, tokenable as gn, compoundHostSchema as gt, HostSchemaIssue as h, tokenSchema as hn, childrenSchema as ht, RunnerHandle as i, envTokenSchema as in, ReactorBackendKind as it, listVerbs as j, reactorBackendSchema as jt, kindShapeIssues as k, profileSchema as kt, MemberDraft as l, itemTokenSchema as ln, ReactorProtocol as lt, DeclaredHostOptions as m, tokenKeyOf as mn, childWrapperSchema as mt, RunCompoundResult as n, TokenableSchema as nn, Profile as nt, StartedHandle as o, findToken as on, ReactorHost as ot, CONNECT_RUNNER as p, ref as pn, RunnerKind as pt, CompoundHost as q, RecordMapToken as qt, runCompound as r, concatTokenSchema as rn, ReactorBackend as rt, runnerHandleSchema as s, forbidRef as sn, ReactorHostInput as st, RunCompoundOptions as t, TokenMode as tn, PlacementKeyIssue as tt, applyChildWrapper as u, keyTokenSchema as un, ReactorRemoteConfig as ut, ONE_SHOT_VERBS as v, connectReactorIssues as vt, SchemaIssue as w, genericCompoundHostSchema as wt, RunnerIssue as x, defineHostSchemas as xt, RunnerContext as y, declaredGenericCompoundHostSchema as yt, checkTokenSites as z, ArrayMapToken as zt };
2520
+ export { HOST_NAME_PATTERN as $, Token as $t, kindShapeIssues as A, profileSchema as At, checkTokenSites as B, ArrayMapToken as Bt, RunnerVerb as C, emitHostJsonSchema as Ct, getVerb as D, makeHostSchemas as Dt, ValidateHostOptions as E, hostNameSchema as Et, validateHost as F, reactorSchema as Ft, schemaAtPath as G, MapToken as Gt, outputRefsOf as H, EnvToken as Ht, DeclaredIssue as I, refineConnectReactor as It, CompoundHost as J, RecordMapToken as Jt, CONNECT_PRIMARY_MESSAGE as K, OutputPath as Kt, OutputRef as L, refineStartOrder as Lt, listVerbs as M, reactorBackendSchema as Mt, resolveRunnerModule as N, reactorHostSchema as Nt, hostSchemaIssues as O, originOrUrlSchema as Ot, validateDeclaredHost as P, reactorProtocolSchema as Pt, HOST_NAME_MESSAGE as Q, Template as Qt, OutputsSchemaLookup as R, runnerBaseSchema as Rt, RunnerModule as S, defineHostSchemas as St, SchemaIssue as T, genericCompoundHostSchema as Tt, outputSitesOf as U, ItemToken as Ut, envSitesOf as V, ConcatToken as Vt, refKey as W, KeyToken as Wt, CompoundWiring as X, TOKEN_ESCAPE_KEY as Xt, CompoundHostInput as Y, RefFn as Yt, HOST_NAME_MAX_LENGTH as Z, TOKEN_KEYS as Zt, HostSchemaLike as _, tokenable as _n, compoundHostSchema as _t, RunnerHandleData as a, envTokenSchema as an, ReactorBackendKind as at, RunnerError as b, declaredGenericCompoundHostSchema as bt, toStartedHandle as c, forbidRef as cn, ReactorHostInput as ct, BootCheckContext as d, keyTokenSchema as dn, ReactorRemoteConfig as dt, TokenFor as en, HostDefinition as et, BootIssue as f, mapTokenSchema as fn, ReactorStorageConfig as ft, HostSchemaIssues as g, tokenSchema as gn, childrenSchema as gt, HostSchemaIssue as h, tokenKeyOf as hn, childWrapperSchema as ht, RunnerHandle as i, concatTokenSchema as in, ReactorBackend as it, knownVerbIssues as j, reactorBackendKindSchema as jt, isSchemaLike as k, placementKeyIssues as kt, MemberDraft as l, isToken as ln, ReactorPackageConfig as lt, DeclaredHostOptions as m, ref as mn, RunnerKind as mt, RunCompoundResult as n, TokenMode as nn, PlacementKeyIssue as nt, StartedHandle as o, envTokenable as on, ReactorConfig as ot, CONNECT_RUNNER as p, outputTokenSchema as pn, RunnerBase as pt, ChildWrapper as q, OutputToken as qt, runCompound as r, TokenableSchema as rn, Profile as rt, runnerHandleSchema as s, findToken as sn, ReactorHost as st, RunCompoundOptions as t, TokenKey as tn, HostSchemas as tt, applyChildWrapper as u, itemTokenSchema as un, ReactorProtocol as ut, ONE_SHOT_VERBS as v, compoundWiringSchema as vt, STORE_VERBS as w, emittedHostSchemas as wt, RunnerIssue as x, declaredHostSchemas as xt, RunnerContext as y, connectReactorIssues as yt, checkOutputPaths as z, runnerKindSchema as zt };
2508
2521
  export {};
2509
- //# sourceMappingURL=compound-eW-6nGxK.d.mts.map
2522
+ //# sourceMappingURL=compound-CBqPgk38.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compound-eW-6nGxK.d.mts","names":[],"sources":["../src/host-schemas.ts","../src/resolve/declared.ts","../src/runner-resolver.ts","../src/child-wrapper.ts","../src/runner-handle.ts","../src/compound.ts"],"mappings":";;;;;;;;;;;;;;;;cA2Ba,mBAAiB;cACjB;cACA;cAEA,gBAAc,EAAA;;;;;;cAWd,mBAAiB,EAAA,mBAAA,EAAA,QAAA,EAAA;cAOjB,eAAa,EAAA;;;;;GAKxB,EAAA,KAAA;cAEW,uBAAqB,EAAA;;;;;;;;;;;;;;;;GAYhC,EAAA,KAAA;cAEW,kBAAgB,EAAA;;;;KACjB,aAAa,EAAE,aAAa;cAE3B,0BAAwB,EAAA;;;;;;;;cAiBxB,sBAAoB,EAAA;;;;GAY/B,EAAA,KAAA;;;;iBAKc,iBACd;EAAQ,UAAU;EAAyB,SAAS;GACpD,KAAK,EAAE;;;UAyBC;EACR,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB;EACzD,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB,GAAG;;;;;;iBAqQrD,iBAAiB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,gBACN,SAAS,eACR;;;;;;;;;UCJc,aAAa,IAAI;EAChC,SAAS;;EAET,OAAO;;EAEP,YAAY;;;;cAKD,oBAAkB,EAAA;;GAE7B,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;UAI7B,sBAAsB;EACrC,SAAS;EACT,QAAQ;EACR;;;;iBAiBc,gBAAgB,gBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;UCYtD;EACR;EACA,QAAQ;EACR;EACA,MAAM;EACN;EACA,QAAQ;;;EAGR,SAAS;;UAiCM;;EAEf;;EAEA,cAAc;;;EAGd;;EAEA,QAAQ;;;EAGR,aAAa,OAAO;;;EAGpB;;EAEA,6BAA6B,OAAO;;UAkCrB;EACf,SAAS;;;EAGT,gBAAgB;;;;EAIhB,eAAe,iCAAiC;;iBAsB5B,YACpB,WAAW,gBACX,KAAK,eACL,SAAS,qBACR,QAAQ"}
1
+ {"version":3,"file":"compound-CBqPgk38.d.mts","names":[],"sources":["../src/host-schemas.ts","../src/resolve/declared.ts","../src/runner-resolver.ts","../src/child-wrapper.ts","../src/runner-handle.ts","../src/compound.ts"],"mappings":";;;;;;;;;;;;;;;;cA2Ba,mBAAiB;cACjB;cACA;cAEA,gBAAc,EAAA;;;;;;cAWd,mBAAiB,EAAA,mBAAA,EAAA,QAAA,EAAA;cAOjB,eAAa,EAAA;;;;;GAKxB,EAAA,KAAA;cAEW,uBAAqB,EAAA;;;;;;;;;;;;;;;;GAYhC,EAAA,KAAA;cAEW,kBAAgB,EAAA;;;;KACjB,aAAa,EAAE,aAAa;cAE3B,0BAAwB,EAAA;;;;;;;;cAiBxB,sBAAoB,EAAA;;;;GAY/B,EAAA,KAAA;;;;iBAKc,iBACd;EAAQ,UAAU;EAAyB,SAAS;GACpD,KAAK,EAAE;;;UAyBC;EACR,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB;EACzD,MAAM,UAAU,EAAE,SAAS,QAAQ,MAAM,gBAAgB,GAAG;;;;;;iB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mBACA,MAAM,0BACL;;;iBAkCa,gBAAgB,GAC9B,QAAQ,aAAa,IACrB,mBACA,MAAM,0BACL;UA+Cc;;;;;EAKf,SAAS;;;;;;;;iBASK,aAAa,GAC3B,QAAQ,aAAa,IACrB,mBACA,eACA,cACA,UAAS,sBACR;UAiBc,oBAAoB;;;EAGnC;;UAGe,iBAAiB;;;EAGhC,QAAQ;;EAER,eAAe;EACf,OAAO;;;iBAIO,iBAAiB,GAC/B,QAAQ,aAAa,IACrB,QAAQ,eAAe,IACvB,mBACA,eACA,UAAS,sBACR,iBAAiB;UAoEH;;;EAGf,mBAAmB,KAAK,cAAc;;;;;;;;;;iBAWxB,qBACd,QAAQ,cACR,mBACA,eACA,cACA,UAAS;;;;KCngBC,cAAc;EACxB;EACA,QAAQ;;;iBAIM,kBACd,MAAM,gBACN,SAAS,eACR;;;;;;;;;UCJc,aAAa,IAAI;EAChC,SAAS;;EAET,OAAO;;EAEP,YAAY;;;;cAKD,oBAAkB,EAAA;;GAE7B,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;UAI7B,sBAAsB;EACrC,SAAS;EACT,QAAQ;EACR;;;;iBAiBc,gBAAgB,gBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;UCatD;EACR;EACA,QAAQ;EACR;EACA,MAAM;EACN;EACA,QAAQ;;;EAGR,SAAS;;UAiCM;;EAEf;;EAEA,cAAc;;;EAGd;;EAEA,QAAQ;;;EAGR,aAAa,OAAO;;;EAGpB;;EAEA,6BAA6B,OAAO;;UAkCrB;EACf,SAAS;;;EAGT,gBAAgB;;;;EAIhB,eAAe,iCAAiC;;iBAsB5B,YACpB,WAAW,gBACX,KAAK,eACL,SAAS,qBACR,QAAQ"}
@@ -7,6 +7,7 @@ import { z } from "zod";
7
7
  import { TOKEN_ESCAPE_KEY, TOKEN_KEYS, concatTokenSchema, envTokenSchema, envTokenable, findToken, forbidRef, isToken, itemTokenSchema, keyTokenSchema, mapTokenSchema, outputTokenSchema, ref, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable } from "@powerhousedao/shared/host-tokens";
8
8
  import { isOriginPlaceholderUrl } from "@powerhousedao/shared/connect/origin-placeholder";
9
9
  import { resolvePhDir } from "@powerhousedao/shared/clis/ph-dir";
10
+ import { execFileSync } from "node:child_process";
10
11
  //#region src/plugins.ts
11
12
  /**
12
13
  * R1 — the host plugin framework (bridge-runners-to-plugins plan,
@@ -368,6 +369,39 @@ function alreadyServed(authored, served) {
368
369
  return Object.keys(want).every((key) => alreadyServed(want[key], have[key]));
369
370
  }
370
371
  /**
372
+ * The composition that serves `config` as Connect serves it with none, for a
373
+ * host that declares no `runner.plugins`. `config` is the connect block
374
+ * Connect would be served without a composition.
375
+ *
376
+ * A built-in configured through its entry is always in it, its entry holding
377
+ * the values `config` has at the slices it owns: composed in, the plugin
378
+ * serves those values again (an unset one falls back to the same default).
379
+ * A built-in whose presence is its switch is in it only where `config`
380
+ * already has that switch on, since composing it in would turn it on.
381
+ */
382
+ function defaultConnectComposition(config) {
383
+ const composition = [];
384
+ for (const [module, { slices }] of Object.entries(CONNECT_PLUGIN_OWNED_SLICES)) {
385
+ const entry = {};
386
+ let configured = false;
387
+ let switchedOn = false;
388
+ for (const { path: slicePath, absent, entryKey } of slices) {
389
+ const value = valueAt$1(config, slicePath);
390
+ if (entryKey === void 0) {
391
+ switchedOn ||= !alreadyServed(value, absent);
392
+ continue;
393
+ }
394
+ configured = true;
395
+ if (value !== void 0 && value !== null) entry[entryKey] = value;
396
+ }
397
+ if (configured || switchedOn) composition.push({
398
+ module,
399
+ config: entry
400
+ });
401
+ }
402
+ return composition;
403
+ }
404
+ /**
371
405
  * Dead-config warnings for a Connect host (typed-host-configs 1.6): an
372
406
  * authored connect config value whose owning plugin is not in the
373
407
  * composition active for `verb`. Connect zeroes such a slice, so the value
@@ -2160,6 +2194,22 @@ function resolveHostOutputs(host, sources, options) {
2160
2194
  }
2161
2195
  };
2162
2196
  }
2197
+ /**
2198
+ * What a one-shot verb (build) gets for a `$map`: no outputs exist there, so
2199
+ * every map in `declared` renders no elements (`[]`, or `{}` with into:
2200
+ * "record") at its path in `host`, the declared-form parse of `declared`.
2201
+ * Other tokens stay, as they do in token-able fields.
2202
+ */
2203
+ function emptyMaps(host, declared) {
2204
+ const maps = collectTokenSites(declared).filter((site) => site.key === "$map" && site.scopes.length === 0 && site.position !== "concat");
2205
+ if (maps.length === 0) return host;
2206
+ const out = cloneWithProvenance(host);
2207
+ for (const { path, token } of maps) {
2208
+ const operand = token.$map;
2209
+ setAt(out, path, isPlainObject(operand) && operand.into === "record" ? {} : [], false);
2210
+ }
2211
+ return out;
2212
+ }
2163
2213
  function setAt(root, trail, value, omit) {
2164
2214
  let current = root;
2165
2215
  for (const key of trail.slice(0, -1)) if (Array.isArray(current) && typeof key === "number") current = current[key];
@@ -2199,6 +2249,7 @@ const NON_VERB_EXPORTS = /* @__PURE__ */ new Set([
2199
2249
  "declaredHostSchema",
2200
2250
  "outputsSchema",
2201
2251
  "verbs",
2252
+ "argsSchema",
2202
2253
  "kind",
2203
2254
  "checkBoot",
2204
2255
  "default"
@@ -2242,8 +2293,18 @@ async function resolveRunnerModule(projectRoot, specifier) {
2242
2293
  /** Verbs that produce something and start nothing (`build`): no outputs, no
2243
2294
  * record, no lock — and no token resolution, since what they read (output
2244
2295
  * dirs, packages) never comes from another host's outputs. Their verb gets
2245
- * the declared host (tokens may remain in token-able fields). */
2296
+ * the declared host (tokens may remain in token-able fields; a `$map` is
2297
+ * the empty collection, see `emptyMaps`). */
2246
2298
  const ONE_SHOT_VERBS = /* @__PURE__ */ new Set(["build"]);
2299
+ /** Verbs that work on a host's stores and start nothing (`migrate`,
2300
+ * `migrate-status`, `reset`). Their host is resolved as for `run`, so they
2301
+ * address the stores `run` opens; they take no lock and return nothing, so
2302
+ * no record is written. A compound does not forward them. */
2303
+ const STORE_VERBS = /* @__PURE__ */ new Set([
2304
+ "migrate",
2305
+ "migrate-status",
2306
+ "reset"
2307
+ ]);
2247
2308
  function listVerbs(runner) {
2248
2309
  if (runner.verbs) return runner.verbs.filter((name) => typeof runner[name] === "function").toSorted();
2249
2310
  return Object.entries(runner).filter(([name, value]) => typeof value === "function" && !NON_VERB_EXPORTS.has(name)).map(([name]) => name).sort();
@@ -2638,8 +2699,8 @@ async function loadHost(projectRoot, hostName) {
2638
2699
  }
2639
2700
  async function importHost(projectRoot, hostName, checkOutputs) {
2640
2701
  const probe = probeHostsFolder(projectRoot);
2641
- if (probe.kind === "absent") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, "Scaffold one with `ph init --uniform-runners` (or create hosts/<name>/host.js).");
2642
- if (probe.kind === "empty") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, "An empty hosts/ folder does not activate the uniform-runners architecture; add a host definition or remove the folder.");
2702
+ if (probe.kind === "absent") throw new HostLoadError(`No hosts/ folder found in ${projectRoot}.`, "New projects get one from `ph init`; in an existing project, create hosts/<name>/host.js.");
2703
+ if (probe.kind === "empty") throw new HostLoadError(`hosts/ exists at ${probe.dir} but contains no <name>/host.js.`, "An empty hosts/ folder defines no hosts; add a host definition or remove the folder.");
2643
2704
  if (!probe.hosts.includes(hostName)) throw new HostLoadError(`Unknown host "${hostName}". Available hosts: ${probe.hosts.join(", ")}.`);
2644
2705
  const file = path.join(probe.dir, hostName, HOST_FILE);
2645
2706
  const producers = lintHostImportGraph(probe.dir, hostName);
@@ -2744,6 +2805,160 @@ async function assertOutputsFileFresh(projectRoot, hostsDir, consumer, producer)
2744
2805
  if (actual !== description.hash) throw new HostLoadError(`${rel} is stale (its producer's outputsSchema or declared drives changed since it was generated); run \`ph generate hosts\`.`, actual === void 0 ? `${rel} carries no outputsHash export; it was not generated by \`ph generate hosts\`.` : `expected ${description.hash}, found ${actual}.`);
2745
2806
  }
2746
2807
  //#endregion
2808
+ //#region src/runner-args.ts
2809
+ const isStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
2810
+ const isStringRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((item) => typeof item === "string");
2811
+ function isRunnerArgsSchema(value) {
2812
+ if (typeof value !== "object" || value === null) return false;
2813
+ const schema = value;
2814
+ return isStrings(schema.options) && isStrings(schema.flags) && (schema.memberOptions === void 0 || isStringRecord(schema.memberOptions)) && (schema.retired === void 0 || isStringRecord(schema.retired));
2815
+ }
2816
+ const OWN_FLAGS = /* @__PURE__ */ new Set([
2817
+ "--debug",
2818
+ "--help",
2819
+ "-h"
2820
+ ]);
2821
+ /**
2822
+ * Splits what follows `ph run`. The host and the verb come before the
2823
+ * runner's arguments: `ph run` does not know which of those take a value, so
2824
+ * a bare word after the first of them belongs to the runner. A literal `--`
2825
+ * hands over everything after it.
2826
+ */
2827
+ function splitRunArgv(args) {
2828
+ const result = {
2829
+ own: [],
2830
+ argv: []
2831
+ };
2832
+ for (let i = 0; i < args.length; i++) {
2833
+ const arg = args[i];
2834
+ if (arg === "--") {
2835
+ result.argv.push(...args.slice(i + 1));
2836
+ break;
2837
+ }
2838
+ if (OWN_FLAGS.has(arg) || arg.startsWith("--explain=")) result.own.push(arg);
2839
+ else if (arg === "--explain") {
2840
+ result.own.push(...args.slice(i, i + 2));
2841
+ i++;
2842
+ } else if (arg.startsWith("-") || result.argv.length > 0) result.argv.push(arg);
2843
+ else if (result.host === void 0) result.host = arg;
2844
+ else if (result.verb === void 0) result.verb = arg;
2845
+ else result.argv.push(arg);
2846
+ }
2847
+ return result;
2848
+ }
2849
+ function entriesOf(argv, takesValue, where) {
2850
+ const entries = [];
2851
+ for (let i = 0; i < argv.length; i++) {
2852
+ const token = argv[i];
2853
+ if (token === "--") continue;
2854
+ const equals = token.startsWith("-") ? token.indexOf("=") : -1;
2855
+ const name = equals === -1 ? token : token.slice(0, equals);
2856
+ if (equals === -1 && takesValue(name)) {
2857
+ if (i + 1 >= argv.length) throw new RunnerError(`${where}: ${name} needs a value.`);
2858
+ entries.push({
2859
+ name,
2860
+ tokens: [token, argv[i + 1]]
2861
+ });
2862
+ i++;
2863
+ } else entries.push({
2864
+ name,
2865
+ tokens: [token]
2866
+ });
2867
+ }
2868
+ return entries;
2869
+ }
2870
+ function warnRetired(name, instead) {
2871
+ console.warn(`${name} is retired and has no effect: ${instead}`);
2872
+ }
2873
+ const acceptedBy = (schema) => [...schema.options, ...schema.flags];
2874
+ /**
2875
+ * The arguments a standalone runner receives as `ctx.argv`: `argv` checked
2876
+ * against the runner's schema, retired switches warned about and dropped.
2877
+ * Nothing is dropped silently: an argument the runner does not accept, or any
2878
+ * argument for a runner without a schema, fails.
2879
+ */
2880
+ function checkRunnerArgv(argv, target) {
2881
+ if (argv.length === 0) return [];
2882
+ const where = `hosts/${target.host}`;
2883
+ const schema = target.schema;
2884
+ if (!isRunnerArgsSchema(schema)) throw new RunnerError(`${where}: its runner ${target.runner} accepts no arguments, but got: ${argv.join(" ")}`, "Set these in the host file instead.");
2885
+ const options = new Set(schema.options);
2886
+ const accepted = new Set(acceptedBy(schema));
2887
+ const kept = [];
2888
+ const unknown = [];
2889
+ for (const entry of entriesOf(argv, (name) => options.has(name), where)) {
2890
+ const instead = schema.retired?.[entry.name];
2891
+ if (accepted.has(entry.name)) kept.push(...entry.tokens);
2892
+ else if (instead !== void 0) warnRetired(entry.name, instead);
2893
+ else unknown.push(entry.name);
2894
+ }
2895
+ if (unknown.length > 0) throw new RunnerError(`${where}: its runner ${target.runner} does not accept ${unknown.join(", ")}.`, `It accepts: ${[...accepted].join(", ") || "no arguments"}.`);
2896
+ return kept;
2897
+ }
2898
+ /**
2899
+ * A compound's arguments, per member key: each member gets the ones its
2900
+ * runner accepts. A member option arrives under its member name
2901
+ * (`--switchboard-port 4001` reaches that member as `--port 4001`). An
2902
+ * argument no member accepts fails, as does one that would set the same
2903
+ * option on several members.
2904
+ */
2905
+ function splitCompoundArgv(argv, host, members) {
2906
+ const perMember = new Map(members.map((m) => [m.key, []]));
2907
+ if (argv.length === 0) return perMember;
2908
+ const where = `hosts/${host}`;
2909
+ const schemas = members.flatMap((m) => isRunnerArgsSchema(m.schema) ? [{
2910
+ key: m.key,
2911
+ schema: m.schema
2912
+ }] : []);
2913
+ const memberNames = /* @__PURE__ */ new Map();
2914
+ for (const { schema } of schemas) for (const [alias, option] of Object.entries(schema.memberOptions ?? {})) {
2915
+ const aliases = memberNames.get(option) ?? [];
2916
+ if (!aliases.includes(alias)) aliases.push(alias);
2917
+ memberNames.set(option, aliases);
2918
+ }
2919
+ const takesValue = (name) => schemas.some(({ schema }) => schema.options.includes(name) || schema.memberOptions?.[name] !== void 0);
2920
+ const warned = /* @__PURE__ */ new Set();
2921
+ const unknown = [];
2922
+ for (const entry of entriesOf(argv, takesValue, where)) {
2923
+ const { name, tokens } = entry;
2924
+ const named = schemas.filter(({ schema }) => schema.memberOptions?.[name] !== void 0);
2925
+ if (named.length > 1) throw new RunnerError(`${where}: ${name} matches the members ${named.map((m) => m.key).join(", ")}.`, "Set the option in each member's host file instead.");
2926
+ if (named.length === 1) {
2927
+ const { key, schema } = named[0];
2928
+ const first = (schema.memberOptions?.[name] ?? name) + tokens[0].slice(name.length);
2929
+ perMember.get(key)?.push(first, ...tokens.slice(1));
2930
+ continue;
2931
+ }
2932
+ const aliases = memberNames.get(name);
2933
+ if (aliases) throw new RunnerError(`${where}: ${name} does not say which member it is for.`, `Use ${aliases.join(" or ")}.`);
2934
+ const takers = schemas.filter(({ schema }) => acceptedBy(schema).includes(name));
2935
+ if (takers.length > 0) {
2936
+ for (const { key } of takers) perMember.get(key)?.push(...tokens);
2937
+ continue;
2938
+ }
2939
+ const retired = schemas.find(({ schema }) => schema.retired?.[name] !== void 0);
2940
+ if (retired) {
2941
+ if (!warned.has(name)) {
2942
+ warned.add(name);
2943
+ warnRetired(name, retired.schema.retired?.[name] ?? "");
2944
+ }
2945
+ continue;
2946
+ }
2947
+ unknown.push(name);
2948
+ }
2949
+ if (unknown.length > 0) {
2950
+ const accepted = members.map((m) => {
2951
+ if (!isRunnerArgsSchema(m.schema)) return ` - ${m.key} (${m.runner}): no arguments`;
2952
+ const schema = m.schema;
2953
+ const scoped = new Set(Object.values(schema.memberOptions ?? {}));
2954
+ const names = [...Object.keys(schema.memberOptions ?? {}), ...acceptedBy(schema).filter((name) => !scoped.has(name))];
2955
+ return ` - ${m.key} (${m.runner}): ${names.join(", ") || "no arguments"}`;
2956
+ });
2957
+ throw new RunnerError(`${where}: no member accepts ${unknown.join(", ")}. The members accept:\n${accepted.join("\n")}`);
2958
+ }
2959
+ return perMember;
2960
+ }
2961
+ //#endregion
2747
2962
  //#region src/run-record-schema.ts
2748
2963
  /**
2749
2964
  * `.ph/run/<host>.json`, version 2 (typed-host-configs 3.6): what a running
@@ -2836,19 +3051,78 @@ function isPidAlive(pid) {
2836
3051
  return error.code === "EPERM";
2837
3052
  }
2838
3053
  }
3054
+ /** When a process started, in ms since the epoch; undefined when the
3055
+ * platform does not tell (the process is gone, the tool is missing). */
3056
+ function processStartedAtMs(pid) {
3057
+ try {
3058
+ if (process.platform === "linux") {
3059
+ const stat = fs.readFileSync(`/proc/${pid}/stat`, "utf8");
3060
+ const ticks = Number(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[19]);
3061
+ const boot = /^btime (\d+)$/m.exec(fs.readFileSync("/proc/stat", "utf8"));
3062
+ if (!boot || !Number.isFinite(ticks)) return void 0;
3063
+ return (Number(boot[1]) + ticks / 100) * 1e3;
3064
+ }
3065
+ const [command, args] = process.platform === "win32" ? ["powershell.exe", [
3066
+ "-NoProfile",
3067
+ "-NonInteractive",
3068
+ "-Command",
3069
+ `(Get-Process -Id ${pid}).StartTime.ToUniversalTime().ToString('o')`
3070
+ ]] : ["ps", [
3071
+ "-o",
3072
+ "lstart=",
3073
+ "-p",
3074
+ String(pid)
3075
+ ]];
3076
+ const out = execFileSync(command, args, {
3077
+ encoding: "utf8",
3078
+ stdio: [
3079
+ "ignore",
3080
+ "pipe",
3081
+ "ignore"
3082
+ ],
3083
+ timeout: 1e4,
3084
+ windowsHide: true,
3085
+ env: {
3086
+ ...process.env,
3087
+ LC_ALL: "C"
3088
+ }
3089
+ }).trim();
3090
+ const started = Date.parse(out);
3091
+ return Number.isFinite(started) ? started : void 0;
3092
+ } catch {
3093
+ return;
3094
+ }
3095
+ }
3096
+ const START_SLACK_MS = 5e3;
3097
+ const confirmedRecords = /* @__PURE__ */ new Set();
3098
+ /** True when the recorded pid now names another process: one that started
3099
+ * after the record was written. False when that cannot be told. */
3100
+ function isPidReused(record) {
3101
+ if (record.pid === process.pid) return false;
3102
+ const recordedAt = Date.parse(record.startedAt);
3103
+ if (!Number.isFinite(recordedAt)) return false;
3104
+ const key = `${record.pid}:${record.startedAt}`;
3105
+ if (confirmedRecords.has(key)) return false;
3106
+ const startedAt = processStartedAtMs(record.pid);
3107
+ if (startedAt === void 0) return false;
3108
+ if (startedAt > recordedAt + START_SLACK_MS) return true;
3109
+ confirmedRecords.add(key);
3110
+ return false;
3111
+ }
2839
3112
  /**
2840
3113
  * Decide whether the recorded instance is this project's live host.
2841
3114
  *
2842
- * pid liveness alone proves nothing (pids are reused), and the recorded
3115
+ * pid liveness alone proves nothing (pids are reused): a live pid counts
3116
+ * only when its process started before the record was written. The recorded
2843
3117
  * projectName is what separates "my instance" from "a different project that
2844
3118
  * happens to hold this storage root" — the confusion the vetra lock exists to
2845
- * prevent. A stale record (dead pid) is reported so the caller can clear it; a
2846
- * foreign one (live pid, different project) is left alone.
3119
+ * prevent. A stale record (dead or reused pid) is reported so the caller can
3120
+ * clear it; a foreign one (live pid, different project) is left alone.
2847
3121
  */
2848
3122
  function probeRun(projectDir, hostName, projectName, env = process.env) {
2849
3123
  const record = readRunRecord(projectDir, hostName, env);
2850
3124
  if (!record) return { status: "none" };
2851
- if (!isPidAlive(record.pid)) return {
3125
+ if (!isPidAlive(record.pid) || isPidReused(record)) return {
2852
3126
  status: "stale",
2853
3127
  record
2854
3128
  };
@@ -3160,6 +3434,11 @@ async function runCompound(hostInput, ctx, options) {
3160
3434
  const producer = byKey.get(target.key);
3161
3435
  return producer ? runnerOutputsSchema(producer.runner, producer.specifier, `member "${target.key}"`) : { error: `names member "${target.key}", which was not prepared.` };
3162
3436
  } });
3437
+ const memberArgv = splitCompoundArgv(ctx.argv ?? [], hostInput.name, prepared.map((m) => ({
3438
+ key: m.key,
3439
+ runner: m.specifier,
3440
+ schema: m.runner.argsSchema
3441
+ })));
3163
3442
  if (wiring.cspRegistrySync && !prepared.some(takesCspRegistrySync)) console.warn(`${compoundFile}: config.cspRegistrySync is set, but no member's runner declares runner.cspRegistrySync (members run: ${prepared.map((m) => m.specifier).join(", ")}); the baked Connect CSP is not patched for the runtime registry.`);
3164
3443
  const started = [];
3165
3444
  const liveOutputs = /* @__PURE__ */ new Map();
@@ -3190,14 +3469,16 @@ async function runCompound(hostInput, ctx, options) {
3190
3469
  const validated = validateHost(m.runner, m.specifier, resolved, m.file, oneShot ? { tokens: "allow" } : {});
3191
3470
  const fn = getVerb(m.runner, m.specifier, memberVerb);
3192
3471
  const where = `${name} (${m.specifier} ${memberVerb})`;
3193
- const handle = toStartedHandle(await fn(validated, {
3472
+ const argv = memberArgv.get(name) ?? [];
3473
+ const handle = toStartedHandle(await fn(oneShot ? emptyMaps(validated, resolved) : validated, {
3194
3474
  projectRoot,
3195
3475
  env: ctx.env,
3196
3476
  verb: memberVerb,
3197
3477
  parent: {
3198
3478
  host: host.name,
3199
3479
  verb
3200
- }
3480
+ },
3481
+ ...argv.length > 0 ? { argv } : {}
3201
3482
  }), where);
3202
3483
  started.push({
3203
3484
  name,
@@ -3291,6 +3572,6 @@ async function prepareMember(projectRoot, key, member) {
3291
3572
  };
3292
3573
  }
3293
3574
  //#endregion
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 };
3575
+ export { knownVerbIssues as $, reactorSchema as $t, splitCompoundArgv as A, entryActiveForVerb as An, HOST_NAME_MAX_LENGTH as At, loadHost as B, runObserveHookSequential as Bn, defineHostSchemas as Bt, readProjectName as C, tokenable as Cn, collectTokenSites as Ct, runRecordSchema as D, resolveHostPlugins as Dn, renderTokens as Dt, runRecordMemberSchema as E, findDeadConnectConfig as En, isPlainObject as Et, describeHostOutputs as F, pluginEntryObjectSchema as Fn, compoundHostSchema as Ft, CONNECT_RUNNER as G, makeHostSchemas as Gt, readOutputsFileHash as H, runTransformHook as Hn, emittedHostSchemas as Ht, findNonStaticValue as I, pluginEntrySchema as In, compoundWiringSchema as It, STORE_VERBS as J, profileSchema as Jt, ONE_SHOT_VERBS as K, originOrUrlSchema as Kt, lintHostImportGraph as L, registerHostType as Ln, connectReactorIssues as Lt, HostLoadError as M, mergeContributions as Mn, HOST_NAME_PATTERN as Mt, OUTPUTS_FILE as N, normalizePluginEntries as Nn, childWrapperSchema as Nt, checkRunnerArgv as O, resolvePluginContributions as On, unwrapEscapes as Ot, computeOutputsHash as P, normalizePluginEntry as Pn, childrenSchema as Pt, kindShapeIssues as Q, reactorProtocolSchema as Qt, lintHostImports as R, resolveOrder as Rn, declaredGenericCompoundHostSchema as Rt, probeRun as S, tokenSchema as Sn, schemaAtPath as St, writeRunRecord as T, defaultConnectComposition as Tn, formatPath as Tt, scanHostImports as U, genericCompoundHostSchema as Ut, probeHostsFolder as V, runProvideHook as Vn, emitHostJsonSchema as Vt, stripComments as W, hostNameSchema as Wt, hostSchemaIssues as X, reactorBackendSchema as Xt, getVerb as Y, reactorBackendKindSchema as Yt, isSchemaLike as Z, reactorHostSchema as Zt, resolveUserDataPlaceholders as _, keyTokenSchema as _n, checkTokenSites as _t, stopStreamOf as a, driveDeclarationSchema as an, describeMapElements as at, isPidAlive as b, ref as bn, outputSitesOf as bt, toStartedHandle as c, TOKEN_ESCAPE_KEY as cn, unsetEnvMessage as ct, loadProducers as d, envTokenSchema as dn, planCompound as dt, refineConnectReactor as en, listVerbs as et, processResolveEnv as f, envTokenable as fn, BUILTIN_ENV_NAMES as ft, defaultUserDataDir as g, itemTokenSchema as gn, checkOutputPaths as gt, runnerOutputsSchema as h, isToken as hn, findRemovedForms as ht, runCompound as i, buildDriveDeclarationSchema as in, TokenResolutionError as it, splitRunArgv as j, hostTypeSatisfies as jn, HOST_NAME_MESSAGE as jt, isRunnerArgsSchema as k, PluginError as kn, CONNECT_PRIMARY_MESSAGE as kt, compoundOutputSource as l, TOKEN_KEYS as ln, PlanError as lt, runRecordOutputSource as m, forbidRef as mn, substituteBuiltinEnv as mt, memberVerbOf as n, runnerBaseSchema as nn, validateDeclaredHost as nt, takesCspRegistrySync as o, drivesSchema as on, emptyMaps as ot, producerOutputsSchemas as p, findToken as pn, isBuiltinEnvName as pt, RunnerError as q, placementKeyIssues as qt, prepareMember as r, runnerKindSchema as rn, validateHost as rt, runnerHandleSchema as s, projectDriveIdWith as sn, resolveHostOutputs as st, compoundStartVerb as t, refineStartOrder as tn, resolveRunnerModule as tt, OUTPUT_DATA_DIRS_ENV as u, concatTokenSchema as un, memberForRef as ut, applyChildWrapper as v, mapTokenSchema as vn, envSitesOf as vt, readRunRecord as w, CONNECT_PLUGIN_OWNED_SLICES as wn, describeToken as wt, listRunRecords as x, tokenKeyOf as xn, refKey as xt, clearRunRecord as y, outputTokenSchema as yn, outputRefsOf as yt, lintOutputsFile as z, runObserveHook as zn, declaredHostSchemas as zt };
3295
3576
 
3296
- //# sourceMappingURL=compound-DO_mvh0O.mjs.map
3577
+ //# sourceMappingURL=compound-CDrU3CLt.mjs.map