@allwright.dev/core 0.0.51 → 0.0.53

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 CHANGED
@@ -13,11 +13,14 @@ import { firefox } from "@allwright.dev/core";
13
13
 
14
14
  const browser = await firefox.launch();
15
15
  const page = browser.page();
16
- await page.goto("https://example.com");
16
+ await page.goto("https://themoderninternet.vercel.app");
17
+ await page.click(
18
+ "xpath=//div[contains(@class,'card')][.//h2[normalize-space()='Form Inputs']]//button[normalize-space()='Visit page']",
19
+ );
17
20
  await browser.close();
18
21
  ```
19
22
 
20
- A small runnable example also lives in [examples/basic.ts](./examples/basic.ts), and the fuller end-to-end playground lives in [examples/playground.ts](./examples/playground.ts).
23
+ Runnable examples live in [examples/web-basic.ts](./examples/web-basic.ts) and [examples/android-basic.ts](./examples/android-basic.ts).
21
24
 
22
25
  Shared config files are stack-agnostic and can live in `allwright.config.yaml` or `allwright.config.json`.
23
26
  The shared schema lives at the repo root in `allwright.schema.json`.
@@ -1,4 +1,2 @@
1
1
  export declare function ensureRuntimeReady(serverAddr: string): Promise<string>;
2
2
  export declare function shutdownManagedServer(): Promise<void>;
3
- export declare function ensurePluginsInstalled(pluginIds: string[]): Promise<void>;
4
- export declare function invokePlugin<TResponse>(pluginId: string, request: unknown): Promise<TResponse>;
package/dist/bootstrap.js CHANGED
@@ -12,7 +12,7 @@ const ALLWRIGHT_HOME_ENV_VAR = "ALLWRIGHT_HOME";
12
12
  const ALLWRIGHT_REPOSITORY_ENV_VAR = "ALLWRIGHT_REPOSITORY";
13
13
  const ALLWRIGHT_VERSION_ENV_VAR = "ALLWRIGHT_VERSION";
14
14
  const DEFAULT_RELEASE_REPOSITORY = "allwright-dev/allwright";
15
- const DEFAULT_RELEASE_VERSION = "0.0.51";
15
+ const DEFAULT_RELEASE_VERSION = "0.0.53";
16
16
  const STARTUP_TIMEOUT_MS = 20_000;
17
17
  const PING_TIMEOUT_MS = 1_000;
18
18
  const PROTO_ROOT = fileURLToPath(new URL("../proto/", import.meta.url));
@@ -168,65 +168,6 @@ async function installCli() {
168
168
  fs.rmSync(assetPath, { force: true });
169
169
  return cliPath;
170
170
  }
171
- export async function ensurePluginsInstalled(pluginIds) {
172
- const expectedVersion = expectedRuntimeVersion();
173
- const cliPath = await ensureCliAvailable(expectedVersion);
174
- ensurePluginsInstalledWithCli(cliPath, expectedVersion, pluginIds);
175
- }
176
- export async function invokePlugin(pluginId, request) {
177
- const expectedVersion = expectedRuntimeVersion();
178
- const cliPath = await ensureCliAvailable(expectedVersion);
179
- const requestJson = JSON.stringify(request);
180
- const result = spawnSync(cliPath, ["plugin", "invoke", pluginId, "--request-json", requestJson], {
181
- encoding: "utf8",
182
- stdio: ["ignore", "pipe", "pipe"],
183
- });
184
- if (result.error) {
185
- throw new Error(`failed to invoke allwright ${pluginId} plugin with ${cliPath}: ${result.error.message}`);
186
- }
187
- if (result.status !== 0) {
188
- const details = [result.stdout, result.stderr]
189
- .map((value) => value?.trim())
190
- .filter((value) => !!value)
191
- .join("\n");
192
- throw new Error(details
193
- ? `allwright ${pluginId} plugin invocation failed:\n${details}`
194
- : `allwright ${pluginId} plugin invocation failed`);
195
- }
196
- try {
197
- return JSON.parse(result.stdout);
198
- }
199
- catch (error) {
200
- throw new Error(`failed to decode allwright ${pluginId} plugin response: ${error instanceof Error ? error.message : String(error)}`);
201
- }
202
- }
203
- function ensurePluginsInstalledWithCli(cliPath, expectedVersion, pluginIds) {
204
- for (const pluginId of new Set(pluginIds.map((value) => value.trim()).filter(Boolean))) {
205
- const pluginPath = path.join(allwrightHome(), "plugins", pluginId, "lib", pluginLibraryFilename(pluginId));
206
- if (isFile(pluginPath) && installedPluginVersion(pluginId) === expectedVersion) {
207
- continue;
208
- }
209
- const result = spawnSync(cliPath, ["plugin", "install", pluginId, "--version", expectedVersion], {
210
- encoding: "utf8",
211
- stdio: ["ignore", "pipe", "pipe"],
212
- });
213
- if (result.error) {
214
- throw new Error(`failed to install allwright ${pluginId} plugin with ${cliPath}: ${result.error.message}`);
215
- }
216
- if (result.status !== 0 || !isFile(pluginPath)) {
217
- const details = [result.stdout, result.stderr]
218
- .map((value) => value?.trim())
219
- .filter((value) => !!value)
220
- .join("\n");
221
- throw new Error(details
222
- ? `allwright attempted to install the \`${pluginId}\` plugin automatically, but the install did not complete successfully:\n${details}`
223
- : `allwright attempted to install the \`${pluginId}\` plugin automatically, but the install did not complete successfully`);
224
- }
225
- if (installedPluginVersion(pluginId) !== expectedVersion) {
226
- throw new Error(`allwright attempted to install the \`${pluginId}\` plugin automatically, but version ${expectedVersion} is still not active`);
227
- }
228
- }
229
- }
230
171
  async function resolveReleaseTag() {
231
172
  const version = process.env[ALLWRIGHT_VERSION_ENV_VAR]?.trim() || DEFAULT_RELEASE_VERSION;
232
173
  if (version !== "latest") {
@@ -325,23 +266,6 @@ function isLocalServerAddr(serverAddr) {
325
266
  const host = parseServerHost(serverAddr);
326
267
  return host === "127.0.0.1" || host === "localhost" || host === "::1";
327
268
  }
328
- function installedPluginVersion(pluginId) {
329
- const manifestPath = path.join(allwrightHome(), "plugins.txt");
330
- if (!isFile(manifestPath)) {
331
- return null;
332
- }
333
- for (const line of fs.readFileSync(manifestPath, "utf8").split(/\r?\n/)) {
334
- const trimmed = line.trim();
335
- if (!trimmed || trimmed.startsWith("#")) {
336
- continue;
337
- }
338
- const [id, , version] = trimmed.split("\t", 3);
339
- if (id === pluginId && version) {
340
- return normalizeReleaseVersion(version);
341
- }
342
- }
343
- return null;
344
- }
345
269
  async function allocateManagedServerAddr(serverAddr) {
346
270
  const host = localBindingHost(serverAddr);
347
271
  const port = await new Promise((resolve, reject) => {
@@ -454,26 +378,6 @@ function findExtractedCli(extractRoot) {
454
378
  }
455
379
  return null;
456
380
  }
457
- function pluginLibraryFilename(pluginId) {
458
- const stem = pluginLibraryStem(pluginId);
459
- if (process.platform === "darwin") {
460
- return `lib${stem}.dylib`;
461
- }
462
- if (process.platform === "win32") {
463
- return `${stem}.dll`;
464
- }
465
- return `lib${stem}.so`;
466
- }
467
- function pluginLibraryStem(pluginId) {
468
- switch (pluginId) {
469
- case "web":
470
- return "allwright_surface_web";
471
- case "mobile-android":
472
- return "allwright_surface_mobile_android";
473
- default:
474
- throw new Error(`automatic install is not supported for allwright plugin \`${pluginId}\``);
475
- }
476
- }
477
381
  function autoInstallEnabled() {
478
382
  const raw = process.env[ALLWRIGHT_AUTO_INSTALL_ENV_VAR]?.trim().toLowerCase();
479
383
  return raw !== "0" && raw !== "false" && raw !== "no";
package/dist/browser.js CHANGED
@@ -33,7 +33,7 @@ export class BrowserImpl {
33
33
  this.launchNote = browserInfo.launchNote;
34
34
  this.cdpWebSocketURL = browserInfo.cdpWebSocketURL;
35
35
  this.userDataDir = browserInfo.userDataDir;
36
- this.#initialPage = this.#createPage(state.launched.initialTabSessionId ?? "");
36
+ this.#initialPage = this.#createPage(state.launched.initialPageSessionId ?? "");
37
37
  }
38
38
  sessionId;
39
39
  browserName;
@@ -52,17 +52,17 @@ export class BrowserImpl {
52
52
  async newPage(options = {}) {
53
53
  this.#ensureOpen();
54
54
  this.#stream.write({
55
- openTab: {
55
+ openContext: {
56
56
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
57
57
  },
58
58
  });
59
59
  while (true) {
60
60
  const event = await this.#queue.next();
61
- if (event.tabOpened?.tabSessionId) {
62
- return this.#createPage(event.tabOpened.tabSessionId);
61
+ if (event.contextOpened?.contextSessionId) {
62
+ return this.#createPage(event.contextOpened.contextSessionId);
63
63
  }
64
64
  if (event.error?.message) {
65
- throw formatActionError("open tab", event.error.message);
65
+ throw formatActionError("open page", event.error.message);
66
66
  }
67
67
  }
68
68
  }
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { PageImpl } from "./page.js";
5
5
  import { setServerAddr, shutdown } from "./runtime.js";
6
6
  import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
7
7
  export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown };
8
- export type { AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidPage, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
8
+ export type { AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
9
9
  export declare const chromium: BrowserType;
10
10
  export declare const firefox: BrowserType;
11
11
  export { mobile };
package/dist/mobile.js CHANGED
@@ -1,59 +1,90 @@
1
- import { invokePlugin } from "./bootstrap.js";
1
+ import { createBrowserSessionHandle, createPageHandle, getRuntime } from "./runtime.js";
2
2
  import { chainMobileSelectorForTransport, normalizeMobileSelectorForTransport } from "./mobileSelectors.js";
3
- function timeoutMsOf(options) {
4
- return options?.timeoutMs;
3
+ function retryOptions(timeoutMs) {
4
+ return timeoutMs ? { timeoutMs } : undefined;
5
5
  }
6
- async function invokeAndroidExpected(commandName, request) {
7
- const envelope = await invokePlugin("mobile-android", request);
8
- if (!envelope.ok) {
9
- throw new Error(envelope.error ?? `mobile-android plugin ${commandName} failed`);
10
- }
11
- if (envelope.result === undefined) {
12
- throw new Error(`mobile-android plugin ${commandName} returned no result`);
13
- }
14
- return envelope.result;
15
- }
16
- class MobileAndroidPageImpl {
17
- browserSession;
18
- pageSession;
19
- constructor(browserSession, pageSession) {
20
- this.browserSession = browserSession;
21
- this.pageSession = pageSession;
22
- }
23
- get sessionId() {
24
- return this.pageSession.page_id;
6
+ class MobileAndroidAppImpl {
7
+ sessionId;
8
+ #runtime;
9
+ #surfaceSessionId;
10
+ #handlePromise = null;
11
+ constructor(runtime, surfaceSessionId, sessionId) {
12
+ this.sessionId = sessionId;
13
+ this.#runtime = runtime;
14
+ this.#surfaceSessionId = surfaceSessionId;
25
15
  }
26
16
  locator(selector) {
27
17
  return new MobileAndroidLocatorImpl(this, normalizeMobileSelectorForTransport(selector));
28
18
  }
29
19
  async click(selector, options = {}) {
30
- const result = await invokeAndroidExpected("click", {
31
- command: "click_element",
32
- browser_session: this.browserSession,
33
- page_session: this.pageSession,
34
- selector: normalizeMobileSelectorForTransport(selector),
35
- timeout_ms: timeoutMsOf(options),
20
+ const handle = await this.#getHandle();
21
+ this.#ensureOpen(handle);
22
+ handle.stream.write({
23
+ surfaceSessionId: this.#surfaceSessionId,
24
+ contextSessionId: this.sessionId,
25
+ clickElement: {
26
+ cssSelector: normalizeMobileSelectorForTransport(selector),
27
+ retryOptions: retryOptions(options.timeoutMs),
28
+ },
36
29
  });
37
- return {
38
- selector: result.selector,
39
- note: result.note,
40
- bidiSessionId: result.session_id,
41
- };
30
+ while (true) {
31
+ const event = await handle.queue.next();
32
+ if (event.elementClicked) {
33
+ return {
34
+ selector: event.elementClicked.cssSelector ?? "",
35
+ note: event.elementClicked.note ?? "",
36
+ bidiSessionId: event.elementClicked.bidiSessionId ?? "",
37
+ };
38
+ }
39
+ if (event.error?.message) {
40
+ throw new Error(event.error.message);
41
+ }
42
+ if (event.closed) {
43
+ handle.closed = true;
44
+ throw new Error(`android app session ${this.sessionId} closed while clicking`);
45
+ }
46
+ }
42
47
  }
43
48
  async fill(selector, value, options = {}) {
44
- const result = await invokeAndroidExpected("fill", {
45
- command: "fill_element",
46
- browser_session: this.browserSession,
47
- page_session: this.pageSession,
48
- selector: normalizeMobileSelectorForTransport(selector),
49
- value,
50
- timeout_ms: timeoutMsOf(options),
49
+ const handle = await this.#getHandle();
50
+ this.#ensureOpen(handle);
51
+ handle.stream.write({
52
+ surfaceSessionId: this.#surfaceSessionId,
53
+ contextSessionId: this.sessionId,
54
+ fillElement: {
55
+ cssSelector: normalizeMobileSelectorForTransport(selector),
56
+ value,
57
+ retryOptions: retryOptions(options.timeoutMs),
58
+ },
51
59
  });
52
- return {
53
- selector: result.selector,
54
- value: result.value,
55
- note: result.note,
56
- };
60
+ while (true) {
61
+ const event = await handle.queue.next();
62
+ if (event.elementFilled) {
63
+ return {
64
+ selector: event.elementFilled.cssSelector ?? "",
65
+ value: event.elementFilled.value ?? "",
66
+ note: event.elementFilled.note ?? "",
67
+ };
68
+ }
69
+ if (event.error?.message) {
70
+ throw new Error(event.error.message);
71
+ }
72
+ if (event.closed) {
73
+ handle.closed = true;
74
+ throw new Error(`android app session ${this.sessionId} closed while filling`);
75
+ }
76
+ }
77
+ }
78
+ async #getHandle() {
79
+ if (!this.#handlePromise) {
80
+ this.#handlePromise = createPageHandle(this.#runtime);
81
+ }
82
+ return this.#handlePromise;
83
+ }
84
+ #ensureOpen(handle) {
85
+ if (handle.closed) {
86
+ throw new Error(`android app session ${this.sessionId} is closed`);
87
+ }
57
88
  }
58
89
  }
59
90
  class MobileAndroidLocatorImpl {
@@ -74,48 +105,81 @@ class MobileAndroidLocatorImpl {
74
105
  }
75
106
  }
76
107
  class MobileAndroidDeviceImpl {
77
- connectInfoRaw;
78
- #initialPage;
79
- constructor(connectInfoRaw) {
80
- this.connectInfoRaw = connectInfoRaw;
81
- this.#initialPage = new MobileAndroidPageImpl(this.connectInfoRaw.browser_session, this.connectInfoRaw.initial_page.page_session);
82
- }
83
- get sessionId() {
84
- return this.connectInfoRaw.browser_session.automation.session_id;
85
- }
86
- page() {
87
- return this.#initialPage;
88
- }
89
- initialPage() {
90
- return this.#initialPage;
108
+ sessionId;
109
+ surfaceSessionId;
110
+ runtime;
111
+ #stream;
112
+ #queue;
113
+ #closed = false;
114
+ #currentApp;
115
+ constructor(sessionId, surfaceSessionId, runtime, stream, queue, initialAppSessionId) {
116
+ this.sessionId = sessionId;
117
+ this.surfaceSessionId = surfaceSessionId;
118
+ this.runtime = runtime;
119
+ this.#stream = stream;
120
+ this.#queue = queue;
121
+ this.#currentApp = new MobileAndroidAppImpl(runtime, surfaceSessionId, initialAppSessionId);
122
+ }
123
+ app() {
124
+ return this.#currentApp;
125
+ }
126
+ initialApp() {
127
+ return this.#currentApp;
91
128
  }
92
129
  async launch(options = {}) {
93
- const page = await invokeAndroidExpected("launch", {
94
- command: "launch_app",
95
- browser_session: this.connectInfoRaw.browser_session,
96
- options: {
97
- apk_path: options.apkPath,
98
- app_id: options.appId,
99
- launch_activity: options.launchActivity,
100
- stop_before_launch: options.stopBeforeLaunch ?? false,
101
- timeout_ms: timeoutMsOf(options),
130
+ this.#ensureOpen();
131
+ this.#stream.write({
132
+ launchApp: {
133
+ apkPath: options.apkPath,
134
+ appId: options.appId,
135
+ launchActivity: options.launchActivity,
136
+ stopBeforeLaunch: options.stopBeforeLaunch ?? false,
137
+ retryOptions: retryOptions(options.timeoutMs),
102
138
  },
103
139
  });
104
- this.#initialPage = new MobileAndroidPageImpl(this.connectInfoRaw.browser_session, page.page_session);
105
- return this.#initialPage;
140
+ while (true) {
141
+ const event = await this.#queue.next();
142
+ if (event.appLaunched?.appSessionId) {
143
+ this.#currentApp = new MobileAndroidAppImpl(this.runtime, this.surfaceSessionId, event.appLaunched.appSessionId);
144
+ return this.#currentApp;
145
+ }
146
+ if (event.error?.message) {
147
+ throw new Error(event.error.message);
148
+ }
149
+ if (event.closed) {
150
+ this.#closed = true;
151
+ throw new Error(`android device session ${this.sessionId} closed while launching app`);
152
+ }
153
+ }
154
+ }
155
+ #ensureOpen() {
156
+ if (this.#closed) {
157
+ throw new Error(`android device session ${this.sessionId} is closed`);
158
+ }
106
159
  }
107
160
  }
108
161
  class MobileAndroidSurfaceImpl {
109
162
  async connect(options = {}) {
110
- const connectInfo = await invokeAndroidExpected("connect", {
111
- command: "connect",
112
- platform: "android",
113
- device: options.device,
114
- adb_endpoint: options.adbEndpoint,
115
- preserve_app_state: options.preserveAppState ?? false,
116
- timeout_ms: timeoutMsOf(options),
163
+ const runtime = await getRuntime();
164
+ const { stream, queue } = await createBrowserSessionHandle(runtime);
165
+ stream.write({
166
+ connectMobile: {
167
+ platform: 1,
168
+ device: options.device,
169
+ adbEndpoint: options.adbEndpoint,
170
+ preserveAppState: options.preserveAppState ?? false,
171
+ retryOptions: retryOptions(options.timeoutMs),
172
+ },
117
173
  });
118
- return new MobileAndroidDeviceImpl(connectInfo);
174
+ while (true) {
175
+ const event = await queue.next();
176
+ if (event.mobileConnected?.initialAppSessionId) {
177
+ return new MobileAndroidDeviceImpl(event.mobileConnected.deviceSessionId ?? event.sessionId ?? "", event.sessionId ?? "", runtime, stream, queue, event.mobileConnected.initialAppSessionId);
178
+ }
179
+ if (event.error?.message) {
180
+ throw new Error(event.error.message);
181
+ }
182
+ }
119
183
  }
120
184
  }
121
185
  export const mobile = {
package/dist/page.js CHANGED
@@ -19,8 +19,8 @@ export class PageImpl {
19
19
  const handle = await this.#getHandle();
20
20
  this.#ensureOpen(handle);
21
21
  handle.stream.write({
22
- browserSessionId: this.browserSessionId,
23
- tabSessionId: this.sessionId,
22
+ surfaceSessionId: this.browserSessionId,
23
+ contextSessionId: this.sessionId,
24
24
  navigate: {
25
25
  url,
26
26
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
@@ -60,8 +60,8 @@ export class PageImpl {
60
60
  this.#ensureOpen(handle);
61
61
  const transportSelector = normalizeSelectorForTransport(selector);
62
62
  handle.stream.write({
63
- browserSessionId: this.browserSessionId,
64
- tabSessionId: this.sessionId,
63
+ surfaceSessionId: this.browserSessionId,
64
+ contextSessionId: this.sessionId,
65
65
  clickElement: {
66
66
  cssSelector: transportSelector,
67
67
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
@@ -90,8 +90,8 @@ export class PageImpl {
90
90
  this.#ensureOpen(handle);
91
91
  const transportSelector = normalizeSelectorForTransport(selector);
92
92
  handle.stream.write({
93
- browserSessionId: this.browserSessionId,
94
- tabSessionId: this.sessionId,
93
+ surfaceSessionId: this.browserSessionId,
94
+ contextSessionId: this.sessionId,
95
95
  countElements: {
96
96
  cssSelector: transportSelector,
97
97
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
@@ -120,8 +120,8 @@ export class PageImpl {
120
120
  this.#ensureOpen(handle);
121
121
  const transportSelector = normalizeSelectorForTransport(selector);
122
122
  handle.stream.write({
123
- browserSessionId: this.browserSessionId,
124
- tabSessionId: this.sessionId,
123
+ surfaceSessionId: this.browserSessionId,
124
+ contextSessionId: this.sessionId,
125
125
  highlightElements: {
126
126
  cssSelector: transportSelector,
127
127
  durationMs: options.durationMs,
@@ -151,8 +151,8 @@ export class PageImpl {
151
151
  this.#ensureOpen(handle);
152
152
  const transportSelector = normalizeSelectorForTransport(selector);
153
153
  handle.stream.write({
154
- browserSessionId: this.browserSessionId,
155
- tabSessionId: this.sessionId,
154
+ surfaceSessionId: this.browserSessionId,
155
+ contextSessionId: this.sessionId,
156
156
  focusElement: {
157
157
  cssSelector: transportSelector,
158
158
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
@@ -180,8 +180,8 @@ export class PageImpl {
180
180
  this.#ensureOpen(handle);
181
181
  const transportSelector = normalizeSelectorForTransport(selector);
182
182
  handle.stream.write({
183
- browserSessionId: this.browserSessionId,
184
- tabSessionId: this.sessionId,
183
+ surfaceSessionId: this.browserSessionId,
184
+ contextSessionId: this.sessionId,
185
185
  fillElement: {
186
186
  cssSelector: transportSelector,
187
187
  value,
@@ -211,8 +211,8 @@ export class PageImpl {
211
211
  this.#ensureOpen(handle);
212
212
  const transportSelector = normalizeSelectorForTransport(selector);
213
213
  handle.stream.write({
214
- browserSessionId: this.browserSessionId,
215
- tabSessionId: this.sessionId,
214
+ surfaceSessionId: this.browserSessionId,
215
+ contextSessionId: this.sessionId,
216
216
  hoverElement: {
217
217
  cssSelector: transportSelector,
218
218
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
@@ -240,8 +240,8 @@ export class PageImpl {
240
240
  this.#ensureOpen(handle);
241
241
  const transportSelector = normalizeSelectorForTransport(selector);
242
242
  handle.stream.write({
243
- browserSessionId: this.browserSessionId,
244
- tabSessionId: this.sessionId,
243
+ surfaceSessionId: this.browserSessionId,
244
+ contextSessionId: this.sessionId,
245
245
  pressKey: {
246
246
  cssSelector: transportSelector,
247
247
  key,
@@ -278,8 +278,8 @@ export class PageImpl {
278
278
  this.#ensureOpen(handle);
279
279
  const transportSelector = normalizeSelectorForTransport(selector);
280
280
  handle.stream.write({
281
- browserSessionId: this.browserSessionId,
282
- tabSessionId: this.sessionId,
281
+ surfaceSessionId: this.browserSessionId,
282
+ contextSessionId: this.sessionId,
283
283
  waitForSelector: {
284
284
  cssSelector: transportSelector,
285
285
  visible: options.visible,
@@ -310,8 +310,8 @@ export class PageImpl {
310
310
  return;
311
311
  }
312
312
  handle.stream.write({
313
- browserSessionId: this.browserSessionId,
314
- tabSessionId: this.sessionId,
313
+ surfaceSessionId: this.browserSessionId,
314
+ contextSessionId: this.sessionId,
315
315
  close: {},
316
316
  });
317
317
  while (true) {
@@ -330,8 +330,8 @@ export class PageImpl {
330
330
  const handle = await this.#getHandle();
331
331
  this.#ensureOpen(handle);
332
332
  handle.stream.write({
333
- browserSessionId: this.browserSessionId,
334
- tabSessionId: this.sessionId,
333
+ surfaceSessionId: this.browserSessionId,
334
+ contextSessionId: this.sessionId,
335
335
  ping: {
336
336
  message,
337
337
  },
@@ -365,16 +365,16 @@ export class PageImpl {
365
365
  const transportSelector = normalizeSelectorForTransport(selector);
366
366
  handle.stream.write(textContent
367
367
  ? {
368
- browserSessionId: this.browserSessionId,
369
- tabSessionId: this.sessionId,
368
+ surfaceSessionId: this.browserSessionId,
369
+ contextSessionId: this.sessionId,
370
370
  getTextContent: {
371
371
  cssSelector: transportSelector,
372
372
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
373
373
  },
374
374
  }
375
375
  : {
376
- browserSessionId: this.browserSessionId,
377
- tabSessionId: this.sessionId,
376
+ surfaceSessionId: this.browserSessionId,
377
+ contextSessionId: this.sessionId,
378
378
  getInnerText: {
379
379
  cssSelector: transportSelector,
380
380
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
package/dist/runtime.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { EventQueue } from "./types.js";
2
- import type { BrowserSessionEvent, BrowserSessionStream, Browser, BrowserKind, LaunchOptions, PageHandle, ResolveConfigOptions, ResolvedAllwrightConfig, RuntimeClient } from "./types.js";
2
+ import type { SurfaceSessionEvent, SurfaceSessionStream, Browser, BrowserKind, LaunchOptions, PageHandle, ResolveConfigOptions, ResolvedAllwrightConfig, RuntimeClient } from "./types.js";
3
3
  export declare function setServerAddr(serverAddr: string): void;
4
4
  export declare function shutdown(): Promise<void>;
5
5
  export declare function ping(): Promise<string>;
6
6
  export declare function getRuntime(): Promise<RuntimeClient>;
7
7
  export declare function createPageHandle(runtime: RuntimeClient): Promise<PageHandle>;
8
8
  export declare function createBrowserSessionHandle(runtime: RuntimeClient): Promise<{
9
- stream: BrowserSessionStream;
10
- queue: EventQueue<BrowserSessionEvent>;
9
+ stream: SurfaceSessionStream;
10
+ queue: EventQueue<SurfaceSessionEvent>;
11
11
  }>;
12
12
  export declare function launchConfiguredBrowser(config: ResolvedAllwrightConfig, launchBrowserKind: (browserKind: BrowserKind, options?: LaunchOptions) => Promise<Browser>): Promise<Browser>;
13
13
  export declare function normalizeServerAddr(raw: string): string;
package/dist/runtime.js CHANGED
@@ -43,7 +43,7 @@ export async function getRuntime() {
43
43
  return runtimePromise;
44
44
  }
45
45
  export async function createPageHandle(runtime) {
46
- const stream = runtime.client.TabSession();
46
+ const stream = runtime.client.ContextSession();
47
47
  const queue = bindStreamQueue(stream);
48
48
  return {
49
49
  stream,
@@ -52,7 +52,7 @@ export async function createPageHandle(runtime) {
52
52
  };
53
53
  }
54
54
  export async function createBrowserSessionHandle(runtime) {
55
- const stream = runtime.client.BrowserSession();
55
+ const stream = runtime.client.SurfaceSession();
56
56
  const queue = bindStreamQueue(stream);
57
57
  return { stream, queue };
58
58
  }
package/dist/types.d.ts CHANGED
@@ -128,13 +128,13 @@ export interface MobileAndroidLaunchOptions {
128
128
  timeoutMs?: number;
129
129
  }
130
130
  export interface MobileAndroidLocator {
131
- readonly page: MobileAndroidPage;
131
+ readonly page: MobileAndroidApp;
132
132
  readonly selector: string;
133
133
  click(options?: CommandOptions): Promise<ClickResult>;
134
134
  fill(value: string, options?: CommandOptions): Promise<FillResult>;
135
135
  locator(selector: string): MobileAndroidLocator;
136
136
  }
137
- export interface MobileAndroidPage {
137
+ export interface MobileAndroidApp {
138
138
  readonly sessionId: string;
139
139
  locator(selector: string): MobileAndroidLocator;
140
140
  click(selector: string, options?: CommandOptions): Promise<ClickResult>;
@@ -142,9 +142,9 @@ export interface MobileAndroidPage {
142
142
  }
143
143
  export interface MobileAndroidDevice {
144
144
  readonly sessionId: string;
145
- page(): MobileAndroidPage;
146
- initialPage(): MobileAndroidPage;
147
- launch(options?: MobileAndroidLaunchOptions): Promise<MobileAndroidPage>;
145
+ app(): MobileAndroidApp;
146
+ initialApp(): MobileAndroidApp;
147
+ launch(options?: MobileAndroidLaunchOptions): Promise<MobileAndroidApp>;
148
148
  }
149
149
  export interface MobileSurfaceNamespace {
150
150
  android: {
@@ -267,22 +267,41 @@ export interface ChromeLaunchedPayload {
267
267
  note?: string;
268
268
  cdpWebsocketUrl?: string;
269
269
  userDataDir?: string;
270
- initialTabSessionId?: string;
270
+ initialPageSessionId?: string;
271
271
  }
272
272
  export interface BrowserLaunchedPayload {
273
273
  browserKind?: number;
274
274
  browser?: string;
275
275
  note?: string;
276
276
  userDataDir?: string;
277
- initialTabSessionId?: string;
277
+ initialPageSessionId?: string;
278
278
  }
279
- export interface BrowserSessionEvent {
279
+ export interface SurfaceSessionEvent {
280
280
  sessionId?: string;
281
281
  event?: string;
282
282
  chromeLaunched?: ChromeLaunchedPayload;
283
283
  browserLaunched?: BrowserLaunchedPayload;
284
- tabOpened?: {
285
- tabSessionId?: string;
284
+ mobileConnected?: {
285
+ platform?: number | string;
286
+ deviceName?: string;
287
+ note?: string;
288
+ deviceId?: string;
289
+ connectionKind?: number | string;
290
+ backend?: string;
291
+ deviceSessionId?: string;
292
+ initialAppSessionId?: string;
293
+ packageName?: string;
294
+ activityName?: string;
295
+ };
296
+ appLaunched?: {
297
+ appSessionId?: string;
298
+ note?: string;
299
+ packageName?: string;
300
+ activityName?: string;
301
+ webviewContext?: string;
302
+ };
303
+ contextOpened?: {
304
+ contextSessionId?: string;
286
305
  note?: string;
287
306
  };
288
307
  pong?: {
@@ -295,8 +314,8 @@ export interface BrowserSessionEvent {
295
314
  message?: string;
296
315
  };
297
316
  }
298
- export interface TabSessionEvent {
299
- tabSessionId?: string;
317
+ export interface ContextSessionEvent {
318
+ contextSessionId?: string;
300
319
  event?: string;
301
320
  attached?: {
302
321
  note?: string;
@@ -387,31 +406,53 @@ export interface LaunchBrowserRequest {
387
406
  };
388
407
  };
389
408
  }
390
- export interface OpenTabRequest {
391
- openTab: {
409
+ export interface OpenContextRequest {
410
+ openContext: {
411
+ retryOptions?: {
412
+ timeoutMs?: number;
413
+ };
414
+ };
415
+ }
416
+ export interface ConnectMobileRequest {
417
+ connectMobile: {
418
+ platform: number;
419
+ device?: string;
420
+ adbEndpoint?: string;
421
+ preserveAppState?: boolean;
422
+ retryOptions?: {
423
+ timeoutMs?: number;
424
+ };
425
+ };
426
+ }
427
+ export interface LaunchAppRequest {
428
+ launchApp: {
429
+ apkPath?: string;
430
+ appId?: string;
431
+ launchActivity?: string;
432
+ stopBeforeLaunch?: boolean;
392
433
  retryOptions?: {
393
434
  timeoutMs?: number;
394
435
  };
395
436
  };
396
437
  }
397
- export interface BrowserPingRequest {
438
+ export interface SurfacePingRequest {
398
439
  ping: {
399
440
  message: string;
400
441
  };
401
442
  }
402
- export interface CloseBrowserRequest {
443
+ export interface CloseSurfaceRequest {
403
444
  close: Record<string, never>;
404
445
  }
405
- export interface TabPingRequest {
406
- browserSessionId: string;
407
- tabSessionId: string;
446
+ export interface ContextPingRequest {
447
+ surfaceSessionId: string;
448
+ contextSessionId: string;
408
449
  ping: {
409
450
  message: string;
410
451
  };
411
452
  }
412
453
  export interface NavigateRequest {
413
- browserSessionId: string;
414
- tabSessionId: string;
454
+ surfaceSessionId: string;
455
+ contextSessionId: string;
415
456
  navigate: {
416
457
  url: string;
417
458
  retryOptions?: {
@@ -420,8 +461,8 @@ export interface NavigateRequest {
420
461
  };
421
462
  }
422
463
  export interface ClickRequest {
423
- browserSessionId: string;
424
- tabSessionId: string;
464
+ surfaceSessionId: string;
465
+ contextSessionId: string;
425
466
  clickElement: {
426
467
  cssSelector: string;
427
468
  retryOptions?: {
@@ -430,8 +471,8 @@ export interface ClickRequest {
430
471
  };
431
472
  }
432
473
  export interface CountRequest {
433
- browserSessionId: string;
434
- tabSessionId: string;
474
+ surfaceSessionId: string;
475
+ contextSessionId: string;
435
476
  countElements: {
436
477
  cssSelector: string;
437
478
  retryOptions?: {
@@ -440,8 +481,8 @@ export interface CountRequest {
440
481
  };
441
482
  }
442
483
  export interface HighlightRequest {
443
- browserSessionId: string;
444
- tabSessionId: string;
484
+ surfaceSessionId: string;
485
+ contextSessionId: string;
445
486
  highlightElements: {
446
487
  cssSelector: string;
447
488
  durationMs?: number;
@@ -451,8 +492,8 @@ export interface HighlightRequest {
451
492
  };
452
493
  }
453
494
  export interface FocusRequest {
454
- browserSessionId: string;
455
- tabSessionId: string;
495
+ surfaceSessionId: string;
496
+ contextSessionId: string;
456
497
  focusElement: {
457
498
  cssSelector: string;
458
499
  retryOptions?: {
@@ -461,8 +502,8 @@ export interface FocusRequest {
461
502
  };
462
503
  }
463
504
  export interface FillRequest {
464
- browserSessionId: string;
465
- tabSessionId: string;
505
+ surfaceSessionId: string;
506
+ contextSessionId: string;
466
507
  fillElement: {
467
508
  cssSelector: string;
468
509
  value: string;
@@ -472,8 +513,8 @@ export interface FillRequest {
472
513
  };
473
514
  }
474
515
  export interface HoverRequest {
475
- browserSessionId: string;
476
- tabSessionId: string;
516
+ surfaceSessionId: string;
517
+ contextSessionId: string;
477
518
  hoverElement: {
478
519
  cssSelector: string;
479
520
  retryOptions?: {
@@ -482,8 +523,8 @@ export interface HoverRequest {
482
523
  };
483
524
  }
484
525
  export interface PressRequest {
485
- browserSessionId: string;
486
- tabSessionId: string;
526
+ surfaceSessionId: string;
527
+ contextSessionId: string;
487
528
  pressKey: {
488
529
  cssSelector: string;
489
530
  key: string;
@@ -494,8 +535,8 @@ export interface PressRequest {
494
535
  };
495
536
  }
496
537
  export interface TextContentRequest {
497
- browserSessionId: string;
498
- tabSessionId: string;
538
+ surfaceSessionId: string;
539
+ contextSessionId: string;
499
540
  getTextContent: {
500
541
  cssSelector: string;
501
542
  retryOptions?: {
@@ -504,8 +545,8 @@ export interface TextContentRequest {
504
545
  };
505
546
  }
506
547
  export interface InnerTextRequest {
507
- browserSessionId: string;
508
- tabSessionId: string;
548
+ surfaceSessionId: string;
549
+ contextSessionId: string;
509
550
  getInnerText: {
510
551
  cssSelector: string;
511
552
  retryOptions?: {
@@ -514,8 +555,8 @@ export interface InnerTextRequest {
514
555
  };
515
556
  }
516
557
  export interface WaitForSelectorRequest {
517
- browserSessionId: string;
518
- tabSessionId: string;
558
+ surfaceSessionId: string;
559
+ contextSessionId: string;
519
560
  waitForSelector: {
520
561
  cssSelector: string;
521
562
  visible?: boolean;
@@ -524,19 +565,19 @@ export interface WaitForSelectorRequest {
524
565
  };
525
566
  };
526
567
  }
527
- export interface CloseTabRequest {
528
- browserSessionId: string;
529
- tabSessionId: string;
568
+ export interface CloseContextRequest {
569
+ surfaceSessionId: string;
570
+ contextSessionId: string;
530
571
  close: Record<string, never>;
531
572
  }
532
- export type BrowserSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenTabRequest | BrowserPingRequest | CloseBrowserRequest;
533
- export type TabSessionRequest = TabPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | CloseTabRequest;
534
- export type BrowserSessionStream = grpc.ClientDuplexStream<BrowserSessionRequest, BrowserSessionEvent>;
535
- export type PageSessionStream = grpc.ClientDuplexStream<TabSessionRequest, TabSessionEvent>;
573
+ export type SurfaceSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenContextRequest | ConnectMobileRequest | LaunchAppRequest | SurfacePingRequest | CloseSurfaceRequest;
574
+ export type ContextSessionRequest = ContextPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | CloseContextRequest;
575
+ export type SurfaceSessionStream = grpc.ClientDuplexStream<SurfaceSessionRequest, SurfaceSessionEvent>;
576
+ export type ContextSessionStream = grpc.ClientDuplexStream<ContextSessionRequest, ContextSessionEvent>;
536
577
  export interface EngineServiceClientShape {
537
578
  Ping(request: Record<string, never>, callback: (error: grpc.ServiceError | null, response: PingResponse) => void): void;
538
- BrowserSession(): BrowserSessionStream;
539
- TabSession(): PageSessionStream;
579
+ SurfaceSession(): SurfaceSessionStream;
580
+ ContextSession(): ContextSessionStream;
540
581
  close(): void;
541
582
  }
542
583
  export interface EngineProtoRoot {
@@ -553,14 +594,14 @@ export interface RuntimeClient {
553
594
  }
554
595
  export interface BrowserLaunchState {
555
596
  runtime: RuntimeClient;
556
- stream: BrowserSessionStream;
557
- queue: EventQueue<BrowserSessionEvent>;
597
+ stream: SurfaceSessionStream;
598
+ queue: EventQueue<SurfaceSessionEvent>;
558
599
  sessionId: string;
559
600
  launched: BrowserLaunchedPayload;
560
601
  }
561
602
  export interface PageHandle {
562
- stream: PageSessionStream;
563
- queue: EventQueue<TabSessionEvent>;
603
+ stream: ContextSessionStream;
604
+ queue: EventQueue<ContextSessionEvent>;
564
605
  closed: boolean;
565
606
  }
566
607
  export declare class EventQueue<T> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,7 +37,8 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.json",
40
- "example:playground": "bun run examples/playground.ts",
40
+ "example:web": "bun run examples/web-basic.ts",
41
+ "example:android": "bun run examples/android-basic.ts",
41
42
  "prepublishOnly": "bun run build"
42
43
  },
43
44
  "dependencies": {
@@ -4,19 +4,22 @@ package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
5
 
6
6
  import "core/v1/common.proto";
7
+ import "surfaces/mobile/v1/mobile.proto";
7
8
  import "surfaces/web/v1/web.proto";
8
9
 
9
- message BrowserSessionCommand {
10
+ message SurfaceSessionCommand {
10
11
  oneof command {
11
12
  LaunchChromeCommand launch_chrome = 1;
12
- OpenTabCommand open_tab = 2;
13
+ OpenContextCommand open_context = 2;
13
14
  SessionPingCommand ping = 3;
14
- CloseBrowserSessionCommand close = 4;
15
+ CloseSurfaceSessionCommand close = 4;
15
16
  LaunchBrowserCommand launch_browser = 5;
17
+ ConnectMobileCommand connect_mobile = 6;
18
+ LaunchAppCommand launch_app = 7;
16
19
  }
17
20
  }
18
21
 
19
- message OpenTabCommand {
22
+ message OpenContextCommand {
20
23
  optional CommandRetryOptions retry_options = 1;
21
24
  }
22
25
 
@@ -24,23 +27,25 @@ message SessionPingCommand {
24
27
  string message = 1;
25
28
  }
26
29
 
27
- message CloseBrowserSessionCommand {}
30
+ message CloseSurfaceSessionCommand {}
28
31
 
29
- message BrowserSessionEvent {
32
+ message SurfaceSessionEvent {
30
33
  string session_id = 1;
31
34
 
32
35
  oneof event {
33
36
  ChromeLaunchedEvent chrome_launched = 2;
34
- TabOpenedEvent tab_opened = 3;
37
+ ContextOpenedEvent context_opened = 3;
35
38
  SessionPongEvent pong = 4;
36
- BrowserSessionClosedEvent closed = 5;
37
- BrowserSessionErrorEvent error = 6;
39
+ SurfaceSessionClosedEvent closed = 5;
40
+ SurfaceSessionErrorEvent error = 6;
38
41
  BrowserLaunchedEvent browser_launched = 7;
42
+ MobileConnectedEvent mobile_connected = 8;
43
+ AppLaunchedEvent app_launched = 9;
39
44
  }
40
45
  }
41
46
 
42
- message TabOpenedEvent {
43
- string tab_session_id = 1;
47
+ message ContextOpenedEvent {
48
+ string context_session_id = 1;
44
49
  string note = 2;
45
50
  }
46
51
 
@@ -48,10 +53,10 @@ message SessionPongEvent {
48
53
  string message = 1;
49
54
  }
50
55
 
51
- message BrowserSessionClosedEvent {
56
+ message SurfaceSessionClosedEvent {
52
57
  string reason = 1;
53
58
  }
54
59
 
55
- message BrowserSessionErrorEvent {
60
+ message SurfaceSessionErrorEvent {
56
61
  string message = 1;
57
62
  }
@@ -5,14 +5,14 @@ option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
5
 
6
6
  import "surfaces/web/v1/web.proto";
7
7
 
8
- message TabSessionCommand {
9
- string browser_session_id = 1;
10
- string tab_session_id = 2;
8
+ message ContextSessionCommand {
9
+ string surface_session_id = 1;
10
+ string context_session_id = 2;
11
11
 
12
12
  oneof command {
13
- TabSessionPingCommand ping = 3;
14
- CloseTabSessionCommand close = 4;
15
- NavigateTabCommand navigate = 5;
13
+ ContextSessionPingCommand ping = 3;
14
+ CloseContextSessionCommand close = 4;
15
+ NavigatePageCommand navigate = 5;
16
16
  ClickElementCommand click_element = 6;
17
17
  CountElementsCommand count_elements = 7;
18
18
  HighlightElementsCommand highlight_elements = 8;
@@ -26,21 +26,21 @@ message TabSessionCommand {
26
26
  }
27
27
  }
28
28
 
29
- message TabSessionPingCommand {
29
+ message ContextSessionPingCommand {
30
30
  string message = 1;
31
31
  }
32
32
 
33
- message CloseTabSessionCommand {}
33
+ message CloseContextSessionCommand {}
34
34
 
35
- message TabSessionEvent {
36
- string tab_session_id = 1;
35
+ message ContextSessionEvent {
36
+ string context_session_id = 1;
37
37
 
38
38
  oneof event {
39
- TabSessionAttachedEvent attached = 2;
40
- TabSessionPongEvent pong = 3;
41
- TabSessionClosedEvent closed = 4;
42
- TabSessionErrorEvent error = 5;
43
- TabNavigatedEvent navigated = 6;
39
+ ContextSessionAttachedEvent attached = 2;
40
+ ContextSessionPongEvent pong = 3;
41
+ ContextSessionClosedEvent closed = 4;
42
+ ContextSessionErrorEvent error = 5;
43
+ PageNavigatedEvent navigated = 6;
44
44
  ChromiumBidiInjectionEvent chromium_bidi_injection = 7;
45
45
  ElementClickedEvent element_clicked = 8;
46
46
  ElementCountedEvent element_counted = 9;
@@ -55,18 +55,18 @@ message TabSessionEvent {
55
55
  }
56
56
  }
57
57
 
58
- message TabSessionAttachedEvent {
58
+ message ContextSessionAttachedEvent {
59
59
  string note = 1;
60
60
  }
61
61
 
62
- message TabSessionPongEvent {
62
+ message ContextSessionPongEvent {
63
63
  string message = 1;
64
64
  }
65
65
 
66
- message TabSessionClosedEvent {
66
+ message ContextSessionClosedEvent {
67
67
  string reason = 1;
68
68
  }
69
69
 
70
- message TabSessionErrorEvent {
70
+ message ContextSessionErrorEvent {
71
71
  string message = 1;
72
72
  }
@@ -9,6 +9,6 @@ import "core/v1/tab.proto";
9
9
 
10
10
  service EngineService {
11
11
  rpc Ping(PingRequest) returns (PingResponse);
12
- rpc BrowserSession(stream BrowserSessionCommand) returns (stream BrowserSessionEvent);
13
- rpc TabSession(stream TabSessionCommand) returns (stream TabSessionEvent);
12
+ rpc SurfaceSession(stream SurfaceSessionCommand) returns (stream SurfaceSessionEvent);
13
+ rpc ContextSession(stream ContextSessionCommand) returns (stream ContextSessionEvent);
14
14
  }
@@ -0,0 +1,56 @@
1
+ syntax = "proto3";
2
+
3
+ package allwright.engine.v1;
4
+ option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+
6
+ import "core/v1/common.proto";
7
+
8
+ enum MobilePlatform {
9
+ MOBILE_PLATFORM_UNSPECIFIED = 0;
10
+ MOBILE_PLATFORM_ANDROID = 1;
11
+ MOBILE_PLATFORM_IOS = 2;
12
+ }
13
+
14
+ enum DeviceConnectionKind {
15
+ DEVICE_CONNECTION_KIND_UNSPECIFIED = 0;
16
+ DEVICE_CONNECTION_KIND_USB = 1;
17
+ DEVICE_CONNECTION_KIND_EMULATOR = 2;
18
+ DEVICE_CONNECTION_KIND_REMOTE_ADB = 3;
19
+ }
20
+
21
+ message ConnectMobileCommand {
22
+ MobilePlatform platform = 1;
23
+ optional string device = 2;
24
+ optional string adb_endpoint = 3;
25
+ bool preserve_app_state = 4;
26
+ optional CommandRetryOptions retry_options = 5;
27
+ }
28
+
29
+ message MobileConnectedEvent {
30
+ MobilePlatform platform = 1;
31
+ string device_name = 2;
32
+ string note = 3;
33
+ string device_id = 4;
34
+ DeviceConnectionKind connection_kind = 5;
35
+ string backend = 6;
36
+ string device_session_id = 7;
37
+ string initial_app_session_id = 8;
38
+ optional string package_name = 9;
39
+ optional string activity_name = 10;
40
+ }
41
+
42
+ message LaunchAppCommand {
43
+ optional string apk_path = 1;
44
+ optional string app_id = 2;
45
+ optional string launch_activity = 3;
46
+ bool stop_before_launch = 4;
47
+ optional CommandRetryOptions retry_options = 5;
48
+ }
49
+
50
+ message AppLaunchedEvent {
51
+ string app_session_id = 1;
52
+ string note = 2;
53
+ optional string package_name = 3;
54
+ optional string activity_name = 4;
55
+ optional string webview_context = 5;
56
+ }
@@ -22,7 +22,7 @@ message BrowserLaunchedEvent {
22
22
  string browser = 2;
23
23
  string note = 3;
24
24
  string user_data_dir = 4;
25
- string initial_tab_session_id = 5;
25
+ string initial_page_session_id = 5;
26
26
  }
27
27
 
28
28
  message LaunchChromeCommand {
@@ -35,10 +35,10 @@ message ChromeLaunchedEvent {
35
35
  string note = 2;
36
36
  string cdp_websocket_url = 3;
37
37
  string user_data_dir = 4;
38
- string initial_tab_session_id = 5;
38
+ string initial_page_session_id = 5;
39
39
  }
40
40
 
41
- message NavigateTabCommand {
41
+ message NavigatePageCommand {
42
42
  string url = 1;
43
43
  optional CommandRetryOptions retry_options = 2;
44
44
  }
@@ -98,7 +98,7 @@ message WaitForSelectorCommand {
98
98
  optional CommandRetryOptions retry_options = 3;
99
99
  }
100
100
 
101
- message TabNavigatedEvent {
101
+ message PageNavigatedEvent {
102
102
  string url = 1;
103
103
  string note = 2;
104
104
  }