@allwright.dev/core 0.1.3 → 0.1.4

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/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.1.3";
15
+ const DEFAULT_RELEASE_VERSION = "0.1.4";
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));
package/dist/mobile.js CHANGED
@@ -200,6 +200,38 @@ class MobileAndroidAppImpl {
200
200
  }
201
201
  }
202
202
  }
203
+ async accessibilitySnapshot(options = {}) {
204
+ const mode = options.mode ?? "default";
205
+ if (!["default", "ai", "autoexpect", "codegen"].includes(mode)) {
206
+ throw new Error("invalid accessibility snapshot mode");
207
+ }
208
+ const format = options.format ?? "json";
209
+ if (format !== "json" && format !== "yaml") {
210
+ throw new Error("accessibility snapshot format must be 'json' or 'yaml'");
211
+ }
212
+ const handle = await this.#getHandle();
213
+ this.#ensureOpen(handle);
214
+ handle.stream.write({
215
+ surfaceSessionId: this.#surfaceSessionId,
216
+ contextSessionId: this.sessionId,
217
+ accessibilitySnapshot: {
218
+ format,
219
+ mode,
220
+ retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
221
+ },
222
+ });
223
+ while (true) {
224
+ const event = await handle.queue.next();
225
+ if (event.accessibilitySnapshotCaptured)
226
+ return event.accessibilitySnapshotCaptured.snapshot ?? "";
227
+ if (event.error?.message)
228
+ throw new Error(event.error.message);
229
+ if (event.closed) {
230
+ handle.closed = true;
231
+ throw new Error(`android app session ${this.sessionId} closed while waiting for accessibility snapshot`);
232
+ }
233
+ }
234
+ }
203
235
  async screenshot(options = {}) {
204
236
  const handle = await this.#getHandle();
205
237
  this.#ensureOpen(handle);
package/dist/types.d.ts CHANGED
@@ -156,6 +156,7 @@ export interface MobileAndroidLocator {
156
156
  locator(selector: string): MobileAndroidLocator;
157
157
  }
158
158
  export interface MobileAndroidApp {
159
+ accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
159
160
  readonly sessionId: string;
160
161
  locator(selector: string): MobileAndroidLocator;
161
162
  click(selector: string, options?: CommandOptions): Promise<ClickResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  message PingRequest {}
7
9
 
@@ -6,7 +6,6 @@ option java_package = "dev.allwright.engine.v1";
6
6
  option java_multiple_files = true;
7
7
 
8
8
  import "core/v1/common.proto";
9
- import "surfaces/web/v1/web.proto";
10
9
 
11
10
  message ContextSessionCommand {
12
11
  string surface_session_id = 1;
@@ -218,3 +217,18 @@ message ScreenshotCapturedEvent {
218
217
  bytes png_data = 1;
219
218
  string note = 2;
220
219
  }
220
+
221
+ // Empty format defaults to JSON. Accepted values are "json" and "yaml".
222
+ message AccessibilitySnapshotCommand {
223
+ // Empty mode defaults to default. AI assigns queryable references; reference storage is surface-owned.
224
+ // Supported: default, ai, autoexpect, codegen.
225
+ string mode = 3;
226
+ string format = 1;
227
+ optional CommandRetryOptions retry_options = 2;
228
+ }
229
+
230
+ // Both formats encode the same versioned, structured document.
231
+ message AccessibilitySnapshotCapturedEvent {
232
+ string snapshot = 1;
233
+ string format = 2;
234
+ }
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  import "core/v1/common.proto";
7
9
  import "surfaces/mobile/v1/mobile.proto";
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  import "core/v1/surface.proto";
7
9
  import "core/v1/common.proto";
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  import "core/v1/common.proto";
7
9
 
@@ -39,18 +39,3 @@ message ChromeLaunchedEvent {
39
39
  string user_data_dir = 4;
40
40
  string initial_page_session_id = 5;
41
41
  }
42
-
43
- // Empty format defaults to JSON. Accepted values are "json" and "yaml".
44
- message AccessibilitySnapshotCommand {
45
- // Empty mode defaults to default. AI injects queryable aria-ref attributes.
46
- // Supported: default, ai, autoexpect, codegen.
47
- string mode = 3;
48
- string format = 1;
49
- optional CommandRetryOptions retry_options = 2;
50
- }
51
-
52
- // Both formats encode the same versioned, structured document.
53
- message AccessibilitySnapshotCapturedEvent {
54
- string snapshot = 1;
55
- string format = 2;
56
- }