@powerhousedao/connect 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 (109) hide show
  1. package/README.md +1 -1
  2. package/RUNTIME-CONFIG.md +6 -85
  3. package/dist/{ClearStorageModal-BwGVIuLX.js → ClearStorageModal-DQv3ZGOq.js} +4 -4
  4. package/dist/{ClearStorageModal-BwGVIuLX.js.map → ClearStorageModal-DQv3ZGOq.js.map} +1 -1
  5. package/dist/{CreateDocumentModal-B-cXzeOA.js → CreateDocumentModal-CiIW3pzx.js} +18 -9
  6. package/dist/CreateDocumentModal-CiIW3pzx.js.map +1 -0
  7. package/dist/{DebugSettingsModal-DfOnR4iY.js → DebugSettingsModal-DjFwGop2.js} +6 -6
  8. package/dist/{DebugSettingsModal-DfOnR4iY.js.map → DebugSettingsModal-DjFwGop2.js.map} +1 -1
  9. package/dist/{InspectorModal-BVqRNFfP.js → InspectorModal-C1ZVZpT5.js} +6 -6
  10. package/dist/{InspectorModal-BVqRNFfP.js.map → InspectorModal-C1ZVZpT5.js.map} +1 -1
  11. package/dist/{OpenFileDocumentsModal-BNHD0vg9.js → OpenFileDocumentsModal-B9c-CsKT.js} +4 -4
  12. package/dist/{OpenFileDocumentsModal-BNHD0vg9.js.map → OpenFileDocumentsModal-B9c-CsKT.js.map} +1 -1
  13. package/dist/app-loader-ClDJbH8j.js +4 -0
  14. package/dist/{app-loader-DtH6v5CE.js → app-loader-DxGySldw.js} +41 -32
  15. package/dist/{app-loader-DtH6v5CE.js.map → app-loader-DxGySldw.js.map} +1 -1
  16. package/dist/{app-skeleton-DFg65Rxa.js → app-skeleton-BHgmbYld.js} +3 -3
  17. package/dist/{app-skeleton-BFjvlTWd.js → app-skeleton-ClRUYLE_.js} +14 -5
  18. package/dist/app-skeleton-ClRUYLE_.js.map +1 -0
  19. package/dist/{boot-N7f3RrY_.js → boot-D2-yDYJi.js} +5 -5
  20. package/dist/{boot-N7f3RrY_.js.map → boot-D2-yDYJi.js.map} +1 -1
  21. package/dist/{build-info-TgBEqTq1.js → build-info-CZ8K52c5.js} +5 -5
  22. package/dist/{build-info-TgBEqTq1.js.map → build-info-CZ8K52c5.js.map} +1 -1
  23. package/dist/{components-B_wpF5Is.js → components-B36iVkNp.js} +8 -8
  24. package/dist/{components-B_wpF5Is.js.map → components-B36iVkNp.js.map} +1 -1
  25. package/dist/{connect.config-D1pGNmaF.js → connect.config-DL9nKtlW.js} +6 -5
  26. package/dist/connect.config-DL9nKtlW.js.map +1 -0
  27. package/dist/{connection-state-B6fleM37.js → connection-state-Bwm9Agwy.js} +4 -4
  28. package/dist/{connection-state-B6fleM37.js.map → connection-state-Bwm9Agwy.js.map} +1 -1
  29. package/dist/{cookie-banner-CAvd3PC3.js → cookie-banner-NclLYtB0.js} +4 -4
  30. package/dist/{cookie-banner-CAvd3PC3.js.map → cookie-banner-NclLYtB0.js.map} +1 -1
  31. package/dist/{drive-icon-BiVP8yJc.js → drive-icon-BIpd8edR.js} +14 -3
  32. package/dist/drive-icon-BIpd8edR.js.map +1 -0
  33. package/dist/generic.d.ts +20 -2
  34. package/dist/generic.d.ts.map +1 -1
  35. package/dist/generic.js +2 -2
  36. package/dist/{load-CkbGF6wB.js → load-C2wlvi5d.js} +9 -9
  37. package/dist/{load-CkbGF6wB.js.map → load-C2wlvi5d.js.map} +1 -1
  38. package/dist/{load-runtime-config-DXswYA71.js → load-runtime-config-BeZF5z7m.js} +4 -4
  39. package/dist/{load-runtime-config-DXswYA71.js.map → load-runtime-config-BeZF5z7m.js.map} +1 -1
  40. package/dist/main.js +2 -2
  41. package/dist/{package-manager-CPqbVSd8.js → package-manager-dfP4R5L3.js} +11 -10
  42. package/dist/{package-manager-CPqbVSd8.js.map → package-manager-dfP4R5L3.js.map} +1 -1
  43. package/dist/{pglite-seed-eGzXMld2.js → pglite-seed-QPbGbLB_.js} +4 -4
  44. package/dist/{pglite-seed-eGzXMld2.js.map → pglite-seed-QPbGbLB_.js.map} +1 -1
  45. package/dist/plugin-configs.d.ts +242 -0
  46. package/dist/plugin-configs.d.ts.map +1 -0
  47. package/dist/plugin-configs.js +26 -0
  48. package/dist/plugin-configs.js.map +1 -0
  49. package/dist/plugins-DV3oFEmL.js +263 -0
  50. package/dist/plugins-DV3oFEmL.js.map +1 -0
  51. package/dist/{preferences-store-CSqauT9V.js → preferences-store-DxYAnGCc.js} +4 -4
  52. package/dist/{preferences-store-CSqauT9V.js.map → preferences-store-DxYAnGCc.js.map} +1 -1
  53. package/dist/prerender.d.ts.map +1 -1
  54. package/dist/prerender.js +18 -7
  55. package/dist/prerender.js.map +1 -1
  56. package/dist/{reactor-DLCl-WHi.js → reactor-DT1kVwnf.js} +12 -7
  57. package/dist/{reactor-DLCl-WHi.js.map → reactor-DT1kVwnf.js.map} +1 -1
  58. package/dist/{registerServiceWorker-APlHkrmH.js → registerServiceWorker-X6fT91iL.js} +4 -4
  59. package/dist/{registerServiceWorker-APlHkrmH.js.map → registerServiceWorker-X6fT91iL.js.map} +1 -1
  60. package/dist/route-tree.js +1 -1
  61. package/dist/{route-views-CTARvT5N.js → route-views-2aB1ZZPP.js} +6 -6
  62. package/dist/route-views-2aB1ZZPP.js.map +1 -0
  63. package/dist/route-views-D_873yb_.js +4 -0
  64. package/dist/{route-views-BF0p-4Fi.js → route-views-DmmQ1DzX.js} +5 -5
  65. package/dist/{route-views-BF0p-4Fi.js.map → route-views-DmmQ1DzX.js.map} +1 -1
  66. package/dist/route-views.js +3 -3
  67. package/dist/router-CBzb5FUq.js +4 -0
  68. package/dist/{router-L9X9U-97.js → router-DXpaaTeR.js} +15 -7
  69. package/dist/router-DXpaaTeR.js.map +1 -0
  70. package/dist/{settings-B-apZN_f.js → settings-BwKo6EAU.js} +17 -10
  71. package/dist/{settings-B-apZN_f.js.map → settings-BwKo6EAU.js.map} +1 -1
  72. package/dist/{settings-tabs-CRgiuZcb.js → settings-tabs-BubPdsiT.js} +51 -19
  73. package/dist/settings-tabs-BubPdsiT.js.map +1 -0
  74. package/dist/shell-core.html +1 -1
  75. package/dist/shell-head.html +1 -1
  76. package/dist/shell.html +1 -1
  77. package/dist/start-connect.js +2 -2
  78. package/dist/style.css +109 -4
  79. package/dist/{ui-CwbE23ra.js → ui-BVOQ9tj_.js} +8 -8
  80. package/dist/{ui-CwbE23ra.js.map → ui-BVOQ9tj_.js.map} +1 -1
  81. package/dist/workflows-C3qEvx1R.js +63 -0
  82. package/dist/workflows-C3qEvx1R.js.map +1 -0
  83. package/docs/customizing/data-and-navigation.md +50 -0
  84. package/docs/customizing/drive-apps.md +42 -0
  85. package/docs/customizing/hosts-and-plugins.md +23 -0
  86. package/docs/customizing/layout.md +9 -2
  87. package/docs/customizing/modals.md +25 -4
  88. package/docs/customizing/overrides.md +59 -4
  89. package/docs/customizing/packages.md +2 -0
  90. package/docs/customizing/pages.md +10 -13
  91. package/docs/customizing/styles-and-branding.md +9 -2
  92. package/docs/customizing/types-and-troubleshooting.md +4 -2
  93. package/generic-routes.json +9 -0
  94. package/package.json +26 -19
  95. package/scripts/assert-plugin-configs.mjs +47 -0
  96. package/skills/customize-connect/SKILL.md +14 -11
  97. package/CUSTOMIZING.md +0 -80
  98. package/dist/CreateDocumentModal-B-cXzeOA.js.map +0 -1
  99. package/dist/app-loader-BjAXSJQ6.js +0 -4
  100. package/dist/app-skeleton-BFjvlTWd.js.map +0 -1
  101. package/dist/connect.config-D1pGNmaF.js.map +0 -1
  102. package/dist/drive-icon-BiVP8yJc.js.map +0 -1
  103. package/dist/plugins-CWbr0n_Q.js +0 -246
  104. package/dist/plugins-CWbr0n_Q.js.map +0 -1
  105. package/dist/route-views-CTARvT5N.js.map +0 -1
  106. package/dist/route-views-D8I-1PWU.js +0 -4
  107. package/dist/router-BguOMBUh.js +0 -4
  108. package/dist/router-L9X9U-97.js.map +0 -1
  109. package/dist/settings-tabs-CRgiuZcb.js.map +0 -1
package/README.md CHANGED
@@ -86,7 +86,7 @@ hosts/connect/routes/
86
86
  - The tree is generated into `.ph/connect-routes.gen.ts`, which types `createFileRoute`, `Link` and `useNavigate` with the project's routes.
87
87
  - Without a routes folder, Connect uses its prebuilt route tree.
88
88
 
89
- [CUSTOMIZING.md](./CUSTOMIZING.md) indexes the task-by-task guides in [`docs/customizing/`](./docs/customizing/), and coding agents start from the [customize-connect skill](./skills/customize-connect/SKILL.md).
89
+ The [customize-connect skill](./skills/customize-connect/SKILL.md) indexes the task-by-task guides in [`docs/customizing/`](./docs/customizing/), for people and coding agents. Contributor notes (UI screenshots and the files behind the customization surface) are in `apps/connect/CUSTOMIZING.md` in the Powerhouse monorepo; the published package leaves them out.
90
90
 
91
91
  Code that does not build with Vite adds code routes with `registerConnectRoutes` from `@powerhousedao/connect/router`: it receives Connect's routes (`appRoute` for the layout, `rootRoute` for a full page, `settingsRoute` for a tab) and returns the routes to add; see [Extend Connect from a package](./docs/customizing/packages.md#register-routes-from-code).
92
92
 
package/RUNTIME-CONFIG.md CHANGED
@@ -49,10 +49,12 @@ Schema lives in `packages/builder-tools/connect-utils/runtime-config-schema.ts`.
49
49
 
50
50
  // Connect-only runtime values:
51
51
  "connect": {
52
- "branding": { "appName": "...", "homeBackground": "..." | null },
52
+ "branding": { "appName": "...", "icon": "..." | null, "loader": "..." | { src, animation, size } | null },
53
+ "home": { "background": "..." | { color, layers: [{ src, position, width, height, fade, ... }] } | null },
53
54
  "app": { "logLevel": "info", "basePath": "/", "offline": true },
54
55
  "renown": { "url": "...", "networkId": "eip155", "chainId": 1, "switchboardUrl": "..." | undefined, "adapters": {...} | undefined },
55
- "drives": { "allowAddDrive": true, "defaultDrives": [...], "preserveStrategy": "...", "sections": {...} },
56
+ "drives": { "allowAddDrive": true, "defaultDrives": [...], "preserveStrategy": "...", "sections": {...},
57
+ "icons": { localDrive, remoteDrive, folder, document, documents } | null },
56
58
  "packages": { "externalEnabled": true },
57
59
  "sentry": { "dsn": null, "env": "dev", "tracing": false },
58
60
  "openPanel": { "clientId": "", "apiUrl": "..." | undefined, "trackUiEvents": true, "trackOperations": true },
@@ -207,7 +209,7 @@ Each layer can supply a partial value; missing leaves fall back to the layer bel
207
209
 
208
210
  Two fields interact with the service worker and deserve a caveat:
209
211
 
210
- - **`connect.branding.favicon` is build-time only.** A file relative to the project, served by `ph connect studio` and built as `icon.ico` by `ph connect build`; the dist file leaves it out.
212
+ - **`connect.branding.favicon` is build-time only.** A file relative to the project, served by `ph connect studio` and built by `ph connect build` as `icon.ico`, `icon.svg` or `icon.png`, keeping its type; the dist file leaves it out.
211
213
  - **`connect.pwa` (the project's own block) is build-time only.** `ph connect build` merges it (together with build-time package `pwa` fragments) into the base `manifest.webmanifest` and the injectManifest `service-worker.js` — including the manifest's `icons`, `file_handlers` (the built-in `.phd`/`.phdm` OS file association plus any contributed types) and `launch_handler`. The manifest's `categories` is not authored here — it is derived from the top-level `category` field of every contributing `powerhouse.manifest.json` (project + packages), unioned. It is carried along in the dist file for transparency, but the SPA never reads the project block — editing the dist copy or injecting it via `PH_CONNECT_CONFIG_JSON` has no effect. See the Academy page "Configure the PWA" for the merge semantics.
212
214
  - **Packages installed AT RUNTIME extend the PWA config the same way build-time packages do.** The service worker serves `manifest.webmanifest` dynamically and reads its runtime-caching / navigate-fallback contributions from IndexedDB `ph-pwa` (mirrored by `BrowserPackageManager.#syncPwaFragments`), so a runtime package's manifest members, overridden scalars, `runtimeCaching` rules and `navigateFallbackDenylist` patterns all apply without a rebuild. Two guardrails vs. build-time: the manifest merge is fragment-wins **except `start_url`/`scope`** (protected, so an end-user-installed package can't re-scope the app), and `.phd`/`.phdm` stay first-registered. Timing caveats (not build-vs-runtime): `file_handlers`/`launch_handler` are captured by the OS at PWA install time (Chrome re-reads on its own periodic manifest check — never mid-session; content-based routing opens `.phd`/`.phdm` regardless), and `runtimeCaching`/`navigateFallbackDenylist` are read at worker startup (full effect on the worker's next activation). Only `globPatterns`/`globIgnores`/`maximumFileSizeToCacheInBytes` stay build-time only — they drive the workbox precache list baked at build.
213
215
  - **`connect.app.offline` is hybrid.** At build time it decides whether a precaching worker or a self-destroying one is emitted; at boot the SPA reads it to register or unregister the worker (`apps/connect/src/components/app.tsx`, default `true`). Flipping it to `false` at deploy time therefore unregisters the worker on the next load, but flipping it to `true` cannot conjure a worker the build didn't emit.
@@ -384,88 +386,7 @@ Partial sets are rejected at boot — `authConditions` requires `authGroups`, wh
384
386
  **"I want to verify what Connect will actually use without booting it."**
385
387
  `ph connect config` (no args) prints the effective `connect.*` block (defaults merged with source). `ph connect config connect.renown.url` (or the equivalent `--get connect.renown.url`) prints a single value.
386
388
 
387
- ## Adding or changing a config field (developers)
388
-
389
- A `connect.*` field has five artefacts that must stay in lockstep. The TS
390
- constants are the source of truth; the two committed `*.schema.json` files are
391
- generated from them. Miss a step and the schemas silently drift from the types.
392
-
393
- 1. **Type** — `packages/shared/clis/types.ts`. Add the field to the relevant
394
- `PHConnect*` type (e.g. `PHConnectPackages`).
395
- 2. **Default** — `packages/shared/connect/runtime-config.ts`. Add the field's
396
- default to `DEFAULT_CONNECT_CONFIG` so the SPA never sees it undefined.
397
- 3. **Schema fragment** — `packages/shared/connect/schema-fragments.ts`. Declare
398
- the field (type, description, `default`) in `phConnectRuntimeConfigSchema`.
399
- Both committed schemas import this fragment, so declaring it once keeps the
400
- source-config and runtime-config schemas in sync by construction.
401
- 4. **Rebuild** the source-of-truth packages so the emit script sees the change:
402
- ```bash
403
- pnpm --filter=@powerhousedao/shared --filter=@powerhousedao/builder-tools build
404
- ```
405
- 5. **Regenerate** the committed JSON schemas:
406
- ```bash
407
- pnpm tsx scripts/emit-schemas.ts
408
- ```
409
- This rewrites `packages/builder-tools/connect-utils/runtime-config.schema.json`
410
- and `packages/shared/clis/source-config.schema.json`. Commit both.
411
-
412
- **`connect.pwa.*` fields have a sixth artefact.** The zod `PwaConfigSchema` /
413
- `PwaManifestOverrideSchema` in `packages/shared/document-model/schemas.ts` is
414
- the validator `ph connect build` actually runs against `connect.pwa` (via
415
- `validateProjectPwaConfig`), and it is hand-maintained: `emit-schemas.ts` does
416
- not regenerate it, and the coverage test below does not cover it (there is no
417
- `pwa` default). The `z.ZodType<PHConnectPwa>` annotation only pins it to the TS
418
- type, not to the schema fragment, and does not force it to gain a newly-added
419
- optional field. So when you add a `connect.pwa.*` field, declare it there too —
420
- the objects are strict (`z.strictObject`), so a field the schema doesn't know
421
- fails the build as an unrecognized key rather than being silently dropped.
422
-
423
- Then consume it in the SPA via `getRuntimeConfig().connect?.<block>?.<field>`
424
- (or add a typed accessor in `apps/connect/src/connect.config.ts`).
425
-
426
- Optional, depending on the field:
427
-
428
- - **CLI flag** — to expose `ph connect config/build --<field>`, wire it through
429
- `packages/shared/clis/args/connect.ts` and `clis/ph-cli/src/utils/cli-connect-override.ts`
430
- (see `externalEnabled` → `--external-packages` for the pattern).
431
- - **Scaffold default** — if new projects should ship the field, add it to the
432
- `ph init` template at `packages/codegen/src/templates/boilerplate/powerhouse.config.json.ts`.
433
-
434
- The `runtime-config-schema.test.ts` coverage test asserts every key emitted from
435
- `DEFAULT_CONNECT_CONFIG` has a matching schema declaration — it fails loudly if
436
- you add a default (step 2) but skip the schema fragment (step 3).
437
-
438
- ## Reference: key files
439
-
440
- ```
441
- packages/shared/connect/
442
- ├ runtime-config.ts DEFAULT_CONNECT_CONFIG, types, buildRuntimeConfig
443
- ├ config-loader.ts ConfigLoader, ConfigAdapter, deepMerge
444
- └ json-adapter.ts JsonConfigAdapter (browser fetch | Node fs)
445
-
446
- packages/builder-tools/connect-utils/
447
- ├ runtime-config-schema.ts JSON Schema (Ajv)
448
- └ vite-plugins/ph-config.ts Emits dist file & serves /powerhouse.config.json in dev
449
-
450
- clis/ph-cli/src/
451
- ├ utils/cli-connect-override.ts buildConnectFlagPatch, wasFlagExplicitlyPassed, buildCliConnectOverride
452
- ├ utils/connect-config-validation.ts validateConnectPatch (Ajv)
453
- ├ services/connect-config.ts `ph connect config` handler
454
- ├ services/connect-studio.ts `ph connect studio` (accepts callerOverride)
455
- ├ services/vetra.ts `ph vetra` (constructs callerOverride)
456
- ├ commands/install.ts `ph install` (writes packageRegistryUrl)
457
- └ utils.ts updateConfigFile
458
-
459
- apps/connect/
460
- ├ main.tsx top-level await + dynamic import (boot race fix)
461
- └ src/runtime-config.ts loadRuntimeConfig, getRuntimeConfig
462
-
463
- packages/codegen/src/templates/boilerplate/powerhouse.config.json.ts
464
- └ `ph init` boilerplate template
465
-
466
- docker/connect-entrypoint.sh
467
- └ PH_CONNECT_CONFIG_JSON → dist overrides (jq deep-merge, operator-wins)
468
- ```
389
+ Adding or changing a `connect.*` field is work in the Powerhouse monorepo; its steps are in `apps/connect/CUSTOMIZING.md` there.
469
390
 
470
391
  ## Design principle, in one line
471
392
 
@@ -1,6 +1,6 @@
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]="fae2f3e9-2f97-5e44-b41c-b3f56cf011d8")}catch(e){}}();
3
- import { t as clearReactorStorage } from "./reactor-DLCl-WHi.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]="2ead670b-1aac-5dc5-bc95-a2c023828dd4")}catch(e){}}();
3
+ import { t as clearReactorStorage } from "./reactor-DT1kVwnf.js";
4
4
  import { useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { ConnectConfirmationModal } from "@powerhousedao/design-system/connect";
@@ -40,5 +40,5 @@ function ClearStorageModal() {
40
40
  //#endregion
41
41
  export { ClearStorageModal };
42
42
 
43
- //# sourceMappingURL=ClearStorageModal-BwGVIuLX.js.map
44
- //# debugId=fae2f3e9-2f97-5e44-b41c-b3f56cf011d8
43
+ //# sourceMappingURL=ClearStorageModal-DQv3ZGOq.js.map
44
+ //# debugId=2ead670b-1aac-5dc5-bc95-a2c023828dd4
@@ -1 +1 @@
1
- {"version":3,"file":"ClearStorageModal-BwGVIuLX.js","sources":["../src/generic/modals/ClearStorageModal.tsx"],"sourcesContent":["import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n getTargetHref,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nconst logger = childLogger([\"ClearStorage\"]);\n\nexport function ClearStorageModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"clearStorage\";\n const { t } = useTranslation();\n const [loading, setLoading] = useState(false);\n\n function clearStorage() {\n setLoading(true);\n clearReactorStorage()\n .then(() => {\n logger.info(\"Storage cleared\");\n // A router writes the URL a tick later; load home directly instead.\n window.location.assign(getTargetHref(undefined));\n })\n .catch((error) => {\n logger.error(\"Error clearing storage: @error\", error);\n setLoading(false);\n });\n }\n\n return (\n <ConnectConfirmationModal\n open={open}\n header={t(\"modals.connectSettings.clearStorage.confirmation.title\")}\n body={t(\"modals.connectSettings.clearStorage.confirmation.body\")}\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\n \"modals.connectSettings.clearStorage.confirmation.clearButton\",\n )}\n onCancel={() => closePHModal()}\n onContinue={clearStorage}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n continueDisabled={loading}\n />\n );\n}\n"],"names":["logger"],"mappings":";;;;;;;;;;AAWA,MAAMA,WAAS,YAAY,CAAC,cAAc,CAAC;AAE3C,SAAgB,oBAAoB;CAElC,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAC/B,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,SAAS,eAAe;EACtB,WAAW,IAAI;EACf,oBAAoB,CAAC,CAClB,WAAW;GACV,SAAO,KAAK,iBAAiB;GAE7B,OAAO,SAAS,OAAO,cAAc,KAAA,CAAS,CAAC;EACjD,CAAC,CAAC,CACD,OAAO,UAAU;GAChB,SAAO,MAAM,kCAAkC,KAAK;GACpD,WAAW,KAAK;EAClB,CAAC;CACL;CAEA,OACE,oBAAC,0BAAD;EACQ;EACN,QAAQ,EAAE,wDAAwD;EAClE,MAAM,EAAE,uDAAuD;EAC/D,aAAa,EAAE,eAAe;EAC9B,eAAe,EACb,8DACF;EACA,gBAAgB,aAAa;EAC7B,YAAY;EACZ,eAAe,WAAoB;GACjC,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,kBAAkB;CACnB,CAAA;AAEL","debug_id":"fae2f3e9-2f97-5e44-b41c-b3f56cf011d8"}
1
+ {"version":3,"file":"ClearStorageModal-DQv3ZGOq.js","sources":["../src/generic/modals/ClearStorageModal.tsx"],"sourcesContent":["import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n getTargetHref,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nconst logger = childLogger([\"ClearStorage\"]);\n\nexport function ClearStorageModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"clearStorage\";\n const { t } = useTranslation();\n const [loading, setLoading] = useState(false);\n\n function clearStorage() {\n setLoading(true);\n clearReactorStorage()\n .then(() => {\n logger.info(\"Storage cleared\");\n // A router writes the URL a tick later; load home directly instead.\n window.location.assign(getTargetHref(undefined));\n })\n .catch((error) => {\n logger.error(\"Error clearing storage: @error\", error);\n setLoading(false);\n });\n }\n\n return (\n <ConnectConfirmationModal\n open={open}\n header={t(\"modals.connectSettings.clearStorage.confirmation.title\")}\n body={t(\"modals.connectSettings.clearStorage.confirmation.body\")}\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\n \"modals.connectSettings.clearStorage.confirmation.clearButton\",\n )}\n onCancel={() => closePHModal()}\n onContinue={clearStorage}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n continueDisabled={loading}\n />\n );\n}\n"],"names":["logger"],"mappings":";;;;;;;;;;AAWA,MAAMA,WAAS,YAAY,CAAC,cAAc,CAAC;AAE3C,SAAgB,oBAAoB;CAElC,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAC/B,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,SAAS,eAAe;EACtB,WAAW,IAAI;EACf,oBAAoB,CAAC,CAClB,WAAW;GACV,SAAO,KAAK,iBAAiB;GAE7B,OAAO,SAAS,OAAO,cAAc,KAAA,CAAS,CAAC;EACjD,CAAC,CAAC,CACD,OAAO,UAAU;GAChB,SAAO,MAAM,kCAAkC,KAAK;GACpD,WAAW,KAAK;EAClB,CAAC;CACL;CAEA,OACE,oBAAC,0BAAD;EACQ;EACN,QAAQ,EAAE,wDAAwD;EAClE,MAAM,EAAE,uDAAuD;EAC/D,aAAa,EAAE,eAAe;EAC9B,eAAe,EACb,8DACF;EACA,gBAAgB,aAAa;EAC7B,YAAY;EACZ,eAAe,WAAoB;GACjC,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,kBAAkB;CACnB,CAAA;AAEL","debug_id":"2ead670b-1aac-5dc5-bc95-a2c023828dd4"}
@@ -1,9 +1,9 @@
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]="80191016-ed64-5a35-8eb6-56700d13ea19")}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]="d274e850-e717-57cf-8c39-7dac81302dab")}catch(e){}}();
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { useDriveRouteData } from "@powerhousedao/connect-core/router";
4
+ import { useCreateDocumentTarget, useDriveRouteData } from "@powerhousedao/connect-core/router";
5
5
  import { CreateDocumentModal as CreateDocumentModal$1 } from "@powerhousedao/design-system/connect";
6
- import { addDocument, closePHModal, setSelectedNode, useDocumentModelModuleById, useNodeParentFolderById, usePHModal } from "@powerhousedao/reactor-browser";
6
+ import { addDocument, closePHModal, getDriveName, getNodeTarget, openTarget, showPHModal, useDocumentModelModuleById, useNodeParentFolderById, usePHModal } from "@powerhousedao/reactor-browser";
7
7
  //#region src/generic/modals/CreateDocumentModal.tsx
8
8
  const CreateDocumentModal = () => {
9
9
  const phModal = usePHModal();
@@ -11,16 +11,25 @@ const CreateDocumentModal = () => {
11
11
  const documentType = open ? phModal.documentType : void 0;
12
12
  const documentModelVersion = open ? phModal.documentModelVersion : void 0;
13
13
  const documentModel = useDocumentModelModuleById(documentType, documentModelVersion);
14
- const { drive, folder, documentId } = useDriveRouteData();
14
+ const target = useCreateDocumentTarget(open ? phModal.driveId : void 0);
15
+ const { folder, documentId } = useDriveRouteData();
15
16
  const parentFolder = useNodeParentFolderById(documentId);
16
17
  const onCreateDocument = async (documentName) => {
17
- closePHModal();
18
+ const { drive } = target;
18
19
  if (!drive || !documentModel) return;
19
- const node = await addDocument(drive.header.id, documentName || `New ${documentModel.documentModel.global.name}`, documentModel.documentModel.global.id, folder?.id ?? parentFolder?.id, void 0, void 0, void 0, documentModelVersion);
20
- setSelectedNode(node);
20
+ closePHModal();
21
+ const node = await addDocument(drive.header.id, documentName || `New ${documentModel.documentModel.global.name}`, documentModel.documentModel.global.id, target.isOpenDrive ? folder?.id ?? parentFolder?.id : void 0, void 0, void 0, void 0, documentModelVersion);
22
+ openTarget(getNodeTarget(node, drive));
21
23
  };
22
24
  return /* @__PURE__ */ jsx(CreateDocumentModal$1, {
23
25
  open,
26
+ drives: target.choices?.map((drive) => ({
27
+ id: drive.header.id,
28
+ name: getDriveName(drive)
29
+ })),
30
+ driveId: target.drive?.header.id,
31
+ onDriveChange: target.pick,
32
+ onAddDrive: () => showPHModal({ type: "addDrive" }),
24
33
  onContinue: (documentName) => {
25
34
  onCreateDocument(documentName);
26
35
  },
@@ -32,5 +41,5 @@ const CreateDocumentModal = () => {
32
41
  //#endregion
33
42
  export { CreateDocumentModal };
34
43
 
35
- //# sourceMappingURL=CreateDocumentModal-B-cXzeOA.js.map
36
- //# debugId=80191016-ed64-5a35-8eb6-56700d13ea19
44
+ //# sourceMappingURL=CreateDocumentModal-CiIW3pzx.js.map
45
+ //# debugId=d274e850-e717-57cf-8c39-7dac81302dab
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateDocumentModal-CiIW3pzx.js","sources":["../src/generic/modals/CreateDocumentModal.tsx"],"sourcesContent":["import { CreateDocumentModal as ConnectCreateDocumentModal } from \"@powerhousedao/design-system/connect\";\nimport {\n addDocument,\n closePHModal,\n getDriveName,\n getNodeTarget,\n openTarget,\n showPHModal,\n useDocumentModelModuleById,\n useNodeParentFolderById,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n useCreateDocumentTarget,\n useDriveRouteData,\n} from \"@powerhousedao/connect-core/router\";\n\nexport const CreateDocumentModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"createDocument\";\n const documentType = open ? phModal.documentType : undefined;\n const documentModelVersion = open ? phModal.documentModelVersion : undefined;\n const documentModel = useDocumentModelModuleById(\n documentType,\n documentModelVersion,\n );\n // The modal's drive, else the open one, else one picked in the modal.\n const target = useCreateDocumentTarget(open ? phModal.driveId : undefined);\n // In the open folder, else beside the open document.\n const { folder, documentId } = useDriveRouteData();\n const parentFolder = useNodeParentFolderById(documentId);\n\n const onCreateDocument = async (documentName: string) => {\n const { drive } = target;\n if (!drive || !documentModel) return;\n closePHModal();\n\n const node = await addDocument(\n drive.header.id,\n documentName || `New ${documentModel.documentModel.global.name}`,\n documentModel.documentModel.global.id,\n target.isOpenDrive ? (folder?.id ?? parentFolder?.id) : undefined,\n undefined,\n undefined,\n undefined,\n documentModelVersion,\n );\n // Opens it in its drive, wherever the modal was opened.\n openTarget(getNodeTarget(node, drive));\n };\n\n return (\n <ConnectCreateDocumentModal\n open={open}\n drives={target.choices?.map((drive) => ({\n id: drive.header.id,\n name: getDriveName(drive),\n }))}\n driveId={target.drive?.header.id}\n onDriveChange={target.pick}\n onAddDrive={() => showPHModal({ type: \"addDrive\" })}\n onContinue={(documentName) => {\n void onCreateDocument(documentName);\n }}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n />\n );\n};\n"],"names":["ConnectCreateDocumentModal"],"mappings":";;;;;;;AAiBA,MAAa,4BAAsC;CACjD,MAAM,UAAU,WAAW;CAC3B,MAAM,OAAO,SAAS,SAAS;CAC/B,MAAM,eAAe,OAAO,QAAQ,eAAe,KAAA;CACnD,MAAM,uBAAuB,OAAO,QAAQ,uBAAuB,KAAA;CACnE,MAAM,gBAAgB,2BACpB,cACA,oBACF;CAEA,MAAM,SAAS,wBAAwB,OAAO,QAAQ,UAAU,KAAA,CAAS;CAEzE,MAAM,EAAE,QAAQ,eAAe,kBAAkB;CACjD,MAAM,eAAe,wBAAwB,UAAU;CAEvD,MAAM,mBAAmB,OAAO,iBAAyB;EACvD,MAAM,EAAE,UAAU;EAClB,IAAI,CAAC,SAAS,CAAC,eAAe;EAC9B,aAAa;EAEb,MAAM,OAAO,MAAM,YACjB,MAAM,OAAO,IACb,gBAAgB,OAAO,cAAc,cAAc,OAAO,QAC1D,cAAc,cAAc,OAAO,IACnC,OAAO,cAAe,QAAQ,MAAM,cAAc,KAAM,KAAA,GACxD,KAAA,GACA,KAAA,GACA,KAAA,GACA,oBACF;EAEA,WAAW,cAAc,MAAM,KAAK,CAAC;CACvC;CAEA,OACE,oBAACA,uBAAD;EACQ;EACN,QAAQ,OAAO,SAAS,KAAK,WAAW;GACtC,IAAI,MAAM,OAAO;GACjB,MAAM,aAAa,KAAK;EAC1B,EAAE;EACF,SAAS,OAAO,OAAO,OAAO;EAC9B,eAAe,OAAO;EACtB,kBAAkB,YAAY,EAAE,MAAM,WAAW,CAAC;EAClD,aAAa,iBAAiB;GAC5B,iBAAsB,YAAY;EACpC;EACA,eAAe,WAAoB;GACjC,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;CACD,CAAA;AAEL","debug_id":"d274e850-e717-57cf-8c39-7dac81302dab"}
@@ -1,8 +1,8 @@
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]="b20786e7-ee1b-552d-be24-e372ed1401a0")}catch(e){}}();
3
- import { r as connectConfig } from "./connect.config-D1pGNmaF.js";
4
- import { n as getGitSha, o as shortGitSha, r as getGitUrl } from "./build-info-TgBEqTq1.js";
5
- import { n as serviceWorkerManager } from "./registerServiceWorker-APlHkrmH.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]="129e10e3-2cd9-5fec-a887-c683242e21f1")}catch(e){}}();
3
+ import { r as connectConfig } from "./connect.config-DL9nKtlW.js";
4
+ import { n as getGitSha, o as shortGitSha, r as getGitUrl } from "./build-info-CZ8K52c5.js";
5
+ import { n as serviceWorkerManager } from "./registerServiceWorker-X6fT91iL.js";
6
6
  import { useEffect, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Combobox, FormInput } from "@powerhousedao/design-system/connect";
@@ -168,5 +168,5 @@ const DebugSettingsModal = () => {
168
168
  //#endregion
169
169
  export { DebugSettingsModal };
170
170
 
171
- //# sourceMappingURL=DebugSettingsModal-DfOnR4iY.js.map
172
- //# debugId=b20786e7-ee1b-552d-be24-e372ed1401a0
171
+ //# sourceMappingURL=DebugSettingsModal-DjFwGop2.js.map
172
+ //# debugId=129e10e3-2cd9-5fec-a887-c683242e21f1
@@ -1 +1 @@
1
- {"version":3,"file":"DebugSettingsModal-DfOnR4iY.js","sources":["../src/generic/modals/DebugSettingsModal.tsx"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport {\n getGitSha,\n getGitUrl,\n serviceWorkerManager,\n shortGitSha,\n} from \"@powerhousedao/connect/utils\";\nimport { Icon, Modal, PowerhouseButton } from \"@powerhousedao/design-system\";\nimport { Combobox, FormInput } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useEffect, useState } from \"react\";\n\nexport const DebugSettingsModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"debugSettings\";\n\n const [appVersion, setAppVersion] = useState(connectConfig.appVersion);\n const [serviceWorkerDebugMode, setServiceWorkerDebugMode] = useState({\n label: serviceWorkerManager.debug ? \"Enabled\" : \"Disabled\",\n value: serviceWorkerManager.debug,\n });\n\n useEffect(() => {\n serviceWorkerManager.setDebug(serviceWorkerDebugMode.value);\n }, [serviceWorkerDebugMode]);\n\n return (\n <Modal\n open={open}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n contentProps={{\n className: \"rounded-2xl\",\n }}\n >\n <div className=\"w-[700px] rounded-2xl bg-background p-6\">\n <div className=\"mb-6 flex justify-between\">\n <div className=\"text-xl font-bold\">Debug Tools</div>\n <button id=\"close-modal\" onClick={() => closePHModal()}>\n <Icon name=\"Xmark\" size={28} />\n </button>\n </div>\n <div className=\"flex text-sm font-bold\">\n <Icon name=\"Ring\" size={22} />\n <span className=\"ml-2\">App Version: {connectConfig.appVersion}</span>\n {(() => {\n const sha = getGitSha();\n if (sha === \"unknown\") return null;\n const url = getGitUrl();\n const label = shortGitSha(sha);\n return url ? (\n <a\n className=\"ml-2 font-mono text-xs font-normal text-info hover:underline\"\n href={url}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n title={sha}\n >\n ({label})\n </a>\n ) : (\n <span\n className=\"ml-2 font-mono text-xs font-normal text-muted-foreground\"\n title={sha}\n >\n ({label})\n </span>\n );\n })()}\n </div>\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Hdd\" size={22} />\n <span className=\"ml-2\">Drive Tools:</span>\n </div>\n\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Gear\" size={22} />\n <span className=\"ml-2\">Service Worker Tools:</span>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"serviceWorkerDebugMode\" className=\"text-xs\">\n Service Worker Debug Mode:\n </label>\n <Combobox\n id=\"serviceWorkerDebugMode\"\n onChange={(value) => {\n setServiceWorkerDebugMode(\n value as typeof serviceWorkerDebugMode,\n );\n }}\n value={serviceWorkerDebugMode}\n options={[\n { label: \"Enabled\", value: true },\n { label: \"Disabled\", value: false },\n ]}\n />\n </div>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"appVersion\" className=\"text-xs\">\n Set invalid app version:\n </label>\n <FormInput\n containerClassName=\"rounded-md border border-border bg-background p-1 text-sm\"\n inputClassName=\"text-xs font-normal\"\n id=\"appVersion\"\n icon={\n <div className=\"flex h-full items-center text-xs\">Version:</div>\n }\n value={appVersion}\n onChange={(element) => setAppVersion(element.target.value)}\n />\n </div>\n <div className=\"mb-1 flex items-center justify-center\">\n <PowerhouseButton\n color={appVersion === \"\" ? \"light\" : \"red\"}\n size=\"small\"\n disabled={appVersion === \"\"}\n onClick={() => {\n serviceWorkerManager.sendMessage({\n type: \"SET_APP_VERSION\",\n version: appVersion,\n });\n setAppVersion(\"\");\n }}\n >\n Add Invalid App Version\n </PowerhouseButton>\n </div>\n </div>\n </div>\n </Modal>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAYA,MAAa,2BAAqC;CAEhD,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAE/B,MAAM,CAAC,YAAY,iBAAiB,SAAS,cAAc,UAAU;CACrE,MAAM,CAAC,wBAAwB,6BAA6B,SAAS;EACnE,OAAO,qBAAqB,QAAQ,YAAY;EAChD,OAAO,qBAAqB;CAC9B,CAAC;CAED,gBAAgB;EACd,qBAAqB,SAAS,uBAAuB,KAAK;CAC5D,GAAG,CAAC,sBAAsB,CAAC;CAE3B,OACE,oBAAC,OAAD;EACQ;EACN,eAAe,WAAW;GACxB,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,cAAc,EACZ,WAAW,cACb;EAEA,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,OAAD;MAAK,WAAU;MAAoB,UAAA;KAAgB,CAAA,GACnD,oBAAC,UAAD;MAAQ,IAAG;MAAc,eAAe,aAAa;MACnD,UAAA,oBAAC,MAAD;OAAM,MAAK;OAAQ,MAAM;MAAK,CAAA;KACxB,CAAA,CACL;;IACL,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,oBAAC,MAAD;OAAM,MAAK;OAAO,MAAM;MAAK,CAAA;MAC7B,qBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA,CAAuB,iBAAc,cAAc,UAAiB;;aAC5D;OACN,MAAM,MAAM,UAAU;OACtB,IAAI,QAAQ,WAAW,OAAO;OAC9B,MAAM,MAAM,UAAU;OACtB,MAAM,QAAQ,YAAY,GAAG;OAC7B,OAAO,MACL,qBAAC,KAAD;QACE,WAAU;QACV,MAAM;QACN,QAAO;QACP,KAAI;QACJ,OAAO;QALT,UAAA;SAMC;SACG;SAAM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K;OACL,UAAU,eAAe;OACzB,eAAe;QACb,qBAAqB,YAAY;SAC/B,MAAM;SACN,SAAS;QACX,CAAC;QACD,cAAc,EAAE;OAClB;OACD,UAAA;MAEiB,CAAA;KACf,CAAA,CACF;;GACF;;CACA,CAAA;AAEX","debug_id":"b20786e7-ee1b-552d-be24-e372ed1401a0"}
1
+ {"version":3,"file":"DebugSettingsModal-DjFwGop2.js","sources":["../src/generic/modals/DebugSettingsModal.tsx"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport {\n getGitSha,\n getGitUrl,\n serviceWorkerManager,\n shortGitSha,\n} from \"@powerhousedao/connect/utils\";\nimport { Icon, Modal, PowerhouseButton } from \"@powerhousedao/design-system\";\nimport { Combobox, FormInput } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useEffect, useState } from \"react\";\n\nexport const DebugSettingsModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"debugSettings\";\n\n const [appVersion, setAppVersion] = useState(connectConfig.appVersion);\n const [serviceWorkerDebugMode, setServiceWorkerDebugMode] = useState({\n label: serviceWorkerManager.debug ? \"Enabled\" : \"Disabled\",\n value: serviceWorkerManager.debug,\n });\n\n useEffect(() => {\n serviceWorkerManager.setDebug(serviceWorkerDebugMode.value);\n }, [serviceWorkerDebugMode]);\n\n return (\n <Modal\n open={open}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n contentProps={{\n className: \"rounded-2xl\",\n }}\n >\n <div className=\"w-[700px] rounded-2xl bg-background p-6\">\n <div className=\"mb-6 flex justify-between\">\n <div className=\"text-xl font-bold\">Debug Tools</div>\n <button id=\"close-modal\" onClick={() => closePHModal()}>\n <Icon name=\"Xmark\" size={28} />\n </button>\n </div>\n <div className=\"flex text-sm font-bold\">\n <Icon name=\"Ring\" size={22} />\n <span className=\"ml-2\">App Version: {connectConfig.appVersion}</span>\n {(() => {\n const sha = getGitSha();\n if (sha === \"unknown\") return null;\n const url = getGitUrl();\n const label = shortGitSha(sha);\n return url ? (\n <a\n className=\"ml-2 font-mono text-xs font-normal text-info hover:underline\"\n href={url}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n title={sha}\n >\n ({label})\n </a>\n ) : (\n <span\n className=\"ml-2 font-mono text-xs font-normal text-muted-foreground\"\n title={sha}\n >\n ({label})\n </span>\n );\n })()}\n </div>\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Hdd\" size={22} />\n <span className=\"ml-2\">Drive Tools:</span>\n </div>\n\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Gear\" size={22} />\n <span className=\"ml-2\">Service Worker Tools:</span>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"serviceWorkerDebugMode\" className=\"text-xs\">\n Service Worker Debug Mode:\n </label>\n <Combobox\n id=\"serviceWorkerDebugMode\"\n onChange={(value) => {\n setServiceWorkerDebugMode(\n value as typeof serviceWorkerDebugMode,\n );\n }}\n value={serviceWorkerDebugMode}\n options={[\n { label: \"Enabled\", value: true },\n { label: \"Disabled\", value: false },\n ]}\n />\n </div>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"appVersion\" className=\"text-xs\">\n Set invalid app version:\n </label>\n <FormInput\n containerClassName=\"rounded-md border border-border bg-background p-1 text-sm\"\n inputClassName=\"text-xs font-normal\"\n id=\"appVersion\"\n icon={\n <div className=\"flex h-full items-center text-xs\">Version:</div>\n }\n value={appVersion}\n onChange={(element) => setAppVersion(element.target.value)}\n />\n </div>\n <div className=\"mb-1 flex items-center justify-center\">\n <PowerhouseButton\n color={appVersion === \"\" ? \"light\" : \"red\"}\n size=\"small\"\n disabled={appVersion === \"\"}\n onClick={() => {\n serviceWorkerManager.sendMessage({\n type: \"SET_APP_VERSION\",\n version: appVersion,\n });\n setAppVersion(\"\");\n }}\n >\n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B,YAAY;SAC/B,MAAM;SACN,SAAS;QACX,CAAC;QACD,cAAc,EAAE;OAClB;OACD,UAAA;MAEiB,CAAA;KACf,CAAA,CACF;;GACF;;CACA,CAAA;AAEX","debug_id":"129e10e3-2cd9-5fec-a887-c683242e21f1"}
@@ -1,9 +1,9 @@
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]="163b178c-5977-5c0b-adbf-85aa33f07edd")}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]="51b69dc8-390e-5e2c-a8eb-b3caf96f0110")}catch(e){}}();
3
3
  import { a as resolvePgMajorForRuntime, i as loadPgDump } from "./pglite-major-p4_YefAE.js";
4
- import { f as subscribeReactorPgMajor, l as getCachedReactorPgMajor } from "./connection-state-B6fleM37.js";
5
- import { t as PENDING_PG_SEED_KEY } from "./pglite-seed-eGzXMld2.js";
6
- import { t as clearReactorStorage } from "./reactor-DLCl-WHi.js";
4
+ import { f as subscribeReactorPgMajor, l as getCachedReactorPgMajor } from "./connection-state-Bwm9Agwy.js";
5
+ import { t as PENDING_PG_SEED_KEY } from "./pglite-seed-QPbGbLB_.js";
6
+ import { t as clearReactorStorage } from "./reactor-DT1kVwnf.js";
7
7
  import { useCallback, useMemo, useState, useSyncExternalStore } from "react";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  import { InspectorModal as InspectorModal$1 } from "@powerhousedao/design-system/connect";
@@ -461,5 +461,5 @@ const InspectorModal = () => {
461
461
  //#endregion
462
462
  export { InspectorModal };
463
463
 
464
- //# sourceMappingURL=InspectorModal-BVqRNFfP.js.map
465
- //# debugId=163b178c-5977-5c0b-adbf-85aa33f07edd
464
+ //# sourceMappingURL=InspectorModal-C1ZVZpT5.js.map
465
+ //# debugId=51b69dc8-390e-5e2c-a8eb-b3caf96f0110
@@ -1 +1 @@
1
- {"version":3,"file":"InspectorModal-BVqRNFfP.js","sources":["../src/generic/modals/InspectorModal/useCatchUpInspector.ts","../src/generic/modals/InspectorModal/useDbExplorer.ts","../src/generic/modals/InspectorModal/useDebugInspector.ts","../src/generic/modals/InspectorModal/useIntegrityInspector.ts","../src/generic/modals/InspectorModal/useProcessorsInspector.ts","../src/generic/modals/InspectorModal/useQueueInspector.ts","../src/generic/modals/InspectorModal/useRemotesInspector.ts","../src/generic/modals/InspectorModal/useWorkerInspector.ts","../src/generic/modals/InspectorModal/InspectorModal.tsx"],"sourcesContent":["import type {\n CatchUpInspectorProps,\n CatchUpStatus,\n} from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useState } from \"react\";\n\nexport function useCatchUpInspector(): CatchUpInspectorProps | undefined {\n const module = useReactorClientModule();\n const catchUp =\n module?.kind === \"browser\" ? module.reactorModule?.catchUp : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n const [status, setStatus] = useState<CatchUpStatus | undefined>();\n\n const onRefresh = useCallback(async (): Promise<void> => {\n if (inspector) {\n setStatus((await inspector.getCatchUpStatus()) as CatchUpStatus);\n return;\n }\n if (catchUp) {\n setStatus(catchUp.status());\n }\n }, [catchUp, inspector]);\n\n const onSweepNow = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.sweepCatchUp();\n return;\n }\n if (catchUp) {\n await catchUp.sweepNow();\n }\n }, [catchUp, inspector]);\n\n if (!catchUp && !inspector) {\n return undefined;\n }\n\n return {\n status,\n onRefresh,\n onSweepNow,\n };\n}\n","import type { PGlite } from \"@electric-sql/pglite\";\nimport {\n getCachedReactorPgMajor,\n loadPgDump,\n resolvePgMajorForRuntime,\n} from \"@powerhousedao/connect/utils\";\nimport type {\n FilterGroup,\n SortOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport type { Database } from \"@powerhousedao/reactor\";\nimport {\n REACTOR_SCHEMA,\n useDatabase,\n usePGlite,\n useReactorClientModule,\n type IQueue,\n} from \"@powerhousedao/reactor-browser\";\nimport type { IInspectorProxy } from \"@powerhousedao/reactor-browser/rpc\";\nimport { Kysely, sql } from \"kysely\";\nimport { PGliteDialect } from \"kysely-pglite-dialect\";\nimport { useCallback, useMemo } from \"react\";\n\nasync function quiesceQueue(queue: IQueue): Promise<void> {\n await new Promise<void>((resolve) => queue.block(() => resolve()));\n}\n\n// The reactor runs with `relaxedDurability: true`, which makes PGlite's\n// `syncToFs()` fire the IDBFS→IndexedDB write and return without awaiting\n// Emscripten's syncfs callback. `close()` also doesn't flush. Calling\n// `FS.syncfs(false, cb)` directly gives us a callback that fires from the\n// IDBFS transaction's `oncomplete` — i.e. after IDB has actually committed.\nasync function syncPgliteToIdb(pglite: {\n readonly Module: {\n readonly FS: {\n syncfs(populate: boolean, cb: (err: Error | null) => void): void;\n };\n };\n}): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n pglite.Module.FS.syncfs(false, (err) => (err ? reject(err) : resolve()));\n });\n}\n\ntype ColumnInfo = {\n readonly name: string;\n readonly dataType: string;\n readonly isNullable: boolean;\n};\n\ntype TableInfo = {\n readonly name: string;\n readonly columns: ColumnInfo[];\n};\n\ntype ColumnRow = {\n table_name: string;\n column_name: string;\n data_type: string;\n is_nullable: string;\n};\n\ntype GetTableRowsOptions = {\n readonly schema?: string;\n readonly limit: number;\n readonly offset: number;\n readonly sort?: SortOptions;\n readonly filters?: FilterGroup;\n};\n\ntype TablePage = {\n readonly columns: string[];\n readonly rows: Record<string, unknown>[];\n readonly total: number | null;\n};\n\nconst PRIORITY_COLUMNS = [\n \"documentType\",\n \"documentId\",\n \"scope\",\n \"branch\",\n \"index\",\n \"skip\",\n] as const;\n\ntype ReactorPgliteAdapter = {\n query: (\n sql: string,\n params?: unknown[],\n ) => Promise<{ rows: unknown[]; affectedRows?: number }>;\n};\n\nfunction createWorkerReactorDatabase(\n inspector: IInspectorProxy,\n): Kysely<Database> {\n const adapter: ReactorPgliteAdapter = {\n query: async (statement, params) => ({\n rows: (await inspector.queryReactorDb(statement, params)) as unknown[],\n }),\n };\n return new Kysely<Database>({\n dialect: new PGliteDialect(adapter as unknown as PGlite),\n });\n}\n\nexport function useDbExplorer() {\n const browserDatabase = useDatabase();\n const pglite = usePGlite();\n const module = useReactorClientModule();\n const reactorClientModule = module?.kind === \"browser\" ? module : undefined;\n const reactor = reactorClientModule?.reactorModule?.reactor;\n const queue = reactorClientModule?.reactorModule?.queue;\n const workerModule = module?.kind === \"worker\" ? module : undefined;\n const workerDatabase = useMemo(\n () =>\n workerModule\n ? createWorkerReactorDatabase(workerModule.inspector)\n : undefined,\n [workerModule],\n );\n const database = browserDatabase ?? workerDatabase;\n\n const getTables = useCallback(async (): Promise<TableInfo[]> => {\n if (!database) return [];\n\n const result = await sql<ColumnRow>`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\n const tableMap = new Map<string, ColumnInfo[]>();\n for (const row of result.rows) {\n if (!tableMap.has(row.table_name)) {\n tableMap.set(row.table_name, []);\n }\n tableMap.get(row.table_name)!.push({\n name: row.column_name,\n dataType: row.data_type,\n isNullable: row.is_nullable === \"YES\",\n });\n }\n\n return Array.from(tableMap).map(([name, columns]) => {\n const columnNames = columns.map((col) => col.name);\n const orderedColumns = [\n ...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map(\n (col) => columns.find((c) => c.name === col)!,\n ),\n ...columns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col.name as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n return {\n name,\n columns: orderedColumns,\n };\n });\n }, [database]);\n\n const getTableRows = useCallback(\n async (table: string, options: GetTableRowsOptions): Promise<TablePage> => {\n if (!database) {\n return { columns: [], rows: [], total: null };\n }\n\n const limit = options.limit;\n const offset = options.offset;\n const sort = options.sort;\n const filters = options.filters;\n const tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\n // Build WHERE clause from filters\n let whereClause = sql``;\n if (filters?.clauses && filters.clauses.length > 0) {\n const conditions: ReturnType<typeof sql>[] = [];\n\n for (let i = 0; i < filters.clauses.length; i++) {\n const clause = filters.clauses[i];\n if (!clause) continue;\n\n const columnRef = sql.raw(`\"${clause.column}\"`);\n\n let condition: ReturnType<typeof sql>;\n\n if (clause.operator === \"IS NULL\") {\n condition = sql`${columnRef} IS NULL`;\n } else if (clause.operator === \"IS NOT NULL\") {\n condition = sql`${columnRef} IS NOT NULL`;\n } else if (\n clause.operator === \"LIKE\" ||\n clause.operator === \"ILIKE\"\n ) {\n const value = clause.value;\n const operator =\n clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n condition = sql`${columnRef} ${operator} ${value}`;\n } else {\n // For =, !=, >, <, >=, <=\n const operator = sql.raw(clause.operator);\n const value = clause.value;\n\n // Try to parse as number if it looks like a number\n let parsedValue: string | number = value;\n if (value !== \"\" && !isNaN(Number(value)) && value.trim() !== \"\") {\n parsedValue = Number(value);\n }\n\n condition = sql`${columnRef} ${operator} ${parsedValue}`;\n }\n\n conditions.push(condition);\n\n // Add connector if not the last clause\n if (i < filters.clauses.length - 1) {\n const connector = filters.connectors?.[i] ?? \"AND\";\n conditions.push(sql.raw(connector));\n }\n }\n\n // Combine all conditions\n if (conditions.length > 0) {\n whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n }\n }\n\n // Build main query\n let query;\n if (sort) {\n const columnRef = sql.raw(`\"${sort.column}\"`);\n const direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n } else {\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n }\n\n const result = await query.execute(database);\n\n // Build count query with same filters\n const countQuery = sql<{ count: string }>`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `;\n const countResult = await countQuery.execute(database);\n const total = countResult.rows[0]\n ? parseInt(countResult.rows[0].count, 10)\n : null;\n\n const rawColumns =\n result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n const columns = [\n ...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)),\n ...rawColumns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n\n return {\n columns,\n rows: result.rows,\n total,\n };\n },\n [database],\n );\n\n const onExportDb = useCallback(async () => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n try {\n const major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n const pgDump = await loadPgDump(major);\n const dump = await pgDump({ pg: pglite });\n const sqlContent = await dump.text();\n\n const blob = new Blob([sqlContent], { type: \"text/sql\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = `database-export-${Date.now()}.sql`;\n a.click();\n URL.revokeObjectURL(url);\n } finally {\n queue?.unblock();\n }\n }, [pglite, queue]);\n\n const onImportDb = useCallback(\n async (sqlContent: string) => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n if (reactor) {\n const status = reactor.kill();\n await status.completed;\n }\n\n // drop every user-created schema before restoring\n await pglite.transaction(async (tx) => {\n const schemas = await tx.query<{ nspname: string }>(\n `SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`,\n );\n for (const { nspname } of schemas.rows) {\n await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n }\n try {\n await tx.exec(\"SET standard_conforming_strings = off;\");\n } catch {\n // PG17 still accepts this but log if it ever fails.\n }\n await tx.exec(sqlContent);\n await tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n });\n\n // flush IDBFS → IndexedDB synchronously\n await syncPgliteToIdb(pglite);\n\n window.location.reload();\n\n // reload() is asynchronous; without blocking here the DBExplorer caller\n // would continue and call loadTables() against an in-flight shutdown.\n await new Promise(() => {});\n },\n [pglite, queue, reactor],\n );\n\n const getDefaultSort = useCallback(\n (table: string): SortOptions | undefined => {\n if (table === \"Operation\") {\n return { column: \"timestampUtcMs\", direction: \"desc\" };\n }\n return undefined;\n },\n [],\n );\n\n const canModifyDb = !!pglite;\n\n return {\n getTables,\n getTableRows,\n getDefaultSort,\n onExportDb: canModifyDb ? onExportDb : undefined,\n onImportDb: canModifyDb ? onImportDb : undefined,\n };\n}\n","import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport {\n getCachedReactorPgMajor,\n PENDING_PG_SEED_KEY,\n subscribeReactorPgMajor,\n} from \"@powerhousedao/connect/utils\";\nimport { useCallback, useSyncExternalStore } from \"react\";\n\nconst SUPPORTED_PG_VERSIONS = [16, 17] as const;\n\nexport function useDebugInspector() {\n const currentPgVersion = useSyncExternalStore(\n subscribeReactorPgMajor,\n getCachedReactorPgMajor,\n () => undefined,\n );\n\n const onResetToPgVersion = useCallback(async (major: number) => {\n console.info(`[debug-inspector] Reset requested: PG${major}`);\n try {\n localStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n console.info(`[debug-inspector] Clearing reactor storage...`);\n await clearReactorStorage();\n console.info(`[debug-inspector] Storage cleared. Reloading...`);\n window.location.reload();\n } catch (err) {\n console.error(\"[debug-inspector] Reset failed:\", err);\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n throw err;\n }\n }, []);\n\n return {\n supportedPgVersions: SUPPORTED_PG_VERSIONS,\n currentPgVersion: currentPgVersion ?? null,\n onResetToPgVersion,\n };\n}\n","import type { IntegrityInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport {\n DocumentIntegrityService,\n useReactorClientModule,\n type RebuildResult,\n type ValidationResult,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useIntegrityInspector(): IntegrityInspectorProps | undefined {\n const module = useReactorClientModule();\n const reactorModule =\n module?.kind === \"browser\" ? module.reactorModule : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n\n const service = useMemo(() => {\n if (!reactorModule) return undefined;\n\n return new DocumentIntegrityService(\n reactorModule.keyframeStore,\n reactorModule.operationStore,\n reactorModule.writeCache,\n reactorModule.documentView,\n reactorModule.documentModelRegistry,\n );\n }, [reactorModule]);\n\n const onValidate = useCallback(\n async (documentId: string, branch?: string): Promise<ValidationResult> => {\n if (inspector) {\n return (await inspector.validateDocument(\n documentId,\n branch,\n )) as ValidationResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.validateDocument(documentId, branch);\n },\n [service, inspector],\n );\n\n const onRebuildKeyframes = useCallback(\n async (documentId: string, branch?: string): Promise<RebuildResult> => {\n if (inspector) {\n return (await inspector.rebuildKeyframes(\n documentId,\n branch,\n )) as RebuildResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildKeyframes(documentId, branch);\n },\n [service, inspector],\n );\n\n const onRebuildSnapshots = useCallback(\n async (documentId: string, branch?: string): Promise<RebuildResult> => {\n if (inspector) {\n return (await inspector.rebuildSnapshots(\n documentId,\n branch,\n )) as RebuildResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildSnapshots(documentId, branch);\n },\n [service, inspector],\n );\n\n if (!service && !inspector) {\n return undefined;\n }\n\n return {\n onValidate,\n onRebuildKeyframes,\n onRebuildSnapshots,\n };\n}\n","import type {\n ProcessorInfo,\n ProcessorsInspectorProps,\n} from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useProcessorsInspector(): ProcessorsInspectorProps | undefined {\n const module = useReactorClientModule();\n const processorManager =\n module?.kind === \"browser\"\n ? module.reactorModule?.processorManager\n : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n\n const available = useMemo(\n () => processorManager != null || inspector != null,\n [processorManager, inspector],\n );\n\n const getProcessors = useCallback((): Promise<ProcessorInfo[]> => {\n if (inspector) {\n return inspector.getProcessors() as Promise<ProcessorInfo[]>;\n }\n if (!processorManager) {\n return Promise.resolve([]);\n }\n return Promise.resolve(\n processorManager.getAll().map((tracked) => ({\n processorId: tracked.processorId,\n factoryId: tracked.factoryId,\n driveId: tracked.driveId,\n processorIndex: tracked.processorIndex,\n lastOrdinal: tracked.lastOrdinal,\n status: tracked.status,\n lastError: tracked.lastError,\n lastErrorTimestamp: tracked.lastErrorTimestamp,\n })),\n );\n }, [processorManager, inspector]);\n\n const onRetry = useCallback(\n async (processorId: string) => {\n if (inspector) {\n await inspector.retryProcessor(processorId);\n return;\n }\n if (!processorManager) return;\n const tracked = processorManager.get(processorId);\n if (tracked) {\n await tracked.retry();\n }\n },\n [processorManager, inspector],\n );\n\n if (!available) {\n return undefined;\n }\n\n return {\n getProcessors,\n onRetry,\n };\n}\n","import type {\n QueueInspectorProps,\n QueueState,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n InMemoryQueue,\n useReactorClientModule,\n type Job,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useQueueInspector(): QueueInspectorProps | undefined {\n const module = useReactorClientModule();\n const reactorClientModule = module?.kind === \"browser\" ? module : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const inMemoryQueue = useMemo(() => {\n if (queue instanceof InMemoryQueue) {\n return queue;\n }\n return undefined;\n }, [queue]);\n\n const getQueueState = useCallback((): Promise<QueueState> => {\n if (inspector) {\n return inspector.getQueueState() as Promise<QueueState>;\n }\n if (!inMemoryQueue) {\n return Promise.resolve({\n isPaused: false,\n pendingJobs: [],\n executingJobs: [],\n totalPending: 0,\n totalExecuting: 0,\n });\n }\n\n const pendingJobs = inMemoryQueue.getPendingJobs();\n const executingJobIds = inMemoryQueue.getExecutingJobIds();\n\n const executingJobs: Job[] = [];\n for (const jobIdSet of executingJobIds.values()) {\n for (const jobId of jobIdSet) {\n const job = inMemoryQueue.getJob(jobId);\n if (job) {\n executingJobs.push(job);\n }\n }\n }\n\n return Promise.resolve({\n isPaused: inMemoryQueue.paused,\n pendingJobs,\n executingJobs,\n totalPending: pendingJobs.length,\n totalExecuting: executingJobs.length,\n });\n }, [inMemoryQueue, inspector]);\n\n const onPause = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.pauseQueue();\n return;\n }\n if (inMemoryQueue) {\n inMemoryQueue.pause();\n }\n }, [inMemoryQueue, inspector]);\n\n const onResume = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.resumeQueue();\n return;\n }\n if (inMemoryQueue) {\n await inMemoryQueue.resume();\n }\n }, [inMemoryQueue, inspector]);\n\n if (!inMemoryQueue && !inspector) {\n return undefined;\n }\n\n return {\n getQueueState,\n onPause,\n onResume,\n };\n}\n","import type {\n ConnectionStateSnapshot,\n IPeerAgreement,\n Remote,\n SyncHold,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addRemoteDrive,\n PollBehavior,\n useConnectionStates,\n useSync,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\n\nexport function useRemotesInspector(): {\n getRemotes: () => Promise<Remote[]>;\n removeRemote: (name: string) => Promise<void>;\n addRemoteManual: (url: string) => Promise<void>;\n triggerPull: (name: string) => void;\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>;\n getAgreement: () => IPeerAgreement;\n getHolds: (remoteName: string) => Promise<SyncHold[]>;\n} {\n const syncManager = useSync();\n if (!syncManager) {\n throw new Error(\"Sync manager not found\");\n }\n\n const connectionStates = useConnectionStates();\n\n const getRemotes = useCallback(() => {\n return Promise.resolve(syncManager.list());\n }, [syncManager]);\n\n const removeRemote = useCallback(\n (name: string) => syncManager.remove(name),\n [syncManager],\n );\n\n const addRemoteManual = useCallback(async (url: string) => {\n await addRemoteDrive(url, undefined, {\n pollBehavior: PollBehavior.Manual,\n });\n }, []);\n\n const triggerPull = useCallback(\n (name: string) => syncManager.triggerPull(name),\n [syncManager],\n );\n\n const getAgreement = useCallback(\n () => syncManager.agreement(),\n [syncManager],\n );\n\n const getHolds = useCallback(\n (remoteName: string) => syncManager.listHolds({ remoteName }),\n [syncManager],\n );\n\n return {\n getAgreement,\n getHolds,\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n };\n}\n","import type { WorkerInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useMemo } from \"react\";\n\nexport function useWorkerInspector(): WorkerInspectorProps | undefined {\n const module = useReactorClientModule();\n const adminClient =\n module?.kind === \"worker\" ? module.adminClient : undefined;\n\n return useMemo(() => {\n if (!adminClient) {\n return undefined;\n }\n return {\n getInfo: () => adminClient.info(),\n onRestart: () => adminClient.restart(),\n };\n }, [adminClient]);\n}\n","import { InspectorModal as ConnectInspectorModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n REACTOR_SCHEMA,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCatchUpInspector } from \"./useCatchUpInspector.js\";\nimport { useDbExplorer } from \"./useDbExplorer.js\";\nimport { useDebugInspector } from \"./useDebugInspector.js\";\nimport { useIntegrityInspector } from \"./useIntegrityInspector.js\";\nimport { useProcessorsInspector } from \"./useProcessorsInspector.js\";\nimport { useQueueInspector } from \"./useQueueInspector.js\";\nimport { useRemotesInspector } from \"./useRemotesInspector.js\";\nimport { useWorkerInspector } from \"./useWorkerInspector.js\";\n\nconst DEFAULT_PAGE_SIZE = 25;\n\nexport const InspectorModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"inspector\";\n\n const { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } =\n useDbExplorer();\n const {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n getAgreement,\n getHolds,\n } = useRemotesInspector();\n const queueInspectorProps = useQueueInspector();\n const processorsInspectorProps = useProcessorsInspector();\n const integrityInspectorProps = useIntegrityInspector();\n const catchUpInspectorProps = useCatchUpInspector();\n const workerInspectorProps = useWorkerInspector();\n const { currentPgVersion, supportedPgVersions, onResetToPgVersion } =\n useDebugInspector();\n\n return (\n <ConnectInspectorModal\n open={open}\n onOpenChange={(status) => {\n if (!status) closePHModal();\n }}\n dbExplorerProps={{\n schema: REACTOR_SCHEMA,\n getTables,\n getTableRows,\n getDefaultSort,\n pageSize: DEFAULT_PAGE_SIZE,\n onExportDb,\n onImportDb,\n pgVersionControl: {\n currentPgVersion,\n supportedPgVersions,\n onResetToPgVersion,\n },\n }}\n remotesInspectorProps={{\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n getAgreement,\n getHolds,\n }}\n queueInspectorProps={queueInspectorProps}\n processorsInspectorProps={processorsInspectorProps}\n integrityInspectorProps={integrityInspectorProps}\n catchUpInspectorProps={catchUpInspectorProps}\n workerInspectorProps={workerInspectorProps}\n />\n );\n};\n"],"names":["ConnectInspectorModal"],"mappings":";;;;;;;;;;;;;AAOA,SAAgB,sBAAyD;CACvE,MAAM,SAAS,uBAAuB;CACtC,MAAM,UACJ,QAAQ,SAAS,YAAY,OAAO,eAAe,UAAU,KAAA;CAC/D,MAAM,YAAY,QAAQ,SA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kB;IAChB;IACA;IACA;GACF;EACF;EACA,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACqB;EACK;EACD;EACF;EACD;CACvB,CAAA;AAEL","debug_id":"163b178c-5977-5c0b-adbf-85aa33f07edd"}
1
+ {"version":3,"file":"InspectorModal-C1ZVZpT5.js","sources":["../src/generic/modals/InspectorModal/useCatchUpInspector.ts","../src/generic/modals/InspectorModal/useDbExplorer.ts","../src/generic/modals/InspectorModal/useDebugInspector.ts","../src/generic/modals/InspectorModal/useIntegrityInspector.ts","../src/generic/modals/InspectorModal/useProcessorsInspector.ts","../src/generic/modals/InspectorModal/useQueueInspector.ts","../src/generic/modals/InspectorModal/useRemotesInspector.ts","../src/generic/modals/InspectorModal/useWorkerInspector.ts","../src/generic/modals/InspectorModal/InspectorModal.tsx"],"sourcesContent":["import type {\n CatchUpInspectorProps,\n CatchUpStatus,\n} from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useState } from \"react\";\n\nexport function useCatchUpInspector(): CatchUpInspectorProps | undefined {\n const module = useReactorClientModule();\n const catchUp =\n module?.kind === \"browser\" ? module.reactorModule?.catchUp : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n const [status, setStatus] = useState<CatchUpStatus | undefined>();\n\n const onRefresh = useCallback(async (): Promise<void> => {\n if (inspector) {\n setStatus((await inspector.getCatchUpStatus()) as CatchUpStatus);\n return;\n }\n if (catchUp) {\n setStatus(catchUp.status());\n }\n }, [catchUp, inspector]);\n\n const onSweepNow = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.sweepCatchUp();\n return;\n }\n if (catchUp) {\n await catchUp.sweepNow();\n }\n }, [catchUp, inspector]);\n\n if (!catchUp && !inspector) {\n return undefined;\n }\n\n return {\n status,\n onRefresh,\n onSweepNow,\n };\n}\n","import type { PGlite } from \"@electric-sql/pglite\";\nimport {\n getCachedReactorPgMajor,\n loadPgDump,\n resolvePgMajorForRuntime,\n} from \"@powerhousedao/connect/utils\";\nimport type {\n FilterGroup,\n SortOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport type { Database } from \"@powerhousedao/reactor\";\nimport {\n REACTOR_SCHEMA,\n useDatabase,\n usePGlite,\n useReactorClientModule,\n type IQueue,\n} from \"@powerhousedao/reactor-browser\";\nimport type { IInspectorProxy } from \"@powerhousedao/reactor-browser/rpc\";\nimport { Kysely, sql } from \"kysely\";\nimport { PGliteDialect } from \"kysely-pglite-dialect\";\nimport { useCallback, useMemo } from \"react\";\n\nasync function quiesceQueue(queue: IQueue): Promise<void> {\n await new Promise<void>((resolve) => queue.block(() => resolve()));\n}\n\n// The reactor runs with `relaxedDurability: true`, which makes PGlite's\n// `syncToFs()` fire the IDBFS→IndexedDB write and return without awaiting\n// Emscripten's syncfs callback. `close()` also doesn't flush. Calling\n// `FS.syncfs(false, cb)` directly gives us a callback that fires from the\n// IDBFS transaction's `oncomplete` — i.e. after IDB has actually committed.\nasync function syncPgliteToIdb(pglite: {\n readonly Module: {\n readonly FS: {\n syncfs(populate: boolean, cb: (err: Error | null) => void): void;\n };\n };\n}): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n pglite.Module.FS.syncfs(false, (err) => (err ? reject(err) : resolve()));\n });\n}\n\ntype ColumnInfo = {\n readonly name: string;\n readonly dataType: string;\n readonly isNullable: boolean;\n};\n\ntype TableInfo = {\n readonly name: string;\n readonly columns: ColumnInfo[];\n};\n\ntype ColumnRow = {\n table_name: string;\n column_name: string;\n data_type: string;\n is_nullable: string;\n};\n\ntype GetTableRowsOptions = {\n readonly schema?: string;\n readonly limit: number;\n readonly offset: number;\n readonly sort?: SortOptions;\n readonly filters?: FilterGroup;\n};\n\ntype TablePage = {\n readonly columns: string[];\n readonly rows: Record<string, unknown>[];\n readonly total: number | null;\n};\n\nconst PRIORITY_COLUMNS = [\n \"documentType\",\n \"documentId\",\n \"scope\",\n \"branch\",\n \"index\",\n \"skip\",\n] as const;\n\ntype ReactorPgliteAdapter = {\n query: (\n sql: string,\n params?: unknown[],\n ) => Promise<{ rows: unknown[]; affectedRows?: number }>;\n};\n\nfunction createWorkerReactorDatabase(\n inspector: IInspectorProxy,\n): Kysely<Database> {\n const adapter: ReactorPgliteAdapter = {\n query: async (statement, params) => ({\n rows: (await inspector.queryReactorDb(statement, params)) as unknown[],\n }),\n };\n return new Kysely<Database>({\n dialect: new PGliteDialect(adapter as unknown as PGlite),\n });\n}\n\nexport function useDbExplorer() {\n const browserDatabase = useDatabase();\n const pglite = usePGlite();\n const module = useReactorClientModule();\n const reactorClientModule = module?.kind === \"browser\" ? module : undefined;\n const reactor = reactorClientModule?.reactorModule?.reactor;\n const queue = reactorClientModule?.reactorModule?.queue;\n const workerModule = module?.kind === \"worker\" ? module : undefined;\n const workerDatabase = useMemo(\n () =>\n workerModule\n ? createWorkerReactorDatabase(workerModule.inspector)\n : undefined,\n [workerModule],\n );\n const database = browserDatabase ?? workerDatabase;\n\n const getTables = useCallback(async (): Promise<TableInfo[]> => {\n if (!database) return [];\n\n const result = await sql<ColumnRow>`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\n const tableMap = new Map<string, ColumnInfo[]>();\n for (const row of result.rows) {\n if (!tableMap.has(row.table_name)) {\n tableMap.set(row.table_name, []);\n }\n tableMap.get(row.table_name)!.push({\n name: row.column_name,\n dataType: row.data_type,\n isNullable: row.is_nullable === \"YES\",\n });\n }\n\n return Array.from(tableMap).map(([name, columns]) => {\n const columnNames = columns.map((col) => col.name);\n const orderedColumns = [\n ...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map(\n (col) => columns.find((c) => c.name === col)!,\n ),\n ...columns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col.name as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n return {\n name,\n columns: orderedColumns,\n };\n });\n }, [database]);\n\n const getTableRows = useCallback(\n async (table: string, options: GetTableRowsOptions): Promise<TablePage> => {\n if (!database) {\n return { columns: [], rows: [], total: null };\n }\n\n const limit = options.limit;\n const offset = options.offset;\n const sort = options.sort;\n const filters = options.filters;\n const tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\n // Build WHERE clause from filters\n let whereClause = sql``;\n if (filters?.clauses && filters.clauses.length > 0) {\n const conditions: ReturnType<typeof sql>[] = [];\n\n for (let i = 0; i < filters.clauses.length; i++) {\n const clause = filters.clauses[i];\n if (!clause) continue;\n\n const columnRef = sql.raw(`\"${clause.column}\"`);\n\n let condition: ReturnType<typeof sql>;\n\n if (clause.operator === \"IS NULL\") {\n condition = sql`${columnRef} IS NULL`;\n } else if (clause.operator === \"IS NOT NULL\") {\n condition = sql`${columnRef} IS NOT NULL`;\n } else if (\n clause.operator === \"LIKE\" ||\n clause.operator === \"ILIKE\"\n ) {\n const value = clause.value;\n const operator =\n clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n condition = sql`${columnRef} ${operator} ${value}`;\n } else {\n // For =, !=, >, <, >=, <=\n const operator = sql.raw(clause.operator);\n const value = clause.value;\n\n // Try to parse as number if it looks like a number\n let parsedValue: string | number = value;\n if (value !== \"\" && !isNaN(Number(value)) && value.trim() !== \"\") {\n parsedValue = Number(value);\n }\n\n condition = sql`${columnRef} ${operator} ${parsedValue}`;\n }\n\n conditions.push(condition);\n\n // Add connector if not the last clause\n if (i < filters.clauses.length - 1) {\n const connector = filters.connectors?.[i] ?? \"AND\";\n conditions.push(sql.raw(connector));\n }\n }\n\n // Combine all conditions\n if (conditions.length > 0) {\n whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n }\n }\n\n // Build main query\n let query;\n if (sort) {\n const columnRef = sql.raw(`\"${sort.column}\"`);\n const direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n } else {\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n }\n\n const result = await query.execute(database);\n\n // Build count query with same filters\n const countQuery = sql<{ count: string }>`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `;\n const countResult = await countQuery.execute(database);\n const total = countResult.rows[0]\n ? parseInt(countResult.rows[0].count, 10)\n : null;\n\n const rawColumns =\n result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n const columns = [\n ...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)),\n ...rawColumns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n\n return {\n columns,\n rows: result.rows,\n total,\n };\n },\n [database],\n );\n\n const onExportDb = useCallback(async () => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n try {\n const major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n const pgDump = await loadPgDump(major);\n const dump = await pgDump({ pg: pglite });\n const sqlContent = await dump.text();\n\n const blob = new Blob([sqlContent], { type: \"text/sql\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = `database-export-${Date.now()}.sql`;\n a.click();\n URL.revokeObjectURL(url);\n } finally {\n queue?.unblock();\n }\n }, [pglite, queue]);\n\n const onImportDb = useCallback(\n async (sqlContent: string) => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n if (reactor) {\n const status = reactor.kill();\n await status.completed;\n }\n\n // drop every user-created schema before restoring\n await pglite.transaction(async (tx) => {\n const schemas = await tx.query<{ nspname: string }>(\n `SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`,\n );\n for (const { nspname } of schemas.rows) {\n await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n }\n try {\n await tx.exec(\"SET standard_conforming_strings = off;\");\n } catch {\n // PG17 still accepts this but log if it ever fails.\n }\n await tx.exec(sqlContent);\n await tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n });\n\n // flush IDBFS → IndexedDB synchronously\n await syncPgliteToIdb(pglite);\n\n window.location.reload();\n\n // reload() is asynchronous; without blocking here the DBExplorer caller\n // would continue and call loadTables() against an in-flight shutdown.\n await new Promise(() => {});\n },\n [pglite, queue, reactor],\n );\n\n const getDefaultSort = useCallback(\n (table: string): SortOptions | undefined => {\n if (table === \"Operation\") {\n return { column: \"timestampUtcMs\", direction: \"desc\" };\n }\n return undefined;\n },\n [],\n );\n\n const canModifyDb = !!pglite;\n\n return {\n getTables,\n getTableRows,\n getDefaultSort,\n onExportDb: canModifyDb ? onExportDb : undefined,\n onImportDb: canModifyDb ? onImportDb : undefined,\n };\n}\n","import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport {\n getCachedReactorPgMajor,\n PENDING_PG_SEED_KEY,\n subscribeReactorPgMajor,\n} from \"@powerhousedao/connect/utils\";\nimport { useCallback, useSyncExternalStore } from \"react\";\n\nconst SUPPORTED_PG_VERSIONS = [16, 17] as const;\n\nexport function useDebugInspector() {\n const currentPgVersion = useSyncExternalStore(\n subscribeReactorPgMajor,\n getCachedReactorPgMajor,\n () => undefined,\n );\n\n const onResetToPgVersion = useCallback(async (major: number) => {\n console.info(`[debug-inspector] Reset requested: PG${major}`);\n try {\n localStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n console.info(`[debug-inspector] Clearing reactor storage...`);\n await clearReactorStorage();\n console.info(`[debug-inspector] Storage cleared. Reloading...`);\n window.location.reload();\n } catch (err) {\n console.error(\"[debug-inspector] Reset failed:\", err);\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n throw err;\n }\n }, []);\n\n return {\n supportedPgVersions: SUPPORTED_PG_VERSIONS,\n currentPgVersion: currentPgVersion ?? null,\n onResetToPgVersion,\n };\n}\n","import type { IntegrityInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport {\n DocumentIntegrityService,\n useReactorClientModule,\n type RebuildResult,\n type ValidationResult,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useIntegrityInspector(): IntegrityInspectorProps | undefined {\n const module = useReactorClientModule();\n const reactorModule =\n module?.kind === \"browser\" ? module.reactorModule : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n\n const service = useMemo(() => {\n if (!reactorModule) return undefined;\n\n return new DocumentIntegrityService(\n reactorModule.keyframeStore,\n reactorModule.operationStore,\n reactorModule.writeCache,\n reactorModule.documentView,\n reactorModule.documentModelRegistry,\n );\n }, [reactorModule]);\n\n const onValidate = useCallback(\n async (documentId: string, branch?: string): Promise<ValidationResult> => {\n if (inspector) {\n return (await inspector.validateDocument(\n documentId,\n branch,\n )) as ValidationResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.validateDocument(documentId, branch);\n },\n [service, inspector],\n );\n\n const onRebuildKeyframes = useCallback(\n async (documentId: string, branch?: string): Promise<RebuildResult> => {\n if (inspector) {\n return (await inspector.rebuildKeyframes(\n documentId,\n branch,\n )) as RebuildResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildKeyframes(documentId, branch);\n },\n [service, inspector],\n );\n\n const onRebuildSnapshots = useCallback(\n async (documentId: string, branch?: string): Promise<RebuildResult> => {\n if (inspector) {\n return (await inspector.rebuildSnapshots(\n documentId,\n branch,\n )) as RebuildResult;\n }\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildSnapshots(documentId, branch);\n },\n [service, inspector],\n );\n\n if (!service && !inspector) {\n return undefined;\n }\n\n return {\n onValidate,\n onRebuildKeyframes,\n onRebuildSnapshots,\n };\n}\n","import type {\n ProcessorInfo,\n ProcessorsInspectorProps,\n} from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useProcessorsInspector(): ProcessorsInspectorProps | undefined {\n const module = useReactorClientModule();\n const processorManager =\n module?.kind === \"browser\"\n ? module.reactorModule?.processorManager\n : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n\n const available = useMemo(\n () => processorManager != null || inspector != null,\n [processorManager, inspector],\n );\n\n const getProcessors = useCallback((): Promise<ProcessorInfo[]> => {\n if (inspector) {\n return inspector.getProcessors() as Promise<ProcessorInfo[]>;\n }\n if (!processorManager) {\n return Promise.resolve([]);\n }\n return Promise.resolve(\n processorManager.getAll().map((tracked) => ({\n processorId: tracked.processorId,\n factoryId: tracked.factoryId,\n driveId: tracked.driveId,\n processorIndex: tracked.processorIndex,\n lastOrdinal: tracked.lastOrdinal,\n status: tracked.status,\n lastError: tracked.lastError,\n lastErrorTimestamp: tracked.lastErrorTimestamp,\n })),\n );\n }, [processorManager, inspector]);\n\n const onRetry = useCallback(\n async (processorId: string) => {\n if (inspector) {\n await inspector.retryProcessor(processorId);\n return;\n }\n if (!processorManager) return;\n const tracked = processorManager.get(processorId);\n if (tracked) {\n await tracked.retry();\n }\n },\n [processorManager, inspector],\n );\n\n if (!available) {\n return undefined;\n }\n\n return {\n getProcessors,\n onRetry,\n };\n}\n","import type {\n QueueInspectorProps,\n QueueState,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n InMemoryQueue,\n useReactorClientModule,\n type Job,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useQueueInspector(): QueueInspectorProps | undefined {\n const module = useReactorClientModule();\n const reactorClientModule = module?.kind === \"browser\" ? module : undefined;\n const inspector = module?.kind === \"worker\" ? module.inspector : undefined;\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const inMemoryQueue = useMemo(() => {\n if (queue instanceof InMemoryQueue) {\n return queue;\n }\n return undefined;\n }, [queue]);\n\n const getQueueState = useCallback((): Promise<QueueState> => {\n if (inspector) {\n return inspector.getQueueState() as Promise<QueueState>;\n }\n if (!inMemoryQueue) {\n return Promise.resolve({\n isPaused: false,\n pendingJobs: [],\n executingJobs: [],\n totalPending: 0,\n totalExecuting: 0,\n });\n }\n\n const pendingJobs = inMemoryQueue.getPendingJobs();\n const executingJobIds = inMemoryQueue.getExecutingJobIds();\n\n const executingJobs: Job[] = [];\n for (const jobIdSet of executingJobIds.values()) {\n for (const jobId of jobIdSet) {\n const job = inMemoryQueue.getJob(jobId);\n if (job) {\n executingJobs.push(job);\n }\n }\n }\n\n return Promise.resolve({\n isPaused: inMemoryQueue.paused,\n pendingJobs,\n executingJobs,\n totalPending: pendingJobs.length,\n totalExecuting: executingJobs.length,\n });\n }, [inMemoryQueue, inspector]);\n\n const onPause = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.pauseQueue();\n return;\n }\n if (inMemoryQueue) {\n inMemoryQueue.pause();\n }\n }, [inMemoryQueue, inspector]);\n\n const onResume = useCallback(async (): Promise<void> => {\n if (inspector) {\n await inspector.resumeQueue();\n return;\n }\n if (inMemoryQueue) {\n await inMemoryQueue.resume();\n }\n }, [inMemoryQueue, inspector]);\n\n if (!inMemoryQueue && !inspector) {\n return undefined;\n }\n\n return {\n getQueueState,\n onPause,\n onResume,\n };\n}\n","import type {\n ConnectionStateSnapshot,\n IPeerAgreement,\n Remote,\n SyncHold,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addRemoteDrive,\n PollBehavior,\n useConnectionStates,\n useSync,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\n\nexport function useRemotesInspector(): {\n getRemotes: () => Promise<Remote[]>;\n removeRemote: (name: string) => Promise<void>;\n addRemoteManual: (url: string) => Promise<void>;\n triggerPull: (name: string) => void;\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>;\n getAgreement: () => IPeerAgreement;\n getHolds: (remoteName: string) => Promise<SyncHold[]>;\n} {\n const syncManager = useSync();\n if (!syncManager) {\n throw new Error(\"Sync manager not found\");\n }\n\n const connectionStates = useConnectionStates();\n\n const getRemotes = useCallback(() => {\n return Promise.resolve(syncManager.list());\n }, [syncManager]);\n\n const removeRemote = useCallback(\n (name: string) => syncManager.remove(name),\n [syncManager],\n );\n\n const addRemoteManual = useCallback(async (url: string) => {\n await addRemoteDrive(url, undefined, {\n pollBehavior: PollBehavior.Manual,\n });\n }, []);\n\n const triggerPull = useCallback(\n (name: string) => syncManager.triggerPull(name),\n [syncManager],\n );\n\n const getAgreement = useCallback(\n () => syncManager.agreement(),\n [syncManager],\n );\n\n const getHolds = useCallback(\n (remoteName: string) => syncManager.listHolds({ remoteName }),\n [syncManager],\n );\n\n return {\n getAgreement,\n getHolds,\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n };\n}\n","import type { WorkerInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useMemo } from \"react\";\n\nexport function useWorkerInspector(): WorkerInspectorProps | undefined {\n const module = useReactorClientModule();\n const adminClient =\n module?.kind === \"worker\" ? module.adminClient : undefined;\n\n return useMemo(() => {\n if (!adminClient) {\n return undefined;\n }\n return {\n getInfo: () => adminClient.info(),\n onRestart: () => adminClient.restart(),\n };\n }, [adminClient]);\n}\n","import { InspectorModal as ConnectInspectorModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n REACTOR_SCHEMA,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCatchUpInspector } from \"./useCatchUpInspector.js\";\nimport { useDbExplorer } from \"./useDbExplorer.js\";\nimport { useDebugInspector } from \"./useDebugInspector.js\";\nimport { useIntegrityInspector } from \"./useIntegrityInspector.js\";\nimport { useProcessorsInspector } from \"./useProcessorsInspector.js\";\nimport { useQueueInspector } from \"./useQueueInspector.js\";\nimport { useRemotesInspector } from \"./useRemotesInspector.js\";\nimport { useWorkerInspector } from \"./useWorkerInspector.js\";\n\nconst DEFAULT_PAGE_SIZE = 25;\n\nexport const InspectorModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"inspector\";\n\n const { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } =\n useDbExplorer();\n const {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n getAgreement,\n getHolds,\n } = useRemotesInspector();\n const queueInspectorProps = useQueueInspector();\n const processorsInspectorProps = useProcessorsInspector();\n const integrityInspectorProps = useIntegrityInspector();\n const catchUpInspectorProps = useCatchUpInspector();\n const workerInspectorProps = useWorkerInspector();\n const { currentPgVersion, supportedPgVersions, onResetToPgVersion } =\n useDebugInspector();\n\n return (\n <ConnectInspectorModal\n open={open}\n onOpenChange={(status) => {\n if (!status) closePHModal();\n }}\n dbExplorerProps={{\n schema: REACTOR_SCHEMA,\n getTables,\n getTableRows,\n getDefaultSort,\n pageSize: DEFAULT_PAGE_SIZE,\n onExportDb,\n onImportDb,\n pgVersionControl: {\n currentPgVersion,\n supportedPgVersions,\n onResetToPgVersion,\n },\n }}\n remotesInspectorProps={{\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n getAgreement,\n getHolds,\n }}\n queueInspectorProps={queueInspectorProps}\n processorsInspectorProps={processorsInspectorProps}\n integrityInspectorProps={integrityInspectorProps}\n catchUpInspectorProps={catchUpInspectorProps}\n workerInspectorProps={workerInspectorProps}\n />\n );\n};\n"],"names":["ConnectInspectorModal"],"mappings":";;;;;;;;;;;;;AAOA,SAAgB,sBAAyD;CACvE,MAAM,SAAS,uBAAuB;CACtC,MAAM,UACJ,QAAQ,SAAS,YAAY,OAAO,eAAe,UAAU,KAA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;GACA,UAAU;GACV;GACA;GACA,kBAAkB;IAChB;IACA;IACA;GACF;EACF;EACA,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACqB;EACK;EACD;EACF;EACD;CACvB,CAAA;AAEL","debug_id":"51b69dc8-390e-5e2c-a8eb-b3caf96f0110"}
@@ -1,6 +1,6 @@
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]="9670fdbe-eaf4-52e7-be75-418cfe2472f4")}catch(e){}}();
3
- import { t as DriveIcon } from "./drive-icon-BiVP8yJc.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]="afc3d1f0-0acf-5c30-b0e9-d5cc1f0d5c33")}catch(e){}}();
3
+ import { t as DriveIcon } from "./drive-icon-BIpd8edR.js";
4
4
  import { i as runOpenFileImports, l as pendingFileKey, o as clearPendingImportFiles, s as getPendingImportFiles, u as subscribePendingImportFiles } from "./open-file-uploads-B5pr1sA2.js";
5
5
  import { useEffect, useState, useSyncExternalStore } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -309,5 +309,5 @@ function OpenFileDocumentsModal() {
309
309
  //#endregion
310
310
  export { OpenFileDocumentsModal };
311
311
 
312
- //# sourceMappingURL=OpenFileDocumentsModal-BNHD0vg9.js.map
313
- //# debugId=9670fdbe-eaf4-52e7-be75-418cfe2472f4
312
+ //# sourceMappingURL=OpenFileDocumentsModal-B9c-CsKT.js.map
313
+ //# debugId=afc3d1f0-0acf-5c30-b0e9-d5cc1f0d5c33