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.
Files changed (113) hide show
  1. package/bin/debug-toolkit.js +114 -0
  2. package/lib/commonjs/features/network/index.js +28 -2
  3. package/lib/commonjs/features/network/index.js.map +1 -1
  4. package/lib/commonjs/features/network/networkInterceptor.js +14 -6
  5. package/lib/commonjs/features/network/networkInterceptor.js.map +1 -1
  6. package/lib/commonjs/index.js +59 -0
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/ui/panel/DebugPanel.js +25 -0
  9. package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -1
  10. package/lib/commonjs/ui/panel/FloatPanelView.js +15 -62
  11. package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -1
  12. package/lib/commonjs/ui/panel/StreamingSettingsModal.js +529 -0
  13. package/lib/commonjs/ui/panel/StreamingSettingsModal.js.map +1 -0
  14. package/lib/commonjs/ui/panel/useTabAnimation.js +71 -0
  15. package/lib/commonjs/ui/panel/useTabAnimation.js.map +1 -0
  16. package/lib/commonjs/utils/autoDetectDaemon.js +141 -0
  17. package/lib/commonjs/utils/autoDetectDaemon.js.map +1 -0
  18. package/lib/commonjs/utils/createPersistedObservableStore.js +23 -3
  19. package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -1
  20. package/lib/commonjs/utils/daemonConnection.js +81 -0
  21. package/lib/commonjs/utils/daemonConnection.js.map +1 -0
  22. package/lib/commonjs/utils/daemonSettings.js +110 -0
  23. package/lib/commonjs/utils/daemonSettings.js.map +1 -0
  24. package/lib/commonjs/utils/reportToDaemon.js +112 -0
  25. package/lib/commonjs/utils/reportToDaemon.js.map +1 -0
  26. package/lib/commonjs/utils/sessionReport.js +132 -0
  27. package/lib/commonjs/utils/sessionReport.js.map +1 -0
  28. package/lib/commonjs/utils/streamToDaemon.js +334 -0
  29. package/lib/commonjs/utils/streamToDaemon.js.map +1 -0
  30. package/lib/module/features/network/index.js +25 -1
  31. package/lib/module/features/network/index.js.map +1 -1
  32. package/lib/module/features/network/networkInterceptor.js +14 -6
  33. package/lib/module/features/network/networkInterceptor.js.map +1 -1
  34. package/lib/module/index.js +5 -0
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/ui/panel/DebugPanel.js +26 -1
  37. package/lib/module/ui/panel/DebugPanel.js.map +1 -1
  38. package/lib/module/ui/panel/FloatPanelView.js +16 -63
  39. package/lib/module/ui/panel/FloatPanelView.js.map +1 -1
  40. package/lib/module/ui/panel/StreamingSettingsModal.js +524 -0
  41. package/lib/module/ui/panel/StreamingSettingsModal.js.map +1 -0
  42. package/lib/module/ui/panel/useTabAnimation.js +67 -0
  43. package/lib/module/ui/panel/useTabAnimation.js.map +1 -0
  44. package/lib/module/utils/autoDetectDaemon.js +136 -0
  45. package/lib/module/utils/autoDetectDaemon.js.map +1 -0
  46. package/lib/module/utils/createPersistedObservableStore.js +23 -3
  47. package/lib/module/utils/createPersistedObservableStore.js.map +1 -1
  48. package/lib/module/utils/daemonConnection.js +77 -0
  49. package/lib/module/utils/daemonConnection.js.map +1 -0
  50. package/lib/module/utils/daemonSettings.js +102 -0
  51. package/lib/module/utils/daemonSettings.js.map +1 -0
  52. package/lib/module/utils/reportToDaemon.js +105 -0
  53. package/lib/module/utils/reportToDaemon.js.map +1 -0
  54. package/lib/module/utils/sessionReport.js +128 -0
  55. package/lib/module/utils/sessionReport.js.map +1 -0
  56. package/lib/module/utils/streamToDaemon.js +328 -0
  57. package/lib/module/utils/streamToDaemon.js.map +1 -0
  58. package/lib/typescript/src/features/network/index.d.ts +2 -0
  59. package/lib/typescript/src/features/network/index.d.ts.map +1 -1
  60. package/lib/typescript/src/features/network/networkInterceptor.d.ts +1 -1
  61. package/lib/typescript/src/features/network/networkInterceptor.d.ts.map +1 -1
  62. package/lib/typescript/src/index.d.ts +10 -0
  63. package/lib/typescript/src/index.d.ts.map +1 -1
  64. package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -1
  65. package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -1
  66. package/lib/typescript/src/ui/panel/StreamingSettingsModal.d.ts +8 -0
  67. package/lib/typescript/src/ui/panel/StreamingSettingsModal.d.ts.map +1 -0
  68. package/lib/typescript/src/ui/panel/useTabAnimation.d.ts +14 -0
  69. package/lib/typescript/src/ui/panel/useTabAnimation.d.ts.map +1 -0
  70. package/lib/typescript/src/utils/autoDetectDaemon.d.ts +15 -0
  71. package/lib/typescript/src/utils/autoDetectDaemon.d.ts.map +1 -0
  72. package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +2 -1
  73. package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -1
  74. package/lib/typescript/src/utils/daemonConnection.d.ts +18 -0
  75. package/lib/typescript/src/utils/daemonConnection.d.ts.map +1 -0
  76. package/lib/typescript/src/utils/daemonSettings.d.ts +19 -0
  77. package/lib/typescript/src/utils/daemonSettings.d.ts.map +1 -0
  78. package/lib/typescript/src/utils/reportToDaemon.d.ts +34 -0
  79. package/lib/typescript/src/utils/reportToDaemon.d.ts.map +1 -0
  80. package/lib/typescript/src/utils/sessionReport.d.ts +18 -0
  81. package/lib/typescript/src/utils/sessionReport.d.ts.map +1 -0
  82. package/lib/typescript/src/utils/streamToDaemon.d.ts +23 -0
  83. package/lib/typescript/src/utils/streamToDaemon.d.ts.map +1 -0
  84. package/node/daemon/src/cli.js +75 -0
  85. package/node/daemon/src/console/console.html +936 -0
  86. package/node/daemon/src/console/index.js +47 -0
  87. package/node/daemon/src/constants.js +32 -0
  88. package/node/daemon/src/index.js +11 -0
  89. package/node/daemon/src/server.js +365 -0
  90. package/node/daemon/src/store.js +110 -0
  91. package/node/mcp/src/cli.js +31 -0
  92. package/node/mcp/src/constants.js +13 -0
  93. package/node/mcp/src/daemonClient.js +132 -0
  94. package/node/mcp/src/httpClient.js +49 -0
  95. package/node/mcp/src/index.js +15 -0
  96. package/node/mcp/src/logs.js +95 -0
  97. package/node/mcp/src/server.js +144 -0
  98. package/node/mcp/src/tools.js +84 -0
  99. package/package.json +7 -2
  100. package/src/features/network/index.ts +30 -3
  101. package/src/features/network/networkInterceptor.ts +19 -6
  102. package/src/index.ts +14 -0
  103. package/src/ui/panel/DebugPanel.tsx +23 -1
  104. package/src/ui/panel/FloatPanelView.tsx +10 -68
  105. package/src/ui/panel/StreamingSettingsModal.tsx +566 -0
  106. package/src/ui/panel/useTabAnimation.ts +77 -0
  107. package/src/utils/autoDetectDaemon.ts +175 -0
  108. package/src/utils/createPersistedObservableStore.ts +16 -3
  109. package/src/utils/daemonConnection.ts +133 -0
  110. package/src/utils/daemonSettings.ts +134 -0
  111. package/src/utils/reportToDaemon.ts +172 -0
  112. package/src/utils/sessionReport.ts +203 -0
  113. 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
- // Content slide animation
70
- const contentOpacity = useRef(new Animated.Value(1)).current;
71
- const contentTranslateX = useRef(new Animated.Value(0)).current;
72
- const isSwitchingTab = useRef(false);
73
-
74
- // Refs to avoid stale closures in PanResponder
75
- const activeTabRef = useRef(0);
76
- activeTabRef.current = activeTab;
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
- {...swipeResponder.panHandlers}
140
+ {...panHandlers}
199
141
  >
200
142
  {renderFeatureContent()}
201
143
  </Animated.View>