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
@@ -0,0 +1,23 @@
1
+ export interface StreamToDaemonOptions {
2
+ endpoint?: string;
3
+ token?: string;
4
+ debounceMs?: number;
5
+ timeoutMs?: number;
6
+ onStatus?: (status: StreamStatus) => void;
7
+ }
8
+ export type StreamStatus = {
9
+ state: 'connecting';
10
+ } | {
11
+ state: 'connected';
12
+ sessionId: string;
13
+ } | {
14
+ state: 'retrying';
15
+ retryInMs: number;
16
+ } | {
17
+ state: 'failed';
18
+ reason: 'auth' | 'retry_limit';
19
+ };
20
+ export declare function startStreaming(options?: StreamToDaemonOptions): void;
21
+ export declare function stopStreaming(): void;
22
+ export declare function isStreaming(): boolean;
23
+ //# sourceMappingURL=streamToDaemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamToDaemon.d.ts","sourceRoot":"","sources":["../../../../src/utils/streamToDaemon.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,GACvB;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CAAC;AAiVxD,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,IAAI,CA0CxE;AAED,wBAAgB,aAAa,IAAI,IAAI,CASpC;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC"}
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ DAEMON_NAME,
5
+ DEFAULT_HOST,
6
+ DEFAULT_PORT,
7
+ getLanIPs,
8
+ } = require('./constants');
9
+ const { createDaemonServer } = require('./server');
10
+
11
+ function readOption(args, name, fallback) {
12
+ const index = args.indexOf(name);
13
+ if (index < 0) {
14
+ return fallback;
15
+ }
16
+ return args[index + 1] || fallback;
17
+ }
18
+
19
+ function hasHelpFlag(args) {
20
+ return args.includes('--help') || args.includes('-h');
21
+ }
22
+
23
+ function printHelp() {
24
+ process.stdout.write('Usage: debug-toolkit-daemon [--host 0.0.0.0] [--port 3799] [--token dev-token]\n');
25
+ }
26
+
27
+ function getLocalOrigin(host, port) {
28
+ const localHost = host === '0.0.0.0' || host === '::' ? '127.0.0.1' : host;
29
+ return `http://${localHost}:${port}`;
30
+ }
31
+
32
+ function startDaemonFromCli(args) {
33
+ if (hasHelpFlag(args)) {
34
+ printHelp();
35
+ return;
36
+ }
37
+
38
+ const host = readOption(args, '--host', process.env.DEBUG_TOOLKIT_DAEMON_HOST || DEFAULT_HOST);
39
+ const port = Number(readOption(args, '--port', process.env.DEBUG_TOOLKIT_DAEMON_PORT || DEFAULT_PORT));
40
+ const token = readOption(args, '--token', process.env.DEBUG_TOOLKIT_DAEMON_TOKEN || '');
41
+
42
+ if (!Number.isFinite(port) || port <= 0) {
43
+ process.stderr.write('Invalid --port value\n');
44
+ process.exitCode = 1;
45
+ return;
46
+ }
47
+
48
+ const { server } = createDaemonServer({ token });
49
+
50
+ server.on('error', (error) => {
51
+ process.stderr.write(`${DAEMON_NAME} failed to start: ${error.message}\n`);
52
+ process.exitCode = 1;
53
+ });
54
+
55
+ server.listen(port, host, () => {
56
+ const consolePath = token ? `/console?token=${encodeURIComponent(token)}` : '/console';
57
+ process.stderr.write(`${DAEMON_NAME} listening on http://${host}:${port}\n`);
58
+ process.stderr.write(`Web Console: ${getLocalOrigin(host, port)}${consolePath}\n`);
59
+ const lanIPs = getLanIPs();
60
+ if (lanIPs.length > 0) {
61
+ process.stderr.write(`LAN IPs: ${lanIPs.join(', ')}\n`);
62
+ }
63
+ });
64
+
65
+ const close = () => {
66
+ server.close(() => process.exit(0));
67
+ };
68
+
69
+ process.on('SIGINT', close);
70
+ process.on('SIGTERM', close);
71
+ }
72
+
73
+ module.exports = {
74
+ startDaemonFromCli,
75
+ };