react-native-debug-toolkit 2.3.0 → 3.0.0
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/bin/debug-toolkit.js +114 -0
- package/lib/commonjs/features/network/index.js +28 -2
- package/lib/commonjs/features/network/index.js.map +1 -1
- package/lib/commonjs/features/network/networkInterceptor.js +14 -6
- package/lib/commonjs/features/network/networkInterceptor.js.map +1 -1
- package/lib/commonjs/index.js +59 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/panel/DebugPanel.js +25 -0
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -1
- package/lib/commonjs/ui/panel/FloatPanelView.js +15 -62
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -1
- package/lib/commonjs/ui/panel/StreamingSettingsModal.js +529 -0
- package/lib/commonjs/ui/panel/StreamingSettingsModal.js.map +1 -0
- package/lib/commonjs/ui/panel/useTabAnimation.js +71 -0
- package/lib/commonjs/ui/panel/useTabAnimation.js.map +1 -0
- package/lib/commonjs/utils/autoDetectDaemon.js +141 -0
- package/lib/commonjs/utils/autoDetectDaemon.js.map +1 -0
- package/lib/commonjs/utils/createPersistedObservableStore.js +23 -3
- package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -1
- package/lib/commonjs/utils/daemonConnection.js +81 -0
- package/lib/commonjs/utils/daemonConnection.js.map +1 -0
- package/lib/commonjs/utils/daemonSettings.js +110 -0
- package/lib/commonjs/utils/daemonSettings.js.map +1 -0
- package/lib/commonjs/utils/reportToDaemon.js +112 -0
- package/lib/commonjs/utils/reportToDaemon.js.map +1 -0
- package/lib/commonjs/utils/sessionReport.js +132 -0
- package/lib/commonjs/utils/sessionReport.js.map +1 -0
- package/lib/commonjs/utils/streamToDaemon.js +334 -0
- package/lib/commonjs/utils/streamToDaemon.js.map +1 -0
- package/lib/module/features/network/index.js +25 -1
- package/lib/module/features/network/index.js.map +1 -1
- package/lib/module/features/network/networkInterceptor.js +14 -6
- package/lib/module/features/network/networkInterceptor.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/panel/DebugPanel.js +26 -1
- package/lib/module/ui/panel/DebugPanel.js.map +1 -1
- package/lib/module/ui/panel/FloatPanelView.js +16 -63
- package/lib/module/ui/panel/FloatPanelView.js.map +1 -1
- package/lib/module/ui/panel/StreamingSettingsModal.js +524 -0
- package/lib/module/ui/panel/StreamingSettingsModal.js.map +1 -0
- package/lib/module/ui/panel/useTabAnimation.js +67 -0
- package/lib/module/ui/panel/useTabAnimation.js.map +1 -0
- package/lib/module/utils/autoDetectDaemon.js +136 -0
- package/lib/module/utils/autoDetectDaemon.js.map +1 -0
- package/lib/module/utils/createPersistedObservableStore.js +23 -3
- package/lib/module/utils/createPersistedObservableStore.js.map +1 -1
- package/lib/module/utils/daemonConnection.js +77 -0
- package/lib/module/utils/daemonConnection.js.map +1 -0
- package/lib/module/utils/daemonSettings.js +102 -0
- package/lib/module/utils/daemonSettings.js.map +1 -0
- package/lib/module/utils/reportToDaemon.js +105 -0
- package/lib/module/utils/reportToDaemon.js.map +1 -0
- package/lib/module/utils/sessionReport.js +128 -0
- package/lib/module/utils/sessionReport.js.map +1 -0
- package/lib/module/utils/streamToDaemon.js +328 -0
- package/lib/module/utils/streamToDaemon.js.map +1 -0
- package/lib/typescript/src/features/network/index.d.ts +2 -0
- package/lib/typescript/src/features/network/index.d.ts.map +1 -1
- package/lib/typescript/src/features/network/networkInterceptor.d.ts +1 -1
- package/lib/typescript/src/features/network/networkInterceptor.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/StreamingSettingsModal.d.ts +8 -0
- package/lib/typescript/src/ui/panel/StreamingSettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/useTabAnimation.d.ts +14 -0
- package/lib/typescript/src/ui/panel/useTabAnimation.d.ts.map +1 -0
- package/lib/typescript/src/utils/autoDetectDaemon.d.ts +15 -0
- package/lib/typescript/src/utils/autoDetectDaemon.d.ts.map +1 -0
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +2 -1
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/daemonConnection.d.ts +18 -0
- package/lib/typescript/src/utils/daemonConnection.d.ts.map +1 -0
- package/lib/typescript/src/utils/daemonSettings.d.ts +19 -0
- package/lib/typescript/src/utils/daemonSettings.d.ts.map +1 -0
- package/lib/typescript/src/utils/reportToDaemon.d.ts +34 -0
- package/lib/typescript/src/utils/reportToDaemon.d.ts.map +1 -0
- package/lib/typescript/src/utils/sessionReport.d.ts +18 -0
- package/lib/typescript/src/utils/sessionReport.d.ts.map +1 -0
- package/lib/typescript/src/utils/streamToDaemon.d.ts +23 -0
- package/lib/typescript/src/utils/streamToDaemon.d.ts.map +1 -0
- package/node/daemon/src/cli.js +75 -0
- package/node/daemon/src/console/console.html +936 -0
- package/node/daemon/src/console/index.js +47 -0
- package/node/daemon/src/constants.js +32 -0
- package/node/daemon/src/index.js +11 -0
- package/node/daemon/src/server.js +365 -0
- package/node/daemon/src/store.js +110 -0
- package/node/mcp/src/cli.js +31 -0
- package/node/mcp/src/constants.js +13 -0
- package/node/mcp/src/daemonClient.js +132 -0
- package/node/mcp/src/httpClient.js +49 -0
- package/node/mcp/src/index.js +15 -0
- package/node/mcp/src/logs.js +95 -0
- package/node/mcp/src/server.js +144 -0
- package/node/mcp/src/tools.js +84 -0
- package/package.json +7 -2
- package/src/features/network/index.ts +30 -3
- package/src/features/network/networkInterceptor.ts +19 -6
- package/src/index.ts +14 -0
- package/src/ui/panel/DebugPanel.tsx +23 -1
- package/src/ui/panel/FloatPanelView.tsx +10 -68
- package/src/ui/panel/StreamingSettingsModal.tsx +566 -0
- package/src/ui/panel/useTabAnimation.ts +77 -0
- package/src/utils/autoDetectDaemon.ts +175 -0
- package/src/utils/createPersistedObservableStore.ts +16 -3
- package/src/utils/daemonConnection.ts +133 -0
- package/src/utils/daemonSettings.ts +134 -0
- package/src/utils/reportToDaemon.ts +172 -0
- package/src/utils/sessionReport.ts +203 -0
- package/src/utils/streamToDaemon.ts +419 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useWindowDimensions,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import { Colors } from '../theme/colors';
|
|
13
|
+
import { StreamingSettingsModal } from './StreamingSettingsModal';
|
|
13
14
|
|
|
14
15
|
interface DebugPanelProps {
|
|
15
16
|
onClose: () => void;
|
|
@@ -21,6 +22,7 @@ export function DebugPanel({ onClose, onClearAll, children }: DebugPanelProps) {
|
|
|
21
22
|
const { height: screenHeight } = useWindowDimensions();
|
|
22
23
|
const panelTranslateY = useRef(new Animated.Value(screenHeight)).current;
|
|
23
24
|
const backdropOpacity = useRef(new Animated.Value(0)).current;
|
|
25
|
+
const [settingsVisible, setSettingsVisible] = useState(false);
|
|
24
26
|
|
|
25
27
|
useEffect(() => {
|
|
26
28
|
requestAnimationFrame(() => {
|
|
@@ -101,6 +103,13 @@ export function DebugPanel({ onClose, onClearAll, children }: DebugPanelProps) {
|
|
|
101
103
|
<View style={styles.header}>
|
|
102
104
|
<Text style={styles.headerTitle}>Debug Toolkit</Text>
|
|
103
105
|
<View style={styles.headerButtons}>
|
|
106
|
+
<TouchableOpacity
|
|
107
|
+
onPress={() => setSettingsVisible(true)}
|
|
108
|
+
style={styles.settingsButton}
|
|
109
|
+
activeOpacity={0.6}
|
|
110
|
+
>
|
|
111
|
+
<Text style={styles.settingsButtonText}>⚙</Text>
|
|
112
|
+
</TouchableOpacity>
|
|
104
113
|
<TouchableOpacity
|
|
105
114
|
onPress={() => {
|
|
106
115
|
onClearAll();
|
|
@@ -119,6 +128,7 @@ export function DebugPanel({ onClose, onClearAll, children }: DebugPanelProps) {
|
|
|
119
128
|
</View>
|
|
120
129
|
<View style={styles.panelContent}>{children}</View>
|
|
121
130
|
</Animated.View>
|
|
131
|
+
<StreamingSettingsModal visible={settingsVisible} onClose={() => setSettingsVisible(false)} />
|
|
122
132
|
</View>
|
|
123
133
|
);
|
|
124
134
|
}
|
|
@@ -198,6 +208,18 @@ const styles = StyleSheet.create({
|
|
|
198
208
|
fontSize: 14,
|
|
199
209
|
fontWeight: '500',
|
|
200
210
|
},
|
|
211
|
+
settingsButton: {
|
|
212
|
+
width: 32,
|
|
213
|
+
height: 32,
|
|
214
|
+
borderRadius: 16,
|
|
215
|
+
backgroundColor: Colors.background,
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
},
|
|
219
|
+
settingsButtonText: {
|
|
220
|
+
fontSize: 16,
|
|
221
|
+
color: Colors.textSecondary,
|
|
222
|
+
},
|
|
201
223
|
closeButton: {
|
|
202
224
|
width: 30,
|
|
203
225
|
height: 30,
|
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
Text,
|
|
5
5
|
StyleSheet,
|
|
6
6
|
Animated,
|
|
7
|
-
PanResponder,
|
|
8
|
-
Easing,
|
|
9
7
|
} from 'react-native';
|
|
10
8
|
import type { AnyDebugFeature } from '../../types';
|
|
11
9
|
import { getPreference, setPreference, KEYS } from '../../utils/debugPreferences';
|
|
@@ -13,6 +11,7 @@ import { FloatIcon } from '../floating/FloatIcon';
|
|
|
13
11
|
import { DebugPanel } from './DebugPanel';
|
|
14
12
|
import { FeatureTabBar } from './FeatureTabBar';
|
|
15
13
|
import type { TabItem } from './FeatureTabBar';
|
|
14
|
+
import { useTabAnimation } from './useTabAnimation';
|
|
16
15
|
|
|
17
16
|
// ─── Error Boundary ────────────────────────────────────
|
|
18
17
|
interface ErrorBoundaryState {
|
|
@@ -66,34 +65,14 @@ export function FloatPanelView({ features, panelOpen, onOpenPanel, onClosePanel,
|
|
|
66
65
|
return () => { mounted = false; };
|
|
67
66
|
}, []);
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const featuresLengthRef = useRef(features.length);
|
|
78
|
-
featuresLengthRef.current = features.length;
|
|
79
|
-
const switchTabRef = useRef<(index: number) => void>(() => {});
|
|
80
|
-
|
|
81
|
-
// Swipe-to-switch responder
|
|
82
|
-
const swipeResponder = useRef(
|
|
83
|
-
PanResponder.create({
|
|
84
|
-
onStartShouldSetPanResponder: () => false,
|
|
85
|
-
onMoveShouldSetPanResponder: (_, gs) => {
|
|
86
|
-
if (isSwitchingTab.current) return false;
|
|
87
|
-
return Math.abs(gs.dx) > 25 && Math.abs(gs.dx) > Math.abs(gs.dy) * 2.5;
|
|
88
|
-
},
|
|
89
|
-
onPanResponderRelease: (_, gs) => {
|
|
90
|
-
const tab = activeTabRef.current;
|
|
91
|
-
if (gs.dx < -40 && tab < featuresLengthRef.current - 1) switchTabRef.current(tab + 1);
|
|
92
|
-
else if (gs.dx > 40 && tab > 0) switchTabRef.current(tab - 1);
|
|
93
|
-
},
|
|
94
|
-
onPanResponderTerminationRequest: () => true,
|
|
95
|
-
}),
|
|
96
|
-
).current;
|
|
68
|
+
const { contentOpacity, contentTranslateX, panHandlers, switchTab } = useTabAnimation({
|
|
69
|
+
activeTab,
|
|
70
|
+
tabCount: features.length,
|
|
71
|
+
onTabChange: useCallback((index: number) => {
|
|
72
|
+
setActiveTab(index);
|
|
73
|
+
setPreference(KEYS.lastTab, String(index));
|
|
74
|
+
}, []),
|
|
75
|
+
});
|
|
97
76
|
|
|
98
77
|
// Feature subscription → re-render on data changes
|
|
99
78
|
const [, setTick] = useState(0);
|
|
@@ -122,43 +101,6 @@ export function FloatPanelView({ features, panelOpen, onOpenPanel, onClosePanel,
|
|
|
122
101
|
}
|
|
123
102
|
}, [features.length, activeTab]);
|
|
124
103
|
|
|
125
|
-
// Tab switching with content animation
|
|
126
|
-
const switchTab = useCallback(
|
|
127
|
-
(index: number) => {
|
|
128
|
-
if (isSwitchingTab.current || index === activeTabRef.current) return;
|
|
129
|
-
isSwitchingTab.current = true;
|
|
130
|
-
const direction = index > activeTabRef.current ? 1 : -1;
|
|
131
|
-
|
|
132
|
-
Animated.parallel([
|
|
133
|
-
Animated.timing(contentOpacity, { toValue: 0, duration: 80, useNativeDriver: true }),
|
|
134
|
-
Animated.timing(contentTranslateX, {
|
|
135
|
-
toValue: -direction * 40,
|
|
136
|
-
duration: 80,
|
|
137
|
-
useNativeDriver: true,
|
|
138
|
-
}),
|
|
139
|
-
]).start(() => {
|
|
140
|
-
setActiveTab(index);
|
|
141
|
-
setPreference(KEYS.lastTab, String(index));
|
|
142
|
-
contentTranslateX.setValue(direction * 40);
|
|
143
|
-
Animated.parallel([
|
|
144
|
-
Animated.timing(contentOpacity, { toValue: 1, duration: 150, useNativeDriver: true }),
|
|
145
|
-
Animated.timing(contentTranslateX, {
|
|
146
|
-
toValue: 0,
|
|
147
|
-
duration: 200,
|
|
148
|
-
easing: Easing.out(Easing.cubic),
|
|
149
|
-
useNativeDriver: true,
|
|
150
|
-
}),
|
|
151
|
-
]).start(() => {
|
|
152
|
-
isSwitchingTab.current = false;
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
[contentOpacity, contentTranslateX],
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
// Keep ref in sync
|
|
160
|
-
switchTabRef.current = switchTab;
|
|
161
|
-
|
|
162
104
|
// Badge (first feature that returns one)
|
|
163
105
|
const envBadge = features.map((f) => f.badge?.()).find((b) => b != null) ?? null;
|
|
164
106
|
const tabs: TabItem[] = features.map((f) => ({ label: f.label, id: f.name }));
|
|
@@ -195,7 +137,7 @@ export function FloatPanelView({ features, panelOpen, onOpenPanel, onClosePanel,
|
|
|
195
137
|
styles.contentContainer,
|
|
196
138
|
{ opacity: contentOpacity, transform: [{ translateX: contentTranslateX }] },
|
|
197
139
|
]}
|
|
198
|
-
{...
|
|
140
|
+
{...panHandlers}
|
|
199
141
|
>
|
|
200
142
|
{renderFeatureContent()}
|
|
201
143
|
</Animated.View>
|