@opengeni/sdk 2.3.0-canary.0 → 2.5.0-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.
@@ -1,4 +1,4 @@
1
1
  /** Artifact-only API client entry; keeps unrelated SDK surfaces out of editor bundles. */
2
2
  export { OpenGeniClient } from "./artifact-client.js";
3
3
  export type { CreateEditableArtifactMaterializationRequest, CreateEditableArtifactResourceRequest, EditableArtifactListResource, EditableArtifactMaterializationFormat, EditableArtifactMaterializationJobResource, EditableArtifactMaterializationResultResource, EditableArtifactPinnedVersionResource, EditableArtifactResource, ListSessionEditableArtifactResourcesOptions, PinEditableArtifactVersionRequest, ReadEditableArtifactMaterializationOptions, ReadEditableArtifactResourceOptions, } from "./editable-artifact-resources.js";
4
- export type { FetchLike, OpenGeniClientOptions, OpenGeniRequestOptions } from "./client.js";
4
+ export type { FetchLike, GetSessionOptions, OpenGeniClientOptions, OpenGeniRequestOptions, } from "./client.js";
package/dist/artifacts.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  OpenGeniClient
3
- } from "./chunk-AGUKZAXR.js";
4
- import "./chunk-6IPZY27S.js";
5
- import "./chunk-TW5MNHUX.js";
3
+ } from "./chunk-UP2PIWU2.js";
4
+ import "./chunk-7VERSV47.js";
5
+ import "./chunk-ERPT45NP.js";
6
6
  import "./chunk-GW3EJ2GP.js";
7
7
  import "./chunk-C4DJPZRU.js";
8
8
  export {
@@ -5,7 +5,7 @@ import {
5
5
  OPENGENI_API_CONTRACT_REVISION,
6
6
  OPENGENI_CORRELATION_HEADER,
7
7
  RETAINED_OUTPUT_MAX_PAGE_BYTES
8
- } from "./chunk-TW5MNHUX.js";
8
+ } from "./chunk-ERPT45NP.js";
9
9
  import {
10
10
  OpenGeniInteractionClient
11
11
  } from "./chunk-GW3EJ2GP.js";
@@ -764,6 +764,22 @@ function sessionListQuery(options) {
764
764
  ...parentSessionId === void 0 ? {} : { parentSessionId: parentSessionId ?? "null" }
765
765
  };
766
766
  }
767
+ function createSingleFlightReadEntry(generation, onRequestStart) {
768
+ let resolve;
769
+ let reject;
770
+ const promise = new Promise((entryResolve, entryReject) => {
771
+ resolve = entryResolve;
772
+ reject = entryReject;
773
+ });
774
+ return {
775
+ generation,
776
+ promise,
777
+ resolve,
778
+ reject,
779
+ started: false,
780
+ listeners: new Set(onRequestStart ? [onRequestStart] : [])
781
+ };
782
+ }
767
783
  function assertNoMessageTools(input) {
768
784
  if (Object.prototype.hasOwnProperty.call(input, "tools")) {
769
785
  throw new TypeError(
@@ -776,8 +792,9 @@ var OpenGeniClient = class {
776
792
  options;
777
793
  fetchImpl;
778
794
  sessionCommandTimeoutMs;
779
- readInFlight = /* @__PURE__ */ new Map();
780
- readTrailing = /* @__PURE__ */ new Map();
795
+ active = /* @__PURE__ */ new Map();
796
+ generations = /* @__PURE__ */ new Map();
797
+ queued = /* @__PURE__ */ new Map();
781
798
  /** Resource-oriented Browser/Computer facade over this exact authenticated client. */
782
799
  interaction;
783
800
  constructor(options) {
@@ -987,7 +1004,7 @@ var OpenGeniClient = class {
987
1004
  }
988
1005
  async getSession(workspaceId, sessionId, options = {}) {
989
1006
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}`;
990
- return await this.singleFlightRead(path, () => this.requestJson("GET", path), options);
1007
+ return await this.sharedRead(path, () => this.requestJson("GET", path), options);
991
1008
  }
992
1009
  async updateSession(workspaceId, sessionId, request) {
993
1010
  return await this.requestJson(
@@ -996,6 +1013,14 @@ var OpenGeniClient = class {
996
1013
  request
997
1014
  );
998
1015
  }
1016
+ /** Replace the complete ordered Variable Set selection at a quiescent turn boundary. */
1017
+ async updateSessionVariableSets(workspaceId, sessionId, request) {
1018
+ return await this.requestJson(
1019
+ "PUT",
1020
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/variable-sets`,
1021
+ request
1022
+ );
1023
+ }
999
1024
  /** Whether this exact authenticated principal may atomically create a private session. */
1000
1025
  async getSessionTenancyCreateCapabilities(workspaceId) {
1001
1026
  return await this.requestJson(
@@ -1156,35 +1181,112 @@ var OpenGeniClient = class {
1156
1181
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}`
1157
1182
  );
1158
1183
  }
1159
- async getSessionLineage(workspaceId, sessionId) {
1184
+ async getSessionLineage(workspaceId, sessionId, options = {}) {
1160
1185
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}/lineage`;
1161
- return await this.singleFlightRead(
1186
+ return await this.sharedRead(
1162
1187
  path,
1163
- () => this.requestJson("GET", path)
1188
+ () => this.requestJson("GET", path),
1189
+ options
1164
1190
  );
1165
1191
  }
1166
- singleFlightRead(key, read, options = {}) {
1167
- const existing = this.readInFlight.get(key);
1192
+ sharedRead(key, read, options = {}) {
1193
+ const existing = this.active.get(key);
1168
1194
  if (existing) {
1169
- if (!options.fresh) return existing;
1170
- const queued = this.readTrailing.get(key);
1171
- if (queued) return queued;
1172
- const trailing = existing.then(
1173
- () => this.singleFlightRead(key, read),
1174
- () => this.singleFlightRead(key, read)
1195
+ if (!options.fresh) {
1196
+ this.observeRead(existing, options.onRequestStart);
1197
+ return existing.promise;
1198
+ }
1199
+ const requiredGeneration = existing.generation + 1;
1200
+ const queued2 = this.queued.get(key);
1201
+ if (queued2 && queued2.generation >= requiredGeneration) {
1202
+ this.observeRead(queued2, options.onRequestStart);
1203
+ return queued2.promise;
1204
+ }
1205
+ const predecessor = queued2?.promise ?? existing.promise;
1206
+ return this.queueRead(key, predecessor, requiredGeneration, read, options.onRequestStart);
1207
+ }
1208
+ const queued = this.queued.get(key);
1209
+ if (queued && (!options.fresh || !queued.started)) {
1210
+ this.observeRead(queued, options.onRequestStart);
1211
+ return queued.promise;
1212
+ }
1213
+ if (queued) {
1214
+ return this.queueRead(
1215
+ key,
1216
+ queued.promise,
1217
+ queued.generation + 1,
1218
+ read,
1219
+ options.onRequestStart
1175
1220
  );
1176
- this.readTrailing.set(key, trailing);
1177
- const clear = () => {
1178
- if (this.readTrailing.get(key) === trailing) this.readTrailing.delete(key);
1179
- };
1180
- void trailing.then(clear, clear);
1181
- return trailing;
1182
1221
  }
1183
- const promise = read().finally(() => {
1184
- if (this.readInFlight.get(key) === promise) this.readInFlight.delete(key);
1185
- });
1186
- this.readInFlight.set(key, promise);
1187
- return promise;
1222
+ const generation = (this.generations.get(key) ?? 0) + 1;
1223
+ const entry = createSingleFlightReadEntry(generation, options.onRequestStart);
1224
+ this.launchRead(key, entry, read);
1225
+ return entry.promise;
1226
+ }
1227
+ queueRead(key, predecessor, generation, read, onRequestStart) {
1228
+ const entry = createSingleFlightReadEntry(generation, onRequestStart);
1229
+ this.queued.set(key, entry);
1230
+ const launch = () => this.launchRead(key, entry, read);
1231
+ void predecessor.then(launch, launch);
1232
+ const clear = () => {
1233
+ if (this.queued.get(key) !== entry) return;
1234
+ this.queued.delete(key);
1235
+ if (!this.active.has(key)) this.generations.delete(key);
1236
+ };
1237
+ void entry.promise.then(clear, clear);
1238
+ return entry.promise;
1239
+ }
1240
+ launchRead(key, entry, read) {
1241
+ entry.started = true;
1242
+ this.generations.set(key, entry.generation);
1243
+ this.active.set(key, entry);
1244
+ try {
1245
+ entry.stamp = this.options.beginSharedRead?.();
1246
+ } catch {
1247
+ }
1248
+ for (const listener of entry.listeners) {
1249
+ try {
1250
+ listener(entry.stamp);
1251
+ } catch {
1252
+ }
1253
+ }
1254
+ entry.listeners.clear();
1255
+ const settle = () => {
1256
+ if (this.active.get(key) !== entry) return;
1257
+ this.active.delete(key);
1258
+ if (!this.queued.has(key)) this.generations.delete(key);
1259
+ };
1260
+ let request;
1261
+ try {
1262
+ request = read();
1263
+ } catch (error) {
1264
+ settle();
1265
+ entry.reject(error);
1266
+ return;
1267
+ }
1268
+ void request.then(
1269
+ (value) => {
1270
+ settle();
1271
+ entry.resolve(value);
1272
+ },
1273
+ (error) => {
1274
+ settle();
1275
+ entry.reject(error);
1276
+ }
1277
+ );
1278
+ }
1279
+ observeRead(entry, listener) {
1280
+ if (!listener) return;
1281
+ if (!entry.started) {
1282
+ entry.listeners.add(listener);
1283
+ return;
1284
+ }
1285
+ if (entry.stamp === void 0) return;
1286
+ try {
1287
+ listener(entry.stamp);
1288
+ } catch {
1289
+ }
1188
1290
  }
1189
1291
  /** Negotiate one server-mediated connected-Codex GPT-Live V3 WebRTC call. */
1190
1292
  async negotiateCodexRealtimeWebrtc(workspaceId, sessionId, request, options = {}) {
@@ -1626,7 +1728,7 @@ var OpenGeniClient = class {
1626
1728
  // --- Turn queue ------------------------------------------------------------
1627
1729
  async getQueue(workspaceId, sessionId) {
1628
1730
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue`;
1629
- return await this.singleFlightRead(
1731
+ return await this.sharedRead(
1630
1732
  path,
1631
1733
  () => this.requestSessionCommand("GET", path)
1632
1734
  );
@@ -1849,7 +1951,7 @@ var OpenGeniClient = class {
1849
1951
  /** The session's goal. 404s when the session never had one. */
1850
1952
  async getGoal(workspaceId, sessionId) {
1851
1953
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal`;
1852
- return await this.singleFlightRead(path, () => this.requestJson("GET", path));
1954
+ return await this.sharedRead(path, () => this.requestJson("GET", path));
1853
1955
  }
1854
1956
  async updateGoal(workspaceId, sessionId, request) {
1855
1957
  return await this.requestJson(
@@ -2904,12 +3006,16 @@ var OpenGeniClient = class {
2904
3006
  request
2905
3007
  );
2906
3008
  }
2907
- async listOrganizationMembers(organizationId) {
3009
+ async listOrganizationAdministrationMembers(organizationId) {
2908
3010
  return await this.requestJson(
2909
3011
  "GET",
2910
3012
  `/v1/organizations/${organizationId}/members`
2911
3013
  );
2912
3014
  }
3015
+ /** @deprecated Use listOrganizationAdministrationMembers for its privacy-safe projection. */
3016
+ async listOrganizationMembers(organizationId) {
3017
+ return await this.listOrganizationAdministrationMembers(organizationId);
3018
+ }
2913
3019
  /** Canonical organization identity and every non-personal workspace access roster. */
2914
3020
  async getOrganizationAdministrationOverview(organizationId) {
2915
3021
  return await this.requestJson(
@@ -2917,18 +3023,15 @@ var OpenGeniClient = class {
2917
3023
  `/v1/organizations/${organizationId}/overview`
2918
3024
  );
2919
3025
  }
2920
- /** Rename the organization under an exact optimistic-concurrency fence. */
2921
- async updateOrganizationName(organizationId, request) {
3026
+ /** Create a shared workspace without implicitly granting the actor access. */
3027
+ async createOrganizationWorkspace(organizationId, request) {
2922
3028
  return await this.requestJson(
2923
- "PATCH",
2924
- `/v1/organizations/${organizationId}`,
3029
+ "POST",
3030
+ `/v1/organizations/${organizationId}/workspaces`,
2925
3031
  request
2926
3032
  );
2927
3033
  }
2928
- /**
2929
- * Organization control-plane update for a shared workspace. This does not
2930
- * require or create operational workspace access for the organization admin.
2931
- */
3034
+ /** Rename one shared workspace under an exact optimistic-concurrency fence. */
2932
3035
  async updateOrganizationWorkspace(organizationId, workspaceId, request) {
2933
3036
  return await this.requestJson(
2934
3037
  "PATCH",
@@ -2936,45 +3039,35 @@ var OpenGeniClient = class {
2936
3039
  request
2937
3040
  );
2938
3041
  }
2939
- /** Create a shared workspace without implicitly granting the actor access. */
2940
- async createOrganizationWorkspace(organizationId, request) {
3042
+ async updateOrganizationWorkspaceSettings(organizationId, workspaceId, request) {
2941
3043
  return await this.requestJson(
2942
- "POST",
2943
- `/v1/organizations/${organizationId}/workspaces`,
3044
+ "PATCH",
3045
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/settings`,
2944
3046
  request
2945
3047
  );
2946
3048
  }
2947
- async updateOrganizationWorkspaceSettings(organizationId, workspaceId, request) {
3049
+ async putOrganizationWorkspaceMember(organizationId, workspaceId, membershipId, request) {
2948
3050
  return await this.requestJson(
2949
- "PATCH",
2950
- `/v1/organizations/${organizationId}/workspaces/${workspaceId}/settings`,
3051
+ "PUT",
3052
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members/${membershipId}`,
2951
3053
  request
2952
3054
  );
2953
3055
  }
2954
- async addOrganizationWorkspaceMember(organizationId, workspaceId, request) {
3056
+ async revokeOrganizationWorkspaceMember(organizationId, workspaceId, membershipId, request) {
2955
3057
  return await this.requestJson(
2956
3058
  "POST",
2957
- `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members`,
3059
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members/${membershipId}/revoke`,
2958
3060
  request
2959
3061
  );
2960
3062
  }
2961
- async updateOrganizationWorkspaceMember(organizationId, workspaceId, subjectId, request) {
3063
+ /** Rename the organization under an exact optimistic-concurrency fence. */
3064
+ async updateOrganizationName(organizationId, request) {
2962
3065
  return await this.requestJson(
2963
3066
  "PATCH",
2964
- `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members/${encodeURIComponent(
2965
- subjectId
2966
- )}`,
3067
+ `/v1/organizations/${organizationId}`,
2967
3068
  request
2968
3069
  );
2969
3070
  }
2970
- async removeOrganizationWorkspaceMember(organizationId, workspaceId, subjectId) {
2971
- await this.requestVoid(
2972
- "DELETE",
2973
- `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members/${encodeURIComponent(
2974
- subjectId
2975
- )}`
2976
- );
2977
- }
2978
3071
  async updateOrganizationMember(organizationId, membershipId, request) {
2979
3072
  return await this.requestJson(
2980
3073
  "PATCH",
@@ -5370,4 +5463,4 @@ export {
5370
5463
  parseMediaGenerationResult,
5371
5464
  OpenGeniClient
5372
5465
  };
5373
- //# sourceMappingURL=chunk-6IPZY27S.js.map
5466
+ //# sourceMappingURL=chunk-7VERSV47.js.map