@ulpi/browse 2.3.3 → 2.4.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 (279) hide show
  1. package/README.md +8 -2
  2. package/dist/browse.cjs +3445 -1636
  3. package/dist/lib.mjs +29504 -0
  4. package/dist/types/a11y.d.ts +32 -0
  5. package/dist/types/a11y.d.ts.map +1 -0
  6. package/dist/types/app/android/bridge.d.ts +41 -0
  7. package/dist/types/app/android/bridge.d.ts.map +1 -0
  8. package/dist/types/app/android/emulator.d.ts +32 -0
  9. package/dist/types/app/android/emulator.d.ts.map +1 -0
  10. package/dist/types/app/android/manager.d.ts +62 -0
  11. package/dist/types/app/android/manager.d.ts.map +1 -0
  12. package/dist/types/app/android/protocol.d.ts +162 -0
  13. package/dist/types/app/android/protocol.d.ts.map +1 -0
  14. package/dist/types/app/android/sim-service.d.ts +33 -0
  15. package/dist/types/app/android/sim-service.d.ts.map +1 -0
  16. package/dist/types/app/index.d.ts +15 -0
  17. package/dist/types/app/index.d.ts.map +1 -0
  18. package/dist/types/app/ios/bridge.d.ts +53 -0
  19. package/dist/types/app/ios/bridge.d.ts.map +1 -0
  20. package/dist/types/app/ios/controller.d.ts +131 -0
  21. package/dist/types/app/ios/controller.d.ts.map +1 -0
  22. package/dist/types/app/ios/manager.d.ts +96 -0
  23. package/dist/types/app/ios/manager.d.ts.map +1 -0
  24. package/dist/types/app/ios/protocol.d.ts +122 -0
  25. package/dist/types/app/ios/protocol.d.ts.map +1 -0
  26. package/dist/types/app/ios/sim-service.d.ts +37 -0
  27. package/dist/types/app/ios/sim-service.d.ts.map +1 -0
  28. package/dist/types/app/macos/bridge.d.ts +22 -0
  29. package/dist/types/app/macos/bridge.d.ts.map +1 -0
  30. package/dist/types/app/manager.d.ts +50 -0
  31. package/dist/types/app/manager.d.ts.map +1 -0
  32. package/dist/types/app/normalize.d.ts +27 -0
  33. package/dist/types/app/normalize.d.ts.map +1 -0
  34. package/dist/types/app/resolve-app.d.ts +31 -0
  35. package/dist/types/app/resolve-app.d.ts.map +1 -0
  36. package/dist/types/app/types.d.ts +77 -0
  37. package/dist/types/app/types.d.ts.map +1 -0
  38. package/dist/types/automation/action-context.d.ts +110 -0
  39. package/dist/types/automation/action-context.d.ts.map +1 -0
  40. package/dist/types/automation/command.d.ts +138 -0
  41. package/dist/types/automation/command.d.ts.map +1 -0
  42. package/dist/types/automation/events.d.ts +72 -0
  43. package/dist/types/automation/events.d.ts.map +1 -0
  44. package/dist/types/automation/executor.d.ts +39 -0
  45. package/dist/types/automation/executor.d.ts.map +1 -0
  46. package/dist/types/automation/index.d.ts +11 -0
  47. package/dist/types/automation/index.d.ts.map +1 -0
  48. package/dist/types/automation/registry.d.ts +38 -0
  49. package/dist/types/automation/registry.d.ts.map +1 -0
  50. package/dist/types/automation/rules.d.ts +52 -0
  51. package/dist/types/automation/rules.d.ts.map +1 -0
  52. package/dist/types/automation/target.d.ts +76 -0
  53. package/dist/types/automation/target.d.ts.map +1 -0
  54. package/dist/types/browser/consent.d.ts +13 -0
  55. package/dist/types/browser/consent.d.ts.map +1 -0
  56. package/dist/types/browser/cookie-import.d.ts +94 -0
  57. package/dist/types/browser/cookie-import.d.ts.map +1 -0
  58. package/dist/types/browser/detection.d.ts +22 -0
  59. package/dist/types/browser/detection.d.ts.map +1 -0
  60. package/dist/types/browser/emulation.d.ts +30 -0
  61. package/dist/types/browser/emulation.d.ts.map +1 -0
  62. package/dist/types/browser/events.d.ts +19 -0
  63. package/dist/types/browser/events.d.ts.map +1 -0
  64. package/dist/types/browser/index.d.ts +17 -0
  65. package/dist/types/browser/index.d.ts.map +1 -0
  66. package/dist/types/browser/macros.d.ts +9 -0
  67. package/dist/types/browser/macros.d.ts.map +1 -0
  68. package/dist/types/browser/manager.d.ts +272 -0
  69. package/dist/types/browser/manager.d.ts.map +1 -0
  70. package/dist/types/browser/png-compare.d.ts +36 -0
  71. package/dist/types/browser/png-compare.d.ts.map +1 -0
  72. package/dist/types/browser/profiles.d.ts +29 -0
  73. package/dist/types/browser/profiles.d.ts.map +1 -0
  74. package/dist/types/browser/react-devtools.d.ts +75 -0
  75. package/dist/types/browser/react-devtools.d.ts.map +1 -0
  76. package/dist/types/browser/readiness.d.ts +19 -0
  77. package/dist/types/browser/readiness.d.ts.map +1 -0
  78. package/dist/types/browser/refs.d.ts +70 -0
  79. package/dist/types/browser/refs.d.ts.map +1 -0
  80. package/dist/types/browser/serp.d.ts +16 -0
  81. package/dist/types/browser/serp.d.ts.map +1 -0
  82. package/dist/types/browser/snapshot-window.d.ts +31 -0
  83. package/dist/types/browser/snapshot-window.d.ts.map +1 -0
  84. package/dist/types/browser/snapshot.d.ts +41 -0
  85. package/dist/types/browser/snapshot.d.ts.map +1 -0
  86. package/dist/types/browser/tabs.d.ts +67 -0
  87. package/dist/types/browser/tabs.d.ts.map +1 -0
  88. package/dist/types/browser/target.d.ts +106 -0
  89. package/dist/types/browser/target.d.ts.map +1 -0
  90. package/dist/types/browser/youtube.d.ts +26 -0
  91. package/dist/types/browser/youtube.d.ts.map +1 -0
  92. package/dist/types/cli.d.ts +14 -0
  93. package/dist/types/cli.d.ts.map +1 -0
  94. package/dist/types/cloud/auth.d.ts +80 -0
  95. package/dist/types/cloud/auth.d.ts.map +1 -0
  96. package/dist/types/cloud/docker.d.ts +76 -0
  97. package/dist/types/cloud/docker.d.ts.map +1 -0
  98. package/dist/types/cloud/firecracker.d.ts +142 -0
  99. package/dist/types/cloud/firecracker.d.ts.map +1 -0
  100. package/dist/types/cloud/golden-snapshot.d.ts +122 -0
  101. package/dist/types/cloud/golden-snapshot.d.ts.map +1 -0
  102. package/dist/types/cloud/index.d.ts +26 -0
  103. package/dist/types/cloud/index.d.ts.map +1 -0
  104. package/dist/types/cloud/orchestrator-interface.d.ts +63 -0
  105. package/dist/types/cloud/orchestrator-interface.d.ts.map +1 -0
  106. package/dist/types/cloud/orchestrator.d.ts +58 -0
  107. package/dist/types/cloud/orchestrator.d.ts.map +1 -0
  108. package/dist/types/cloud/proxy.d.ts +34 -0
  109. package/dist/types/cloud/proxy.d.ts.map +1 -0
  110. package/dist/types/cloud/reaper.d.ts +49 -0
  111. package/dist/types/cloud/reaper.d.ts.map +1 -0
  112. package/dist/types/cloud/server.d.ts +19 -0
  113. package/dist/types/cloud/server.d.ts.map +1 -0
  114. package/dist/types/cloud/sessions.d.ts +85 -0
  115. package/dist/types/cloud/sessions.d.ts.map +1 -0
  116. package/dist/types/cloud/vm-orchestrator.d.ts +133 -0
  117. package/dist/types/cloud/vm-orchestrator.d.ts.map +1 -0
  118. package/dist/types/cloud/vm-warm-pool.d.ts +104 -0
  119. package/dist/types/cloud/vm-warm-pool.d.ts.map +1 -0
  120. package/dist/types/cloud/warm-pool.d.ts +85 -0
  121. package/dist/types/cloud/warm-pool.d.ts.map +1 -0
  122. package/dist/types/cloud/ws.d.ts +61 -0
  123. package/dist/types/cloud/ws.d.ts.map +1 -0
  124. package/dist/types/commands/meta/auth.d.ts +6 -0
  125. package/dist/types/commands/meta/auth.d.ts.map +1 -0
  126. package/dist/types/commands/meta/flows.d.ts +15 -0
  127. package/dist/types/commands/meta/flows.d.ts.map +1 -0
  128. package/dist/types/commands/meta/index.d.ts +14 -0
  129. package/dist/types/commands/meta/index.d.ts.map +1 -0
  130. package/dist/types/commands/meta/inspection.d.ts +7 -0
  131. package/dist/types/commands/meta/inspection.d.ts.map +1 -0
  132. package/dist/types/commands/meta/profile.d.ts +11 -0
  133. package/dist/types/commands/meta/profile.d.ts.map +1 -0
  134. package/dist/types/commands/meta/recording.d.ts +7 -0
  135. package/dist/types/commands/meta/recording.d.ts.map +1 -0
  136. package/dist/types/commands/meta/screenshots.d.ts +7 -0
  137. package/dist/types/commands/meta/screenshots.d.ts.map +1 -0
  138. package/dist/types/commands/meta/sessions.d.ts +7 -0
  139. package/dist/types/commands/meta/sessions.d.ts.map +1 -0
  140. package/dist/types/commands/meta/sim.d.ts +10 -0
  141. package/dist/types/commands/meta/sim.d.ts.map +1 -0
  142. package/dist/types/commands/meta/system.d.ts +8 -0
  143. package/dist/types/commands/meta/system.d.ts.map +1 -0
  144. package/dist/types/commands/meta/tabs.d.ts +6 -0
  145. package/dist/types/commands/meta/tabs.d.ts.map +1 -0
  146. package/dist/types/commands/meta/youtube.d.ts +7 -0
  147. package/dist/types/commands/meta/youtube.d.ts.map +1 -0
  148. package/dist/types/commands/read.d.ts +16 -0
  149. package/dist/types/commands/read.d.ts.map +1 -0
  150. package/dist/types/commands/write.d.ts +17 -0
  151. package/dist/types/commands/write.d.ts.map +1 -0
  152. package/dist/types/config.d.ts +101 -0
  153. package/dist/types/config.d.ts.map +1 -0
  154. package/dist/types/constants.d.ts +36 -0
  155. package/dist/types/constants.d.ts.map +1 -0
  156. package/dist/types/detection/frameworks.d.ts +27 -0
  157. package/dist/types/detection/frameworks.d.ts.map +1 -0
  158. package/dist/types/detection/index.d.ts +64 -0
  159. package/dist/types/detection/index.d.ts.map +1 -0
  160. package/dist/types/detection/infrastructure.d.ts +82 -0
  161. package/dist/types/detection/infrastructure.d.ts.map +1 -0
  162. package/dist/types/detection/saas.d.ts +39 -0
  163. package/dist/types/detection/saas.d.ts.map +1 -0
  164. package/dist/types/enable.d.ts +10 -0
  165. package/dist/types/enable.d.ts.map +1 -0
  166. package/dist/types/engine/chrome.d.ts +45 -0
  167. package/dist/types/engine/chrome.d.ts.map +1 -0
  168. package/dist/types/engine/index.d.ts +9 -0
  169. package/dist/types/engine/index.d.ts.map +1 -0
  170. package/dist/types/engine/providers.d.ts +36 -0
  171. package/dist/types/engine/providers.d.ts.map +1 -0
  172. package/dist/types/engine/resolver.d.ts +36 -0
  173. package/dist/types/engine/resolver.d.ts.map +1 -0
  174. package/dist/types/expect.d.ts +68 -0
  175. package/dist/types/expect.d.ts.map +1 -0
  176. package/dist/types/export/index.d.ts +8 -0
  177. package/dist/types/export/index.d.ts.map +1 -0
  178. package/dist/types/export/record.d.ts +28 -0
  179. package/dist/types/export/record.d.ts.map +1 -0
  180. package/dist/types/export/replay.d.ts +9 -0
  181. package/dist/types/export/replay.d.ts.map +1 -0
  182. package/dist/types/flow-parser.d.ts +32 -0
  183. package/dist/types/flow-parser.d.ts.map +1 -0
  184. package/dist/types/install-skill.d.ts +8 -0
  185. package/dist/types/install-skill.d.ts.map +1 -0
  186. package/dist/types/lib.d.ts +27 -0
  187. package/dist/types/lib.d.ts.map +1 -0
  188. package/dist/types/mcp/index.d.ts +10 -0
  189. package/dist/types/mcp/index.d.ts.map +1 -0
  190. package/dist/types/mcp/server.d.ts +9 -0
  191. package/dist/types/mcp/server.d.ts.map +1 -0
  192. package/dist/types/mcp/tools/index.d.ts +36 -0
  193. package/dist/types/mcp/tools/index.d.ts.map +1 -0
  194. package/dist/types/network/buffers.d.ts +53 -0
  195. package/dist/types/network/buffers.d.ts.map +1 -0
  196. package/dist/types/network/har.d.ts +10 -0
  197. package/dist/types/network/har.d.ts.map +1 -0
  198. package/dist/types/network/index.d.ts +6 -0
  199. package/dist/types/network/index.d.ts.map +1 -0
  200. package/dist/types/perf-audit/diff.d.ts +43 -0
  201. package/dist/types/perf-audit/diff.d.ts.map +1 -0
  202. package/dist/types/perf-audit/dom-analysis.d.ts +74 -0
  203. package/dist/types/perf-audit/dom-analysis.d.ts.map +1 -0
  204. package/dist/types/perf-audit/formatter.d.ts +34 -0
  205. package/dist/types/perf-audit/formatter.d.ts.map +1 -0
  206. package/dist/types/perf-audit/index.d.ts +128 -0
  207. package/dist/types/perf-audit/index.d.ts.map +1 -0
  208. package/dist/types/perf-audit/persist.d.ts +40 -0
  209. package/dist/types/perf-audit/persist.d.ts.map +1 -0
  210. package/dist/types/perf-audit/recommendations.d.ts +18 -0
  211. package/dist/types/perf-audit/recommendations.d.ts.map +1 -0
  212. package/dist/types/perf-audit/resource-analyzer.d.ts +46 -0
  213. package/dist/types/perf-audit/resource-analyzer.d.ts.map +1 -0
  214. package/dist/types/perf-audit/web-vitals.d.ts +73 -0
  215. package/dist/types/perf-audit/web-vitals.d.ts.map +1 -0
  216. package/dist/types/proxy/index.d.ts +6 -0
  217. package/dist/types/proxy/index.d.ts.map +1 -0
  218. package/dist/types/proxy/pool.d.ts +44 -0
  219. package/dist/types/proxy/pool.d.ts.map +1 -0
  220. package/dist/types/proxy/providers.d.ts +32 -0
  221. package/dist/types/proxy/providers.d.ts.map +1 -0
  222. package/dist/types/sdk/client.d.ts +37 -0
  223. package/dist/types/sdk/client.d.ts.map +1 -0
  224. package/dist/types/sdk/index.d.ts +17 -0
  225. package/dist/types/sdk/index.d.ts.map +1 -0
  226. package/dist/types/sdk/session.d.ts +95 -0
  227. package/dist/types/sdk/session.d.ts.map +1 -0
  228. package/dist/types/sdk/transports/cloud.d.ts +89 -0
  229. package/dist/types/sdk/transports/cloud.d.ts.map +1 -0
  230. package/dist/types/sdk/transports/index.d.ts +3 -0
  231. package/dist/types/sdk/transports/index.d.ts.map +1 -0
  232. package/dist/types/sdk/transports/local.d.ts +56 -0
  233. package/dist/types/sdk/transports/local.d.ts.map +1 -0
  234. package/dist/types/sdk.d.ts +35 -0
  235. package/dist/types/sdk.d.ts.map +1 -0
  236. package/dist/types/security/auth-vault.d.ts +32 -0
  237. package/dist/types/security/auth-vault.d.ts.map +1 -0
  238. package/dist/types/security/domain-filter.d.ts +31 -0
  239. package/dist/types/security/domain-filter.d.ts.map +1 -0
  240. package/dist/types/security/index.d.ts +10 -0
  241. package/dist/types/security/index.d.ts.map +1 -0
  242. package/dist/types/security/policy.d.ts +20 -0
  243. package/dist/types/security/policy.d.ts.map +1 -0
  244. package/dist/types/security/sanitize.d.ts +6 -0
  245. package/dist/types/security/sanitize.d.ts.map +1 -0
  246. package/dist/types/server.d.ts +13 -0
  247. package/dist/types/server.d.ts.map +1 -0
  248. package/dist/types/session/concurrency.d.ts +28 -0
  249. package/dist/types/session/concurrency.d.ts.map +1 -0
  250. package/dist/types/session/encryption.d.ts +8 -0
  251. package/dist/types/session/encryption.d.ts.map +1 -0
  252. package/dist/types/session/index.d.ts +7 -0
  253. package/dist/types/session/index.d.ts.map +1 -0
  254. package/dist/types/session/manager.d.ts +110 -0
  255. package/dist/types/session/manager.d.ts.map +1 -0
  256. package/dist/types/session/persist.d.ts +87 -0
  257. package/dist/types/session/persist.d.ts.map +1 -0
  258. package/dist/types/session/tab-lock.d.ts +26 -0
  259. package/dist/types/session/tab-lock.d.ts.map +1 -0
  260. package/dist/types/session/target-factory.d.ts +88 -0
  261. package/dist/types/session/target-factory.d.ts.map +1 -0
  262. package/dist/types/sim-cli.d.ts +8 -0
  263. package/dist/types/sim-cli.d.ts.map +1 -0
  264. package/dist/types/types.d.ts +45 -0
  265. package/dist/types/types.d.ts.map +1 -0
  266. package/dist/types/visual.d.ts +79 -0
  267. package/dist/types/visual.d.ts.map +1 -0
  268. package/package.json +22 -3
  269. package/skill/browse/SKILL.md +286 -0
  270. package/skill/{references → browse/references}/commands.md +203 -18
  271. package/skill/browse-aeo/SKILL.md +148 -0
  272. package/skill/browse-config/SKILL.md +200 -0
  273. package/skill/browse-geo/SKILL.md +225 -0
  274. package/skill/browse-qa/SKILL.md +143 -0
  275. package/skill/browse-seo/SKILL.md +188 -0
  276. package/skill/browse-stealth/SKILL.md +246 -0
  277. package/skill/SKILL.md +0 -496
  278. /package/skill/{references → browse/references}/guides.md +0 -0
  279. /package/skill/{references → browse/references}/permissions.md +0 -0
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Proxy module — proxy pool, providers, and configuration.
3
+ */
4
+ export { type ProxyProvider, type SessionOptions, decodoProvider, genericProvider, getProvider, registerProvider, normalizePlaywrightProxy } from './providers';
5
+ export { type ProxyPool, type ProxyPoolConfig, type ProxyConfig, createProxyPool, buildProxyUrl } from './pool';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proxy/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAChK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Proxy pool — assigns different proxies to different browser contexts.
3
+ * Supports round-robin (fixed port list) and backconnect (sticky sessions via provider).
4
+ */
5
+ import { type ProxyProvider } from './providers';
6
+ export interface ProxyConfig {
7
+ server: string;
8
+ username?: string;
9
+ password?: string;
10
+ sessionId?: string;
11
+ }
12
+ export interface ProxyPoolConfig {
13
+ strategy: 'round_robin' | 'backconnect';
14
+ host?: string;
15
+ ports?: number[];
16
+ username?: string;
17
+ password?: string;
18
+ backconnectHost?: string;
19
+ backconnectPort?: number;
20
+ providerName?: string;
21
+ country?: string;
22
+ state?: string;
23
+ city?: string;
24
+ sessionDurationMinutes?: number;
25
+ }
26
+ export interface ProxyPool {
27
+ mode: 'round_robin' | 'backconnect';
28
+ provider: ProxyProvider | null;
29
+ canRotateSessions: boolean;
30
+ launchRetries: number;
31
+ launchTimeoutMs: number;
32
+ size: number;
33
+ getLaunchProxy(sessionId?: string): ProxyConfig;
34
+ getNext(sessionId?: string): ProxyConfig;
35
+ }
36
+ /**
37
+ * Create a proxy pool from configuration. Returns null if required fields are missing.
38
+ */
39
+ export declare function createProxyPool(config: ProxyPoolConfig): ProxyPool | null;
40
+ /**
41
+ * Build a proxy URL string (http://user:pass@host:port) for CLI tools.
42
+ */
43
+ export declare function buildProxyUrl(pool: ProxyPool, config: ProxyPoolConfig): string | null;
44
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/proxy/pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAyC,KAAK,aAAa,EAAE,MA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0,0 +1,32 @@
1
+ /**
2
+ * Proxy providers — pluggable proxy credential shaping and capability declaration.
3
+ * Each provider knows how to build usernames for sticky sessions.
4
+ */
5
+ export interface SessionOptions {
6
+ country?: string;
7
+ state?: string;
8
+ city?: string;
9
+ zip?: string;
10
+ sessionId?: string;
11
+ sessionDurationMinutes?: number;
12
+ }
13
+ export interface ProxyProvider {
14
+ name: string;
15
+ canRotateSessions: boolean;
16
+ launchRetries: number;
17
+ launchTimeoutMs: number;
18
+ buildSessionUsername(baseUsername: string, options?: SessionOptions): string;
19
+ }
20
+ /** Decodo residential proxy provider. Username DSL: user-{base}-country-{cc}-session-{id} */
21
+ export declare const decodoProvider: ProxyProvider;
22
+ /** Generic backconnect provider — pass-through username with session suffix. */
23
+ export declare const genericProvider: ProxyProvider;
24
+ export declare function getProvider(name: string): ProxyProvider | null;
25
+ export declare function registerProvider(name: string, provider: ProxyProvider): void;
26
+ /** Decode percent-encoded proxy credentials for Playwright compatibility. */
27
+ export declare function normalizePlaywrightProxy(proxy: {
28
+ server: string;
29
+ username?: string;
30
+ password?: string;
31
+ }): typeof proxy;
32
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../src/proxy/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;CAC9E;AAOD,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,aAqB5B,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,eAAe,EAAE,aAU7B,CAAC;AAOF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAE9D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAE5E;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,KAAK,CAOtH"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * BrowseClient — factory for creating BrowseSession instances.
3
+ *
4
+ * Automatically selects the right transport based on options:
5
+ * - No endpoint/apiKey -> LocalTransport (HTTP to local server)
6
+ * - endpoint + apiKey -> CloudTransport (HTTPS to browse cloud)
7
+ */
8
+ import { BrowseSession } from './session.js';
9
+ export interface ConnectOptions {
10
+ /** Cloud API endpoint URL. If provided with apiKey, uses cloud transport. */
11
+ endpoint?: string;
12
+ /** API key for cloud authentication. */
13
+ apiKey?: string;
14
+ /** Session ID for multiplexing (works with both local and cloud). */
15
+ session?: string;
16
+ /** Override state file path for local transport. */
17
+ stateFile?: string;
18
+ /** Command timeout in milliseconds (default: 30000). */
19
+ timeout?: number;
20
+ }
21
+ export declare class BrowseClient {
22
+ /**
23
+ * Connect to a browse server and return a typed session.
24
+ *
25
+ * Local (default):
26
+ * const session = await BrowseClient.connect();
27
+ * const session = await BrowseClient.connect({ session: 'agent-1' });
28
+ *
29
+ * Cloud:
30
+ * const session = await BrowseClient.connect({
31
+ * endpoint: 'https://api.browse.dev',
32
+ * apiKey: 'brw_...',
33
+ * });
34
+ */
35
+ static connect(opts?: ConnectOptions): Promise<BrowseSession>;
36
+ }
37
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/sdk/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM7C,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,qBAAa,YAAY;IACvB;;;;;;;;;;;;OAYG;WACU,OAAO,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;CA8BxE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @ulpi/browse SDK — programmatic API for browse automation.
3
+ *
4
+ * Usage:
5
+ * import { BrowseClient } from './sdk/index.js';
6
+ *
7
+ * const session = await BrowseClient.connect();
8
+ * await session.goto('https://example.com');
9
+ * const text = await session.text();
10
+ * console.log(text);
11
+ * await session.close();
12
+ */
13
+ export { BrowseClient, type ConnectOptions } from './client.js';
14
+ export { BrowseSession, type Transport, type SnapshotOptions } from './session.js';
15
+ export { LocalTransport, type LocalTransportOptions } from './transports/local.js';
16
+ export { CloudTransport, CloudApiError, type CloudTransportOptions } from './transports/cloud.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * BrowseSession — typed wrapper around a browse transport.
3
+ *
4
+ * Provides ergonomic methods for every browse command category:
5
+ * navigation, content extraction, interaction, evaluation, and meta.
6
+ * Each method delegates to the underlying Transport.execute().
7
+ */
8
+ /**
9
+ * Transport contract — any mechanism that can send a browse command
10
+ * and return its text output. Implementations:
11
+ * - LocalTransport (HTTP to local server)
12
+ * - CloudTransport (HTTPS to browse cloud API)
13
+ */
14
+ export interface Transport {
15
+ execute(command: string, args: string[]): Promise<string>;
16
+ close(): Promise<void>;
17
+ }
18
+ export interface SnapshotOptions {
19
+ /** Include interactive elements with @ref IDs (-i flag) */
20
+ interactive?: boolean;
21
+ /** Include cursor-interactive elements like div.onclick (-C flag) */
22
+ clickable?: boolean;
23
+ /** Max tree depth (-d flag) */
24
+ depth?: number;
25
+ /** Scope to a CSS selector (-s flag) */
26
+ selector?: string;
27
+ }
28
+ export declare class BrowseSession {
29
+ private transport;
30
+ readonly sessionId?: string | undefined;
31
+ constructor(transport: Transport, sessionId?: string | undefined);
32
+ goto(url: string): Promise<string>;
33
+ back(): Promise<string>;
34
+ forward(): Promise<string>;
35
+ reload(): Promise<string>;
36
+ text(): Promise<string>;
37
+ html(selector?: string): Promise<string>;
38
+ links(): Promise<string>;
39
+ forms(): Promise<string>;
40
+ accessibility(): Promise<string>;
41
+ snapshot(opts?: SnapshotOptions): Promise<string>;
42
+ value(selector: string): Promise<string>;
43
+ count(selector: string): Promise<string>;
44
+ css(selector: string, property: string): Promise<string>;
45
+ attrs(selector: string): Promise<string>;
46
+ elementState(selector: string): Promise<string>;
47
+ click(selector: string): Promise<string>;
48
+ dblclick(selector: string): Promise<string>;
49
+ fill(selector: string, value: string): Promise<string>;
50
+ select(selector: string, value: string): Promise<string>;
51
+ hover(selector: string): Promise<string>;
52
+ focus(selector: string): Promise<string>;
53
+ check(selector: string): Promise<string>;
54
+ uncheck(selector: string): Promise<string>;
55
+ type(text: string): Promise<string>;
56
+ press(key: string): Promise<string>;
57
+ scroll(target?: string): Promise<string>;
58
+ drag(source: string, target: string): Promise<string>;
59
+ highlight(selector: string): Promise<string>;
60
+ upload(selector: string, ...files: string[]): Promise<string>;
61
+ download(selector: string, path?: string): Promise<string>;
62
+ dialog(): Promise<string>;
63
+ dialogAccept(text?: string): Promise<string>;
64
+ dialogDismiss(): Promise<string>;
65
+ js(expression: string): Promise<string>;
66
+ eval(filePath: string): Promise<string>;
67
+ wait(selectorOrFlag: string): Promise<string>;
68
+ screenshot(path?: string): Promise<string>;
69
+ pdf(path?: string): Promise<string>;
70
+ responsive(prefix?: string): Promise<string>;
71
+ screenshotDiff(baseline: string, current?: string): Promise<string>;
72
+ tabs(): Promise<string>;
73
+ tab(id: string): Promise<string>;
74
+ newtab(url?: string): Promise<string>;
75
+ closetab(id?: string): Promise<string>;
76
+ url(): Promise<string>;
77
+ cookies(): Promise<string>;
78
+ storage(action?: string, key?: string, value?: string): Promise<string>;
79
+ perf(): Promise<string>;
80
+ console(opts?: {
81
+ clear?: boolean;
82
+ }): Promise<string>;
83
+ network(opts?: {
84
+ clear?: boolean;
85
+ }): Promise<string>;
86
+ viewport(size: string): Promise<string>;
87
+ cookie(nameValue: string): Promise<string>;
88
+ header(nameValue: string): Promise<string>;
89
+ useragent(ua: string): Promise<string>;
90
+ emulate(device: string): Promise<string>;
91
+ offline(mode?: 'on' | 'off'): Promise<string>;
92
+ route(pattern: string, action: string): Promise<string>;
93
+ close(): Promise<void>;
94
+ }
95
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +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AC;IAItB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQvE,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAMvB,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpD,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAMpD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1C,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAItC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMvD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * CloudTransport — talks to a browse cloud API via HTTPS (or HTTP for dev).
3
+ *
4
+ * Authenticates with an API key, receives a JWT, and sends commands
5
+ * as authenticated HTTP requests. Handles JWT auto-refresh (60s before
6
+ * expiry) and 401 retry.
7
+ *
8
+ * API contract (cloud server — built in parallel):
9
+ * POST /v1/auth { apiKey } -> { token, expiresIn, tenantId }
10
+ * POST /v1/sessions (JWT) -> { sessionId, createdAt }
11
+ * POST /v1/sessions/:id/command { command, args } -> { output, durationMs }
12
+ * DELETE /v1/sessions/:id -> 204
13
+ * POST /v1/sessions/:id/freeze -> 200
14
+ * POST /v1/sessions/:id/resume -> 200
15
+ */
16
+ import type { Transport } from '../session.js';
17
+ export interface CloudTransportOptions {
18
+ /** Cloud API endpoint URL (e.g., 'https://api.browse.dev' or 'http://localhost:8400') */
19
+ endpoint: string;
20
+ /** API key for authentication */
21
+ apiKey: string;
22
+ /** Session ID — if not provided, one is provisioned on connect */
23
+ sessionId?: string;
24
+ /** Request timeout in ms (default 30000) */
25
+ timeout?: number;
26
+ }
27
+ export declare class CloudTransport implements Transport {
28
+ /** Session ID — publicly readable for BrowseClient to pass to BrowseSession. */
29
+ sessionId: string | undefined;
30
+ private endpoint;
31
+ private apiKey;
32
+ private timeout;
33
+ private jwt;
34
+ private jwtExpiresAt;
35
+ private connected;
36
+ /** Parsed URL components for request routing. */
37
+ private parsedUrl;
38
+ private useHttps;
39
+ constructor(opts: CloudTransportOptions);
40
+ /**
41
+ * Authenticate with the API key and optionally provision a session.
42
+ * Idempotent — safe to call multiple times.
43
+ */
44
+ connect(): Promise<void>;
45
+ /**
46
+ * Send a command to the cloud session.
47
+ * Auto-refreshes the JWT if expired (or within 60s of expiry).
48
+ * Retries once on 401 (token rejected by server).
49
+ */
50
+ execute(command: string, args: string[]): Promise<string>;
51
+ /**
52
+ * Close the cloud session (best-effort DELETE).
53
+ */
54
+ close(): Promise<void>;
55
+ /**
56
+ * Freeze the cloud session (persist state for later resume).
57
+ * Requires cloud server with freeze/resume routes (POST /v1/sessions/:id/freeze|resume).
58
+ */
59
+ freeze(): Promise<void>;
60
+ /**
61
+ * Resume a previously frozen cloud session.
62
+ * Requires cloud server with freeze/resume routes (POST /v1/sessions/:id/freeze|resume).
63
+ */
64
+ resume(): Promise<void>;
65
+ /**
66
+ * Authenticate with the API key and store the JWT + expiry.
67
+ */
68
+ private authenticate;
69
+ /**
70
+ * Re-authenticate if the JWT is expired or within 60s of expiry.
71
+ */
72
+ private ensureValidJwt;
73
+ /**
74
+ * Generic HTTP/HTTPS request using native modules.
75
+ * Selects http vs https based on the endpoint URL.
76
+ * Sets Content-Type and Authorization headers.
77
+ * Parses JSON response. Throws CloudApiError on non-2xx.
78
+ */
79
+ private request;
80
+ }
81
+ /**
82
+ * Error with HTTP status code from the cloud API.
83
+ * Extends Error so it propagates naturally through promise chains.
84
+ */
85
+ export declare class CloudApiError extends Error {
86
+ readonly statusCode: number;
87
+ constructor(statusCode: number, message: string);
88
+ }
89
+ //# sourceMappingURL=cloud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../../../src/sdk/transports/cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,WAAW,qBAAqB;IACpC,yFAAyF;IACzF,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAoBD,qBAAa,cAAe,YAAW,SAAS;IAC9C,gFAAgF;IACzE,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,SAAS,CAAkB;IAEnC,iDAAiD;IACjD,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,QAAQ,CAAU;gBAEd,IAAI,EAAE,qBAAqB;IAavC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAa9B;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAyB/D;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B;;OAEG;YACW,YAAY;IAa1B;;OAEG;YACW,cAAc;IAQ5B;;;;;OAKG;IACH,OAAO,CAAC,OAAO;CA6GhB;AAID;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;aAEpB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM,EAClC,OAAO,EAAE,MAAM;CAKlB"}
@@ -0,0 +1,3 @@
1
+ export { LocalTransport, type LocalTransportOptions } from './local.js';
2
+ export { CloudTransport, CloudApiError, type CloudTransportOptions } from './cloud.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * LocalTransport — talks to a local browse server via HTTP.
3
+ *
4
+ * Reads the server state file (.browse/browse-server.json) to discover
5
+ * the port and auth token. Does NOT auto-start the server — callers
6
+ * should ensure the server is running before connecting (e.g. via `browse status`).
7
+ *
8
+ * State file discovery mirrors the CLI logic in src/cli.ts:
9
+ * 1. Explicit stateFile option
10
+ * 2. BROWSE_STATE_FILE env var
11
+ * 3. Walk up from cwd looking for .browse/browse-server.json
12
+ * 4. Fallback to /tmp/browse-server.json
13
+ */
14
+ import type { Transport } from '../session.js';
15
+ export interface LocalTransportOptions {
16
+ /** Override state file path (skips discovery) */
17
+ stateFile?: string;
18
+ /** Session ID for multiplexing */
19
+ session?: string;
20
+ /** Command timeout in milliseconds (default: 30000) */
21
+ timeout?: number;
22
+ }
23
+ export declare class LocalTransport implements Transport {
24
+ private opts;
25
+ private port;
26
+ private token;
27
+ private session;
28
+ private timeout;
29
+ private connected;
30
+ constructor(opts?: LocalTransportOptions);
31
+ /**
32
+ * Read the server state file and extract port + token.
33
+ * Must be called before execute(), or execute() will call it lazily.
34
+ */
35
+ connect(): Promise<void>;
36
+ /**
37
+ * Send a command to the browse server and return the text response.
38
+ * Lazily connects on first call if connect() was not called explicitly.
39
+ */
40
+ execute(command: string, args: string[]): Promise<string>;
41
+ /**
42
+ * Close the transport. LocalTransport does not own the server,
43
+ * so this is a no-op. The session can optionally be closed via
44
+ * session.execute('session-close', [sessionId]).
45
+ */
46
+ close(): Promise<void>;
47
+ /**
48
+ * Resolve the state file path using the same strategy as the CLI:
49
+ * 1. Explicit option
50
+ * 2. BROWSE_STATE_FILE env var
51
+ * 3. Walk up from cwd looking for .browse/browse-server.json
52
+ * 4. Fallback to /tmp/browse-server.json
53
+ */
54
+ private resolveStateFile;
55
+ }
56
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../../src/sdk/transports/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAYD,qBAAa,cAAe,YAAW,SAAS;IAOlC,OAAO,CAAC,IAAI;IANxB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAkB;gBAEf,IAAI,GAAE,qBAA0B;IAKpD;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC9B;;;OAGG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsE/D;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;CAoCzB"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * SDK mode — programmatic API for direct browser automation.
3
+ *
4
+ * Usage:
5
+ * import { createBrowser } from '@ulpi/browse';
6
+ * const browser = await createBrowser();
7
+ * await browser.goto('https://example.com');
8
+ * const text = await browser.text();
9
+ * await browser.close();
10
+ *
11
+ * No HTTP server is spawned. Direct BrowserManager access.
12
+ */
13
+ export interface BrowseSDK {
14
+ goto(url: string): Promise<string>;
15
+ text(): Promise<string>;
16
+ html(selector?: string): Promise<string>;
17
+ click(selector: string): Promise<string>;
18
+ fill(selector: string, value: string): Promise<string>;
19
+ type(text: string): Promise<string>;
20
+ press(key: string): Promise<string>;
21
+ snapshot(opts?: {
22
+ interactive?: boolean;
23
+ }): Promise<string>;
24
+ screenshot(path?: string): Promise<string>;
25
+ evaluate(expression: string): Promise<string>;
26
+ close(): Promise<void>;
27
+ }
28
+ /**
29
+ * Create a new headless browser instance for programmatic use.
30
+ * No HTTP server — direct Playwright access.
31
+ */
32
+ export declare function createBrowser(options?: {
33
+ headless?: boolean;
34
+ }): Promise<BrowseSDK>;
35
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,SAAS,CAAC,CA+CrB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Credential vault — AES-256-GCM encrypted credential storage
3
+ *
4
+ * Encryption key: BROWSE_ENCRYPTION_KEY env var (64-char hex)
5
+ * or auto-generated at .browse/.encryption-key
6
+ *
7
+ * Storage: .browse/auth/<name>.json (mode 0o600)
8
+ * Password never returned in list/get — only hasPassword: true
9
+ */
10
+ import type { BrowserTarget } from '../browser/target';
11
+ export interface CredentialInfo {
12
+ name: string;
13
+ url: string;
14
+ username: string;
15
+ hasPassword: boolean;
16
+ createdAt: string;
17
+ }
18
+ export declare class AuthVault {
19
+ private authDir;
20
+ private encryptionKey;
21
+ constructor(localDir: string);
22
+ save(name: string, url: string, username: string, password: string, selectors?: {
23
+ username?: string;
24
+ password?: string;
25
+ submit?: string;
26
+ }): void;
27
+ private load;
28
+ login(name: string, bm: BrowserTarget): Promise<string>;
29
+ list(): CredentialInfo[];
30
+ delete(name: string): void;
31
+ }
32
+ //# sourceMappingURL=auth-vault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-vault.d.ts","sourceRoot":"","sources":["../../../src/security/auth-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoBvD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAS;gBAElB,QAAQ,EAAE,MAAM;IAK5B,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GACpE,IAAI;IAyBP,OAAO,CAAC,IAAI;IAQN,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IA2B7D,IAAI,IAAI,cAAc,EAAE;IAoBxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAO3B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Domain filter — blocks navigation and sub-resource requests outside an allowlist.
3
+ *
4
+ * Supports:
5
+ * - Exact domain: "example.com" matches only example.com
6
+ * - Wildcard: "*.example.com" matches example.com AND any subdomain
7
+ * - Case-insensitive matching
8
+ */
9
+ export declare class DomainFilter {
10
+ private domains;
11
+ constructor(domains: string[]);
12
+ /**
13
+ * Check if a URL's domain is in the allowlist.
14
+ * Returns true if allowed, false if blocked.
15
+ * Non-HTTP URLs (about:blank, data:, etc.) are always allowed.
16
+ */
17
+ isAllowed(url: string): boolean;
18
+ /**
19
+ * Get a human-readable error message for a blocked URL.
20
+ */
21
+ blockedMessage(url: string): string;
22
+ /**
23
+ * Generate a JS init script that wraps WebSocket, EventSource, and
24
+ * navigator.sendBeacon with domain checks. Playwright's context.route()
25
+ * only covers HTTP — these JS-level APIs bypass it entirely.
26
+ *
27
+ * Injected via context.addInitScript() so it runs before any page JS.
28
+ */
29
+ generateInitScript(): string;
30
+ }
31
+ //# sourceMappingURL=domain-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-filter.d.ts","sourceRoot":"","sources":["../../../src/security/domain-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAW;gBAEd,OAAO,EAAE,MAAM,EAAE;IAI7B;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAmC/B;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQnC;;;;;;OAMG;IACH,kBAAkB,IAAI,MAAM;CAiE7B"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Security module — domain filtering, action policy, path sanitization, credential vault.
3
+ */
4
+ export { DomainFilter } from './domain-filter';
5
+ export { PolicyChecker } from './policy';
6
+ export type { PolicyResult } from './policy';
7
+ export { sanitizeName } from './sanitize';
8
+ export { AuthVault } from './auth-vault';
9
+ export type { CredentialInfo } from './auth-vault';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Action policy — gate commands via JSON config
3
+ *
4
+ * File: browse-policy.json (project root) or BROWSE_POLICY env var
5
+ * Format: { default: "allow"|"deny", deny?: string[], confirm?: string[], allow?: string[] }
6
+ * Precedence: deny > confirm > allow whitelist > default
7
+ * Hot-reloads on mtime change.
8
+ */
9
+ export type PolicyResult = 'allow' | 'deny' | 'confirm';
10
+ export declare class PolicyChecker {
11
+ private filePath;
12
+ private lastMtime;
13
+ private policy;
14
+ private confirmOverrides;
15
+ constructor(filePath?: string);
16
+ private reload;
17
+ check(command: string): PolicyResult;
18
+ isActive(): boolean;
19
+ }
20
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/security/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAkBxD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,gBAAgB,CAA4B;gBAExC,QAAQ,CAAC,EAAE,MAAM;IAe7B,OAAO,CAAC,MAAM;IAed,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAiBpC,QAAQ,IAAI,OAAO;CAGpB"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sanitize a user-supplied name for safe use in file paths.
3
+ * Strips path separators and parent directory references.
4
+ */
5
+ export declare function sanitizeName(name: string): string;
6
+ //# sourceMappingURL=sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/security/sanitize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * browse server — persistent Chromium daemon
3
+ *
4
+ * Architecture:
5
+ * Bun.serve HTTP on localhost → routes commands to Playwright
6
+ * Session multiplexing: multiple agents share one Chromium via X-Browse-Session header
7
+ * Console/network buffers: per-session in-memory + disk flush every 1s
8
+ * Chromium crash → server EXITS with clear error (CLI auto-restarts)
9
+ * Auto-shutdown when all sessions idle past BROWSE_IDLE_TIMEOUT (default 30 min)
10
+ */
11
+ import { type LogEntry, type NetworkEntry } from './network/buffers';
12
+ export { type LogEntry, type NetworkEntry };
13
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuCrE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ConcurrencyLimiter — caps concurrent operations per session.
3
+ * Excess requests queue with a timeout.
4
+ */
5
+ export declare class ConcurrencyLimitError extends Error {
6
+ constructor(sessionId: string, timeoutMs: number);
7
+ }
8
+ export declare class ConcurrencyLimiter {
9
+ private maxConcurrent;
10
+ private sessions;
11
+ constructor(maxConcurrent?: number);
12
+ /** Get stats for a session. */
13
+ getStats(sessionId: string): {
14
+ active: number;
15
+ queued: number;
16
+ };
17
+ /** Acquire a slot. Resolves when a slot is available. Rejects on timeout. */
18
+ acquire(sessionId: string, timeoutMs?: number): Promise<void>;
19
+ /** Release a slot, allowing the next queued request to proceed. */
20
+ release(sessionId: string): void;
21
+ /** Drain all queued requests for a session. Call before closing. */
22
+ drain(sessionId: string): void;
23
+ }
24
+ /**
25
+ * Convenience wrapper: acquire, run operation, release.
26
+ */
27
+ export declare function withUserLimit<T>(limiter: ConcurrencyLimiter, sessionId: string, operation: () => Promise<T>, timeoutMs?: number): Promise<T>;
28
+ //# sourceMappingURL=concurrency.d.ts.map