@powerhousedao/host-core 6.2.3-dev.73 → 6.2.3-dev.74
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-PhoVeqe1.d.mts → compound-DlaK_sWa.d.mts} +46 -2
- package/dist/{compound-PhoVeqe1.d.mts.map → compound-DlaK_sWa.d.mts.map} +1 -1
- package/dist/{compound-B6RZMA0Y.mjs → compound-Gjt5rBfF.mjs} +134 -52
- package/dist/compound-Gjt5rBfF.mjs.map +1 -0
- package/dist/{env-substitution-Dj3pdsut.mjs → env-substitution-BjpuE5fm.mjs} +8 -3
- package/dist/{env-substitution-Dj3pdsut.mjs.map → env-substitution-BjpuE5fm.mjs.map} +1 -1
- package/dist/env-substitution-C_fVirPh.d.mts.map +1 -1
- package/dist/index.d.mts +227 -123
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +469 -11
- package/dist/index.mjs.map +1 -1
- package/dist/projection.d.mts +19 -6
- package/dist/projection.d.mts.map +1 -1
- package/dist/projection.mjs +47 -17
- package/dist/projection.mjs.map +1 -1
- package/dist/runners/compound.d.mts +1 -1
- package/dist/runners/compound.d.mts.map +1 -1
- package/dist/runners/compound.mjs +2 -2
- package/dist/runners/compound.mjs.map +1 -1
- package/dist/schema.d.mts +14 -1
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +1 -1
- package/package.json +3 -3
- package/dist/compound-B6RZMA0Y.mjs.map +0 -1
|
@@ -305,7 +305,12 @@ function emittedHostSchemas() {
|
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/env-substitution.ts
|
|
308
|
-
|
|
308
|
+
/** The always-resolvable `$env` names (also the `"${name}"` sugar). */
|
|
309
|
+
const BUILTIN_ENV_NAMES = ["userData", "projectRoot"];
|
|
310
|
+
function isBuiltinEnvName(name) {
|
|
311
|
+
return BUILTIN_ENV_NAMES.includes(name);
|
|
312
|
+
}
|
|
313
|
+
const BUILTIN = new RegExp(`\\$\\{(${BUILTIN_ENV_NAMES.join("|")})\\}`, "g");
|
|
309
314
|
function substitute(text, env) {
|
|
310
315
|
return text.replace(BUILTIN, (match, name) => env[name] ?? match);
|
|
311
316
|
}
|
|
@@ -325,6 +330,6 @@ function substituteValue(value, env) {
|
|
|
325
330
|
return value;
|
|
326
331
|
}
|
|
327
332
|
//#endregion
|
|
328
|
-
export {
|
|
333
|
+
export { envTokenSchema as A, tokenKeyOf as B, buildDriveDeclarationSchema as C, TOKEN_ESCAPE_KEY as D, projectDriveIdWith as E, itemTokenSchema as F, tokenable as H, keyTokenSchema as I, mapTokenSchema as L, findToken as M, forbidRef as N, TOKEN_KEYS as O, isToken as P, outputTokenSchema as R, runnerKindSchema as S, drivesSchema as T, tokenSchema as V, reactorHostSchema as _, compoundHostSchema as a, refineStartOrder as b, declaredHostSchemas as c, emittedHostSchemas as d, genericCompoundHostSchema as f, reactorBackendSchema as g, reactorBackendKindSchema as h, childrenSchema as i, envTokenable as j, concatTokenSchema as k, defineHostSchemas as l, profileSchema as m, substituteBuiltinEnv as n, compoundWiringSchema as o, makeHostSchemas as p, childWrapperSchema as r, declaredGenericCompoundHostSchema as s, isBuiltinEnvName as t, emitHostJsonSchema as u, reactorProtocolSchema as v, driveDeclarationSchema as w, runnerBaseSchema as x, reactorSchema as y, ref as z };
|
|
329
334
|
|
|
330
|
-
//# sourceMappingURL=env-substitution-
|
|
335
|
+
//# sourceMappingURL=env-substitution-BjpuE5fm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-substitution-Dj3pdsut.mjs","names":[],"sources":["../src/drive-schema.ts","../src/host-schemas.ts","../src/env-substitution.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { tokenable, type TokenableSchema } from \"./tokens.js\";\n\n/**\n * The schema half of drives.ts, zod only so `./schema` stays neutral.\n * - slug: the SEEDING KEY (idempotence); id optional (stable identity).\n * - preferredEditor: stored at header.meta.preferredEditor; Connect config's\n * `app` is the legacy alias.\n * - remote.url: a drive served elsewhere; local fields are ignored for it.\n * Token-able (`$output` on a producer's `drives.<slug>.url`).\n */\nexport function buildDriveDeclarationSchema(\n urlField: (schema: z.ZodString) => TokenableSchema<z.ZodString>,\n) {\n return z.strictObject({\n slug: z.string().min(1),\n id: z.string().min(1).optional(),\n /** Derive the id from the project path, like generateProjectDriveId — the\n * same ids classic `ph vetra` produces. `true` serves the drive under the\n * hashed slug too (the vetra drive's slug IS its hashed id); `\"id\"` hashes\n * only the id and keeps the declared slug (the classic Workflows drive:\n * `/d/workflows`, id `workflows-<hash>`). */\n projectHash: z.union([z.boolean(), z.literal(\"id\")]).optional(),\n name: z.string().min(1).optional(),\n icon: z.string().optional(),\n preferredEditor: z.string().optional(),\n sharingType: z.enum([\"public\", \"private\", \"shared\"]).optional(),\n availableOffline: z.boolean().optional(),\n remote: z.strictObject({ url: urlField(z.string().min(1)) }).optional(),\n });\n}\n\nexport const driveDeclarationSchema = buildDriveDeclarationSchema(tokenable);\n\nexport type DriveDeclaration = z.infer<typeof driveDeclarationSchema>;\n\nexport const drivesSchema = z.array(driveDeclarationSchema);\n\n/** The project-hashed drive id (`${slug}-${sha256(projectRoot)[0..8]}`) with\n * the hash function injected, so neutral consumers (a browser monitor) can\n * pass `crypto.subtle`-derived or precomputed hex. drives.ts binds it to\n * node:crypto as `projectDriveId`. */\nexport function projectDriveIdWith(\n sha256Hex: (input: string) => string,\n projectRoot: string,\n slug: string,\n): string {\n return `${slug}-${sha256Hex(projectRoot).substring(0, 8)}`;\n}\n","import { z } from \"zod\";\nimport { buildDriveDeclarationSchema } from \"./drive-schema.js\";\nimport { pluginEntrySchema } from \"./plugins.js\";\nimport {\n envTokenable,\n tokenable,\n type EnvToken,\n type TokenableSchema,\n type TokenMode,\n} from \"./tokens.js\";\n\n/**\n * The zod single source for host.js blocks (typed-host-configs G1). Every\n * host type is z.input/z.output of these schemas; nothing is hand-mirrored.\n * Top-level host objects and the `reactor` block are STRICT (a typo fails);\n * `runner` stays loose until each runner declares its options (T2), and\n * `config` is runner-defined.\n *\n * Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`\n * (required), `reactor.drives` (whole list, e.g. `$map`),\n * `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.\n */\n\nexport const profileSchema = z.strictObject({\n appId: z.string().min(1).optional(),\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n icon: z.string().optional(),\n});\n\nexport const reactorProtocolSchema = z.strictObject({\n featureFlags: z\n .strictObject({\n documentDecisions: z.boolean().optional(),\n authEnforcement: z.boolean().optional(),\n authGroups: z.boolean().optional(),\n authConditions: z.boolean().optional(),\n })\n .optional(),\n createSignaturePolicy: z.enum([\"legacy\", \"v2-required\"]).optional(),\n unsupportedStoredDocuments: z.enum([\"refuse\", \"read-only\"]).optional(),\n});\n\nexport const runnerKindSchema = z.enum([\"reactor\", \"compound\"]);\nexport type RunnerKind = z.infer<typeof runnerKindSchema>;\n\nexport const reactorBackendKindSchema = z.enum([\n \"in-process\",\n \"worker\",\n \"remote\",\n]);\n\n// Path-equality for the one-dir guard: pure string normalisation (the host\n// core stays Node-free); the server repeats the check with path.resolve.\nconst samePath = (a: string, b: string): boolean => {\n const norm = (p: string) =>\n p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").replace(/^\\.\\//, \"\");\n return norm(a) === norm(b);\n};\n\n/** Compound wiring: the generic compound runner's `config` block.\n * (`projectDrivesIntoConnect` and `drivesPublicBase` were removed in T3: a\n * member consumes another member's drives through `$output` tokens.) */\nexport const compoundWiringSchema = z.strictObject({\n /** Member start order; must name declared children and agree with the\n * output-token dependencies (resolve/plan.ts). Optional: without it the\n * order is derived from the tokens. Unnamed members start after the named\n * ones, in declaration order. */\n startOrder: z.array(z.string().min(1)).optional(),\n /** Write .ph/run/<host>.json (default true). */\n runtimeRecord: z.boolean().optional(),\n /** Patch the baked CSP for the runtime registry on a served Connect\n * member (forwarded as `runner.cspRegistrySync` to every member whose\n * runner is `@powerhousedao/ph-cli/runners/connect`). */\n cspRegistrySync: z.boolean().optional(),\n});\n\n/** `config.startOrder ⊆ keys(children)`, checked where both are visible.\n * Apply it LAST (`.superRefine(refineStartOrder)`) to a runner's final host\n * schema: zod refuses to `.extend()` a refined object. */\nexport function refineStartOrder(\n host: { children: Record<string, unknown>; config?: Record<string, unknown> },\n ctx: z.RefinementCtx,\n): void {\n const startOrder = host.config?.startOrder;\n if (!Array.isArray(startOrder)) return;\n const members = Object.keys(host.children);\n startOrder.forEach((name: unknown, index) => {\n if (startOrder.indexOf(name) !== index) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"config\", \"startOrder\", index],\n message: `startOrder names \"${String(name)}\" twice; each member starts once.`,\n });\n return;\n }\n if (typeof name === \"string\" && members.includes(name)) return;\n ctx.addIssue({\n code: \"custom\",\n path: [\"config\", \"startOrder\", index],\n message: `startOrder names \"${String(name)}\", which is not a member. Members: ${members.join(\", \") || \"(none)\"}.`,\n });\n });\n}\n\n/** How a schema set wraps its token-able fields. Both modes share one static\n * type (declared input, resolved output); they differ at runtime only. */\ninterface FieldWrappers {\n any: <S extends z.ZodType>(schema: S) => TokenableSchema<S>;\n env: <S extends z.ZodType>(schema: S) => TokenableSchema<S, EnvToken>;\n}\n\nconst ALLOW_TOKENS: FieldWrappers = { any: tokenable, env: envTokenable };\n// A one-option union: the same validation as `schema`, typed like the\n// \"allow\" wrappers so both modes share HostSchemas.\nconst FORBID_TOKENS: FieldWrappers = {\n any: (schema) => z.union([schema]),\n env: (schema) => z.union([schema]),\n};\n\n/**\n * Builds the host schema set. \"allow\" (declared form) accepts `T | Token` in\n * every token-able field; \"forbid\" (resolved form) accepts `T` only.\n */\nfunction buildHostSchemas(tokenField: FieldWrappers) {\n const reactorBackendSchema = z\n .strictObject({\n kind: reactorBackendKindSchema,\n storage: z\n .strictObject({\n kind: z.enum([\"idb\", \"memory\", \"path\", \"postgres\"]),\n /** `\"${userData}/…\"` sugar or `{ $env: \"NAME\" }`. */\n dataDir: tokenField.env(z.string()).optional(),\n url: z.string().optional(),\n })\n .optional(),\n readModel: z.strictObject({ url: z.string().optional() }).optional(),\n packages: z\n .strictObject({\n cdnUrl: z.string().optional(),\n specs: z.array(z.string()).optional(),\n /** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n dynamic: z.boolean().optional(),\n })\n .optional(),\n // The reactor to attach to, by URL: typically a producer's\n // `endpoints.graphql` output token. (`remote.host` was removed in T3.)\n remote: z.strictObject({ url: tokenField.any(z.url()) }).optional(),\n // Deployment topology (R1): field names match the real switchboard\n // options (projectionWorker / workerPool).\n projection: z\n .strictObject({\n enabled: z.boolean().optional(),\n dbPoolSize: z.number().int().positive().optional(),\n })\n .optional(),\n executors: z\n .strictObject({\n numWorkers: z\n .union([z.number().int().positive(), z.literal(\"auto\")])\n .optional(),\n })\n .optional(),\n })\n // Two PGlite instances on one data dir corrupt it: the reactor store\n // (storage.dataDir) and the read-model store (readModel.url) must differ.\n // Postgres is exempt: one database legitimately serves both stores.\n .superRefine((backend, ctx) => {\n // 2.1 \"a remote backend needs url\": `remote` is optional for the\n // in-process/worker kinds, but a remote backend attaches by URL only.\n if (backend.kind === \"remote\" && !backend.remote) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"remote\", \"url\"],\n message:\n 'a \"remote\" backend needs remote.url: remote: { url: switchboard.endpoints.graphql } ' +\n 'with switchboard from ../switchboard/outputs.js, or remote: { url: { $output: { host: \"switchboard\", path: [\"endpoints\", \"graphql\"] } } }.',\n });\n }\n const store = backend.storage;\n const storeDir = store?.kind === \"path\" ? store.dataDir : undefined;\n const readModel = backend.readModel?.url;\n // In the declared form dataDir may still be a `$env` token: compare\n // only resolved strings (resolved validation re-runs this check).\n if (\n typeof storeDir === \"string\" &&\n readModel &&\n samePath(storeDir, readModel)\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"readModel\", \"url\"],\n message:\n `readModel.url must not be the reactor's storage dir (${readModel}): ` +\n \"two PGlite instances on one data dir corrupt it. Omit readModel.url \" +\n \"to get the classic <root>/.ph/read-storage next to the reactor store.\",\n });\n }\n });\n\n const reactorSchema = z.strictObject({\n backends: z.record(z.string(), reactorBackendSchema).optional(),\n placement: z\n .strictObject({\n primary: z.string().optional(),\n default: z.looseObject({}).optional(),\n })\n .optional(),\n protocol: reactorProtocolSchema.optional(),\n /** DEPRECATED (dies in R2): workflows become a listed plugin. */\n workflows: z.boolean().optional(),\n // R1 core keys: identity/signing, package registry, storage namespace,\n // access control — capabilities and intrinsics of the reactor.\n renown: z\n .strictObject({\n url: z.string().optional(),\n networkId: z.string().optional(),\n chainId: z.number().int().optional(),\n })\n .optional(),\n packages: z.strictObject({ registryUrl: z.string().optional() }).optional(),\n namespace: z.string().min(1).optional(),\n auth: z\n .strictObject({\n enabled: z.boolean().optional(),\n admins: z.array(z.string()).optional(),\n renown: z.looseObject({}).optional(),\n })\n .optional(),\n // Core-declared, seeded by the host runtime. Token-able as a whole\n // (3.3): a `$map` over a producer's `drives` output (or an `$output` of\n // an array of declarations) renders the list at resolve time.\n drives: tokenField\n .any(z.array(buildDriveDeclarationSchema(tokenField.any)))\n .optional(),\n });\n\n /** Common runner options; runner modules extend it with their own. */\n const runnerBaseSchema = z.looseObject({\n module: z.string().min(1),\n defaultVerb: z.string().min(1).optional(),\n port: z.number().int().positive().optional(),\n /** Bind address; each runner documents its default. */\n host: z.string().min(1).optional(),\n /** THE COMPOSITION: plugin entries; presence is activation. */\n plugins: z.array(pluginEntrySchema).optional(),\n });\n\n /** A compound member wrapper. Sections are FULL STATEMENTS except `runner`,\n * which key-merges over the member's own. Plugins live in `runner.plugins`\n * (as on a standalone host); there is no wrapper-level `plugins`. */\n const childWrapperSchema = z.strictObject({\n host: z.string().min(1),\n runner: runnerBaseSchema.partial().optional(),\n config: z.looseObject({}).optional(),\n reactor: reactorSchema.optional(),\n });\n\n const childrenSchema = z.record(z.string(), childWrapperSchema);\n\n const reactorHostSchema = z.strictObject({\n name: z.string().min(1),\n runner: runnerBaseSchema,\n config: z.looseObject({}).optional(),\n profile: profileSchema.optional(),\n reactor: reactorSchema.optional(),\n });\n\n const compoundHostSchema = z.strictObject({\n name: z.string().min(1),\n runner: runnerBaseSchema,\n children: childrenSchema,\n config: z.looseObject({}).optional(),\n profile: profileSchema.optional(),\n });\n\n return {\n reactorBackendSchema,\n reactorSchema,\n runnerBaseSchema,\n childWrapperSchema,\n childrenSchema,\n reactorHostSchema,\n compoundHostSchema,\n /** This set's field wrapper, for a runner's OWN token-able fields inside\n * `defineHostSchemas`: declared, `T | Token` in and `T` out; resolved,\n * `T` only. Both modes share one static type. */\n tokenable: tokenField.any,\n /** As `tokenable`, but the only token accepted is `$env`. */\n envTokenable: tokenField.env,\n };\n}\n\nexport type HostSchemas = ReturnType<typeof buildHostSchemas>;\n\n/** The host schema set in declared (\"allow\": token-able fields take tokens)\n * or resolved (\"forbid\") form. */\nexport function makeHostSchemas(options: { tokens: TokenMode }): HostSchemas {\n return buildHostSchemas(\n options.tokens === \"allow\" ? ALLOW_TOKENS : FORBID_TOKENS,\n );\n}\n\n/**\n * One runner definition, two schemas (3.5): `build` runs over the DECLARED\n * set (tokens allowed; its z.input types host files) and the RESOLVED set\n * (no tokens; `validateHost` checks it before the verb). Export both, type\n * the host as `z.input<typeof declaredHostSchema>`, refine last inside the\n * builder (zod can't extend a refined object), and wrap the runner's own\n * token-able fields with `s.tokenable` / `s.envTokenable`.\n */\nexport function defineHostSchemas<T>(build: (schemas: HostSchemas) => T): {\n declaredHostSchema: T;\n hostSchema: T;\n} {\n return {\n declaredHostSchema: build(declaredSchemas),\n hostSchema: build(resolvedSchemas),\n };\n}\n\nconst declaredSchemas = makeHostSchemas({ tokens: \"allow\" });\nconst resolvedSchemas = makeHostSchemas({ tokens: \"forbid\" });\n\n/* The exported base blocks are the RESOLVED form (what verbs receive). The\n * declared forms are `declaredHostSchemas` / `defineHostSchemas`. */\nexport const declaredHostSchemas: HostSchemas = declaredSchemas;\nexport const reactorBackendSchema = resolvedSchemas.reactorBackendSchema;\nexport const reactorSchema = resolvedSchemas.reactorSchema;\nexport const runnerBaseSchema = resolvedSchemas.runnerBaseSchema;\nexport const childWrapperSchema = resolvedSchemas.childWrapperSchema;\nexport const childrenSchema = resolvedSchemas.childrenSchema;\nexport const reactorHostSchema = resolvedSchemas.reactorHostSchema;\nexport const compoundHostSchema = resolvedSchemas.compoundHostSchema;\n\n/** The generic compound runner's host: the base with its wiring config. */\nconst genericCompound = defineHostSchemas((s) =>\n s.compoundHostSchema\n .extend({ config: compoundWiringSchema.optional() })\n .superRefine(refineStartOrder),\n);\nexport const genericCompoundHostSchema = genericCompound.hostSchema;\nexport const declaredGenericCompoundHostSchema =\n genericCompound.declaredHostSchema;\n\n/* -------------------------------------------------------------------- types */\n\nexport type Profile = z.infer<typeof profileSchema>;\nexport type ReactorProtocol = z.infer<typeof reactorProtocolSchema>;\nexport type ReactorBackend = z.infer<typeof reactorBackendSchema>;\nexport type ReactorBackendKind = ReactorBackend[\"kind\"];\nexport type ReactorStorageConfig = NonNullable<ReactorBackend[\"storage\"]>;\nexport type ReactorPackageConfig = NonNullable<ReactorBackend[\"packages\"]>;\nexport type ReactorRemoteConfig = NonNullable<ReactorBackend[\"remote\"]>;\nexport type ReactorConfig = z.infer<typeof reactorSchema>;\nexport type RunnerBase = z.infer<typeof runnerBaseSchema>;\nexport type ChildWrapper = z.infer<typeof childWrapperSchema>;\nexport type CompoundWiring = z.infer<typeof compoundWiringSchema>;\n\n/** What a host.js author writes (z.input), per runner kind. The `never`\n * sides make reactor XOR children a type error. */\nexport type ReactorHostInput = z.input<\n typeof declaredSchemas.reactorHostSchema\n> & {\n children?: never;\n};\nexport type CompoundHostInput = z.input<\n typeof declaredSchemas.compoundHostSchema\n> & {\n reactor?: never;\n};\nexport type HostDefinition = ReactorHostInput | CompoundHostInput;\n\n/** What a verb receives (z.output) from the base schemas. */\nexport type ReactorHost = z.output<typeof reactorHostSchema>;\nexport type CompoundHost = z.output<typeof compoundHostSchema>;\n\n/* --------------------------------------------------------------- JSON Schema */\n\nconst SCHEMA_BASE = \"https://powerhouse.inc/schemas\";\n\n/** One host schema as an editor JSON Schema with a stable `$id` — the\n * per-runner emission helper (runner packages emit their own hostSchema). */\nexport function emitHostJsonSchema(\n name: string,\n schema: z.ZodType,\n): Record<string, unknown> {\n return {\n $id: `${SCHEMA_BASE}/${name}.schema.json`,\n ...z.toJSONSchema(schema, { io: \"input\" }),\n };\n}\n\n/** The emitted-schema set, keyed by published filename. Pure — the\n * emit-schemas script writes these and the drift test re-derives them. */\nexport function emittedHostSchemas(): Record<string, unknown> {\n return {\n // Editor schemas describe what authors write: the declared form.\n \"host-reactor.schema.json\": emitHostJsonSchema(\n \"host-reactor\",\n declaredSchemas.reactorHostSchema,\n ),\n \"host-compound.schema.json\": emitHostJsonSchema(\n \"host-compound\",\n declaredSchemas.compoundHostSchema,\n ),\n };\n}\n","/**\n * Pure built-in `$env` substitution: the `\"${userData}\"` / `\"${projectRoot}\"`\n * string sugar, deep-applied to a JSON-shaped value. No node imports, so it\n * ships in `./schema`; the node default for userData is placeholders.ts.\n */\n\nexport interface BuiltinEnv {\n userData?: string;\n projectRoot?: string;\n}\n\nconst BUILTIN = /\\$\\{(userData|projectRoot)\\}/g;\n\nfunction substitute(text: string, env: BuiltinEnv): string {\n return text.replace(\n BUILTIN,\n (match, name: keyof BuiltinEnv) => env[name] ?? match,\n );\n}\n\n/** Deep-substitute the built-ins that `env` provides in every string; an\n * absent built-in is left as written. The input is never mutated. */\nexport function substituteBuiltinEnv<T>(value: T, env: BuiltinEnv): T {\n return substituteValue(value, env) as T;\n}\n\nfunction substituteValue(value: unknown, env: BuiltinEnv): unknown {\n if (typeof value === \"string\") return substitute(value, env);\n if (Array.isArray(value)) return value.map((v) => substituteValue(v, env));\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = substituteValue(v, env);\n }\n return out;\n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;AACF;;;AAIA,SAAgB,qBAA8C;CAC5D,OAAO;EAEL,4BAA4B,mBAC1B,gBACA,gBAAgB,iBAClB;EACA,6BAA6B,mBAC3B,iBACA,gBAAgB,kBAClB;CACF;AACF;;;AC5YA,MAAM,UAAU;AAEhB,SAAS,WAAW,MAAc,KAAyB;CACzD,OAAO,KAAK,QACV,UACC,OAAO,SAA2B,IAAI,SAAS,KAClD;AACF;;;AAIA,SAAgB,qBAAwB,OAAU,KAAoB;CACpE,OAAO,gBAAgB,OAAO,GAAG;AACnC;AAEA,SAAS,gBAAgB,OAAgB,KAA0B;CACjE,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,OAAO,GAAG;CAC3D,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,KAAK,MAAM,gBAAgB,GAAG,GAAG,CAAC;CACzE,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,MAA+B,CAAC;EACtC,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,KAAK,GACvC,IAAI,KAAK,gBAAgB,GAAG,GAAG;EAEjC,OAAO;CACT;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"env-substitution-BjpuE5fm.mjs","names":[],"sources":["../src/drive-schema.ts","../src/host-schemas.ts","../src/env-substitution.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { tokenable, type TokenableSchema } from \"./tokens.js\";\n\n/**\n * The schema half of drives.ts, zod only so `./schema` stays neutral.\n * - slug: the SEEDING KEY (idempotence); id optional (stable identity).\n * - preferredEditor: stored at header.meta.preferredEditor; Connect config's\n * `app` is the legacy alias.\n * - remote.url: a drive served elsewhere; local fields are ignored for it.\n * Token-able (`$output` on a producer's `drives.<slug>.url`).\n */\nexport function buildDriveDeclarationSchema(\n urlField: (schema: z.ZodString) => TokenableSchema<z.ZodString>,\n) {\n return z.strictObject({\n slug: z.string().min(1),\n id: z.string().min(1).optional(),\n /** Derive the id from the project path, like generateProjectDriveId — the\n * same ids classic `ph vetra` produces. `true` serves the drive under the\n * hashed slug too (the vetra drive's slug IS its hashed id); `\"id\"` hashes\n * only the id and keeps the declared slug (the classic Workflows drive:\n * `/d/workflows`, id `workflows-<hash>`). */\n projectHash: z.union([z.boolean(), z.literal(\"id\")]).optional(),\n name: z.string().min(1).optional(),\n icon: z.string().optional(),\n preferredEditor: z.string().optional(),\n sharingType: z.enum([\"public\", \"private\", \"shared\"]).optional(),\n availableOffline: z.boolean().optional(),\n remote: z.strictObject({ url: urlField(z.string().min(1)) }).optional(),\n });\n}\n\nexport const driveDeclarationSchema = buildDriveDeclarationSchema(tokenable);\n\nexport type DriveDeclaration = z.infer<typeof driveDeclarationSchema>;\n\nexport const drivesSchema = z.array(driveDeclarationSchema);\n\n/** The project-hashed drive id (`${slug}-${sha256(projectRoot)[0..8]}`) with\n * the hash function injected, so neutral consumers (a browser monitor) can\n * pass `crypto.subtle`-derived or precomputed hex. drives.ts binds it to\n * node:crypto as `projectDriveId`. */\nexport function projectDriveIdWith(\n sha256Hex: (input: string) => string,\n projectRoot: string,\n slug: string,\n): string {\n return `${slug}-${sha256Hex(projectRoot).substring(0, 8)}`;\n}\n","import { z } from \"zod\";\nimport { buildDriveDeclarationSchema } from \"./drive-schema.js\";\nimport { pluginEntrySchema } from \"./plugins.js\";\nimport {\n envTokenable,\n tokenable,\n type EnvToken,\n type TokenableSchema,\n type TokenMode,\n} from \"./tokens.js\";\n\n/**\n * The zod single source for host.js blocks (typed-host-configs G1). Every\n * host type is z.input/z.output of these schemas; nothing is hand-mirrored.\n * Top-level host objects and the `reactor` block are STRICT (a typo fails);\n * `runner` stays loose until each runner declares its options (T2), and\n * `config` is runner-defined.\n *\n * Token-able fields (typed-host-configs 3.5): `reactor.backends.*.remote.url`\n * (required), `reactor.drives` (whole list, e.g. `$map`),\n * `reactor.drives[].remote.url` and `storage.dataDir` (`$env` only). Their z.input admits tokens, their z.output is the resolved type.\n */\n\nexport const profileSchema = z.strictObject({\n appId: z.string().min(1).optional(),\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n icon: z.string().optional(),\n});\n\nexport const reactorProtocolSchema = z.strictObject({\n featureFlags: z\n .strictObject({\n documentDecisions: z.boolean().optional(),\n authEnforcement: z.boolean().optional(),\n authGroups: z.boolean().optional(),\n authConditions: z.boolean().optional(),\n })\n .optional(),\n createSignaturePolicy: z.enum([\"legacy\", \"v2-required\"]).optional(),\n unsupportedStoredDocuments: z.enum([\"refuse\", \"read-only\"]).optional(),\n});\n\nexport const runnerKindSchema = z.enum([\"reactor\", \"compound\"]);\nexport type RunnerKind = z.infer<typeof runnerKindSchema>;\n\nexport const reactorBackendKindSchema = z.enum([\n \"in-process\",\n \"worker\",\n \"remote\",\n]);\n\n// Path-equality for the one-dir guard: pure string normalisation (the host\n// core stays Node-free); the server repeats the check with path.resolve.\nconst samePath = (a: string, b: string): boolean => {\n const norm = (p: string) =>\n p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\").replace(/^\\.\\//, \"\");\n return norm(a) === norm(b);\n};\n\n/** Compound wiring: the generic compound runner's `config` block.\n * (`projectDrivesIntoConnect` and `drivesPublicBase` were removed in T3: a\n * member consumes another member's drives through `$output` tokens.) */\nexport const compoundWiringSchema = z.strictObject({\n /** Member start order; must name declared children and agree with the\n * output-token dependencies (resolve/plan.ts). Optional: without it the\n * order is derived from the tokens. Unnamed members start after the named\n * ones, in declaration order. */\n startOrder: z.array(z.string().min(1)).optional(),\n /** Write .ph/run/<host>.json (default true). */\n runtimeRecord: z.boolean().optional(),\n /** Patch the baked CSP for the runtime registry on a served Connect\n * member (forwarded as `runner.cspRegistrySync` to every member whose\n * runner is `@powerhousedao/ph-cli/runners/connect`). */\n cspRegistrySync: z.boolean().optional(),\n});\n\n/** `config.startOrder ⊆ keys(children)`, checked where both are visible.\n * Apply it LAST (`.superRefine(refineStartOrder)`) to a runner's final host\n * schema: zod refuses to `.extend()` a refined object. */\nexport function refineStartOrder(\n host: { children: Record<string, unknown>; config?: Record<string, unknown> },\n ctx: z.RefinementCtx,\n): void {\n const startOrder = host.config?.startOrder;\n if (!Array.isArray(startOrder)) return;\n const members = Object.keys(host.children);\n startOrder.forEach((name: unknown, index) => {\n if (startOrder.indexOf(name) !== index) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"config\", \"startOrder\", index],\n message: `startOrder names \"${String(name)}\" twice; each member starts once.`,\n });\n return;\n }\n if (typeof name === \"string\" && members.includes(name)) return;\n ctx.addIssue({\n code: \"custom\",\n path: [\"config\", \"startOrder\", index],\n message: `startOrder names \"${String(name)}\", which is not a member. Members: ${members.join(\", \") || \"(none)\"}.`,\n });\n });\n}\n\n/** How a schema set wraps its token-able fields. Both modes share one static\n * type (declared input, resolved output); they differ at runtime only. */\ninterface FieldWrappers {\n any: <S extends z.ZodType>(schema: S) => TokenableSchema<S>;\n env: <S extends z.ZodType>(schema: S) => TokenableSchema<S, EnvToken>;\n}\n\nconst ALLOW_TOKENS: FieldWrappers = { any: tokenable, env: envTokenable };\n// A one-option union: the same validation as `schema`, typed like the\n// \"allow\" wrappers so both modes share HostSchemas.\nconst FORBID_TOKENS: FieldWrappers = {\n any: (schema) => z.union([schema]),\n env: (schema) => z.union([schema]),\n};\n\n/**\n * Builds the host schema set. \"allow\" (declared form) accepts `T | Token` in\n * every token-able field; \"forbid\" (resolved form) accepts `T` only.\n */\nfunction buildHostSchemas(tokenField: FieldWrappers) {\n const reactorBackendSchema = z\n .strictObject({\n kind: reactorBackendKindSchema,\n storage: z\n .strictObject({\n kind: z.enum([\"idb\", \"memory\", \"path\", \"postgres\"]),\n /** `\"${userData}/…\"` sugar or `{ $env: \"NAME\" }`. */\n dataDir: tokenField.env(z.string()).optional(),\n url: z.string().optional(),\n })\n .optional(),\n readModel: z.strictObject({ url: z.string().optional() }).optional(),\n packages: z\n .strictObject({\n cdnUrl: z.string().optional(),\n specs: z.array(z.string()).optional(),\n /** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n dynamic: z.boolean().optional(),\n })\n .optional(),\n // The reactor to attach to, by URL: typically a producer's\n // `endpoints.graphql` output token. (`remote.host` was removed in T3.)\n remote: z.strictObject({ url: tokenField.any(z.url()) }).optional(),\n // Deployment topology (R1): field names match the real switchboard\n // options (projectionWorker / workerPool).\n projection: z\n .strictObject({\n enabled: z.boolean().optional(),\n dbPoolSize: z.number().int().positive().optional(),\n })\n .optional(),\n executors: z\n .strictObject({\n numWorkers: z\n .union([z.number().int().positive(), z.literal(\"auto\")])\n .optional(),\n })\n .optional(),\n })\n // Two PGlite instances on one data dir corrupt it: the reactor store\n // (storage.dataDir) and the read-model store (readModel.url) must differ.\n // Postgres is exempt: one database legitimately serves both stores.\n .superRefine((backend, ctx) => {\n // 2.1 \"a remote backend needs url\": `remote` is optional for the\n // in-process/worker kinds, but a remote backend attaches by URL only.\n if (backend.kind === \"remote\" && !backend.remote) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"remote\", \"url\"],\n message:\n 'a \"remote\" backend needs remote.url: remote: { url: switchboard.endpoints.graphql } ' +\n 'with switchboard from ../switchboard/outputs.js, or remote: { url: { $output: { host: \"switchboard\", path: [\"endpoints\", \"graphql\"] } } }.',\n });\n }\n const store = backend.storage;\n const storeDir = store?.kind === \"path\" ? store.dataDir : undefined;\n const readModel = backend.readModel?.url;\n // In the declared form dataDir may still be a `$env` token: compare\n // only resolved strings (resolved validation re-runs this check).\n if (\n typeof storeDir === \"string\" &&\n readModel &&\n samePath(storeDir, readModel)\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"readModel\", \"url\"],\n message:\n `readModel.url must not be the reactor's storage dir (${readModel}): ` +\n \"two PGlite instances on one data dir corrupt it. Omit readModel.url \" +\n \"to get the classic <root>/.ph/read-storage next to the reactor store.\",\n });\n }\n });\n\n const reactorSchema = z.strictObject({\n backends: z.record(z.string(), reactorBackendSchema).optional(),\n placement: z\n .strictObject({\n primary: z.string().optional(),\n default: z.looseObject({}).optional(),\n })\n .optional(),\n protocol: reactorProtocolSchema.optional(),\n /** DEPRECATED (dies in R2): workflows become a listed plugin. */\n workflows: z.boolean().optional(),\n // R1 core keys: identity/signing, package registry, storage namespace,\n // access control — capabilities and intrinsics of the reactor.\n renown: z\n .strictObject({\n url: z.string().optional(),\n networkId: z.string().optional(),\n chainId: z.number().int().optional(),\n })\n .optional(),\n packages: z.strictObject({ registryUrl: z.string().optional() }).optional(),\n namespace: z.string().min(1).optional(),\n auth: z\n .strictObject({\n enabled: z.boolean().optional(),\n admins: z.array(z.string()).optional(),\n renown: z.looseObject({}).optional(),\n })\n .optional(),\n // Core-declared, seeded by the host runtime. Token-able as a whole\n // (3.3): a `$map` over a producer's `drives` output (or an `$output` of\n // an array of declarations) renders the list at resolve time.\n drives: tokenField\n .any(z.array(buildDriveDeclarationSchema(tokenField.any)))\n .optional(),\n });\n\n /** Common runner options; runner modules extend it with their own. */\n const runnerBaseSchema = z.looseObject({\n module: z.string().min(1),\n defaultVerb: z.string().min(1).optional(),\n port: z.number().int().positive().optional(),\n /** Bind address; each runner documents its default. */\n host: z.string().min(1).optional(),\n /** THE COMPOSITION: plugin entries; presence is activation. */\n plugins: z.array(pluginEntrySchema).optional(),\n });\n\n /** A compound member wrapper. Sections are FULL STATEMENTS except `runner`,\n * which key-merges over the member's own. Plugins live in `runner.plugins`\n * (as on a standalone host); there is no wrapper-level `plugins`. */\n const childWrapperSchema = z.strictObject({\n host: z.string().min(1),\n runner: runnerBaseSchema.partial().optional(),\n config: z.looseObject({}).optional(),\n reactor: reactorSchema.optional(),\n });\n\n const childrenSchema = z.record(z.string(), childWrapperSchema);\n\n const reactorHostSchema = z.strictObject({\n name: z.string().min(1),\n runner: runnerBaseSchema,\n config: z.looseObject({}).optional(),\n profile: profileSchema.optional(),\n reactor: reactorSchema.optional(),\n });\n\n const compoundHostSchema = z.strictObject({\n name: z.string().min(1),\n runner: runnerBaseSchema,\n children: childrenSchema,\n config: z.looseObject({}).optional(),\n profile: profileSchema.optional(),\n });\n\n return {\n reactorBackendSchema,\n reactorSchema,\n runnerBaseSchema,\n childWrapperSchema,\n childrenSchema,\n reactorHostSchema,\n compoundHostSchema,\n /** This set's field wrapper, for a runner's OWN token-able fields inside\n * `defineHostSchemas`: declared, `T | Token` in and `T` out; resolved,\n * `T` only. Both modes share one static type. */\n tokenable: tokenField.any,\n /** As `tokenable`, but the only token accepted is `$env`. */\n envTokenable: tokenField.env,\n };\n}\n\nexport type HostSchemas = ReturnType<typeof buildHostSchemas>;\n\n/** The host schema set in declared (\"allow\": token-able fields take tokens)\n * or resolved (\"forbid\") form. */\nexport function makeHostSchemas(options: { tokens: TokenMode }): HostSchemas {\n return buildHostSchemas(\n options.tokens === \"allow\" ? ALLOW_TOKENS : FORBID_TOKENS,\n );\n}\n\n/**\n * One runner definition, two schemas (3.5): `build` runs over the DECLARED\n * set (tokens allowed; its z.input types host files) and the RESOLVED set\n * (no tokens; `validateHost` checks it before the verb). Export both, type\n * the host as `z.input<typeof declaredHostSchema>`, refine last inside the\n * builder (zod can't extend a refined object), and wrap the runner's own\n * token-able fields with `s.tokenable` / `s.envTokenable`.\n */\nexport function defineHostSchemas<T>(build: (schemas: HostSchemas) => T): {\n declaredHostSchema: T;\n hostSchema: T;\n} {\n return {\n declaredHostSchema: build(declaredSchemas),\n hostSchema: build(resolvedSchemas),\n };\n}\n\nconst declaredSchemas = makeHostSchemas({ tokens: \"allow\" });\nconst resolvedSchemas = makeHostSchemas({ tokens: \"forbid\" });\n\n/* The exported base blocks are the RESOLVED form (what verbs receive). The\n * declared forms are `declaredHostSchemas` / `defineHostSchemas`. */\nexport const declaredHostSchemas: HostSchemas = declaredSchemas;\nexport const reactorBackendSchema = resolvedSchemas.reactorBackendSchema;\nexport const reactorSchema = resolvedSchemas.reactorSchema;\nexport const runnerBaseSchema = resolvedSchemas.runnerBaseSchema;\nexport const childWrapperSchema = resolvedSchemas.childWrapperSchema;\nexport const childrenSchema = resolvedSchemas.childrenSchema;\nexport const reactorHostSchema = resolvedSchemas.reactorHostSchema;\nexport const compoundHostSchema = resolvedSchemas.compoundHostSchema;\n\n/** The generic compound runner's host: the base with its wiring config. */\nconst genericCompound = defineHostSchemas((s) =>\n s.compoundHostSchema\n .extend({ config: compoundWiringSchema.optional() })\n .superRefine(refineStartOrder),\n);\nexport const genericCompoundHostSchema = genericCompound.hostSchema;\nexport const declaredGenericCompoundHostSchema =\n genericCompound.declaredHostSchema;\n\n/* -------------------------------------------------------------------- types */\n\nexport type Profile = z.infer<typeof profileSchema>;\nexport type ReactorProtocol = z.infer<typeof reactorProtocolSchema>;\nexport type ReactorBackend = z.infer<typeof reactorBackendSchema>;\nexport type ReactorBackendKind = ReactorBackend[\"kind\"];\nexport type ReactorStorageConfig = NonNullable<ReactorBackend[\"storage\"]>;\nexport type ReactorPackageConfig = NonNullable<ReactorBackend[\"packages\"]>;\nexport type ReactorRemoteConfig = NonNullable<ReactorBackend[\"remote\"]>;\nexport type ReactorConfig = z.infer<typeof reactorSchema>;\nexport type RunnerBase = z.infer<typeof runnerBaseSchema>;\nexport type ChildWrapper = z.infer<typeof childWrapperSchema>;\nexport type CompoundWiring = z.infer<typeof compoundWiringSchema>;\n\n/** What a host.js author writes (z.input), per runner kind. The `never`\n * sides make reactor XOR children a type error. */\nexport type ReactorHostInput = z.input<\n typeof declaredSchemas.reactorHostSchema\n> & {\n children?: never;\n};\nexport type CompoundHostInput = z.input<\n typeof declaredSchemas.compoundHostSchema\n> & {\n reactor?: never;\n};\nexport type HostDefinition = ReactorHostInput | CompoundHostInput;\n\n/** What a verb receives (z.output) from the base schemas. */\nexport type ReactorHost = z.output<typeof reactorHostSchema>;\nexport type CompoundHost = z.output<typeof compoundHostSchema>;\n\n/* --------------------------------------------------------------- JSON Schema */\n\nconst SCHEMA_BASE = \"https://powerhouse.inc/schemas\";\n\n/** One host schema as an editor JSON Schema with a stable `$id` — the\n * per-runner emission helper (runner packages emit their own hostSchema). */\nexport function emitHostJsonSchema(\n name: string,\n schema: z.ZodType,\n): Record<string, unknown> {\n return {\n $id: `${SCHEMA_BASE}/${name}.schema.json`,\n ...z.toJSONSchema(schema, { io: \"input\" }),\n };\n}\n\n/** The emitted-schema set, keyed by published filename. Pure — the\n * emit-schemas script writes these and the drift test re-derives them. */\nexport function emittedHostSchemas(): Record<string, unknown> {\n return {\n // Editor schemas describe what authors write: the declared form.\n \"host-reactor.schema.json\": emitHostJsonSchema(\n \"host-reactor\",\n declaredSchemas.reactorHostSchema,\n ),\n \"host-compound.schema.json\": emitHostJsonSchema(\n \"host-compound\",\n declaredSchemas.compoundHostSchema,\n ),\n };\n}\n","/**\n * Pure built-in `$env` substitution: the `\"${userData}\"` / `\"${projectRoot}\"`\n * string sugar, deep-applied to a JSON-shaped value. No node imports, so it\n * ships in `./schema`; the node default for userData is placeholders.ts.\n */\n\nexport interface BuiltinEnv {\n userData?: string;\n projectRoot?: string;\n}\n\n/** The always-resolvable `$env` names (also the `\"${name}\"` sugar). */\nexport const BUILTIN_ENV_NAMES: readonly (keyof BuiltinEnv)[] = [\n \"userData\",\n \"projectRoot\",\n];\n\nexport function isBuiltinEnvName(name: string): name is keyof BuiltinEnv {\n return (BUILTIN_ENV_NAMES as readonly string[]).includes(name);\n}\n\nconst BUILTIN = new RegExp(`\\\\$\\\\{(${BUILTIN_ENV_NAMES.join(\"|\")})\\\\}`, \"g\");\n\nfunction substitute(text: string, env: BuiltinEnv): string {\n return text.replace(\n BUILTIN,\n (match, name: keyof BuiltinEnv) => env[name] ?? match,\n );\n}\n\n/** Deep-substitute the built-ins that `env` provides in every string; an\n * absent built-in is left as written. The input is never mutated. */\nexport function substituteBuiltinEnv<T>(value: T, env: BuiltinEnv): T {\n return substituteValue(value, env) as T;\n}\n\nfunction substituteValue(value: unknown, env: BuiltinEnv): unknown {\n if (typeof value === \"string\") return substitute(value, env);\n if (Array.isArray(value)) return value.map((v) => substituteValue(v, env));\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = substituteValue(v, env);\n }\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;CAC3C;AACF;;;AAIA,SAAgB,qBAA8C;CAC5D,OAAO;EAEL,4BAA4B,mBAC1B,gBACA,gBAAgB,iBAClB;EACA,6BAA6B,mBAC3B,iBACA,gBAAgB,kBAClB;CACF;AACF;;;;AC3YA,MAAa,oBAAmD,CAC9D,YACA,aACF;AAEA,SAAgB,iBAAiB,MAAwC;CACvE,OAAQ,kBAAwC,SAAS,IAAI;AAC/D;AAEA,MAAM,UAAU,IAAI,OAAO,UAAU,kBAAkB,KAAK,GAAG,EAAE,OAAO,GAAG;AAE3E,SAAS,WAAW,MAAc,KAAyB;CACzD,OAAO,KAAK,QACV,UACC,OAAO,SAA2B,IAAI,SAAS,KAClD;AACF;;;AAIA,SAAgB,qBAAwB,OAAU,KAAoB;CACpE,OAAO,gBAAgB,OAAO,GAAG;AACnC;AAEA,SAAS,gBAAgB,OAAgB,KAA0B;CACjE,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,OAAO,GAAG;CAC3D,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,KAAK,MAAM,gBAAgB,GAAG,GAAG,CAAC;CACzE,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,MAA+B,CAAC;EACtC,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,KAAK,GACvC,IAAI,KAAK,gBAAgB,GAAG,GAAG;EAEjC,OAAO;CACT;CACA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-substitution-C_fVirPh.d.mts","names":[],"sources":["../src/env-substitution.ts"],"mappings":";;;;;;UAMiB;EACf;EACA;;;;
|
|
1
|
+
{"version":3,"file":"env-substitution-C_fVirPh.d.mts","names":[],"sources":["../src/env-substitution.ts"],"mappings":";;;;;;UAMiB;EACf;EACA;;;;iBAwBc,qBAAqB,GAAG,OAAO,GAAG,KAAK,aAAa"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as ReactorHost, $t as mapTokenSchema, A as resolveRunnerModule, At as ItemToken, B as outputSitesOf, Bt as Token, C as ValidateHostOptions, Ct as reactorSchema, D as kindShapeIssues, Dt as ArrayMapToken, E as isSchemaLike, Et as runnerKindSchema, F as OutputsSchemaLookup, Ft as RecordMapToken, G as CompoundHostInput, Gt as concatTokenSchema, H as schemaAtPath, Ht as TokenKey, I as checkOutputPaths, It as RefFn, J as HostSchemas, Jt as findToken, K as CompoundWiring, Kt as envTokenSchema, L as checkTokenSites, Lt as TOKEN_ESCAPE_KEY, M as validateHost, Mt as MapToken, N as DeclaredIssue, Nt as OutputPath, O as knownVerbIssues, Ot as ConcatToken, P as OutputRef, Pt as OutputToken, Q as ReactorConfig, Qt as keyTokenSchema, R as envSitesOf, Rt as TOKEN_KEYS, S as SchemaIssue, St as reactorProtocolSchema, T as hostSchemaIssues, Tt as runnerBaseSchema, U as ChildWrapper, Ut as TokenMode, V as refKey, Vt as TokenFor, W as CompoundHost, Wt as TokenableSchema, X as ReactorBackend, Xt as isToken, Y as Profile, Yt as forbidRef, Z as ReactorBackendKind, Zt as itemTokenSchema, _ as RunnerContext, _t as makeHostSchemas, a as RunnerHandleData, at as RunnerBase, b as RunnerModule, bt as reactorBackendSchema, c as toStartedHandle, ct as childrenSchema, d as CONNECT_RUNNER, dt as declaredGenericCompoundHostSchema, en as outputTokenSchema, et as ReactorHostInput, f as DeclaredHostOptions, ft as declaredHostSchemas, g as ONE_SHOT_VERBS, gt as genericCompoundHostSchema, h as HostSchemaLike, ht as emittedHostSchemas, i as RunnerHandle, in as tokenable, it as ReactorStorageConfig, j as validateDeclaredHost, jt as KeyToken, k as listVerbs, kt as EnvToken, l as BootCheckContext, lt as compoundHostSchema, m as HostSchemaIssues, mt as emitHostJsonSchema, n as RunCompoundResult, nn as tokenKeyOf, nt as ReactorProtocol, o as StartedHandle, ot as RunnerKind, p as HostSchemaIssue, pt as defineHostSchemas, q as HostDefinition, qt as envTokenable, r as runCompound, rn as tokenSchema, rt as ReactorRemoteConfig, s as runnerHandleSchema, st as childWrapperSchema, t as RunCompoundOptions, tn as ref, tt as ReactorPackageConfig, u as BootIssue, ut as compoundWiringSchema, v as RunnerError, vt as profileSchema, w as getVerb, wt as refineStartOrder, x as RunnerVerb, xt as reactorHostSchema, y as RunnerIssue, yt as reactorBackendKindSchema, z as outputRefsOf, zt as Template } from "./compound-DlaK_sWa.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { PHConnectDefaultDrive, PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
|
|
4
4
|
//#region src/host-loader.d.ts
|
|
@@ -155,14 +155,15 @@ type RunProbe = {
|
|
|
155
155
|
status: "foreign";
|
|
156
156
|
record: RunRecord;
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
159
|
+
export declare function readRunRecord(projectDir: string, hostName: string, env?: Env): RunRecord | undefined;
|
|
159
160
|
/** Every valid v2 record under `.ph/run/` (invalid and v1 files skipped). */
|
|
160
|
-
export declare function listRunRecords(projectDir: string): RunRecord[];
|
|
161
|
+
export declare function listRunRecords(projectDir: string, env?: Env): RunRecord[];
|
|
161
162
|
/** The project identity the live/foreign probe compares: package.json
|
|
162
163
|
* `name`, else the folder name. */
|
|
163
164
|
export declare function readProjectName(projectDir: string): string;
|
|
164
165
|
export declare function writeRunRecord(projectDir: string, record: RunRecord): void;
|
|
165
|
-
export declare function clearRunRecord(projectDir: string, hostName: string): void;
|
|
166
|
+
export declare function clearRunRecord(projectDir: string, hostName: string, env?: Env): void;
|
|
166
167
|
export declare function isPidAlive(pid: number): boolean;
|
|
167
168
|
/**
|
|
168
169
|
* Decide whether the recorded instance is this project's live host.
|
|
@@ -173,7 +174,220 @@ export declare function isPidAlive(pid: number): boolean;
|
|
|
173
174
|
* prevent. A stale record (dead pid) is reported so the caller can clear it; a
|
|
174
175
|
* foreign one (live pid, different project) is left alone.
|
|
175
176
|
*/
|
|
176
|
-
export declare function probeRun(projectDir: string, hostName: string, projectName: string): RunProbe;
|
|
177
|
+
export declare function probeRun(projectDir: string, hostName: string, projectName: string, env?: Env): RunProbe;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/spawn-host.d.ts
|
|
180
|
+
interface SpawnHostOptions {
|
|
181
|
+
projectRoot: string;
|
|
182
|
+
/** Folder name under hosts/. */
|
|
183
|
+
host: string;
|
|
184
|
+
/** The child's PH_USER_DATA_DIR (created if missing). */
|
|
185
|
+
dataDir: string;
|
|
186
|
+
verb?: string;
|
|
187
|
+
/** Merged over the clean base env; may not set PH_USER_DATA_DIR. */
|
|
188
|
+
env?: Record<string, string>;
|
|
189
|
+
/** ph-cli entry; default: the project's `@powerhousedao/ph-cli/dist/cli.mjs`. */
|
|
190
|
+
cli?: string;
|
|
191
|
+
readyTimeoutMs?: number;
|
|
192
|
+
stopTimeoutMs?: number;
|
|
193
|
+
/** Before ready: stop and reject. After: stop. */
|
|
194
|
+
signal?: AbortSignal;
|
|
195
|
+
onOutput?: (stream: "stdout" | "stderr", chunk: string) => void;
|
|
196
|
+
/** Appends both streams. */
|
|
197
|
+
logFile?: string;
|
|
198
|
+
}
|
|
199
|
+
interface HostExit {
|
|
200
|
+
code: number | null;
|
|
201
|
+
signal: NodeJS.Signals | null;
|
|
202
|
+
/** SIGKILL after stopTimeoutMs. */
|
|
203
|
+
forced: boolean;
|
|
204
|
+
}
|
|
205
|
+
interface SpawnedHost {
|
|
206
|
+
pid: number;
|
|
207
|
+
dataDir: string;
|
|
208
|
+
record: RunRecord;
|
|
209
|
+
outputs: Record<string, unknown> | undefined;
|
|
210
|
+
members: RunRecord["members"];
|
|
211
|
+
/** Resolves (never rejects) when the child exits. */
|
|
212
|
+
exited: Promise<HostExit>;
|
|
213
|
+
/** SIGTERM, SIGKILL after stopTimeoutMs, clear a leftover record. */
|
|
214
|
+
stop(): Promise<HostExit>;
|
|
215
|
+
}
|
|
216
|
+
type SpawnHostPhase = "exited" | "timeout" | "aborted";
|
|
217
|
+
export declare class SpawnHostError extends Error {
|
|
218
|
+
readonly phase: SpawnHostPhase;
|
|
219
|
+
readonly outputTail: string;
|
|
220
|
+
readonly exit?: HostExit | undefined;
|
|
221
|
+
constructor(message: string, phase: SpawnHostPhase, outputTail: string, exit?: HostExit | undefined);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* `ph run <host> [verb]` as a child; ready when its run record appears.
|
|
225
|
+
*
|
|
226
|
+
* The child shares this process's group, so a terminal Ctrl-C reaches both.
|
|
227
|
+
* It runs the project's own ph-cli: one older than PH_NO_DOTENV reads the
|
|
228
|
+
* project's `.env` anyway.
|
|
229
|
+
*/
|
|
230
|
+
export declare function spawnHost(options: SpawnHostOptions): Promise<SpawnedHost>;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/host-issues.d.ts
|
|
233
|
+
/** Where in the `ph run` pipeline a host check found an issue. */
|
|
234
|
+
type CheckStage = "load" | "declared" | "resolve" | "resolved" | "boot";
|
|
235
|
+
interface HostIssue {
|
|
236
|
+
stage: CheckStage;
|
|
237
|
+
/** A compound's issues come from its members' files too. */
|
|
238
|
+
file: string;
|
|
239
|
+
/** Empty when the issue concerns the file as a whole. */
|
|
240
|
+
path: string;
|
|
241
|
+
message: string;
|
|
242
|
+
hint?: string;
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/env-substitution.d.ts
|
|
246
|
+
/**
|
|
247
|
+
* Pure built-in `$env` substitution: the `"${userData}"` / `"${projectRoot}"`
|
|
248
|
+
* string sugar, deep-applied to a JSON-shaped value. No node imports, so it
|
|
249
|
+
* ships in `./schema`; the node default for userData is placeholders.ts.
|
|
250
|
+
*/
|
|
251
|
+
interface BuiltinEnv {
|
|
252
|
+
userData?: string;
|
|
253
|
+
projectRoot?: string;
|
|
254
|
+
}
|
|
255
|
+
/** The always-resolvable `$env` names (also the `"${name}"` sugar). */
|
|
256
|
+
export declare const BUILTIN_ENV_NAMES: readonly (keyof BuiltinEnv)[];
|
|
257
|
+
export declare function isBuiltinEnvName(name: string): name is keyof BuiltinEnv;
|
|
258
|
+
/** Deep-substitute the built-ins that `env` provides in every string; an
|
|
259
|
+
* absent built-in is left as written. The input is never mutated. */
|
|
260
|
+
export declare function substituteBuiltinEnv<T>(value: T, env: BuiltinEnv): T;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/resolve/resolve.d.ts
|
|
263
|
+
/**
|
|
264
|
+
* The resolver (pipeline step 5): replaces every token in a declared host
|
|
265
|
+
* with its value. `$output` reads the producer's outputs through an
|
|
266
|
+
* `OutputSource` (live compound members, or a standalone run record: the
|
|
267
|
+
* node adapters in ./node.ts); `$env` reads the environment map of the
|
|
268
|
+
* resolving process; `$map` renders its `to` template once per element of
|
|
269
|
+
* its `over` (arrays in order, records key-sorted; `$item`/`$key` read the
|
|
270
|
+
* element being rendered); the `"${userData}"`/`"${projectRoot}"` string
|
|
271
|
+
* sugar is substituted on the way. An `$output`/`$item` that reads a field
|
|
272
|
+
* absent from the data but optional in the producer's schema (codegen's
|
|
273
|
+
* `OutputToken<T | undefined>`) omits its enclosing property, like an unset
|
|
274
|
+
* optional `$env`. Pure and browser-safe.
|
|
275
|
+
*/
|
|
276
|
+
type OutputLookup = {
|
|
277
|
+
status: "available";
|
|
278
|
+
outputs: unknown;
|
|
279
|
+
/** The producer's `outputsSchema`, when known: an absent field it
|
|
280
|
+
* marks optional omits the consuming property instead of failing. */
|
|
281
|
+
schema?: unknown;
|
|
282
|
+
} |
|
|
283
|
+
/** `message` is the complete, user-facing reason (e.g. "connect needs
|
|
284
|
+
* outputs from host "switchboard", which is not running. …"). */
|
|
285
|
+
{
|
|
286
|
+
status: "unavailable";
|
|
287
|
+
message: string;
|
|
288
|
+
};
|
|
289
|
+
interface OutputSource {
|
|
290
|
+
lookup(ref: OutputRef): OutputLookup;
|
|
291
|
+
}
|
|
292
|
+
interface ResolveSources {
|
|
293
|
+
/** Where `$output` tokens read. Absent: any `$output` fails. */
|
|
294
|
+
outputs?: OutputSource;
|
|
295
|
+
/** The resolving process's environment (`$env`). */
|
|
296
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
297
|
+
/** `userData`/`projectRoot`: always resolvable `$env` names and string
|
|
298
|
+
* sugar. */
|
|
299
|
+
builtins?: BuiltinEnv;
|
|
300
|
+
/** The host file named in errors (`hosts/connect/host.js`). */
|
|
301
|
+
where?: string;
|
|
302
|
+
}
|
|
303
|
+
export declare class TokenResolutionError extends Error {
|
|
304
|
+
/** The host path that failed and the reason, without the file prefix. */
|
|
305
|
+
readonly detail?: {
|
|
306
|
+
path: string;
|
|
307
|
+
reason: string;
|
|
308
|
+
};
|
|
309
|
+
constructor(message: string, detail?: {
|
|
310
|
+
path: string;
|
|
311
|
+
reason: string;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The `$map` elements an issue path (from resolved validation of a resolved
|
|
316
|
+
* host) passes through, as text: `$map element "workflows"`. Undefined when
|
|
317
|
+
* the path crosses no `$map`-rendered array. Walk the SAME object
|
|
318
|
+
* `resolveHostOutputs` returned (provenance is by identity).
|
|
319
|
+
*/
|
|
320
|
+
export declare function describeMapElements(host: unknown, path: readonly PropertyKey[]): string | undefined;
|
|
321
|
+
/** A compound's own member set, for `deferSelf`. */
|
|
322
|
+
interface SelfMembers {
|
|
323
|
+
/** The compound's members: key (`children.<key>`) and host folder. */
|
|
324
|
+
members: readonly {
|
|
325
|
+
key: string;
|
|
326
|
+
host: string;
|
|
327
|
+
}[];
|
|
328
|
+
}
|
|
329
|
+
/** A token in a compound's own fields that reads one of its members. */
|
|
330
|
+
interface DeferredToken {
|
|
331
|
+
/** Host path (`config.agents.assistant.url`). */
|
|
332
|
+
path: string;
|
|
333
|
+
/** The member keys whose outputs it needs. */
|
|
334
|
+
members: string[];
|
|
335
|
+
}
|
|
336
|
+
interface DeferredResolution<T> {
|
|
337
|
+
/** The host with every token resolved EXCEPT the deferred ones (still in
|
|
338
|
+
* place) and the `children` wrappers (member-level: each member resolves
|
|
339
|
+
* its own). */
|
|
340
|
+
host: T;
|
|
341
|
+
deferred: DeferredToken[];
|
|
342
|
+
/** The member keys any deferred token needs (start them first). */
|
|
343
|
+
needs: string[];
|
|
344
|
+
/** Resolve the deferred tokens once those members have started, from
|
|
345
|
+
* their live outputs (e.g. `compoundOutputSource`); returns the fully
|
|
346
|
+
* resolved host (children still untouched). */
|
|
347
|
+
finish(outputs: OutputSource): T;
|
|
348
|
+
}
|
|
349
|
+
interface ResolveOptions {
|
|
350
|
+
/** Resolving a COMPOUND's own fields: tokens that read one of its members
|
|
351
|
+
* are deferred until those members have started (see
|
|
352
|
+
* `DeferredResolution`); `children` is left for the members. `"outputs"`
|
|
353
|
+
* defers every `$output` (its `members` are the producers' ref keys). */
|
|
354
|
+
deferSelf: SelfMembers | "outputs";
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Resolve every token in a declared host (or any JSON-shaped value): the
|
|
358
|
+
* result has the same shape with tokens replaced by values, optional unset
|
|
359
|
+
* `$env` properties omitted and the built-in string sugar substituted (`$$`
|
|
360
|
+
* escapes are kept; validateHost unwraps them). Throws `TokenResolutionError` naming the host path;
|
|
361
|
+
* an `$output` whose producer is not running fails with the source's
|
|
362
|
+
* message (no fallback, no waiting).
|
|
363
|
+
*
|
|
364
|
+
* With `{ deferSelf }` (a compound resolving its own fields), returns a
|
|
365
|
+
* `DeferredResolution` instead: everything but the self-references now,
|
|
366
|
+
* and `finish(outputs)` for the rest once the members it needs run.
|
|
367
|
+
*/
|
|
368
|
+
export declare function resolveHostOutputs<T>(host: T, sources: ResolveSources): T;
|
|
369
|
+
export declare function resolveHostOutputs<T>(host: T, sources: ResolveSources, options: ResolveOptions): DeferredResolution<T>;
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/check-host.d.ts
|
|
372
|
+
interface CheckHostOptions {
|
|
373
|
+
projectRoot: string;
|
|
374
|
+
/** The environment `ph run` would resolve against; `process.env` is never read. */
|
|
375
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
376
|
+
/** Default `run`, as `ph run <name>`. */
|
|
377
|
+
verb?: string;
|
|
378
|
+
/** Producers' outputs. Absent: `$output` tokens are checked declared-only. */
|
|
379
|
+
outputs?: OutputSource;
|
|
380
|
+
}
|
|
381
|
+
interface CheckDeferred extends DeferredToken {
|
|
382
|
+
file: string;
|
|
383
|
+
}
|
|
384
|
+
interface CheckHostResult {
|
|
385
|
+
issues: HostIssue[];
|
|
386
|
+
/** `$output` tokens left unresolved because no `outputs` were given. */
|
|
387
|
+
deferred: CheckDeferred[];
|
|
388
|
+
}
|
|
389
|
+
/** The `ph run` pipeline up to the verb, collecting every issue; starts nothing. */
|
|
390
|
+
export declare function checkHost(name: string, options: CheckHostOptions): Promise<CheckHostResult>;
|
|
177
391
|
//#endregion
|
|
178
392
|
//#region src/placeholders.d.ts
|
|
179
393
|
/**
|
|
@@ -561,20 +775,6 @@ export declare function mergeDrivePlan(projectRoot: string, hostDeclared: readon
|
|
|
561
775
|
}[]): DrivePlanEntry[];
|
|
562
776
|
export declare function explainDrivePlan(plan: readonly DrivePlanEntry[]): string;
|
|
563
777
|
//#endregion
|
|
564
|
-
//#region src/env-substitution.d.ts
|
|
565
|
-
/**
|
|
566
|
-
* Pure built-in `$env` substitution: the `"${userData}"` / `"${projectRoot}"`
|
|
567
|
-
* string sugar, deep-applied to a JSON-shaped value. No node imports, so it
|
|
568
|
-
* ships in `./schema`; the node default for userData is placeholders.ts.
|
|
569
|
-
*/
|
|
570
|
-
interface BuiltinEnv {
|
|
571
|
-
userData?: string;
|
|
572
|
-
projectRoot?: string;
|
|
573
|
-
}
|
|
574
|
-
/** Deep-substitute the built-ins that `env` provides in every string; an
|
|
575
|
-
* absent built-in is left as written. The input is never mutated. */
|
|
576
|
-
export declare function substituteBuiltinEnv<T>(value: T, env: BuiltinEnv): T;
|
|
577
|
-
//#endregion
|
|
578
778
|
//#region src/reactor-config.d.ts
|
|
579
779
|
/** The single primary backend for phase-2 projection (multi-backend routing is
|
|
580
780
|
* track R). Prefers placement.primary, else "main"/"local", else the first. */
|
|
@@ -623,12 +823,16 @@ interface ConnectReactorProjection {
|
|
|
623
823
|
* (legacy) + instance.reactorClient (the explicit 4-way selector),
|
|
624
824
|
* workflows → app.workflowsEnabled. */
|
|
625
825
|
export declare function projectReactorToConnect(reactor: ReactorConfig | undefined): ConnectReactorProjection;
|
|
826
|
+
/** Each pre-set env var that CONTRADICTS the host's protocol block, as a
|
|
827
|
+
* message naming the var, the host value and the env value. An env var that
|
|
828
|
+
* merely matches, or is unset, is fine. */
|
|
829
|
+
export declare function protocolConflicts(protocol: ReactorProtocol | undefined, env: Readonly<Record<string, string | undefined>>, hostFile?: string): string[];
|
|
626
830
|
/**
|
|
627
831
|
* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS
|
|
628
832
|
* the host's protocol block, fail loudly naming the var, the host value, and
|
|
629
|
-
* the env value
|
|
630
|
-
*
|
|
631
|
-
*
|
|
833
|
+
* the env value (phase-2 transition keeps an operator's explicit env as an
|
|
834
|
+
* escape hatch unless it disagrees with the protocol — see the WBS
|
|
835
|
+
* precedence note).
|
|
632
836
|
*/
|
|
633
837
|
export declare function assertProtocolConsistency(protocol: ReactorProtocol | undefined, env: Record<string, string | undefined>, hostFile?: string): void;
|
|
634
838
|
//#endregion
|
|
@@ -766,106 +970,6 @@ export declare function memberForRef(ref: OutputRef, members: readonly Pick<Plan
|
|
|
766
970
|
};
|
|
767
971
|
export declare function planCompound(members: readonly PlanMember[], startOrder?: readonly string[]): CompoundPlan;
|
|
768
972
|
//#endregion
|
|
769
|
-
//#region src/resolve/resolve.d.ts
|
|
770
|
-
/**
|
|
771
|
-
* The resolver (pipeline step 5): replaces every token in a declared host
|
|
772
|
-
* with its value. `$output` reads the producer's outputs through an
|
|
773
|
-
* `OutputSource` (live compound members, or a standalone run record: the
|
|
774
|
-
* node adapters in ./node.ts); `$env` reads the environment map of the
|
|
775
|
-
* resolving process; `$map` renders its `to` template once per element of
|
|
776
|
-
* its `over` (arrays in order, records key-sorted; `$item`/`$key` read the
|
|
777
|
-
* element being rendered); the `"${userData}"`/`"${projectRoot}"` string
|
|
778
|
-
* sugar is substituted on the way. An `$output`/`$item` that reads a field
|
|
779
|
-
* absent from the data but optional in the producer's schema (codegen's
|
|
780
|
-
* `OutputToken<T | undefined>`) omits its enclosing property, like an unset
|
|
781
|
-
* optional `$env`. Pure and browser-safe.
|
|
782
|
-
*/
|
|
783
|
-
type OutputLookup = {
|
|
784
|
-
status: "available";
|
|
785
|
-
outputs: unknown;
|
|
786
|
-
/** The producer's `outputsSchema`, when known: an absent field it
|
|
787
|
-
* marks optional omits the consuming property instead of failing. */
|
|
788
|
-
schema?: unknown;
|
|
789
|
-
} |
|
|
790
|
-
/** `message` is the complete, user-facing reason (e.g. "connect needs
|
|
791
|
-
* outputs from host "switchboard", which is not running. …"). */
|
|
792
|
-
{
|
|
793
|
-
status: "unavailable";
|
|
794
|
-
message: string;
|
|
795
|
-
};
|
|
796
|
-
interface OutputSource {
|
|
797
|
-
lookup(ref: OutputRef): OutputLookup;
|
|
798
|
-
}
|
|
799
|
-
interface ResolveSources {
|
|
800
|
-
/** Where `$output` tokens read. Absent: any `$output` fails. */
|
|
801
|
-
outputs?: OutputSource;
|
|
802
|
-
/** The resolving process's environment (`$env`). */
|
|
803
|
-
env?: Readonly<Record<string, string | undefined>>;
|
|
804
|
-
/** `userData`/`projectRoot`: always resolvable `$env` names and string
|
|
805
|
-
* sugar. */
|
|
806
|
-
builtins?: BuiltinEnv;
|
|
807
|
-
/** The host file named in errors (`hosts/connect/host.js`). */
|
|
808
|
-
where?: string;
|
|
809
|
-
}
|
|
810
|
-
export declare class TokenResolutionError extends Error {
|
|
811
|
-
constructor(message: string);
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* The `$map` elements an issue path (from resolved validation of a resolved
|
|
815
|
-
* host) passes through, as text: `$map element "workflows"`. Undefined when
|
|
816
|
-
* the path crosses no `$map`-rendered array. Walk the SAME object
|
|
817
|
-
* `resolveHostOutputs` returned (provenance is by identity).
|
|
818
|
-
*/
|
|
819
|
-
export declare function describeMapElements(host: unknown, path: readonly PropertyKey[]): string | undefined;
|
|
820
|
-
/** A compound's own member set, for `deferSelf`. */
|
|
821
|
-
interface SelfMembers {
|
|
822
|
-
/** The compound's members: key (`children.<key>`) and host folder. */
|
|
823
|
-
members: readonly {
|
|
824
|
-
key: string;
|
|
825
|
-
host: string;
|
|
826
|
-
}[];
|
|
827
|
-
}
|
|
828
|
-
/** A token in a compound's own fields that reads one of its members. */
|
|
829
|
-
interface DeferredToken {
|
|
830
|
-
/** Host path (`config.agents.assistant.url`). */
|
|
831
|
-
path: string;
|
|
832
|
-
/** The member keys whose outputs it needs. */
|
|
833
|
-
members: string[];
|
|
834
|
-
}
|
|
835
|
-
interface DeferredResolution<T> {
|
|
836
|
-
/** The host with every token resolved EXCEPT the deferred ones (still in
|
|
837
|
-
* place) and the `children` wrappers (member-level: each member resolves
|
|
838
|
-
* its own). */
|
|
839
|
-
host: T;
|
|
840
|
-
deferred: DeferredToken[];
|
|
841
|
-
/** The member keys any deferred token needs (start them first). */
|
|
842
|
-
needs: string[];
|
|
843
|
-
/** Resolve the deferred tokens once those members have started, from
|
|
844
|
-
* their live outputs (e.g. `compoundOutputSource`); returns the fully
|
|
845
|
-
* resolved host (children still untouched). */
|
|
846
|
-
finish(outputs: OutputSource): T;
|
|
847
|
-
}
|
|
848
|
-
interface ResolveOptions {
|
|
849
|
-
/** Resolving a COMPOUND's own fields: tokens that read one of its members
|
|
850
|
-
* are deferred until those members have started (see
|
|
851
|
-
* `DeferredResolution`); `children` is left for the members. */
|
|
852
|
-
deferSelf: SelfMembers;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Resolve every token in a declared host (or any JSON-shaped value): the
|
|
856
|
-
* result has the same shape with tokens replaced by values, optional unset
|
|
857
|
-
* `$env` properties omitted and the built-in string sugar substituted (`$$`
|
|
858
|
-
* escapes are kept; validateHost unwraps them). Throws `TokenResolutionError` naming the host path;
|
|
859
|
-
* an `$output` whose producer is not running fails with the source's
|
|
860
|
-
* message (no fallback, no waiting).
|
|
861
|
-
*
|
|
862
|
-
* With `{ deferSelf }` (a compound resolving its own fields), returns a
|
|
863
|
-
* `DeferredResolution` instead: everything but the self-references now,
|
|
864
|
-
* and `finish(outputs)` for the rest once the members it needs run.
|
|
865
|
-
*/
|
|
866
|
-
export declare function resolveHostOutputs<T>(host: T, sources: ResolveSources): T;
|
|
867
|
-
export declare function resolveHostOutputs<T>(host: T, sources: ResolveSources, options: ResolveOptions): DeferredResolution<T>;
|
|
868
|
-
//#endregion
|
|
869
973
|
//#region src/resolve/removed-forms.d.ts
|
|
870
974
|
/**
|
|
871
975
|
* The cross-host forms removed in T3 (typed-host-configs 3.7), detected
|
|
@@ -1093,6 +1197,6 @@ interface MemberInput extends Omit<ExpectHostInput, "members" | "plan"> {
|
|
|
1093
1197
|
*/
|
|
1094
1198
|
export declare function expectHost(input: ExpectHostInput): HostExpectation;
|
|
1095
1199
|
//#endregion
|
|
1096
|
-
export { type ArrayMapToken, type BuiltinEnv, CONNECT_RUNNER, type ChildWrapper, type CompoundHost, type CompoundHostInput, type CompoundPlan, type CompoundWiring, type ConcatToken, type ConnectPluginSlices, type ConnectReactorProjection, type ConsumedOutput, type ContributedDrive, type ContributedDriveInput, type ContributionSource, type Contributions, type DeadConfigWarning, type DeclaredHostOptions, type DeclaredIssue, type DeferredResolution, type DeferredToken, type DriveDeclaration, type DrivePlanEntry, type DriveProjectionInput, type DriveSeederClient, type EnvToken, type ExpectHostInput, type ExpectedBackend, type ExpectedDrive, type HostDefinition, type HostExpectation, type HostImports, type HostOutputsDescription, type HostPlugin, type HostPluginModule, type HostSchemaIssue, type HostSchemaLike, type HostSchemas, type HostsFolderStatus, type ItemToken, type KeyToken, type LoadedHost, type MapToken, type MemberExpectation, type MemberInput, type MergedContribution, type NormalizedPluginEntry, ONE_SHOT_VERBS, type Observe, type OutputLookup, type OutputPath, type OutputRef, type OutputSource, type OutputToken, type OutputsSchemaLookup, type OwnedConfigSlice, type PHHost, type PHHostOutputs, type PlanEdge, type PlanMember, type PluginContributionsPlan, type PluginEntry, type PluginEntryData, type ProducerInfo, type ProducerMap, type Profile, type ProjectedDescriptor, type ProjectedStorage, type Provide, type ReactorBackend, type ReactorBackendKind, type ReactorClientMode, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RemovedForm, type ResolveOptions, type ResolveSources, type ResolvedDrive, type ResolvedPlugin, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerBase, type RunnerContext, RunnerError, type RunnerHandle, type RunnerHandleData, type RunnerKind, type RunnerModule, type RunnerVerb, type SeedResult, type SelfMembers, type StartedHandle, type SwitchboardReactorProjection, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenPosition, type TokenSite, type TokenableSchema, type Transform, type ValidateHostOptions, checkOutputPaths, checkTokenSites, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, emitHostJsonSchema, emittedHostSchemas, envSitesOf, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, getVerb, isSchemaLike, isToken, itemTokenSchema, keyTokenSchema, listVerbs, makeHostSchemas, mapTokenSchema, outputRefsOf, outputSitesOf, outputTokenSchema, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refKey, refineStartOrder, resolveRunnerModule, runCompound, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, schemaAtPath, toStartedHandle, tokenKeyOf, tokenSchema, tokenable, validateDeclaredHost, validateHost };
|
|
1200
|
+
export { type ArrayMapToken, type BootCheckContext, type BootIssue, type BuiltinEnv, CONNECT_RUNNER, type CheckDeferred, type CheckHostOptions, type CheckHostResult, type CheckStage, type ChildWrapper, type CompoundHost, type CompoundHostInput, type CompoundPlan, type CompoundWiring, type ConcatToken, type ConnectPluginSlices, type ConnectReactorProjection, type ConsumedOutput, type ContributedDrive, type ContributedDriveInput, type ContributionSource, type Contributions, type DeadConfigWarning, type DeclaredHostOptions, type DeclaredIssue, type DeferredResolution, type DeferredToken, type DriveDeclaration, type DrivePlanEntry, type DriveProjectionInput, type DriveSeederClient, type EnvToken, type ExpectHostInput, type ExpectedBackend, type ExpectedDrive, type HostDefinition, type HostExit, type HostExpectation, type HostImports, type HostIssue, type HostOutputsDescription, type HostPlugin, type HostPluginModule, type HostSchemaIssue, type HostSchemaIssues, type HostSchemaLike, type HostSchemas, type HostsFolderStatus, type ItemToken, type KeyToken, type LoadedHost, type MapToken, type MemberExpectation, type MemberInput, type MergedContribution, type NormalizedPluginEntry, ONE_SHOT_VERBS, type Observe, type OutputLookup, type OutputPath, type OutputRef, type OutputSource, type OutputToken, type OutputsSchemaLookup, type OwnedConfigSlice, type PHHost, type PHHostOutputs, type PlanEdge, type PlanMember, type PluginContributionsPlan, type PluginEntry, type PluginEntryData, type ProducerInfo, type ProducerMap, type Profile, type ProjectedDescriptor, type ProjectedStorage, type Provide, type ReactorBackend, type ReactorBackendKind, type ReactorClientMode, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RemovedForm, type ResolveOptions, type ResolveSources, type ResolvedDrive, type ResolvedPlugin, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerBase, type RunnerContext, RunnerError, type RunnerHandle, type RunnerHandleData, type RunnerIssue, type RunnerKind, type RunnerModule, type RunnerVerb, type SchemaIssue, type SeedResult, type SelfMembers, type SpawnHostOptions, type SpawnHostPhase, type SpawnedHost, type StartedHandle, type SwitchboardReactorProjection, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenPosition, type TokenSite, type TokenableSchema, type Transform, type ValidateHostOptions, checkOutputPaths, checkTokenSites, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, emitHostJsonSchema, emittedHostSchemas, envSitesOf, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, getVerb, hostSchemaIssues, isSchemaLike, isToken, itemTokenSchema, keyTokenSchema, kindShapeIssues, knownVerbIssues, listVerbs, makeHostSchemas, mapTokenSchema, outputRefsOf, outputSitesOf, outputTokenSchema, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refKey, refineStartOrder, resolveRunnerModule, runCompound, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, schemaAtPath, toStartedHandle, tokenKeyOf, tokenSchema, tokenable, validateDeclaredHost, validateHost };
|
|
1097
1201
|
export {};
|
|
1098
1202
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/host-loader.ts","../src/run-record-schema.ts","../src/run-record.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/host-loader.ts","../src/run-record-schema.ts","../src/run-record.ts","../src/spawn-host.ts","../src/host-issues.ts","../src/env-substitution.ts","../src/resolve/resolve.ts","../src/check-host.ts","../src/placeholders.ts","../src/host-types.ts","../src/plugins.ts","../src/plugins-resolve.ts","../src/drive-schema.ts","../src/drives.ts","../src/reactor-config.ts","../src/backend-projection.ts","../src/connect-projection.ts","../src/resolve/plan.ts","../src/resolve/removed-forms.ts","../src/resolve/sources.ts","../src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