@powerhousedao/shared 6.2.3-dev.44 → 6.2.3-dev.46

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.
@@ -667,7 +667,7 @@ export declare const phConnectRuntimeConfigSchema: {
667
667
  };
668
668
  readonly reactorWorker: {
669
669
  readonly type: "boolean";
670
- readonly description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.";
670
+ readonly description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.";
671
671
  readonly default: false;
672
672
  };
673
673
  };
@@ -1043,6 +1043,13 @@ export type PackageDeps = {
1043
1043
  */
1044
1044
  export declare function checkSharedDeps(pkgJson: PackageDeps, hostVersions: Record<string, string>): SharedDepMismatch[];
1045
1045
  export declare function formatSharedDepWarnings(mismatches: SharedDepMismatch[]): string[];
1046
+ /**
1047
+ * Stable filename for a local package's worker model bundle under
1048
+ * `__reactor_worker__/packages/`. Shared by the tab (URL computation via the
1049
+ * manifest) and the production prebuild (emitted entry names), so the two can
1050
+ * never drift. Scoped names flatten (`@scope/name` -> `scope__name`).
1051
+ */
1052
+ export declare function workerPackageFileName(packageName: string): string;
1046
1053
  //#endregion
1047
1054
  export { ConfigAdapter, ConfigLoader, ConfigShape, DeepPartial, JsonConfigAdapter, JsonConfigAdapterOptions, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, deepMerge, resolveSourceConnect, workflowsSettingConflict };
1048
1055
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/runtime-config.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAYa;;;;;;cCQP,gBAAc,EAAA;;;;;;GA0BlB,EAAA,KAAA;;;;;;qBAiGW,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAES,EAAA,KAAA;;;;qBAKzB,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgD,EAAA,KAAA;;;;YAKjE,kBAAkB,EAAE,aAAa;YACjC,oBAAoB,EAAE,aAAa;YACnC,aAAa,EAAE,aAAa;;;;iBASvB;;;;EAIf,aAAa;;;;EAIb,UAAU;;;;;;;;;;;wBAkEI,eAAe,UAAS,iBAAsB;;;;;;;;;wBAkB9C,eACd,UAAS,iBACR;;;;;;;;;;;;;;;wBAoBa,cAAc,QAAQ,QAAQ;;;;;;;;;;;;;;;;;wBA4C9B,kBAAkB;;;;;;qBA8BrB;;;;;;;;;;;;;;;;;;;;;;;wBAwBG,oBAAoB;;;;YCrVxB;;EAEV;EACA,QAAQ;;KA6BL;EACH;EACA;EACA;;;wBAyBc,YAAY,UAAU,UAAU,OAAO,MAAM;;;;;;;;;wBA4B7C,mBAAmB,kBAAkB,UAAU,MAAM;;;;;;wBASrD,qBACd,QAAQ,cACR,oBACC;;wBASa,aACd,4BACA;;;;;;;;;;;;;;;wBA2Gc,eACd,sBAAsB,mBACtB,gBAAgB,cAChB,UAAS,2BACR;;;wBA8Ca,iBACd,SAAS,kCACC;;;;;;;;;;;qBCrRC;qBAQA;qBACA;qBACA;qBACA;;;;iBAKI;EACf,QAAQ;EACR,iBAAiB;IAA4B;;EAC7C;GACC;;;;;;;;;;;;;;;;;;;;;wBAsBa,cACd,MAAM,gBACN,UAAU,kCACV;EACE;EACA;IAED;;;YCzES;EACV;EACA,UAAU;EACV;EACA;IAAgB;IAAc;;EAC9B,SAAS;;;;qBAKE,wBAAwB;wBA+DrB,mBACd,QAAQ,KAAK,kEACb;EAAe;EAAc;WAC5B;;;qBC3EU;WACX;WACA;WACA;WACA;aACE;eACE;eACA;;aAEF;eACE;eACA;;aAEF;eACE;eACA;eACA;;aAEF;eACE;eACA;;;;qBAsEO;WACX;WACA;WACA;WAEA;aACE;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;;iBAGF;mBACE;mBACA;;;;aAKN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;;;;aAKN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;mBACA;qBACE;uBAEI;uBACA;uBACA;uBACA;yBACE;2BAAO;;yBACP;2BAAQ;;yBACR;2BAAQ;;;;uBAIV;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;yBAGF;2BAAQ;;yBACR;2BAAQ;;yBACR;2BACE;2BACA;;;;;;iBAQZ;mBACE;mBACA;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBA5NJ;;uBAGJ;;yBAEA;2BACE;2BACA;2BACA;;yBAEF;2BACE;2BACA;2BAEA;;yBAEF;2BACE;2BACA;2BAEA;;;;qBAyMM;;;;;;;;;;;;;;;;;;;;;;;;;;aAKR;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;;iBAGF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;;;qBAKN;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;yBAEF;2BACE;2BACA;2BAEA;6BAAS;;;;;;;;;aAQvB;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBACA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;;;aAIN;eACE;eACA;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;;;iBAIN;mBACE;mBACA;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBACA;mBACA;qBACE;uBAAQ;;qBACR;uBAAc;;qBACd;uBAAe;;qBACf;uBAAe;;qBACf;uBAAoB;;qBACpB;uBACE;uBACA;;qBAEF;uBAAa;;qBACb;uBAAS;;qBACT;uBACE;uBACA;uBAEA;yBA3ZN;;yBAEK;;2BAET;6BAAO;;2BACP;6BAAS;;2BACT;6BAAQ;;2BACR;6BAAW;;;;;qBAsZH;uBACE;uBACA;uBAEA;yBACE;yBACA;yBACA;yBACA;2BACE;6BACE;6BACA;6BAEA;+BACE;+BACA;iCAAS;iCAAgB;;;;2BAG7B;6BACE;6BACA;6BACA;;;;;;;;;;;;;;;;;;;;2BAEF;6BACE;6BACA;;;;;qBAKR;uBACE;uBACA;uBACA;uBACA;uBAEA;yBACE;2BACE;2BACA;;;;;;iBAWV;mBACE;mBACA;qBAAS;;mBACT;;iBAGF;mBACE;mBACA;qBAAS;;mBACT;;iBAGF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBAEA;qBACE;qBACA;qBACA;qBACA;uBACE;yBA1fV;;2BAEE;;2BAEA;2BACA;2BACA;2BACA;6BACE;+BAAU;+BAAgB;;6BAC1B;+BAAS;+BAAgB;;;;;uBAkfnB;yBACE;yBACA;;uBAQF;yBACE;yBACA;;uBAEF;yBACE;yBACA;yBACA;2BACE;6BAAa;;2BACb;6BACE;6BACA;;2BAGF;6BACE;6BACA;6BACA;+BACE;iCAAc;;+BACd;iCAAiB;;;;2BAGrB;6BACE;6BACA;6BACA;+BACE;iCAAY;iCAAe;mCAAS;;;+BACpC;iCACE;iCACA;mCAAwB;;;;;;;;;;iBASxC;mBACE;mBACA;mBAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;YClnBE;EAAc;EAAmB;;;;;;;qBAOhC,sBAAsB;qBA2BtB;;;;;;;;;qBAYA;;;;;;;;;;;;qBAqBA;;wBAQG,aAAa;EAAiB;EAAa;;;;;;;;;;;wBAwB3C,kBACd,gBACA;;;;;;;;;;wBA0Bc,qBACd,gBACA,mBACA,SAAS;YAkCC;EACV;EACA;EACA;;YAGU;EACV,eAAe;EACf,mBAAmB;;;;;;;;wBASL,gBACd,SAAS,aACT,cAAc,yBACb;wBAkBa,wBACd,YAAY"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/runtime-config.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAYa;;;;;;cCQP,gBAAc,EAAA;;;;;;GA0BlB,EAAA,KAAA;;;;;;qBAiGW,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAES,EAAA,KAAA;;;;qB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AKN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;;;;aAKN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;mBACA;qBACE;uBAEI;uBACA;uBACA;uBACA;yBACE;2BAAO;;yBACP;2BAAQ;;yBACR;2BAAQ;;;;uBAIV;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;yBAGF;2BAAQ;;yBACR;2BAAQ;;yBACR;2BACE;2BACA;;;;;;iBAQZ;mBACE;mBACA;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBA5NJ;;uBAGJ;;yBAEA;2BACE;2BACA;2BACA;;yBAEF;2BACE;2BACA;2BAEA;;yBAEF;2BACE;2BACA;2BAEA;;;;qBAyMM;;;;;;;;;;;;;;;;;;;;;;;;;;aAKR;eACE;eACA;eACA;eACA;iBACE;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;;iBAGF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;;;qBAKN;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;;yBAGF;2BACE;2BACA;;yBAEF;2BACE;2BACA;2BAEA;6BAAS;;;;;;;;;aAQvB;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBACA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;;iBAEF;mBACE;mBACA;mBACA;;;;aAIN;eACE;eACA;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;qBAEF;uBACE;uBACA;uBAEA;;;;iBAIN;mBACE;mBACA;mBACA;mBAEA;;iBAEF;mBACE;mBACA;mBACA;mBAEA;;;;aAIN;eACE;eACA;eACA;eAEA;iBACE;mBACE;mBACA;mBACA;mBACA;qBACE;uBAAQ;;qBACR;uBAAc;;qBACd;uBAAe;;qBACf;uBAAe;;qBACf;uBAAoB;;qBACpB;uBACE;uBACA;;qBAEF;uBAAa;;qBACb;uBAAS;;qBACT;uBACE;uBACA;uBAEA;yBA3ZN;;yBAEK;;2BAET;6BAAO;;2BACP;6BAAS;;2BACT;6BAAQ;;2BACR;6BAAW;;;;;qBAsZH;uBACE;uBACA;uBAEA;yBACE;yBACA;yBACA;yBACA;2BACE;6BACE;6BACA;6BAEA;+BACE;+BACA;iCAAS;iCAAgB;;;;2BAG7B;6BACE;6BACA;6BACA;;;;;;;;;;;;;;;;;;;;2BAEF;6BACE;6BACA;;;;;qBAKR;uBACE;uBACA;uBACA;uBACA;uBAEA;yBACE;2BACE;2BACA;;;;;;iBAWV;mBACE;mBACA;qBAAS;;mBACT;;iBAGF;mBACE;mBACA;qBAAS;;mBACT;;iBAGF;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBAEA;qBACE;qBACA;qBACA;qBACA;uBACE;yBA1fV;;2BAEE;;2BAEA;2BACA;2BACA;2BACA;6BACE;+BAAU;+BAAgB;;6BAC1B;+BAAS;+BAAgB;;;;;uBAkfnB;yBACE;yBACA;;uBAQF;yBACE;yBACA;;uBAEF;yBACE;yBACA;yBACA;2BACE;6BAAa;;2BACb;6BACE;6BACA;;2BAGF;6BACE;6BACA;6BACA;+BACE;iCAAc;;+BACd;iCAAiB;;;;2BAGrB;6BACE;6BACA;6BACA;+BACE;iCAAY;iCAAe;mCAAS;;;+BACpC;iCACE;iCACA;mCAAwB;;;;;;;;;;iBASxC;mBACE;mBACA;mBAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;YClnBE;EAAc;EAAmB;;;;;;;qBAOhC,sBAAsB;qBA2BtB;;;;;;;;;qBAYA;;;;;;;;;;;;qBAqBA;;wBAQG,aAAa;EAAiB;EAAa;;;;;;;;;;;wBAwB3C,kBACd,gBACA;;;;;;;;;;wBA0Bc,qBACd,gBACA,mBACA,SAAS;YAkCC;EACV;EACA;EACA;;YAGU;EACV,eAAe;EACf,mBAAmB;;;;;;;;wBASL,gBACd,SAAS,aACT,cAAc,yBACb;wBAkBa,wBACd,YAAY;;;;;;;wBAcE,sBAAsB"}
@@ -854,7 +854,7 @@ const phConnectRuntimeConfigSchema = {
854
854
  },
855
855
  reactorWorker: {
856
856
  type: "boolean",
857
- description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.",
857
+ description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.",
858
858
  default: false
859
859
  }
860
860
  }
@@ -1236,7 +1236,16 @@ function checkSharedDeps(pkgJson, hostVersions) {
1236
1236
  function formatSharedDepWarnings(mismatches) {
1237
1237
  return mismatches.map((m) => `${m.package}: requires ${m.required}, Connect provides ${m.provided}`);
1238
1238
  }
1239
+ /**
1240
+ * Stable filename for a local package's worker model bundle under
1241
+ * `__reactor_worker__/packages/`. Shared by the tab (URL computation via the
1242
+ * manifest) and the production prebuild (emitted entry names), so the two can
1243
+ * never drift. Scoped names flatten (`@scope/name` -> `scope__name`).
1244
+ */
1245
+ function workerPackageFileName(packageName) {
1246
+ return `${packageName.replace(/^@/, "").replace(/[^\w.-]+/g, "__")}.js`;
1247
+ }
1239
1248
  //#endregion
1240
- export { ConfigLoader, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, EXTERNALIZABLE_SHARED_SPECIFIERS, JsonConfigAdapter, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, ROOT_STORAGE_NAMESPACE, SHARED_DEPS, SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, buildRuntimeConfig, checkSharedDeps, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, findSharedImports, formatSharedDepWarnings, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, parseDepSpec, phConnectRuntimeConfigSchema, powerhousePackageSchema, resolveSourceConnect, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory, workflowsSettingConflict };
1249
+ export { ConfigLoader, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, EXTERNALIZABLE_SHARED_SPECIFIERS, JsonConfigAdapter, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, ROOT_STORAGE_NAMESPACE, SHARED_DEPS, SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, buildRuntimeConfig, checkSharedDeps, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, findSharedImports, formatSharedDepWarnings, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, parseDepSpec, phConnectRuntimeConfigSchema, powerhousePackageSchema, resolveSourceConnect, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory, workerPackageFileName, workflowsSettingConflict };
1241
1250
 
1242
1251
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"sourcesContent":["/**\n * The base a dynamic-base Connect build is compiled against. The build emits\n * this literal wherever a base-relative URL would go, and the serving layer\n * (the dynamic-base vite plugin at build time, the connect proxy at serve\n * time) rewrites it to the base the app is actually deployed under.\n *\n * It lives here, in the browser-safe shared package, rather than in\n * `@powerhousedao/builder-tools`, because both the node-only build toolchain\n * and Connect's own browser code need it. Importing builder-tools from app\n * code pulls the whole build toolchain (and its node-only `read-pkg`\n * dependency) into the browser graph.\n */\nexport const DYNAMIC_BASE_PLACEHOLDER = \"/__PH_DYNAMIC_BASE__/\";\n","import { z } from \"zod\";\n\n/**\n * Coerces string values to boolean.\n * Accepts: \"true\", \"false\", true, false\n */\nconst booleanString = z\n .union([z.boolean(), z.enum([\"true\", \"false\"])])\n .transform((val) => {\n if (typeof val === \"boolean\") return val;\n return val === \"true\";\n });\n\n// ============================================================================\n// Build-time Environment Variables\n// ============================================================================\n\n/**\n * Build-time configuration schema\n */\nconst buildEnvSchema = z.object({\n /**\n * Comma-separated list of package names to load\n * @example \"package1,package2\"\n */\n PH_PACKAGES: z.string().optional(),\n\n /**\n * Path to local package to load during development\n */\n PH_LOCAL_PACKAGE: z.string().optional(),\n\n /**\n * Sentry authentication token for uploading source maps\n */\n PH_SENTRY_AUTH_TOKEN: z.string().optional(),\n\n /**\n * Sentry organization slug\n */\n PH_SENTRY_ORG: z.string().optional(),\n\n /**\n * Sentry project slug\n */\n PH_SENTRY_PROJECT: z.string().optional(),\n});\n\n// ============================================================================\n// Application Configuration (build metadata only)\n// ============================================================================\n\n/**\n * Connect runtime values (anything in `PHConnectRuntimeConfig`) are NOT\n * settable from env vars. They live in `powerhouse.config.json` and are\n * overridden via `ph connect build --<field>` or `ph connect config\n * --<field>`.\n *\n * What stays env-driven below is non-runtime: build metadata, Sentry\n * credentials, analytics processor toggles, etc.\n */\nconst appConfigSchema = z.object({\n /**\n * Application version number (build metadata stamp)\n * @default \"unknown\"\n */\n PH_CONNECT_VERSION: z.string().default(\"unknown\"),\n\n /**\n * CLI version number (build metadata stamp)\n */\n PH_CONNECT_CLI_VERSION: z.string().optional(),\n});\n\n// ============================================================================\n// Analytics Processor Configuration\n// ============================================================================\n\n/**\n * Analytics processor configuration schema. These are non-runtime feature\n * toggles for the analytics subsystem — they don't live in the runtime\n * schema and stay env-driven.\n */\nconst processorsConfigSchema = z.object({\n /**\n * Enable diff analytics tracking\n * @default false\n */\n PH_CONNECT_DIFF_ANALYTICS_ENABLED: booleanString.default(false),\n\n /**\n * Enable drive analytics tracking\n * @default true\n */\n PH_CONNECT_DRIVE_ANALYTICS_ENABLED: booleanString.default(true),\n\n /**\n * Enable external analytics processors\n * @default true\n */\n PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED: booleanString.default(true),\n});\n\n// ============================================================================\n// OpenPanel Configuration\n// ============================================================================\n\n/**\n * OpenPanel analytics configuration schema\n */\nconst openPanelConfigSchema = z.object({\n /**\n * OpenPanel client ID. When unset, the OpenPanel subsystem is a no-op.\n */\n PH_CONNECT_OPENPANEL_CLIENT_ID: z.string().optional(),\n\n /**\n * OpenPanel API URL override. Defaults to the OpenPanel cloud when unset.\n */\n PH_CONNECT_OPENPANEL_API_URL: z.string().optional(),\n\n /**\n * Track UI events via the useOpenPanel() hook\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: booleanString.default(true),\n\n /**\n * Track document operations via the OpenPanel processor\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: booleanString.default(true),\n});\n\n// ============================================================================\n// Combined Schemas\n// ============================================================================\n\n/**\n * Complete runtime environment schema (all PH_CONNECT_* vars). Only\n * build-metadata + analytics-processor toggles live here; all Connect\n * runtime config lives in `powerhouse.config.json`.\n */\nexport const runtimeEnvSchema = appConfigSchema\n .extend(processorsConfigSchema.shape)\n .extend(openPanelConfigSchema.shape);\n\n/**\n * Complete environment schema (build + runtime)\n */\nexport const connectEnvSchema = buildEnvSchema.extend(runtimeEnvSchema.shape);\n\n/**\n * Inferred TypeScript types from schemas\n */\nexport type ConnectBuildEnv = z.infer<typeof buildEnvSchema>;\nexport type ConnectRuntimeEnv = z.infer<typeof runtimeEnvSchema>;\nexport type ConnectEnv = z.infer<typeof connectEnvSchema>;\n\n// ============================================================================\n// Environment Loading Functions\n// ============================================================================\n\n/**\n * Options for loading environment variables\n */\nexport interface LoadEnvOptions {\n /**\n * Environment variables from process.env (highest priority)\n */\n processEnv?: Record<string, string | undefined>;\n /**\n * Environment variables from .env file (lowest priority)\n */\n fileEnv?: Record<string, string | undefined>;\n}\n\n/**\n * Internal helper to merge environment sources with priority.\n * Validates each value and falls back to next priority if invalid.\n */\nfunction mergeEnvSources(\n options: LoadEnvOptions,\n keys: Set<string>,\n schema: z.ZodObject<Record<string, z.ZodTypeAny>>,\n): Record<string, unknown> {\n const { processEnv = {}, fileEnv = {} } = options;\n const merged: Record<string, unknown> = {};\n\n // Apply priority: fileEnv < processEnv\n for (const key of keys) {\n const sources = [\n { name: \"process.env\", value: processEnv[key] },\n { name: \"fileEnv\", value: fileEnv[key] },\n ];\n\n // Try each source in priority order\n for (const source of sources) {\n const value = source.value;\n if (value === undefined || value === \"\") continue;\n\n // Try to validate just this field\n try {\n const fieldSchema = schema.shape[key];\n if (fieldSchema) {\n fieldSchema.parse(value);\n merged[key] = value;\n break; // Successfully validated, use this value\n }\n // No schema for this key, accept it\n console.warn(`Unknown environment variable: '${key}'`);\n merged[key] = value;\n break;\n } catch {\n // Validation failed, log warning and try next source\n const valueStr =\n value === null\n ? \"null\"\n : typeof value === \"object\"\n ? JSON.stringify(value)\n : (value as string);\n console.warn(\n `Invalid value for ${key} from ${source.name}: ${valueStr}. Trying next source.`,\n );\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Loads and validates environment variables with priority:\n * 1. process.env (highest)\n * 2. fileEnv\n * 3. defaults from schema (lowest)\n *\n * @param options - Environment sources in priority order\n * @returns Validated and typed environment configuration\n */\nexport function loadConnectEnv(options: LoadEnvOptions = {}): ConnectEnv {\n const allKeys = new Set([\n ...Object.keys(buildEnvSchema.shape),\n ...Object.keys(runtimeEnvSchema.shape),\n ]);\n\n const merged = mergeEnvSources(options, allKeys, connectEnvSchema);\n return connectEnvSchema.parse(merged);\n}\n\n/**\n * Loads only runtime environment variables (build metadata + Sentry +\n * analytics-processor toggles — everything in the Connect runtime schema\n * is sourced from powerhouse.config.json, not env).\n *\n * @param options - Environment sources in priority order\n * @returns Validated runtime environment configuration\n */\nexport function loadRuntimeEnv(\n options: LoadEnvOptions = {},\n): ConnectRuntimeEnv {\n const allKeys = new Set(Object.keys(runtimeEnvSchema.shape));\n const merged = mergeEnvSources(options, allKeys, runtimeEnvSchema);\n return runtimeEnvSchema.parse(merged);\n}\n\n/**\n * Safely sets Connect environment variables with validation.\n * Invalid values will log a warning and be skipped.\n *\n * @param values - Type-safe object with key-value pairs to set\n *\n * @example\n * ```ts\n * setConnectEnv({\n * PH_CONNECT_VERSION: \"1.2.3\",\n * PH_CONNECT_SENTRY_DSN: \"https://…\",\n * });\n * ```\n */\nexport function setConnectEnv(values: Partial<ConnectEnv>): void {\n for (const [key, value] of Object.entries(values)) {\n // Check if key exists in schema\n const fieldSchema =\n connectEnvSchema.shape[key as keyof typeof connectEnvSchema.shape];\n\n if (!fieldSchema) {\n console.warn(\n `Unknown environment variable: ${key}. Variable not set. Valid keys: ${Object.keys(connectEnvSchema.shape).join(\", \")}`,\n );\n continue;\n }\n\n try {\n // Validate the value\n fieldSchema.parse(value);\n\n // Set the value (convert to string for process.env compatibility)\n process.env[key] = String(value);\n } catch (error) {\n console.warn(\n `Invalid value for ${key}: ${String(value)}. Validation failed.`,\n error,\n );\n }\n }\n}\n\n/**\n * Normalizes a base path to ensure it:\n * - Starts with a forward slash (/)\n * - Ends with a forward slash (/)\n * - Has no relative path prefix (.)\n *\n * @param basePath - The base path to normalize\n * @returns The normalized base path\n *\n * @example\n * normalizeBasePath('/app') // '/app/'\n * normalizeBasePath('./app/') // '/app/'\n * normalizeBasePath('app') // '/app/'\n * normalizeBasePath('/') // '/'\n * normalizeBasePath('') // '/'\n */\nexport function normalizeBasePath(basePath: string): string {\n if (!basePath) {\n return \"/\";\n }\n\n let normalized = basePath;\n\n // Remove relative path prefix\n if (normalized.startsWith(\".\")) {\n normalized = normalized.slice(1);\n }\n\n // Ensure it starts with a forward slash\n if (!normalized.startsWith(\"/\")) {\n normalized = `/${normalized}`;\n }\n\n // Ensure it ends with a forward slash\n if (!normalized.endsWith(\"/\")) {\n normalized = `${normalized}/`;\n }\n\n return normalized;\n}\n\n/**\n * Base storage namespace for a Connect instance served at the root of an\n * origin. Kept as a literal so root deployments resolve to a byte-identical\n * value with no migration.\n */\nexport const ROOT_STORAGE_NAMESPACE = \"reactor\";\n\n/**\n * Derives the origin-scoped storage namespace from a Connect base path.\n *\n * Connect instances served under different path prefixes of the same origin\n * (e.g. behind a reverse proxy) otherwise share all origin-scoped browser\n * storage (PGlite data dirs, IndexedDB). This produces a deterministic,\n * collision-free namespace per distinct prefix that is valid as an\n * IndexedDB database name.\n *\n * - root base path (\"/\" or unset) -> \"reactor\" (byte-identical to the legacy\n * key, so existing root deployments keep their data with zero migration)\n * - any non-root base path -> \"reactor--<slug>\", e.g.\n * \"/reactor-project/vetra-studio/\" -> \"reactor--reactor-project-vetra-studio\"\n *\n * @param basePath - The Connect base path (env.PH_CONNECT_BASE_PATH ||\n * import.meta.env.BASE_URL); normalized internally.\n * @returns The storage namespace.\n *\n * @example\n * getStorageNamespace('/') // 'reactor'\n * getStorageNamespace('/reactor-project/vetra-studio/') // 'reactor--reactor-project-vetra-studio'\n */\nexport function getStorageNamespace(basePath: string): string {\n const normalized = normalizeBasePath(basePath);\n if (normalized === \"/\") {\n return ROOT_STORAGE_NAMESPACE;\n }\n const slug = normalized\n .slice(1, -1)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n // A non-root base path whose slug normalizes to nothing (e.g. \"/-/\") must\n // not collapse into the root namespace and share its storage.\n return `${ROOT_STORAGE_NAMESPACE}--${slug || \"default\"}`;\n}\n","// Merging of Connect PWA override fragments.\n//\n// PWA config comes from several layers — Connect's hardcoded defaults, each\n// build-time-known package's `pwa` fragment, and the project's `connect.pwa`\n// block. A naive deep-merge is wrong here: runtime-caching rules and precache\n// globs are ADDITIVE (a later layer must not drop an earlier layer's offline\n// coverage), and the precache size ceiling must be the MAX so no contributor\n// can silently shrink another's limit. This module encodes those per-field\n// strategies: `mergePwaConfig(contributions)` folds an ordered list of\n// serialisable `PHConnectPwa` fragments (lowest precedence first) into one\n// effective fragment, warning when multiple packages set the same manifest\n// scalar to different values.\n//\n// Laying the effective fragment over Connect's hardcoded VitePWA base happens\n// in builder-tools (`connect-utils/vite-plugins/pwa-overrides.ts`), where\n// vite-plugin-pwa's manifest types are available.\n\nimport type {\n PHConnectPwa,\n PHConnectPwaManifest,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\nimport { deepMerge } from \"./config-loader.js\";\n\n// Re-exported so the PWA override types are reachable from the same\n// `@powerhousedao/shared/connect` entry as the merge helpers that consume them.\nexport type {\n PHConnectPwa,\n PHConnectPwaCacheStrategy,\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n PHConnectPwaRuntimeCaching,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\n\n/** A labelled PWA fragment, so merge diagnostics can name the contributor. */\nexport type PwaContribution = {\n /** Human-readable origin (package name, or the project config file). */\n source: string;\n config: PHConnectPwa;\n};\n\n// Manifest scalar fields — the ones where \"two layers set it\" is a genuine\n// conflict (as opposed to the additive arrays, which never conflict).\nconst MANIFEST_SCALAR_KEYS: readonly (keyof PHConnectPwaManifest)[] = [\n \"name\",\n \"short_name\",\n \"description\",\n \"theme_color\",\n \"background_color\",\n \"display\",\n \"start_url\",\n \"scope\",\n \"launch_handler\",\n];\n\n// Manifest fields merged additively (concatenated/unioned across every layer),\n// never as scalar conflicts. Kept out of the deepMerge path, which replaces\n// arrays wholesale and would drop earlier contributions. `categories` is\n// derived (from the manifest `category` field) but merges the same additive way.\nconst ADDITIVE_MANIFEST_KEYS = new Set<keyof PHConnectPwaManifest>([\n \"icons\",\n \"file_handlers\",\n \"categories\",\n]);\n\n// Structural icon shape shared by PHConnectPwaIcon and vite-plugin-pwa's\n// IconResource (whose `purpose` may also be an array of purposes).\ntype IconLike = {\n src: string;\n sizes?: string;\n purpose?: string | readonly string[];\n};\n\nfunction iconKey(icon: IconLike): string {\n const purpose =\n typeof icon.purpose === \"string\"\n ? icon.purpose\n : (icon.purpose?.join(\",\") ?? \"\");\n return `${icon.src}|${icon.sizes ?? \"\"}|${purpose}`;\n}\n\n/** Concatenate, keeping the first occurrence per `key`. */\nfunction dedupeBy<T>(items: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const item of items) {\n const k = key(item);\n if (seen.has(k)) continue;\n seen.add(k);\n result.push(item);\n }\n return result;\n}\n\n/** Concatenate icons, keeping the first occurrence of each (src,sizes,purpose). */\nexport function dedupeIcons<T extends IconLike>(icons: T[]): T[] {\n return dedupeBy(icons, iconKey);\n}\n\n/** `JSON.stringify` with object keys sorted recursively, so two structurally\n * equal values always serialise identically (accept-map key order etc.). */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`);\n return `{${entries.join(\",\")}}`;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Concatenate file handlers, keeping the first occurrence of each entry.\n * Deduped on the WHOLE entry (canonical JSON) rather than any single field:\n * every handler shares Connect's fixed action, and two handlers accepting\n * different file types are both real contributions — only the exact same\n * fragment arriving via two layers is a duplicate. Structural, so it also\n * works on the vite-plugin-pwa handler shape in builder-tools.\n */\nexport function dedupeFileHandlers<T extends object>(handlers: T[]): T[] {\n return dedupeBy(handlers, stableStringify);\n}\n\n/** Fold a manifest's top-level `category` string into a PWA config as a\n * `categories: [category]` entry. PWA `categories` is DERIVED from the\n * `category` field of every contributing `powerhouse.manifest.json` (never\n * authored under `pwa`); `mergePwaConfig`/`mergeManifest` then union them\n * across contributors. No-op when there is no usable category. */\nexport function withInferredCategory(\n config: PHConnectPwa,\n category: unknown,\n): PHConnectPwa {\n if (typeof category !== \"string\" || !category) return config;\n return {\n ...config,\n manifest: { ...config.manifest, categories: [category] },\n };\n}\n\n/** Order-preserving string union (used for the precache glob lists). */\nexport function unionStrings(\n base: string[] | undefined,\n extra: string[],\n): string[] {\n const result = [...(base ?? [])];\n for (const item of extra) if (!result.includes(item)) result.push(item);\n return result;\n}\n\nfunction patternKey(pattern: PHConnectPwaUrlPattern): string {\n return typeof pattern === \"string\"\n ? `s:${pattern}`\n : `r:${pattern.source}:${pattern.flags ?? \"\"}`;\n}\n\nfunction unionPatterns(\n base: PHConnectPwaUrlPattern[] | undefined,\n extra: PHConnectPwaUrlPattern[],\n): PHConnectPwaUrlPattern[] {\n const result = [...(base ?? [])];\n const seen = new Set(result.map(patternKey));\n for (const pattern of extra) {\n const key = patternKey(pattern);\n if (seen.has(key)) continue;\n seen.add(key);\n result.push(pattern);\n }\n return result;\n}\n\n/** Merge one fragment into `target` in place, applying the per-field\n * strategies (manifest scalars deep-merge and win; icons/file_handlers/globs/\n * rules/denylist are additive; size ceiling takes the max). */\nfunction mergeInto(target: PHConnectPwa, config: PHConnectPwa): void {\n if (config.manifest) {\n // The additive arrays are pulled out of the deepMerge path: deepMerge\n // replaces arrays wholesale, which would drop earlier contributions.\n const { icons, file_handlers, categories, ...scalars } = config.manifest;\n if (Object.keys(scalars).length > 0) {\n target.manifest = deepMerge(\n target.manifest ?? {},\n scalars as PHConnectPwaManifest,\n );\n }\n if (icons?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n icons: dedupeIcons([...(target.manifest?.icons ?? []), ...icons]),\n };\n }\n if (file_handlers?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n file_handlers: dedupeFileHandlers([\n ...(target.manifest?.file_handlers ?? []),\n ...file_handlers,\n ]),\n };\n }\n if (categories?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n categories: unionStrings(target.manifest?.categories, categories),\n };\n }\n }\n if (config.globPatterns?.length) {\n target.globPatterns = unionStrings(\n target.globPatterns,\n config.globPatterns,\n );\n }\n if (config.globIgnores?.length) {\n target.globIgnores = unionStrings(target.globIgnores, config.globIgnores);\n }\n if (config.runtimeCaching?.length) {\n target.runtimeCaching = [\n ...(target.runtimeCaching ?? []),\n ...config.runtimeCaching,\n ];\n }\n if (config.navigateFallbackDenylist?.length) {\n target.navigateFallbackDenylist = unionPatterns(\n target.navigateFallbackDenylist,\n config.navigateFallbackDenylist,\n );\n }\n if (typeof config.maximumFileSizeToCacheInBytes === \"number\") {\n target.maximumFileSizeToCacheInBytes = Math.max(\n target.maximumFileSizeToCacheInBytes ?? 0,\n config.maximumFileSizeToCacheInBytes,\n );\n }\n}\n\n/**\n * Fold the build-time-known package PWA fragments and the project's\n * `connect.pwa` block into one effective fragment. Precedence is\n * `packageContributions (in order) < projectConfig` — the project config wins\n * scalar fields, while arrays (`icons`, globs, `runtimeCaching`,\n * `navigateFallbackDenylist`) are additive across every layer and the size\n * ceiling takes the max.\n *\n * `onWarn` fires when two or more PACKAGES set the same manifest scalar to\n * different values and the project config doesn't settle it — the winner is\n * otherwise decided silently by package load order. The operator resolves it\n * by setting that field in `connect.pwa`, which both wins and silences the\n * warning.\n */\nexport function mergePwaConfig(\n packageContributions: PwaContribution[],\n projectConfig?: PHConnectPwa,\n onWarn: (message: string) => void = () => {},\n): PHConnectPwa {\n const merged: PHConnectPwa = {};\n // Which packages set each manifest scalar, and to what (for the conflict\n // warning). The project config is deliberately excluded — it is the\n // authority, not a conflicting sibling.\n const packageScalarSetters: Partial<\n Record<string, { source: string; value: unknown }[]>\n > = {};\n\n for (const { source, config } of packageContributions) {\n mergeInto(merged, config);\n for (const [key, value] of Object.entries(config.manifest ?? {})) {\n if (ADDITIVE_MANIFEST_KEYS.has(key as keyof PHConnectPwaManifest)) {\n continue;\n }\n (packageScalarSetters[key] ??= []).push({ source, value });\n }\n }\n if (projectConfig) mergeInto(merged, projectConfig);\n\n const projectManifest = projectConfig?.manifest ?? {};\n for (const key of MANIFEST_SCALAR_KEYS) {\n const setters = packageScalarSetters[key];\n const projectSettles = projectManifest[key] !== undefined;\n if (!setters || setters.length < 2 || projectSettles) continue;\n // Same value from every package is agreement, not a conflict. Compared\n // via stableStringify, not by identity — launch_handler is object-valued,\n // and two packages sending equal objects (in any key order) must not read\n // as a conflict.\n const distinctValues = new Set(\n setters.map((s) => stableStringify(s.value)),\n );\n if (distinctValues.size < 2) continue;\n const sources = setters.map((s) => s.source);\n onWarn(\n `PWA config: manifest.${key} set by multiple packages (${sources.join(\n \", \",\n )}); '${sources[sources.length - 1]}' wins by load order. Set connect.pwa.manifest.${key} in the project config to make the winner explicit.`,\n );\n }\n\n return merged;\n}\n\n/** A serialisable URL pattern as Workbox consumes it: strings pass through\n * verbatim, `{ source, flags }` is rebuilt into a RegExp. */\nexport function toRegExpOrString(\n pattern: PHConnectPwaUrlPattern,\n): string | RegExp {\n return typeof pattern === \"string\"\n ? pattern\n : new RegExp(pattern.source, pattern.flags);\n}\n","// Building the effective web-app manifest from a base manifest plus a\n// `PHConnectPwaManifest` fragment. Pure JSON in / JSON out — no PWA-toolchain\n// or DOM dependency — so the SAME code path runs at build time (laying the\n// effective build-merged fragment over Connect's hardcoded base, see\n// applyPwaOverrides) and at runtime inside the service worker (laying a\n// dynamically-installed package's fragment over the build-embedded base to\n// serve the live manifest).\n//\n// Connect owns the \"where\" of every OS integration: file handlers open at the\n// app root, `web+…` protocol links and shared files route through fixed\n// in-scope endpoints. Contributors declare only WHAT they accept; the routes\n// below are injected here so a package can never point the OS at an arbitrary\n// URL. Injection is idempotent, so re-merging a manifest that already carries\n// the routes is a no-op.\n\nimport type {\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n} from \"../clis/types.js\";\nimport { dedupeFileHandlers, dedupeIcons, unionStrings } from \"./pwa-config.js\";\n\n/**\n * The one route launched files open at, shared by the built-in handler and\n * injected into every contributed one. Not configurable: consuming launched\n * files takes runtime code that lives in Connect itself, and a relative \".\"\n * resolves against the manifest URL so it tracks any deploy base (the\n * webmanifest is served dynamically and never rewritten by the dynamic-base\n * plugin) — same trick as the base start_url/scope.\n */\nexport const PWA_FILE_HANDLER_ACTION = \".\";\n\n// IndexedDB schema for the page->service-worker PWA-fragment mirror. A SW can't\n// read localStorage (where the installed-package list lives), so the SPA\n// mirrors the merged fragment here and the SW reads it to serve a live\n// manifest. Both sides MUST agree, so the schema lives here as the single\n// source of truth (the SPA writer and the SW reader both import these) —\n// a rename or version bump can no longer desync one side silently.\nexport const PWA_IDB_NAME = \"ph-pwa\";\nexport const PWA_IDB_STORE = \"fragments\";\nexport const PWA_IDB_KEY = \"merged\";\nexport const PWA_IDB_VERSION = 1;\n\n/** The subset of a web-app manifest this module reads/writes, plus an index\n * signature so untouched fields (name, theme_color, launch_handler, …) pass\n * through verbatim. */\nexport interface PwaWebManifest {\n icons?: PHConnectPwaIcon[];\n file_handlers?: (PHConnectPwaFileHandler & { action?: string })[];\n categories?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Lay a `PHConnectPwaManifest` fragment over a base web-manifest object.\n *\n * - **scalars** (name, theme_color, launch_handler, …): governed by\n * `scalarPolicy`. `\"fragment-wins\"` lets the fragment overwrite the base;\n * `\"base-wins\"` keeps the base and only fills fields it left unset. Keys\n * listed in `protectedScalars` always behave as base-wins even under a\n * fragment-wins policy — used at runtime to fragment-win cosmetic scalars\n * while still protecting navigation-critical ones (`start_url`/`scope`) from\n * an untrusted dynamically-installed package.\n * - **arrays** (icons, file_handlers): always additive, base entries first,\n * de-duplicated — so a package can extend but never displace a built-in\n * (Chromium is first-registered-wins per file extension, so `.phd`/`.phdm`\n * stay Connect's).\n * - **categories**: order-preserving string union (derived from the manifest\n * `category` field, not authored under `pwa`).\n *\n * The Connect-owned file-handler action is injected idempotently.\n */\nexport function mergeManifest(\n base: PwaWebManifest,\n fragment: PHConnectPwaManifest | undefined,\n opts?: {\n scalarPolicy?: \"base-wins\" | \"fragment-wins\";\n protectedScalars?: readonly string[];\n },\n): PwaWebManifest {\n const scalarPolicy = opts?.scalarPolicy ?? \"base-wins\";\n const protectedScalars = opts?.protectedScalars ?? [];\n const result: PwaWebManifest = { ...base };\n const { icons, file_handlers, categories, ...scalars } = fragment ?? {};\n\n const takeScalar = (key: string): boolean => {\n // Protected keys stay base-wins regardless of the policy.\n const policy = protectedScalars.includes(key) ? \"base-wins\" : scalarPolicy;\n return policy === \"fragment-wins\" || result[key] === undefined;\n };\n\n for (const [key, value] of Object.entries(scalars)) {\n if (takeScalar(key)) result[key] = value;\n }\n\n if (icons?.length) {\n result.icons = dedupeIcons([...(result.icons ?? []), ...icons]);\n }\n if (file_handlers?.length) {\n // Force the Connect-owned action (spread first, action last) so contributed\n // handlers match the base's already-injected shape and de-dupe correctly.\n const injected = file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n result.file_handlers = dedupeFileHandlers([\n ...(result.file_handlers ?? []),\n ...injected,\n ]);\n }\n if (categories?.length) {\n result.categories = unionStrings(result.categories, categories);\n }\n\n // Idempotently (re-)assert the Connect-owned file-handler action across the\n // merged result, covering both fragment contributions and any base entries.\n if (result.file_handlers?.length) {\n result.file_handlers = result.file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n }\n\n return result;\n}\n","// Single source of truth for JSON Schema shapes shared between the source\n// PowerhouseConfig schema (packages/shared/clis/source-config-schema.ts) and\n// the runtime RuntimePowerhouseConfig schema\n// (packages/builder-tools/connect-utils/runtime-config-schema.ts).\n//\n// When a shared shape changes, edit it here — both schemas pick it up.\n\nexport const powerhousePackageSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"packageName\"],\n properties: {\n packageName: {\n type: \"string\",\n description: \"Fully qualified npm package name (e.g. @scope/name).\",\n },\n version: {\n type: \"string\",\n description: \"Exact version (registry providers) or omit to take latest.\",\n },\n provider: {\n type: \"string\",\n enum: [\"npm\", \"github\", \"local\", \"registry\"],\n description: \"Where Connect should resolve the package from at runtime.\",\n },\n url: {\n type: \"string\",\n description:\n \"Override URL for non-registry providers (e.g. github tarball).\",\n },\n },\n} as const;\n\n// Reusable shape for `connect.drives.sections.{remote,local}` — three\n// affirmative-named toggles per section. The legacy public+cloud sections\n// have been collapsed into a single `remote`.\nconst driveSectionSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Visibility and add/delete affordances for a drive section in the sidebar.\",\n properties: {\n enabled: {\n type: \"boolean\",\n description: \"When false, the section is hidden in the sidebar.\",\n default: true,\n },\n allowAdd: {\n type: \"boolean\",\n description:\n \"When false, the section's 'add drive' affordance is hidden.\",\n default: true,\n },\n allowDelete: {\n type: \"boolean\",\n description:\n \"When false, drives in this section cannot be deleted from the UI.\",\n default: true,\n },\n },\n} as const;\n\n// Reusable shape for a runtime-caching / denylist URL match. A string is\n// handed to Workbox verbatim; `{ source, flags }` is rebuilt into a RegExp at\n// build time. Function patterns aren't serialisable and can't be expressed\n// from config — only Connect's built-in rules use them (see the runtime-caching\n// rules in builder-tools' connect-utils/service-worker/service-worker.ts).\nconst pwaUrlPatternSchema = {\n description:\n \"URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.\",\n oneOf: [\n { type: \"string\" },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"source\"],\n properties: {\n source: { type: \"string\", description: \"RegExp source.\" },\n flags: { type: \"string\", description: \"RegExp flags (e.g. 'i').\" },\n },\n },\n ],\n} as const;\n\n// Reusable web-app-manifest icon shape (manifest.icons and file-handler icons).\nconst pwaIconSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"src\"],\n properties: {\n src: { type: \"string\" },\n sizes: { type: \"string\" },\n type: { type: \"string\" },\n purpose: { type: \"string\" },\n },\n} as const;\n\nexport const phConnectRuntimeConfigSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.\",\n properties: {\n branding: {\n type: \"object\",\n additionalProperties: false,\n description: \"App identity and visual branding.\",\n properties: {\n appName: {\n type: \"string\",\n description:\n \"Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'.\",\n },\n homeBackground: {\n type: [\"string\", \"null\"],\n description:\n \"Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.\",\n },\n },\n },\n app: {\n type: \"object\",\n additionalProperties: false,\n description: \"Top-level Connect application behaviour.\",\n properties: {\n logLevel: {\n type: \"string\",\n enum: [\"debug\", \"info\", \"warn\", \"error\"],\n description:\n \"Log level applied by Connect's logger at boot. Affects browser-side output only.\",\n default: \"info\",\n },\n basePath: {\n type: \"string\",\n description:\n \"Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.\",\n default: \"/\",\n },\n offline: {\n type: \"boolean\",\n description:\n \"When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.\",\n default: true,\n },\n studioMode: {\n type: \"boolean\",\n description:\n \"Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.\",\n default: false,\n },\n workflowsEnabled: {\n type: \"boolean\",\n description:\n \"Powerhouse workflows in Connect. When true the tab loads the @powerhousedao/workflow package (workflow + connection documents, their editors and Workflow Studio) and the reactor worker registers its document models. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set.\",\n },\n },\n },\n ai: {\n type: \"object\",\n additionalProperties: false,\n description: \"AI assistant (chat) behaviour.\",\n properties: {\n assistantEnabled: {\n type: \"boolean\",\n description:\n \"When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.\",\n default: false,\n },\n },\n },\n packages: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).\",\n properties: {\n externalEnabled: {\n type: \"boolean\",\n description:\n \"When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.\",\n default: true,\n },\n liveReload: {\n type: \"boolean\",\n description:\n \"When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).\",\n default: false,\n },\n },\n },\n drives: {\n type: \"object\",\n additionalProperties: false,\n description: \"Default-drive and add-drive UI behaviour.\",\n properties: {\n allowAddDrive: {\n type: \"boolean\",\n description:\n \"When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.\",\n default: true,\n },\n defaultDrives: {\n type: \"array\",\n description:\n \"Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).\",\n default: [],\n items: {\n oneOf: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"url\"],\n properties: {\n url: { type: \"string\" },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n },\n },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"local\", \"id\"],\n properties: {\n local: {\n const: true,\n description:\n \"Discriminator: this entry is a local drive created on first boot.\",\n },\n id: {\n type: \"string\",\n description:\n \"Stable drive id. The drive is created with this id on first boot and is not re-created on later boots.\",\n },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n app: {\n type: \"string\",\n description:\n \"Drive app (preferred editor) to open on the drive.\",\n },\n },\n },\n ],\n },\n },\n preserveStrategy: {\n type: \"string\",\n enum: [\"preserve-all\", \"preserve-by-url-and-detach\"],\n description:\n \"Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.\",\n },\n sections: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.\",\n properties: {\n remote: driveSectionSchema,\n local: driveSectionSchema,\n },\n },\n },\n },\n renown: {\n type: \"object\",\n additionalProperties: false,\n description: \"Renown identity / authentication coordinates.\",\n properties: {\n url: {\n type: \"string\",\n description: \"Renown auth service URL.\",\n default: \"https://www.renown.id\",\n },\n networkId: {\n type: \"string\",\n description: \"CAIP-2 network namespace (e.g. 'eip155').\",\n default: \"eip155\",\n },\n chainId: {\n type: \"number\",\n description: \"CAIP-2 chain reference within the network namespace.\",\n default: 1,\n },\n namespace: {\n type: \"string\",\n description:\n \"Renown localStorage namespace; share it across Connects to share login.\",\n },\n switchboardUrl: {\n type: \"string\",\n description:\n \"Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`.\",\n },\n adapters: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.\",\n properties: {\n rainbow: {\n type: \"object\",\n additionalProperties: false,\n description: \"wagmi + RainbowKit external-wallet adapter config.\",\n properties: {\n walletConnectProjectId: {\n type: \"string\",\n description:\n \"WalletConnect project id; required for this adapter to function.\",\n },\n infuraProjectId: {\n type: \"string\",\n description:\n \"Optional Infura project id used to build RPC transports.\",\n },\n },\n },\n privy: {\n type: \"object\",\n additionalProperties: false,\n description: \"Privy embedded/social adapter config.\",\n properties: {\n appId: {\n type: \"string\",\n description:\n \"Privy application id; required for this adapter to function.\",\n },\n clientId: {\n type: \"string\",\n description: \"Optional Privy client id.\",\n },\n methods: {\n type: \"array\",\n description:\n \"Login methods this adapter offers; default per adapter when omitted.\",\n items: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n sentry: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.\",\n properties: {\n dsn: {\n type: [\"string\", \"null\"],\n description:\n \"Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.\",\n default: null,\n },\n env: {\n type: \"string\",\n description:\n \"Sentry environment label, surfaced as the `environment` tag on every event.\",\n default: \"dev\",\n },\n tracing: {\n type: \"boolean\",\n description: \"Enable Sentry performance tracing.\",\n default: false,\n },\n },\n },\n openPanel: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.\",\n properties: {\n clientId: {\n type: \"string\",\n description:\n \"OpenPanel client id. Empty string disables OpenPanel entirely.\",\n default: \"\",\n },\n apiUrl: {\n type: \"string\",\n description:\n \"OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API.\",\n },\n trackUiEvents: {\n type: \"boolean\",\n description: \"Track UI events.\",\n default: true,\n },\n trackOperations: {\n type: \"boolean\",\n description: \"Track document operations.\",\n default: true,\n },\n },\n },\n instance: {\n type: \"object\",\n additionalProperties: false,\n required: [\"namespace\", \"reactorWorker\"],\n description:\n \"Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.\",\n properties: {\n namespace: {\n type: [\"string\", \"null\"],\n description:\n \"Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.\",\n default: null,\n },\n reactorWorker: {\n type: \"boolean\",\n description:\n \"Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.\",\n default: false,\n },\n },\n },\n reactor: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.\",\n properties: {\n featureFlags: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.\",\n properties: {\n documentDecisions: {\n type: \"boolean\",\n description:\n \"Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.\",\n default: false,\n },\n authEnforcement: {\n type: \"boolean\",\n description:\n \"Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.\",\n default: false,\n },\n authGroups: {\n type: \"boolean\",\n description:\n \"Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.\",\n default: false,\n },\n authConditions: {\n type: \"boolean\",\n description:\n \"Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.\",\n default: false,\n },\n },\n },\n createSignaturePolicy: {\n type: \"string\",\n enum: [\"legacy\", \"v2-required\"],\n description:\n \"What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.\",\n default: \"v2-required\",\n },\n unsupportedStoredDocuments: {\n type: \"string\",\n enum: [\"refuse\", \"read-only\"],\n description:\n \"What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.\",\n default: \"refuse\",\n },\n },\n },\n pwa: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.\",\n properties: {\n manifest: {\n type: \"object\",\n additionalProperties: false,\n description: \"Web-app-manifest field overrides.\",\n properties: {\n name: { type: \"string\" },\n short_name: { type: \"string\" },\n description: { type: \"string\" },\n theme_color: { type: \"string\" },\n background_color: { type: \"string\" },\n display: {\n type: \"string\",\n enum: [\"fullscreen\", \"standalone\", \"minimal-ui\", \"browser\"],\n },\n start_url: { type: \"string\" },\n scope: { type: \"string\" },\n icons: {\n type: \"array\",\n description:\n \"Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).\",\n items: pwaIconSchema,\n },\n file_handlers: {\n type: \"array\",\n description:\n \"File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"accept\"],\n properties: {\n accept: {\n type: \"object\",\n description:\n \"MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.\",\n additionalProperties: {\n type: \"array\",\n items: { type: \"string\", pattern: \"^\\\\.\" },\n },\n },\n icons: {\n type: \"array\",\n description: \"OS-level file-type icons.\",\n items: pwaIconSchema,\n },\n launch_type: {\n type: \"string\",\n enum: [\"single-client\", \"multiple-clients\"],\n },\n },\n },\n },\n launch_handler: {\n type: \"object\",\n additionalProperties: false,\n required: [\"client_mode\"],\n description:\n \"How the OS launches the app for handled files/links. Connect defaults to focus-existing.\",\n properties: {\n client_mode: {\n type: \"string\",\n enum: [\n \"auto\",\n \"focus-existing\",\n \"navigate-existing\",\n \"navigate-new\",\n ],\n },\n },\n },\n },\n },\n globPatterns: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra Workbox precache globs, unioned with the built-ins.\",\n },\n globIgnores: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra precache ignore globs, unioned with the built-ins.\",\n },\n maximumFileSizeToCacheInBytes: {\n type: \"number\",\n description:\n \"Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit.\",\n },\n runtimeCaching: {\n type: \"array\",\n description:\n \"Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"urlPattern\", \"handler\"],\n properties: {\n urlPattern: pwaUrlPatternSchema,\n handler: {\n type: \"string\",\n enum: [\n \"CacheFirst\",\n \"CacheOnly\",\n \"NetworkFirst\",\n \"NetworkOnly\",\n \"StaleWhileRevalidate\",\n ],\n },\n method: {\n type: \"string\",\n enum: [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"HEAD\", \"PATCH\"],\n },\n options: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n cacheName: { type: \"string\" },\n networkTimeoutSeconds: {\n type: \"number\",\n description:\n \"Seconds a NetworkFirst rule waits for the network before falling back to the cache.\",\n },\n expiration: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n maxEntries: { type: \"number\" },\n maxAgeSeconds: { type: \"number\" },\n },\n },\n cacheableResponse: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n statuses: { type: \"array\", items: { type: \"number\" } },\n headers: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n },\n navigateFallbackDenylist: {\n type: \"array\",\n description:\n \"Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.\",\n items: pwaUrlPatternSchema,\n },\n },\n },\n },\n} as const;\n","import { satisfies, validRange } from \"semver\";\n\nexport type SharedDep = { specifier: string; package: string };\n\n/**\n * The dependency set Connect and loaded packages share via the import map.\n * `@powerhousedao/connect` is deliberately absent: it is the Connect app\n * itself (no importable exports), so there is nothing to share.\n */\nexport const SHARED_DEPS: readonly SharedDep[] = [\n { specifier: \"document-model\", package: \"document-model\" },\n {\n specifier: \"@powerhousedao/document-engineering\",\n package: \"@powerhousedao/document-engineering\",\n },\n { specifier: \"@powerhousedao/shared\", package: \"@powerhousedao/shared\" },\n {\n specifier: \"@powerhousedao/shared/registry/urls\",\n package: \"@powerhousedao/shared\",\n },\n {\n specifier: \"@powerhousedao/design-system/connect\",\n package: \"@powerhousedao/design-system\",\n },\n {\n specifier: \"@powerhousedao/reactor-browser\",\n package: \"@powerhousedao/reactor-browser\",\n },\n // Connect already vendors zod (it is in DEFAULT_VENDOR_INCLUDE, so the\n // import map publishes an entry for it) and every generated project already\n // declares it as a peerDependency -- yet it was missing from this set, so\n // each package inlined a private copy anyway. It is the single biggest\n // dependency left in a minimal package.\n { specifier: \"zod\", package: \"zod\" },\n];\n\nexport const SHARED_DEP_SPECIFIERS: readonly string[] = SHARED_DEPS.map(\n (d) => d.specifier,\n);\n\n/**\n * The `@powerhousedao/shared` subpaths the production vendor bundles. The\n * bare root is deliberately absent: its type barrel references node-only\n * modules (`clis/`), which the current vite/rolldown cannot bundle for the\n * browser — vendoring the root fails the build (a pre-existing latent\n * issue). A package that imports the bare root is simply not shared; it\n * bundles its own copy.\n */\nexport const SHARED_SUBPATHS: readonly string[] = [\n \"connect\",\n \"document-model\",\n \"processors\",\n \"document-drive\",\n \"registry\",\n \"registry/urls\",\n \"registry/manifest-slim\",\n];\n\n/**\n * The specifiers a package build may safely externalize onto the host's\n * import map — i.e. the ones the vendor actually publishes an entry for.\n *\n * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as\n * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and\n * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).\n * Externalizing those would leave a bare specifier in the package's output\n * that nothing in the import map resolves, so the package would fail to load\n * at runtime instead of simply bundling its own copy.\n */\nexport const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[] = [\n ...new Set([\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n];\n\n/** Split a specifier into its package name and subpath (\"\" for a root). */\nexport function parseDepSpec(spec: string): { pkg: string; sub: string } {\n if (spec.startsWith(\"@\")) {\n const parts = spec.split(\"/\");\n return { pkg: parts.slice(0, 2).join(\"/\"), sub: parts.slice(2).join(\"/\") };\n }\n const i = spec.indexOf(\"/\");\n return i === -1\n ? { pkg: spec, sub: \"\" }\n : { pkg: spec.slice(0, i), sub: spec.slice(i + 1) };\n}\n\nfunction isSharedSpecifier(spec: string, specs: readonly string[]): boolean {\n return specs.some((s) => spec === s || spec.startsWith(s + \"/\"));\n}\n\n/**\n * Return the import/export specifiers in `source` that are a shared\n * specifier (or a subpath of one), sorted. Heuristic: only statement\n * positions are scanned (`from \"x\"`, `import \"x\"`, `import(\"x\")`;\n * `export … from \"x\"` is covered by the `from` pattern), so import-like\n * text inside comments or strings can be reported too. That errs toward\n * over-reporting, which is the safe direction for the advisory build\n * warning.\n */\nexport function findSharedImports(\n source: string,\n specs: readonly string[] = SHARED_DEP_SPECIFIERS,\n): string[] {\n const found = new Set<string>();\n const patterns = [\n /\\bfrom\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s*\\(\\s*[\"']([^\"'\\\\]+)[\"']\\s*\\)/g,\n ];\n for (const re of patterns) {\n for (const m of source.matchAll(re)) {\n const spec = m[1];\n if (isSharedSpecifier(spec, specs)) found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * Rewrite a package source for blob import in a worker context (import maps\n * don't apply there): shared specifiers become their mapped URLs, and\n * relative (`./`, `../`) specifiers become absolute against `sourceUrl`\n * (a blob URL has no directory to resolve against). `#` subpath imports are\n * deliberately left alone: they resolve via the package's own\n * `package.json` \"imports\" field, which the rewrite cannot reproduce.\n * Returns the input unchanged when nothing matched.\n */\nexport function rewritePackageSource(\n source: string,\n sourceUrl: string,\n imports: Record<string, string>,\n): string {\n if (!Object.keys(imports).length) return source;\n const base = new URL(sourceUrl);\n const map = (spec: string): string | null => {\n const mapped = imports[spec];\n if (mapped) return mapped;\n if (spec.startsWith(\"./\") || spec.startsWith(\"../\")) {\n return new URL(spec, base).href;\n }\n return null;\n };\n let out = source;\n // The quote character is captured and reused: a source that quotes its\n // specifiers with ' would otherwise never match the replacement and be\n // left un-rewritten — silently, since the specifier still maps.\n for (const re of [\n /\\bfrom\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s*\\(\\s*([\"'])([^\"'\\\\]+)\\1\\s*\\)/g,\n ]) {\n out = out.replace(re, (match, quote: string, spec: string) => {\n // The match contains the quoted specifier exactly once and the\n // captured group has no quotes/backslashes ([^\"'\\\\]), so a literal\n // replace is safe.\n const mapped = map(spec);\n return mapped\n ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`)\n : match;\n });\n }\n return out;\n}\n\nexport type SharedDepMismatch = {\n package: string;\n required: string;\n provided: string;\n};\n\nexport type PackageDeps = {\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n};\n\n/**\n * Compare a package's declared ranges against the host's version table.\n * `hostVersions` defines the checked set (only deps present in it are\n * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)\n * and unparseable ranges never mismatch.\n */\nexport function checkSharedDeps(\n pkgJson: PackageDeps,\n hostVersions: Record<string, string>,\n): SharedDepMismatch[] {\n const out: SharedDepMismatch[] = [];\n const entries = [\n ...Object.entries(pkgJson.dependencies ?? {}),\n ...Object.entries(pkgJson.peerDependencies ?? {}),\n ];\n for (const [dep, range] of entries) {\n const provided = hostVersions[dep];\n if (provided === undefined || typeof range !== \"string\") continue;\n if (range === \"*\" || /^[a-z]+:/i.test(range)) continue;\n if (!validRange(range)) continue;\n if (!satisfies(provided, range, { includePrerelease: true })) {\n out.push({ package: dep, required: range, provided });\n }\n }\n return out;\n}\n\nexport function formatSharedDepWarnings(\n mismatches: SharedDepMismatch[],\n): string[] {\n return mismatches.map(\n (m) =>\n `${m.package}: requires ${m.required}, Connect provides ${m.provided}`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,2BAA2B;;;;;;;ACNxC,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,CAC/C,WAAW,QAAQ;CAClB,IAAI,OAAO,QAAQ,WAAW,OAAO;CACrC,OAAO,QAAQ;AACjB,CAAC;;;;AASH,MAAM,iBAAiB,EAAE,OAAO;;;;;CAK9B,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKtC,sBAAsB,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAK1C,eAAe,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKnC,mBAAmB,EAAE,OAAO,CAAC,CAAC,SAAS;AACzC,CAAC;;;;;;;;;;AAeD,MAAM,kBAAkB,EAAE,OAAO;;;;;CAK/B,oBAAoB,EAAE,OAAO,CAAC,CAAC,QAAQ,SAAS;;;;CAKhD,wBAAwB,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9C,CAAC;;;;;;AAWD,MAAM,yBAAyB,EAAE,OAA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B,YAAY;EACV,KAAK,EAAE,MAAM,SAAS;EACtB,OAAO,EAAE,MAAM,SAAS;EACxB,MAAM,EAAE,MAAM,SAAS;EACvB,SAAS,EAAE,MAAM,SAAS;CAC5B;AACF;AAEA,MAAa,+BAA+B;CAC1C,MAAM;CACN,sBAAsB;CACtB,aACE;CACF,YAAY;EACV,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,SAAS;KACP,MAAM;KACN,aACE;IACJ;IACA,gBAAgB;KACd,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;IACJ;GACF;EACF;EACA,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;KAAO;KACvC,aACE;KACF,SAAS;IACX;IACA,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,kBAAkB;KAChB,MAAM;KACN,aACE;IACJ;GACF;EACF;EACA,IAAI;GACF,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY,EACV,kBAAkB;IAChB,MAAM;IACN,aACE;IACF,SAAS;GACX,EACF;EACF;EACA,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,iBAAiB;KACf,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;IACX;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,CAAC;KACV,OAAO,EACL,OAAO,CACL;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,KAAK;MAChB,YAAY;OACV,KAAK,EAAE,MAAM,SAAS;OACtB,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;MACnC;KACF,GACA;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,SAAS,IAAI;MACxB,YAAY;OACV,OAAO;QACL,OAAO;QACP,aACE;OACJ;OACA,IAAI;QACF,MAAM;QACN,aACE;OACJ;OACA,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,KAAK;QACH,MAAM;QACN,aACE;OACJ;MACF;KACF,CACF,EACF;IACF;IACA,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,4BAA4B;KACnD,aACE;IACJ;IACA,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;KACT;IACF;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,WAAW;KACT,MAAM;KACN,aACE;IACJ;IACA,gBAAgB;KACd,MAAM;KACN,aACE;IACJ;IACA,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,SAAS;OACP,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,wBAAwB;SACtB,MAAM;SACN,aACE;QACJ;QACA,iBAAiB;SACf,MAAM;SACN,aACE;QACJ;OACF;MACF;MACA,OAAO;OACL,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,OAAO;SACL,MAAM;SACN,aACE;QACJ;QACA,UAAU;SACR,MAAM;SACN,aAAa;QACf;QACA,SAAS;SACP,MAAM;SACN,aACE;SACF,OAAO,EAAE,MAAM,SAAS;QAC1B;OACF;MACF;KACF;IACF;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;KACF,SAAS;IACX;IACA,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;IACX;GACF;EACF;EACA,WAAW;GACT,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,QAAQ;KACN,MAAM;KACN,aACE;IACJ;IACA,eAAe;KACb,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,iBAAiB;KACf,MAAM;KACN,aAAa;KACb,SAAS;IACX;GACF;EACF;EACA,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,UAAU,CAAC,aAAa,eAAe;GACvC,aACE;GACF,YAAY;IACV,WAAW;KACT,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;KACF,SAAS;IACX;IACA,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;IACX;GACF;EACF;EACA,SAAS;GACP,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,cAAc;KACZ,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,mBAAmB;OACjB,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,iBAAiB;OACf,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,YAAY;OACV,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,gBAAgB;OACd,MAAM;OACN,aACE;OACF,SAAS;MACX;KACF;IACF;IACA,uBAAuB;KACrB,MAAM;KACN,MAAM,CAAC,UAAU,aAAa;KAC9B,aACE;KACF,SAAS;IACX;IACA,4BAA4B;KAC1B,MAAM;KACN,MAAM,CAAC,UA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CAAC;EAE7B,OAAO;CACT;CACA,IAAI,MAAM;CAIV,KAAK,MAAM,MAAM;EACf;EACA;EACA;CACF,GACE,MAAM,IAAI,QAAQ,KAAK,OAAO,OAAe,SAAiB;EAI5D,MAAM,SAAS,IAAI,IAAI;EACvB,OAAO,SACH,MAAM,QAAQ,GAAG,QAAQ,OAAO,SAAS,GAAG,QAAQ,SAAS,OAAO,IACpE;CACN,CAAC;CAEH,OAAO;AACT;;;;;;;AAmBA,SAAgB,gBACd,SACA,cACqB;CACrB,MAAM,MAA2B,CAAC;CAClC,MAAM,UAAU,CACd,GAAG,OAAO,QAAQ,QAAQ,gBAAgB,CAAC,CAAC,GAC5C,GAAG,OAAO,QAAQ,QAAQ,oBAAoB,CAAC,CAAC,CAClD;CACA,KAAK,MAAM,CAAC,KAAK,UAAU,SAAS;EAClC,MAAM,WAAW,aAAa;EAC9B,IAAI,aAAa,KAAA,KAAa,OAAO,UAAU,UAAU;EACzD,IAAI,UAAU,OAAO,YAAY,KAAK,KAAK,GAAG;EAC9C,IAAI,CAAC,WAAW,KAAK,GAAG;EACxB,IAAI,CAAC,UAAU,UAAU,OAAO,EAAE,mBAAmB,KAAK,CAAC,GACzD,IAAI,KAAK;GAAE,SAAS;GAAK,UAAU;GAAO;EAAS,CAAC;CAExD;CACA,OAAO;AACT;AAEA,SAAgB,wBACd,YACU;CACV,OAAO,WAAW,KACf,MACC,GAAG,EAAE,QAAQ,aAAa,EAAE,SAAS,qBAAqB,EAAE,UAChE;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"sourcesContent":["/**\n * The base a dynamic-base Connect build is compiled against. The build emits\n * this literal wherever a base-relative URL would go, and the serving layer\n * (the dynamic-base vite plugin at build time, the connect proxy at serve\n * time) rewrites it to the base the app is actually deployed under.\n *\n * It lives here, in the browser-safe shared package, rather than in\n * `@powerhousedao/builder-tools`, because both the node-only build toolchain\n * and Connect's own browser code need it. Importing builder-tools from app\n * code pulls the whole build toolchain (and its node-only `read-pkg`\n * dependency) into the browser graph.\n */\nexport const DYNAMIC_BASE_PLACEHOLDER = \"/__PH_DYNAMIC_BASE__/\";\n","import { z } from \"zod\";\n\n/**\n * Coerces string values to boolean.\n * Accepts: \"true\", \"false\", true, false\n */\nconst booleanString = z\n .union([z.boolean(), z.enum([\"true\", \"false\"])])\n .transform((val) => {\n if (typeof val === \"boolean\") return val;\n return val === \"true\";\n });\n\n// ============================================================================\n// Build-time Environment Variables\n// ============================================================================\n\n/**\n * Build-time configuration schema\n */\nconst buildEnvSchema = z.object({\n /**\n * Comma-separated list of package names to load\n * @example \"package1,package2\"\n */\n PH_PACKAGES: z.string().optional(),\n\n /**\n * Path to local package to load during development\n */\n PH_LOCAL_PACKAGE: z.string().optional(),\n\n /**\n * Sentry authentication token for uploading source maps\n */\n PH_SENTRY_AUTH_TOKEN: z.string().optional(),\n\n /**\n * Sentry organization slug\n */\n PH_SENTRY_ORG: z.string().optional(),\n\n /**\n * Sentry project slug\n */\n PH_SENTRY_PROJECT: z.string().optional(),\n});\n\n// ============================================================================\n// Application Configuration (build metadata only)\n// ============================================================================\n\n/**\n * Connect runtime values (anything in `PHConnectRuntimeConfig`) are NOT\n * settable from env vars. They live in `powerhouse.config.json` and are\n * overridden via `ph connect build --<field>` or `ph connect config\n * --<field>`.\n *\n * What stays env-driven below is non-runtime: build metadata, Sentry\n * credentials, analytics processor toggles, etc.\n */\nconst appConfigSchema = z.object({\n /**\n * Application version number (build metadata stamp)\n * @default \"unknown\"\n */\n PH_CONNECT_VERSION: z.string().default(\"unknown\"),\n\n /**\n * CLI version number (build metadata stamp)\n */\n PH_CONNECT_CLI_VERSION: z.string().optional(),\n});\n\n// ============================================================================\n// Analytics Processor Configuration\n// ============================================================================\n\n/**\n * Analytics processor configuration schema. These are non-runtime feature\n * toggles for the analytics subsystem — they don't live in the runtime\n * schema and stay env-driven.\n */\nconst processorsConfigSchema = z.object({\n /**\n * Enable diff analytics tracking\n * @default false\n */\n PH_CONNECT_DIFF_ANALYTICS_ENABLED: booleanString.default(false),\n\n /**\n * Enable drive analytics tracking\n * @default true\n */\n PH_CONNECT_DRIVE_ANALYTICS_ENABLED: booleanString.default(true),\n\n /**\n * Enable external analytics processors\n * @default true\n */\n PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED: booleanString.default(true),\n});\n\n// ============================================================================\n// OpenPanel Configuration\n// ============================================================================\n\n/**\n * OpenPanel analytics configuration schema\n */\nconst openPanelConfigSchema = z.object({\n /**\n * OpenPanel client ID. When unset, the OpenPanel subsystem is a no-op.\n */\n PH_CONNECT_OPENPANEL_CLIENT_ID: z.string().optional(),\n\n /**\n * OpenPanel API URL override. Defaults to the OpenPanel cloud when unset.\n */\n PH_CONNECT_OPENPANEL_API_URL: z.string().optional(),\n\n /**\n * Track UI events via the useOpenPanel() hook\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: booleanString.default(true),\n\n /**\n * Track document operations via the OpenPanel processor\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: booleanString.default(true),\n});\n\n// ============================================================================\n// Combined Schemas\n// ============================================================================\n\n/**\n * Complete runtime environment schema (all PH_CONNECT_* vars). Only\n * build-metadata + analytics-processor toggles live here; all Connect\n * runtime config lives in `powerhouse.config.json`.\n */\nexport const runtimeEnvSchema = appConfigSchema\n .extend(processorsConfigSchema.shape)\n .extend(openPanelConfigSchema.shape);\n\n/**\n * Complete environment schema (build + runtime)\n */\nexport const connectEnvSchema = buildEnvSchema.extend(runtimeEnvSchema.shape);\n\n/**\n * Inferred TypeScript types from schemas\n */\nexport type ConnectBuildEnv = z.infer<typeof buildEnvSchema>;\nexport type ConnectRuntimeEnv = z.infer<typeof runtimeEnvSchema>;\nexport type ConnectEnv = z.infer<typeof connectEnvSchema>;\n\n// ============================================================================\n// Environment Loading Functions\n// ============================================================================\n\n/**\n * Options for loading environment variables\n */\nexport interface LoadEnvOptions {\n /**\n * Environment variables from process.env (highest priority)\n */\n processEnv?: Record<string, string | undefined>;\n /**\n * Environment variables from .env file (lowest priority)\n */\n fileEnv?: Record<string, string | undefined>;\n}\n\n/**\n * Internal helper to merge environment sources with priority.\n * Validates each value and falls back to next priority if invalid.\n */\nfunction mergeEnvSources(\n options: LoadEnvOptions,\n keys: Set<string>,\n schema: z.ZodObject<Record<string, z.ZodTypeAny>>,\n): Record<string, unknown> {\n const { processEnv = {}, fileEnv = {} } = options;\n const merged: Record<string, unknown> = {};\n\n // Apply priority: fileEnv < processEnv\n for (const key of keys) {\n const sources = [\n { name: \"process.env\", value: processEnv[key] },\n { name: \"fileEnv\", value: fileEnv[key] },\n ];\n\n // Try each source in priority order\n for (const source of sources) {\n const value = source.value;\n if (value === undefined || value === \"\") continue;\n\n // Try to validate just this field\n try {\n const fieldSchema = schema.shape[key];\n if (fieldSchema) {\n fieldSchema.parse(value);\n merged[key] = value;\n break; // Successfully validated, use this value\n }\n // No schema for this key, accept it\n console.warn(`Unknown environment variable: '${key}'`);\n merged[key] = value;\n break;\n } catch {\n // Validation failed, log warning and try next source\n const valueStr =\n value === null\n ? \"null\"\n : typeof value === \"object\"\n ? JSON.stringify(value)\n : (value as string);\n console.warn(\n `Invalid value for ${key} from ${source.name}: ${valueStr}. Trying next source.`,\n );\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Loads and validates environment variables with priority:\n * 1. process.env (highest)\n * 2. fileEnv\n * 3. defaults from schema (lowest)\n *\n * @param options - Environment sources in priority order\n * @returns Validated and typed environment configuration\n */\nexport function loadConnectEnv(options: LoadEnvOptions = {}): ConnectEnv {\n const allKeys = new Set([\n ...Object.keys(buildEnvSchema.shape),\n ...Object.keys(runtimeEnvSchema.shape),\n ]);\n\n const merged = mergeEnvSources(options, allKeys, connectEnvSchema);\n return connectEnvSchema.parse(merged);\n}\n\n/**\n * Loads only runtime environment variables (build metadata + Sentry +\n * analytics-processor toggles — everything in the Connect runtime schema\n * is sourced from powerhouse.config.json, not env).\n *\n * @param options - Environment sources in priority order\n * @returns Validated runtime environment configuration\n */\nexport function loadRuntimeEnv(\n options: LoadEnvOptions = {},\n): ConnectRuntimeEnv {\n const allKeys = new Set(Object.keys(runtimeEnvSchema.shape));\n const merged = mergeEnvSources(options, allKeys, runtimeEnvSchema);\n return runtimeEnvSchema.parse(merged);\n}\n\n/**\n * Safely sets Connect environment variables with validation.\n * Invalid values will log a warning and be skipped.\n *\n * @param values - Type-safe object with key-value pairs to set\n *\n * @example\n * ```ts\n * setConnectEnv({\n * PH_CONNECT_VERSION: \"1.2.3\",\n * PH_CONNECT_SENTRY_DSN: \"https://…\",\n * });\n * ```\n */\nexport function setConnectEnv(values: Partial<ConnectEnv>): void {\n for (const [key, value] of Object.entries(values)) {\n // Check if key exists in schema\n const fieldSchema =\n connectEnvSchema.shape[key as keyof typeof connectEnvSchema.shape];\n\n if (!fieldSchema) {\n console.warn(\n `Unknown environment variable: ${key}. Variable not set. Valid keys: ${Object.keys(connectEnvSchema.shape).join(\", \")}`,\n );\n continue;\n }\n\n try {\n // Validate the value\n fieldSchema.parse(value);\n\n // Set the value (convert to string for process.env compatibility)\n process.env[key] = String(value);\n } catch (error) {\n console.warn(\n `Invalid value for ${key}: ${String(value)}. Validation failed.`,\n error,\n );\n }\n }\n}\n\n/**\n * Normalizes a base path to ensure it:\n * - Starts with a forward slash (/)\n * - Ends with a forward slash (/)\n * - Has no relative path prefix (.)\n *\n * @param basePath - The base path to normalize\n * @returns The normalized base path\n *\n * @example\n * normalizeBasePath('/app') // '/app/'\n * normalizeBasePath('./app/') // '/app/'\n * normalizeBasePath('app') // '/app/'\n * normalizeBasePath('/') // '/'\n * normalizeBasePath('') // '/'\n */\nexport function normalizeBasePath(basePath: string): string {\n if (!basePath) {\n return \"/\";\n }\n\n let normalized = basePath;\n\n // Remove relative path prefix\n if (normalized.startsWith(\".\")) {\n normalized = normalized.slice(1);\n }\n\n // Ensure it starts with a forward slash\n if (!normalized.startsWith(\"/\")) {\n normalized = `/${normalized}`;\n }\n\n // Ensure it ends with a forward slash\n if (!normalized.endsWith(\"/\")) {\n normalized = `${normalized}/`;\n }\n\n return normalized;\n}\n\n/**\n * Base storage namespace for a Connect instance served at the root of an\n * origin. Kept as a literal so root deployments resolve to a byte-identical\n * value with no migration.\n */\nexport const ROOT_STORAGE_NAMESPACE = \"reactor\";\n\n/**\n * Derives the origin-scoped storage namespace from a Connect base path.\n *\n * Connect instances served under different path prefixes of the same origin\n * (e.g. behind a reverse proxy) otherwise share all origin-scoped browser\n * storage (PGlite data dirs, IndexedDB). This produces a deterministic,\n * collision-free namespace per distinct prefix that is valid as an\n * IndexedDB database name.\n *\n * - root base path (\"/\" or unset) -> \"reactor\" (byte-identical to the legacy\n * key, so existing root deployments keep their data with zero migration)\n * - any non-root base path -> \"reactor--<slug>\", e.g.\n * \"/reactor-project/vetra-studio/\" -> \"reactor--reactor-project-vetra-studio\"\n *\n * @param basePath - The Connect base path (env.PH_CONNECT_BASE_PATH ||\n * import.meta.env.BASE_URL); normalized internally.\n * @returns The storage namespace.\n *\n * @example\n * getStorageNamespace('/') // 'reactor'\n * getStorageNamespace('/reactor-project/vetra-studio/') // 'reactor--reactor-project-vetra-studio'\n */\nexport function getStorageNamespace(basePath: string): string {\n const normalized = normalizeBasePath(basePath);\n if (normalized === \"/\") {\n return ROOT_STORAGE_NAMESPACE;\n }\n const slug = normalized\n .slice(1, -1)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n // A non-root base path whose slug normalizes to nothing (e.g. \"/-/\") must\n // not collapse into the root namespace and share its storage.\n return `${ROOT_STORAGE_NAMESPACE}--${slug || \"default\"}`;\n}\n","// Merging of Connect PWA override fragments.\n//\n// PWA config comes from several layers — Connect's hardcoded defaults, each\n// build-time-known package's `pwa` fragment, and the project's `connect.pwa`\n// block. A naive deep-merge is wrong here: runtime-caching rules and precache\n// globs are ADDITIVE (a later layer must not drop an earlier layer's offline\n// coverage), and the precache size ceiling must be the MAX so no contributor\n// can silently shrink another's limit. This module encodes those per-field\n// strategies: `mergePwaConfig(contributions)` folds an ordered list of\n// serialisable `PHConnectPwa` fragments (lowest precedence first) into one\n// effective fragment, warning when multiple packages set the same manifest\n// scalar to different values.\n//\n// Laying the effective fragment over Connect's hardcoded VitePWA base happens\n// in builder-tools (`connect-utils/vite-plugins/pwa-overrides.ts`), where\n// vite-plugin-pwa's manifest types are available.\n\nimport type {\n PHConnectPwa,\n PHConnectPwaManifest,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\nimport { deepMerge } from \"./config-loader.js\";\n\n// Re-exported so the PWA override types are reachable from the same\n// `@powerhousedao/shared/connect` entry as the merge helpers that consume them.\nexport type {\n PHConnectPwa,\n PHConnectPwaCacheStrategy,\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n PHConnectPwaRuntimeCaching,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\n\n/** A labelled PWA fragment, so merge diagnostics can name the contributor. */\nexport type PwaContribution = {\n /** Human-readable origin (package name, or the project config file). */\n source: string;\n config: PHConnectPwa;\n};\n\n// Manifest scalar fields — the ones where \"two layers set it\" is a genuine\n// conflict (as opposed to the additive arrays, which never conflict).\nconst MANIFEST_SCALAR_KEYS: readonly (keyof PHConnectPwaManifest)[] = [\n \"name\",\n \"short_name\",\n \"description\",\n \"theme_color\",\n \"background_color\",\n \"display\",\n \"start_url\",\n \"scope\",\n \"launch_handler\",\n];\n\n// Manifest fields merged additively (concatenated/unioned across every layer),\n// never as scalar conflicts. Kept out of the deepMerge path, which replaces\n// arrays wholesale and would drop earlier contributions. `categories` is\n// derived (from the manifest `category` field) but merges the same additive way.\nconst ADDITIVE_MANIFEST_KEYS = new Set<keyof PHConnectPwaManifest>([\n \"icons\",\n \"file_handlers\",\n \"categories\",\n]);\n\n// Structural icon shape shared by PHConnectPwaIcon and vite-plugin-pwa's\n// IconResource (whose `purpose` may also be an array of purposes).\ntype IconLike = {\n src: string;\n sizes?: string;\n purpose?: string | readonly string[];\n};\n\nfunction iconKey(icon: IconLike): string {\n const purpose =\n typeof icon.purpose === \"string\"\n ? icon.purpose\n : (icon.purpose?.join(\",\") ?? \"\");\n return `${icon.src}|${icon.sizes ?? \"\"}|${purpose}`;\n}\n\n/** Concatenate, keeping the first occurrence per `key`. */\nfunction dedupeBy<T>(items: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const item of items) {\n const k = key(item);\n if (seen.has(k)) continue;\n seen.add(k);\n result.push(item);\n }\n return result;\n}\n\n/** Concatenate icons, keeping the first occurrence of each (src,sizes,purpose). */\nexport function dedupeIcons<T extends IconLike>(icons: T[]): T[] {\n return dedupeBy(icons, iconKey);\n}\n\n/** `JSON.stringify` with object keys sorted recursively, so two structurally\n * equal values always serialise identically (accept-map key order etc.). */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`);\n return `{${entries.join(\",\")}}`;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Concatenate file handlers, keeping the first occurrence of each entry.\n * Deduped on the WHOLE entry (canonical JSON) rather than any single field:\n * every handler shares Connect's fixed action, and two handlers accepting\n * different file types are both real contributions — only the exact same\n * fragment arriving via two layers is a duplicate. Structural, so it also\n * works on the vite-plugin-pwa handler shape in builder-tools.\n */\nexport function dedupeFileHandlers<T extends object>(handlers: T[]): T[] {\n return dedupeBy(handlers, stableStringify);\n}\n\n/** Fold a manifest's top-level `category` string into a PWA config as a\n * `categories: [category]` entry. PWA `categories` is DERIVED from the\n * `category` field of every contributing `powerhouse.manifest.json` (never\n * authored under `pwa`); `mergePwaConfig`/`mergeManifest` then union them\n * across contributors. No-op when there is no usable category. */\nexport function withInferredCategory(\n config: PHConnectPwa,\n category: unknown,\n): PHConnectPwa {\n if (typeof category !== \"string\" || !category) return config;\n return {\n ...config,\n manifest: { ...config.manifest, categories: [category] },\n };\n}\n\n/** Order-preserving string union (used for the precache glob lists). */\nexport function unionStrings(\n base: string[] | undefined,\n extra: string[],\n): string[] {\n const result = [...(base ?? [])];\n for (const item of extra) if (!result.includes(item)) result.push(item);\n return result;\n}\n\nfunction patternKey(pattern: PHConnectPwaUrlPattern): string {\n return typeof pattern === \"string\"\n ? `s:${pattern}`\n : `r:${pattern.source}:${pattern.flags ?? \"\"}`;\n}\n\nfunction unionPatterns(\n base: PHConnectPwaUrlPattern[] | undefined,\n extra: PHConnectPwaUrlPattern[],\n): PHConnectPwaUrlPattern[] {\n const result = [...(base ?? [])];\n const seen = new Set(result.map(patternKey));\n for (const pattern of extra) {\n const key = patternKey(pattern);\n if (seen.has(key)) continue;\n seen.add(key);\n result.push(pattern);\n }\n return result;\n}\n\n/** Merge one fragment into `target` in place, applying the per-field\n * strategies (manifest scalars deep-merge and win; icons/file_handlers/globs/\n * rules/denylist are additive; size ceiling takes the max). */\nfunction mergeInto(target: PHConnectPwa, config: PHConnectPwa): void {\n if (config.manifest) {\n // The additive arrays are pulled out of the deepMerge path: deepMerge\n // replaces arrays wholesale, which would drop earlier contributions.\n const { icons, file_handlers, categories, ...scalars } = config.manifest;\n if (Object.keys(scalars).length > 0) {\n target.manifest = deepMerge(\n target.manifest ?? {},\n scalars as PHConnectPwaManifest,\n );\n }\n if (icons?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n icons: dedupeIcons([...(target.manifest?.icons ?? []), ...icons]),\n };\n }\n if (file_handlers?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n file_handlers: dedupeFileHandlers([\n ...(target.manifest?.file_handlers ?? []),\n ...file_handlers,\n ]),\n };\n }\n if (categories?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n categories: unionStrings(target.manifest?.categories, categories),\n };\n }\n }\n if (config.globPatterns?.length) {\n target.globPatterns = unionStrings(\n target.globPatterns,\n config.globPatterns,\n );\n }\n if (config.globIgnores?.length) {\n target.globIgnores = unionStrings(target.globIgnores, config.globIgnores);\n }\n if (config.runtimeCaching?.length) {\n target.runtimeCaching = [\n ...(target.runtimeCaching ?? []),\n ...config.runtimeCaching,\n ];\n }\n if (config.navigateFallbackDenylist?.length) {\n target.navigateFallbackDenylist = unionPatterns(\n target.navigateFallbackDenylist,\n config.navigateFallbackDenylist,\n );\n }\n if (typeof config.maximumFileSizeToCacheInBytes === \"number\") {\n target.maximumFileSizeToCacheInBytes = Math.max(\n target.maximumFileSizeToCacheInBytes ?? 0,\n config.maximumFileSizeToCacheInBytes,\n );\n }\n}\n\n/**\n * Fold the build-time-known package PWA fragments and the project's\n * `connect.pwa` block into one effective fragment. Precedence is\n * `packageContributions (in order) < projectConfig` — the project config wins\n * scalar fields, while arrays (`icons`, globs, `runtimeCaching`,\n * `navigateFallbackDenylist`) are additive across every layer and the size\n * ceiling takes the max.\n *\n * `onWarn` fires when two or more PACKAGES set the same manifest scalar to\n * different values and the project config doesn't settle it — the winner is\n * otherwise decided silently by package load order. The operator resolves it\n * by setting that field in `connect.pwa`, which both wins and silences the\n * warning.\n */\nexport function mergePwaConfig(\n packageContributions: PwaContribution[],\n projectConfig?: PHConnectPwa,\n onWarn: (message: string) => void = () => {},\n): PHConnectPwa {\n const merged: PHConnectPwa = {};\n // Which packages set each manifest scalar, and to what (for the conflict\n // warning). The project config is deliberately excluded — it is the\n // authority, not a conflicting sibling.\n const packageScalarSetters: Partial<\n Record<string, { source: string; value: unknown }[]>\n > = {};\n\n for (const { source, config } of packageContributions) {\n mergeInto(merged, config);\n for (const [key, value] of Object.entries(config.manifest ?? {})) {\n if (ADDITIVE_MANIFEST_KEYS.has(key as keyof PHConnectPwaManifest)) {\n continue;\n }\n (packageScalarSetters[key] ??= []).push({ source, value });\n }\n }\n if (projectConfig) mergeInto(merged, projectConfig);\n\n const projectManifest = projectConfig?.manifest ?? {};\n for (const key of MANIFEST_SCALAR_KEYS) {\n const setters = packageScalarSetters[key];\n const projectSettles = projectManifest[key] !== undefined;\n if (!setters || setters.length < 2 || projectSettles) continue;\n // Same value from every package is agreement, not a conflict. Compared\n // via stableStringify, not by identity — launch_handler is object-valued,\n // and two packages sending equal objects (in any key order) must not read\n // as a conflict.\n const distinctValues = new Set(\n setters.map((s) => stableStringify(s.value)),\n );\n if (distinctValues.size < 2) continue;\n const sources = setters.map((s) => s.source);\n onWarn(\n `PWA config: manifest.${key} set by multiple packages (${sources.join(\n \", \",\n )}); '${sources[sources.length - 1]}' wins by load order. Set connect.pwa.manifest.${key} in the project config to make the winner explicit.`,\n );\n }\n\n return merged;\n}\n\n/** A serialisable URL pattern as Workbox consumes it: strings pass through\n * verbatim, `{ source, flags }` is rebuilt into a RegExp. */\nexport function toRegExpOrString(\n pattern: PHConnectPwaUrlPattern,\n): string | RegExp {\n return typeof pattern === \"string\"\n ? pattern\n : new RegExp(pattern.source, pattern.flags);\n}\n","// Building the effective web-app manifest from a base manifest plus a\n// `PHConnectPwaManifest` fragment. Pure JSON in / JSON out — no PWA-toolchain\n// or DOM dependency — so the SAME code path runs at build time (laying the\n// effective build-merged fragment over Connect's hardcoded base, see\n// applyPwaOverrides) and at runtime inside the service worker (laying a\n// dynamically-installed package's fragment over the build-embedded base to\n// serve the live manifest).\n//\n// Connect owns the \"where\" of every OS integration: file handlers open at the\n// app root, `web+…` protocol links and shared files route through fixed\n// in-scope endpoints. Contributors declare only WHAT they accept; the routes\n// below are injected here so a package can never point the OS at an arbitrary\n// URL. Injection is idempotent, so re-merging a manifest that already carries\n// the routes is a no-op.\n\nimport type {\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n} from \"../clis/types.js\";\nimport { dedupeFileHandlers, dedupeIcons, unionStrings } from \"./pwa-config.js\";\n\n/**\n * The one route launched files open at, shared by the built-in handler and\n * injected into every contributed one. Not configurable: consuming launched\n * files takes runtime code that lives in Connect itself, and a relative \".\"\n * resolves against the manifest URL so it tracks any deploy base (the\n * webmanifest is served dynamically and never rewritten by the dynamic-base\n * plugin) — same trick as the base start_url/scope.\n */\nexport const PWA_FILE_HANDLER_ACTION = \".\";\n\n// IndexedDB schema for the page->service-worker PWA-fragment mirror. A SW can't\n// read localStorage (where the installed-package list lives), so the SPA\n// mirrors the merged fragment here and the SW reads it to serve a live\n// manifest. Both sides MUST agree, so the schema lives here as the single\n// source of truth (the SPA writer and the SW reader both import these) —\n// a rename or version bump can no longer desync one side silently.\nexport const PWA_IDB_NAME = \"ph-pwa\";\nexport const PWA_IDB_STORE = \"fragments\";\nexport const PWA_IDB_KEY = \"merged\";\nexport const PWA_IDB_VERSION = 1;\n\n/** The subset of a web-app manifest this module reads/writes, plus an index\n * signature so untouched fields (name, theme_color, launch_handler, …) pass\n * through verbatim. */\nexport interface PwaWebManifest {\n icons?: PHConnectPwaIcon[];\n file_handlers?: (PHConnectPwaFileHandler & { action?: string })[];\n categories?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Lay a `PHConnectPwaManifest` fragment over a base web-manifest object.\n *\n * - **scalars** (name, theme_color, launch_handler, …): governed by\n * `scalarPolicy`. `\"fragment-wins\"` lets the fragment overwrite the base;\n * `\"base-wins\"` keeps the base and only fills fields it left unset. Keys\n * listed in `protectedScalars` always behave as base-wins even under a\n * fragment-wins policy — used at runtime to fragment-win cosmetic scalars\n * while still protecting navigation-critical ones (`start_url`/`scope`) from\n * an untrusted dynamically-installed package.\n * - **arrays** (icons, file_handlers): always additive, base entries first,\n * de-duplicated — so a package can extend but never displace a built-in\n * (Chromium is first-registered-wins per file extension, so `.phd`/`.phdm`\n * stay Connect's).\n * - **categories**: order-preserving string union (derived from the manifest\n * `category` field, not authored under `pwa`).\n *\n * The Connect-owned file-handler action is injected idempotently.\n */\nexport function mergeManifest(\n base: PwaWebManifest,\n fragment: PHConnectPwaManifest | undefined,\n opts?: {\n scalarPolicy?: \"base-wins\" | \"fragment-wins\";\n protectedScalars?: readonly string[];\n },\n): PwaWebManifest {\n const scalarPolicy = opts?.scalarPolicy ?? \"base-wins\";\n const protectedScalars = opts?.protectedScalars ?? [];\n const result: PwaWebManifest = { ...base };\n const { icons, file_handlers, categories, ...scalars } = fragment ?? {};\n\n const takeScalar = (key: string): boolean => {\n // Protected keys stay base-wins regardless of the policy.\n const policy = protectedScalars.includes(key) ? \"base-wins\" : scalarPolicy;\n return policy === \"fragment-wins\" || result[key] === undefined;\n };\n\n for (const [key, value] of Object.entries(scalars)) {\n if (takeScalar(key)) result[key] = value;\n }\n\n if (icons?.length) {\n result.icons = dedupeIcons([...(result.icons ?? []), ...icons]);\n }\n if (file_handlers?.length) {\n // Force the Connect-owned action (spread first, action last) so contributed\n // handlers match the base's already-injected shape and de-dupe correctly.\n const injected = file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n result.file_handlers = dedupeFileHandlers([\n ...(result.file_handlers ?? []),\n ...injected,\n ]);\n }\n if (categories?.length) {\n result.categories = unionStrings(result.categories, categories);\n }\n\n // Idempotently (re-)assert the Connect-owned file-handler action across the\n // merged result, covering both fragment contributions and any base entries.\n if (result.file_handlers?.length) {\n result.file_handlers = result.file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n }\n\n return result;\n}\n","// Single source of truth for JSON Schema shapes shared between the source\n// PowerhouseConfig schema (packages/shared/clis/source-config-schema.ts) and\n// the runtime RuntimePowerhouseConfig schema\n// (packages/builder-tools/connect-utils/runtime-config-schema.ts).\n//\n// When a shared shape changes, edit it here — both schemas pick it up.\n\nexport const powerhousePackageSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"packageName\"],\n properties: {\n packageName: {\n type: \"string\",\n description: \"Fully qualified npm package name (e.g. @scope/name).\",\n },\n version: {\n type: \"string\",\n description: \"Exact version (registry providers) or omit to take latest.\",\n },\n provider: {\n type: \"string\",\n enum: [\"npm\", \"github\", \"local\", \"registry\"],\n description: \"Where Connect should resolve the package from at runtime.\",\n },\n url: {\n type: \"string\",\n description:\n \"Override URL for non-registry providers (e.g. github tarball).\",\n },\n },\n} as const;\n\n// Reusable shape for `connect.drives.sections.{remote,local}` — three\n// affirmative-named toggles per section. The legacy public+cloud sections\n// have been collapsed into a single `remote`.\nconst driveSectionSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Visibility and add/delete affordances for a drive section in the sidebar.\",\n properties: {\n enabled: {\n type: \"boolean\",\n description: \"When false, the section is hidden in the sidebar.\",\n default: true,\n },\n allowAdd: {\n type: \"boolean\",\n description:\n \"When false, the section's 'add drive' affordance is hidden.\",\n default: true,\n },\n allowDelete: {\n type: \"boolean\",\n description:\n \"When false, drives in this section cannot be deleted from the UI.\",\n default: true,\n },\n },\n} as const;\n\n// Reusable shape for a runtime-caching / denylist URL match. A string is\n// handed to Workbox verbatim; `{ source, flags }` is rebuilt into a RegExp at\n// build time. Function patterns aren't serialisable and can't be expressed\n// from config — only Connect's built-in rules use them (see the runtime-caching\n// rules in builder-tools' connect-utils/service-worker/service-worker.ts).\nconst pwaUrlPatternSchema = {\n description:\n \"URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.\",\n oneOf: [\n { type: \"string\" },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"source\"],\n properties: {\n source: { type: \"string\", description: \"RegExp source.\" },\n flags: { type: \"string\", description: \"RegExp flags (e.g. 'i').\" },\n },\n },\n ],\n} as const;\n\n// Reusable web-app-manifest icon shape (manifest.icons and file-handler icons).\nconst pwaIconSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"src\"],\n properties: {\n src: { type: \"string\" },\n sizes: { type: \"string\" },\n type: { type: \"string\" },\n purpose: { type: \"string\" },\n },\n} as const;\n\nexport const phConnectRuntimeConfigSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.\",\n properties: {\n branding: {\n type: \"object\",\n additionalProperties: false,\n description: \"App identity and visual branding.\",\n properties: {\n appName: {\n type: \"string\",\n description:\n \"Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'.\",\n },\n homeBackground: {\n type: [\"string\", \"null\"],\n description:\n \"Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.\",\n },\n },\n },\n app: {\n type: \"object\",\n additionalProperties: false,\n description: \"Top-level Connect application behaviour.\",\n properties: {\n logLevel: {\n type: \"string\",\n enum: [\"debug\", \"info\", \"warn\", \"error\"],\n description:\n \"Log level applied by Connect's logger at boot. Affects browser-side output only.\",\n default: \"info\",\n },\n basePath: {\n type: \"string\",\n description:\n \"Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.\",\n default: \"/\",\n },\n offline: {\n type: \"boolean\",\n description:\n \"When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.\",\n default: true,\n },\n studioMode: {\n type: \"boolean\",\n description:\n \"Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.\",\n default: false,\n },\n workflowsEnabled: {\n type: \"boolean\",\n description:\n \"Powerhouse workflows in Connect. When true the tab loads the @powerhousedao/workflow package (workflow + connection documents, their editors and Workflow Studio) and the reactor worker registers its document models. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set.\",\n },\n },\n },\n ai: {\n type: \"object\",\n additionalProperties: false,\n description: \"AI assistant (chat) behaviour.\",\n properties: {\n assistantEnabled: {\n type: \"boolean\",\n description:\n \"When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.\",\n default: false,\n },\n },\n },\n packages: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).\",\n properties: {\n externalEnabled: {\n type: \"boolean\",\n description:\n \"When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.\",\n default: true,\n },\n liveReload: {\n type: \"boolean\",\n description:\n \"When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).\",\n default: false,\n },\n },\n },\n drives: {\n type: \"object\",\n additionalProperties: false,\n description: \"Default-drive and add-drive UI behaviour.\",\n properties: {\n allowAddDrive: {\n type: \"boolean\",\n description:\n \"When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.\",\n default: true,\n },\n defaultDrives: {\n type: \"array\",\n description:\n \"Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).\",\n default: [],\n items: {\n oneOf: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"url\"],\n properties: {\n url: { type: \"string\" },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n },\n },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"local\", \"id\"],\n properties: {\n local: {\n const: true,\n description:\n \"Discriminator: this entry is a local drive created on first boot.\",\n },\n id: {\n type: \"string\",\n description:\n \"Stable drive id. The drive is created with this id on first boot and is not re-created on later boots.\",\n },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n app: {\n type: \"string\",\n description:\n \"Drive app (preferred editor) to open on the drive.\",\n },\n },\n },\n ],\n },\n },\n preserveStrategy: {\n type: \"string\",\n enum: [\"preserve-all\", \"preserve-by-url-and-detach\"],\n description:\n \"Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.\",\n },\n sections: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.\",\n properties: {\n remote: driveSectionSchema,\n local: driveSectionSchema,\n },\n },\n },\n },\n renown: {\n type: \"object\",\n additionalProperties: false,\n description: \"Renown identity / authentication coordinates.\",\n properties: {\n url: {\n type: \"string\",\n description: \"Renown auth service URL.\",\n default: \"https://www.renown.id\",\n },\n networkId: {\n type: \"string\",\n description: \"CAIP-2 network namespace (e.g. 'eip155').\",\n default: \"eip155\",\n },\n chainId: {\n type: \"number\",\n description: \"CAIP-2 chain reference within the network namespace.\",\n default: 1,\n },\n namespace: {\n type: \"string\",\n description:\n \"Renown localStorage namespace; share it across Connects to share login.\",\n },\n switchboardUrl: {\n type: \"string\",\n description:\n \"Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`.\",\n },\n adapters: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.\",\n properties: {\n rainbow: {\n type: \"object\",\n additionalProperties: false,\n description: \"wagmi + RainbowKit external-wallet adapter config.\",\n properties: {\n walletConnectProjectId: {\n type: \"string\",\n description:\n \"WalletConnect project id; required for this adapter to function.\",\n },\n infuraProjectId: {\n type: \"string\",\n description:\n \"Optional Infura project id used to build RPC transports.\",\n },\n },\n },\n privy: {\n type: \"object\",\n additionalProperties: false,\n description: \"Privy embedded/social adapter config.\",\n properties: {\n appId: {\n type: \"string\",\n description:\n \"Privy application id; required for this adapter to function.\",\n },\n clientId: {\n type: \"string\",\n description: \"Optional Privy client id.\",\n },\n methods: {\n type: \"array\",\n description:\n \"Login methods this adapter offers; default per adapter when omitted.\",\n items: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n sentry: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.\",\n properties: {\n dsn: {\n type: [\"string\", \"null\"],\n description:\n \"Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.\",\n default: null,\n },\n env: {\n type: \"string\",\n description:\n \"Sentry environment label, surfaced as the `environment` tag on every event.\",\n default: \"dev\",\n },\n tracing: {\n type: \"boolean\",\n description: \"Enable Sentry performance tracing.\",\n default: false,\n },\n },\n },\n openPanel: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.\",\n properties: {\n clientId: {\n type: \"string\",\n description:\n \"OpenPanel client id. Empty string disables OpenPanel entirely.\",\n default: \"\",\n },\n apiUrl: {\n type: \"string\",\n description:\n \"OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API.\",\n },\n trackUiEvents: {\n type: \"boolean\",\n description: \"Track UI events.\",\n default: true,\n },\n trackOperations: {\n type: \"boolean\",\n description: \"Track document operations.\",\n default: true,\n },\n },\n },\n instance: {\n type: \"object\",\n additionalProperties: false,\n required: [\"namespace\", \"reactorWorker\"],\n description:\n \"Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.\",\n properties: {\n namespace: {\n type: [\"string\", \"null\"],\n description:\n \"Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.\",\n default: null,\n },\n reactorWorker: {\n type: \"boolean\",\n description:\n \"Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.\",\n default: false,\n },\n },\n },\n reactor: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.\",\n properties: {\n featureFlags: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.\",\n properties: {\n documentDecisions: {\n type: \"boolean\",\n description:\n \"Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.\",\n default: false,\n },\n authEnforcement: {\n type: \"boolean\",\n description:\n \"Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.\",\n default: false,\n },\n authGroups: {\n type: \"boolean\",\n description:\n \"Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.\",\n default: false,\n },\n authConditions: {\n type: \"boolean\",\n description:\n \"Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.\",\n default: false,\n },\n },\n },\n createSignaturePolicy: {\n type: \"string\",\n enum: [\"legacy\", \"v2-required\"],\n description:\n \"What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.\",\n default: \"v2-required\",\n },\n unsupportedStoredDocuments: {\n type: \"string\",\n enum: [\"refuse\", \"read-only\"],\n description:\n \"What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.\",\n default: \"refuse\",\n },\n },\n },\n pwa: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.\",\n properties: {\n manifest: {\n type: \"object\",\n additionalProperties: false,\n description: \"Web-app-manifest field overrides.\",\n properties: {\n name: { type: \"string\" },\n short_name: { type: \"string\" },\n description: { type: \"string\" },\n theme_color: { type: \"string\" },\n background_color: { type: \"string\" },\n display: {\n type: \"string\",\n enum: [\"fullscreen\", \"standalone\", \"minimal-ui\", \"browser\"],\n },\n start_url: { type: \"string\" },\n scope: { type: \"string\" },\n icons: {\n type: \"array\",\n description:\n \"Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).\",\n items: pwaIconSchema,\n },\n file_handlers: {\n type: \"array\",\n description:\n \"File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"accept\"],\n properties: {\n accept: {\n type: \"object\",\n description:\n \"MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.\",\n additionalProperties: {\n type: \"array\",\n items: { type: \"string\", pattern: \"^\\\\.\" },\n },\n },\n icons: {\n type: \"array\",\n description: \"OS-level file-type icons.\",\n items: pwaIconSchema,\n },\n launch_type: {\n type: \"string\",\n enum: [\"single-client\", \"multiple-clients\"],\n },\n },\n },\n },\n launch_handler: {\n type: \"object\",\n additionalProperties: false,\n required: [\"client_mode\"],\n description:\n \"How the OS launches the app for handled files/links. Connect defaults to focus-existing.\",\n properties: {\n client_mode: {\n type: \"string\",\n enum: [\n \"auto\",\n \"focus-existing\",\n \"navigate-existing\",\n \"navigate-new\",\n ],\n },\n },\n },\n },\n },\n globPatterns: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra Workbox precache globs, unioned with the built-ins.\",\n },\n globIgnores: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra precache ignore globs, unioned with the built-ins.\",\n },\n maximumFileSizeToCacheInBytes: {\n type: \"number\",\n description:\n \"Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit.\",\n },\n runtimeCaching: {\n type: \"array\",\n description:\n \"Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"urlPattern\", \"handler\"],\n properties: {\n urlPattern: pwaUrlPatternSchema,\n handler: {\n type: \"string\",\n enum: [\n \"CacheFirst\",\n \"CacheOnly\",\n \"NetworkFirst\",\n \"NetworkOnly\",\n \"StaleWhileRevalidate\",\n ],\n },\n method: {\n type: \"string\",\n enum: [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"HEAD\", \"PATCH\"],\n },\n options: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n cacheName: { type: \"string\" },\n networkTimeoutSeconds: {\n type: \"number\",\n description:\n \"Seconds a NetworkFirst rule waits for the network before falling back to the cache.\",\n },\n expiration: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n maxEntries: { type: \"number\" },\n maxAgeSeconds: { type: \"number\" },\n },\n },\n cacheableResponse: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n statuses: { type: \"array\", items: { type: \"number\" } },\n headers: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n },\n navigateFallbackDenylist: {\n type: \"array\",\n description:\n \"Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.\",\n items: pwaUrlPatternSchema,\n },\n },\n },\n },\n} as const;\n","import { satisfies, validRange } from \"semver\";\n\nexport type SharedDep = { specifier: string; package: string };\n\n/**\n * The dependency set Connect and loaded packages share via the import map.\n * `@powerhousedao/connect` is deliberately absent: it is the Connect app\n * itself (no importable exports), so there is nothing to share.\n */\nexport const SHARED_DEPS: readonly SharedDep[] = [\n { specifier: \"document-model\", package: \"document-model\" },\n {\n specifier: \"@powerhousedao/document-engineering\",\n package: \"@powerhousedao/document-engineering\",\n },\n { specifier: \"@powerhousedao/shared\", package: \"@powerhousedao/shared\" },\n {\n specifier: \"@powerhousedao/shared/registry/urls\",\n package: \"@powerhousedao/shared\",\n },\n {\n specifier: \"@powerhousedao/design-system/connect\",\n package: \"@powerhousedao/design-system\",\n },\n {\n specifier: \"@powerhousedao/reactor-browser\",\n package: \"@powerhousedao/reactor-browser\",\n },\n // Connect already vendors zod (it is in DEFAULT_VENDOR_INCLUDE, so the\n // import map publishes an entry for it) and every generated project already\n // declares it as a peerDependency -- yet it was missing from this set, so\n // each package inlined a private copy anyway. It is the single biggest\n // dependency left in a minimal package.\n { specifier: \"zod\", package: \"zod\" },\n];\n\nexport const SHARED_DEP_SPECIFIERS: readonly string[] = SHARED_DEPS.map(\n (d) => d.specifier,\n);\n\n/**\n * The `@powerhousedao/shared` subpaths the production vendor bundles. The\n * bare root is deliberately absent: its type barrel references node-only\n * modules (`clis/`), which the current vite/rolldown cannot bundle for the\n * browser — vendoring the root fails the build (a pre-existing latent\n * issue). A package that imports the bare root is simply not shared; it\n * bundles its own copy.\n */\nexport const SHARED_SUBPATHS: readonly string[] = [\n \"connect\",\n \"document-model\",\n \"processors\",\n \"document-drive\",\n \"registry\",\n \"registry/urls\",\n \"registry/manifest-slim\",\n];\n\n/**\n * The specifiers a package build may safely externalize onto the host's\n * import map — i.e. the ones the vendor actually publishes an entry for.\n *\n * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as\n * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and\n * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).\n * Externalizing those would leave a bare specifier in the package's output\n * that nothing in the import map resolves, so the package would fail to load\n * at runtime instead of simply bundling its own copy.\n */\nexport const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[] = [\n ...new Set([\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n];\n\n/** Split a specifier into its package name and subpath (\"\" for a root). */\nexport function parseDepSpec(spec: string): { pkg: string; sub: string } {\n if (spec.startsWith(\"@\")) {\n const parts = spec.split(\"/\");\n return { pkg: parts.slice(0, 2).join(\"/\"), sub: parts.slice(2).join(\"/\") };\n }\n const i = spec.indexOf(\"/\");\n return i === -1\n ? { pkg: spec, sub: \"\" }\n : { pkg: spec.slice(0, i), sub: spec.slice(i + 1) };\n}\n\nfunction isSharedSpecifier(spec: string, specs: readonly string[]): boolean {\n return specs.some((s) => spec === s || spec.startsWith(s + \"/\"));\n}\n\n/**\n * Return the import/export specifiers in `source` that are a shared\n * specifier (or a subpath of one), sorted. Heuristic: only statement\n * positions are scanned (`from \"x\"`, `import \"x\"`, `import(\"x\")`;\n * `export … from \"x\"` is covered by the `from` pattern), so import-like\n * text inside comments or strings can be reported too. That errs toward\n * over-reporting, which is the safe direction for the advisory build\n * warning.\n */\nexport function findSharedImports(\n source: string,\n specs: readonly string[] = SHARED_DEP_SPECIFIERS,\n): string[] {\n const found = new Set<string>();\n const patterns = [\n /\\bfrom\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s*\\(\\s*[\"']([^\"'\\\\]+)[\"']\\s*\\)/g,\n ];\n for (const re of patterns) {\n for (const m of source.matchAll(re)) {\n const spec = m[1];\n if (isSharedSpecifier(spec, specs)) found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * Rewrite a package source for blob import in a worker context (import maps\n * don't apply there): shared specifiers become their mapped URLs, and\n * relative (`./`, `../`) specifiers become absolute against `sourceUrl`\n * (a blob URL has no directory to resolve against). `#` subpath imports are\n * deliberately left alone: they resolve via the package's own\n * `package.json` \"imports\" field, which the rewrite cannot reproduce.\n * Returns the input unchanged when nothing matched.\n */\nexport function rewritePackageSource(\n source: string,\n sourceUrl: string,\n imports: Record<string, string>,\n): string {\n if (!Object.keys(imports).length) return source;\n const base = new URL(sourceUrl);\n const map = (spec: string): string | null => {\n const mapped = imports[spec];\n if (mapped) return mapped;\n if (spec.startsWith(\"./\") || spec.startsWith(\"../\")) {\n return new URL(spec, base).href;\n }\n return null;\n };\n let out = source;\n // The quote character is captured and reused: a source that quotes its\n // specifiers with ' would otherwise never match the replacement and be\n // left un-rewritten — silently, since the specifier still maps.\n for (const re of [\n /\\bfrom\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s*\\(\\s*([\"'])([^\"'\\\\]+)\\1\\s*\\)/g,\n ]) {\n out = out.replace(re, (match, quote: string, spec: string) => {\n // The match contains the quoted specifier exactly once and the\n // captured group has no quotes/backslashes ([^\"'\\\\]), so a literal\n // replace is safe.\n const mapped = map(spec);\n return mapped\n ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`)\n : match;\n });\n }\n return out;\n}\n\nexport type SharedDepMismatch = {\n package: string;\n required: string;\n provided: string;\n};\n\nexport type PackageDeps = {\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n};\n\n/**\n * Compare a package's declared ranges against the host's version table.\n * `hostVersions` defines the checked set (only deps present in it are\n * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)\n * and unparseable ranges never mismatch.\n */\nexport function checkSharedDeps(\n pkgJson: PackageDeps,\n hostVersions: Record<string, string>,\n): SharedDepMismatch[] {\n const out: SharedDepMismatch[] = [];\n const entries = [\n ...Object.entries(pkgJson.dependencies ?? {}),\n ...Object.entries(pkgJson.peerDependencies ?? {}),\n ];\n for (const [dep, range] of entries) {\n const provided = hostVersions[dep];\n if (provided === undefined || typeof range !== \"string\") continue;\n if (range === \"*\" || /^[a-z]+:/i.test(range)) continue;\n if (!validRange(range)) continue;\n if (!satisfies(provided, range, { includePrerelease: true })) {\n out.push({ package: dep, required: range, provided });\n }\n }\n return out;\n}\n\nexport function formatSharedDepWarnings(\n mismatches: SharedDepMismatch[],\n): string[] {\n return mismatches.map(\n (m) =>\n `${m.package}: requires ${m.required}, Connect provides ${m.provided}`,\n );\n}\n\n/**\n * Stable filename for a local package's worker model bundle under\n * `__reactor_worker__/packages/`. Shared by the tab (URL computation via the\n * manifest) and the production prebuild (emitted entry names), so the two can\n * never drift. Scoped names flatten (`@scope/name` -> `scope__name`).\n */\nexport function workerPackageFileName(packageName: string): string {\n return `${packageName.replace(/^@/, \"\").replace(/[^\\w.-]+/g, \"__\")}.js`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,2BAA2B;;;;;;;ACNxC,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,CAC/C,WAAW,QAAQ;CAClB,IAAI,OAAO,QAAQ,WAAW,OAAO;CACrC,OAAO,QAAQ;AACjB,CAAC;;;;AASH,MAAM,iBAAiB,EAAE,OAAO;;;;;CAK9B,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKtC,sBAAsB,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAK1C,eAAe,EAAE,OAAO,CAAC,CAAC,SAAS;;;;CAKnC,mBAAmB,EAAE,OAAO,CAAC,CAAC,SAAS;AACzC,CAAC;;;;;;;;;;AAeD,MAAM,kBAAkB,EAAE,OAAO;;;;;CAK/B,oBAAoB,EAAE,OAAO,CAAC,CAAC,QAAQ,SAAS;;;;CAKhD,wBAAwB,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9C,CAAC;;;;;;AAWD,MAAM,yBAAyB,EAAE,OAAO;;;;;CAKtC,mCAAmC,cAAc,QAAQ,KAAK;;;;;CAM9D,oCAAoC,cAAc,QAAQ,IAAI;;;;;CAM9D,kDAAkD,cAAc,QAAQ,IAAI;AAC9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;CAC5B;AACF;AAEA,MAAa,+BAA+B;CAC1C,MAAM;CACN,sBAAsB;CACtB,aACE;CACF,YAAY;EACV,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,SAAS;KACP,MAAM;KACN,aACE;IACJ;IACA,gBAAgB;KACd,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;IACJ;GACF;EACF;EACA,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;KAAO;KACvC,aACE;KACF,SAAS;IACX;IACA,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,kBAAkB;KAChB,MAAM;KACN,aACE;IACJ;GACF;EACF;EACA,IAAI;GACF,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY,EACV,kBAAkB;IAChB,MAAM;IACN,aACE;IACF,SAAS;GACX,EACF;EACF;EACA,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,iBAAiB;KACf,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;IACX;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,CAAC;KACV,OAAO,EACL,OAAO,CACL;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,KAAK;MAChB,YAAY;OACV,KAAK,EAAE,MAAM,SAAS;OACtB,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;MACnC;KACF,GACA;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,SAAS,IAAI;MACxB,YAAY;OACV,OAAO;QACL,OAAO;QACP,aACE;OACJ;OACA,IAAI;QACF,MAAM;QACN,aACE;OACJ;OACA,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,MAAM,EAAE,MAAM,CAAC,UAAU,MAAM,EAAE;OACjC,KAAK;QACH,MAAM;QACN,aACE;OACJ;MACF;KACF,CACF,EACF;IACF;IACA,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,4BAA4B;KACnD,aACE;IACJ;IACA,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;KACT;IACF;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,WAAW;KACT,MAAM;KACN,aACE;IACJ;IACA,gBAAgB;KACd,MAAM;KACN,aACE;IACJ;IACA,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,SAAS;OACP,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,wBAAwB;SACtB,MAAM;SACN,aACE;QACJ;QACA,iBAAiB;SACf,MAAM;SACN,aACE;QACJ;OACF;MACF;MACA,OAAO;OACL,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,OAAO;SACL,MAAM;SACN,aACE;QACJ;QACA,UAAU;SACR,MAAM;SACN,aAAa;QACf;QACA,SAAS;SACP,MAAM;SACN,aACE;SACF,OAAO,EAAE,MAAM,SAAS;QAC1B;OACF;MACF;KACF;IACF;GACF;EACF;EACA,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;KACF,SAAS;IACX;IACA,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;IACX;GACF;EACF;EACA,WAAW;GACT,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;IACX;IACA,QAAQ;KACN,MAAM;KACN,aACE;IACJ;IACA,eAAe;KACb,MAAM;KACN,aAAa;KACb,SAAS;IACX;IACA,iBAAiB;KACf,MAAM;KACN,aAAa;KACb,SAAS;IACX;GACF;EACF;EACA,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,UAAU,CAAC,aAAa,eAAe;GACvC,aACE;GACF,YAAY;IACV,WAAW;KACT,MAAM,CAAC,UAAU,MAAM;KACvB,aACE;KACF,SAAS;IACX;IACA,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;IACX;GACF;EACF;EACA,SAAS;GACP,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,cAAc;KACZ,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,mBAAmB;OACjB,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,iBAAiB;OACf,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,YAAY;OACV,MAAM;OACN,aACE;OACF,SAAS;MACX;MACA,gBAAgB;OACd,MAAM;OACN,aACE;OACF,SAAS;MACX;KACF;IACF;IACA,uBAAuB;KACrB,MAAM;KACN,MAAM,CAAC,UAAU,aAAa;KAC9B,aACE;KACF,SAAS;IACX;IACA,4BAA4B;KAC1B,MAAM;KACN,MAAM,CAAC,UAAU,WAAW;KAC5B,aACE;KACF,SAAS;IACX;GACF;EACF;EACA,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,UAAU;KACR,MAAM;K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SAAiB;EAI5D,MAAM,SAAS,IAAI,IAAI;EACvB,OAAO,SACH,MAAM,QAAQ,GAAG,QAAQ,OAAO,SAAS,GAAG,QAAQ,SAAS,OAAO,IACpE;CACN,CAAC;CAEH,OAAO;AACT;;;;;;;AAmBA,SAAgB,gBACd,SACA,cACqB;CACrB,MAAM,MAA2B,CAAC;CAClC,MAAM,UAAU,CACd,GAAG,OAAO,QAAQ,QAAQ,gBAAgB,CAAC,CAAC,GAC5C,GAAG,OAAO,QAAQ,QAAQ,oBAAoB,CAAC,CAAC,CAClD;CACA,KAAK,MAAM,CAAC,KAAK,UAAU,SAAS;EAClC,MAAM,WAAW,aAAa;EAC9B,IAAI,aAAa,KAAA,KAAa,OAAO,UAAU,UAAU;EACzD,IAAI,UAAU,OAAO,YAAY,KAAK,KAAK,GAAG;EAC9C,IAAI,CAAC,WAAW,KAAK,GAAG;EACxB,IAAI,CAAC,UAAU,UAAU,OAAO,EAAE,mBAAmB,KAAK,CAAC,GACzD,IAAI,KAAK;GAAE,SAAS;GAAK,UAAU;GAAO;EAAS,CAAC;CAExD;CACA,OAAO;AACT;AAEA,SAAgB,wBACd,YACU;CACV,OAAO,WAAW,KACf,MACC,GAAG,EAAE,QAAQ,aAAa,EAAE,SAAS,qBAAqB,EAAE,UAChE;AACF;;;;;;;AAQA,SAAgB,sBAAsB,aAA6B;CACjE,OAAO,GAAG,YAAY,QAAQ,MAAM,EAAE,CAAC,CAAC,QAAQ,aAAa,IAAI,EAAE;AACrE"}
@@ -0,0 +1,9 @@
1
+ //#region constants.d.ts
2
+ declare const PACKAGES_DEPENDENCIES: readonly ["@powerhousedao/builder-tools", "@powerhousedao/codegen", "@powerhousedao/common", "@powerhousedao/config", "@powerhousedao/design-system", "document-drive", "document-model", "@powerhousedao/opentelemetry-instrumentation-reactor", "@powerhousedao/pieces-framework", "@powerhousedao/reactor", "@powerhousedao/reactor-api", "@powerhousedao/reactor-attachments", "@powerhousedao/reactor-browser", "@powerhousedao/reactor-drive", "@powerhousedao/reactor-group", "@powerhousedao/reactor-hypercore", "@powerhousedao/reactor-mcp", "@powerhousedao/reactor-privacy", "@powerhousedao/reactor-workflow", "@powerhousedao/registry", "@powerhousedao/switchboard-gui", "@powerhousedao/vetra", "@powerhousedao/workflow", "@powerhousedao/analytics-engine-core", "@powerhousedao/analytics-engine-knex", "@powerhousedao/analytics-engine-pg", "@powerhousedao/analytics-engine-browser", "@powerhousedao/analytics-engine-graphql", "@powerhousedao/shared", "@powerhousedao/powerhouse-vetra-packages", "@renown/sdk"];
3
+ declare const CLIS_DEPENDENCIES: string[];
4
+ declare const APPS_DEPENDENCIES: string[];
5
+ declare const ALL_POWERHOUSE_DEPENDENCIES: string[];
6
+ //#endregion
7
+ export { PACKAGES_DEPENDENCIES as i, APPS_DEPENDENCIES as n, CLIS_DEPENDENCIES as r, ALL_POWERHOUSE_DEPENDENCIES as t };
8
+ export {};
9
+ //# sourceMappingURL=constants-C2K-m7pp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-C2K-m7pp.d.ts","names":[],"sources":["../constants.ts"],"mappings":";cACa;cAkCA;cACA;cAKA"}
@@ -1,3 +1,3 @@
1
- import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-CZasmdmu.js";
1
+ import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-C2K-m7pp.js";
2
2
  export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, CLIS_DEPENDENCIES, PACKAGES_DEPENDENCIES };
3
3
  export {};
package/dist/constants.js CHANGED
@@ -8,7 +8,6 @@ const PACKAGES_DEPENDENCIES = [
8
8
  "document-drive",
9
9
  "document-model",
10
10
  "@powerhousedao/opentelemetry-instrumentation-reactor",
11
- "@powerhousedao/pglite-fs",
12
11
  "@powerhousedao/pieces-framework",
13
12
  "@powerhousedao/reactor",
14
13
  "@powerhousedao/reactor-api",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../constants.ts"],"sourcesContent":["// Every package published from the monorepo that `ph update` / `ph use` keep in lockstep.\nexport const PACKAGES_DEPENDENCIES = [\n \"@powerhousedao/builder-tools\",\n \"@powerhousedao/codegen\",\n \"@powerhousedao/common\",\n \"@powerhousedao/config\",\n \"@powerhousedao/design-system\",\n \"document-drive\",\n \"document-model\",\n \"@powerhousedao/opentelemetry-instrumentation-reactor\",\n \"@powerhousedao/pglite-fs\",\n \"@powerhousedao/pieces-framework\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/reactor-api\",\n \"@powerhousedao/reactor-attachments\",\n \"@powerhousedao/reactor-browser\",\n \"@powerhousedao/reactor-drive\",\n \"@powerhousedao/reactor-group\",\n \"@powerhousedao/reactor-hypercore\",\n \"@powerhousedao/reactor-mcp\",\n \"@powerhousedao/reactor-privacy\",\n \"@powerhousedao/reactor-workflow\",\n \"@powerhousedao/registry\",\n \"@powerhousedao/switchboard-gui\",\n \"@powerhousedao/vetra\",\n \"@powerhousedao/workflow\",\n \"@powerhousedao/analytics-engine-core\",\n \"@powerhousedao/analytics-engine-knex\",\n \"@powerhousedao/analytics-engine-pg\",\n \"@powerhousedao/analytics-engine-browser\",\n \"@powerhousedao/analytics-engine-graphql\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/powerhouse-vetra-packages\",\n \"@renown/sdk\",\n] as const;\n\nexport const CLIS_DEPENDENCIES = [\"ph-cmd\", \"@powerhousedao/ph-cli\"];\nexport const APPS_DEPENDENCIES = [\n \"@powerhousedao/connect\",\n \"@powerhousedao/switchboard\",\n];\n\nexport const ALL_POWERHOUSE_DEPENDENCIES = [\n ...PACKAGES_DEPENDENCIES,\n ...CLIS_DEPENDENCIES,\n ...APPS_DEPENDENCIES,\n];\n"],"mappings":";AACA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,oBAAoB,CAAC,UAAU,uBAAuB;AACnE,MAAa,oBAAoB,CAC/B,0BACA,4BACF;AAEA,MAAa,8BAA8B;CACzC,GAAG;CACH,GAAG;CACH,GAAG;AACL"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../constants.ts"],"sourcesContent":["// Every package published from the monorepo that `ph update` / `ph use` keep in lockstep.\nexport const PACKAGES_DEPENDENCIES = [\n \"@powerhousedao/builder-tools\",\n \"@powerhousedao/codegen\",\n \"@powerhousedao/common\",\n \"@powerhousedao/config\",\n \"@powerhousedao/design-system\",\n \"document-drive\",\n \"document-model\",\n \"@powerhousedao/opentelemetry-instrumentation-reactor\",\n \"@powerhousedao/pieces-framework\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/reactor-api\",\n \"@powerhousedao/reactor-attachments\",\n \"@powerhousedao/reactor-browser\",\n \"@powerhousedao/reactor-drive\",\n \"@powerhousedao/reactor-group\",\n \"@powerhousedao/reactor-hypercore\",\n \"@powerhousedao/reactor-mcp\",\n \"@powerhousedao/reactor-privacy\",\n \"@powerhousedao/reactor-workflow\",\n \"@powerhousedao/registry\",\n \"@powerhousedao/switchboard-gui\",\n \"@powerhousedao/vetra\",\n \"@powerhousedao/workflow\",\n \"@powerhousedao/analytics-engine-core\",\n \"@powerhousedao/analytics-engine-knex\",\n \"@powerhousedao/analytics-engine-pg\",\n \"@powerhousedao/analytics-engine-browser\",\n \"@powerhousedao/analytics-engine-graphql\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/powerhouse-vetra-packages\",\n \"@renown/sdk\",\n] as const;\n\nexport const CLIS_DEPENDENCIES = [\"ph-cmd\", \"@powerhousedao/ph-cli\"];\nexport const APPS_DEPENDENCIES = [\n \"@powerhousedao/connect\",\n \"@powerhousedao/switchboard\",\n];\n\nexport const ALL_POWERHOUSE_DEPENDENCIES = [\n ...PACKAGES_DEPENDENCIES,\n ...CLIS_DEPENDENCIES,\n ...APPS_DEPENDENCIES,\n];\n"],"mappings":";AACA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,oBAAoB,CAAC,UAAU,uBAAuB;AACnE,MAAa,oBAAoB,CAC/B,0BACA,4BACF;AAEA,MAAa,8BAA8B;CACzC,GAAG;CACH,GAAG;CACH,GAAG;AACL"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as AnalyticsSeriesInput, c as CompoundAnalyticsExpression, d as ConversionMetric, f as IAnalyticsStore, i as AnalyticsSeries, l as CompoundAnalyticsInputs, n as AnalyticsOperand, o as AnalyticsSeriesQuery, p as MultiCurrencyConversion, r as AnalyticsQuery, s as AnalyticsUpdateCallback, t as AnalyticsDimension, u as CompoundAnalyticsQuery } from "./types-Bsp8VL2y.js";
2
2
  import { $ as AddOperationErrorInput, $i as SetOperationErrorTemplateInput, $n as MutationMoveOperationArgs, $r as RemoveRelationshipActionInput, $t as DocumentModelOperationExampleAction, A as PHPackageProvider, Aa as UndoAction, Ai as SetModelDescriptionInput, An as MakeEmpty, Ar as MutationUpdateStateExampleArgs, At as DeleteOperationErrorAction, B as ServiceActions, Ba as UpdateStateExampleInput, Bi as SetModuleNameInput, Bn as Mutation, Br as PieceModule, Bt as DocumentModelDocumentModelModule, C as PHConnectPwaUrlPattern, Ca as SigningParameters, Ci as SetAuthorNameAction, Cn as ISigner, Cr as MutationSetOperationReducerArgs, Ct as DeleteChildDocumentInput, D as PHConnectRenownAdapters, Da as StateReducer, Di as SetInitialStateAction, Dn as IsStateOfType, Dr as MutationUndoArgs, Dt as DeleteModuleAction, E as PHConnectRenown, Ea as State, Ei as SetAuthorWebsiteInput, En as IsDocumentOfType, Er as MutationSetStateSchemaArgs, Et as DeleteDocumentActionInput, F as ParsedCmdResult, Fa as UpdateOperationExampleAction, Fi as SetModelNameAction, Fn as Maybe, Fr as OperationsByScope, Ft as DeleteStateExampleAction, G as ActionVerificationHandler, Gi as SetOperationDescriptionInput, Gn as MutationAddOperationExampleArgs, Gr as Query, Gt as DocumentModelLib, H as ActionErrorCallback, Ha as UpgradeDocumentActionInput, Hi as SetNameActionInput, Hn as MutationAddModuleArgs, Hr as Publisher, Ht as DocumentModelHeaderAction, I as PathValidation, Ia as UpdateOperationExampleInput, Ii as SetModelNameInput, In as MinimalBackupData, Ir as PartialRecord, It as DeleteStateExampleInput, J as AddChangeLogItemInput, Ji as SetOperationErrorDescriptionAction, Jn as MutationDeleteModuleArgs, Jr as RedoActionInput, Jt as DocumentModelModuleAction, K as Actions, Ki as SetOperationErrorCodeAction, Kn as MutationAddStateExampleArgs, Kr as Redo, Kt as DocumentModelLocalState, L as PowerhouseConfig, La as UpdateRelationshipAction, Li as SetModuleDescriptionAction, Ln as ModuleSpecification, Lr as PartialState, Lt as DocumentAction, M as PHRenownPrivyAdapterConfig, Ma as UndoRedoAction, Mi as SetModelExtensionInput, Mn as MakeOptional, Mr as OperationErrorSpecification, Mt as DeleteOperationExampleAction, N as PHRenownRainbowAdapterConfig, Na as UpdateChangeLogItemAction, Ni as SetModelIdAction, Nn as Manifest, Nr as OperationIndex, Nt as DeleteOperationExampleInput, O as PHConnectRuntimeConfig, Oa as SubgraphModule, Oi as SetInitialStateInput, On as LoadFromFile, Or as MutationUpdateChangeLogItemInputArgs, Ot as DeleteModuleInput, P as PackageManagerArgs, Pa as UpdateChangeLogItemInput, Pi as SetModelIdInput, Pn as MappedOperation, Pr as OperationSpecification, Pt as DeleteOperationInput, Q as AddOperationErrorAction, Qi as SetOperationErrorTemplateAction, Qn as MutationDeleteStateExampleArgs, Qr as RemoveRelationshipAction, Qt as DocumentModelOperationErrorOperations, R as PowerhousePackage, Ra as UpdateRelationshipActionInput, Ri as SetModuleDescriptionInput, Rn as MoveOperationAction, Rr as PhAiToolAnnotations, Rt as DocumentModelAction, S as PHConnectPwaRuntimeCaching, Sa as SignatureVerificationHandler, Si as ScopeState, Sn as ISignalResult, Sr as MutationSetOperationNameArgs, St as DeleteChangeLogItemInput, T as PHConnectReactorFeatureFlags, Ta as SkipHeaderOperations, Ti as SetAuthorWebsiteAction, Tn as InputMaybe, Tr as MutationSetOperationTemplateArgs, Tt as DeleteDocumentAction, U as ActionSignatureContext, Ua as User, Ui as SetNameOperation, Un as MutationAddOperationArgs, Ur as PurgeDocumentAction, Ut as DocumentModelHeaderOperations, Va as UpgradeDocumentAction, Vi as SetNameAction, Vn as MutationAddChangeLogItemInputArgs, Vr as PowerhouseModule, Vt as DocumentModelGlobalState, W as ActionSigningHandler, Wa as ValidationError, Wi as SetOperationDescriptionAction, Wn as MutationAddOperationErrorArgs, Wr as PurgeDocumentActionInput, Wt as DocumentModelInput, X as AddModuleInput, Xi as SetOperationErrorNameAction, Xn as MutationDeleteOperationErrorArgs, Xr as ReducerOptions, Xt as DocumentModelOperationAction, Y as AddModuleAction, Yi as SetOperationErrorDescriptionInput, Yn as MutationDeleteOperationArgs, Yr as Reducer, Yt as DocumentModelModuleOperations, Z as AddOperationAction, Zi as SetOperationErrorNameInput, Zn as MutationDeleteOperationExampleArgs, Zr as ReleaseNewVersionAction, Zt as DocumentModelOperationErrorAction, _ as PHConnectPwa, _a as Signal, _i as SchemaNOOPAction, _n as IAction, _o as ProcessorRecord, _r as MutationSetOperationDescriptionArgs, _t as CreateDocument, a as PHConnectAi, aa as SetOperationSchemaInput, ai as ReorderModulesInput, an as DocumentModelUtils, ar as MutationReorderOperationExamplesArgs, at as AddStateExampleAction, b as PHConnectPwaIcon, ba as SignalResults, bi as SchemaSetPreferredEditorAction, bn as IOperation, br as MutationSetOperationErrorNameArgs, bt as CreateState, c as PHConnectDefaultDrive, ca as SetOperationTemplateAction, ci as ReorderOperationExamplesAction, cn as DocumentOperationsIgnoreMap, co as IProcessorDispatch, cr as MutationSetAuthorWebsiteArgs, ct as AssertIsStateOfType, d as PHConnectDriveSection, da as SetPreferredEditorActionInput, di as ReorderStateExamplesInput, dn as EditorDispatch, do as ProcessorApp, dr as MutationSetModelExtensionArgs, dt as ConfigEntry, ea as SetOperationNameAction, ei as ReorderChangeLogItemsAction, en as DocumentModelOperationExampleOperations, er as MutationRedoArgs, et as AddOperationExampleAction, f as PHConnectDriveSections, fa as SetPreferredEditorOperation, fi as ReplayDocumentOptions, fn as EditorModule, fo as ProcessorApps, fr as MutationSetModelIdArgs, ft as ConfigEntryType, g as PHConnectPackages, ga as Set_PreferredEditor, gi as Scalars, gn as GetDocumentOptions, go as ProcessorFilter, gr as MutationSetNameArgs, gt as CreateChildDocumentSignal, h as PHConnectOpenPanel, ha as Set_Name, hi as SaveToFileHandle, hn as FileInput, ho as ProcessorFactoryBuilder, hr as MutationSetModuleNameArgs, ht as CreateChildDocumentInput, i as LogLevels, ia as SetOperationSchemaAction, ii as ReorderModulesAction, in as DocumentModelStateOperations, ir as MutationReorderOperationErrorsArgs, it as AddRelationshipActionInput, j as PHReactorRenown, ja as UndoActionInput, ji as SetModelExtensionAction, jn as MakeMaybe, jr as NOOPAction, jt as DeleteOperationErrorInput, k as PHConnectSentry, ka as Undo, ki as SetModelDescriptionAction, kn as LoadFromInput, kr as MutationUpdateOperationExampleArgs, kt as DeleteOperationAction, l as PHConnectDefaultDriveLocal, la as SetOperationTemplateInput, li as ReorderOperationExamplesInput, ln as DocumentSpecification, lo as IProcessorHostModuleBase, lr as MutationSetInitialStateArgs, lt as Author, m as PHConnectInstance, ma as SetStateSchemaInput, mi as SaveToFile, mn as Exact, mo as ProcessorFactory, mr as MutationSetModuleDescriptionArgs, mt as CopyChildDocumentSignal, n as DrivePreserveStrategy, na as SetOperationReducerAction, ni as ReorderModuleOperationsAction, nn as DocumentModelPHState, nr as MutationReorderModuleOperationsArgs, nt as AddOperationInput, o as PHConnectApp, oa as SetOperationScopeAction, oi as ReorderOperationErrorsAction, on as DocumentModelVersioningAction, or as MutationReorderStateExamplesArgs, ot as AddStateExampleInput, p as PHConnectDrives, pa as SetStateSchemaAction, pi as RevisionsFilter, pn as EditorProps, po as ProcessorDispatchResult, pr as MutationSetModelNameArgs, pt as CopyChildDocumentInput, q as AddChangeLogItemAction, qi as SetOperationErrorCodeInput, qn as MutationDeleteChangeLogItemInputArgs, qr as RedoAction, qt as DocumentModelModule, r as LogLevel, ra as SetOperationReducerInput, ri as ReorderModuleOperationsInput, rn as DocumentModelStateAction, rr as MutationReorderModulesArgs, rt as AddRelationshipAction, s as PHConnectBranding, sa as SetOperationScopeInput, si as ReorderOperationErrorsInput, sn as DocumentModelVersioningOperations, so as IProcessor, sr as MutationSetAuthorNameArgs, st as AssertIsDocumentOfType, t as DrivePreserveStrategies, ta as SetOperationNameInput, ti as ReorderChangeLogItemsInput, tn as DocumentModelOperationOperations, tr as MutationReorderChangeLogItemsInputArgs, tt as AddOperationExampleInput, u as PHConnectDefaultDriveRemote, ua as SetPreferredEditorAction, ui as ReorderStateExamplesAction, un as ENSInfo, uo as IProcessorManager, ur as MutationSetModelDescriptionArgs, ut as CodeExample, v as PHConnectPwaCacheStrategy, va as SignalDispatch, vi as SchemaRedoAction, vn as ID, vo as ProcessorStatus, vr as MutationSetOperationErrorCodeArgs, vt as CreateDocumentAction, w as PHConnectReactor, wa as SkipHeaderOperationIndex, wi as SetAuthorNameInput, wn as Incremental, wr as MutationSetOperationSchemaArgs, wt as DeleteChildDocumentSignal, x as PHConnectPwaManifest, xa as SignalType, xi as SchemaUndoAction, xn as ISignal, xr as MutationSetOperationErrorTemplateArgs, xt as DeleteChangeLogItemAction, y as PHConnectPwaFileHandler, ya as SignalResult, yi as SchemaSetNameAction, yn as IDocument, yo as TrackedProcessor, yr as MutationSetOperationErrorDescriptionArgs, yt as CreateDocumentActionInput, z as ServiceAction, za as UpdateStateExampleAction, zi as SetModuleNameAction, zn as MoveOperationInput, zr as PhAiToolDescriptor, zt as DocumentModelDocument } from "./types-CFbd2nan.js";
3
- import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-CZasmdmu.js";
3
+ import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-C2K-m7pp.js";
4
4
  import { $ as LegacySynchronizationUnit, A as TriggerData, B as PackagePage, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, F as PACKAGE_MODULE_TYPES, G as RegistryPackageSource, H as RegistryPackage, I as PackageFacets, J as DriveDocumentModelModule, K as RegistryPackageStatus, L as PackageInfo, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, R as PackageListItem, S as RemoveListenerInput, T as SetDriveIconInput, U as RegistryPackageList, V as Page, W as RegistryPackageMap, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as DocumentDrivePHState, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node, z as PackageModuleType } from "./types-B11NGQOQ.js";
5
5
  import { a as GenerateNodesCopyIdGenerator, i as DriveInput, n as buildTreeUrl, o as GenerateNodesCopySrc, r as shortGitSha, s as SharingType, t as GITHUB_REPO_URL } from "./index-DdXp-CVw.js";
6
6
  export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, type ActionErrorCallback, type ActionSignatureContext, type ActionSigningHandler, type ActionVerificationHandler, type Actions, type AddChangeLogItemAction, type AddChangeLogItemInput, type AddFileAction, type AddFileInput, type AddFolderAction, type AddFolderInput, type AddListenerAction, type AddListenerInput, type AddModuleAction, type AddModuleInput, type AddOperationAction, type AddOperationErrorAction, type AddOperationErrorInput, type AddOperationExampleAction, type AddOperationExampleInput, type AddOperationInput, type AddRelationshipAction, type AddRelationshipActionInput, type AddStateExampleAction, type AddStateExampleInput, type AddTriggerAction, type AddTriggerInput, type AnalyticsDimension, type AnalyticsOperand, type AnalyticsQuery, type AnalyticsSeries, type AnalyticsSeriesInput, type AnalyticsSeriesQuery, type AnalyticsUpdateCallback, type AssertIsDocumentOfType, type AssertIsStateOfType, type Author, CLIS_DEPENDENCIES, type CodeExample, type CompoundAnalyticsExpression, type CompoundAnalyticsInputs, type CompoundAnalyticsQuery, type ConfigEntry, type ConfigEntryType, type ConversionMetric, type CopyChildDocumentInput, type CopyChildDocumentSignal, type CopyNodeAction, type CopyNodeInput, type CreateChildDocumentInput, type CreateChildDocumentSignal, type CreateDocument, type CreateDocumentAction, type CreateDocumentActionInput, type CreateState, type DeleteChangeLogItemAction, type DeleteChangeLogItemInput, type DeleteChildDocumentInput, type DeleteChildDocumentSignal, type DeleteDocumentAction, type DeleteDocumentActionInput, type DeleteModuleAction, type DeleteModuleInput, type DeleteNodeAction, type DeleteNodeInput, type DeleteOperationAction, type DeleteOperationErrorAction, type DeleteOperationErrorInput, type DeleteOperationExampleAction, type DeleteOperationExampleInput, type DeleteOperationInput, type DeleteStateExampleAction, type DeleteStateExampleInput, type DocumentAction, type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveDriveAction, type DocumentDriveDriveOperations, type DocumentDriveGlobalState, type DocumentDriveLocalState, type DocumentDriveNodeAction, type DocumentDriveNodeOperations, type DocumentDrivePHState, type DocumentModelAction, type DocumentModelDocument, type DocumentModelDocumentModelModule, type DocumentModelGlobalState, type DocumentModelHeaderAction, type DocumentModelHeaderOperations, type DocumentModelInput, type DocumentModelLib, type DocumentModelLocalState, type DocumentModelModule, type DocumentModelModuleAction, type DocumentModelModuleOperations, type DocumentModelOperationAction, type DocumentModelOperationErrorAction, type DocumentModelOperationErrorOperations, type DocumentModelOperationExampleAction, type DocumentModelOperationExampleOperations, type DocumentModelOperationOperations, type DocumentModelPHState, type DocumentModelStateAction, type DocumentModelStateOperations, type DocumentModelUtils, type DocumentModelVersioningAction, type DocumentModelVersioningOperations, type DocumentOperationsIgnoreMap, type DocumentSpecification, type DriveDocumentModelModule, type DriveInput, type DrivePreserveStrategies, type DrivePreserveStrategy, type ENSInfo, type EditorDispatch, type EditorModule, type EditorProps, type Exact, type FileInput, type FileNode, type FolderNode, GITHUB_REPO_URL, type GenerateNodesCopyIdGenerator, type GenerateNodesCopySrc, type GetDocumentOptions, type IAction, type IAnalyticsStore, type ID, type IDocument, type IOperation, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, type ISignal, type ISignalResult, type ISigner, type Incremental, type InputMaybe, type IsDocumentOfType, type IsStateOfType, type LegacyAddFileAction, type LegacyAddFileInput, type LegacySynchronizationUnit, type Listener, type ListenerCallInfo, type ListenerCallInfoInput, type ListenerFilter, type ListenerFilterInput, type ListenerInput, type LoadFromFile, type LoadFromInput, type LogLevel, type LogLevels, type MakeEmpty, type MakeMaybe, type MakeOptional, type Manifest, type MappedOperation, type Maybe, type MinimalBackupData, type ModuleSpecification, type MoveNodeAction, type MoveNodeInput, type MoveOperationAction, type MoveOperationInput, type MultiCurrencyConversion, type Mutation, type MutationAddChangeLogItemInputArgs, type MutationAddModuleArgs, type MutationAddOperationArgs, type MutationAddOperationErrorArgs, type MutationAddOperationExampleArgs, type MutationAddStateExampleArgs, type MutationDeleteChangeLogItemInputArgs, type MutationDeleteModuleArgs, type MutationDeleteOperationArgs, type MutationDeleteOperationErrorArgs, type MutationDeleteOperationExampleArgs, type MutationDeleteStateExampleArgs, type MutationMoveOperationArgs, type MutationRedoArgs, type MutationReorderChangeLogItemsInputArgs, type MutationReorderModuleOperationsArgs, type MutationReorderModulesArgs, type MutationReorderOperationErrorsArgs, type MutationReorderOperationExamplesArgs, type MutationReorderStateExamplesArgs, type MutationSetAuthorNameArgs, type MutationSetAuthorWebsiteArgs, type MutationSetInitialStateArgs, type MutationSetModelDescriptionArgs, type MutationSetModelExtensionArgs, type MutationSetModelIdArgs, type MutationSetModelNameArgs, type MutationSetModuleDescriptionArgs, type MutationSetModuleNameArgs, type MutationSetNameArgs, type MutationSetOperationDescriptionArgs, type MutationSetOperationErrorCodeArgs, type MutationSetOperationErrorDescriptionArgs, type MutationSetOperationErrorNameArgs, type MutationSetOperationErrorTemplateArgs, type MutationSetOperationNameArgs, type MutationSetOperationReducerArgs, type MutationSetOperationSchemaArgs, type MutationSetOperationTemplateArgs, type MutationSetStateSchemaArgs, type MutationUndoArgs, type MutationUpdateChangeLogItemInputArgs, type MutationUpdateOperationExampleArgs, type MutationUpdateStateExampleArgs, type NOOPAction, type Node, type OperationErrorSpecification, type OperationIndex, type OperationSpecification, type OperationsByScope, PACKAGES_DEPENDENCIES, type PACKAGE_MODULE_TYPES, type PHConnectAi, type PHConnectApp, type PHConnectBranding, type PHConnectDefaultDrive, type PHConnectDefaultDriveLocal, type PHConnectDefaultDriveRemote, type PHConnectDriveSection, type PHConnectDriveSections, type PHConnectDrives, type PHConnectInstance, type PHConnectOpenPanel, type PHConnectPackages, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, type PHConnectReactor, type PHConnectReactorFeatureFlags, type PHConnectRenown, type PHConnectRenownAdapters, type PHConnectRuntimeConfig, type PHConnectSentry, type PHPackageProvider, type PHReactorRenown, type PHRenownPrivyAdapterConfig, type PHRenownRainbowAdapterConfig, type PackageFacets, type PackageInfo, type PackageListItem, type PackageManagerArgs, type PackageModuleType, type PackagePage, type Page, type ParsedCmdResult, type PartialRecord, type PartialState, type PathValidation, type PhAiToolAnnotations, type PhAiToolDescriptor, type PieceModule, type PowerhouseConfig, type PowerhouseModule, type PowerhousePackage, type ProcessorApp, type ProcessorApps, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorRecord, type ProcessorStatus, type Publisher, type PullResponderTriggerData, type PullResponderTriggerDataInput, type PurgeDocumentAction, type PurgeDocumentActionInput, type Query, type Redo, type RedoAction, type RedoActionInput, type Reducer, type ReducerOptions, type RegistryPackage, type RegistryPackageList, type RegistryPackageMap, type RegistryPackageSource, type RegistryPackageStatus, type ReleaseNewVersionAction, type RemoveListenerAction, type RemoveListenerInput, type RemoveRelationshipAction, type RemoveRelationshipActionInput, type RemoveTriggerAction, type RemoveTriggerInput, type ReorderChangeLogItemsAction, type ReorderChangeLogItemsInput, type ReorderModuleOperationsAction, type ReorderModuleOperationsInput, type ReorderModulesAction, type ReorderModulesInput, type ReorderOperationErrorsAction, type ReorderOperationErrorsInput, type ReorderOperationExamplesAction, type ReorderOperationExamplesInput, type ReorderStateExamplesAction, type ReorderStateExamplesInput, type ReplayDocumentOptions, type RevisionsFilter, type SaveToFile, type SaveToFileHandle, type Scalars, type SchemaNOOPAction, type SchemaRedoAction, type SchemaSetNameAction, type SchemaSetPreferredEditorAction, type SchemaUndoAction, type ScopeState, type ServiceAction, type ServiceActions, type SetAuthorNameAction, type SetAuthorNameInput, type SetAuthorWebsiteAction, type SetAuthorWebsiteInput, type SetAvailableOfflineAction, type SetAvailableOfflineInput, type SetDriveIconAction, type SetDriveIconInput, type SetDriveNameAction, type SetDriveNameInput, type SetInitialStateAction, type SetInitialStateInput, type SetModelDescriptionAction, type SetModelDescriptionInput, type SetModelExtensionAction, type SetModelExtensionInput, type SetModelIdAction, type SetModelIdInput, type SetModelNameAction, type SetModelNameInput, type SetModuleDescriptionAction, type SetModuleDescriptionInput, type SetModuleNameAction, type SetModuleNameInput, type SetNameAction, type SetNameActionInput, type SetNameOperation, type SetOperationDescriptionAction, type SetOperationDescriptionInput, type SetOperationErrorCodeAction, type SetOperationErrorCodeInput, type SetOperationErrorDescriptionAction, type SetOperationErrorDescriptionInput, type SetOperationErrorNameAction, type SetOperationErrorNameInput, type SetOperationErrorTemplateAction, type SetOperationErrorTemplateInput, type SetOperationNameAction, type SetOperationNameInput, type SetOperationReducerAction, type SetOperationReducerInput, type SetOperationSchemaAction, type SetOperationSchemaInput, type SetOperationScopeAction, type SetOperationScopeInput, type SetOperationTemplateAction, type SetOperationTemplateInput, type SetPreferredEditorAction, type SetPreferredEditorActionInput, type SetPreferredEditorOperation, type SetSharingTypeAction, type SetSharingTypeInput, type SetStateSchemaAction, type SetStateSchemaInput, type Set_Name, type Set_PreferredEditor, type SharingType, type Signal, type SignalDispatch, type SignalResult, type SignalResults, type SignalType, type SignatureVerificationHandler, type SigningParameters, type SkipHeaderOperationIndex, type SkipHeaderOperations, type State, type StateReducer, type SubgraphModule, type TrackedProcessor, type TransmitterType, type Trigger, type TriggerData, type TriggerInput, type TriggerType, type Undo, type UndoAction, type UndoActionInput, type UndoRedoAction, type UpdateChangeLogItemAction, type UpdateChangeLogItemInput, type UpdateFileAction, type UpdateFileInput, type UpdateNodeAction, type UpdateNodeInput, type UpdateOperationExampleAction, type UpdateOperationExampleInput, type UpdateRelationshipAction, type UpdateRelationshipActionInput, type UpdateStateExampleAction, type UpdateStateExampleInput, type UpgradeDocumentAction, type UpgradeDocumentActionInput, type User, type ValidationError, buildTreeUrl, shortGitSha };