browser-use-sdk 0.3.0 → 0.5.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 (94) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/internal/detect-platform.js +1 -1
  9. package/internal/detect-platform.js.map +1 -1
  10. package/internal/detect-platform.mjs +1 -1
  11. package/internal/detect-platform.mjs.map +1 -1
  12. package/lib/bin/auth.d.mts +10 -0
  13. package/lib/bin/auth.d.mts.map +1 -0
  14. package/lib/bin/auth.d.ts +10 -0
  15. package/lib/bin/auth.d.ts.map +1 -0
  16. package/lib/bin/auth.js +52 -0
  17. package/lib/bin/auth.js.map +1 -0
  18. package/lib/bin/auth.mjs +47 -0
  19. package/lib/bin/auth.mjs.map +1 -0
  20. package/lib/bin/cli.d.mts +3 -0
  21. package/lib/bin/cli.d.mts.map +1 -0
  22. package/lib/bin/cli.d.ts +3 -0
  23. package/lib/bin/cli.d.ts.map +1 -0
  24. package/lib/bin/cli.js +12 -0
  25. package/lib/bin/cli.js.map +1 -0
  26. package/lib/bin/cli.mjs +10 -0
  27. package/lib/bin/cli.mjs.map +1 -0
  28. package/lib/bin/commands/listen.d.mts +3 -0
  29. package/lib/bin/commands/listen.d.mts.map +1 -0
  30. package/lib/bin/commands/listen.d.ts +3 -0
  31. package/lib/bin/commands/listen.d.ts.map +1 -0
  32. package/lib/bin/commands/listen.js +133 -0
  33. package/lib/bin/commands/listen.js.map +1 -0
  34. package/lib/bin/commands/listen.mjs +130 -0
  35. package/lib/bin/commands/listen.mjs.map +1 -0
  36. package/lib/stream.d.mts.map +1 -1
  37. package/lib/stream.d.ts.map +1 -1
  38. package/lib/stream.js +6 -3
  39. package/lib/stream.js.map +1 -1
  40. package/lib/stream.mjs +6 -3
  41. package/lib/stream.mjs.map +1 -1
  42. package/lib/webhooks.d.mts +73 -0
  43. package/lib/webhooks.d.mts.map +1 -0
  44. package/lib/webhooks.d.ts +73 -0
  45. package/lib/webhooks.d.ts.map +1 -0
  46. package/lib/webhooks.js +84 -0
  47. package/lib/webhooks.js.map +1 -0
  48. package/lib/webhooks.mjs +78 -0
  49. package/lib/webhooks.mjs.map +1 -0
  50. package/package.json +9 -2
  51. package/resources/index.d.mts +1 -1
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +1 -1
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js.map +1 -1
  56. package/resources/index.mjs.map +1 -1
  57. package/resources/sessions/index.d.mts +1 -1
  58. package/resources/sessions/index.d.mts.map +1 -1
  59. package/resources/sessions/index.d.ts +1 -1
  60. package/resources/sessions/index.d.ts.map +1 -1
  61. package/resources/sessions/index.js.map +1 -1
  62. package/resources/sessions/index.mjs.map +1 -1
  63. package/resources/sessions/sessions.d.mts +2 -8
  64. package/resources/sessions/sessions.d.mts.map +1 -1
  65. package/resources/sessions/sessions.d.ts +2 -8
  66. package/resources/sessions/sessions.d.ts.map +1 -1
  67. package/resources/sessions/sessions.js +2 -2
  68. package/resources/sessions/sessions.js.map +1 -1
  69. package/resources/sessions/sessions.mjs +2 -2
  70. package/resources/sessions/sessions.mjs.map +1 -1
  71. package/resources/tasks.d.mts +96 -65
  72. package/resources/tasks.d.mts.map +1 -1
  73. package/resources/tasks.d.ts +96 -65
  74. package/resources/tasks.d.ts.map +1 -1
  75. package/resources/tasks.js +5 -12
  76. package/resources/tasks.js.map +1 -1
  77. package/resources/tasks.mjs +5 -12
  78. package/resources/tasks.mjs.map +1 -1
  79. package/src/client.ts +2 -2
  80. package/src/internal/detect-platform.ts +1 -1
  81. package/src/lib/bin/auth.ts +63 -0
  82. package/src/lib/bin/cli.ts +11 -0
  83. package/src/lib/bin/commands/listen.ts +172 -0
  84. package/src/lib/stream.ts +6 -3
  85. package/src/lib/webhooks.ts +118 -0
  86. package/src/resources/index.ts +0 -1
  87. package/src/resources/sessions/index.ts +0 -1
  88. package/src/resources/sessions/sessions.ts +2 -16
  89. package/src/resources/tasks.ts +108 -73
  90. package/src/version.ts +1 -1
  91. package/version.d.mts +1 -1
  92. package/version.d.ts +1 -1
  93. package/version.js +1 -1
  94. package/version.mjs +1 -1
@@ -226,25 +226,18 @@ export class Tasks extends APIResource {
226
226
  }
227
227
 
228
228
  /**
229
- * Get a paginated list of all AI agent tasks for the authenticated user.
229
+ * Get a paginated list of all Browser Use Agent tasks for the authenticated user.
230
230
  *
231
- * AI agent tasks are the individual jobs that your agents perform within a
232
- * session. Each task represents a specific instruction or goal that the agent
231
+ * Browser Use Agent tasks are the individual jobs that your agents perform within
232
+ * a session. Each task represents a specific instruction or goal that the agent
233
233
  * works on, such as filling out a form, extracting data, or navigating to specific
234
234
  * pages.
235
235
  *
236
- * You can control what data is included for each task:
237
- *
238
- * - Task steps: Detailed actions the agent took
239
- * - User uploaded files: Files you provided for the task
240
- * - Output files: Files generated by the agent during the task
241
- *
242
236
  * Returns:
243
237
  *
244
- * - A paginated list of agent tasks
245
- * - Total count of tasks
238
+ * - A paginated list of Browser Use Agent tasks
239
+ * - Total count of Browser Use Agent tasks
246
240
  * - Page information for navigation
247
- * - Optional detailed data based on your parameters
248
241
  */
249
242
  list(
250
243
  query: TaskListParams | null | undefined = {},
@@ -390,18 +383,18 @@ export type LlmModel =
390
383
  * View model for representing a task with its execution details
391
384
  *
392
385
  * Attributes: id: Unique identifier for the task session_id: ID of the session
393
- * this task belongs to session_live_url: Optional live URL of the session llm: The
394
- * LLM model used for this task task: The task prompt/instruction given to the
395
- * agent status: Current status of the task execution started_at: Naive UTC
396
- * timestamp when the task was started finished_at: Naive UTC timestamp when the
397
- * task completed (None if still running) metadata: Optional additional metadata
398
- * associated with the task set by the user is_scheduled: Whether this task was
399
- * created as a scheduled task steps: Optional list of execution steps done_output:
400
- * Final output/result of the task user_uploaded_files: Optional list of files
401
- * uploaded by user for this task output_files: Optional list of files generated as
402
- * output by this task browser_use_version: Version of browser-use used for this
403
- * task (older tasks may not have this set) is_success: Whether the task was
404
- * successful (self-reported by the agent)
386
+ * this task belongs to llm: The LLM model used for this task task: The task
387
+ * prompt/instruction given to the agent status: Current status of the task
388
+ * execution started_at: Naive UTC timestamp when the task was started finished_at:
389
+ * Naive UTC timestamp when the task completed (None if still running) metadata:
390
+ * Optional additional metadata associated with the task set by the user
391
+ * is_scheduled: Whether this task was created as a scheduled task steps: Optional
392
+ * list of execution steps done_output: Final output/result of the task
393
+ * user_uploaded_files: Optional list of files uploaded by user for this task
394
+ * output_files: Optional list of files generated as output by this task
395
+ * browser_use_version: Version of browser-use used for this task (older tasks may
396
+ * not have this set) is_success: Whether the task was successful (self-reported by
397
+ * the agent)
405
398
  */
406
399
  export interface TaskItemView {
407
400
  id: string;
@@ -417,9 +410,10 @@ export interface TaskItemView {
417
410
  /**
418
411
  * Enumeration of possible task execution states
419
412
  *
420
- * Attributes: STARTED: Task has been started and is currently running PAUSED: Task
421
- * execution has been temporarily paused (can be resumed) STOPPED: Task execution
422
- * has been stopped (cannot be resumed) FINISHED: Task has completed successfully
413
+ * Attributes: STARTED: Task has been started and is currently running. PAUSED:
414
+ * Task execution has been temporarily paused (can be resumed) FINISHED: Task has
415
+ * finished and the agent has completed the task. STOPPED: Task execution has been
416
+ * manually stopped (cannot be resumed).
423
417
  */
424
418
  status: TaskStatus;
425
419
 
@@ -434,24 +428,17 @@ export interface TaskItemView {
434
428
  isSuccess?: boolean | null;
435
429
 
436
430
  metadata?: { [key: string]: unknown };
437
-
438
- outputFiles?: Array<FileView> | null;
439
-
440
- sessionLiveUrl?: string | null;
441
-
442
- steps?: Array<TaskStepView> | null;
443
-
444
- userUploadedFiles?: Array<FileView> | null;
445
431
  }
446
432
 
447
433
  /**
448
434
  * Enumeration of possible task execution states
449
435
  *
450
- * Attributes: STARTED: Task has been started and is currently running PAUSED: Task
451
- * execution has been temporarily paused (can be resumed) STOPPED: Task execution
452
- * has been stopped (cannot be resumed) FINISHED: Task has completed successfully
436
+ * Attributes: STARTED: Task has been started and is currently running. PAUSED:
437
+ * Task execution has been temporarily paused (can be resumed) FINISHED: Task has
438
+ * finished and the agent has completed the task. STOPPED: Task execution has been
439
+ * manually stopped (cannot be resumed).
453
440
  */
454
- export type TaskStatus = 'started' | 'paused' | 'stopped' | 'finished';
441
+ export type TaskStatus = 'started' | 'paused' | 'finished' | 'stopped';
455
442
 
456
443
  /**
457
444
  * View model for representing a single step in a task's execution
@@ -483,11 +470,11 @@ export interface TaskStepView {
483
470
  * View model for representing a task with its execution details
484
471
  *
485
472
  * Attributes: id: Unique identifier for the task session_id: ID of the session
486
- * this task belongs to session_live_url: Optional live URL of the session llm: The
487
- * LLM model used for this task task: The task prompt/instruction given to the
488
- * agent status: Current status of the task execution started_at: Naive UTC
489
- * timestamp when the task was started finished_at: Naive UTC timestamp when the
490
- * task completed (None if still running) metadata: Optional additional metadata
473
+ * this task belongs to session: The session this task belongs to llm: The LLM
474
+ * model used for this task task: The task prompt/instruction given to the agent
475
+ * status: Current status of the task execution started_at: Naive UTC timestamp
476
+ * when the task was started finished_at: Naive UTC timestamp when the task
477
+ * completed (None if still running) metadata: Optional additional metadata
491
478
  * associated with the task set by the user is_scheduled: Whether this task was
492
479
  * created as a scheduled task steps: List of execution steps done_output: Final
493
480
  * output/result of the task user_uploaded_files: List of files uploaded by user
@@ -505,6 +492,16 @@ export interface TaskView {
505
492
 
506
493
  outputFiles: Array<FileView>;
507
494
 
495
+ /**
496
+ * View model for representing a session that a task belongs to
497
+ *
498
+ * Attributes: id: Unique identifier for the session status: Current status of the
499
+ * session (active/stopped) live_url: URL where the browser can be viewed live in
500
+ * real-time. started_at: Timestamp when the session was created and started.
501
+ * finished_at: Timestamp when the session was stopped (None if still active).
502
+ */
503
+ session: TaskView.Session;
504
+
508
505
  sessionId: string;
509
506
 
510
507
  startedAt: string;
@@ -512,9 +509,10 @@ export interface TaskView {
512
509
  /**
513
510
  * Enumeration of possible task execution states
514
511
  *
515
- * Attributes: STARTED: Task has been started and is currently running PAUSED: Task
516
- * execution has been temporarily paused (can be resumed) STOPPED: Task execution
517
- * has been stopped (cannot be resumed) FINISHED: Task has completed successfully
512
+ * Attributes: STARTED: Task has been started and is currently running. PAUSED:
513
+ * Task execution has been temporarily paused (can be resumed) FINISHED: Task has
514
+ * finished and the agent has completed the task. STOPPED: Task execution has been
515
+ * manually stopped (cannot be resumed).
518
516
  */
519
517
  status: TaskStatus;
520
518
 
@@ -533,8 +531,34 @@ export interface TaskView {
533
531
  isSuccess?: boolean | null;
534
532
 
535
533
  metadata?: { [key: string]: unknown };
534
+ }
535
+
536
+ export namespace TaskView {
537
+ /**
538
+ * View model for representing a session that a task belongs to
539
+ *
540
+ * Attributes: id: Unique identifier for the session status: Current status of the
541
+ * session (active/stopped) live_url: URL where the browser can be viewed live in
542
+ * real-time. started_at: Timestamp when the session was created and started.
543
+ * finished_at: Timestamp when the session was stopped (None if still active).
544
+ */
545
+ export interface Session {
546
+ id: string;
547
+
548
+ startedAt: string;
536
549
 
537
- sessionLiveUrl?: string | null;
550
+ /**
551
+ * Enumeration of possible (browser) session states
552
+ *
553
+ * Attributes: ACTIVE: Session is currently active and running (browser is running)
554
+ * STOPPED: Session has been stopped and is no longer active (browser is stopped)
555
+ */
556
+ status: 'active' | 'stopped';
557
+
558
+ finishedAt?: string | null;
559
+
560
+ liveUrl?: string | null;
561
+ }
538
562
  }
539
563
 
540
564
  /**
@@ -576,29 +600,40 @@ export interface TaskGetLogsResponse {
576
600
  /**
577
601
  * Response model for output file requests
578
602
  *
579
- * Attributes: download_url: URL to download the output file
603
+ * Attributes: id: Unique identifier for the output file file_name: Name of the
604
+ * output file download_url: URL to download the output file
580
605
  */
581
606
  export interface TaskGetOutputFileResponse {
607
+ id: string;
608
+
582
609
  downloadUrl: string;
610
+
611
+ fileName: string;
583
612
  }
584
613
 
585
614
  /**
586
615
  * Response model for user uploaded file requests
587
616
  *
588
- * Attributes: download_url: URL to download the user uploaded file
617
+ * Attributes: id: Unique identifier for the user uploaded file file_name: Name of
618
+ * the user uploaded file download_url: URL to download the user uploaded file
589
619
  */
590
620
  export interface TaskGetUserUploadedFileResponse {
621
+ id: string;
622
+
591
623
  downloadUrl: string;
624
+
625
+ fileName: string;
592
626
  }
593
627
 
594
628
  export interface TaskCreateParams {
595
629
  task: string;
596
630
 
597
631
  /**
598
- * Configuration settings for the AI agent
632
+ * Configuration settings for the agent
599
633
  *
600
- * Attributes: llm: The LLM model to use for the agent profile_id: Unique
601
- * identifier of the agent profile to use for the task
634
+ * Attributes: llm: The LLM model to use for the agent start_url: Optional URL to
635
+ * start the agent on (will not be changed as a step) profile_id: Unique identifier
636
+ * of the agent profile to use for the task
602
637
  */
603
638
  agentSettings?: TaskCreateParams.AgentSettings;
604
639
 
@@ -606,8 +641,8 @@ export interface TaskCreateParams {
606
641
  * Configuration settings for the browser session
607
642
  *
608
643
  * Attributes: session_id: Unique identifier of existing session to continue
609
- * profile_id: Unique identifier of browser profile to use save_browser_data:
610
- * Whether to save browser state/data for the user to download later
644
+ * profile_id: Unique identifier of browser profile to use (use if you want to
645
+ * start a new session)
611
646
  */
612
647
  browserSettings?: TaskCreateParams.BrowserSettings;
613
648
 
@@ -622,29 +657,30 @@ export interface TaskCreateParams {
622
657
 
623
658
  export namespace TaskCreateParams {
624
659
  /**
625
- * Configuration settings for the AI agent
660
+ * Configuration settings for the agent
626
661
  *
627
- * Attributes: llm: The LLM model to use for the agent profile_id: Unique
628
- * identifier of the agent profile to use for the task
662
+ * Attributes: llm: The LLM model to use for the agent start_url: Optional URL to
663
+ * start the agent on (will not be changed as a step) profile_id: Unique identifier
664
+ * of the agent profile to use for the task
629
665
  */
630
666
  export interface AgentSettings {
631
667
  llm?: TasksAPI.LlmModel;
632
668
 
633
669
  profileId?: string | null;
670
+
671
+ startUrl?: string | null;
634
672
  }
635
673
 
636
674
  /**
637
675
  * Configuration settings for the browser session
638
676
  *
639
677
  * Attributes: session_id: Unique identifier of existing session to continue
640
- * profile_id: Unique identifier of browser profile to use save_browser_data:
641
- * Whether to save browser state/data for the user to download later
678
+ * profile_id: Unique identifier of browser profile to use (use if you want to
679
+ * start a new session)
642
680
  */
643
681
  export interface BrowserSettings {
644
682
  profileId?: string | null;
645
683
 
646
- saveBrowserData?: boolean;
647
-
648
684
  sessionId?: string | null;
649
685
  }
650
686
  }
@@ -661,20 +697,19 @@ export interface TaskUpdateParams {
661
697
  }
662
698
 
663
699
  export interface TaskListParams {
700
+ after?: string | null;
701
+
702
+ before?: string | null;
703
+
664
704
  /**
665
- * Enumeration of possible task filters
705
+ * Enumeration of possible task execution states
666
706
  *
667
- * Attributes: STARTED: All started tasks PAUSED: All paused tasks STOPPED: All
668
- * stopped tasks FINISHED: All finished tasks SUCCESSFUL: All successful tasks
669
- * UNSUCCESSFUL: All unsuccessful tasks
707
+ * Attributes: STARTED: Task has been started and is currently running. PAUSED:
708
+ * Task execution has been temporarily paused (can be resumed) FINISHED: Task has
709
+ * finished and the agent has completed the task. STOPPED: Task execution has been
710
+ * manually stopped (cannot be resumed).
670
711
  */
671
- filterBy?: 'started' | 'paused' | 'stopped' | 'finished' | 'successful' | 'unsuccessful' | null;
672
-
673
- includeOutputFiles?: boolean;
674
-
675
- includeSteps?: boolean;
676
-
677
- includeUserUploadedFiles?: boolean;
712
+ filterBy?: TaskStatus | null;
678
713
 
679
714
  pageNumber?: number;
680
715
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.3.0'; // x-release-please-version
1
+ export const VERSION = '0.5.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.3.0";
1
+ export declare const VERSION = "0.5.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.3.0";
1
+ export declare const VERSION = "0.5.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.3.0'; // x-release-please-version
4
+ exports.VERSION = '0.5.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.3.0'; // x-release-please-version
1
+ export const VERSION = '0.5.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map