@opengeni/sdk 3.3.2-canary.0 → 3.3.2-canary.1

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 (44) hide show
  1. package/dist/artifacts.js +6 -6
  2. package/dist/browser.d.ts +2 -1
  3. package/dist/browser.js +6 -4
  4. package/dist/{chunk-C2H7HBNP.js → chunk-6NEPJ7NC.js} +2 -2
  5. package/dist/{chunk-YXQX7RQT.js → chunk-BESZFWMU.js} +2 -2
  6. package/dist/{chunk-JUS2UYRP.js → chunk-E5BNEG2D.js} +1 -1
  7. package/dist/chunk-E5BNEG2D.js.map +1 -0
  8. package/dist/{chunk-TRNI7KEO.js → chunk-GY6RQPCG.js} +72 -4
  9. package/dist/chunk-GY6RQPCG.js.map +1 -0
  10. package/dist/{chunk-C4DJPZRU.js → chunk-OO5LPTO7.js} +14 -1
  11. package/dist/chunk-OO5LPTO7.js.map +1 -0
  12. package/dist/{chunk-KKRO2VCP.js → chunk-QTBAMHEF.js} +2 -2
  13. package/dist/{chunk-QT3KFVDP.js → chunk-TFCLHRZK.js} +2 -2
  14. package/dist/client.d.ts +13 -1
  15. package/dist/codex-realtime-controller.js +2 -2
  16. package/dist/core.d.ts +2 -1
  17. package/dist/core.js +7 -5
  18. package/dist/document-authority.js +5 -5
  19. package/dist/editable-artifacts.js +1 -1
  20. package/dist/errors.d.ts +12 -0
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.js +9 -7
  23. package/dist/index.js.map +1 -1
  24. package/dist/interaction.js +2 -2
  25. package/dist/model-picker-order.d.ts +1 -0
  26. package/dist/model-picker-order.js +10 -0
  27. package/dist/model-picker-order.js.map +1 -0
  28. package/dist/realtime.js +2 -2
  29. package/dist/types.d.ts +32 -1
  30. package/package.json +6 -2
  31. package/src/browser.ts +2 -0
  32. package/src/client.ts +116 -0
  33. package/src/core.ts +2 -0
  34. package/src/errors.ts +23 -0
  35. package/src/index.ts +11 -0
  36. package/src/model-picker-order.ts +6 -0
  37. package/src/types.ts +41 -1
  38. package/dist/chunk-C4DJPZRU.js.map +0 -1
  39. package/dist/chunk-JUS2UYRP.js.map +0 -1
  40. package/dist/chunk-TRNI7KEO.js.map +0 -1
  41. /package/dist/{chunk-C2H7HBNP.js.map → chunk-6NEPJ7NC.js.map} +0 -0
  42. /package/dist/{chunk-YXQX7RQT.js.map → chunk-BESZFWMU.js.map} +0 -0
  43. /package/dist/{chunk-KKRO2VCP.js.map → chunk-QTBAMHEF.js.map} +0 -0
  44. /package/dist/{chunk-QT3KFVDP.js.map → chunk-TFCLHRZK.js.map} +0 -0
@@ -5,19 +5,20 @@ import {
5
5
  OPENGENI_API_CONTRACT_REVISION,
6
6
  OPENGENI_CORRELATION_HEADER,
7
7
  RETAINED_OUTPUT_MAX_PAGE_BYTES
8
- } from "./chunk-JUS2UYRP.js";
8
+ } from "./chunk-E5BNEG2D.js";
9
9
  import {
10
10
  OpenGeniInteractionClient,
11
11
  decodeComputerFrameMetadataHeader
12
- } from "./chunk-KKRO2VCP.js";
12
+ } from "./chunk-QTBAMHEF.js";
13
13
  import {
14
14
  OpenGeniApiContractMismatchError,
15
15
  OpenGeniApiError,
16
+ OpenGeniSecureContextRequiredError,
16
17
  OpenGeniSessionListCursorError,
17
18
  OpenGeniStreamError,
18
19
  isAbortError,
19
20
  isRetryableStreamError
20
- } from "./chunk-C4DJPZRU.js";
21
+ } from "./chunk-OO5LPTO7.js";
21
22
 
22
23
  // src/sse.ts
23
24
  async function* parseSseStream(stream) {
@@ -3019,6 +3020,62 @@ var OpenGeniClient = class {
3019
3020
  options
3020
3021
  );
3021
3022
  }
3023
+ /** List workspace-owned unpinned Vercel AI Gateway model slugs. */
3024
+ async listWorkspaceGatewayCustomModels(workspaceId) {
3025
+ return await this.requestJson(
3026
+ "GET",
3027
+ `/v1/workspaces/${workspaceId}/gateway-custom-models`
3028
+ );
3029
+ }
3030
+ /** Add one exact upstream Vercel AI Gateway slug. */
3031
+ async createWorkspaceGatewayCustomModel(workspaceId, request) {
3032
+ return await this.requestJson(
3033
+ "POST",
3034
+ `/v1/workspaces/${workspaceId}/gateway-custom-models`,
3035
+ request
3036
+ );
3037
+ }
3038
+ /** Remove one workspace custom Gateway model by its stable row id. */
3039
+ async deleteWorkspaceGatewayCustomModel(workspaceId, customModelId, request) {
3040
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(
3041
+ customModelId
3042
+ )) {
3043
+ throw new TypeError("customModelId must be a UUID");
3044
+ }
3045
+ await this.requestVoid(
3046
+ "DELETE",
3047
+ `/v1/workspaces/${workspaceId}/gateway-custom-models/${encodeURIComponent(customModelId)}`,
3048
+ request
3049
+ );
3050
+ }
3051
+ /** List workspace-owned unpinned OpenRouter model slugs. */
3052
+ async listWorkspaceOpenRouterCustomModels(workspaceId) {
3053
+ return await this.requestJson(
3054
+ "GET",
3055
+ `/v1/workspaces/${workspaceId}/openrouter-custom-models`
3056
+ );
3057
+ }
3058
+ /** Add one exact upstream OpenRouter slug. */
3059
+ async createWorkspaceOpenRouterCustomModel(workspaceId, request) {
3060
+ return await this.requestJson(
3061
+ "POST",
3062
+ `/v1/workspaces/${workspaceId}/openrouter-custom-models`,
3063
+ request
3064
+ );
3065
+ }
3066
+ /** Remove one workspace custom OpenRouter model by its stable row id. */
3067
+ async deleteWorkspaceOpenRouterCustomModel(workspaceId, customModelId, request) {
3068
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(
3069
+ customModelId
3070
+ )) {
3071
+ throw new TypeError("customModelId must be a UUID");
3072
+ }
3073
+ await this.requestVoid(
3074
+ "DELETE",
3075
+ `/v1/workspaces/${workspaceId}/openrouter-custom-models/${encodeURIComponent(customModelId)}`,
3076
+ request
3077
+ );
3078
+ }
3022
3079
  /** Read the workspace's hard provider/model allowlist. */
3023
3080
  async getWorkspaceModelAccessPolicy(workspaceId) {
3024
3081
  return await this.requestJson(
@@ -3992,6 +4049,7 @@ var OpenGeniClient = class {
3992
4049
  if (input.timeoutMs !== void 0 && (!Number.isFinite(input.timeoutMs) || input.timeoutMs <= 0)) {
3993
4050
  throw new Error("File upload timeout must be a positive number");
3994
4051
  }
4052
+ assertBrowserFileUploadSecureContext();
3995
4053
  const withTimeout = async (timeoutMs, operation) => {
3996
4054
  const controller = new AbortController();
3997
4055
  let timeout;
@@ -5538,6 +5596,16 @@ function mutationTransportError(correlationId) {
5538
5596
  displayMessage: "OpenGeni could not confirm the request \u2014 reconcile before retrying."
5539
5597
  });
5540
5598
  }
5599
+ function assertBrowserFileUploadSecureContext() {
5600
+ const secureContext = typeof window !== "undefined" ? window.isSecureContext : typeof globalThis.isSecureContext === "boolean" ? globalThis.isSecureContext : void 0;
5601
+ if (secureContext === void 0) return;
5602
+ if (!secureContext) {
5603
+ throw new OpenGeniSecureContextRequiredError("insecure_context");
5604
+ }
5605
+ if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") {
5606
+ throw new OpenGeniSecureContextRequiredError("web_crypto_unavailable");
5607
+ }
5608
+ }
5541
5609
  async function sha256ForUpload(body) {
5542
5610
  const bytes = typeof body === "string" ? new TextEncoder().encode(body) : body instanceof Blob ? new Uint8Array(await body.arrayBuffer()) : new Uint8Array(body);
5543
5611
  const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
@@ -5649,4 +5717,4 @@ export {
5649
5717
  parseMediaGenerationResult,
5650
5718
  OpenGeniClient
5651
5719
  };
5652
- //# sourceMappingURL=chunk-TRNI7KEO.js.map
5720
+ //# sourceMappingURL=chunk-GY6RQPCG.js.map