@quiesco/protocol 0.0.0-stage → 0.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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/dist/actions.d.ts +238 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +2 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/assertions.d.ts +74 -0
  8. package/dist/assertions.d.ts.map +1 -0
  9. package/dist/assertions.js +2 -0
  10. package/dist/assertions.js.map +1 -0
  11. package/dist/config.d.ts +54 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +2 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/constants.d.ts +43 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +42 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/element.d.ts +49 -0
  20. package/dist/element.d.ts.map +1 -0
  21. package/dist/element.js +2 -0
  22. package/dist/element.js.map +1 -0
  23. package/dist/errors.d.ts +106 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +26 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/events.d.ts +19 -0
  28. package/dist/events.d.ts.map +1 -0
  29. package/dist/events.js +2 -0
  30. package/dist/events.js.map +1 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +13 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/json.d.ts +6 -0
  36. package/dist/json.d.ts.map +1 -0
  37. package/dist/json.js +2 -0
  38. package/dist/json.js.map +1 -0
  39. package/dist/matcher.d.ts +44 -0
  40. package/dist/matcher.d.ts.map +1 -0
  41. package/dist/matcher.js +22 -0
  42. package/dist/matcher.js.map +1 -0
  43. package/dist/messages.d.ts +49 -0
  44. package/dist/messages.d.ts.map +1 -0
  45. package/dist/messages.js +2 -0
  46. package/dist/messages.js.map +1 -0
  47. package/dist/methods.d.ts +256 -0
  48. package/dist/methods.d.ts.map +1 -0
  49. package/dist/methods.js +2 -0
  50. package/dist/methods.js.map +1 -0
  51. package/dist/webview.d.ts +9 -0
  52. package/dist/webview.d.ts.map +1 -0
  53. package/dist/webview.js +31 -0
  54. package/dist/webview.js.map +1 -0
  55. package/package.json +47 -3
  56. package/src/actions.ts +107 -0
  57. package/src/assertions.ts +29 -0
  58. package/src/config.ts +54 -0
  59. package/src/constants.ts +46 -0
  60. package/src/element.ts +51 -0
  61. package/src/errors.ts +61 -0
  62. package/src/events.ts +11 -0
  63. package/src/index.ts +12 -0
  64. package/src/json.ts +3 -0
  65. package/src/matcher.ts +59 -0
  66. package/src/messages.ts +55 -0
  67. package/src/methods.ts +140 -0
  68. package/src/webview.ts +30 -0
@@ -0,0 +1,106 @@
1
+ import type { ActionType } from './actions.js';
2
+ import type { ElementSummary } from './element.js';
3
+ import type { JsonValue } from './json.js';
4
+ import type { Matcher } from './matcher.js';
5
+ import type { TrackerState } from './methods.js';
6
+ /** Standard JSON-RPC 2.0 error codes. */
7
+ export declare const JsonRpcErrorCode: {
8
+ readonly PARSE_ERROR: -32700;
9
+ readonly INVALID_REQUEST: -32600;
10
+ readonly METHOD_NOT_FOUND: -32601;
11
+ readonly INVALID_PARAMS: -32602;
12
+ readonly INTERNAL_ERROR: -32603;
13
+ };
14
+ /** Quiesco error codes (requirements.md §7). */
15
+ export declare const ErrorCode: {
16
+ readonly ELEMENT_NOT_FOUND: 1001;
17
+ readonly MULTIPLE_MATCHES: 1002;
18
+ readonly SYNC_TIMEOUT: 1003;
19
+ readonly ASSERTION_FAILED: 1004;
20
+ readonly ACTION_NOT_SUPPORTED: 1005;
21
+ readonly BACKDOOR_NOT_REGISTERED: 1006;
22
+ readonly NOT_SERIALIZABLE: 1007;
23
+ readonly BACKDOOR_FAILED: 1008;
24
+ readonly PROTOCOL_MISMATCH: 1009;
25
+ readonly SESSION_MISMATCH: 1010;
26
+ readonly AGENT_NOT_READY: 1011;
27
+ readonly APP_ERROR: 1012;
28
+ readonly RESET_FAILED: 1013;
29
+ readonly ELEMENT_OBSCURED: 1014;
30
+ };
31
+ export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
32
+ export type ErrorName = keyof typeof ErrorCode;
33
+ /** Structured `error.data` for each Quiesco error code. */
34
+ export interface ErrorDataMap {
35
+ /** `reason: 'not-in-window'`: React rendered it, but no window shows it (e.g. a system alert is over the app; Phase 6.12). */
36
+ ELEMENT_NOT_FOUND: {
37
+ matcher: Matcher;
38
+ reason?: 'not-in-window';
39
+ };
40
+ MULTIPLE_MATCHES: {
41
+ matcher: Matcher;
42
+ matches: ElementSummary[];
43
+ };
44
+ SYNC_TIMEOUT: {
45
+ timeoutMs: number;
46
+ busy: TrackerState[];
47
+ };
48
+ ASSERTION_FAILED: {
49
+ expected: JsonValue;
50
+ actual: JsonValue;
51
+ elements: ElementSummary[];
52
+ };
53
+ ACTION_NOT_SUPPORTED: {
54
+ action: ActionType | 'webview';
55
+ platform: string;
56
+ hint?: string;
57
+ };
58
+ BACKDOOR_NOT_REGISTERED: {
59
+ name: string;
60
+ registered: string[];
61
+ };
62
+ NOT_SERIALIZABLE: {
63
+ where: 'args' | 'result';
64
+ path: string;
65
+ };
66
+ BACKDOOR_FAILED: {
67
+ name: string;
68
+ message: string;
69
+ stack?: string;
70
+ };
71
+ PROTOCOL_MISMATCH: {
72
+ host: number;
73
+ agent: number;
74
+ };
75
+ SESSION_MISMATCH: {
76
+ expected: string[];
77
+ received: string | null;
78
+ };
79
+ AGENT_NOT_READY: {
80
+ reason: string;
81
+ };
82
+ APP_ERROR: {
83
+ message: string;
84
+ stack?: string;
85
+ };
86
+ RESET_FAILED: {
87
+ step: string;
88
+ message: string;
89
+ };
90
+ /** A real touch would not reach the element: another element or window is on top of it. */
91
+ /** `native`: what the native hit test saw (iOS: hit view and its superviews, presented view controllers). */
92
+ ELEMENT_OBSCURED: {
93
+ matcher: Matcher;
94
+ element: ElementSummary;
95
+ obscuredBy: string;
96
+ native?: Record<string, unknown>;
97
+ };
98
+ }
99
+ export interface QuiescoErrorObject<N extends ErrorName = ErrorName> {
100
+ code: (typeof ErrorCode)[N];
101
+ message: string;
102
+ data: {
103
+ name: N;
104
+ } & ErrorDataMap[N];
105
+ }
106
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,yCAAyC;AACzC,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AAEX,gDAAgD;AAChD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAeZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AACnE,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,SAAS,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,8HAA8H;IAC9H,iBAAiB,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,eAAe,CAAA;KAAE,CAAC;IAClE,gBAAgB,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC;IAClE,YAAY,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAC1D,gBAAgB,EAAE;QAAE,QAA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CAAA;KAAE,CAAC;CACvH;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IACjE,IAAI,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;CACrC"}
package/dist/errors.js ADDED
@@ -0,0 +1,26 @@
1
+ /** Standard JSON-RPC 2.0 error codes. */
2
+ export const JsonRpcErrorCode = {
3
+ PARSE_ERROR: -32700,
4
+ INVALID_REQUEST: -32600,
5
+ METHOD_NOT_FOUND: -32601,
6
+ INVALID_PARAMS: -32602,
7
+ INTERNAL_ERROR: -32603,
8
+ };
9
+ /** Quiesco error codes (requirements.md §7). */
10
+ export const ErrorCode = {
11
+ ELEMENT_NOT_FOUND: 1001,
12
+ MULTIPLE_MATCHES: 1002,
13
+ SYNC_TIMEOUT: 1003,
14
+ ASSERTION_FAILED: 1004,
15
+ ACTION_NOT_SUPPORTED: 1005,
16
+ BACKDOOR_NOT_REGISTERED: 1006,
17
+ NOT_SERIALIZABLE: 1007,
18
+ BACKDOOR_FAILED: 1008,
19
+ PROTOCOL_MISMATCH: 1009,
20
+ SESSION_MISMATCH: 1010,
21
+ AGENT_NOT_READY: 1011,
22
+ APP_ERROR: 1012,
23
+ RESET_FAILED: 1013,
24
+ ELEMENT_OBSCURED: 1014,
25
+ };
26
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,yCAAyC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,CAAC,KAAK;IACnB,eAAe,EAAE,CAAC,KAAK;IACvB,gBAAgB,EAAE,CAAC,KAAK;IACxB,cAAc,EAAE,CAAC,KAAK;IACtB,cAAc,EAAE,CAAC,KAAK;CACd,CAAC;AAEX,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,IAAI;IAC7B,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;CACd,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** Notifications sent by the agent (no `id`, no response). requirements.md §7. */
2
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
+ export interface AgentEvents {
4
+ /** App-side console output forwarded to the host (level is configurable). */
5
+ log: {
6
+ level: LogLevel;
7
+ message: string;
8
+ timestamp: number;
9
+ };
10
+ /** Uncaught exception / red box / unhandled rejection: the current step must fail immediately. */
11
+ error: {
12
+ kind: 'uncaught' | 'unhandledRejection' | 'redbox';
13
+ message: string;
14
+ stack?: string;
15
+ timestamp: number;
16
+ };
17
+ }
18
+ export type AgentEventName = keyof AgentEvents;
19
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,GAAG,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,kGAAkG;IAClG,KAAK,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,oBAAoB,GAAG,QAAQ,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACnH;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC"}
package/dist/events.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ export * from './actions.js';
2
+ export * from './assertions.js';
3
+ export * from './config.js';
4
+ export * from './constants.js';
5
+ export * from './element.js';
6
+ export * from './errors.js';
7
+ export * from './events.js';
8
+ export * from './json.js';
9
+ export * from './matcher.js';
10
+ export * from './messages.js';
11
+ export * from './methods.js';
12
+ export * from './webview.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ export * from './actions.js';
2
+ export * from './assertions.js';
3
+ export * from './config.js';
4
+ export * from './constants.js';
5
+ export * from './element.js';
6
+ export * from './errors.js';
7
+ export * from './events.js';
8
+ export * from './json.js';
9
+ export * from './matcher.js';
10
+ export * from './messages.js';
11
+ export * from './methods.js';
12
+ export * from './webview.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /** Any value that survives JSON.stringify / JSON.parse unchanged. */
2
+ export type JsonPrimitive = string | number | boolean | null;
3
+ export type JsonValue = JsonPrimitive | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
6
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
package/dist/json.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ /** A regular expression in JSON form (RegExp itself is not serializable). */
2
+ export interface RegexPattern {
3
+ regex: {
4
+ source: string;
5
+ flags: string;
6
+ };
7
+ }
8
+ /** Exact string or regular expression. */
9
+ export type TextMatch = string | RegexPattern;
10
+ /**
11
+ * Platform-independent element kinds (requirements.md §6.1, Phase 6.1). Derived from the host
12
+ * component type, the accessibility role and the props of the owning component; the same element
13
+ * gets the same kind on iOS, Android and the web.
14
+ */
15
+ export declare const SEMANTIC_TYPES: readonly ["button", "link", "header", "text", "input", "image", "switch", "checkbox", "radio", "slider", "picker", "progress", "scroll", "list"];
16
+ export type SemanticType = (typeof SEMANTIC_TYPES)[number];
17
+ /**
18
+ * Element query (requirements.md §6.1). All given fields must match.
19
+ * Only host components (views that end up as native views / DOM nodes) are returned.
20
+ */
21
+ export interface Matcher {
22
+ /** `testID`: exact string or regular expression. */
23
+ id?: TextMatch;
24
+ /** Text content of the element (concatenated text of its subtree). */
25
+ text?: TextMatch;
26
+ /** `accessibilityLabel` / `aria-label`. */
27
+ label?: TextMatch;
28
+ /** `accessibilityRole` / `role`. */
29
+ role?: string;
30
+ /**
31
+ * A semantic type (`'button'`, `'input'`, ... see SEMANTIC_TYPES), a host component type
32
+ * (`'RCTView'`, `'div'`) or the display name of a component that renders the element (`'Pressable'`).
33
+ */
34
+ type?: string;
35
+ /** Some descendant matches this matcher (Detox `withDescendant`). */
36
+ has?: Matcher;
37
+ /** The element itself does NOT match this matcher (its own fields, `has` and `not`). */
38
+ not?: Matcher;
39
+ /** Restrict the search to descendants of the (single) element matched by this matcher. */
40
+ within?: Matcher;
41
+ /** Pick the n-th match (0-based, in render order) when several elements match. */
42
+ index?: number;
43
+ }
44
+ //# sourceMappingURL=matcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../src/matcher.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C;AAED,0CAA0C;AAC1C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,cAAc,kJAejB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,oDAAoD;IACpD,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,sEAAsE;IACtE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wFAAwF;IACxF,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,0FAA0F;IAC1F,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Platform-independent element kinds (requirements.md §6.1, Phase 6.1). Derived from the host
3
+ * component type, the accessibility role and the props of the owning component; the same element
4
+ * gets the same kind on iOS, Android and the web.
5
+ */
6
+ export const SEMANTIC_TYPES = [
7
+ 'button',
8
+ 'link',
9
+ 'header',
10
+ 'text',
11
+ 'input',
12
+ 'image',
13
+ 'switch',
14
+ 'checkbox',
15
+ 'radio',
16
+ 'slider',
17
+ 'picker',
18
+ 'progress',
19
+ 'scroll',
20
+ 'list',
21
+ ];
22
+ //# sourceMappingURL=matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matcher.js","sourceRoot":"","sources":["../src/matcher.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,MAAM;CACE,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { AgentEventName, AgentEvents } from './events.js';
2
+ import type { QuiescoErrorObject } from './errors.js';
3
+ import type { JsonValue } from './json.js';
4
+ import type { AgentMethods, HostMethods } from './methods.js';
5
+ /** JSON-RPC 2.0 envelope types (https://www.jsonrpc.org/specification). */
6
+ export type RequestId = number | string;
7
+ export interface JsonRpcRequest<M extends string = string, P = unknown> {
8
+ jsonrpc: '2.0';
9
+ id: RequestId;
10
+ method: M;
11
+ params: P;
12
+ }
13
+ export interface JsonRpcNotification<M extends string = string, P = unknown> {
14
+ jsonrpc: '2.0';
15
+ method: M;
16
+ params: P;
17
+ }
18
+ export interface JsonRpcSuccess<R = unknown> {
19
+ jsonrpc: '2.0';
20
+ id: RequestId;
21
+ result: R;
22
+ }
23
+ export interface JsonRpcErrorObject {
24
+ code: number;
25
+ message: string;
26
+ data?: JsonValue;
27
+ }
28
+ export interface JsonRpcFailure {
29
+ jsonrpc: '2.0';
30
+ id: RequestId | null;
31
+ error: JsonRpcErrorObject | QuiescoErrorObject;
32
+ }
33
+ export type JsonRpcResponse<R = unknown> = JsonRpcSuccess<R> | JsonRpcFailure;
34
+ /** Typed request for a given method table. */
35
+ export type RequestFor<T extends {
36
+ [K in keyof T]: {
37
+ params: unknown;
38
+ };
39
+ }, K extends keyof T & string = keyof T & string> = {
40
+ [M in K]: JsonRpcRequest<M, T[M]['params']>;
41
+ }[K];
42
+ export type AgentRequest = RequestFor<AgentMethods>;
43
+ export type HostRequest = RequestFor<HostMethods>;
44
+ export type AgentEvent = {
45
+ [E in AgentEventName]: JsonRpcNotification<E, AgentEvents[E]>;
46
+ }[AgentEventName];
47
+ /** Every message that can travel over the socket. */
48
+ export type WireMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
49
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
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cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC;AAE9E,8CAA8C;AAC9C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE;CAAE,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,IAAI;KACxH,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC5C,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,cAAc,GAAG,mBAAmB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CAC9D,CAAC,cAAc,CAAC,CAAC;AAElB,qDAAqD;AACrD,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,mBAAmB,GAAG,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":""}
@@ -0,0 +1,256 @@
1
+ import type { ActionMode, ActionSpec, HostInput } from './actions.js';
2
+ import type { AssertionSpec } from './assertions.js';
3
+ import type { AgentConfig } from './config.js';
4
+ import type { ElementSummary, Rect, TreeNode } from './element.js';
5
+ import type { JsonValue } from './json.js';
6
+ import type { Matcher } from './matcher.js';
7
+ export type Platform = 'ios' | 'android' | 'web';
8
+ /** State of one idle tracker (requirements.md §6.2 `IdleTracker`). */
9
+ export interface TrackerState {
10
+ name: string;
11
+ idle: boolean;
12
+ /** Human-readable busy reasons, e.g. `GET https://api.example.com/todos (1200ms)`. */
13
+ busy: string[];
14
+ }
15
+ /** Common option: disable the automatic wait-for-idle around a single call (§6.2 `{ sync: false }`). */
16
+ /** Results of query / action / assert / webview / scrollView carry the ms spent waiting for idle (Phase 6.9). */
17
+ export interface SyncTiming {
18
+ syncMs?: number;
19
+ }
20
+ export interface SyncOption {
21
+ sync?: boolean;
22
+ timeoutMs?: number;
23
+ }
24
+ /** Methods the HOST calls on the AGENT. */
25
+ export interface AgentMethods {
26
+ query: {
27
+ params: {
28
+ matcher: Matcher;
29
+ } & SyncOption;
30
+ result: {
31
+ elements: ElementSummary[];
32
+ } & SyncTiming;
33
+ };
34
+ action: {
35
+ params: {
36
+ action: ActionSpec;
37
+ mode: ActionMode;
38
+ } & SyncOption;
39
+ /** `hostInput` is set when the host must perform the real input itself (web native mode). */
40
+ result: {
41
+ element?: ElementSummary;
42
+ hostInput?: HostInput;
43
+ } & SyncTiming;
44
+ };
45
+ assert: {
46
+ params: {
47
+ assertion: AssertionSpec;
48
+ } & SyncOption;
49
+ result: {
50
+ elements: ElementSummary[];
51
+ } & SyncTiming;
52
+ };
53
+ waitForIdle: {
54
+ params: {
55
+ timeoutMs?: number;
56
+ };
57
+ result: {
58
+ waitedMs: number;
59
+ };
60
+ };
61
+ getTree: {
62
+ params: Record<string, never>;
63
+ result: {
64
+ root: TreeNode | null;
65
+ };
66
+ };
67
+ reset: {
68
+ params: Record<string, never>;
69
+ result: {
70
+ durationMs: number;
71
+ };
72
+ };
73
+ backdoor: {
74
+ params: {
75
+ name: string;
76
+ args: JsonValue[];
77
+ };
78
+ result: {
79
+ value: JsonValue;
80
+ };
81
+ };
82
+ getIdleState: {
83
+ params: Record<string, never>;
84
+ result: {
85
+ trackers: TrackerState[];
86
+ };
87
+ };
88
+ /** Replace the agent config at runtime (Phase 6.5 `app.sync.*`); the next `hello` carries it too. */
89
+ configure: {
90
+ params: {
91
+ config: AgentConfig;
92
+ };
93
+ result: Record<string, never>;
94
+ };
95
+ /** Window size, pixel ratio and app state (element screenshots, background detection). */
96
+ deviceInfo: {
97
+ params: Record<string, never>;
98
+ result: DeviceInfo;
99
+ };
100
+ /** Leave for the home screen from inside the app (iOS @quiesco/native); `false` when not available. */
101
+ suspend: {
102
+ params: Record<string, never>;
103
+ result: {
104
+ suspended: boolean;
105
+ };
106
+ };
107
+ /**
108
+ * Rotate the app's window from inside the app (iOS @quiesco/native; Phase 6.6). `supported: false`
109
+ * when the app cannot (no native module, other platforms); `error` when iOS refused the request.
110
+ */
111
+ setOrientation: {
112
+ params: {
113
+ orientation: Orientation;
114
+ };
115
+ result: {
116
+ supported: boolean;
117
+ error?: string;
118
+ };
119
+ };
120
+ /**
121
+ * The clipboard, read / written from inside the app (@quiesco/native; Phase 6.6). Inside the app because
122
+ * iOS asks the user before an app reads text another process (simctl pbcopy) put there, and Android
123
+ * has no shell command for it. `supported: false` without the native module.
124
+ */
125
+ getClipboard: {
126
+ params: Record<string, never>;
127
+ result: {
128
+ supported: boolean;
129
+ text?: string;
130
+ };
131
+ };
132
+ setClipboard: {
133
+ params: {
134
+ text: string;
135
+ };
136
+ result: {
137
+ supported: boolean;
138
+ };
139
+ };
140
+ /**
141
+ * Post a notification as the app (Android @quiesco/native; Phase 6.7). `supported: false` without it;
142
+ * `enabled: false` when the app may not show notifications (POST_NOTIFICATIONS not granted).
143
+ */
144
+ postNotification: {
145
+ params: {
146
+ title: string;
147
+ body: string;
148
+ data: Record<string, string>;
149
+ };
150
+ result: {
151
+ supported: boolean;
152
+ enabled?: boolean;
153
+ };
154
+ };
155
+ /**
156
+ * A WebView (Phase 6.8): waits for idle, finds the single WebView matching `matcher` (default: the only
157
+ * one on screen), and on iOS / Android (@quiesco/native) evaluates `script` in its page. On the web the
158
+ * WebView is an `<iframe>` the host reaches itself (Playwright frames): no `value`, the host uses `rect`.
159
+ */
160
+ webview: {
161
+ params: {
162
+ matcher?: Matcher;
163
+ script?: string;
164
+ } & SyncOption;
165
+ result: WebViewCallResult & SyncTiming;
166
+ };
167
+ /**
168
+ * A scroll view (Phase 6.9 full-page screenshots): the one containing the element matching `matcher`
169
+ * (default: the largest visible one). With `to`, scrolls it there first (programmatically) and waits
170
+ * for idle. `indicators`: show / hide its scroll indicators (native; they would end up in the
171
+ * screenshots). Reports where it is.
172
+ */
173
+ scrollView: {
174
+ params: {
175
+ matcher?: Matcher;
176
+ to?: {
177
+ x: number;
178
+ y: number;
179
+ };
180
+ indicators?: boolean;
181
+ } & SyncOption;
182
+ result: ScrollViewInfo & SyncTiming;
183
+ };
184
+ }
185
+ export interface ScrollViewInfo {
186
+ /** The scroll view's visible area in window coordinates. */
187
+ rect: Rect;
188
+ /** Content offset (how far it is scrolled). */
189
+ offset: {
190
+ x: number;
191
+ y: number;
192
+ };
193
+ /** Size of the scrollable content. */
194
+ content: {
195
+ width: number;
196
+ height: number;
197
+ };
198
+ /** With `indicators`: whether they were shown before (native only). */
199
+ indicatorsWere?: boolean;
200
+ }
201
+ export interface WebViewCallResult {
202
+ /** The WebView in window coordinates (logical units). */
203
+ rect: Rect;
204
+ /** Native: the page is (re)loading. */
205
+ loading?: boolean;
206
+ /** Native: the result of `script` (a string expression). */
207
+ value?: string;
208
+ /** Web: the host evaluates the script in the iframe at `rect` itself. */
209
+ viaHost?: boolean;
210
+ }
211
+ export type Orientation = 'portrait' | 'landscape';
212
+ /** `AppState` as React Native reports it; `unknown` where it cannot be read. */
213
+ export type AppStateName = 'active' | 'background' | 'inactive' | 'unknown';
214
+ export interface DeviceInfo {
215
+ /** The app window in logical units (dp / pt / CSS px), the space of element rects. */
216
+ window: {
217
+ width: number;
218
+ height: number;
219
+ };
220
+ /** Physical pixels per logical unit. */
221
+ pixelRatio: number;
222
+ appState: AppStateName;
223
+ /** Phase 6.6 read-backs (optional for older agents): what the app sees of the device state. */
224
+ colorScheme?: 'light' | 'dark' | null;
225
+ /** Text size multiplier (`PixelRatio.getFontScale()`). */
226
+ fontScale?: number;
227
+ /** The JS engine's default locale (`Intl.DateTimeFormat().resolvedOptions().locale`). */
228
+ locale?: string;
229
+ }
230
+ /** Methods the AGENT calls on the HOST. */
231
+ export interface HostMethods {
232
+ hello: {
233
+ params: {
234
+ sessionId: string | null;
235
+ platform: Platform;
236
+ protocolVersion: number;
237
+ agentVersion: string;
238
+ /** Whether @quiesco/native is linked (enables the `native` action mode). */
239
+ nativeModule: boolean;
240
+ };
241
+ result: {
242
+ accepted: true;
243
+ sessionId: string;
244
+ config: AgentConfig;
245
+ };
246
+ };
247
+ }
248
+ export type AgentMethodName = keyof AgentMethods;
249
+ export type HostMethodName = keyof HostMethods;
250
+ export type ParamsOf<M extends {
251
+ params: unknown;
252
+ }> = M['params'];
253
+ export type ResultOf<M extends {
254
+ result: unknown;
255
+ }> = M['result'];
256
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAEjD,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,sFAAsF;IACtF,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wGAAwG;AACxG,iHAAiH;AACjH,MAAM,WAAW,UAAU;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AA;SAAE,CAAC;KACpE,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,YAAY,CAAC;AACjD,MAAM,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC;AAC/C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * WebView pages (Phase 6.8): the script Quiesco installs in a WebView's pages to know when they are busy.
3
+ * The agent registers it to run at document start of every later load (native WebViews) and the host's
4
+ * page-state script runs it in the current page too; it is idempotent.
5
+ *
6
+ * It counts the page's fetch / XMLHttpRequest calls still running in `window.__quiescoPending`.
7
+ */
8
+ export declare const WEBVIEW_HOOK = "(function () {\n if (window.__quiescoHook) return;\n window.__quiescoHook = true;\n window.__quiescoPending = 0;\n var done = function () { window.__quiescoPending = Math.max(0, window.__quiescoPending - 1); };\n if (typeof window.fetch === 'function') {\n var f = window.fetch;\n window.fetch = function () {\n window.__quiescoPending++;\n var p;\n try { p = f.apply(this, arguments); } catch (e) { done(); throw e; }\n return p.then(function (r) { done(); return r; }, function (e) { done(); throw e; });\n };\n }\n if (typeof XMLHttpRequest === 'function') {\n var send = XMLHttpRequest.prototype.send;\n XMLHttpRequest.prototype.send = function () {\n window.__quiescoPending++;\n this.addEventListener('loadend', done);\n try { return send.apply(this, arguments); } catch (e) { done(); throw e; }\n };\n }\n})();";
9
+ //# sourceMappingURL=webview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webview.d.ts","sourceRoot":"","sources":["../src/webview.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,m3BAsBnB,CAAC"}