@powerhousedao/shared 6.2.3-dev.10 → 6.2.3-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/clis/args/{access-token-To5LaIfL.mjs → access-token-zW_7Brog.mjs} +2 -2
  2. package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-zW_7Brog.mjs.map} +1 -1
  3. package/dist/clis/args/access-token.mjs +1 -1
  4. package/dist/clis/args/{common-CcYbXrBx.mjs → common-BT8ABM57.mjs} +9 -2
  5. package/dist/clis/args/{common-CcYbXrBx.mjs.map → common-BT8ABM57.mjs.map} +1 -1
  6. package/dist/clis/args/{common-Dsf1vpHV.d.mts → common-rEpM4Oqq.d.mts} +4 -1
  7. package/dist/clis/args/common-rEpM4Oqq.d.mts.map +1 -0
  8. package/dist/clis/args/common.d.mts +1 -1
  9. package/dist/clis/args/common.mjs +1 -1
  10. package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-Du3Us5tQ.mjs} +7 -2
  11. package/dist/clis/args/connect-Du3Us5tQ.mjs.map +1 -0
  12. package/dist/clis/args/{connect-DetTnI8g.d.mts → connect-_FQWS7p3.d.mts} +10 -1
  13. package/dist/clis/args/connect-_FQWS7p3.d.mts.map +1 -0
  14. package/dist/clis/args/connect.d.mts +1 -1
  15. package/dist/clis/args/connect.mjs +1 -1
  16. package/dist/clis/args/{generate-CA916Fvj.mjs → generate-DkFqeNX3.mjs} +2 -2
  17. package/dist/clis/args/{generate-CA916Fvj.mjs.map → generate-DkFqeNX3.mjs.map} +1 -1
  18. package/dist/clis/args/generate.mjs +1 -1
  19. package/dist/clis/args/{help-Bqbgbalu.mjs → help-stFOz1hp.mjs} +15 -15
  20. package/dist/clis/args/{help-Bqbgbalu.mjs.map → help-stFOz1hp.mjs.map} +1 -1
  21. package/dist/clis/args/help.mjs +1 -1
  22. package/dist/clis/args/index.d.mts +2 -2
  23. package/dist/clis/args/index.mjs +18 -18
  24. package/dist/clis/args/{init-rz9Ei7nq.mjs → init-Bu8-Ovk8.mjs} +2 -2
  25. package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-Bu8-Ovk8.mjs.map} +1 -1
  26. package/dist/clis/args/init.mjs +1 -1
  27. package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-GjiR0Qqd.mjs} +2 -2
  28. package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-GjiR0Qqd.mjs.map} +1 -1
  29. package/dist/clis/args/inspect.mjs +1 -1
  30. package/dist/clis/args/{install-Sz2DlCHh.mjs → install-B2hLryPk.mjs} +2 -2
  31. package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-B2hLryPk.mjs.map} +1 -1
  32. package/dist/clis/args/install.mjs +1 -1
  33. package/dist/clis/args/{list-DM2d6f1m.mjs → list-O6VmV3Cw.mjs} +2 -2
  34. package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-O6VmV3Cw.mjs.map} +1 -1
  35. package/dist/clis/args/list.mjs +1 -1
  36. package/dist/clis/args/{login-DiKT5Jfu.mjs → login-BWXdMfMX.mjs} +2 -2
  37. package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-BWXdMfMX.mjs.map} +1 -1
  38. package/dist/clis/args/login.mjs +1 -1
  39. package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-3MTmDiXt.mjs} +2 -2
  40. package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-3MTmDiXt.mjs.map} +1 -1
  41. package/dist/clis/args/migrate.mjs +1 -1
  42. package/dist/clis/args/{publish-DDZYsUfV.mjs → publish--zdKYIOl.mjs} +2 -2
  43. package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish--zdKYIOl.mjs.map} +1 -1
  44. package/dist/clis/args/publish.mjs +1 -1
  45. package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-BNVeE6qR.mjs} +2 -2
  46. package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-BNVeE6qR.mjs.map} +1 -1
  47. package/dist/clis/args/registry.mjs +1 -1
  48. package/dist/clis/args/{service-CHOOr0Gg.mjs → service-x6wsNujS.mjs} +2 -2
  49. package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-x6wsNujS.mjs.map} +1 -1
  50. package/dist/clis/args/service.mjs +1 -1
  51. package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-Cryy_3Qc.mjs} +2 -2
  52. package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-Cryy_3Qc.mjs.map} +1 -1
  53. package/dist/clis/args/switchboard.mjs +1 -1
  54. package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-DQUsLzCG.mjs} +2 -2
  55. package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-DQUsLzCG.mjs.map} +1 -1
  56. package/dist/clis/args/uninstall.mjs +1 -1
  57. package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-CeDsvgMv.mjs} +2 -2
  58. package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-CeDsvgMv.mjs.map} +1 -1
  59. package/dist/clis/args/unpublish.mjs +1 -1
  60. package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-pYJXVf_o.mjs} +2 -2
  61. package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-pYJXVf_o.mjs.map} +1 -1
  62. package/dist/clis/args/vetra.mjs +1 -1
  63. package/dist/clis/build-config.d.mts +29 -1
  64. package/dist/clis/build-config.d.mts.map +1 -1
  65. package/dist/clis/build-config.mjs +134 -19
  66. package/dist/clis/build-config.mjs.map +1 -1
  67. package/dist/clis/constants.d.mts +4 -0
  68. package/dist/clis/constants.d.mts.map +1 -1
  69. package/dist/clis/index.d.mts +32 -0
  70. package/dist/clis/index.d.mts.map +1 -1
  71. package/dist/clis/index.mjs +27 -1
  72. package/dist/clis/index.mjs.map +1 -1
  73. package/dist/{config-loader-B845Hidf.js → config-loader-e4-qdVVI.js} +3 -2
  74. package/dist/config-loader-e4-qdVVI.js.map +1 -0
  75. package/dist/connect/config-loader.d.ts +1 -1
  76. package/dist/connect/config-loader.js +1 -1
  77. package/dist/connect/index.d.ts +98 -2
  78. package/dist/connect/index.d.ts.map +1 -1
  79. package/dist/connect/index.js +186 -2
  80. package/dist/connect/index.js.map +1 -1
  81. package/dist/document-drive/index.d.ts +2 -2
  82. package/dist/document-model/index.d.ts +2 -2
  83. package/dist/{index-DP3QgHTq.d.ts → index-DWS2M59v.d.ts} +2 -2
  84. package/dist/{index-DP3QgHTq.d.ts.map → index-DWS2M59v.d.ts.map} +1 -1
  85. package/dist/index.d.ts +2 -2
  86. package/dist/processors/index.d.ts +1 -1
  87. package/dist/registry/index.d.ts +2 -2
  88. package/dist/registry/manifest-slim.d.ts +1 -1
  89. package/dist/{types-BIoOWpOT.d.ts → types-DX5QXaOU.d.ts} +5 -1
  90. package/dist/{types-BIoOWpOT.d.ts.map → types-DX5QXaOU.d.ts.map} +1 -1
  91. package/dist/{types-DDpRvBK_.d.ts → types-KwFsKkFJ.d.ts} +8 -2
  92. package/dist/{types-DDpRvBK_.d.ts.map → types-KwFsKkFJ.d.ts.map} +1 -1
  93. package/package.json +1 -1
  94. package/dist/clis/args/common-Dsf1vpHV.d.mts.map +0 -1
  95. package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
  96. package/dist/clis/args/connect-DetTnI8g.d.mts.map +0 -1
  97. package/dist/config-loader-B845Hidf.js.map +0 -1
@@ -11,7 +11,8 @@ const DEFAULT_CONNECT_CONFIG = {
11
11
  logLevel: "info",
12
12
  basePath: "/",
13
13
  offline: true,
14
- studioMode: false
14
+ studioMode: false,
15
+ workflowsEnabled: false
15
16
  },
16
17
  ai: { assistantEnabled: false },
17
18
  packages: {
@@ -144,4 +145,4 @@ var ConfigLoader = class {
144
145
  //#endregion
145
146
  export { buildRuntimeConfig as i, deepMerge as n, DEFAULT_CONNECT_CONFIG as r, ConfigLoader as t };
146
147
 
147
- //# sourceMappingURL=config-loader-B845Hidf.js.map
148
+ //# sourceMappingURL=config-loader-e4-qdVVI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader-e4-qdVVI.js","names":[],"sources":["../connect/runtime-config.ts","../connect/config-loader.ts"],"sourcesContent":["import type {\n PHConnectRuntimeConfig,\n PowerhouseConfig,\n PowerhousePackage,\n} from \"../clis/types.js\";\n\nexport type RuntimePowerhouseConfig = {\n schemaVersion: 2;\n packages: PowerhousePackage[];\n packageRegistryUrl?: string;\n localPackage: { name: string; version: string } | null;\n connect: PHConnectRuntimeConfig;\n};\n\n/** Defaults for every field Connect reads at runtime, merged into the\n * `connect.*` block at boot; also the dist emitter's and the scaffold's base. */\nexport const DEFAULT_CONNECT_CONFIG: PHConnectRuntimeConfig = {\n branding: {\n appName: \"Powerhouse Connect\",\n homeBackground: null,\n },\n app: {\n logLevel: \"info\",\n basePath: \"/\",\n offline: true,\n studioMode: false,\n workflowsEnabled: false,\n },\n ai: {\n assistantEnabled: false,\n },\n packages: {\n externalEnabled: true,\n liveReload: false,\n },\n drives: {\n allowAddDrive: true,\n defaultDrives: [],\n sections: {\n remote: { enabled: true, allowAdd: true, allowDelete: true },\n local: { enabled: true, allowAdd: true, allowDelete: true },\n },\n },\n renown: {\n url: \"https://www.renown.id\",\n networkId: \"eip155\",\n chainId: 1,\n },\n sentry: {\n // `dsn: null` is the disabled-Sentry state — the SPA never loads the\n // Sentry SDK chunk. Override via `ph connect config --sentry-dsn ...`\n // or by including `connect.sentry.dsn` in PH_CONNECT_CONFIG_JSON.\n dsn: null,\n env: \"dev\",\n tracing: false,\n },\n instance: {\n namespace: null,\n reactorWorker: false,\n },\n reactor: {\n featureFlags: {\n documentDecisions: false,\n authEnforcement: false,\n authGroups: false,\n authConditions: false,\n },\n },\n};\n\nexport function buildRuntimeConfig(\n source: Pick<PowerhouseConfig, \"packages\" | \"connect\" | \"packageRegistryUrl\">,\n projectInfo: { name: string; version: string } | null,\n): RuntimePowerhouseConfig {\n const result: RuntimePowerhouseConfig = {\n schemaVersion: 2,\n packages: source.packages ?? [],\n localPackage: projectInfo,\n connect: source.connect ?? {},\n };\n if (\n typeof source.packageRegistryUrl === \"string\" &&\n source.packageRegistryUrl !== \"\"\n ) {\n result.packageRegistryUrl = source.packageRegistryUrl;\n }\n return result;\n}\n","// Environment-neutral config loader. Wraps a `ConfigAdapter` (the IO layer)\n// with in-process caching and deep-merge-with-defaults reads.\n//\n// No validation. The loader trusts that whatever bytes the adapter returns\n// can be merged into the default Connect config; missing or partial fields\n// fall back to DEFAULT_CONNECT_CONFIG, so the SPA always sees a complete\n// `connect.*` block.\n//\n// Top-level fields outside `connect.*` (e.g. `studio.port` in the source\n// powerhouse.config.json) pass through untouched on both read and write.\n// They're not Connect's concern, but a write-back round-trip preserves\n// them so editing tools don't accidentally drop them.\n\nimport { isPlainObject } from \"remeda\";\nimport type { PHConnectRuntimeConfig } from \"../clis/types.js\";\nimport { DEFAULT_CONNECT_CONFIG } from \"./runtime-config.js\";\n\n/** Recursive Partial. Arrays are leaves — `write({ packages: [...] })`\n * replaces the array, it doesn't merge. */\nexport type DeepPartial<T> =\n T extends Array<infer U>\n ? Array<U>\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/**\n * Shape returned by `ConfigLoader.read()`. The loader is Connect-scoped:\n * it guarantees `connect` is present and fully populated from\n * DEFAULT_CONNECT_CONFIG, but lets any other top-level fields pass\n * through unchanged so source-config-only fields (studio, reactor, auth,\n * documentModelsDir, etc.) survive a read+write round-trip.\n */\nexport type ConfigShape = Record<string, unknown> & {\n connect: PHConnectRuntimeConfig;\n};\n\n/**\n * Abstract IO layer for `powerhouse.config.json`.\n *\n * Implementations decide where bytes come from and go to. The shipped\n * adapter is `JsonConfigAdapter` (reads via fetch in the browser, fs in\n * Node; writes via fs in Node, throws in the browser). Future adapters\n * (remote-JSON, GraphQL) plug in without changing the loader or any\n * consumer.\n */\nexport interface ConfigAdapter {\n /** Read raw JSON-parsed payload from the backing store. */\n read(): Promise<unknown>;\n /** Persist a fully-formed config. */\n write(next: ConfigShape): Promise<void>;\n /** Human-readable description used in errors and logs. */\n readonly source: string;\n}\n\n/**\n * Deep-merge `patch` into `base`. Object fields recurse; arrays and\n * primitives replace. `undefined` in patch leaves the base value\n * untouched (no unset). `null` in patch overwrites with null.\n *\n * Exported for unit tests; consumers use ConfigLoader.write() which\n * applies this internally.\n */\nexport function deepMerge<T>(base: T, patch: DeepPartial<T>): T {\n if (!isPlainObject(base) || !isPlainObject(patch)) {\n return patch as T;\n }\n const result: Record<string, unknown> = { ...base };\n for (const [key, patchValue] of Object.entries(patch)) {\n if (patchValue === undefined) continue;\n const baseValue = result[key];\n if (isPlainObject(baseValue) && isPlainObject(patchValue)) {\n result[key] = deepMerge(\n baseValue,\n patchValue as DeepPartial<typeof baseValue>,\n );\n } else {\n result[key] = patchValue;\n }\n }\n return result as T;\n}\n\n/**\n * Pluggable loader on top of a `ConfigAdapter`.\n *\n * Responsibilities:\n * - merge-with-defaults on read (so consumers never see a partial connect block)\n * - in-process caching (call `invalidate()` to force re-read)\n * - deep-merge for partial writes; writes the merged whole back through the adapter\n *\n * The cache is module-instance scoped — every `new ConfigLoader(...)` has\n * its own cache. The browser SPA constructs the loader once at boot; the\n * CLI typically constructs a fresh loader per command.\n */\nexport class ConfigLoader {\n private cache: ConfigShape | undefined;\n\n constructor(\n private readonly adapter: ConfigAdapter,\n private readonly defaults: PHConnectRuntimeConfig = DEFAULT_CONNECT_CONFIG,\n ) {}\n\n /** Returns the config with the default connect block merged in.\n * Cached after the first successful call. */\n async read(): Promise<ConfigShape> {\n if (this.cache) return this.cache;\n const raw = await this.adapter.read();\n const obj = isPlainObject(raw) ? raw : {};\n const connectRaw = isPlainObject(obj.connect) ? obj.connect : {};\n this.cache = {\n ...obj,\n connect: deepMerge(\n this.defaults,\n connectRaw as DeepPartial<PHConnectRuntimeConfig>,\n ),\n };\n return this.cache;\n }\n\n /**\n * Returns the cached config synchronously. Throws if `read()` has not\n * resolved yet — matches Connect's `getRuntimeConfig()` shape.\n */\n getCached(): ConfigShape {\n if (!this.cache) {\n throw new Error(\n `ConfigLoader (${this.adapter.source}): cache empty; call read() first.`,\n );\n }\n return this.cache;\n }\n\n /** Drop the in-memory cache. Next `read()` re-fetches from the adapter. */\n invalidate(): void {\n this.cache = undefined;\n }\n\n /**\n * Deep-merge `patch` into the current config and persist via the adapter.\n * Returns the new full config (also updates the cache). Arrays in `patch`\n * replace — they do NOT append.\n */\n async write(patch: DeepPartial<ConfigShape>): Promise<ConfigShape> {\n const current = await this.read();\n const next = deepMerge(current, patch);\n await this.adapter.write(next);\n this.cache = next;\n return next;\n }\n}\n"],"mappings":";;;;AAgBA,MAAa,yBAAiD;CAC5D,UAAU;EACR,SAAS;EACT,gBAAgB;EACjB;CACD,KAAK;EACH,UAAU;EACV,UAAU;EACV,SAAS;EACT,YAAY;EACZ,kBAAkB;EACnB;CACD,IAAI,EACF,kBAAkB,OACnB;CACD,UAAU;EACR,iBAAiB;EACjB,YAAY;EACb;CACD,QAAQ;EACN,eAAe;EACf,eAAe,EAAE;EACjB,UAAU;GACR,QAAQ;IAAE,SAAS;IAAM,UAAU;IAAM,aAAa;IAAM;GAC5D,OAAO;IAAE,SAAS;IAAM,UAAU;IAAM,aAAa;IAAM;GAC5D;EACF;CACD,QAAQ;EACN,KAAK;EACL,WAAW;EACX,SAAS;EACV;CACD,QAAQ;EAIN,KAAK;EACL,KAAK;EACL,SAAS;EACV;CACD,UAAU;EACR,WAAW;EACX,eAAe;EAChB;CACD,SAAS,EACP,cAAc;EACZ,mBAAmB;EACnB,iBAAiB;EACjB,YAAY;EACZ,gBAAgB;EACjB,EACF;CACF;AAED,SAAgB,mBACd,QACA,aACyB;CACzB,MAAM,SAAkC;EACtC,eAAe;EACf,UAAU,OAAO,YAAY,EAAE;EAC/B,cAAc;EACd,SAAS,OAAO,WAAW,EAAE;EAC9B;AACD,KACE,OAAO,OAAO,uBA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+ import { D as PHConnectRuntimeConfig } from "../types-DX5QXaOU.js";
2
2
 
3
3
  //#region connect/config-loader.d.ts
4
4
  /** Recursive Partial. Arrays are leaves — `write({ packages: [...] })`
@@ -1,2 +1,2 @@
1
- import { n as deepMerge, t as ConfigLoader } from "../config-loader-B845Hidf.js";
1
+ import { n as deepMerge, t as ConfigLoader } from "../config-loader-e4-qdVVI.js";
2
2
  export { ConfigLoader, deepMerge };
@@ -1,8 +1,23 @@
1
- import { D as PHConnectRuntimeConfig, I as PowerhouseConfig, L as PowerhousePackage, S as PHConnectPwaUrlPattern, _ as PHConnectPwaCacheStrategy, b as PHConnectPwaManifest, g as PHConnectPwa, v as PHConnectPwaFileHandler, x as PHConnectPwaRuntimeCaching, y as PHConnectPwaIcon } from "../types-BIoOWpOT.js";
1
+ import { D as PHConnectRuntimeConfig, I as PowerhouseConfig, L as PowerhousePackage, S as PHConnectPwaUrlPattern, _ as PHConnectPwaCacheStrategy, b as PHConnectPwaManifest, g as PHConnectPwa, v as PHConnectPwaFileHandler, x as PHConnectPwaRuntimeCaching, y as PHConnectPwaIcon } from "../types-DX5QXaOU.js";
2
2
  import { ConfigAdapter, ConfigLoader, ConfigShape, DeepPartial, deepMerge } from "./config-loader.js";
3
3
  import { JsonConfigAdapter, JsonConfigAdapterOptions } from "./json-adapter.js";
4
4
  import { z } from "zod";
5
5
 
6
+ //#region connect/dynamic-base.d.ts
7
+ /**
8
+ * The base a dynamic-base Connect build is compiled against. The build emits
9
+ * this literal wherever a base-relative URL would go, and the serving layer
10
+ * (the dynamic-base vite plugin at build time, the connect proxy at serve
11
+ * time) rewrites it to the base the app is actually deployed under.
12
+ *
13
+ * It lives here, in the browser-safe shared package, rather than in
14
+ * `@powerhousedao/builder-tools`, because both the node-only build toolchain
15
+ * and Connect's own browser code need it. Importing builder-tools from app
16
+ * code pulls the whole build toolchain (and its node-only `read-pkg`
17
+ * dependency) into the browser graph.
18
+ */
19
+ declare const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
20
+ //#endregion
6
21
  //#region connect/env-config.d.ts
7
22
  /**
8
23
  * Build-time configuration schema
@@ -367,6 +382,11 @@ declare const phConnectRuntimeConfigSchema: {
367
382
  readonly description: "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.";
368
383
  readonly default: false;
369
384
  };
385
+ readonly workflowsEnabled: {
386
+ readonly type: "boolean";
387
+ readonly description: "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. Connect's counterpart to the reactor-side `workflows.enabled` / PH_WORKFLOWS_ENABLED; independent of studioMode. False by default.";
388
+ readonly default: false;
389
+ };
370
390
  };
371
391
  };
372
392
  readonly ai: {
@@ -911,5 +931,81 @@ declare const phConnectRuntimeConfigSchema: {
911
931
  };
912
932
  };
913
933
  //#endregion
914
- export { ConfigAdapter, ConfigLoader, ConfigShape, ConnectBuildEnv, ConnectEnv, ConnectRuntimeEnv, DEFAULT_CONNECT_CONFIG, DeepPartial, JsonConfigAdapter, JsonConfigAdapterOptions, LoadEnvOptions, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, PwaContribution, PwaWebManifest, ROOT_STORAGE_NAMESPACE, RuntimePowerhouseConfig, buildRuntimeConfig, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, phConnectRuntimeConfigSchema, powerhousePackageSchema, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
934
+ //#region connect/shared-deps.d.ts
935
+ type SharedDep = {
936
+ specifier: string;
937
+ package: string;
938
+ };
939
+ /**
940
+ * The dependency set Connect and loaded packages share via the import map.
941
+ * `@powerhousedao/connect` is deliberately absent: it is the Connect app
942
+ * itself (no importable exports), so there is nothing to share.
943
+ */
944
+ declare const SHARED_DEPS: readonly SharedDep[];
945
+ declare const SHARED_DEP_SPECIFIERS: readonly string[];
946
+ /**
947
+ * The `@powerhousedao/shared` subpaths the production vendor bundles. The
948
+ * bare root is deliberately absent: its type barrel references node-only
949
+ * modules (`clis/`), which the current vite/rolldown cannot bundle for the
950
+ * browser — vendoring the root fails the build (a pre-existing latent
951
+ * issue). A package that imports the bare root is simply not shared; it
952
+ * bundles its own copy.
953
+ */
954
+ declare const SHARED_SUBPATHS: readonly string[];
955
+ /**
956
+ * The specifiers a package build may safely externalize onto the host's
957
+ * import map — i.e. the ones the vendor actually publishes an entry for.
958
+ *
959
+ * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as
960
+ * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and
961
+ * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).
962
+ * Externalizing those would leave a bare specifier in the package's output
963
+ * that nothing in the import map resolves, so the package would fail to load
964
+ * at runtime instead of simply bundling its own copy.
965
+ */
966
+ declare const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[];
967
+ /** Split a specifier into its package name and subpath ("" for a root). */
968
+ declare function parseDepSpec(spec: string): {
969
+ pkg: string;
970
+ sub: string;
971
+ };
972
+ /**
973
+ * Return the import/export specifiers in `source` that are a shared
974
+ * specifier (or a subpath of one), sorted. Heuristic: only statement
975
+ * positions are scanned (`from "x"`, `import "x"`, `import("x")`;
976
+ * `export … from "x"` is covered by the `from` pattern), so import-like
977
+ * text inside comments or strings can be reported too. That errs toward
978
+ * over-reporting, which is the safe direction for the advisory build
979
+ * warning.
980
+ */
981
+ declare function findSharedImports(source: string, specs?: readonly string[]): string[];
982
+ /**
983
+ * Rewrite a package source for blob import in a worker context (import maps
984
+ * don't apply there): shared specifiers become their mapped URLs, and
985
+ * relative (`./`, `../`) specifiers become absolute against `sourceUrl`
986
+ * (a blob URL has no directory to resolve against). `#` subpath imports are
987
+ * deliberately left alone: they resolve via the package's own
988
+ * `package.json` "imports" field, which the rewrite cannot reproduce.
989
+ * Returns the input unchanged when nothing matched.
990
+ */
991
+ declare function rewritePackageSource(source: string, sourceUrl: string, imports: Record<string, string>): string;
992
+ type SharedDepMismatch = {
993
+ package: string;
994
+ required: string;
995
+ provided: string;
996
+ };
997
+ type PackageDeps = {
998
+ dependencies?: Record<string, unknown>;
999
+ peerDependencies?: Record<string, unknown>;
1000
+ };
1001
+ /**
1002
+ * Compare a package's declared ranges against the host's version table.
1003
+ * `hostVersions` defines the checked set (only deps present in it are
1004
+ * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)
1005
+ * and unparseable ranges never mismatch.
1006
+ */
1007
+ declare function checkSharedDeps(pkgJson: PackageDeps, hostVersions: Record<string, string>): SharedDepMismatch[];
1008
+ declare function formatSharedDepWarnings(mismatches: SharedDepMismatch[]): string[];
1009
+ //#endregion
1010
+ export { ConfigAdapter, ConfigLoader, ConfigShape, ConnectBuildEnv, ConnectEnv, ConnectRuntimeEnv, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, DeepPartial, EXTERNALIZABLE_SHARED_SPECIFIERS, JsonConfigAdapter, JsonConfigAdapterOptions, LoadEnvOptions, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, PackageDeps, PwaContribution, PwaWebManifest, ROOT_STORAGE_NAMESPACE, RuntimePowerhouseConfig, SHARED_DEPS, SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, SharedDep, SharedDepMismatch, buildRuntimeConfig, checkSharedDeps, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, findSharedImports, formatSharedDepWarnings, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, parseDepSpec, phConnectRuntimeConfigSchema, powerhousePackageSchema, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
915
1011
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/runtime-config.ts","../../connect/schema-fragments.ts"],"mappings":";;;;;;;;;cAoBM,cAAA,EAAc,CAAA,CAAA,SAAA;;;;;;;;;;;;cA2HP,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAOhB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKjB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,cAAA;AAAA,KACjC,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,KACnC,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,gBAAA;;;;UASvB,cAAA;;;;EAIf,UAAA,GAAa,MAAA;;;;EAIb,OAAA,GAAU,MAAA;AAAA;;;;;;;;;;iBAkEI,cAAA,CAAe,OAAA,GAAS,cAAA,GAAsB,UAAA;;;;;;;;;iBAkB9C,cAAA,CACd,OAAA,GAAS,cAAA,GACR,iBAAA;;;;;;;;;;;;;;;iBAoBa,aAAA,CAAc,MAAA,EAAQ,OAAA,CAAQ,UAAA;;;;;;;;;;;;;;;;;iBA4C9B,iBAAA,CAAkB,QAAA;;;;;;cA8BrB,sBAAA;;;;;;;;;;;;;;;;;;;;;;;iBAwBG,mBAAA,CAAoB,QAAA;;;;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BAAA;EAAA"}
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":";;;;;;;;;;;;AAYA;;;;;;cAAa,wBAAA;;;;;;cCQP,cAAA,EAAc,CAAA,CAAA,SAAA;;;;;;;;;;AApBI;;cA+IX,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAOhB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKjB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,cAAA;AAAA,KACjC,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,KACnC,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,gBAAA;;;;UASvB,cAAA;;;;EAIf,UAAA,GAAa,MAAA;;;;EAIb,OAAA,GAAU,MAAA;AAAA;;;;;;;;;;iBAkEI,cAAA,CAAe,OAAA,GAAS,cAAA,GAAsB,UAAA;;;;;;;;;iBAkB9C,cAAA,CACd,OAAA,GAAS,cAAA,GACR,iBAAA;;;;;;;;;;;;;;;iBAoBa,aAAA,CAAc,MAAA,EAAQ,OAAA,CAAQ,UAAA;;;;;;;;;;;;;;;;;iBA4C9B,iBAAA,CAAkB,QAAA;;;;;;cA8BrB,sBAAA;;;;;;;;;;;;;;;;;;;;;;;iBAwBG,mBAAA,CAAoB,QAAA;;;;KCrVxB,eAAA;0EAEV,MAAA;EACA,MAAA,EAAQ,YAAA;AAAA;AAAA,KA6BL,QAAA;EACH,GAAA;EACA,KAAA;EACA,OAAA;AAAA;;iBAyBc,WAAA,WAAsB,QAAA,CAAA,CAAU,KAAA,EAAO,CAAA,KAAM,CAAA;;;;;;;;;iBA4B7C,kBAAA,kBAAA,CAAqC,QAAA,EAAU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as deepMerge, r as DEFAULT_CONNECT_CONFIG, t as ConfigLoader } from "../config-loader-e4-qdVVI.js";
2
2
  import { JsonConfigAdapter } from "./json-adapter.js";
3
3
  import { z } from "zod";
4
+ import { satisfies, validRange } from "semver";
5
+ //#region connect/dynamic-base.ts
6
+ /**
7
+ * The base a dynamic-base Connect build is compiled against. The build emits
8
+ * this literal wherever a base-relative URL would go, and the serving layer
9
+ * (the dynamic-base vite plugin at build time, the connect proxy at serve
10
+ * time) rewrites it to the base the app is actually deployed under.
11
+ *
12
+ * It lives here, in the browser-safe shared package, rather than in
13
+ * `@powerhousedao/builder-tools`, because both the node-only build toolchain
14
+ * and Connect's own browser code need it. Importing builder-tools from app
15
+ * code pulls the whole build toolchain (and its node-only `read-pkg`
16
+ * dependency) into the browser graph.
17
+ */
18
+ const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
19
+ //#endregion
4
20
  //#region connect/env-config.ts
5
21
  /**
6
22
  * Coerces string values to boolean.
@@ -560,6 +576,11 @@ const phConnectRuntimeConfigSchema = {
560
576
  type: "boolean",
561
577
  description: "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.",
562
578
  default: false
579
+ },
580
+ workflowsEnabled: {
581
+ type: "boolean",
582
+ description: "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. Connect's counterpart to the reactor-side `workflows.enabled` / PH_WORKFLOWS_ENABLED; independent of studioMode. False by default.",
583
+ default: false
563
584
  }
564
585
  }
565
586
  },
@@ -964,6 +985,169 @@ const phConnectRuntimeConfigSchema = {
964
985
  }
965
986
  };
966
987
  //#endregion
967
- export { ConfigLoader, DEFAULT_CONNECT_CONFIG, JsonConfigAdapter, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, ROOT_STORAGE_NAMESPACE, buildRuntimeConfig, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, phConnectRuntimeConfigSchema, powerhousePackageSchema, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
988
+ //#region connect/shared-deps.ts
989
+ /**
990
+ * The dependency set Connect and loaded packages share via the import map.
991
+ * `@powerhousedao/connect` is deliberately absent: it is the Connect app
992
+ * itself (no importable exports), so there is nothing to share.
993
+ */
994
+ const SHARED_DEPS = [
995
+ {
996
+ specifier: "document-model",
997
+ package: "document-model"
998
+ },
999
+ {
1000
+ specifier: "@powerhousedao/document-engineering",
1001
+ package: "@powerhousedao/document-engineering"
1002
+ },
1003
+ {
1004
+ specifier: "@powerhousedao/shared",
1005
+ package: "@powerhousedao/shared"
1006
+ },
1007
+ {
1008
+ specifier: "@powerhousedao/shared/registry/urls",
1009
+ package: "@powerhousedao/shared"
1010
+ },
1011
+ {
1012
+ specifier: "@powerhousedao/design-system/connect",
1013
+ package: "@powerhousedao/design-system"
1014
+ },
1015
+ {
1016
+ specifier: "@powerhousedao/reactor-browser",
1017
+ package: "@powerhousedao/reactor-browser"
1018
+ },
1019
+ {
1020
+ specifier: "zod",
1021
+ package: "zod"
1022
+ }
1023
+ ];
1024
+ const SHARED_DEP_SPECIFIERS = SHARED_DEPS.map((d) => d.specifier);
1025
+ /**
1026
+ * The `@powerhousedao/shared` subpaths the production vendor bundles. The
1027
+ * bare root is deliberately absent: its type barrel references node-only
1028
+ * modules (`clis/`), which the current vite/rolldown cannot bundle for the
1029
+ * browser — vendoring the root fails the build (a pre-existing latent
1030
+ * issue). A package that imports the bare root is simply not shared; it
1031
+ * bundles its own copy.
1032
+ */
1033
+ const SHARED_SUBPATHS = [
1034
+ "connect",
1035
+ "document-model",
1036
+ "processors",
1037
+ "document-drive",
1038
+ "registry",
1039
+ "registry/urls",
1040
+ "registry/manifest-slim"
1041
+ ];
1042
+ /**
1043
+ * The specifiers a package build may safely externalize onto the host's
1044
+ * import map — i.e. the ones the vendor actually publishes an entry for.
1045
+ *
1046
+ * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as
1047
+ * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and
1048
+ * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).
1049
+ * Externalizing those would leave a bare specifier in the package's output
1050
+ * that nothing in the import map resolves, so the package would fail to load
1051
+ * at runtime instead of simply bundling its own copy.
1052
+ */
1053
+ const EXTERNALIZABLE_SHARED_SPECIFIERS = [...new Set([...SHARED_DEP_SPECIFIERS.filter((s) => s !== "@powerhousedao/shared"), ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`)])];
1054
+ /** Split a specifier into its package name and subpath ("" for a root). */
1055
+ function parseDepSpec(spec) {
1056
+ if (spec.startsWith("@")) {
1057
+ const parts = spec.split("/");
1058
+ return {
1059
+ pkg: parts.slice(0, 2).join("/"),
1060
+ sub: parts.slice(2).join("/")
1061
+ };
1062
+ }
1063
+ const i = spec.indexOf("/");
1064
+ return i === -1 ? {
1065
+ pkg: spec,
1066
+ sub: ""
1067
+ } : {
1068
+ pkg: spec.slice(0, i),
1069
+ sub: spec.slice(i + 1)
1070
+ };
1071
+ }
1072
+ function isSharedSpecifier(spec, specs) {
1073
+ return specs.some((s) => spec === s || spec.startsWith(s + "/"));
1074
+ }
1075
+ /**
1076
+ * Return the import/export specifiers in `source` that are a shared
1077
+ * specifier (or a subpath of one), sorted. Heuristic: only statement
1078
+ * positions are scanned (`from "x"`, `import "x"`, `import("x")`;
1079
+ * `export … from "x"` is covered by the `from` pattern), so import-like
1080
+ * text inside comments or strings can be reported too. That errs toward
1081
+ * over-reporting, which is the safe direction for the advisory build
1082
+ * warning.
1083
+ */
1084
+ function findSharedImports(source, specs = SHARED_DEP_SPECIFIERS) {
1085
+ const found = /* @__PURE__ */ new Set();
1086
+ for (const re of [
1087
+ /\bfrom\s+["']([^"'\\]+)["']/g,
1088
+ /\bimport\s+["']([^"'\\]+)["']/g,
1089
+ /\bimport\s*\(\s*["']([^"'\\]+)["']\s*\)/g
1090
+ ]) for (const m of source.matchAll(re)) {
1091
+ const spec = m[1];
1092
+ if (isSharedSpecifier(spec, specs)) found.add(spec);
1093
+ }
1094
+ return [...found].sort();
1095
+ }
1096
+ /**
1097
+ * Rewrite a package source for blob import in a worker context (import maps
1098
+ * don't apply there): shared specifiers become their mapped URLs, and
1099
+ * relative (`./`, `../`) specifiers become absolute against `sourceUrl`
1100
+ * (a blob URL has no directory to resolve against). `#` subpath imports are
1101
+ * deliberately left alone: they resolve via the package's own
1102
+ * `package.json` "imports" field, which the rewrite cannot reproduce.
1103
+ * Returns the input unchanged when nothing matched.
1104
+ */
1105
+ function rewritePackageSource(source, sourceUrl, imports) {
1106
+ if (!Object.keys(imports).length) return source;
1107
+ const base = new URL(sourceUrl);
1108
+ const map = (spec) => {
1109
+ const mapped = imports[spec];
1110
+ if (mapped) return mapped;
1111
+ if (spec.startsWith("./") || spec.startsWith("../")) return new URL(spec, base).href;
1112
+ return null;
1113
+ };
1114
+ let out = source;
1115
+ for (const re of [
1116
+ /\bfrom\s+(["'])([^"'\\]+)\1/g,
1117
+ /\bimport\s+(["'])([^"'\\]+)\1/g,
1118
+ /\bimport\s*\(\s*(["'])([^"'\\]+)\1\s*\)/g
1119
+ ]) out = out.replace(re, (match, quote, spec) => {
1120
+ const mapped = map(spec);
1121
+ return mapped ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`) : match;
1122
+ });
1123
+ return out;
1124
+ }
1125
+ /**
1126
+ * Compare a package's declared ranges against the host's version table.
1127
+ * `hostVersions` defines the checked set (only deps present in it are
1128
+ * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)
1129
+ * and unparseable ranges never mismatch.
1130
+ */
1131
+ function checkSharedDeps(pkgJson, hostVersions) {
1132
+ const out = [];
1133
+ const entries = [...Object.entries(pkgJson.dependencies ?? {}), ...Object.entries(pkgJson.peerDependencies ?? {})];
1134
+ for (const [dep, range] of entries) {
1135
+ const provided = hostVersions[dep];
1136
+ if (provided === void 0 || typeof range !== "string") continue;
1137
+ if (range === "*" || /^[a-z]+:/i.test(range)) continue;
1138
+ if (!validRange(range)) continue;
1139
+ if (!satisfies(provided, range, { includePrerelease: true })) out.push({
1140
+ package: dep,
1141
+ required: range,
1142
+ provided
1143
+ });
1144
+ }
1145
+ return out;
1146
+ }
1147
+ function formatSharedDepWarnings(mismatches) {
1148
+ return mismatches.map((m) => `${m.package}: requires ${m.required}, Connect provides ${m.provided}`);
1149
+ }
1150
+ //#endregion
1151
+ 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, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
968
1152
 
969
1153
  //# sourceMappingURL=index.js.map