@powerhousedao/shared 6.1.0-dev.20 → 6.1.0-dev.21

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.
@@ -21,7 +21,10 @@ const DEFAULT_CONNECT_CONFIG = {
21
21
  logLevel: "info",
22
22
  basePath: "/"
23
23
  },
24
- packages: { externalEnabled: true },
24
+ packages: {
25
+ externalEnabled: true,
26
+ liveReload: false
27
+ },
25
28
  drives: {
26
29
  allowAddDrive: true,
27
30
  defaultDrives: [],
@@ -138,4 +141,4 @@ var ConfigLoader = class {
138
141
  //#endregion
139
142
  export { buildRuntimeConfig as i, deepMerge as n, DEFAULT_CONNECT_CONFIG as r, ConfigLoader as t };
140
143
 
141
- //# sourceMappingURL=config-loader-BPXmnFbm.js.map
144
+ //# sourceMappingURL=config-loader-DORViRnN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader-DORViRnN.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/**\n * Default values for every Connect-relevant field. Merged with the\n * `connect.*` block of whatever `powerhouse.config.json` Connect is pointed\n * at, so the SPA never has to guard against undefined fields.\n *\n * Scoped to fields Connect actually reads at runtime — build-time concerns\n * (studio port, switchboard port, reactor.*, auth.*) live in the source\n * config but are not Connect's business and not represented here.\n *\n * Single source of truth for defaults across Connect's runtime read (via\n * ConfigLoader merge), the dist emitter, and the codegen scaffold template.\n */\nexport const DEFAULT_CONNECT_CONFIG: PHConnectRuntimeConfig = {\n branding: {\n appName: \"Powerhouse Connect\",\n homeBackground: null,\n },\n app: {\n logLevel: \"info\",\n basePath: \"/\",\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};\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":";;;;;;;;;;;;;;AA0BA,MAAa,yBAAiD;CAC5D,UAAU;EACR,SAAS;EACT,gBAAgB;EACjB;CACD,KAAK;EACH,UAAU;EACV,UAAU;EACX;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,UAA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AQ,OAAO,oCACtC;AAEH,SAAO,KAAK;;;CAId,aAAmB;AACjB,OAAK,QAAQ,KAAA;;;;;;;CAQf,MAAM,MAAM,OAAuD;EAEjE,MAAM,OAAO,UADG,MAAM,KAAK,MAAM,EACD,MAAM;AACtC,QAAM,KAAK,QAAQ,MAAM,KAAK;AAC9B,OAAK,QAAQ;AACb,SAAO"}
@@ -1,4 +1,4 @@
1
- import { p as PHConnectRuntimeConfig } from "../types-DgDE_nr0.js";
1
+ import { p as PHConnectRuntimeConfig } from "../types-Daq_zHP_.js";
2
2
  //#region connect/config-loader.d.ts
3
3
  /** Recursive Partial. Arrays are leaves — `write({ packages: [...] })`
4
4
  * replaces the array, it doesn't merge. */
@@ -1,2 +1,2 @@
1
- import { n as deepMerge, t as ConfigLoader } from "../config-loader-BPXmnFbm.js";
1
+ import { n as deepMerge, t as ConfigLoader } from "../config-loader-DORViRnN.js";
2
2
  export { ConfigLoader, deepMerge };
@@ -1,4 +1,4 @@
1
- import { b as PowerhousePackage, p as PHConnectRuntimeConfig, y as PowerhouseConfig } from "../types-DgDE_nr0.js";
1
+ import { b as PowerhousePackage, p as PHConnectRuntimeConfig, y as PowerhouseConfig } from "../types-Daq_zHP_.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";
@@ -281,6 +281,11 @@ declare const phConnectRuntimeConfigSchema: {
281
281
  readonly description: "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.";
282
282
  readonly default: true;
283
283
  };
284
+ readonly liveReload: {
285
+ readonly type: "boolean";
286
+ readonly description: "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).";
287
+ readonly default: false;
288
+ };
284
289
  };
285
290
  };
286
291
  readonly drives: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/env-config.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;;;KCpXxB,uBAAA;EACV,aAAA;EACA,QAAA,EAAU,iBAAA;EACV,kBAAA;EACA,YAAA;IAAgB,IAAA;IAAc,OAAA;EAAA;EAC9B,OAAA,EAAS,sBAAA;AAAA;;;;;;;;;;;;;cAeE,sBAAA,EAAwB,sBAAA;AAAA,iBAmCrB,kBAAA,CACd,MAAA,EAAQ,IAAA,CAAK,gBAAA,kDACb,WAAA;EAAe,IAAA;EAAc,OAAA;AAAA,WAC5B,uBAAA;;;cCzDU,uBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;cAuDA,4BAAA;EAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/env-config.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;;;KCpXxB,uBAAA;EACV,aAAA;EACA,QAAA,EAAU,iBAAA;EACV,kBAAA;EACA,YAAA;IAAgB,IAAA;IAAc,OAAA;EAAA;EAC9B,OAAA,EAAS,sBAAA;AAAA;;;;;;;;;;;;;cAeE,sBAAA,EAAwB,sBAAA;AAAA,iBAoCrB,kBAAA,CACd,MAAA,EAAQ,IAAA,CAAK,gBAAA,kDACb,WAAA;EAAe,IAAA;EAAc,OAAA;AAAA,WAC5B,uBAAA;;;cC1DU,uBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;cAuDA,4BAAA;EAAA"}
@@ -1,4 +1,4 @@
1
- import { i as buildRuntimeConfig, n as deepMerge, r as DEFAULT_CONNECT_CONFIG, t as ConfigLoader } from "../config-loader-BPXmnFbm.js";
1
+ import { i as buildRuntimeConfig, n as deepMerge, r as DEFAULT_CONNECT_CONFIG, t as ConfigLoader } from "../config-loader-DORViRnN.js";
2
2
  import { JsonConfigAdapter } from "./json-adapter.js";
3
3
  import { z } from "zod";
4
4
  //#region connect/env-config.ts
@@ -309,11 +309,18 @@ const phConnectRuntimeConfigSchema = {
309
309
  type: "object",
310
310
  additionalProperties: false,
311
311
  description: "Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).",
312
- properties: { externalEnabled: {
313
- type: "boolean",
314
- description: "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.",
315
- default: true
316
- } }
312
+ properties: {
313
+ externalEnabled: {
314
+ type: "boolean",
315
+ description: "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.",
316
+ default: true
317
+ },
318
+ liveReload: {
319
+ type: "boolean",
320
+ description: "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).",
321
+ default: false
322
+ }
323
+ }
317
324
  },
318
325
  drives: {
319
326
  type: "object",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../connect/env-config.ts","../../connect/schema-fragments.ts"],"sourcesContent":["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","// 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\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 },\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 },\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 must specify a URL; name and icon are optional overrides.\",\n default: [],\n items: {\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 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 },\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 },\n} as const;\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAC/C,WAAW,QAAQ;AAClB,KAAI,OAAO,QAAQ,UAAW,QAAO;AACrC,QAAO,QAAQ;EACf;;;;AASJ,MAAM,iBAAiB,EAAE,OAAO;CAK9B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAKlC,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CAKvC,sBAAsB,EAAE,QAAQ,CAAC,UAAU;CAK3C,eAAe,EAAE,QAAQ,CAAC,UAAU;CAKpC,mBAAmB,EAAE,QAAQ,CAAC,UAAU;CACzC,CAAC;;;;;;;;;;AAeF,MAAM,kBAAkB,EAAE,OAAO;CAK/B,oBAAoB,EAAE,QAAQ,CAAC,QAAQ,UAAU;CAKjD,wBAAwB,EAAE,QAAQ,CAAC,UAAU;CAC9C,CAAC;;;;;;AAWF,MAAM,yBAAyB,EAAE,OAAO;CAKtC,mCAAmC,cAAc,QAAQ,MAAM;CAM/D,oCAAoC,cAAc,QAAQ,KAAK;CAM/D,kDAAkD,cAAc,QAAQ,KAAK;CAC9E,CAAC;;;;AASF,MAAM,wBAAwB,EAAE,OAAO;CAIrC,gCAAgC,EAAE,QAAQ,CAAC,UAAU;CAKrD,8BAA8B,EAAE,QAAQ,CAAC,UAAU;CAMnD,sCAAsC,cAAc,QAAQ,KAAK;CAMjE,uCAAuC,cAAc,QAAQ,KAAK;CACnE,CAAC;;;;;;AAWF,MAAa,mBAAmB,gBAC7B,OAAO,uBAAuB,MAAM,CACpC,O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AAqB;CACzB,MAAM;CACN,sBAAsB;CACtB,aACE;CACF,YAAY;EACV,SAAS;GACP,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,UAAU;GACR,MAAM;GACN,aACE;GACF,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aACE;GACF,SAAS;GACV;EACF;CACF;AAED,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;KACH;IACD,gBAAgB;KACd,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACH;IACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;MAAQ;KACxC,aACE;KACF,SAAS;KACV;IACD,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY,EACV,iBAAiB;IACf,MAAM;IACN,aACE;IACF,SAAS;IACV,EACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,EAAE;KACX,OAAO;MACL,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,MAAM;MACjB,YAAY;OACV,KAAK,EAAE,MAAM,UAAU;OACvB,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OACnC;MACF;KACF;IACD,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,6BAA6B;KACpD,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;MACR;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACF;CACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../connect/env-config.ts","../../connect/schema-fragments.ts"],"sourcesContent":["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","// 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\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 },\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 must specify a URL; name and icon are optional overrides.\",\n default: [],\n items: {\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 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 },\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 },\n} as const;\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,K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N,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,SAAS;KACP,MAAM;KACN,aACE;KACH;IACD,gBAAgB;KACd,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACH;IACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;MAAQ;KACxC,aACE;KACF,SAAS;KACV;IACD,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,iBAAiB;KACf,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,EAAE;KACX,OAAO;MACL,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,MAAM;MACjB,YAAY;OACV,KAAK,EAAE,MAAM,UAAU;OACvB,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OACnC;MACF;KACF;IACD,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,6BAA6B;KACpD,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;MACR;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACF;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-C1in4fl3.js";
2
- import { S as ServiceActions, _ as ParsedCmdResult, a as PHConnectApp, b as PowerhousePackage, c as PHConnectDriveSection, d as PHConnectPackages, f as PHConnectRenown, g as PackageManagerArgs, h as PHPackageProvider, i as LogLevels, l as PHConnectDriveSections, m as PHConnectSentry, n as DrivePreserveStrategy, o as PHConnectBranding, p as PHConnectRuntimeConfig, r as LogLevel, s as PHConnectDefaultDrive, t as DrivePreserveStrategies, u as PHConnectDrives, v as PathValidation, x as ServiceAction, y as PowerhouseConfig } from "./types-DgDE_nr0.js";
2
+ import { S as ServiceActions, _ as ParsedCmdResult, a as PHConnectApp, b as PowerhousePackage, c as PHConnectDriveSection, d as PHConnectPackages, f as PHConnectRenown, g as PackageManagerArgs, h as PHPackageProvider, i as LogLevels, l as PHConnectDriveSections, m as PHConnectSentry, n as DrivePreserveStrategy, o as PHConnectBranding, p as PHConnectRuntimeConfig, r as LogLevel, s as PHConnectDefaultDrive, t as DrivePreserveStrategies, u as PHConnectDrives, v as PathValidation, x as ServiceAction, y as PowerhouseConfig } from "./types-Daq_zHP_.js";
3
3
  import { $ as DocumentModelDocument, $i as UndoRedoAction, $n as OperationErrorSpecification, $r as SetModelExtensionInput, $t as MappedOperation, A as CreateDocument, Ai as SetOperationTemplateInput, An as MutationSetInitialStateArgs, Ar as ReorderStateExamplesInput, At as FileRegistry, B as DeleteModuleAction, Bi as SignalResult, Bn as MutationSetOperationErrorDescriptionArgs, Br as SchemaSetNameAction, Bt as InputMaybe, C as CodeExample, Ci as SetOperationReducerAction, Cn as MutationReorderModuleOperationsArgs, Cr as ReorderModulesAction, Ct as DocumentSpecification, D as CopyChildDocumentSignal, Di as SetOperationScopeAction, Dn as MutationReorderStateExamplesArgs, Dr as ReorderOperationExamplesAction, Dt as EditorProps, E as CopyChildDocumentInput, Ei as SetOperationSchemaInput, En as MutationReorderOperationExamplesArgs, Er as ReorderOperationErrorsInput, Et as EditorModule, F as DeleteChangeLogItemInput, Fi as SetStateSchemaInput, Fn as MutationSetModuleDescriptionArgs, Fr as Scalars, Ft as IOperation, G as DeleteOperationExampleAction, Gi as SkipHeaderOperationIndex, Gn as MutationSetOperationSchemaArgs, Gr as SetAuthorNameInput, Gt as LoadStateAction, H as DeleteOperationAction, Hi as SignalType, Hn as MutationSetOperationErrorTemplateArgs, Hr as SchemaUndoAction, Ht as IsStateOfType, I as DeleteChildDocumentInput, Ii as Set_Name, In as MutationSetModuleNameArgs, Ir as SchemaLoadStateAction, It as ISignal, J as DeleteStateExampleAction, Ji as StateReducer, Jn as MutationUndoArgs, Jr as SetInitialStateAction, Jt as Load_State, K as DeleteOperationExampleInput, Ki as SkipHeaderOperations, Kn as MutationSetOperationTemplateArgs, Kr as SetAuthorWebsiteAction, Kt as LoadStateActionInput, L as DeleteChildDocumentSignal, Li as Set_PreferredEditor, Ln as MutationSetNameArgs, Lr as SchemaNOOPAction, Lt as ISignalResult, M as CreateDocumentActionInput, Mi as SetPreferredEditorActionInput, Mn as MutationSetModelExtensionArgs, Mr as RevisionsFilter, Mt as IAction, N as CreateState, Ni as SetPreferredEditorOperation, Nn as MutationSetModelIdArgs, Nr as SaveToFile, Nt as ID, O as CreateChildDocumentInput, Oi as SetOperationScopeInput, On as MutationSetAuthorNameArgs, Or as ReorderOperationExamplesInput, Ot as Exact, P as DeleteChangeLogItemAction, Pi as SetStateSchemaAction, Pn as MutationSetModelNameArgs, Pr as SaveToFileHandle, Pt as IDocument, Q as DocumentModelAction, Qi as UndoActionInput, Qn as NOOPAction, Qr as SetModelExtensionAction, Qt as Manifest, R as DeleteDocumentAction, Ri as Signal, Rn as MutationSetOperationDescriptionArgs, Rr as SchemaPruneAction, Rt as ISigner, S as Author, Si as SetOperationNameInput, Sn as MutationReorderChangeLogItemsInputArgs, Sr as ReorderModuleOperationsInput, St as DocumentOperationsIgnoreMap, T as ConfigEntryType, Ti as SetOperationSchemaAction, Tn as MutationReorderOperationErrorsArgs, Tr as ReorderOperationErrorsAction, Tt as EditorDispatch, U as DeleteOperationErrorAction, Ui as SignatureVerificationHandler, Un as MutationSetOperationNameArgs, Ur as ScopeState, Ut as LoadFromFile, V as DeleteModuleInput, Vi as SignalResults, Vn as MutationSetOperationErrorNameArgs, Vr as SchemaSetPreferredEditorAction, Vt as IsDocumentOfType, W as DeleteOperationErrorInput, Wi as SigningParameters, Wn as MutationSetOperationReducerArgs, Wr as SetAuthorNameAction, Wt as LoadFromInput, X as DocumentAction, Xi as Undo, Xn as MutationUpdateOperationExampleArgs, Xr as SetModelDescriptionAction, Xt as MakeMaybe, Y as DeleteStateExampleInput, Yi as SubgraphModule, Yn as MutationUpdateChangeLogItemInputArgs, Yr as SetInitialStateInput, Yt as MakeEmpty, Z as DocumentFile, Zi as UndoAction, Zn as MutationUpdateStateExampleArgs, Zr as SetModelDescriptionInput, Zt as MakeOptional, _ as AddRelationshipActionInput, _i as SetOperationErrorNameAction, _n as MutationDeleteStateExampleArgs, _r as RemoveRelationshipAction, _t as DocumentModelStateAction, a as Actions, aa as UpdateRelationshipActionInput, ai as SetModuleDescriptionInput, an as Mutation, ar as PowerhouseModule, as as IProcessorHostModule, at as DocumentModelLib, b as AssertIsDocumentOfType, bi as SetOperationErrorTemplateInput, bn as MutationPruneArgs, br as ReorderChangeLogItemsInput, bt as DocumentModelVersioningAction, c as AddModuleAction, ca as UpgradeDocumentAction, ci as SetNameAction, cn as MutationAddOperationArgs, cr as PruneActionInput, cs as ProcessorApps, ct as DocumentModelModuleAction, d as AddOperationErrorAction, da as ValidationError, di as SetOperationDescriptionAction, dn as MutationAddStateExampleArgs, dr as Redo, ds as ProcessorFactoryBuilder, dt as DocumentModelOperationErrorAction, ea as UpdateChangeLogItemAction, ei as SetModelIdAction, en as Maybe, er as OperationIndex, et as DocumentModelDocumentModelModule, f as AddOperationErrorInput, fi as SetOperationDescriptionInput, fn as MutationDeleteChangeLogItemInputArgs, fr as RedoAction, fs as ProcessorFilter, ft as DocumentModelOperationErrorOperations, g as AddRelationshipAction, gi as SetOperationErrorDescriptionInput, gn as MutationDeleteOperationExampleArgs, gr as ReleaseNewVersionAction, gt as DocumentModelPHState, h as AddOperationInput, hi as SetOperationErrorDescriptionAction, hn as MutationDeleteOperationErrorArgs, hr as ReducerOptions, hs as TrackedProcessor, ht as DocumentModelOperationOperations, i as ActionVerificationHandler, ia as UpdateRelationshipAction, ii as SetModuleDescriptionAction, in as MoveOperationInput, ir as PartialState, is as IProcessorDispatch, it as DocumentModelInput, j as CreateDocumentAction, ji as SetPreferredEditorAction, jn as MutationSetModelDescriptionArgs, jr as ReplayDocumentOptions, jt as GetDocumentOptions, k as CreateChildDocumentSignal, ki as SetOperationTemplateAction, kn as MutationSetAuthorWebsiteArgs, kr as ReorderStateExamplesAction, kt as FileInput, l as AddModuleInput, la as UpgradeDocumentActionInput, li as SetNameActionInput, ln as MutationAddOperationErrorArgs, lr as Publisher, ls as ProcessorDispatchResult, lt as DocumentModelModuleOperations, m as AddOperationExampleInput, mi as SetOperationErrorCodeInput, mn as MutationDeleteOperationArgs, mr as Reducer, ms as ProcessorStatus, mt as DocumentModelOperationExampleOperations, n as ActionSignatureContext, na as UpdateOperationExampleAction, ni as SetModelNameAction, nn as ModuleSpecification, nr as OperationsByScope, nt as DocumentModelHeaderAction, o as AddChangeLogItemAction, oa as UpdateStateExampleAction, oi as SetModuleNameAction, on as MutationAddChangeLogItemInputArgs, or as Prune, os as IProcessorManager, ot as DocumentModelLocalState, p as AddOperationExampleAction, pi as SetOperationErrorCodeAction, pn as MutationDeleteModuleArgs, pr as RedoActionInput, ps as ProcessorRecord, pt as DocumentModelOperationExampleAction, q as DeleteOperationInput, qi as State, qn as MutationSetStateSchemaArgs, qr as SetAuthorWebsiteInput, qt as LoadStateActionStateInput, r as ActionSigningHandler, ra as UpdateOperationExampleInput, ri as SetModelNameInput, rn as MoveOperationAction, rr as PartialRecord, rs as IProcessor, rt as DocumentModelHeaderOperations, s as AddChangeLogItemInput, sa as UpdateStateExampleInput, si as SetModuleNameInput, sn as MutationAddModuleArgs, sr as PruneAction, ss as ProcessorApp, st as DocumentModelModule, t as ActionErrorCallback, ta as UpdateChangeLogItemInput, ti as SetModelIdInput, tn as MinimalBackupData, tr as OperationSpecification, tt as DocumentModelGlobalState, u as AddOperationAction, ua as User, ui as SetNameOperation, un as MutationAddOperationExampleArgs, ur as Query, us as ProcessorFactory, ut as DocumentModelOperationAction, v as AddStateExampleAction, vi as SetOperationErrorNameInput, vn as MutationLoadStateArgs, vr as RemoveRelationshipActionInput, vt as DocumentModelStateOperations, w as ConfigEntry, wi as SetOperationReducerInput, wn as MutationReorderModulesArgs, wr as ReorderModulesInput, wt as ENSInfo, x as AssertIsStateOfType, xi as SetOperationNameAction, xn as MutationRedoArgs, xr as ReorderModuleOperationsAction, xt as DocumentModelVersioningOperations, y as AddStateExampleInput, yi as SetOperationErrorTemplateAction, yn as MutationMoveOperationArgs, yr as ReorderChangeLogItemsAction, yt as DocumentModelUtils, z as DeleteDocumentActionInput, zi as SignalDispatch, zn as MutationSetOperationErrorCodeArgs, zr as SchemaRedoAction, zt as Incremental } from "./types-CC6ib3_2.js";
4
4
  import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-C_EQX4DY.js";
5
5
  import { $ as AddFolderAction, A as TriggerData, B as RegistryPackageStatus, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, F as PackageInfo, G as GenerateNodesCopySrc, H as DriveDocumentModelModule, I as RegistryPackage, J as DocumentDriveDocument, K as SharingType, L as RegistryPackageList, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as AddFileAction, R as RegistryPackageMap, S as RemoveListenerInput, T as SetDriveIconInput, U as DriveInput, V as DocumentDrivePHState, W as GenerateNodesCopyIdGenerator, X as LegacyAddFileInput, Y as LegacyAddFileAction, Z as LegacySynchronizationUnit, _ as ListenerInput, a as CopyNodeInput, at as UpdateFileAction, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as AddTriggerAction, d as FolderNode, dt as RemoveListenerAction, et as CopyNodeAction, f as Listener, ft as RemoveTriggerAction, g as ListenerFilterInput, gt as SetSharingTypeAction, h as ListenerFilter, ht as SetDriveNameAction, i as AddTriggerInput, it as MoveNodeAction, j as TriggerInput, k as Trigger, lt as DocumentDriveDriveAction, m as ListenerCallInfoInput, mt as SetDriveIconAction, n as AddFolderInput, nt as DocumentDriveNodeAction, o as DeleteNodeInput, ot as UpdateNodeAction, p as ListenerCallInfo, pt as SetAvailableOfflineAction, q as DocumentDriveAction, r as AddListenerInput, rt as DocumentDriveNodeOperations, s as DocumentDriveGlobalState, st as AddListenerAction, t as AddFileInput, tt as DeleteNodeAction, u as FileNode, ut as DocumentDriveDriveOperations, v as MoveNodeInput, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node, z as RegistryPackageSource } from "./types-CVqmv94G.js";
@@ -1,4 +1,4 @@
1
- import { C as DEFAULT_REGISTRY_URL } from "../types-DgDE_nr0.js";
1
+ import { C as DEFAULT_REGISTRY_URL } from "../types-Daq_zHP_.js";
2
2
  import { B as RegistryPackageStatus, F as PackageInfo, I as RegistryPackage, L as RegistryPackageList, R as RegistryPackageMap, z as RegistryPackageSource } from "../types-CVqmv94G.js";
3
3
 
4
4
  //#region registry/registry.d.ts
@@ -87,7 +87,8 @@ type PHConnectApp = {
87
87
  basePath?: string;
88
88
  };
89
89
  type PHConnectPackages = {
90
- externalEnabled?: boolean;
90
+ externalEnabled?: boolean; /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
91
+ liveReload?: boolean;
91
92
  };
92
93
  type PHConnectRenown = {
93
94
  url?: string;
@@ -156,4 +157,4 @@ type PowerhouseConfig = {
156
157
  };
157
158
  //#endregion
158
159
  export { DEFAULT_REGISTRY_URL as C, ServiceActions as S, ParsedCmdResult as _, PHConnectApp as a, PowerhousePackage as b, PHConnectDriveSection as c, PHConnectPackages as d, PHConnectRenown as f, PackageManagerArgs as g, PHPackageProvider as h, LogLevels as i, PHConnectDriveSections as l, PHConnectSentry as m, DrivePreserveStrategy as n, PHConnectBranding as o, PHConnectRuntimeConfig as p, LogLevel as r, PHConnectDefaultDrive as s, DrivePreserveStrategies as t, PHConnectDrives as u, PathValidation as v, ServiceAction as x, PowerhouseConfig as y };
159
- //# sourceMappingURL=types-DgDE_nr0.d.ts.map
160
+ //# sourceMappingURL=types-Daq_zHP_.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-DgDE_nr0.d.ts","names":[],"sources":["../clis/args/common.ts","../clis/constants.ts","../clis/types.ts"],"mappings":";;;;;;;cAyEa,wBAAA,EAAwB,OAAA,CAInC,6BAAA,CAJmC,QAAA;iBAAA,6BAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCpExB,eAAA;AAAA,cAYA,0BAAA;AAAA,cAKA,UAAA;AAAA,cAoBA,oBAAA;;;KClCD,cAAA,UAAwB,eAAA;AAAA,KACxB,aAAA,GAAgB,cAAA;AAAA,KAChB,uBAAA,UAAiC,0BAAA;AAAA,KACjC,qBAAA,GAA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,IAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;EAGJ,IAAA;IACE,OAAA;IACA,MAAA;IACA,iBAAA;EAAA;EAEF,WAAA;IACE,QAAA;MACE,GAAA;IAAA;IAEF,IAAA;EAAA;EAEF,MAAA;IACE,IAAA;IACA,IAAA;IACA,KAAA;IACA,WAAA;EAAA;EAEF,QAAA,GAAW,iBAAA;EACX,KAAA;IACE,OAAA;IACA,QAAA;EAAA;EAEF,kBAAA;EACA,OAAA,GAAU,sBAAA;AAAA"}
1
+ {"version":3,"file":"types-Daq_zHP_.d.ts","names":[],"sources":["../clis/args/common.ts","../clis/constants.ts","../clis/types.ts"],"mappings":";;;;;;;cAyEa,wBAAA,EAAwB,OAAA,CAInC,6BAAA,CAJmC,QAAA;iBAAA,6BAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCpExB,eAAA;AAAA,cAYA,0BAAA;AAAA,cAKA,UAAA;AAAA,cAoBA,oBAAA;;;KClCD,cAAA,UAAwB,eAAA;AAAA,KACxB,aAAA,GAAgB,cAAA;AAAA,KAChB,uBAAA,UAAiC,0BAAA;AAAA,KACjC,qBAAA,GAAwB,uBAAA;AAAA,KACxB,SAAA,UAAmB,UAAA;AAAA,KACnB,QAAA,GAAW,SAAA;AAAA,KAEX,eAAA,MAAqB,CAAA,SAAU,SAAA,cAAuB,GAAA;AAAA,KACtD,kBAAA,GAAqB,eAAA,QACxB,wBAAA;AAAA,KAGG,iBAAA;AAAA,KAEA,cAAA,IAAkB,GAAA;AAAA,KAClB,iBAAA;EACV,WAAA;EACA,OAAA;EACA,QAAA,GAAW,iBAAA;EACX,GAAA;AAAA;AAAA,KAGU,iBAAA;EACV,OAAA;EACA,cAAA;AAAA;AAAA,KAGU,qBAAA;EACV,GAAA;EACA,IAAA;EACA,IAAA;AAAA;AAAA,KAGU,qBAAA;EACV,OAAA;EACA,QAAA;EACA,WAAA;AAAA;AAAA,KAGU,sBAAA;EACV,MAAA,GAAS,qBAAA;EACT,KAAA,GAAQ,qBAAA;AAAA;AAAA,KAGE,eAAA;EACV,aAAA;EACA,aAAA,GAAgB,qBAAA;EAChB,gBAAA,GAAmB,qBAAA;EACnB,QAAA,GAAW,sBAAA;AAAA;AAAA,KAGD,YAAA;EACV,QAAA;EACA,QAAA;AAAA;AAAA,KAGU,iBAAA;EACV,eAAA;EAEA,UAAA;AAAA;AAAA,KAGU,eAAA;EACV,GAAA;EACA,SAAA;EACA,OAAA;AAAA;AAAA,KAGU,eAAA;yDAEV,GAAA;EAEA,GAAA;EAEA,OAAA;AAAA;AAAA,KAGU,sBAAA;EACV,QAAA,GAAW,iBAAA;EACX,GAAA,GAAM,YAAA;EACN,QAAA,GAAW,iBAAA;EACX,MAAA,GAAS,eAAA;EACT,MAAA,GAAS,eAAA;EACT,MAAA,GAAS,eAAA;AAAA;AAAA,KAGC,gBAAA;EAEV,QAAA,EAAU,QAAA;EACV,iBAAA;EACA,UAAA;EACA,aAAA;EACA,YAAA;EACA,gBAAA;EACA,UAAA;EAGA,WAAA;EACA,KAAA;EACA,OAAA;IACE,IAAA;IACA,KAAA;MAIM,OAAA;MACA,QAAA;IAAA;IAEN,OAAA;MACE,IAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;EAGJ,IAAA;IACE,OAAA;IACA,MAAA;IACA,iBAAA;EAAA;EAEF,WAAA;IACE,QAAA;MACE,GAAA;IAAA;IAEF,IAAA;EAAA;EAEF,MAAA;IACE,IAAA;IACA,IAAA;IACA,KAAA;IACA,WAAA;EAAA;EAEF,QAAA,GAAW,iBAAA;EACX,KAAA;IACE,OAAA;IACA,QAAA;EAAA;EAEF,kBAAA;EACA,OAAA,GAAU,sBAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/shared",
3
- "version": "6.1.0-dev.20",
3
+ "version": "6.1.0-dev.21",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-loader-BPXmnFbm.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/**\n * Default values for every Connect-relevant field. Merged with the\n * `connect.*` block of whatever `powerhouse.config.json` Connect is pointed\n * at, so the SPA never has to guard against undefined fields.\n *\n * Scoped to fields Connect actually reads at runtime — build-time concerns\n * (studio port, switchboard port, reactor.*, auth.*) live in the source\n * config but are not Connect's business and not represented here.\n *\n * Single source of truth for defaults across Connect's runtime read (via\n * ConfigLoader merge), the dist emitter, and the codegen scaffold template.\n */\nexport const DEFAULT_CONNECT_CONFIG: PHConnectRuntimeConfig = {\n branding: {\n appName: \"Powerhouse Connect\",\n homeBackground: null,\n },\n app: {\n logLevel: \"info\",\n basePath: \"/\",\n },\n packages: {\n externalEnabled: true,\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};\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":";;;;;;;;;;;;;;AA0BA,MAAa,yBAAiD;CAC5D,UAAU;EACR,SAAS;EACT,gBAAgB;EACjB;CACD,KAAK;EACH,UAAU;EACV,UAAU;EACX;CACD,UAAU,EACR,iBAAiB,MAClB;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;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,uBAAuB,YACrC,OAAO,uBAAuB,GAE9B,QAAO,qBAAqB,OAAO;AAErC,QAAO;;;;;;;;;;;;ACdT,SAAgB,UAAa,MAAS,OAA0B;AAC9D,KAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,MAAM,CAC/C,QAAO;CAET,MAAM,SAAkC,EAAE,GAAG,MAAM;AACnD,MAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QAAQ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