turno-browser 0.6.0 → 0.8.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 (76) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +13 -5
  3. package/dist/act.js +4 -29
  4. package/dist/agent-cursor-overlay.d.ts +95 -0
  5. package/dist/agent-cursor-overlay.js +358 -0
  6. package/dist/agent-cursor.d.ts +191 -0
  7. package/dist/agent-cursor.js +494 -0
  8. package/dist/api.d.ts +8 -3
  9. package/dist/api.js +6 -3
  10. package/dist/argv.d.ts +2 -1
  11. package/dist/argv.js +7 -1
  12. package/dist/bin/mcp.js +5 -0
  13. package/dist/cli/commands.js +12 -3
  14. package/dist/cli/completion.js +3 -0
  15. package/dist/cli/context.d.ts +2 -0
  16. package/dist/cli/context.js +8 -4
  17. package/dist/cli/do-background.d.ts +2 -0
  18. package/dist/cli/do-background.js +15 -0
  19. package/dist/cli/do.d.ts +4 -0
  20. package/dist/cli/do.js +17 -1
  21. package/dist/cli/flows.js +3 -0
  22. package/dist/cli/identity.d.ts +2 -0
  23. package/dist/cli/identity.js +67 -11
  24. package/dist/cli/init.d.ts +12 -0
  25. package/dist/cli/init.js +219 -0
  26. package/dist/cli/login-summary.d.ts +6 -0
  27. package/dist/cli/login-summary.js +11 -0
  28. package/dist/cli/main.js +3 -0
  29. package/dist/cli/setup.d.ts +32 -0
  30. package/dist/cli/setup.js +32 -23
  31. package/dist/doctor.js +18 -2
  32. package/dist/engine-camoufox.js +1 -0
  33. package/dist/engine-lightpanda.js +1 -0
  34. package/dist/host.d.ts +7 -0
  35. package/dist/host.js +330 -68
  36. package/dist/human-input.d.ts +5 -0
  37. package/dist/human-input.js +1 -1
  38. package/dist/human-step-overlay.d.ts +73 -0
  39. package/dist/human-step-overlay.js +285 -0
  40. package/dist/human-step.d.ts +128 -0
  41. package/dist/human-step.js +521 -0
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +2 -2
  44. package/dist/live-server.d.ts +7 -3
  45. package/dist/live-server.js +13 -15
  46. package/dist/live.d.ts +20 -1
  47. package/dist/live.js +52 -10
  48. package/dist/login.d.ts +22 -2
  49. package/dist/login.js +95 -7
  50. package/dist/network-redact.d.ts +28 -0
  51. package/dist/network-redact.js +202 -0
  52. package/dist/recorder.d.ts +0 -21
  53. package/dist/recorder.js +1 -41
  54. package/dist/recordings.d.ts +5 -0
  55. package/dist/recordings.js +4 -2
  56. package/dist/redact.d.ts +7 -0
  57. package/dist/redact.js +32 -1
  58. package/dist/replay.d.ts +2 -0
  59. package/dist/replay.js +33 -14
  60. package/dist/reputation.d.ts +5 -0
  61. package/dist/reputation.js +12 -7
  62. package/dist/sensitive.d.ts +79 -0
  63. package/dist/sensitive.js +275 -0
  64. package/dist/session.d.ts +12 -0
  65. package/dist/session.js +24 -0
  66. package/dist/settings.d.ts +12 -2
  67. package/dist/settings.js +14 -2
  68. package/dist/tools.d.ts +5 -0
  69. package/dist/tools.js +9 -1
  70. package/dist/tuning.d.ts +4 -1
  71. package/dist/tuning.js +1 -0
  72. package/dist/upstream.d.ts +5 -0
  73. package/dist/watch.d.ts +60 -0
  74. package/dist/watch.js +114 -0
  75. package/npm-shrinkwrap.json +2 -2
  76. package/package.json +1 -1
package/dist/watch.js ADDED
@@ -0,0 +1,114 @@
1
+ import { DEFAULT_LIVE_WAIT_MS, PauseGate } from "./live.js";
2
+ /** The tab's title, or "" when the page does not answer within a second. */
3
+ export async function titleOf(page) {
4
+ let timer;
5
+ const late = new Promise((r) => {
6
+ timer = setTimeout(() => r(""), 1_000);
7
+ });
8
+ try {
9
+ return await Promise.race([page.title().catch(() => ""), late]);
10
+ }
11
+ finally {
12
+ clearTimeout(timer);
13
+ }
14
+ }
15
+ /** The watch of a browser without the live view: no stream, no socket, no user pause. */
16
+ export class PlainWatch {
17
+ waitMs;
18
+ gate = new PauseGate();
19
+ browser;
20
+ heldBrowser;
21
+ lastBySession = new Map();
22
+ ids = new WeakMap();
23
+ nextId = 1;
24
+ busy = 0;
25
+ constructor(waitMs = DEFAULT_LIVE_WAIT_MS) {
26
+ this.waitMs = waitMs;
27
+ }
28
+ get paused() {
29
+ return this.gate.paused !== undefined;
30
+ }
31
+ get inFlight() {
32
+ return this.busy;
33
+ }
34
+ bind(browser) {
35
+ this.browser = browser;
36
+ this.lastBySession.clear();
37
+ if (this.paused && this.heldBrowser !== browser) {
38
+ this.heldBrowser = browser;
39
+ void browser.onPause?.().catch(() => { });
40
+ }
41
+ return () => {
42
+ if (this.browser !== browser)
43
+ return;
44
+ this.browser = undefined;
45
+ if (this.heldBrowser === browser)
46
+ this.heldBrowser = undefined;
47
+ };
48
+ }
49
+ follow(session, page) {
50
+ if (page && !page.isClosed())
51
+ this.lastBySession.set(session, page);
52
+ }
53
+ lastPage(session) {
54
+ return this.lastBySession.get(session);
55
+ }
56
+ idOf(page) {
57
+ let id = this.ids.get(page);
58
+ if (id === undefined) {
59
+ id = this.nextId++;
60
+ this.ids.set(page, id);
61
+ }
62
+ return id;
63
+ }
64
+ /** The agent's pages: every page, or in attach mode only those the agent worked on. */
65
+ pages() {
66
+ const b = this.browser;
67
+ if (!b)
68
+ return [];
69
+ if (b.userBrowser)
70
+ return [...new Set(this.lastBySession.values())].filter((p) => !p.isClosed());
71
+ try {
72
+ return b.context.pages().filter((p) => !p.isClosed());
73
+ }
74
+ catch {
75
+ return [];
76
+ }
77
+ }
78
+ async tabStates() {
79
+ return await Promise.all(this.pages().map(async (p) => ({
80
+ id: this.idOf(p),
81
+ url: this.browser?.urlOf?.(p) ?? p.url(),
82
+ title: await titleOf(p),
83
+ })));
84
+ }
85
+ begin() {
86
+ this.busy++;
87
+ let done = false;
88
+ return () => {
89
+ if (done)
90
+ return;
91
+ done = true;
92
+ this.busy--;
93
+ };
94
+ }
95
+ async pause(by, _front = false, hold = {}) {
96
+ if (!this.gate.start(by, this.tabStates(), hold))
97
+ return false;
98
+ const b = this.browser;
99
+ if (b) {
100
+ this.heldBrowser = b;
101
+ await b.onPause?.().catch(() => { });
102
+ }
103
+ return true;
104
+ }
105
+ resume() {
106
+ if (!this.gate.resume())
107
+ return false;
108
+ const b = this.heldBrowser;
109
+ this.heldBrowser = undefined;
110
+ b?.onResume?.();
111
+ return true;
112
+ }
113
+ }
114
+ //# sourceMappingURL=watch.js.map
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "turno-browser",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "turno-browser",
9
- "version": "0.6.0",
9
+ "version": "0.8.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@modelcontextprotocol/sdk": "1.32.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turno-browser",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "A browser your agents use with your accounts. It stays light on your machine, and the model never sees your passwords.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "William Frank Monroy Mamani (https://github.com/william-monroy)",