@buoy-gg/core 7.0.40 → 7.0.42
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.
- package/README.md +14 -85
- package/bin/buoy.js +20 -347
- package/lib/commonjs/Buoy.js +1 -107
- package/lib/commonjs/browserRegister.js +1 -0
- package/lib/commonjs/browserRegister.server.js +1 -0
- package/lib/commonjs/earlyHookScript.js +1 -0
- package/lib/commonjs/earlyNetwork.js +1 -0
- package/lib/commonjs/floatingMenu/AppHost.js +1 -460
- package/lib/commonjs/floatingMenu/AppHost.web.js +1 -364
- package/lib/commonjs/floatingMenu/AppHostLogic.js +1 -50
- package/lib/commonjs/floatingMenu/AppIcon.js +1 -91
- package/lib/commonjs/floatingMenu/AppIcon.web.js +1 -53
- package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -0
- package/lib/commonjs/floatingMenu/DefaultConfigContext.js +1 -45
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.js +1 -1119
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -0
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.web.js +1 -1048
- package/lib/commonjs/floatingMenu/DevToolsVisibilityContext.js +1 -49
- package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -554
- package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -401
- package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -371
- package/lib/commonjs/floatingMenu/MinimizedToolsContext.js +1 -274
- package/lib/commonjs/floatingMenu/MinimizedToolsStack.js +1 -288
- package/lib/commonjs/floatingMenu/MinimizedToolsStack.web.js +1 -371
- package/lib/commonjs/floatingMenu/ToggleStateManager.js +1 -36
- package/lib/commonjs/floatingMenu/ToolHost.js +1 -281
- package/lib/commonjs/floatingMenu/ToolOpenerBridge.js +1 -41
- package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -461
- package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -434
- package/lib/commonjs/floatingMenu/defaultConfig.js +1 -167
- package/lib/commonjs/floatingMenu/deviceIdentity.js +1 -173
- package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -904
- package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +1 -821
- package/lib/commonjs/floatingMenu/dial/DialHyperspace.js +1 -177
- package/lib/commonjs/floatingMenu/dial/DialIcon.js +1 -302
- package/lib/commonjs/floatingMenu/dial/DialPagination.js +1 -165
- package/lib/commonjs/floatingMenu/dial/DialSnow.js +1 -92
- package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.js +1 -246
- package/lib/commonjs/floatingMenu/dial/OnboardingTooltip.web.js +2 -147
- package/lib/commonjs/floatingMenu/dial/dialUsageStore.js +1 -93
- package/lib/commonjs/floatingMenu/dial/onboardingConstants.js +1 -42
- package/lib/commonjs/floatingMenu/dial/onboardingConstants.web.js +1 -42
- package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -49
- package/lib/commonjs/floatingMenu/floatingTools.js +1 -42
- package/lib/commonjs/floatingMenu/floatingTools.web.js +1 -30
- package/lib/commonjs/floatingMenu/optionalRequire.js +1 -37
- package/lib/commonjs/floatingMenu/settingsBus.js +1 -23
- package/lib/commonjs/floatingMenu/sync/appSyncAdapter.js +1 -115
- package/lib/commonjs/floatingMenu/types.js +1 -5
- package/lib/commonjs/floatingMenu/useDesktopSyncStatus.js +1 -28
- package/lib/commonjs/floatingMenu/useDesktopSyncStatus.web.js +1 -0
- package/lib/commonjs/index.js +1 -291
- package/lib/commonjs/index.web.js +1 -150
- package/lib/commonjs/reactDevtoolsTypes.js +1 -0
- package/lib/commonjs/releaseOptIn.js +1 -0
- package/lib/commonjs/telemetry/installPing.js +1 -131
- package/lib/commonjs/toolkit.js +1 -584
- package/lib/commonjs/toolkitComponents.js +1 -241
- package/lib/commonjs/utils/autoDiscoverPresets.web.js +1 -219
- package/lib/commonjs/utils/createWebTool.js +1 -0
- package/lib/commonjs/utils/createWebTools.js +1 -0
- package/lib/commonjs/version.js +1 -18
- package/lib/module/Buoy.js +1 -102
- package/lib/module/browserRegister.js +1 -0
- package/lib/module/browserRegister.server.js +1 -0
- package/lib/module/earlyHookScript.js +1 -0
- package/lib/module/earlyNetwork.js +1 -0
- package/lib/module/floatingMenu/AppHost.js +1 -452
- package/lib/module/floatingMenu/AppHost.web.js +1 -356
- package/lib/module/floatingMenu/AppHostLogic.js +1 -45
- package/lib/module/floatingMenu/AppIcon.js +1 -84
- package/lib/module/floatingMenu/AppIcon.web.js +1 -47
- package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -0
- package/lib/module/floatingMenu/DefaultConfigContext.js +1 -39
- package/lib/module/floatingMenu/DevToolsSettingsModal.js +1 -1115
- package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -0
- package/lib/module/floatingMenu/DevToolsSettingsModal.web.js +1 -1055
- package/lib/module/floatingMenu/DevToolsVisibilityContext.js +1 -44
- package/lib/module/floatingMenu/FloatingDevTools.js +1 -551
- package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -399
- package/lib/module/floatingMenu/FloatingMenu.js +1 -366
- package/lib/module/floatingMenu/MinimizedToolsContext.js +1 -266
- package/lib/module/floatingMenu/MinimizedToolsStack.js +1 -285
- package/lib/module/floatingMenu/MinimizedToolsStack.web.js +1 -368
- package/lib/module/floatingMenu/ToggleStateManager.js +1 -32
- package/lib/module/floatingMenu/ToolHost.js +1 -273
- package/lib/module/floatingMenu/ToolOpenerBridge.js +1 -37
- package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -457
- package/lib/module/floatingMenu/autoExternalSync.js +1 -427
- package/lib/module/floatingMenu/defaultConfig.js +1 -158
- package/lib/module/floatingMenu/deviceIdentity.js +1 -163
- package/lib/module/floatingMenu/dial/DialDevTools.js +1 -900
- package/lib/module/floatingMenu/dial/DialDevTools.web.js +1 -818
- package/lib/module/floatingMenu/dial/DialHyperspace.js +1 -173
- package/lib/module/floatingMenu/dial/DialIcon.js +1 -299
- package/lib/module/floatingMenu/dial/DialPagination.js +1 -160
- package/lib/module/floatingMenu/dial/DialSnow.js +1 -90
- package/lib/module/floatingMenu/dial/OnboardingTooltip.js +1 -240
- package/lib/module/floatingMenu/dial/OnboardingTooltip.web.js +2 -142
- package/lib/module/floatingMenu/dial/dialUsageStore.js +1 -85
- package/lib/module/floatingMenu/dial/onboardingConstants.js +1 -3
- package/lib/module/floatingMenu/dial/onboardingConstants.web.js +1 -3
- package/lib/module/floatingMenu/externalSyncGate.js +1 -44
- package/lib/module/floatingMenu/floatingTools.js +1 -27
- package/lib/module/floatingMenu/floatingTools.web.js +1 -3
- package/lib/module/floatingMenu/optionalRequire.js +1 -33
- package/lib/module/floatingMenu/settingsBus.js +1 -19
- package/lib/module/floatingMenu/sync/appSyncAdapter.js +1 -112
- package/lib/module/floatingMenu/types.js +1 -3
- package/lib/module/floatingMenu/useDesktopSyncStatus.js +1 -25
- package/lib/module/floatingMenu/useDesktopSyncStatus.web.js +1 -0
- package/lib/module/index.js +1 -41
- package/lib/module/index.web.js +1 -29
- package/lib/module/reactDevtoolsTypes.js +1 -0
- package/lib/module/releaseOptIn.js +1 -0
- package/lib/module/telemetry/installPing.js +1 -127
- package/lib/module/toolkit.js +1 -62
- package/lib/module/toolkitComponents.js +1 -230
- package/lib/module/utils/autoDiscoverPresets.web.js +1 -213
- package/lib/module/utils/createWebTool.js +1 -0
- package/lib/module/utils/createWebTools.js +1 -0
- package/lib/module/version.js +1 -14
- package/lib/typescript/commonjs/browserRegister.d.ts +13 -0
- package/lib/typescript/commonjs/browserRegister.server.d.ts +6 -0
- package/lib/typescript/commonjs/earlyHookScript.d.ts +12 -0
- package/lib/typescript/commonjs/earlyNetwork.d.ts +52 -0
- package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts +3 -3
- package/lib/typescript/commonjs/floatingMenu/BrowserToolRuntime.d.ts +14 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts +2 -67
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.shared.d.ts +71 -0
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts +3 -16
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +12 -6
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/settingsBus.d.ts +1 -9
- package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.web.d.ts +3 -0
- package/lib/typescript/commonjs/index.web.d.ts +7 -0
- package/lib/typescript/commonjs/reactDevtoolsTypes.d.ts +8 -0
- package/lib/typescript/commonjs/releaseOptIn.d.ts +4 -0
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts +3 -40
- package/lib/typescript/commonjs/utils/createWebTool.d.ts +6 -0
- package/lib/typescript/commonjs/utils/createWebTools.d.ts +4 -0
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/browserRegister.d.ts +13 -0
- package/lib/typescript/module/browserRegister.server.d.ts +6 -0
- package/lib/typescript/module/earlyHookScript.d.ts +12 -0
- package/lib/typescript/module/earlyNetwork.d.ts +52 -0
- package/lib/typescript/module/floatingMenu/AppHost.web.d.ts +3 -3
- package/lib/typescript/module/floatingMenu/BrowserToolRuntime.d.ts +14 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts +2 -67
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.shared.d.ts +71 -0
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts +3 -16
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +12 -6
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/settingsBus.d.ts +1 -9
- package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.web.d.ts +3 -0
- package/lib/typescript/module/index.web.d.ts +7 -0
- package/lib/typescript/module/reactDevtoolsTypes.d.ts +8 -0
- package/lib/typescript/module/releaseOptIn.d.ts +4 -0
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts +3 -40
- package/lib/typescript/module/utils/createWebTool.d.ts +6 -0
- package/lib/typescript/module/utils/createWebTools.d.ts +4 -0
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/chunks/chunk-5SGL6QL4.mjs +1 -0
- package/lib/web/chunks/chunk-FROELTJH.mjs +1 -0
- package/lib/web/chunks/chunk-QZDVCMCT.mjs +1 -0
- package/lib/web/chunks/chunk-R7RGRTY5.mjs +1 -0
- package/lib/web/index.mjs +10 -0
- package/lib/web/register-server.mjs +1 -0
- package/lib/web/register.mjs +1 -0
- package/lib/web/toolkit.mjs +1 -0
- package/package.json +50 -12
- package/lib/typescript/commonjs/Buoy.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHost.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHost.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppIcon.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/AppIcon.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingMenu.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToggleStateManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToolHost.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/deviceIdentity.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialIcon.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialPagination.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/DialSnow.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/externalSyncGate.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/floatingTools.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/floatingTools.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/optionalRequire.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/settingsBus.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/types.d.ts.map +0 -1
- package/lib/typescript/commonjs/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
- package/lib/typescript/commonjs/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/telemetry/installPing.d.ts.map +0 -1
- package/lib/typescript/commonjs/toolkit.d.ts.map +0 -1
- package/lib/typescript/commonjs/toolkitComponents.d.ts.map +0 -1
- package/lib/typescript/commonjs/utils/autoDiscoverPresets.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/version.d.ts.map +0 -1
- package/lib/typescript/module/Buoy.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHost.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHost.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppIcon.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/AppIcon.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DefaultConfigContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsSettingsModal.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/DevToolsVisibilityContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/FloatingMenu.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsContext.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsStack.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/MinimizedToolsStack.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToggleStateManager.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToolHost.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/ToolOpenerBridge.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/autoDiscoverPresets.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/deviceIdentity.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialHyperspace.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialIcon.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialPagination.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/DialSnow.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/OnboardingTooltip.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/dialUsageStore.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/onboardingConstants.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/dial/onboardingConstants.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/externalSyncGate.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/floatingTools.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/floatingTools.web.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/optionalRequire.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/settingsBus.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/sync/appSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/types.d.ts.map +0 -1
- package/lib/typescript/module/floatingMenu/useDesktopSyncStatus.d.ts.map +0 -1
- package/lib/typescript/module/index.d.ts.map +0 -1
- package/lib/typescript/module/index.web.d.ts.map +0 -1
- package/lib/typescript/module/telemetry/installPing.d.ts.map +0 -1
- package/lib/typescript/module/toolkit.d.ts.map +0 -1
- package/lib/typescript/module/toolkitComponents.d.ts.map +0 -1
- package/lib/typescript/module/utils/autoDiscoverPresets.web.d.ts.map +0 -1
- package/lib/typescript/module/version.d.ts.map +0 -1
|
@@ -1,427 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Zero-config device→desktop sync for FloatingDevTools.
|
|
5
|
-
*
|
|
6
|
-
* When @buoy-gg/external-sync is installed, FloatingDevTools renders
|
|
7
|
-
* <AutoExternalSync /> in dev builds (and in release builds that opted in via
|
|
8
|
-
* externalSync.enableInRelease — see externalSyncGate.ts): it connects to the
|
|
9
|
-
* Buoy Desktop broker (port 42831 on the Metro host, so physical devices reach
|
|
10
|
-
* the dev machine automatically — a background retry when the desktop app
|
|
11
|
-
* isn't running) and registers a sync adapter for every installed tool
|
|
12
|
-
* package, discovered with the same guarded-require pattern as
|
|
13
|
-
* autoDiscoverPresets. No <DevToolsSync> wiring needed in the app.
|
|
14
|
-
*
|
|
15
|
-
* Identity defaults come from deviceIdentity.ts: the app name (expo-constants)
|
|
16
|
-
* plus a persisted per-install tail, so two devices on one build register as
|
|
17
|
-
* two devices — "MyApp (iPhone 17 Pro · 2c1d)" / "myapp-ios-3f9a2c1d".
|
|
18
|
-
* Overridable via the `externalSync` prop.
|
|
19
|
-
*/
|
|
20
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
21
|
-
import { Platform } from "react-native";
|
|
22
|
-
import { LicenseManager } from "@buoy-gg/license";
|
|
23
|
-
import { reportOptionalRequireError } from "./optionalRequire.js";
|
|
24
|
-
import { appSyncAdapter } from "./sync/appSyncAdapter.js";
|
|
25
|
-
import { useDeviceIdentity } from "./deviceIdentity.js";
|
|
26
|
-
import { registerToolAdapters } from "@buoy-gg/shared-ui";
|
|
27
|
-
|
|
28
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
29
|
-
|
|
30
|
-
// Module-level guarded requires: presence is constant for the app lifetime,
|
|
31
|
-
// so hooks pulled from these modules keep a stable call order.
|
|
32
|
-
//
|
|
33
|
-
// IMPORTANT: each require() must sit LEXICALLY inside its own try block
|
|
34
|
-
// (same pattern as autoDiscoverPresets) — Metro only marks a dependency as
|
|
35
|
-
// optional when the require is directly inside a try statement. Wrapping it
|
|
36
|
-
// in a helper/arrow makes Metro hard-fail the bundle for apps that don't
|
|
37
|
-
// install that package.
|
|
38
|
-
let externalSyncModule = null;
|
|
39
|
-
let storageModule = null;
|
|
40
|
-
let networkModule = null;
|
|
41
|
-
let reactQueryModule = null;
|
|
42
|
-
let routeEventsModule = null;
|
|
43
|
-
let reduxModule = null;
|
|
44
|
-
let zustandModule = null;
|
|
45
|
-
let jotaiModule = null;
|
|
46
|
-
let eventsModule = null;
|
|
47
|
-
let consoleModule = null;
|
|
48
|
-
let sentryModule = null;
|
|
49
|
-
let envModule = null;
|
|
50
|
-
let highlightUpdatesModule = null;
|
|
51
|
-
let debugBordersModule = null;
|
|
52
|
-
let impersonateModule = null;
|
|
53
|
-
let perfMonitorModule = null;
|
|
54
|
-
let jsTopModule = null;
|
|
55
|
-
let imagesModule = null;
|
|
56
|
-
let assetsModule = null;
|
|
57
|
-
let tvRemoteModule = null;
|
|
58
|
-
let focusInspectorModule = null;
|
|
59
|
-
let expoConstantsModule = null;
|
|
60
|
-
|
|
61
|
-
// Catch bodies report through reportOptionalRequireError: silent for a
|
|
62
|
-
// genuinely absent package, one dev warning when an installed package fails
|
|
63
|
-
// to load (broken transitive resolve, top-level crash).
|
|
64
|
-
try {
|
|
65
|
-
externalSyncModule = require("@buoy-gg/external-sync");
|
|
66
|
-
} catch (e) {
|
|
67
|
-
reportOptionalRequireError("@buoy-gg/external-sync", e);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
storageModule = require("@buoy-gg/storage");
|
|
71
|
-
} catch (e) {
|
|
72
|
-
reportOptionalRequireError("@buoy-gg/storage", e);
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
networkModule = require("@buoy-gg/network");
|
|
76
|
-
} catch (e) {
|
|
77
|
-
reportOptionalRequireError("@buoy-gg/network", e);
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
reactQueryModule = require("@buoy-gg/react-query");
|
|
81
|
-
} catch (e) {
|
|
82
|
-
reportOptionalRequireError("@buoy-gg/react-query", e);
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
routeEventsModule = require("@buoy-gg/route-events");
|
|
86
|
-
} catch (e) {
|
|
87
|
-
reportOptionalRequireError("@buoy-gg/route-events", e);
|
|
88
|
-
}
|
|
89
|
-
try {
|
|
90
|
-
reduxModule = require("@buoy-gg/redux");
|
|
91
|
-
} catch (e) {
|
|
92
|
-
reportOptionalRequireError("@buoy-gg/redux", e);
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
zustandModule = require("@buoy-gg/zustand");
|
|
96
|
-
} catch (e) {
|
|
97
|
-
reportOptionalRequireError("@buoy-gg/zustand", e);
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
jotaiModule = require("@buoy-gg/jotai");
|
|
101
|
-
} catch (e) {
|
|
102
|
-
reportOptionalRequireError("@buoy-gg/jotai", e);
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
eventsModule = require("@buoy-gg/events");
|
|
106
|
-
} catch (e) {
|
|
107
|
-
reportOptionalRequireError("@buoy-gg/events", e);
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
consoleModule = require("@buoy-gg/console");
|
|
111
|
-
} catch (e) {
|
|
112
|
-
reportOptionalRequireError("@buoy-gg/console", e);
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
sentryModule = require("@buoy-gg/sentry");
|
|
116
|
-
} catch (e) {
|
|
117
|
-
reportOptionalRequireError("@buoy-gg/sentry", e);
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
envModule = require("@buoy-gg/env");
|
|
121
|
-
} catch (e) {
|
|
122
|
-
reportOptionalRequireError("@buoy-gg/env", e);
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
highlightUpdatesModule = require("@buoy-gg/highlight-updates");
|
|
126
|
-
} catch (e) {
|
|
127
|
-
reportOptionalRequireError("@buoy-gg/highlight-updates", e);
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
debugBordersModule = require("@buoy-gg/debug-borders");
|
|
131
|
-
} catch (e) {
|
|
132
|
-
reportOptionalRequireError("@buoy-gg/debug-borders", e);
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
impersonateModule = require("@buoy-gg/impersonate");
|
|
136
|
-
} catch (e) {
|
|
137
|
-
reportOptionalRequireError("@buoy-gg/impersonate", e);
|
|
138
|
-
}
|
|
139
|
-
try {
|
|
140
|
-
perfMonitorModule = require("@buoy-gg/perf-monitor");
|
|
141
|
-
} catch (e) {
|
|
142
|
-
reportOptionalRequireError("@buoy-gg/perf-monitor", e);
|
|
143
|
-
}
|
|
144
|
-
try {
|
|
145
|
-
jsTopModule = require("@buoy-gg/js-top");
|
|
146
|
-
} catch (e) {
|
|
147
|
-
reportOptionalRequireError("@buoy-gg/js-top", e);
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
imagesModule = require("@buoy-gg/images");
|
|
151
|
-
} catch (e) {
|
|
152
|
-
reportOptionalRequireError("@buoy-gg/images", e);
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
assetsModule = require("@buoy-gg/assets");
|
|
156
|
-
} catch (e) {
|
|
157
|
-
reportOptionalRequireError("@buoy-gg/assets", e);
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
tvRemoteModule = require("@buoy-gg/tv-remote");
|
|
161
|
-
} catch (e) {
|
|
162
|
-
reportOptionalRequireError("@buoy-gg/tv-remote", e);
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
focusInspectorModule = require("@buoy-gg/focus-inspector");
|
|
166
|
-
} catch (e) {
|
|
167
|
-
reportOptionalRequireError("@buoy-gg/focus-inspector", e);
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
expoConstantsModule = require("expo-constants");
|
|
171
|
-
} catch (e) {
|
|
172
|
-
// not installed (RN CLI apps) — still report real load failures
|
|
173
|
-
reportOptionalRequireError("expo-constants", e);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/** Whether zero-config sync can run (the external-sync package is installed). */
|
|
177
|
-
export function isExternalSyncAvailable() {
|
|
178
|
-
return !!externalSyncModule?.useExternalSyncSocket;
|
|
179
|
-
}
|
|
180
|
-
function getAppName() {
|
|
181
|
-
const constants = expoConstantsModule?.default ?? expoConstantsModule;
|
|
182
|
-
return constants?.expoConfig?.name ?? constants?.manifest2?.extra?.expoClient?.name ?? null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/** expo-constants' `deviceName`: the simulator's name on a sim, the model on Android. */
|
|
186
|
-
function getHardwareName() {
|
|
187
|
-
const constants = expoConstantsModule?.default ?? expoConstantsModule;
|
|
188
|
-
const name = constants?.deviceName;
|
|
189
|
-
return typeof name === "string" && name.length > 0 ? name : null;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Build the `toolId -> sync adapter` map from whatever tool packages the app
|
|
193
|
-
* installed.
|
|
194
|
-
*
|
|
195
|
-
* Extracted out of AutoExternalSync so the map can be published on-device
|
|
196
|
-
* WITHOUT opening a broker socket. It used to be inline, which quietly welded
|
|
197
|
-
* the two together: `registerToolAdapters` had exactly one caller, inside a
|
|
198
|
-
* component that only mounts when the sync gate passes, so in any build where
|
|
199
|
-
* the broker path was closed the on-device registry was empty too and every
|
|
200
|
-
* `dispatchToolAction` threw `Unknown tool`. Anything that drives tools from
|
|
201
|
-
* inside the app — the Scenarios runner, Ask Buoy — needs the map without the
|
|
202
|
-
* socket.
|
|
203
|
-
*/
|
|
204
|
-
export function useToolAdapterMap({
|
|
205
|
-
requiredEnvVars,
|
|
206
|
-
customApps
|
|
207
|
-
}) {
|
|
208
|
-
// Context-based query adapter; null when there is no QueryClientProvider
|
|
209
|
-
// above FloatingDevTools (or the installed @buoy-gg/react-query predates
|
|
210
|
-
// the hook).
|
|
211
|
-
const queryAdapter = reactQueryModule?.useReactQuerySyncAdapter ? reactQueryModule.useReactQuerySyncAdapter() : null;
|
|
212
|
-
return useToolAdapterMapInner(queryAdapter, requiredEnvVars, customApps);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Publish the adapter map on-device, with no socket and no external-sync
|
|
217
|
-
* dependency.
|
|
218
|
-
*
|
|
219
|
-
* Mounted unconditionally by FloatingDevTools. A getter is registered rather
|
|
220
|
-
* than a snapshot for the same reason `attachDeviceSync` does it: the memo is
|
|
221
|
-
* rebuilt whenever its inputs change, and a captured copy would keep
|
|
222
|
-
* dispatching into adapters the tree has already replaced.
|
|
223
|
-
*/
|
|
224
|
-
export function ToolRegistryPublisher({
|
|
225
|
-
requiredEnvVars,
|
|
226
|
-
customApps
|
|
227
|
-
}) {
|
|
228
|
-
const tools = useToolAdapterMap({
|
|
229
|
-
requiredEnvVars,
|
|
230
|
-
customApps
|
|
231
|
-
});
|
|
232
|
-
const toolsRef = useRef(tools);
|
|
233
|
-
toolsRef.current = tools;
|
|
234
|
-
useEffect(() => registerToolAdapters(() => toolsRef.current), []);
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
export function AutoExternalSync({
|
|
238
|
-
options,
|
|
239
|
-
requiredEnvVars,
|
|
240
|
-
isPro,
|
|
241
|
-
tier,
|
|
242
|
-
licenseKey,
|
|
243
|
-
customApps
|
|
244
|
-
}) {
|
|
245
|
-
const {
|
|
246
|
-
useExternalSyncSocket,
|
|
247
|
-
useExternalSync
|
|
248
|
-
} = externalSyncModule;
|
|
249
|
-
const tools = useToolAdapterMap({
|
|
250
|
-
requiredEnvVars,
|
|
251
|
-
customApps
|
|
252
|
-
});
|
|
253
|
-
const identity = useDeviceIdentity(options, {
|
|
254
|
-
appName: getAppName(),
|
|
255
|
-
hardwareName: getHardwareName(),
|
|
256
|
-
platform: Platform.OS
|
|
257
|
-
});
|
|
258
|
-
const deviceId = identity?.deviceId ?? null;
|
|
259
|
-
const {
|
|
260
|
-
socket
|
|
261
|
-
} = useExternalSyncSocket({
|
|
262
|
-
deviceName: identity?.deviceName ?? "Buoy Device",
|
|
263
|
-
// Older external-sync versions predate getDefaultSocketURL and require
|
|
264
|
-
// an explicit URL — keep the literal fallback for them.
|
|
265
|
-
socketURL: options?.socketURL ?? externalSyncModule.getDefaultSocketURL?.() ?? "http://localhost:42831",
|
|
266
|
-
persistentDeviceId: deviceId,
|
|
267
|
-
platform: Platform.OS,
|
|
268
|
-
enableLogs: options?.enableLogs
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// The license validates asynchronously (Keygen call on mount), usually AFTER
|
|
272
|
-
// the socket handshake is already sent — so the one-shot handshake query
|
|
273
|
-
// can't carry Pro status reliably. Emit it as an event whenever it resolves
|
|
274
|
-
// or changes, and on every (re)connect. The broker stores it on the device
|
|
275
|
-
// record and rebroadcasts, so the desktop dashboard can auto-adopt the key.
|
|
276
|
-
const licenseRef = useRef({
|
|
277
|
-
isPro,
|
|
278
|
-
tier,
|
|
279
|
-
licenseKey
|
|
280
|
-
});
|
|
281
|
-
licenseRef.current = {
|
|
282
|
-
isPro,
|
|
283
|
-
tier,
|
|
284
|
-
licenseKey
|
|
285
|
-
};
|
|
286
|
-
useEffect(() => {
|
|
287
|
-
if (!socket) return;
|
|
288
|
-
const emitLicense = () => {
|
|
289
|
-
if (!LicenseManager.hasAccountAccess() || !socket.connected) return;
|
|
290
|
-
socket.emit("device-license", {
|
|
291
|
-
isPro: licenseRef.current.isPro ? "1" : "0",
|
|
292
|
-
// Brokers older than the tier split ignore this; newer ones prefer it.
|
|
293
|
-
tier: licenseRef.current.tier ?? (licenseRef.current.isPro ? "pro" : "free")
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
if (socket.connected) emitLicense();
|
|
297
|
-
socket.on("connect", emitLicense);
|
|
298
|
-
return () => {
|
|
299
|
-
socket.off("connect", emitLicense);
|
|
300
|
-
};
|
|
301
|
-
}, [socket, isPro, tier, licenseKey]);
|
|
302
|
-
useExternalSync({
|
|
303
|
-
tools,
|
|
304
|
-
socket,
|
|
305
|
-
deviceId,
|
|
306
|
-
enableLogs: options?.enableLogs
|
|
307
|
-
});
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* The map itself. Split from `useToolAdapterMap` only so the react-query hook
|
|
313
|
-
* is called at a stable position while the memo takes its result as a plain
|
|
314
|
-
* dependency.
|
|
315
|
-
*/
|
|
316
|
-
function useToolAdapterMapInner(queryAdapter, requiredEnvVars, customApps) {
|
|
317
|
-
return useMemo(() => {
|
|
318
|
-
// Core's own adapter — device-level capabilities (JS-bundle reload) that
|
|
319
|
-
// don't belong to any tool package. Registered unconditionally so remote
|
|
320
|
-
// drivers can rely on it for every app, whatever tools are installed.
|
|
321
|
-
const map = {
|
|
322
|
-
app: appSyncAdapter
|
|
323
|
-
};
|
|
324
|
-
if (storageModule?.storageSyncAdapter) {
|
|
325
|
-
map.storage = storageModule.storageSyncAdapter;
|
|
326
|
-
}
|
|
327
|
-
if (networkModule?.networkSyncAdapter) {
|
|
328
|
-
map.network = networkModule.networkSyncAdapter;
|
|
329
|
-
}
|
|
330
|
-
if (queryAdapter) {
|
|
331
|
-
map.query = queryAdapter;
|
|
332
|
-
}
|
|
333
|
-
if (routeEventsModule?.routeEventsSyncAdapter) {
|
|
334
|
-
map["route-events"] = routeEventsModule.routeEventsSyncAdapter;
|
|
335
|
-
}
|
|
336
|
-
if (reduxModule?.reduxSyncAdapter) {
|
|
337
|
-
map.redux = reduxModule.reduxSyncAdapter;
|
|
338
|
-
}
|
|
339
|
-
if (zustandModule?.zustandSyncAdapter) {
|
|
340
|
-
map.zustand = zustandModule.zustandSyncAdapter;
|
|
341
|
-
}
|
|
342
|
-
if (jotaiModule?.jotaiSyncAdapter) {
|
|
343
|
-
map.jotai = jotaiModule.jotaiSyncAdapter;
|
|
344
|
-
}
|
|
345
|
-
if (eventsModule?.eventsSyncAdapter) {
|
|
346
|
-
map.events = eventsModule.eventsSyncAdapter;
|
|
347
|
-
}
|
|
348
|
-
if (consoleModule?.consoleSyncAdapter) {
|
|
349
|
-
map.console = consoleModule.consoleSyncAdapter;
|
|
350
|
-
}
|
|
351
|
-
if (sentryModule?.sentrySyncAdapter) {
|
|
352
|
-
map.sentry = sentryModule.sentrySyncAdapter;
|
|
353
|
-
}
|
|
354
|
-
// Lazy: time-machine imports `@buoy-gg/core` (useToolHost), and this file
|
|
355
|
-
// is loaded from core's index. Requiring it at module top-level is a
|
|
356
|
-
// require cycle (LogBox on every reload). Waiting until first render
|
|
357
|
-
// lets core finish evaluating first.
|
|
358
|
-
try {
|
|
359
|
-
const timeMachineModule = require("@buoy-gg/time-machine");
|
|
360
|
-
if (timeMachineModule?.timeMachineSyncAdapter) {
|
|
361
|
-
map["time-machine"] = timeMachineModule.timeMachineSyncAdapter;
|
|
362
|
-
}
|
|
363
|
-
} catch (e) {
|
|
364
|
-
reportOptionalRequireError("@buoy-gg/time-machine", e);
|
|
365
|
-
}
|
|
366
|
-
// Lazy for the same reason as time-machine: scenarios imports
|
|
367
|
-
// `@buoy-gg/core` for useToolHost/useToolHeader.
|
|
368
|
-
try {
|
|
369
|
-
const scenariosModule = require("@buoy-gg/scenarios");
|
|
370
|
-
if (scenariosModule?.scenariosSyncAdapter) {
|
|
371
|
-
map.scenarios = scenariosModule.scenariosSyncAdapter;
|
|
372
|
-
}
|
|
373
|
-
} catch (e) {
|
|
374
|
-
reportOptionalRequireError("@buoy-gg/scenarios", e);
|
|
375
|
-
}
|
|
376
|
-
// Lazy, same require-cycle reason as time-machine and scenarios: the
|
|
377
|
-
// ask-buoy package imports `@buoy-gg/core` for the tool-host hooks.
|
|
378
|
-
try {
|
|
379
|
-
const askBuoyModule = require("@buoy-gg/ask-buoy");
|
|
380
|
-
if (askBuoyModule?.askBuoySyncAdapter) {
|
|
381
|
-
map["ask-buoy"] = askBuoyModule.askBuoySyncAdapter;
|
|
382
|
-
}
|
|
383
|
-
} catch (e) {
|
|
384
|
-
reportOptionalRequireError("@buoy-gg/ask-buoy", e);
|
|
385
|
-
}
|
|
386
|
-
if (envModule?.createEnvSyncAdapter) {
|
|
387
|
-
map.env = envModule.createEnvSyncAdapter(requiredEnvVars ?? []);
|
|
388
|
-
}
|
|
389
|
-
if (highlightUpdatesModule?.highlightUpdatesSyncAdapter) {
|
|
390
|
-
map["highlight-updates"] = highlightUpdatesModule.highlightUpdatesSyncAdapter;
|
|
391
|
-
}
|
|
392
|
-
if (debugBordersModule?.debugBordersSyncAdapter) {
|
|
393
|
-
map["debug-borders"] = debugBordersModule.debugBordersSyncAdapter;
|
|
394
|
-
}
|
|
395
|
-
if (impersonateModule?.impersonateSyncAdapter) {
|
|
396
|
-
map.impersonate = impersonateModule.impersonateSyncAdapter;
|
|
397
|
-
}
|
|
398
|
-
if (perfMonitorModule?.perfMonitorSyncAdapter) {
|
|
399
|
-
map["perf-monitor"] = perfMonitorModule.perfMonitorSyncAdapter;
|
|
400
|
-
}
|
|
401
|
-
if (jsTopModule?.jsTopSyncAdapter) {
|
|
402
|
-
map["js-top"] = jsTopModule.jsTopSyncAdapter;
|
|
403
|
-
}
|
|
404
|
-
if (imagesModule?.imagesSyncAdapter) {
|
|
405
|
-
map.images = imagesModule.imagesSyncAdapter;
|
|
406
|
-
}
|
|
407
|
-
if (assetsModule?.assetsSyncAdapter) {
|
|
408
|
-
map.assets = assetsModule.assetsSyncAdapter;
|
|
409
|
-
}
|
|
410
|
-
if (tvRemoteModule?.tvRemoteSyncAdapter) {
|
|
411
|
-
map["tv-remote"] = tvRemoteModule.tvRemoteSyncAdapter;
|
|
412
|
-
}
|
|
413
|
-
if (focusInspectorModule?.focusInspectorSyncAdapter) {
|
|
414
|
-
map["focus-inspector"] = focusInspectorModule.focusInspectorSyncAdapter;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Third-party custom tools that declared InstalledApp.sync. Namespaced so
|
|
418
|
-
// a custom tool named "network" can't shadow the first-party adapter on
|
|
419
|
-
// the broker, in MCP call_action, or in desktop watch state.
|
|
420
|
-
for (const app of customApps ?? []) {
|
|
421
|
-
if (app?.sync) {
|
|
422
|
-
map[`custom:${app.id}`] = app.sync;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return map;
|
|
426
|
-
}, [queryAdapter, requiredEnvVars, customApps]);
|
|
427
|
-
}
|
|
1
|
+
"use strict";import{useEffect as z,useMemo as H,useRef as U}from"react";import{Platform as D}from"react-native";import{LicenseManager as $}from"@buoy-gg/license";import{reportOptionalRequireError as r}from"./optionalRequire.js";import{appSyncAdapter as F}from"./sync/appSyncAdapter.js";import{useDeviceIdentity as G}from"./deviceIdentity.js";import{registerToolAdapters as J}from"@buoy-gg/shared-ui";let i=null;let y=null;let g=null;let d=null;let p=null;let f=null;let b=null;let m=null;let S=null;let h=null;let A=null;let M=null;let v=null;try{v=require("@buoy-gg/notifications")}catch(e){r("@buoy-gg/notifications",e)}let q=null;let k=null;let x=null;let R=null;let j=null;let E=null;let L=null;let w=null;let I=null;let B=null;let a=null;try{i=require("@buoy-gg/external-sync")}catch(e){r("@buoy-gg/external-sync",e)}try{y=require("@buoy-gg/storage")}catch(e){r("@buoy-gg/storage",e)}try{g=require("@buoy-gg/network")}catch(e){r("@buoy-gg/network",e)}try{d=require("@buoy-gg/react-query")}catch(e){r("@buoy-gg/react-query",e)}try{p=require("@buoy-gg/route-events")}catch(e){r("@buoy-gg/route-events",e)}try{f=require("@buoy-gg/redux")}catch(e){r("@buoy-gg/redux",e)}try{b=require("@buoy-gg/zustand")}catch(e){r("@buoy-gg/zustand",e)}try{m=require("@buoy-gg/jotai")}catch(e){r("@buoy-gg/jotai",e)}try{S=require("@buoy-gg/events")}catch(e){r("@buoy-gg/events",e)}try{h=require("@buoy-gg/console")}catch(e){r("@buoy-gg/console",e)}try{A=require("@buoy-gg/clock")}catch(e){r("@buoy-gg/clock",e)}try{M=require("@buoy-gg/sentry")}catch(e){r("@buoy-gg/sentry",e)}try{q=require("@buoy-gg/env")}catch(e){r("@buoy-gg/env",e)}try{k=require("@buoy-gg/highlight-updates")}catch(e){r("@buoy-gg/highlight-updates",e)}try{x=require("@buoy-gg/debug-borders")}catch(e){r("@buoy-gg/debug-borders",e)}try{R=require("@buoy-gg/impersonate")}catch(e){r("@buoy-gg/impersonate",e)}try{j=require("@buoy-gg/perf-monitor")}catch(e){r("@buoy-gg/perf-monitor",e)}try{E=require("@buoy-gg/js-top")}catch(e){r("@buoy-gg/js-top",e)}try{L=require("@buoy-gg/images")}catch(e){r("@buoy-gg/images",e)}try{w=require("@buoy-gg/assets")}catch(e){r("@buoy-gg/assets",e)}try{I=require("@buoy-gg/tv-remote")}catch(e){r("@buoy-gg/tv-remote",e)}try{B=require("@buoy-gg/focus-inspector")}catch(e){r("@buoy-gg/focus-inspector",e)}try{a=require("expo-constants")}catch(e){r("expo-constants",e)}export function isExternalSyncAvailable(){return!!i?.useExternalSyncSocket}function W(){const e=a?.default??a;return e?.expoConfig?.name??e?.manifest2?.extra?.expoClient?.name??null}function X(){const e=a?.default??a;const n=e?.deviceName;return typeof n==="string"&&n.length>0?n:null}export function useToolAdapterMap({requiredEnvVars:e,customApps:n}){const c=d?.useReactQuerySyncAdapter?d.useReactQuerySyncAdapter():null;return Y(c,e,n)}export function ToolRegistryPublisher({requiredEnvVars:e,customApps:n}){const c=useToolAdapterMap({requiredEnvVars:e,customApps:n});const t=U(c);t.current=c;z(()=>J(()=>t.current),[]);return null}export function AutoExternalSync({options:e,requiredEnvVars:n,isPro:c,tier:t,licenseKey:o,customApps:C}){const{useExternalSyncSocket:O,useExternalSync:P}=i;const Q=useToolAdapterMap({requiredEnvVars:n,customApps:C});const N=G(e,{appName:W(),hardwareName:X(),platform:D.OS});const T=N?.deviceId??null;const{socket:u}=O({deviceName:N?.deviceName??"Buoy Device",socketURL:e?.socketURL??i.getDefaultSocketURL?.()??"http://localhost:42831",persistentDeviceId:T,platform:D.OS,enableLogs:e?.enableLogs});const s=U({isPro:c,tier:t,licenseKey:o});s.current={isPro:c,tier:t,licenseKey:o};z(()=>{if(!u)return;const l=()=>{if(!$.hasAccountAccess()||!u.connected)return;u.emit("device-license",{isPro:s.current.isPro?"1":"0",tier:s.current.tier??(s.current.isPro?"pro":"free")})};if(u.connected)l();u.on("connect",l);return()=>{u.off("connect",l)}},[u,c,t,o]);P({tools:Q,socket:u,deviceId:T,enableLogs:e?.enableLogs});return null}function Y(e,n,c){return H(()=>{const t={app:F};if(y?.storageSyncAdapter){t.storage=y.storageSyncAdapter}if(g?.networkSyncAdapter){t.network=g.networkSyncAdapter}if(e){t.query=e}if(p?.routeEventsSyncAdapter){t["route-events"]=p.routeEventsSyncAdapter}if(f?.reduxSyncAdapter){t.redux=f.reduxSyncAdapter}if(b?.zustandSyncAdapter){t.zustand=b.zustandSyncAdapter}if(m?.jotaiSyncAdapter){t.jotai=m.jotaiSyncAdapter}if(S?.eventsSyncAdapter){t.events=S.eventsSyncAdapter}if(h?.consoleSyncAdapter){t.console=h.consoleSyncAdapter}if(A?.clockSyncAdapter){t.clock=A.clockSyncAdapter}if(v?.notificationSyncAdapter){t["push-notifications"]=v.notificationSyncAdapter}if(M?.sentrySyncAdapter){t.sentry=M.sentrySyncAdapter}try{const o=require("@buoy-gg/time-machine");if(o?.timeMachineSyncAdapter){t["time-machine"]=o.timeMachineSyncAdapter}}catch(o){r("@buoy-gg/time-machine",o)}try{const o=require("@buoy-gg/scenarios");if(o?.scenariosSyncAdapter){t.scenarios=o.scenariosSyncAdapter}}catch(o){r("@buoy-gg/scenarios",o)}try{const o=require("@buoy-gg/ask-buoy");if(o?.askBuoySyncAdapter){t["ask-buoy"]=o.askBuoySyncAdapter}}catch(o){r("@buoy-gg/ask-buoy",o)}if(q?.createEnvSyncAdapter){t.env=q.createEnvSyncAdapter(n??[])}if(k?.highlightUpdatesSyncAdapter){t["highlight-updates"]=k.highlightUpdatesSyncAdapter}if(x?.debugBordersSyncAdapter){t["debug-borders"]=x.debugBordersSyncAdapter}if(R?.impersonateSyncAdapter){t.impersonate=R.impersonateSyncAdapter}if(j?.perfMonitorSyncAdapter){t["perf-monitor"]=j.perfMonitorSyncAdapter}if(E?.jsTopSyncAdapter){t["js-top"]=E.jsTopSyncAdapter}if(L?.imagesSyncAdapter){t.images=L.imagesSyncAdapter}if(w?.assetsSyncAdapter){t.assets=w.assetsSyncAdapter}if(I?.tvRemoteSyncAdapter){t["tv-remote"]=I.tvRemoteSyncAdapter}if(B?.focusInspectorSyncAdapter){t["focus-inspector"]=B.focusInspectorSyncAdapter}for(const o of c??[]){if(o?.sync){t[`custom:${o.id}`]=o.sync}}return t},[e,n,c])}
|
|
@@ -1,158 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type-safe default configuration for React Buoy DevTools.
|
|
5
|
-
*
|
|
6
|
-
* This module provides a simple, type-safe way for teams to configure
|
|
7
|
-
* which tools are enabled by default in the floating menu and dial menu.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { FloatingDevTools } from '@buoy-gg/core';
|
|
12
|
-
*
|
|
13
|
-
* // Simple: Enable specific tools by default
|
|
14
|
-
* <FloatingDevTools
|
|
15
|
-
* defaultFloatingTools={['env', 'environment', 'network']}
|
|
16
|
-
* defaultDialTools={['env', 'network', 'storage', 'query']}
|
|
17
|
-
* />
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* All known tool IDs that can appear in the floating menu or dial menu.
|
|
23
|
-
* This is a union type of all auto-discovered tool IDs.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
// Benchmark recording modal (@buoy-gg/perf-monitor)
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Special floating-only tool IDs that only appear in the floating bubble row.
|
|
30
|
-
*/
|
|
31
|
-
// Environment badge indicator
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* All tool IDs that can appear in the floating menu (bubble row).
|
|
35
|
-
* Includes all built-in tools plus floating-only tools.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Tool IDs that can appear in the dial menu.
|
|
40
|
-
* Same as BuiltInToolId (environment badge is floating-only).
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Maximum number of tools allowed in the dial menu.
|
|
45
|
-
*/
|
|
46
|
-
export const MAX_DIAL_TOOLS = 6;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Configuration for default floating menu tools.
|
|
50
|
-
* Pass an array of tool IDs to enable by default.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* const floatingDefaults: DefaultFloatingConfig = ['env', 'environment', 'network'];
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Configuration for default dial menu tools.
|
|
60
|
-
* Pass an array of 1-6 tool IDs to enable by default.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```tsx
|
|
64
|
-
* const dialDefaults: DefaultDialConfig = ['env', 'network', 'storage', 'query'];
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Validates and normalizes a dial configuration to not exceed the maximum allowed tools.
|
|
70
|
-
* If more than MAX_DIAL_TOOLS are provided, logs a warning and truncates to first 6 tools.
|
|
71
|
-
*
|
|
72
|
-
* @param tools - Array of dial tool IDs to validate
|
|
73
|
-
* @returns The original array if valid, or truncated array if too many tools
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```tsx
|
|
77
|
-
* // This returns as-is
|
|
78
|
-
* validateDialConfig(['env', 'network', 'storage']);
|
|
79
|
-
* // Returns: ['env', 'network', 'storage']
|
|
80
|
-
*
|
|
81
|
-
* // This truncates and warns
|
|
82
|
-
* validateDialConfig(['env', 'network', 'storage', 'query', 'route-events', 'debug-borders', 'highlight-updates']);
|
|
83
|
-
* // Console warning, returns: ['env', 'network', 'storage', 'query', 'route-events', 'debug-borders']
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export function validateDialConfig(tools) {
|
|
87
|
-
if (tools.length > MAX_DIAL_TOOLS) {
|
|
88
|
-
const toolList = tools.map(t => `"${t}"`).join(', ');
|
|
89
|
-
// console.warn(
|
|
90
|
-
// `[React Buoy] Dial menu configuration has ${tools.length} tools, but maximum is ${MAX_DIAL_TOOLS}. ` +
|
|
91
|
-
// `Tools provided: [${toolList}]. ` +
|
|
92
|
-
// `Only the first ${MAX_DIAL_TOOLS} tools will be shown.`
|
|
93
|
-
// );
|
|
94
|
-
return tools.slice(0, MAX_DIAL_TOOLS);
|
|
95
|
-
}
|
|
96
|
-
return tools;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Helper to create a type-safe default configuration.
|
|
101
|
-
* Provides autocomplete and validation at compile time.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```tsx
|
|
105
|
-
* import { createDefaultConfig } from '@buoy-gg/core';
|
|
106
|
-
*
|
|
107
|
-
* const config = createDefaultConfig({
|
|
108
|
-
* floating: ['env', 'environment', 'network', 'query-wifi-toggle'],
|
|
109
|
-
* dial: ['env', 'network', 'storage', 'query', 'route-events', 'debug-borders'],
|
|
110
|
-
* });
|
|
111
|
-
*
|
|
112
|
-
* <FloatingDevTools
|
|
113
|
-
* defaultFloatingTools={config.floating}
|
|
114
|
-
* defaultDialTools={config.dial}
|
|
115
|
-
* />
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export function createDefaultConfig(config) {
|
|
119
|
-
// Runtime validation for dial tools
|
|
120
|
-
if (config.dial) {
|
|
121
|
-
validateDialConfig(config.dial);
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
floating: config.floating,
|
|
125
|
-
dial: config.dial
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Type guard to check if a string is a valid FloatingToolId.
|
|
131
|
-
*/
|
|
132
|
-
export function isFloatingToolId(id) {
|
|
133
|
-
const validIds = ['env', 'network', 'storage', 'query', 'query-wifi-toggle', 'route-events', 'debug-borders', 'highlight-updates', 'highlight-updates-modal', 'environment'];
|
|
134
|
-
return validIds.includes(id);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Type guard to check if a string is a valid DialToolId.
|
|
139
|
-
*/
|
|
140
|
-
export function isDialToolId(id) {
|
|
141
|
-
const validIds = ['env', 'network', 'storage', 'query', 'query-wifi-toggle', 'route-events', 'debug-borders', 'highlight-updates', 'highlight-updates-modal'];
|
|
142
|
-
return validIds.includes(id);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Converts an array of tool IDs into a settings record.
|
|
147
|
-
* Used internally to convert default config to DevToolsSettings format.
|
|
148
|
-
*
|
|
149
|
-
* @internal
|
|
150
|
-
*/
|
|
151
|
-
export function toolIdsToRecord(ids, allPossibleIds) {
|
|
152
|
-
const record = {};
|
|
153
|
-
const enabledSet = new Set(ids);
|
|
154
|
-
for (const id of allPossibleIds) {
|
|
155
|
-
record[id] = enabledSet.has(id);
|
|
156
|
-
}
|
|
157
|
-
return record;
|
|
158
|
-
}
|
|
1
|
+
"use strict";export const MAX_DIAL_TOOLS=6;export function validateDialConfig(e){if(e.length>MAX_DIAL_TOOLS){const t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,MAX_DIAL_TOOLS)}return e}export function createDefaultConfig(e){if(e.dial){validateDialConfig(e.dial)}return{floating:e.floating,dial:e.dial}}export function isFloatingToolId(e){const t=["env","network","storage","query","query-wifi-toggle","route-events","debug-borders","highlight-updates","highlight-updates-modal","environment"];return t.includes(e)}export function isDialToolId(e){const t=["env","network","storage","query","query-wifi-toggle","route-events","debug-borders","highlight-updates","highlight-updates-modal"];return t.includes(e)}export function toolIdsToRecord(e,t){const o={};const n=new Set(e);for(const i of t){o[i]=n.has(i)}return o}
|