@opengeni/sdk 0.57.0 → 2.2.0-canary.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 (94) hide show
  1. package/README.md +123 -2
  2. package/dist/artifacts.js +5 -5
  3. package/dist/automations-client.d.ts +17 -0
  4. package/dist/automations.d.ts +3 -0
  5. package/dist/automations.js +78 -0
  6. package/dist/automations.js.map +1 -0
  7. package/dist/{chunk-JDLDDRNE.js → chunk-C2H7HBNP.js} +290 -33
  8. package/dist/chunk-C2H7HBNP.js.map +1 -0
  9. package/dist/{chunk-GU6JF75T.js → chunk-C4DJPZRU.js} +1 -1
  10. package/dist/{chunk-GU6JF75T.js.map → chunk-C4DJPZRU.js.map} +1 -1
  11. package/dist/{chunk-JRPFWI6T.js → chunk-G6LBVWKT.js} +2 -2
  12. package/dist/{chunk-HJ3HHUT5.js → chunk-GLDV5QY7.js} +16 -2
  13. package/dist/chunk-GLDV5QY7.js.map +1 -0
  14. package/dist/{chunk-ST5DDKJP.js → chunk-GW3EJ2GP.js} +52 -1
  15. package/dist/chunk-GW3EJ2GP.js.map +1 -0
  16. package/dist/{chunk-VWE2QIVO.js → chunk-XNG7YGR3.js} +23 -6
  17. package/dist/chunk-XNG7YGR3.js.map +1 -0
  18. package/dist/{chunk-PKQ377ED.js → chunk-YBQTKNTL.js} +696 -57
  19. package/dist/chunk-YBQTKNTL.js.map +1 -0
  20. package/dist/client.d.ts +151 -26
  21. package/dist/codex-realtime-controller.d.ts +3 -0
  22. package/dist/codex-realtime-controller.js +2 -2
  23. package/dist/codex-realtime-v3.d.ts +13 -2
  24. package/dist/company-brain.d.ts +32 -0
  25. package/dist/company-profile.d.ts +1 -1
  26. package/dist/core.js +4 -4
  27. package/dist/editable-artifacts/browser-session.d.ts +7 -3
  28. package/dist/editable-artifacts/controller.d.ts +4 -1
  29. package/dist/editable-artifacts/errors.d.ts +1 -1
  30. package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
  31. package/dist/editable-artifacts/index.d.ts +2 -0
  32. package/dist/editable-artifacts/open-failure.d.ts +9 -0
  33. package/dist/editable-artifacts/types.d.ts +4 -3
  34. package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
  35. package/dist/editable-artifacts-worker.js +44 -17
  36. package/dist/editable-artifacts-worker.js.map +1 -1
  37. package/dist/editable-artifacts.js +222 -119
  38. package/dist/editable-artifacts.js.map +1 -1
  39. package/dist/errors.d.ts +1 -1
  40. package/dist/index.d.ts +7 -4
  41. package/dist/index.js +61 -12
  42. package/dist/index.js.map +1 -1
  43. package/dist/interaction.d.ts +23 -0
  44. package/dist/interaction.js +4 -1
  45. package/dist/organization-private-session-settings.d.ts +6 -0
  46. package/dist/organization-private-session-settings.js +22 -0
  47. package/dist/organization-private-session-settings.js.map +1 -0
  48. package/dist/pr-review-client.d.ts +15 -0
  49. package/dist/pr-review.d.ts +4 -0
  50. package/dist/pr-review.js +56 -0
  51. package/dist/pr-review.js.map +1 -0
  52. package/dist/preference-registry.d.ts +8 -0
  53. package/dist/realtime.js +2 -2
  54. package/dist/retained-artifacts.d.ts +5 -1
  55. package/dist/types.d.ts +976 -17
  56. package/dist/workspace-instruction-policies.d.ts +22 -0
  57. package/dist/workspace-learning.d.ts +124 -0
  58. package/package.json +14 -2
  59. package/src/automations-client.ts +118 -0
  60. package/src/automations.ts +15 -0
  61. package/src/client.ts +974 -71
  62. package/src/codex-realtime-controller.ts +235 -5
  63. package/src/codex-realtime-v3.ts +162 -31
  64. package/src/company-brain.ts +99 -0
  65. package/src/company-profile.ts +4 -1
  66. package/src/editable-artifacts/browser-session.ts +36 -22
  67. package/src/editable-artifacts/controller.ts +66 -45
  68. package/src/editable-artifacts/errors.ts +2 -0
  69. package/src/editable-artifacts/http-live-transport.ts +62 -37
  70. package/src/editable-artifacts/index.ts +6 -0
  71. package/src/editable-artifacts/open-failure.ts +79 -0
  72. package/src/editable-artifacts/storage.ts +31 -40
  73. package/src/editable-artifacts/types.ts +4 -3
  74. package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
  75. package/src/editable-artifacts/worker/runtime.ts +26 -13
  76. package/src/editable-artifacts/worker/wire-codec.ts +23 -5
  77. package/src/errors.ts +1 -1
  78. package/src/index.ts +131 -0
  79. package/src/interaction.ts +95 -0
  80. package/src/organization-private-session-settings.ts +33 -0
  81. package/src/pr-review-client.ts +84 -0
  82. package/src/pr-review.ts +15 -0
  83. package/src/preference-registry.ts +9 -0
  84. package/src/retained-artifacts.ts +101 -0
  85. package/src/stream.ts +13 -2
  86. package/src/types.ts +1117 -16
  87. package/src/workspace-instruction-policies.ts +24 -0
  88. package/src/workspace-learning.ts +138 -0
  89. package/dist/chunk-HJ3HHUT5.js.map +0 -1
  90. package/dist/chunk-JDLDDRNE.js.map +0 -1
  91. package/dist/chunk-PKQ377ED.js.map +0 -1
  92. package/dist/chunk-ST5DDKJP.js.map +0 -1
  93. package/dist/chunk-VWE2QIVO.js.map +0 -1
  94. /package/dist/{chunk-JRPFWI6T.js.map → chunk-G6LBVWKT.js.map} +0 -0
@@ -5,7 +5,10 @@ import {
5
5
  OPENGENI_API_CONTRACT_REVISION,
6
6
  OPENGENI_CORRELATION_HEADER,
7
7
  RETAINED_OUTPUT_MAX_PAGE_BYTES
8
- } from "./chunk-HJ3HHUT5.js";
8
+ } from "./chunk-GLDV5QY7.js";
9
+ import {
10
+ OpenGeniInteractionClient
11
+ } from "./chunk-GW3EJ2GP.js";
9
12
  import {
10
13
  OpenGeniApiContractMismatchError,
11
14
  OpenGeniApiError,
@@ -13,10 +16,7 @@ import {
13
16
  OpenGeniStreamError,
14
17
  isAbortError,
15
18
  isRetryableStreamError
16
- } from "./chunk-GU6JF75T.js";
17
- import {
18
- OpenGeniInteractionClient
19
- } from "./chunk-ST5DDKJP.js";
19
+ } from "./chunk-C4DJPZRU.js";
20
20
 
21
21
  // src/sse.ts
22
22
  async function* parseSseStream(stream) {
@@ -123,9 +123,11 @@ async function* streamSessionEvents(transport, options = {}) {
123
123
  return;
124
124
  }
125
125
  const event = parseSessionEvent(message.data);
126
- if (!event || event.sequence <= cursor) {
126
+ if (!event) {
127
127
  continue;
128
128
  }
129
+ const coveredSequence = eventResumeSequence(event);
130
+ if (coveredSequence <= cursor) continue;
129
131
  if (event.sequence > cursor + 1) {
130
132
  for await (const missed of backfillEvents(transport, cursor, event.sequence - 1)) {
131
133
  cursor = missed.sequence;
@@ -135,7 +137,7 @@ async function* streamSessionEvents(transport, options = {}) {
135
137
  }
136
138
  }
137
139
  }
138
- cursor = event.sequence;
140
+ cursor = coveredSequence;
139
141
  yield event;
140
142
  }
141
143
  if (!reconnect) {
@@ -262,6 +264,13 @@ function parseSessionEvent(data) {
262
264
  }
263
265
  return parsed;
264
266
  }
267
+ function eventResumeSequence(event) {
268
+ if (!event.payload || typeof event.payload !== "object" || Array.isArray(event.payload)) {
269
+ return event.sequence;
270
+ }
271
+ const covered = Number(event.payload.coalescedUntil);
272
+ return Math.max(event.sequence, Number.isFinite(covered) ? Math.floor(covered) : event.sequence);
273
+ }
265
274
  async function sleep(delayMs, signal) {
266
275
  if (signal?.aborted || delayMs <= 0) {
267
276
  return;
@@ -534,6 +543,45 @@ var MAX_VIDEO_BYTES = 512 * 1024 * 1024;
534
543
  var MAX_DIMENSION = 16384;
535
544
  var MAX_PIXELS = 67108864;
536
545
  var MAX_RANGE_BYTES = 1024 * 1024;
546
+ var MAX_SANDBOX_FILE_BYTES = 25 * 1024 * 1024 - 1;
547
+ function parseRetainedWorkspaceFileReference(value, expectedWorkspaceId) {
548
+ if (!recordWithKeys(value, WORKSPACE_FILE_REFERENCE_KEYS)) return null;
549
+ const artifact = value;
550
+ if (artifact.available !== true || artifact.kind !== "file" || typeof artifact.artifactId !== "string" || !UUID.test(artifact.artifactId) || typeof artifact.contentType !== "string" || !/^[a-z0-9][a-z0-9!#$&^_.+-]{0,62}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,62}$/.test(
551
+ artifact.contentType
552
+ ) || !safeIntegerBetween(artifact.originalBytes, 1, MAX_SANDBOX_FILE_BYTES) || typeof artifact.sha256 !== "string" || !SHA256.test(artifact.sha256) || typeof artifact.retainedAt !== "string" || artifact.retainedAt.length > 64 || !ISO_DATETIME_WITH_OFFSET.test(artifact.retainedAt) || !Number.isFinite(Date.parse(artifact.retainedAt)) || !recordWithKeys(artifact.retention, RETENTION_KEYS) || !recordWithKeys(artifact.retrieval, RETRIEVAL_KEYS)) {
553
+ return null;
554
+ }
555
+ const retention = artifact.retention;
556
+ if (retention.policy !== "workspace_file" || retention.expiresAt !== null) return null;
557
+ const retrieval = artifact.retrieval;
558
+ if (retrieval.method !== "GET" || retrieval.acceptRanges !== "bytes" || retrieval.maxRangeBytes !== MAX_RANGE_BYTES || typeof retrieval.path !== "string" || retrieval.path.length > 256) {
559
+ return null;
560
+ }
561
+ const match = WORKSPACE_PATH.exec(retrieval.path);
562
+ if (!match || !UUID.test(match[1] ?? "") || match[2] !== artifact.artifactId || expectedWorkspaceId !== void 0 && match[1] !== expectedWorkspaceId) {
563
+ return null;
564
+ }
565
+ return value;
566
+ }
567
+ function parseSandboxFileArtifactReceipt(value, expectedWorkspaceId) {
568
+ if (typeof value === "string" && value.length <= 8192) {
569
+ try {
570
+ return parseSandboxFileArtifactReceipt(JSON.parse(value), expectedWorkspaceId);
571
+ } catch {
572
+ return null;
573
+ }
574
+ }
575
+ if (!recordWithKeys(value, SANDBOX_FILE_RECEIPT_KEYS)) return null;
576
+ const artifact = parseRetainedWorkspaceFileReference(value.artifact, expectedWorkspaceId);
577
+ const pathSegments = typeof value.sandboxPath === "string" ? value.sandboxPath.split("/") : [];
578
+ if (value.type !== "sandbox_file" || typeof value.sandboxPath !== "string" || !value.sandboxPath.startsWith("/workspace/") || value.sandboxPath.length > 4096 || value.sandboxPath.includes("\0") || pathSegments.some(
579
+ (segment, index) => index > 1 && (!segment || segment === "." || segment === "..")
580
+ ) || typeof value.filename !== "string" || value.filename.length < 1 || value.filename.length > 1024 || pathSegments.at(-1) !== value.filename || !artifact) {
581
+ return null;
582
+ }
583
+ return value;
584
+ }
537
585
  function parseRetainedGeneratedImageReference(value, expectedWorkspaceId) {
538
586
  if (!recordWithKeys(value, GENERATED_IMAGE_REFERENCE_KEYS)) return null;
539
587
  const artifact = value;
@@ -654,10 +702,22 @@ var GENERATED_IMAGE_REFERENCE_KEYS = /* @__PURE__ */ new Set([
654
702
  "retention",
655
703
  "retrieval"
656
704
  ]);
705
+ var WORKSPACE_FILE_REFERENCE_KEYS = /* @__PURE__ */ new Set([
706
+ "available",
707
+ "artifactId",
708
+ "kind",
709
+ "contentType",
710
+ "originalBytes",
711
+ "sha256",
712
+ "retainedAt",
713
+ "retention",
714
+ "retrieval"
715
+ ]);
657
716
  var DIMENSION_KEYS = /* @__PURE__ */ new Set(["width", "height"]);
658
717
  var RETENTION_KEYS = /* @__PURE__ */ new Set(["policy", "expiresAt"]);
659
718
  var RETRIEVAL_KEYS = /* @__PURE__ */ new Set(["method", "path", "acceptRanges", "maxRangeBytes"]);
660
719
  var GENERATED_IMAGE_RECEIPT_KEYS = /* @__PURE__ */ new Set(["type", "artifact", "sandboxPath"]);
720
+ var SANDBOX_FILE_RECEIPT_KEYS = /* @__PURE__ */ new Set(["type", "sandboxPath", "filename", "artifact"]);
661
721
  var GENERATED_VIDEO_RECEIPT_KEYS = /* @__PURE__ */ new Set([
662
722
  "type",
663
723
  "schemaVersion",
@@ -704,10 +764,18 @@ function sessionListQuery(options) {
704
764
  ...parentSessionId === void 0 ? {} : { parentSessionId: parentSessionId ?? "null" }
705
765
  };
706
766
  }
767
+ function assertNoMessageTools(input) {
768
+ if (Object.prototype.hasOwnProperty.call(input, "tools")) {
769
+ throw new TypeError(
770
+ "Message-level tools are not supported; update the session tool policy before sending."
771
+ );
772
+ }
773
+ }
707
774
  var OpenGeniClient = class {
708
775
  baseUrl;
709
776
  options;
710
777
  fetchImpl;
778
+ sessionCommandTimeoutMs;
711
779
  readInFlight = /* @__PURE__ */ new Map();
712
780
  readTrailing = /* @__PURE__ */ new Map();
713
781
  /** Resource-oriented Browser/Computer facade over this exact authenticated client. */
@@ -716,6 +784,11 @@ var OpenGeniClient = class {
716
784
  this.baseUrl = options.baseUrl.replace(/\/+$/, "");
717
785
  this.options = options;
718
786
  this.fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
787
+ const sessionCommandTimeoutMs = options.sessionCommandTimeoutMs ?? 15e3;
788
+ if (!Number.isFinite(sessionCommandTimeoutMs) || sessionCommandTimeoutMs <= 0) {
789
+ throw new RangeError("sessionCommandTimeoutMs must be a finite positive number");
790
+ }
791
+ this.sessionCommandTimeoutMs = sessionCommandTimeoutMs;
719
792
  this.interaction = new OpenGeniInteractionClient(this);
720
793
  }
721
794
  // --- Session lifecycle ---------------------------------------------------
@@ -923,6 +996,29 @@ var OpenGeniClient = class {
923
996
  request
924
997
  );
925
998
  }
999
+ /** Whether this exact authenticated principal may atomically create a private session. */
1000
+ async getSessionTenancyCreateCapabilities(workspaceId) {
1001
+ return await this.requestJson(
1002
+ "GET",
1003
+ `/v1/workspaces/${workspaceId}/session-tenancy/capabilities`
1004
+ );
1005
+ }
1006
+ /** Change an owned, fully quiescent session between private and workspace visibility. */
1007
+ async updateSessionVisibility(workspaceId, sessionId, request) {
1008
+ return await this.requestJson(
1009
+ "PUT",
1010
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/visibility`,
1011
+ request
1012
+ );
1013
+ }
1014
+ /** Create an independent same-workspace fork with explicit destination visibility. */
1015
+ async forkSession(workspaceId, sessionId, request) {
1016
+ return await this.requestJson(
1017
+ "POST",
1018
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/forks`,
1019
+ request
1020
+ );
1021
+ }
926
1022
  /** Replace the durable tool policy or explicitly adopt workspace defaults. */
927
1023
  async updateSessionToolPolicy(workspaceId, sessionId, request) {
928
1024
  return await this.requestJson(
@@ -955,6 +1051,18 @@ var OpenGeniClient = class {
955
1051
  sessionListQuery(options)
956
1052
  );
957
1053
  }
1054
+ async listSessionBackgroundCommands(workspaceId, sessionId) {
1055
+ return await this.requestJson(
1056
+ "GET",
1057
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/background-commands`
1058
+ );
1059
+ }
1060
+ async cancelSessionBackgroundCommand(workspaceId, sessionId, commandId) {
1061
+ return await this.requestJson(
1062
+ "DELETE",
1063
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/background-commands/${commandId}`
1064
+ );
1065
+ }
958
1066
  /** Pin-aware ordinary-session page with a stable keyset cursor. */
959
1067
  async listSessionPage(workspaceId, options = {}) {
960
1068
  const search = options.search?.trim();
@@ -969,7 +1077,8 @@ var OpenGeniClient = class {
969
1077
  ...sessionListQuery(options),
970
1078
  ...options.cursor !== void 0 ? { cursor: options.cursor } : {},
971
1079
  ...search ? { search } : {},
972
- ...options.pinsOnly ? { pinsOnly: "true" } : {}
1080
+ ...options.pinsOnly ? { pinsOnly: "true" } : {},
1081
+ ...options.archivedOnly ? { archivedOnly: "true" } : {}
973
1082
  }
974
1083
  );
975
1084
  } catch (error) {
@@ -994,6 +1103,9 @@ var OpenGeniClient = class {
994
1103
  if (options.pinsOnly) {
995
1104
  throw new Error("The connected OpenGeni API does not support pins-only session lists");
996
1105
  }
1106
+ if (options.archivedOnly) {
1107
+ throw new Error("The connected OpenGeni API does not support archived session lists");
1108
+ }
997
1109
  return { pinned: [], sessions: response, nextCursor: null };
998
1110
  }
999
1111
  return response;
@@ -1021,6 +1133,29 @@ var OpenGeniClient = class {
1021
1133
  request
1022
1134
  );
1023
1135
  }
1136
+ /** Set this authenticated member's explicit read/actively-working state. */
1137
+ async updateSessionAttention(workspaceId, sessionId, request) {
1138
+ return await this.requestJson(
1139
+ "PUT",
1140
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/attention`,
1141
+ request
1142
+ );
1143
+ }
1144
+ /** Archive or restore this authenticated member's root chat. */
1145
+ async updateSessionArchive(workspaceId, sessionId, request) {
1146
+ return await this.requestJson(
1147
+ "PUT",
1148
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/archive`,
1149
+ request
1150
+ );
1151
+ }
1152
+ /** Permanently delete one quiescent root session and its full descendant tree. */
1153
+ async deleteSession(workspaceId, sessionId) {
1154
+ return await this.requestJson(
1155
+ "DELETE",
1156
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}`
1157
+ );
1158
+ }
1024
1159
  async getSessionLineage(workspaceId, sessionId) {
1025
1160
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}/lineage`;
1026
1161
  return await this.singleFlightRead(
@@ -1159,6 +1294,24 @@ var OpenGeniClient = class {
1159
1294
  { signal: options.signal }
1160
1295
  );
1161
1296
  }
1297
+ /** Ask one authoritative Connected Machine runner to drain accepted work and
1298
+ * install the exact signed version promoted for its channel. Progress is read
1299
+ * from `listMachines`; completion requires the successor build identity. */
1300
+ async updateMachineAgent(workspaceId, enrollmentId) {
1301
+ return await this.requestJson(
1302
+ "POST",
1303
+ `/v1/workspaces/${workspaceId}/machines/${enrollmentId}/update`
1304
+ );
1305
+ }
1306
+ /** Revision-fenced update of a Connected Machine's optional command memory
1307
+ * policy. Null byte limits preserve unrestricted machine access. */
1308
+ async updateMachineOperationPolicy(workspaceId, enrollmentId, request) {
1309
+ return await this.requestJson(
1310
+ "PATCH",
1311
+ `/v1/workspaces/${workspaceId}/machines/${enrollmentId}/operation-policy`,
1312
+ request
1313
+ );
1314
+ }
1162
1315
  /**
1163
1316
  * Read the downsampled (~1/min) metrics series for ONE machine over a time
1164
1317
  * window (default 1h). The samples are oldest-first (a left-to-right chart).
@@ -1175,8 +1328,9 @@ var OpenGeniClient = class {
1175
1328
  /**
1176
1329
  * Remove one connected self-hosted machine enrollment. The control-plane
1177
1330
  * operation works while the agent is offline, revokes future reconnects,
1178
- * retains history, and returns a typed blocker when active route/lease or
1179
- * recovery dependencies make removal unsafe. `idempotencyKey` is replay-safe.
1331
+ * retains history, and atomically detaches idle dependent sessions (a
1332
+ * machine-home session becomes `backend:none`). Active turns, live leases,
1333
+ * and recovery work remain typed blockers. `idempotencyKey` is replay-safe.
1180
1334
  */
1181
1335
  async removeEnrollment(workspaceId, enrollmentId, request = {}) {
1182
1336
  return await this.requestJson(
@@ -1213,7 +1367,8 @@ var OpenGeniClient = class {
1213
1367
  `/v1/workspaces/${workspaceId}/enrollments/device/approve`,
1214
1368
  {
1215
1369
  userCode: request.userCode,
1216
- allowScreenControl: request.allowScreenControl ?? false
1370
+ allowScreenControl: request.allowScreenControl ?? false,
1371
+ ...request.scope ? { scope: request.scope } : {}
1217
1372
  }
1218
1373
  );
1219
1374
  }
@@ -1373,7 +1528,7 @@ var OpenGeniClient = class {
1373
1528
  }
1374
1529
  /** POST a user/control event to the session. Returns the accepted event. */
1375
1530
  async sendEvent(workspaceId, sessionId, event) {
1376
- return await this.requestJson(
1531
+ return await this.requestSessionCommand(
1377
1532
  "POST",
1378
1533
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/events`,
1379
1534
  event
@@ -1381,6 +1536,7 @@ var OpenGeniClient = class {
1381
1536
  }
1382
1537
  async sendMessage(workspaceId, sessionId, message) {
1383
1538
  const input = typeof message === "string" ? { text: message } : message;
1539
+ assertNoMessageTools(input);
1384
1540
  const { clientEventId, ...payload } = input;
1385
1541
  return await this.sendEvent(workspaceId, sessionId, {
1386
1542
  type: "user.message",
@@ -1472,52 +1628,59 @@ var OpenGeniClient = class {
1472
1628
  const path = `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue`;
1473
1629
  return await this.singleFlightRead(
1474
1630
  path,
1475
- () => this.requestJson("GET", path)
1631
+ () => this.requestSessionCommand("GET", path)
1476
1632
  );
1477
1633
  }
1478
1634
  async moveQueueItem(workspaceId, sessionId, turnId, request) {
1479
- return await this.requestJson(
1635
+ return await this.requestSessionCommand(
1480
1636
  "POST",
1481
1637
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue/${turnId}/move`,
1482
1638
  request
1483
1639
  );
1484
1640
  }
1485
1641
  async editQueueItem(workspaceId, sessionId, turnId, request) {
1486
- return await this.requestJson(
1642
+ return await this.requestSessionCommand(
1487
1643
  "POST",
1488
1644
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue/${turnId}/edit`,
1489
1645
  request
1490
1646
  );
1491
1647
  }
1492
1648
  async steerQueueItem(workspaceId, sessionId, turnId, request) {
1493
- return await this.requestJson(
1649
+ return await this.requestSessionCommand(
1494
1650
  "POST",
1495
1651
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue/${turnId}/steer`,
1496
1652
  request
1497
1653
  );
1498
1654
  }
1499
1655
  async deleteQueueItem(workspaceId, sessionId, turnId, request) {
1500
- return await this.requestJson(
1656
+ return await this.requestSessionCommand(
1501
1657
  "POST",
1502
1658
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue/${turnId}/delete`,
1503
1659
  request
1504
1660
  );
1505
1661
  }
1506
1662
  async getComposerDraft(workspaceId, sessionId) {
1507
- return await this.requestJson(
1663
+ return await this.requestSessionCommand(
1508
1664
  "GET",
1509
1665
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/composer-draft`
1510
1666
  );
1511
1667
  }
1512
1668
  async saveComposerDraft(workspaceId, sessionId, request) {
1513
- return await this.requestJson(
1669
+ return await this.requestSessionCommand(
1514
1670
  "PUT",
1515
1671
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/composer-draft`,
1516
1672
  request
1517
1673
  );
1518
1674
  }
1675
+ async submitComposerDraft(workspaceId, sessionId, request) {
1676
+ return await this.requestSessionCommand(
1677
+ "POST",
1678
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/composer-draft/submit`,
1679
+ request
1680
+ );
1681
+ }
1519
1682
  async controlSession(workspaceId, sessionId, request) {
1520
- return await this.requestJson(
1683
+ return await this.requestSessionCommand(
1521
1684
  "POST",
1522
1685
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/control`,
1523
1686
  request
@@ -1675,7 +1838,8 @@ var OpenGeniClient = class {
1675
1838
  */
1676
1839
  async steerMessage(workspaceId, sessionId, message) {
1677
1840
  const input = typeof message === "string" ? { text: message } : message;
1678
- return await this.requestJson(
1841
+ assertNoMessageTools(input);
1842
+ return await this.requestSessionCommand(
1679
1843
  "POST",
1680
1844
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/steer`,
1681
1845
  input
@@ -1700,6 +1864,30 @@ var OpenGeniClient = class {
1700
1864
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal/revisions`
1701
1865
  );
1702
1866
  }
1867
+ async listGoalRevisionPage(workspaceId, sessionId, options = {}) {
1868
+ const query = new URLSearchParams();
1869
+ if (options.limit !== void 0) query.set("limit", String(options.limit));
1870
+ if (options.before !== void 0) query.set("before", options.before);
1871
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1872
+ return await this.requestJson(
1873
+ "GET",
1874
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal/revisions/page${suffix}`
1875
+ );
1876
+ }
1877
+ async rejectGoalRevision(workspaceId, sessionId, revisionId, request) {
1878
+ return await this.requestJson(
1879
+ "POST",
1880
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal/revisions/${revisionId}/reject`,
1881
+ request
1882
+ );
1883
+ }
1884
+ async rollbackGoalRevision(workspaceId, sessionId, revisionId, request) {
1885
+ return await this.requestJson(
1886
+ "POST",
1887
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal/revisions/${revisionId}/rollback`,
1888
+ request
1889
+ );
1890
+ }
1703
1891
  async applyGoalRevision(workspaceId, sessionId, revisionId, request) {
1704
1892
  return await this.requestJson(
1705
1893
  "POST",
@@ -1778,6 +1966,16 @@ var OpenGeniClient = class {
1778
1966
  options
1779
1967
  );
1780
1968
  }
1969
+ /** Publish one exact sandbox file into permanent workspace artifact storage. */
1970
+ async publishSandboxFileArtifact(workspaceId, sessionId, request, options = {}) {
1971
+ return await this.requestJson(
1972
+ "POST",
1973
+ `/v1/workspaces/${workspaceId}/sessions/${sessionId}/artifacts/publish`,
1974
+ request,
1975
+ {},
1976
+ options
1977
+ );
1978
+ }
1781
1979
  /** FileSystem: write a file (last-writer-wins; emits fs.changed). */
1782
1980
  async fsWrite(workspaceId, sessionId, request) {
1783
1981
  return await this.requestJson(
@@ -2598,6 +2796,21 @@ var OpenGeniClient = class {
2598
2796
  `/v1/workspaces/${workspaceId}/model-catalog`
2599
2797
  );
2600
2798
  }
2799
+ /** Read the workspace's hard provider/model allowlist. */
2800
+ async getWorkspaceModelAccessPolicy(workspaceId) {
2801
+ return await this.requestJson(
2802
+ "GET",
2803
+ `/v1/workspaces/${workspaceId}/model-policy`
2804
+ );
2805
+ }
2806
+ /** Fully replace the workspace's hard provider/model allowlist. */
2807
+ async updateWorkspaceModelAccessPolicy(workspaceId, request) {
2808
+ return await this.requestJson(
2809
+ "PUT",
2810
+ `/v1/workspaces/${workspaceId}/model-policy`,
2811
+ request
2812
+ );
2813
+ }
2601
2814
  /** Authenticated realtime voice models and credential readiness. */
2602
2815
  async getWorkspaceRealtimeModelCatalog(workspaceId) {
2603
2816
  return await this.requestJson(
@@ -2616,6 +2829,172 @@ var OpenGeniClient = class {
2616
2829
  "/v1/organization-memberships"
2617
2830
  );
2618
2831
  }
2832
+ /** Bounded owner-only personal-resource authority page for one exact resource kind. */
2833
+ async listUserResourceAuthorities(workspaceId, options) {
2834
+ const query = new URLSearchParams({
2835
+ scope: "user",
2836
+ resourceKind: options.resourceKind
2837
+ });
2838
+ if (options.cursor) query.set("cursor", options.cursor);
2839
+ if (options.limit !== void 0) query.set("limit", String(options.limit));
2840
+ return await this.requestJson(
2841
+ "GET",
2842
+ `/v1/workspaces/${workspaceId}/user-resource-authorities?${query.toString()}`
2843
+ );
2844
+ }
2845
+ /** Issue an exact-session or standing personal-resource grant. */
2846
+ async issueUserResourceGrant(workspaceId, authorityId, request) {
2847
+ return await this.requestJson(
2848
+ "POST",
2849
+ `/v1/workspaces/${workspaceId}/user-resource-authorities/${authorityId}/grants`,
2850
+ request
2851
+ );
2852
+ }
2853
+ /** Revoke an owner grant through the exact workspace it targets. */
2854
+ async revokeUserResourceGrant(workspaceId, grantId) {
2855
+ return await this.requestJson(
2856
+ "DELETE",
2857
+ `/v1/workspaces/${workspaceId}/user-resource-authorities/grants/${grantId}?scope=user`
2858
+ );
2859
+ }
2860
+ /** Create a new organization owned by the current managed human. */
2861
+ async createOrganization(request) {
2862
+ return await this.requestJson("POST", "/v1/organizations", request);
2863
+ }
2864
+ /** Pending and historical invitations addressed to the current managed human. */
2865
+ async listOrganizationInvitations(options = {}) {
2866
+ const query = new URLSearchParams();
2867
+ if (options.cursor) query.set("cursor", options.cursor);
2868
+ if (options.limit !== void 0) query.set("limit", String(options.limit));
2869
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
2870
+ return await this.requestJson(
2871
+ "GET",
2872
+ `/v1/organization-invitations${suffix}`
2873
+ );
2874
+ }
2875
+ /** Admin-only deterministic page of invitations for one organization. */
2876
+ async listOrganizationInvitationsForOrganization(organizationId, options = {}) {
2877
+ const query = new URLSearchParams();
2878
+ if (options.cursor) query.set("cursor", options.cursor);
2879
+ if (options.limit !== void 0) query.set("limit", String(options.limit));
2880
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
2881
+ return await this.requestJson(
2882
+ "GET",
2883
+ `/v1/organizations/${organizationId}/invitations${suffix}`
2884
+ );
2885
+ }
2886
+ async createOrganizationInvitation(organizationId, request) {
2887
+ return await this.requestJson(
2888
+ "POST",
2889
+ `/v1/organizations/${organizationId}/invitations`,
2890
+ request
2891
+ );
2892
+ }
2893
+ async acceptOrganizationInvitation(invitationId, request) {
2894
+ return await this.requestJson(
2895
+ "POST",
2896
+ `/v1/organization-invitations/${invitationId}/accept`,
2897
+ request
2898
+ );
2899
+ }
2900
+ async revokeOrganizationInvitation(organizationId, invitationId, request) {
2901
+ return await this.requestJson(
2902
+ "POST",
2903
+ `/v1/organizations/${organizationId}/invitations/${invitationId}/revoke`,
2904
+ request
2905
+ );
2906
+ }
2907
+ async listOrganizationMembers(organizationId) {
2908
+ return await this.requestJson(
2909
+ "GET",
2910
+ `/v1/organizations/${organizationId}/members`
2911
+ );
2912
+ }
2913
+ /** Canonical organization identity and every non-personal workspace access roster. */
2914
+ async getOrganizationAdministrationOverview(organizationId) {
2915
+ return await this.requestJson(
2916
+ "GET",
2917
+ `/v1/organizations/${organizationId}/overview`
2918
+ );
2919
+ }
2920
+ /** Rename the organization under an exact optimistic-concurrency fence. */
2921
+ async updateOrganizationName(organizationId, request) {
2922
+ return await this.requestJson(
2923
+ "PATCH",
2924
+ `/v1/organizations/${organizationId}`,
2925
+ request
2926
+ );
2927
+ }
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
+ */
2932
+ async updateOrganizationWorkspace(organizationId, workspaceId, request) {
2933
+ return await this.requestJson(
2934
+ "PATCH",
2935
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}`,
2936
+ request
2937
+ );
2938
+ }
2939
+ /** Create a shared workspace without implicitly granting the actor access. */
2940
+ async createOrganizationWorkspace(organizationId, request) {
2941
+ return await this.requestJson(
2942
+ "POST",
2943
+ `/v1/organizations/${organizationId}/workspaces`,
2944
+ request
2945
+ );
2946
+ }
2947
+ async updateOrganizationWorkspaceSettings(organizationId, workspaceId, request) {
2948
+ return await this.requestJson(
2949
+ "PATCH",
2950
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/settings`,
2951
+ request
2952
+ );
2953
+ }
2954
+ async addOrganizationWorkspaceMember(organizationId, workspaceId, request) {
2955
+ return await this.requestJson(
2956
+ "POST",
2957
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members`,
2958
+ request
2959
+ );
2960
+ }
2961
+ async updateOrganizationWorkspaceMember(organizationId, workspaceId, subjectId, request) {
2962
+ return await this.requestJson(
2963
+ "PATCH",
2964
+ `/v1/organizations/${organizationId}/workspaces/${workspaceId}/members/${encodeURIComponent(
2965
+ subjectId
2966
+ )}`,
2967
+ request
2968
+ );
2969
+ }
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
+ async updateOrganizationMember(organizationId, membershipId, request) {
2979
+ return await this.requestJson(
2980
+ "PATCH",
2981
+ `/v1/organizations/${organizationId}/members/${membershipId}`,
2982
+ request
2983
+ );
2984
+ }
2985
+ async getOrganizationRetentionPolicy(organizationId) {
2986
+ return await this.requestJson(
2987
+ "GET",
2988
+ `/v1/organizations/${organizationId}/retention-policy`
2989
+ );
2990
+ }
2991
+ async updateOrganizationRetentionPolicy(organizationId, request) {
2992
+ return await this.requestJson(
2993
+ "PATCH",
2994
+ `/v1/organizations/${organizationId}/retention-policy`,
2995
+ request
2996
+ );
2997
+ }
2619
2998
  async listWorkspaces() {
2620
2999
  return await this.requestJson("GET", "/v1/workspaces");
2621
3000
  }
@@ -2645,6 +3024,26 @@ var OpenGeniClient = class {
2645
3024
  `/v1/workspaces/${workspaceId}/workspace-state/export${query}`
2646
3025
  );
2647
3026
  }
3027
+ /** Permission-filtered Company Brain package with authorized guidance bodies. */
3028
+ getCompanyBrain(workspaceId) {
3029
+ return this.requestJson(
3030
+ "GET",
3031
+ `/v1/workspaces/${workspaceId}/company-brain`
3032
+ );
3033
+ }
3034
+ /** Download the deterministic Markdown/YAML Company Brain package. */
3035
+ async exportCompanyBrainOkf(workspaceId) {
3036
+ const response = await this.requestResponse(
3037
+ "GET",
3038
+ `/v1/workspaces/${workspaceId}/company-brain/export`
3039
+ );
3040
+ const headers = response.headers;
3041
+ return {
3042
+ content: await response.text(),
3043
+ contentType: headers.get("content-type") ?? "text/markdown",
3044
+ filename: headers.get("content-disposition")?.split('"')[1] ?? "company-brain.okf.md"
3045
+ };
3046
+ }
2648
3047
  async updateWorkspace(workspaceId, request) {
2649
3048
  return await this.requestJson("PATCH", `/v1/workspaces/${workspaceId}`, request);
2650
3049
  }
@@ -2664,6 +3063,44 @@ var OpenGeniClient = class {
2664
3063
  `/v1/workspaces/${workspaceId}/instruction-policies${query ? `?${query}` : ""}`
2665
3064
  );
2666
3065
  }
3066
+ /** Inspect the bounded, permission-filtered governed-learning timeline. */
3067
+ async getWorkspaceLearningHistory(workspaceId, options = {}) {
3068
+ const params = new URLSearchParams();
3069
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
3070
+ const query = params.toString();
3071
+ return await this.requestJson(
3072
+ "GET",
3073
+ `/v1/workspaces/${workspaceId}/learning${query ? `?${query}` : ""}`
3074
+ );
3075
+ }
3076
+ async createWorkspaceLearningPolicyRevision(workspaceId, request) {
3077
+ return await this.requestJson(
3078
+ "POST",
3079
+ `/v1/workspaces/${workspaceId}/learning/revisions`,
3080
+ request
3081
+ );
3082
+ }
3083
+ async activateWorkspaceLearningPolicyRevision(workspaceId, revisionId, request) {
3084
+ return await this.requestJson(
3085
+ "POST",
3086
+ `/v1/workspaces/${workspaceId}/learning/revisions/${encodeURIComponent(revisionId)}/activate`,
3087
+ request
3088
+ );
3089
+ }
3090
+ async rollbackWorkspaceLearningPolicyRevision(workspaceId, request) {
3091
+ return await this.requestJson(
3092
+ "POST",
3093
+ `/v1/workspaces/${workspaceId}/learning/rollback`,
3094
+ request
3095
+ );
3096
+ }
3097
+ async undoGovernedLearningActivation(workspaceId, activationReceiptId, request = {}) {
3098
+ return await this.requestJson(
3099
+ "POST",
3100
+ `/v1/workspaces/${workspaceId}/learning/activations/${encodeURIComponent(activationReceiptId)}/undo`,
3101
+ request
3102
+ );
3103
+ }
2667
3104
  async getWorkspaceInstructionPolicyRevision(workspaceId, revisionId) {
2668
3105
  return await this.requestJson(
2669
3106
  "GET",
@@ -3076,6 +3513,13 @@ var OpenGeniClient = class {
3076
3513
  request
3077
3514
  );
3078
3515
  }
3516
+ async reorderChannels(workspaceId, request) {
3517
+ return await this.requestJson(
3518
+ "PUT",
3519
+ `/v1/workspaces/${workspaceId}/channels/order`,
3520
+ request
3521
+ );
3522
+ }
3079
3523
  async deleteChannel(workspaceId, channelId) {
3080
3524
  await this.requestJson(
3081
3525
  "DELETE",
@@ -3332,15 +3776,15 @@ var OpenGeniClient = class {
3332
3776
  options
3333
3777
  );
3334
3778
  }
3335
- /** Assemble one permanent generated-image receipt from bounded authenticated ranges. */
3779
+ /** Assemble one permanent image or file artifact from bounded authenticated ranges. */
3336
3780
  async downloadRetainedArtifact(workspaceId, artifact, options = {}) {
3337
- assertRetainedGeneratedImageReceipt(workspaceId, artifact);
3781
+ assertRetainedWorkspaceArtifactReceipt(workspaceId, artifact);
3338
3782
  const bytes = await this.downloadRetainedArtifactBytes(artifact, options);
3339
3783
  return { artifact, bytes };
3340
3784
  }
3341
- /** Mint a short-lived, zero-copy browser source for a validated generated image. */
3785
+ /** Mint a short-lived, zero-copy browser source for a validated workspace artifact. */
3342
3786
  async createRetainedArtifactDownloadUrl(workspaceId, artifact, options = {}) {
3343
- assertRetainedGeneratedImageReceipt(workspaceId, artifact);
3787
+ assertRetainedWorkspaceArtifactReceipt(workspaceId, artifact);
3344
3788
  const download = await this.createFileDownloadUrl(workspaceId, artifact.artifactId, options);
3345
3789
  assertSafeArtifactDownloadUrl(download);
3346
3790
  return download;
@@ -3537,6 +3981,28 @@ var OpenGeniClient = class {
3537
3981
  `/v1/workspaces/${workspaceId}/document-bases/${baseId}/documents`
3538
3982
  );
3539
3983
  }
3984
+ /**
3985
+ * List every Document the current human can manage from this workspace,
3986
+ * including portable personal and organization-scoped Documents whose
3987
+ * immutable ingestion workspace is different.
3988
+ */
3989
+ async listAccessibleDocuments(workspaceId) {
3990
+ return await this.requestJson("GET", `/v1/workspaces/${workspaceId}/documents`);
3991
+ }
3992
+ /** Read the immutable source file through the Document's effective authority. */
3993
+ async getDocumentOriginalFile(workspaceId, documentId) {
3994
+ return await this.requestJson(
3995
+ "GET",
3996
+ `/v1/workspaces/${workspaceId}/documents/${documentId}/original-file`
3997
+ );
3998
+ }
3999
+ /** Mint a source-file URL through the Document's effective authority. */
4000
+ async createDocumentOriginalFileDownloadUrl(workspaceId, documentId) {
4001
+ return await this.requestJson(
4002
+ "POST",
4003
+ `/v1/workspaces/${workspaceId}/documents/${documentId}/original-file/download-url`
4004
+ );
4005
+ }
3540
4006
  /**
3541
4007
  * Drop raw text or an already-uploaded file into the workspace's Default
3542
4008
  * base. When curation is enabled, it may name, summarize, categorize, and
@@ -3561,6 +4027,39 @@ var OpenGeniClient = class {
3561
4027
  request
3562
4028
  );
3563
4029
  }
4030
+ /**
4031
+ * Atomically reclassify a Document's authority and every indexed chunk.
4032
+ * The operation is replay-safe and rejects a stale expected authority tuple.
4033
+ */
4034
+ async reclassifyDocumentAuthority(workspaceId, documentId, request) {
4035
+ return await this.requestJson(
4036
+ "POST",
4037
+ `/v1/workspaces/${workspaceId}/documents/${documentId}/authority-reclassifications`,
4038
+ request
4039
+ );
4040
+ }
4041
+ /** List the current actor's durable authority-reclassification receipts. */
4042
+ async listDocumentAuthorityReclassifications(workspaceId, documentId, options = {}) {
4043
+ const params = new URLSearchParams();
4044
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
4045
+ if (options.cursor) params.set("cursor", options.cursor);
4046
+ const query = params.size > 0 ? `?${params.toString()}` : "";
4047
+ return await this.requestJson(
4048
+ "GET",
4049
+ `/v1/workspaces/${workspaceId}/documents/${documentId}/authority-reclassifications${query}`
4050
+ );
4051
+ }
4052
+ /**
4053
+ * Advance one resumable, organization-scoped Default collection backfill.
4054
+ * Reusing an operation ID is idempotent; keep the run ID across batches.
4055
+ */
4056
+ async runDocumentDefaultCollectionBackfill(workspaceId, request) {
4057
+ return await this.requestJson(
4058
+ "POST",
4059
+ `/v1/workspaces/${workspaceId}/document-default-collection-backfills`,
4060
+ request
4061
+ );
4062
+ }
3564
4063
  /** Retry indexing for a failed document. */
3565
4064
  async reindexDocument(workspaceId, baseId, documentId) {
3566
4065
  return await this.requestJson(
@@ -3964,6 +4463,66 @@ var OpenGeniClient = class {
3964
4463
  );
3965
4464
  return response.connections;
3966
4465
  }
4466
+ /** Secret-free status for the caller's exact personal GitHub connection. */
4467
+ async personalGitHubStatus(workspaceId) {
4468
+ return await this.requestJson(
4469
+ "GET",
4470
+ `/v1/workspaces/${workspaceId}/connections/github`
4471
+ );
4472
+ }
4473
+ /** Start the dedicated personal GitHub authorization-code + PKCE flow. */
4474
+ async startPersonalGitHubOAuth(workspaceId, request = {}) {
4475
+ return await this.requestJson(
4476
+ "POST",
4477
+ `/v1/workspaces/${workspaceId}/connections/github/oauth/start`,
4478
+ request
4479
+ );
4480
+ }
4481
+ /** Re-authorize one exact personal GitHub Connection generation in place. */
4482
+ async reconnectPersonalGitHub(workspaceId, connectionId, request = {}) {
4483
+ return await this.requestJson(
4484
+ "POST",
4485
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}/github/reconnect`,
4486
+ request
4487
+ );
4488
+ }
4489
+ /** Revoke one exact generation through an idempotent owner-only disconnect. */
4490
+ async disconnectPersonalGitHub(workspaceId, connectionId, request) {
4491
+ const response = await this.requestJson(
4492
+ "DELETE",
4493
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}`,
4494
+ request
4495
+ );
4496
+ return response.connection;
4497
+ }
4498
+ /** Browse one bounded page of repositories visible to one exact owner connection. */
4499
+ async listPersonalGitHubRepositories(workspaceId, connectionId, options = {}) {
4500
+ return await this.requestJson(
4501
+ "GET",
4502
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}/github/repositories`,
4503
+ void 0,
4504
+ {
4505
+ ...options.cursor !== void 0 ? { cursor: String(options.cursor) } : {},
4506
+ ...options.limit !== void 0 ? { limit: String(options.limit) } : {}
4507
+ }
4508
+ );
4509
+ }
4510
+ /** Atomically replace the exact owner connection's selected repository set. */
4511
+ async replacePersonalGitHubRepositorySelections(workspaceId, connectionId, request) {
4512
+ return await this.requestJson(
4513
+ "PUT",
4514
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}/github/repositories`,
4515
+ request
4516
+ );
4517
+ }
4518
+ /** Revalidate every selected repository without accepting provider URLs from the caller. */
4519
+ async verifyPersonalGitHubRepositorySelections(workspaceId, connectionId, request) {
4520
+ return await this.requestJson(
4521
+ "POST",
4522
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}/github/repositories/verify`,
4523
+ request
4524
+ );
4525
+ }
3967
4526
  /** List the secret-free Slack team -> OpenGeni tenant routing authority. */
3968
4527
  async listSlackInstallationBindings(workspaceId) {
3969
4528
  const response = await this.requestJson(
@@ -4190,6 +4749,14 @@ var OpenGeniClient = class {
4190
4749
  async createBillingCheckout(request) {
4191
4750
  return await this.requestJson("POST", "/v1/billing/checkout", request);
4192
4751
  }
4752
+ /** Open Stripe's hosted portal for invoices and payment information. */
4753
+ async createBillingPortalSession(request = {}) {
4754
+ return await this.requestJson(
4755
+ "POST",
4756
+ "/v1/billing/portal",
4757
+ request
4758
+ );
4759
+ }
4193
4760
  // --- Internals -------------------------------------------------------------
4194
4761
  headers(correlationId) {
4195
4762
  const extra = typeof this.options.headers === "function" ? this.options.headers() : this.options.headers;
@@ -4384,38 +4951,60 @@ var OpenGeniClient = class {
4384
4951
  return await this.requestJson("DELETE", `/v1/workspaces/${workspaceId}/supergrok/accounts/${accountId}`, {});
4385
4952
  }
4386
4953
  /** Contract-checked JSON transport shared by opt-in typed SDK clients. */
4954
+ async requestSessionCommand(method, path, body) {
4955
+ return await this.requestJson(
4956
+ method,
4957
+ path,
4958
+ body,
4959
+ {},
4960
+ {
4961
+ timeoutMs: this.sessionCommandTimeoutMs
4962
+ }
4963
+ );
4964
+ }
4965
+ /** Contract-checked JSON transport shared by opt-in typed SDK clients. */
4387
4966
  async requestJson(method, path, body, query = {}, options = {}) {
4388
4967
  const correlationId = crypto.randomUUID();
4389
- let response;
4968
+ const abort = requestAbortSignal(options);
4390
4969
  try {
4391
- response = await this.fetchImpl(this.url(path, query), {
4392
- method,
4393
- headers: {
4394
- ...this.headers(correlationId),
4395
- Accept: "application/json",
4396
- ...body !== void 0 ? { "Content-Type": "application/json" } : {}
4397
- },
4398
- ...body !== void 0 ? { body: JSON.stringify(body) } : {},
4399
- ...options.signal ? { signal: options.signal } : {}
4400
- });
4401
- } catch (error) {
4402
- if (isMutationMethod(method)) {
4403
- throw mutationTransportError(correlationId);
4970
+ let response;
4971
+ try {
4972
+ response = await awaitWithAbort(
4973
+ this.fetchImpl(this.url(path, query), {
4974
+ method,
4975
+ headers: {
4976
+ ...this.headers(correlationId),
4977
+ Accept: "application/json",
4978
+ ...body !== void 0 ? { "Content-Type": "application/json" } : {}
4979
+ },
4980
+ ...body !== void 0 ? { body: JSON.stringify(body) } : {},
4981
+ ...abort.signal ? { signal: abort.signal } : {}
4982
+ }),
4983
+ abort.signal
4984
+ );
4985
+ } catch (error) {
4986
+ if (options.signal?.aborted) throw error;
4987
+ if (isMutationMethod(method)) {
4988
+ throw mutationTransportError(correlationId);
4989
+ }
4990
+ throw error;
4404
4991
  }
4405
- throw error;
4406
- }
4407
- assertApiContractResponse(response);
4408
- if (!response.ok) {
4409
- throw await apiErrorFromResponse(response, { method, correlationId });
4410
- }
4411
- await assertJsonResponse(response, { method, correlationId });
4412
- try {
4413
- return await response.json();
4414
- } catch (error) {
4415
- if (isMutationMethod(method)) {
4416
- throw mutationTransportError(correlationId);
4992
+ assertApiContractResponse(response);
4993
+ if (!response.ok) {
4994
+ throw await apiErrorFromResponse(response, { method, correlationId });
4417
4995
  }
4418
- throw error;
4996
+ await assertJsonResponse(response, { method, correlationId });
4997
+ try {
4998
+ return await response.json();
4999
+ } catch (error) {
5000
+ if (options.signal?.aborted) throw error;
5001
+ if (isMutationMethod(method)) {
5002
+ throw mutationTransportError(correlationId);
5003
+ }
5004
+ throw error;
5005
+ }
5006
+ } finally {
5007
+ abort.dispose();
4419
5008
  }
4420
5009
  }
4421
5010
  /** Authenticated, contract-checked response for bounded streaming downloads. */
@@ -4441,7 +5030,7 @@ var OpenGeniClient = class {
4441
5030
  }
4442
5031
  return response;
4443
5032
  }
4444
- /** Like `requestJson` for endpoints that respond with no body (204). */
5033
+ /** Contract-checked transport shared by opt-in typed SDK clients for 204 responses. */
4445
5034
  async requestVoid(method, path, body) {
4446
5035
  const correlationId = crypto.randomUUID();
4447
5036
  let response;
@@ -4533,6 +5122,54 @@ function filenameForAudioMimeType(mimeType) {
4533
5122
  }
4534
5123
  }
4535
5124
  var API_ERROR_MAX_BYTES = 16 * 1024;
5125
+ function requestAbortSignal(options) {
5126
+ const timeoutMs = options.timeoutMs ?? 0;
5127
+ if (timeoutMs <= 0) {
5128
+ return { signal: options.signal, dispose: () => void 0 };
5129
+ }
5130
+ const controller = new AbortController();
5131
+ const onCallerAbort = () => controller.abort(options.signal?.reason);
5132
+ if (options.signal?.aborted) {
5133
+ onCallerAbort();
5134
+ } else {
5135
+ options.signal?.addEventListener("abort", onCallerAbort, { once: true });
5136
+ }
5137
+ const timer = setTimeout(
5138
+ () => controller.abort(new DOMException("Request timed out", "TimeoutError")),
5139
+ timeoutMs
5140
+ );
5141
+ return {
5142
+ signal: controller.signal,
5143
+ dispose: () => {
5144
+ clearTimeout(timer);
5145
+ options.signal?.removeEventListener("abort", onCallerAbort);
5146
+ }
5147
+ };
5148
+ }
5149
+ async function awaitWithAbort(promise, signal) {
5150
+ if (!signal) return await promise;
5151
+ if (signal.aborted) {
5152
+ throw signal.reason ?? new DOMException("Request aborted", "AbortError");
5153
+ }
5154
+ return await new Promise((resolve, reject) => {
5155
+ const onAbort = () => {
5156
+ cleanup();
5157
+ reject(signal.reason ?? new DOMException("Request aborted", "AbortError"));
5158
+ };
5159
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
5160
+ signal.addEventListener("abort", onAbort, { once: true });
5161
+ promise.then(
5162
+ (value) => {
5163
+ cleanup();
5164
+ resolve(value);
5165
+ },
5166
+ (cause) => {
5167
+ cleanup();
5168
+ reject(cause);
5169
+ }
5170
+ );
5171
+ });
5172
+ }
4536
5173
  async function apiErrorFromResponse(response, context) {
4537
5174
  return new OpenGeniApiError(response.status, await readBoundedJsonErrorBody(response), {
4538
5175
  correlationId: response.headers.get(OPENGENI_CORRELATION_HEADER) ?? context.correlationId,
@@ -4596,9 +5233,9 @@ async function sha256Hex(bytes) {
4596
5233
  async function cancelResponseBody(response, reason) {
4597
5234
  await response.body?.cancel(reason).catch(() => void 0);
4598
5235
  }
4599
- function assertRetainedGeneratedImageReceipt(workspaceId, artifact) {
4600
- if (!parseRetainedGeneratedImageReference(artifact, workspaceId)) {
4601
- throw new OpenGeniApiError(502, "retained generated image receipt is invalid");
5236
+ function assertRetainedWorkspaceArtifactReceipt(workspaceId, artifact) {
5237
+ if (!parseRetainedGeneratedImageReference(artifact, workspaceId) && !parseRetainedWorkspaceFileReference(artifact, workspaceId)) {
5238
+ throw new OpenGeniApiError(502, "retained workspace artifact receipt is invalid");
4602
5239
  }
4603
5240
  }
4604
5241
  function assertSafeArtifactDownloadUrl(value) {
@@ -4675,6 +5312,8 @@ export {
4675
5312
  streamWorkspaceInteractionRevisions,
4676
5313
  streamWorkspaceLiveEvents,
4677
5314
  parseWorkspaceLiveEvent,
5315
+ parseRetainedWorkspaceFileReference,
5316
+ parseSandboxFileArtifactReceipt,
4678
5317
  parseRetainedGeneratedImageReference,
4679
5318
  generatedImageSandboxPathMatches,
4680
5319
  parseGeneratedImageReceipt,
@@ -4683,4 +5322,4 @@ export {
4683
5322
  parseMediaGenerationResult,
4684
5323
  OpenGeniClient
4685
5324
  };
4686
- //# sourceMappingURL=chunk-PKQ377ED.js.map
5325
+ //# sourceMappingURL=chunk-YBQTKNTL.js.map