wuying-agentbay-sdk 0.10.2 → 0.12.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 (108) hide show
  1. package/dist/chunk-BVWUCG4J.mjs +3402 -0
  2. package/dist/chunk-BVWUCG4J.mjs.map +1 -0
  3. package/dist/chunk-SL5GCAQE.cjs +3393 -0
  4. package/dist/chunk-SL5GCAQE.cjs.map +1 -0
  5. package/dist/index.cjs +4623 -3978
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.mts +3934 -1964
  8. package/dist/index.d.ts +3934 -1964
  9. package/dist/index.mjs +4601 -3956
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/key-normalizer-AF7APGQZ.cjs +136 -0
  12. package/dist/key-normalizer-AF7APGQZ.cjs.map +1 -0
  13. package/dist/key-normalizer-QDBRLFHF.mjs +145 -0
  14. package/dist/key-normalizer-QDBRLFHF.mjs.map +1 -0
  15. package/dist/model-CNCGFWJH.cjs +200 -0
  16. package/dist/model-CNCGFWJH.cjs.map +1 -0
  17. package/dist/model-LGWQJWKQ.mjs +209 -0
  18. package/docs/api/README.md +26 -0
  19. package/docs/api/browser-use/browser.md +177 -0
  20. package/docs/api/browser-use/extension.md +284 -0
  21. package/docs/api/codespace/code.md +77 -0
  22. package/docs/api/common-features/advanced/agent.md +84 -0
  23. package/docs/api/common-features/advanced/oss.md +221 -0
  24. package/docs/api/common-features/basics/agentbay.md +277 -0
  25. package/docs/api/common-features/basics/command.md +83 -0
  26. package/docs/api/common-features/basics/context-manager.md +149 -0
  27. package/docs/api/common-features/basics/context-sync.md +51 -0
  28. package/docs/api/common-features/basics/context.md +348 -0
  29. package/docs/api/common-features/basics/filesystem.md +499 -0
  30. package/docs/api/common-features/basics/logging.md +77 -0
  31. package/docs/api/common-features/basics/session.md +542 -0
  32. package/docs/api/computer-use/computer.md +786 -0
  33. package/docs/api/mobile-use/mobile.md +395 -0
  34. package/docs/examples/README.md +332 -0
  35. package/docs/examples/basic-usage.ts +86 -0
  36. package/docs/examples/browser-use/browser/README.md +356 -0
  37. package/docs/examples/browser-use/browser/basic-usage.ts +136 -0
  38. package/docs/examples/browser-use/browser/browser-command-args.ts +117 -0
  39. package/docs/examples/browser-use/browser/browser-context-cookie-persistence.ts +348 -0
  40. package/docs/examples/browser-use/browser/browser-fingerprint-basic-usage.ts +121 -0
  41. package/docs/examples/browser-use/browser/browser-fingerprint-construct.ts +114 -0
  42. package/docs/examples/browser-use/browser/browser-fingerprint-local-sync.ts +98 -0
  43. package/docs/examples/browser-use/browser/browser-fingerprint-persistence.ts +242 -0
  44. package/docs/examples/browser-use/browser/browser-proxies.ts +149 -0
  45. package/docs/examples/browser-use/browser/browser-type-example.ts +266 -0
  46. package/docs/examples/browser-use/browser/browser-viewport.ts +129 -0
  47. package/docs/examples/browser-use/browser/call_for_user_jd.ts +184 -0
  48. package/docs/examples/browser-use/browser/captcha_tongcheng.ts +151 -0
  49. package/docs/examples/browser-use/browser/run-2048.ts +209 -0
  50. package/docs/examples/browser-use/browser/run-sudoku.ts +150 -0
  51. package/docs/examples/browser-use/browser/screenshot-example.ts +132 -0
  52. package/docs/examples/browser-use/extension-example/README.md +252 -0
  53. package/docs/examples/browser-use/extension-example/extension-example.ts +381 -0
  54. package/docs/examples/codespace/automation/automation-example.ts +322 -0
  55. package/docs/examples/common-features/advanced/agent-module-example/README.md +40 -0
  56. package/docs/examples/common-features/advanced/agent-module-example.ts +66 -0
  57. package/docs/examples/common-features/advanced/archive-upload-mode-example/README.md +212 -0
  58. package/docs/examples/common-features/advanced/archive-upload-mode-example/archive-upload-mode-example.ts +213 -0
  59. package/docs/examples/common-features/advanced/vpc-session-example/README.md +47 -0
  60. package/docs/examples/common-features/advanced/vpc-session-example.ts +106 -0
  61. package/docs/examples/common-features/basics/archive-upload-mode-example/README.md +236 -0
  62. package/docs/examples/common-features/basics/archive-upload-mode-example/main.ts +236 -0
  63. package/docs/examples/common-features/basics/command-example/README.md +47 -0
  64. package/docs/examples/common-features/basics/command-example/command-example.ts +153 -0
  65. package/docs/examples/common-features/basics/context-management/README.md +55 -0
  66. package/docs/examples/common-features/basics/context-management/context-management.ts +140 -0
  67. package/docs/examples/common-features/basics/data-persistence/README.md +129 -0
  68. package/docs/examples/common-features/basics/data-persistence/context-sync-demo.md +144 -0
  69. package/docs/examples/common-features/basics/data-persistence/context-sync-demo.ts +275 -0
  70. package/docs/examples/common-features/basics/data-persistence/data-persistence.ts +259 -0
  71. package/docs/examples/common-features/basics/data-persistence/recycle-policy-example.ts +294 -0
  72. package/docs/examples/common-features/basics/filesystem-example/README.md +57 -0
  73. package/docs/examples/common-features/basics/filesystem-example/filesystem-example.ts +164 -0
  74. package/docs/examples/common-features/basics/filesystem-example/filesystem-filetransfer-example.ts +153 -0
  75. package/docs/examples/common-features/basics/filesystem-example/watch-directory-example.ts +168 -0
  76. package/docs/examples/common-features/basics/get/README.md +136 -0
  77. package/docs/examples/common-features/basics/get/main.ts +79 -0
  78. package/docs/examples/common-features/basics/list_sessions/README.md +54 -0
  79. package/docs/examples/common-features/basics/list_sessions/main.ts +258 -0
  80. package/docs/examples/common-features/basics/mcp_tool_direct_call/README.md +142 -0
  81. package/docs/examples/common-features/basics/mcp_tool_direct_call/main.ts +135 -0
  82. package/docs/examples/common-features/basics/session-creation/README.md +28 -0
  83. package/docs/examples/common-features/basics/session-creation/session-creation.ts +295 -0
  84. package/docs/examples/common-features/basics/session-pause-resume/README.md +53 -0
  85. package/docs/examples/common-features/basics/session-pause-resume/session-pause-resume.ts +237 -0
  86. package/docs/examples/mobile-use/mobile-get-adb-url/README.md +92 -0
  87. package/docs/examples/mobile-use/mobile-get-adb-url/index.ts +80 -0
  88. package/docs/examples/mobile-use/mobile-get-adb-url/package-lock.json +279 -0
  89. package/docs/examples/mobile-use/mobile-get-adb-url/package.json +18 -0
  90. package/docs/examples/mobile-use/mobile-simulate-basic-usage.ts +202 -0
  91. package/docs/examples/mobile-use/mobile-simulate-with-ctx.ts +170 -0
  92. package/package.json +19 -12
  93. package/dist/application-KZWXH46T.mjs +0 -17
  94. package/dist/application-LMA7KSRH.cjs +0 -8
  95. package/dist/application-LMA7KSRH.cjs.map +0 -1
  96. package/dist/chunk-BQNGKBQF.mjs +0 -386
  97. package/dist/chunk-BQNGKBQF.mjs.map +0 -1
  98. package/dist/chunk-IOVGAAJL.cjs +0 -558
  99. package/dist/chunk-IOVGAAJL.cjs.map +0 -1
  100. package/dist/chunk-UF2TC2R4.mjs +0 -567
  101. package/dist/chunk-UF2TC2R4.mjs.map +0 -1
  102. package/dist/chunk-X6MS7Z5L.cjs +0 -377
  103. package/dist/chunk-X6MS7Z5L.cjs.map +0 -1
  104. package/dist/window-DH37ZDD5.mjs +0 -17
  105. package/dist/window-DH37ZDD5.mjs.map +0 -1
  106. package/dist/window-U7N3H735.cjs +0 -8
  107. package/dist/window-U7N3H735.cjs.map +0 -1
  108. /package/dist/{application-KZWXH46T.mjs.map → model-LGWQJWKQ.mjs.map} +0 -0
@@ -1,558 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunk4IPTHWLMcjs = require('./chunk-4IPTHWLM.cjs');
5
-
6
- // src/window/window.ts
7
- _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
8
- var _WindowManager = class _WindowManager {
9
- /**
10
- * Creates a new WindowManager instance.
11
- * @param session The session object that provides access to the AgentBay API.
12
- */
13
- constructor(session) {
14
- this.session = session;
15
- }
16
- /**
17
- * Helper method to parse JSON string into Window objects
18
- * @param jsonStr - JSON string to parse
19
- * @returns Array of Window objects or single Window object
20
- */
21
- parseWindowsFromJSON(jsonStr) {
22
- try {
23
- const parsed = JSON.parse(jsonStr);
24
- return Array.isArray(parsed) ? parsed : [parsed];
25
- } catch (error) {
26
- throw new Error(`Failed to parse window data: ${error}`);
27
- }
28
- }
29
- /**
30
- * Lists all root windows in the system.
31
- * Corresponds to Python's list_root_windows() method
32
- *
33
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
34
- * @returns WindowListResult with windows array and requestId
35
- *
36
- * @deprecated Use session.computer.listRootWindows() instead.
37
- */
38
- async listRootWindows(timeoutMs = 3e3) {
39
- console.warn("\u26A0\uFE0F WindowManager.listRootWindows() is deprecated. Use session.computer.listRootWindows() instead.");
40
- try {
41
- const args = {
42
- timeout_ms: timeoutMs
43
- };
44
- const response = await this.session.callMcpTool(
45
- "list_root_windows",
46
- args
47
- );
48
- if (!response.success) {
49
- return {
50
- requestId: response.requestId,
51
- success: false,
52
- windows: [],
53
- errorMessage: response.errorMessage
54
- };
55
- }
56
- const windows = response.data ? this.parseWindowsFromJSON(response.data) : [];
57
- return {
58
- requestId: response.requestId,
59
- success: true,
60
- windows
61
- };
62
- } catch (error) {
63
- return {
64
- requestId: "",
65
- success: false,
66
- windows: [],
67
- errorMessage: `Failed to list root windows: ${error}`
68
- };
69
- }
70
- }
71
- /**
72
- * Lists all windows in the system.
73
- * Corresponds to Python's list_all_windows() method
74
- *
75
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
76
- * @returns WindowListResult with windows array and requestId
77
- *
78
- * @deprecated Use session.computer.listAllWindows() instead.
79
- */
80
- async listAllWindows(timeoutMs = 3e3) {
81
- console.warn("\u26A0\uFE0F WindowManager.listAllWindows() is deprecated. Use session.computer.listAllWindows() instead.");
82
- try {
83
- const args = {
84
- timeout_ms: timeoutMs
85
- };
86
- const response = await this.session.callMcpTool(
87
- "list_all_windows",
88
- args
89
- );
90
- if (!response.success) {
91
- return {
92
- requestId: response.requestId,
93
- success: false,
94
- windows: [],
95
- errorMessage: response.errorMessage
96
- };
97
- }
98
- const windows = response.data ? this.parseWindowsFromJSON(response.data) : [];
99
- return {
100
- requestId: response.requestId,
101
- success: true,
102
- windows
103
- };
104
- } catch (error) {
105
- return {
106
- requestId: "",
107
- success: false,
108
- windows: [],
109
- errorMessage: `Failed to list all windows: ${error}`
110
- };
111
- }
112
- }
113
- /**
114
- * Gets information about a specific window.
115
- * Corresponds to Python's get_window_info() method
116
- *
117
- * @param windowId - The ID of the window to get information for.
118
- * @returns WindowInfoResult with window information and requestId
119
- *
120
- * @deprecated Use session.computer.getWindowInfo() instead.
121
- */
122
- async getWindowInfo(windowId) {
123
- console.warn("\u26A0\uFE0F WindowManager.getWindowInfo() is deprecated. Use session.computer.getWindowInfo() instead.");
124
- try {
125
- const args = {
126
- window_id: windowId
127
- };
128
- const response = await this.session.callMcpTool(
129
- "get_window_info",
130
- args
131
- );
132
- if (!response.success) {
133
- return {
134
- requestId: response.requestId,
135
- success: false,
136
- errorMessage: response.errorMessage
137
- };
138
- }
139
- let window = void 0;
140
- if (response.data) {
141
- const windows = this.parseWindowsFromJSON(response.data);
142
- window = windows.length > 0 ? windows[0] : void 0;
143
- }
144
- return {
145
- requestId: response.requestId,
146
- success: true,
147
- window
148
- };
149
- } catch (error) {
150
- return {
151
- requestId: "",
152
- success: false,
153
- errorMessage: `Failed to get window info: ${error}`
154
- };
155
- }
156
- }
157
- /**
158
- * Activates a window by bringing it to the foreground.
159
- * Corresponds to Python's activate_window() method
160
- *
161
- * @param windowId - The ID of the window to activate.
162
- * @returns BoolResult with success status and requestId
163
- *
164
- * @deprecated Use session.computer.activateWindow() instead.
165
- */
166
- async activateWindow(windowId) {
167
- console.warn("\u26A0\uFE0F WindowManager.activateWindow() is deprecated. Use session.computer.activateWindow() instead.");
168
- try {
169
- const args = {
170
- window_id: windowId
171
- };
172
- const response = await this.session.callMcpTool(
173
- "activate_window",
174
- args
175
- );
176
- if (!response.success) {
177
- return {
178
- requestId: response.requestId,
179
- success: false,
180
- errorMessage: response.errorMessage
181
- };
182
- }
183
- return {
184
- requestId: response.requestId,
185
- success: true,
186
- data: true
187
- };
188
- } catch (error) {
189
- return {
190
- requestId: "",
191
- success: false,
192
- errorMessage: `Failed to activate window: ${error}`
193
- };
194
- }
195
- }
196
- /**
197
- * Maximizes a window.
198
- * Corresponds to Python's maximize_window() method
199
- *
200
- * @param windowId - The ID of the window to maximize.
201
- * @returns BoolResult with success status and requestId
202
- *
203
- * @deprecated Use session.computer.maximizeWindow() instead.
204
- */
205
- async maximizeWindow(windowId) {
206
- console.warn("\u26A0\uFE0F WindowManager.maximizeWindow() is deprecated. Use session.computer.maximizeWindow() instead.");
207
- try {
208
- const args = {
209
- window_id: windowId
210
- };
211
- const response = await this.session.callMcpTool(
212
- "maximize_window",
213
- args
214
- );
215
- if (!response.success) {
216
- return {
217
- requestId: response.requestId,
218
- success: false,
219
- errorMessage: response.errorMessage
220
- };
221
- }
222
- return {
223
- requestId: response.requestId,
224
- success: true,
225
- data: true
226
- };
227
- } catch (error) {
228
- return {
229
- requestId: "",
230
- success: false,
231
- errorMessage: `Failed to maximize window: ${error}`
232
- };
233
- }
234
- }
235
- /**
236
- * Minimizes a window.
237
- * Corresponds to Python's minimize_window() method
238
- *
239
- * @param windowId - The ID of the window to minimize.
240
- * @returns BoolResult with success status and requestId
241
- *
242
- * @deprecated Use session.computer.minimizeWindow() instead.
243
- */
244
- async minimizeWindow(windowId) {
245
- console.warn("\u26A0\uFE0F WindowManager.minimizeWindow() is deprecated. Use session.computer.minimizeWindow() instead.");
246
- try {
247
- const args = {
248
- window_id: windowId
249
- };
250
- const response = await this.session.callMcpTool(
251
- "minimize_window",
252
- args
253
- );
254
- if (!response.success) {
255
- return {
256
- requestId: response.requestId,
257
- success: false,
258
- errorMessage: response.errorMessage
259
- };
260
- }
261
- return {
262
- requestId: response.requestId,
263
- success: true,
264
- data: true
265
- };
266
- } catch (error) {
267
- return {
268
- requestId: "",
269
- success: false,
270
- errorMessage: `Failed to minimize window: ${error}`
271
- };
272
- }
273
- }
274
- /**
275
- * Restores a window by ID.
276
- * Corresponds to Python's restore_window() method
277
- *
278
- * @param windowId The ID of the window to restore.
279
- * @returns BoolResult with requestId
280
- */
281
- async restoreWindow(windowId) {
282
- try {
283
- const args = {
284
- window_id: windowId
285
- };
286
- const response = await this.session.callMcpTool(
287
- "restore_window",
288
- args
289
- );
290
- if (!response.success) {
291
- return {
292
- requestId: response.requestId,
293
- success: false,
294
- errorMessage: response.errorMessage
295
- };
296
- }
297
- return {
298
- requestId: response.requestId,
299
- success: true,
300
- data: true
301
- };
302
- } catch (error) {
303
- return {
304
- requestId: "",
305
- success: false,
306
- errorMessage: `Failed to restore window: ${error}`
307
- };
308
- }
309
- }
310
- /**
311
- * Closes a window.
312
- * Corresponds to Python's close_window() method
313
- *
314
- * @param windowId - The ID of the window to close.
315
- * @returns BoolResult with success status and requestId
316
- *
317
- * @deprecated Use session.computer.closeWindow() instead.
318
- */
319
- async closeWindow(windowId) {
320
- console.warn("\u26A0\uFE0F WindowManager.closeWindow() is deprecated. Use session.computer.closeWindow() instead.");
321
- try {
322
- const args = {
323
- window_id: windowId
324
- };
325
- const response = await this.session.callMcpTool(
326
- "close_window",
327
- args
328
- );
329
- if (!response.success) {
330
- return {
331
- requestId: response.requestId,
332
- success: false,
333
- errorMessage: response.errorMessage
334
- };
335
- }
336
- return {
337
- requestId: response.requestId,
338
- success: true,
339
- data: true
340
- };
341
- } catch (error) {
342
- return {
343
- requestId: "",
344
- success: false,
345
- errorMessage: `Failed to close window: ${error}`
346
- };
347
- }
348
- }
349
- /**
350
- * Sets a window to fullscreen by ID.
351
- * Corresponds to Python's fullscreen_window() method
352
- *
353
- * @param windowId The ID of the window to set to fullscreen.
354
- * @returns BoolResult with requestId
355
- */
356
- async fullscreenWindow(windowId) {
357
- try {
358
- const args = {
359
- window_id: windowId
360
- };
361
- const response = await this.session.callMcpTool(
362
- "fullscreen_window",
363
- args
364
- );
365
- if (!response.success) {
366
- return {
367
- requestId: response.requestId,
368
- success: false,
369
- errorMessage: response.errorMessage
370
- };
371
- }
372
- return {
373
- requestId: response.requestId,
374
- success: true,
375
- data: true
376
- };
377
- } catch (error) {
378
- return {
379
- requestId: "",
380
- success: false,
381
- errorMessage: `Failed to make window fullscreen: ${error}`
382
- };
383
- }
384
- }
385
- /**
386
- * Resizes a window to the specified dimensions.
387
- * Corresponds to Python's resize_window() method
388
- *
389
- * @param windowId - The ID of the window to resize.
390
- * @param width - The new width of the window.
391
- * @param height - The new height of the window.
392
- * @returns BoolResult with success status and requestId
393
- *
394
- * @deprecated Use session.computer.resizeWindow() instead.
395
- */
396
- async resizeWindow(windowId, width, height) {
397
- console.warn("\u26A0\uFE0F WindowManager.resizeWindow() is deprecated. Use session.computer.resizeWindow() instead.");
398
- try {
399
- const args = {
400
- window_id: windowId,
401
- width,
402
- height
403
- };
404
- const response = await this.session.callMcpTool(
405
- "resize_window",
406
- args
407
- );
408
- if (!response.success) {
409
- return {
410
- requestId: response.requestId,
411
- success: false,
412
- errorMessage: response.errorMessage
413
- };
414
- }
415
- return {
416
- requestId: response.requestId,
417
- success: true,
418
- data: true
419
- };
420
- } catch (error) {
421
- return {
422
- requestId: "",
423
- success: false,
424
- errorMessage: `Failed to resize window: ${error}`
425
- };
426
- }
427
- }
428
- /**
429
- * Moves a window to the specified position.
430
- * Corresponds to Python's move_window() method
431
- *
432
- * @param windowId - The ID of the window to move.
433
- * @param x - The new x coordinate of the window.
434
- * @param y - The new y coordinate of the window.
435
- * @returns BoolResult with success status and requestId
436
- *
437
- * @deprecated Use session.computer.moveWindow() instead.
438
- */
439
- async moveWindow(windowId, x, y) {
440
- console.warn("\u26A0\uFE0F WindowManager.moveWindow() is deprecated. Use session.computer.moveWindow() instead.");
441
- try {
442
- const args = {
443
- window_id: windowId,
444
- x,
445
- y
446
- };
447
- const response = await this.session.callMcpTool(
448
- "move_window",
449
- args
450
- );
451
- if (!response.success) {
452
- return {
453
- requestId: response.requestId,
454
- success: false,
455
- errorMessage: response.errorMessage
456
- };
457
- }
458
- return {
459
- requestId: response.requestId,
460
- success: true,
461
- data: true
462
- };
463
- } catch (error) {
464
- return {
465
- requestId: "",
466
- success: false,
467
- errorMessage: `Failed to move window: ${error}`
468
- };
469
- }
470
- }
471
- /**
472
- * Enables or disables focus mode.
473
- * Corresponds to Python's focus_mode() method
474
- *
475
- * @param on Whether to enable focus mode.
476
- * @returns BoolResult with requestId
477
- */
478
- async focusMode(on) {
479
- try {
480
- const args = {
481
- on
482
- };
483
- const response = await this.session.callMcpTool(
484
- "focus_mode",
485
- args
486
- );
487
- if (!response.success) {
488
- return {
489
- requestId: response.requestId,
490
- success: false,
491
- errorMessage: response.errorMessage
492
- };
493
- }
494
- return {
495
- requestId: response.requestId,
496
- success: true,
497
- data: true
498
- };
499
- } catch (error) {
500
- return {
501
- requestId: "",
502
- success: false,
503
- errorMessage: `Failed to toggle focus mode: ${error}`
504
- };
505
- }
506
- }
507
- /**
508
- * Gets the currently active window.
509
- * Corresponds to Python's get_active_window() method
510
- *
511
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
512
- * @returns WindowInfoResult with active window information and requestId
513
- *
514
- * @deprecated Use session.computer.getActiveWindow() instead.
515
- */
516
- async getActiveWindow(timeoutMs = 3e3) {
517
- console.warn("\u26A0\uFE0F WindowManager.getActiveWindow() is deprecated. Use session.computer.getActiveWindow() instead.");
518
- try {
519
- const args = {
520
- timeout_ms: timeoutMs
521
- };
522
- const response = await this.session.callMcpTool(
523
- "get_active_window",
524
- args
525
- );
526
- if (!response.success) {
527
- return {
528
- requestId: response.requestId,
529
- success: false,
530
- errorMessage: response.errorMessage
531
- };
532
- }
533
- let activeWindow = void 0;
534
- if (response.data) {
535
- const windows = this.parseWindowsFromJSON(response.data);
536
- activeWindow = windows.length > 0 ? windows[0] : void 0;
537
- }
538
- return {
539
- requestId: response.requestId,
540
- success: true,
541
- window: activeWindow
542
- };
543
- } catch (error) {
544
- return {
545
- requestId: "",
546
- success: false,
547
- errorMessage: `Failed to get active window: ${error}`
548
- };
549
- }
550
- }
551
- };
552
- _chunk4IPTHWLMcjs.__name.call(void 0, _WindowManager, "WindowManager");
553
- var WindowManager = _WindowManager;
554
-
555
-
556
-
557
- exports.WindowManager = WindowManager;
558
- //# sourceMappingURL=chunk-IOVGAAJL.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/wuying-agentbay-sdk/wuying-agentbay-sdk/typescript/dist/chunk-IOVGAAJL.cjs","../src/window/window.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,8CAAA,CAAA;AA+BO,IAAM,eAAA,EAAN,MAAM,eAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBzB,WAAA,CAAY,OAAA,EAST;AACD,IAAA,IAAA,CAAK,QAAA,EAAU,OAAA;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,oBAAA,CAAqB,OAAA,EAA2B;AACtD,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA;AACjC,MAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,MAAM,EAAA,EAAI,OAAA,EAAS,CAAC,MAAM,CAAA;AAAA,IACjD,EAAA,MAAA,CAAS,KAAA,EAAO;AACd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA;AACvD,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWmE,EAAA;AACpD,IAAA;AAET,IAAA;AACW,MAAA;AACC,QAAA;AACd,MAAA;AAEoC,MAAA;AAClC,QAAA;AACA,QAAA;AACF,MAAA;AAEuB,MAAA;AACd,QAAA;AACe,UAAA;AACX,UAAA;AACC,UAAA;AACa,UAAA;AACzB,QAAA;AACF,MAAA;AAGS,MAAA;AAGF,MAAA;AACe,QAAA;AACX,QAAA;AACT,QAAA;AACF,MAAA;AACc,IAAA;AACP,MAAA;AACM,QAAA;AACF,QAAA;AACC,QAAA;AACyC,QAAA;AACrD,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWkE,EAAA;AACnD,IAAA;AAET,IAAA;AACW,MAAA;A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;AAClC,QAAA;AACA,QAAA;AACF,MAAA;AAEuB,MAAA;AACd,QAAA;AACe,UAAA;AACX,UAAA;AACc,UAAA;AACzB,QAAA;AACF,MAAA;AAEO,MAAA;AACe,QAAA;AACX,QAAA;AACH,QAAA;AACR,MAAA;AACc,IAAA;AACP,MAAA;AACM,QAAA;AACF,QAAA;AACoC,QAAA;AAC/C,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASkD,EAAA;AAC5C,IAAA;AACW,MAAA;AACX,QAAA;AACF,MAAA;AAEoC,MAAA;AAClC,QAAA;AACA,QAAA;AACF,MAAA;AAEuB,MAAA;AACd,QAAA;AACe,UAAA;AACX,UAAA;AACc,UAAA;AACzB,QAAA;AACF,MAAA;AAEO,MAAA;AACe,QAAA;AACX,QAAA;AACH,QAAA;AACR,MAAA;AACc,IAAA;AACP,MAAA;AACM,QAAA;AACF,QAAA;AAC0C,QAAA;AACrD,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWmE,EAAA;AACpD,IAAA;AAET,IAAA;AACW,MAAA;AACC,QAAA;AACd,MAAA;AAEoC,MAAA;AAClC,QAAA;AACA,QAAA;AACF,MAAA;AAEuB,MAAA;AACd,QAAA;AACe,UAAA;AACX,UAAA;AACc,UAAA;AACzB,QAAA;AACF,MAAA;AAEuC,MAAA;AACpB,MAAA;AACkC,QAAA;AACF,QAAA;AACnD,MAAA;AAEO,MAAA;AACe,QAAA;AACX,QAAA;AACD,QAAA;AACV,MAAA;AACc,IAAA;AACP,MAAA;AACM,QAAA;AACF,QAAA;AAC0C,QAAA;AACrD,MAAA;AACF,IAAA;AACF,EAAA;AACF;AA5nB2B;AAApB;AD0gBqD;AACA;AACA;AACA","file":"/home/runner/work/wuying-agentbay-sdk/wuying-agentbay-sdk/typescript/dist/chunk-IOVGAAJL.cjs","sourcesContent":[null,"\nimport {\n WindowListResult,\n WindowInfoResult,\n BoolResult,\n} from \"../types/api-response\";\n\n\n\n/**\n * Represents a window in the system.\n */\nexport interface Window {\n window_id: number;\n title: string;\n absolute_upper_left_x?: number;\n absolute_upper_left_y?: number;\n width?: number;\n height?: number;\n pid?: number;\n pname?: string;\n child_windows?: Window[];\n}\n\n/**\n * Handles window management operations in the AgentBay cloud environment.\n * \n * @deprecated This module is deprecated. Use Computer module instead.\n * - For desktop window operations, use session.computer\n * - Window operations are not available for mobile\n */\nexport class WindowManager {\n private session: {\n getAPIKey(): string;\n getSessionId(): string;\n callMcpTool(toolName: string, args: any): Promise<{\n success: boolean;\n data: string;\n errorMessage: string;\n requestId: string;\n }>;\n };\n\n /**\n * Creates a new WindowManager instance.\n * @param session The session object that provides access to the AgentBay API.\n */\n constructor(session: {\n getAPIKey(): string;\n getSessionId(): string;\n callMcpTool(toolName: string, args: any): Promise<{\n success: boolean;\n data: string;\n errorMessage: string;\n requestId: string;\n }>;\n }) {\n this.session = session;\n }\n\n\n\n /**\n * Helper method to parse JSON string into Window objects\n * @param jsonStr - JSON string to parse\n * @returns Array of Window objects or single Window object\n */\n private parseWindowsFromJSON(jsonStr: string): Window[] {\n try {\n const parsed = JSON.parse(jsonStr);\n return Array.isArray(parsed) ? parsed : [parsed];\n } catch (error) {\n throw new Error(`Failed to parse window data: ${error}`);\n }\n }\n\n /**\n * Lists all root windows in the system.\n * Corresponds to Python's list_root_windows() method\n *\n * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.\n * @returns WindowListResult with windows array and requestId\n * \n * @deprecated Use session.computer.listRootWindows() instead.\n */\n async listRootWindows(timeoutMs = 3000): Promise<WindowListResult> {\n console.warn('⚠️ WindowManager.listRootWindows() is deprecated. Use session.computer.listRootWindows() instead.');\n \n try {\n const args = {\n timeout_ms: timeoutMs,\n };\n\n const response = await this.session.callMcpTool(\n \"list_root_windows\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n windows: [],\n errorMessage: response.errorMessage,\n };\n }\n\n const windows = response.data\n ? this.parseWindowsFromJSON(response.data)\n : [];\n\n return {\n requestId: response.requestId,\n success: true,\n windows,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n windows: [],\n errorMessage: `Failed to list root windows: ${error}`,\n };\n }\n }\n\n /**\n * Lists all windows in the system.\n * Corresponds to Python's list_all_windows() method\n *\n * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.\n * @returns WindowListResult with windows array and requestId\n * \n * @deprecated Use session.computer.listAllWindows() instead.\n */\n async listAllWindows(timeoutMs = 3000): Promise<WindowListResult> {\n console.warn('⚠️ WindowManager.listAllWindows() is deprecated. Use session.computer.listAllWindows() instead.');\n \n try {\n const args = {\n timeout_ms: timeoutMs,\n };\n\n const response = await this.session.callMcpTool(\n \"list_all_windows\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n windows: [],\n errorMessage: response.errorMessage,\n };\n }\n\n const windows = response.data\n ? this.parseWindowsFromJSON(response.data)\n : [];\n\n return {\n requestId: response.requestId,\n success: true,\n windows,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n windows: [],\n errorMessage: `Failed to list all windows: ${error}`,\n };\n }\n }\n\n /**\n * Gets information about a specific window.\n * Corresponds to Python's get_window_info() method\n *\n * @param windowId - The ID of the window to get information for.\n * @returns WindowInfoResult with window information and requestId\n * \n * @deprecated Use session.computer.getWindowInfo() instead.\n */\n async getWindowInfo(windowId: number): Promise<WindowInfoResult> {\n console.warn('⚠️ WindowManager.getWindowInfo() is deprecated. Use session.computer.getWindowInfo() instead.');\n \n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"get_window_info\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n let window: Window | undefined = undefined;\n if (response.data) {\n const windows = this.parseWindowsFromJSON(response.data);\n window = windows.length > 0 ? windows[0] : undefined;\n }\n\n return {\n requestId: response.requestId,\n success: true,\n window,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to get window info: ${error}`,\n };\n }\n }\n\n /**\n * Activates a window by bringing it to the foreground.\n * Corresponds to Python's activate_window() method\n *\n * @param windowId - The ID of the window to activate.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.activateWindow() instead.\n */\n async activateWindow(windowId: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.activateWindow() is deprecated. Use session.computer.activateWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"activate_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to activate window: ${error}`,\n };\n }\n }\n\n /**\n * Maximizes a window.\n * Corresponds to Python's maximize_window() method\n *\n * @param windowId - The ID of the window to maximize.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.maximizeWindow() instead.\n */\n async maximizeWindow(windowId: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.maximizeWindow() is deprecated. Use session.computer.maximizeWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"maximize_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to maximize window: ${error}`,\n };\n }\n }\n\n /**\n * Minimizes a window.\n * Corresponds to Python's minimize_window() method\n *\n * @param windowId - The ID of the window to minimize.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.minimizeWindow() instead.\n */\n async minimizeWindow(windowId: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.minimizeWindow() is deprecated. Use session.computer.minimizeWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"minimize_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to minimize window: ${error}`,\n };\n }\n }\n\n /**\n * Restores a window by ID.\n * Corresponds to Python's restore_window() method\n *\n * @param windowId The ID of the window to restore.\n * @returns BoolResult with requestId\n */\n async restoreWindow(windowId: number): Promise<BoolResult> {\n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"restore_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to restore window: ${error}`,\n };\n }\n }\n\n /**\n * Closes a window.\n * Corresponds to Python's close_window() method\n *\n * @param windowId - The ID of the window to close.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.closeWindow() instead.\n */\n async closeWindow(windowId: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.closeWindow() is deprecated. Use session.computer.closeWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"close_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to close window: ${error}`,\n };\n }\n }\n\n /**\n * Sets a window to fullscreen by ID.\n * Corresponds to Python's fullscreen_window() method\n *\n * @param windowId The ID of the window to set to fullscreen.\n * @returns BoolResult with requestId\n */\n async fullscreenWindow(windowId: number): Promise<BoolResult> {\n try {\n const args = {\n window_id: windowId,\n };\n\n const response = await this.session.callMcpTool(\n \"fullscreen_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to make window fullscreen: ${error}`,\n };\n }\n }\n\n /**\n * Resizes a window to the specified dimensions.\n * Corresponds to Python's resize_window() method\n *\n * @param windowId - The ID of the window to resize.\n * @param width - The new width of the window.\n * @param height - The new height of the window.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.resizeWindow() instead.\n */\n async resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.resizeWindow() is deprecated. Use session.computer.resizeWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n width,\n height,\n };\n\n const response = await this.session.callMcpTool(\n \"resize_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to resize window: ${error}`,\n };\n }\n }\n\n /**\n * Moves a window to the specified position.\n * Corresponds to Python's move_window() method\n *\n * @param windowId - The ID of the window to move.\n * @param x - The new x coordinate of the window.\n * @param y - The new y coordinate of the window.\n * @returns BoolResult with success status and requestId\n * \n * @deprecated Use session.computer.moveWindow() instead.\n */\n async moveWindow(windowId: number, x: number, y: number): Promise<BoolResult> {\n console.warn('⚠️ WindowManager.moveWindow() is deprecated. Use session.computer.moveWindow() instead.');\n \n try {\n const args = {\n window_id: windowId,\n x,\n y,\n };\n\n const response = await this.session.callMcpTool(\n \"move_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to move window: ${error}`,\n };\n }\n }\n\n /**\n * Enables or disables focus mode.\n * Corresponds to Python's focus_mode() method\n *\n * @param on Whether to enable focus mode.\n * @returns BoolResult with requestId\n */\n async focusMode(on: boolean): Promise<BoolResult> {\n try {\n const args = {\n on,\n };\n\n const response = await this.session.callMcpTool(\n \"focus_mode\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n return {\n requestId: response.requestId,\n success: true,\n data: true,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to toggle focus mode: ${error}`,\n };\n }\n }\n\n /**\n * Gets the currently active window.\n * Corresponds to Python's get_active_window() method\n *\n * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.\n * @returns WindowInfoResult with active window information and requestId\n * \n * @deprecated Use session.computer.getActiveWindow() instead.\n */\n async getActiveWindow(timeoutMs = 3000): Promise<WindowInfoResult> {\n console.warn('⚠️ WindowManager.getActiveWindow() is deprecated. Use session.computer.getActiveWindow() instead.');\n \n try {\n const args = {\n timeout_ms: timeoutMs,\n };\n\n const response = await this.session.callMcpTool(\n \"get_active_window\",\n args\n );\n\n if (!response.success) {\n return {\n requestId: response.requestId,\n success: false,\n errorMessage: response.errorMessage,\n };\n }\n\n let activeWindow: Window | undefined = undefined;\n if (response.data) {\n const windows = this.parseWindowsFromJSON(response.data);\n activeWindow = windows.length > 0 ? windows[0] : undefined;\n }\n\n return {\n requestId: response.requestId,\n success: true,\n window: activeWindow,\n };\n } catch (error) {\n return {\n requestId: \"\",\n success: false,\n errorMessage: `Failed to get active window: ${error}`,\n };\n }\n }\n}\n"]}