@powerhousedao/host-core 6.2.3-dev.58 → 6.2.3-dev.60
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-9--OujO-.d.mts → compound-C8P0kvPJ.d.mts} +7 -5
- package/dist/compound-C8P0kvPJ.d.mts.map +1 -0
- package/dist/{host-schemas-C_MLcYX6.mjs → host-schemas-CL_wFpY7.mjs} +193 -20
- package/dist/host-schemas-CL_wFpY7.mjs.map +1 -0
- package/dist/index.d.mts +332 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +87 -4
- package/dist/index.mjs.map +1 -1
- package/dist/plugins.d.mts +127 -0
- package/dist/plugins.d.mts.map +1 -0
- package/dist/plugins.mjs +174 -0
- package/dist/plugins.mjs.map +1 -0
- package/dist/runners/compound.d.mts +47 -3
- package/dist/runners/compound.d.mts.map +1 -1
- package/dist/runners/compound.mjs +1 -1
- package/package.json +9 -3
- package/dist/compound-9--OujO-.d.mts.map +0 -1
- package/dist/host-schemas-C_MLcYX6.mjs.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/backend-projection.ts","../src/reactor-config.ts"],"sourcesContent":["import type {\n ReactorBackend,\n ReactorConfig,\n ReactorProtocol,\n} from \"./reactor-config.js\";\n\n/**\n * Phase 4 (track R): project named host backends onto reactor-monitor's\n * `ReactorDescriptor` shape — the input `provision()` takes. Pure and\n * dependency-free; a type-assignability test pins the output to the real\n * `ReactorDescriptor` so an upstream field rename fails this package's tests\n * instead of silently drifting (D2.b: aligned locally, upstreaming not\n * blocked on).\n */\n\n/** The browser-provisionable storage union — reactor-monitor's\n * `ReactorStorageConfig` shape. `postgres` is the SERVER extension (D2.b): a\n * switchboard backend's storage, never a provisioned browser reactor's. */\nexport type ProjectedStorage =\n | { kind: \"idb\" }\n | { kind: \"memory\" }\n | { kind: \"path\"; dataDir: string };\n\nexport interface ProjectedDescriptor {\n kind: \"in-process\" | \"worker\" | \"remote\";\n name: string;\n storage?: ProjectedStorage;\n packages?: { cdnUrl?: string; specs?: string[]; dynamic?: boolean };\n featureFlags?: {\n documentDecisions?: boolean;\n authEnforcement?: boolean;\n authGroups?: boolean;\n authConditions?: boolean;\n };\n remote?: { url: string };\n}\n\nfunction projectStorage(\n name: string,\n storage: NonNullable<ReactorBackend[\"storage\"]>,\n): ProjectedStorage {\n switch (storage.kind) {\n case \"idb\":\n return { kind: \"idb\" };\n case \"memory\":\n return { kind: \"memory\" };\n case \"path\": {\n if (!storage.dataDir) {\n throw new Error(\n `Backend \"${name}\": storage kind \"path\" requires dataDir.`,\n );\n }\n return { kind: \"path\", dataDir: storage.dataDir };\n }\n case \"postgres\":\n throw new Error(\n `Backend \"${name}\": storage kind \"postgres\" is server-side only — ` +\n `a provisioned (in-process/worker) reactor cannot use it. Point a ` +\n `\"remote\" backend at the switchboard that owns that database instead.`,\n );\n }\n}\n\n/** One backend → one descriptor. The protocol's featureFlags ride every\n * descriptor (they are fleet consensus, not per-backend). A remote backend\n * must carry remote.url — provision() requires it. */\nexport function backendToDescriptor(\n name: string,\n backend: ReactorBackend,\n protocol?: ReactorProtocol,\n): ProjectedDescriptor {\n const descriptor: ProjectedDescriptor = {\n kind: backend.kind ?? \"in-process\",\n name,\n };\n if (descriptor.kind === \"remote\") {\n const url = backend.remote?.url;\n if (!url) {\n throw new Error(\n `Backend \"${name}\" is kind \"remote\" but has no remote.url — ` +\n `a remote descriptor attaches to an already-running reactor by URL.`,\n );\n }\n descriptor.remote = { url };\n // remote attaches; it builds nothing, so local-build fields do not apply\n return descriptor;\n }\n if (backend.storage) {\n descriptor.storage = projectStorage(name, backend.storage);\n }\n if (backend.packages) descriptor.packages = backend.packages;\n if (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n return descriptor;\n}\n\n/** All named backends, in placement-primary-first order (the order a\n * createReactorClients step would provision them). */\nexport function backendsToDescriptors(\n reactor: ReactorConfig | undefined,\n): ProjectedDescriptor[] {\n const backends = reactor?.backends;\n if (!backends) return [];\n const names = Object.keys(backends);\n const primary = reactor.placement?.primary;\n const ordered =\n primary && names.includes(primary)\n ? [primary, ...names.filter((n) => n !== primary)]\n : names;\n return ordered.map((name) =>\n backendToDescriptor(name, backends[name], reactor.protocol),\n );\n}\n\nconst LOCAL_KINDS = new Set([\"in-process\", \"worker\", undefined]);\n\n/**\n * Structural multi-reactor (phase 4): true when the block names BOTH a local\n * backend (in-process/worker — the tab's own reactor) and a remote one. This\n * is the shape Connect's routing client serves; a lone remote backend is an\n * attach-only host (assistant/agent shape), not a routed tab.\n */\nexport function isStructuralMultiReactor(\n reactor: ReactorConfig | undefined,\n): boolean {\n const backends = reactor?.backends;\n if (!backends) return false;\n const kinds = Object.values(backends).map((b) => b.kind);\n return (\n kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\")\n );\n}\n\n/** The remote backends' urls, placement order — what the routing client dials. */\nexport function remoteBackendUrls(\n reactor: ReactorConfig | undefined,\n): string[] {\n return backendsToDescriptors(reactor)\n .filter((d) => d.kind === \"remote\")\n .map((d) => d.remote?.url)\n .filter((u): u is string => typeof u === \"string\");\n}\n","/**\n * The shared `reactor` host-config block and its projections onto today's\n * Switchboard env / Connect runtime config. Phase 2 of uniform-runners: makes\n * the reactor block live through the bridge runners, BEFORE track R replaces\n * the projection with reactor-monitor's provision(). The headline is\n * single-sourced `reactor.protocol` — both projections read the same block, so\n * client and server cannot diverge, and a contradicting pre-set env fails boot.\n */\n\nexport type ReactorBackendKind = \"in-process\" | \"worker\" | \"remote\";\n\nexport interface ReactorStorageConfig {\n kind: \"idb\" | \"memory\" | \"path\" | \"postgres\";\n dataDir?: string;\n url?: string;\n}\n\nexport interface ReactorPackageConfig {\n cdnUrl?: string;\n specs?: string[];\n /** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n dynamic?: boolean;\n}\n\nexport interface ReactorRemoteConfig {\n host?: string;\n url?: string;\n}\n\nexport interface ReactorBackend {\n kind?: ReactorBackendKind;\n storage?: ReactorStorageConfig;\n readModel?: { url?: string };\n packages?: ReactorPackageConfig;\n remote?: ReactorRemoteConfig;\n}\n\n/** Replay/admission rules every sync peer must share. */\nexport interface ReactorProtocol {\n featureFlags?: {\n documentDecisions?: boolean;\n authEnforcement?: boolean;\n authGroups?: boolean;\n authConditions?: boolean;\n };\n createSignaturePolicy?: \"legacy\" | \"v2-required\";\n unsupportedStoredDocuments?: \"refuse\" | \"read-only\";\n}\n\nexport interface ReactorConfig {\n backends?: Record<string, ReactorBackend>;\n placement?: {\n primary?: string;\n default?: Record<string, unknown>;\n };\n workflows?: boolean;\n protocol?: ReactorProtocol;\n}\n\n/** The single primary backend for phase-2 projection (multi-backend routing is\n * track R). Prefers placement.primary, else \"main\"/\"local\", else the first. */\nexport function primaryBackend(\n reactor: ReactorConfig | undefined,\n): ReactorBackend | undefined {\n const backends = reactor?.backends;\n if (!backends) return undefined;\n const names = Object.keys(backends);\n if (names.length === 0) return undefined;\n const pick =\n reactor.placement?.primary ??\n (names.includes(\"main\")\n ? \"main\"\n : names.includes(\"local\")\n ? \"local\"\n : names[0]);\n return backends[pick];\n}\n\nconst FLAG_ENV: Record<\n keyof NonNullable<ReactorProtocol[\"featureFlags\"]>,\n string\n> = {\n documentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n authEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n authGroups: \"REACTOR_AUTH_GROUPS\",\n authConditions: \"REACTOR_AUTH_CONDITIONS\",\n};\n\n/** The env vars a protocol block maps onto, with their string values. Only\n * keys the block actually sets appear. */\nexport function protocolEnv(\n protocol: ReactorProtocol | undefined,\n): Record<string, string> {\n const env: Record<string, string> = {};\n if (!protocol) return env;\n for (const [key, varName] of Object.entries(FLAG_ENV)) {\n const value = protocol.featureFlags?.[key as keyof typeof FLAG_ENV];\n if (value !== undefined) env[varName] = value ? \"true\" : \"false\";\n }\n if (protocol.createSignaturePolicy !== undefined) {\n env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n }\n if (protocol.unsupportedStoredDocuments !== undefined) {\n env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS =\n protocol.unsupportedStoredDocuments;\n }\n return env;\n}\n\nexport interface SwitchboardReactorProjection {\n /** Env the switchboard server reads at boot. Only keys the block sets. */\n env: Record<string, string>;\n /** Options passed to startSwitchboard (DB path). */\n options: { dbPath?: string };\n}\n\n/** Project the reactor block onto the switchboard's env + options. */\nexport function projectReactorToSwitchboard(\n reactor: ReactorConfig | undefined,\n): SwitchboardReactorProjection {\n const env = protocolEnv(reactor?.protocol);\n const backend = primaryBackend(reactor);\n const options: { dbPath?: string } = {};\n\n if (backend?.storage) {\n const s = backend.storage;\n const dbUrl = s.kind === \"postgres\" ? s.url : s.dataDir;\n if (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;\n }\n if (backend?.readModel?.url) options.dbPath = backend.readModel.url;\n if (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = \"true\";\n if (reactor?.workflows !== undefined) {\n env.PH_WORKFLOWS_ENABLED = reactor.workflows ? \"1\" : \"0\";\n }\n return { env, options };\n}\n\nexport interface ConnectReactorProjection {\n /** Patch merged into the connect runtime config (connect.*). */\n connect: {\n reactor?: ReactorProtocol;\n instance?: { reactorWorker?: boolean };\n app?: { workflowsEnabled?: boolean };\n };\n}\n\n/** Project the reactor block onto the Connect runtime config: protocol →\n * connect.reactor (same shape), backend kind → instance.reactorWorker,\n * workflows → app.workflowsEnabled. */\nexport function projectReactorToConnect(\n reactor: ReactorConfig | undefined,\n): ConnectReactorProjection {\n const connect: ConnectReactorProjection[\"connect\"] = {};\n if (reactor?.protocol) connect.reactor = reactor.protocol;\n const backend = primaryBackend(reactor);\n if (backend?.kind !== undefined) {\n connect.instance = { reactorWorker: backend.kind === \"worker\" };\n }\n if (reactor?.workflows !== undefined) {\n connect.app = { workflowsEnabled: reactor.workflows };\n }\n return { connect };\n}\n\n/**\n * The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n * the host's protocol block, fail loudly naming the var, the host value, and\n * the env value. An env var that merely matches, or is unset, is fine (phase-2\n * transition keeps an operator's explicit env as an escape hatch unless it\n * disagrees with the protocol — see the WBS precedence note).\n */\nexport function assertProtocolConsistency(\n protocol: ReactorProtocol | undefined,\n env: Record<string, string | undefined>,\n hostFile = \"the host file\",\n): void {\n if (!protocol) return;\n const expected = protocolEnv(protocol);\n for (const [varName, hostValue] of Object.entries(expected)) {\n const envValue = env[varName];\n if (envValue !== undefined && envValue !== hostValue) {\n throw new Error(\n `reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment ` +\n `but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — ` +\n `a mismatch would diverge replay. Remove the env override or align the host.`,\n );\n }\n }\n}\n"],"mappings":";;AAqCA,SAAS,eACP,MACA,SACkB;CAClB,QAAQ,QAAQ,MAAhB;EACE,KAAK,OACH,OAAO,EAAE,MAAM,MAAM;EACvB,KAAK,UACH,OAAO,EAAE,MAAM,SAAS;EAC1B,KAAK;GACH,IAAI,CAAC,QAAQ,SACX,MAAM,IAAI,MACR,YAAY,KAAK,yCACnB;GAEF,OAAO;IAAE,MAAM;IAAQ,SAAS,QAAQ;GAAQ;EAElD,KAAK,YACH,MAAM,IAAI,MACR,YAAY,KAAK,uLAGnB;CACJ;AACF;;;;AAKA,SAAgB,oBACd,MACA,SACA,UACqB;CACrB,MAAM,aAAkC;EACtC,MAAM,QAAQ,QAAQ;EACtB;CACF;CACA,IAAI,WAAW,SAAS,UAAU;EAChC,MAAM,MAAM,QAAQ,QAAQ;EAC5B,IAAI,CAAC,KACH,MAAM,IAAI,MACR,YAAY,KAAK,8GAEnB;EAEF,WAAW,SAAS,EAAE,IAAI;EAE1B,OAAO;CACT;CACA,IAAI,QAAQ,SACV,WAAW,UAAU,eAAe,MAAM,QAAQ,OAAO;CAE3D,IAAI,QAAQ,UAA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Q;AACnB;;;;;;;;AASA,SAAgB,0BACd,UACA,KACA,WAAW,iBACL;CACN,IAAI,CAAC,UAAU;CACf,MAAM,WAAW,YAAY,QAAQ;CACrC,KAAK,MAAM,CAAC,SAAS,cAAc,OAAO,QAAQ,QAAQ,GAAG;EAC3D,MAAM,WAAW,IAAI;EACrB,IAAI,aAAa,KAAA,KAAa,aAAa,WACzC,MAAM,IAAI,MACR,8BAA8B,QAAQ,OAAO,SAAS,4BAC5C,UAAU,OAAO,SAAS,mHAEtC;CAEJ;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["factory"],"sources":["../src/backend-projection.ts","../src/reactor-config.ts","../src/plugins-resolve.ts"],"sourcesContent":["import type {\n ReactorBackend,\n ReactorConfig,\n ReactorProtocol,\n} from \"./reactor-config.js\";\n\n/**\n * Phase 4 (track R): project named host backends onto reactor-monitor's\n * `ReactorDescriptor` shape — the input `provision()` takes. Pure and\n * dependency-free; a type-assignability test pins the output to the real\n * `ReactorDescriptor` so an upstream field rename fails this package's tests\n * instead of silently drifting (D2.b: aligned locally, upstreaming not\n * blocked on).\n */\n\n/** The browser-provisionable storage union — reactor-monitor's\n * `ReactorStorageConfig` shape. `postgres` is the SERVER extension (D2.b): a\n * switchboard backend's storage, never a provisioned browser reactor's. */\nexport type ProjectedStorage =\n | { kind: \"idb\" }\n | { kind: \"memory\" }\n | { kind: \"path\"; dataDir: string };\n\nexport interface ProjectedDescriptor {\n kind: \"in-process\" | \"worker\" | \"remote\";\n name: string;\n storage?: ProjectedStorage;\n packages?: { cdnUrl?: string; specs?: string[]; dynamic?: boolean };\n featureFlags?: {\n documentDecisions?: boolean;\n authEnforcement?: boolean;\n authGroups?: boolean;\n authConditions?: boolean;\n };\n remote?: { url: string };\n}\n\nfunction projectStorage(\n name: string,\n storage: NonNullable<ReactorBackend[\"storage\"]>,\n): ProjectedStorage {\n switch (storage.kind) {\n case \"idb\":\n return { kind: \"idb\" };\n case \"memory\":\n return { kind: \"memory\" };\n case \"path\": {\n if (!storage.dataDir) {\n throw new Error(\n `Backend \"${name}\": storage kind \"path\" requires dataDir.`,\n );\n }\n return { kind: \"path\", dataDir: storage.dataDir };\n }\n case \"postgres\":\n throw new Error(\n `Backend \"${name}\": storage kind \"postgres\" is server-side only — ` +\n `a provisioned (in-process/worker) reactor cannot use it. Point a ` +\n `\"remote\" backend at the switchboard that owns that database instead.`,\n );\n }\n}\n\n/** One backend → one descriptor. The protocol's featureFlags ride every\n * descriptor (they are fleet consensus, not per-backend). A remote backend\n * must carry remote.url — provision() requires it. */\nexport function backendToDescriptor(\n name: string,\n backend: ReactorBackend,\n protocol?: ReactorProtocol,\n): ProjectedDescriptor {\n const descriptor: ProjectedDescriptor = {\n kind: backend.kind ?? \"in-process\",\n name,\n };\n if (descriptor.kind === \"remote\") {\n const url = backend.remote?.url;\n if (!url) {\n throw new Error(\n `Backend \"${name}\" is kind \"remote\" but has no remote.url — ` +\n `a remote descriptor attaches to an already-running reactor by URL.`,\n );\n }\n descriptor.remote = { url };\n // remote attaches; it builds nothing, so local-build fields do not apply\n return descriptor;\n }\n if (backend.storage) {\n descriptor.storage = projectStorage(name, backend.storage);\n }\n if (backend.packages) descriptor.packages = backend.packages;\n if (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n return descriptor;\n}\n\n/** All named backends, in placement-primary-first order (the order a\n * createReactorClients step would provision them). */\nexport function backendsToDescriptors(\n reactor: ReactorConfig | undefined,\n): ProjectedDescriptor[] {\n const backends = reactor?.backends;\n if (!backends) return [];\n const names = Object.keys(backends);\n const primary = reactor.placement?.primary;\n const ordered =\n primary && names.includes(primary)\n ? [primary, ...names.filter((n) => n !== primary)]\n : names;\n return ordered.map((name) =>\n backendToDescriptor(name, backends[name], reactor.protocol),\n );\n}\n\nconst LOCAL_KINDS = new Set([\"in-process\", \"worker\", undefined]);\n\n/**\n * Structural multi-reactor (phase 4): true when the block names BOTH a local\n * backend (in-process/worker — the tab's own reactor) and a remote one. This\n * is the shape Connect's routing client serves; a lone remote backend is an\n * attach-only host (assistant/agent shape), not a routed tab.\n */\nexport function isStructuralMultiReactor(\n reactor: ReactorConfig | undefined,\n): boolean {\n const backends = reactor?.backends;\n if (!backends) return false;\n const kinds = Object.values(backends).map((b) => b.kind);\n return (\n kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\")\n );\n}\n\n/** The remote backends' urls, placement order — what the routing client dials. */\nexport function remoteBackendUrls(\n reactor: ReactorConfig | undefined,\n): string[] {\n return backendsToDescriptors(reactor)\n .filter((d) => d.kind === \"remote\")\n .map((d) => d.remote?.url)\n .filter((u): u is string => typeof u === \"string\");\n}\n","/**\n * The shared `reactor` host-config block and its projections onto today's\n * Switchboard env / Connect runtime config. Phase 2 of uniform-runners: makes\n * the reactor block live through the bridge runners, BEFORE track R replaces\n * the projection with reactor-monitor's provision(). The headline is\n * single-sourced `reactor.protocol` — both projections read the same block, so\n * client and server cannot diverge, and a contradicting pre-set env fails boot.\n */\n\nexport type ReactorBackendKind = \"in-process\" | \"worker\" | \"remote\";\n\nexport interface ReactorStorageConfig {\n kind: \"idb\" | \"memory\" | \"path\" | \"postgres\";\n dataDir?: string;\n url?: string;\n}\n\nexport interface ReactorPackageConfig {\n cdnUrl?: string;\n specs?: string[];\n /** on-demand model resolution (was DYNAMIC_MODEL_LOADING). */\n dynamic?: boolean;\n}\n\nexport interface ReactorRemoteConfig {\n host?: string;\n url?: string;\n}\n\nexport interface ReactorBackend {\n kind?: ReactorBackendKind;\n storage?: ReactorStorageConfig;\n readModel?: { url?: string };\n packages?: ReactorPackageConfig;\n remote?: ReactorRemoteConfig;\n}\n\n/** Replay/admission rules every sync peer must share. */\nexport interface ReactorProtocol {\n featureFlags?: {\n documentDecisions?: boolean;\n authEnforcement?: boolean;\n authGroups?: boolean;\n authConditions?: boolean;\n };\n createSignaturePolicy?: \"legacy\" | \"v2-required\";\n unsupportedStoredDocuments?: \"refuse\" | \"read-only\";\n}\n\nexport interface ReactorConfig {\n backends?: Record<string, ReactorBackend>;\n placement?: {\n primary?: string;\n default?: Record<string, unknown>;\n };\n workflows?: boolean;\n protocol?: ReactorProtocol;\n}\n\n/** The single primary backend for phase-2 projection (multi-backend routing is\n * track R). Prefers placement.primary, else \"main\"/\"local\", else the first. */\nexport function primaryBackend(\n reactor: ReactorConfig | undefined,\n): ReactorBackend | undefined {\n const backends = reactor?.backends;\n if (!backends) return undefined;\n const names = Object.keys(backends);\n if (names.length === 0) return undefined;\n const pick =\n reactor.placement?.primary ??\n (names.includes(\"main\")\n ? \"main\"\n : names.includes(\"local\")\n ? \"local\"\n : names[0]);\n return backends[pick];\n}\n\nconst FLAG_ENV: Record<\n keyof NonNullable<ReactorProtocol[\"featureFlags\"]>,\n string\n> = {\n documentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n authEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n authGroups: \"REACTOR_AUTH_GROUPS\",\n authConditions: \"REACTOR_AUTH_CONDITIONS\",\n};\n\n/** The env vars a protocol block maps onto, with their string values. Only\n * keys the block actually sets appear. */\nexport function protocolEnv(\n protocol: ReactorProtocol | undefined,\n): Record<string, string> {\n const env: Record<string, string> = {};\n if (!protocol) return env;\n for (const [key, varName] of Object.entries(FLAG_ENV)) {\n const value = protocol.featureFlags?.[key as keyof typeof FLAG_ENV];\n if (value !== undefined) env[varName] = value ? \"true\" : \"false\";\n }\n if (protocol.createSignaturePolicy !== undefined) {\n env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n }\n if (protocol.unsupportedStoredDocuments !== undefined) {\n env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS =\n protocol.unsupportedStoredDocuments;\n }\n return env;\n}\n\nexport interface SwitchboardReactorProjection {\n /** Env the switchboard server reads at boot. Only keys the block sets. */\n env: Record<string, string>;\n /** Options passed to startSwitchboard (DB path). */\n options: { dbPath?: string };\n}\n\n/** Project the reactor block onto the switchboard's env + options. */\nexport function projectReactorToSwitchboard(\n reactor: ReactorConfig | undefined,\n): SwitchboardReactorProjection {\n const env = protocolEnv(reactor?.protocol);\n const backend = primaryBackend(reactor);\n const options: { dbPath?: string } = {};\n\n if (backend?.storage) {\n const s = backend.storage;\n const dbUrl = s.kind === \"postgres\" ? s.url : s.dataDir;\n if (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;\n }\n if (backend?.readModel?.url) options.dbPath = backend.readModel.url;\n if (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = \"true\";\n if (reactor?.workflows !== undefined) {\n env.PH_WORKFLOWS_ENABLED = reactor.workflows ? \"1\" : \"0\";\n }\n return { env, options };\n}\n\n/** The four reactor-client shapes a Connect host can select (mirrors the\n * shared PHReactorClientMode; kept local to avoid an import cycle). */\nexport type ReactorClientMode = \"in-process\" | \"worker\" | \"remote\" | \"router\";\n\nconst LOCAL_BACKEND_KINDS = new Set<ReactorBackendKind | undefined>([\n \"in-process\",\n \"worker\",\n undefined,\n]);\n\n/**\n * Which reactor client the backend topology asks for:\n * - local (in-process/worker) AND remote backends -> `router`\n * - remote backend(s) only -> `remote`\n * - a worker backend -> `worker`\n * - anything else local -> `in-process`\n * `undefined` when no backends are declared — the caller then keeps the\n * legacy reactorWorker/multiReactor behaviour untouched.\n */\nexport function reactorClientMode(\n reactor: ReactorConfig | undefined,\n): ReactorClientMode | undefined {\n const backends = reactor?.backends;\n if (!backends) return undefined;\n const kinds = Object.values(backends).map((b) => b.kind);\n if (kinds.length === 0) return undefined;\n const hasLocal = kinds.some((k) => LOCAL_BACKEND_KINDS.has(k));\n const hasRemote = kinds.some((k) => k === \"remote\");\n if (hasLocal && hasRemote) return \"router\";\n if (hasRemote) return \"remote\";\n return primaryBackend(reactor)?.kind === \"worker\" ? \"worker\" : \"in-process\";\n}\n\nexport interface ConnectReactorProjection {\n /** Patch merged into the connect runtime config (connect.*). */\n connect: {\n reactor?: ReactorProtocol;\n instance?: { reactorWorker?: boolean; reactorClient?: ReactorClientMode };\n app?: { workflowsEnabled?: boolean };\n };\n}\n\n/** Project the reactor block onto the Connect runtime config: protocol →\n * connect.reactor (same shape), backend topology → instance.reactorWorker\n * (legacy) + instance.reactorClient (the explicit 4-way selector),\n * workflows → app.workflowsEnabled. */\nexport function projectReactorToConnect(\n reactor: ReactorConfig | undefined,\n): ConnectReactorProjection {\n const connect: ConnectReactorProjection[\"connect\"] = {};\n if (reactor?.protocol) connect.reactor = reactor.protocol;\n const backend = primaryBackend(reactor);\n const mode = reactorClientMode(reactor);\n if (backend?.kind !== undefined || mode !== undefined) {\n connect.instance = {\n ...(backend?.kind !== undefined\n ? { reactorWorker: backend.kind === \"worker\" }\n : {}),\n ...(mode !== undefined ? { reactorClient: mode } : {}),\n };\n }\n if (reactor?.workflows !== undefined) {\n connect.app = { workflowsEnabled: reactor.workflows };\n }\n return { connect };\n}\n\n/**\n * The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n * the host's protocol block, fail loudly naming the var, the host value, and\n * the env value. An env var that merely matches, or is unset, is fine (phase-2\n * transition keeps an operator's explicit env as an escape hatch unless it\n * disagrees with the protocol — see the WBS precedence note).\n */\nexport function assertProtocolConsistency(\n protocol: ReactorProtocol | undefined,\n env: Record<string, string | undefined>,\n hostFile = \"the host file\",\n): void {\n if (!protocol) return;\n const expected = protocolEnv(protocol);\n for (const [varName, hostValue] of Object.entries(expected)) {\n const envValue = env[varName];\n if (envValue !== undefined && envValue !== hostValue) {\n throw new Error(\n `reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment ` +\n `but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — ` +\n `a mismatch would diverge replay. Remove the env override or align the host.`,\n );\n }\n }\n}\n","import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\nimport {\n entryActiveForVerb,\n hostTypeSatisfies,\n normalizePluginEntries,\n PluginError,\n type HostPlugin,\n type PluginEntry,\n type ResolvedPlugin,\n} from \"./plugins.js\";\n\n/**\n * NODE-ONLY plugin resolution (split from plugins.ts so the pure runner core\n * stays browser-safe for ConnectCore — R3). Resolves host.js entries from the\n * PROJECT dependency tree, exactly like runner modules.\n */\n\nfunction isHostPluginShape(value: unknown): value is HostPlugin {\n return (\n value !== null &&\n typeof value === \"object\" &&\n typeof (value as HostPlugin).name === \"string\"\n );\n}\n\n/**\n * Resolve host.js plugin entries into live plugins for one host boot:\n * verb-filter → module resolution from the project tree (default condition,\n * like runners) → factory/object contract → config validation → appliesTo.\n */\nexport async function resolveHostPlugins<THooks = Record<string, unknown>>(\n projectRoot: string,\n hostType: string,\n verb: string,\n entries: readonly PluginEntry[],\n where: string,\n): Promise<ResolvedPlugin<THooks>[]> {\n const normalized = normalizePluginEntries(entries, where);\n const projectRequire = createRequire(\n pathToFileURL(path.join(projectRoot, \"package.json\")).href,\n );\n\n const resolved: ResolvedPlugin<THooks>[] = [];\n for (const entry of normalized) {\n if (!entryActiveForVerb(entry, verb)) continue;\n\n let file: string;\n try {\n file = projectRequire.resolve(entry.module);\n } catch {\n throw new PluginError(\n `${where}: cannot resolve plugin \"${entry.module}\" from ${projectRoot}.`,\n \"Plugins resolve from the project dependency tree, exactly like runner modules.\",\n );\n }\n const module = (await import(pathToFileURL(file).href)) as {\n default?: unknown;\n };\n const exported = module.default;\n\n let plugin: HostPlugin<THooks>;\n if (typeof exported === \"function\") {\n const factory = exported as (config: unknown) => HostPlugin<THooks>;\n plugin = factory(entry.config);\n } else if (isHostPluginShape(exported)) {\n if (Object.keys(entry.config).length > 0 && !exported.configSchema) {\n throw new PluginError(\n `${where}: plugin \"${entry.module}\" takes no config, but the entry passes one.`,\n );\n }\n plugin = exported as HostPlugin<THooks>;\n } else {\n throw new PluginError(\n `${where}: \"${entry.module}\" does not default-export a plugin object or factory.`,\n \"Export `{ name, hooks?, contributions? }` or `(config) => plugin`.\",\n );\n }\n\n if (plugin.configSchema) {\n const parsed = plugin.configSchema.safeParse(entry.config);\n if (!parsed.success) {\n throw new PluginError(\n `${where}: config for plugin \"${plugin.name}\" is invalid:\\n` +\n z.prettifyError(parsed.error),\n );\n }\n }\n\n const appliesTo = plugin.appliesTo ?? \"reactor\";\n if (!hostTypeSatisfies(hostType, appliesTo)) {\n throw new PluginError(\n `${where}: plugin \"${plugin.name}\" applies to \"${appliesTo}\" hosts, but this host is \"${hostType}\".`,\n );\n }\n\n resolved.push({ entry, plugin, provenance: \"dependency\" });\n }\n return resolved;\n}\n"],"mappings":";;;;;;;AAqCA,SAAS,eACP,MACA,SACkB;CAClB,QAAQ,QAAQ,MAAhB;EACE,KAAK,OACH,OAAO,EAAE,MAAM,MAAM;EACvB,KAAK,UACH,OAAO,EAAE,MAAM,SAAS;EAC1B,KAAK;GACH,IAAI,CAAC,QAAQ,SACX,MAAM,IAAI,MACR,YAAY,KAAK,yCACnB;GAEF,OAAO;IAAE,MAAM;IAAQ,SAAS,QAAQ;GAAQ;EAElD,KAAK,YACH,MAAM,IAAI,MACR,YAAY,KAAK,uLAGnB;CACJ;AACF;;;;AAKA,SAAgB,oBACd,MACA,SACA,UACqB;CACrB,MAAM,aAAkC;EACtC,MAAM,QAAQ,QAAQ;EACtB;CACF;CACA,IAAI,WAAW,SAAS,UAAU;EAChC,MAAM,MAAM,QAAQ,QAAQ;EAC5B,IAAI,CAAC,KACH,MAAM,IAAI,MACR,YAAY,KAAK,8GAEnB;EAEF,WAAW,SAAS,EAAE,IAAI;EAE1B,OAAO;CACT;CACA,IAAI,QAAQ,SACV,WAAW,UAAU,eAAe,MAAM,QAAQ,OAAO;CAE3D,IAAI,QAAQ,UAAU,WAAW,WAAW,QAAQ;CACpD,IAAI,UAAU,cAAc,WAAW,eAAe,SAAS;CAC/D,OAAO;AACT;;;AAIA,SAAgB,sBACd,SACuB;CACvB,MAAM,WAAW,SAAS;CAC1B,IAAI,CAAC,UAAU,OAAO,CAAC;CACvB,MAAM,QAAQ,OAAO,KAAK,QAAQ;CAClC,MAAM,UAAU,QAAQ,WAAW;CAKnC,QAHE,WAA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,MAAM,2BAA2B,MAAM,OAAO,SAAS,YAAY,IACtE,gFACF;EACF;EAIA,MAAM,YAAW,MAHK,OAAO,cAAc,IAAI,CAAC,CAAC,MAAA,CAGzB;EAExB,IAAI;EACJ,IAAI,OAAO,aAAa,YAEtB,SAASA,SAAQ,MAAM,MAAM;OACxB,IAAI,kBAAkB,QAAQ,GAAG;GACtC,IAAI,OAAO,KAAK,MAAM,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,cACpD,MAAM,IAAI,YACR,GAAG,MAAM,YAAY,MAAM,OAAO,6CACpC;GAEF,SAAS;EACX,OACE,MAAM,IAAI,YACR,GAAG,MAAM,KAAK,MAAM,OAAO,wDAC3B,oEACF;EAGF,IAAI,OAAO,cAAc;GACvB,MAAM,SAAS,OAAO,aAAa,UAAU,MAAM,MAAM;GACzD,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,YACR,GAAG,MAAM,uBAAuB,OAAO,KAAK,mBAC1C,EAAE,cAAc,OAAO,KAAK,CAChC;EAEJ;EAEA,MAAM,YAAY,OAAO,aAAa;EACtC,IAAI,CAAC,kBAAkB,UAAU,SAAS,GACxC,MAAM,IAAI,YACR,GAAG,MAAM,YAAY,OAAO,KAAK,gBAAgB,UAAU,6BAA6B,SAAS,GACnG;EAGF,SAAS,KAAK;GAAE;GAAO;GAAQ,YAAY;EAAa,CAAC;CAC3D;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/plugins.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* R1 — the host plugin framework (bridge-runners-to-plugins plan,
|
|
5
|
+
* customization-references/host-core as the blueprint).
|
|
6
|
+
*
|
|
7
|
+
* A plugin is hooks + contributions; hooks are boot wiring (main realm only),
|
|
8
|
+
* contributions are declarative, serializable surface. Host RUNTIMES define
|
|
9
|
+
* the hook vocabulary and interleave their own wiring between stages — they
|
|
10
|
+
* are never plugins themselves.
|
|
11
|
+
*
|
|
12
|
+
* host.js carries the COMPOSITION as `runner.plugins` entries:
|
|
13
|
+
* string | { module, enabled?, verbs?, config? }
|
|
14
|
+
* Presence is activation (enabled defaults true); `verbs` scopes an entry to
|
|
15
|
+
* matching run verbs; `config` is validated against the plugin's declared
|
|
16
|
+
* zod schema. Entries resolve from the PROJECT's dependency tree exactly
|
|
17
|
+
* like runner modules.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PluginError extends Error {
|
|
20
|
+
constructor(message: string, hint?: string);
|
|
21
|
+
}
|
|
22
|
+
export declare const pluginEntryObjectSchema: z.ZodObject<{
|
|
23
|
+
module: z.ZodString;
|
|
24
|
+
/** Presence is activation BY DEFAULT; false is the explicit off-switch. */
|
|
25
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
/** "*" (default) or the run verbs this entry is active for. */
|
|
27
|
+
verbs: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
|
|
28
|
+
/** Validated against the plugin's declared configSchema at resolution. */
|
|
29
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export declare const pluginEntrySchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
32
|
+
module: z.ZodString;
|
|
33
|
+
/** Presence is activation BY DEFAULT; false is the explicit off-switch. */
|
|
34
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
/** "*" (default) or the run verbs this entry is active for. */
|
|
36
|
+
verbs: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
|
|
37
|
+
/** Validated against the plugin's declared configSchema at resolution. */
|
|
38
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
39
|
+
}, z.core.$strict>]>;
|
|
40
|
+
export type PluginEntry = z.infer<typeof pluginEntrySchema>;
|
|
41
|
+
export interface NormalizedPluginEntry {
|
|
42
|
+
module: string;
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
verbs: "*" | string[];
|
|
45
|
+
config: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export declare function normalizePluginEntry(entry: PluginEntry): NormalizedPluginEntry;
|
|
48
|
+
/** Module is the identity key: a duplicate makes override targeting and
|
|
49
|
+
* ordering ambiguous, so it fails loudly. */
|
|
50
|
+
export declare function normalizePluginEntries(entries: readonly PluginEntry[], where: string): NormalizedPluginEntry[];
|
|
51
|
+
export declare function entryActiveForVerb(entry: NormalizedPluginEntry, verb: string): boolean;
|
|
52
|
+
export declare function registerHostType(id: string, parent: string | null): void;
|
|
53
|
+
export declare function hostTypeSatisfies(hostType: string, appliesTo: string): boolean;
|
|
54
|
+
/** Hook kinds (v1 §2.2). The hook VOCABULARY is defined by host runtimes;
|
|
55
|
+
* plugins implement subsets of it. */
|
|
56
|
+
export type Provide<T, C> = (ctx: C) => T | Promise<T>;
|
|
57
|
+
export type Transform<T, C> = (value: T, ctx: C) => T | Promise<T>;
|
|
58
|
+
export type Observe<C> = (ctx: C) => void | Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Core contributions — declarative, serializable, realm-crossing. Host
|
|
61
|
+
* runtimes extend this with their own kinds (UI slots live in connect-host,
|
|
62
|
+
* never here). `drives` entries use the drive declaration shape from
|
|
63
|
+
* drives.ts; kept as unknown here to avoid a cycle — the merge is shape-blind.
|
|
64
|
+
*/
|
|
65
|
+
export interface Contributions {
|
|
66
|
+
drives?: unknown[];
|
|
67
|
+
packages?: string[];
|
|
68
|
+
configDeclarations?: {
|
|
69
|
+
name: string;
|
|
70
|
+
type?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
}[];
|
|
73
|
+
[kind: string]: unknown[] | undefined;
|
|
74
|
+
}
|
|
75
|
+
export interface HostPlugin<THooks = Record<string, unknown>, TConfig = unknown> {
|
|
76
|
+
/** Stable id; used in ordering, dependsOn, and every diagnostic. */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Host-type requirement; the entry is rejected on a host outside the
|
|
79
|
+
* hierarchy branch. Default: "reactor". */
|
|
80
|
+
appliesTo?: string;
|
|
81
|
+
/** Coarse ordering bucket (Vite-style). Default: "normal". */
|
|
82
|
+
enforce?: "pre" | "post";
|
|
83
|
+
/** Hard dependencies on OTHER PLUGINS — the host runtime is implied and
|
|
84
|
+
* never named. Missing dependency or cycle fails boot naming both sides. */
|
|
85
|
+
dependsOn?: string[];
|
|
86
|
+
/** Declared config shape; entry config is validated against it. A plugin
|
|
87
|
+
* without a schema accepts no config (passing one is a boot error). */
|
|
88
|
+
configSchema?: z.ZodType<TConfig>;
|
|
89
|
+
hooks?: Partial<THooks>;
|
|
90
|
+
contributions?: Contributions;
|
|
91
|
+
}
|
|
92
|
+
/** A plugin module default-exports either a HostPlugin object (no config
|
|
93
|
+
* accepted) or a factory `(config) => HostPlugin`. */
|
|
94
|
+
export type HostPluginModule<THooks = Record<string, unknown>, TConfig = unknown> = HostPlugin<THooks, TConfig> | ((config: TConfig) => HostPlugin<THooks, TConfig>);
|
|
95
|
+
export interface ResolvedPlugin<THooks = Record<string, unknown>> {
|
|
96
|
+
entry: NormalizedPluginEntry;
|
|
97
|
+
plugin: HostPlugin<THooks>;
|
|
98
|
+
/** Provenance for contribution merge ordering. */
|
|
99
|
+
provenance: "built-in" | "local" | "dependency";
|
|
100
|
+
}
|
|
101
|
+
/** Registration order, bucketed pre → normal → post (stable within buckets),
|
|
102
|
+
* then dependsOn topo-sorted within the bucketed order. */
|
|
103
|
+
export declare function resolveOrder<THooks>(plugins: readonly HostPlugin<THooks>[]): HostPlugin<THooks>[];
|
|
104
|
+
export declare function runProvideHook<T, C>(name: string, plugins: readonly HostPlugin[], ctx: C): Promise<T | undefined>;
|
|
105
|
+
export declare function runTransformHook<T, C>(name: string, plugins: readonly HostPlugin[], ctx: C, seed: T): Promise<T>;
|
|
106
|
+
/** Sequential observe, in plugin order — for lifecycle moments whose order
|
|
107
|
+
* is load-bearing (teardown: the switchboard stops privacy before workflows
|
|
108
|
+
* before the api, per the carve map). */
|
|
109
|
+
export declare function runObserveHookSequential<C>(name: string, plugins: readonly HostPlugin[], ctx: C): Promise<void>;
|
|
110
|
+
export declare function runObserveHook<C>(name: string, plugins: readonly HostPlugin[], ctx: C): Promise<void>;
|
|
111
|
+
export interface ContributionSource {
|
|
112
|
+
pluginName: string;
|
|
113
|
+
provenance: "built-in" | "local" | "dependency";
|
|
114
|
+
}
|
|
115
|
+
export interface MergedContribution<T = unknown> {
|
|
116
|
+
value: T;
|
|
117
|
+
source: ContributionSource;
|
|
118
|
+
}
|
|
119
|
+
/** Array kinds concatenate in provenance-then-order sequence (built-in first,
|
|
120
|
+
* so later sources read as overrides where consumers want last-wins). */
|
|
121
|
+
export declare function mergeContributions(resolved: readonly {
|
|
122
|
+
plugin: HostPlugin;
|
|
123
|
+
provenance: ContributionSource["provenance"];
|
|
124
|
+
}[]): Record<string, MergedContribution[]>;
|
|
125
|
+
//#endregion
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=plugins.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.mts","names":[],"sources":["../src/plugins.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAmBa,oBAAoB;EAC/B,YAAY,iBAAiB;;qBAQlB,yBAAuB,EAAA;;;;;;;;GAUlC,EAAA,KAAA;qBAEW,mBAAiB,EAAA,mBAAA,EAAA,WAAA,EAAA;;;;;;;;GAG5B,EAAA,KAAA;YAEU,cAAc,EAAE,aAAa;iBAExB;EACf;EACA;EACA;EACA,QAAQ;;wBAGM,qBACd,OAAO,cACN;;;wBAca,uBACd,kBAAkB,eAClB,gBACC;wBAea,mBACd,OAAO,uBACP;wBAsBc,iBAAiB,YAAY;wBAS7B,kBACd,kBACA;;;YAcU,QAAQ,GAAG,MAAM,KAAK,MAAM,IAAI,QAAQ;YACxC,UAAU,GAAG,MAAM,OAAO,GAAG,KAAK,MAAM,IAAI,QAAQ;YACpD,QAAQ,MAAM,KAAK,aAAa;;;;;;;iBAQ3B;EACf;EACA;EACA;IAAuB;IAAc;IAAe;;GACnD;;iBAGc,WACf,SAAS,yBACT;;EAGA;;;EAGA;;EAEA;;;EAGA;;;EAGA,eAAe,EAAE,QAAQ;EACzB,QAAQ,QAAQ;EAChB,gBAAgB;;;;YAKN,iBACV,SAAS,yBACT,qBAEE,WAAW,QAAQ,aACjB,QAAQ,YAAY,WAAW,QAAQ;iBAE5B,eAAe,SAAS;EACvC,OAAO;EACP,QAAQ,WAAW;;EAEnB;;;;wBAOc,aAAa,QAC3B,kBAAkB,WAAW,YAC5B,WAAW;wBA6CQ,eAAe,GAAG,GACtC,cACA,kBAAkB,cAClB,KAAK,IACJ,QAAQ;wBAWW,iBAAiB,GAAG,GACxC,cACA,kBAAkB,cAClB,KAAK,GACL,MAAM,IACL,QAAQ;;;;wBAYW,yBAAyB,GAC7C,cACA,kBAAkB,cAClB,KAAK,IACJ;wBAOmB,eAAe,GACnC,cACA,kBAAkB,cAClB,KAAK,IACJ;iBAWc;EACf;EACA;;iBAGe,mBAAmB;EAClC,OAAO;EACP,QAAQ;;;;wBAKM,mBACd;EACE,QAAQ;EACR,YAAY;MAEb,eAAe"}
|
package/dist/plugins.mjs
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/plugins.ts
|
|
3
|
+
/**
|
|
4
|
+
* R1 — the host plugin framework (bridge-runners-to-plugins plan,
|
|
5
|
+
* customization-references/host-core as the blueprint).
|
|
6
|
+
*
|
|
7
|
+
* A plugin is hooks + contributions; hooks are boot wiring (main realm only),
|
|
8
|
+
* contributions are declarative, serializable surface. Host RUNTIMES define
|
|
9
|
+
* the hook vocabulary and interleave their own wiring between stages — they
|
|
10
|
+
* are never plugins themselves.
|
|
11
|
+
*
|
|
12
|
+
* host.js carries the COMPOSITION as `runner.plugins` entries:
|
|
13
|
+
* string | { module, enabled?, verbs?, config? }
|
|
14
|
+
* Presence is activation (enabled defaults true); `verbs` scopes an entry to
|
|
15
|
+
* matching run verbs; `config` is validated against the plugin's declared
|
|
16
|
+
* zod schema. Entries resolve from the PROJECT's dependency tree exactly
|
|
17
|
+
* like runner modules.
|
|
18
|
+
*/
|
|
19
|
+
var PluginError = class extends Error {
|
|
20
|
+
constructor(message, hint) {
|
|
21
|
+
super(hint ? `${message}\n Hint: ${hint}` : message);
|
|
22
|
+
this.name = "PluginError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const pluginEntryObjectSchema = z.strictObject({
|
|
26
|
+
module: z.string().min(1),
|
|
27
|
+
/** Presence is activation BY DEFAULT; false is the explicit off-switch. */
|
|
28
|
+
enabled: z.boolean().optional(),
|
|
29
|
+
/** "*" (default) or the run verbs this entry is active for. */
|
|
30
|
+
verbs: z.union([z.literal("*"), z.array(z.string().min(1)).min(1)]).optional(),
|
|
31
|
+
/** Validated against the plugin's declared configSchema at resolution. */
|
|
32
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
33
|
+
});
|
|
34
|
+
const pluginEntrySchema = z.union([z.string().min(1), pluginEntryObjectSchema]);
|
|
35
|
+
function normalizePluginEntry(entry) {
|
|
36
|
+
if (typeof entry === "string") return {
|
|
37
|
+
module: entry,
|
|
38
|
+
enabled: true,
|
|
39
|
+
verbs: "*",
|
|
40
|
+
config: {}
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
module: entry.module,
|
|
44
|
+
enabled: entry.enabled ?? true,
|
|
45
|
+
verbs: entry.verbs ?? "*",
|
|
46
|
+
config: entry.config ?? {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Module is the identity key: a duplicate makes override targeting and
|
|
50
|
+
* ordering ambiguous, so it fails loudly. */
|
|
51
|
+
function normalizePluginEntries(entries, where) {
|
|
52
|
+
const normalized = entries.map(normalizePluginEntry);
|
|
53
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54
|
+
for (const entry of normalized) {
|
|
55
|
+
if (seen.has(entry.module)) throw new PluginError(`${where}: plugin "${entry.module}" is listed twice.`, "Module specifiers are the identity key of a composition; a plugin meant to run twice needs distinct subpath specifiers.");
|
|
56
|
+
seen.add(entry.module);
|
|
57
|
+
}
|
|
58
|
+
return normalized;
|
|
59
|
+
}
|
|
60
|
+
function entryActiveForVerb(entry, verb) {
|
|
61
|
+
if (!entry.enabled) return false;
|
|
62
|
+
return entry.verbs === "*" || entry.verbs.includes(verb);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The appliesTo hierarchy. "reactor" is the base every reactor host extends;
|
|
66
|
+
* "compound" is its own branch (plugins over the member set — e.g. the clint
|
|
67
|
+
* proxy). Host runtimes register their id with a parent; compatibility walks
|
|
68
|
+
* the parent chain.
|
|
69
|
+
*/
|
|
70
|
+
const HOST_TYPE_PARENTS = {
|
|
71
|
+
reactor: null,
|
|
72
|
+
compound: null,
|
|
73
|
+
connect: "reactor",
|
|
74
|
+
switchboard: "reactor",
|
|
75
|
+
mastra: "reactor"
|
|
76
|
+
};
|
|
77
|
+
function registerHostType(id, parent) {
|
|
78
|
+
if (id in HOST_TYPE_PARENTS && HOST_TYPE_PARENTS[id] !== parent) throw new PluginError(`Host type "${id}" is already registered with parent "${String(HOST_TYPE_PARENTS[id])}".`);
|
|
79
|
+
HOST_TYPE_PARENTS[id] = parent;
|
|
80
|
+
}
|
|
81
|
+
function hostTypeSatisfies(hostType, appliesTo) {
|
|
82
|
+
let current = hostType;
|
|
83
|
+
while (current !== null) {
|
|
84
|
+
if (current === appliesTo) return true;
|
|
85
|
+
current = current in HOST_TYPE_PARENTS ? HOST_TYPE_PARENTS[current] : null;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
/** Registration order, bucketed pre → normal → post (stable within buckets),
|
|
90
|
+
* then dependsOn topo-sorted within the bucketed order. */
|
|
91
|
+
function resolveOrder(plugins) {
|
|
92
|
+
const buckets = {
|
|
93
|
+
pre: [],
|
|
94
|
+
normal: [],
|
|
95
|
+
post: []
|
|
96
|
+
};
|
|
97
|
+
for (const plugin of plugins) buckets[plugin.enforce ?? "normal"].push(plugin);
|
|
98
|
+
const bucketed = [
|
|
99
|
+
...buckets.pre,
|
|
100
|
+
...buckets.normal,
|
|
101
|
+
...buckets.post
|
|
102
|
+
];
|
|
103
|
+
const byName = new Map(bucketed.map((p) => [p.name, p]));
|
|
104
|
+
for (const plugin of bucketed) for (const dep of plugin.dependsOn ?? []) if (!byName.has(dep)) throw new PluginError(`Plugin "${plugin.name}" depends on missing plugin "${dep}".`, "dependsOn names PLUGINS only — the host runtime is implied and never named.");
|
|
105
|
+
const ordered = [];
|
|
106
|
+
const state = /* @__PURE__ */ new Map();
|
|
107
|
+
const visit = (plugin, chain) => {
|
|
108
|
+
const mark = state.get(plugin.name);
|
|
109
|
+
if (mark === "done") return;
|
|
110
|
+
if (mark === "visiting") throw new PluginError(`Plugin dependency cycle: ${[...chain, plugin.name].join(" -> ")}.`);
|
|
111
|
+
state.set(plugin.name, "visiting");
|
|
112
|
+
for (const dep of plugin.dependsOn ?? []) visit(byName.get(dep), [...chain, plugin.name]);
|
|
113
|
+
state.set(plugin.name, "done");
|
|
114
|
+
ordered.push(plugin);
|
|
115
|
+
};
|
|
116
|
+
for (const plugin of bucketed) visit(plugin, []);
|
|
117
|
+
return ordered;
|
|
118
|
+
}
|
|
119
|
+
async function runProvideHook(name, plugins, ctx) {
|
|
120
|
+
const impls = plugins.filter((p) => typeof p.hooks?.[name] === "function");
|
|
121
|
+
if (impls.length > 1) throw new PluginError(`Hook "${name}" is provided by ${impls.map((p) => `"${p.name}"`).join(" and ")} — provide hooks have one winner.`);
|
|
122
|
+
const impl = impls[0]?.hooks?.[name];
|
|
123
|
+
return impl ? await impl(ctx) : void 0;
|
|
124
|
+
}
|
|
125
|
+
async function runTransformHook(name, plugins, ctx, seed) {
|
|
126
|
+
let value = seed;
|
|
127
|
+
for (const plugin of plugins) {
|
|
128
|
+
const impl = plugin.hooks?.[name];
|
|
129
|
+
if (typeof impl === "function") value = await impl(value, ctx);
|
|
130
|
+
}
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
/** Sequential observe, in plugin order — for lifecycle moments whose order
|
|
134
|
+
* is load-bearing (teardown: the switchboard stops privacy before workflows
|
|
135
|
+
* before the api, per the carve map). */
|
|
136
|
+
async function runObserveHookSequential(name, plugins, ctx) {
|
|
137
|
+
for (const plugin of plugins) {
|
|
138
|
+
const impl = plugin.hooks?.[name];
|
|
139
|
+
if (typeof impl === "function") await impl(ctx);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function runObserveHook(name, plugins, ctx) {
|
|
143
|
+
await Promise.all(plugins.map(async (plugin) => {
|
|
144
|
+
const impl = plugin.hooks?.[name];
|
|
145
|
+
if (typeof impl === "function") await impl(ctx);
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
/** Array kinds concatenate in provenance-then-order sequence (built-in first,
|
|
149
|
+
* so later sources read as overrides where consumers want last-wins). */
|
|
150
|
+
function mergeContributions(resolved) {
|
|
151
|
+
const rank = {
|
|
152
|
+
"built-in": 0,
|
|
153
|
+
local: 1,
|
|
154
|
+
dependency: 2
|
|
155
|
+
};
|
|
156
|
+
const sorted = [...resolved].sort((a, b) => rank[a.provenance] - rank[b.provenance]);
|
|
157
|
+
const merged = {};
|
|
158
|
+
for (const { plugin, provenance } of sorted) for (const [kind, values] of Object.entries(plugin.contributions ?? {})) {
|
|
159
|
+
if (!values) continue;
|
|
160
|
+
const bucket = merged[kind] ??= [];
|
|
161
|
+
for (const value of values) bucket.push({
|
|
162
|
+
value,
|
|
163
|
+
source: {
|
|
164
|
+
pluginName: plugin.name,
|
|
165
|
+
provenance
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return merged;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
export { PluginError, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntryObjectSchema, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=plugins.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../src/plugins.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * R1 — the host plugin framework (bridge-runners-to-plugins plan,\n * customization-references/host-core as the blueprint).\n *\n * A plugin is hooks + contributions; hooks are boot wiring (main realm only),\n * contributions are declarative, serializable surface. Host RUNTIMES define\n * the hook vocabulary and interleave their own wiring between stages — they\n * are never plugins themselves.\n *\n * host.js carries the COMPOSITION as `runner.plugins` entries:\n * string | { module, enabled?, verbs?, config? }\n * Presence is activation (enabled defaults true); `verbs` scopes an entry to\n * matching run verbs; `config` is validated against the plugin's declared\n * zod schema. Entries resolve from the PROJECT's dependency tree exactly\n * like runner modules.\n */\n\nexport class PluginError extends Error {\n constructor(message: string, hint?: string) {\n super(hint ? `${message}\\n Hint: ${hint}` : message);\n this.name = \"PluginError\";\n }\n}\n\n/* ------------------------------------------------------------------ entries */\n\nexport const pluginEntryObjectSchema = z.strictObject({\n module: z.string().min(1),\n /** Presence is activation BY DEFAULT; false is the explicit off-switch. */\n enabled: z.boolean().optional(),\n /** \"*\" (default) or the run verbs this entry is active for. */\n verbs: z\n .union([z.literal(\"*\"), z.array(z.string().min(1)).min(1)])\n .optional(),\n /** Validated against the plugin's declared configSchema at resolution. */\n config: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const pluginEntrySchema = z.union([\n z.string().min(1),\n pluginEntryObjectSchema,\n]);\n\nexport type PluginEntry = z.infer<typeof pluginEntrySchema>;\n\nexport interface NormalizedPluginEntry {\n module: string;\n enabled: boolean;\n verbs: \"*\" | string[];\n config: Record<string, unknown>;\n}\n\nexport function normalizePluginEntry(\n entry: PluginEntry,\n): NormalizedPluginEntry {\n if (typeof entry === \"string\") {\n return { module: entry, enabled: true, verbs: \"*\", config: {} };\n }\n return {\n module: entry.module,\n enabled: entry.enabled ?? true,\n verbs: entry.verbs ?? \"*\",\n config: entry.config ?? {},\n };\n}\n\n/** Module is the identity key: a duplicate makes override targeting and\n * ordering ambiguous, so it fails loudly. */\nexport function normalizePluginEntries(\n entries: readonly PluginEntry[],\n where: string,\n): NormalizedPluginEntry[] {\n const normalized = entries.map(normalizePluginEntry);\n const seen = new Set<string>();\n for (const entry of normalized) {\n if (seen.has(entry.module)) {\n throw new PluginError(\n `${where}: plugin \"${entry.module}\" is listed twice.`,\n \"Module specifiers are the identity key of a composition; a plugin meant to run twice needs distinct subpath specifiers.\",\n );\n }\n seen.add(entry.module);\n }\n return normalized;\n}\n\nexport function entryActiveForVerb(\n entry: NormalizedPluginEntry,\n verb: string,\n): boolean {\n if (!entry.enabled) return false;\n return entry.verbs === \"*\" || entry.verbs.includes(verb);\n}\n\n/* ---------------------------------------------------------------- hierarchy */\n\n/**\n * The appliesTo hierarchy. \"reactor\" is the base every reactor host extends;\n * \"compound\" is its own branch (plugins over the member set — e.g. the clint\n * proxy). Host runtimes register their id with a parent; compatibility walks\n * the parent chain.\n */\nconst HOST_TYPE_PARENTS: Record<string, string | null> = {\n reactor: null,\n compound: null,\n connect: \"reactor\",\n switchboard: \"reactor\",\n mastra: \"reactor\",\n};\n\nexport function registerHostType(id: string, parent: string | null): void {\n if (id in HOST_TYPE_PARENTS && HOST_TYPE_PARENTS[id] !== parent) {\n throw new PluginError(\n `Host type \"${id}\" is already registered with parent \"${String(HOST_TYPE_PARENTS[id])}\".`,\n );\n }\n HOST_TYPE_PARENTS[id] = parent;\n}\n\nexport function hostTypeSatisfies(\n hostType: string,\n appliesTo: string,\n): boolean {\n let current: string | null = hostType;\n while (current !== null) {\n if (current === appliesTo) return true;\n current = current in HOST_TYPE_PARENTS ? HOST_TYPE_PARENTS[current] : null;\n }\n return false;\n}\n\n/* ------------------------------------------------------------------- plugin */\n\n/** Hook kinds (v1 §2.2). The hook VOCABULARY is defined by host runtimes;\n * plugins implement subsets of it. */\nexport type Provide<T, C> = (ctx: C) => T | Promise<T>;\nexport type Transform<T, C> = (value: T, ctx: C) => T | Promise<T>;\nexport type Observe<C> = (ctx: C) => void | Promise<void>;\n\n/**\n * Core contributions — declarative, serializable, realm-crossing. Host\n * runtimes extend this with their own kinds (UI slots live in connect-host,\n * never here). `drives` entries use the drive declaration shape from\n * drives.ts; kept as unknown here to avoid a cycle — the merge is shape-blind.\n */\nexport interface Contributions {\n drives?: unknown[];\n packages?: string[];\n configDeclarations?: { name: string; type?: string; description?: string }[];\n [kind: string]: unknown[] | undefined;\n}\n\nexport interface HostPlugin<\n THooks = Record<string, unknown>,\n TConfig = unknown,\n> {\n /** Stable id; used in ordering, dependsOn, and every diagnostic. */\n name: string;\n /** Host-type requirement; the entry is rejected on a host outside the\n * hierarchy branch. Default: \"reactor\". */\n appliesTo?: string;\n /** Coarse ordering bucket (Vite-style). Default: \"normal\". */\n enforce?: \"pre\" | \"post\";\n /** Hard dependencies on OTHER PLUGINS — the host runtime is implied and\n * never named. Missing dependency or cycle fails boot naming both sides. */\n dependsOn?: string[];\n /** Declared config shape; entry config is validated against it. A plugin\n * without a schema accepts no config (passing one is a boot error). */\n configSchema?: z.ZodType<TConfig>;\n hooks?: Partial<THooks>;\n contributions?: Contributions;\n}\n\n/** A plugin module default-exports either a HostPlugin object (no config\n * accepted) or a factory `(config) => HostPlugin`. */\nexport type HostPluginModule<\n THooks = Record<string, unknown>,\n TConfig = unknown,\n> =\n | HostPlugin<THooks, TConfig>\n | ((config: TConfig) => HostPlugin<THooks, TConfig>);\n\nexport interface ResolvedPlugin<THooks = Record<string, unknown>> {\n entry: NormalizedPluginEntry;\n plugin: HostPlugin<THooks>;\n /** Provenance for contribution merge ordering. */\n provenance: \"built-in\" | \"local\" | \"dependency\";\n}\n\n/* ----------------------------------------------------------------- ordering */\n\n/** Registration order, bucketed pre → normal → post (stable within buckets),\n * then dependsOn topo-sorted within the bucketed order. */\nexport function resolveOrder<THooks>(\n plugins: readonly HostPlugin<THooks>[],\n): HostPlugin<THooks>[] {\n const buckets: Record<\"pre\" | \"normal\" | \"post\", HostPlugin<THooks>[]> = {\n pre: [],\n normal: [],\n post: [],\n };\n for (const plugin of plugins)\n buckets[plugin.enforce ?? \"normal\"].push(plugin);\n const bucketed = [...buckets.pre, ...buckets.normal, ...buckets.post];\n\n const byName = new Map(bucketed.map((p) => [p.name, p]));\n for (const plugin of bucketed) {\n for (const dep of plugin.dependsOn ?? []) {\n if (!byName.has(dep)) {\n throw new PluginError(\n `Plugin \"${plugin.name}\" depends on missing plugin \"${dep}\".`,\n \"dependsOn names PLUGINS only — the host runtime is implied and never named.\",\n );\n }\n }\n }\n\n const ordered: HostPlugin<THooks>[] = [];\n const state = new Map<string, \"visiting\" | \"done\">();\n const visit = (plugin: HostPlugin<THooks>, chain: string[]): void => {\n const mark = state.get(plugin.name);\n if (mark === \"done\") return;\n if (mark === \"visiting\") {\n throw new PluginError(\n `Plugin dependency cycle: ${[...chain, plugin.name].join(\" -> \")}.`,\n );\n }\n state.set(plugin.name, \"visiting\");\n for (const dep of plugin.dependsOn ?? []) {\n visit(byName.get(dep)!, [...chain, plugin.name]);\n }\n state.set(plugin.name, \"done\");\n ordered.push(plugin);\n };\n for (const plugin of bucketed) visit(plugin, []);\n return ordered;\n}\n\n/* -------------------------------------------------------------------- hooks */\n\nexport async function runProvideHook<T, C>(\n name: string,\n plugins: readonly HostPlugin[],\n ctx: C,\n): Promise<T | undefined> {\n const impls = plugins.filter((p) => typeof p.hooks?.[name] === \"function\");\n if (impls.length > 1) {\n throw new PluginError(\n `Hook \"${name}\" is provided by ${impls.map((p) => `\"${p.name}\"`).join(\" and \")} — provide hooks have one winner.`,\n );\n }\n const impl = impls[0]?.hooks?.[name] as Provide<T, C> | undefined;\n return impl ? await impl(ctx) : undefined;\n}\n\nexport async function runTransformHook<T, C>(\n name: string,\n plugins: readonly HostPlugin[],\n ctx: C,\n seed: T,\n): Promise<T> {\n let value = seed;\n for (const plugin of plugins) {\n const impl = plugin.hooks?.[name] as Transform<T, C> | undefined;\n if (typeof impl === \"function\") value = await impl(value, ctx);\n }\n return value;\n}\n\n/** Sequential observe, in plugin order — for lifecycle moments whose order\n * is load-bearing (teardown: the switchboard stops privacy before workflows\n * before the api, per the carve map). */\nexport async function runObserveHookSequential<C>(\n name: string,\n plugins: readonly HostPlugin[],\n ctx: C,\n): Promise<void> {\n for (const plugin of plugins) {\n const impl = plugin.hooks?.[name] as Observe<C> | undefined;\n if (typeof impl === \"function\") await impl(ctx);\n }\n}\n\nexport async function runObserveHook<C>(\n name: string,\n plugins: readonly HostPlugin[],\n ctx: C,\n): Promise<void> {\n await Promise.all(\n plugins.map(async (plugin) => {\n const impl = plugin.hooks?.[name] as Observe<C> | undefined;\n if (typeof impl === \"function\") await impl(ctx);\n }),\n );\n}\n\n/* ------------------------------------------------------------ contributions */\n\nexport interface ContributionSource {\n pluginName: string;\n provenance: \"built-in\" | \"local\" | \"dependency\";\n}\n\nexport interface MergedContribution<T = unknown> {\n value: T;\n source: ContributionSource;\n}\n\n/** Array kinds concatenate in provenance-then-order sequence (built-in first,\n * so later sources read as overrides where consumers want last-wins). */\nexport function mergeContributions(\n resolved: readonly {\n plugin: HostPlugin;\n provenance: ContributionSource[\"provenance\"];\n }[],\n): Record<string, MergedContribution[]> {\n const rank: Record<ContributionSource[\"provenance\"], number> = {\n \"built-in\": 0,\n local: 1,\n dependency: 2,\n };\n const sorted = [...resolved].sort(\n (a, b) => rank[a.provenance] - rank[b.provenance],\n );\n const merged: Record<string, MergedContribution[]> = {};\n for (const { plugin, provenance } of sorted) {\n for (const [kind, values] of Object.entries(plugin.contributions ?? {})) {\n if (!values) continue;\n const bucket = (merged[kind] ??= []);\n for (const value of values) {\n bucket.push({ value, source: { pluginName: plugin.name, provenance } });\n }\n }\n }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YAAY,MAAM,KAAK,GAAG;CAChD,CAAC,CACH;AACF;;;AAgBA,SAAgB,mBACd,UAIsC;CACtC,MAAM,OAAyD;EAC7D,YAAY;EACZ,OAAO;EACP,YAAY;CACd;CACA,MAAM,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,MAC1B,GAAG,MAAM,KAAK,EAAE,cAAc,KAAK,EAAE,WACxC;CACA,MAAM,SAA+C,CAAC;CACtD,KAAK,MAAM,EAAE,QAAQ,gBAAgB,QACnC,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,OAAO,iBAAiB,CAAC,CAAC,GAAG;EACvE,IAAI,CAAC,QAAQ;EACb,MAAM,SAAU,OAAO,UAAU,CAAC;EAClC,KAAK,MAAM,SAAS,QAClB,OAAO,KAAK;GAAE;GAAO,QAAQ;IAAE,YAAY,OAAO;IAAM;GAAW;EAAE,CAAC;CAE1E;CAEF,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as RunnerContext, g as HostDefinition, i as RunCompoundResult } from "../compound-
|
|
1
|
+
import { c as RunnerContext, g as HostDefinition, i as RunCompoundResult } from "../compound-C8P0kvPJ.mjs";
|
|
2
2
|
//#region src/runners/compound.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The GENERIC compound runner module (phase 3): supervises the members a
|
|
@@ -19,10 +19,16 @@ export declare const hostSchema: import("zod").ZodObject<{
|
|
|
19
19
|
module: import("zod").ZodString;
|
|
20
20
|
defaultVerb: import("zod").ZodOptional<import("zod").ZodString>;
|
|
21
21
|
port: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
22
|
+
host: import("zod").ZodOptional<import("zod").ZodString>;
|
|
23
|
+
plugins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
24
|
+
module: import("zod").ZodString;
|
|
25
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
26
|
+
verbs: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<"*">, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
27
|
+
config: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
28
|
+
}, import("zod/v4/core").$strict>]>>>;
|
|
22
29
|
}, import("zod/v4/core").$loose>;
|
|
23
30
|
children: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
24
31
|
host: import("zod").ZodString;
|
|
25
|
-
plugins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
26
32
|
runner: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
27
33
|
config: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
28
34
|
reactor: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -54,12 +60,18 @@ export declare const hostSchema: import("zod").ZodObject<{
|
|
|
54
60
|
host: import("zod").ZodOptional<import("zod").ZodString>;
|
|
55
61
|
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
62
|
}, import("zod/v4/core").$strict>>;
|
|
63
|
+
projection: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
64
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
65
|
+
dbPoolSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
66
|
+
}, import("zod/v4/core").$strict>>;
|
|
67
|
+
executors: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
68
|
+
numWorkers: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"auto">]>>;
|
|
69
|
+
}, import("zod/v4/core").$strict>>;
|
|
57
70
|
}, import("zod/v4/core").$strict>>>;
|
|
58
71
|
placement: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
59
72
|
primary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
73
|
default: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
61
74
|
}, import("zod/v4/core").$strict>>;
|
|
62
|
-
workflows: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
63
75
|
protocol: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
64
76
|
featureFlags: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
65
77
|
documentDecisions: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -76,6 +88,38 @@ export declare const hostSchema: import("zod").ZodObject<{
|
|
|
76
88
|
refuse: "refuse";
|
|
77
89
|
}>>;
|
|
78
90
|
}, import("zod/v4/core").$strict>>;
|
|
91
|
+
workflows: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
92
|
+
renown: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
93
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
94
|
+
networkId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
95
|
+
chainId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
96
|
+
}, import("zod/v4/core").$strict>>;
|
|
97
|
+
packages: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
98
|
+
registryUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
99
|
+
}, import("zod/v4/core").$strict>>;
|
|
100
|
+
namespace: import("zod").ZodOptional<import("zod").ZodString>;
|
|
101
|
+
auth: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
102
|
+
enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
103
|
+
admins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
104
|
+
renown: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
105
|
+
}, import("zod/v4/core").$strict>>;
|
|
106
|
+
drives: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
107
|
+
slug: import("zod").ZodString;
|
|
108
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
109
|
+
projectHash: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
110
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
111
|
+
icon: import("zod").ZodOptional<import("zod").ZodString>;
|
|
112
|
+
preferredEditor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
113
|
+
sharingType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
114
|
+
private: "private";
|
|
115
|
+
public: "public";
|
|
116
|
+
shared: "shared";
|
|
117
|
+
}>>;
|
|
118
|
+
availableOffline: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
119
|
+
remote: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
120
|
+
url: import("zod").ZodString;
|
|
121
|
+
}, import("zod/v4/core").$strict>>;
|
|
122
|
+
}, import("zod/v4/core").$strict>>>;
|
|
79
123
|
}, import("zod/v4/core").$strict>>;
|
|
80
124
|
}, import("zod/v4/core").$strict>>;
|
|
81
125
|
config: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$loose>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compound.d.mts","names":[],"sources":["../../src/runners/compound.ts"],"mappings":";;;;;;;;;;;;;;qBAoBa;qBAEA,0BAAU
|
|
1
|
+
{"version":3,"file":"compound.d.mts","names":[],"sources":["../../src/runners/compound.ts"],"mappings":";;;;;;;;;;;;;;qBAoBa;qBAEA,0BAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAqB;wBA0BtB,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;wBAKW,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 { _ as runCompound, n as compoundHostSchema } from "../host-schemas-CL_wFpY7.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/runners/compound.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/host-core",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.60",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -28,16 +28,22 @@
|
|
|
28
28
|
"types": "./dist/runners/compound.d.mts",
|
|
29
29
|
"import": "./dist/runners/compound.mjs",
|
|
30
30
|
"default": "./dist/runners/compound.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./plugins": {
|
|
33
|
+
"source": "./src/plugins.ts",
|
|
34
|
+
"types": "./dist/plugins.d.mts",
|
|
35
|
+
"import": "./dist/plugins.mjs",
|
|
36
|
+
"default": "./dist/plugins.mjs"
|
|
31
37
|
}
|
|
32
38
|
},
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"@powerhousedao/shared": "6.2.3-dev.
|
|
40
|
+
"@powerhousedao/shared": "6.2.3-dev.60",
|
|
35
41
|
"zod": "4.3.6"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
44
|
"tsdown": "0.23.0",
|
|
39
45
|
"vitest": "5.0.3",
|
|
40
|
-
"@powerhousedao/reactor-monitor": "6.2.3-dev.
|
|
46
|
+
"@powerhousedao/reactor-monitor": "6.2.3-dev.60"
|
|
41
47
|
},
|
|
42
48
|
"scripts": {
|
|
43
49
|
"tsc": "tsc",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compound-9--OujO-.d.mts","names":[],"sources":["../src/host-loader.ts","../src/runner-resolver.ts","../src/compound.ts"],"mappings":";cAuBa,sBAAsB;EACjC,YAAY,iBAAiB;;KAMnB;EACN;;EACA;EAAe;;EACf;EAAiB;EAAa;;;;;iBAKpB,iBAAiB,sBAAsB;;;;iBAqBvC,gBAAgB,gBAAgB;;;iBA0BhC,mBACd,gBACA;UA4Be;EACf;EACA;IAAU;MAAmB;EAC7B,SAAS;EACT,UAAU;EACV,UAAU;EACV,WAAW;;UAGI;EACf;EACA;EACA;EACA,MAAM;;iBA2Bc,SACpB,qBACA,mBACC,QAAQ;;;;;;;;;;cCjJE,oBAAoB;EAC/B,YAAY,iBAAiB;;UAMd;EACf;EACA;EACA,KAAK;;KAGK,cACV,MAAM,gBACN,KAAK,kBACF;;UAGY;EACf,UAAU;IACR;IACA;MAAU;QAAW;QAA2B;;;;;UAInC;EACf,KAAK;EACL,YAAY;EACZ;GACC;;iBAMmB,oBACpB,qBACA,oBACC,QAAQ;iBAsCK,UAAU,QAAQ;iBAUlB,QACd,QAAQ,cACR,mBACA,eACC;iBAYa,aACd,QAAQ,cACR,mBACA,MAAM,gBACN;;;;;;;;;;;;;;;;;UCrFe;;EAEf;;;EAGA;;EAEA,YAAY;;;EAGZ,QAAQ;;EAER,wBAAwB;;UAGT;EACf;EACA;EACA;IAAW;MAAkB;EAC7B,SAAS;EACT,UAAU;;UAGK;;EAEf;;EAEA;;EAEA;;EAEA;;;EAGA;;UAGQ;EACR;EACA,QAAQ;;UA+DO;;EAEf;;EAEA,cAAc;;EAEd;;UAGe;EACf,SAAS;EACT,gBAAgB;;iBAGI,YACpB,MAAM,gBACN,KAAK,eACL,SAAS,qBACR,QAAQ"}
|