@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,4 +1,17 @@
1
1
  import type { OpenGeniRequestOptions } from "./client";
2
+ import { browserSessionStorageMode } from "@opengeni/contracts/browser-storage";
3
+ import type {
4
+ BrowserDomReadRequest,
5
+ BrowserDomReadResponse,
6
+ BrowserTargetState,
7
+ } from "@opengeni/contracts";
8
+ export type {
9
+ BrowserDomReadRequest,
10
+ BrowserDomReadResponse,
11
+ BrowserDomSafeAttribute,
12
+ BrowserTargetState,
13
+ } from "@opengeni/contracts";
14
+ import { OpenGeniApiError } from "./errors";
2
15
  import type { RetainedArtifactReference } from "./types";
3
16
 
4
17
  /** Public Browser/Computer protocol version. Driver and provider details stay private. */
@@ -11,6 +24,15 @@ export const BROWSER_FRAME_MAX_BYTES = 24 * 1024 * 1024;
11
24
  export const BROWSER_FRAME_MAX_DIMENSION = 32_768;
12
25
  export const BROWSER_FRAME_MAX_PIXELS = 100_000_000;
13
26
 
27
+ /** Latest-wins invalidation cursor for workspace Browser/Computer resources. */
28
+ export type WorkspaceInteractionRevisionEvent = {
29
+ workspaceId: string;
30
+ sequence: number;
31
+ revision: number;
32
+ type: "workspace.interaction.changed";
33
+ occurredAt: string;
34
+ };
35
+
14
36
  export type InteractionJsonValue =
15
37
  | null
16
38
  | string
@@ -19,6 +41,83 @@ export type InteractionJsonValue =
19
41
  | InteractionJsonValue[]
20
42
  | { [key: string]: InteractionJsonValue };
21
43
 
44
+ export type InteractionControlFailureCode =
45
+ | "unknown"
46
+ | "unsupported"
47
+ | "os"
48
+ | "not_found"
49
+ | "consent_required"
50
+ | "timeout"
51
+ | "draining"
52
+ | "protocol"
53
+ | "stream"
54
+ | "agent_offline"
55
+ | "fenced"
56
+ | "payload_too_large";
57
+
58
+ export type InteractionControlFailure = {
59
+ layer: "connected_machine";
60
+ surface: "browser" | "computer";
61
+ code: InteractionControlFailureCode;
62
+ retryable: boolean;
63
+ outcomeUnknown: boolean;
64
+ requestId: string | undefined;
65
+ controlRequestId: string | undefined;
66
+ message: string;
67
+ };
68
+
69
+ /** Decodes the bounded typed control-failure details emitted by OpenGeni. Raw
70
+ * provider/OS detail is intentionally absent; both correlation ids are opaque. */
71
+ export function interactionControlFailureFromError(
72
+ error: unknown,
73
+ ): InteractionControlFailure | null {
74
+ if (!(error instanceof OpenGeniApiError)) return null;
75
+ const details = error.details;
76
+ if (!details || details.interactionLayer !== "connected_machine") return null;
77
+ const surface = details.interactionSurface;
78
+ const code = details.controlFailureCode;
79
+ if ((surface !== "browser" && surface !== "computer") || !isControlFailureCode(code)) {
80
+ return null;
81
+ }
82
+ const controlRequestId = boundedOpaqueCorrelation(details.controlRequestId);
83
+ return {
84
+ layer: "connected_machine",
85
+ surface,
86
+ code,
87
+ retryable: error.retryable,
88
+ outcomeUnknown: error.outcomeUnknown,
89
+ requestId: error.correlationId,
90
+ controlRequestId,
91
+ message: error.message,
92
+ };
93
+ }
94
+
95
+ function isControlFailureCode(value: unknown): value is InteractionControlFailureCode {
96
+ return (
97
+ typeof value === "string" &&
98
+ [
99
+ "unknown",
100
+ "unsupported",
101
+ "os",
102
+ "not_found",
103
+ "consent_required",
104
+ "timeout",
105
+ "draining",
106
+ "protocol",
107
+ "stream",
108
+ "agent_offline",
109
+ "fenced",
110
+ "payload_too_large",
111
+ ].includes(value)
112
+ );
113
+ }
114
+
115
+ function boundedOpaqueCorrelation(value: unknown): string | undefined {
116
+ return typeof value === "string" && value.length <= 128 && /^[A-Za-z0-9._:-]+$/u.test(value)
117
+ ? value
118
+ : undefined;
119
+ }
120
+
22
121
  export type InteractionPlacement =
23
122
  | { kind: "sandbox_group"; sandboxGroupId: string }
24
123
  | { kind: "connected_machine"; sandboxId: string }
@@ -62,8 +161,18 @@ export type AttachedBrowserDevice = {
62
161
  updatedAt: string;
63
162
  };
64
163
 
164
+ export type AttachedBrowserBridge = {
165
+ enrollmentId: string;
166
+ state: "online" | "offline";
167
+ bridgeGeneration: string;
168
+ inventoryRevision: number;
169
+ connectedProfileCount: number;
170
+ lastSeenAt: string;
171
+ };
172
+
65
173
  export type AttachedBrowserDeviceListResponse = {
66
174
  revision: number;
175
+ bridges: AttachedBrowserBridge[];
67
176
  devices: AttachedBrowserDevice[];
68
177
  };
69
178
 
@@ -103,6 +212,7 @@ export type BrowserSessionCapabilities = {
103
212
  downloads: boolean;
104
213
  uploads: boolean;
105
214
  clipboard: boolean;
215
+ permissions: boolean;
106
216
  diagnostics: boolean;
107
217
  rawCdp: boolean;
108
218
  linkedComputer: boolean;
@@ -135,6 +245,353 @@ export type BrowserSession = {
135
245
  failureCode: string | null;
136
246
  };
137
247
 
248
+ export type BrowserClipboard = {
249
+ browserSessionId: string;
250
+ controllerGeneration: string;
251
+ revision: number;
252
+ text: string;
253
+ source: "empty" | "write" | "clear" | "copy" | "paste";
254
+ sourceTargetId: string | null;
255
+ updatedAt: string | null;
256
+ };
257
+
258
+ export type InteractionCredentialAuthorityRef = {
259
+ connectionId: string;
260
+ connectionSubjectId: string | null;
261
+ providerDomain: string;
262
+ };
263
+
264
+ export type NetworkRouteConfiguration =
265
+ | { kind: "direct" }
266
+ | {
267
+ kind: "proxy";
268
+ protocol: "http" | "https" | "socks5";
269
+ host: string;
270
+ port: number;
271
+ credential: InteractionCredentialAuthorityRef | null;
272
+ }
273
+ | {
274
+ kind: "managed";
275
+ providerId: string;
276
+ routeId: string;
277
+ egressClass: "datacenter" | "residential" | "isp";
278
+ region: string | null;
279
+ credential: InteractionCredentialAuthorityRef | null;
280
+ }
281
+ | { kind: "tunnel"; placement: InteractionPlacement; tunnelId: string };
282
+
283
+ export type NetworkRouteConsistency = {
284
+ dns: "placement" | "proxy" | "provider";
285
+ expectedPublicIp: string | null;
286
+ expectedRegion: string | null;
287
+ locale: string | null;
288
+ timezone: string | null;
289
+ geolocation: {
290
+ latitude: number;
291
+ longitude: number;
292
+ accuracyMeters: number;
293
+ } | null;
294
+ webRtc: "default" | "disable_non_proxied_udp" | "proxy_only";
295
+ stability: "session" | "sticky" | "persistent";
296
+ };
297
+
298
+ export type NetworkRoute = {
299
+ id: string;
300
+ accountId: string;
301
+ workspaceId: string;
302
+ name: string;
303
+ status: "active" | "archived";
304
+ configuration: NetworkRouteConfiguration;
305
+ consistency: NetworkRouteConsistency;
306
+ version: number;
307
+ createdBySubjectId: string;
308
+ createdAt: string;
309
+ updatedAt: string;
310
+ };
311
+
312
+ export type NetworkRouteListResponse = { revision: number; routes: NetworkRoute[] };
313
+ export type CreateNetworkRouteRequest = {
314
+ operationId: string;
315
+ name: string;
316
+ configuration: NetworkRouteConfiguration;
317
+ consistency: NetworkRouteConsistency;
318
+ };
319
+ export type UpdateNetworkRouteRequest = {
320
+ operationId: string;
321
+ expectedVersion: number;
322
+ name?: string | undefined;
323
+ status?: "active" | "archived" | undefined;
324
+ configuration?: NetworkRouteConfiguration | undefined;
325
+ consistency?: NetworkRouteConsistency | undefined;
326
+ };
327
+ export type NetworkRouteMutationResponse = {
328
+ route: NetworkRoute;
329
+ operationId: string;
330
+ replayed: boolean;
331
+ };
332
+
333
+ export type SiteAuthFieldPurpose = "identifier" | "password" | "secret" | "totp";
334
+ export type SiteAuthAuthority =
335
+ | {
336
+ id: string;
337
+ kind: "connection_fields";
338
+ label: string;
339
+ credential: InteractionCredentialAuthorityRef;
340
+ fields: Array<{
341
+ id: string;
342
+ purpose: SiteAuthFieldPurpose;
343
+ credentialKey: string;
344
+ digits?: number | undefined;
345
+ periodSeconds?: number | undefined;
346
+ algorithm?: "sha1" | "sha256" | "sha512" | undefined;
347
+ }>;
348
+ }
349
+ | {
350
+ id: string;
351
+ kind: "human";
352
+ label: string;
353
+ fields: Array<{ id: string; purpose: SiteAuthFieldPurpose }>;
354
+ }
355
+ | {
356
+ id: string;
357
+ kind: "external_provider";
358
+ label: string;
359
+ adapterId: string;
360
+ connectionId: string;
361
+ credential: InteractionCredentialAuthorityRef | null;
362
+ };
363
+
364
+ export type SiteAuthMethod = {
365
+ id: string;
366
+ kind: "password" | "sso" | "magic_link" | "passkey" | "external";
367
+ label: string;
368
+ authorityIds: string[];
369
+ };
370
+
371
+ export type SiteAuthHealthPolicy = {
372
+ mode: "on_use" | "maintained";
373
+ intervalSeconds: number | null;
374
+ automaticRepair: boolean;
375
+ };
376
+
377
+ export type SiteAuthConnectionConfiguration = {
378
+ name: string;
379
+ accountLabel: string;
380
+ origins: string[];
381
+ loginUrl: string | null;
382
+ verificationUrlPrefixes: string[];
383
+ authorities: SiteAuthAuthority[];
384
+ methods: SiteAuthMethod[];
385
+ preferredIdentityId: string | null;
386
+ preferredPlacement: InteractionPlacement | null;
387
+ preferredNetworkRouteId: string | null;
388
+ healthPolicy: SiteAuthHealthPolicy;
389
+ };
390
+
391
+ export type SiteAuthConnection = SiteAuthConnectionConfiguration & {
392
+ id: string;
393
+ accountId: string;
394
+ workspaceId: string;
395
+ status: "active" | "archived";
396
+ verificationState: "unknown" | "verified" | "needs_repair" | "failed";
397
+ lastVerifiedAt: string | null;
398
+ lastVerifiedUrl: string | null;
399
+ lastCheckedAt: string | null;
400
+ nextCheckAt: string | null;
401
+ maintenance: {
402
+ action: "health_check" | "repair";
403
+ sessionId: string | null;
404
+ dueAt: string;
405
+ startedAt: string | null;
406
+ } | null;
407
+ repairCode: string | null;
408
+ version: number;
409
+ createdBySubjectId: string;
410
+ createdAt: string;
411
+ updatedAt: string;
412
+ };
413
+
414
+ export type SiteAuthConnectionListResponse = {
415
+ revision: number;
416
+ connections: SiteAuthConnection[];
417
+ };
418
+ export type CreateSiteAuthConnectionRequest = SiteAuthConnectionConfiguration & {
419
+ operationId: string;
420
+ };
421
+ export type UpdateSiteAuthConnectionRequest = Partial<SiteAuthConnectionConfiguration> & {
422
+ operationId: string;
423
+ expectedVersion: number;
424
+ status?: "active" | "archived" | undefined;
425
+ };
426
+ export type SiteAuthConnectionMutationResponse = {
427
+ connection: SiteAuthConnection;
428
+ operationId: string;
429
+ replayed: boolean;
430
+ };
431
+
432
+ export type AuthRun = {
433
+ id: string;
434
+ accountId: string;
435
+ workspaceId: string;
436
+ siteAuthConnectionId: string;
437
+ browserSessionId: string;
438
+ targetId: string;
439
+ controllerGeneration: string;
440
+ targetGeneration: string;
441
+ documentGeneration: string | null;
442
+ purpose: "authenticate" | "health_check" | "repair";
443
+ methodId: string | null;
444
+ authorityId: string | null;
445
+ state:
446
+ | "discovering"
447
+ | "awaiting_choice"
448
+ | "awaiting_secret"
449
+ | "awaiting_external_action"
450
+ | "working"
451
+ | "verified"
452
+ | "failed"
453
+ | "cancelled";
454
+ choices: Array<{ id: string; label: string; methodId: string }>;
455
+ pendingFields: Array<{ id: string; label: string; purpose: SiteAuthFieldPurpose }>;
456
+ externalAction: {
457
+ kind: "push" | "security_key" | "passkey" | "device" | "human" | "other";
458
+ label: string;
459
+ expiresAt: string | null;
460
+ } | null;
461
+ interventionId: string | null;
462
+ verifiedUrl: string | null;
463
+ failureCode: string | null;
464
+ version: number;
465
+ operationId: string;
466
+ createdBySubjectId: string;
467
+ createdAt: string;
468
+ updatedAt: string;
469
+ settledAt: string | null;
470
+ };
471
+
472
+ export type AuthRunListResponse = { runs: AuthRun[] };
473
+ export type AuthRunMutationResponse = { run: AuthRun; operationId: string; replayed: boolean };
474
+ export type StartAuthRunRequest = {
475
+ operationId: string;
476
+ siteAuthConnectionId: string;
477
+ targetId: string;
478
+ expectedTargetGeneration: string;
479
+ expectedDocumentGeneration: string | null;
480
+ purpose?: "authenticate" | "health_check" | "repair" | undefined;
481
+ methodId?: string | undefined;
482
+ authorityId?: string | undefined;
483
+ };
484
+ export type ReportAuthRunRequest = {
485
+ operationId: string;
486
+ expectedVersion: number;
487
+ methodId?: string | undefined;
488
+ authorityId?: string | undefined;
489
+ state:
490
+ | "awaiting_choice"
491
+ | "awaiting_secret"
492
+ | "awaiting_external_action"
493
+ | "working"
494
+ | "failed"
495
+ | "cancelled";
496
+ choices?: AuthRun["choices"] | undefined;
497
+ pendingFields?: AuthRun["pendingFields"] | undefined;
498
+ externalAction?: AuthRun["externalAction"] | undefined;
499
+ failureCode?: string | null | undefined;
500
+ };
501
+ export type ProtectedAuthFillRequest = {
502
+ operationId: string;
503
+ expectedVersion: number;
504
+ expectedTargetGeneration: string;
505
+ expectedDocumentGeneration: string | null;
506
+ expectedFrameId: string | null;
507
+ authorityId: string;
508
+ fields: Array<{ fieldId: string; locator: BrowserLocator }>;
509
+ submit:
510
+ | { type: "none" }
511
+ | { type: "click"; locator: BrowserLocator }
512
+ | { type: "press"; key: string; locator?: BrowserLocator | undefined };
513
+ };
514
+ export type ProtectedAuthFillResponse = {
515
+ run: AuthRun;
516
+ status: "submitted" | "working" | "needs_human" | "stale" | "failed";
517
+ operationId: string;
518
+ replayed: boolean;
519
+ };
520
+ export type ExternalAuthRunRequest = {
521
+ operationId: string;
522
+ expectedVersion: number;
523
+ action: "start" | "poll";
524
+ };
525
+ export type ExternalAuthRunResponse = {
526
+ run: AuthRun;
527
+ status: "working" | "needs_human" | "ready_to_verify" | "failed";
528
+ operationId: string;
529
+ replayed: boolean;
530
+ };
531
+ export type ExternalAuthInteractiveRequest = {
532
+ operationId: string;
533
+ expectedVersion: number;
534
+ };
535
+ export type ExternalAuthInteractiveResponse = {
536
+ authRunId: string;
537
+ url: string;
538
+ expiresAt: string | null;
539
+ };
540
+ export type VerifyAuthRunRequest = { operationId: string; expectedVersion: number };
541
+
542
+ export type InteractionIntervention = {
543
+ id: string;
544
+ accountId: string;
545
+ workspaceId: string;
546
+ resourceKind: "browser_session" | "computer_session";
547
+ resourceId: string;
548
+ targetId: string;
549
+ controllerGeneration: string;
550
+ targetGeneration: string;
551
+ documentGeneration: string | null;
552
+ kind: "manual_login" | "mfa" | "external_action" | "confirmation" | "other";
553
+ reason: string;
554
+ status: "open" | "completed" | "dismissed" | "expired" | "cancelled";
555
+ authRunId: string | null;
556
+ originatingSessionId: string;
557
+ originatingTurnId: string | null;
558
+ originatingAttemptId: string | null;
559
+ originatingToolOperationId: string | null;
560
+ responseActorSubjectId: string | null;
561
+ version: number;
562
+ operationId: string;
563
+ expiresAt: string;
564
+ createdAt: string;
565
+ updatedAt: string;
566
+ settledAt: string | null;
567
+ };
568
+ export type InteractionInterventionListResponse = {
569
+ interventions: InteractionIntervention[];
570
+ };
571
+ export type CreateInteractionInterventionRequest = {
572
+ operationId: string;
573
+ resourceKind: "browser_session" | "computer_session";
574
+ resourceId: string;
575
+ targetId: string;
576
+ expectedControllerGeneration: string;
577
+ expectedTargetGeneration: string;
578
+ expectedDocumentGeneration: string | null;
579
+ kind: InteractionIntervention["kind"];
580
+ reason: string;
581
+ authRunId?: string | undefined;
582
+ expiresInSeconds?: number | undefined;
583
+ };
584
+ export type ResolveInteractionInterventionRequest = {
585
+ operationId: string;
586
+ expectedVersion: number;
587
+ outcome: "completed" | "dismissed";
588
+ };
589
+ export type InteractionInterventionMutationResponse = {
590
+ intervention: InteractionIntervention;
591
+ operationId: string;
592
+ replayed: boolean;
593
+ };
594
+
138
595
  export type BrowserIdentityStatus = "active" | "archived";
139
596
  export type BrowserRevisionComponentKind =
140
597
  | "chromium_profile"
@@ -185,6 +642,7 @@ export type BrowserIdentity = {
185
642
  workspaceId: string;
186
643
  name: string;
187
644
  status: BrowserIdentityStatus;
645
+ version: number;
188
646
  defaultRevisionId: string | null;
189
647
  headGeneration: number;
190
648
  revisionCount: number;
@@ -208,6 +666,14 @@ export type CreateBrowserIdentityRequest = {
208
666
  name: string;
209
667
  };
210
668
 
669
+ export type UpdateBrowserIdentityRequest = {
670
+ operationId: string;
671
+ expectedVersion: number;
672
+ name?: string | undefined;
673
+ status?: BrowserIdentityStatus | undefined;
674
+ defaultRevisionId?: string | undefined;
675
+ };
676
+
211
677
  export type BrowserIdentityMutationResponse = {
212
678
  identity: BrowserIdentity;
213
679
  operationId: string;
@@ -242,6 +708,51 @@ export type BrowserTarget = {
242
708
  createdAt: string;
243
709
  };
244
710
 
711
+ export type BrowserDownloadStatus =
712
+ | "in_progress"
713
+ | "completed"
714
+ | "cancelled"
715
+ | "failed"
716
+ | "unavailable";
717
+
718
+ /** One browser-produced file. Its bytes remain private to the exact browser
719
+ * controller until an explicit save publishes them into the workspace. */
720
+ export type BrowserDownload = {
721
+ id: string;
722
+ browserSessionId: string;
723
+ controllerGeneration: string;
724
+ targetId: string | null;
725
+ filename: string;
726
+ status: BrowserDownloadStatus;
727
+ receivedBytes: number;
728
+ totalBytes: number | null;
729
+ sha256: string | null;
730
+ version: number;
731
+ startedAt: string;
732
+ settledAt: string | null;
733
+ failureCode: string | null;
734
+ };
735
+
736
+ export type BrowserDownloadListResponse = {
737
+ browserSessionId: string;
738
+ controllerGeneration: string;
739
+ downloads: BrowserDownload[];
740
+ };
741
+
742
+ export type BrowserDownloadSaveRequest = {
743
+ operationId: string;
744
+ destinationPath: string;
745
+ overwrite?: boolean | undefined;
746
+ };
747
+
748
+ export type BrowserDownloadSaveResponse = {
749
+ download: BrowserDownload;
750
+ destinationPath: string;
751
+ fileId: string;
752
+ operationId: string;
753
+ replayed: boolean;
754
+ };
755
+
245
756
  export type InteractionRect = {
246
757
  x: number;
247
758
  y: number;
@@ -303,6 +814,17 @@ export type BrowserObservation = {
303
814
  frameId: string | null;
304
815
  semantic: InteractionSemanticSnapshot | InteractionSemanticDiff | null;
305
816
  screenshot: RetainedArtifactReference | null;
817
+ viewport?:
818
+ | {
819
+ width: number;
820
+ height: number;
821
+ visualWidth: number;
822
+ visualHeight: number;
823
+ deviceScaleFactor: number;
824
+ maxTouchPoints: number;
825
+ }
826
+ | null
827
+ | undefined;
306
828
  focusedRef: string | null;
307
829
  changedRegions: InteractionRect[];
308
830
  diagnostics: InteractionDiagnosticSummary;
@@ -348,8 +870,31 @@ export type BrowserLocator =
348
870
  | { kind: "test_id"; value: string }
349
871
  | { kind: "css"; selector: string };
350
872
 
873
+ export type BrowserPermission =
874
+ | "geolocation"
875
+ | "notifications"
876
+ | "camera"
877
+ | "microphone"
878
+ | "midi"
879
+ | "midi_sysex"
880
+ | "sensors"
881
+ | "idle_detection"
882
+ | "local_fonts"
883
+ | "window_management";
884
+
885
+ export type BrowserPermissionSetting = "granted" | "denied" | "prompt";
886
+
351
887
  export type BrowserAction =
352
888
  | { type: "navigate"; url: string }
889
+ | { type: "history"; direction: "back" | "forward" }
890
+ | { type: "activate" }
891
+ | {
892
+ type: "viewport";
893
+ width: number;
894
+ height: number;
895
+ mobile: boolean;
896
+ deviceScaleFactor?: number | undefined;
897
+ }
353
898
  | {
354
899
  type: "click";
355
900
  locator: BrowserLocator;
@@ -379,6 +924,7 @@ export type BrowserAction =
379
924
  deltaX?: number | undefined;
380
925
  deltaY?: number | undefined;
381
926
  button?: "left" | "right" | "middle" | undefined;
927
+ clickCount?: 1 | 2 | undefined;
382
928
  }
383
929
  | {
384
930
  type: "handle_dialog";
@@ -386,6 +932,18 @@ export type BrowserAction =
386
932
  promptText?: string | undefined;
387
933
  }
388
934
  | { type: "upload"; locator: BrowserLocator; workspaceFileIds: string[] }
935
+ | {
936
+ type: "clipboard";
937
+ operation: "write" | "clear" | "copy" | "paste";
938
+ text?: string | undefined;
939
+ locator?: BrowserLocator | undefined;
940
+ content?: "selection" | "value" | "text" | undefined;
941
+ }
942
+ | {
943
+ type: "permission";
944
+ permission: BrowserPermission;
945
+ setting: BrowserPermissionSetting;
946
+ }
389
947
  | {
390
948
  type: "wait";
391
949
  condition: "load" | "network_idle" | "visible" | "hidden";
@@ -393,7 +951,11 @@ export type BrowserAction =
393
951
  timeoutMs?: number | undefined;
394
952
  };
395
953
 
396
- export type BrowserActionBatch = { type: "batch"; actions: BrowserAction[] };
954
+ export type BrowserActionBatch = {
955
+ type: "batch";
956
+ actions: BrowserAction[];
957
+ fenceEachAction?: true | undefined;
958
+ };
397
959
 
398
960
  export type InteractionError = {
399
961
  code:
@@ -448,9 +1010,12 @@ export type CreateBrowserSessionRequest = {
448
1010
  name?: string | undefined;
449
1011
  initialUrl?: string | undefined;
450
1012
  headless?: boolean | undefined;
1013
+ storageMode?: "private_profile" | "ephemeral_context" | undefined;
1014
+ engine?: "chromium" | "lightpanda" | undefined;
451
1015
  placement?: InteractionPlacement | undefined;
452
1016
  identityId?: string | undefined;
453
1017
  baseRevisionId?: string | undefined;
1018
+ networkRouteId?: string | undefined;
454
1019
  linkedComputerSessionId?: string | undefined;
455
1020
  };
456
1021
 
@@ -488,11 +1053,18 @@ export type InteractionFrameStreamAttachment<RelayKind extends 3 | 4 = 3 | 4> =
488
1053
  };
489
1054
  };
490
1055
 
1056
+ export type ComputerFrameStreamAttachment =
1057
+ | InteractionFrameStreamAttachment<4>
1058
+ | { kind: "direct_rfb"; url: string; protocols: string[]; inputAllowed: boolean };
1059
+
491
1060
  export type BrowserSessionAttachment = {
492
1061
  browserSessionId: string;
493
1062
  controllerGeneration: string;
494
1063
  targetId: string;
495
1064
  stream: InteractionFrameStreamAttachment<3>;
1065
+ /** Negotiated from this attachment’s live controller, absent on older helpers. */
1066
+ fencedInputBatches?: true | undefined;
1067
+ focusedInputObservations?: true | undefined;
496
1068
  expiresAt: string;
497
1069
  };
498
1070
 
@@ -508,6 +1080,10 @@ export type BrowserActionRequest = {
508
1080
  expectedTargetGeneration: string;
509
1081
  expectedDocumentGeneration: string | null;
510
1082
  expectedFrameId: string | null;
1083
+ /** `input` is negotiated by focusedInputObservations on a live attachment.
1084
+ * It returns optional native-select metadata after a pointer click, and null
1085
+ * for ordinary input. Use full for agent observations. */
1086
+ observationMode?: "full" | "none" | "input" | undefined;
511
1087
  action: BrowserAction | BrowserActionBatch;
512
1088
  };
513
1089
 
@@ -539,10 +1115,21 @@ export type ComputerSessionCapabilities = {
539
1115
  semanticActions: boolean;
540
1116
  pointerInput: boolean;
541
1117
  keyboardInput: boolean;
1118
+ clipboard: boolean;
542
1119
  backgroundActions: boolean;
1120
+ /** Raw window input stays in the background. Absent means foreground-only. */
1121
+ backgroundInput?: boolean | undefined;
543
1122
  parallelApps: boolean;
544
1123
  };
545
1124
 
1125
+ export type ComputerClipboard = {
1126
+ computerSessionId: string;
1127
+ controllerGeneration: string;
1128
+ text: string | null;
1129
+ truncated: boolean;
1130
+ observedAt: string;
1131
+ };
1132
+
546
1133
  export type ComputerSession = {
547
1134
  id: string;
548
1135
  accountId: string;
@@ -632,6 +1219,11 @@ export type ComputerAction =
632
1219
  button?: "left" | "right" | "middle" | undefined;
633
1220
  }
634
1221
  | { type: "keyboard"; action: "type" | "press"; value: string }
1222
+ | {
1223
+ type: "clipboard";
1224
+ operation: "write" | "clear" | "copy" | "paste";
1225
+ text?: string | undefined;
1226
+ }
635
1227
  | { type: "focus"; targetId: string }
636
1228
  | { type: "launch"; applicationId: string };
637
1229
 
@@ -674,10 +1266,19 @@ export type ComputerSessionAttachment = {
674
1266
  computerSessionId: string;
675
1267
  controllerGeneration: string;
676
1268
  targetId: string;
677
- stream: InteractionFrameStreamAttachment<4>;
1269
+ /** Viewer posture when attached; actions still reauthorize the live source. */
1270
+ inputAllowed?: boolean | undefined;
1271
+ stream: ComputerFrameStreamAttachment;
678
1272
  expiresAt: string;
679
1273
  };
680
1274
 
1275
+ /** Caller-specific hint only; every action still requires live authorization. */
1276
+ export type ComputerSessionInputPosture = {
1277
+ computerSessionId: string;
1278
+ controllerGeneration: string;
1279
+ inputAllowed: boolean;
1280
+ };
1281
+
681
1282
  export type ComputerSessionAttachmentRequest = {
682
1283
  targetId: string;
683
1284
  expiresInSeconds?: number | undefined;
@@ -721,6 +1322,113 @@ export type BrowserDiagnosticsOptions = {
721
1322
 
722
1323
  /** The exact HTTP surface needed by the framework-free interaction client. */
723
1324
  export interface InteractionTransport {
1325
+ listNetworkRoutes(
1326
+ workspaceId: string,
1327
+ options?: NetworkRouteListOptions,
1328
+ ): Promise<NetworkRouteListResponse>;
1329
+ getNetworkRoute(
1330
+ workspaceId: string,
1331
+ networkRouteId: string,
1332
+ options?: OpenGeniRequestOptions,
1333
+ ): Promise<NetworkRoute>;
1334
+ createNetworkRoute(
1335
+ workspaceId: string,
1336
+ request: CreateNetworkRouteRequest,
1337
+ options?: OpenGeniRequestOptions,
1338
+ ): Promise<NetworkRouteMutationResponse>;
1339
+ updateNetworkRoute(
1340
+ workspaceId: string,
1341
+ networkRouteId: string,
1342
+ request: UpdateNetworkRouteRequest,
1343
+ options?: OpenGeniRequestOptions,
1344
+ ): Promise<NetworkRouteMutationResponse>;
1345
+ listSiteAuthConnections(
1346
+ workspaceId: string,
1347
+ options?: SiteAuthConnectionListOptions,
1348
+ ): Promise<SiteAuthConnectionListResponse>;
1349
+ getSiteAuthConnection(
1350
+ workspaceId: string,
1351
+ siteAuthConnectionId: string,
1352
+ options?: OpenGeniRequestOptions,
1353
+ ): Promise<SiteAuthConnection>;
1354
+ createSiteAuthConnection(
1355
+ workspaceId: string,
1356
+ request: CreateSiteAuthConnectionRequest,
1357
+ options?: OpenGeniRequestOptions,
1358
+ ): Promise<SiteAuthConnectionMutationResponse>;
1359
+ updateSiteAuthConnection(
1360
+ workspaceId: string,
1361
+ siteAuthConnectionId: string,
1362
+ request: UpdateSiteAuthConnectionRequest,
1363
+ options?: OpenGeniRequestOptions,
1364
+ ): Promise<SiteAuthConnectionMutationResponse>;
1365
+ listAuthRuns(workspaceId: string, options?: AuthRunListOptions): Promise<AuthRunListResponse>;
1366
+ getAuthRun(
1367
+ workspaceId: string,
1368
+ authRunId: string,
1369
+ options?: OpenGeniRequestOptions,
1370
+ ): Promise<AuthRun>;
1371
+ startBrowserAuthRun(
1372
+ workspaceId: string,
1373
+ browserSessionId: string,
1374
+ request: StartAuthRunRequest,
1375
+ options?: OpenGeniRequestOptions,
1376
+ ): Promise<AuthRunMutationResponse>;
1377
+ reportBrowserAuthRun(
1378
+ workspaceId: string,
1379
+ browserSessionId: string,
1380
+ authRunId: string,
1381
+ request: ReportAuthRunRequest,
1382
+ options?: OpenGeniRequestOptions,
1383
+ ): Promise<AuthRunMutationResponse>;
1384
+ protectedBrowserAuthFill(
1385
+ workspaceId: string,
1386
+ browserSessionId: string,
1387
+ authRunId: string,
1388
+ request: ProtectedAuthFillRequest,
1389
+ options?: OpenGeniRequestOptions,
1390
+ ): Promise<ProtectedAuthFillResponse>;
1391
+ advanceExternalBrowserAuthRun(
1392
+ workspaceId: string,
1393
+ browserSessionId: string,
1394
+ authRunId: string,
1395
+ request: ExternalAuthRunRequest,
1396
+ options?: OpenGeniRequestOptions,
1397
+ ): Promise<ExternalAuthRunResponse>;
1398
+ openExternalBrowserAuthFlow(
1399
+ workspaceId: string,
1400
+ browserSessionId: string,
1401
+ authRunId: string,
1402
+ request: ExternalAuthInteractiveRequest,
1403
+ options?: OpenGeniRequestOptions,
1404
+ ): Promise<ExternalAuthInteractiveResponse>;
1405
+ verifyBrowserAuthRun(
1406
+ workspaceId: string,
1407
+ browserSessionId: string,
1408
+ authRunId: string,
1409
+ request: VerifyAuthRunRequest,
1410
+ options?: OpenGeniRequestOptions,
1411
+ ): Promise<AuthRunMutationResponse>;
1412
+ listInteractionInterventions(
1413
+ workspaceId: string,
1414
+ options?: InteractionInterventionListOptions,
1415
+ ): Promise<InteractionInterventionListResponse>;
1416
+ getInteractionIntervention(
1417
+ workspaceId: string,
1418
+ interventionId: string,
1419
+ options?: OpenGeniRequestOptions,
1420
+ ): Promise<InteractionIntervention>;
1421
+ createInteractionIntervention(
1422
+ workspaceId: string,
1423
+ request: CreateInteractionInterventionRequest,
1424
+ options?: OpenGeniRequestOptions,
1425
+ ): Promise<InteractionInterventionMutationResponse>;
1426
+ resolveInteractionIntervention(
1427
+ workspaceId: string,
1428
+ interventionId: string,
1429
+ request: ResolveInteractionInterventionRequest,
1430
+ options?: OpenGeniRequestOptions,
1431
+ ): Promise<InteractionInterventionMutationResponse>;
724
1432
  listAttachedBrowsers(
725
1433
  workspaceId: string,
726
1434
  options?: AttachedBrowserDeviceListOptions,
@@ -744,6 +1452,12 @@ export interface InteractionTransport {
744
1452
  request: CreateBrowserIdentityRequest,
745
1453
  options?: OpenGeniRequestOptions,
746
1454
  ): Promise<BrowserIdentityMutationResponse>;
1455
+ updateBrowserIdentity(
1456
+ workspaceId: string,
1457
+ identityId: string,
1458
+ request: UpdateBrowserIdentityRequest,
1459
+ options?: OpenGeniRequestOptions,
1460
+ ): Promise<BrowserIdentityMutationResponse>;
747
1461
  listBrowserRevisions(
748
1462
  workspaceId: string,
749
1463
  identityId: string,
@@ -758,6 +1472,29 @@ export interface InteractionTransport {
758
1472
  browserSessionId: string,
759
1473
  options?: OpenGeniRequestOptions,
760
1474
  ): Promise<BrowserSession>;
1475
+ readBrowserClipboard(
1476
+ workspaceId: string,
1477
+ browserSessionId: string,
1478
+ options?: OpenGeniRequestOptions,
1479
+ ): Promise<BrowserClipboard>;
1480
+ listBrowserDownloads(
1481
+ workspaceId: string,
1482
+ browserSessionId: string,
1483
+ options?: OpenGeniRequestOptions,
1484
+ ): Promise<BrowserDownloadListResponse>;
1485
+ getBrowserDownload(
1486
+ workspaceId: string,
1487
+ browserSessionId: string,
1488
+ downloadId: string,
1489
+ options?: OpenGeniRequestOptions,
1490
+ ): Promise<BrowserDownload>;
1491
+ saveBrowserDownload(
1492
+ workspaceId: string,
1493
+ browserSessionId: string,
1494
+ downloadId: string,
1495
+ request: BrowserDownloadSaveRequest,
1496
+ options?: OpenGeniRequestOptions,
1497
+ ): Promise<BrowserDownloadSaveResponse>;
761
1498
  createBrowserSession(
762
1499
  workspaceId: string,
763
1500
  request: CreateBrowserSessionRequest,
@@ -773,13 +1510,13 @@ export interface InteractionTransport {
773
1510
  browserSessionId: string,
774
1511
  request?: BrowserOpenTargetRequest,
775
1512
  options?: OpenGeniRequestOptions,
776
- ): Promise<BrowserTarget>;
1513
+ ): Promise<BrowserObservation>;
777
1514
  selectBrowserTarget(
778
1515
  workspaceId: string,
779
1516
  browserSessionId: string,
780
1517
  targetId: string,
781
1518
  options?: OpenGeniRequestOptions,
782
- ): Promise<BrowserTarget>;
1519
+ ): Promise<BrowserObservation>;
783
1520
  closeBrowserTarget(
784
1521
  workspaceId: string,
785
1522
  browserSessionId: string,
@@ -792,6 +1529,26 @@ export interface InteractionTransport {
792
1529
  targetId: string,
793
1530
  options?: OpenGeniRequestOptions,
794
1531
  ): Promise<BrowserObservation>;
1532
+ getBrowserTargetState(
1533
+ workspaceId: string,
1534
+ browserSessionId: string,
1535
+ targetId: string,
1536
+ options?: OpenGeniRequestOptions,
1537
+ ): Promise<BrowserTargetState>;
1538
+ readBrowserDom(
1539
+ workspaceId: string,
1540
+ browserSessionId: string,
1541
+ targetId: string,
1542
+ request: BrowserDomReadRequest,
1543
+ options?: OpenGeniRequestOptions,
1544
+ ): Promise<BrowserDomReadResponse>;
1545
+ captureBrowserTarget(
1546
+ workspaceId: string,
1547
+ browserSessionId: string,
1548
+ targetId: string,
1549
+ options?: OpenGeniRequestOptions,
1550
+ captureOptions?: BrowserScreenshotOptions,
1551
+ ): Promise<BrowserFrame>;
795
1552
  actInBrowser(
796
1553
  workspaceId: string,
797
1554
  browserSessionId: string,
@@ -854,6 +1611,16 @@ export interface InteractionTransport {
854
1611
  computerSessionId: string,
855
1612
  options?: OpenGeniRequestOptions,
856
1613
  ): Promise<ComputerSession>;
1614
+ getComputerInputPosture?(
1615
+ workspaceId: string,
1616
+ computerSessionId: string,
1617
+ options?: OpenGeniRequestOptions,
1618
+ ): Promise<ComputerSessionInputPosture>;
1619
+ readComputerClipboard(
1620
+ workspaceId: string,
1621
+ computerSessionId: string,
1622
+ options?: OpenGeniRequestOptions,
1623
+ ): Promise<ComputerClipboard>;
857
1624
  createComputerSession(
858
1625
  workspaceId: string,
859
1626
  request: CreateComputerSessionRequest,
@@ -870,6 +1637,12 @@ export interface InteractionTransport {
870
1637
  targetId: string,
871
1638
  options?: OpenGeniRequestOptions,
872
1639
  ): Promise<ComputerObservation>;
1640
+ captureComputerTarget(
1641
+ workspaceId: string,
1642
+ computerSessionId: string,
1643
+ targetId: string,
1644
+ options?: OpenGeniRequestOptions,
1645
+ ): Promise<ComputerFrame>;
873
1646
  actInComputer(
874
1647
  workspaceId: string,
875
1648
  computerSessionId: string,
@@ -895,58 +1668,373 @@ export interface InteractionTransport {
895
1668
  ): Promise<ComputerSessionHeartbeatResponse>;
896
1669
  endComputerSession(
897
1670
  workspaceId: string,
898
- computerSessionId: string,
899
- request: ComputerSessionLifecycleRequest,
900
- options?: OpenGeniRequestOptions,
901
- ): Promise<ComputerSessionMutationResponse>;
1671
+ computerSessionId: string,
1672
+ request: ComputerSessionLifecycleRequest,
1673
+ options?: OpenGeniRequestOptions,
1674
+ ): Promise<ComputerSessionMutationResponse>;
1675
+ }
1676
+
1677
+ /** @deprecated Use InteractionTransport. */
1678
+ export type BrowserInteractionTransport = InteractionTransport;
1679
+
1680
+ export type BrowserIdentityListOptions = OpenGeniRequestOptions & {
1681
+ includeArchived?: boolean | undefined;
1682
+ };
1683
+
1684
+ export type NetworkRouteListOptions = OpenGeniRequestOptions & {
1685
+ includeArchived?: boolean | undefined;
1686
+ };
1687
+
1688
+ export type SiteAuthConnectionListOptions = OpenGeniRequestOptions & {
1689
+ includeArchived?: boolean | undefined;
1690
+ };
1691
+
1692
+ export type AuthRunListOptions = OpenGeniRequestOptions & {
1693
+ browserSessionId?: string | undefined;
1694
+ siteAuthConnectionId?: string | undefined;
1695
+ includeSettled?: boolean | undefined;
1696
+ };
1697
+
1698
+ export type InteractionInterventionListOptions = OpenGeniRequestOptions & {
1699
+ resourceKind?: "browser_session" | "computer_session" | undefined;
1700
+ resourceId?: string | undefined;
1701
+ includeSettled?: boolean | undefined;
1702
+ };
1703
+
1704
+ export type AttachedBrowserDeviceListOptions = OpenGeniRequestOptions & {
1705
+ includeDisconnected?: boolean | undefined;
1706
+ };
1707
+
1708
+ export type BrowserDownloadSaveOptions = OpenGeniRequestOptions & {
1709
+ operationId?: string | undefined;
1710
+ overwrite?: boolean | undefined;
1711
+ };
1712
+
1713
+ export type CurrentOrOpenBrowserOptions = {
1714
+ workspaceId: string;
1715
+ associationSessionId: string;
1716
+ operationId?: string | undefined;
1717
+ name?: string | undefined;
1718
+ initialUrl?: string | undefined;
1719
+ headless?: boolean | undefined;
1720
+ storageMode?: "private_profile" | "ephemeral_context" | undefined;
1721
+ placement?: InteractionPlacement | undefined;
1722
+ identityId?: string | undefined;
1723
+ baseRevisionId?: string | undefined;
1724
+ networkRouteId?: string | undefined;
1725
+ linkedComputerSessionId?: string | undefined;
1726
+ signal?: AbortSignal | undefined;
1727
+ };
1728
+
1729
+ export type CurrentOrOpenComputerOptions = {
1730
+ workspaceId: string;
1731
+ associationSessionId: string;
1732
+ operationId?: string | undefined;
1733
+ name?: string | undefined;
1734
+ placement?: InteractionPlacement | undefined;
1735
+ signal?: AbortSignal | undefined;
1736
+ };
1737
+
1738
+ /** Framework-free resource facade over the public interaction HTTP API. */
1739
+ export class OpenGeniInteractionClient {
1740
+ readonly attachedBrowsers: AttachedBrowserDeviceCollection;
1741
+ readonly authRuns: AuthRunCollection;
1742
+ readonly browsers: BrowserSessionCollection;
1743
+ readonly computers: ComputerSessionCollection;
1744
+ readonly identities: BrowserIdentityCollection;
1745
+ readonly interventions: InteractionInterventionCollection;
1746
+ readonly networkRoutes: NetworkRouteCollection;
1747
+ readonly siteAuthConnections: SiteAuthConnectionCollection;
1748
+
1749
+ constructor(transport: BrowserInteractionTransport) {
1750
+ this.attachedBrowsers = new AttachedBrowserDeviceCollection(transport);
1751
+ this.authRuns = new AuthRunCollection(transport);
1752
+ this.browsers = new BrowserSessionCollection(transport);
1753
+ this.computers = new ComputerSessionCollection(transport);
1754
+ this.identities = new BrowserIdentityCollection(transport);
1755
+ this.interventions = new InteractionInterventionCollection(transport);
1756
+ this.networkRoutes = new NetworkRouteCollection(transport);
1757
+ this.siteAuthConnections = new SiteAuthConnectionCollection(transport);
1758
+ }
1759
+ }
1760
+
1761
+ export class NetworkRouteCollection {
1762
+ constructor(private readonly transport: BrowserInteractionTransport) {}
1763
+
1764
+ async list(
1765
+ workspaceId: string,
1766
+ options: NetworkRouteListOptions = {},
1767
+ ): Promise<NetworkRouteListResponse> {
1768
+ return await this.transport.listNetworkRoutes(workspaceId, options);
1769
+ }
1770
+
1771
+ route(workspaceId: string, networkRouteId: string): NetworkRouteResource {
1772
+ return new NetworkRouteResource(this.transport, workspaceId, networkRouteId);
1773
+ }
1774
+
1775
+ async create(
1776
+ workspaceId: string,
1777
+ request: CreateNetworkRouteRequest,
1778
+ options: OpenGeniRequestOptions = {},
1779
+ ): Promise<NetworkRouteResource> {
1780
+ const response = await this.transport.createNetworkRoute(workspaceId, request, options);
1781
+ return this.route(workspaceId, response.route.id);
1782
+ }
1783
+ }
1784
+
1785
+ export class NetworkRouteResource {
1786
+ constructor(
1787
+ private readonly transport: BrowserInteractionTransport,
1788
+ readonly workspaceId: string,
1789
+ readonly id: string,
1790
+ ) {}
1791
+
1792
+ async get(options: OpenGeniRequestOptions = {}): Promise<NetworkRoute> {
1793
+ return await this.transport.getNetworkRoute(this.workspaceId, this.id, options);
1794
+ }
1795
+
1796
+ async update(
1797
+ request: UpdateNetworkRouteRequest,
1798
+ options: OpenGeniRequestOptions = {},
1799
+ ): Promise<NetworkRouteMutationResponse> {
1800
+ return await this.transport.updateNetworkRoute(this.workspaceId, this.id, request, options);
1801
+ }
1802
+ }
1803
+
1804
+ export class SiteAuthConnectionCollection {
1805
+ constructor(private readonly transport: BrowserInteractionTransport) {}
1806
+
1807
+ async list(
1808
+ workspaceId: string,
1809
+ options: SiteAuthConnectionListOptions = {},
1810
+ ): Promise<SiteAuthConnectionListResponse> {
1811
+ return await this.transport.listSiteAuthConnections(workspaceId, options);
1812
+ }
1813
+
1814
+ connection(workspaceId: string, connectionId: string): SiteAuthConnectionResource {
1815
+ return new SiteAuthConnectionResource(this.transport, workspaceId, connectionId);
1816
+ }
1817
+
1818
+ async create(
1819
+ workspaceId: string,
1820
+ request: CreateSiteAuthConnectionRequest,
1821
+ options: OpenGeniRequestOptions = {},
1822
+ ): Promise<SiteAuthConnectionResource> {
1823
+ const response = await this.transport.createSiteAuthConnection(workspaceId, request, options);
1824
+ return this.connection(workspaceId, response.connection.id);
1825
+ }
1826
+ }
1827
+
1828
+ export class SiteAuthConnectionResource {
1829
+ constructor(
1830
+ private readonly transport: BrowserInteractionTransport,
1831
+ readonly workspaceId: string,
1832
+ readonly id: string,
1833
+ ) {}
1834
+
1835
+ async get(options: OpenGeniRequestOptions = {}): Promise<SiteAuthConnection> {
1836
+ return await this.transport.getSiteAuthConnection(this.workspaceId, this.id, options);
1837
+ }
1838
+
1839
+ async update(
1840
+ request: UpdateSiteAuthConnectionRequest,
1841
+ options: OpenGeniRequestOptions = {},
1842
+ ): Promise<SiteAuthConnectionMutationResponse> {
1843
+ return await this.transport.updateSiteAuthConnection(
1844
+ this.workspaceId,
1845
+ this.id,
1846
+ request,
1847
+ options,
1848
+ );
1849
+ }
1850
+ }
1851
+
1852
+ export class AuthRunCollection {
1853
+ constructor(private readonly transport: BrowserInteractionTransport) {}
1854
+
1855
+ async list(workspaceId: string, options: AuthRunListOptions = {}): Promise<AuthRunListResponse> {
1856
+ return await this.transport.listAuthRuns(workspaceId, options);
1857
+ }
1858
+
1859
+ async get(
1860
+ workspaceId: string,
1861
+ authRunId: string,
1862
+ options: OpenGeniRequestOptions = {},
1863
+ ): Promise<AuthRun> {
1864
+ return await this.transport.getAuthRun(workspaceId, authRunId, options);
1865
+ }
1866
+
1867
+ run(workspaceId: string, browserSessionId: string, authRunId: string): AuthRunResource {
1868
+ return new AuthRunResource(this.transport, workspaceId, browserSessionId, authRunId);
1869
+ }
902
1870
  }
903
1871
 
904
- /** @deprecated Use InteractionTransport. */
905
- export type BrowserInteractionTransport = InteractionTransport;
1872
+ export class BrowserAuthRunCollection {
1873
+ constructor(
1874
+ private readonly transport: BrowserInteractionTransport,
1875
+ readonly workspaceId: string,
1876
+ readonly browserSessionId: string,
1877
+ ) {}
906
1878
 
907
- export type BrowserIdentityListOptions = OpenGeniRequestOptions & {
908
- includeArchived?: boolean | undefined;
909
- };
1879
+ async list(
1880
+ options: Omit<AuthRunListOptions, "browserSessionId"> = {},
1881
+ ): Promise<AuthRunListResponse> {
1882
+ return await this.transport.listAuthRuns(this.workspaceId, {
1883
+ ...options,
1884
+ browserSessionId: this.browserSessionId,
1885
+ });
1886
+ }
910
1887
 
911
- export type AttachedBrowserDeviceListOptions = OpenGeniRequestOptions & {
912
- includeDisconnected?: boolean | undefined;
913
- };
1888
+ run(authRunId: string): AuthRunResource {
1889
+ return new AuthRunResource(this.transport, this.workspaceId, this.browserSessionId, authRunId);
1890
+ }
914
1891
 
915
- export type CurrentOrOpenBrowserOptions = {
916
- workspaceId: string;
917
- associationSessionId: string;
918
- operationId?: string | undefined;
919
- name?: string | undefined;
920
- initialUrl?: string | undefined;
921
- headless?: boolean | undefined;
922
- placement?: InteractionPlacement | undefined;
923
- identityId?: string | undefined;
924
- baseRevisionId?: string | undefined;
925
- linkedComputerSessionId?: string | undefined;
926
- signal?: AbortSignal | undefined;
927
- };
1892
+ async start(
1893
+ request: StartAuthRunRequest,
1894
+ options: OpenGeniRequestOptions = {},
1895
+ ): Promise<AuthRunResource> {
1896
+ const response = await this.transport.startBrowserAuthRun(
1897
+ this.workspaceId,
1898
+ this.browserSessionId,
1899
+ request,
1900
+ options,
1901
+ );
1902
+ return this.run(response.run.id);
1903
+ }
1904
+ }
928
1905
 
929
- export type CurrentOrOpenComputerOptions = {
930
- workspaceId: string;
931
- associationSessionId: string;
932
- operationId?: string | undefined;
933
- name?: string | undefined;
934
- placement?: InteractionPlacement | undefined;
935
- signal?: AbortSignal | undefined;
936
- };
1906
+ export class AuthRunResource {
1907
+ constructor(
1908
+ private readonly transport: BrowserInteractionTransport,
1909
+ readonly workspaceId: string,
1910
+ readonly browserSessionId: string,
1911
+ readonly id: string,
1912
+ ) {}
937
1913
 
938
- /** Framework-free resource facade over the public interaction HTTP API. */
939
- export class OpenGeniInteractionClient {
940
- readonly attachedBrowsers: AttachedBrowserDeviceCollection;
941
- readonly browsers: BrowserSessionCollection;
942
- readonly computers: ComputerSessionCollection;
943
- readonly identities: BrowserIdentityCollection;
1914
+ async get(options: OpenGeniRequestOptions = {}): Promise<AuthRun> {
1915
+ const run = await this.transport.getAuthRun(this.workspaceId, this.id, options);
1916
+ if (run.browserSessionId !== this.browserSessionId) {
1917
+ throw new Error("AuthRun belongs to another BrowserSession");
1918
+ }
1919
+ return run;
1920
+ }
944
1921
 
945
- constructor(transport: BrowserInteractionTransport) {
946
- this.attachedBrowsers = new AttachedBrowserDeviceCollection(transport);
947
- this.browsers = new BrowserSessionCollection(transport);
948
- this.computers = new ComputerSessionCollection(transport);
949
- this.identities = new BrowserIdentityCollection(transport);
1922
+ async report(
1923
+ request: ReportAuthRunRequest,
1924
+ options: OpenGeniRequestOptions = {},
1925
+ ): Promise<AuthRunMutationResponse> {
1926
+ return await this.transport.reportBrowserAuthRun(
1927
+ this.workspaceId,
1928
+ this.browserSessionId,
1929
+ this.id,
1930
+ request,
1931
+ options,
1932
+ );
1933
+ }
1934
+
1935
+ async protectedFill(
1936
+ request: ProtectedAuthFillRequest,
1937
+ options: OpenGeniRequestOptions = {},
1938
+ ): Promise<ProtectedAuthFillResponse> {
1939
+ return await this.transport.protectedBrowserAuthFill(
1940
+ this.workspaceId,
1941
+ this.browserSessionId,
1942
+ this.id,
1943
+ request,
1944
+ options,
1945
+ );
1946
+ }
1947
+
1948
+ async advanceExternal(
1949
+ request: ExternalAuthRunRequest,
1950
+ options: OpenGeniRequestOptions = {},
1951
+ ): Promise<ExternalAuthRunResponse> {
1952
+ return await this.transport.advanceExternalBrowserAuthRun(
1953
+ this.workspaceId,
1954
+ this.browserSessionId,
1955
+ this.id,
1956
+ request,
1957
+ options,
1958
+ );
1959
+ }
1960
+
1961
+ /** Human-session helper. Hosted provider URLs never appear in model tools. */
1962
+ async openExternalFlow(
1963
+ request: ExternalAuthInteractiveRequest,
1964
+ options: OpenGeniRequestOptions = {},
1965
+ ): Promise<ExternalAuthInteractiveResponse> {
1966
+ return await this.transport.openExternalBrowserAuthFlow(
1967
+ this.workspaceId,
1968
+ this.browserSessionId,
1969
+ this.id,
1970
+ request,
1971
+ options,
1972
+ );
1973
+ }
1974
+
1975
+ async verify(
1976
+ request: VerifyAuthRunRequest,
1977
+ options: OpenGeniRequestOptions = {},
1978
+ ): Promise<AuthRunMutationResponse> {
1979
+ return await this.transport.verifyBrowserAuthRun(
1980
+ this.workspaceId,
1981
+ this.browserSessionId,
1982
+ this.id,
1983
+ request,
1984
+ options,
1985
+ );
1986
+ }
1987
+ }
1988
+
1989
+ export class InteractionInterventionCollection {
1990
+ constructor(private readonly transport: BrowserInteractionTransport) {}
1991
+
1992
+ async list(
1993
+ workspaceId: string,
1994
+ options: InteractionInterventionListOptions = {},
1995
+ ): Promise<InteractionInterventionListResponse> {
1996
+ return await this.transport.listInteractionInterventions(workspaceId, options);
1997
+ }
1998
+
1999
+ intervention(workspaceId: string, interventionId: string): InteractionInterventionResource {
2000
+ return new InteractionInterventionResource(this.transport, workspaceId, interventionId);
2001
+ }
2002
+
2003
+ async create(
2004
+ workspaceId: string,
2005
+ request: CreateInteractionInterventionRequest,
2006
+ options: OpenGeniRequestOptions = {},
2007
+ ): Promise<InteractionInterventionResource> {
2008
+ const response = await this.transport.createInteractionIntervention(
2009
+ workspaceId,
2010
+ request,
2011
+ options,
2012
+ );
2013
+ return this.intervention(workspaceId, response.intervention.id);
2014
+ }
2015
+ }
2016
+
2017
+ export class InteractionInterventionResource {
2018
+ constructor(
2019
+ private readonly transport: BrowserInteractionTransport,
2020
+ readonly workspaceId: string,
2021
+ readonly id: string,
2022
+ ) {}
2023
+
2024
+ async get(options: OpenGeniRequestOptions = {}): Promise<InteractionIntervention> {
2025
+ return await this.transport.getInteractionIntervention(this.workspaceId, this.id, options);
2026
+ }
2027
+
2028
+ async resolve(
2029
+ request: ResolveInteractionInterventionRequest,
2030
+ options: OpenGeniRequestOptions = {},
2031
+ ): Promise<InteractionInterventionMutationResponse> {
2032
+ return await this.transport.resolveInteractionIntervention(
2033
+ this.workspaceId,
2034
+ this.id,
2035
+ request,
2036
+ options,
2037
+ );
950
2038
  }
951
2039
  }
952
2040
 
@@ -1015,6 +2103,13 @@ export class BrowserIdentityResource {
1015
2103
  async revisions(options: OpenGeniRequestOptions = {}): Promise<BrowserRevisionListResponse> {
1016
2104
  return await this.transport.listBrowserRevisions(this.workspaceId, this.id, options);
1017
2105
  }
2106
+
2107
+ async update(
2108
+ request: UpdateBrowserIdentityRequest,
2109
+ options: OpenGeniRequestOptions = {},
2110
+ ): Promise<BrowserIdentityMutationResponse> {
2111
+ return await this.transport.updateBrowserIdentity(this.workspaceId, this.id, request, options);
2112
+ }
1018
2113
  }
1019
2114
 
1020
2115
  export class BrowserSessionCollection {
@@ -1043,7 +2138,13 @@ export class BrowserSessionCollection {
1043
2138
  async currentOrOpen(options: CurrentOrOpenBrowserOptions): Promise<BrowserSessionResource> {
1044
2139
  const requestOptions = options.signal ? { signal: options.signal } : {};
1045
2140
  const listed = await this.list(options.workspaceId, requestOptions);
1046
- const current = newestRelevantBrowser(listed.sessions, options.associationSessionId);
2141
+ const current = newestRelevantBrowser(
2142
+ listed.sessions.filter(
2143
+ (session) =>
2144
+ browserSessionStorageMode(session) === (options.storageMode ?? "private_profile"),
2145
+ ),
2146
+ options.associationSessionId,
2147
+ );
1047
2148
  if (current) {
1048
2149
  const resource = this.session(options.workspaceId, current.id);
1049
2150
  if (current.lifecycle === "suspended") {
@@ -1062,9 +2163,11 @@ export class BrowserSessionCollection {
1062
2163
  ...(options.name !== undefined ? { name: options.name } : {}),
1063
2164
  ...(options.initialUrl !== undefined ? { initialUrl: options.initialUrl } : {}),
1064
2165
  ...(options.headless !== undefined ? { headless: options.headless } : {}),
2166
+ ...(options.storageMode !== undefined ? { storageMode: options.storageMode } : {}),
1065
2167
  ...(options.placement !== undefined ? { placement: options.placement } : {}),
1066
2168
  ...(options.identityId !== undefined ? { identityId: options.identityId } : {}),
1067
2169
  ...(options.baseRevisionId !== undefined ? { baseRevisionId: options.baseRevisionId } : {}),
2170
+ ...(options.networkRouteId !== undefined ? { networkRouteId: options.networkRouteId } : {}),
1068
2171
  ...(options.linkedComputerSessionId !== undefined
1069
2172
  ? { linkedComputerSessionId: options.linkedComputerSessionId }
1070
2173
  : {}),
@@ -1075,6 +2178,9 @@ export class BrowserSessionCollection {
1075
2178
  }
1076
2179
 
1077
2180
  export class BrowserSessionResource {
2181
+ readonly auth: BrowserAuthRunCollection;
2182
+ readonly clipboard: BrowserClipboardResource;
2183
+ readonly downloads: BrowserDownloadCollection;
1078
2184
  readonly tabs: BrowserTargetCollection;
1079
2185
  /** Alias for hosts that prefer the protocol term. */
1080
2186
  readonly targets: BrowserTargetCollection;
@@ -1084,6 +2190,9 @@ export class BrowserSessionResource {
1084
2190
  readonly workspaceId: string,
1085
2191
  readonly id: string,
1086
2192
  ) {
2193
+ this.auth = new BrowserAuthRunCollection(transport, workspaceId, id);
2194
+ this.clipboard = new BrowserClipboardResource(transport, workspaceId, id);
2195
+ this.downloads = new BrowserDownloadCollection(transport, workspaceId, id);
1087
2196
  this.tabs = new BrowserTargetCollection(transport, workspaceId, id);
1088
2197
  this.targets = this.tabs;
1089
2198
  }
@@ -1099,6 +2208,49 @@ export class BrowserSessionResource {
1099
2208
  return await this.transport.observeBrowserTarget(this.workspaceId, this.id, targetId, options);
1100
2209
  }
1101
2210
 
2211
+ async targetState(
2212
+ targetId: string,
2213
+ options: OpenGeniRequestOptions = {},
2214
+ ): Promise<BrowserTargetState> {
2215
+ return await this.transport.getBrowserTargetState(this.workspaceId, this.id, targetId, options);
2216
+ }
2217
+
2218
+ async readDom(
2219
+ targetId: string,
2220
+ request: BrowserDomReadRequest,
2221
+ options: OpenGeniRequestOptions = {},
2222
+ ): Promise<BrowserDomReadResponse> {
2223
+ return await this.transport.readBrowserDom(
2224
+ this.workspaceId,
2225
+ this.id,
2226
+ targetId,
2227
+ request,
2228
+ options,
2229
+ );
2230
+ }
2231
+
2232
+ async capture(
2233
+ targetId: string,
2234
+ options: OpenGeniRequestOptions = {},
2235
+ captureOptions: BrowserScreenshotOptions = {},
2236
+ ): Promise<BrowserFrame> {
2237
+ return await this.transport.captureBrowserTarget(
2238
+ this.workspaceId,
2239
+ this.id,
2240
+ targetId,
2241
+ options,
2242
+ captureOptions,
2243
+ );
2244
+ }
2245
+
2246
+ async screenshot(
2247
+ targetId: string,
2248
+ captureOptions: BrowserScreenshotOptions = {},
2249
+ options: OpenGeniRequestOptions = {},
2250
+ ): Promise<BrowserFrame> {
2251
+ return await this.capture(targetId, options, captureOptions);
2252
+ }
2253
+
1102
2254
  async act(
1103
2255
  request: BrowserActionRequest,
1104
2256
  options: OpenGeniRequestOptions = {},
@@ -1176,6 +2328,97 @@ export class BrowserSessionResource {
1176
2328
  }
1177
2329
  }
1178
2330
 
2331
+ export class BrowserClipboardResource {
2332
+ constructor(
2333
+ private readonly transport: BrowserInteractionTransport,
2334
+ readonly workspaceId: string,
2335
+ readonly browserSessionId: string,
2336
+ ) {}
2337
+
2338
+ async read(options: OpenGeniRequestOptions = {}): Promise<BrowserClipboard> {
2339
+ const clipboard = await this.transport.readBrowserClipboard(
2340
+ this.workspaceId,
2341
+ this.browserSessionId,
2342
+ options,
2343
+ );
2344
+ if (clipboard.browserSessionId !== this.browserSessionId) {
2345
+ throw new Error("Browser clipboard belongs to another BrowserSession");
2346
+ }
2347
+ return clipboard;
2348
+ }
2349
+ }
2350
+
2351
+ export class BrowserDownloadCollection {
2352
+ constructor(
2353
+ private readonly transport: BrowserInteractionTransport,
2354
+ readonly workspaceId: string,
2355
+ readonly browserSessionId: string,
2356
+ ) {}
2357
+
2358
+ async list(options: OpenGeniRequestOptions = {}): Promise<BrowserDownloadListResponse> {
2359
+ return await this.transport.listBrowserDownloads(
2360
+ this.workspaceId,
2361
+ this.browserSessionId,
2362
+ options,
2363
+ );
2364
+ }
2365
+
2366
+ download(downloadId: string): BrowserDownloadResource {
2367
+ return new BrowserDownloadResource(
2368
+ this.transport,
2369
+ this.workspaceId,
2370
+ this.browserSessionId,
2371
+ downloadId,
2372
+ );
2373
+ }
2374
+ }
2375
+
2376
+ export class BrowserDownloadResource {
2377
+ constructor(
2378
+ private readonly transport: BrowserInteractionTransport,
2379
+ readonly workspaceId: string,
2380
+ readonly browserSessionId: string,
2381
+ readonly id: string,
2382
+ ) {}
2383
+
2384
+ async get(options: OpenGeniRequestOptions = {}): Promise<BrowserDownload> {
2385
+ const download = await this.transport.getBrowserDownload(
2386
+ this.workspaceId,
2387
+ this.browserSessionId,
2388
+ this.id,
2389
+ options,
2390
+ );
2391
+ if (download.browserSessionId !== this.browserSessionId) {
2392
+ throw new Error("BrowserDownload belongs to another BrowserSession");
2393
+ }
2394
+ return download;
2395
+ }
2396
+
2397
+ /** Publish this exact private browser download into the source session's
2398
+ * workspace. Pass an operationId when the caller needs retry identity across
2399
+ * process boundaries; otherwise one is generated for this call. */
2400
+ async saveToWorkspace(
2401
+ destinationPath: string,
2402
+ options: BrowserDownloadSaveOptions = {},
2403
+ ): Promise<BrowserDownloadSaveResponse> {
2404
+ const { operationId = crypto.randomUUID(), overwrite = false, ...requestOptions } = options;
2405
+ const response = await this.transport.saveBrowserDownload(
2406
+ this.workspaceId,
2407
+ this.browserSessionId,
2408
+ this.id,
2409
+ { operationId, destinationPath, overwrite },
2410
+ requestOptions,
2411
+ );
2412
+ if (
2413
+ response.download.id !== this.id ||
2414
+ response.download.browserSessionId !== this.browserSessionId
2415
+ ) {
2416
+ throw new Error("BrowserDownload save returned another resource");
2417
+ }
2418
+ return response;
2419
+ }
2420
+ }
2421
+
1179
2422
  export class BrowserTargetCollection {
1180
2423
  constructor(
1181
2424
  private readonly transport: BrowserInteractionTransport,
@@ -1191,7 +2434,7 @@ export class BrowserTargetCollection {
1191
2434
  );
1192
2435
  }
1193
2436
 
1194
- async open(url?: string, options: OpenGeniRequestOptions = {}): Promise<BrowserTarget> {
2437
+ async open(url?: string, options: OpenGeniRequestOptions = {}): Promise<BrowserObservation> {
1195
2438
  return await this.transport.openBrowserTarget(
1196
2439
  this.workspaceId,
1197
2440
  this.browserSessionId,
@@ -1200,7 +2443,10 @@ export class BrowserTargetCollection {
1200
2443
  );
1201
2444
  }
1202
2445
 
1203
- async select(targetId: string, options: OpenGeniRequestOptions = {}): Promise<BrowserTarget> {
2446
+ async select(
2447
+ targetId: string,
2448
+ options: OpenGeniRequestOptions = {},
2449
+ ): Promise<BrowserObservation> {
1204
2450
  return await this.transport.selectBrowserTarget(
1205
2451
  this.workspaceId,
1206
2452
  this.browserSessionId,
@@ -1269,6 +2515,7 @@ export class ComputerSessionResource {
1269
2515
  readonly targets: ComputerTargetCollection;
1270
2516
  /** Native application/window targets are also the public app collection. */
1271
2517
  readonly apps: ComputerTargetCollection;
2518
+ readonly clipboard: ComputerClipboardResource;
1272
2519
 
1273
2520
  constructor(
1274
2521
  private readonly transport: BrowserInteractionTransport,
@@ -1277,6 +2524,7 @@ export class ComputerSessionResource {
1277
2524
  ) {
1278
2525
  this.targets = new ComputerTargetCollection(transport, workspaceId, id);
1279
2526
  this.apps = this.targets;
2527
+ this.clipboard = new ComputerClipboardResource(transport, workspaceId, id);
1280
2528
  }
1281
2529
 
1282
2530
  async get(options: OpenGeniRequestOptions = {}): Promise<ComputerSession> {
@@ -1290,6 +2538,10 @@ export class ComputerSessionResource {
1290
2538
  return await this.transport.observeComputerTarget(this.workspaceId, this.id, targetId, options);
1291
2539
  }
1292
2540
 
2541
+ async capture(targetId: string, options: OpenGeniRequestOptions = {}): Promise<ComputerFrame> {
2542
+ return await this.transport.captureComputerTarget(this.workspaceId, this.id, targetId, options);
2543
+ }
2544
+
1293
2545
  async act(
1294
2546
  request: ComputerActionRequest,
1295
2547
  options: OpenGeniRequestOptions = {},
@@ -1316,6 +2568,13 @@ export class ComputerSessionResource {
1316
2568
  return await this.transport.attachComputerSession(this.workspaceId, this.id, request, options);
1317
2569
  }
1318
2570
 
2571
+ async inputPosture(options: OpenGeniRequestOptions = {}): Promise<ComputerSessionInputPosture> {
2572
+ if (!this.transport.getComputerInputPosture) {
2573
+ throw new Error("Computer input posture requires a current interaction transport.");
2574
+ }
2575
+ return await this.transport.getComputerInputPosture(this.workspaceId, this.id, options);
2576
+ }
2577
+
1319
2578
  async heartbeat(options: OpenGeniRequestOptions = {}): Promise<ComputerSessionHeartbeatResponse> {
1320
2579
  return await this.transport.heartbeatComputerSession(this.workspaceId, this.id, options);
1321
2580
  }
@@ -1328,6 +2587,26 @@ export class ComputerSessionResource {
1328
2587
  }
1329
2588
  }
1330
2589
 
2590
+ export class ComputerClipboardResource {
2591
+ constructor(
2592
+ private readonly transport: BrowserInteractionTransport,
2593
+ readonly workspaceId: string,
2594
+ readonly computerSessionId: string,
2595
+ ) {}
2596
+
2597
+ async read(options: OpenGeniRequestOptions = {}): Promise<ComputerClipboard> {
2598
+ const clipboard = await this.transport.readComputerClipboard(
2599
+ this.workspaceId,
2600
+ this.computerSessionId,
2601
+ options,
2602
+ );
2603
+ if (clipboard.computerSessionId !== this.computerSessionId) {
2604
+ throw new Error("Computer clipboard belongs to another ComputerSession");
2605
+ }
2606
+ return clipboard;
2607
+ }
2608
+ }
2609
+
1331
2610
  export class ComputerTargetCollection {
1332
2611
  constructor(
1333
2612
  private readonly transport: BrowserInteractionTransport,
@@ -1363,6 +2642,14 @@ export type BrowserFrameMetadata = {
1363
2642
 
1364
2643
  export type BrowserFrame = BrowserFrameMetadata & { data: Uint8Array };
1365
2644
 
2645
+ export type BrowserScreenshotOptions = {
2646
+ /** Capture the document content instead of the visible viewport. */
2647
+ fullPage?: boolean;
2648
+ format?: "jpeg" | "png";
2649
+ /** JPEG quality, from 1 to 100. Ignored for PNG. */
2650
+ quality?: number;
2651
+ };
2652
+
1366
2653
  export type ComputerFrameMetadata = {
1367
2654
  frameId: string;
1368
2655
  computerSessionId: string;
@@ -1395,6 +2682,7 @@ export function browserFrameSocketUrl(
1395
2682
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
1396
2683
  throw new Error("browser frame attachment did not contain an HTTP or WebSocket URL");
1397
2684
  }
2685
+ upgradeMixedContentWebSocket(url);
1398
2686
  if (options.format !== undefined) url.searchParams.set("format", options.format);
1399
2687
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
1400
2688
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4_096);
@@ -1417,6 +2705,7 @@ export function computerFrameSocketUrl(
1417
2705
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
1418
2706
  throw new Error("computer frame attachment did not contain an HTTP or WebSocket URL");
1419
2707
  }
2708
+ upgradeMixedContentWebSocket(url);
1420
2709
  if (options.format !== undefined) url.searchParams.set("format", options.format);
1421
2710
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
1422
2711
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4_096);
@@ -1657,6 +2946,28 @@ export function parseComputerFrameMetadata(value: unknown): ComputerFrameMetadat
1657
2946
  return metadata;
1658
2947
  }
1659
2948
 
2949
+ export function decodeComputerFrameMetadataHeader(value: string): ComputerFrameMetadata {
2950
+ if (!value || value.length > 32 * 1024 || !/^[A-Za-z0-9_-]+$/u.test(value)) {
2951
+ throw new Error("computer frame metadata header is invalid");
2952
+ }
2953
+ const normalized = value.replace(/-/gu, "+").replace(/_/gu, "/");
2954
+ const padded = normalized.padEnd(Math.ceil(normalized.length / 4) * 4, "=");
2955
+ let decoded: string;
2956
+ try {
2957
+ decoded = atob(padded);
2958
+ } catch {
2959
+ throw new Error("computer frame metadata header is invalid");
2960
+ }
2961
+ const bytes = Uint8Array.from(decoded, (character) => character.charCodeAt(0));
2962
+ let metadata: unknown;
2963
+ try {
2964
+ metadata = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
2965
+ } catch {
2966
+ throw new Error("computer frame metadata header is invalid");
2967
+ }
2968
+ return parseComputerFrameMetadata(metadata);
2969
+ }
2970
+
1660
2971
  function newestRelevantBrowser(
1661
2972
  sessions: readonly BrowserSession[],
1662
2973
  associationSessionId: string,
@@ -1710,6 +3021,11 @@ function computerRelevance(session: ComputerSession, associationSessionId: strin
1710
3021
  return Math.max(association, Number.isFinite(used) ? used : 0);
1711
3022
  }
1712
3023
 
3024
+ function upgradeMixedContentWebSocket(url: URL): void {
3025
+ const protocol = (globalThis as { location?: { protocol?: string } }).location?.protocol;
3026
+ if (protocol === "https:" && url.protocol === "ws:") url.protocol = "wss:";
3027
+ }
3028
+
1713
3029
  function setBoundedIntegerQuery(
1714
3030
  url: URL,
1715
3031
  name: string,