@open-wa/screencaster 5.0.0-alpha.8 → 5.1.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/dist/types.d.cts CHANGED
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Options for CDP Page.startScreencast.
4
4
  */
5
- interface ScreencastOptions {
5
+ export interface ScreencastOptions {
6
6
  format?: 'jpeg' | 'png';
7
7
  quality?: number;
8
8
  maxWidth?: number;
@@ -12,8 +12,8 @@ interface ScreencastOptions {
12
12
  /**
13
13
  * Default screencast options.
14
14
  */
15
- declare const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions>;
16
- interface FrameMessage {
15
+ export declare const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions>;
16
+ export interface FrameMessage {
17
17
  type: 'frame';
18
18
  /** base64-encoded image data */
19
19
  data: string;
@@ -29,37 +29,37 @@ interface FrameMessage {
29
29
  deviceHeight: number;
30
30
  };
31
31
  }
32
- interface NavStateMessage {
32
+ export interface NavStateMessage {
33
33
  type: 'nav-state';
34
34
  url: string;
35
35
  canGoBack: boolean;
36
36
  canGoForward: boolean;
37
37
  }
38
- interface ErrorMessage {
38
+ export interface ErrorMessage {
39
39
  type: 'error';
40
40
  message: string;
41
41
  }
42
- interface StoppedMessage {
42
+ export interface StoppedMessage {
43
43
  type: 'stopped';
44
44
  }
45
- interface ReadyMessage {
45
+ export interface ReadyMessage {
46
46
  type: 'ready';
47
47
  /** Whether a page driver is currently bound */
48
48
  bound: boolean;
49
49
  }
50
- type ServerMessage = FrameMessage | NavStateMessage | ErrorMessage | StoppedMessage | ReadyMessage;
51
- interface StartMessage {
50
+ export type ServerMessage = FrameMessage | NavStateMessage | ErrorMessage | StoppedMessage | ReadyMessage;
51
+ export interface StartMessage {
52
52
  type: 'start';
53
53
  options?: ScreencastOptions;
54
54
  }
55
- interface StopMessage {
55
+ export interface StopMessage {
56
56
  type: 'stop';
57
57
  }
58
- interface AckMessage {
58
+ export interface AckMessage {
59
59
  type: 'ack';
60
60
  sessionId: number;
61
61
  }
62
- interface MouseMessage {
62
+ export interface MouseMessage {
63
63
  type: 'mouse';
64
64
  action: 'move' | 'down' | 'up';
65
65
  /** Normalized X coordinate (0-1) */
@@ -68,14 +68,14 @@ interface MouseMessage {
68
68
  y: number;
69
69
  button?: 'left' | 'right' | 'middle';
70
70
  }
71
- interface KeyMessage {
71
+ export interface KeyMessage {
72
72
  type: 'key';
73
73
  action: 'down' | 'up';
74
74
  key: string;
75
75
  code: string;
76
76
  modifiers?: number;
77
77
  }
78
- interface ScrollMessage {
78
+ export interface ScrollMessage {
79
79
  type: 'scroll';
80
80
  deltaX: number;
81
81
  deltaY: number;
@@ -84,22 +84,22 @@ interface ScrollMessage {
84
84
  /** Normalized Y coordinate (0-1) */
85
85
  y: number;
86
86
  }
87
- interface NavigateMessage {
87
+ export interface NavigateMessage {
88
88
  type: 'navigate';
89
89
  url: string;
90
90
  }
91
- interface GoBackMessage {
91
+ export interface GoBackMessage {
92
92
  type: 'go-back';
93
93
  }
94
- interface GoForwardMessage {
94
+ export interface GoForwardMessage {
95
95
  type: 'go-forward';
96
96
  }
97
- interface ResizeMessage {
97
+ export interface ResizeMessage {
98
98
  type: 'resize';
99
99
  width: number;
100
100
  height: number;
101
101
  }
102
- type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | KeyMessage | ScrollMessage | NavigateMessage | GoBackMessage | GoForwardMessage | ResizeMessage;
102
+ export type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | KeyMessage | ScrollMessage | NavigateMessage | GoBackMessage | GoForwardMessage | ResizeMessage;
103
103
  /**
104
104
  * A minimal CDP-capable page interface.
105
105
  * This is a subset of IPage from @open-wa/driver-interface
@@ -109,7 +109,7 @@ type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | Ke
109
109
  * narrows it to this interface, keeping the screencaster decoupled
110
110
  * from any specific driver package.
111
111
  */
112
- interface IScreencastPage {
112
+ export interface IScreencastPage {
113
113
  /** Get a CDP session for sending raw CDP commands */
114
114
  cdp(): IScreencastCDPSession | Promise<IScreencastCDPSession>;
115
115
  /** Navigate to a URL */
@@ -123,7 +123,7 @@ interface IScreencastPage {
123
123
  /** Get underlying driver for mouse/keyboard (opaque) */
124
124
  unwrap(): unknown;
125
125
  }
126
- interface IScreencastCDPSession {
126
+ export interface IScreencastCDPSession {
127
127
  send<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
128
128
  detach(): Promise<void>;
129
129
  }
@@ -131,7 +131,7 @@ interface IScreencastCDPSession {
131
131
  * The CDP modifier key bitmask values.
132
132
  * Used to convert from the modifier bitmask to individual key states.
133
133
  */
134
- declare const Modifiers: {
134
+ export declare const Modifiers: {
135
135
  readonly Alt: 1;
136
136
  readonly Ctrl: 2;
137
137
  readonly Meta: 4;
@@ -141,7 +141,6 @@ declare const Modifiers: {
141
141
  * Special keys that should be dispatched as raw key events
142
142
  * rather than typed as text.
143
143
  */
144
- declare const SPECIAL_KEYS: Set<string>;
144
+ export declare const SPECIAL_KEYS: Set<string>;
145
145
  //#endregion
146
- export { AckMessage, ClientMessage, DEFAULT_SCREENCAST_OPTIONS, ErrorMessage, FrameMessage, GoBackMessage, GoForwardMessage, IScreencastCDPSession, IScreencastPage, KeyMessage, Modifiers, MouseMessage, NavStateMessage, NavigateMessage, ReadyMessage, ResizeMessage, SPECIAL_KEYS, ScreencastOptions, ScrollMessage, ServerMessage, StartMessage, StopMessage, StoppedMessage };
147
146
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;AAUA;;UAAiB,iBAAA;EACb,MAAA;EACA,OAAA;EACA,QAAA;EACA,SAAA;EACA,aAAA;AAAA;;;AAMJ;cAAa,0BAAA,EAA4B,QAAA,CAAS,iBAAA;AAAA,UAUjC,YAAA;EACb,IAAA;EAX+D;EAa/D,IAAA;EAHyB;EAKzB,SAA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AAY,SAAA;EAAA,IAAuB,OAAA;EAzDxC;EA4Db,MAAA,IAAU,OAAA;;EAGV,QAAA;EA9DA;EAiEA,MAAA;AAAA;AAAA,UAGa,qBAAA;EACb,IAAA,cAAkB,MAAA,UAAgB,MAAA,GAAS,MAAA,oBAA0B,OAAA,CAAQ,CAAA;EAC7E,MAAA,IAAU,OAAA;AAAA;AA7Dd;;;;AAAA,cAoEa,SAAA;EAAA;;;;;AA3Db;;;;AAAA,cAsEa,YAAA,EAAY,GAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;iBAUiB;EACb;EACA;EACA;EACA;EACA;;;;;qBAMS,4BAA4B,SAAS;iBAUjC;EACb;;EAEA;;EAEA;EACA;IACI;IACA;IACA;IACA;IACA;IACA;IACA;;;iBAIS;EACb;EACA;EACA;EACA;;iBAGa;EACb;EACA;;iBAGa;EACb;;iBAGa;EACb;;EAEA;;YAGQ,gBACN,eACA,kBACA,eACA,iBACA;iBAIW;EACb;EACA,UAAU;;iBAGG;EACb;;iBAGa;EACb;EACA;;iBAGa;EACb;EACA;;EAEA;;EAEA;EACA;;iBAGa;EACb;EACA;EACA;EACA;EACA;;iBAGa;EACb;EACA;EACA;;EAEA;;EAEA;;iBAGa;EACb;EACA;;iBAGa;EACb;;iBAGa;EACb;;iBAGa;EACb;EACA;EACA;;YAGQ,gBACN,eACA,cACA,aACA,eACA,aACA,gBACA,kBACA,gBACA,mBACA;;;;;;;;;;iBAaW;;EAEb,OAAO,wBAAwB,QAAQ;;EAGvC,KAAK,aAAa;IAAY;MAAuB;;EAGrD,UAAU;;EAGV;;EAGA;;iBAGa;EACb,KAAK,aAAa,gBAAgB,SAAS,0BAA0B,QAAQ;EAC7E,UAAU;;;;;;qBAOD;WACT;WACA;WACA;WACA;;;;;;qBAOS,cAAY"}
package/dist/types.d.mts CHANGED
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Options for CDP Page.startScreencast.
4
4
  */
5
- interface ScreencastOptions {
5
+ export interface ScreencastOptions {
6
6
  format?: 'jpeg' | 'png';
7
7
  quality?: number;
8
8
  maxWidth?: number;
@@ -12,8 +12,8 @@ interface ScreencastOptions {
12
12
  /**
13
13
  * Default screencast options.
14
14
  */
15
- declare const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions>;
16
- interface FrameMessage {
15
+ export declare const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions>;
16
+ export interface FrameMessage {
17
17
  type: 'frame';
18
18
  /** base64-encoded image data */
19
19
  data: string;
@@ -29,37 +29,37 @@ interface FrameMessage {
29
29
  deviceHeight: number;
30
30
  };
31
31
  }
32
- interface NavStateMessage {
32
+ export interface NavStateMessage {
33
33
  type: 'nav-state';
34
34
  url: string;
35
35
  canGoBack: boolean;
36
36
  canGoForward: boolean;
37
37
  }
38
- interface ErrorMessage {
38
+ export interface ErrorMessage {
39
39
  type: 'error';
40
40
  message: string;
41
41
  }
42
- interface StoppedMessage {
42
+ export interface StoppedMessage {
43
43
  type: 'stopped';
44
44
  }
45
- interface ReadyMessage {
45
+ export interface ReadyMessage {
46
46
  type: 'ready';
47
47
  /** Whether a page driver is currently bound */
48
48
  bound: boolean;
49
49
  }
50
- type ServerMessage = FrameMessage | NavStateMessage | ErrorMessage | StoppedMessage | ReadyMessage;
51
- interface StartMessage {
50
+ export type ServerMessage = FrameMessage | NavStateMessage | ErrorMessage | StoppedMessage | ReadyMessage;
51
+ export interface StartMessage {
52
52
  type: 'start';
53
53
  options?: ScreencastOptions;
54
54
  }
55
- interface StopMessage {
55
+ export interface StopMessage {
56
56
  type: 'stop';
57
57
  }
58
- interface AckMessage {
58
+ export interface AckMessage {
59
59
  type: 'ack';
60
60
  sessionId: number;
61
61
  }
62
- interface MouseMessage {
62
+ export interface MouseMessage {
63
63
  type: 'mouse';
64
64
  action: 'move' | 'down' | 'up';
65
65
  /** Normalized X coordinate (0-1) */
@@ -68,14 +68,14 @@ interface MouseMessage {
68
68
  y: number;
69
69
  button?: 'left' | 'right' | 'middle';
70
70
  }
71
- interface KeyMessage {
71
+ export interface KeyMessage {
72
72
  type: 'key';
73
73
  action: 'down' | 'up';
74
74
  key: string;
75
75
  code: string;
76
76
  modifiers?: number;
77
77
  }
78
- interface ScrollMessage {
78
+ export interface ScrollMessage {
79
79
  type: 'scroll';
80
80
  deltaX: number;
81
81
  deltaY: number;
@@ -84,22 +84,22 @@ interface ScrollMessage {
84
84
  /** Normalized Y coordinate (0-1) */
85
85
  y: number;
86
86
  }
87
- interface NavigateMessage {
87
+ export interface NavigateMessage {
88
88
  type: 'navigate';
89
89
  url: string;
90
90
  }
91
- interface GoBackMessage {
91
+ export interface GoBackMessage {
92
92
  type: 'go-back';
93
93
  }
94
- interface GoForwardMessage {
94
+ export interface GoForwardMessage {
95
95
  type: 'go-forward';
96
96
  }
97
- interface ResizeMessage {
97
+ export interface ResizeMessage {
98
98
  type: 'resize';
99
99
  width: number;
100
100
  height: number;
101
101
  }
102
- type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | KeyMessage | ScrollMessage | NavigateMessage | GoBackMessage | GoForwardMessage | ResizeMessage;
102
+ export type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | KeyMessage | ScrollMessage | NavigateMessage | GoBackMessage | GoForwardMessage | ResizeMessage;
103
103
  /**
104
104
  * A minimal CDP-capable page interface.
105
105
  * This is a subset of IPage from @open-wa/driver-interface
@@ -109,7 +109,7 @@ type ClientMessage = StartMessage | StopMessage | AckMessage | MouseMessage | Ke
109
109
  * narrows it to this interface, keeping the screencaster decoupled
110
110
  * from any specific driver package.
111
111
  */
112
- interface IScreencastPage {
112
+ export interface IScreencastPage {
113
113
  /** Get a CDP session for sending raw CDP commands */
114
114
  cdp(): IScreencastCDPSession | Promise<IScreencastCDPSession>;
115
115
  /** Navigate to a URL */
@@ -123,7 +123,7 @@ interface IScreencastPage {
123
123
  /** Get underlying driver for mouse/keyboard (opaque) */
124
124
  unwrap(): unknown;
125
125
  }
126
- interface IScreencastCDPSession {
126
+ export interface IScreencastCDPSession {
127
127
  send<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
128
128
  detach(): Promise<void>;
129
129
  }
@@ -131,7 +131,7 @@ interface IScreencastCDPSession {
131
131
  * The CDP modifier key bitmask values.
132
132
  * Used to convert from the modifier bitmask to individual key states.
133
133
  */
134
- declare const Modifiers: {
134
+ export declare const Modifiers: {
135
135
  readonly Alt: 1;
136
136
  readonly Ctrl: 2;
137
137
  readonly Meta: 4;
@@ -141,7 +141,6 @@ declare const Modifiers: {
141
141
  * Special keys that should be dispatched as raw key events
142
142
  * rather than typed as text.
143
143
  */
144
- declare const SPECIAL_KEYS: Set<string>;
144
+ export declare const SPECIAL_KEYS: Set<string>;
145
145
  //#endregion
146
- export { AckMessage, ClientMessage, DEFAULT_SCREENCAST_OPTIONS, ErrorMessage, FrameMessage, GoBackMessage, GoForwardMessage, IScreencastCDPSession, IScreencastPage, KeyMessage, Modifiers, MouseMessage, NavStateMessage, NavigateMessage, ReadyMessage, ResizeMessage, SPECIAL_KEYS, ScreencastOptions, ScrollMessage, ServerMessage, StartMessage, StopMessage, StoppedMessage };
147
146
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;AAUA;;UAAiB,iBAAA;EACb,MAAA;EACA,OAAA;EACA,QAAA;EACA,SAAA;EACA,aAAA;AAAA;;;AAMJ;cAAa,0BAAA,EAA4B,QAAA,CAAS,iBAAA;AAAA,UAUjC,YAAA;EACb,IAAA;EAX+D;EAa/D,IAAA;EAHyB;EAKzB,SAAA;EACA,QAAA;IACI,KAAA;IACA,MAAA;IACA,SAAA;IACA,SAAA;IACA,eAAA;IACA,WAAA;IACA,YAAA;EAAA;AAAA;AAAA,UAIS,eAAA;EACb,IAAA;EACA,GAAA;EACA,SAAA;EACA,YAAA;AAAA;AAAA,UAGa,YAAA;EACb,IAAA;EACA,OAAA;AAA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,IAAU,OAAA;AAAA;AA7Dd;;;;AAAA,cAoEa,SAAA;EAAA;;;;;AA3Db;;;;AAAA,cAsEa,YAAA,EAAY,GAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;iBAUiB;EACb;EACA;EACA;EACA;EACA;;;;;qBAMS,4BAA4B,SAAS;iBAUjC;EACb;;EAEA;;EAEA;EACA;IACI;IACA;IACA;IACA;IACA;IACA;IACA;;;iBAIS;EACb;EACA;EACA;EACA;;iBAGa;EACb;EACA;;iBAGa;EACb;;iBAGa;EACb;;EAEA;;YAGQ,gBACN,eACA,kBACA,eACA,iBACA;iBAIW;EACb;EACA,UAAU;;iBAGG;EACb;;iBAGa;EACb;EACA;;iBAGa;EACb;EACA;;EAEA;;EAEA;EACA;;iBAGa;EACb;EACA;EACA;EACA;EACA;;iBAGa;EACb;EACA;EACA;;EAEA;;EAEA;;iBAGa;EACb;EACA;;iBAGa;EACb;;iBAGa;EACb;;iBAGa;EACb;EACA;EACA;;YAGQ,gBACN,eACA,cACA,aACA,eACA,aACA,gBACA,kBACA,gBACA,mBACA;;;;;;;;;;iBAaW;;EAEb,OAAO,wBAAwB,QAAQ;;EAGvC,KAAK,aAAa;IAAY;MAAuB;;EAGrD,UAAU;;EAGV;;EAGA;;iBAGa;EACb,KAAK,aAAa,gBAAgB,SAAS,0BAA0B,QAAQ;EAC7E,UAAU;;;;;;qBAOD;WACT;WACA;WACA;WACA;;;;;;qBAOS,cAAY"}
package/dist/types.mjs CHANGED
@@ -23,7 +23,7 @@ const Modifiers = {
23
23
  * Special keys that should be dispatched as raw key events
24
24
  * rather than typed as text.
25
25
  */
26
- const SPECIAL_KEYS = new Set([
26
+ const SPECIAL_KEYS = /* @__PURE__ */ new Set([
27
27
  "Tab",
28
28
  "ArrowUp",
29
29
  "ArrowDown",
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["// ────────────────────────────────────────────────────────────\n// @open-wa/screencaster — Shared Protocol Types\n//\n// Consumed by both the server (Node.js) and client (browser).\n// This file has ZERO runtime deps — pure type definitions + enums.\n// ────────────────────────────────────────────────────────────\n\n/**\n * Options for CDP Page.startScreencast.\n */\nexport interface ScreencastOptions {\n format?: 'jpeg' | 'png';\n quality?: number;\n maxWidth?: number;\n maxHeight?: number;\n everyNthFrame?: number;\n}\n\n/**\n * Default screencast options.\n */\nexport const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions> = {\n format: 'jpeg',\n quality: 80,\n maxWidth: 1280,\n maxHeight: 720,\n everyNthFrame: 1,\n};\n\n// ────── Server → Client Messages ──────\n\nexport interface FrameMessage {\n type: 'frame';\n /** base64-encoded image data */\n data: string;\n /** CDP session ID — must be ACK'd back to keep frames flowing */\n sessionId: number;\n metadata: {\n width: number;\n height: number;\n timestamp: number;\n offsetTop: number;\n pageScaleFactor: number;\n deviceWidth: number;\n deviceHeight: number;\n };\n}\n\nexport interface NavStateMessage {\n type: 'nav-state';\n url: string;\n canGoBack: boolean;\n canGoForward: boolean;\n}\n\nexport interface ErrorMessage {\n type: 'error';\n message: string;\n}\n\nexport interface StoppedMessage {\n type: 'stopped';\n}\n\nexport interface ReadyMessage {\n type: 'ready';\n /** Whether a page driver is currently bound */\n bound: boolean;\n}\n\nexport type ServerMessage =\n | FrameMessage\n | NavStateMessage\n | ErrorMessage\n | StoppedMessage\n | ReadyMessage;\n\n// ────── Client → Server Messages ──────\n\nexport interface StartMessage {\n type: 'start';\n options?: ScreencastOptions;\n}\n\nexport interface StopMessage {\n type: 'stop';\n}\n\nexport interface AckMessage {\n type: 'ack';\n sessionId: number;\n}\n\nexport interface MouseMessage {\n type: 'mouse';\n action: 'move' | 'down' | 'up';\n /** Normalized X coordinate (0-1) */\n x: number;\n /** Normalized Y coordinate (0-1) */\n y: number;\n button?: 'left' | 'right' | 'middle';\n}\n\nexport interface KeyMessage {\n type: 'key';\n action: 'down' | 'up';\n key: string;\n code: string;\n modifiers?: number;\n}\n\nexport interface ScrollMessage {\n type: 'scroll';\n deltaX: number;\n deltaY: number;\n /** Normalized X coordinate (0-1) */\n x: number;\n /** Normalized Y coordinate (0-1) */\n y: number;\n}\n\nexport interface NavigateMessage {\n type: 'navigate';\n url: string;\n}\n\nexport interface GoBackMessage {\n type: 'go-back';\n}\n\nexport interface GoForwardMessage {\n type: 'go-forward';\n}\n\nexport interface ResizeMessage {\n type: 'resize';\n width: number;\n height: number;\n}\n\nexport type ClientMessage =\n | StartMessage\n | StopMessage\n | AckMessage\n | MouseMessage\n | KeyMessage\n | ScrollMessage\n | NavigateMessage\n | GoBackMessage\n | GoForwardMessage\n | ResizeMessage;\n\n// ────── Minimal Page Interface ──────\n\n/**\n * A minimal CDP-capable page interface.\n * This is a subset of IPage from @open-wa/driver-interface\n * that captures exactly what the screencaster needs.\n *\n * Consumers pass in an IPage from driver-interface; the factory\n * narrows it to this interface, keeping the screencaster decoupled\n * from any specific driver package.\n */\nexport interface IScreencastPage {\n /** Get a CDP session for sending raw CDP commands */\n cdp(): IScreencastCDPSession | Promise<IScreencastCDPSession>;\n\n /** Navigate to a URL */\n goto(url: string, options?: { waitUntil?: string }): Promise<void>;\n\n /** Reload the current page */\n reload(): Promise<void>;\n\n /** Check if the page has been closed */\n isClosed(): boolean;\n\n /** Get underlying driver for mouse/keyboard (opaque) */\n unwrap(): unknown;\n}\n\nexport interface IScreencastCDPSession {\n send<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;\n detach(): Promise<void>;\n}\n\n/**\n * The CDP modifier key bitmask values.\n * Used to convert from the modifier bitmask to individual key states.\n */\nexport const Modifiers = {\n Alt: 1,\n Ctrl: 2,\n Meta: 4,\n Shift: 8,\n} as const;\n\n/**\n * Special keys that should be dispatched as raw key events\n * rather than typed as text.\n */\nexport const SPECIAL_KEYS = new Set([\n 'Tab', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',\n 'Backspace', 'Enter', 'Escape', 'Delete', 'Home', 'End',\n 'PageUp', 'PageDown', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6',\n 'F7', 'F8', 'F9', 'F10', 'F11', 'F12',\n]);\n"],"mappings":";;;;AAqBA,MAAa,6BAA0D;CACnE,QAAQ;CACR,SAAS;CACT,UAAU;CACV,WAAW;CACX,eAAe;CAClB;;;;;AAkKD,MAAa,YAAY;CACrB,KAAK;CACL,MAAM;CACN,MAAM;CACN,OAAO;CACV;;;;;AAMD,MAAa,eAAe,IAAI,IAAI;CAChC;CAAO;CAAW;CAAa;CAAa;CAC5C;CAAa;CAAS;CAAU;CAAU;CAAQ;CAClD;CAAU;CAAY;CAAM;CAAM;CAAM;CAAM;CAAM;CACpD;CAAM;CAAM;CAAM;CAAO;CAAO;CACnC,CAAC"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["// ────────────────────────────────────────────────────────────\n// @open-wa/screencaster — Shared Protocol Types\n//\n// Consumed by both the server (Node.js) and client (browser).\n// This file has ZERO runtime deps — pure type definitions + enums.\n// ────────────────────────────────────────────────────────────\n\n/**\n * Options for CDP Page.startScreencast.\n */\nexport interface ScreencastOptions {\n format?: 'jpeg' | 'png';\n quality?: number;\n maxWidth?: number;\n maxHeight?: number;\n everyNthFrame?: number;\n}\n\n/**\n * Default screencast options.\n */\nexport const DEFAULT_SCREENCAST_OPTIONS: Required<ScreencastOptions> = {\n format: 'jpeg',\n quality: 80,\n maxWidth: 1280,\n maxHeight: 720,\n everyNthFrame: 1,\n};\n\n// ────── Server → Client Messages ──────\n\nexport interface FrameMessage {\n type: 'frame';\n /** base64-encoded image data */\n data: string;\n /** CDP session ID — must be ACK'd back to keep frames flowing */\n sessionId: number;\n metadata: {\n width: number;\n height: number;\n timestamp: number;\n offsetTop: number;\n pageScaleFactor: number;\n deviceWidth: number;\n deviceHeight: number;\n };\n}\n\nexport interface NavStateMessage {\n type: 'nav-state';\n url: string;\n canGoBack: boolean;\n canGoForward: boolean;\n}\n\nexport interface ErrorMessage {\n type: 'error';\n message: string;\n}\n\nexport interface StoppedMessage {\n type: 'stopped';\n}\n\nexport interface ReadyMessage {\n type: 'ready';\n /** Whether a page driver is currently bound */\n bound: boolean;\n}\n\nexport type ServerMessage =\n | FrameMessage\n | NavStateMessage\n | ErrorMessage\n | StoppedMessage\n | ReadyMessage;\n\n// ────── Client → Server Messages ──────\n\nexport interface StartMessage {\n type: 'start';\n options?: ScreencastOptions;\n}\n\nexport interface StopMessage {\n type: 'stop';\n}\n\nexport interface AckMessage {\n type: 'ack';\n sessionId: number;\n}\n\nexport interface MouseMessage {\n type: 'mouse';\n action: 'move' | 'down' | 'up';\n /** Normalized X coordinate (0-1) */\n x: number;\n /** Normalized Y coordinate (0-1) */\n y: number;\n button?: 'left' | 'right' | 'middle';\n}\n\nexport interface KeyMessage {\n type: 'key';\n action: 'down' | 'up';\n key: string;\n code: string;\n modifiers?: number;\n}\n\nexport interface ScrollMessage {\n type: 'scroll';\n deltaX: number;\n deltaY: number;\n /** Normalized X coordinate (0-1) */\n x: number;\n /** Normalized Y coordinate (0-1) */\n y: number;\n}\n\nexport interface NavigateMessage {\n type: 'navigate';\n url: string;\n}\n\nexport interface GoBackMessage {\n type: 'go-back';\n}\n\nexport interface GoForwardMessage {\n type: 'go-forward';\n}\n\nexport interface ResizeMessage {\n type: 'resize';\n width: number;\n height: number;\n}\n\nexport type ClientMessage =\n | StartMessage\n | StopMessage\n | AckMessage\n | MouseMessage\n | KeyMessage\n | ScrollMessage\n | NavigateMessage\n | GoBackMessage\n | GoForwardMessage\n | ResizeMessage;\n\n// ────── Minimal Page Interface ──────\n\n/**\n * A minimal CDP-capable page interface.\n * This is a subset of IPage from @open-wa/driver-interface\n * that captures exactly what the screencaster needs.\n *\n * Consumers pass in an IPage from driver-interface; the factory\n * narrows it to this interface, keeping the screencaster decoupled\n * from any specific driver package.\n */\nexport interface IScreencastPage {\n /** Get a CDP session for sending raw CDP commands */\n cdp(): IScreencastCDPSession | Promise<IScreencastCDPSession>;\n\n /** Navigate to a URL */\n goto(url: string, options?: { waitUntil?: string }): Promise<void>;\n\n /** Reload the current page */\n reload(): Promise<void>;\n\n /** Check if the page has been closed */\n isClosed(): boolean;\n\n /** Get underlying driver for mouse/keyboard (opaque) */\n unwrap(): unknown;\n}\n\nexport interface IScreencastCDPSession {\n send<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;\n detach(): Promise<void>;\n}\n\n/**\n * The CDP modifier key bitmask values.\n * Used to convert from the modifier bitmask to individual key states.\n */\nexport const Modifiers = {\n Alt: 1,\n Ctrl: 2,\n Meta: 4,\n Shift: 8,\n} as const;\n\n/**\n * Special keys that should be dispatched as raw key events\n * rather than typed as text.\n */\nexport const SPECIAL_KEYS = new Set([\n 'Tab', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',\n 'Backspace', 'Enter', 'Escape', 'Delete', 'Home', 'End',\n 'PageUp', 'PageDown', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6',\n 'F7', 'F8', 'F9', 'F10', 'F11', 'F12',\n]);\n"],"mappings":";;;;AAqBA,MAAa,6BAA0D;CACnE,QAAQ;CACR,SAAS;CACT,UAAU;CACV,WAAW;CACX,eAAe;AACnB;;;;;AAkKA,MAAa,YAAY;CACrB,KAAK;CACL,MAAM;CACN,MAAM;CACN,OAAO;AACX;;;;;AAMA,MAAa,+BAAe,IAAI,IAAI;CAChC;CAAO;CAAW;CAAa;CAAa;CAC5C;CAAa;CAAS;CAAU;CAAU;CAAQ;CAClD;CAAU;CAAY;CAAM;CAAM;CAAM;CAAM;CAAM;CACpD;CAAM;CAAM;CAAM;CAAO;CAAO;AACpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/screencaster",
3
- "version": "5.0.0-alpha.8",
3
+ "version": "5.1.0",
4
4
  "description": "Headless browser screencasting for open-wa — treeshakable server + client",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,13 +21,14 @@
21
21
  }
22
22
  },
23
23
  "files": [
24
+ "src",
24
25
  "dist"
25
26
  ],
26
27
  "dependencies": {
27
- "hono": "^4.12.9"
28
+ "hono": "^4.13.9"
28
29
  },
29
30
  "peerDependencies": {
30
- "@open-wa/driver-interface": "5.0.0-alpha.8"
31
+ "@open-wa/driver-interface": "5.1.0"
31
32
  },
32
33
  "peerDependenciesMeta": {
33
34
  "@open-wa/driver-interface": {
@@ -35,9 +36,9 @@
35
36
  }
36
37
  },
37
38
  "devDependencies": {
38
- "@types/node": "^25.9.1",
39
- "typescript": "^6.0.3",
40
- "@open-wa/driver-interface": "5.0.0-alpha.8"
39
+ "@open-wa/driver-interface": "5.1.0",
40
+ "@types/node": "^26.6.3",
41
+ "typescript": "^7.0.2"
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public"
@@ -53,6 +54,7 @@
53
54
  "type": "git",
54
55
  "url": "https://github.com/open-wa/wa-automate-nodejs.git"
55
56
  },
57
+ "license": "SEE LICENSE IN LICENSE.md",
56
58
  "scripts": {
57
59
  "build": "tsdown --format cjs,esm",
58
60
  "dev": "tsdown --format cjs,esm --watch",