@memberjunction/remote-browser-base 0.0.1 → 5.41.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/README.md +145 -40
- package/dist/base-remote-browser-provider.d.ts +149 -0
- package/dist/base-remote-browser-provider.d.ts.map +1 -0
- package/dist/base-remote-browser-provider.js +95 -0
- package/dist/base-remote-browser-provider.js.map +1 -0
- package/dist/capability-errors.d.ts +47 -0
- package/dist/capability-errors.d.ts.map +1 -0
- package/dist/capability-errors.js +44 -0
- package/dist/capability-errors.js.map +1 -0
- package/dist/control.d.ts +69 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +52 -0
- package/dist/control.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/remote-browser-engine-base.d.ts +76 -0
- package/dist/remote-browser-engine-base.d.ts.map +1 -0
- package/dist/remote-browser-engine-base.js +116 -0
- package/dist/remote-browser-engine-base.js.map +1 -0
- package/dist/remote-browser-features.d.ts +46 -0
- package/dist/remote-browser-features.d.ts.map +1 -0
- package/dist/remote-browser-features.js +37 -0
- package/dist/remote-browser-features.js.map +1 -0
- package/dist/remote-browser-session.d.ts +376 -0
- package/dist/remote-browser-session.d.ts.map +1 -0
- package/dist/remote-browser-session.js +15 -0
- package/dist/remote-browser-session.js.map +1 -0
- package/package.json +32 -7
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live-session contract for the Remote Browser channel and the self-contained, strongly-typed
|
|
3
|
+
* action / input / output payloads it carries.
|
|
4
|
+
*
|
|
5
|
+
* These types are defined **self-contained here** (no dependency on `@memberjunction/computer-use` or
|
|
6
|
+
* Playwright) so this Base package stays universal — usable client *and* server. The server package
|
|
7
|
+
* and the backend drivers (which depend on `@memberjunction/computer-use`) *implement*
|
|
8
|
+
* {@link IRemoteBrowserSession} against a real CDP-connected browser; this package only declares the
|
|
9
|
+
* shape both sides agree on.
|
|
10
|
+
*
|
|
11
|
+
* @see `/plans/realtime/realtime-bridges-architecture.md` §4d (the Remote Browser channel) and §4d-i
|
|
12
|
+
* (the one-primitive-CDP build decision).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Navigate the browser to a URL.
|
|
16
|
+
*/
|
|
17
|
+
export interface RemoteBrowserNavigateAction {
|
|
18
|
+
Kind: 'navigate';
|
|
19
|
+
/** The absolute URL to load. */
|
|
20
|
+
Url: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Click an element. Identify the target either by CSS `Selector` or by viewport coordinates
|
|
24
|
+
* (`X` / `Y`); a driver prefers `Selector` when both are present.
|
|
25
|
+
*/
|
|
26
|
+
export interface RemoteBrowserClickAction {
|
|
27
|
+
Kind: 'click';
|
|
28
|
+
/** Optional CSS selector identifying the element to click. */
|
|
29
|
+
Selector?: string;
|
|
30
|
+
/** Optional viewport X coordinate (used when no `Selector` is given). */
|
|
31
|
+
X?: number;
|
|
32
|
+
/** Optional viewport Y coordinate (used when no `Selector` is given). */
|
|
33
|
+
Y?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Type text. When `Selector` is provided the driver focuses that element first; otherwise the text is
|
|
37
|
+
* sent to the currently-focused element.
|
|
38
|
+
*/
|
|
39
|
+
export interface RemoteBrowserTypeAction {
|
|
40
|
+
Kind: 'type';
|
|
41
|
+
/** The text to type. */
|
|
42
|
+
Text: string;
|
|
43
|
+
/** Optional CSS selector to focus before typing. */
|
|
44
|
+
Selector?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Press a single key or key-combination (e.g. `'Enter'`, `'Escape'`, `'Control+A'`).
|
|
48
|
+
*/
|
|
49
|
+
export interface RemoteBrowserKeyAction {
|
|
50
|
+
Kind: 'key';
|
|
51
|
+
/** The key (or combination) to press, in Playwright/CDP key syntax. */
|
|
52
|
+
Key: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Scroll the viewport (by `DeltaX` / `DeltaY` pixels) or scroll a specific element into view (by
|
|
56
|
+
* `Selector`). At least one of the three should be supplied; a driver scrolls `Selector` into view
|
|
57
|
+
* when present, otherwise applies the deltas.
|
|
58
|
+
*/
|
|
59
|
+
export interface RemoteBrowserScrollAction {
|
|
60
|
+
Kind: 'scroll';
|
|
61
|
+
/** Horizontal scroll distance in pixels (positive = right). */
|
|
62
|
+
DeltaX?: number;
|
|
63
|
+
/** Vertical scroll distance in pixels (positive = down). */
|
|
64
|
+
DeltaY?: number;
|
|
65
|
+
/** Optional CSS selector to scroll into view instead of applying deltas. */
|
|
66
|
+
Selector?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Navigate back in history.
|
|
70
|
+
*/
|
|
71
|
+
export interface RemoteBrowserBackAction {
|
|
72
|
+
Kind: 'back';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Navigate forward in history.
|
|
76
|
+
*/
|
|
77
|
+
export interface RemoteBrowserForwardAction {
|
|
78
|
+
Kind: 'forward';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Wait — either for a fixed duration (`Ms`) or until an element matching `Selector` appears. At least
|
|
82
|
+
* one should be supplied; a driver waits for `Selector` when present, otherwise sleeps for `Ms`.
|
|
83
|
+
*/
|
|
84
|
+
export interface RemoteBrowserWaitAction {
|
|
85
|
+
Kind: 'wait';
|
|
86
|
+
/** Fixed wait in milliseconds. */
|
|
87
|
+
Ms?: number;
|
|
88
|
+
/** Optional CSS selector to wait for instead of a fixed duration. */
|
|
89
|
+
Selector?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The full agent action vocabulary — a discriminated union over the `Kind` field. The realtime agent
|
|
93
|
+
* emits these as tool calls and the channel's session executes them over CDP. Strongly typed with no
|
|
94
|
+
* `any`; narrow on `action.Kind` to access the kind-specific fields.
|
|
95
|
+
*/
|
|
96
|
+
export type RemoteBrowserAction = RemoteBrowserNavigateAction | RemoteBrowserClickAction | RemoteBrowserTypeAction | RemoteBrowserKeyAction | RemoteBrowserScrollAction | RemoteBrowserBackAction | RemoteBrowserForwardAction | RemoteBrowserWaitAction;
|
|
97
|
+
/**
|
|
98
|
+
* The outcome of executing a {@link RemoteBrowserAction} (or {@link IRemoteBrowserSession.Navigate}).
|
|
99
|
+
*/
|
|
100
|
+
export interface RemoteBrowserActionResult {
|
|
101
|
+
/** Whether the action completed successfully. */
|
|
102
|
+
Success: boolean;
|
|
103
|
+
/** The page URL after the action, when known. */
|
|
104
|
+
CurrentUrl?: string;
|
|
105
|
+
/** Optional human-readable detail (an error message on failure, a note on success). */
|
|
106
|
+
Detail?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A single encoded viewport frame emitted by the live screencast (CDP `Page.startScreencast` for
|
|
110
|
+
* self-host, or a provider live-view stream). Frames feed the channel's ScreenOut media track when
|
|
111
|
+
* screen-sharing the browser into a meeting, or a panel in the MJ console.
|
|
112
|
+
*/
|
|
113
|
+
export interface RemoteBrowserScreencastFrame {
|
|
114
|
+
/** The frame image, Base64-encoded (typically JPEG/PNG per the backend). */
|
|
115
|
+
DataBase64: string;
|
|
116
|
+
/** Frame width in pixels. */
|
|
117
|
+
Width: number;
|
|
118
|
+
/** Frame height in pixels. */
|
|
119
|
+
Height: number;
|
|
120
|
+
/** Monotonically increasing sequence number for ordering / drop detection. */
|
|
121
|
+
SequenceNumber: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A single encoded chunk of audio streamed FROM the remote browser to the user — the soundtrack of
|
|
125
|
+
* whatever the browser is playing (e.g. a YouTube video the co-agent is demoing). The sibling of
|
|
126
|
+
* {@link RemoteBrowserScreencastFrame} for audio: chunks feed the channel's client-side audio player
|
|
127
|
+
* (a MediaSource fed `audio/webm;codecs=opus`).
|
|
128
|
+
*
|
|
129
|
+
* The default (Self-Hosted Chrome) capture path produces `'webm-opus'` chunks via an in-page
|
|
130
|
+
* `MediaRecorder`; `'opus'` / `'pcm16'` are reserved for future backend capture paths (e.g. a
|
|
131
|
+
* server-side virtual audio sink).
|
|
132
|
+
*/
|
|
133
|
+
export interface RemoteBrowserAudioChunk {
|
|
134
|
+
/** The encoded audio data, Base64-encoded (no `data:` prefix). */
|
|
135
|
+
DataBase64: string;
|
|
136
|
+
/** The codec / container of {@link DataBase64}. `'webm-opus'` for the default in-page recorder. */
|
|
137
|
+
Codec: 'webm-opus' | 'opus' | 'pcm16';
|
|
138
|
+
/** Sample rate in Hz (typically 48000 for the Opus path). */
|
|
139
|
+
SampleRate: number;
|
|
140
|
+
/** Channel count (1 = mono, 2 = stereo). */
|
|
141
|
+
Channels: number;
|
|
142
|
+
/** Monotonically increasing sequence number for ordering / drop detection / resync. */
|
|
143
|
+
SequenceNumber: number;
|
|
144
|
+
/** Approximate duration of this chunk in milliseconds, when known. */
|
|
145
|
+
DurationMs?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A keyboard modifier key that can be held while a human input occurs. These ride on pointer clicks
|
|
149
|
+
* (so Shift-click text selection / Ctrl-click new-tab semantics relay faithfully) AND on key presses
|
|
150
|
+
* (so combos like Ctrl/Cmd+A select-all, Cmd+C / Cmd+V relay faithfully). `'Meta'` is the Command key
|
|
151
|
+
* on macOS / the Windows key elsewhere. Platform-agnostic at this layer — the CDP mapper translates to
|
|
152
|
+
* Playwright/CDP modifier syntax.
|
|
153
|
+
*/
|
|
154
|
+
export type RemoteBrowserModifierKey = 'Shift' | 'Control' | 'Alt' | 'Meta';
|
|
155
|
+
/**
|
|
156
|
+
* A human pointer move into the browser viewport.
|
|
157
|
+
*/
|
|
158
|
+
export interface RemoteBrowserPointerMoveInput {
|
|
159
|
+
Kind: 'pointer-move';
|
|
160
|
+
/** Viewport X coordinate. */
|
|
161
|
+
X: number;
|
|
162
|
+
/** Viewport Y coordinate. */
|
|
163
|
+
Y: number;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A human pointer click into the browser viewport.
|
|
167
|
+
*/
|
|
168
|
+
export interface RemoteBrowserPointerClickInput {
|
|
169
|
+
Kind: 'pointer-click';
|
|
170
|
+
/** Viewport X coordinate. */
|
|
171
|
+
X: number;
|
|
172
|
+
/** Viewport Y coordinate. */
|
|
173
|
+
Y: number;
|
|
174
|
+
/** Which mouse button was used (defaults to `'left'` when omitted). */
|
|
175
|
+
Button?: 'left' | 'middle' | 'right';
|
|
176
|
+
/**
|
|
177
|
+
* Modifier keys held during the click (e.g. `['Shift']` for shift-click text selection). Omitted /
|
|
178
|
+
* empty means no modifiers.
|
|
179
|
+
*/
|
|
180
|
+
Modifiers?: RemoteBrowserModifierKey[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A human pointer-button press (mouse-down) at a viewport point WITHOUT a release — the start of a
|
|
184
|
+
* click-drag. Pairs with {@link RemoteBrowserPointerUpInput} (and any intervening
|
|
185
|
+
* {@link RemoteBrowserPointerMoveInput}s) to relay a drag, e.g. click-drag text selection in a field.
|
|
186
|
+
*/
|
|
187
|
+
export interface RemoteBrowserPointerDownInput {
|
|
188
|
+
Kind: 'pointer-down';
|
|
189
|
+
/** Viewport X coordinate. */
|
|
190
|
+
X: number;
|
|
191
|
+
/** Viewport Y coordinate. */
|
|
192
|
+
Y: number;
|
|
193
|
+
/** Which mouse button was pressed (defaults to `'left'` when omitted). */
|
|
194
|
+
Button?: 'left' | 'middle' | 'right';
|
|
195
|
+
/** Modifier keys held during the press. Omitted / empty means no modifiers. */
|
|
196
|
+
Modifiers?: RemoteBrowserModifierKey[];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A human pointer-button release (mouse-up) at a viewport point — the end of a click-drag started by a
|
|
200
|
+
* {@link RemoteBrowserPointerDownInput}.
|
|
201
|
+
*/
|
|
202
|
+
export interface RemoteBrowserPointerUpInput {
|
|
203
|
+
Kind: 'pointer-up';
|
|
204
|
+
/** Viewport X coordinate. */
|
|
205
|
+
X: number;
|
|
206
|
+
/** Viewport Y coordinate. */
|
|
207
|
+
Y: number;
|
|
208
|
+
/** Which mouse button was released (defaults to `'left'` when omitted). */
|
|
209
|
+
Button?: 'left' | 'middle' | 'right';
|
|
210
|
+
/** Modifier keys held during the release. Omitted / empty means no modifiers. */
|
|
211
|
+
Modifiers?: RemoteBrowserModifierKey[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A human key press routed into the browser during takeover.
|
|
215
|
+
*/
|
|
216
|
+
export interface RemoteBrowserKeyInput {
|
|
217
|
+
Kind: 'key';
|
|
218
|
+
/** The key (or combination) pressed, in Playwright/CDP key syntax. */
|
|
219
|
+
Key: string;
|
|
220
|
+
/**
|
|
221
|
+
* Modifier keys held during the press (e.g. `['Control']` with `Key: 'a'` for select-all). The
|
|
222
|
+
* mapper composes these with `Key` into a single Playwright/CDP chord. Omitted / empty means the
|
|
223
|
+
* `Key` is pressed on its own.
|
|
224
|
+
*/
|
|
225
|
+
Modifiers?: RemoteBrowserModifierKey[];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* A human mouse-wheel / trackpad scroll into the browser viewport (Magic Mouse scroll, trackpad
|
|
229
|
+
* two-finger scroll, wheel). `X` / `Y` are the viewport pixel position the scroll occurred over (so a
|
|
230
|
+
* scroll targets the element under the pointer); `DeltaX` / `DeltaY` are the scroll deltas in pixels
|
|
231
|
+
* (positive `DeltaY` = down, positive `DeltaX` = right — matching the DOM `WheelEvent` convention).
|
|
232
|
+
*/
|
|
233
|
+
export interface RemoteBrowserScrollInput {
|
|
234
|
+
Kind: 'scroll';
|
|
235
|
+
/** Viewport X coordinate the scroll occurred over. */
|
|
236
|
+
X: number;
|
|
237
|
+
/** Viewport Y coordinate the scroll occurred over. */
|
|
238
|
+
Y: number;
|
|
239
|
+
/** Horizontal scroll delta in pixels (positive = right). */
|
|
240
|
+
DeltaX: number;
|
|
241
|
+
/** Vertical scroll delta in pixels (positive = down). */
|
|
242
|
+
DeltaY: number;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The full human-takeover input vocabulary — a discriminated union over `Kind`. When a human "grabs
|
|
246
|
+
* the wheel" in `Collaborative` (or watches in `ViewOnly`) their pointer/keyboard/scroll events arrive
|
|
247
|
+
* as these and route into the backend browser via {@link IRemoteBrowserSession.RouteHumanInput}.
|
|
248
|
+
* Strongly typed with no `any`; narrow on `input.Kind`.
|
|
249
|
+
*/
|
|
250
|
+
export type RemoteBrowserHumanInput = RemoteBrowserPointerMoveInput | RemoteBrowserPointerClickInput | RemoteBrowserPointerDownInput | RemoteBrowserPointerUpInput | RemoteBrowserKeyInput | RemoteBrowserScrollInput;
|
|
251
|
+
/**
|
|
252
|
+
* A live handle to a single remote-browser session, returned by
|
|
253
|
+
* {@link import('./base-remote-browser-provider.js').BaseRemoteBrowserProvider.Connect}.
|
|
254
|
+
*
|
|
255
|
+
* The **core** methods (`GetCdpEndpoint`, `Navigate`, `ExecuteAction`, `CaptureScreenshot`,
|
|
256
|
+
* `GetCurrentUrl`, `Close`) rest on the universal CDP substrate every backend provides and are always
|
|
257
|
+
* available. The remaining methods are **capability-gated** (feature-gated, documented per-method):
|
|
258
|
+
* the engine checks the provider's `SupportedFeatures` flag before calling them, and a backend that
|
|
259
|
+
* cannot satisfy a feature should reject/throw {@link
|
|
260
|
+
* import('./capability-errors.js').RemoteBrowserCapabilityNotSupportedError}.
|
|
261
|
+
*
|
|
262
|
+
* This is a pure interface — the concrete implementation lives in the server package / drivers (which
|
|
263
|
+
* own the Playwright + CDP machinery).
|
|
264
|
+
*/
|
|
265
|
+
export interface IRemoteBrowserSession {
|
|
266
|
+
/**
|
|
267
|
+
* Returns the Chrome DevTools Protocol endpoint for this session — the one primitive every
|
|
268
|
+
* backend exposes and the engine's computer-use loop connects to.
|
|
269
|
+
*
|
|
270
|
+
* @returns The CDP websocket/connect endpoint URL.
|
|
271
|
+
*/
|
|
272
|
+
GetCdpEndpoint(): string;
|
|
273
|
+
/**
|
|
274
|
+
* Navigates the browser to a URL. Convenience over {@link IRemoteBrowserSession.ExecuteAction}
|
|
275
|
+
* with a `navigate` action.
|
|
276
|
+
*
|
|
277
|
+
* @param url The absolute URL to load.
|
|
278
|
+
* @returns The action result (success + resulting URL).
|
|
279
|
+
*/
|
|
280
|
+
Navigate(url: string): Promise<RemoteBrowserActionResult>;
|
|
281
|
+
/**
|
|
282
|
+
* Executes a single agent {@link RemoteBrowserAction} over CDP.
|
|
283
|
+
*
|
|
284
|
+
* @param action The action to perform; narrow on `action.Kind`.
|
|
285
|
+
* @returns The action result.
|
|
286
|
+
*/
|
|
287
|
+
ExecuteAction(action: RemoteBrowserAction): Promise<RemoteBrowserActionResult>;
|
|
288
|
+
/**
|
|
289
|
+
* Captures a one-off screenshot of the current viewport.
|
|
290
|
+
*
|
|
291
|
+
* @returns The screenshot image, Base64-encoded.
|
|
292
|
+
*/
|
|
293
|
+
CaptureScreenshot(): Promise<string>;
|
|
294
|
+
/**
|
|
295
|
+
* Returns the browser's current URL synchronously (last known to the session).
|
|
296
|
+
*
|
|
297
|
+
* @returns The current page URL.
|
|
298
|
+
*/
|
|
299
|
+
GetCurrentUrl(): string;
|
|
300
|
+
/**
|
|
301
|
+
* Closes the session and releases the backend browser/container. Idempotent — safe to call once
|
|
302
|
+
* teardown has already begun.
|
|
303
|
+
*
|
|
304
|
+
* @returns A promise that resolves once the session is fully torn down.
|
|
305
|
+
*/
|
|
306
|
+
Close(): Promise<void>;
|
|
307
|
+
/**
|
|
308
|
+
* Returns an embeddable live-view URL so humans can watch the browser without MJ encoding frames.
|
|
309
|
+
*
|
|
310
|
+
* **Capability-gated** by `LiveView`. Backends without it reject with {@link
|
|
311
|
+
* import('./capability-errors.js').RemoteBrowserCapabilityNotSupportedError}.
|
|
312
|
+
*
|
|
313
|
+
* @returns The live-view URL.
|
|
314
|
+
*/
|
|
315
|
+
GetLiveViewUrl(): Promise<string>;
|
|
316
|
+
/**
|
|
317
|
+
* Begins streaming encoded viewport frames to `onFrame` (the source for the channel's ScreenOut
|
|
318
|
+
* track).
|
|
319
|
+
*
|
|
320
|
+
* **Capability-gated** by `ScreenStreaming`. Backends without it reject.
|
|
321
|
+
*
|
|
322
|
+
* @param onFrame Invoked with each encoded {@link RemoteBrowserScreencastFrame}.
|
|
323
|
+
* @returns A promise that resolves once the screencast has started.
|
|
324
|
+
*/
|
|
325
|
+
StartScreencast(onFrame: (frame: RemoteBrowserScreencastFrame) => void): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Stops a screencast previously started with {@link IRemoteBrowserSession.StartScreencast}.
|
|
328
|
+
*
|
|
329
|
+
* **Capability-gated** by `ScreenStreaming`. Backends without it reject.
|
|
330
|
+
*
|
|
331
|
+
* @returns A promise that resolves once streaming has stopped.
|
|
332
|
+
*/
|
|
333
|
+
StopScreencast(): Promise<void>;
|
|
334
|
+
/**
|
|
335
|
+
* Begins streaming the remote browser's tab audio to `onChunk` (the source for the channel's
|
|
336
|
+
* client-side audio player) — so a co-agent demoing a video/audio site is HEARD, not just seen.
|
|
337
|
+
*
|
|
338
|
+
* **Capability-gated by BACKEND IMPLEMENTATION** (v1): a backend without an audio-capture mechanism
|
|
339
|
+
* rejects with {@link import('./capability-errors.js').RemoteBrowserCapabilityNotSupportedError}, exactly
|
|
340
|
+
* like a non-streaming backend rejects {@link IRemoteBrowserSession.StartScreencast}. (A future
|
|
341
|
+
* metadata `AudioStreaming` feature flag is a documented fast-follow; v1 gates by whether the backend
|
|
342
|
+
* provides capture.)
|
|
343
|
+
*
|
|
344
|
+
* @param onChunk Invoked with each encoded {@link RemoteBrowserAudioChunk}.
|
|
345
|
+
* @returns A promise that resolves once the audio stream has started.
|
|
346
|
+
*/
|
|
347
|
+
StartAudioStream(onChunk: (chunk: RemoteBrowserAudioChunk) => void): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Stops an audio stream previously started with {@link IRemoteBrowserSession.StartAudioStream}.
|
|
350
|
+
*
|
|
351
|
+
* **Capability-gated by BACKEND IMPLEMENTATION** (v1). Backends without audio capture reject.
|
|
352
|
+
*
|
|
353
|
+
* @returns A promise that resolves once streaming has stopped.
|
|
354
|
+
*/
|
|
355
|
+
StopAudioStream(): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Routes a human takeover input (pointer move/click, key, scroll) into the backend browser.
|
|
358
|
+
*
|
|
359
|
+
* **Capability-gated** by `HumanTakeover` — only valid in `Collaborative` (and pointer-only
|
|
360
|
+
* observation in `ViewOnly`). Backends without it throw.
|
|
361
|
+
*
|
|
362
|
+
* @param input The human input event; narrow on `input.Kind`.
|
|
363
|
+
*/
|
|
364
|
+
RouteHumanInput(input: RemoteBrowserHumanInput): void;
|
|
365
|
+
/**
|
|
366
|
+
* Delegates a high-level natural-language intent to the backend's own AI-control harness (e.g.
|
|
367
|
+
* Browserbase Stagehand) instead of MJ's computer-use loop.
|
|
368
|
+
*
|
|
369
|
+
* **Capability-gated** by `NativeAIControl`. Backends without it reject.
|
|
370
|
+
*
|
|
371
|
+
* @param intent The natural-language intent (e.g. `'log in with the test account'`).
|
|
372
|
+
* @returns The action result.
|
|
373
|
+
*/
|
|
374
|
+
InvokeNativeAIControl(intent: string): Promise<RemoteBrowserActionResult>;
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=remote-browser-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-session.d.ts","sourceRoot":"","sources":["../src/remote-browser-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,IAAI,EAAE,UAAU,CAAC;IACjB,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,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;IAEzB;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAE/E;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAErC;;;;OAIG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;;;;OAKG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAIvB;;;;;;;OAOG;IACH,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAElC;;;;;;;;OAQG;IACH,eAAe,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvF;;;;;;OAMG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnF;;;;;;OAMG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,eAAe,CAAC,KAAK,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAEtD;;;;;;;;OAQG;IACH,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC7E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live-session contract for the Remote Browser channel and the self-contained, strongly-typed
|
|
3
|
+
* action / input / output payloads it carries.
|
|
4
|
+
*
|
|
5
|
+
* These types are defined **self-contained here** (no dependency on `@memberjunction/computer-use` or
|
|
6
|
+
* Playwright) so this Base package stays universal — usable client *and* server. The server package
|
|
7
|
+
* and the backend drivers (which depend on `@memberjunction/computer-use`) *implement*
|
|
8
|
+
* {@link IRemoteBrowserSession} against a real CDP-connected browser; this package only declares the
|
|
9
|
+
* shape both sides agree on.
|
|
10
|
+
*
|
|
11
|
+
* @see `/plans/realtime/realtime-bridges-architecture.md` §4d (the Remote Browser channel) and §4d-i
|
|
12
|
+
* (the one-primitive-CDP build decision).
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=remote-browser-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-browser-session.js","sourceRoot":"","sources":["../src/remote-browser-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/remote-browser-base",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.41.0",
|
|
5
|
+
"description": "MemberJunction: Universal (client+server) base layer for the Remote Browser channel — the provider registry cache, the capability-gated BaseRemoteBrowserProvider driver contract, the CDP-backed live-session interface, and the control mode/strategy helpers that the server engine and backend drivers build on.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "ts-node-dev src/index.ts",
|
|
13
|
+
"build": "tsc && tsc-alias -f",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest"
|
|
16
|
+
},
|
|
17
|
+
"author": "MemberJunction.com",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@memberjunction/core": "5.41.0",
|
|
21
|
+
"@memberjunction/global": "5.41.0",
|
|
22
|
+
"@memberjunction/core-entities": "5.41.0",
|
|
23
|
+
"rxjs": "^7.8.2"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "24.10.11",
|
|
27
|
+
"ts-node-dev": "^2.0.0",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"vitest": "^4.0.18"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
34
|
+
}
|
|
10
35
|
}
|