@browserbasehq/sdk 1.2.1 → 1.3.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.
@@ -0,0 +1 @@
1
+ * @browserbase/eng
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ node-version: [18.x, 20.x, 22.x]
17
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Use Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v3
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+ cache: 'npm'
26
+ - run: npm ci
27
+ - run: npm run build
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <p align="center">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="logo/dark.png"/>
4
- <img alt="Browserbase logo" src="logo/light.png" style="max-width: 250px;"/>
3
+ <source media="(prefers-color-scheme: dark)" srcset="logo/dark.svg"/>
4
+ <img alt="Browserbase logo" src="logo/light.svg" width="300" />
5
5
  </picture>
6
6
  </p>
7
7
 
package/logo/dark.svg ADDED
@@ -0,0 +1,17 @@
1
+ <svg width="604" height="140" viewBox="0 0 604 140" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M177.04 57.272H195.976C200.44 57.272 203.872 57.608 206.272 58.28C208.72 58.904 210.448 59.936 211.456 61.376C212.464 62.768 212.968 64.736 212.968 67.28V73.04C212.968 74.336 212.44 75.56 211.384 76.712C210.376 77.864 209.176 78.656 207.784 79.088V79.448C209.608 79.64 211.264 80.432 212.752 81.824C214.288 83.168 215.056 84.68 215.056 86.36V93.56C215.056 97.352 213.544 100.04 210.52 101.624C207.496 103.208 202.816 104 196.48 104H177.04V57.272ZM195.976 76.28C197.752 76.28 199.072 76.136 199.936 75.848C200.8 75.56 201.376 75.104 201.664 74.48C202 73.808 202.168 72.848 202.168 71.6V69.296C202.168 68.192 202.024 67.376 201.736 66.848C201.448 66.272 200.848 65.864 199.936 65.624C199.072 65.384 197.68 65.264 195.76 65.264H188.272V76.28H195.976ZM196.264 96.008C199 96.008 200.944 95.696 202.096 95.072C203.248 94.448 203.824 93.44 203.824 92.048V88.304C203.824 86.576 203.368 85.352 202.456 84.632C201.592 83.912 200.032 83.552 197.776 83.552H188.272V96.008H196.264ZM220.871 69.152H230.879V75.272C230.879 74.168 231.335 73.088 232.247 72.032C233.159 70.976 234.311 70.112 235.703 69.44C237.143 68.768 238.559 68.432 239.951 68.432H243.695V77.144H240.095C237.119 77.144 234.911 77.6 233.471 78.512C232.079 79.424 231.383 80.936 231.383 83.048V104H220.871V69.152ZM264.752 104.72C262.592 104.72 260.816 104.648 259.424 104.504C258.032 104.36 256.544 104.072 254.96 103.64C253.232 103.16 251.84 102.488 250.784 101.624C249.728 100.712 248.84 99.44 248.12 97.808C247.4 96.224 247.04 94.304 247.04 92.048V81.752C247.04 79.448 247.4 77.432 248.12 75.704C248.84 73.976 249.776 72.632 250.928 71.672C251.936 70.856 253.256 70.184 254.888 69.656C256.568 69.08 258.2 68.72 259.784 68.576C261.608 68.48 263.264 68.432 264.752 68.432C266.96 68.432 268.712 68.504 270.008 68.648C271.352 68.744 272.816 69.032 274.4 69.512C276.128 70.04 277.52 70.76 278.576 71.672C279.68 72.584 280.616 73.88 281.384 75.56C282.104 77.288 282.464 79.352 282.464 81.752V92.048C282.464 94.208 282.104 96.104 281.384 97.736C280.712 99.368 279.824 100.64 278.72 101.552C277.76 102.368 276.44 103.04 274.76 103.568C273.128 104.048 271.52 104.36 269.936 104.504C268.496 104.648 266.768 104.72 264.752 104.72ZM264.752 98.168C266.72 98.168 268.208 98.024 269.216 97.736C270.224 97.4 270.92 96.896 271.304 96.224C271.736 95.552 271.952 94.568 271.952 93.272V80.096C271.952 78.176 271.448 76.832 270.44 76.064C269.432 75.296 267.536 74.912 264.752 74.912C261.968 74.912 260.072 75.296 259.064 76.064C258.056 76.832 257.552 78.176 257.552 80.096V93.272C257.552 94.568 257.744 95.552 258.128 96.224C258.56 96.896 259.28 97.4 260.288 97.736C261.296 98.024 262.784 98.168 264.752 98.168ZM285.186 69.152H295.914L302.394 94.424L309.306 69.152H319.602L326.802 94.424L332.994 69.152H343.218L331.842 104H321.186L314.274 80.456L307.506 104H296.85L285.186 69.152ZM360.013 104.72C356.269 104.72 351.685 104.36 346.261 103.64V96.656C352.933 97.664 357.565 98.168 360.157 98.168C362.365 98.168 363.997 97.952 365.053 97.52C366.109 97.088 366.637 96.296 366.637 95.144V92.984C366.637 91.784 366.301 90.944 365.629 90.464C364.957 89.936 363.637 89.672 361.669 89.672H357.133C353.437 89.672 350.581 88.952 348.565 87.512C346.549 86.024 345.541 83.864 345.541 81.032V76.784C345.541 73.76 346.981 71.624 349.861 70.376C352.741 69.08 357.085 68.432 362.893 68.432C365.197 68.432 369.325 68.648 375.277 69.08V75.776C367.789 75.2 363.565 74.912 362.605 74.912C359.773 74.912 357.925 75.104 357.061 75.488C356.293 75.92 355.909 76.712 355.909 77.864V79.736C355.909 80.36 356.221 80.912 356.845 81.392C357.469 81.824 358.381 82.04 359.581 82.04H364.189C372.733 82.04 377.005 84.824 377.005 90.392V94.784C377.005 96.464 376.693 97.928 376.069 99.176C375.445 100.424 374.629 101.408 373.621 102.128C372.661 102.8 371.413 103.328 369.877 103.712C368.389 104.096 366.829 104.36 365.197 104.504C363.709 104.648 361.981 104.72 360.013 104.72ZM400.865 104.72C388.529 104.72 382.361 100.952 382.361 93.416V80.888C382.361 76.52 383.753 73.352 386.537 71.384C389.369 69.416 393.713 68.432 399.569 68.432C405.089 68.432 409.121 69.392 411.665 71.312C414.257 73.184 415.553 76.376 415.553 80.888V89.384H392.945V92.552C392.945 94.568 393.665 96.008 395.105 96.872C396.545 97.736 399.137 98.168 402.881 98.168C406.337 98.168 410.225 97.664 414.545 96.656V103.352C410.273 104.264 405.713 104.72 400.865 104.72ZM405.545 83.408V78.368C405.545 77.216 405.065 76.352 404.105 75.776C403.193 75.2 401.633 74.912 399.425 74.912C396.881 74.912 395.177 75.2 394.313 75.776C393.401 76.4 392.945 77.264 392.945 78.368V83.408H405.545ZM422.148 69.152H432.156V75.272C432.156 74.168 432.612 73.088 433.524 72.032C434.436 70.976 435.588 70.112 436.98 69.44C438.42 68.768 439.836 68.432 441.228 68.432H444.972V77.144H441.372C438.396 77.144 436.188 77.6 434.748 78.512C433.356 79.424 432.66 80.936 432.66 83.048V104H422.148V69.152ZM466.965 104.72C462.549 104.72 459.045 104.264 456.453 103.352C453.909 102.44 452.085 101.048 450.981 99.176C449.877 97.256 449.325 94.736 449.325 91.616V53.6H459.837V72.608C460.461 71.024 461.613 69.944 463.293 69.368C464.973 68.744 467.589 68.432 471.141 68.432C474.165 68.432 476.589 68.672 478.413 69.152C480.285 69.632 481.701 70.4 482.661 71.456C483.573 72.512 484.197 73.688 484.533 74.984C484.869 76.232 485.037 77.96 485.037 80.168V91.616C485.037 96.32 483.621 99.68 480.789 101.696C477.957 103.712 473.349 104.72 466.965 104.72ZM467.109 98.168C469.173 98.168 470.733 98.024 471.789 97.736C472.845 97.448 473.565 96.944 473.949 96.224C474.333 95.504 474.525 94.424 474.525 92.984V80.096C474.525 78.512 474.357 77.384 474.021 76.712C473.685 75.992 473.013 75.512 472.005 75.272C470.997 75.032 469.341 74.912 467.037 74.912C465.069 74.912 463.557 75.08 462.501 75.416C461.493 75.752 460.797 76.28 460.413 77C460.029 77.72 459.837 78.752 459.837 80.096V92.984C459.837 94.424 460.005 95.504 460.341 96.224C460.725 96.944 461.421 97.448 462.429 97.736C463.485 98.024 465.045 98.168 467.109 98.168ZM501.694 104.72C498.43 104.72 495.982 104.432 494.35 103.856C492.766 103.232 491.638 102.152 490.966 100.616C490.342 99.032 490.03 96.68 490.03 93.56C490.03 90.776 490.366 88.592 491.038 87.008C491.758 85.424 492.886 84.296 494.422 83.624C496.006 82.904 498.166 82.544 500.902 82.544H512.71V80.168C512.71 78.68 512.494 77.576 512.062 76.856C511.678 76.136 510.934 75.632 509.83 75.344C508.774 75.056 507.166 74.912 505.006 74.912C502.03 74.912 497.95 75.2 492.766 75.776V69.152C496.558 68.672 500.998 68.432 506.086 68.432C510.55 68.432 513.982 68.768 516.382 69.44C518.83 70.112 520.582 71.264 521.638 72.896C522.694 74.528 523.222 76.904 523.222 80.024V104H512.926V100.832C512.11 102.224 511.006 103.208 509.614 103.784C508.222 104.408 505.582 104.72 501.694 104.72ZM505.798 98.168C507.91 98.168 509.422 98.096 510.334 97.952C511.006 97.856 511.462 97.712 511.702 97.52C511.99 97.328 512.23 97.016 512.422 96.584C512.614 96.248 512.71 95.744 512.71 95.072V88.304H505.51C503.878 88.304 502.726 88.424 502.054 88.664C501.382 88.856 500.926 89.288 500.686 89.96C500.446 90.584 500.326 91.712 500.326 93.344C500.326 94.928 500.446 96.032 500.686 96.656C500.926 97.28 501.382 97.688 502.054 97.88C502.774 98.072 504.022 98.168 505.798 98.168ZM544.063 104.72C540.319 104.72 535.735 104.36 530.311 103.64V96.656C536.983 97.664 541.615 98.168 544.207 98.168C546.415 98.168 548.047 97.952 549.103 97.52C550.159 97.088 550.687 96.296 550.687 95.144V92.984C550.687 91.784 550.351 90.944 549.679 90.464C549.007 89.936 547.687 89.672 545.719 89.672H541.183C537.487 89.672 534.631 88.952 532.615 87.512C530.599 86.024 529.591 83.864 529.591 81.032V76.784C529.591 73.76 531.031 71.624 533.911 70.376C536.791 69.08 541.135 68.432 546.943 68.432C549.247 68.432 553.375 68.648 559.327 69.08V75.776C551.839 75.2 547.615 74.912 546.655 74.912C543.823 74.912 541.975 75.104 541.111 75.488C540.343 75.92 539.959 76.712 539.959 77.864V79.736C539.959 80.36 540.271 80.912 540.895 81.392C541.519 81.824 542.431 82.04 543.631 82.04H548.239C556.783 82.04 561.055 84.824 561.055 90.392V94.784C561.055 96.464 560.743 97.928 560.119 99.176C559.495 100.424 558.679 101.408 557.671 102.128C556.711 102.8 555.463 103.328 553.927 103.712C552.439 104.096 550.879 104.36 549.247 104.504C547.759 104.648 546.031 104.72 544.063 104.72ZM584.915 104.72C572.579 104.72 566.411 100.952 566.411 93.416V80.888C566.411 76.52 567.803 73.352 570.587 71.384C573.419 69.416 577.763 68.432 583.619 68.432C589.139 68.432 593.171 69.392 595.715 71.312C598.307 73.184 599.603 76.376 599.603 80.888V89.384H576.995V92.552C576.995 94.568 577.715 96.008 579.155 96.872C580.595 97.736 583.187 98.168 586.931 98.168C590.387 98.168 594.275 97.664 598.595 96.656V103.352C594.323 104.264 589.763 104.72 584.915 104.72ZM589.595 83.408V78.368C589.595 77.216 589.115 76.352 588.155 75.776C587.243 75.2 585.683 74.912 583.475 74.912C580.931 74.912 579.227 75.2 578.363 75.776C577.451 76.4 576.995 77.264 576.995 78.368V83.408H589.595Z" fill="white"/>
3
+ <rect width="128" height="128" fill="#F21923"/>
4
+ <rect width="128" height="128" fill="black" fill-opacity="0.4"/>
5
+ <rect x="16" y="12" width="128" height="128" fill="url(#paint0_linear_277_801)"/>
6
+ <path d="M59 49H79.9205C84.8523 49 88.6439 49.3883 91.2955 50.1649C94 50.886 95.9091 52.0786 97.0227 53.7427C98.1364 55.3513 98.6932 57.6256 98.6932 60.5655V67.2219C98.6932 68.7196 98.1098 70.1341 96.9432 71.4653C95.8295 72.7966 94.5038 73.7119 92.9659 74.2111V74.6271C94.9811 74.849 96.8106 75.7643 98.4545 77.3729C100.152 78.926 101 80.6733 101 82.6148V90.9353C101 95.3174 99.3295 98.4237 95.9886 100.254C92.6477 102.085 87.4773 103 80.4773 103H59V49ZM79.9205 70.9661C81.8826 70.9661 83.3409 70.7997 84.2955 70.4669C85.25 70.1341 85.8864 69.6071 86.2045 68.886C86.5758 68.1094 86.7614 67 86.7614 65.5578V62.8952C86.7614 61.6194 86.6023 60.6764 86.2841 60.0663C85.9659 59.4006 85.303 58.9291 84.2955 58.6518C83.3409 58.3744 81.803 58.2357 79.6818 58.2357H71.4091V70.9661H79.9205ZM80.2386 93.7643C83.2614 93.7643 85.4091 93.4037 86.6818 92.6826C87.9545 91.9615 88.5909 90.7966 88.5909 89.188V84.8613C88.5909 82.8644 88.0871 81.4499 87.0795 80.6179C86.125 79.7858 84.4015 79.3698 81.9091 79.3698H71.4091V93.7643H80.2386Z" fill="white"/>
7
+ <path d="M0 0H128L144 12H16L0 0Z" fill="#F21923"/>
8
+ <path d="M0 0H128L144 12H16L0 0Z" fill="white" fill-opacity="0.4"/>
9
+ <path d="M0 128H16V140L0 128Z" fill="#F21923"/>
10
+ <path d="M0 128H16V140L0 128Z" fill="black" fill-opacity="0.4"/>
11
+ <defs>
12
+ <linearGradient id="paint0_linear_277_801" x1="80" y1="12" x2="80" y2="140" gradientUnits="userSpaceOnUse">
13
+ <stop stop-color="#F21923"/>
14
+ <stop offset="1" stop-color="#F21923"/>
15
+ </linearGradient>
16
+ </defs>
17
+ </svg>
package/logo/light.svg ADDED
@@ -0,0 +1,17 @@
1
+ <svg width="604" height="140" viewBox="0 0 604 140" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M177.04 57.272H195.976C200.44 57.272 203.872 57.608 206.272 58.28C208.72 58.904 210.448 59.936 211.456 61.376C212.464 62.768 212.968 64.736 212.968 67.28V73.04C212.968 74.336 212.44 75.56 211.384 76.712C210.376 77.864 209.176 78.656 207.784 79.088V79.448C209.608 79.64 211.264 80.432 212.752 81.824C214.288 83.168 215.056 84.68 215.056 86.36V93.56C215.056 97.352 213.544 100.04 210.52 101.624C207.496 103.208 202.816 104 196.48 104H177.04V57.272ZM195.976 76.28C197.752 76.28 199.072 76.136 199.936 75.848C200.8 75.56 201.376 75.104 201.664 74.48C202 73.808 202.168 72.848 202.168 71.6V69.296C202.168 68.192 202.024 67.376 201.736 66.848C201.448 66.272 200.848 65.864 199.936 65.624C199.072 65.384 197.68 65.264 195.76 65.264H188.272V76.28H195.976ZM196.264 96.008C199 96.008 200.944 95.696 202.096 95.072C203.248 94.448 203.824 93.44 203.824 92.048V88.304C203.824 86.576 203.368 85.352 202.456 84.632C201.592 83.912 200.032 83.552 197.776 83.552H188.272V96.008H196.264ZM220.871 69.152H230.879V75.272C230.879 74.168 231.335 73.088 232.247 72.032C233.159 70.976 234.311 70.112 235.703 69.44C237.143 68.768 238.559 68.432 239.951 68.432H243.695V77.144H240.095C237.119 77.144 234.911 77.6 233.471 78.512C232.079 79.424 231.383 80.936 231.383 83.048V104H220.871V69.152ZM264.752 104.72C262.592 104.72 260.816 104.648 259.424 104.504C258.032 104.36 256.544 104.072 254.96 103.64C253.232 103.16 251.84 102.488 250.784 101.624C249.728 100.712 248.84 99.44 248.12 97.808C247.4 96.224 247.04 94.304 247.04 92.048V81.752C247.04 79.448 247.4 77.432 248.12 75.704C248.84 73.976 249.776 72.632 250.928 71.672C251.936 70.856 253.256 70.184 254.888 69.656C256.568 69.08 258.2 68.72 259.784 68.576C261.608 68.48 263.264 68.432 264.752 68.432C266.96 68.432 268.712 68.504 270.008 68.648C271.352 68.744 272.816 69.032 274.4 69.512C276.128 70.04 277.52 70.76 278.576 71.672C279.68 72.584 280.616 73.88 281.384 75.56C282.104 77.288 282.464 79.352 282.464 81.752V92.048C282.464 94.208 282.104 96.104 281.384 97.736C280.712 99.368 279.824 100.64 278.72 101.552C277.76 102.368 276.44 103.04 274.76 103.568C273.128 104.048 271.52 104.36 269.936 104.504C268.496 104.648 266.768 104.72 264.752 104.72ZM264.752 98.168C266.72 98.168 268.208 98.024 269.216 97.736C270.224 97.4 270.92 96.896 271.304 96.224C271.736 95.552 271.952 94.568 271.952 93.272V80.096C271.952 78.176 271.448 76.832 270.44 76.064C269.432 75.296 267.536 74.912 264.752 74.912C261.968 74.912 260.072 75.296 259.064 76.064C258.056 76.832 257.552 78.176 257.552 80.096V93.272C257.552 94.568 257.744 95.552 258.128 96.224C258.56 96.896 259.28 97.4 260.288 97.736C261.296 98.024 262.784 98.168 264.752 98.168ZM285.186 69.152H295.914L302.394 94.424L309.306 69.152H319.602L326.802 94.424L332.994 69.152H343.218L331.842 104H321.186L314.274 80.456L307.506 104H296.85L285.186 69.152ZM360.013 104.72C356.269 104.72 351.685 104.36 346.261 103.64V96.656C352.933 97.664 357.565 98.168 360.157 98.168C362.365 98.168 363.997 97.952 365.053 97.52C366.109 97.088 366.637 96.296 366.637 95.144V92.984C366.637 91.784 366.301 90.944 365.629 90.464C364.957 89.936 363.637 89.672 361.669 89.672H357.133C353.437 89.672 350.581 88.952 348.565 87.512C346.549 86.024 345.541 83.864 345.541 81.032V76.784C345.541 73.76 346.981 71.624 349.861 70.376C352.741 69.08 357.085 68.432 362.893 68.432C365.197 68.432 369.325 68.648 375.277 69.08V75.776C367.789 75.2 363.565 74.912 362.605 74.912C359.773 74.912 357.925 75.104 357.061 75.488C356.293 75.92 355.909 76.712 355.909 77.864V79.736C355.909 80.36 356.221 80.912 356.845 81.392C357.469 81.824 358.381 82.04 359.581 82.04H364.189C372.733 82.04 377.005 84.824 377.005 90.392V94.784C377.005 96.464 376.693 97.928 376.069 99.176C375.445 100.424 374.629 101.408 373.621 102.128C372.661 102.8 371.413 103.328 369.877 103.712C368.389 104.096 366.829 104.36 365.197 104.504C363.709 104.648 361.981 104.72 360.013 104.72ZM400.865 104.72C388.529 104.72 382.361 100.952 382.361 93.416V80.888C382.361 76.52 383.753 73.352 386.537 71.384C389.369 69.416 393.713 68.432 399.569 68.432C405.089 68.432 409.121 69.392 411.665 71.312C414.257 73.184 415.553 76.376 415.553 80.888V89.384H392.945V92.552C392.945 94.568 393.665 96.008 395.105 96.872C396.545 97.736 399.137 98.168 402.881 98.168C406.337 98.168 410.225 97.664 414.545 96.656V103.352C410.273 104.264 405.713 104.72 400.865 104.72ZM405.545 83.408V78.368C405.545 77.216 405.065 76.352 404.105 75.776C403.193 75.2 401.633 74.912 399.425 74.912C396.881 74.912 395.177 75.2 394.313 75.776C393.401 76.4 392.945 77.264 392.945 78.368V83.408H405.545ZM422.148 69.152H432.156V75.272C432.156 74.168 432.612 73.088 433.524 72.032C434.436 70.976 435.588 70.112 436.98 69.44C438.42 68.768 439.836 68.432 441.228 68.432H444.972V77.144H441.372C438.396 77.144 436.188 77.6 434.748 78.512C433.356 79.424 432.66 80.936 432.66 83.048V104H422.148V69.152ZM466.965 104.72C462.549 104.72 459.045 104.264 456.453 103.352C453.909 102.44 452.085 101.048 450.981 99.176C449.877 97.256 449.325 94.736 449.325 91.616V53.6H459.837V72.608C460.461 71.024 461.613 69.944 463.293 69.368C464.973 68.744 467.589 68.432 471.141 68.432C474.165 68.432 476.589 68.672 478.413 69.152C480.285 69.632 481.701 70.4 482.661 71.456C483.573 72.512 484.197 73.688 484.533 74.984C484.869 76.232 485.037 77.96 485.037 80.168V91.616C485.037 96.32 483.621 99.68 480.789 101.696C477.957 103.712 473.349 104.72 466.965 104.72ZM467.109 98.168C469.173 98.168 470.733 98.024 471.789 97.736C472.845 97.448 473.565 96.944 473.949 96.224C474.333 95.504 474.525 94.424 474.525 92.984V80.096C474.525 78.512 474.357 77.384 474.021 76.712C473.685 75.992 473.013 75.512 472.005 75.272C470.997 75.032 469.341 74.912 467.037 74.912C465.069 74.912 463.557 75.08 462.501 75.416C461.493 75.752 460.797 76.28 460.413 77C460.029 77.72 459.837 78.752 459.837 80.096V92.984C459.837 94.424 460.005 95.504 460.341 96.224C460.725 96.944 461.421 97.448 462.429 97.736C463.485 98.024 465.045 98.168 467.109 98.168ZM501.694 104.72C498.43 104.72 495.982 104.432 494.35 103.856C492.766 103.232 491.638 102.152 490.966 100.616C490.342 99.032 490.03 96.68 490.03 93.56C490.03 90.776 490.366 88.592 491.038 87.008C491.758 85.424 492.886 84.296 494.422 83.624C496.006 82.904 498.166 82.544 500.902 82.544H512.71V80.168C512.71 78.68 512.494 77.576 512.062 76.856C511.678 76.136 510.934 75.632 509.83 75.344C508.774 75.056 507.166 74.912 505.006 74.912C502.03 74.912 497.95 75.2 492.766 75.776V69.152C496.558 68.672 500.998 68.432 506.086 68.432C510.55 68.432 513.982 68.768 516.382 69.44C518.83 70.112 520.582 71.264 521.638 72.896C522.694 74.528 523.222 76.904 523.222 80.024V104H512.926V100.832C512.11 102.224 511.006 103.208 509.614 103.784C508.222 104.408 505.582 104.72 501.694 104.72ZM505.798 98.168C507.91 98.168 509.422 98.096 510.334 97.952C511.006 97.856 511.462 97.712 511.702 97.52C511.99 97.328 512.23 97.016 512.422 96.584C512.614 96.248 512.71 95.744 512.71 95.072V88.304H505.51C503.878 88.304 502.726 88.424 502.054 88.664C501.382 88.856 500.926 89.288 500.686 89.96C500.446 90.584 500.326 91.712 500.326 93.344C500.326 94.928 500.446 96.032 500.686 96.656C500.926 97.28 501.382 97.688 502.054 97.88C502.774 98.072 504.022 98.168 505.798 98.168ZM544.063 104.72C540.319 104.72 535.735 104.36 530.311 103.64V96.656C536.983 97.664 541.615 98.168 544.207 98.168C546.415 98.168 548.047 97.952 549.103 97.52C550.159 97.088 550.687 96.296 550.687 95.144V92.984C550.687 91.784 550.351 90.944 549.679 90.464C549.007 89.936 547.687 89.672 545.719 89.672H541.183C537.487 89.672 534.631 88.952 532.615 87.512C530.599 86.024 529.591 83.864 529.591 81.032V76.784C529.591 73.76 531.031 71.624 533.911 70.376C536.791 69.08 541.135 68.432 546.943 68.432C549.247 68.432 553.375 68.648 559.327 69.08V75.776C551.839 75.2 547.615 74.912 546.655 74.912C543.823 74.912 541.975 75.104 541.111 75.488C540.343 75.92 539.959 76.712 539.959 77.864V79.736C539.959 80.36 540.271 80.912 540.895 81.392C541.519 81.824 542.431 82.04 543.631 82.04H548.239C556.783 82.04 561.055 84.824 561.055 90.392V94.784C561.055 96.464 560.743 97.928 560.119 99.176C559.495 100.424 558.679 101.408 557.671 102.128C556.711 102.8 555.463 103.328 553.927 103.712C552.439 104.096 550.879 104.36 549.247 104.504C547.759 104.648 546.031 104.72 544.063 104.72ZM584.915 104.72C572.579 104.72 566.411 100.952 566.411 93.416V80.888C566.411 76.52 567.803 73.352 570.587 71.384C573.419 69.416 577.763 68.432 583.619 68.432C589.139 68.432 593.171 69.392 595.715 71.312C598.307 73.184 599.603 76.376 599.603 80.888V89.384H576.995V92.552C576.995 94.568 577.715 96.008 579.155 96.872C580.595 97.736 583.187 98.168 586.931 98.168C590.387 98.168 594.275 97.664 598.595 96.656V103.352C594.323 104.264 589.763 104.72 584.915 104.72ZM589.595 83.408V78.368C589.595 77.216 589.115 76.352 588.155 75.776C587.243 75.2 585.683 74.912 583.475 74.912C580.931 74.912 579.227 75.2 578.363 75.776C577.451 76.4 576.995 77.264 576.995 78.368V83.408H589.595Z" fill="#1E1C1C"/>
3
+ <rect width="128" height="128" fill="#F21923"/>
4
+ <rect width="128" height="128" fill="black" fill-opacity="0.4"/>
5
+ <rect x="16" y="12" width="128" height="128" fill="url(#paint0_linear_277_800)"/>
6
+ <path d="M59 49H79.9205C84.8523 49 88.6439 49.3883 91.2955 50.1649C94 50.886 95.9091 52.0786 97.0227 53.7427C98.1364 55.3513 98.6932 57.6256 98.6932 60.5655V67.2219C98.6932 68.7196 98.1098 70.1341 96.9432 71.4653C95.8295 72.7966 94.5038 73.7119 92.9659 74.2111V74.6271C94.9811 74.849 96.8106 75.7643 98.4545 77.3729C100.152 78.926 101 80.6733 101 82.6148V90.9353C101 95.3174 99.3295 98.4237 95.9886 100.254C92.6477 102.085 87.4773 103 80.4773 103H59V49ZM79.9205 70.9661C81.8826 70.9661 83.3409 70.7997 84.2955 70.4669C85.25 70.1341 85.8864 69.6071 86.2045 68.886C86.5758 68.1094 86.7614 67 86.7614 65.5578V62.8952C86.7614 61.6194 86.6023 60.6764 86.2841 60.0663C85.9659 59.4006 85.303 58.9291 84.2955 58.6518C83.3409 58.3744 81.803 58.2357 79.6818 58.2357H71.4091V70.9661H79.9205ZM80.2386 93.7643C83.2614 93.7643 85.4091 93.4037 86.6818 92.6826C87.9545 91.9615 88.5909 90.7966 88.5909 89.188V84.8613C88.5909 82.8644 88.0871 81.4499 87.0795 80.6179C86.125 79.7858 84.4015 79.3698 81.9091 79.3698H71.4091V93.7643H80.2386Z" fill="white"/>
7
+ <path d="M0 0H128L144 12H16L0 0Z" fill="#F21923"/>
8
+ <path d="M0 0H128L144 12H16L0 0Z" fill="white" fill-opacity="0.4"/>
9
+ <path d="M0 128H16V140L0 128Z" fill="#F21923"/>
10
+ <path d="M0 128H16V140L0 128Z" fill="black" fill-opacity="0.4"/>
11
+ <defs>
12
+ <linearGradient id="paint0_linear_277_800" x1="80" y1="12" x2="80" y2="140" gradientUnits="userSpaceOnUse">
13
+ <stop stop-color="#F21923"/>
14
+ <stop offset="1" stop-color="#F21923"/>
15
+ </linearGradient>
16
+ </defs>
17
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Browserbase JS SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -46,6 +46,9 @@ export type CreateSessionOptions = {
46
46
  height?: number
47
47
  }
48
48
  }
49
+ keepAlive?: boolean
50
+ // duration in seconds. Minimum 60 (1 minute), maximum 21600 (6 hours)
51
+ timeout?: number
49
52
  }
50
53
 
51
54
  export type Session = {
@@ -53,18 +56,11 @@ export type Session = {
53
56
  createdAt: string
54
57
  startedAt: string
55
58
  endedAt?: string
59
+ expiresAt: string
56
60
  projectId: string
57
- status?:
58
- | 'NEW'
59
- | 'CREATED'
60
- | 'ERROR'
61
- | 'RUNNING'
62
- | 'REQUEST_RELEASE'
63
- | 'RELEASING'
64
- | 'COMPLETED'
61
+ status: 'RUNNING' | 'COMPLETED' | 'ERROR' | 'TIMED_OUT'
65
62
  taskId?: string
66
63
  proxyBytes?: number
67
- expiresAt?: string
68
64
  avg_cpu_usage?: number
69
65
  memory_usage?: number
70
66
  details?: string
@@ -153,6 +149,34 @@ export default class Browserbase {
153
149
  return await response.json()
154
150
  }
155
151
 
152
+ async completeSession(sessionId: string): Promise<Session> {
153
+ if (!sessionId || sessionId === '') {
154
+ throw new Error('sessionId is required')
155
+ }
156
+ if (!this.projectId) {
157
+ throw new Error(
158
+ 'a projectId is missing: use the options.projectId or BROWSERBASE_PROJECT_ID environment variable to set one.'
159
+ )
160
+ }
161
+
162
+ const response = await fetch(
163
+ `${this.baseAPIURL}/v1/sessions/${sessionId}`,
164
+ {
165
+ method: 'POST',
166
+ headers: {
167
+ 'x-bb-api-key': this.apiKey,
168
+ 'Content-Type': 'application/json',
169
+ },
170
+ body: JSON.stringify({
171
+ projectId: this.projectId,
172
+ status: 'REQUEST_RELEASE',
173
+ }),
174
+ }
175
+ )
176
+
177
+ return await response.json()
178
+ }
179
+
156
180
  async getSession(sessionId: string): Promise<Session> {
157
181
  const response = await fetch(
158
182
  `${this.baseAPIURL}/v1/sessions/${sessionId}`,
package/dist/index.d.ts DELETED
@@ -1,104 +0,0 @@
1
- /// <reference types="node" />
2
- import BrowserbaseAISDK from './integrations/ai-sdk.js';
3
- export type ClientOptions = {
4
- apiKey?: string;
5
- projectId?: string;
6
- baseURL?: string;
7
- baseConnectURL?: string;
8
- };
9
- export type ConnectOptions = {
10
- sessionId?: string;
11
- proxy?: boolean;
12
- };
13
- export type LoadOptions = {
14
- textContent?: boolean;
15
- } & ConnectOptions;
16
- export type ScreenshotOptions = {
17
- fullPage?: boolean;
18
- } & ConnectOptions;
19
- export type CreateSessionOptions = {
20
- projectId?: string;
21
- extensionId?: string;
22
- browserSettings?: {
23
- fingerprint?: {
24
- browserListQuery?: string;
25
- httpVersion?: 1 | 2;
26
- browsers?: Array<'chrome' | 'firefox' | 'edge' | 'safari'>;
27
- devices?: Array<'desktop' | 'mobile'>;
28
- locales?: string[];
29
- operatingSystems?: Array<'windows' | 'macos' | 'linux' | 'ios' | 'android'>;
30
- screen?: {
31
- maxHeight?: number;
32
- maxWidth?: number;
33
- minHeight?: number;
34
- minWidth?: number;
35
- };
36
- };
37
- viewport?: {
38
- width?: number;
39
- height?: number;
40
- };
41
- };
42
- };
43
- export type Session = {
44
- id: string;
45
- createdAt: string;
46
- startedAt: string;
47
- endedAt?: string;
48
- projectId: string;
49
- status?: 'NEW' | 'CREATED' | 'ERROR' | 'RUNNING' | 'REQUEST_RELEASE' | 'RELEASING' | 'COMPLETED';
50
- taskId?: string;
51
- proxyBytes?: number;
52
- expiresAt?: string;
53
- avg_cpu_usage?: number;
54
- memory_usage?: number;
55
- details?: string;
56
- logs?: string;
57
- };
58
- export type SessionRecording = {
59
- type?: number;
60
- time?: string;
61
- data?: any;
62
- };
63
- export type DebugConnectionURLs = {
64
- debuggerFullscreenUrl?: string;
65
- debuggerUrl?: string;
66
- wsUrl?: string;
67
- };
68
- export type SessionLog = {
69
- sessionId?: string;
70
- id: string;
71
- timestamp?: string;
72
- method?: string;
73
- request?: {
74
- timestamp?: string;
75
- params?: any;
76
- rawBody?: string;
77
- };
78
- response?: {
79
- timestamp?: string;
80
- result?: any;
81
- rawBody?: string;
82
- };
83
- pageId?: string;
84
- };
85
- export default class Browserbase {
86
- private apiKey;
87
- private projectId;
88
- private baseAPIURL;
89
- private baseConnectURL;
90
- constructor(options?: ClientOptions);
91
- getConnectURL({ sessionId, proxy }?: ConnectOptions): string;
92
- listSessions(): Promise<Session[]>;
93
- createSession(options?: CreateSessionOptions): Promise<Session>;
94
- getSession(sessionId: string): Promise<Session>;
95
- getSessionRecording(sessionId: string): Promise<SessionRecording[]>;
96
- getSessionDownloads(sessionId: string, retryInterval?: number, retryCount?: number): Promise<Buffer>;
97
- getDebugConnectionURLs(sessionId: string): Promise<DebugConnectionURLs>;
98
- getSessionLogs(sessionId: string): Promise<SessionLog[]>;
99
- load(url: string | string[], options?: LoadOptions): Promise<string> | AsyncGenerator<string, any, unknown>;
100
- loadURL(url: string, options?: LoadOptions): Promise<string>;
101
- loadURLs(urls: string[], options?: LoadOptions): AsyncGenerator<string>;
102
- screenshot(url: string, options?: ScreenshotOptions): Promise<Buffer>;
103
- }
104
- export { Browserbase, BrowserbaseAISDK };
package/dist/index.js DELETED
@@ -1,191 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BrowserbaseAISDK = exports.Browserbase = void 0;
7
- const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
8
- const ai_sdk_js_1 = __importDefault(require("./integrations/ai-sdk.js"));
9
- exports.BrowserbaseAISDK = ai_sdk_js_1.default;
10
- class Browserbase {
11
- apiKey;
12
- projectId;
13
- baseAPIURL;
14
- baseConnectURL;
15
- constructor(options = {}) {
16
- this.apiKey = options.apiKey || process.env.BROWSERBASE_API_KEY;
17
- this.projectId = options.projectId || process.env.BROWSERBASE_PROJECT_ID;
18
- this.baseAPIURL = options.baseURL || 'https://www.browserbase.com';
19
- this.baseConnectURL =
20
- options.baseConnectURL || 'wss://connect.browserbase.com';
21
- }
22
- getConnectURL({ sessionId, proxy = false } = {}) {
23
- return `${this.baseConnectURL}?apiKey=${this.apiKey}${sessionId ? `&sessionId=${sessionId}` : ''}${proxy ? `&enableProxy=true` : ''}`;
24
- }
25
- async listSessions() {
26
- const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
27
- headers: {
28
- 'x-bb-api-key': this.apiKey,
29
- 'Content-Type': 'application/json',
30
- },
31
- });
32
- return await response.json();
33
- }
34
- async createSession(options) {
35
- const mergedOptions = { projectId: this.projectId, ...options };
36
- if (!mergedOptions.projectId) {
37
- throw new Error('a projectId is missing: use the options.projectId or BROWSERBASE_PROJECT_ID environment variable to set one.');
38
- }
39
- const response = await fetch(`${this.baseAPIURL}/v1/sessions`, {
40
- method: 'POST',
41
- headers: {
42
- 'x-bb-api-key': this.apiKey,
43
- 'Content-Type': 'application/json',
44
- },
45
- body: JSON.stringify(mergedOptions),
46
- });
47
- return await response.json();
48
- }
49
- async getSession(sessionId) {
50
- const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}`, {
51
- headers: {
52
- 'x-bb-api-key': this.apiKey,
53
- 'Content-Type': 'application/json',
54
- },
55
- });
56
- return await response.json();
57
- }
58
- async getSessionRecording(sessionId) {
59
- const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/recording`, {
60
- headers: {
61
- 'x-bb-api-key': this.apiKey,
62
- 'Content-Type': 'application/json',
63
- },
64
- });
65
- return await response.json();
66
- }
67
- async getSessionDownloads(sessionId, retryInterval = 2000, retryCount = 2) {
68
- return new Promise((resolve, reject) => {
69
- const fetchDownload = async () => {
70
- const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/downloads`, {
71
- method: 'GET',
72
- headers: {
73
- 'x-bb-api-key': this.apiKey,
74
- },
75
- });
76
- const arrayBuffer = await response.arrayBuffer();
77
- if (arrayBuffer.byteLength > 0) {
78
- resolve(Buffer.from(arrayBuffer));
79
- }
80
- else {
81
- retryCount--;
82
- if (retryCount <= 0) {
83
- reject();
84
- }
85
- setTimeout(fetchDownload, retryInterval);
86
- }
87
- };
88
- fetchDownload();
89
- });
90
- }
91
- async getDebugConnectionURLs(sessionId) {
92
- const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/debug`, {
93
- method: 'GET',
94
- headers: {
95
- 'x-bb-api-key': this.apiKey,
96
- 'Content-Type': 'application/json',
97
- },
98
- });
99
- const json = await response.json();
100
- return json;
101
- }
102
- async getSessionLogs(sessionId) {
103
- const response = await fetch(`${this.baseAPIURL}/v1/sessions/${sessionId}/logs`, {
104
- headers: {
105
- 'x-bb-api-key': this.apiKey,
106
- 'Content-Type': 'application/json',
107
- },
108
- });
109
- return await response.json();
110
- }
111
- load(url, options = {}) {
112
- if (typeof url === 'string') {
113
- return this.loadURL(url, options);
114
- }
115
- else if (Array.isArray(url)) {
116
- return this.loadURLs(url, options);
117
- }
118
- else {
119
- throw new TypeError('Input must be a URL string or array of URLs');
120
- }
121
- }
122
- async loadURL(url, options = {}) {
123
- if (!url) {
124
- throw new Error('Page URL was not provided');
125
- }
126
- const browser = await puppeteer_core_1.default.connect({
127
- browserWSEndpoint: this.getConnectURL({
128
- sessionId: options.sessionId,
129
- proxy: options.proxy,
130
- }),
131
- });
132
- const pages = await browser.pages();
133
- const page = pages[0];
134
- await page.goto(url);
135
- let html = await page.content();
136
- if (options.textContent) {
137
- const readable = await page.evaluate(`
138
- import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
139
- return new readability.Readability(document).parse()
140
- })`);
141
- html = `${readable.title}\n${readable.textContent}`;
142
- }
143
- await browser.close();
144
- return html;
145
- }
146
- async *loadURLs(urls, options = {}) {
147
- if (!urls.length) {
148
- throw new Error('Page URLs were not provided');
149
- }
150
- const browser = await puppeteer_core_1.default.connect({
151
- browserWSEndpoint: this.getConnectURL({
152
- sessionId: options.sessionId,
153
- proxy: options.proxy,
154
- }),
155
- });
156
- const pages = await browser.pages();
157
- const page = pages[0];
158
- for (const url of urls) {
159
- await page.goto(url);
160
- let html = await page.content();
161
- if (options.textContent) {
162
- const readable = await page.evaluate(`
163
- import('https://cdn.skypack.dev/@mozilla/readability').then(readability => {
164
- return new readability.Readability(document).parse()
165
- })`);
166
- html = `${readable.title}\n${readable.textContent}`;
167
- }
168
- yield html;
169
- }
170
- await browser.close();
171
- }
172
- async screenshot(url, options = { fullPage: false }) {
173
- if (!url) {
174
- throw new Error('Page URL was not provided');
175
- }
176
- const browser = await puppeteer_core_1.default.connect({
177
- browserWSEndpoint: this.getConnectURL({
178
- sessionId: options.sessionId,
179
- proxy: options.proxy,
180
- }),
181
- });
182
- const pages = await browser.pages();
183
- const page = pages[0];
184
- await page.goto(url);
185
- const screenshot = await page.screenshot({ fullPage: options.fullPage });
186
- await browser.close();
187
- return screenshot;
188
- }
189
- }
190
- exports.default = Browserbase;
191
- exports.Browserbase = Browserbase;
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import Browserbase, { LoadOptions } from '../index.js';
3
- export default function BrowserbaseAISDK(b: Browserbase, options?: LoadOptions): {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- url: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- url?: string;
9
- }, {
10
- url?: string;
11
- }>;
12
- execute: ({ url }: {
13
- url: string;
14
- }) => Promise<{
15
- page: string;
16
- }>;
17
- };
18
- export { BrowserbaseAISDK };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BrowserbaseAISDK = void 0;
4
- const zod_1 = require("zod");
5
- function BrowserbaseAISDK(b, options = {}) {
6
- return {
7
- description: 'Load a webpage in a browser hosted by Browserbase and return its contents',
8
- parameters: zod_1.z.object({
9
- url: zod_1.z.string().describe('Page URL to be loaded'),
10
- }),
11
- execute: async ({ url }) => {
12
- const page = await b.loadURL(url, options);
13
- return { page };
14
- },
15
- };
16
- }
17
- exports.default = BrowserbaseAISDK;
18
- exports.BrowserbaseAISDK = BrowserbaseAISDK;
package/logo/dark.png DELETED
Binary file
package/logo/light.png DELETED
Binary file