@powerhousedao/shared 6.2.3-dev.70 → 6.2.3-dev.72

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 (80) hide show
  1. package/dist/clis/args/common-BXabdhiO.mjs.map +1 -1
  2. package/dist/clis/args/{connect-BG3HkYBk.mjs → connect-Bad05YS-.mjs} +3 -3
  3. package/dist/clis/args/connect-Bad05YS-.mjs.map +1 -0
  4. package/dist/clis/args/connect.mjs +1 -1
  5. package/dist/clis/args/{help-BfAqpYvC.mjs → help-Di8n5ZnJ.mjs} +3 -3
  6. package/dist/clis/args/{help-BfAqpYvC.mjs.map → help-Di8n5ZnJ.mjs.map} +1 -1
  7. package/dist/clis/args/help.mjs +1 -1
  8. package/dist/clis/args/index.d.mts +1 -1
  9. package/dist/clis/args/index.mjs +2 -2
  10. package/dist/clis/args/{run-CYp5t1xU.mjs → run-l_LiMplO.mjs} +2 -2
  11. package/dist/clis/args/{run-CYp5t1xU.mjs.map → run-l_LiMplO.mjs.map} +1 -1
  12. package/dist/clis/args/run.mjs +1 -1
  13. package/dist/clis/args/{service-CHjY5epu.d.mts → service-DiTFThbn.d.mts} +2 -2
  14. package/dist/clis/args/service-DiTFThbn.d.mts.map +1 -0
  15. package/dist/clis/args/service.d.mts +1 -1
  16. package/dist/clis/{build-config-DwRi23zQ.mjs → build-config-tJhHVdPm.mjs} +17 -2
  17. package/dist/clis/{build-config-DwRi23zQ.mjs.map → build-config-tJhHVdPm.mjs.map} +1 -1
  18. package/dist/clis/build-config.d.mts +1 -0
  19. package/dist/clis/build-config.d.mts.map +1 -1
  20. package/dist/clis/build-config.mjs +2 -2
  21. package/dist/clis/build-pieces.d.mts +1 -1
  22. package/dist/clis/build-pieces.mjs +1 -1
  23. package/dist/clis/constants.d.mts +1 -1
  24. package/dist/clis/constants.mjs +6 -1
  25. package/dist/clis/constants.mjs.map +1 -1
  26. package/dist/clis/index.d.mts +2063 -889
  27. package/dist/clis/index.d.mts.map +1 -1
  28. package/dist/clis/index.mjs +436 -586
  29. package/dist/clis/index.mjs.map +1 -1
  30. package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
  31. package/dist/clis/types-BNdhWTBs.d.mts +2321 -0
  32. package/dist/clis/types-BNdhWTBs.d.mts.map +1 -0
  33. package/dist/{config-loader-DBJolZd0.js → config-loader-BWt0c0eU.js} +6 -3
  34. package/dist/config-loader-BWt0c0eU.js.map +1 -0
  35. package/dist/connect/config-loader.d.ts +1 -1
  36. package/dist/connect/config-loader.js +1 -1
  37. package/dist/connect/connect-config-schema.d.ts +3 -0
  38. package/dist/connect/connect-config-schema.js +445 -0
  39. package/dist/connect/connect-config-schema.js.map +1 -0
  40. package/dist/connect/image-ref.d.ts +32 -0
  41. package/dist/connect/image-ref.d.ts.map +1 -0
  42. package/dist/connect/image-ref.js +80 -0
  43. package/dist/connect/image-ref.js.map +1 -0
  44. package/dist/connect/index.d.ts +60 -641
  45. package/dist/connect/index.d.ts.map +1 -1
  46. package/dist/connect/index.js +175 -560
  47. package/dist/connect/index.js.map +1 -1
  48. package/dist/connect-config-schema-1-O1CQ4v.d.ts +1731 -0
  49. package/dist/connect-config-schema-1-O1CQ4v.d.ts.map +1 -0
  50. package/dist/document-drive/index.d.ts +3 -3
  51. package/dist/document-drive/index.js +1 -12
  52. package/dist/document-drive/index.js.map +1 -1
  53. package/dist/document-model/errors.d.ts +1 -1
  54. package/dist/document-model/index.d.ts +1 -1
  55. package/dist/document-model/index.js.map +1 -1
  56. package/dist/host-tokens/index.d.ts +3 -0
  57. package/dist/host-tokens/index.js +278 -0
  58. package/dist/host-tokens/index.js.map +1 -0
  59. package/dist/index-DIM6qtzj.d.ts +227 -0
  60. package/dist/index-DIM6qtzj.d.ts.map +1 -0
  61. package/dist/{index-DeEVCeve.d.ts → index-DvbhwImT.d.ts} +2 -2
  62. package/dist/{index-DeEVCeve.d.ts.map → index-DvbhwImT.d.ts.map} +1 -1
  63. package/dist/index.d.ts +4 -4
  64. package/dist/processors/index.d.ts +1 -1
  65. package/dist/registry/index.d.ts +2 -2
  66. package/dist/registry/index.js +1 -1
  67. package/dist/registry/index.js.map +1 -1
  68. package/dist/registry/manifest-slim.d.ts +2 -2
  69. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  70. package/dist/{types-PM0i4vns.d.ts → types-BpO4LIKj.d.ts} +180 -255
  71. package/dist/types-BpO4LIKj.d.ts.map +1 -0
  72. package/dist/{types-f_wMStgZ.d.ts → types-OXIqeH8W.d.ts} +2 -2
  73. package/dist/{types-f_wMStgZ.d.ts.map → types-OXIqeH8W.d.ts.map} +1 -1
  74. package/package.json +5 -1
  75. package/dist/clis/args/connect-BG3HkYBk.mjs.map +0 -1
  76. package/dist/clis/args/service-CHjY5epu.d.mts.map +0 -1
  77. package/dist/clis/types-BxOUzRvH.d.mts +0 -588
  78. package/dist/clis/types-BxOUzRvH.d.mts.map +0 -1
  79. package/dist/config-loader-DBJolZd0.js.map +0 -1
  80. package/dist/types-PM0i4vns.d.ts.map +0 -1
@@ -1,7 +1,153 @@
1
- import { a as DEFAULT_CONNECT_CONFIG, i as workflowsSettingConflict, n as deepMerge, o as buildRuntimeConfig, r as resolveSourceConnect, t as ConfigLoader } from "../config-loader-DBJolZd0.js";
1
+ import { a as DEFAULT_CONNECT_CONFIG, i as workflowsSettingConflict, n as deepMerge, o as buildRuntimeConfig, r as resolveSourceConnect, t as ConfigLoader } from "../config-loader-BWt0c0eU.js";
2
2
  import { JsonConfigAdapter } from "./json-adapter.js";
3
- import { z } from "zod";
3
+ import { connectAiSchema, connectAppSchema, connectBackgroundLayerSchema, connectBackgroundLayersSchema, connectBackgroundSchema, connectBrandingSchema, connectCompositionEntrySchema, connectConfigSchema, connectConfigSchemaWith, connectDefaultDriveLocalSchema, connectDefaultDriveRemoteSchema, connectDefaultDriveSchema, connectDrivePreserveStrategySchema, connectDriveSectionSchema, connectDriveSectionsSchema, connectDrivesSchema, connectEdgesSchema, connectExplorerIconsSchema, connectHomeSchema, connectImageRefSchema, connectInstanceSchema, connectLengthSchema, connectLoaderSchema, connectOpenPanelSchema, connectPackagesSchema, connectPwaCacheStrategySchema, connectPwaFileHandlerSchema, connectPwaIconSchema, connectPwaManifestSchema, connectPwaRuntimeCachingSchema, connectPwaSchema, connectPwaUrlPatternSchema, connectReactorClientModeSchema, connectReactorFeatureFlagsSchema, connectReactorSchema, connectRenownAdaptersSchema, connectRenownPrivyAdapterSchema, connectRenownRainbowAdapterSchema, connectRenownSchema, connectRuntimeConfigSchema, connectRuntimeInstanceSchema, connectRuntimePwaManifestSchema, connectRuntimePwaSchema, connectSchemedColorSchema, connectSchemedImageSchema, connectSentrySchema, declaredConnectConfigSchema } from "./connect-config-schema.js";
4
+ import { toJSONSchema, z } from "zod";
4
5
  import { satisfies, validRange } from "semver";
6
+ //#region connect/background.ts
7
+ const EDGES = [
8
+ "top",
9
+ "right",
10
+ "bottom",
11
+ "left"
12
+ ];
13
+ /** A single image is one layer pinned to the bottom-right corner. */
14
+ function normalizeBackground(background) {
15
+ if (!background) return null;
16
+ if (typeof background === "string") return { layers: [{
17
+ src: background,
18
+ position: {
19
+ bottom: 0,
20
+ right: 0
21
+ }
22
+ }] };
23
+ return background;
24
+ }
25
+ /** The light image and, when it differs, the dark one. */
26
+ function imageVariants(src) {
27
+ if (typeof src === "string") return { light: src };
28
+ return src.dark && src.dark !== src.light ? {
29
+ light: src.light,
30
+ dark: src.dark
31
+ } : { light: src.light };
32
+ }
33
+ /** The light colour and, when it differs, the dark one. */
34
+ function colorVariants(color) {
35
+ if (!color) return null;
36
+ if (typeof color === "string") return { light: color };
37
+ return color.dark && color.dark !== color.light ? {
38
+ light: color.light,
39
+ dark: color.dark
40
+ } : { light: color.light };
41
+ }
42
+ /** A number is px; a string is a CSS length as written. */
43
+ function cssLength(length) {
44
+ return typeof length === "number" ? `${length}px` : length.trim();
45
+ }
46
+ const FADE_DIRECTION = {
47
+ top: "to bottom",
48
+ right: "to left",
49
+ bottom: "to top",
50
+ left: "to right"
51
+ };
52
+ /**
53
+ * The CSS declarations (kebab-case) that place one layer inside a
54
+ * `position: relative` pane. The pane's content must come after the layers
55
+ * in the DOM (or carry a z-index) to paint above them.
56
+ */
57
+ function layerDeclarations(layer) {
58
+ const out = {
59
+ position: "absolute",
60
+ "pointer-events": "none",
61
+ "object-fit": "contain"
62
+ };
63
+ const position = layer.position ?? {};
64
+ for (const edge of EDGES) {
65
+ const value = position[edge];
66
+ if (value !== void 0 && value !== null) out[edge] = cssLength(value);
67
+ }
68
+ const centreX = !("left" in out) && !("right" in out);
69
+ const centreY = !("top" in out) && !("bottom" in out);
70
+ if (centreX) out.left = "50%";
71
+ if (centreY) out.top = "50%";
72
+ if (centreX || centreY) out.transform = `translate(${centreX ? "-50%" : "0"}, ${centreY ? "-50%" : "0"})`;
73
+ for (const [key, property] of [
74
+ ["width", "width"],
75
+ ["height", "height"],
76
+ ["minWidth", "min-width"],
77
+ ["minHeight", "min-height"],
78
+ ["maxWidth", "max-width"],
79
+ ["maxHeight", "max-height"]
80
+ ]) {
81
+ const value = layer[key];
82
+ if (value !== void 0 && value !== null) out[property] = cssLength(value);
83
+ }
84
+ if (layer.opacity !== void 0 && layer.opacity !== null) out.opacity = String(layer.opacity);
85
+ const fades = [];
86
+ for (const edge of EDGES) {
87
+ const depth = layer.fade?.[edge];
88
+ if (depth === void 0 || depth === null) continue;
89
+ fades.push(`linear-gradient(${FADE_DIRECTION[edge]}, transparent, #000 ${cssLength(depth)})`);
90
+ }
91
+ if (fades.length > 0) {
92
+ out["mask-image"] = fades.join(", ");
93
+ if (fades.length > 1) out["mask-composite"] = "intersect";
94
+ }
95
+ return out;
96
+ }
97
+ /** The declarations as one `style` attribute's text. */
98
+ function layerStyleText(layer) {
99
+ return Object.entries(layerDeclarations(layer)).map(([property, value]) => `${property}: ${value}`).join("; ");
100
+ }
101
+ /** The same declarations with the camelCase keys React's `style` takes. */
102
+ function layerStyle(layer) {
103
+ return Object.fromEntries(Object.entries(layerDeclarations(layer)).map(([property, value]) => [property.replace(/-([a-z])/g, (_, c) => c.toUpperCase()), value]));
104
+ }
105
+ function edgesConflict(edges) {
106
+ if (!edges) return null;
107
+ const set = (edge) => edges[edge] !== void 0 && edges[edge] !== null;
108
+ if (set("top") && set("bottom")) return "set top or bottom, not both";
109
+ if (set("left") && set("right")) return "set left or right, not both";
110
+ return null;
111
+ }
112
+ /** What is wrong with a background, one message per problem; empty when it
113
+ * is usable. `at` names the field in the messages. */
114
+ function validateBackground(background, at = "background") {
115
+ const problems = [];
116
+ (normalizeBackground(background)?.layers ?? []).forEach((layer, index) => {
117
+ const where = `${at}.layers[${index}]`;
118
+ if (!(typeof layer.src === "string" ? layer.src : layer.src.light)) problems.push(`${where}.src: an image is required`);
119
+ const conflict = edgesConflict(layer.position);
120
+ if (conflict) problems.push(`${where}.position: ${conflict}`);
121
+ if (layer.opacity !== void 0 && layer.opacity !== null && !(layer.opacity >= 0 && layer.opacity <= 1)) problems.push(`${where}.opacity: must be between 0 and 1`);
122
+ });
123
+ return problems;
124
+ }
125
+ /**
126
+ * The background with every image reference mapped (resolved to a data URI,
127
+ * rebased to another directory, …). A layer whose light image maps to
128
+ * undefined is dropped; a dark image that does falls back to the light one.
129
+ */
130
+ function mapBackgroundImages(background, map) {
131
+ const layers = [];
132
+ for (const layer of background.layers) {
133
+ const variants = imageVariants(layer.src);
134
+ const light = map(variants.light);
135
+ if (!light) continue;
136
+ const dark = variants.dark ? map(variants.dark) : void 0;
137
+ layers.push({
138
+ ...layer,
139
+ src: dark ? {
140
+ light,
141
+ dark
142
+ } : light
143
+ });
144
+ }
145
+ return {
146
+ ...background,
147
+ layers
148
+ };
149
+ }
150
+ //#endregion
5
151
  //#region connect/dynamic-base.ts
6
152
  /**
7
153
  * The base a dynamic-base Connect build is compiled against. The build emits
@@ -535,563 +681,32 @@ const powerhousePackageSchema = {
535
681
  }
536
682
  }
537
683
  };
538
- const driveSectionSchema = {
539
- type: "object",
540
- additionalProperties: false,
541
- description: "Visibility and add/delete affordances for a drive section in the sidebar.",
542
- properties: {
543
- enabled: {
544
- type: "boolean",
545
- description: "When false, the section is hidden in the sidebar.",
546
- default: true
547
- },
548
- allowAdd: {
549
- type: "boolean",
550
- description: "When false, the section's 'add drive' affordance is hidden.",
551
- default: true
552
- },
553
- allowDelete: {
554
- type: "boolean",
555
- description: "When false, drives in this section cannot be deleted from the UI.",
556
- default: true
557
- }
558
- }
559
- };
560
- const pwaUrlPatternSchema = {
561
- description: "URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.",
562
- oneOf: [{ type: "string" }, {
563
- type: "object",
564
- additionalProperties: false,
565
- required: ["source"],
566
- properties: {
567
- source: {
568
- type: "string",
569
- description: "RegExp source."
570
- },
571
- flags: {
572
- type: "string",
573
- description: "RegExp flags (e.g. 'i')."
574
- }
575
- }
576
- }]
577
- };
578
- const pwaIconSchema = {
579
- type: "object",
580
- additionalProperties: false,
581
- required: ["src"],
582
- properties: {
583
- src: { type: "string" },
584
- sizes: { type: "string" },
585
- type: { type: "string" },
586
- purpose: { type: "string" }
587
- }
588
- };
589
- const phConnectRuntimeConfigSchema = {
590
- type: "object",
591
- additionalProperties: false,
592
- description: "Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.",
593
- properties: {
594
- branding: {
595
- type: "object",
596
- additionalProperties: false,
597
- description: "App identity and visual branding.",
598
- properties: {
599
- appName: {
600
- type: "string",
601
- description: "Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'."
602
- },
603
- homeBackground: {
604
- type: ["string", "null"],
605
- description: "Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image."
606
- },
607
- favicon: {
608
- type: ["string", "null"],
609
- description: "The browser tab icon: a file (.ico, .svg or .png) relative to the project, served and built as icon.ico. A build input; the built runtime config leaves it out. `ph connect build --favicon` wins over it."
610
- }
611
- }
612
- },
613
- app: {
614
- type: "object",
615
- additionalProperties: false,
616
- description: "Top-level Connect application behaviour.",
617
- properties: {
618
- logLevel: {
619
- type: "string",
620
- enum: [
621
- "debug",
622
- "info",
623
- "warn",
624
- "error"
625
- ],
626
- description: "Log level applied by Connect's logger at boot. Affects browser-side output only.",
627
- default: "info"
628
- },
629
- basePath: {
630
- type: "string",
631
- description: "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.",
632
- default: "/"
633
- },
634
- offline: {
635
- type: "boolean",
636
- description: "When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.",
637
- default: true
638
- },
639
- studioMode: {
640
- type: "boolean",
641
- 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.",
642
- default: false
643
- },
644
- workflowsEnabled: {
645
- type: "boolean",
646
- 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. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set."
647
- }
648
- }
649
- },
650
- ai: {
651
- type: "object",
652
- additionalProperties: false,
653
- description: "AI assistant (chat) behaviour.",
654
- properties: { assistantEnabled: {
655
- type: "boolean",
656
- description: "When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.",
657
- default: false
658
- } }
659
- },
660
- packages: {
661
- type: "object",
662
- additionalProperties: false,
663
- description: "Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).",
664
- properties: {
665
- externalEnabled: {
666
- type: "boolean",
667
- 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.",
668
- default: true
669
- },
670
- liveReload: {
671
- type: "boolean",
672
- 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).",
673
- default: false
674
- }
675
- }
676
- },
677
- drives: {
678
- type: "object",
679
- additionalProperties: false,
680
- description: "Default-drive and add-drive UI behaviour.",
681
- properties: {
682
- allowAddDrive: {
683
- type: "boolean",
684
- description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.",
685
- default: true
686
- },
687
- defaultDrives: {
688
- type: "array",
689
- description: "Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).",
690
- default: [],
691
- items: { oneOf: [{
692
- type: "object",
693
- additionalProperties: false,
694
- required: ["url"],
695
- properties: {
696
- url: { type: "string" },
697
- name: { type: ["string", "null"] },
698
- icon: { type: ["string", "null"] }
699
- }
700
- }, {
701
- type: "object",
702
- additionalProperties: false,
703
- required: ["local", "id"],
704
- properties: {
705
- local: {
706
- const: true,
707
- description: "Discriminator: this entry is a local drive created on first boot."
708
- },
709
- id: {
710
- type: "string",
711
- description: "Stable drive id. The drive is created with this id on first boot and is not re-created on later boots."
712
- },
713
- name: { type: ["string", "null"] },
714
- icon: { type: ["string", "null"] },
715
- app: {
716
- type: "string",
717
- description: "Drive app (preferred editor) to open on the drive."
718
- }
719
- }
720
- }] }
721
- },
722
- preserveStrategy: {
723
- type: "string",
724
- enum: ["preserve-all", "preserve-by-url-and-detach"],
725
- description: "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."
726
- },
727
- sections: {
728
- type: "object",
729
- additionalProperties: false,
730
- description: "Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.",
731
- properties: {
732
- remote: driveSectionSchema,
733
- local: driveSectionSchema
734
- }
735
- }
736
- }
737
- },
738
- renown: {
739
- type: "object",
740
- additionalProperties: false,
741
- description: "Renown identity / authentication coordinates.",
742
- properties: {
743
- url: {
744
- type: "string",
745
- description: "Renown auth service URL.",
746
- default: "https://www.renown.id"
747
- },
748
- networkId: {
749
- type: "string",
750
- description: "CAIP-2 network namespace (e.g. 'eip155').",
751
- default: "eip155"
752
- },
753
- chainId: {
754
- type: "number",
755
- description: "CAIP-2 chain reference within the network namespace.",
756
- default: 1
757
- },
758
- namespace: {
759
- type: "string",
760
- description: "Renown localStorage namespace; share it across Connects to share login."
761
- },
762
- switchboardUrl: {
763
- type: "string",
764
- description: "Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`."
765
- },
766
- adapters: {
767
- type: "object",
768
- additionalProperties: false,
769
- description: "Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.",
770
- properties: {
771
- rainbow: {
772
- type: "object",
773
- additionalProperties: false,
774
- description: "wagmi + RainbowKit external-wallet adapter config.",
775
- properties: {
776
- walletConnectProjectId: {
777
- type: "string",
778
- description: "WalletConnect project id; required for this adapter to function."
779
- },
780
- infuraProjectId: {
781
- type: "string",
782
- description: "Optional Infura project id used to build RPC transports."
783
- }
784
- }
785
- },
786
- privy: {
787
- type: "object",
788
- additionalProperties: false,
789
- description: "Privy embedded/social adapter config.",
790
- properties: {
791
- appId: {
792
- type: "string",
793
- description: "Privy application id; required for this adapter to function."
794
- },
795
- clientId: {
796
- type: "string",
797
- description: "Optional Privy client id."
798
- },
799
- methods: {
800
- type: "array",
801
- description: "Login methods this adapter offers; default per adapter when omitted.",
802
- items: { type: "string" }
803
- }
804
- }
805
- }
806
- }
807
- }
808
- }
809
- },
810
- sentry: {
811
- type: "object",
812
- additionalProperties: false,
813
- description: "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.",
814
- properties: {
815
- dsn: {
816
- type: ["string", "null"],
817
- description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.",
818
- default: null
819
- },
820
- env: {
821
- type: "string",
822
- description: "Sentry environment label, surfaced as the `environment` tag on every event.",
823
- default: "dev"
824
- },
825
- tracing: {
826
- type: "boolean",
827
- description: "Enable Sentry performance tracing.",
828
- default: false
829
- }
830
- }
831
- },
832
- openPanel: {
833
- type: "object",
834
- additionalProperties: false,
835
- description: "OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.",
836
- properties: {
837
- clientId: {
838
- type: "string",
839
- description: "OpenPanel client id. Empty string disables OpenPanel entirely.",
840
- default: ""
841
- },
842
- apiUrl: {
843
- type: "string",
844
- description: "OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API."
845
- },
846
- trackUiEvents: {
847
- type: "boolean",
848
- description: "Track UI events.",
849
- default: true
850
- },
851
- trackOperations: {
852
- type: "boolean",
853
- description: "Track document operations.",
854
- default: true
855
- }
856
- }
857
- },
858
- instance: {
859
- type: "object",
860
- additionalProperties: false,
861
- required: ["namespace", "reactorWorker"],
862
- description: "Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.",
863
- properties: {
864
- namespace: {
865
- type: ["string", "null"],
866
- description: "Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.",
867
- default: null
868
- },
869
- reactorWorker: {
870
- type: "boolean",
871
- description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.",
872
- default: false
873
- },
874
- multiReactor: {
875
- type: "boolean",
876
- description: "Opt-in multi-reactor routing. When on, Connect routes through the in-browser reactor plus remote backends instead of the single in-browser reactor. Off by default; the single-reactor path is unchanged.",
877
- default: false
878
- }
879
- }
880
- },
881
- reactor: {
882
- type: "object",
883
- additionalProperties: false,
884
- description: "Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.",
885
- properties: {
886
- featureFlags: {
887
- type: "object",
888
- additionalProperties: false,
889
- description: "Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.",
890
- properties: {
891
- documentDecisions: {
892
- type: "boolean",
893
- description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.",
894
- default: false
895
- },
896
- authEnforcement: {
897
- type: "boolean",
898
- description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.",
899
- default: false
900
- },
901
- authGroups: {
902
- type: "boolean",
903
- description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.",
904
- default: false
905
- },
906
- authConditions: {
907
- type: "boolean",
908
- description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.",
909
- default: false
910
- }
911
- }
912
- },
913
- createSignaturePolicy: {
914
- type: "string",
915
- enum: ["legacy", "v2-required"],
916
- description: "What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.",
917
- default: "v2-required"
918
- },
919
- unsupportedStoredDocuments: {
920
- type: "string",
921
- enum: ["refuse", "read-only"],
922
- description: "What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.",
923
- default: "refuse"
924
- }
925
- }
926
- },
927
- pwa: {
928
- type: "object",
929
- additionalProperties: false,
930
- description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.",
931
- properties: {
932
- manifest: {
933
- type: "object",
934
- additionalProperties: false,
935
- description: "Web-app-manifest field overrides.",
936
- properties: {
937
- name: { type: "string" },
938
- short_name: { type: "string" },
939
- description: { type: "string" },
940
- theme_color: { type: "string" },
941
- background_color: { type: "string" },
942
- display: {
943
- type: "string",
944
- enum: [
945
- "fullscreen",
946
- "standalone",
947
- "minimal-ui",
948
- "browser"
949
- ]
950
- },
951
- start_url: { type: "string" },
952
- scope: { type: "string" },
953
- icons: {
954
- type: "array",
955
- description: "Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).",
956
- items: pwaIconSchema
957
- },
958
- file_handlers: {
959
- type: "array",
960
- description: "File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.",
961
- items: {
962
- type: "object",
963
- additionalProperties: false,
964
- required: ["accept"],
965
- properties: {
966
- accept: {
967
- type: "object",
968
- description: "MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.",
969
- additionalProperties: {
970
- type: "array",
971
- items: {
972
- type: "string",
973
- pattern: "^\\."
974
- }
975
- }
976
- },
977
- icons: {
978
- type: "array",
979
- description: "OS-level file-type icons.",
980
- items: pwaIconSchema
981
- },
982
- launch_type: {
983
- type: "string",
984
- enum: ["single-client", "multiple-clients"]
985
- }
986
- }
987
- }
988
- },
989
- launch_handler: {
990
- type: "object",
991
- additionalProperties: false,
992
- required: ["client_mode"],
993
- description: "How the OS launches the app for handled files/links. Connect defaults to focus-existing.",
994
- properties: { client_mode: {
995
- type: "string",
996
- enum: [
997
- "auto",
998
- "focus-existing",
999
- "navigate-existing",
1000
- "navigate-new"
1001
- ]
1002
- } }
1003
- }
1004
- }
1005
- },
1006
- globPatterns: {
1007
- type: "array",
1008
- items: { type: "string" },
1009
- description: "Extra Workbox precache globs, unioned with the built-ins."
1010
- },
1011
- globIgnores: {
1012
- type: "array",
1013
- items: { type: "string" },
1014
- description: "Extra precache ignore globs, unioned with the built-ins."
1015
- },
1016
- maximumFileSizeToCacheInBytes: {
1017
- type: "number",
1018
- description: "Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit."
1019
- },
1020
- runtimeCaching: {
1021
- type: "array",
1022
- description: "Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.",
1023
- items: {
1024
- type: "object",
1025
- additionalProperties: false,
1026
- required: ["urlPattern", "handler"],
1027
- properties: {
1028
- urlPattern: pwaUrlPatternSchema,
1029
- handler: {
1030
- type: "string",
1031
- enum: [
1032
- "CacheFirst",
1033
- "CacheOnly",
1034
- "NetworkFirst",
1035
- "NetworkOnly",
1036
- "StaleWhileRevalidate"
1037
- ]
1038
- },
1039
- method: {
1040
- type: "string",
1041
- enum: [
1042
- "GET",
1043
- "POST",
1044
- "PUT",
1045
- "DELETE",
1046
- "HEAD",
1047
- "PATCH"
1048
- ]
1049
- },
1050
- options: {
1051
- type: "object",
1052
- additionalProperties: false,
1053
- properties: {
1054
- cacheName: { type: "string" },
1055
- networkTimeoutSeconds: {
1056
- type: "number",
1057
- description: "Seconds a NetworkFirst rule waits for the network before falling back to the cache."
1058
- },
1059
- expiration: {
1060
- type: "object",
1061
- additionalProperties: false,
1062
- properties: {
1063
- maxEntries: { type: "number" },
1064
- maxAgeSeconds: { type: "number" }
1065
- }
1066
- },
1067
- cacheableResponse: {
1068
- type: "object",
1069
- additionalProperties: false,
1070
- properties: {
1071
- statuses: {
1072
- type: "array",
1073
- items: { type: "number" }
1074
- },
1075
- headers: {
1076
- type: "object",
1077
- additionalProperties: { type: "string" }
1078
- }
1079
- }
1080
- }
1081
- }
1082
- }
1083
- }
1084
- }
1085
- },
1086
- navigateFallbackDenylist: {
1087
- type: "array",
1088
- description: "Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.",
1089
- items: pwaUrlPatternSchema
1090
- }
1091
- }
1092
- }
1093
- }
1094
- };
684
+ /** Emits a zod schema as a draft-07 fragment: input shape, no `$schema`. */
685
+ function emitJsonSchemaFragment(schema) {
686
+ const { $schema: _, ...fragment } = toJSONSchema(schema, {
687
+ target: "draft-7",
688
+ io: "input",
689
+ unrepresentable: "throw"
690
+ });
691
+ return fragment;
692
+ }
693
+ /** `schema` or null, keeping its description on the outer node. */
694
+ function orNull(schema) {
695
+ const nullable = schema.nullable();
696
+ return schema.description ? nullable.describe(schema.description) : nullable;
697
+ }
698
+ /** One image of a decorated pane. */
699
+ const phBackgroundLayerSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectBackgroundLayerSchema);
700
+ /** A pane's background: layers over a page colour, or one image. */
701
+ const phBackgroundSchema = /* @__PURE__ */ emitJsonSchemaFragment(/* @__PURE__ */ orNull(connectBackgroundSchema));
702
+ /** The drive explorer's icons (the generic plugin's). */
703
+ const phConnectExplorerIconsSchema = /* @__PURE__ */ emitJsonSchemaFragment(/* @__PURE__ */ orNull(connectExplorerIconsSchema));
704
+ /** `connect.branding`. */
705
+ const phConnectBrandingSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectBrandingSchema);
706
+ /** `connect.home`. */
707
+ const phConnectHomeSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectHomeSchema);
708
+ /** The authored `connect` block, as validated by Ajv. */
709
+ const phConnectRuntimeConfigSchema = /* @__PURE__ */ emitJsonSchemaFragment(connectConfigSchema);
1095
710
  //#endregion
1096
711
  //#region connect/shared-deps.ts
1097
712
  /**
@@ -1274,6 +889,6 @@ function workerPackageFileName(packageName) {
1274
889
  return `${packageName.replace(/^@/, "").replace(/[^\w.-]+/g, "__")}.js`;
1275
890
  }
1276
891
  //#endregion
1277
- export { CONNECT_LAYER_ORDER, 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, resolveDynamicBaseUrl, resolveSourceConnect, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory, workerPackageFileName, workflowsSettingConflict };
892
+ export { CONNECT_LAYER_ORDER, ConfigLoader, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, EDGES, 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, colorVariants, connectAiSchema, connectAppSchema, connectBackgroundLayerSchema, connectBackgroundLayersSchema, connectBackgroundSchema, connectBrandingSchema, connectCompositionEntrySchema, connectConfigSchema, connectConfigSchemaWith, connectDefaultDriveLocalSchema, connectDefaultDriveRemoteSchema, connectDefaultDriveSchema, connectDrivePreserveStrategySchema, connectDriveSectionSchema, connectDriveSectionsSchema, connectDrivesSchema, connectEdgesSchema, connectEnvSchema, connectExplorerIconsSchema, connectHomeSchema, connectImageRefSchema, connectInstanceSchema, connectLengthSchema, connectLoaderSchema, connectOpenPanelSchema, connectPackagesSchema, connectPwaCacheStrategySchema, connectPwaFileHandlerSchema, connectPwaIconSchema, connectPwaManifestSchema, connectPwaRuntimeCachingSchema, connectPwaSchema, connectPwaUrlPatternSchema, connectReactorClientModeSchema, connectReactorFeatureFlagsSchema, connectReactorSchema, connectRenownAdaptersSchema, connectRenownPrivyAdapterSchema, connectRenownRainbowAdapterSchema, connectRenownSchema, connectRuntimeConfigSchema, connectRuntimeInstanceSchema, connectRuntimePwaManifestSchema, connectRuntimePwaSchema, connectSchemedColorSchema, connectSchemedImageSchema, connectSentrySchema, cssLength, declaredConnectConfigSchema, dedupeFileHandlers, dedupeIcons, deepMerge, emitJsonSchemaFragment, findSharedImports, formatSharedDepWarnings, getStorageNamespace, imageVariants, layerDeclarations, layerStyle, layerStyleText, loadConnectEnv, loadRuntimeEnv, mapBackgroundImages, mergeManifest, mergePwaConfig, normalizeBackground, normalizeBasePath, parseDepSpec, phBackgroundLayerSchema, phBackgroundSchema, phConnectBrandingSchema, phConnectExplorerIconsSchema, phConnectHomeSchema, phConnectRuntimeConfigSchema, powerhousePackageSchema, resolveDynamicBaseUrl, resolveSourceConnect, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, validateBackground, withInferredCategory, workerPackageFileName, workflowsSettingConflict };
1278
893
 
1279
894
  //# sourceMappingURL=index.js.map