@powerhousedao/host-core 6.2.3-dev.79 → 6.2.3-dev.81
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-Cfqa5Jal.mjs → compound-C7GuPnTP.mjs} +249 -14
- package/dist/compound-C7GuPnTP.mjs.map +1 -0
- package/dist/{compound-DXcOFNcC.d.mts → compound-fPleFc-P.d.mts} +53 -23
- package/dist/compound-fPleFc-P.d.mts.map +1 -0
- package/dist/{env-substitution-qS_lDcbn.mjs → env-substitution-CzlXbvQJ.mjs} +236 -10
- package/dist/env-substitution-CzlXbvQJ.mjs.map +1 -0
- package/dist/{host-schemas-B6DsXA0Y.d.mts → host-schemas-ByrS_x_Z.d.mts} +47 -24
- package/dist/host-schemas-ByrS_x_Z.d.mts.map +1 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{plugins-EFYLaYQi.d.mts → plugins-CUY86XvH.d.mts} +2 -2
- package/dist/{plugins-EFYLaYQi.d.mts.map → plugins-CUY86XvH.d.mts.map} +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/projection.d.mts +2 -2
- package/dist/projection.mjs +8 -4
- package/dist/projection.mjs.map +1 -1
- package/dist/runners/compound.d.mts +5 -3
- package/dist/runners/compound.d.mts.map +1 -1
- package/dist/runners/compound.mjs +1 -1
- package/dist/schema.d.mts +4 -3
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +3 -2
- package/dist/schema.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/compound-Cfqa5Jal.mjs.map +0 -1
- package/dist/compound-DXcOFNcC.d.mts.map +0 -1
- package/dist/env-substitution-qS_lDcbn.mjs.map +0 -1
- package/dist/host-schemas-B6DsXA0Y.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as HostDefinition, n as RunCompoundResult, y as RunnerContext } from "../compound-fPleFc-P.mjs";
|
|
2
2
|
//#region src/runners/compound.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The GENERIC compound runner module (phase 3): supervises the members a
|
|
@@ -68,11 +68,12 @@ export declare const hostSchema: import("zod").ZodObject<{
|
|
|
68
68
|
dynamic: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
69
69
|
}, import("zod/v4/core").$strict>>;
|
|
70
70
|
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
71
|
-
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodURL
|
|
71
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodString]>>;
|
|
72
72
|
}, import("zod/v4/core").$strict>>;
|
|
73
73
|
}, import("zod/v4/core").$strict>>>;
|
|
74
74
|
placement: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
75
75
|
primary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
+
drives: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
76
77
|
}, import("zod/v4/core").$strict>>;
|
|
77
78
|
protocol: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
78
79
|
featureFlags: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -183,11 +184,12 @@ export declare const declaredHostSchema: import("zod").ZodObject<{
|
|
|
183
184
|
dynamic: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
184
185
|
}, import("zod/v4/core").$strict>>;
|
|
185
186
|
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
186
|
-
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodURL
|
|
187
|
+
url: import("@powerhousedao/shared/host-tokens").TokenableSchema<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodString]>>;
|
|
187
188
|
}, import("zod/v4/core").$strict>>;
|
|
188
189
|
}, import("zod/v4/core").$strict>>>;
|
|
189
190
|
placement: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
190
191
|
primary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
192
|
+
drives: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
191
193
|
}, import("zod/v4/core").$strict>>;
|
|
192
194
|
protocol: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
193
195
|
featureFlags: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compound.d.mts","names":[],"sources":["../../src/runners/compound.ts"],"mappings":";;;;;;;;;;;;;;qBA0Ba;qBAEA,0BAAU
|
|
1
|
+
{"version":3,"file":"compound.d.mts","names":[],"sources":["../../src/runners/compound.ts"],"mappings":";;;;;;;;;;;;;;qBA0Ba;qBAEA,0BAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA4B;qBACtC,kCAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAoC;wBAc7C,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,MACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAIW,MACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nt as genericCompoundHostSchema, Ot as declaredGenericCompoundHostSchema, i as runCompound, t as compoundStartVerb, x as readProjectName } from "../compound-C7GuPnTP.mjs";
|
|
2
2
|
//#region src/runners/compound.ts
|
|
3
3
|
/**
|
|
4
4
|
* The GENERIC compound runner module (phase 3): supervises the members a
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { D as PHHostOutputs, E as PHHost, O as PluginEntry, c as PluginEntryData, v as pluginEntryObjectSchema, y as pluginEntrySchema } from "./plugins-
|
|
1
|
+
import { $ as TOKEN_ESCAPE_KEY, A as emittedHostSchemas, B as refineStartOrder, C as childrenSchema, D as declaredHostSchemas, E as declaredGenericCompoundHostSchema, F as reactorBackendKindSchema, G as EnvToken, H as runnerKindSchema, I as reactorBackendSchema, J as MapToken, K as ItemToken, L as reactorHostSchema, M as hostNameSchema, N as makeHostSchemas, O as defineHostSchemas, P as profileSchema, Q as RefFn, R as reactorProtocolSchema, S as childWrapperSchema, T as compoundWiringSchema, U as ArrayMapToken, V as runnerBaseSchema, W as ConcatToken, X as OutputToken, Y as OutputPath, Z as RecordMapToken, _ as ReactorProtocol, _t as ref, a as HOST_NAME_MAX_LENGTH, at as TokenMode, b as RunnerBase, bt as tokenable, c as HostDefinition, ct as envTokenSchema, d as ReactorBackend, dt as forbidRef, et as TOKEN_KEYS, f as ReactorBackendKind, ft as isToken, g as ReactorPackageConfig, gt as outputTokenSchema, h as ReactorHostInput, ht as mapTokenSchema, i as CompoundWiring, it as TokenKey, j as genericCompoundHostSchema, k as emitHostJsonSchema, l as HostSchemas, lt as envTokenable, m as ReactorHost, mt as keyTokenSchema, n as CompoundHost, nt as Token, o as HOST_NAME_MESSAGE, ot as TokenableSchema, p as ReactorConfig, pt as itemTokenSchema, q as KeyToken, r as CompoundHostInput, rt as TokenFor, s as HOST_NAME_PATTERN, st as concatTokenSchema, t as ChildWrapper, tt as Template, u as Profile, ut as findToken, v as ReactorRemoteConfig, vt as tokenKeyOf, w as compoundHostSchema, x as RunnerKind, y as ReactorStorageConfig, yt as tokenSchema, z as reactorSchema } from "./host-schemas-ByrS_x_Z.mjs";
|
|
2
|
+
import { D as PHHostOutputs, E as PHHost, O as PluginEntry, c as PluginEntryData, v as pluginEntryObjectSchema, y as pluginEntrySchema } from "./plugins-CUY86XvH.mjs";
|
|
3
3
|
import { n as substituteBuiltinEnv, t as BuiltinEnv } from "./env-substitution-C_fVirPh.mjs";
|
|
4
|
+
import { SwitchboardDrive, driveAddressMessage, switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/host-export-schema.d.ts
|
|
6
7
|
/** `ph host export`: a declared host plus its members, keyed by folder. */
|
|
@@ -128,6 +129,6 @@ interface HostIssue {
|
|
|
128
129
|
hint?: string;
|
|
129
130
|
}
|
|
130
131
|
//#endregion
|
|
131
|
-
export { type ArrayMapToken, type BuiltinEnv, type CheckStage, type ChildWrapper, type CompoundHost, type CompoundHostInput, type CompoundWiring, type ConcatToken, type DriveDeclaration, type EnvToken, type HostDefinition, type HostExport, type HostIssue, type HostSchemas, type ItemToken, type KeyToken, type MapToken, type OutputPath, type OutputToken, type PHHost, type PHHostOutputs, type PluginEntry, type PluginEntryData, type Profile, type ReactorBackend, type ReactorBackendKind, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RunnerBase, type RunnerHandle, type RunnerHandleData, type RunnerKind, type StartedHandle, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenableSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineStartOrder, runnerBaseSchema, runnerKindSchema, substituteBuiltinEnv, tokenKeyOf, tokenSchema, tokenable };
|
|
132
|
+
export { type ArrayMapToken, type BuiltinEnv, type CheckStage, type ChildWrapper, type CompoundHost, type CompoundHostInput, type CompoundWiring, type ConcatToken, type DriveDeclaration, type EnvToken, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, type HostDefinition, type HostExport, type HostIssue, type HostSchemas, type ItemToken, type KeyToken, type MapToken, type OutputPath, type OutputToken, type PHHost, type PHHostOutputs, type PluginEntry, type PluginEntryData, type Profile, type ReactorBackend, type ReactorBackendKind, type ReactorConfig, type ReactorHost, type ReactorHostInput, type ReactorPackageConfig, type ReactorProtocol, type ReactorRemoteConfig, type ReactorStorageConfig, type RecordMapToken, type RefFn, type RunnerBase, type RunnerHandle, type RunnerHandleData, type RunnerKind, type StartedHandle, type SwitchboardDrive, TOKEN_ESCAPE_KEY, TOKEN_KEYS, type Template, type Token, type TokenFor, type TokenKey, type TokenMode, type TokenableSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, hostNameSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineStartOrder, runnerBaseSchema, runnerKindSchema, substituteBuiltinEnv, switchboardOfDrive, tokenKeyOf, tokenSchema, tokenable };
|
|
132
133
|
export {};
|
|
133
134
|
//# sourceMappingURL=schema.d.mts.map
|
package/dist/schema.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.mts","names":[],"sources":["../src/host-export-schema.ts","../src/drive-schema.ts","../src/runner-handle.ts","../src/host-issues.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.mts","names":[],"sources":["../src/host-export-schema.ts","../src/drive-schema.ts","../src/runner-handle.ts","../src/host-issues.ts"],"mappings":";;;;;;;qBAoCa,kBAAgB,EAAA;;;;;;;;;;GAuCzB,EAAA,KAAA;KAEQ,aAAa,EAAE,aAAa;;;;;;;;;;;wBClExB,4BACd,WAAW,QAAQ,EAAE,cAAc,gBAAgB,EAAE,aAAU,EAAA;;;;;;;;;;;;;;;;GAkBhE,EAAA,KAAA;qBAEY,wBAAsB,EAAA;;;;;;;;;;;;;;;;GAAyC,EAAA,KAAA;KAEhE,mBAAmB,EAAE,aAAa;qBAEjC,cAAY,EAAA,SAAA,EAAA;;;;;;;;;;;;;;;;GAAkC,EAAA,KAAA;;;;;wBAM3C,mBACd,YAAY,0BACZ,qBACA;;;;;;;;;UCrCe,aAAa,IAAI;EAChC,SAAS;;EAET,OAAO;;EAEP,YAAY;;;;qBAKD,oBAAkB,EAAA;;GAE7B,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;UAI7B,sBAAsB;EACrC,SAAS;EACT,QAAQ;EACR;;;;wBAiBc,gBAAgB,gBAAgB,gBAAgB;;;;KC7CpD;UAEK;EACf,OAAO;;EAEP;;EAEA;EACA;EACA"}
|
package/dist/schema.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as projectDriveIdWith, B as keyTokenSchema, C as reactorSchema, D as buildDriveDeclarationSchema, E as runnerKindSchema, F as envTokenable, G as tokenSchema, H as outputTokenSchema, I as findToken, K as tokenable, L as forbidRef, M as TOKEN_KEYS, N as concatTokenSchema, O as driveDeclarationSchema, P as envTokenSchema, R as isToken, S as reactorProtocolSchema, T as runnerBaseSchema, U as ref, V as mapTokenSchema, W as tokenKeyOf, _ as makeHostSchemas, a as HOST_NAME_PATTERN, b as reactorBackendSchema, c as compoundHostSchema, d as declaredHostSchemas, f as defineHostSchemas, g as hostNameSchema, h as genericCompoundHostSchema, i as HOST_NAME_MESSAGE, j as TOKEN_ESCAPE_KEY, k as drivesSchema, l as compoundWiringSchema, m as emittedHostSchemas, n as substituteBuiltinEnv, o as childWrapperSchema, p as emitHostJsonSchema, r as HOST_NAME_MAX_LENGTH, s as childrenSchema, u as declaredGenericCompoundHostSchema, v as profileSchema, w as refineStartOrder, x as reactorHostSchema, y as reactorBackendKindSchema, z as itemTokenSchema } from "./env-substitution-CzlXbvQJ.mjs";
|
|
2
2
|
import { pluginEntryObjectSchema, pluginEntrySchema } from "./plugins.mjs";
|
|
3
|
+
import { driveAddressMessage, switchboardOfDrive } from "@powerhousedao/shared/host-tokens";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
//#region src/host-export-schema.ts
|
|
5
6
|
function isRecord$1(value) {
|
|
@@ -92,6 +93,6 @@ function toStartedHandle(value, where) {
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
//#endregion
|
|
95
|
-
export { TOKEN_ESCAPE_KEY, TOKEN_KEYS, buildDriveDeclarationSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveDeclarationSchema, drivesSchema, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, hostExportSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, projectDriveIdWith, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineStartOrder, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, substituteBuiltinEnv, toStartedHandle, tokenKeyOf, tokenSchema, tokenable };
|
|
96
|
+
export { HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, TOKEN_ESCAPE_KEY, TOKEN_KEYS, buildDriveDeclarationSchema, childWrapperSchema, childrenSchema, compoundHostSchema, compoundWiringSchema, concatTokenSchema, declaredGenericCompoundHostSchema, declaredHostSchemas, defineHostSchemas, driveAddressMessage, driveDeclarationSchema, drivesSchema, emitHostJsonSchema, emittedHostSchemas, envTokenSchema, envTokenable, findToken, forbidRef, genericCompoundHostSchema, hostExportSchema, hostNameSchema, isToken, itemTokenSchema, keyTokenSchema, makeHostSchemas, mapTokenSchema, outputTokenSchema, pluginEntryObjectSchema, pluginEntrySchema, profileSchema, projectDriveIdWith, reactorBackendKindSchema, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, ref, refineStartOrder, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, substituteBuiltinEnv, switchboardOfDrive, toStartedHandle, tokenKeyOf, tokenSchema, tokenable };
|
|
96
97
|
|
|
97
98
|
//# sourceMappingURL=schema.mjs.map
|
package/dist/schema.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":["isRecord"],"sources":["../src/host-export-schema.ts","../src/runner-handle.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { declaredHostSchemas, type HostDefinition } from \"./host-schemas.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction childFolders(host: unknown): [key: string, folder: string][] {\n if (!isRecord(host) || !isRecord(host.children)) return [];\n return Object.entries(host.children).flatMap(([key, child]) =>\n isRecord(child) && typeof child.host === \"string\"\n ? [[key, child.host] as [string, string]]\n : [],\n );\n}\n\n// Picked by structure, as the loader does, so issues name the field.\nconst declaredHostSchema = z\n .custom<HostDefinition>()\n .superRefine((host, ctx) => {\n const schema =\n isRecord(host) && \"children\" in host\n ? declaredHostSchemas.compoundHostSchema\n : declaredHostSchemas.reactorHostSchema;\n const result = schema.safeParse(host);\n if (result.success) return;\n for (const issue of result.error.issues) {\n ctx.addIssue({\n code: \"custom\",\n message: issue.message,\n path: issue.path,\n });\n }\n });\n\n/** `ph host export`: a declared host plus its members, keyed by folder. */\nexport const hostExportSchema = z\n .strictObject({\n format: z.literal(\"ph-host-export\"),\n version: z.literal(1),\n project: z.strictObject({\n name: z.string().min(1),\n root: z.string().min(1),\n }),\n name: z.string().min(1),\n host: declaredHostSchema,\n members: z.record(z.string(), declaredHostSchema),\n })\n .superRefine((value, ctx) => {\n const reached = new Set<string>();\n const pending: [at: string[], host: unknown][] = [[[\"host\"], value.host]];\n for (let next = pending.shift(); next; next = pending.shift()) {\n const [at, host] = next;\n for (const [key, folder] of childFolders(host)) {\n if (!(folder in value.members)) {\n ctx.addIssue({\n code: \"custom\",\n path: [...at, \"children\", key, \"host\"],\n message: `Member folder \"${folder}\" is missing from members.`,\n });\n continue;\n }\n if (reached.has(folder)) continue;\n reached.add(folder);\n pending.push([[\"members\", folder], value.members[folder]]);\n }\n }\n for (const folder of Object.keys(value.members)) {\n if (reached.has(folder)) continue;\n ctx.addIssue({\n code: \"custom\",\n path: [\"members\", folder],\n message: `Member \"${folder}\" is not reached from the host's children.`,\n });\n }\n });\n\nexport type HostExport = z.input<typeof hostExportSchema>;\n","import { z } from \"zod\";\n\n/**\n * What a server verb returns to its supervisor (typed-host-configs 3.1/3.6):\n * `RunnerHandle<O>`. Consumers read a started host only through `outputs`\n * (and `$output` tokens over them). A verb that returns nothing (one-shot,\n * or self-sustaining) is an empty handle.\n */\nexport interface RunnerHandle<O = Record<string, unknown>> {\n outputs: O;\n /** Resolves when the member is serving. */\n ready: Promise<void>;\n /** Reverse-order compound teardown (and standalone signal handling). */\n shutdown(): Promise<void>;\n}\n\n/** The data half of a handle, validated by the compound. `ready`/`shutdown`\n * are functions and promises, so they are checked as TS fields, not here. */\nexport const runnerHandleSchema = z.looseObject({\n outputs: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type RunnerHandleData = z.infer<typeof runnerHandleSchema>;\n\n/** A verb's return value, normalized: validated data plus the live fields\n * when present. */\nexport interface StartedHandle extends RunnerHandleData {\n outputs: Record<string, unknown>;\n ready?: PromiseLike<unknown>;\n shutdown?: () => unknown;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return isRecord(value) && typeof value.then === \"function\";\n}\n\nfunction isCallable(value: unknown): value is (this: unknown) => unknown {\n return typeof value === \"function\";\n}\n\n/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)\n * is an empty handle; anything else must match runnerHandleSchema. */\nexport function toStartedHandle(value: unknown, where: string): StartedHandle {\n if (value === undefined || value === null) return { outputs: {} };\n const parsed = runnerHandleSchema.safeParse(value);\n if (!parsed.success) {\n throw new Error(\n `${where} returned an invalid runner handle:\\n${z.prettifyError(parsed.error)}`,\n );\n }\n const live = isRecord(value) ? value : {};\n const shutdown = live.shutdown;\n return {\n ...parsed.data,\n outputs: parsed.data.outputs ?? {},\n ...(isPromiseLike(live.ready) ? { ready: live.ready } : {}),\n ...(isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}),\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":["isRecord"],"sources":["../src/host-export-schema.ts","../src/runner-handle.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { declaredHostSchemas, type HostDefinition } from \"./host-schemas.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction childFolders(host: unknown): [key: string, folder: string][] {\n if (!isRecord(host) || !isRecord(host.children)) return [];\n return Object.entries(host.children).flatMap(([key, child]) =>\n isRecord(child) && typeof child.host === \"string\"\n ? [[key, child.host] as [string, string]]\n : [],\n );\n}\n\n// Picked by structure, as the loader does, so issues name the field.\nconst declaredHostSchema = z\n .custom<HostDefinition>()\n .superRefine((host, ctx) => {\n const schema =\n isRecord(host) && \"children\" in host\n ? declaredHostSchemas.compoundHostSchema\n : declaredHostSchemas.reactorHostSchema;\n const result = schema.safeParse(host);\n if (result.success) return;\n for (const issue of result.error.issues) {\n ctx.addIssue({\n code: \"custom\",\n message: issue.message,\n path: issue.path,\n });\n }\n });\n\n/** `ph host export`: a declared host plus its members, keyed by folder. */\nexport const hostExportSchema = z\n .strictObject({\n format: z.literal(\"ph-host-export\"),\n version: z.literal(1),\n project: z.strictObject({\n name: z.string().min(1),\n root: z.string().min(1),\n }),\n name: z.string().min(1),\n host: declaredHostSchema,\n members: z.record(z.string(), declaredHostSchema),\n })\n .superRefine((value, ctx) => {\n const reached = new Set<string>();\n const pending: [at: string[], host: unknown][] = [[[\"host\"], value.host]];\n for (let next = pending.shift(); next; next = pending.shift()) {\n const [at, host] = next;\n for (const [key, folder] of childFolders(host)) {\n if (!(folder in value.members)) {\n ctx.addIssue({\n code: \"custom\",\n path: [...at, \"children\", key, \"host\"],\n message: `Member folder \"${folder}\" is missing from members.`,\n });\n continue;\n }\n if (reached.has(folder)) continue;\n reached.add(folder);\n pending.push([[\"members\", folder], value.members[folder]]);\n }\n }\n for (const folder of Object.keys(value.members)) {\n if (reached.has(folder)) continue;\n ctx.addIssue({\n code: \"custom\",\n path: [\"members\", folder],\n message: `Member \"${folder}\" is not reached from the host's children.`,\n });\n }\n });\n\nexport type HostExport = z.input<typeof hostExportSchema>;\n","import { z } from \"zod\";\n\n/**\n * What a server verb returns to its supervisor (typed-host-configs 3.1/3.6):\n * `RunnerHandle<O>`. Consumers read a started host only through `outputs`\n * (and `$output` tokens over them). A verb that returns nothing (one-shot,\n * or self-sustaining) is an empty handle.\n */\nexport interface RunnerHandle<O = Record<string, unknown>> {\n outputs: O;\n /** Resolves when the member is serving. */\n ready: Promise<void>;\n /** Reverse-order compound teardown (and standalone signal handling). */\n shutdown(): Promise<void>;\n}\n\n/** The data half of a handle, validated by the compound. `ready`/`shutdown`\n * are functions and promises, so they are checked as TS fields, not here. */\nexport const runnerHandleSchema = z.looseObject({\n outputs: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type RunnerHandleData = z.infer<typeof runnerHandleSchema>;\n\n/** A verb's return value, normalized: validated data plus the live fields\n * when present. */\nexport interface StartedHandle extends RunnerHandleData {\n outputs: Record<string, unknown>;\n ready?: PromiseLike<unknown>;\n shutdown?: () => unknown;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return isRecord(value) && typeof value.then === \"function\";\n}\n\nfunction isCallable(value: unknown): value is (this: unknown) => unknown {\n return typeof value === \"function\";\n}\n\n/** Normalize what a verb returned. `undefined` (a self-sustaining bridge)\n * is an empty handle; anything else must match runnerHandleSchema. */\nexport function toStartedHandle(value: unknown, where: string): StartedHandle {\n if (value === undefined || value === null) return { outputs: {} };\n const parsed = runnerHandleSchema.safeParse(value);\n if (!parsed.success) {\n throw new Error(\n `${where} returned an invalid runner handle:\\n${z.prettifyError(parsed.error)}`,\n );\n }\n const live = isRecord(value) ? value : {};\n const shutdown = live.shutdown;\n return {\n ...parsed.data,\n outputs: parsed.data.outputs ?? {},\n ...(isPromiseLike(live.ready) ? { ready: live.ready } : {}),\n ...(isCallable(shutdown) ? { shutdown: () => shutdown.call(value) } : {}),\n };\n}\n"],"mappings":";;;;;AAGA,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,aAAa,MAAgD;CACpE,IAAI,CAACA,WAAS,IAAI,KAAK,CAACA,WAAS,KAAK,QAAQ,GAAG,OAAO,CAAC;CACzD,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,SAAS,CAAC,KAAK,WAClDA,WAAS,KAAK,KAAK,OAAO,MAAM,SAAS,WACrC,CAAC,CAAC,KAAK,MAAM,IAAI,CAAqB,IACtC,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
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.81",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@powerhousedao/shared": "6.2.3-dev.
|
|
52
|
+
"@powerhousedao/shared": "6.2.3-dev.81",
|
|
53
53
|
"zod": "^4.5.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"tsdown": "0.23.0",
|
|
57
57
|
"vitest": "5.0.3",
|
|
58
|
-
"@powerhousedao/reactor-monitor": "6.2.3-dev.
|
|
58
|
+
"@powerhousedao/reactor-monitor": "6.2.3-dev.81"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"tsc": "tsc",
|