@workglow/browser-control 0.2.36 → 0.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.
Files changed (59) hide show
  1. package/dist/defaults.d.ts +13 -0
  2. package/dist/defaults.d.ts.map +1 -0
  3. package/dist/task/register.d.ts +18 -18
  4. package/dist/task/register.d.ts.map +1 -1
  5. package/dist/task/tasks/BrowserAttributeTask.d.ts +3 -2
  6. package/dist/task/tasks/BrowserAttributeTask.d.ts.map +1 -1
  7. package/dist/task/tasks/BrowserBackTask.d.ts +3 -2
  8. package/dist/task/tasks/BrowserBackTask.d.ts.map +1 -1
  9. package/dist/task/tasks/BrowserClickTask.d.ts +3 -2
  10. package/dist/task/tasks/BrowserClickTask.d.ts.map +1 -1
  11. package/dist/task/tasks/BrowserCloseTabTask.d.ts +3 -2
  12. package/dist/task/tasks/BrowserCloseTabTask.d.ts.map +1 -1
  13. package/dist/task/tasks/BrowserCloseTask.d.ts +3 -2
  14. package/dist/task/tasks/BrowserCloseTask.d.ts.map +1 -1
  15. package/dist/task/tasks/BrowserEvaluateTask.d.ts +3 -2
  16. package/dist/task/tasks/BrowserEvaluateTask.d.ts.map +1 -1
  17. package/dist/task/tasks/BrowserExtractHtmlTask.d.ts +3 -2
  18. package/dist/task/tasks/BrowserExtractHtmlTask.d.ts.map +1 -1
  19. package/dist/task/tasks/BrowserExtractTextTask.d.ts +3 -2
  20. package/dist/task/tasks/BrowserExtractTextTask.d.ts.map +1 -1
  21. package/dist/task/tasks/BrowserFillTask.d.ts +3 -2
  22. package/dist/task/tasks/BrowserFillTask.d.ts.map +1 -1
  23. package/dist/task/tasks/BrowserForwardTask.d.ts +3 -2
  24. package/dist/task/tasks/BrowserForwardTask.d.ts.map +1 -1
  25. package/dist/task/tasks/BrowserHoverTask.d.ts +3 -2
  26. package/dist/task/tasks/BrowserHoverTask.d.ts.map +1 -1
  27. package/dist/task/tasks/BrowserLoginTask.d.ts +2 -1
  28. package/dist/task/tasks/BrowserLoginTask.d.ts.map +1 -1
  29. package/dist/task/tasks/BrowserNavigateTask.d.ts +3 -2
  30. package/dist/task/tasks/BrowserNavigateTask.d.ts.map +1 -1
  31. package/dist/task/tasks/BrowserNewTabTask.d.ts +3 -2
  32. package/dist/task/tasks/BrowserNewTabTask.d.ts.map +1 -1
  33. package/dist/task/tasks/BrowserPressKeyTask.d.ts +3 -2
  34. package/dist/task/tasks/BrowserPressKeyTask.d.ts.map +1 -1
  35. package/dist/task/tasks/BrowserQuerySelectorTask.d.ts +3 -2
  36. package/dist/task/tasks/BrowserQuerySelectorTask.d.ts.map +1 -1
  37. package/dist/task/tasks/BrowserReloadTask.d.ts +3 -2
  38. package/dist/task/tasks/BrowserReloadTask.d.ts.map +1 -1
  39. package/dist/task/tasks/BrowserScreenshotTask.d.ts +3 -2
  40. package/dist/task/tasks/BrowserScreenshotTask.d.ts.map +1 -1
  41. package/dist/task/tasks/BrowserScrollTask.d.ts +3 -2
  42. package/dist/task/tasks/BrowserScrollTask.d.ts.map +1 -1
  43. package/dist/task/tasks/BrowserSelectTask.d.ts +3 -2
  44. package/dist/task/tasks/BrowserSelectTask.d.ts.map +1 -1
  45. package/dist/task/tasks/BrowserSessionTask.d.ts +2 -1
  46. package/dist/task/tasks/BrowserSessionTask.d.ts.map +1 -1
  47. package/dist/task/tasks/BrowserSnapshotTask.d.ts +3 -2
  48. package/dist/task/tasks/BrowserSnapshotTask.d.ts.map +1 -1
  49. package/dist/task/tasks/BrowserSwitchTabTask.d.ts +3 -2
  50. package/dist/task/tasks/BrowserSwitchTabTask.d.ts.map +1 -1
  51. package/dist/task/tasks/BrowserTypeTask.d.ts +3 -2
  52. package/dist/task/tasks/BrowserTypeTask.d.ts.map +1 -1
  53. package/dist/task/tasks/BrowserUploadTask.d.ts +3 -2
  54. package/dist/task/tasks/BrowserUploadTask.d.ts.map +1 -1
  55. package/dist/task/tasks/BrowserWaitTask.d.ts +3 -2
  56. package/dist/task/tasks/BrowserWaitTask.d.ts.map +1 -1
  57. package/dist/task.js +79 -52
  58. package/dist/task.js.map +28 -28
  59. package/package.json +5 -5
package/dist/task.js CHANGED
@@ -619,7 +619,7 @@ class BrowserSessionTask extends Task {
619
619
  static category = "Browser";
620
620
  static title = "Browser Session";
621
621
  static description = "Creates a new browser session and returns its session ID";
622
- static cacheable = false;
622
+ static cachePolicy = { kind: "none" };
623
623
  static hasDynamicEntitlements = true;
624
624
  static configSchema() {
625
625
  return browserSessionTaskConfigSchema;
@@ -685,10 +685,12 @@ class BrowserSessionTask extends Task {
685
685
  const ctx = deps.createContext(options);
686
686
  await ctx.connect(options);
687
687
  const sessionId = BrowserSessionRegistry.register(ctx);
688
- executeContext.resourceScope?.register(`browser:${sessionId}`, async () => {
688
+ const resourceKey = `browser:${sessionId}`;
689
+ executeContext.resourceScope?.register(resourceKey, async () => {
689
690
  await ctx.disconnect();
690
691
  BrowserSessionRegistry.unregister(sessionId);
691
692
  });
693
+ executeContext.resourceScope?.touch(resourceKey);
692
694
  return { sessionId };
693
695
  }
694
696
  }
@@ -717,7 +719,7 @@ class BrowserCloseTask extends Task2 {
717
719
  static category = "Browser";
718
720
  static title = "Browser Close";
719
721
  static description = "Disconnects and closes an existing browser session";
720
- static cacheable = false;
722
+ static cachePolicy = { kind: "none" };
721
723
  static configSchema() {
722
724
  return TaskConfigSchema2;
723
725
  }
@@ -727,7 +729,8 @@ class BrowserCloseTask extends Task2 {
727
729
  static outputSchema() {
728
730
  return outputSchema2;
729
731
  }
730
- async execute(input, _executeContext) {
732
+ async execute(input, executeContext) {
733
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
731
734
  const ctx = BrowserSessionRegistry.get(input.sessionId);
732
735
  await ctx.disconnect();
733
736
  BrowserSessionRegistry.unregister(input.sessionId);
@@ -800,7 +803,7 @@ class BrowserNavigateTask extends Task3 {
800
803
  static category = "Browser";
801
804
  static title = "Browser Navigate";
802
805
  static description = "Navigates the browser to a URL and returns the page title and URL";
803
- static cacheable = false;
806
+ static cachePolicy = { kind: "none" };
804
807
  static configSchema() {
805
808
  return browserNavigateTaskConfigSchema;
806
809
  }
@@ -817,7 +820,8 @@ class BrowserNavigateTask extends Task3 {
817
820
  ]
818
821
  };
819
822
  }
820
- async execute(input, _executeContext) {
823
+ async execute(input, executeContext) {
824
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
821
825
  const parsed = new URL(input.url, "https://placeholder");
822
826
  if (parsed.protocol === "javascript:") {
823
827
  throw new Error("BrowserNavigateTask: javascript: URLs are not allowed");
@@ -867,7 +871,7 @@ class BrowserBackTask extends Task4 {
867
871
  static category = "Browser";
868
872
  static title = "Browser Back";
869
873
  static description = "Navigates back in the browser history and returns the current URL";
870
- static cacheable = false;
874
+ static cachePolicy = { kind: "none" };
871
875
  static configSchema() {
872
876
  return TaskConfigSchema4;
873
877
  }
@@ -877,7 +881,8 @@ class BrowserBackTask extends Task4 {
877
881
  static outputSchema() {
878
882
  return outputSchema4;
879
883
  }
880
- async execute(input, _executeContext) {
884
+ async execute(input, executeContext) {
885
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
881
886
  const ctx = BrowserSessionRegistry.get(input.sessionId);
882
887
  await ctx.goBack();
883
888
  const url = await ctx.currentUrl();
@@ -921,7 +926,7 @@ class BrowserForwardTask extends Task5 {
921
926
  static category = "Browser";
922
927
  static title = "Browser Forward";
923
928
  static description = "Navigates forward in the browser history and returns the current URL";
924
- static cacheable = false;
929
+ static cachePolicy = { kind: "none" };
925
930
  static configSchema() {
926
931
  return TaskConfigSchema5;
927
932
  }
@@ -931,7 +936,8 @@ class BrowserForwardTask extends Task5 {
931
936
  static outputSchema() {
932
937
  return outputSchema5;
933
938
  }
934
- async execute(input, _executeContext) {
939
+ async execute(input, executeContext) {
940
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
935
941
  const ctx = BrowserSessionRegistry.get(input.sessionId);
936
942
  await ctx.goForward();
937
943
  const url = await ctx.currentUrl();
@@ -970,7 +976,7 @@ class BrowserReloadTask extends Task6 {
970
976
  static category = "Browser";
971
977
  static title = "Browser Reload";
972
978
  static description = "Reloads the current page in the browser";
973
- static cacheable = false;
979
+ static cachePolicy = { kind: "none" };
974
980
  static configSchema() {
975
981
  return TaskConfigSchema6;
976
982
  }
@@ -980,7 +986,8 @@ class BrowserReloadTask extends Task6 {
980
986
  static outputSchema() {
981
987
  return outputSchema6;
982
988
  }
983
- async execute(input, _executeContext) {
989
+ async execute(input, executeContext) {
990
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
984
991
  const ctx = BrowserSessionRegistry.get(input.sessionId);
985
992
  await ctx.reload();
986
993
  return { sessionId: input.sessionId };
@@ -1024,7 +1031,7 @@ class BrowserSnapshotTask extends Task7 {
1024
1031
  static category = "Browser";
1025
1032
  static title = "Browser Snapshot";
1026
1033
  static description = "Returns the accessibility tree of the current browser page";
1027
- static cacheable = false;
1034
+ static cachePolicy = { kind: "none" };
1028
1035
  static configSchema() {
1029
1036
  return TaskConfigSchema7;
1030
1037
  }
@@ -1034,7 +1041,8 @@ class BrowserSnapshotTask extends Task7 {
1034
1041
  static outputSchema() {
1035
1042
  return outputSchema7;
1036
1043
  }
1037
- async execute(input, _executeContext) {
1044
+ async execute(input, executeContext) {
1045
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1038
1046
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1039
1047
  const tree = await ctx.snapshot();
1040
1048
  return { sessionId: input.sessionId, tree };
@@ -1098,7 +1106,7 @@ class BrowserScreenshotTask extends Task8 {
1098
1106
  static category = "Browser";
1099
1107
  static title = "Browser Screenshot";
1100
1108
  static description = "Takes a screenshot of the current browser page";
1101
- static cacheable = false;
1109
+ static cachePolicy = { kind: "none" };
1102
1110
  static configSchema() {
1103
1111
  return browserScreenshotTaskConfigSchema;
1104
1112
  }
@@ -1108,7 +1116,8 @@ class BrowserScreenshotTask extends Task8 {
1108
1116
  static outputSchema() {
1109
1117
  return outputSchema8;
1110
1118
  }
1111
- async execute(input, _executeContext) {
1119
+ async execute(input, executeContext) {
1120
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1112
1121
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1113
1122
  const format = this.config.format ?? "png";
1114
1123
  const fullPage = this.config.fullPage ?? false;
@@ -1179,7 +1188,7 @@ class BrowserClickTask extends Task9 {
1179
1188
  static category = "Browser";
1180
1189
  static title = "Browser Click";
1181
1190
  static description = "Clicks an element in the browser by ref or by ARIA role and name";
1182
- static cacheable = false;
1191
+ static cachePolicy = { kind: "none" };
1183
1192
  static configSchema() {
1184
1193
  return browserClickTaskConfigSchema;
1185
1194
  }
@@ -1189,7 +1198,8 @@ class BrowserClickTask extends Task9 {
1189
1198
  static outputSchema() {
1190
1199
  return outputSchema9;
1191
1200
  }
1192
- async execute(input, _executeContext) {
1201
+ async execute(input, executeContext) {
1202
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1193
1203
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1194
1204
  const opts = this.config.modifiers ? { modifiers: this.config.modifiers } : undefined;
1195
1205
  if (input.ref) {
@@ -1262,7 +1272,7 @@ class BrowserFillTask extends Task10 {
1262
1272
  static category = "Browser";
1263
1273
  static title = "Browser Fill";
1264
1274
  static description = "Fills a text input in the browser by ref or by label";
1265
- static cacheable = false;
1275
+ static cachePolicy = { kind: "none" };
1266
1276
  static configSchema() {
1267
1277
  return browserFillTaskConfigSchema;
1268
1278
  }
@@ -1272,7 +1282,8 @@ class BrowserFillTask extends Task10 {
1272
1282
  static outputSchema() {
1273
1283
  return outputSchema10;
1274
1284
  }
1275
- async execute(input, _executeContext) {
1285
+ async execute(input, executeContext) {
1286
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1276
1287
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1277
1288
  if (input.ref) {
1278
1289
  await ctx.fill(input.ref, input.value);
@@ -1331,7 +1342,7 @@ class BrowserSelectTask extends Task11 {
1331
1342
  static category = "Browser";
1332
1343
  static title = "Browser Select";
1333
1344
  static description = "Selects an option in a select element identified by ref";
1334
- static cacheable = false;
1345
+ static cachePolicy = { kind: "none" };
1335
1346
  static configSchema() {
1336
1347
  return TaskConfigSchema11;
1337
1348
  }
@@ -1341,7 +1352,8 @@ class BrowserSelectTask extends Task11 {
1341
1352
  static outputSchema() {
1342
1353
  return outputSchema11;
1343
1354
  }
1344
- async execute(input, _executeContext) {
1355
+ async execute(input, executeContext) {
1356
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1345
1357
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1346
1358
  if (input.ref) {
1347
1359
  await ctx.selectOption(input.ref, input.value);
@@ -1398,7 +1410,7 @@ class BrowserHoverTask extends Task12 {
1398
1410
  static category = "Browser";
1399
1411
  static title = "Browser Hover";
1400
1412
  static description = "Hovers over an element in the browser identified by ref";
1401
- static cacheable = false;
1413
+ static cachePolicy = { kind: "none" };
1402
1414
  static configSchema() {
1403
1415
  return TaskConfigSchema12;
1404
1416
  }
@@ -1408,7 +1420,8 @@ class BrowserHoverTask extends Task12 {
1408
1420
  static outputSchema() {
1409
1421
  return outputSchema12;
1410
1422
  }
1411
- async execute(input, _executeContext) {
1423
+ async execute(input, executeContext) {
1424
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1412
1425
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1413
1426
  if (input.ref) {
1414
1427
  await ctx.hover(input.ref);
@@ -1467,7 +1480,7 @@ class BrowserExtractTextTask extends Task13 {
1467
1480
  static category = "Browser";
1468
1481
  static title = "Browser Extract Text";
1469
1482
  static description = "Extracts text content from a specific element or the full page";
1470
- static cacheable = false;
1483
+ static cachePolicy = { kind: "none" };
1471
1484
  static configSchema() {
1472
1485
  return browserExtractTextTaskConfigSchema;
1473
1486
  }
@@ -1477,7 +1490,8 @@ class BrowserExtractTextTask extends Task13 {
1477
1490
  static outputSchema() {
1478
1491
  return outputSchema13;
1479
1492
  }
1480
- async execute(input, _executeContext) {
1493
+ async execute(input, executeContext) {
1494
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1481
1495
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1482
1496
  let ref = this.config.ref;
1483
1497
  if (!ref) {
@@ -1545,7 +1559,7 @@ class BrowserExtractHtmlTask extends Task14 {
1545
1559
  static category = "Browser";
1546
1560
  static title = "Browser Extract HTML";
1547
1561
  static description = "Extracts HTML content from a specific element by ref or CSS selector";
1548
- static cacheable = false;
1562
+ static cachePolicy = { kind: "none" };
1549
1563
  static configSchema() {
1550
1564
  return browserExtractHtmlTaskConfigSchema;
1551
1565
  }
@@ -1555,7 +1569,8 @@ class BrowserExtractHtmlTask extends Task14 {
1555
1569
  static outputSchema() {
1556
1570
  return outputSchema14;
1557
1571
  }
1558
- async execute(input, _executeContext) {
1572
+ async execute(input, executeContext) {
1573
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1559
1574
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1560
1575
  let ref = this.config.ref;
1561
1576
  if (!ref) {
@@ -1619,7 +1634,7 @@ class BrowserAttributeTask extends Task15 {
1619
1634
  static category = "Browser";
1620
1635
  static title = "Browser Attribute";
1621
1636
  static description = "Retrieves the value of an attribute from a browser element";
1622
- static cacheable = false;
1637
+ static cachePolicy = { kind: "none" };
1623
1638
  static configSchema() {
1624
1639
  return TaskConfigSchema15;
1625
1640
  }
@@ -1629,7 +1644,8 @@ class BrowserAttributeTask extends Task15 {
1629
1644
  static outputSchema() {
1630
1645
  return outputSchema15;
1631
1646
  }
1632
- async execute(input, _executeContext) {
1647
+ async execute(input, executeContext) {
1648
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1633
1649
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1634
1650
  const value = await ctx.attribute(input.ref, input.attribute);
1635
1651
  return { sessionId: input.sessionId, value };
@@ -1678,7 +1694,7 @@ class BrowserQuerySelectorTask extends Task16 {
1678
1694
  static category = "Browser";
1679
1695
  static title = "Browser Query Selector";
1680
1696
  static description = "Queries all elements matching a CSS selector and returns their refs";
1681
- static cacheable = false;
1697
+ static cachePolicy = { kind: "none" };
1682
1698
  static configSchema() {
1683
1699
  return TaskConfigSchema16;
1684
1700
  }
@@ -1688,7 +1704,8 @@ class BrowserQuerySelectorTask extends Task16 {
1688
1704
  static outputSchema() {
1689
1705
  return outputSchema16;
1690
1706
  }
1691
- async execute(input, _executeContext) {
1707
+ async execute(input, executeContext) {
1708
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1692
1709
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1693
1710
  const refs = await ctx.querySelectorAll(input.selector);
1694
1711
  return { sessionId: input.sessionId, refs };
@@ -1739,7 +1756,7 @@ class BrowserEvaluateTask extends Task17 {
1739
1756
  static category = "Browser";
1740
1757
  static title = "Browser Evaluate";
1741
1758
  static description = "Evaluates a JavaScript expression in the browser page context";
1742
- static cacheable = false;
1759
+ static cachePolicy = { kind: "none" };
1743
1760
  static configSchema() {
1744
1761
  return TaskConfigSchema17;
1745
1762
  }
@@ -1759,7 +1776,8 @@ class BrowserEvaluateTask extends Task17 {
1759
1776
  ]
1760
1777
  };
1761
1778
  }
1762
- async execute(input, _executeContext) {
1779
+ async execute(input, executeContext) {
1780
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1763
1781
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1764
1782
  const result = await ctx.evaluate(input.expression);
1765
1783
  return { sessionId: input.sessionId, result };
@@ -1818,7 +1836,7 @@ class BrowserPressKeyTask extends Task18 {
1818
1836
  static category = "Browser";
1819
1837
  static title = "Browser Press Key";
1820
1838
  static description = "Presses a keyboard key in the browser, optionally with modifiers";
1821
- static cacheable = false;
1839
+ static cachePolicy = { kind: "none" };
1822
1840
  static configSchema() {
1823
1841
  return browserPressKeyTaskConfigSchema;
1824
1842
  }
@@ -1832,7 +1850,8 @@ class BrowserPressKeyTask extends Task18 {
1832
1850
  const modifiers = this.config.modifiers?.filter(Boolean) ?? [];
1833
1851
  return modifiers.length > 0 ? `${modifiers.join("+")}+${key}` : key;
1834
1852
  }
1835
- async execute(input, _executeContext) {
1853
+ async execute(input, executeContext) {
1854
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1836
1855
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1837
1856
  await ctx.pressKey(this.buildKeyChord(input.key));
1838
1857
  return { sessionId: input.sessionId };
@@ -1882,7 +1901,7 @@ class BrowserTypeTask extends Task19 {
1882
1901
  static category = "Browser";
1883
1902
  static title = "Browser Type";
1884
1903
  static description = "Types text into the currently focused element in the browser";
1885
- static cacheable = false;
1904
+ static cachePolicy = { kind: "none" };
1886
1905
  static configSchema() {
1887
1906
  return browserTypeTaskConfigSchema;
1888
1907
  }
@@ -1892,7 +1911,8 @@ class BrowserTypeTask extends Task19 {
1892
1911
  static outputSchema() {
1893
1912
  return outputSchema19;
1894
1913
  }
1895
- async execute(input, _executeContext) {
1914
+ async execute(input, executeContext) {
1915
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1896
1916
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1897
1917
  await ctx.type(input.text);
1898
1918
  return { sessionId: input.sessionId };
@@ -1954,7 +1974,7 @@ class BrowserScrollTask extends Task20 {
1954
1974
  static category = "Browser";
1955
1975
  static title = "Browser Scroll";
1956
1976
  static description = "Scrolls the page or a specific element by the given pixel deltas";
1957
- static cacheable = false;
1977
+ static cachePolicy = { kind: "none" };
1958
1978
  static configSchema() {
1959
1979
  return browserScrollTaskConfigSchema;
1960
1980
  }
@@ -1964,7 +1984,8 @@ class BrowserScrollTask extends Task20 {
1964
1984
  static outputSchema() {
1965
1985
  return outputSchema20;
1966
1986
  }
1967
- async execute(input, _executeContext) {
1987
+ async execute(input, executeContext) {
1988
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
1968
1989
  const ctx = BrowserSessionRegistry.get(input.sessionId);
1969
1990
  await ctx.scroll(this.config.x ?? 0, this.config.y ?? 0, this.config.ref);
1970
1991
  return { sessionId: input.sessionId };
@@ -2026,7 +2047,7 @@ class BrowserUploadTask extends Task21 {
2026
2047
  static category = "Browser";
2027
2048
  static title = "Browser Upload";
2028
2049
  static description = "Uploads one or more files to a file input element in the browser";
2029
- static cacheable = false;
2050
+ static cachePolicy = { kind: "none" };
2030
2051
  static entitlements() {
2031
2052
  return {
2032
2053
  entitlements: [
@@ -2043,7 +2064,8 @@ class BrowserUploadTask extends Task21 {
2043
2064
  static outputSchema() {
2044
2065
  return outputSchema21;
2045
2066
  }
2046
- async execute(input, _executeContext) {
2067
+ async execute(input, executeContext) {
2068
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2047
2069
  const ctx = BrowserSessionRegistry.get(input.sessionId);
2048
2070
  await ctx.uploadFile(input.ref, input.filePaths);
2049
2071
  return { sessionId: input.sessionId };
@@ -2106,7 +2128,7 @@ class BrowserWaitTask extends Task22 {
2106
2128
  static category = "Browser";
2107
2129
  static title = "Browser Wait";
2108
2130
  static description = "Waits for a navigation, selector, or network idle state in the browser";
2109
- static cacheable = false;
2131
+ static cachePolicy = { kind: "none" };
2110
2132
  static configSchema() {
2111
2133
  return browserWaitTaskConfigSchema;
2112
2134
  }
@@ -2116,7 +2138,8 @@ class BrowserWaitTask extends Task22 {
2116
2138
  static outputSchema() {
2117
2139
  return outputSchema22;
2118
2140
  }
2119
- async execute(input, _executeContext) {
2141
+ async execute(input, executeContext) {
2142
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2120
2143
  const ctx = BrowserSessionRegistry.get(input.sessionId);
2121
2144
  const waitFor = this.config.waitFor ?? "idle";
2122
2145
  const timeout = this.config.timeout ?? 30000;
@@ -2188,7 +2211,7 @@ class BrowserNewTabTask extends Task23 {
2188
2211
  static category = "Browser";
2189
2212
  static title = "Browser New Tab";
2190
2213
  static description = "Opens a new browser tab and returns its tab ID";
2191
- static cacheable = false;
2214
+ static cachePolicy = { kind: "none" };
2192
2215
  static configSchema() {
2193
2216
  return browserNewTabTaskConfigSchema;
2194
2217
  }
@@ -2198,7 +2221,8 @@ class BrowserNewTabTask extends Task23 {
2198
2221
  static outputSchema() {
2199
2222
  return outputSchema23;
2200
2223
  }
2201
- async execute(input, _executeContext) {
2224
+ async execute(input, executeContext) {
2225
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2202
2226
  const ctx = BrowserSessionRegistry.get(input.sessionId);
2203
2227
  const tabInfo = await ctx.newTab(input.url);
2204
2228
  return { sessionId: input.sessionId, tabId: tabInfo.tabId };
@@ -2248,7 +2272,7 @@ class BrowserSwitchTabTask extends Task24 {
2248
2272
  static category = "Browser";
2249
2273
  static title = "Browser Switch Tab";
2250
2274
  static description = "Switches the active browser tab to the specified tab ID";
2251
- static cacheable = false;
2275
+ static cachePolicy = { kind: "none" };
2252
2276
  static configSchema() {
2253
2277
  return browserSwitchTabTaskConfigSchema;
2254
2278
  }
@@ -2258,7 +2282,8 @@ class BrowserSwitchTabTask extends Task24 {
2258
2282
  static outputSchema() {
2259
2283
  return outputSchema24;
2260
2284
  }
2261
- async execute(input, _executeContext) {
2285
+ async execute(input, executeContext) {
2286
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2262
2287
  const ctx = BrowserSessionRegistry.get(input.sessionId);
2263
2288
  await ctx.switchTab(input.tabId);
2264
2289
  return { sessionId: input.sessionId };
@@ -2308,7 +2333,7 @@ class BrowserCloseTabTask extends Task25 {
2308
2333
  static category = "Browser";
2309
2334
  static title = "Browser Close Tab";
2310
2335
  static description = "Closes a browser tab by tab ID";
2311
- static cacheable = false;
2336
+ static cachePolicy = { kind: "none" };
2312
2337
  static configSchema() {
2313
2338
  return browserCloseTabTaskConfigSchema;
2314
2339
  }
@@ -2318,7 +2343,8 @@ class BrowserCloseTabTask extends Task25 {
2318
2343
  static outputSchema() {
2319
2344
  return outputSchema25;
2320
2345
  }
2321
- async execute(input, _executeContext) {
2346
+ async execute(input, executeContext) {
2347
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2322
2348
  if (!this.config.tabId) {
2323
2349
  throw new Error("BrowserCloseTabTask requires config.tabId");
2324
2350
  }
@@ -2389,7 +2415,7 @@ class BrowserLoginTask extends Task26 {
2389
2415
  static category = "Browser";
2390
2416
  static title = "Browser Login";
2391
2417
  static description = "Logs into a website using manual, credential, or AI-driven login strategies";
2392
- static cacheable = false;
2418
+ static cachePolicy = { kind: "none" };
2393
2419
  static hasDynamicEntitlements = true;
2394
2420
  static configSchema() {
2395
2421
  return browserLoginTaskConfigSchema;
@@ -2422,6 +2448,7 @@ class BrowserLoginTask extends Task26 {
2422
2448
  return base;
2423
2449
  }
2424
2450
  async execute(input, executeContext) {
2451
+ executeContext.resourceScope?.touch(`browser:${input.sessionId}`);
2425
2452
  const parsed = new URL(input.url, "https://placeholder");
2426
2453
  if (parsed.protocol === "javascript:") {
2427
2454
  throw new Error("BrowserLoginTask: javascript: URLs are not allowed");
@@ -2476,4 +2503,4 @@ export {
2476
2503
  BROWSER_CONTROL_TASK_DEPS
2477
2504
  };
2478
2505
 
2479
- //# debugId=BB75C3F860F618D964756E2164756E21
2506
+ //# debugId=87E0BB2655418B2964756E2164756E21