@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
package/dist/realtime.js CHANGED
@@ -23,22 +23,25 @@ import {
23
23
  sessionRealtimeOwnerStorageKey,
24
24
  sessionRealtimeOwnerStorageNamespace,
25
25
  startCodexRealtimeWebrtc
26
- } from "./chunk-KIHGPM7H.js";
27
- import "./chunk-V5F253OG.js";
26
+ } from "./chunk-2UXZUCEZ.js";
28
27
  import {
29
- createGatewayRealtimeTransportStarter
30
- } from "./chunk-DXDL7EEW.js";
28
+ createGatewayRealtimeTransportStarter,
29
+ createXaiSubscriptionRealtimeTransportStarter
30
+ } from "./chunk-KWADQ227.js";
31
+ import "./chunk-V6GIY62B.js";
31
32
 
32
33
  // src/realtime.ts
33
34
  function sessionRealtimeTransportKind(model) {
34
- return model === "gpt-live-1-boulder-alpha" ? "codex" : "gateway";
35
+ if (model === "gpt-live-1-boulder-alpha") return "codex";
36
+ if (model === "supergrok/grok-voice-think-fast-2.0") return "xai-subscription";
37
+ return "gateway";
35
38
  }
36
39
  function createSessionRealtimeController(options) {
37
40
  const transport = sessionRealtimeTransportKind(options.model);
38
41
  return createCodexRealtimeController({
39
42
  ...options,
40
43
  ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),
41
- ...transport === "gateway" ? { startTransport: createGatewayRealtimeTransportStarter() } : {}
44
+ ...transport === "gateway" ? { startTransport: createGatewayRealtimeTransportStarter() } : transport === "xai-subscription" ? { startTransport: createXaiSubscriptionRealtimeTransportStarter() } : {}
42
45
  });
43
46
  }
44
47
  export {
@@ -60,6 +63,7 @@ export {
60
63
  createCodexRealtimeV3Bridge,
61
64
  createGatewayRealtimeTransportStarter,
62
65
  createSessionRealtimeController,
66
+ createXaiSubscriptionRealtimeTransportStarter,
63
67
  encodeCodexRealtimeV3DelegationContextAppend,
64
68
  encodeCodexRealtimeV3SessionContextAppend,
65
69
  hasStoredSessionRealtimeOwnerProof,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/realtime.ts"],"sourcesContent":["/**\n * Public, provider-neutral realtime browser SDK.\n *\n * Import this subpath lazily in browser applications. The base `@opengeni/sdk`\n * entry remains free of eager realtime transport initialization.\n */\nimport {\n createCodexRealtimeController,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n type CodexRealtimeController,\n type CodexRealtimeControllerClient,\n type CodexRealtimeControllerSnapshot,\n type CodexRealtimeControllerStatus,\n type CodexRealtimeDiagnostic,\n type CodexRealtimeDiagnosticKind,\n type CodexRealtimeMicrophoneState,\n type CodexRealtimeOwnerStorage,\n type CreateCodexRealtimeControllerOptions,\n type RealtimeControllerTransportStarter,\n} from \"./codex-realtime-controller\";\nimport { createGatewayRealtimeTransportStarter } from \"./gateway-realtime-transport\";\nimport type { SessionRealtimeModel, WorkspaceRealtimeModelCatalogResponse } from \"./types\";\n\n/** Exact backend-facing methods required by the batteries-included realtime SDK. */\nexport type SessionRealtimeClientLike = CodexRealtimeControllerClient & {\n getWorkspaceRealtimeModelCatalog(\n workspaceId: string,\n ): Promise<WorkspaceRealtimeModelCatalogResponse>;\n};\n\nexport type SessionRealtimeTransportKind = \"codex\" | \"gateway\";\n\n/** Provider-neutral names for the existing, battle-tested controller projection. */\nexport type SessionRealtimeController = CodexRealtimeController;\nexport type SessionRealtimeControllerSnapshot = CodexRealtimeControllerSnapshot;\nexport type SessionRealtimeControllerStatus = CodexRealtimeControllerStatus;\nexport type SessionRealtimeDiagnostic = CodexRealtimeDiagnostic;\nexport type SessionRealtimeDiagnosticKind = CodexRealtimeDiagnosticKind;\nexport type SessionRealtimeMicrophoneState = CodexRealtimeMicrophoneState;\nexport type SessionRealtimeOwnerStorage = CodexRealtimeOwnerStorage;\n\nexport type CreateSessionRealtimeControllerOptions = Omit<\n CreateCodexRealtimeControllerOptions,\n \"client\" | \"model\" | \"ownerStorageNamespace\" | \"startTransport\"\n> & {\n client: CodexRealtimeControllerClient;\n model: SessionRealtimeModel;\n};\n\n/** Select the existing transport without exposing provider mechanics to hosts. */\nexport function sessionRealtimeTransportKind(\n model: SessionRealtimeModel,\n): SessionRealtimeTransportKind {\n return model === \"gpt-live-1-boulder-alpha\" ? \"codex\" : \"gateway\";\n}\n\n/**\n * Compose the exact current controller with its existing Codex Live or AI\n * Gateway transport. Wire, ledger, delegation, recovery, and lifecycle\n * semantics remain owned by the existing implementations below this facade.\n */\nexport function createSessionRealtimeController(\n options: CreateSessionRealtimeControllerOptions,\n): SessionRealtimeController {\n const transport = sessionRealtimeTransportKind(options.model);\n return createCodexRealtimeController({\n ...options,\n ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),\n ...(transport === \"gateway\" ? { startTransport: createGatewayRealtimeTransportStarter() } : {}),\n });\n}\n\nexport {\n createCodexRealtimeController,\n createGatewayRealtimeTransportStarter,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n};\nexport type {\n CodexRealtimeController,\n CodexRealtimeControllerClient,\n CodexRealtimeControllerSnapshot,\n CodexRealtimeControllerStatus,\n CodexRealtimeDiagnostic,\n CodexRealtimeDiagnosticKind,\n CodexRealtimeMicrophoneState,\n CodexRealtimeOwnerStorage,\n CreateCodexRealtimeControllerOptions,\n RealtimeControllerTransportStarter,\n};\n\nexport {\n CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,\n projectSessionRealtimeLifecycle,\n} from \"./codex-realtime-controller\";\nexport type { SessionRealtimeLifecycleProjection } from \"./codex-realtime-lifecycle\";\n\nexport {\n CodexRealtimeMicrophoneError,\n acquireCodexRealtimeMicrophone,\n codexRealtimeMicrophoneHealthy,\n startCodexRealtimeWebrtc,\n} from \"./codex-realtime\";\nexport type {\n AcquireCodexRealtimeMicrophoneOptions,\n CodexRealtimeAudibleOutputState,\n CodexRealtimeConnectionHealth,\n CodexRealtimeMicrophoneErrorCode,\n CodexRealtimeNegotiator,\n CodexRealtimeWebrtcSession,\n StartCodexRealtimeWebrtcOptions,\n} from \"./codex-realtime\";\n\nexport {\n CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,\n CODEX_REALTIME_V3_MAX_EVENT_BYTES,\n CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,\n CODEX_REALTIME_V3_MAX_TEXT_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,\n CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,\n contextAppendChunks,\n createCodexRealtimeV3Bridge,\n encodeCodexRealtimeV3DelegationContextAppend,\n encodeCodexRealtimeV3SessionContextAppend,\n parseCodexRealtimeV3Event,\n} from \"./codex-realtime-v3\";\nexport type {\n CodexRealtimeV3Bridge,\n CodexRealtimeV3BridgeFatal,\n CodexRealtimeV3BridgeOptions,\n CodexRealtimeV3BridgeSnapshot,\n CodexRealtimeV3ContextAppendChannel,\n CodexRealtimeV3DelegationContextAppend,\n CodexRealtimeV3Event,\n CodexRealtimeV3ParseFailure,\n CodexRealtimeV3ParseResult,\n CodexRealtimeV3SessionContextAppend,\n} from \"./codex-realtime-v3\";\n\nexport {\n CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,\n CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,\n} from \"./codex-realtime-v3-wire\";\nexport type { CodexRealtimeInitialItem } from \"./codex-realtime-v3-wire\";\n\nexport type {\n ActivateCodexRealtimeConnectionRequest,\n BeginSessionRealtimeRequest,\n CodexRealtimeVoice,\n CodexRealtimeWebrtcRequest,\n CodexRealtimeWebrtcResponse,\n CodexRealtimeWebrtcVersion,\n EndSessionRealtimeRequest,\n GatewayRealtimeConnectRequest,\n GatewayRealtimeConnectResponse,\n GatewayRealtimeInitialItem,\n RenewSessionRealtimeRequest,\n SessionRealtimeEndReason,\n SessionRealtimeLedgerEntry,\n SessionRealtimeMode,\n SessionRealtimeModel,\n SessionRealtimeMutationResponse,\n SessionRealtimeState,\n SyncSessionRealtimeLedgerRequest,\n SyncSessionRealtimeLedgerResponse,\n WorkspaceRealtimeModelCatalogItem,\n WorkspaceRealtimeModelCatalogResponse,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDO,SAAS,6BACd,OAC8B;AAC9B,SAAO,UAAU,6BAA6B,UAAU;AAC1D;AAOO,SAAS,gCACd,SAC2B;AAC3B,QAAM,YAAY,6BAA6B,QAAQ,KAAK;AAC5D,SAAO,8BAA8B;AAAA,IACnC,GAAG;AAAA,IACH,uBAAuB,qCAAqC,QAAQ,KAAK;AAAA,IACzE,GAAI,cAAc,YAAY,EAAE,gBAAgB,sCAAsC,EAAE,IAAI,CAAC;AAAA,EAC/F,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/realtime.ts"],"sourcesContent":["/**\n * Public, provider-neutral realtime browser SDK.\n *\n * Import this subpath lazily in browser applications. The base `@opengeni/sdk`\n * entry remains free of eager realtime transport initialization.\n */\nimport {\n createCodexRealtimeController,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n type CodexRealtimeController,\n type CodexRealtimeControllerClient,\n type CodexRealtimeControllerSnapshot,\n type CodexRealtimeControllerStatus,\n type CodexRealtimeDiagnostic,\n type CodexRealtimeDiagnosticKind,\n type CodexRealtimeMicrophoneState,\n type CodexRealtimeOwnerStorage,\n type CreateCodexRealtimeControllerOptions,\n type RealtimeControllerTransportStarter,\n} from \"./codex-realtime-controller\";\nimport {\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n} from \"./gateway-realtime-transport\";\nimport type { SessionRealtimeModel, WorkspaceRealtimeModelCatalogResponse } from \"./types\";\n\n/** Exact backend-facing methods required by the batteries-included realtime SDK. */\nexport type SessionRealtimeClientLike = CodexRealtimeControllerClient & {\n getWorkspaceRealtimeModelCatalog(\n workspaceId: string,\n options?: { signal?: AbortSignal | undefined },\n ): Promise<WorkspaceRealtimeModelCatalogResponse>;\n};\n\nexport type SessionRealtimeTransportKind = \"codex\" | \"gateway\" | \"xai-subscription\";\n\n/** Provider-neutral names for the existing, battle-tested controller projection. */\nexport type SessionRealtimeController = CodexRealtimeController;\nexport type SessionRealtimeControllerSnapshot = CodexRealtimeControllerSnapshot;\nexport type SessionRealtimeControllerStatus = CodexRealtimeControllerStatus;\nexport type SessionRealtimeDiagnostic = CodexRealtimeDiagnostic;\nexport type SessionRealtimeDiagnosticKind = CodexRealtimeDiagnosticKind;\nexport type SessionRealtimeMicrophoneState = CodexRealtimeMicrophoneState;\nexport type SessionRealtimeOwnerStorage = CodexRealtimeOwnerStorage;\n\nexport type CreateSessionRealtimeControllerOptions = Omit<\n CreateCodexRealtimeControllerOptions,\n \"client\" | \"model\" | \"ownerStorageNamespace\" | \"startTransport\"\n> & {\n client: CodexRealtimeControllerClient;\n model: SessionRealtimeModel;\n};\n\n/** Select the existing transport without exposing provider mechanics to hosts. */\nexport function sessionRealtimeTransportKind(\n model: SessionRealtimeModel,\n): SessionRealtimeTransportKind {\n if (model === \"gpt-live-1-boulder-alpha\") return \"codex\";\n if (model === \"supergrok/grok-voice-think-fast-2.0\") return \"xai-subscription\";\n return \"gateway\";\n}\n\n/**\n * Compose the exact current controller with its existing Codex Live or AI\n * Gateway transport. Wire, ledger, delegation, recovery, and lifecycle\n * semantics remain owned by the existing implementations below this facade.\n */\nexport function createSessionRealtimeController(\n options: CreateSessionRealtimeControllerOptions,\n): SessionRealtimeController {\n const transport = sessionRealtimeTransportKind(options.model);\n return createCodexRealtimeController({\n ...options,\n ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),\n ...(transport === \"gateway\"\n ? { startTransport: createGatewayRealtimeTransportStarter() }\n : transport === \"xai-subscription\"\n ? { startTransport: createXaiSubscriptionRealtimeTransportStarter() }\n : {}),\n });\n}\n\nexport {\n createCodexRealtimeController,\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n};\nexport type {\n CodexRealtimeController,\n CodexRealtimeControllerClient,\n CodexRealtimeControllerSnapshot,\n CodexRealtimeControllerStatus,\n CodexRealtimeDiagnostic,\n CodexRealtimeDiagnosticKind,\n CodexRealtimeMicrophoneState,\n CodexRealtimeOwnerStorage,\n CreateCodexRealtimeControllerOptions,\n RealtimeControllerTransportStarter,\n};\n\nexport {\n CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,\n projectSessionRealtimeLifecycle,\n} from \"./codex-realtime-controller\";\nexport type { SessionRealtimeLifecycleProjection } from \"./codex-realtime-lifecycle\";\n\nexport {\n CodexRealtimeMicrophoneError,\n acquireCodexRealtimeMicrophone,\n codexRealtimeMicrophoneHealthy,\n startCodexRealtimeWebrtc,\n} from \"./codex-realtime\";\nexport type {\n AcquireCodexRealtimeMicrophoneOptions,\n CodexRealtimeAudibleOutputState,\n CodexRealtimeConnectionHealth,\n CodexRealtimeMicrophoneErrorCode,\n CodexRealtimeNegotiator,\n CodexRealtimeWebrtcSession,\n StartCodexRealtimeWebrtcOptions,\n} from \"./codex-realtime\";\n\nexport {\n CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,\n CODEX_REALTIME_V3_MAX_EVENT_BYTES,\n CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,\n CODEX_REALTIME_V3_MAX_TEXT_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,\n CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,\n contextAppendChunks,\n createCodexRealtimeV3Bridge,\n encodeCodexRealtimeV3DelegationContextAppend,\n encodeCodexRealtimeV3SessionContextAppend,\n parseCodexRealtimeV3Event,\n} from \"./codex-realtime-v3\";\nexport type {\n CodexRealtimeV3Bridge,\n CodexRealtimeV3BridgeFatal,\n CodexRealtimeV3BridgeOptions,\n CodexRealtimeV3BridgeSnapshot,\n CodexRealtimeV3ContextAppendChannel,\n CodexRealtimeV3DelegationContextAppend,\n CodexRealtimeV3Event,\n CodexRealtimeV3ParseFailure,\n CodexRealtimeV3ParseResult,\n CodexRealtimeV3SessionContextAppend,\n} from \"./codex-realtime-v3\";\n\nexport {\n CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,\n CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,\n} from \"./codex-realtime-v3-wire\";\nexport type { CodexRealtimeInitialItem } from \"./codex-realtime-v3-wire\";\n\nexport type {\n ActivateCodexRealtimeConnectionRequest,\n BeginSessionRealtimeRequest,\n CodexRealtimeVoice,\n CodexRealtimeWebrtcRequest,\n CodexRealtimeWebrtcResponse,\n CodexRealtimeWebrtcVersion,\n EndSessionRealtimeRequest,\n GatewayRealtimeConnectRequest,\n GatewayRealtimeConnectResponse,\n GatewayRealtimeInitialItem,\n RenewSessionRealtimeRequest,\n SessionRealtimeEndReason,\n SessionRealtimeLedgerEntry,\n SessionRealtimeMode,\n SessionRealtimeModel,\n SessionRealtimeMutationResponse,\n SessionRealtimeState,\n SyncSessionRealtimeLedgerRequest,\n SyncSessionRealtimeLedgerResponse,\n WorkspaceRealtimeModelCatalogItem,\n WorkspaceRealtimeModelCatalogResponse,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDO,SAAS,6BACd,OAC8B;AAC9B,MAAI,UAAU,2BAA4B,QAAO;AACjD,MAAI,UAAU,sCAAuC,QAAO;AAC5D,SAAO;AACT;AAOO,SAAS,gCACd,SAC2B;AAC3B,QAAM,YAAY,6BAA6B,QAAQ,KAAK;AAC5D,SAAO,8BAA8B;AAAA,IACnC,GAAG;AAAA,IACH,uBAAuB,qCAAqC,QAAQ,KAAK;AAAA,IACzE,GAAI,cAAc,YACd,EAAE,gBAAgB,sCAAsC,EAAE,IAC1D,cAAc,qBACZ,EAAE,gBAAgB,8CAA8C,EAAE,IAClE,CAAC;AAAA,EACT,CAAC;AACH;","names":[]}
@@ -1,4 +1,8 @@
1
- import type { GeneratedImageReceipt, GeneratedVideoReceipt, MediaGenerationResult, RetainedArtifactReference } from "./types.js";
1
+ import type { GeneratedImageReceipt, GeneratedVideoReceipt, MediaGenerationResult, RetainedArtifactReference, SandboxFileArtifactReceipt } from "./types.js";
2
+ /** Zero-dependency validation for a permanent generic workspace-file receipt. */
3
+ export declare function parseRetainedWorkspaceFileReference(value: unknown, expectedWorkspaceId?: string): RetainedArtifactReference | null;
4
+ /** Parse the closed result returned by sandbox_file_publish and the session API. */
5
+ export declare function parseSandboxFileArtifactReceipt(value: unknown, expectedWorkspaceId?: string): SandboxFileArtifactReceipt | null;
2
6
  /** Zero-dependency validation for the SDK's permanent generated-image wire receipt. */
3
7
  export declare function parseRetainedGeneratedImageReference(value: unknown, expectedWorkspaceId?: string): RetainedArtifactReference | null;
4
8
  export declare function generatedImageSandboxPathMatches(artifact: RetainedArtifactReference, sandboxPath: unknown): sandboxPath is string;
@@ -0,0 +1,22 @@
1
+ import type { OpenGeniClient } from "./client.js";
2
+ import type { AppendArchivedSessionEventsRequest, AppendArchivedSessionEventsResponse, ImportArchivedSessionRequest, ImportArchivedSessionResponse } from "@opengeni/contracts";
3
+ export type { ArchivedSessionImportEvent, AppendArchivedSessionEventsRequest, AppendArchivedSessionEventsResponse, ImportArchivedSessionRequest, ImportArchivedSessionResponse, SessionImportedArchive, } from "@opengeni/contracts";
4
+ type SessionHistoryImportClient = Pick<OpenGeniClient, "requestJson">;
5
+ /**
6
+ * Server-only migration of a read-only archive, not model-facing conversation
7
+ * history. Use an asUser client to preserve the verified creator/owner. Persist
8
+ * importId and retry the exact request after an uncertain outcome.
9
+ * Requires sessions:create in the authenticated actor's permissions.
10
+ */
11
+ export declare function importArchivedSession(client: SessionHistoryImportClient, workspaceId: string, request: ImportArchivedSessionRequest): Promise<ImportArchivedSessionResponse>;
12
+ /**
13
+ * Append historical events at the acknowledged nextOffset. Retrying the exact
14
+ * batchId, offset and events replays its receipt; conflicting reuse returns 409.
15
+ * Each request accepts at most 100 events / 1 MiB, with 256 KiB per event.
16
+ * Requires sessions:control and the same authenticated importer.
17
+ */
18
+ export declare function appendArchivedSessionEvents(client: SessionHistoryImportClient, workspaceId: string, importId: string, request: AppendArchivedSessionEventsRequest): Promise<AppendArchivedSessionEventsResponse>;
19
+ /** Import through an existing external tenant mapping; this does not onboard it. */
20
+ export declare function importExternalWorkspaceArchivedSession(client: SessionHistoryImportClient, source: string, externalId: string, request: ImportArchivedSessionRequest): Promise<ImportArchivedSessionResponse>;
21
+ /** Append to an archive through the same external tenant mapping and actor. */
22
+ export declare function appendExternalWorkspaceArchivedSessionEvents(client: SessionHistoryImportClient, source: string, externalId: string, importId: string, request: AppendArchivedSessionEventsRequest): Promise<AppendArchivedSessionEventsResponse>;
@@ -0,0 +1,36 @@
1
+ // src/session-history-import.ts
2
+ function importArchivedSession(client, workspaceId, request) {
3
+ return client.requestJson(
4
+ "POST",
5
+ `/v1/workspaces/${encodeURIComponent(workspaceId)}/session-imports`,
6
+ request
7
+ );
8
+ }
9
+ function appendArchivedSessionEvents(client, workspaceId, importId, request) {
10
+ return client.requestJson(
11
+ "POST",
12
+ `/v1/workspaces/${encodeURIComponent(workspaceId)}/session-imports/${encodeURIComponent(importId)}/events`,
13
+ request
14
+ );
15
+ }
16
+ function importExternalWorkspaceArchivedSession(client, source, externalId, request) {
17
+ return client.requestJson(
18
+ "POST",
19
+ `/v1/workspaces/external/${encodeURIComponent(source)}/${encodeURIComponent(externalId)}/session-imports`,
20
+ request
21
+ );
22
+ }
23
+ function appendExternalWorkspaceArchivedSessionEvents(client, source, externalId, importId, request) {
24
+ return client.requestJson(
25
+ "POST",
26
+ `/v1/workspaces/external/${encodeURIComponent(source)}/${encodeURIComponent(externalId)}/session-imports/${encodeURIComponent(importId)}/events`,
27
+ request
28
+ );
29
+ }
30
+ export {
31
+ appendArchivedSessionEvents,
32
+ appendExternalWorkspaceArchivedSessionEvents,
33
+ importArchivedSession,
34
+ importExternalWorkspaceArchivedSession
35
+ };
36
+ //# sourceMappingURL=session-history-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/session-history-import.ts"],"sourcesContent":["import type { OpenGeniClient } from \"./client\";\nimport type {\n AppendArchivedSessionEventsRequest,\n AppendArchivedSessionEventsResponse,\n ImportArchivedSessionRequest,\n ImportArchivedSessionResponse,\n} from \"@opengeni/contracts\";\n\nexport type {\n ArchivedSessionImportEvent,\n AppendArchivedSessionEventsRequest,\n AppendArchivedSessionEventsResponse,\n ImportArchivedSessionRequest,\n ImportArchivedSessionResponse,\n SessionImportedArchive,\n} from \"@opengeni/contracts\";\n\ntype SessionHistoryImportClient = Pick<OpenGeniClient, \"requestJson\">;\n\n/**\n * Server-only migration of a read-only archive, not model-facing conversation\n * history. Use an asUser client to preserve the verified creator/owner. Persist\n * importId and retry the exact request after an uncertain outcome.\n * Requires sessions:create in the authenticated actor's permissions.\n */\nexport function importArchivedSession(\n client: SessionHistoryImportClient,\n workspaceId: string,\n request: ImportArchivedSessionRequest,\n): Promise<ImportArchivedSessionResponse> {\n return client.requestJson(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/session-imports`,\n request,\n );\n}\n\n/**\n * Append historical events at the acknowledged nextOffset. Retrying the exact\n * batchId, offset and events replays its receipt; conflicting reuse returns 409.\n * Each request accepts at most 100 events / 1 MiB, with 256 KiB per event.\n * Requires sessions:control and the same authenticated importer.\n */\nexport function appendArchivedSessionEvents(\n client: SessionHistoryImportClient,\n workspaceId: string,\n importId: string,\n request: AppendArchivedSessionEventsRequest,\n): Promise<AppendArchivedSessionEventsResponse> {\n return client.requestJson(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/session-imports/${encodeURIComponent(importId)}/events`,\n request,\n );\n}\n\n/** Import through an existing external tenant mapping; this does not onboard it. */\nexport function importExternalWorkspaceArchivedSession(\n client: SessionHistoryImportClient,\n source: string,\n externalId: string,\n request: ImportArchivedSessionRequest,\n): Promise<ImportArchivedSessionResponse> {\n return client.requestJson(\n \"POST\",\n `/v1/workspaces/external/${encodeURIComponent(source)}/${encodeURIComponent(externalId)}/session-imports`,\n request,\n );\n}\n\n/** Append to an archive through the same external tenant mapping and actor. */\nexport function appendExternalWorkspaceArchivedSessionEvents(\n client: SessionHistoryImportClient,\n source: string,\n externalId: string,\n importId: string,\n request: AppendArchivedSessionEventsRequest,\n): Promise<AppendArchivedSessionEventsResponse> {\n return client.requestJson(\n \"POST\",\n `/v1/workspaces/external/${encodeURIComponent(source)}/${encodeURIComponent(externalId)}/session-imports/${encodeURIComponent(importId)}/events`,\n request,\n );\n}\n"],"mappings":";AAyBO,SAAS,sBACd,QACA,aACA,SACwC;AACxC,SAAO,OAAO;AAAA,IACZ;AAAA,IACA,kBAAkB,mBAAmB,WAAW,CAAC;AAAA,IACjD;AAAA,EACF;AACF;AAQO,SAAS,4BACd,QACA,aACA,UACA,SAC8C;AAC9C,SAAO,OAAO;AAAA,IACZ;AAAA,IACA,kBAAkB,mBAAmB,WAAW,CAAC,oBAAoB,mBAAmB,QAAQ,CAAC;AAAA,IACjG;AAAA,EACF;AACF;AAGO,SAAS,uCACd,QACA,QACA,YACA,SACwC;AACxC,SAAO,OAAO;AAAA,IACZ;AAAA,IACA,2BAA2B,mBAAmB,MAAM,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,IACvF;AAAA,EACF;AACF;AAGO,SAAS,6CACd,QACA,QACA,YACA,UACA,SAC8C;AAC9C,SAAO,OAAO;AAAA,IACZ;AAAA,IACA,2BAA2B,mBAAmB,MAAM,CAAC,IAAI,mBAAmB,UAAU,CAAC,oBAAoB,mBAAmB,QAAQ,CAAC;AAAA,IACvI;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ export { sessionListEntry } from "@opengeni/contracts/session-list-entries";
@@ -0,0 +1,7 @@
1
+ import {
2
+ sessionListEntry
3
+ } from "./chunk-GZYZT22T.js";
4
+ export {
5
+ sessionListEntry
6
+ };
7
+ //# sourceMappingURL=session-list-entries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,53 @@
1
+ /** Literal Unicode case-insensitive substring. Whitespace is significant. */
2
+ export type SessionMessageSearchRequest = {
3
+ query: string;
4
+ sessionId?: string | undefined;
5
+ /** Workspace-only first hit per session; cannot combine with sessionId. */
6
+ groupBy?: "session" | undefined;
7
+ archiveStatus?: "active" | "archived" | "all" | undefined;
8
+ limit?: number | undefined;
9
+ cursor?: string | undefined;
10
+ };
11
+ export type SessionMessageSearchMatch = {
12
+ sessionId: string;
13
+ sessionTitle: string | null;
14
+ eventId: string;
15
+ sequence: number;
16
+ turnId: string | null;
17
+ role: "user" | "assistant";
18
+ messageId: string | null;
19
+ /** Zero-based UTF-16 offset in the complete visible message. */
20
+ messageMatchOffset: number;
21
+ /** Zero-based UTF-16 offsets in text; matchEnd is exclusive. */
22
+ snippet: {
23
+ text: string;
24
+ matchStart: number;
25
+ matchEnd: number;
26
+ };
27
+ };
28
+ export type SessionMessageSearchResponse = {
29
+ matches: SessionMessageSearchMatch[];
30
+ nextCursor: string | null;
31
+ /** Empty advancing pages are valid. Continue until false. */
32
+ hasMore: boolean;
33
+ /** Cumulative distinct messages visited in this live traversal. */
34
+ scannedMessages: number;
35
+ /** Cumulative matching messages, or session representatives with groupBy=session. */
36
+ matchedMessageCount: number;
37
+ /** Cumulative occurrences, or session representatives with groupBy=session. */
38
+ matchedOccurrenceCount: number;
39
+ /** True only on exhaustion. Concurrent mutations require a fresh traversal. */
40
+ countIsExact: boolean;
41
+ };
42
+ /** Exact selected event reference from a search match; no payload fields are read. */
43
+ export type SessionMessagePreviewReference = {
44
+ eventId: string;
45
+ sequence: number;
46
+ };
47
+ /** A complete visible message, or an explicit over-12,000-UTF-16-unit result. */
48
+ export type SessionMessagePreview = {
49
+ status: "available";
50
+ text: string;
51
+ } | {
52
+ status: "unavailable";
53
+ };
@@ -0,0 +1,24 @@
1
+ import type { OpenGeniEmbeddingClient } from "./embedding-client.js";
2
+ import type { OpenGeniRequestOptions, FetchResponse } from "./client.js";
3
+ import type { AccessGrant } from "./types.js";
4
+ /** Maximum actual UTF-8 bytes forwarded for one embedded Site HTML response. */
5
+ export declare const SESSION_PROXY_SITE_HTML_MAX_BYTES: number;
6
+ /** A streaming Site download exceeded the host proxy's actual-byte ceiling. */
7
+ export declare class SessionProxySiteHtmlTooLargeError extends Error {
8
+ readonly code = "site_html_too_large";
9
+ readonly limitBytes: number;
10
+ constructor();
11
+ }
12
+ /** Server-only effective grant read; never derive external authority from access/me snapshots. */
13
+ export declare function getSessionProxyWorkspaceGrant(client: Pick<OpenGeniEmbeddingClient, "requestJson">, workspaceId: string, options?: OpenGeniRequestOptions): Promise<AccessGrant>;
14
+ /** Exact association read. The API reauthorizes the source session on every call. */
15
+ export declare function getSessionProxyArtifactAssociation(client: Pick<OpenGeniEmbeddingClient, "requestJson">, workspaceId: string, sessionId: string, kind: "editable" | "site", artifactId: string, options?: OpenGeniRequestOptions): Promise<{
16
+ sessionId: string;
17
+ artifactId: string;
18
+ kind: "editable" | "site";
19
+ }>;
20
+ /** Authenticated response stream for the server proxy; does not buffer Site HTML. */
21
+ export declare function downloadSessionProxySiteHtml(client: Pick<OpenGeniEmbeddingClient, "requestJsonResponse">, workspaceId: string, artifactId: string, options: {
22
+ versionId: string;
23
+ signal?: AbortSignal;
24
+ }): Promise<FetchResponse>;
@@ -0,0 +1,245 @@
1
+ import type { OpenGeniEmbeddingClient } from "./embedding-client.js";
2
+ import { type Chats } from "./chats.js";
3
+ import type { WorkspaceIdOptions, WorkspaceIdTarget } from "./tenant-workspaces.js";
4
+ import type { CreateSessionRequest, SessionMcpCredentialUpdateInput } from "./types.js";
5
+ export { downloadSessionProxySiteHtml, getSessionProxyArtifactAssociation, getSessionProxyWorkspaceGrant, SESSION_PROXY_SITE_HTML_MAX_BYTES, SessionProxySiteHtmlTooLargeError, } from "./session-proxy-client.js";
6
+ /**
7
+ * Packaged same-origin backend for the React conversation surfaces.
8
+ *
9
+ * Mount the handler at a catch-all route (for example `/api/opengeni/*`) and
10
+ * point an unmodified browser `OpenGeniClient({ baseUrl: "/api/opengeni" })`
11
+ * at it. Every request is authenticated by the host's `resolve` hook, pinned
12
+ * to the resolved workspace, executed as the resolved external user through
13
+ * `asUser` (never the organization key's own service authority), and limited
14
+ * to the exact native routes `SessionConversation` and its hooks use. It is
15
+ * an explicit dispatcher, not an arbitrary upstream proxy.
16
+ */
17
+ type ProxyClient = OpenGeniEmbeddingClient;
18
+ /** The `@opengeni/sdk/chat` `OpenGeni` facade, structurally. */
19
+ type ProxyFacade = {
20
+ readonly client: ProxyClient;
21
+ readonly source: string;
22
+ workspaceId(target: {
23
+ tenant: string;
24
+ }): Promise<string>;
25
+ workspaceIdFor?(target: WorkspaceIdTarget, options: WorkspaceIdOptions): Promise<string>;
26
+ };
27
+ /**
28
+ * Who the authenticated request acts as, in your own ids. Never derive any of
29
+ * it from the request body or path. `{ user, tenant }`: one workspace per
30
+ * tenant. `{ user }`: one workspace per user. `{ user, workspaceId }`: your
31
+ * own workspace. Tenant and per-user mapping require the `OpenGeni` facade
32
+ * from `@opengeni/sdk/chat`; workspaces are created on first use and Opengeni
33
+ * adds the user on their first request.
34
+ */
35
+ export type SessionProxyResolution = ({
36
+ workspaceId: string;
37
+ tenant?: undefined;
38
+ } | {
39
+ tenant: string;
40
+ workspaceId?: undefined;
41
+ } | {
42
+ tenant?: undefined;
43
+ workspaceId?: undefined;
44
+ }) & {
45
+ /** Host-authenticated external user id; every call runs through `asUser(user)`. */
46
+ user: string;
47
+ /** External identity source. Defaults to the facade's `source`, else `"default"`. */
48
+ source?: string | undefined;
49
+ };
50
+ /** Host auth hook: return the resolution, or a `Response` (for example 401) to reject. */
51
+ export type SessionProxyResolve = (request: Request) => Promise<SessionProxyResolution | Response> | SessionProxyResolution | Response;
52
+ export type SessionProxyContext = {
53
+ request: Request;
54
+ workspaceId: string;
55
+ user: string;
56
+ source: string;
57
+ /** The `asUser` client the proxy uses for this request. */
58
+ client: ProxyClient;
59
+ };
60
+ /** The only fields a browser may send when creating a session through the proxy. */
61
+ export type SessionProxyCreateInput = {
62
+ initialMessage: string;
63
+ /** Browser retry key; replay is scoped to the acting user by the API. */
64
+ idempotencyKey?: string | undefined;
65
+ };
66
+ /** Which browser action is about to forward a user message or response. */
67
+ export type SessionProxyMessageInput = {
68
+ /** Absent for `create`. */
69
+ sessionId?: string | undefined;
70
+ delivery: "create" | "send" | "steer" | "submit";
71
+ };
72
+ /** Server-side additions the host attaches to one forwarded user message or response. */
73
+ export type SessionProxyMessageExtras = {
74
+ /**
75
+ * Model-visible context for this message (current page, time zone, today's
76
+ * date). Placed before any context the browser sent. Not secret. Ignored for
77
+ * approval decisions and human-input responses, which are not new messages.
78
+ */
79
+ modelContext?: string | undefined;
80
+ /**
81
+ * Header-only credential rotation for MCP servers already attached to the
82
+ * session (for example a fresh short-lived per-user bearer), applied
83
+ * atomically as the message or response is accepted. Ignored for `create`,
84
+ * where the `createSession` hook sets the initial headers.
85
+ */
86
+ mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;
87
+ };
88
+ /**
89
+ * Your product's own MCP tool server, attached to every session this proxy
90
+ * creates with a per-user bearer token. Verify it on every MCP request with
91
+ * `verifyToolRequest` from `@opengeni/sdk/tool-auth`. Tools always act as the
92
+ * chat's creator: in a shared chat, other members' messages do not change it.
93
+ */
94
+ export type SessionProxyToolServer = {
95
+ /**
96
+ * Public HTTPS URL of your MCP endpoint, e.g. `https://app.example.com/api/mcp`.
97
+ * Defaults to `OPENGENI_TOOL_SERVER_URL`, which `verifyToolRequest` also reads.
98
+ */
99
+ url?: string | undefined;
100
+ /** Session MCP server id (model-facing tool prefix). Defaults to `"app"`. */
101
+ id?: string | undefined;
102
+ /** Display name. */
103
+ name?: string | undefined;
104
+ /**
105
+ * Tools the user must approve before each call: list your write tools here
106
+ * (unprefixed MCP tool names), or `true` for every tool. Others run directly.
107
+ */
108
+ approvals?: {
109
+ ask: string[] | true;
110
+ } | undefined;
111
+ /** Token signing secret. Defaults to `OPENGENI_API_KEY`; `verifyToolRequest` must use the same. */
112
+ secret?: string | undefined;
113
+ /** Token lifetime in seconds. Defaults to 24 hours; refreshed on every message, approval, and answer. */
114
+ ttlSeconds?: number | undefined;
115
+ };
116
+ export type SessionProxyHandlerOptions = {
117
+ /**
118
+ * Private (default) uses personal Knowledge and session-only reach; shared uses
119
+ * workspace Knowledge and reach. Isolated also gives each user their own tenant workspace.
120
+ */
121
+ chats?: Chats | undefined;
122
+ /** Mandatory host auth hook, called on every request. */
123
+ resolve: SessionProxyResolve;
124
+ /**
125
+ * Host CSRF/session policy for non-GET requests. Without it the proxy only
126
+ * rejects `Sec-Fetch-Site: cross-site` mutations and requires JSON bodies;
127
+ * cookie-authenticated hosts should supply their existing CSRF check.
128
+ */
129
+ authorizeMutation?: ((request: Request) => boolean | Promise<boolean>) | undefined;
130
+ /**
131
+ * Optional product-level session check (for example "this ticket's session
132
+ * belongs to this user"). OpenGeni still enforces membership and private
133
+ * visibility on every call.
134
+ */
135
+ authorizeSession?: ((sessionId: string, context: SessionProxyContext) => boolean | Promise<boolean>) | undefined;
136
+ /**
137
+ * Server-controlled session creation. The browser supplies only
138
+ * {@link SessionProxyCreateInput}; this hook returns the complete create
139
+ * request (agent, tools, MCP servers, Skills, instructions, model policy). Omit it
140
+ * to disable browser-initiated creation entirely.
141
+ */
142
+ createSession?: ((input: SessionProxyCreateInput, context: SessionProxyContext) => CreateSessionRequest | Response | Promise<CreateSessionRequest | Response>) | undefined;
143
+ /**
144
+ * Called before every forwarded user message (send, steer, composer submit,
145
+ * and browser-started create), approval decision, and human-input response.
146
+ * Return server-owned `modelContext` (messages only) and MCP credential
147
+ * rotations, or a `Response` to reject the action.
148
+ */
149
+ beforeForwardMessage?: ((input: SessionProxyMessageInput, context: SessionProxyContext) => SessionProxyMessageExtras | Response | undefined | Promise<SessionProxyMessageExtras | Response | undefined>) | undefined;
150
+ /**
151
+ * Attach your product's MCP tool server to every session the `createSession`
152
+ * hook creates, authenticated as the resolved user. The proxy mints the
153
+ * token, adds the `mcpServers` entry (plus an eager ref when the hook lists
154
+ * explicit `tools`), and rotates the token on every send, steer, submit,
155
+ * approval decision, and human-input answer.
156
+ */
157
+ toolServer?: SessionProxyToolServer | undefined;
158
+ /** Mount prefix, e.g. `/api/opengeni`. Defaults to everything before the first `/v1/`. */
159
+ basePath?: string | undefined;
160
+ /** Maximum JSON request body. Defaults to 1 MiB. */
161
+ maxBodyBytes?: number | undefined;
162
+ /** Expose composer file attachments (upload begin/complete, download URL). Defaults to true. */
163
+ files?: boolean | undefined;
164
+ /**
165
+ * Let the browser read a file from the session's sandbox (`POST .../fs/read`)
166
+ * so `sandbox:` links in agent replies can be downloaded. Only `path`,
167
+ * `encoding`, and `maxBytes` are forwarded; OpenGeni still requires the
168
+ * user's `files:read` permission on that session. Explicit opt-in, default
169
+ * false. Reads are confined to its working directory, including on Connected
170
+ * Machines; symlinked paths are refused.
171
+ */
172
+ sandboxFiles?: boolean | undefined;
173
+ /**
174
+ * Serve the embedded artifact viewer and inline Site previews: reads of the
175
+ * editable artifacts and Sites a session produced, and live-ticket minting
176
+ * for the editor. Explicit opt-in, default false.
177
+ *
178
+ * Every request must name its session in the `x-opengeni-session-id` header
179
+ * (`SessionArtifactViewer` and `SessionConversation` do this). The proxy
180
+ * runs `authorizeSession`, then only forwards an artifact OpenGeni associates with
181
+ * that session, so the browser cannot open other workspace artifacts through
182
+ * it. Editing still requires the user's own `artifacts:publish` grant. Site
183
+ * tool calls are not proxied.
184
+ *
185
+ * The editor's live socket is ticket-authenticated and connects to OpenGeni
186
+ * directly; the ticket binds the source session and the API revalidates its
187
+ * authority while connected. `editableLiveUrl` overrides the derived URL.
188
+ * Site HTML streams with backpressure and cancellation, with a 25 MiB
189
+ * actual-byte ceiling (`SESSION_PROXY_SITE_HTML_MAX_BYTES`). Oversize streams
190
+ * fail with `SessionProxySiteHtmlTooLargeError` / `site_html_too_large`;
191
+ * headers cannot be replaced once streaming has begun.
192
+ */
193
+ artifacts?: boolean | {
194
+ editableLiveUrl?: string | undefined;
195
+ } | undefined;
196
+ /**
197
+ * Chat list for `SessionList` / `OpenGeniChat` (`listSessionPage` only).
198
+ * `"mine"` (default) lists sessions the resolved user created; `"visible"`
199
+ * lists every session OpenGeni lets that user read in the workspace (shared
200
+ * chats included); `false` disables listing.
201
+ */
202
+ sessionList?: "mine" | "visible" | false | undefined;
203
+ /** Let the user archive or restore their own chats. Defaults to true. */
204
+ archive?: boolean | undefined;
205
+ /**
206
+ * Let the browser choose model, reasoning effort, and latency per message
207
+ * or draft (still limited by the workspace model catalog). When false those
208
+ * choices are removed from messages and draft saves. Saves use the actor's
209
+ * server-owned draft policy (initially the session defaults). Submit must repeat
210
+ * the saved policy unchanged as an integrity fence, not a new selection: the
211
+ * API atomically checks the saved revision/content or replays the original
212
+ * receipt. Hide the composer's model picker to match. Defaults to true.
213
+ * Pass `true` explicitly to also show end users the stock model picker
214
+ * (`SessionConversation`/`OpenGeniChat` hide it unless asked).
215
+ */
216
+ modelSelection?: boolean | undefined;
217
+ /** SSE heartbeat interval. Defaults to 15 seconds. */
218
+ heartbeatMs?: number | undefined;
219
+ };
220
+ /**
221
+ * Create the packaged session proxy. Returns a web-standard
222
+ * `(Request) => Promise<Response>` for Next.js route handlers, Hono, Bun.serve,
223
+ * Cloudflare Workers, and similar hosts.
224
+ */
225
+ export declare function createSessionProxyHandler(target: ProxyClient | ProxyFacade, options: SessionProxyHandlerOptions): (request: Request) => Promise<Response>;
226
+ /**
227
+ * The client-config `artifacts` capability a custom host proxy reports so
228
+ * `SessionArtifactViewer` can open editable artifacts: the live socket URL
229
+ * (ticket-authenticated, reached directly) and the proxied user's browser cache
230
+ * partition. `client` acts as that user (for example `asUser(...)`).
231
+ */
232
+ export declare function artifactViewerCapability(input: {
233
+ client: Pick<ProxyClient, "getAccessContext" | "apiUrl"> & Partial<Pick<ProxyClient, "requestJson">>;
234
+ workspaceId: string;
235
+ /** Stable namespace of the host's user identities, mixed into the partition. */
236
+ source?: string | undefined;
237
+ editableLiveUrl?: string | undefined;
238
+ }): Promise<{
239
+ editableLiveUrl: string;
240
+ cachePartition: {
241
+ accountId: string;
242
+ principalId: string;
243
+ authorizationEpoch: string;
244
+ };
245
+ }>;
@@ -0,0 +1,24 @@
1
+ import {
2
+ SESSION_PROXY_SITE_HTML_MAX_BYTES,
3
+ SessionProxySiteHtmlTooLargeError,
4
+ artifactViewerCapability,
5
+ createSessionProxyHandler,
6
+ downloadSessionProxySiteHtml,
7
+ getSessionProxyArtifactAssociation,
8
+ getSessionProxyWorkspaceGrant
9
+ } from "./chunk-RWKB6YZG.js";
10
+ import "./chunk-UM4ZXXJR.js";
11
+ import "./chunk-U6CV2SXO.js";
12
+ import "./chunk-APXVSSSY.js";
13
+ import "./chunk-YIKA2QT4.js";
14
+ import "./chunk-V6GIY62B.js";
15
+ export {
16
+ SESSION_PROXY_SITE_HTML_MAX_BYTES,
17
+ SessionProxySiteHtmlTooLargeError,
18
+ artifactViewerCapability,
19
+ createSessionProxyHandler,
20
+ downloadSessionProxySiteHtml,
21
+ getSessionProxyArtifactAssociation,
22
+ getSessionProxyWorkspaceGrant
23
+ };
24
+ //# sourceMappingURL=session-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export { AUTOMATIC_SESSION_TITLE_FALLBACK, deriveAutomaticSessionTitlePreview, deriveSessionDisplayTitle, sessionTitleIsPending, } from "@opengeni/contracts/session-titles";
2
+ export type { SessionDisplayTitleInput, SessionDisplayTitleOptions, } from "@opengeni/contracts/session-titles";
@@ -0,0 +1 @@
1
+ export {};