@alwith/module-device 0.6.1 → 0.6.2

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 (162) hide show
  1. package/dist/{chunk-sbhrg9jp.js → chunk-35bn393s.js} +2 -2
  2. package/dist/{chunk-ctffar6x.js → chunk-3n6qrzdg.js} +2 -2
  3. package/dist/{chunk-rqdjybwe.js → chunk-3zjj07q7.js} +2 -2
  4. package/dist/chunk-40mwa0cy.js +2 -0
  5. package/dist/chunk-7n1fmm2p.js +2 -0
  6. package/dist/chunk-a8pbgphe.js +2 -0
  7. package/dist/chunk-cyvmm690.js +5 -0
  8. package/dist/chunk-mx5dd23x.js +2 -0
  9. package/dist/chunk-pa4b54h3.js +2 -0
  10. package/dist/chunk-tp1d4pv6.js +2 -0
  11. package/dist/chunk-wgktmrwt.js +2 -0
  12. package/dist/chunk-xd4kq6pe.js +2 -0
  13. package/dist/chunk-yf3yrtxe.js +2 -0
  14. package/dist/generated/commands.d.ts +155 -0
  15. package/dist/generated/commands.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/preview/activity.d.ts +6 -0
  18. package/dist/preview/activity.js +1 -0
  19. package/dist/preview/bezel.js +1 -1
  20. package/dist/preview/captures.d.ts +8 -0
  21. package/dist/preview/captures.js +1 -0
  22. package/dist/preview/device-panel.d.ts +1 -1
  23. package/dist/preview/device-panel.js +1 -1
  24. package/dist/preview/gestures.d.ts +1 -1
  25. package/dist/preview/gestures.js +1 -1
  26. package/dist/preview/index.d.ts +1 -1
  27. package/dist/preview/index.js +1 -1
  28. package/dist/preview/inspection.d.ts +21 -0
  29. package/dist/preview/inspection.js +1 -0
  30. package/dist/preview/inspector.d.ts +26 -0
  31. package/dist/preview/inspector.js +1 -0
  32. package/dist/preview/live-touch.d.ts +16 -0
  33. package/dist/preview/live-touch.js +1 -0
  34. package/dist/preview/locales.js +1 -1
  35. package/dist/preview/native-view.d.ts +22 -0
  36. package/dist/preview/native-view.js +1 -0
  37. package/dist/preview/screens.js +1 -1
  38. package/dist/preview/types.d.ts +79 -1
  39. package/dist/tauri.d.ts +23 -0
  40. package/dist/tauri.js +1 -1
  41. package/native/darwin-arm64/THIRD_PARTY_NOTICES.md +39 -9
  42. package/native/darwin-arm64/alwith-device-helper +0 -0
  43. package/native/darwin-arm64/artifact.json +2 -2
  44. package/native/darwin-arm64/libalwith_native_device.dylib +0 -0
  45. package/native/darwin-arm64/licenses/form_urlencoded-1.2.2/LICENSE-MIT +25 -0
  46. package/native/darwin-arm64/licenses/icu_collections-2.4.0/LICENSE +46 -0
  47. package/native/darwin-arm64/licenses/icu_locale_core-2.4.0/LICENSE +46 -0
  48. package/native/darwin-arm64/licenses/icu_normalizer-2.4.0/LICENSE +46 -0
  49. package/native/darwin-arm64/licenses/icu_normalizer_data-2.4.0/LICENSE +46 -0
  50. package/native/darwin-arm64/licenses/icu_properties-2.4.0/LICENSE +46 -0
  51. package/native/darwin-arm64/licenses/icu_properties_data-2.4.0/LICENSE +46 -0
  52. package/native/darwin-arm64/licenses/icu_provider-2.4.0/LICENSE +46 -0
  53. package/native/darwin-arm64/licenses/idna-1.1.0/LICENSE-MIT +25 -0
  54. package/native/darwin-arm64/licenses/idna_adapter-1.2.2/LICENSE-MIT +25 -0
  55. package/native/darwin-arm64/licenses/litemap-0.8.3/LICENSE +46 -0
  56. package/native/darwin-arm64/licenses/memmap2-0.9.12/LICENSE-APACHE +201 -0
  57. package/native/darwin-arm64/licenses/memmap2-0.9.12/LICENSE-MIT +26 -0
  58. package/native/darwin-arm64/licenses/percent-encoding-2.3.2/LICENSE-MIT +25 -0
  59. package/native/darwin-arm64/licenses/potential_utf-0.1.6/LICENSE +46 -0
  60. package/native/darwin-arm64/licenses/smallvec-1.16.5/LICENSE-APACHE +201 -0
  61. package/native/darwin-arm64/licenses/smallvec-1.16.5/LICENSE-MIT +25 -0
  62. package/native/darwin-arm64/licenses/stable_deref_trait-1.2.1/LICENSE-APACHE +201 -0
  63. package/native/darwin-arm64/licenses/stable_deref_trait-1.2.1/LICENSE-MIT +25 -0
  64. package/native/darwin-arm64/licenses/synstructure-0.14.0/LICENSE +7 -0
  65. package/native/darwin-arm64/licenses/tinystr-0.8.5/LICENSE +46 -0
  66. package/native/darwin-arm64/licenses/url-2.5.8/LICENSE-APACHE +201 -0
  67. package/native/darwin-arm64/licenses/url-2.5.8/LICENSE-MIT +25 -0
  68. package/native/darwin-arm64/licenses/utf8_iter-1.1.0/LICENSE-APACHE +202 -0
  69. package/native/darwin-arm64/licenses/utf8_iter-1.1.0/LICENSE-MIT +25 -0
  70. package/native/darwin-arm64/licenses/utf_types-1.0.0/LICENSE-APACHE +202 -0
  71. package/native/darwin-arm64/licenses/utf_types-1.0.0/LICENSE-MIT +25 -0
  72. package/native/darwin-arm64/licenses/uuid-1.29.2/LICENSE-APACHE +201 -0
  73. package/native/darwin-arm64/licenses/writeable-0.6.4/LICENSE +46 -0
  74. package/native/darwin-arm64/licenses/yoke-0.8.4/LICENSE +46 -0
  75. package/native/darwin-arm64/licenses/yoke-derive-0.8.4/LICENSE +46 -0
  76. package/native/darwin-arm64/licenses/zerofrom-0.1.8/LICENSE +46 -0
  77. package/native/darwin-arm64/licenses/zerofrom-derive-0.1.8/LICENSE +46 -0
  78. package/native/darwin-arm64/licenses/zerotrie-0.2.5/LICENSE +46 -0
  79. package/native/darwin-arm64/licenses/zerovec-0.11.9/LICENSE +46 -0
  80. package/native/darwin-arm64/licenses/zerovec-derive-0.11.7/LICENSE +46 -0
  81. package/native/win32-x64/THIRD_PARTY_NOTICES.md +38 -8
  82. package/native/win32-x64/alwith_native_device.dll +0 -0
  83. package/native/win32-x64/artifact.json +1 -1
  84. package/native/win32-x64/licenses/displaydoc-0.2.7/LICENSE-APACHE +201 -0
  85. package/native/win32-x64/licenses/form_urlencoded-1.2.2/LICENSE-APACHE +201 -0
  86. package/native/win32-x64/licenses/form_urlencoded-1.2.2/LICENSE-MIT +25 -0
  87. package/native/win32-x64/licenses/icu_collections-2.4.0/LICENSE +46 -0
  88. package/native/win32-x64/licenses/icu_locale_core-2.4.0/LICENSE +46 -0
  89. package/native/win32-x64/licenses/icu_normalizer-2.4.0/LICENSE +46 -0
  90. package/native/win32-x64/licenses/icu_normalizer_data-2.4.0/LICENSE +46 -0
  91. package/native/win32-x64/licenses/icu_properties-2.4.0/LICENSE +46 -0
  92. package/native/win32-x64/licenses/icu_properties_data-2.4.0/LICENSE +46 -0
  93. package/native/win32-x64/licenses/icu_provider-2.4.0/LICENSE +46 -0
  94. package/native/win32-x64/licenses/idna-1.1.0/LICENSE-APACHE +201 -0
  95. package/native/win32-x64/licenses/idna-1.1.0/LICENSE-MIT +25 -0
  96. package/native/win32-x64/licenses/idna_adapter-1.2.2/LICENSE-APACHE +201 -0
  97. package/native/win32-x64/licenses/idna_adapter-1.2.2/LICENSE-MIT +25 -0
  98. package/native/win32-x64/licenses/itertools-0.15.0/LICENSE-APACHE +201 -0
  99. package/native/win32-x64/licenses/itoa-1.0.19/LICENSE-MIT +23 -0
  100. package/native/win32-x64/licenses/litemap-0.8.3/LICENSE +46 -0
  101. package/native/win32-x64/licenses/memmap2-0.9.12/LICENSE-APACHE +201 -0
  102. package/native/win32-x64/licenses/memmap2-0.9.12/LICENSE-MIT +26 -0
  103. package/native/win32-x64/licenses/percent-encoding-2.3.2/LICENSE-APACHE +201 -0
  104. package/native/win32-x64/licenses/percent-encoding-2.3.2/LICENSE-MIT +25 -0
  105. package/native/win32-x64/licenses/potential_utf-0.1.6/LICENSE +46 -0
  106. package/native/win32-x64/licenses/prost-0.14.6/LICENSE +201 -0
  107. package/native/win32-x64/licenses/prost-derive-0.14.6/LICENSE +201 -0
  108. package/native/win32-x64/licenses/smallvec-1.16.5/LICENSE-APACHE +201 -0
  109. package/native/win32-x64/licenses/smallvec-1.16.5/LICENSE-MIT +25 -0
  110. package/native/win32-x64/licenses/stable_deref_trait-1.2.1/LICENSE-APACHE +201 -0
  111. package/native/win32-x64/licenses/stable_deref_trait-1.2.1/LICENSE-MIT +25 -0
  112. package/native/win32-x64/licenses/syn-3.0.10/LICENSE-MIT +23 -0
  113. package/native/win32-x64/licenses/synstructure-0.14.0/LICENSE +7 -0
  114. package/native/win32-x64/licenses/tinystr-0.8.5/LICENSE +46 -0
  115. package/native/win32-x64/licenses/url-2.5.8/LICENSE-APACHE +201 -0
  116. package/native/win32-x64/licenses/url-2.5.8/LICENSE-MIT +25 -0
  117. package/native/win32-x64/licenses/utf8_iter-1.1.0/LICENSE-APACHE +202 -0
  118. package/native/win32-x64/licenses/utf8_iter-1.1.0/LICENSE-MIT +25 -0
  119. package/native/win32-x64/licenses/utf_types-1.0.0/LICENSE-APACHE +202 -0
  120. package/native/win32-x64/licenses/utf_types-1.0.0/LICENSE-MIT +25 -0
  121. package/native/win32-x64/licenses/uuid-1.29.2/LICENSE-APACHE +201 -0
  122. package/native/win32-x64/licenses/writeable-0.6.4/LICENSE +46 -0
  123. package/native/win32-x64/licenses/yoke-0.8.4/LICENSE +46 -0
  124. package/native/win32-x64/licenses/yoke-derive-0.8.4/LICENSE +46 -0
  125. package/native/win32-x64/licenses/zerofrom-0.1.8/LICENSE +46 -0
  126. package/native/win32-x64/licenses/zerofrom-derive-0.1.8/LICENSE +46 -0
  127. package/native/win32-x64/licenses/zerotrie-0.2.5/LICENSE +46 -0
  128. package/native/win32-x64/licenses/zerovec-0.11.9/LICENSE +46 -0
  129. package/native/win32-x64/licenses/zerovec-derive-0.11.7/LICENSE +46 -0
  130. package/package.json +2 -2
  131. package/dist/chunk-48n5t82k.js +0 -2
  132. package/dist/chunk-f0y4sedm.js +0 -2
  133. package/dist/chunk-mcpaya08.js +0 -2
  134. package/dist/chunk-s4svy2y1.js +0 -2
  135. /package/native/darwin-arm64/licenses/{crc32fast-1.5.4 → crc32fast-1.5.5}/LICENSE-APACHE +0 -0
  136. /package/native/darwin-arm64/licenses/{crc32fast-1.5.4 → crc32fast-1.5.5}/LICENSE-MIT +0 -0
  137. /package/native/darwin-arm64/licenses/{errno-0.3.14 → displaydoc-0.2.7}/LICENSE-APACHE +0 -0
  138. /package/native/darwin-arm64/licenses/{itoa-1.0.18 → displaydoc-0.2.7}/LICENSE-MIT +0 -0
  139. /package/native/darwin-arm64/licenses/{itertools-0.14.0 → errno-0.3.15}/LICENSE-APACHE +0 -0
  140. /package/native/darwin-arm64/licenses/{errno-0.3.14 → errno-0.3.15}/LICENSE-MIT +0 -0
  141. /package/native/darwin-arm64/licenses/{uuid-1.29.1 → form_urlencoded-1.2.2}/LICENSE-APACHE +0 -0
  142. /package/native/{win32-x64/licenses/itertools-0.14.0 → darwin-arm64/licenses/idna-1.1.0}/LICENSE-APACHE +0 -0
  143. /package/native/{win32-x64/licenses/uuid-1.29.1 → darwin-arm64/licenses/idna_adapter-1.2.2}/LICENSE-APACHE +0 -0
  144. /package/native/darwin-arm64/licenses/{prost-0.14.4/LICENSE → itertools-0.15.0/LICENSE-APACHE} +0 -0
  145. /package/native/darwin-arm64/licenses/{itertools-0.14.0 → itertools-0.15.0}/LICENSE-MIT +0 -0
  146. /package/native/darwin-arm64/licenses/{itoa-1.0.18 → itoa-1.0.19}/LICENSE-APACHE +0 -0
  147. /package/native/darwin-arm64/licenses/{syn-3.0.9 → itoa-1.0.19}/LICENSE-MIT +0 -0
  148. /package/native/darwin-arm64/licenses/{mio-1.2.4 → mio-1.2.5}/LICENSE +0 -0
  149. /package/native/darwin-arm64/licenses/{prost-derive-0.14.4/LICENSE → percent-encoding-2.3.2/LICENSE-APACHE} +0 -0
  150. /package/native/{win32-x64/licenses/prost-0.14.4 → darwin-arm64/licenses/prost-0.14.6}/LICENSE +0 -0
  151. /package/native/{win32-x64/licenses/prost-derive-0.14.4 → darwin-arm64/licenses/prost-derive-0.14.6}/LICENSE +0 -0
  152. /package/native/darwin-arm64/licenses/{syn-3.0.9 → syn-3.0.10}/LICENSE-APACHE +0 -0
  153. /package/native/{win32-x64/licenses/itoa-1.0.18 → darwin-arm64/licenses/syn-3.0.10}/LICENSE-MIT +0 -0
  154. /package/native/darwin-arm64/licenses/{uuid-1.29.1 → uuid-1.29.2}/LICENSE-MIT +0 -0
  155. /package/native/win32-x64/licenses/{crc32fast-1.5.4 → crc32fast-1.5.5}/LICENSE-APACHE +0 -0
  156. /package/native/win32-x64/licenses/{crc32fast-1.5.4 → crc32fast-1.5.5}/LICENSE-MIT +0 -0
  157. /package/native/win32-x64/licenses/{syn-3.0.9 → displaydoc-0.2.7}/LICENSE-MIT +0 -0
  158. /package/native/win32-x64/licenses/{itertools-0.14.0 → itertools-0.15.0}/LICENSE-MIT +0 -0
  159. /package/native/win32-x64/licenses/{itoa-1.0.18 → itoa-1.0.19}/LICENSE-APACHE +0 -0
  160. /package/native/win32-x64/licenses/{mio-1.2.4 → mio-1.2.5}/LICENSE +0 -0
  161. /package/native/win32-x64/licenses/{syn-3.0.9 → syn-3.0.10}/LICENSE-APACHE +0 -0
  162. /package/native/win32-x64/licenses/{uuid-1.29.1 → uuid-1.29.2}/LICENSE-MIT +0 -0
@@ -1,5 +1,16 @@
1
1
  import { type EventCallback as __t3Callback, type EventTarget as __t3Target } from '@tauri-apps/api/event';
2
2
  export declare const commands: {
3
+ readonly tools: () => Promise<Value[]>;
4
+ readonly toolCall: (args: {
5
+ "sessionId": string;
6
+ "requestId": string;
7
+ "name": string;
8
+ "arguments": Value;
9
+ }) => Promise<Value>;
10
+ readonly toolCancel: (args: {
11
+ "sessionId": string;
12
+ "requestId": string;
13
+ }) => Promise<null>;
3
14
  readonly context: () => Promise<{
4
15
  registration: Registration;
5
16
  carrier: DeviceCarrier;
@@ -26,10 +37,51 @@ export declare const commands: {
26
37
  readonly frame: (args: {
27
38
  "udid": string;
28
39
  }) => Promise<string>;
40
+ readonly nativeViewSupported: (args: {
41
+ "platform": Platform;
42
+ }) => Promise<boolean>;
43
+ readonly nativeViewMount: (args: {
44
+ "sessionId": string;
45
+ "udid": string;
46
+ "layout": NativeViewLayout;
47
+ }) => Promise<string>;
48
+ readonly nativeViewUpdate: (args: {
49
+ "id": string;
50
+ "layout": NativeViewLayout;
51
+ }) => Promise<null>;
52
+ readonly nativeViewUnmount: (args: {
53
+ "id": string;
54
+ }) => Promise<null>;
55
+ readonly nativeViewStatus: (args: {
56
+ "id": string;
57
+ }) => Promise<NativeViewStatus_Serialize>;
29
58
  readonly gesture: (args: {
30
59
  "udid": string;
31
60
  "gesture": Gesture;
32
61
  }) => Promise<null>;
62
+ readonly inspect: (args: {
63
+ "sessionId": string;
64
+ "udid": string;
65
+ }) => Promise<string>;
66
+ readonly capabilities: (args: {
67
+ "sessionId": string;
68
+ "udid": string;
69
+ }) => Promise<DeviceCapabilities_Serialize>;
70
+ readonly monitorDensity: () => Promise<number | null>;
71
+ readonly activity: (args: {
72
+ "sessionId": string;
73
+ }) => Promise<DeviceActivity_Serialize[]>;
74
+ readonly captureList: (args: {
75
+ "sessionId": string;
76
+ }) => Promise<DeviceCapture[]>;
77
+ readonly captureAccess: (args: {
78
+ "sessionId": string;
79
+ "id": string;
80
+ }) => Promise<string>;
81
+ readonly captureRemove: (args: {
82
+ "sessionId": string;
83
+ "id": string;
84
+ }) => Promise<null>;
33
85
  readonly appearance: (args: {
34
86
  "udid": string;
35
87
  }) => Promise<string>;
@@ -71,6 +123,9 @@ export declare const commands: {
71
123
  } | null>;
72
124
  };
73
125
  export type CommandErrors = {
126
+ "tools": NativeError;
127
+ "toolCall": NativeError;
128
+ "toolCancel": NativeError;
74
129
  "context": NativeError;
75
130
  "bind": NativeError;
76
131
  "stopSession": NativeError;
@@ -79,7 +134,19 @@ export type CommandErrors = {
79
134
  "attach": NativeError;
80
135
  "detach": NativeError;
81
136
  "frame": NativeError;
137
+ "nativeViewSupported": never;
138
+ "nativeViewMount": NativeError;
139
+ "nativeViewUpdate": NativeError;
140
+ "nativeViewUnmount": NativeError;
141
+ "nativeViewStatus": NativeError;
82
142
  "gesture": NativeError;
143
+ "inspect": NativeError;
144
+ "capabilities": NativeError;
145
+ "monitorDensity": NativeError;
146
+ "activity": never;
147
+ "captureList": NativeError;
148
+ "captureAccess": NativeError;
149
+ "captureRemove": NativeError;
83
150
  "appearance": NativeError;
84
151
  "setAppearance": NativeError;
85
152
  "setStatusBar": NativeError;
@@ -109,11 +176,13 @@ export type AttachmentInfo_Deserialize = {
109
176
  systemVersion: string;
110
177
  owner: Owner;
111
178
  attachedAt: string;
179
+ inputRevision?: number;
112
180
  pixelWidth?: number | null;
113
181
  pixelHeight?: number | null;
114
182
  pointWidth?: number | null;
115
183
  pointHeight?: number | null;
116
184
  rotation?: number | null;
185
+ deviceRotation?: number | null;
117
186
  recordingPath?: string | null;
118
187
  app?: LaunchedApp | null;
119
188
  };
@@ -124,20 +193,46 @@ export type AttachmentInfo_Serialize = {
124
193
  systemVersion: string;
125
194
  owner: Owner;
126
195
  attachedAt: string;
196
+ inputRevision: number;
127
197
  pixelWidth: number | null;
128
198
  pixelHeight: number | null;
129
199
  pointWidth: number | null;
130
200
  pointHeight: number | null;
131
201
  rotation: number | null;
202
+ deviceRotation: number | null;
132
203
  recordingPath: string | null;
133
204
  app: LaunchedApp | null;
134
205
  };
206
+ export type ContactPhase = "begin" | "move" | "end" | "cancel";
135
207
  export type CrashReport = {
136
208
  path: string;
137
209
  process: string;
138
210
  timestamp: string;
139
211
  summary: string;
140
212
  };
213
+ export type DeviceActivity = DeviceActivity_Serialize | DeviceActivity_Deserialize;
214
+ export type DeviceActivity_Deserialize = {
215
+ id: string;
216
+ sessionId: string;
217
+ udid: string;
218
+ origin: string;
219
+ action: string;
220
+ startedAt: number;
221
+ durationMs?: number | null;
222
+ status: string;
223
+ error?: string | null;
224
+ };
225
+ export type DeviceActivity_Serialize = {
226
+ id: string;
227
+ sessionId: string;
228
+ udid: string;
229
+ origin: string;
230
+ action: string;
231
+ startedAt: number;
232
+ durationMs: number | null;
233
+ status: string;
234
+ error: string | null;
235
+ };
141
236
  export type DeviceAttachments = DeviceAttachments_Serialize | DeviceAttachments_Deserialize;
142
237
  export type DeviceAttachments_Deserialize = {
143
238
  revision: number;
@@ -148,6 +243,25 @@ export type DeviceAttachments_Serialize = {
148
243
  attachments: AttachmentInfo_Serialize[];
149
244
  };
150
245
  export type DeviceButton = "HOME" | "LOCK" | "SIRI" | "BACK" | "RECENTS";
246
+ export type DeviceCapabilities = DeviceCapabilities_Serialize | DeviceCapabilities_Deserialize;
247
+ export type DeviceCapabilities_Deserialize = {
248
+ densityDpi?: number | null;
249
+ hingeAngle?: number | null;
250
+ };
251
+ export type DeviceCapabilities_Serialize = {
252
+ densityDpi: number | null;
253
+ hingeAngle: number | null;
254
+ };
255
+ export type DeviceCapture = {
256
+ id: string;
257
+ sessionId: string;
258
+ udid: string;
259
+ path: string;
260
+ name: string;
261
+ kind: string;
262
+ createdAt: number;
263
+ bytes: number;
264
+ };
151
265
  export type DeviceCarrier = {
152
266
  command: string;
153
267
  args: string[];
@@ -158,6 +272,10 @@ export type DeviceSessionConnection = {
158
272
  carrier: DeviceCarrier;
159
273
  };
160
274
  export type Gesture = {
275
+ type: "contact";
276
+ phase: ContactPhase;
277
+ contacts: TouchPoint[];
278
+ } | {
161
279
  type: "tap";
162
280
  x: number;
163
281
  y: number;
@@ -186,6 +304,9 @@ export type Gesture = {
186
304
  } | {
187
305
  type: "button";
188
306
  name: DeviceButton;
307
+ } | {
308
+ type: "hinge";
309
+ angle: number;
189
310
  } | {
190
311
  type: "shake";
191
312
  } | {
@@ -243,6 +364,37 @@ export type NativeError = {
243
364
  } & {
244
365
  [key in string]: unknown;
245
366
  };
367
+ export type NativeViewLayout = {
368
+ occlusions: NativeViewOcclusion[];
369
+ x: number;
370
+ y: number;
371
+ width: number;
372
+ height: number;
373
+ clipX: number;
374
+ clipY: number;
375
+ clipWidth: number;
376
+ clipHeight: number;
377
+ radius: number;
378
+ rotation: number;
379
+ maxFps: number;
380
+ visible: boolean;
381
+ };
382
+ export type NativeViewOcclusion = {
383
+ x: number;
384
+ y: number;
385
+ width: number;
386
+ height: number;
387
+ };
388
+ export type NativeViewStatus = NativeViewStatus_Serialize | NativeViewStatus_Deserialize;
389
+ export type NativeViewStatus_Deserialize = {
390
+ frames: number;
391
+ error?: string | null;
392
+ };
393
+ export type NativeViewStatus_Serialize = {
394
+ frames: number;
395
+ error: string | null;
396
+ };
397
+ export type Number = number;
246
398
  export type Owner = {
247
399
  type: "development_session";
248
400
  id: string;
@@ -270,5 +422,8 @@ export type TouchPoint = {
270
422
  x: number;
271
423
  y: number;
272
424
  };
425
+ export type Value = null | boolean | number | string | Value[] | {
426
+ [key in string]: Value;
427
+ };
273
428
  export declare function isNativeError(error: unknown): error is NativeError;
274
429
  export declare function nativeErrorMessage(error: unknown): string;
@@ -1 +1 @@
1
- import{e,p,x,D}from"../chunk-48n5t82k.js";export{e as commands,p as events,x as isNativeError,D as nativeErrorMessage};
1
+ import{e,g,T,B}from"../chunk-7n1fmm2p.js";export{e as commands,g as events,T as isNativeError,B as nativeErrorMessage};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{w,P,m}from"./chunk-rqdjybwe.js";import{i,o}from"./chunk-sbhrg9jp.js";export{P as DEVICE_INSTRUCTIONS,w as DEVICE_SERVER_NAME,m as deviceContext,i as deviceLocales,o as resolveDeviceLabels};
1
+ import{L,I,h}from"./chunk-3zjj07q7.js";import{a,r}from"./chunk-35bn393s.js";export{I as DEVICE_INSTRUCTIONS,L as DEVICE_SERVER_NAME,h as deviceContext,a as deviceLocales,r as resolveDeviceLabels};
@@ -0,0 +1,6 @@
1
+ import type { DeviceBridge } from "./types";
2
+ export declare function ActivityDrawer({ bridge, language, onClose }: {
3
+ bridge: DeviceBridge;
4
+ language?: string;
5
+ onClose: () => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{E}from"../chunk-yf3yrtxe.js";export{E as ActivityDrawer};
@@ -1 +1 @@
1
- import{g,r,s,l}from"../chunk-s4svy2y1.js";export{l as Bezel,g as FRAMES,r as frameKindFor,s as screenPlacement};
1
+ import{P,i,u,d}from"../chunk-xd4kq6pe.js";export{d as Bezel,P as FRAMES,i as frameKindFor,u as screenPlacement};
@@ -0,0 +1,8 @@
1
+ import type { DeviceBridge, DeviceCapture } from "./types";
2
+ export declare function Captures({ bridge, language, revision, onClose, onAdd }: {
3
+ bridge: DeviceBridge;
4
+ language?: string;
5
+ revision: number;
6
+ onClose: () => void;
7
+ onAdd?: (capture: DeviceCapture, url: string) => Promise<void>;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{C}from"../chunk-pa4b54h3.js";export{C as Captures};
@@ -1,2 +1,2 @@
1
1
  import type { DevicePanelProps } from "./types";
2
- export declare function DevicePanel({ bridge, platform: initialPlatform, udid, language, agentName, pollFps: initialFps, maximized, onMaximize, onClose, className }: DevicePanelProps): import("react").JSX.Element;
2
+ export declare function DevicePanel({ bridge, onAddContext, onAddCapture, platform: initialPlatform, udid, language, agentName, pollFps: initialFps, maximized, onMaximize, onClose, className }: DevicePanelProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- import{k}from"../chunk-mcpaya08.js";import"../chunk-s4svy2y1.js";import"../chunk-ctffar6x.js";import"../chunk-sbhrg9jp.js";import"../chunk-f0y4sedm.js";import"../chunk-arw91r4t.js";export{k as DevicePanel};
1
+ import{z}from"../chunk-a8pbgphe.js";import"../chunk-40mwa0cy.js";import"../chunk-tp1d4pv6.js";import"../chunk-cyvmm690.js";import"../chunk-3n6qrzdg.js";import"../chunk-xd4kq6pe.js";import"../chunk-mx5dd23x.js";import"../chunk-35bn393s.js";import"../chunk-pa4b54h3.js";import"../chunk-yf3yrtxe.js";import"../chunk-arw91r4t.js";import"../chunk-wgktmrwt.js";export{z as DevicePanel};
@@ -35,7 +35,7 @@ export declare function pointFor(rect: {
35
35
  top: number;
36
36
  width: number;
37
37
  height: number;
38
- }, clientX: number, clientY: number, pointWidth: number, pointHeight: number): {
38
+ }, clientX: number, clientY: number, pointWidth: number, pointHeight: number, rotation?: number): {
39
39
  x: number;
40
40
  y: number;
41
41
  } | null;
@@ -1 +1 @@
1
- import{f,c,d,b,S,u,a,y}from"../chunk-f0y4sedm.js";export{d as ANDROID_SHORTCUTS,c as IOS_SHORTCUTS,f as KEY_CODES,u as keyGesture,y as pathGesture,a as pointFor,b as releaseGesture,S as shortcutKey};
1
+ import{v,o,s,f,b,l,c,M}from"../chunk-40mwa0cy.js";export{s as ANDROID_SHORTCUTS,o as IOS_SHORTCUTS,v as KEY_CODES,l as keyGesture,M as pathGesture,c as pointFor,f as releaseGesture,b as shortcutKey};
@@ -6,4 +6,4 @@ export { deviceLocales, fill, resolveDeviceLabels } from "./locales";
6
6
  export type { PanelLabels } from "./locales";
7
7
  export { MenuButton } from "./menu";
8
8
  export type { MenuEntry } from "./menu";
9
- export type { AttachmentInfo, DeviceBridge, DeviceGesture, DeviceOwner, DevicePanelProps, LaunchedApp, LogEntry, LogPage, ManagedDevice } from "./types";
9
+ export type { AttachmentInfo, DeviceBridge, DeviceActivity, DeviceCapture, DeviceGesture, DeviceOwner, DevicePanelProps, LaunchedApp, LogEntry, LogPage, ManagedDevice } from "./types";
@@ -1 +1 @@
1
- import{g,r,s,l}from"../chunk-s4svy2y1.js";import{f,c,d,b,S,u,a}from"../chunk-f0y4sedm.js";import{i,o,t}from"../chunk-sbhrg9jp.js";import{n}from"../chunk-arw91r4t.js";import"../chunk-ctffar6x.js";import{k}from"../chunk-mcpaya08.js";export{d as ANDROID_SHORTCUTS,l as Bezel,k as DevicePanel,g as FRAMES,c as IOS_SHORTCUTS,f as KEY_CODES,n as MenuButton,i as deviceLocales,t as fill,r as frameKindFor,u as keyGesture,a as pointFor,b as releaseGesture,o as resolveDeviceLabels,s as screenPlacement,S as shortcutKey};
1
+ import{P,i,u,d}from"../chunk-xd4kq6pe.js";import"../chunk-yf3yrtxe.js";import"../chunk-pa4b54h3.js";import{v,o,s,f,b,l,c}from"../chunk-40mwa0cy.js";import"../chunk-cyvmm690.js";import"../chunk-wgktmrwt.js";import"../chunk-mx5dd23x.js";import{a,r,t}from"../chunk-35bn393s.js";import{n}from"../chunk-arw91r4t.js";import"../chunk-tp1d4pv6.js";import"../chunk-3n6qrzdg.js";import{z}from"../chunk-a8pbgphe.js";export{s as ANDROID_SHORTCUTS,d as Bezel,z as DevicePanel,P as FRAMES,o as IOS_SHORTCUTS,v as KEY_CODES,n as MenuButton,a as deviceLocales,t as fill,i as frameKindFor,l as keyGesture,c as pointFor,f as releaseGesture,r as resolveDeviceLabels,u as screenPlacement,b as shortcutKey};
@@ -0,0 +1,21 @@
1
+ export interface DeviceElement {
2
+ id: string;
3
+ depth: number;
4
+ label: string;
5
+ role: string;
6
+ identifier: string;
7
+ enabled: boolean;
8
+ frame: {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ };
14
+ properties: Record<string, unknown>;
15
+ }
16
+ export declare function parseInspection(source: string, platform: string): DeviceElement[];
17
+ export declare function elementsAt(elements: DeviceElement[], point: {
18
+ x: number;
19
+ y: number;
20
+ }): DeviceElement[];
21
+ export declare function elementContext(deviceName: string, platform: string, element: DeviceElement, note: string): string;
@@ -0,0 +1 @@
1
+ import{S,w,k}from"../chunk-cyvmm690.js";export{k as elementContext,w as elementsAt,S as parseInspection};
@@ -0,0 +1,26 @@
1
+ import type { DeviceElement } from "./inspection";
2
+ export declare function inspectionLabels(language?: string): {
3
+ inspect: string;
4
+ refresh: string;
5
+ close: string;
6
+ note: string;
7
+ add: string;
8
+ copy: string;
9
+ empty: string;
10
+ loading: string;
11
+ previous: string;
12
+ next: string;
13
+ };
14
+ export declare function Inspector({ elements, selected, loading, error, language, onSelect, onRefresh, onClose, onAdd, onCopy, onCycle }: {
15
+ elements: DeviceElement[];
16
+ selected: DeviceElement | null;
17
+ loading: boolean;
18
+ error: string | null;
19
+ language?: string;
20
+ onSelect: (element: DeviceElement) => void;
21
+ onRefresh: () => void;
22
+ onClose: () => void;
23
+ onAdd?: (element: DeviceElement, note: string) => Promise<void>;
24
+ onCopy: (text: string) => Promise<void>;
25
+ onCycle: (direction: number) => void;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{m,N}from"../chunk-wgktmrwt.js";export{N as Inspector,m as inspectionLabels};
@@ -0,0 +1,16 @@
1
+ import type { DeviceGesture } from "./types";
2
+ type Contact = Extract<DeviceGesture, {
3
+ type: "contact";
4
+ }>;
5
+ export declare class LiveTouch {
6
+ private queue;
7
+ private sending;
8
+ private active;
9
+ private send;
10
+ private error;
11
+ constructor(send: (input: DeviceGesture) => Promise<void>, error: (error: unknown) => void);
12
+ push(phase: Contact["phase"], contacts: Contact["contacts"]): void;
13
+ cancel(): void;
14
+ private drain;
15
+ }
16
+ export {};
@@ -0,0 +1 @@
1
+ import{p}from"../chunk-mx5dd23x.js";export{p as LiveTouch};
@@ -1 +1 @@
1
- import{i,o,t}from"../chunk-sbhrg9jp.js";export{i as deviceLocales,t as fill,o as resolveDeviceLabels};
1
+ import{a,r,t}from"../chunk-35bn393s.js";export{a as deviceLocales,t as fill,r as resolveDeviceLabels};
@@ -0,0 +1,22 @@
1
+ import type { NativeDeviceView, NativeViewLayout } from "./types";
2
+ export declare function intersect(a: {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }, b: {
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ }): {
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ };
18
+ export declare function viewLayout(node: HTMLElement): NativeViewLayout;
19
+ export declare function useNativeView(api: NativeDeviceView | undefined, platform: string, udid: string, fps: number, onError: (message: string | null) => void, onFps: (fps: number) => void): {
20
+ supported: boolean | null;
21
+ ref: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
22
+ };
@@ -0,0 +1 @@
1
+ import{y,R,x}from"../chunk-tp1d4pv6.js";export{y as intersect,x as useNativeView,R as viewLayout};
@@ -1 +1 @@
1
- import{h,v}from"../chunk-ctffar6x.js";import"../chunk-sbhrg9jp.js";export{h as AttachScreen,v as ConsentScreen};
1
+ import{D,A}from"../chunk-3n6qrzdg.js";import"../chunk-35bn393s.js";export{D as AttachScreen,A as ConsentScreen};
@@ -25,11 +25,13 @@ export interface AttachmentInfo {
25
25
  systemVersion: string;
26
26
  owner: DeviceOwner;
27
27
  attachedAt: string;
28
+ inputRevision?: number;
28
29
  pixelWidth: number | null;
29
30
  pixelHeight: number | null;
30
31
  pointWidth?: number | null;
31
32
  pointHeight?: number | null;
32
33
  rotation?: number | null;
34
+ deviceRotation?: number | null;
33
35
  recordingPath?: string | null;
34
36
  app: LaunchedApp | null;
35
37
  }
@@ -51,6 +53,13 @@ export interface LogPage {
51
53
  captureStartedAt: string;
52
54
  }
53
55
  export type DeviceGesture = {
56
+ type: "contact";
57
+ phase: "begin" | "move" | "end" | "cancel";
58
+ contacts: {
59
+ x: number;
60
+ y: number;
61
+ }[];
62
+ } | {
54
63
  type: "tap";
55
64
  x: number;
56
65
  y: number;
@@ -82,6 +91,9 @@ export type DeviceGesture = {
82
91
  } | {
83
92
  type: "button";
84
93
  name: "HOME" | "LOCK" | "SIRI" | "BACK" | "RECENTS";
94
+ } | {
95
+ type: "hinge";
96
+ angle: number;
85
97
  } | {
86
98
  type: "shake";
87
99
  } | {
@@ -90,14 +102,78 @@ export type DeviceGesture = {
90
102
  type: "rotate";
91
103
  direction: "left" | "right";
92
104
  };
105
+ export interface NativeViewLayout {
106
+ occlusions: {
107
+ x: number;
108
+ y: number;
109
+ width: number;
110
+ height: number;
111
+ }[];
112
+ rotation: number;
113
+ x: number;
114
+ y: number;
115
+ width: number;
116
+ height: number;
117
+ clipX: number;
118
+ clipY: number;
119
+ clipWidth: number;
120
+ clipHeight: number;
121
+ radius: number;
122
+ maxFps: number;
123
+ visible: boolean;
124
+ }
125
+ export interface NativeDeviceView {
126
+ supported(platform: string): Promise<boolean>;
127
+ mount(udid: string, layout: NativeViewLayout): Promise<string>;
128
+ update(id: string, layout: NativeViewLayout): Promise<void>;
129
+ unmount(id: string): Promise<void>;
130
+ status(id: string): Promise<{
131
+ frames: number;
132
+ error: string | null;
133
+ }>;
134
+ }
135
+ export interface DeviceActivity {
136
+ id: string;
137
+ sessionId: string;
138
+ udid: string;
139
+ origin: string;
140
+ action: string;
141
+ startedAt: number;
142
+ durationMs: number | null;
143
+ status: string;
144
+ error: string | null;
145
+ }
146
+ export interface DeviceCapture {
147
+ id: string;
148
+ sessionId: string;
149
+ udid: string;
150
+ path: string;
151
+ name: string;
152
+ kind: string;
153
+ createdAt: number;
154
+ bytes: number;
155
+ }
93
156
  export interface DeviceBridge {
157
+ nativeView?: NativeDeviceView;
94
158
  listDevices(platform: string): Promise<ManagedDevice[]>;
95
159
  attach(udid: string | undefined, platform: string): Promise<AttachmentInfo>;
96
160
  detach(udid: string): Promise<void>;
97
161
  captureFrame(udid: string): Promise<string | null>;
98
162
  gesture(udid: string, gesture: DeviceGesture): Promise<void>;
99
- subscribe(listener: (attachments: AttachmentInfo[]) => void): () => void;
163
+ subscribe(listener: (attachments: AttachmentInfo[]) => void, onError?: (error: unknown) => void): () => void;
100
164
  takeOver?(udid: string): Promise<void>;
165
+ readActivity?(): Promise<DeviceActivity[]>;
166
+ listCaptures?(): Promise<DeviceCapture[]>;
167
+ captureUrl?(id: string): Promise<string>;
168
+ removeCapture?(id: string): Promise<void>;
169
+ revealCapture?(path: string): Promise<void>;
170
+ monitorDensity?(): Promise<number | null>;
171
+ capabilities?(udid: string): Promise<{
172
+ densityDpi: number | null;
173
+ hingeAngle: number | null;
174
+ }>;
175
+ inspect?(udid: string): Promise<string>;
176
+ copyText?(text: string): Promise<void>;
101
177
  appearance?(udid: string): Promise<string>;
102
178
  setAppearance?(udid: string, mode: "light" | "dark"): Promise<void>;
103
179
  setStatusBar?(udid: string, look: "showcase" | "live"): Promise<void>;
@@ -119,6 +195,8 @@ export interface DeviceBridge {
119
195
  }
120
196
  export interface DevicePanelProps {
121
197
  bridge: DeviceBridge;
198
+ onAddContext?: (text: string) => Promise<void>;
199
+ onAddCapture?: (capture: DeviceCapture, url: string) => Promise<void>;
122
200
  platform?: "ios" | "android";
123
201
  udid?: string;
124
202
  language?: string;
package/dist/tauri.d.ts CHANGED
@@ -9,3 +9,26 @@ export declare function deviceSessionContext(): Promise<{
9
9
  appendSystemPrompt?: string;
10
10
  bind?: (sessionId: string) => Promise<void>;
11
11
  }>;
12
+ export interface DeviceToolDefinition {
13
+ name: string;
14
+ description: string;
15
+ inputSchema: Record<string, unknown>;
16
+ }
17
+ export interface DeviceToolResult {
18
+ isError: boolean;
19
+ content: ({
20
+ type: "text";
21
+ text: string;
22
+ } | {
23
+ type: "image";
24
+ data: string;
25
+ mimeType: string;
26
+ })[];
27
+ }
28
+ export declare function deviceToolDefinitions(): Promise<DeviceToolDefinition[]>;
29
+ export declare function callDeviceTool(name: string, args: Record<string, unknown>, context: {
30
+ sessionId: string;
31
+ requestId: string;
32
+ signal: AbortSignal;
33
+ projectPath?: string;
34
+ }): Promise<DeviceToolResult>;
package/dist/tauri.js CHANGED
@@ -1 +1 @@
1
- import{e,p}from"./chunk-48n5t82k.js";import"./chunk-sbhrg9jp.js";import{m}from"./chunk-rqdjybwe.js";import{isTauri as d}from"@tauri-apps/api/core";function c(n){if(n==="ios"||n==="android")return n;throw Error(`Unsupported device platform: ${n}`)}function f(n){return{listDevices:(t)=>e.list({platform:c(t)}),attach:(t,r)=>e.attach({sessionId:n,platform:c(r),udid:t??null}),detach:async(t)=>{await e.detach({udid:t})},captureFrame:(t)=>e.frame({udid:t}),gesture:async(t,r)=>{await e.gesture({udid:t,gesture:r})},appearance:(t)=>e.appearance({udid:t}),setAppearance:async(t,r)=>{await e.setAppearance({udid:t,mode:r})},setStatusBar:async(t,r)=>{await e.setStatusBar({udid:t,look:r})},shutdown:async(t)=>{await e.shutdown({udid:t})},restart:async(t)=>{await e.restart({udid:t})},readLogs:(t,r)=>e.logs({udid:t,query:{sinceSeq:r.sinceSeq??null,tail:r.tail??null,minLevel:r.minLevel??null,filter:r.filter??null}}),startRecording:(t)=>e.recordStart({udid:t}),stopRecording:(t)=>e.recordStop({udid:t}),saveScreenshot:(t)=>e.saveScreenshot({udid:t}),subscribe:(t)=>{if(!d())return()=>{};let r=!1,s,a=(i)=>i.filter((o)=>o.owner.type==="development_session"&&o.owner.id===n);return e.attachments().then((i)=>{if(!r)t(a(i))}).catch((i)=>console.error("Cannot read device attachments",i)),p["device:attachments"].listen(({payload:i})=>{if(!r)t(a(i.attachments))}).then((i)=>{if(r)i();else s=i}).catch((i)=>console.error("Cannot subscribe to device attachments",i)),()=>{r=!0,s?.()}}}}async function g(){if(!d())return{mcpServers:[]};let n=await e.context();if(!n)return{mcpServers:[]};let t=await m(()=>Promise.resolve(n.registration),n.carrier),r=n.registration.token;return{mcpServers:t.mcpServers,...t.appendSystemPrompt?{appendSystemPrompt:t.appendSystemPrompt}:{},bind:async(s)=>{await e.bind({token:r,sessionId:s})}}}export{f as deviceBridge,g as deviceSessionContext};
1
+ import{e,g}from"./chunk-7n1fmm2p.js";import"./chunk-35bn393s.js";import{h}from"./chunk-3zjj07q7.js";import{convertFileSrc as w,isTauri as y}from"@tauri-apps/api/core";function v(n){if(n==="ios"||n==="android")return n;throw Error(`Unsupported device platform: ${n}`)}function A(n){return{nativeView:{supported:(t)=>e.nativeViewSupported({platform:v(t)}),mount:(t,r)=>e.nativeViewMount({sessionId:n,udid:t,layout:r}),update:async(t,r)=>{await e.nativeViewUpdate({id:t,layout:r})},unmount:async(t)=>{await e.nativeViewUnmount({id:t})},status:(t)=>e.nativeViewStatus({id:t})},listDevices:(t)=>e.list({platform:v(t)}),attach:(t,r)=>e.attach({sessionId:n,platform:v(r),udid:t??null}),detach:async(t)=>{await e.detach({udid:t})},captureFrame:(t)=>e.frame({udid:t}),gesture:async(t,r)=>{await e.gesture({udid:t,gesture:r})},readActivity:()=>e.activity({sessionId:n}),listCaptures:()=>e.captureList({sessionId:n}),captureUrl:async(t)=>w(await e.captureAccess({sessionId:n,id:t})),removeCapture:async(t)=>{await e.captureRemove({sessionId:n,id:t})},monitorDensity:()=>e.monitorDensity(),capabilities:(t)=>e.capabilities({sessionId:n,udid:t}),inspect:(t)=>e.inspect({sessionId:n,udid:t}),appearance:(t)=>e.appearance({udid:t}),setAppearance:async(t,r)=>{await e.setAppearance({udid:t,mode:r})},setStatusBar:async(t,r)=>{await e.setStatusBar({udid:t,look:r})},shutdown:async(t)=>{await e.shutdown({udid:t})},restart:async(t)=>{await e.restart({udid:t})},readLogs:(t,r)=>e.logs({udid:t,query:{sinceSeq:r.sinceSeq??null,tail:r.tail??null,minLevel:r.minLevel??null,filter:r.filter??null}}),startRecording:(t)=>e.recordStart({udid:t}),stopRecording:(t)=>e.recordStop({udid:t}),saveScreenshot:(t)=>e.saveScreenshot({udid:t}),subscribe:(t,r)=>{if(!y())return()=>{};let s=!1,u,c=(a)=>a.filter((d)=>d.owner.type==="development_session"&&d.owner.id===n),p=-1;return g["device:attachments"].listen(({payload:a})=>{if(!s&&a.revision>p)p=a.revision,t(c(a.attachments))}).then(async(a)=>{if(s){a();return}u=a;let d=p,l=await e.attachments();if(!s&&p===d)t(c(l))}).catch((a)=>{if(!s)r?.(a)}),()=>{s=!0,u?.()}}}}async function x(){if(!y())return{mcpServers:[]};let n=await e.context();if(!n)return{mcpServers:[]};let t=await h(()=>Promise.resolve(n.registration),n.carrier),r=n.registration.token;return{mcpServers:t.mcpServers,...t.appendSystemPrompt?{appendSystemPrompt:t.appendSystemPrompt}:{},bind:async(s)=>{await e.bind({token:r,sessionId:s})}}}async function P(){let n=await e.tools();if(!Array.isArray(n)||n.some((t)=>!t||typeof t!=="object"||Array.isArray(t)||typeof t.name!=="string"||typeof t.description!=="string"||!t.inputSchema||typeof t.inputSchema!=="object"||Array.isArray(t.inputSchema)))throw Error("Invalid device tool definitions");return n}async function T(n,t,r){let{sessionId:s,requestId:u,signal:c}=r;c.throwIfAborted();let p=t.platform==="android"?"android":"ios",a=r.projectPath?`alwith:device:target:${JSON.stringify([r.projectPath,p])}`:null,d=t;if(n==="control"&&t.action==="attach"&&t.udid===void 0&&a){let o=localStorage.getItem(a);if(o){if((await e.list({platform:p})).some((i)=>i.id===o))d={...t,udid:o}}}c.throwIfAborted();let l=()=>{e.toolCancel({sessionId:s,requestId:u}).catch((o)=>console.error("Cannot cancel device operation",o))};c.addEventListener("abort",l,{once:!0});try{let o=await e.toolCall({sessionId:s,requestId:u,name:n,arguments:d});if(c.throwIfAborted(),!o||typeof o!=="object"||!("isError"in o)||typeof o.isError!=="boolean"||!("content"in o)||!Array.isArray(o.content)||o.content.some((i)=>!i||typeof i!=="object"||!("type"in i)||(i.type==="text"?!("text"in i)||typeof i.text!=="string":i.type==="image"?!("data"in i)||typeof i.data!=="string"||!("mimeType"in i)||typeof i.mimeType!=="string":!0)))throw Error("Invalid device tool result");let f=o;if(!f.isError&&n==="control"&&t.action==="attach"&&a){let i=f.content.find((m)=>m.type==="text");if(i?.type==="text"){let m=JSON.parse(i.text);if(typeof m.attachment?.udid==="string")localStorage.setItem(a,m.attachment.udid)}}return f}finally{c.removeEventListener("abort",l)}}export{T as callDeviceTool,A as deviceBridge,x as deviceSessionContext,P as deviceToolDefinitions};