@powerhousedao/host-core 6.2.3-dev.78 → 6.2.3-dev.79

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.
@@ -9,16 +9,28 @@ export declare function primaryBackend(reactor: ReactorConfig | undefined): Reac
9
9
  /** The env vars a protocol block maps onto, with their string values. Only
10
10
  * keys the block actually sets appear. */
11
11
  export declare function protocolEnv(protocol: ReactorProtocol | undefined): Record<string, string>;
12
- interface SwitchboardReactorProjection {
13
- /** Env the switchboard server reads at boot. Only keys the block sets. */
14
- env: Record<string, string>;
15
- /** Options passed to startSwitchboard (DB path). */
16
- options: {
17
- dbPath?: string;
12
+ /** The switchboard config layer a reactor block maps to (the shape of
13
+ * `@powerhousedao/switchboard/config`'s input). Only keys the block sets. */
14
+ interface SwitchboardReactorLayer {
15
+ storage?: {
16
+ reactor?: {
17
+ url: string;
18
+ };
19
+ readModel?: {
20
+ url: string;
21
+ };
22
+ };
23
+ protocol?: ReactorProtocol;
24
+ packages?: {
25
+ dynamic: true;
26
+ };
27
+ features?: {
28
+ workflows: boolean;
18
29
  };
19
30
  }
20
- /** Project the reactor block onto the switchboard's env + options. */
21
- export declare function projectReactorToSwitchboard(reactor: ReactorConfig | undefined): SwitchboardReactorProjection;
31
+ /** The reactor block as a switchboard config layer. The reactor store and the
32
+ * read model are separate fields: `readModel.url` never moves the reactor. */
33
+ export declare function reactorBlockToSwitchboardConfig(reactor: ReactorConfig | undefined): SwitchboardReactorLayer;
22
34
  /** The four reactor-client shapes a Connect host can select (mirrors the
23
35
  * shared PHReactorClientMode; kept local to avoid an import cycle). */
24
36
  type ReactorClientMode = "in-process" | "worker" | "remote" | "router";
@@ -603,6 +615,6 @@ interface MemberInput extends Omit<ExpectHostInput, "members" | "plan"> {
603
615
  */
604
616
  export declare function expectHost(input: ExpectHostInput): HostExpectation;
605
617
  //#endregion
606
- export type { CompoundPlan, ConnectReactorProjection, ConsumedOutput, ContributedDriveInput, DeclaredIssue, DeferredResolution, DeferredToken, DriveProjectionInput, ExpectHostInput, ExpectedBackend, ExpectedDrive, HostExpectation, MemberDraft, MemberExpectation, MemberInput, OutputLookup, OutputRef, OutputSource, OutputsSchemaLookup, PlanEdge, PlanMember, ProjectedDescriptor, ProjectedStorage, ReactorClientMode, RemovedForm, ResolveOptions, ResolveSources, RunRecord, RunRecordMember, SelfMembers, SwitchboardReactorProjection, TokenPosition, TokenSite };
618
+ export type { CompoundPlan, ConnectReactorProjection, ConsumedOutput, ContributedDriveInput, DeclaredIssue, DeferredResolution, DeferredToken, DriveProjectionInput, ExpectHostInput, ExpectedBackend, ExpectedDrive, HostExpectation, MemberDraft, MemberExpectation, MemberInput, OutputLookup, OutputRef, OutputSource, OutputsSchemaLookup, PlanEdge, PlanMember, ProjectedDescriptor, ProjectedStorage, ReactorClientMode, RemovedForm, ResolveOptions, ResolveSources, RunRecord, RunRecordMember, SelfMembers, SwitchboardReactorLayer, TokenPosition, TokenSite };
607
619
  export {};
608
620
  //# sourceMappingURL=projection.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projection.d.mts","names":[],"sources":["../src/reactor-config.ts","../src/backend-projection.ts","../src/child-wrapper.ts","../src/connect-projection.ts","../src/run-record-schema.ts","../src/resolve/declared.ts","../src/resolve/plan.ts","../src/resolve/resolve.ts","../src/resolve/removed-forms.ts","../src/resolve/sources.ts","../src/resolve/walk.ts","../src/expect-host.ts"],"mappings":";;;;;;;wBA4BgB,eACd,SAAS,4BACR;;;wBA2Ba,YACd,UAAU,8BACT;UAiBc;;EAEf,KAAK;;EAEL;IAAW;;;;wBAIG,4BACd,SAAS,4BACR;;;KAoBS;;;;;;;;;;wBAgBI,kBACd,SAAS,4BACR;UAYc;;EAEf;IACE,UAAU;IACV;MAAa;MAAyB,gBAAgB;;IACtD;MAAQ;;;;;;;;wBAQI,wBACd,SAAS,4BACR;;;;wBAsBa,kBACd,UAAU,6BACV,KAAK,SAAS,qCACd;;;;;;;;wBAuBc,0BACd,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AU;;EAEV;;EAEA;;EAEA,UAAU,eAAe;;UAGV,0BAA0B,KACzC;;EAIA;;EAEA;;;;UAKe;EACf,aAAa;EACb;;UAGe;EACf,MAAM;;;EAGN,UAAU;;EAEV,WAAW;;EAEX,uBAAuB;;EAEvB,mBAAmB;;EAEnB,OAAO;;UAGQ,oBAAoB,KAAK;EACxC;EACA;;;;;;;;wBAgKc,WAAW,OAAO,kBAAkB"}
1
+ {"version":3,"file":"projection.d.mts","names":[],"sources":["../src/reactor-config.ts","../src/backend-projection.ts","../src/child-wrapper.ts","../src/connect-projection.ts","../src/run-record-schema.ts","../src/resolve/declared.ts","../src/resolve/plan.ts","../src/resolve/resolve.ts","../src/resolve/removed-forms.ts","../src/resolve/sources.ts","../src/resolve/walk.ts","../src/expect-host.ts"],"mappings":";;;;;;;wBA4BgB,eACd,SAAS,4BACR;;;wBA2Ba,YACd,UAAU,8BACT;;;UAmBc;EACf;IAAY;MAAY;;IAAe;MAAc;;;EACrD,WAAW;EACX;IAAa;;EACb;IAAa;;;;;wBAKC,gCACd,SAAS,4BACR;;;KAuBS;;;;;;;;;;wBAgBI,kBACd,SAAS,4BACR;UAYc;;EAEf;IACE,UAAU;IACV;MAAa;MAAyB,gBAAgB;;IACtD;MAAQ;;;;;;;;wBAQI,wBACd,SAAS,4BACR;;;;wBAsBa,kBACd,UAAU,6BACV,KAAK,SAAS,qCACd;;;;;;;;wBAuBc,0BACd,UAAU,6BACV,KAAK,oCACL;;;;;;;;;;;;;;KC7LU;EACN;;EACA;;EACA;EAAc;;UAEH;EACf;EACA;EACA,UAAU;EACV;IAAa;IAAiB;IAAkB;;EAChD;IACE;IACA;IACA;IACA;;EAEF;IAAW;;;;;;wBAgCG,oBACd,cACA,SAAS,gBACT,WAAW,kBACV;;;wBA2Ba,sBACd,SAAS,4BACR;;;;;;;wBAsBa,yBACd,SAAS;;wBAWK,kBACd,SAAS;;;;KCpIC,cAAc;EACxB;EACA,QAAQ;;;wBAIM,kBACd,MAAM,gB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UPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;
30
30
  return env;
31
31
  }
32
- /** Project the reactor block onto the switchboard's env + options. */
33
- function projectReactorToSwitchboard(reactor) {
34
- const env = protocolEnv(reactor?.protocol);
32
+ /** The reactor block as a switchboard config layer. The reactor store and the
33
+ * read model are separate fields: `readModel.url` never moves the reactor. */
34
+ function reactorBlockToSwitchboardConfig(reactor) {
35
+ const layer = {};
35
36
  const backend = primaryBackend(reactor);
36
- const options = {};
37
- if (backend?.storage) {
38
- const s = backend.storage;
39
- const dbUrl = s.kind === "postgres" ? s.url : s.dataDir;
40
- if (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;
41
- }
42
- if (backend?.readModel?.url) options.dbPath = backend.readModel.url;
43
- if (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = "true";
44
- if (reactor?.workflows !== void 0) env.PH_WORKFLOWS_ENABLED = reactor.workflows ? "1" : "0";
45
- return {
46
- env,
47
- options
37
+ const storage = backend?.storage;
38
+ const reactorUrl = storage?.kind === "postgres" ? storage.url : storage?.dataDir;
39
+ const readModelUrl = backend?.readModel?.url;
40
+ if (reactorUrl || readModelUrl) layer.storage = {
41
+ ...reactorUrl ? { reactor: { url: reactorUrl } } : {},
42
+ ...readModelUrl ? { readModel: { url: readModelUrl } } : {}
48
43
  };
44
+ if (reactor?.protocol) layer.protocol = reactor.protocol;
45
+ if (backend?.packages?.dynamic) layer.packages = { dynamic: true };
46
+ if (reactor?.workflows !== void 0) layer.features = { workflows: reactor.workflows };
47
+ return layer;
49
48
  }
50
49
  const LOCAL_BACKEND_KINDS = /* @__PURE__ */ new Set(["in-process", "worker"]);
51
50
  /**
@@ -1546,6 +1545,6 @@ function expectHost(input) {
1546
1545
  return expectation;
1547
1546
  }
1548
1547
  //#endregion
1549
- export { PlanError, TokenResolutionError, applyChildWrapper, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, checkOutputPaths, checkTokenSites, collectTokenSites, compoundOutputSource, describeMapElements, describeToken, envSitesOf, expectHost, findRemovedForms, formatPath, isStructuralMultiReactor, memberForRef, mergeDefaultDrives, outputRefsOf, outputSitesOf, planCompound, primaryBackend, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolConflicts, protocolEnv, reactorClientMode, rebaseDriveUrl, refKey, remoteBackendUrls, renderTokens, resolveHostOutputs, runRecordMemberSchema, runRecordSchema, schemaAtPath, unwrapEscapes };
1548
+ export { PlanError, TokenResolutionError, applyChildWrapper, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, checkOutputPaths, checkTokenSites, collectTokenSites, compoundOutputSource, describeMapElements, describeToken, envSitesOf, expectHost, findRemovedForms, formatPath, isStructuralMultiReactor, memberForRef, mergeDefaultDrives, outputRefsOf, outputSitesOf, planCompound, primaryBackend, projectDrivesIntoConnect, projectReactorToConnect, protocolConflicts, protocolEnv, reactorBlockToSwitchboardConfig, reactorClientMode, rebaseDriveUrl, refKey, remoteBackendUrls, renderTokens, resolveHostOutputs, runRecordMemberSchema, runRecordSchema, schemaAtPath, unwrapEscapes };
1550
1549
 
1551
1550
  //# sourceMappingURL=projection.mjs.map