@opengeni/sdk 0.57.0 → 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 (291) hide show
  1. package/README.md +1017 -26
  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-JDLDDRNE.js → chunk-2UXZUCEZ.js} +291 -34
  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-JRPFWI6T.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-PKQ377ED.js → chunk-FG3OO5LM.js} +2686 -611
  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-YKZME56C.js → chunk-KWADQ227.js} +3 -3
  57. package/dist/{chunk-YKZME56C.js.map → chunk-KWADQ227.js.map} +1 -1
  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-ST5DDKJP.js → chunk-NC57YMUO.js} +121 -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-HJ3HHUT5.js → chunk-YIKA2QT4.js} +33 -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 +740 -94
  81. package/dist/codex-realtime-controller.d.ts +3 -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 +25 -6
  88. package/dist/deprecation.d.ts +47 -0
  89. package/dist/document-authority-client.d.ts +51 -0
  90. package/dist/document-authority.d.ts +2 -0
  91. package/dist/document-authority.js +12 -0
  92. package/dist/document-authority.js.map +1 -0
  93. package/dist/editable-artifacts/browser-session.d.ts +7 -3
  94. package/dist/editable-artifacts/controller.d.ts +4 -1
  95. package/dist/editable-artifacts/errors.d.ts +1 -1
  96. package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
  97. package/dist/editable-artifacts/index.d.ts +2 -0
  98. package/dist/editable-artifacts/open-failure.d.ts +9 -0
  99. package/dist/editable-artifacts/types.d.ts +6 -3
  100. package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
  101. package/dist/editable-artifacts-worker.js +44 -17
  102. package/dist/editable-artifacts-worker.js.map +1 -1
  103. package/dist/editable-artifacts.js +240 -121
  104. package/dist/editable-artifacts.js.map +1 -1
  105. package/dist/embedding-client.d.ts +129 -0
  106. package/dist/errors.d.ts +36 -1
  107. package/dist/feedback.d.ts +23 -0
  108. package/dist/gateway-realtime-transport.js +1 -1
  109. package/dist/github-repositories.d.ts +10 -0
  110. package/dist/github-repositories.js +36 -0
  111. package/dist/github-repositories.js.map +1 -0
  112. package/dist/index.d.ts +56 -11
  113. package/dist/index.js +242 -125
  114. package/dist/index.js.map +1 -1
  115. package/dist/interaction.d.ts +84 -1
  116. package/dist/interaction.js +6 -1
  117. package/dist/knowledge.d.ts +7 -0
  118. package/dist/knowledge.js +20 -0
  119. package/dist/knowledge.js.map +1 -0
  120. package/dist/message-links.d.ts +68 -0
  121. package/dist/model-context.d.ts +68 -0
  122. package/dist/model-display.d.ts +2 -0
  123. package/dist/model-display.js +15 -0
  124. package/dist/model-display.js.map +1 -0
  125. package/dist/model-picker-order.d.ts +1 -0
  126. package/dist/model-picker-order.js +10 -0
  127. package/dist/model-picker-order.js.map +1 -0
  128. package/dist/organization-integration-policy.d.ts +26 -0
  129. package/dist/organization-integration-policy.js +26 -0
  130. package/dist/organization-integration-policy.js.map +1 -0
  131. package/dist/organization-private-session-settings.d.ts +6 -0
  132. package/dist/organization-private-session-settings.js +22 -0
  133. package/dist/organization-private-session-settings.js.map +1 -0
  134. package/dist/organization-user-setup.d.ts +8 -0
  135. package/dist/organization-user-setup.js +16 -0
  136. package/dist/organization-user-setup.js.map +1 -0
  137. package/dist/pr-review-client.d.ts +16 -0
  138. package/dist/pr-review.d.ts +4 -0
  139. package/dist/pr-review.js +62 -0
  140. package/dist/pr-review.js.map +1 -0
  141. package/dist/preference-registry.d.ts +9 -1
  142. package/dist/proxy.d.ts +7 -5
  143. package/dist/realtime.d.ts +3 -1
  144. package/dist/realtime.js +6 -6
  145. package/dist/realtime.js.map +1 -1
  146. package/dist/retained-artifacts.d.ts +5 -1
  147. package/dist/session-history-import.d.ts +22 -0
  148. package/dist/session-history-import.js +36 -0
  149. package/dist/session-history-import.js.map +1 -0
  150. package/dist/session-list-entries.d.ts +1 -0
  151. package/dist/session-list-entries.js +7 -0
  152. package/dist/session-list-entries.js.map +1 -0
  153. package/dist/session-message-search.d.ts +53 -0
  154. package/dist/session-proxy-client.d.ts +24 -0
  155. package/dist/session-proxy.d.ts +245 -0
  156. package/dist/session-proxy.js +24 -0
  157. package/dist/session-proxy.js.map +1 -0
  158. package/dist/session-titles.d.ts +2 -0
  159. package/dist/site-browser-entry.d.ts +1 -0
  160. package/dist/site-browser-runtime.gen.d.ts +1 -0
  161. package/dist/site-document.d.ts +5 -0
  162. package/dist/site-document.js +20 -0
  163. package/dist/site-document.js.map +1 -0
  164. package/dist/site-document.test.d.ts +1 -0
  165. package/dist/site-http.d.ts +16 -0
  166. package/dist/site-tool-bridge.d.ts +44 -0
  167. package/dist/site.d.ts +101 -0
  168. package/dist/site.js +49 -0
  169. package/dist/site.js.map +1 -0
  170. package/dist/skills.d.ts +75 -0
  171. package/dist/stream.d.ts +2 -0
  172. package/dist/tenant-workspaces.d.ts +47 -0
  173. package/dist/tenant-workspaces.js +8 -0
  174. package/dist/tenant-workspaces.js.map +1 -0
  175. package/dist/tool-auth.d.ts +87 -0
  176. package/dist/tool-auth.js +23 -0
  177. package/dist/tool-auth.js.map +1 -0
  178. package/dist/tool-display-metadata.d.ts +3 -0
  179. package/dist/tools-FXBLUWAE.js +12 -0
  180. package/dist/tools-FXBLUWAE.js.map +1 -0
  181. package/dist/tools.d.ts +61 -0
  182. package/dist/types.d.ts +2863 -424
  183. package/dist/usage-allowances.d.ts +36 -0
  184. package/dist/usage-allowances.js +80 -0
  185. package/dist/usage-allowances.js.map +1 -0
  186. package/dist/workspace-artifacts.d.ts +33 -5
  187. package/dist/workspace-instruction-policies.d.ts +24 -2
  188. package/dist/workspace-integrations.d.ts +74 -0
  189. package/dist/workspace-integrations.js +65 -0
  190. package/dist/workspace-integrations.js.map +1 -0
  191. package/dist/workspace-learning.d.ts +124 -0
  192. package/dist/workspace-state.d.ts +8 -71
  193. package/package.json +108 -3
  194. package/src/accounts.ts +443 -0
  195. package/src/adapters/express.ts +136 -0
  196. package/src/adapters/hono.ts +18 -0
  197. package/src/adapters/next.ts +42 -0
  198. package/src/allowance-refusal.ts +5 -0
  199. package/src/artifact-catalog.ts +41 -0
  200. package/src/artifact-client.ts +43 -52
  201. package/src/artifacts.ts +7 -1
  202. package/src/automations-client.ts +124 -0
  203. package/src/automations.ts +15 -0
  204. package/src/browser.ts +54 -0
  205. package/src/chat/fold.ts +431 -0
  206. package/src/chat/handler.ts +240 -0
  207. package/src/chat/http.ts +257 -0
  208. package/src/chat/ids.ts +85 -0
  209. package/src/chat/index.ts +87 -0
  210. package/src/chat/openai.ts +439 -0
  211. package/src/chat/opengeni.ts +722 -0
  212. package/src/chat/types.ts +219 -0
  213. package/src/chat/vercel.ts +204 -0
  214. package/src/chats.ts +16 -0
  215. package/src/client.ts +4084 -515
  216. package/src/codex-realtime-controller.ts +235 -5
  217. package/src/codex-realtime-v3.ts +162 -31
  218. package/src/codex-realtime.ts +1 -1
  219. package/src/company-brain.ts +59 -0
  220. package/src/company-profile.ts +17 -1
  221. package/src/core.ts +23 -1
  222. package/src/deprecation.ts +149 -0
  223. package/src/document-authority-client.ts +219 -0
  224. package/src/document-authority.ts +17 -0
  225. package/src/editable-artifacts/browser-session.ts +36 -22
  226. package/src/editable-artifacts/controller.ts +102 -47
  227. package/src/editable-artifacts/errors.ts +2 -0
  228. package/src/editable-artifacts/http-live-transport.ts +62 -37
  229. package/src/editable-artifacts/index.ts +6 -0
  230. package/src/editable-artifacts/open-failure.ts +79 -0
  231. package/src/editable-artifacts/storage.ts +31 -40
  232. package/src/editable-artifacts/types.ts +6 -3
  233. package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
  234. package/src/editable-artifacts/worker/runtime.ts +26 -13
  235. package/src/editable-artifacts/worker/wire-codec.ts +23 -5
  236. package/src/embedding-client.ts +519 -0
  237. package/src/errors.ts +169 -2
  238. package/src/feedback.ts +20 -0
  239. package/src/gateway-realtime-transport.ts +3 -3
  240. package/src/github-repositories.ts +60 -0
  241. package/src/index.ts +561 -41
  242. package/src/interaction.ts +276 -4
  243. package/src/knowledge.ts +72 -0
  244. package/src/message-links.ts +178 -0
  245. package/src/model-context.ts +112 -0
  246. package/src/model-display.ts +10 -0
  247. package/src/model-picker-order.ts +6 -0
  248. package/src/organization-integration-policy.ts +54 -0
  249. package/src/organization-private-session-settings.ts +33 -0
  250. package/src/organization-user-setup.ts +31 -0
  251. package/src/pr-review-client.ts +92 -0
  252. package/src/pr-review.ts +17 -0
  253. package/src/preference-registry.ts +11 -0
  254. package/src/proxy.ts +17 -6
  255. package/src/realtime.ts +1 -0
  256. package/src/retained-artifacts.ts +101 -0
  257. package/src/session-history-import.ts +84 -0
  258. package/src/session-list-entries.ts +1 -0
  259. package/src/session-message-search.ts +47 -0
  260. package/src/session-proxy-client.ts +64 -0
  261. package/src/session-proxy.ts +1473 -0
  262. package/src/session-titles.ts +10 -0
  263. package/src/site-browser-entry.ts +6 -0
  264. package/src/site-browser-runtime.gen.ts +2 -0
  265. package/src/site-document.test.ts +64 -0
  266. package/src/site-document.ts +18 -0
  267. package/src/site-http.ts +162 -0
  268. package/src/site-tool-bridge.ts +146 -0
  269. package/src/site.ts +585 -0
  270. package/src/skills.ts +69 -0
  271. package/src/sse.ts +8 -2
  272. package/src/stream.ts +38 -4
  273. package/src/tenant-workspaces.ts +148 -0
  274. package/src/tool-auth.ts +301 -0
  275. package/src/tool-display-metadata.ts +19 -0
  276. package/src/tools.ts +396 -0
  277. package/src/types.ts +3346 -501
  278. package/src/usage-allowances.ts +189 -0
  279. package/src/workspace-artifacts.ts +40 -6
  280. package/src/workspace-instruction-policies.ts +26 -1
  281. package/src/workspace-integrations.ts +402 -0
  282. package/src/workspace-learning.ts +138 -0
  283. package/src/workspace-state.ts +8 -82
  284. package/dist/chunk-GU6JF75T.js +0 -119
  285. package/dist/chunk-GU6JF75T.js.map +0 -1
  286. package/dist/chunk-HJ3HHUT5.js.map +0 -1
  287. package/dist/chunk-JDLDDRNE.js.map +0 -1
  288. package/dist/chunk-JRPFWI6T.js.map +0 -1
  289. package/dist/chunk-PKQ377ED.js.map +0 -1
  290. package/dist/chunk-ST5DDKJP.js.map +0 -1
  291. 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. */
@@ -28,6 +41,83 @@ export type InteractionJsonValue =
28
41
  | InteractionJsonValue[]
29
42
  | { [key: string]: InteractionJsonValue };
30
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
+
31
121
  export type InteractionPlacement =
32
122
  | { kind: "sandbox_group"; sandboxGroupId: string }
33
123
  | { kind: "connected_machine"; sandboxId: string }
@@ -71,8 +161,18 @@ export type AttachedBrowserDevice = {
71
161
  updatedAt: string;
72
162
  };
73
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
+
74
173
  export type AttachedBrowserDeviceListResponse = {
75
174
  revision: number;
175
+ bridges: AttachedBrowserBridge[];
76
176
  devices: AttachedBrowserDevice[];
77
177
  };
78
178
 
@@ -714,6 +814,17 @@ export type BrowserObservation = {
714
814
  frameId: string | null;
715
815
  semantic: InteractionSemanticSnapshot | InteractionSemanticDiff | null;
716
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;
717
828
  focusedRef: string | null;
718
829
  changedRegions: InteractionRect[];
719
830
  diagnostics: InteractionDiagnosticSummary;
@@ -775,6 +886,15 @@ export type BrowserPermissionSetting = "granted" | "denied" | "prompt";
775
886
 
776
887
  export type BrowserAction =
777
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
+ }
778
898
  | {
779
899
  type: "click";
780
900
  locator: BrowserLocator;
@@ -831,7 +951,11 @@ export type BrowserAction =
831
951
  timeoutMs?: number | undefined;
832
952
  };
833
953
 
834
- export type BrowserActionBatch = { type: "batch"; actions: BrowserAction[] };
954
+ export type BrowserActionBatch = {
955
+ type: "batch";
956
+ actions: BrowserAction[];
957
+ fenceEachAction?: true | undefined;
958
+ };
835
959
 
836
960
  export type InteractionError = {
837
961
  code:
@@ -886,6 +1010,7 @@ export type CreateBrowserSessionRequest = {
886
1010
  name?: string | undefined;
887
1011
  initialUrl?: string | undefined;
888
1012
  headless?: boolean | undefined;
1013
+ storageMode?: "private_profile" | "ephemeral_context" | undefined;
889
1014
  engine?: "chromium" | "lightpanda" | undefined;
890
1015
  placement?: InteractionPlacement | undefined;
891
1016
  identityId?: string | undefined;
@@ -930,13 +1055,16 @@ export type InteractionFrameStreamAttachment<RelayKind extends 3 | 4 = 3 | 4> =
930
1055
 
931
1056
  export type ComputerFrameStreamAttachment =
932
1057
  | InteractionFrameStreamAttachment<4>
933
- | { kind: "direct_rfb"; url: string; protocols: string[] };
1058
+ | { kind: "direct_rfb"; url: string; protocols: string[]; inputAllowed: boolean };
934
1059
 
935
1060
  export type BrowserSessionAttachment = {
936
1061
  browserSessionId: string;
937
1062
  controllerGeneration: string;
938
1063
  targetId: string;
939
1064
  stream: InteractionFrameStreamAttachment<3>;
1065
+ /** Negotiated from this attachment’s live controller, absent on older helpers. */
1066
+ fencedInputBatches?: true | undefined;
1067
+ focusedInputObservations?: true | undefined;
940
1068
  expiresAt: string;
941
1069
  };
942
1070
 
@@ -952,7 +1080,10 @@ export type BrowserActionRequest = {
952
1080
  expectedTargetGeneration: string;
953
1081
  expectedDocumentGeneration: string | null;
954
1082
  expectedFrameId: string | null;
955
- observationMode?: "full" | "none" | undefined;
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;
956
1087
  action: BrowserAction | BrowserActionBatch;
957
1088
  };
958
1089
 
@@ -986,6 +1117,8 @@ export type ComputerSessionCapabilities = {
986
1117
  keyboardInput: boolean;
987
1118
  clipboard: boolean;
988
1119
  backgroundActions: boolean;
1120
+ /** Raw window input stays in the background. Absent means foreground-only. */
1121
+ backgroundInput?: boolean | undefined;
989
1122
  parallelApps: boolean;
990
1123
  };
991
1124
 
@@ -1133,10 +1266,19 @@ export type ComputerSessionAttachment = {
1133
1266
  computerSessionId: string;
1134
1267
  controllerGeneration: string;
1135
1268
  targetId: string;
1269
+ /** Viewer posture when attached; actions still reauthorize the live source. */
1270
+ inputAllowed?: boolean | undefined;
1136
1271
  stream: ComputerFrameStreamAttachment;
1137
1272
  expiresAt: string;
1138
1273
  };
1139
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
+
1140
1282
  export type ComputerSessionAttachmentRequest = {
1141
1283
  targetId: string;
1142
1284
  expiresInSeconds?: number | undefined;
@@ -1387,6 +1529,26 @@ export interface InteractionTransport {
1387
1529
  targetId: string,
1388
1530
  options?: OpenGeniRequestOptions,
1389
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>;
1390
1552
  actInBrowser(
1391
1553
  workspaceId: string,
1392
1554
  browserSessionId: string,
@@ -1449,6 +1611,11 @@ export interface InteractionTransport {
1449
1611
  computerSessionId: string,
1450
1612
  options?: OpenGeniRequestOptions,
1451
1613
  ): Promise<ComputerSession>;
1614
+ getComputerInputPosture?(
1615
+ workspaceId: string,
1616
+ computerSessionId: string,
1617
+ options?: OpenGeniRequestOptions,
1618
+ ): Promise<ComputerSessionInputPosture>;
1452
1619
  readComputerClipboard(
1453
1620
  workspaceId: string,
1454
1621
  computerSessionId: string,
@@ -1470,6 +1637,12 @@ export interface InteractionTransport {
1470
1637
  targetId: string,
1471
1638
  options?: OpenGeniRequestOptions,
1472
1639
  ): Promise<ComputerObservation>;
1640
+ captureComputerTarget(
1641
+ workspaceId: string,
1642
+ computerSessionId: string,
1643
+ targetId: string,
1644
+ options?: OpenGeniRequestOptions,
1645
+ ): Promise<ComputerFrame>;
1473
1646
  actInComputer(
1474
1647
  workspaceId: string,
1475
1648
  computerSessionId: string,
@@ -1544,6 +1717,7 @@ export type CurrentOrOpenBrowserOptions = {
1544
1717
  name?: string | undefined;
1545
1718
  initialUrl?: string | undefined;
1546
1719
  headless?: boolean | undefined;
1720
+ storageMode?: "private_profile" | "ephemeral_context" | undefined;
1547
1721
  placement?: InteractionPlacement | undefined;
1548
1722
  identityId?: string | undefined;
1549
1723
  baseRevisionId?: string | undefined;
@@ -1964,7 +2138,13 @@ export class BrowserSessionCollection {
1964
2138
  async currentOrOpen(options: CurrentOrOpenBrowserOptions): Promise<BrowserSessionResource> {
1965
2139
  const requestOptions = options.signal ? { signal: options.signal } : {};
1966
2140
  const listed = await this.list(options.workspaceId, requestOptions);
1967
- 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
+ );
1968
2148
  if (current) {
1969
2149
  const resource = this.session(options.workspaceId, current.id);
1970
2150
  if (current.lifecycle === "suspended") {
@@ -1983,6 +2163,7 @@ export class BrowserSessionCollection {
1983
2163
  ...(options.name !== undefined ? { name: options.name } : {}),
1984
2164
  ...(options.initialUrl !== undefined ? { initialUrl: options.initialUrl } : {}),
1985
2165
  ...(options.headless !== undefined ? { headless: options.headless } : {}),
2166
+ ...(options.storageMode !== undefined ? { storageMode: options.storageMode } : {}),
1986
2167
  ...(options.placement !== undefined ? { placement: options.placement } : {}),
1987
2168
  ...(options.identityId !== undefined ? { identityId: options.identityId } : {}),
1988
2169
  ...(options.baseRevisionId !== undefined ? { baseRevisionId: options.baseRevisionId } : {}),
@@ -2027,6 +2208,49 @@ export class BrowserSessionResource {
2027
2208
  return await this.transport.observeBrowserTarget(this.workspaceId, this.id, targetId, options);
2028
2209
  }
2029
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
+
2030
2254
  async act(
2031
2255
  request: BrowserActionRequest,
2032
2256
  options: OpenGeniRequestOptions = {},
@@ -2314,6 +2538,10 @@ export class ComputerSessionResource {
2314
2538
  return await this.transport.observeComputerTarget(this.workspaceId, this.id, targetId, options);
2315
2539
  }
2316
2540
 
2541
+ async capture(targetId: string, options: OpenGeniRequestOptions = {}): Promise<ComputerFrame> {
2542
+ return await this.transport.captureComputerTarget(this.workspaceId, this.id, targetId, options);
2543
+ }
2544
+
2317
2545
  async act(
2318
2546
  request: ComputerActionRequest,
2319
2547
  options: OpenGeniRequestOptions = {},
@@ -2340,6 +2568,13 @@ export class ComputerSessionResource {
2340
2568
  return await this.transport.attachComputerSession(this.workspaceId, this.id, request, options);
2341
2569
  }
2342
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
+
2343
2578
  async heartbeat(options: OpenGeniRequestOptions = {}): Promise<ComputerSessionHeartbeatResponse> {
2344
2579
  return await this.transport.heartbeatComputerSession(this.workspaceId, this.id, options);
2345
2580
  }
@@ -2407,6 +2642,14 @@ export type BrowserFrameMetadata = {
2407
2642
 
2408
2643
  export type BrowserFrame = BrowserFrameMetadata & { data: Uint8Array };
2409
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
+
2410
2653
  export type ComputerFrameMetadata = {
2411
2654
  frameId: string;
2412
2655
  computerSessionId: string;
@@ -2439,6 +2682,7 @@ export function browserFrameSocketUrl(
2439
2682
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
2440
2683
  throw new Error("browser frame attachment did not contain an HTTP or WebSocket URL");
2441
2684
  }
2685
+ upgradeMixedContentWebSocket(url);
2442
2686
  if (options.format !== undefined) url.searchParams.set("format", options.format);
2443
2687
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
2444
2688
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4_096);
@@ -2461,6 +2705,7 @@ export function computerFrameSocketUrl(
2461
2705
  else if (url.protocol !== "ws:" && url.protocol !== "wss:") {
2462
2706
  throw new Error("computer frame attachment did not contain an HTTP or WebSocket URL");
2463
2707
  }
2708
+ upgradeMixedContentWebSocket(url);
2464
2709
  if (options.format !== undefined) url.searchParams.set("format", options.format);
2465
2710
  setBoundedIntegerQuery(url, "quality", options.quality, 1, 100);
2466
2711
  setBoundedIntegerQuery(url, "maxWidth", options.maxWidth, 1, 4_096);
@@ -2701,6 +2946,28 @@ export function parseComputerFrameMetadata(value: unknown): ComputerFrameMetadat
2701
2946
  return metadata;
2702
2947
  }
2703
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
+
2704
2971
  function newestRelevantBrowser(
2705
2972
  sessions: readonly BrowserSession[],
2706
2973
  associationSessionId: string,
@@ -2754,6 +3021,11 @@ function computerRelevance(session: ComputerSession, associationSessionId: strin
2754
3021
  return Math.max(association, Number.isFinite(used) ? used : 0);
2755
3022
  }
2756
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
+
2757
3029
  function setBoundedIntegerQuery(
2758
3030
  url: URL,
2759
3031
  name: string,
@@ -0,0 +1,72 @@
1
+ export type {
2
+ AgentLearningMode,
3
+ AgentLearningCategory,
4
+ AgentLearningDefaults,
5
+ AgentLearningOverrides,
6
+ AgentLearningContext,
7
+ AgentLearningOverridePatch,
8
+ AgentLearningSettingsRecord,
9
+ AgentLearningOverrideRecord,
10
+ SaveAgentLearningSettingsRequest,
11
+ KnowledgeFilePreparationResult,
12
+ KnowledgeSavePreparationRequest,
13
+ KnowledgeSavePreparationResponse,
14
+ KnowledgeOriginalFileDownload,
15
+ KnowledgeEntryKind,
16
+ KnowledgeEntryScope,
17
+ KnowledgeIndexStatus,
18
+ KnowledgeEntryContent,
19
+ KnowledgeEntrySource,
20
+ KnowledgeEntryEvidence,
21
+ KnowledgeEntryRelationship,
22
+ KnowledgeEntryRecord,
23
+ KnowledgeEntrySummary,
24
+ KnowledgeEntrySaveRequest,
25
+ KnowledgeEntryReviewRequest,
26
+ KnowledgeEntryBatchReviewRequest,
27
+ KnowledgeEntryRestoreRequest,
28
+ KnowledgeEntryWriteReceipt,
29
+ KnowledgeEntryListRequest,
30
+ KnowledgeEntryListResponse,
31
+ KnowledgeReviewBatch,
32
+ KnowledgeReviewBatchListRequest,
33
+ KnowledgeReviewBatchListResponse,
34
+ AgentInstructionReviewRequest,
35
+ AgentInstructionReceipt,
36
+ AgentInstructionReviewItem,
37
+ AgentInstructionReviewListResponse,
38
+ } from "@opengeni/contracts";
39
+
40
+ import type { OpenGeniClient } from "./client";
41
+ import type {
42
+ KnowledgeSavePreparationRequest,
43
+ KnowledgeSavePreparationResponse,
44
+ KnowledgeFilePreparationResult,
45
+ } from "@opengeni/contracts";
46
+
47
+ /** Agent-only source preparation is a focused transport surface, outside the browser client. */
48
+ export async function prepareKnowledgeFile(
49
+ client: Pick<OpenGeniClient, "requestJson">,
50
+ workspaceId: string,
51
+ fileId: string,
52
+ purpose?: "evidence" | "reference",
53
+ ): Promise<KnowledgeFilePreparationResult> {
54
+ return client.requestJson(
55
+ "POST",
56
+ `/v1/workspaces/${encodeURIComponent(workspaceId)}/knowledge/files/${encodeURIComponent(fileId)}/prepare`,
57
+ purpose ? { purpose } : undefined,
58
+ );
59
+ }
60
+
61
+ /** Read-only collection/duplicate discovery for a live selected agent or human Knowledge reviewer. */
62
+ export async function prepareKnowledgeSave(
63
+ client: Pick<OpenGeniClient, "requestJson">,
64
+ workspaceId: string,
65
+ request: KnowledgeSavePreparationRequest,
66
+ ): Promise<KnowledgeSavePreparationResponse> {
67
+ return client.requestJson(
68
+ "POST",
69
+ `/v1/workspaces/${encodeURIComponent(workspaceId)}/knowledge/entries/prepare-save`,
70
+ request,
71
+ );
72
+ }