@capybara-hq/plugin-browser 0.1.0-rc.0 → 0.1.0-rc.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "browser",
4
- "version": "0.1.0-rc.0",
4
+ "version": "0.1.0-rc.1",
5
5
  "publisher": "Capybara",
6
6
  "description": {
7
7
  "en": "A real browser in the conversation owner's device for agents: navigate, read and act on pages through tools, with a live view in the conversation panel and takeover by the person",
@@ -17,7 +17,7 @@
17
17
  "entry": "./dist/index.mjs",
18
18
  "manifest": {
19
19
  "name": "browser",
20
- "version": "0.1.0-rc.0",
20
+ "version": "0.1.0-rc.1",
21
21
  "sdk": "^0.1.0-rc.69",
22
22
  "provides": [],
23
23
  "requires": [],
package/dist/index.mjs CHANGED
@@ -859,7 +859,7 @@ function registerBrowserTools(ctx, deps) {
859
859
  // src/index.ts
860
860
  var index_default = defineExtension({
861
861
  name: "browser",
862
- version: "0.1.0-rc.0",
862
+ version: "0.1.0-rc.1",
863
863
  sdk: "^0.1.0-rc.69",
864
864
  provides: [],
865
865
  ui: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-browser",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A real browser in the person's device for agents: navigate, read and act on pages through tools, with a live view in the conversation and takeover by the person",
@@ -434,6 +434,11 @@ var BrowserSession = class {
434
434
  /** Downloads in progress, cancelled together when their bytes pass the cap. */
435
435
  activeDownloads = /* @__PURE__ */ new Set();
436
436
  downloadPoll;
437
+ /**
438
+ * Files of downloads cancelled at the cap: Playwright removes them later, and until then they
439
+ * do not count toward the cap of the downloads that follow.
440
+ */
441
+ cancelledTmp = /* @__PURE__ */ new Set();
437
442
  pages = /* @__PURE__ */ new Map();
438
443
  ids = /* @__PURE__ */ new WeakMap();
439
444
  titles = /* @__PURE__ */ new Map();
@@ -682,19 +687,24 @@ var BrowserSession = class {
682
687
  this.downloadPoll = void 0;
683
688
  if (this.activeDownloads.size === 0) return;
684
689
  let bytes = 0;
690
+ let names = [];
685
691
  const dir = this.downloadsTmp;
686
692
  if (dir !== void 0) {
687
693
  try {
688
- for (const f of readdirSync(dir)) {
689
- try {
690
- bytes += statSync(join(dir, f)).size;
691
- } catch {
692
- }
693
- }
694
+ names = readdirSync(dir);
694
695
  } catch {
695
696
  }
697
+ for (const f of this.cancelledTmp) if (!names.includes(f)) this.cancelledTmp.delete(f);
698
+ for (const f of names) {
699
+ if (this.cancelledTmp.has(f)) continue;
700
+ try {
701
+ bytes += statSync(join(dir, f)).size;
702
+ } catch {
703
+ }
704
+ }
696
705
  }
697
706
  if (bytes > this.downloadMaxBytes) {
707
+ for (const f of names) this.cancelledTmp.add(f);
698
708
  for (const d of this.activeDownloads) {
699
709
  this.note(
700
710
  `The download of ${JSON.stringify(clip(d.suggestedFilename(), 300))} was cancelled: downloads in progress passed ${this.downloadMaxBytes} bytes.`