@powerhousedao/connect 6.2.3-dev.59 → 6.2.3-dev.60

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 (53) hide show
  1. package/dist/{ClearStorageModal-C0cmaiL-.js → ClearStorageModal-DE2TKUfn.js} +4 -4
  2. package/dist/{ClearStorageModal-C0cmaiL-.js.map → ClearStorageModal-DE2TKUfn.js.map} +1 -1
  3. package/dist/{DebugSettingsModal-dOdaU2-h.js → DebugSettingsModal-BYrr41NU.js} +6 -6
  4. package/dist/{DebugSettingsModal-dOdaU2-h.js.map → DebugSettingsModal-BYrr41NU.js.map} +1 -1
  5. package/dist/{InspectorModal-D24UGyzU.js → InspectorModal-CpqAS_PY.js} +6 -6
  6. package/dist/{InspectorModal-D24UGyzU.js.map → InspectorModal-CpqAS_PY.js.map} +1 -1
  7. package/dist/{MissingPackageModal-C0azFAgR.js → MissingPackageModal-DS3dgJ1K.js} +4 -4
  8. package/dist/{MissingPackageModal-C0azFAgR.js.map → MissingPackageModal-DS3dgJ1K.js.map} +1 -1
  9. package/dist/{OpenFileDocumentsModal-ChvkfBsA.js → OpenFileDocumentsModal-C9vyTb6I.js} +4 -4
  10. package/dist/{OpenFileDocumentsModal-ChvkfBsA.js.map → OpenFileDocumentsModal-C9vyTb6I.js.map} +1 -1
  11. package/dist/{SettingsModal-BWosT7_G.js → SettingsModal-_hk8S-ey.js} +7 -7
  12. package/dist/{SettingsModal-BWosT7_G.js.map → SettingsModal-_hk8S-ey.js.map} +1 -1
  13. package/dist/{app-loader-DY5wUIbd.js → app-loader-C_y2O5-k.js} +78 -19
  14. package/dist/app-loader-C_y2O5-k.js.map +1 -0
  15. package/dist/app-loader-DthM3kLU.js +4 -0
  16. package/dist/{boot-BlFiByed.js → boot-CNW7ypcB.js} +4 -4
  17. package/dist/{boot-BlFiByed.js.map → boot-CNW7ypcB.js.map} +1 -1
  18. package/dist/{build-info-wcenFM4h.js → build-info-CRwnXFRI.js} +5 -5
  19. package/dist/{build-info-wcenFM4h.js.map → build-info-CRwnXFRI.js.map} +1 -1
  20. package/dist/components-DVQlpeR0.js +5 -0
  21. package/dist/{connect.config-CY3WDzWp.js → connect.config-CB78ZsFz.js} +4 -4
  22. package/dist/{connect.config-CY3WDzWp.js.map → connect.config-CB78ZsFz.js.map} +1 -1
  23. package/dist/{connection-state-CRm6nmtQ.js → connection-state-BDikOGKo.js} +5 -5
  24. package/dist/{connection-state-CRm6nmtQ.js.map → connection-state-BDikOGKo.js.map} +1 -1
  25. package/dist/{cookie-banner-DPiqIk9l.js → cookie-banner-D05DZRqY.js} +4 -4
  26. package/dist/{cookie-banner-DPiqIk9l.js.map → cookie-banner-D05DZRqY.js.map} +1 -1
  27. package/dist/{load-Bv6QWD8O.js → load-BO0qVu72.js} +9 -9
  28. package/dist/{load-Bv6QWD8O.js.map → load-BO0qVu72.js.map} +1 -1
  29. package/dist/main.js +2 -2
  30. package/dist/{multi-reactor-CcMPtKrf.js → multi-reactor-BG-DqUcm.js} +36 -20
  31. package/dist/{multi-reactor-CcMPtKrf.js.map → multi-reactor-BG-DqUcm.js.map} +1 -1
  32. package/dist/{pglite-seed-CbAziB1V.js → pglite-seed-CQJ97bEt.js} +4 -4
  33. package/dist/{pglite-seed-CbAziB1V.js.map → pglite-seed-CQJ97bEt.js.map} +1 -1
  34. package/dist/plugin-host--lBWChr9.js +254 -0
  35. package/dist/plugin-host--lBWChr9.js.map +1 -0
  36. package/dist/{preferences-store-Dqd7WH0_.js → preferences-store-Cm0BoiHA.js} +4 -4
  37. package/dist/{preferences-store-Dqd7WH0_.js.map → preferences-store-Cm0BoiHA.js.map} +1 -1
  38. package/dist/{reactor-BSJ_EKFj.js → reactor-B8Sh7Et8.js} +93 -27
  39. package/dist/reactor-B8Sh7Et8.js.map +1 -0
  40. package/dist/{registerServiceWorker-CcFLBm9W.js → registerServiceWorker-DT6t8wjg.js} +4 -4
  41. package/dist/{registerServiceWorker-CcFLBm9W.js.map → registerServiceWorker-DT6t8wjg.js.map} +1 -1
  42. package/dist/{runtime-config-CrRDk_9c.js → runtime-config-DI5OfIC6.js} +4 -4
  43. package/dist/{runtime-config-CrRDk_9c.js.map → runtime-config-DI5OfIC6.js.map} +1 -1
  44. package/dist/start-connect.js +2 -2
  45. package/dist/{useRegistryPackages-CfqEWzTx.js → useRegistryPackages-3EcR3GOh.js} +4 -4
  46. package/dist/{useRegistryPackages-CfqEWzTx.js.map → useRegistryPackages-3EcR3GOh.js.map} +1 -1
  47. package/package.json +15 -15
  48. package/dist/app-loader-CyvxdMUL.js +0 -4
  49. package/dist/app-loader-DY5wUIbd.js.map +0 -1
  50. package/dist/components-BKchrfUs.js +0 -5
  51. package/dist/plugin-host-DL7BEJa2.js +0 -120
  52. package/dist/plugin-host-DL7BEJa2.js.map +0 -1
  53. package/dist/reactor-BSJ_EKFj.js.map +0 -1
@@ -0,0 +1,254 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="566f903f-07cc-5e93-9047-80e612e99a53")}catch(e){}}();
3
+ import { DEFAULT_CONNECT_CONFIG } from "@powerhousedao/shared/connect";
4
+ import { z } from "zod";
5
+ import { resolveOrder, runTransformHook } from "@powerhousedao/host-core/plugins";
6
+ //#region src/plugins/assistant.ts
7
+ /**
8
+ * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).
9
+ * Presence flips `ai.assistantEnabled` on and merges the entry config
10
+ * (endpoint, agent, defaultOpen, …); absence forces it off. The assistant FAB
11
+ * in app.tsx already renders on `ai.assistantEnabled`, so this plugin's
12
+ * config shuffle is immediately visible in the UI.
13
+ */
14
+ const createAssistantPlugin = (config) => {
15
+ return {
16
+ name: "connect-assistant",
17
+ appliesTo: "connect",
18
+ hooks: { transformConnectConfig(served) {
19
+ return {
20
+ ...served,
21
+ ai: {
22
+ ...served.ai,
23
+ assistantEnabled: true,
24
+ ...config
25
+ }
26
+ };
27
+ } }
28
+ };
29
+ };
30
+ //#endregion
31
+ //#region src/plugins/generic.ts
32
+ /**
33
+ * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).
34
+ *
35
+ * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section
36
+ * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete). These
37
+ * describe nothing outside the generic chrome (connect.config.ts reads them to
38
+ * decide whether the add-drive affordance and the drive sections render), so
39
+ * under uniform runners they are configured HERE, through this plugin's entry
40
+ * config, not as free-standing top-level connect.drives values:
41
+ *
42
+ * - present + entry provides a value -> that value
43
+ * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG
44
+ * - absent from the composition -> zeroed off (see plugin-host's
45
+ * zeroAbsentSlices — no chrome, no
46
+ * toggles)
47
+ *
48
+ * The top-level served value is deliberately NOT a fallback: ownership means a
49
+ * single source. `branding` is intentionally NOT handled here — it has reach
50
+ * beyond the chrome (e.g. document.title), so it stays a Connect-level config
51
+ * value that survives this plugin's absence.
52
+ */
53
+ const sectionSchema = z.object({
54
+ enabled: z.boolean().optional(),
55
+ allowAdd: z.boolean().optional(),
56
+ allowDelete: z.boolean().optional()
57
+ }).optional();
58
+ const genericConfigSchema = z.object({
59
+ allowAddDrive: z.boolean().optional(),
60
+ sections: z.object({
61
+ remote: sectionSchema,
62
+ local: sectionSchema
63
+ }).optional()
64
+ }).partial();
65
+ const DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;
66
+ const createGenericPlugin = (rawConfig) => {
67
+ const config = genericConfigSchema.parse(rawConfig ?? {});
68
+ return {
69
+ name: "connect-generic",
70
+ appliesTo: "connect",
71
+ configSchema: genericConfigSchema,
72
+ hooks: { transformConnectConfig(served) {
73
+ const entrySections = config.sections ?? {};
74
+ return {
75
+ ...served,
76
+ drives: {
77
+ ...served.drives,
78
+ allowAddDrive: config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,
79
+ sections: {
80
+ remote: {
81
+ ...DEFAULT_DRIVES?.sections?.remote,
82
+ ...entrySections.remote
83
+ },
84
+ local: {
85
+ ...DEFAULT_DRIVES?.sections?.local,
86
+ ...entrySections.local
87
+ }
88
+ }
89
+ }
90
+ };
91
+ } }
92
+ };
93
+ };
94
+ //#endregion
95
+ //#region src/plugins/openpanel.ts
96
+ /**
97
+ * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence
98
+ * is activation: the entry config (clientId, trackUiEvents, trackOperations)
99
+ * merges into the served `openPanel` block; absence clears the clientId and
100
+ * turns tracking off. Config shuffle today; the Analytics/OpenPanel
101
+ * components that consume it already live in the app tree.
102
+ */
103
+ const createOpenPanelPlugin = (config) => {
104
+ return {
105
+ name: "connect-openpanel",
106
+ appliesTo: "connect",
107
+ hooks: { transformConnectConfig(served) {
108
+ return {
109
+ ...served,
110
+ openPanel: {
111
+ ...served.openPanel,
112
+ ...config
113
+ }
114
+ };
115
+ } }
116
+ };
117
+ };
118
+ //#endregion
119
+ //#region src/plugins/sentry.ts
120
+ /**
121
+ * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence
122
+ * is activation: listing it merges the entry config (dsn, env, tracing) into
123
+ * the served `sentry` block; omitting it nulls the dsn (see the absence
124
+ * zeroing in plugin-host). A thin config shuffle today — the SentryProvider
125
+ * that reads this slice already exists in the app.
126
+ */
127
+ const createSentryPlugin = (config) => {
128
+ return {
129
+ name: "connect-sentry",
130
+ appliesTo: "connect",
131
+ hooks: { transformConnectConfig(served) {
132
+ return {
133
+ ...served,
134
+ sentry: {
135
+ ...served.sentry,
136
+ ...config
137
+ }
138
+ };
139
+ } }
140
+ };
141
+ };
142
+ //#endregion
143
+ //#region src/plugins/vetra-studio.ts
144
+ /**
145
+ * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its
146
+ * presence turns Connect's studio mode on; the classic `app.studioMode`
147
+ * consumer paths run unchanged, and absence forces studio off (the zeroing in
148
+ * plugin-host). Lives here, in Connect's own source, because the studio-mode
149
+ * behaviour is Connect browser behaviour — the published vetra-studio/connect
150
+ * module is only the server-resolvable identity of the same plugin.
151
+ */
152
+ const createVetraStudioPlugin = (config) => {
153
+ return {
154
+ name: "vetra-studio-connect",
155
+ appliesTo: "connect",
156
+ hooks: { transformConnectConfig(served) {
157
+ return {
158
+ ...served,
159
+ app: {
160
+ ...served.app,
161
+ studioMode: true,
162
+ ...config
163
+ }
164
+ };
165
+ } }
166
+ };
167
+ };
168
+ //#endregion
169
+ //#region src/plugin-host.ts
170
+ /** The built-in registry: published specifier -> the module's factory. The
171
+ * modules live in Connect's own source (bundled into the app), so this is a
172
+ * static import map, not a dynamic module resolution. */
173
+ const BUILTINS = {
174
+ "@powerhousedao/connect/plugins/generic": createGenericPlugin,
175
+ "@powerhousedao/connect/plugins/sentry": createSentryPlugin,
176
+ "@powerhousedao/connect/plugins/openpanel": createOpenPanelPlugin,
177
+ "@powerhousedao/connect/plugins/assistant": createAssistantPlugin,
178
+ "@powerhousedao/vetra-studio/connect": createVetraStudioPlugin
179
+ };
180
+ /** The config slices each built-in owns; zeroed when its plugin is ABSENT
181
+ * from a declared composition — presence is activation. */
182
+ function zeroAbsentSlices(config, present) {
183
+ const out = { ...config };
184
+ if (!present.has("@powerhousedao/connect/plugins/generic")) {
185
+ const off = {
186
+ enabled: false,
187
+ allowAdd: false,
188
+ allowDelete: false
189
+ };
190
+ out.drives = {
191
+ ...out.drives,
192
+ allowAddDrive: false,
193
+ sections: {
194
+ remote: off,
195
+ local: off
196
+ }
197
+ };
198
+ }
199
+ if (!present.has("@powerhousedao/connect/plugins/sentry")) out.sentry = {
200
+ ...out.sentry,
201
+ dsn: null
202
+ };
203
+ if (!present.has("@powerhousedao/connect/plugins/openpanel")) out.openPanel = {
204
+ ...out.openPanel,
205
+ clientId: "",
206
+ trackUiEvents: false,
207
+ trackOperations: false
208
+ };
209
+ if (!present.has("@powerhousedao/connect/plugins/assistant")) out.ai = {
210
+ ...out.ai,
211
+ assistantEnabled: false
212
+ };
213
+ if (!present.has("@powerhousedao/vetra-studio/connect")) out.app = {
214
+ ...out.app,
215
+ studioMode: false
216
+ };
217
+ return out;
218
+ }
219
+ const LOG = "[connect:plugins]";
220
+ /**
221
+ * Apply the composition to the served config. Pure (no mutation of the input);
222
+ * called from loadRuntimeConfig after the fetch, before the cache is warmed —
223
+ * every downstream consumer sees the transformed config through the classic
224
+ * paths. Logs the resolved plan and each lifecycle hook it fires to the
225
+ * browser console, so activation is observable (Change 2).
226
+ */
227
+ async function applyComposition(config) {
228
+ const composition = config.composition;
229
+ if (!composition) return config;
230
+ const present = new Set(composition.map((entry) => entry.module));
231
+ const plugins = [];
232
+ console.info(`${LOG} resolving composition — ${composition.length} entr${composition.length === 1 ? "y" : "ies"}`);
233
+ for (const entry of composition) {
234
+ const factory = BUILTINS[entry.module];
235
+ if (!factory) {
236
+ console.warn(`${LOG} ✗ ${entry.module} — unknown (external plugin loading not wired); SKIPPED`);
237
+ continue;
238
+ }
239
+ const plugin = factory(entry.config ?? {});
240
+ plugins.push(plugin);
241
+ const cfgKeys = Object.keys(entry.config ?? {});
242
+ console.info(`${LOG} ✓ ${plugin.name} (${entry.module})` + (cfgKeys.length ? ` config: {${cfgKeys.join(", ")}}` : ""));
243
+ }
244
+ const ordered = resolveOrder(plugins);
245
+ const ctx = { entryConfig: {} };
246
+ const ran = ordered.filter((p) => p.hooks?.transformConnectConfig).map((p) => p.name);
247
+ console.info(`${LOG} hook transformConnectConfig → ${ran.length ? ran.join(", ") : "(none)"}`);
248
+ return await runTransformHook("transformConnectConfig", ordered, ctx, zeroAbsentSlices(config, present));
249
+ }
250
+ //#endregion
251
+ export { applyComposition };
252
+
253
+ //# sourceMappingURL=plugin-host--lBWChr9.js.map
254
+ //# debugId=566f903f-07cc-5e93-9047-80e612e99a53
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-host--lBWChr9.js","sources":["../src/plugins/assistant.ts","../src/plugins/generic.ts","../src/plugins/openpanel.ts","../src/plugins/sentry.ts","../src/plugins/vetra-studio.ts","../src/plugin-host.ts"],"sourcesContent":["import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPlugin, ConnectPluginFactory } from \"./types.js\";\n\n/**\n * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).\n * Presence flips `ai.assistantEnabled` on and merges the entry config\n * (endpoint, agent, defaultOpen, …); absence forces it off. The assistant FAB\n * in app.tsx already renders on `ai.assistantEnabled`, so this plugin's\n * config shuffle is immediately visible in the UI.\n */\nexport const createAssistantPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-assistant\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n ai: { ...served.ai, assistantEnabled: true, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createAssistantPlugin;\n","import { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport { z } from \"zod\";\nimport type { ConnectPlugin, ConnectPluginFactory } from \"./types.js\";\n\n/**\n * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).\n *\n * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section\n * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete). These\n * describe nothing outside the generic chrome (connect.config.ts reads them to\n * decide whether the add-drive affordance and the drive sections render), so\n * under uniform runners they are configured HERE, through this plugin's entry\n * config, not as free-standing top-level connect.drives values:\n *\n * - present + entry provides a value -> that value\n * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG\n * - absent from the composition -> zeroed off (see plugin-host's\n * zeroAbsentSlices — no chrome, no\n * toggles)\n *\n * The top-level served value is deliberately NOT a fallback: ownership means a\n * single source. `branding` is intentionally NOT handled here — it has reach\n * beyond the chrome (e.g. document.title), so it stays a Connect-level config\n * value that survives this plugin's absence.\n */\n\nconst sectionSchema = z\n .object({\n enabled: z.boolean().optional(),\n allowAdd: z.boolean().optional(),\n allowDelete: z.boolean().optional(),\n })\n .optional();\n\nconst genericConfigSchema = z\n .object({\n allowAddDrive: z.boolean().optional(),\n sections: z\n .object({ remote: sectionSchema, local: sectionSchema })\n .optional(),\n })\n .partial();\n\ntype GenericConfig = z.infer<typeof genericConfigSchema>;\n\nconst DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;\n\nexport const createGenericPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = genericConfigSchema.parse(rawConfig ?? {}) as GenericConfig;\n const plugin: ConnectPlugin = {\n name: \"connect-generic\",\n appliesTo: \"connect\",\n configSchema: genericConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const entrySections = config.sections ?? {};\n return {\n ...served,\n drives: {\n ...served.drives,\n // Owned: entry value, else the single-source default — never the\n // served top-level value.\n allowAddDrive:\n config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,\n sections: {\n remote: {\n ...DEFAULT_DRIVES?.sections?.remote,\n ...entrySections.remote,\n },\n local: {\n ...DEFAULT_DRIVES?.sections?.local,\n ...entrySections.local,\n },\n },\n } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createGenericPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPlugin, ConnectPluginFactory } from \"./types.js\";\n\n/**\n * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence\n * is activation: the entry config (clientId, trackUiEvents, trackOperations)\n * merges into the served `openPanel` block; absence clears the clientId and\n * turns tracking off. Config shuffle today; the Analytics/OpenPanel\n * components that consume it already live in the app tree.\n */\nexport const createOpenPanelPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-openpanel\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n openPanel: { ...served.openPanel, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createOpenPanelPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPlugin, ConnectPluginFactory } from \"./types.js\";\n\n/**\n * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence\n * is activation: listing it merges the entry config (dsn, env, tracing) into\n * the served `sentry` block; omitting it nulls the dsn (see the absence\n * zeroing in plugin-host). A thin config shuffle today — the SentryProvider\n * that reads this slice already exists in the app.\n */\nexport const createSentryPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"connect-sentry\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n sentry: { ...served.sentry, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createSentryPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { ConnectPlugin, ConnectPluginFactory } from \"./types.js\";\n\n/**\n * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its\n * presence turns Connect's studio mode on; the classic `app.studioMode`\n * consumer paths run unchanged, and absence forces studio off (the zeroing in\n * plugin-host). Lives here, in Connect's own source, because the studio-mode\n * behaviour is Connect browser behaviour — the published vetra-studio/connect\n * module is only the server-resolvable identity of the same plugin.\n */\nexport const createVetraStudioPlugin: ConnectPluginFactory = (config) => {\n const plugin: ConnectPlugin = {\n name: \"vetra-studio-connect\",\n appliesTo: \"connect\",\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n app: { ...served.app, studioMode: true, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createVetraStudioPlugin;\n","import {\n resolveOrder,\n runObserveHookSequential,\n runTransformHook,\n type HostPlugin,\n} from \"@powerhousedao/host-core/plugins\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport createAssistantPlugin from \"./plugins/assistant.js\";\nimport createGenericPlugin from \"./plugins/generic.js\";\nimport createOpenPanelPlugin from \"./plugins/openpanel.js\";\nimport createSentryPlugin from \"./plugins/sentry.js\";\nimport type {\n ConnectConfigHooks,\n ConnectPlugin,\n ConnectPluginContext,\n ConnectPluginFactory,\n} from \"./plugins/types.js\";\nimport createVetraStudioPlugin from \"./plugins/vetra-studio.js\";\n\nexport type { ConnectPluginContext } from \"./plugins/types.js\";\n\n/**\n * R3.2 — ConnectCore's plugin pipeline (rewire plan R3; the browser side of\n * the real-pipeline decision Q2). Runs ONLY when the served runtime config\n * carries a `composition` (projected by the uniform-runners connect runner\n * from host.js runner.plugins) AND the runtime flag is on — otherwise the\n * classic boot is byte-identical.\n *\n * The built-in plugins are REAL modules under ./plugins — each a\n * `(config) => HostPlugin` with a named `transformConnectConfig` hook, so the\n * config slice it owns is auditable in its own file. Presence is activation:\n * a plugin that is absent from a declared composition has its slice ZEROED.\n * Unknown specifiers are logged and skipped (external, non-built-in browser\n * plugin loading is the documented follow-up; the connect runner should also\n * reject unknowns at `ph run` time — tracked separately).\n */\n\nexport const PLUGIN_RUNNER_FLAG = \"FEATURE_PLUGIN_RUNNER_ENABLED\";\n\n/** The built-in registry: published specifier -> the module's factory. The\n * modules live in Connect's own source (bundled into the app), so this is a\n * static import map, not a dynamic module resolution. */\nconst BUILTINS: Record<string, ConnectPluginFactory> = {\n \"@powerhousedao/connect/plugins/generic\": createGenericPlugin,\n \"@powerhousedao/connect/plugins/sentry\": createSentryPlugin,\n \"@powerhousedao/connect/plugins/openpanel\": createOpenPanelPlugin,\n \"@powerhousedao/connect/plugins/assistant\": createAssistantPlugin,\n \"@powerhousedao/vetra-studio/connect\": createVetraStudioPlugin,\n};\n\n/** The config slices each built-in owns; zeroed when its plugin is ABSENT\n * from a declared composition — presence is activation. */\nfunction zeroAbsentSlices(\n config: PHConnectRuntimeConfig,\n present: ReadonlySet<string>,\n): PHConnectRuntimeConfig {\n const out = { ...config };\n if (!present.has(\"@powerhousedao/connect/plugins/generic\")) {\n // The drive-chrome toggles the generic plugin owns describe nothing when\n // the generic chrome is not composed in: no add-drive affordance, and the\n // remote/local sections off. (branding is NOT zeroed — it is Connect-level\n // and survives the plugin's absence.)\n const off = { enabled: false, allowAdd: false, allowDelete: false };\n out.drives = {\n ...out.drives,\n allowAddDrive: false,\n sections: { remote: off, local: off },\n } as never;\n }\n if (!present.has(\"@powerhousedao/connect/plugins/sentry\")) {\n out.sentry = { ...out.sentry, dsn: null } as never;\n }\n if (!present.has(\"@powerhousedao/connect/plugins/openpanel\")) {\n out.openPanel = {\n ...out.openPanel,\n clientId: \"\",\n trackUiEvents: false,\n trackOperations: false,\n } as never;\n }\n if (!present.has(\"@powerhousedao/connect/plugins/assistant\")) {\n out.ai = { ...out.ai, assistantEnabled: false } as never;\n }\n if (!present.has(\"@powerhousedao/vetra-studio/connect\")) {\n out.app = { ...out.app, studioMode: false } as never;\n }\n return out;\n}\n\nconst LOG = \"[connect:plugins]\";\n\n/**\n * Apply the composition to the served config. Pure (no mutation of the input);\n * called from loadRuntimeConfig after the fetch, before the cache is warmed —\n * every downstream consumer sees the transformed config through the classic\n * paths. Logs the resolved plan and each lifecycle hook it fires to the\n * browser console, so activation is observable (Change 2).\n */\nexport async function applyComposition(\n config: PHConnectRuntimeConfig,\n): Promise<PHConnectRuntimeConfig> {\n const composition = config.composition;\n if (!composition) return config;\n\n const present = new Set(composition.map((entry) => entry.module));\n const plugins: ConnectPlugin[] = [];\n\n console.info(\n `${LOG} resolving composition — ${composition.length} entr${composition.length === 1 ? \"y\" : \"ies\"}`,\n );\n for (const entry of composition) {\n const factory = BUILTINS[entry.module];\n if (!factory) {\n console.warn(\n `${LOG} ✗ ${entry.module} — unknown (external plugin loading not wired); SKIPPED`,\n );\n continue;\n }\n const plugin = factory(entry.config ?? {});\n plugins.push(plugin);\n const cfgKeys = Object.keys(entry.config ?? {});\n console.info(\n `${LOG} ✓ ${plugin.name} (${entry.module})` +\n (cfgKeys.length ? ` config: {${cfgKeys.join(\", \")}}` : \"\"),\n );\n }\n\n const ordered = resolveOrder(plugins);\n const ctx: ConnectPluginContext = { entryConfig: {} };\n const ran = ordered\n .filter((p) => p.hooks?.transformConnectConfig)\n .map((p) => p.name);\n console.info(\n `${LOG} hook transformConnectConfig → ${ran.length ? ran.join(\", \") : \"(none)\"}`,\n );\n const transformed = await runTransformHook<\n PHConnectRuntimeConfig,\n ConnectPluginContext\n >(\"transformConnectConfig\", ordered, ctx, zeroAbsentSlices(config, present));\n return transformed;\n}\n\n/** Teardown parity with the server pipeline (unused tonight; the browser has\n * no orderly shutdown, but the vocabulary stays symmetric). */\nexport async function shutdownComposition(\n plugins: readonly HostPlugin<ConnectConfigHooks>[],\n): Promise<void> {\n await runObserveHookSequential(\"onShutdown\", plugins, { entryConfig: {} });\n}\n"],"names":[],"mappings":"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","debug_id":"566f903f-07cc-5e93-9047-80e612e99a53"}
@@ -1,7 +1,7 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0c494d4f-efdb-5711-97d8-4e6daaff3e2e")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="10de0235-fdbd-50e7-920d-4b96495c866c")}catch(e){}}();
3
3
  import { t as getIsEmbedded } from "./useIsEmbedded-BWJ0qb7w.js";
4
- import { r as connectConfig } from "./connect.config-CY3WDzWp.js";
4
+ import { r as connectConfig } from "./connect.config-CB78ZsFz.js";
5
5
  import { useSyncExternalStore } from "react";
6
6
  //#region src/hooks/preferences-store.ts
7
7
  const namespace = connectConfig.routerBasename;
@@ -81,5 +81,5 @@ const useCookieBanner = () => {
81
81
  //#endregion
82
82
  export { useAcceptedCookies as n, useCookieBanner as r, setBannerShown as t };
83
83
 
84
- //# sourceMappingURL=preferences-store-Dqd7WH0_.js.map
85
- //# debugId=0c494d4f-efdb-5711-97d8-4e6daaff3e2e
84
+ //# sourceMappingURL=preferences-store-Cm0BoiHA.js.map
85
+ //# debugId=10de0235-fdbd-50e7-920d-4b96495c866c
@@ -1 +1 @@
1
- {"version":3,"file":"preferences-store-Dqd7WH0_.js","sources":["../src/hooks/preferences-store.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useSyncExternalStore } from \"react\";\n\nimport { getIsEmbedded } from \"./useIsEmbedded.js\";\n\nconst namespace = connectConfig.routerBasename;\n\n/**\n * Block-proof home for Connect's consent and banner state.\n *\n * The file name deliberately avoids words that appear in ad-blocker\n * filter lists (cookie, banner, consent, analytics, ...). Modules in the\n * app's critical import chain import from here, never from files whose\n * URLs match those filters. If an ad blocker blocks the lazy-loaded\n * cookie-banner chunk instead, the app simply never shows the banner —\n * which leaves the flags at their rejected defaults (analytics off) —\n * and everything else keeps working.\n */\n\n// ---------------------------------------------------------------------------\n// Accepted cookies (analytics / marketing / functional)\n// ---------------------------------------------------------------------------\n\nexport const ACCEPTED_COOKIES_KEY_STORAGE = `${namespace}:acceptedCookies`;\n\nexport interface AcceptedCookies {\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n}\n\nconst REJECTED_COOKIES: AcceptedCookies = {\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nconst cookieListeners = new Set<() => void>();\n\nlet acceptedCookies: AcceptedCookies = getInitialAcceptedCookies();\n\nfunction getInitialAcceptedCookies(): AcceptedCookies {\n try {\n const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);\n return value ? (JSON.parse(value) as AcceptedCookies) : REJECTED_COOKIES;\n } catch {\n return REJECTED_COOKIES;\n }\n}\n\nfunction subscribeAcceptedCookies(fn: () => void) {\n cookieListeners.add(fn);\n return () => {\n cookieListeners.delete(fn);\n };\n}\n\nfunction getAcceptedCookies(): AcceptedCookies {\n return acceptedCookies;\n}\n\nexport function setAcceptedCookies(\n setter: (prev: AcceptedCookies) => AcceptedCookies,\n) {\n acceptedCookies = setter(acceptedCookies);\n localStorage.setItem(\n ACCEPTED_COOKIES_KEY_STORAGE,\n JSON.stringify(acceptedCookies),\n );\n cookieListeners.forEach((fn) => fn());\n}\n\nexport const useAcceptedCookies = () => {\n const cookies = useSyncExternalStore(\n subscribeAcceptedCookies,\n getAcceptedCookies,\n getAcceptedCookies,\n );\n return [cookies, setAcceptedCookies] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Cookie banner visibility\n// ---------------------------------------------------------------------------\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst bannerListeners = new Set<() => void>();\n\nlet bannerShown = getInitialBannerShown();\n\nfunction getInitialBannerShown(): boolean {\n if (getIsEmbedded()) return false;\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== \"false\";\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction subscribeBannerShown(fn: () => void) {\n bannerListeners.add(fn);\n return () => {\n bannerListeners.delete(fn);\n };\n}\n\nfunction getBannerShown(): boolean {\n return bannerShown;\n}\n\nexport function setBannerShown(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n bannerListeners.forEach((fn) => fn());\n}\n\nexport const useCookieBanner = () => {\n const shown = useSyncExternalStore(\n subscribeBannerShown,\n getBannerShown,\n getBannerShown,\n );\n return [shown, setBannerShown] as const;\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,YAAY,cAAc;;;;;;;;;;;;AAkBhC,MAAa,+BAA+B,GAAG,UAAU;AAQzD,MAAM,mBAAoC;CACxC,WAAW;CACX,WAAW;CACX,YAAY;AACd;AAEA,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,kBAAmC,0BAA0B;AAEjE,SAAS,4BAA6C;CACpD,IAAI;EACF,MAAM,QAAQ,aAAa,QAAQ,4BAA4B;EAC/D,OAAO,QAAS,KAAK,MAAM,KAAK,IAAwB;CAC1D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,yBAAyB,IAAgB;CAChD,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,qBAAsC;CAC7C,OAAO;AACT;AAEA,SAAgB,mBACd,QACA;CACA,kBAAkB,OAAO,eAAe;CACxC,aAAa,QACX,8BACA,KAAK,UAAU,eAAe,CAChC;CACA,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,2BAA2B;CAMtC,OAAO,CALS,qBACd,0BACA,oBACA,kBAEY,GAAG,kBAAkB;AACrC;AAMA,MAAa,4BAA4B,GAAG,UAAU;AAEtD,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,cAAc,sBAAsB;AAExC,SAAS,wBAAiC;CACxC,IAAI,cAAc,GAAG,OAAO;CAC5B,IAAI;EAEF,OADc,aAAa,QAAQ,yBACxB,MAAM;CACnB,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;EACnB,OAAO;CACT;AACF;AAEA,SAAS,qBAAqB,IAAgB;CAC5C,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,iBAA0B;CACjC,OAAO;AACT;AAEA,SAAgB,eAAe,OAAgB;CAC7C,cAAc;CACd,aAAa,QAAQ,2BAA2B,KAAK,UAAU,KAAK,CAAC;CACrE,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,wBAAwB;CAMnC,OAAO,CALO,qBACZ,sBACA,gBACA,cAEU,GAAG,cAAc;AAC/B","debug_id":"0c494d4f-efdb-5711-97d8-4e6daaff3e2e"}
1
+ {"version":3,"file":"preferences-store-Cm0BoiHA.js","sources":["../src/hooks/preferences-store.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useSyncExternalStore } from \"react\";\n\nimport { getIsEmbedded } from \"./useIsEmbedded.js\";\n\nconst namespace = connectConfig.routerBasename;\n\n/**\n * Block-proof home for Connect's consent and banner state.\n *\n * The file name deliberately avoids words that appear in ad-blocker\n * filter lists (cookie, banner, consent, analytics, ...). Modules in the\n * app's critical import chain import from here, never from files whose\n * URLs match those filters. If an ad blocker blocks the lazy-loaded\n * cookie-banner chunk instead, the app simply never shows the banner —\n * which leaves the flags at their rejected defaults (analytics off) —\n * and everything else keeps working.\n */\n\n// ---------------------------------------------------------------------------\n// Accepted cookies (analytics / marketing / functional)\n// ---------------------------------------------------------------------------\n\nexport const ACCEPTED_COOKIES_KEY_STORAGE = `${namespace}:acceptedCookies`;\n\nexport interface AcceptedCookies {\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n}\n\nconst REJECTED_COOKIES: AcceptedCookies = {\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nconst cookieListeners = new Set<() => void>();\n\nlet acceptedCookies: AcceptedCookies = getInitialAcceptedCookies();\n\nfunction getInitialAcceptedCookies(): AcceptedCookies {\n try {\n const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);\n return value ? (JSON.parse(value) as AcceptedCookies) : REJECTED_COOKIES;\n } catch {\n return REJECTED_COOKIES;\n }\n}\n\nfunction subscribeAcceptedCookies(fn: () => void) {\n cookieListeners.add(fn);\n return () => {\n cookieListeners.delete(fn);\n };\n}\n\nfunction getAcceptedCookies(): AcceptedCookies {\n return acceptedCookies;\n}\n\nexport function setAcceptedCookies(\n setter: (prev: AcceptedCookies) => AcceptedCookies,\n) {\n acceptedCookies = setter(acceptedCookies);\n localStorage.setItem(\n ACCEPTED_COOKIES_KEY_STORAGE,\n JSON.stringify(acceptedCookies),\n );\n cookieListeners.forEach((fn) => fn());\n}\n\nexport const useAcceptedCookies = () => {\n const cookies = useSyncExternalStore(\n subscribeAcceptedCookies,\n getAcceptedCookies,\n getAcceptedCookies,\n );\n return [cookies, setAcceptedCookies] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Cookie banner visibility\n// ---------------------------------------------------------------------------\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst bannerListeners = new Set<() => void>();\n\nlet bannerShown = getInitialBannerShown();\n\nfunction getInitialBannerShown(): boolean {\n if (getIsEmbedded()) return false;\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== \"false\";\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction subscribeBannerShown(fn: () => void) {\n bannerListeners.add(fn);\n return () => {\n bannerListeners.delete(fn);\n };\n}\n\nfunction getBannerShown(): boolean {\n return bannerShown;\n}\n\nexport function setBannerShown(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n bannerListeners.forEach((fn) => fn());\n}\n\nexport const useCookieBanner = () => {\n const shown = useSyncExternalStore(\n subscribeBannerShown,\n getBannerShown,\n getBannerShown,\n );\n return [shown, setBannerShown] as const;\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,YAAY,cAAc;;;;;;;;;;;;AAkBhC,MAAa,+BAA+B,GAAG,UAAU;AAQzD,MAAM,mBAAoC;CACxC,WAAW;CACX,WAAW;CACX,YAAY;AACd;AAEA,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,kBAAmC,0BAA0B;AAEjE,SAAS,4BAA6C;CACpD,IAAI;EACF,MAAM,QAAQ,aAAa,QAAQ,4BAA4B;EAC/D,OAAO,QAAS,KAAK,MAAM,KAAK,IAAwB;CAC1D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,yBAAyB,IAAgB;CAChD,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,qBAAsC;CAC7C,OAAO;AACT;AAEA,SAAgB,mBACd,QACA;CACA,kBAAkB,OAAO,eAAe;CACxC,aAAa,QACX,8BACA,KAAK,UAAU,eAAe,CAChC;CACA,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,2BAA2B;CAMtC,OAAO,CALS,qBACd,0BACA,oBACA,kBAEY,GAAG,kBAAkB;AACrC;AAMA,MAAa,4BAA4B,GAAG,UAAU;AAEtD,MAAM,kCAAkB,IAAI,IAAgB;AAE5C,IAAI,cAAc,sBAAsB;AAExC,SAAS,wBAAiC;CACxC,IAAI,cAAc,GAAG,OAAO;CAC5B,IAAI;EAEF,OADc,aAAa,QAAQ,yBACxB,MAAM;CACnB,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;EACnB,OAAO;CACT;AACF;AAEA,SAAS,qBAAqB,IAAgB;CAC5C,gBAAgB,IAAI,EAAE;CACtB,aAAa;EACX,gBAAgB,OAAO,EAAE;CAC3B;AACF;AAEA,SAAS,iBAA0B;CACjC,OAAO;AACT;AAEA,SAAgB,eAAe,OAAgB;CAC7C,cAAc;CACd,aAAa,QAAQ,2BAA2B,KAAK,UAAU,KAAK,CAAC;CACrE,gBAAgB,SAAS,OAAO,GAAG,CAAC;AACtC;AAEA,MAAa,wBAAwB;CAMnC,OAAO,CALO,qBACZ,sBACA,gBACA,cAEU,GAAG,cAAc;AAC/B","debug_id":"10de0235-fdbd-50e7-920d-4b96495c866c"}
@@ -1,13 +1,13 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b3417e0-d6e0-5cff-a81f-f789dbc08790")}catch(e){}}();
3
- import { n as getRuntimeConfig } from "./runtime-config-CrRDk_9c.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="25f5b030-997d-5eef-b64b-536c6e8d0f21")}catch(e){}}();
3
+ import { n as getRuntimeConfig } from "./runtime-config-DI5OfIC6.js";
4
4
  import { a as closeWithin, n as watchStoreLockWait, o as configureConnectChannelScheme, s as createConnectSignerConfig } from "./store-lock-Bi3B9VJD.js";
5
5
  import { a as resolvePgMajorForRuntime, f as toStoredDocumentsRefused, r as loadPGliteModule } from "./pglite-major-p4_YefAE.js";
6
- import { n as buildPHGlobalConfig, o as phGlobalConfig, r as connectConfig } from "./connect.config-CY3WDzWp.js";
6
+ import { n as buildPHGlobalConfig, o as phGlobalConfig, r as connectConfig } from "./connect.config-CB78ZsFz.js";
7
7
  import { r as toast } from "./toast-C6WW-_O-.js";
8
8
  import { r as getSharedDeps, t as BrowserPackageManager } from "./package-manager-BPVMRBoV.js";
9
- import { a as isPackagedConnectDist, i as getVersion, n as getGitSha } from "./build-info-wcenFM4h.js";
10
- import { g as RELATIONAL_PGLITE_NAME, h as REACTOR_PGLITE_NAME, m as REACTOR_INSTANCE_NAMESPACE, n as getWorkerConnectionStatus, o as detectReactorPgMajor, r as setWorkerConnectionStatus, s as detectRelationalPgMajor, t as clearStorageHeld } from "./connection-state-CRm6nmtQ.js";
9
+ import { a as isPackagedConnectDist, i as getVersion, n as getGitSha } from "./build-info-CRwnXFRI.js";
10
+ import { g as RELATIONAL_PGLITE_NAME, h as REACTOR_PGLITE_NAME, m as REACTOR_INSTANCE_NAMESPACE, n as getWorkerConnectionStatus, o as detectReactorPgMajor, r as setWorkerConnectionStatus, s as detectRelationalPgMajor, t as clearStorageHeld } from "./connection-state-BDikOGKo.js";
11
11
  import { t as isRuntimeFlagEnabled } from "./runtime-flag-CT5OKujT.js";
12
12
  import { createRelationalDb } from "@powerhousedao/shared/processors";
13
13
  import { DocumentModelRegistry, DocumentModelResolver, HardenedPGliteDialect, LocalChannelFactory, LocalChannelPortRegistry, PGLITE_IDB_STORAGE_FACTS, ReactorEventTypes, createReactorHostModuleBase } from "@powerhousedao/reactor";
@@ -938,11 +938,6 @@ async function startupOwningStores(startup, namespaces, watchOptions) {
938
938
  }
939
939
  }
940
940
  //#endregion
941
- //#region src/utils/multi-reactor-flag.ts
942
- function isMultiReactorEnabled() {
943
- return getRuntimeConfig().connect.instance?.multiReactor ?? false;
944
- }
945
- //#endregion
946
941
  //#region src/utils/reactor-worker-flag.ts
947
942
  const REACTOR_WORKER_QUERY_KEY = "reactorWorker";
948
943
  const REACTOR_WORKER_STORAGE_KEY = "ph:reactorWorker";
@@ -954,6 +949,37 @@ function isReactorWorkerEnabled() {
954
949
  });
955
950
  }
956
951
  //#endregion
952
+ //#region src/utils/multi-reactor-flag.ts
953
+ function isMultiReactorEnabled() {
954
+ return getRuntimeConfig().connect.instance?.multiReactor ?? false;
955
+ }
956
+ //#endregion
957
+ //#region src/store/reactor-client-mode.ts
958
+ const MODES = /* @__PURE__ */ new Set([
959
+ "in-process",
960
+ "worker",
961
+ "remote",
962
+ "router"
963
+ ]);
964
+ function fromQuery() {
965
+ if (typeof window === "undefined") return void 0;
966
+ try {
967
+ const value = new URLSearchParams(window.location.search).get("reactorClient");
968
+ return value && MODES.has(value) ? value : void 0;
969
+ } catch {
970
+ return;
971
+ }
972
+ }
973
+ function resolveReactorClientMode() {
974
+ const override = fromQuery();
975
+ if (override) return override;
976
+ const configured = getRuntimeConfig().connect.instance?.reactorClient;
977
+ if (configured && MODES.has(configured)) return configured;
978
+ if (isMultiReactorEnabled()) return "router";
979
+ if (isReactorWorkerEnabled()) return "worker";
980
+ return "in-process";
981
+ }
982
+ //#endregion
957
983
  //#region src/utils/reactor-worker-url.ts
958
984
  /**
959
985
  * Stable path of the prebuilt reactor SharedWorker bundle, relative to the
@@ -1079,17 +1105,33 @@ function subscribeLocalPackageChanges(manager, onChange) {
1079
1105
  }
1080
1106
  //#endregion
1081
1107
  //#region src/store/app-reactor-client.ts
1082
- const loadMultiReactor = () => import("./multi-reactor-CcMPtKrf.js");
1083
- /** Flag off: the local client, and the router module is never loaded. */
1108
+ const loadMultiReactor = () => import("./multi-reactor-BG-DqUcm.js");
1109
+ /**
1110
+ * Pick the client for the resolved mode:
1111
+ * - `in-process` / `worker`: the local client, router module never loaded.
1112
+ * - `router`: the local reactor plus remote backends.
1113
+ * - `remote`: a remote-only router — a full IReactorClient that proxies to
1114
+ * the Switchboard over GraphQL with NO local reactor (no PGlite).
1115
+ */
1084
1116
  async function selectAppReactorClient(params) {
1085
- if (!params.multiReactor) {
1117
+ if (params.mode === "remote") {
1118
+ setFullReactorClient(void 0);
1119
+ const remote = await buildRemoteOnly(params);
1120
+ setFullReactorClient(remote);
1121
+ return remote;
1122
+ }
1123
+ if (params.mode !== "router") {
1086
1124
  if (window.ph?.fullReactorClient) setFullReactorClient(void 0);
1087
- return params.module.client;
1125
+ return requireModule(params).client;
1088
1126
  }
1089
1127
  setFullReactorClient(void 0);
1090
1128
  const routed = await buildRouter(params);
1091
1129
  setFullReactorClient(routed);
1092
- return routed ?? params.module.client;
1130
+ return routed ?? requireModule(params).client;
1131
+ }
1132
+ function requireModule(params) {
1133
+ if (!params.module) throw new Error(`reactorClient mode "${params.mode}" needs a local reactor, but none was built`);
1134
+ return params.module;
1093
1135
  }
1094
1136
  /** A Switchboard that cannot answer must not fail boot: list the tab's drives. */
1095
1137
  async function getAppDrives(client, local) {
@@ -1124,7 +1166,27 @@ async function buildRouter(params) {
1124
1166
  }
1125
1167
  logger.info("Multi-reactor routing to @url", remoteGraphqlUrl);
1126
1168
  return multiReactor.buildMultiReactorClient({
1127
- module: params.module,
1169
+ module: requireModule(params),
1170
+ remoteGraphqlUrl,
1171
+ signer: params.signer,
1172
+ documentModelModules: params.documentModelModules
1173
+ });
1174
+ }
1175
+ /**
1176
+ * The `remote` mode: a remote-only router — a full IReactorClient that proxies
1177
+ * to the Switchboard over GraphQL with NO local backend, so no local reactor
1178
+ * and no PGlite are ever built. A missing/unparseable remote URL is a hard
1179
+ * config error here (unlike `router`, there is no local reactor to fall back
1180
+ * to).
1181
+ */
1182
+ async function buildRemoteOnly(params) {
1183
+ if (!params.remoteDriveUrl) throw new Error("reactorClient \"remote\" needs a remote drive URL — declare a remote backend / default drive the client can proxy to");
1184
+ const multiReactor = await (params.loadRouter ?? loadMultiReactor)();
1185
+ const remoteGraphqlUrl = multiReactor.deriveSwitchboardGraphqlUrl(params.remoteDriveUrl);
1186
+ if (!remoteGraphqlUrl) throw new Error(`reactorClient "remote": the remote drive URL "${params.remoteDriveUrl}" does not resolve to a Switchboard GraphQL endpoint`);
1187
+ logger.info("Remote reactor client → @url", remoteGraphqlUrl);
1188
+ return multiReactor.buildMultiReactorClient({
1189
+ module: void 0,
1128
1190
  remoteGraphqlUrl,
1129
1191
  signer: params.signer,
1130
1192
  documentModelModules: params.documentModelModules
@@ -1298,9 +1360,12 @@ async function createReactor(localPackage) {
1298
1360
  renownUrl: phGlobalConfig.renownUrl,
1299
1361
  switchboardUrl: phGlobalConfig.switchboardUrl
1300
1362
  };
1301
- const multiReactor = isMultiReactorEnabled();
1363
+ const mode = resolveReactorClientMode();
1364
+ const multiReactor = mode === "router";
1365
+ const needsLocalReactor = mode !== "remote";
1366
+ const localAsWorker = needsLocalReactor && (mode === "worker" || mode === "router" && isReactorWorkerEnabled());
1302
1367
  let reactorClientModule;
1303
- if (isReactorWorkerEnabled()) {
1368
+ if (localAsWorker) {
1304
1369
  const packageSpecs = packageManager.getRegistryPackages().map((p) => p.version ? `${p.name}@${p.version}` : p.name);
1305
1370
  const registryClient = new RegistryClient(packageManager.cdnUrl ?? "");
1306
1371
  const documentModelLoader = { async load(documentType) {
@@ -1372,15 +1437,15 @@ async function createReactor(localPackage) {
1372
1437
  logger.error("Reactor worker failed to start: @error", error);
1373
1438
  throw error;
1374
1439
  }
1375
- } else reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, reactorFeatureFlags, discoveryService, createSignaturePolicy, renownEndpoints, unsupportedStoredDocuments, multiReactor);
1440
+ } else if (needsLocalReactor) reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, reactorFeatureFlags, discoveryService, createSignaturePolicy, renownEndpoints, unsupportedStoredDocuments, multiReactor);
1376
1441
  const appReactorClient = await selectAppReactorClient({
1377
- multiReactor,
1442
+ mode,
1378
1443
  module: reactorClientModule,
1379
1444
  remoteDriveUrl: phGlobalConfig.defaultDrivesUrl,
1380
1445
  signer: renown.signer,
1381
1446
  documentModelModules
1382
1447
  });
1383
- const drives = await getAppDrives(appReactorClient, reactorClientModule.client);
1448
+ const drives = await getAppDrives(appReactorClient, reactorClientModule?.client ?? appReactorClient);
1384
1449
  const didFromUrl = getDidFromUrl();
1385
1450
  await login(didFromUrl, renown);
1386
1451
  const documentCache = new DocumentCache(appReactorClient);
@@ -1436,11 +1501,12 @@ async function createReactor(localPackage) {
1436
1501
  notify: (message) => toast(message)
1437
1502
  });
1438
1503
  });
1439
- await refreshAppDrives(appReactorClient, reactorClientModule.client);
1504
+ await refreshAppDrives(appReactorClient, reactorClientModule?.client ?? appReactorClient);
1440
1505
  const packagesWithProcessorFactories = packageManager.packages.filter((pkg) => pkg.processorFactory !== void 0);
1441
- const reactorModule = reactorClientModule.kind === "browser" ? reactorClientModule.reactorModule : void 0;
1442
- if (packagesWithProcessorFactories.length > 0 && !reactorModule) for (const pkg of packagesWithProcessorFactories) logger.warn("Skipping processor factory @name: processors are not supported on the worker reactor path yet", pkg.manifest.name);
1443
- else if (packagesWithProcessorFactories.length > 0 && reactorModule) {
1506
+ const reactorModule = reactorClientModule?.kind === "browser" ? reactorClientModule.reactorModule : void 0;
1507
+ if (packagesWithProcessorFactories.length > 0 && !reactorClientModule) logger.info("Remote reactor client: @count processor factory/ies run on the Switchboard, not in the tab", packagesWithProcessorFactories.length);
1508
+ else if (packagesWithProcessorFactories.length > 0 && !reactorModule) for (const pkg of packagesWithProcessorFactories) logger.warn("Skipping processor factory @name: processors are not supported on the worker reactor path yet", pkg.manifest.name);
1509
+ else if (packagesWithProcessorFactories.length > 0 && reactorModule && reactorClientModule) {
1444
1510
  const readModels = reactorModule.readModelCoordinator.readModels;
1445
1511
  const processorHostModule = await createProcessorHostModule(reactorClientModule.client, readModels, window.ph?.attachmentService);
1446
1512
  if (processorHostModule !== void 0) await Promise.all(packagesWithProcessorFactories.map(async (pkg) => {
@@ -1473,5 +1539,5 @@ function getDriveUrl() {
1473
1539
  //#endregion
1474
1540
  export { createReactor as n, clearReactorStorage as t };
1475
1541
 
1476
- //# sourceMappingURL=reactor-BSJ_EKFj.js.map
1477
- //# debugId=5b3417e0-d6e0-5cff-a81f-f789dbc08790
1542
+ //# sourceMappingURL=reactor-B8Sh7Et8.js.map
1543
+ //# debugId=25f5b030-997d-5eef-b64b-536c6e8d0f21