@opengeni/sdk 0.52.1 → 1.0.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 (300) hide show
  1. package/README.md +1078 -33
  2. package/dist/accounts.d.ts +153 -0
  3. package/dist/accounts.js +307 -0
  4. package/dist/accounts.js.map +1 -0
  5. package/dist/adapters/express.d.ts +31 -0
  6. package/dist/adapters/express.js +87 -0
  7. package/dist/adapters/express.js.map +1 -0
  8. package/dist/adapters/hono.d.ts +16 -0
  9. package/dist/adapters/hono.js +8 -0
  10. package/dist/adapters/hono.js.map +1 -0
  11. package/dist/adapters/next.d.ts +29 -0
  12. package/dist/adapters/next.js +22 -0
  13. package/dist/adapters/next.js.map +1 -0
  14. package/dist/allowance-refusal.d.ts +2 -0
  15. package/dist/allowance-refusal.js +50 -0
  16. package/dist/allowance-refusal.js.map +1 -0
  17. package/dist/artifact-catalog.d.ts +31 -0
  18. package/dist/artifact-client.d.ts +23 -11
  19. package/dist/artifacts.d.ts +1 -1
  20. package/dist/artifacts.js +7 -5
  21. package/dist/automations-client.d.ts +17 -0
  22. package/dist/automations.d.ts +3 -0
  23. package/dist/automations.js +84 -0
  24. package/dist/automations.js.map +1 -0
  25. package/dist/browser.d.ts +11 -0
  26. package/dist/browser.js +47 -0
  27. package/dist/browser.js.map +1 -0
  28. package/dist/chat/fold.d.ts +75 -0
  29. package/dist/chat/handler.d.ts +41 -0
  30. package/dist/chat/http.d.ts +67 -0
  31. package/dist/chat/ids.d.ts +34 -0
  32. package/dist/chat/index.d.ts +9 -0
  33. package/dist/chat/index.js +1694 -0
  34. package/dist/chat/index.js.map +1 -0
  35. package/dist/chat/openai.d.ts +30 -0
  36. package/dist/chat/opengeni.d.ts +128 -0
  37. package/dist/chat/types.d.ts +207 -0
  38. package/dist/chat/vercel.d.ts +49 -0
  39. package/dist/chats.d.ts +8 -0
  40. package/dist/{chunk-KIHGPM7H.js → chunk-2UXZUCEZ.js} +309 -46
  41. package/dist/chunk-2UXZUCEZ.js.map +1 -0
  42. package/dist/chunk-4SMEOV3P.js +246 -0
  43. package/dist/chunk-4SMEOV3P.js.map +1 -0
  44. package/dist/{chunk-FHI4DFIG.js → chunk-AH5D5Q5V.js} +31 -35
  45. package/dist/chunk-AH5D5Q5V.js.map +1 -0
  46. package/dist/chunk-APXVSSSY.js +301 -0
  47. package/dist/chunk-APXVSSSY.js.map +1 -0
  48. package/dist/chunk-DUVIYER4.js +639 -0
  49. package/dist/chunk-DUVIYER4.js.map +1 -0
  50. package/dist/{chunk-ILQZR5N6.js → chunk-FG3OO5LM.js} +3484 -750
  51. package/dist/chunk-FG3OO5LM.js.map +1 -0
  52. package/dist/chunk-GZYZT22T.js +260 -0
  53. package/dist/chunk-GZYZT22T.js.map +1 -0
  54. package/dist/chunk-HMGADJGZ.js +150 -0
  55. package/dist/chunk-HMGADJGZ.js.map +1 -0
  56. package/dist/{chunk-DXDL7EEW.js → chunk-KWADQ227.js} +198 -114
  57. package/dist/chunk-KWADQ227.js.map +1 -0
  58. package/dist/chunk-LY2K6ELJ.js +126 -0
  59. package/dist/chunk-LY2K6ELJ.js.map +1 -0
  60. package/dist/chunk-MOTJYIYL.js +340 -0
  61. package/dist/chunk-MOTJYIYL.js.map +1 -0
  62. package/dist/{chunk-MZWTWOX6.js → chunk-NC57YMUO.js} +447 -3
  63. package/dist/chunk-NC57YMUO.js.map +1 -0
  64. package/dist/chunk-RWKB6YZG.js +1270 -0
  65. package/dist/chunk-RWKB6YZG.js.map +1 -0
  66. package/dist/chunk-U6CV2SXO.js +195 -0
  67. package/dist/chunk-U6CV2SXO.js.map +1 -0
  68. package/dist/chunk-UM4ZXXJR.js +9 -0
  69. package/dist/chunk-UM4ZXXJR.js.map +1 -0
  70. package/dist/chunk-V6GIY62B.js +229 -0
  71. package/dist/chunk-V6GIY62B.js.map +1 -0
  72. package/dist/chunk-WU6GQG25.js +268 -0
  73. package/dist/chunk-WU6GQG25.js.map +1 -0
  74. package/dist/{chunk-VWE2QIVO.js → chunk-XNG7YGR3.js} +23 -6
  75. package/dist/chunk-XNG7YGR3.js.map +1 -0
  76. package/dist/{chunk-FRJFNDIR.js → chunk-YIKA2QT4.js} +37 -2
  77. package/dist/chunk-YIKA2QT4.js.map +1 -0
  78. package/dist/chunk-ZKPY6YAJ.js +135 -0
  79. package/dist/chunk-ZKPY6YAJ.js.map +1 -0
  80. package/dist/client.d.ts +843 -107
  81. package/dist/codex-realtime-controller.d.ts +6 -0
  82. package/dist/codex-realtime-controller.js +2 -2
  83. package/dist/codex-realtime-v3.d.ts +13 -2
  84. package/dist/company-brain.d.ts +22 -0
  85. package/dist/company-profile.d.ts +14 -1
  86. package/dist/core.d.ts +9 -3
  87. package/dist/core.js +28 -9
  88. package/dist/deprecation.d.ts +47 -0
  89. package/dist/desktop.d.ts +8 -0
  90. package/dist/document-authority-client.d.ts +51 -0
  91. package/dist/document-authority.d.ts +2 -0
  92. package/dist/document-authority.js +12 -0
  93. package/dist/document-authority.js.map +1 -0
  94. package/dist/editable-artifacts/browser-session.d.ts +7 -3
  95. package/dist/editable-artifacts/controller.d.ts +4 -1
  96. package/dist/editable-artifacts/errors.d.ts +1 -1
  97. package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
  98. package/dist/editable-artifacts/index.d.ts +2 -0
  99. package/dist/editable-artifacts/open-failure.d.ts +9 -0
  100. package/dist/editable-artifacts/types.d.ts +6 -3
  101. package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
  102. package/dist/editable-artifacts-worker.js +44 -17
  103. package/dist/editable-artifacts-worker.js.map +1 -1
  104. package/dist/editable-artifacts.js +243 -124
  105. package/dist/editable-artifacts.js.map +1 -1
  106. package/dist/embedding-client.d.ts +129 -0
  107. package/dist/errors.d.ts +36 -1
  108. package/dist/feedback.d.ts +23 -0
  109. package/dist/gateway-realtime-transport.d.ts +1 -0
  110. package/dist/gateway-realtime-transport.js +5 -3
  111. package/dist/github-repositories.d.ts +10 -0
  112. package/dist/github-repositories.js +36 -0
  113. package/dist/github-repositories.js.map +1 -0
  114. package/dist/index.d.ts +61 -12
  115. package/dist/index.js +277 -126
  116. package/dist/index.js.map +1 -1
  117. package/dist/interaction-revision-stream.d.ts +11 -0
  118. package/dist/interaction.d.ts +687 -5
  119. package/dist/interaction.js +32 -1
  120. package/dist/knowledge.d.ts +7 -0
  121. package/dist/knowledge.js +20 -0
  122. package/dist/knowledge.js.map +1 -0
  123. package/dist/message-links.d.ts +68 -0
  124. package/dist/model-context.d.ts +68 -0
  125. package/dist/model-display.d.ts +2 -0
  126. package/dist/model-display.js +15 -0
  127. package/dist/model-display.js.map +1 -0
  128. package/dist/model-picker-order.d.ts +1 -0
  129. package/dist/model-picker-order.js +10 -0
  130. package/dist/model-picker-order.js.map +1 -0
  131. package/dist/organization-integration-policy.d.ts +26 -0
  132. package/dist/organization-integration-policy.js +26 -0
  133. package/dist/organization-integration-policy.js.map +1 -0
  134. package/dist/organization-private-session-settings.d.ts +6 -0
  135. package/dist/organization-private-session-settings.js +22 -0
  136. package/dist/organization-private-session-settings.js.map +1 -0
  137. package/dist/organization-user-setup.d.ts +8 -0
  138. package/dist/organization-user-setup.js +16 -0
  139. package/dist/organization-user-setup.js.map +1 -0
  140. package/dist/pr-review-client.d.ts +16 -0
  141. package/dist/pr-review.d.ts +4 -0
  142. package/dist/pr-review.js +62 -0
  143. package/dist/pr-review.js.map +1 -0
  144. package/dist/preference-registry.d.ts +9 -1
  145. package/dist/proxy.d.ts +7 -5
  146. package/dist/realtime.d.ts +6 -4
  147. package/dist/realtime.js +10 -6
  148. package/dist/realtime.js.map +1 -1
  149. package/dist/retained-artifacts.d.ts +5 -1
  150. package/dist/session-history-import.d.ts +22 -0
  151. package/dist/session-history-import.js +36 -0
  152. package/dist/session-history-import.js.map +1 -0
  153. package/dist/session-list-entries.d.ts +1 -0
  154. package/dist/session-list-entries.js +7 -0
  155. package/dist/session-list-entries.js.map +1 -0
  156. package/dist/session-message-search.d.ts +53 -0
  157. package/dist/session-proxy-client.d.ts +24 -0
  158. package/dist/session-proxy.d.ts +245 -0
  159. package/dist/session-proxy.js +24 -0
  160. package/dist/session-proxy.js.map +1 -0
  161. package/dist/session-titles.d.ts +2 -0
  162. package/dist/site-browser-entry.d.ts +1 -0
  163. package/dist/site-browser-runtime.gen.d.ts +1 -0
  164. package/dist/site-document.d.ts +5 -0
  165. package/dist/site-document.js +20 -0
  166. package/dist/site-document.js.map +1 -0
  167. package/dist/site-document.test.d.ts +1 -0
  168. package/dist/site-http.d.ts +16 -0
  169. package/dist/site-tool-bridge.d.ts +44 -0
  170. package/dist/site.d.ts +101 -0
  171. package/dist/site.js +49 -0
  172. package/dist/site.js.map +1 -0
  173. package/dist/skills.d.ts +75 -0
  174. package/dist/stream.d.ts +2 -0
  175. package/dist/tenant-workspaces.d.ts +47 -0
  176. package/dist/tenant-workspaces.js +8 -0
  177. package/dist/tenant-workspaces.js.map +1 -0
  178. package/dist/tool-auth.d.ts +87 -0
  179. package/dist/tool-auth.js +23 -0
  180. package/dist/tool-auth.js.map +1 -0
  181. package/dist/tool-display-metadata.d.ts +3 -0
  182. package/dist/tools-FXBLUWAE.js +12 -0
  183. package/dist/tools-FXBLUWAE.js.map +1 -0
  184. package/dist/tools.d.ts +61 -0
  185. package/dist/types.d.ts +3048 -406
  186. package/dist/usage-allowances.d.ts +36 -0
  187. package/dist/usage-allowances.js +80 -0
  188. package/dist/usage-allowances.js.map +1 -0
  189. package/dist/workspace-artifacts.d.ts +33 -5
  190. package/dist/workspace-instruction-policies.d.ts +24 -2
  191. package/dist/workspace-integrations.d.ts +74 -0
  192. package/dist/workspace-integrations.js +65 -0
  193. package/dist/workspace-integrations.js.map +1 -0
  194. package/dist/workspace-learning.d.ts +124 -0
  195. package/dist/workspace-live-stream.d.ts +14 -0
  196. package/dist/workspace-state.d.ts +8 -71
  197. package/package.json +108 -3
  198. package/src/accounts.ts +443 -0
  199. package/src/adapters/express.ts +136 -0
  200. package/src/adapters/hono.ts +18 -0
  201. package/src/adapters/next.ts +42 -0
  202. package/src/allowance-refusal.ts +5 -0
  203. package/src/artifact-catalog.ts +41 -0
  204. package/src/artifact-client.ts +43 -52
  205. package/src/artifacts.ts +7 -1
  206. package/src/automations-client.ts +124 -0
  207. package/src/automations.ts +15 -0
  208. package/src/browser.ts +54 -0
  209. package/src/chat/fold.ts +431 -0
  210. package/src/chat/handler.ts +240 -0
  211. package/src/chat/http.ts +257 -0
  212. package/src/chat/ids.ts +85 -0
  213. package/src/chat/index.ts +87 -0
  214. package/src/chat/openai.ts +439 -0
  215. package/src/chat/opengeni.ts +722 -0
  216. package/src/chat/types.ts +219 -0
  217. package/src/chat/vercel.ts +204 -0
  218. package/src/chats.ts +16 -0
  219. package/src/client.ts +5162 -792
  220. package/src/codex-realtime-controller.ts +260 -12
  221. package/src/codex-realtime-lifecycle.ts +1 -0
  222. package/src/codex-realtime-v3.ts +162 -31
  223. package/src/codex-realtime.ts +1 -1
  224. package/src/company-brain.ts +59 -0
  225. package/src/company-profile.ts +17 -1
  226. package/src/core.ts +23 -1
  227. package/src/deprecation.ts +149 -0
  228. package/src/desktop.ts +11 -1
  229. package/src/document-authority-client.ts +219 -0
  230. package/src/document-authority.ts +17 -0
  231. package/src/editable-artifacts/browser-session.ts +36 -22
  232. package/src/editable-artifacts/controller.ts +102 -47
  233. package/src/editable-artifacts/errors.ts +2 -0
  234. package/src/editable-artifacts/http-live-transport.ts +62 -37
  235. package/src/editable-artifacts/index.ts +6 -0
  236. package/src/editable-artifacts/open-failure.ts +79 -0
  237. package/src/editable-artifacts/storage.ts +31 -40
  238. package/src/editable-artifacts/types.ts +6 -3
  239. package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
  240. package/src/editable-artifacts/worker/runtime.ts +26 -13
  241. package/src/editable-artifacts/worker/wire-codec.ts +23 -5
  242. package/src/embedding-client.ts +519 -0
  243. package/src/errors.ts +185 -4
  244. package/src/feedback.ts +20 -0
  245. package/src/gateway-realtime-transport.ts +253 -110
  246. package/src/github-repositories.ts +60 -0
  247. package/src/index.ts +603 -54
  248. package/src/interaction-revision-stream.ts +117 -0
  249. package/src/interaction.ts +1367 -51
  250. package/src/knowledge.ts +72 -0
  251. package/src/message-links.ts +178 -0
  252. package/src/model-context.ts +112 -0
  253. package/src/model-display.ts +10 -0
  254. package/src/model-picker-order.ts +6 -0
  255. package/src/organization-integration-policy.ts +54 -0
  256. package/src/organization-private-session-settings.ts +33 -0
  257. package/src/organization-user-setup.ts +31 -0
  258. package/src/pr-review-client.ts +92 -0
  259. package/src/pr-review.ts +17 -0
  260. package/src/preference-registry.ts +11 -0
  261. package/src/proxy.ts +17 -6
  262. package/src/realtime.ts +15 -4
  263. package/src/retained-artifacts.ts +101 -0
  264. package/src/session-history-import.ts +84 -0
  265. package/src/session-list-entries.ts +1 -0
  266. package/src/session-message-search.ts +47 -0
  267. package/src/session-proxy-client.ts +64 -0
  268. package/src/session-proxy.ts +1473 -0
  269. package/src/session-titles.ts +10 -0
  270. package/src/site-browser-entry.ts +6 -0
  271. package/src/site-browser-runtime.gen.ts +2 -0
  272. package/src/site-document.test.ts +64 -0
  273. package/src/site-document.ts +18 -0
  274. package/src/site-http.ts +162 -0
  275. package/src/site-tool-bridge.ts +146 -0
  276. package/src/site.ts +585 -0
  277. package/src/skills.ts +69 -0
  278. package/src/sse.ts +8 -2
  279. package/src/stream.ts +38 -4
  280. package/src/tenant-workspaces.ts +148 -0
  281. package/src/tool-auth.ts +301 -0
  282. package/src/tool-display-metadata.ts +19 -0
  283. package/src/tools.ts +396 -0
  284. package/src/types.ts +3607 -493
  285. package/src/usage-allowances.ts +189 -0
  286. package/src/workspace-artifacts.ts +40 -6
  287. package/src/workspace-instruction-policies.ts +26 -1
  288. package/src/workspace-integrations.ts +402 -0
  289. package/src/workspace-learning.ts +138 -0
  290. package/src/workspace-live-stream.ts +137 -0
  291. package/src/workspace-state.ts +8 -82
  292. package/dist/chunk-DXDL7EEW.js.map +0 -1
  293. package/dist/chunk-FHI4DFIG.js.map +0 -1
  294. package/dist/chunk-FRJFNDIR.js.map +0 -1
  295. package/dist/chunk-ILQZR5N6.js.map +0 -1
  296. package/dist/chunk-KIHGPM7H.js.map +0 -1
  297. package/dist/chunk-MZWTWOX6.js.map +0 -1
  298. package/dist/chunk-V5F253OG.js +0 -116
  299. package/dist/chunk-V5F253OG.js.map +0 -1
  300. package/dist/chunk-VWE2QIVO.js.map +0 -1
@@ -1,3 +1,13 @@
1
+ import {
2
+ OpenGeniApiError
3
+ } from "./chunk-V6GIY62B.js";
4
+
5
+ // ../contracts/src/browser-storage.ts
6
+ var EPHEMERAL_CHROMIUM_DRIVER_ID = "opengeni.cdp.ephemeral-context.v1";
7
+ function browserSessionStorageMode(session) {
8
+ return session.driverId === EPHEMERAL_CHROMIUM_DRIVER_ID ? "ephemeral_context" : "private_profile";
9
+ }
10
+
1
11
  // src/interaction.ts
2
12
  var INTERACTION_PROTOCOL_VERSION = 1;
3
13
  var BROWSER_CONTROL_WEBSOCKET_PROTOCOL = "opengeni.browser.v1";
@@ -7,16 +17,262 @@ var BROWSER_CONTROL_MAX_FRAME_HEADER_BYTES = 64 * 1024;
7
17
  var BROWSER_FRAME_MAX_BYTES = 24 * 1024 * 1024;
8
18
  var BROWSER_FRAME_MAX_DIMENSION = 32768;
9
19
  var BROWSER_FRAME_MAX_PIXELS = 1e8;
20
+ function interactionControlFailureFromError(error) {
21
+ if (!(error instanceof OpenGeniApiError)) return null;
22
+ const details = error.details;
23
+ if (!details || details.interactionLayer !== "connected_machine") return null;
24
+ const surface = details.interactionSurface;
25
+ const code = details.controlFailureCode;
26
+ if (surface !== "browser" && surface !== "computer" || !isControlFailureCode(code)) {
27
+ return null;
28
+ }
29
+ const controlRequestId = boundedOpaqueCorrelation(details.controlRequestId);
30
+ return {
31
+ layer: "connected_machine",
32
+ surface,
33
+ code,
34
+ retryable: error.retryable,
35
+ outcomeUnknown: error.outcomeUnknown,
36
+ requestId: error.correlationId,
37
+ controlRequestId,
38
+ message: error.message
39
+ };
40
+ }
41
+ function isControlFailureCode(value) {
42
+ return typeof value === "string" && [
43
+ "unknown",
44
+ "unsupported",
45
+ "os",
46
+ "not_found",
47
+ "consent_required",
48
+ "timeout",
49
+ "draining",
50
+ "protocol",
51
+ "stream",
52
+ "agent_offline",
53
+ "fenced",
54
+ "payload_too_large"
55
+ ].includes(value);
56
+ }
57
+ function boundedOpaqueCorrelation(value) {
58
+ return typeof value === "string" && value.length <= 128 && /^[A-Za-z0-9._:-]+$/u.test(value) ? value : void 0;
59
+ }
10
60
  var OpenGeniInteractionClient = class {
11
61
  attachedBrowsers;
62
+ authRuns;
12
63
  browsers;
13
64
  computers;
14
65
  identities;
66
+ interventions;
67
+ networkRoutes;
68
+ siteAuthConnections;
15
69
  constructor(transport) {
16
70
  this.attachedBrowsers = new AttachedBrowserDeviceCollection(transport);
71
+ this.authRuns = new AuthRunCollection(transport);
17
72
  this.browsers = new BrowserSessionCollection(transport);
18
73
  this.computers = new ComputerSessionCollection(transport);
19
74
  this.identities = new BrowserIdentityCollection(transport);
75
+ this.interventions = new InteractionInterventionCollection(transport);
76
+ this.networkRoutes = new NetworkRouteCollection(transport);
77
+ this.siteAuthConnections = new SiteAuthConnectionCollection(transport);
78
+ }
79
+ };
80
+ var NetworkRouteCollection = class {
81
+ constructor(transport) {
82
+ this.transport = transport;
83
+ }
84
+ async list(workspaceId, options = {}) {
85
+ return await this.transport.listNetworkRoutes(workspaceId, options);
86
+ }
87
+ route(workspaceId, networkRouteId) {
88
+ return new NetworkRouteResource(this.transport, workspaceId, networkRouteId);
89
+ }
90
+ async create(workspaceId, request, options = {}) {
91
+ const response = await this.transport.createNetworkRoute(workspaceId, request, options);
92
+ return this.route(workspaceId, response.route.id);
93
+ }
94
+ };
95
+ var NetworkRouteResource = class {
96
+ constructor(transport, workspaceId, id) {
97
+ this.transport = transport;
98
+ this.workspaceId = workspaceId;
99
+ this.id = id;
100
+ }
101
+ async get(options = {}) {
102
+ return await this.transport.getNetworkRoute(this.workspaceId, this.id, options);
103
+ }
104
+ async update(request, options = {}) {
105
+ return await this.transport.updateNetworkRoute(this.workspaceId, this.id, request, options);
106
+ }
107
+ };
108
+ var SiteAuthConnectionCollection = class {
109
+ constructor(transport) {
110
+ this.transport = transport;
111
+ }
112
+ async list(workspaceId, options = {}) {
113
+ return await this.transport.listSiteAuthConnections(workspaceId, options);
114
+ }
115
+ connection(workspaceId, connectionId) {
116
+ return new SiteAuthConnectionResource(this.transport, workspaceId, connectionId);
117
+ }
118
+ async create(workspaceId, request, options = {}) {
119
+ const response = await this.transport.createSiteAuthConnection(workspaceId, request, options);
120
+ return this.connection(workspaceId, response.connection.id);
121
+ }
122
+ };
123
+ var SiteAuthConnectionResource = class {
124
+ constructor(transport, workspaceId, id) {
125
+ this.transport = transport;
126
+ this.workspaceId = workspaceId;
127
+ this.id = id;
128
+ }
129
+ async get(options = {}) {
130
+ return await this.transport.getSiteAuthConnection(this.workspaceId, this.id, options);
131
+ }
132
+ async update(request, options = {}) {
133
+ return await this.transport.updateSiteAuthConnection(
134
+ this.workspaceId,
135
+ this.id,
136
+ request,
137
+ options
138
+ );
139
+ }
140
+ };
141
+ var AuthRunCollection = class {
142
+ constructor(transport) {
143
+ this.transport = transport;
144
+ }
145
+ async list(workspaceId, options = {}) {
146
+ return await this.transport.listAuthRuns(workspaceId, options);
147
+ }
148
+ async get(workspaceId, authRunId, options = {}) {
149
+ return await this.transport.getAuthRun(workspaceId, authRunId, options);
150
+ }
151
+ run(workspaceId, browserSessionId, authRunId) {
152
+ return new AuthRunResource(this.transport, workspaceId, browserSessionId, authRunId);
153
+ }
154
+ };
155
+ var BrowserAuthRunCollection = class {
156
+ constructor(transport, workspaceId, browserSessionId) {
157
+ this.transport = transport;
158
+ this.workspaceId = workspaceId;
159
+ this.browserSessionId = browserSessionId;
160
+ }
161
+ async list(options = {}) {
162
+ return await this.transport.listAuthRuns(this.workspaceId, {
163
+ ...options,
164
+ browserSessionId: this.browserSessionId
165
+ });
166
+ }
167
+ run(authRunId) {
168
+ return new AuthRunResource(this.transport, this.workspaceId, this.browserSessionId, authRunId);
169
+ }
170
+ async start(request, options = {}) {
171
+ const response = await this.transport.startBrowserAuthRun(
172
+ this.workspaceId,
173
+ this.browserSessionId,
174
+ request,
175
+ options
176
+ );
177
+ return this.run(response.run.id);
178
+ }
179
+ };
180
+ var AuthRunResource = class {
181
+ constructor(transport, workspaceId, browserSessionId, id) {
182
+ this.transport = transport;
183
+ this.workspaceId = workspaceId;
184
+ this.browserSessionId = browserSessionId;
185
+ this.id = id;
186
+ }
187
+ async get(options = {}) {
188
+ const run = await this.transport.getAuthRun(this.workspaceId, this.id, options);
189
+ if (run.browserSessionId !== this.browserSessionId) {
190
+ throw new Error("AuthRun belongs to another BrowserSession");
191
+ }
192
+ return run;
193
+ }
194
+ async report(request, options = {}) {
195
+ return await this.transport.reportBrowserAuthRun(
196
+ this.workspaceId,
197
+ this.browserSessionId,
198
+ this.id,
199
+ request,
200
+ options
201
+ );
202
+ }
203
+ async protectedFill(request, options = {}) {
204
+ return await this.transport.protectedBrowserAuthFill(
205
+ this.workspaceId,
206
+ this.browserSessionId,
207
+ this.id,
208
+ request,
209
+ options
210
+ );
211
+ }
212
+ async advanceExternal(request, options = {}) {
213
+ return await this.transport.advanceExternalBrowserAuthRun(
214
+ this.workspaceId,
215
+ this.browserSessionId,
216
+ this.id,
217
+ request,
218
+ options
219
+ );
220
+ }
221
+ /** Human-session helper. Hosted provider URLs never appear in model tools. */
222
+ async openExternalFlow(request, options = {}) {
223
+ return await this.transport.openExternalBrowserAuthFlow(
224
+ this.workspaceId,
225
+ this.browserSessionId,
226
+ this.id,
227
+ request,
228
+ options
229
+ );
230
+ }
231
+ async verify(request, options = {}) {
232
+ return await this.transport.verifyBrowserAuthRun(
233
+ this.workspaceId,
234
+ this.browserSessionId,
235
+ this.id,
236
+ request,
237
+ options
238
+ );
239
+ }
240
+ };
241
+ var InteractionInterventionCollection = class {
242
+ constructor(transport) {
243
+ this.transport = transport;
244
+ }
245
+ async list(workspaceId, options = {}) {
246
+ return await this.transport.listInteractionInterventions(workspaceId, options);
247
+ }
248
+ intervention(workspaceId, interventionId) {
249
+ return new InteractionInterventionResource(this.transport, workspaceId, interventionId);
250
+ }
251
+ async create(workspaceId, request, options = {}) {
252
+ const response = await this.transport.createInteractionIntervention(
253
+ workspaceId,
254
+ request,
255
+ options
256
+ );
257
+ return this.intervention(workspaceId, response.intervention.id);
258
+ }
259
+ };
260
+ var InteractionInterventionResource = class {
261
+ constructor(transport, workspaceId, id) {
262
+ this.transport = transport;
263
+ this.workspaceId = workspaceId;
264
+ this.id = id;
265
+ }
266
+ async get(options = {}) {
267
+ return await this.transport.getInteractionIntervention(this.workspaceId, this.id, options);
268
+ }
269
+ async resolve(request, options = {}) {
270
+ return await this.transport.resolveInteractionIntervention(
271
+ this.workspaceId,
272
+ this.id,
273
+ request,
274
+ options
275
+ );
20
276
  }
21
277
  };
22
278
  var AttachedBrowserDeviceCollection = class {
@@ -67,6 +323,9 @@ var BrowserIdentityResource = class {
67
323
  async revisions(options = {}) {
68
324
  return await this.transport.listBrowserRevisions(this.workspaceId, this.id, options);
69
325
  }
326
+ async update(request, options = {}) {
327
+ return await this.transport.updateBrowserIdentity(this.workspaceId, this.id, request, options);
328
+ }
70
329
  };
71
330
  var BrowserSessionCollection = class {
72
331
  constructor(transport) {
@@ -85,7 +344,12 @@ var BrowserSessionCollection = class {
85
344
  async currentOrOpen(options) {
86
345
  const requestOptions = options.signal ? { signal: options.signal } : {};
87
346
  const listed = await this.list(options.workspaceId, requestOptions);
88
- const current = newestRelevantBrowser(listed.sessions, options.associationSessionId);
347
+ const current = newestRelevantBrowser(
348
+ listed.sessions.filter(
349
+ (session) => browserSessionStorageMode(session) === (options.storageMode ?? "private_profile")
350
+ ),
351
+ options.associationSessionId
352
+ );
89
353
  if (current) {
90
354
  const resource = this.session(options.workspaceId, current.id);
91
355
  if (current.lifecycle === "suspended") {
@@ -104,9 +368,11 @@ var BrowserSessionCollection = class {
104
368
  ...options.name !== void 0 ? { name: options.name } : {},
105
369
  ...options.initialUrl !== void 0 ? { initialUrl: options.initialUrl } : {},
106
370
  ...options.headless !== void 0 ? { headless: options.headless } : {},
371
+ ...options.storageMode !== void 0 ? { storageMode: options.storageMode } : {},
107
372
  ...options.placement !== void 0 ? { placement: options.placement } : {},
108
373
  ...options.identityId !== void 0 ? { identityId: options.identityId } : {},
109
374
  ...options.baseRevisionId !== void 0 ? { baseRevisionId: options.baseRevisionId } : {},
375
+ ...options.networkRouteId !== void 0 ? { networkRouteId: options.networkRouteId } : {},
110
376
  ...options.linkedComputerSessionId !== void 0 ? { linkedComputerSessionId: options.linkedComputerSessionId } : {}
111
377
  },
112
378
  requestOptions
@@ -118,9 +384,15 @@ var BrowserSessionResource = class {
118
384
  this.transport = transport;
119
385
  this.workspaceId = workspaceId;
120
386
  this.id = id;
387
+ this.auth = new BrowserAuthRunCollection(transport, workspaceId, id);
388
+ this.clipboard = new BrowserClipboardResource(transport, workspaceId, id);
389
+ this.downloads = new BrowserDownloadCollection(transport, workspaceId, id);
121
390
  this.tabs = new BrowserTargetCollection(transport, workspaceId, id);
122
391
  this.targets = this.tabs;
123
392
  }
393
+ auth;
394
+ clipboard;
395
+ downloads;
124
396
  tabs;
125
397
  /** Alias for hosts that prefer the protocol term. */
126
398
  targets;
@@ -130,6 +402,30 @@ var BrowserSessionResource = class {
130
402
  async observe(targetId, options = {}) {
131
403
  return await this.transport.observeBrowserTarget(this.workspaceId, this.id, targetId, options);
132
404
  }
405
+ async targetState(targetId, options = {}) {
406
+ return await this.transport.getBrowserTargetState(this.workspaceId, this.id, targetId, options);
407
+ }
408
+ async readDom(targetId, request, options = {}) {
409
+ return await this.transport.readBrowserDom(
410
+ this.workspaceId,
411
+ this.id,
412
+ targetId,
413
+ request,
414
+ options
415
+ );
416
+ }
417
+ async capture(targetId, options = {}, captureOptions = {}) {
418
+ return await this.transport.captureBrowserTarget(
419
+ this.workspaceId,
420
+ this.id,
421
+ targetId,
422
+ options,
423
+ captureOptions
424
+ );
425
+ }
426
+ async screenshot(targetId, captureOptions = {}, options = {}) {
427
+ return await this.capture(targetId, options, captureOptions);
428
+ }
133
429
  async act(request, options = {}) {
134
430
  return await this.transport.actInBrowser(this.workspaceId, this.id, request, options);
135
431
  }
@@ -174,6 +470,83 @@ var BrowserSessionResource = class {
174
470
  return await this.transport.endBrowserSession(this.workspaceId, this.id, request, options);
175
471
  }
176
472
  };
473
+ var BrowserClipboardResource = class {
474
+ constructor(transport, workspaceId, browserSessionId) {
475
+ this.transport = transport;
476
+ this.workspaceId = workspaceId;
477
+ this.browserSessionId = browserSessionId;
478
+ }
479
+ async read(options = {}) {
480
+ const clipboard = await this.transport.readBrowserClipboard(
481
+ this.workspaceId,
482
+ this.browserSessionId,
483
+ options
484
+ );
485
+ if (clipboard.browserSessionId !== this.browserSessionId) {
486
+ throw new Error("Browser clipboard belongs to another BrowserSession");
487
+ }
488
+ return clipboard;
489
+ }
490
+ };
491
+ var BrowserDownloadCollection = class {
492
+ constructor(transport, workspaceId, browserSessionId) {
493
+ this.transport = transport;
494
+ this.workspaceId = workspaceId;
495
+ this.browserSessionId = browserSessionId;
496
+ }
497
+ async list(options = {}) {
498
+ return await this.transport.listBrowserDownloads(
499
+ this.workspaceId,
500
+ this.browserSessionId,
501
+ options
502
+ );
503
+ }
504
+ download(downloadId) {
505
+ return new BrowserDownloadResource(
506
+ this.transport,
507
+ this.workspaceId,
508
+ this.browserSessionId,
509
+ downloadId
510
+ );
511
+ }
512
+ };
513
+ var BrowserDownloadResource = class {
514
+ constructor(transport, workspaceId, browserSessionId, id) {
515
+ this.transport = transport;
516
+ this.workspaceId = workspaceId;
517
+ this.browserSessionId = browserSessionId;
518
+ this.id = id;
519
+ }
520
+ async get(options = {}) {
521
+ const download = await this.transport.getBrowserDownload(
522
+ this.workspaceId,
523
+ this.browserSessionId,
524
+ this.id,
525
+ options
526
+ );
527
+ if (download.browserSessionId !== this.browserSessionId) {
528
+ throw new Error("BrowserDownload belongs to another BrowserSession");
529
+ }
530
+ return download;
531
+ }
532
+ /** Publish this exact private browser download into the source session's
533
+ * workspace. Pass an operationId when the caller needs retry identity across
534
+ * process boundaries; otherwise one is generated for this call. */
535
+ async saveToWorkspace(destinationPath, options = {}) {
536
+ const { operationId = crypto.randomUUID(), overwrite = false, ...requestOptions } = options;
537
+ const response = await this.transport.saveBrowserDownload(
538
+ this.workspaceId,
539
+ this.browserSessionId,
540
+ this.id,
541
+ { operationId, destinationPath, overwrite },
542
+ requestOptions
543
+ );
544
+ if (response.download.id !== this.id || response.download.browserSessionId !== this.browserSessionId) {
545
+ throw new Error("BrowserDownload save returned another resource");
546
+ }
547
+ return response;
548
+ }
549
+ };
177
550
  var BrowserTargetCollection = class {
178
551
  constructor(transport, workspaceId, browserSessionId) {
179
552
  this.transport = transport;
@@ -252,16 +625,21 @@ var ComputerSessionResource = class {
252
625
  this.id = id;
253
626
  this.targets = new ComputerTargetCollection(transport, workspaceId, id);
254
627
  this.apps = this.targets;
628
+ this.clipboard = new ComputerClipboardResource(transport, workspaceId, id);
255
629
  }
256
630
  targets;
257
631
  /** Native application/window targets are also the public app collection. */
258
632
  apps;
633
+ clipboard;
259
634
  async get(options = {}) {
260
635
  return await this.transport.getComputerSession(this.workspaceId, this.id, options);
261
636
  }
262
637
  async observe(targetId, options = {}) {
263
638
  return await this.transport.observeComputerTarget(this.workspaceId, this.id, targetId, options);
264
639
  }
640
+ async capture(targetId, options = {}) {
641
+ return await this.transport.captureComputerTarget(this.workspaceId, this.id, targetId, options);
642
+ }
265
643
  async act(request, options = {}) {
266
644
  return await this.transport.actInComputer(this.workspaceId, this.id, request, options);
267
645
  }
@@ -276,6 +654,12 @@ var ComputerSessionResource = class {
276
654
  async attach(request, options = {}) {
277
655
  return await this.transport.attachComputerSession(this.workspaceId, this.id, request, options);
278
656
  }
657
+ async inputPosture(options = {}) {
658
+ if (!this.transport.getComputerInputPosture) {
659
+ throw new Error("Computer input posture requires a current interaction transport.");
660
+ }
661
+ return await this.transport.getComputerInputPosture(this.workspaceId, this.id, options);
662
+ }
279
663
  async heartbeat(options = {}) {
280
664
  return await this.transport.heartbeatComputerSession(this.workspaceId, this.id, options);
281
665
  }
@@ -283,6 +667,24 @@ var ComputerSessionResource = class {
283
667
  return await this.transport.endComputerSession(this.workspaceId, this.id, request, options);
284
668
  }
285
669
  };
670
+ var ComputerClipboardResource = class {
671
+ constructor(transport, workspaceId, computerSessionId) {
672
+ this.transport = transport;
673
+ this.workspaceId = workspaceId;
674
+ this.computerSessionId = computerSessionId;
675
+ }
676
+ async read(options = {}) {
677
+ const clipboard = await this.transport.readComputerClipboard(
678
+ this.workspaceId,
679
+ this.computerSessionId,
680
+ options
681
+ );
682
+ if (clipboard.computerSessionId !== this.computerSessionId) {
683
+ throw new Error("Computer clipboard belongs to another ComputerSession");
684
+ }
685
+ return clipboard;
686
+ }
687
+ };
286
688
  var ComputerTargetCollection = class {
287
689
  constructor(transport, workspaceId, computerSessionId) {
288
690
  this.transport = transport;
@@ -307,6 +709,7 @@ function browserFrameSocketUrl(attachment, options = {}) {
307
709
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
308
710
  throw new Error("browser frame attachment did not contain an HTTP or WebSocket URL");
309
711
  }
712
+ upgradeMixedContentWebSocket(url);
310
713
  if (options.format !== void 0) url.searchParams.set("format", options.format);
311
714
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
312
715
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4096);
@@ -324,6 +727,7 @@ function computerFrameSocketUrl(attachment, options = {}) {
324
727
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
325
728
  throw new Error("computer frame attachment did not contain an HTTP or WebSocket URL");
326
729
  }
730
+ upgradeMixedContentWebSocket(url);
327
731
  if (options.format !== void 0) url.searchParams.set("format", options.format);
328
732
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
329
733
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4096);
@@ -524,6 +928,27 @@ function parseComputerFrameMetadata(value) {
524
928
  }
525
929
  return metadata;
526
930
  }
931
+ function decodeComputerFrameMetadataHeader(value) {
932
+ if (!value || value.length > 32 * 1024 || !/^[A-Za-z0-9_-]+$/u.test(value)) {
933
+ throw new Error("computer frame metadata header is invalid");
934
+ }
935
+ const normalized = value.replace(/-/gu, "+").replace(/_/gu, "/");
936
+ const padded = normalized.padEnd(Math.ceil(normalized.length / 4) * 4, "=");
937
+ let decoded;
938
+ try {
939
+ decoded = atob(padded);
940
+ } catch {
941
+ throw new Error("computer frame metadata header is invalid");
942
+ }
943
+ const bytes = Uint8Array.from(decoded, (character) => character.charCodeAt(0));
944
+ let metadata;
945
+ try {
946
+ metadata = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
947
+ } catch {
948
+ throw new Error("computer frame metadata header is invalid");
949
+ }
950
+ return parseComputerFrameMetadata(metadata);
951
+ }
527
952
  function newestRelevantBrowser(sessions, associationSessionId) {
528
953
  const live = sessions.filter(
529
954
  (session) => !["ending", "ended", "failed", "lost"].includes(session.lifecycle) && session.associations.some((association) => association.sessionId === associationSessionId)
@@ -552,6 +977,10 @@ function computerRelevance(session, associationSessionId) {
552
977
  const used = Date.parse(session.lastUsedAt);
553
978
  return Math.max(association, Number.isFinite(used) ? used : 0);
554
979
  }
980
+ function upgradeMixedContentWebSocket(url) {
981
+ const protocol = globalThis.location?.protocol;
982
+ if (protocol === "https:" && url.protocol === "ws:") url.protocol = "wss:";
983
+ }
555
984
  function setBoundedIntegerQuery(url, name, value, min, max) {
556
985
  if (value === void 0) return;
557
986
  if (!Number.isSafeInteger(value) || value < min || value > max) {
@@ -640,22 +1069,37 @@ export {
640
1069
  BROWSER_FRAME_MAX_BYTES,
641
1070
  BROWSER_FRAME_MAX_DIMENSION,
642
1071
  BROWSER_FRAME_MAX_PIXELS,
1072
+ interactionControlFailureFromError,
643
1073
  OpenGeniInteractionClient,
1074
+ NetworkRouteCollection,
1075
+ NetworkRouteResource,
1076
+ SiteAuthConnectionCollection,
1077
+ SiteAuthConnectionResource,
1078
+ AuthRunCollection,
1079
+ BrowserAuthRunCollection,
1080
+ AuthRunResource,
1081
+ InteractionInterventionCollection,
1082
+ InteractionInterventionResource,
644
1083
  AttachedBrowserDeviceCollection,
645
1084
  AttachedBrowserDeviceResource,
646
1085
  BrowserIdentityCollection,
647
1086
  BrowserIdentityResource,
648
1087
  BrowserSessionCollection,
649
1088
  BrowserSessionResource,
1089
+ BrowserClipboardResource,
1090
+ BrowserDownloadCollection,
1091
+ BrowserDownloadResource,
650
1092
  BrowserTargetCollection,
651
1093
  ComputerSessionCollection,
652
1094
  ComputerSessionResource,
1095
+ ComputerClipboardResource,
653
1096
  ComputerTargetCollection,
654
1097
  browserFrameSocketUrl,
655
1098
  computerFrameSocketUrl,
656
1099
  decodeBrowserFrameMessage,
657
1100
  decodeComputerFrameMessage,
658
1101
  parseBrowserFrameMetadata,
659
- parseComputerFrameMetadata
1102
+ parseComputerFrameMetadata,
1103
+ decodeComputerFrameMetadataHeader
660
1104
  };
661
- //# sourceMappingURL=chunk-MZWTWOX6.js.map
1105
+ //# sourceMappingURL=chunk-NC57YMUO.js.map