capdebug 0.2.0 → 0.3.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 (133) hide show
  1. package/README.md +30 -0
  2. package/android/build/.transforms/105231053f5053e70f17f15178bed793/results.bin +1 -0
  3. package/android/build/.transforms/7c2b02c40854250ff97be5e9e723091e/results.bin +1 -0
  4. package/android/build/.transforms/ca1c0f6bb67b5238fd83a40c3a1c0ddd/results.bin +1 -0
  5. package/android/build/.transforms/ca1c0f6bb67b5238fd83a40c3a1c0ddd/transformed/classes/classes_dex/classes.dex +0 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +9 -0
  7. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  8. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
  9. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  10. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  11. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  12. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
  13. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  14. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  16. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  17. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  18. package/android/build/intermediates/java_res/debug/out/META-INF/capdebug_debug.kotlin_module +0 -0
  19. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  20. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +11 -0
  21. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +9 -0
  22. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  23. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  24. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1 -0
  25. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  105. package/android/build/outputs/logs/manifest-merger-debug-report.txt +20 -0
  106. package/android/build/tmp/kotlin-classes/debug/META-INF/capdebug_debug.kotlin_module +0 -0
  107. package/android/build/tmp/kotlin-classes/debug/com/capdebug/plugin/CapDebugPlugin$Companion.class +0 -0
  108. package/android/build/tmp/kotlin-classes/debug/com/capdebug/plugin/CapDebugPlugin.class +0 -0
  109. package/bin/capdebug.js +8 -0
  110. package/dist/capacitor/deep-link.d.ts +4 -0
  111. package/dist/cli/index.d.ts +1 -0
  112. package/dist/cli/qr.d.ts +15 -0
  113. package/dist/cli/server.d.ts +34 -0
  114. package/dist/cli.js +1868 -0
  115. package/dist/cli.js.map +1 -0
  116. package/dist/index.d.ts +13 -0
  117. package/dist/plugin.cjs.js +866 -0
  118. package/dist/plugin.cjs.js.map +1 -1
  119. package/dist/plugin.js +866 -0
  120. package/dist/plugin.js.map +1 -1
  121. package/dist/plugin.mjs +859 -1
  122. package/dist/plugin.mjs.map +1 -1
  123. package/dist/remote/buffer.d.ts +13 -0
  124. package/dist/remote/desktop-viewer-html.d.ts +10 -0
  125. package/dist/remote/pairing-page-html.d.ts +8 -0
  126. package/dist/remote/pairing.d.ts +34 -0
  127. package/dist/remote/protocol.d.ts +14 -0
  128. package/dist/remote/remote-manager.d.ts +19 -0
  129. package/dist/remote/signaling.d.ts +27 -0
  130. package/dist/remote/transport.d.ts +15 -0
  131. package/dist/remote/types.d.ts +69 -0
  132. package/dist/remote/webrtc-transport.d.ts +47 -0
  133. package/package.json +5 -1
@@ -0,0 +1,13 @@
1
+ import type { CapDebugEvent } from '../types';
2
+ export declare class RemoteEventBuffer {
3
+ private buffer;
4
+ private maxCapacity;
5
+ private droppedCount;
6
+ constructor(maxCapacity?: number);
7
+ push(event: CapDebugEvent): void;
8
+ flush(): CapDebugEvent[];
9
+ clear(): void;
10
+ size(): number;
11
+ getDroppedCount(): number;
12
+ incrementDropped(): void;
13
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HTML template for the Desktop Remote Viewer (http://localhost:4783).
3
+ * Contains full client-side WebRTC host logic, real-time log stream UI,
4
+ * filtering, JSON inspection, and remote controls.
5
+ */
6
+ export declare function getDesktopViewerHtml(options: {
7
+ sessionId: string;
8
+ secret: string;
9
+ signalingUrl: string;
10
+ }): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * HTML template for the mobile pairing redirect page (/pair).
3
+ * Served when the user scans the terminal QR code.
4
+ */
5
+ export declare function getPairingPageHtml(options: {
6
+ sessionId: string;
7
+ signalingUrl: string;
8
+ }): string;
@@ -0,0 +1,34 @@
1
+ import type { PairingSession } from './types';
2
+ export interface ParsedPairingInfo {
3
+ sessionId: string;
4
+ secret: string;
5
+ signalingUrl?: string;
6
+ rawUrl: string;
7
+ }
8
+ export declare class PairingHelper {
9
+ /**
10
+ * Creates a new pairing session with given TTL (default 5 minutes).
11
+ */
12
+ static createSession(ttlMs?: number): PairingSession;
13
+ /**
14
+ * Generates a short, human-readable session ID (e.g. "K7P4-M2" or "7HQ2-9X").
15
+ */
16
+ static generateSessionId(): string;
17
+ /**
18
+ * Generates a cryptographically strong 128-bit random secret string.
19
+ */
20
+ static generateSecret(): string;
21
+ /**
22
+ * Formats a web pairing URL where the secret is stored strictly in the URL fragment (#SECRET).
23
+ */
24
+ static formatPairingUrl(baseUrl: string, sessionId: string, secret: string): string;
25
+ /**
26
+ * Formats a Capacitor mobile deep link URL.
27
+ */
28
+ static formatDeepLinkUrl(sessionId: string, secret: string, signalingUrl?: string): string;
29
+ /**
30
+ * Parses a web pairing URL or Capacitor deep-link URL into session and secret components.
31
+ */
32
+ static parseUrl(urlStr: string): ParsedPairingInfo | null;
33
+ private static getRandomBytes;
34
+ }
@@ -0,0 +1,14 @@
1
+ import type { CapDebugEvent } from '../types';
2
+ import type { ControlCommand, RemoteMessage } from './types';
3
+ export declare const PROTOCOL_VERSION = 1;
4
+ export declare class RemoteProtocol {
5
+ static createHello(capdebugVersion?: string, platform?: string, deviceName?: string): RemoteMessage;
6
+ static createHelloAck(): RemoteMessage;
7
+ static createEvent(event: CapDebugEvent): RemoteMessage;
8
+ static createBatch(events: CapDebugEvent[]): RemoteMessage;
9
+ static createControl(command: ControlCommand): RemoteMessage;
10
+ static createPing(timestamp?: number): RemoteMessage;
11
+ static createPong(pingTimestamp: number): RemoteMessage;
12
+ static serialize(message: RemoteMessage): string;
13
+ static parse(raw: string): RemoteMessage | null;
14
+ }
@@ -0,0 +1,19 @@
1
+ import type { CapDebugStore } from '../store';
2
+ import type { ConnectionDiagnostics, PairingConfig, TransportStatus } from './types';
3
+ import { WebRTCTransport } from './webrtc-transport';
4
+ export declare class RemoteManager {
5
+ private transport;
6
+ private store;
7
+ private isListening;
8
+ private eventListener;
9
+ constructor(store: CapDebugStore);
10
+ get activeTransport(): WebRTCTransport;
11
+ connect(config: PairingConfig): Promise<void>;
12
+ disconnect(): void;
13
+ status(): TransportStatus;
14
+ getDiagnostics(): ConnectionDiagnostics;
15
+ handlePairingUrl(url: string): Promise<boolean>;
16
+ private startEventListener;
17
+ private stopEventListener;
18
+ private setupControlHandler;
19
+ }
@@ -0,0 +1,27 @@
1
+ import type { PairingSessionInfo, SignalingMessage } from './types';
2
+ export interface SignalingTransport {
3
+ createSession(ttlSeconds?: number): Promise<PairingSessionInfo>;
4
+ joinSession(sessionId: string, secret: string): Promise<void>;
5
+ send(message: SignalingMessage): Promise<void>;
6
+ onMessage(callback: (message: SignalingMessage) => void): () => void;
7
+ close(): void;
8
+ }
9
+ export declare class HttpSseSignalingClient implements SignalingTransport {
10
+ private baseUrl;
11
+ private sessionId;
12
+ private secret;
13
+ private role;
14
+ private eventSource;
15
+ private listeners;
16
+ private isClosed;
17
+ private pollTimer;
18
+ constructor(baseUrl: string);
19
+ createSession(ttlSeconds?: number): Promise<PairingSessionInfo>;
20
+ joinSession(sessionId: string, secret: string): Promise<void>;
21
+ send(message: SignalingMessage): Promise<void>;
22
+ onMessage(callback: (message: SignalingMessage) => void): () => void;
23
+ close(): void;
24
+ private connectEventStream;
25
+ private startPolling;
26
+ private dispatchMessage;
27
+ }
@@ -0,0 +1,15 @@
1
+ import type { CapDebugEvent } from '../types';
2
+ import type { ConnectionDiagnostics, ControlCommand, PairingConfig, TransportStatus } from './types';
3
+ export interface CapDebugTransport {
4
+ readonly id: string;
5
+ connect(config: PairingConfig): Promise<void>;
6
+ send(event: CapDebugEvent): void;
7
+ sendControl(command: ControlCommand): void;
8
+ disconnect(): void;
9
+ getStatus(): TransportStatus;
10
+ getDiagnostics(): ConnectionDiagnostics;
11
+ onEvent(callback: (event: CapDebugEvent) => void): () => void;
12
+ onControl(callback: (command: ControlCommand) => void): () => void;
13
+ onStatusChange(callback: (status: TransportStatus) => void): () => void;
14
+ onDiagnostics(callback: (diag: ConnectionDiagnostics) => void): () => void;
15
+ }
@@ -0,0 +1,69 @@
1
+ import type { CapDebugEvent } from '../types';
2
+ export type SessionStatus = 'waiting' | 'peer-joined' | 'negotiating' | 'connected' | 'expired' | 'closed';
3
+ export interface PairingSession {
4
+ id: string;
5
+ createdAt: number;
6
+ expiresAt: number;
7
+ status: SessionStatus;
8
+ }
9
+ export interface PairingSessionInfo {
10
+ sessionId: string;
11
+ secret: string;
12
+ createdAt: number;
13
+ expiresAt: number;
14
+ signalingUrl: string;
15
+ pairingUrl: string;
16
+ deepLinkUrl: string;
17
+ }
18
+ export interface PairingConfig {
19
+ sessionId: string;
20
+ secret: string;
21
+ signalingUrl?: string;
22
+ iceServers?: RTCIceServer[];
23
+ isHost?: boolean;
24
+ }
25
+ export type SignalingMessageType = 'join' | 'peer-joined' | 'offer' | 'answer' | 'ice-candidate' | 'disconnect' | 'error';
26
+ export interface SignalingMessage {
27
+ sessionId: string;
28
+ secret: string;
29
+ type: SignalingMessageType;
30
+ sender: 'host' | 'peer';
31
+ payload?: any;
32
+ timestamp?: number;
33
+ }
34
+ export type TransportStatus = 'disconnected' | 'connecting' | 'signaling' | 'connected' | 'reconnecting' | 'failed';
35
+ export interface ConnectionDiagnostics {
36
+ transport: 'webrtc' | 'local' | 'mock';
37
+ status: TransportStatus;
38
+ iceConnectionState?: string;
39
+ iceGatheringState?: string;
40
+ signalingState?: string;
41
+ connectionState?: string;
42
+ candidateType?: string;
43
+ protocol?: string;
44
+ route?: 'direct / LAN' | 'STUN / WAN' | 'relay / TURN' | 'unknown';
45
+ rttMs?: number;
46
+ bufferedAmountBytes?: number;
47
+ droppedEventsCount?: number;
48
+ totalEventsSent?: number;
49
+ totalEventsReceived?: number;
50
+ connectedAt?: number;
51
+ deviceName?: string;
52
+ platform?: string;
53
+ }
54
+ export type ControlCommandType = 'pause' | 'resume' | 'clear' | 'snapshot.request' | 'collector.enable' | 'collector.disable' | 'ping' | 'pong' | 'disconnect';
55
+ export interface ControlCommand {
56
+ type: ControlCommandType;
57
+ collector?: string;
58
+ timestamp?: number;
59
+ payload?: unknown;
60
+ }
61
+ export interface RemoteMessage {
62
+ v: 1;
63
+ type: 'hello' | 'hello-ack' | 'event' | 'events-batch' | 'control' | 'ping' | 'pong';
64
+ payload?: unknown;
65
+ event?: CapDebugEvent;
66
+ events?: CapDebugEvent[];
67
+ command?: ControlCommand;
68
+ timestamp?: number;
69
+ }
@@ -0,0 +1,47 @@
1
+ import type { CapDebugEvent } from '../types';
2
+ import type { CapDebugTransport } from './transport';
3
+ import type { ConnectionDiagnostics, ControlCommand, PairingConfig, TransportStatus } from './types';
4
+ export declare class WebRTCTransport implements CapDebugTransport {
5
+ readonly id = "webrtc";
6
+ private pc;
7
+ private signaling;
8
+ private config;
9
+ private eventsChannel;
10
+ private controlChannel;
11
+ private status;
12
+ private buffer;
13
+ private eventListeners;
14
+ private controlListeners;
15
+ private statusListeners;
16
+ private diagnosticsListeners;
17
+ private pingTimer;
18
+ private statsTimer;
19
+ private rttMs;
20
+ private totalEventsSent;
21
+ private totalEventsReceived;
22
+ private connectedAt;
23
+ private remoteDeviceName;
24
+ private remotePlatform;
25
+ private diagnostics;
26
+ connect(config: PairingConfig): Promise<void>;
27
+ send(event: CapDebugEvent): void;
28
+ sendControl(command: ControlCommand): void;
29
+ disconnect(): void;
30
+ getStatus(): TransportStatus;
31
+ getDiagnostics(): ConnectionDiagnostics;
32
+ onEvent(callback: (event: CapDebugEvent) => void): () => void;
33
+ onControl(callback: (command: ControlCommand) => void): () => void;
34
+ onStatusChange(callback: (status: TransportStatus) => void): () => void;
35
+ onDiagnostics(callback: (diag: ConnectionDiagnostics) => void): () => void;
36
+ private handleSignalingMessage;
37
+ private initPeerConnection;
38
+ private startHandshakeAsInitiator;
39
+ private handleOffer;
40
+ private setupDataChannel;
41
+ private handleControlMessage;
42
+ private startTimers;
43
+ private stopTimers;
44
+ private queryWebRTCStats;
45
+ private setStatus;
46
+ private updateDiagnostics;
47
+ }
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "capdebug",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Lightweight, embedded debug viewer and diagnostics plugin for Capacitor apps",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/plugin.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "unpkg": "dist/plugin.js",
9
+ "bin": {
10
+ "capdebug": "./bin/capdebug.js"
11
+ },
9
12
  "files": [
10
13
  "dist/",
14
+ "bin/",
11
15
  "ios/",
12
16
  "android/",
13
17
  "CapDebug.podspec"