@powerhousedao/switchboard 6.2.3-dev.85 → 6.2.3-dev.87

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.
Files changed (57) hide show
  1. package/.tsbuild/test/ai-gateway.test.d.ts +2 -0
  2. package/.tsbuild/test/ai-gateway.test.d.ts.map +1 -0
  3. package/.tsbuild/test/keyframe-reclaim-store.test.d.ts +2 -0
  4. package/.tsbuild/test/keyframe-reclaim-store.test.d.ts.map +1 -0
  5. package/.tsbuild/test/processor-timing-log.test.d.ts +2 -0
  6. package/.tsbuild/test/processor-timing-log.test.d.ts.map +1 -0
  7. package/.tsbuild/tsconfig.tsbuildinfo +1 -1
  8. package/CHANGELOG.md +34 -0
  9. package/README.md +33 -0
  10. package/dist/boot.d.mts +1 -1
  11. package/dist/boot.mjs +1 -1
  12. package/dist/config/from-env.d.mts +1 -1
  13. package/dist/config/from-env.d.mts.map +1 -1
  14. package/dist/config/from-env.mjs +3 -3
  15. package/dist/config/schema.d.mts +1 -1
  16. package/dist/config/schema.mjs +3 -3
  17. package/dist/{from-env-BO0n9R02.mjs → from-env-DuUwngOC.mjs} +80 -8
  18. package/dist/from-env-DuUwngOC.mjs.map +1 -0
  19. package/dist/index.mjs +3 -3
  20. package/dist/{plugin-host-C1sYEm8g.d.mts → plugin-host-C0bSz1Oe.d.mts} +2 -2
  21. package/dist/{plugin-host-C1sYEm8g.d.mts.map → plugin-host-C0bSz1Oe.d.mts.map} +1 -1
  22. package/dist/plugins/ai.d.mts +37 -0
  23. package/dist/plugins/ai.d.mts.map +1 -0
  24. package/dist/plugins/ai.mjs +352 -0
  25. package/dist/plugins/ai.mjs.map +1 -0
  26. package/dist/plugins/attachments.d.mts +1 -1
  27. package/dist/plugins/attachments.mjs +3 -3
  28. package/dist/plugins/mcp.d.mts +1 -1
  29. package/dist/plugins/privacy.d.mts +1 -1
  30. package/dist/plugins/workflows.d.mts +2 -2
  31. package/dist/plugins/workflows.mjs +3 -3
  32. package/dist/{schema-ivUWPQOn.d.mts → schema-DhempFjb.d.mts} +41 -1
  33. package/dist/schema-DhempFjb.d.mts.map +1 -0
  34. package/dist/{schema-0g_QdOWn.mjs → schema-XEZrdmag.mjs} +55 -6
  35. package/dist/schema-XEZrdmag.mjs.map +1 -0
  36. package/dist/{server-YNY3Qw9a.mjs → server-BqiCmeR0.mjs} +102 -14
  37. package/dist/server-BqiCmeR0.mjs.map +1 -0
  38. package/dist/server.d.mts +8 -7
  39. package/dist/server.d.mts.map +1 -1
  40. package/dist/server.mjs +5 -5
  41. package/dist/{workflow-runtime-7GaJ13c9.d.mts → workflow-runtime-CF5pc8mt.d.mts} +5 -2
  42. package/dist/workflow-runtime-CF5pc8mt.d.mts.map +1 -0
  43. package/dist/{workflows-DkIrfmdn.mjs → workflows-C_pWcP2u.mjs} +4 -3
  44. package/dist/{workflows-DkIrfmdn.mjs.map → workflows-C_pWcP2u.mjs.map} +1 -1
  45. package/package.json +22 -16
  46. package/test/ai-gateway.test.ts +555 -0
  47. package/test/config-from-env.test.ts +184 -0
  48. package/test/config-schema.test.ts +28 -0
  49. package/test/goldens/supergraph.graphql +132 -0
  50. package/test/keyframe-reclaim-store.test.ts +156 -0
  51. package/test/processor-timing-log.test.ts +109 -0
  52. package/tsdown.config.ts +1 -0
  53. package/dist/from-env-BO0n9R02.mjs.map +0 -1
  54. package/dist/schema-0g_QdOWn.mjs.map +0 -1
  55. package/dist/schema-ivUWPQOn.d.mts.map +0 -1
  56. package/dist/server-YNY3Qw9a.mjs.map +0 -1
  57. package/dist/workflow-runtime-7GaJ13c9.d.mts.map +0 -1
package/dist/server.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as SwitchboardConfigInput } from "./schema-ivUWPQOn.mjs";
2
- import { n as WorkflowTriggersCapability } from "./workflow-runtime-7GaJ13c9.mjs";
1
+ import { a as SwitchboardConfigInput, i as SwitchboardConfig } from "./schema-DhempFjb.mjs";
2
+ import { n as WorkflowTriggersCapability } from "./workflow-runtime-CF5pc8mt.mjs";
3
3
  import { ILogger } from "document-model";
4
- import { ChannelScheme, Database, IDocumentModelLoader, IInspector, IReactorClient, InProcessReactorClientModule, JwtHandler, ModelManifestEntry, PoolInstrumentation, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, ReactorStorageFacts, SignerConfig, UnsupportedStoredDocuments, UnsupportedStoredProtocolError } from "@powerhousedao/reactor";
4
+ import { ChannelScheme, Database, IDocumentModelLoader, IInspector, IReactorClient, IStoreMaintenance, InProcessReactorClientModule, JwtHandler, KeyframeSettings, ModelManifestEntry, PoolInstrumentation, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, ReactorStorageFacts, SignerConfig, StoredProtocolRefusal, UnsupportedStoredDocuments, UnsupportedStoredProtocolError } from "@powerhousedao/reactor";
5
5
  import { AttachmentReferenceProjectionCapability } from "@powerhousedao/reactor-api";
6
6
  import { PgliteMaintenanceSettings, resolvePgliteMaintenance } from "@powerhousedao/reactor-api/pglite-node";
7
7
  import { DocumentModelModule, ISigner, SignaturePolicy, UpgradeManifest } from "@powerhousedao/shared/document-model";
@@ -365,10 +365,7 @@ export declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorB
365
365
  export declare function resolveUnsupportedStoredDocuments(input: UnsupportedStoredDocuments | undefined, env: NodeJS.ProcessEnv): UnsupportedStoredDocuments;
366
366
  /** The reactor refused to start over documents this build does not run. */
367
367
  export declare class StoredDocumentsRefusedError extends Error {
368
- readonly versions: readonly {
369
- protocol: string;
370
- version: number;
371
- }[];
368
+ readonly versions: readonly StoredProtocolRefusal[];
372
369
  readonly documents: number;
373
370
  constructor(cause: UnsupportedStoredProtocolError);
374
371
  static isError(error: unknown): error is StoredDocumentsRefusedError;
@@ -383,6 +380,8 @@ export declare function initSwitchboardProcess(options?: Pick<SwitchboardConfigI
383
380
  * surfaced so we don't silently mask real issues (permissions, bad host, …).
384
381
  */
385
382
  export declare function isPortAvailable(port: number): Promise<boolean>;
383
+ /** `PH_KEYFRAMES` (or a caller's layer) wins whole over the project config. */
384
+ export declare function resolveKeyframes(configured: SwitchboardConfig["storage"]["keyframes"], fromFile: unknown, configPath: string): KeyframeSettings | undefined;
386
385
  /**
387
386
  * The reactor's storage handle, plus the pool instrumentation when that
388
387
  * storage is Postgres. The PGlite branch has no `pg.Pool` at all, so the
@@ -392,6 +391,8 @@ type ReactorStorage = {
392
391
  kysely: Kysely<Database>;
393
392
  poolInstrumentation: PoolInstrumentation | undefined;
394
393
  storageFacts: ReactorStorageFacts;
394
+ /** Absent on Postgres, where the host does not own the connection. */
395
+ storeMaintenance?: IStoreMaintenance;
395
396
  };
396
397
  export declare function createReactorKysely(opts: {
397
398
  reactorDbUrl: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.mts","names":[],"sources":["../src/pglite-version.ts","../src/pglite-store.mts","../src/privacy.mts","../src/types.ts","../src/builder-defaults.mts","../src/unsupported-stored-documents.mts","../src/server.mts"],"mappings":";;;;;;;;;;;;;;;;cAYa;KACD,2BAA2B;;;;UCuHtB;EACf;EACA,cAAc;EACd;;;;KC9GU;;EAEV;;EAEA;;EAEA,SAAS;;EAET;EACA;EACA;EACA;;;;;;;;;;YCXU;;YAKA,wBAAwB;EAClC,eAAe;;YAGL;EACV;EACA;EACA;;YAGU;;EAEV;;;;;EAKA;;EAGA;;;;;;;YAQU;;;;;;;;;;;;;;;;;;;;;EAqBV,UAAU;;;;;;;;EAQV;;;;;;;EAOA;;;;;EAKA,aAAa;;;;;;;EAOb;EACA;;;;;;;EAOA;;;;;;EAMA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;IAEM;IACA;;;;;;;EASN,WAAW;;EAEX;;;EAGA;;;;;;EAMA,oBAAoB;;;EAGpB;;;;EAIA;;;EAGA;IACE;;;;;;;IAOA;MACE;MACA;QAAW;QAAkB;;MAC7B;QAAU;QAAkB;QAAqB;;;;;EAIrD,UAAU;EACV,kBAAkB;EAClB;EACA;;;;;;EAMA;EACA,SAAS;;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,QACpB,wBAAsB,OACvB,oBACL,QAAQ"}
1
+ {"version":3,"file":"server.d.mts","names":[],"sources":["../src/pglite-version.ts","../src/pglite-store.mts","../src/privacy.mts","../src/types.ts","../src/builder-defaults.mts","../src/unsupported-stored-documents.mts","../src/server.mts"],"mappings":";;;;;;;;;;;;;;;;cAYa;KACD,2BAA2B;;;;UCuHtB;EACf;EACA,cAAc;EACd;;;;KC9GU;;EAEV;;EAEA;;EAEA,SAAS;;EAET;EACA;EACA;EACA;;;;;;;;;;YCXU;;YAKA,wBAAwB;EAClC,eAAe;;YAGL;EACV;EACA;EACA;;YAGU;;EAEV;;;;;EAKA;;EAGA;;;;;;;YAQU;;;;;;;;;;;;;;;;;;;;;EAqBV,UAAU;;;;;;;;EAQV;;;;;;;EAOA;;;;;EAKA,aAAa;;;;;;;EAOb;EACA;;;;;;;EAOA;;;;;;EAMA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;IAEM;IACA;;;;;;;EASN,WAAW;;EAEX;;;EAGA;;;;;;EAMA,oBAAoB;;;EAGpB;;;;EAIA;;;EAGA;IACE;;;;;;;IAOA;MACE;MACA;QAAW;QAAkB;;MAC7B;QAAU;QAAkB;QAAqB;;;;;EAIrD,UAAU;EACV,kBAAkB;EAClB;EACA;;;;;;EAMA;EACA,SAAS;;;;;;;;;;EAUT;;;;;;;;;;EAUA;;;;;;;;;EASA;IACE;IACA;IACA;;;;;;;;;;;EAWF;IACE;IACA;;;;;;;;;EASF,6BAA6B;;;YAInB;EACV,SAAS;;EAET,UAAU;;EAEV,oBAAoB;;EAEpB,eAAe;;EAEf;;EAEA;;EAEA,aAAa;;EAEb,gBAAgB;;YAGN;EACV;EACA,SAAS;;;;EAIT,mBAAmB;;EAEnB,+BAA+B;;;EAG/B,mBAAmB;;EAEnB;;EAEA,iBAAiB;;EAEjB;IAAY,SAAS;;;EAErB;;EAEA;;EAEA,WAAW;;EAEX,QAAQ;;;;;EAKR;;;;;;;;EAQA,gBAAgB;;;;KCrRN;EAIV,iBAAiB;;EAEjB,mBAAmB;;EAEnB;;;;;;;EAOA,gBAAgB;;EAEhB;;EAEA;IACE;IACA,eAAe,QAAQ;;;EAGzB,sBAAsB;EACtB,SAAS;;;;;;EAMT,SAAS;;;;;EAKT,cAAc,KAAK;;EAEnB,wBAAwB;;wBAiBV,gCACd,gBAAgB,gBAChB,eAAe,sBACf,UAAS;;;;wBCrEK,kCACd,OAAO,wCACP,KAAK,OAAO,aACX;;qBAaU,oCAAoC;WACtC,mBAAmB;WACnB;EAET,YAAY,OAAO;SAYH,QACd,iBACC,SAAS;;;;;wBC6JE,uBACd,UAAS,KAAK;;;;;;wBAgCM,gBAAgB,eAAe;;wBA6ErC,iBACd,YAAY,2CACZ,mBACA,qBACC;;;;;;KA2CE;EACH,QAAQ,OAAO;EACf,qBAAqB;EACrB,cAAc;;EAEd,mBAAmB;;wBAGC,oBAAoB;EACxC;EACA;EACA,oBAAoB;EACpB;;EAEA;;EAEA;EACA,iBAAiB;EACjB,QAAQ;IACN,QAAQ;iBA+DK;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;wBAcc,yBAAyB;EACvC;EACA;;EAEA;;EAEA;EACA;IACE;;wBAmCY,8BACd,SAAS,KAAK,uDACd,oBACA,QAAQ;EACL;EAAmB,YAAY;;;;;;;;;;;;;;;;;;;;qBAwxCvB,mBAAgB,QACpB,wBAAsB,OACvB,oBACL,QAAQ"}
package/dist/server.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { n as StoredDocumentsRefusedError, r as resolveUnsupportedStoredDocuments } from "./from-env-BO0n9R02.mjs";
3
- import { a as resolvePgliteStorageDirs, i as isPortAvailable, l as applySwitchboardReactorDefaults, n as deriveAttachmentServiceConfig, o as startSwitchboard, r as initSwitchboardProcess, t as createReactorKysely } from "./server-YNY3Qw9a.mjs";
4
- export { StoredDocumentsRefusedError, applySwitchboardReactorDefaults, createReactorKysely, deriveAttachmentServiceConfig, initSwitchboardProcess, isPortAvailable, resolvePgliteStorageDirs, resolveUnsupportedStoredDocuments, startSwitchboard };
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="08f0a326-294b-5287-a9a0-7d660e42f79b")}catch(e){}}();
6
- //# debugId=08f0a326-294b-5287-a9a0-7d660e42f79b
2
+ import { n as StoredDocumentsRefusedError, r as resolveUnsupportedStoredDocuments } from "./from-env-DuUwngOC.mjs";
3
+ import { a as resolveKeyframes, i as isPortAvailable, n as deriveAttachmentServiceConfig, o as resolvePgliteStorageDirs, r as initSwitchboardProcess, s as startSwitchboard, t as createReactorKysely, u as applySwitchboardReactorDefaults } from "./server-BqiCmeR0.mjs";
4
+ export { StoredDocumentsRefusedError, applySwitchboardReactorDefaults, createReactorKysely, deriveAttachmentServiceConfig, initSwitchboardProcess, isPortAvailable, resolveKeyframes, resolvePgliteStorageDirs, resolveUnsupportedStoredDocuments, startSwitchboard };
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b1533e1-d629-5ea0-8a03-6d8e48bdb7e4")}catch(e){}}();
6
+ //# debugId=5b1533e1-d629-5ea0-8a03-6d8e48bdb7e4
@@ -2,7 +2,7 @@ import { ILogger } from "document-model";
2
2
  import { IReactorClient, InProcessReactorClientModule, ModelManifestEntry, ReactorBuilder } from "@powerhousedao/reactor";
3
3
  import { SubgraphClass } from "@powerhousedao/reactor-api";
4
4
  import "@powerhousedao/shared/document-model";
5
- import "@powerhousedao/reactor-workflow";
5
+ import * as WorkflowEngine from "@powerhousedao/reactor-workflow";
6
6
  import "@powerhousedao/shared/processors";
7
7
  //#region src/workflow-runtime.d.mts
8
8
  /** Whether the operation intake is indexing. Same shape as the attachment
@@ -13,6 +13,7 @@ type WorkflowTriggersCapability = {
13
13
  status: "unavailable";
14
14
  reason: "in-process-reactor-module-unavailable" | "live-read-model-registration-unsupported" | "workflow-singleton-lost";
15
15
  };
16
+ type WorkflowRuntimeSecrets = WorkflowEngine.WorkflowRuntimeService["secrets"];
16
17
  interface ComposedWorkflowRuntime {
17
18
  subgraph: SubgraphClass;
18
19
  /** Whether document operations reach the runtime at all; unavailable once
@@ -21,10 +22,12 @@ interface ComposedWorkflowRuntime {
21
22
  /** The owner name this host holds the workflow singleton under; undefined
22
23
  * when the lease was not taken (a suite that opted out). */
23
24
  singletonOwner?: string;
25
+ /** The runtime's secret store, for host secrets its own surface never lists. */
26
+ secrets: WorkflowRuntimeSecrets;
24
27
  start(): Promise<void>;
25
28
  stop(): Promise<void>;
26
29
  }
27
30
  //#endregion
28
31
  export { WorkflowTriggersCapability as n, ComposedWorkflowRuntime as t };
29
32
  export {};
30
- //# sourceMappingURL=workflow-runtime-7GaJ13c9.d.mts.map
33
+ //# sourceMappingURL=workflow-runtime-CF5pc8mt.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-runtime-CF5pc8mt.d.mts","names":[],"sources":["../src/workflow-runtime.mts"],"mappings":";;;;;;;;;KAsEY;EACN;;EAEA;EACA;;KAgQD,yBAAyB,eAAe;UAE5B;EACf,UAAU;;;WAGD,UAAU;;;EAGnB;;EAEA,SAAS;EACT,SAAS;EACT,QAAQ"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c8f32b53-08da-5217-b7ec-200b108fa949")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6b9e5899-0452-5e20-bb38-75fb66d37239")}catch(e){}}();
3
3
  import { REACTOR_SCHEMA, supportsLiveReadModelRegistration } from "@powerhousedao/reactor";
4
4
  import { AuthorizationPolicy, BaseSubgraph, ForbiddenError, callerSubject, createCanonicalDocumentIdResolver } from "@powerhousedao/reactor-api";
5
5
  import { hostname } from "node:os";
@@ -1769,6 +1769,7 @@ async function composeClaimed(engine, deps, lease, loss) {
1769
1769
  return loss.lost ? SINGLETON_LOST : triggers;
1770
1770
  },
1771
1771
  ...lease ? { singletonOwner: lease.owner } : {},
1772
+ secrets: () => runtime.secrets(),
1772
1773
  async start() {
1773
1774
  if (registration.tornDown) return;
1774
1775
  await runtime.registerWebhookEndpoint();
@@ -1899,5 +1900,5 @@ const workflowsPlugin = createWorkflowsPlugin({});
1899
1900
  //#endregion
1900
1901
  export { workflowsPlugin as a, WORKFLOW_TELEMETRY_SCOPE as c, isWorkflowSingletonConflict as d, modelManifestSource as f, triggerFatalShutdown as g, installFatalErrorShutdown as h, workflowsDriveDeclaration as i, assertWorkflowPackageLoadable as l, workflowSingletonLossHandler as m, WORKFLOW_STUDIO_EDITOR_ID as n, workflowsPluginConfigSchema as o, retryWorkflowSingleton as p, createWorkflowsPlugin as r, WORKFLOW_PACKAGE_NAME as s, DEFAULT_WORKFLOWS_DRIVE as t, composeWorkflowRuntime as u };
1901
1902
 
1902
- //# sourceMappingURL=workflows-DkIrfmdn.mjs.map
1903
- //# debugId=c8f32b53-08da-5217-b7ec-200b108fa949
1903
+ //# sourceMappingURL=workflows-C_pWcP2u.mjs.map
1904
+ //# debugId=6b9e5899-0452-5e20-bb38-75fb66d37239