turno-browser 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 (131) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +95 -123
  3. package/dist/act-model.d.ts +85 -0
  4. package/dist/act-model.js +117 -0
  5. package/dist/act.d.ts +37 -0
  6. package/dist/act.js +600 -0
  7. package/dist/api.d.ts +90 -2
  8. package/dist/api.js +41 -4
  9. package/dist/argv.d.ts +16 -2
  10. package/dist/argv.js +100 -3
  11. package/dist/background-state.d.ts +54 -0
  12. package/dist/background-state.js +97 -0
  13. package/dist/background.d.ts +69 -0
  14. package/dist/background.js +458 -0
  15. package/dist/batch.d.ts +5 -0
  16. package/dist/batch.js +3 -3
  17. package/dist/bin/mcp.js +103 -6
  18. package/dist/captcha.d.ts +77 -0
  19. package/dist/captcha.js +334 -0
  20. package/dist/cdp-relay.d.ts +20 -0
  21. package/dist/cdp-relay.js +101 -0
  22. package/dist/chrome-features.d.ts +23 -0
  23. package/dist/chrome-features.js +44 -0
  24. package/dist/cli/background.d.ts +11 -0
  25. package/dist/cli/background.js +132 -0
  26. package/dist/cli/commands.d.ts +16 -0
  27. package/dist/cli/commands.js +515 -0
  28. package/dist/cli/context.d.ts +75 -0
  29. package/dist/cli/context.js +44 -0
  30. package/dist/cli/do-background.d.ts +27 -0
  31. package/dist/cli/do-background.js +212 -0
  32. package/dist/cli/do.d.ts +85 -0
  33. package/dist/cli/do.js +558 -0
  34. package/dist/cli/flows.d.ts +28 -0
  35. package/dist/cli/flows.js +303 -0
  36. package/dist/cli/identity.d.ts +37 -0
  37. package/dist/cli/identity.js +906 -0
  38. package/dist/cli/live.d.ts +7 -0
  39. package/dist/cli/live.js +99 -0
  40. package/dist/cli/main.d.ts +16 -0
  41. package/dist/cli/main.js +171 -0
  42. package/dist/cli/secret.d.ts +4 -0
  43. package/dist/cli/secret.js +151 -0
  44. package/dist/cli/session.d.ts +6 -0
  45. package/dist/cli/session.js +106 -0
  46. package/dist/cli/setup.d.ts +7 -0
  47. package/dist/cli/setup.js +180 -0
  48. package/dist/cli/vault.d.ts +5 -0
  49. package/dist/cli/vault.js +192 -0
  50. package/dist/client.d.ts +82 -0
  51. package/dist/client.js +303 -0
  52. package/dist/diagnose.d.ts +7 -0
  53. package/dist/diagnose.js +61 -6
  54. package/dist/doctor.d.ts +37 -3
  55. package/dist/doctor.js +264 -6
  56. package/dist/engine-attach.d.ts +27 -0
  57. package/dist/engine-attach.js +165 -0
  58. package/dist/engine-camoufox.d.ts +32 -0
  59. package/dist/engine-camoufox.js +271 -0
  60. package/dist/engine-lightpanda.d.ts +72 -0
  61. package/dist/engine-lightpanda.js +293 -0
  62. package/dist/engine.d.ts +63 -11
  63. package/dist/engine.js +106 -29
  64. package/dist/flows.d.ts +127 -0
  65. package/dist/flows.js +294 -0
  66. package/dist/governor.d.ts +42 -7
  67. package/dist/governor.js +82 -32
  68. package/dist/health.js +2 -1
  69. package/dist/host.d.ts +38 -2
  70. package/dist/host.js +689 -52
  71. package/dist/human-input.d.ts +84 -0
  72. package/dist/human-input.js +448 -0
  73. package/dist/humanize.d.ts +123 -0
  74. package/dist/humanize.js +241 -0
  75. package/dist/identities.js +4 -1
  76. package/dist/idle-timer.d.ts +12 -0
  77. package/dist/idle-timer.js +25 -0
  78. package/dist/index.d.ts +13 -4
  79. package/dist/index.js +7 -1
  80. package/dist/lifecycle.d.ts +11 -1
  81. package/dist/lifecycle.js +11 -2
  82. package/dist/live-client.d.ts +22 -0
  83. package/dist/live-client.js +95 -0
  84. package/dist/live-page.d.ts +4 -0
  85. package/dist/live-page.js +144 -0
  86. package/dist/live-server.d.ts +173 -0
  87. package/dist/live-server.js +643 -0
  88. package/dist/live.d.ts +120 -0
  89. package/dist/live.js +204 -0
  90. package/dist/login-tool.d.ts +13 -0
  91. package/dist/login-tool.js +8 -3
  92. package/dist/login.d.ts +4 -1
  93. package/dist/login.js +12 -2
  94. package/dist/names.d.ts +28 -0
  95. package/dist/names.js +25 -0
  96. package/dist/network-chrome.d.ts +74 -0
  97. package/dist/network-chrome.js +178 -0
  98. package/dist/network.d.ts +125 -0
  99. package/dist/network.js +264 -0
  100. package/dist/opt-in-settings.d.ts +69 -0
  101. package/dist/opt-in-settings.js +152 -0
  102. package/dist/recorder.d.ts +88 -0
  103. package/dist/recorder.js +538 -0
  104. package/dist/recordings.d.ts +116 -0
  105. package/dist/recordings.js +474 -0
  106. package/dist/redact.d.ts +7 -0
  107. package/dist/redact.js +18 -0
  108. package/dist/replay.d.ts +20 -0
  109. package/dist/replay.js +383 -0
  110. package/dist/reputation.d.ts +24 -2
  111. package/dist/reputation.js +63 -17
  112. package/dist/runtime-lock.js +3 -2
  113. package/dist/session-export.js +1 -1
  114. package/dist/session.d.ts +10 -2
  115. package/dist/session.js +10 -2
  116. package/dist/settings.d.ts +104 -2
  117. package/dist/settings.js +204 -6
  118. package/dist/sharing.d.ts +96 -0
  119. package/dist/sharing.js +269 -0
  120. package/dist/snippet.d.ts +8 -2
  121. package/dist/snippet.js +10 -4
  122. package/dist/tab-locks.d.ts +63 -0
  123. package/dist/tab-locks.js +179 -0
  124. package/dist/tools.d.ts +38 -0
  125. package/dist/tools.js +20 -1
  126. package/dist/tuning.d.ts +14 -0
  127. package/dist/tuning.js +9 -0
  128. package/dist/upstream.d.ts +11 -0
  129. package/dist/vault.js +5 -4
  130. package/npm-shrinkwrap.json +6 -5
  131. package/package.json +13 -7
package/dist/host.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
3
  import type { SecretStore } from "turno-core/secrets";
4
- import { type Engine, type IdentityRef } from "./engine.js";
5
- import { type TurnoTool } from "./tools.js";
4
+ import { type Engine, type EngineFlags, type IdentityRef } from "./engine.js";
5
+ import { type LiveFlags } from "./live.js";
6
+ import { LiveServer } from "./live-server.js";
7
+ import { type TabLockPolicy } from "./tab-locks.js";
8
+ import { type Providers, type TurnoTool } from "./tools.js";
6
9
  import { type Tuning, type TuningFlags } from "./tuning.js";
7
10
  import { type IdleTimerLike, type McpConfig, type ServerBackendFactory, type ToolResult, type ToolSchemaJson } from "./upstream.js";
8
11
  /** The name and version the server reports in `initialize`. */
@@ -23,6 +26,14 @@ export interface HostOptions {
23
26
  tuning?: TuningFlags;
24
27
  /** The secret store the vault reads (tests inject a fake); default: this machine's. */
25
28
  vaultStore?: SecretStore;
29
+ /** With `"sharing": "tabs"`: how long a call waits for a held tab, and when an idle session lets go. */
30
+ tabLocks?: Partial<TabLockPolicy>;
31
+ /** `--engine` and `--attach`; they win over identity.json. */
32
+ engineFlags?: EngineFlags;
33
+ /** Stand-ins for the opt-in providers (tests inject fakes). */
34
+ providers?: Providers;
35
+ /** `--live` and `--live-wait`; they win over identity.json `live`. */
36
+ live?: LiveFlags;
26
37
  }
27
38
  export interface Host {
28
39
  config: McpConfig;
@@ -31,6 +42,8 @@ export interface Host {
31
42
  factory: ServerBackendFactory;
32
43
  /** Hides vault values in a text this server is about to send. */
33
44
  redact(text: string): string;
45
+ /** The live view server, when the live view is on for the identity served. */
46
+ live?: LiveServer;
34
47
  }
35
48
  /** Upstream joins the text parts of a result into one (`mergeTextParts`). */
36
49
  export declare function mergeTextParts(result: ToolResult): ToolResult;
@@ -68,6 +81,22 @@ export declare class CallIdleTimer implements IdleTimerLike {
68
81
  export declare function configForSession(config: McpConfig, cliOptions: Record<string, unknown>, tuning: Tuning): McpConfig;
69
82
  /** Builds the host for a resolved config: tool list, engine and session factory. */
70
83
  export declare function createHost(options: HostOptions): Host;
84
+ /**
85
+ * One browser for many connections: the background server's host. Each connection gets its own
86
+ * MCP server, and every one of them calls the same session backend, so the connections share the
87
+ * identity's one Chrome the way mcpd's client sessions share one stdio server. The caller puts
88
+ * each connection's client session in the `_meta` of its calls (`SESSION_META_KEY`), which keys
89
+ * the tabs of `"sharing": "tabs"`, and ends it with `endSession`.
90
+ */
91
+ export interface SharedHost {
92
+ /** Serves one connection on `transport`. Closing it leaves the browser open. */
93
+ connect(transport: Transport): Promise<Server>;
94
+ /** A client session ended: with `"sharing": "tabs"` its tabs are free at once. */
95
+ endSession(session: string): Promise<void>;
96
+ /** Closes the browser. */
97
+ dispose(): Promise<void>;
98
+ }
99
+ export declare function shareHost(host: Host): SharedHost;
71
100
  /** Serves the host: stdio by turno, `--port` by upstream's HTTP server. */
72
101
  export declare function serve(host: Host, transport?: Transport): Promise<Server | undefined>;
73
102
  /**
@@ -77,4 +106,11 @@ export declare function serve(host: Host, transport?: Transport): Promise<Server
77
106
  export declare function runHost(args: string[], options?: {
78
107
  identity?: IdentityRef;
79
108
  tuning?: TuningFlags;
109
+ engineFlags?: EngineFlags;
110
+ live?: LiveFlags;
111
+ /**
112
+ * Serves the host instead of stdio or `--port` (`--background`). Such a server has no client
113
+ * on stdin, so upstream's watchdog, which exits when stdin closes, is not installed.
114
+ */
115
+ serve?: (host: Host) => Promise<void>;
80
116
  }): Promise<void>;