@opengeni/sdk 0.48.0 → 0.52.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 (99) hide show
  1. package/README.md +93 -1
  2. package/dist/artifact-client.d.ts +20 -2
  3. package/dist/artifacts.d.ts +4 -0
  4. package/dist/artifacts.js +11 -0
  5. package/dist/artifacts.js.map +1 -0
  6. package/dist/chunk-FHI4DFIG.js +128 -0
  7. package/dist/chunk-FHI4DFIG.js.map +1 -0
  8. package/dist/chunk-FRJFNDIR.js +218 -0
  9. package/dist/chunk-FRJFNDIR.js.map +1 -0
  10. package/dist/{chunk-MBGBLVUV.js → chunk-ILQZR5N6.js} +1088 -577
  11. package/dist/chunk-ILQZR5N6.js.map +1 -0
  12. package/dist/chunk-MZWTWOX6.js +661 -0
  13. package/dist/chunk-MZWTWOX6.js.map +1 -0
  14. package/dist/chunk-VWE2QIVO.js +1162 -0
  15. package/dist/chunk-VWE2QIVO.js.map +1 -0
  16. package/dist/chunk-VYCTL62C.js +230 -0
  17. package/dist/chunk-VYCTL62C.js.map +1 -0
  18. package/dist/client.d.ts +150 -16
  19. package/dist/codex-realtime-controller.d.ts +6 -6
  20. package/dist/codex-realtime-lifecycle.d.ts +1 -1
  21. package/dist/codex-realtime-v3.d.ts +3 -3
  22. package/dist/codex-realtime.d.ts +1 -1
  23. package/dist/company-profile.d.ts +100 -0
  24. package/dist/core.d.ts +5 -5
  25. package/dist/core.js +9 -4
  26. package/dist/desktop.d.ts +1 -1
  27. package/dist/editable-artifact-resources.d.ts +96 -0
  28. package/dist/editable-artifacts/browser-session.d.ts +35 -0
  29. package/dist/editable-artifacts/controller.d.ts +60 -0
  30. package/dist/editable-artifacts/errors.d.ts +23 -0
  31. package/dist/editable-artifacts/http-live-transport.d.ts +46 -0
  32. package/dist/editable-artifacts/index.d.ts +19 -0
  33. package/dist/editable-artifacts/pool.d.ts +15 -0
  34. package/dist/editable-artifacts/session.d.ts +96 -0
  35. package/dist/editable-artifacts/storage.d.ts +72 -0
  36. package/dist/editable-artifacts/types.d.ts +416 -0
  37. package/dist/editable-artifacts/worker/browser-client.d.ts +80 -0
  38. package/dist/editable-artifacts/worker/browser-entry.d.ts +6 -0
  39. package/dist/editable-artifacts/worker/kernel-adapter.d.ts +45 -0
  40. package/dist/editable-artifacts/worker/rpc-protocol.d.ts +92 -0
  41. package/dist/editable-artifacts/worker/runtime.d.ts +66 -0
  42. package/dist/editable-artifacts/worker/wire-codec.d.ts +52 -0
  43. package/dist/editable-artifacts-worker.d.ts +8 -0
  44. package/dist/editable-artifacts-worker.js +1708 -0
  45. package/dist/editable-artifacts-worker.js.map +1 -0
  46. package/dist/editable-artifacts.d.ts +6 -0
  47. package/dist/editable-artifacts.js +5954 -0
  48. package/dist/editable-artifacts.js.map +1 -0
  49. package/dist/gateway-realtime-transport.d.ts +1 -1
  50. package/dist/index.d.ts +41 -35
  51. package/dist/index.js +104 -68
  52. package/dist/index.js.map +1 -1
  53. package/dist/interaction.d.ts +885 -0
  54. package/dist/interaction.js +55 -0
  55. package/dist/interaction.js.map +1 -0
  56. package/dist/memory-slack-client.d.ts +13 -0
  57. package/dist/memory-slack-delivery.d.ts +99 -0
  58. package/dist/memory-slack.d.ts +4 -0
  59. package/dist/memory-slack.js +44 -0
  60. package/dist/memory-slack.js.map +1 -0
  61. package/dist/proxy.d.ts +3 -3
  62. package/dist/realtime.d.ts +12 -12
  63. package/dist/retained-artifacts.d.ts +12 -0
  64. package/dist/stream.d.ts +1 -1
  65. package/dist/terminal.d.ts +1 -1
  66. package/dist/types.d.ts +1128 -18
  67. package/dist/workspace-control-stream.d.ts +2 -2
  68. package/dist/workspace-state.d.ts +1 -1
  69. package/package.json +29 -3
  70. package/src/artifact-client.ts +129 -0
  71. package/src/artifacts.ts +17 -0
  72. package/src/client.ts +1511 -200
  73. package/src/company-profile.ts +92 -0
  74. package/src/editable-artifact-resources.ts +119 -0
  75. package/src/editable-artifacts/browser-session.ts +176 -0
  76. package/src/editable-artifacts/controller.ts +2632 -0
  77. package/src/editable-artifacts/errors.ts +52 -0
  78. package/src/editable-artifacts/http-live-transport.ts +1449 -0
  79. package/src/editable-artifacts/index.ts +175 -0
  80. package/src/editable-artifacts/pool.ts +81 -0
  81. package/src/editable-artifacts/session.ts +778 -0
  82. package/src/editable-artifacts/storage.ts +1718 -0
  83. package/src/editable-artifacts/types.ts +499 -0
  84. package/src/editable-artifacts/worker/browser-client.ts +1167 -0
  85. package/src/editable-artifacts/worker/browser-entry.ts +57 -0
  86. package/src/editable-artifacts/worker/kernel-adapter.ts +1039 -0
  87. package/src/editable-artifacts/worker/rpc-protocol.ts +622 -0
  88. package/src/editable-artifacts/worker/runtime.ts +1204 -0
  89. package/src/editable-artifacts/worker/wire-codec.ts +852 -0
  90. package/src/editable-artifacts-worker.ts +8 -0
  91. package/src/editable-artifacts.ts +6 -0
  92. package/src/index.ts +185 -0
  93. package/src/interaction.ts +1830 -0
  94. package/src/memory-slack-client.ts +71 -0
  95. package/src/memory-slack-delivery.ts +128 -0
  96. package/src/memory-slack.ts +19 -0
  97. package/src/retained-artifacts.ts +326 -0
  98. package/src/types.ts +1343 -28
  99. package/dist/chunk-MBGBLVUV.js.map +0 -1
@@ -6,6 +6,17 @@ import {
6
6
  isAbortError,
7
7
  isRetryableStreamError
8
8
  } from "./chunk-V5F253OG.js";
9
+ import {
10
+ OpenGeniInteractionClient
11
+ } from "./chunk-MZWTWOX6.js";
12
+ import {
13
+ COMPUTER_SCREENSHOT_MAX_BYTES,
14
+ GENERATED_VIDEO_MAX_BYTES,
15
+ OPENGENI_API_CONTRACT_HEADER,
16
+ OPENGENI_API_CONTRACT_REVISION,
17
+ OPENGENI_CORRELATION_HEADER,
18
+ RETAINED_OUTPUT_MAX_PAGE_BYTES
19
+ } from "./chunk-FRJFNDIR.js";
9
20
 
10
21
  // src/sse.ts
11
22
  async function* parseSseStream(stream) {
@@ -342,203 +353,177 @@ async function sleep2(delayMs, signal) {
342
353
  });
343
354
  }
344
355
 
345
- // src/types.ts
346
- var DEFAULT_FILE_RESOURCE_MOUNT_ROOT = ".opengeni/files";
347
- var SESSION_EVENT_TYPES = [
348
- "session.created",
349
- // Defensive bounded projection for malformed/legacy oversized envelopes.
350
- "session.event.envelope_omitted",
351
- "session.status.changed",
352
- "session.realtime.started",
353
- "session.realtime.ended",
354
- "session.requiresAction",
355
- "session.humanInput.requested",
356
- "session.context.compaction.requested",
357
- "session.context.compaction.started",
358
- "session.context.compacted",
359
- "session.context.compaction.skipped",
360
- "session.context.cleared",
361
- "user.message",
362
- "user.pause",
363
- "user.approvalDecision",
364
- "user.humanInputResponse",
365
- "turn.queued",
366
- "turn.started",
367
- "turn.completed",
368
- "turn.failed",
369
- "turn.cancelled",
370
- "turn.superseded",
371
- "turn.recovery.requested",
372
- "turn.capacity_waiting",
373
- "agent.message.delta",
374
- "agent.message.completed",
375
- "agent.reasoning.delta",
376
- "agent.toolCall.created",
377
- "agent.toolCall.output",
378
- "agent.model.request",
379
- "agent.model.usage",
380
- "tool.auth_needed",
381
- "credential.auth_needed",
382
- "agent.updated",
383
- "rig.setup.started",
384
- "rig.setup.completed",
385
- "rig.setup.skipped",
386
- "rig.setup.failed",
387
- "sandbox.operation.started",
388
- "sandbox.operation.completed",
389
- "sandbox.operation.failed",
390
- "sandbox.command.output.delta",
391
- "artifact.created",
392
- "goal.set",
393
- "goal.updated",
394
- "goal.completed",
395
- "goal.paused",
396
- "goal.resumed",
397
- "goal.cleared",
398
- "goal.continuation",
399
- "system.update.pending",
400
- "system.update.delivered",
401
- "system.update.superseded",
402
- "system.update.cancelled",
403
- "system.update.settled",
404
- "session.control.paused",
405
- "session.control.resumed",
406
- "session.control.steer_requested",
407
- "workspace.inference.paused",
408
- "workspace.inference.resumed",
409
- "session.queue.changed",
410
- "session.queue.prompt.cancelled",
411
- "session.queue.history",
412
- "turn.event.rejected_late",
413
- "memory.saved",
414
- "memory.corrected",
415
- // Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;
416
- // the contract-parity test asserts sorted equality).
417
- "stream.url.rotated",
418
- "stream.opened",
419
- "stream.closed",
420
- "stream.revoked",
421
- // Channel-B recording signals (P4.3 — "agent films itself proving the fix").
422
- "recording.started",
423
- "recording.available",
424
- "recording.failed",
425
- // Channel-A structured-service notifications (P4.4; mirror of contracts
426
- // SessionEventType the contract-parity test asserts sorted equality).
427
- "fs.changed",
428
- "git.changed",
429
- "terminal.pty.started",
430
- "terminal.pty.output.delta",
431
- "terminal.pty.exited",
432
- "session.title_set",
433
- "session.mcp.approval_policy.updated",
434
- "session.tool_policy.updated",
435
- // Multi-account Codex (P1): the session's inference account changed.
436
- "codex.account.switched",
437
- // credential allocator metadata-only per-turn credential selection audit.
438
- "codex.credential.selected",
439
- // Bounded, identity-free deterministic shadow/replay decision.
440
- "codex.fleet.decision",
441
- // credential allocator durable zero-capacity wait lifecycle. These are system/runtime
442
- // events, never synthetic user messages.
443
- "codex.capacity.waiting",
444
- "codex.capacity.resumed",
445
- "codex.capacity.superseded",
446
- // Sandbox durability observability (mirror of contracts SessionEventType):
447
- // box lifecycle + manifest-env drift, attributable from the DB alone.
448
- "sandbox.box.created",
449
- "sandbox.box.lost",
450
- "sandbox.box.terminated",
451
- "sandbox.box.snapshot",
452
- "sandbox.env.drift",
453
- // Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts
454
- // SessionEventType — the contract-parity test asserts sorted equality).
455
- "session.route.reconciled",
456
- // Workbench v2 turn-end workspace capture (announce-only; mirror of contracts
457
- // SessionEventType — the contract-parity test asserts sorted equality).
458
- "workspace.revision.captured",
459
- "workspace.revision.degraded",
460
- // Connected Machine op-outcome observability (announce-only, quiet; mirror of
461
- // contracts SessionEventType — the contract-parity test asserts sorted equality).
462
- "machine.op.failed",
463
- "machine.op.recovered",
464
- // Connected Machine link-plane observability (announce-only, quiet; mirror of
465
- // contracts SessionEventType — the contract-parity test asserts sorted equality).
466
- "machine.link.lost",
467
- "machine.link.restored",
468
- "machine.runner.restarted"
469
- ];
470
- var KNOWN_PERMISSIONS = [
471
- "account:read",
472
- "account:admin",
473
- "members:manage",
474
- "workspace:create",
475
- "billing:read",
476
- "billing:manage",
477
- "workspace:read",
478
- "workspace:admin",
479
- "sessions:create",
480
- "sessions:read",
481
- "sessions:control",
482
- // sandbox workspace (mirror of @opengeni/contracts Permission). stream:view is
483
- // strictly broader than sessions:read (un-redacted pixels); stream:control is
484
- // the never-granted-v1 raw-input plane; stream:acknowledge is the secret-leak
485
- // consent gate.
486
- "stream:view",
487
- "stream:control",
488
- "stream:acknowledge",
489
- "files:upload",
490
- "files:read",
491
- "files:write",
492
- "terminal:attach",
493
- "documents:manage",
494
- "documents:search",
495
- "scheduled_tasks:manage",
496
- "scheduled_tasks:run",
497
- "github:manage",
498
- "github:use",
499
- "api_keys:manage",
500
- "connections:read",
501
- "connections:write",
502
- "environments:manage",
503
- "environments:use",
504
- "variable-sets:list",
505
- "variable-sets:read",
506
- "variable-sets:write",
507
- "variable-sets:manage",
508
- "variable-sets:use",
509
- "secrets:list",
510
- "secrets:read",
511
- "secrets:write",
512
- "mcp_servers:attach",
513
- "toolspace:call",
514
- "goals:manage",
515
- "enrollments:read",
516
- "enrollments:manage",
517
- "rigs:use",
518
- "rigs:manage",
519
- "artifacts:read",
520
- "artifacts:publish"
521
- ];
522
- var OPENGENI_API_CONTRACT_REVISION = "2026-07-workspace-artifacts-v1";
523
- var OPENGENI_API_CONTRACT_HEADER = "x-opengeni-api-contract";
524
- var OPENGENI_CORRELATION_HEADER = "x-opengeni-correlation-id";
525
- var RETAINED_OUTPUT_DEFAULT_PAGE_BYTES = 256 * 1024;
526
- var RETAINED_OUTPUT_MAX_PAGE_BYTES = 1024 * 1024;
527
- var COMPUTER_SCREENSHOT_MAX_BYTES = 32 * 1024 * 1024;
528
- var KNOWN_USAGE_EVENT_TYPES = [
529
- "agent_run.created",
530
- "agent_run.completed",
531
- "model.tokens",
532
- "model.cost",
533
- "file.uploaded",
534
- "file.deleted",
535
- "document.indexed",
536
- "scheduled_task.fired",
537
- "api_key.request",
538
- // sandbox warm-time metering (P2.1) — mirrors contracts UsageEventType.
539
- "sandbox.warm_seconds",
540
- "sandbox.warm_cost"
541
- ];
356
+ // src/retained-artifacts.ts
357
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
358
+ var SHA256 = /^[0-9a-f]{64}$/;
359
+ var ISO_DATETIME_WITH_OFFSET = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
360
+ var WORKSPACE_PATH = /^\/v1\/workspaces\/([0-9a-f-]+)\/artifacts\/([0-9a-f-]+)\/content$/;
361
+ var MAX_BYTES = 64 * 1024 * 1024;
362
+ var MAX_VIDEO_BYTES = 512 * 1024 * 1024;
363
+ var MAX_DIMENSION = 16384;
364
+ var MAX_PIXELS = 67108864;
365
+ var MAX_RANGE_BYTES = 1024 * 1024;
366
+ function parseRetainedGeneratedImageReference(value, expectedWorkspaceId) {
367
+ if (!recordWithKeys(value, GENERATED_IMAGE_REFERENCE_KEYS)) return null;
368
+ const artifact = value;
369
+ if (artifact.available !== true || artifact.kind !== "generated_image" || typeof artifact.artifactId !== "string" || !UUID.test(artifact.artifactId) || !["image/png", "image/jpeg", "image/webp"].includes(String(artifact.contentType)) || !safeIntegerBetween(artifact.originalBytes, 1, MAX_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.dimensions, DIMENSION_KEYS) || !recordWithKeys(artifact.retention, RETENTION_KEYS) || !recordWithKeys(artifact.retrieval, RETRIEVAL_KEYS)) {
370
+ return null;
371
+ }
372
+ const dimensions = artifact.dimensions;
373
+ if (!safeIntegerBetween(dimensions.width, 1, MAX_DIMENSION) || !safeIntegerBetween(dimensions.height, 1, MAX_DIMENSION) || Number(dimensions.width) * Number(dimensions.height) > MAX_PIXELS) {
374
+ return null;
375
+ }
376
+ const retention = artifact.retention;
377
+ if (retention.policy !== "workspace_file" || retention.expiresAt !== null) return null;
378
+ const retrieval = artifact.retrieval;
379
+ if (retrieval.method !== "GET" || retrieval.acceptRanges !== "bytes" || retrieval.maxRangeBytes !== MAX_RANGE_BYTES || typeof retrieval.path !== "string" || retrieval.path.length > 256) {
380
+ return null;
381
+ }
382
+ const match = WORKSPACE_PATH.exec(retrieval.path);
383
+ if (!match || !UUID.test(match[1] ?? "") || match[2] !== artifact.artifactId || expectedWorkspaceId !== void 0 && match[1] !== expectedWorkspaceId) {
384
+ return null;
385
+ }
386
+ return value;
387
+ }
388
+ function generatedImageSandboxPathMatches(artifact, sandboxPath) {
389
+ if (typeof sandboxPath !== "string") return false;
390
+ const extension = artifact.contentType === "image/png" ? "png" : artifact.contentType === "image/jpeg" ? "jpg" : artifact.contentType === "image/webp" ? "webp" : null;
391
+ return extension !== null && sandboxPath === `/workspace/generated-images/generated-image-${artifact.artifactId}.${extension}`;
392
+ }
393
+ function parseGeneratedImageReceipt(value, expectedWorkspaceId) {
394
+ if (typeof value === "string" && value.length <= 4096) {
395
+ try {
396
+ return parseGeneratedImageReceipt(JSON.parse(value), expectedWorkspaceId);
397
+ } catch {
398
+ return null;
399
+ }
400
+ }
401
+ if (!recordWithKeys(value, GENERATED_IMAGE_RECEIPT_KEYS)) return null;
402
+ if (value.type !== "generated_image") return null;
403
+ const artifact = parseRetainedGeneratedImageReference(value.artifact, expectedWorkspaceId);
404
+ if (!artifact || !generatedImageSandboxPathMatches(artifact, value.sandboxPath)) return null;
405
+ return { type: "generated_image", artifact, sandboxPath: value.sandboxPath };
406
+ }
407
+ function parseRetainedGeneratedVideoReference(value, expectedWorkspaceId) {
408
+ if (!recordWithKeys(value, GENERATED_IMAGE_REFERENCE_KEYS)) return null;
409
+ const artifact = value;
410
+ if (artifact.available !== true || artifact.kind !== "generated_video" || typeof artifact.artifactId !== "string" || !UUID.test(artifact.artifactId) || artifact.contentType !== "video/mp4" || !safeIntegerBetween(artifact.originalBytes, 1, MAX_VIDEO_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.dimensions, DIMENSION_KEYS) || !recordWithKeys(artifact.retention, RETENTION_KEYS) || !recordWithKeys(artifact.retrieval, RETRIEVAL_KEYS)) {
411
+ return null;
412
+ }
413
+ const dimensions = artifact.dimensions;
414
+ if (!safeIntegerBetween(dimensions.width, 1, 8192) || !safeIntegerBetween(dimensions.height, 1, 8192)) {
415
+ return null;
416
+ }
417
+ const retention = artifact.retention;
418
+ if (retention.policy !== "workspace_file" || retention.expiresAt !== null) return null;
419
+ const retrieval = artifact.retrieval;
420
+ if (retrieval.method !== "GET" || retrieval.acceptRanges !== "bytes" || retrieval.maxRangeBytes !== MAX_RANGE_BYTES || typeof retrieval.path !== "string" || retrieval.path.length > 256) {
421
+ return null;
422
+ }
423
+ const match = WORKSPACE_PATH.exec(retrieval.path);
424
+ if (!match || !UUID.test(match[1] ?? "") || match[2] !== artifact.artifactId || expectedWorkspaceId !== void 0 && match[1] !== expectedWorkspaceId) {
425
+ return null;
426
+ }
427
+ return value;
428
+ }
429
+ function parseGeneratedVideoReceipt(value, expectedWorkspaceId) {
430
+ if (typeof value === "string" && value.length <= 8192) {
431
+ try {
432
+ return parseGeneratedVideoReceipt(JSON.parse(value), expectedWorkspaceId);
433
+ } catch {
434
+ return null;
435
+ }
436
+ }
437
+ if (!recordWithKeys(value, GENERATED_VIDEO_RECEIPT_KEYS)) return null;
438
+ if (value.type !== "generated_video" || value.schemaVersion !== 1 || typeof value.operationId !== "string" || !UUID.test(value.operationId) || !recordWithKeys(value.video, GENERATED_VIDEO_FACT_KEYS)) {
439
+ return null;
440
+ }
441
+ const artifact = parseRetainedGeneratedVideoReference(value.artifact, expectedWorkspaceId);
442
+ const video = value.video;
443
+ if (!artifact || typeof value.sandboxPath !== "string" || value.sandboxPath !== `/workspace/generated-videos/generated-video-${artifact.artifactId}.mp4` || typeof video.durationSeconds !== "number" || !Number.isFinite(video.durationSeconds) || video.durationSeconds <= 0 || video.durationSeconds > 120 || video.width !== artifact.dimensions?.width || video.height !== artifact.dimensions?.height || typeof video.fps !== "number" || !Number.isFinite(video.fps) || video.fps <= 0 || video.fps > 120 || typeof video.hasAudio !== "boolean" || video.videoCodec !== "h264" || video.audioCodec !== null && video.audioCodec !== "aac") {
444
+ return null;
445
+ }
446
+ return value;
447
+ }
448
+ function parseMediaGenerationResult(value, expectedWorkspaceId) {
449
+ if (typeof value === "string" && value.length <= 12e3) {
450
+ try {
451
+ return parseMediaGenerationResult(JSON.parse(value), expectedWorkspaceId);
452
+ } catch {
453
+ return null;
454
+ }
455
+ }
456
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
457
+ const result = value;
458
+ if (result.type !== "media_generation_result" || result.schemaVersion !== 1 || typeof result.operationId !== "string" || !UUID.test(result.operationId)) {
459
+ return null;
460
+ }
461
+ if (result.status === "ready") {
462
+ if (!recordWithKeys(result, MEDIA_RESULT_READY_KEYS)) return null;
463
+ const receipt = parseGeneratedVideoReceipt(result.receipt, expectedWorkspaceId);
464
+ if (!receipt || receipt.operationId !== result.operationId) return null;
465
+ return value;
466
+ }
467
+ if (!["provider_failed", "retention_failed", "cancelled_before_submit", "outcome_unknown"].includes(
468
+ String(result.status)
469
+ ) || !recordWithKeys(result, MEDIA_RESULT_FAILURE_KEYS) || typeof result.boundedPublicReason !== "string" || result.boundedPublicReason.length < 1 || result.boundedPublicReason.length > 1e3) {
470
+ return null;
471
+ }
472
+ return value;
473
+ }
474
+ var GENERATED_IMAGE_REFERENCE_KEYS = /* @__PURE__ */ new Set([
475
+ "available",
476
+ "artifactId",
477
+ "kind",
478
+ "contentType",
479
+ "originalBytes",
480
+ "sha256",
481
+ "retainedAt",
482
+ "dimensions",
483
+ "retention",
484
+ "retrieval"
485
+ ]);
486
+ var DIMENSION_KEYS = /* @__PURE__ */ new Set(["width", "height"]);
487
+ var RETENTION_KEYS = /* @__PURE__ */ new Set(["policy", "expiresAt"]);
488
+ var RETRIEVAL_KEYS = /* @__PURE__ */ new Set(["method", "path", "acceptRanges", "maxRangeBytes"]);
489
+ var GENERATED_IMAGE_RECEIPT_KEYS = /* @__PURE__ */ new Set(["type", "artifact", "sandboxPath"]);
490
+ var GENERATED_VIDEO_RECEIPT_KEYS = /* @__PURE__ */ new Set([
491
+ "type",
492
+ "schemaVersion",
493
+ "operationId",
494
+ "artifact",
495
+ "video",
496
+ "sandboxPath"
497
+ ]);
498
+ var GENERATED_VIDEO_FACT_KEYS = /* @__PURE__ */ new Set([
499
+ "durationSeconds",
500
+ "width",
501
+ "height",
502
+ "fps",
503
+ "hasAudio",
504
+ "videoCodec",
505
+ "audioCodec"
506
+ ]);
507
+ var MEDIA_RESULT_READY_KEYS = /* @__PURE__ */ new Set([
508
+ "type",
509
+ "schemaVersion",
510
+ "status",
511
+ "operationId",
512
+ "receipt"
513
+ ]);
514
+ var MEDIA_RESULT_FAILURE_KEYS = /* @__PURE__ */ new Set([
515
+ "type",
516
+ "schemaVersion",
517
+ "status",
518
+ "operationId",
519
+ "boundedPublicReason"
520
+ ]);
521
+ function recordWithKeys(value, allowed) {
522
+ return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === allowed.size && Object.keys(value).every((key) => allowed.has(key));
523
+ }
524
+ function safeIntegerBetween(value, min, max) {
525
+ return Number.isSafeInteger(value) && Number(value) >= min && Number(value) <= max;
526
+ }
542
527
 
543
528
  // src/client.ts
544
529
  function sessionListQuery(options) {
@@ -554,10 +539,13 @@ var OpenGeniClient = class {
554
539
  fetchImpl;
555
540
  readInFlight = /* @__PURE__ */ new Map();
556
541
  readTrailing = /* @__PURE__ */ new Map();
542
+ /** Resource-oriented Browser/Computer facade over this exact authenticated client. */
543
+ interaction;
557
544
  constructor(options) {
558
545
  this.baseUrl = options.baseUrl.replace(/\/+$/, "");
559
546
  this.options = options;
560
547
  this.fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
548
+ this.interaction = new OpenGeniInteractionClient(this);
561
549
  }
562
550
  // --- Session lifecycle ---------------------------------------------------
563
551
  /** Make one finalization attempt for a recording; callers may retry retained audio. */
@@ -839,6 +827,21 @@ var OpenGeniClient = class {
839
827
  }
840
828
  return response;
841
829
  }
830
+ /** Compact, bounded workspace agent hierarchy page. */
831
+ async listAgentTopology(workspaceId, options = {}) {
832
+ const search = options.search?.trim();
833
+ return await this.requestJson(
834
+ "GET",
835
+ `/v1/workspaces/${workspaceId}/agent-topology`,
836
+ void 0,
837
+ {
838
+ ...options.limit !== void 0 ? { limit: String(options.limit) } : {},
839
+ ...options.parentSessionId === void 0 ? {} : { parentSessionId: options.parentSessionId ?? "null" },
840
+ ...options.cursor ? { cursor: options.cursor } : {},
841
+ ...search ? { search } : {}
842
+ }
843
+ );
844
+ }
842
845
  /** Set this authenticated member's personal workspace pin for a session. */
843
846
  async updateSessionPin(workspaceId, sessionId, request) {
844
847
  return await this.requestJson(
@@ -1714,13 +1717,11 @@ var OpenGeniClient = class {
1714
1717
  );
1715
1718
  }
1716
1719
  /** Attach a viewer holder (refcounted liveness — keeps the box warm while
1717
- * watched/used), spinning the box up in-process when cold, and mint the scoped
1718
- * direct-to-provider URLs for the requested plane(s). `request.desktop:true`
1719
- * opts into the un-redacted pixel plane and mints the noVNC URL — that plane
1720
- * alone throws `OpenGeniApiError(409)` when the un-redacted/shared
1721
- * acknowledgment is missing (the consent gate). A terminal-only attach
1722
- * (`desktop` omitted/false) warms the box + mints the pty-ws terminal cell with
1723
- * NO consent gate. An omitted `viewerId` mints a fresh one. */
1720
+ * watched/used), spinning the box up in-process when cold. Exact plane flags
1721
+ * mint only the requested short-lived credentials and enforce that plane's
1722
+ * permission. `desktop:true` alone carries the un-redacted/shared consent
1723
+ * gate. An entirely omitted plane set retains the legacy terminal-only
1724
+ * meaning; current clients should send all three flags. */
1724
1725
  async attachViewer(workspaceId, sessionId, request = {}) {
1725
1726
  return await this.requestJson(
1726
1727
  "POST",
@@ -1745,196 +1746,548 @@ var OpenGeniClient = class {
1745
1746
  `/v1/workspaces/${workspaceId}/sessions/${sessionId}/viewers/${viewerId}`
1746
1747
  );
1747
1748
  }
1748
- // --- Access + workspaces -----------------------------------------------------
1749
- /**
1750
- * The deployment's public client bootstrap config: the host-exposed models
1751
- * (provider-grouped in `models`, flat in `allowedModels` for back-compat),
1752
- * reasoning efforts, MCP servers, file-upload limits, and how the client is
1753
- * expected to authenticate. Drives a composer's model picker without prior
1754
- * knowledge of the host setup; safe to call before any auth is established.
1755
- */
1756
- async getClientConfig() {
1757
- const config = await this.requestJson("GET", "/v1/config/client");
1758
- if (config.apiContractRevision !== OPENGENI_API_CONTRACT_REVISION) {
1759
- throw new OpenGeniApiContractMismatchError(
1760
- OPENGENI_API_CONTRACT_REVISION,
1761
- String(config.apiContractRevision || "(missing)")
1762
- );
1763
- }
1764
- return config;
1765
- }
1766
- /** Authenticated model definitions plus workspace-specific selectability. */
1767
- async getWorkspaceModelCatalog(workspaceId) {
1749
+ // --- Browser / Computer interaction resources --------------------------------
1750
+ async listAttachedBrowsers(workspaceId, options = {}) {
1768
1751
  return await this.requestJson(
1769
1752
  "GET",
1770
- `/v1/workspaces/${workspaceId}/model-catalog`
1753
+ `/v1/workspaces/${workspaceId}/attached-browsers`,
1754
+ void 0,
1755
+ options.includeDisconnected ? { includeDisconnected: "true" } : {},
1756
+ options
1771
1757
  );
1772
1758
  }
1773
- /** Authenticated realtime voice models and credential readiness. */
1774
- async getWorkspaceRealtimeModelCatalog(workspaceId) {
1759
+ async getAttachedBrowser(workspaceId, deviceId, options = {}) {
1775
1760
  return await this.requestJson(
1776
1761
  "GET",
1777
- `/v1/workspaces/${workspaceId}/realtime-model-catalog`
1762
+ `/v1/workspaces/${workspaceId}/attached-browsers/${encodeURIComponent(deviceId)}`,
1763
+ void 0,
1764
+ {},
1765
+ options
1778
1766
  );
1779
1767
  }
1780
- /** The caller's access context: subject, account + workspace grants, defaults. */
1781
- async getAccessContext() {
1782
- return await this.requestJson("GET", "/v1/access/me");
1783
- }
1784
- async listWorkspaces() {
1785
- return await this.requestJson("GET", "/v1/workspaces");
1786
- }
1787
- async createWorkspace(request) {
1788
- return await this.requestJson("POST", "/v1/workspaces", request);
1789
- }
1790
- async getWorkspace(workspaceId) {
1791
- return await this.requestJson("GET", `/v1/workspaces/${workspaceId}`);
1792
- }
1793
- /** Read-time, secret-safe inventory of policy heads and visible workspace knowledge. */
1794
- async getWorkspaceState(workspaceId, options = {}) {
1795
- const params = new URLSearchParams();
1796
- if (options.attemptId) params.set("attemptId", options.attemptId);
1797
- const query = params.size > 0 ? `?${params.toString()}` : "";
1768
+ async listBrowserIdentities(workspaceId, options = {}) {
1798
1769
  return await this.requestJson(
1799
1770
  "GET",
1800
- `/v1/workspaces/${workspaceId}/workspace-state${query}`
1771
+ `/v1/workspaces/${workspaceId}/browser-identities`,
1772
+ void 0,
1773
+ options.includeArchived ? { includeArchived: "true" } : {},
1774
+ options
1801
1775
  );
1802
1776
  }
1803
- /** Download the canonical, explicitly sanitized Workspace State export. */
1804
- async exportWorkspaceState(workspaceId, options = {}) {
1805
- const params = new URLSearchParams();
1806
- if (options.attemptId) params.set("attemptId", options.attemptId);
1807
- const query = params.size > 0 ? `?${params.toString()}` : "";
1777
+ async getBrowserIdentity(workspaceId, identityId, options = {}) {
1808
1778
  return await this.requestJson(
1809
1779
  "GET",
1810
- `/v1/workspaces/${workspaceId}/workspace-state/export${query}`
1780
+ `/v1/workspaces/${workspaceId}/browser-identities/${encodeURIComponent(identityId)}`,
1781
+ void 0,
1782
+ {},
1783
+ options
1811
1784
  );
1812
1785
  }
1813
- async updateWorkspace(workspaceId, request) {
1814
- return await this.requestJson("PATCH", `/v1/workspaces/${workspaceId}`, request);
1786
+ async createBrowserIdentity(workspaceId, request, options = {}) {
1787
+ return await this.requestJson(
1788
+ "POST",
1789
+ `/v1/workspaces/${workspaceId}/browser-identities`,
1790
+ request,
1791
+ {},
1792
+ options
1793
+ );
1815
1794
  }
1816
- /** Inspect immutable instruction-policy history, active heads, and activation audit evidence. */
1817
- async listWorkspaceInstructionPolicies(workspaceId, options = {}) {
1818
- const params = new URLSearchParams();
1819
- if (options.kind !== void 0) params.set("kind", options.kind);
1820
- if (options.scope !== void 0) params.set("scope", options.scope);
1821
- if (options.roleKey !== void 0) params.set("roleKey", options.roleKey);
1822
- if (options.afterRevision !== void 0) {
1823
- params.set("afterRevision", String(options.afterRevision));
1824
- }
1825
- if (options.limit !== void 0) params.set("limit", String(options.limit));
1826
- const query = params.toString();
1795
+ async listBrowserRevisions(workspaceId, identityId, options = {}) {
1827
1796
  return await this.requestJson(
1828
1797
  "GET",
1829
- `/v1/workspaces/${workspaceId}/instruction-policies${query ? `?${query}` : ""}`
1798
+ `/v1/workspaces/${workspaceId}/browser-identities/${encodeURIComponent(identityId)}/revisions`,
1799
+ void 0,
1800
+ {},
1801
+ options
1830
1802
  );
1831
1803
  }
1832
- async getWorkspaceInstructionPolicyRevision(workspaceId, revisionId) {
1804
+ /** Workspace-wide BrowserSession inventory. Associations express relevance,
1805
+ * not access: peers and child agents intentionally remain discoverable. */
1806
+ async listBrowserSessions(workspaceId, options = {}) {
1833
1807
  return await this.requestJson(
1834
1808
  "GET",
1835
- `/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}`
1809
+ `/v1/workspaces/${workspaceId}/browser-sessions`,
1810
+ void 0,
1811
+ {},
1812
+ options
1836
1813
  );
1837
1814
  }
1838
- async createWorkspaceInstructionPolicyDraft(workspaceId, request) {
1815
+ async getBrowserSession(workspaceId, browserSessionId, options = {}) {
1816
+ return await this.requestJson(
1817
+ "GET",
1818
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}`,
1819
+ void 0,
1820
+ {},
1821
+ options
1822
+ );
1823
+ }
1824
+ async createBrowserSession(workspaceId, request, options = {}) {
1839
1825
  return await this.requestJson(
1840
1826
  "POST",
1841
- `/v1/workspaces/${workspaceId}/instruction-policies/drafts`,
1842
- request
1827
+ `/v1/workspaces/${workspaceId}/browser-sessions`,
1828
+ request,
1829
+ {},
1830
+ options
1843
1831
  );
1844
1832
  }
1845
- /** List the newest immutable onboarding proposals and their inactive policy drafts. */
1846
- async listWorkspaceInstructionPolicyOnboardingProposals(workspaceId, options = {}) {
1847
- const params = new URLSearchParams();
1848
- if (options.limit !== void 0) params.set("limit", String(options.limit));
1849
- const query = params.toString();
1833
+ async listBrowserTargets(workspaceId, browserSessionId, options = {}) {
1850
1834
  return await this.requestJson(
1851
1835
  "GET",
1852
- `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals${query ? `?${query}` : ""}`
1836
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets`,
1837
+ void 0,
1838
+ {},
1839
+ options
1853
1840
  );
1854
1841
  }
1855
- /** Create one draft-only proposal against an exact active-policy baseline. */
1856
- async createWorkspaceInstructionPolicyOnboardingProposal(workspaceId, request) {
1842
+ async openBrowserTarget(workspaceId, browserSessionId, request = {}, options = {}) {
1857
1843
  return await this.requestJson(
1858
1844
  "POST",
1859
- `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals`,
1860
- request
1845
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets`,
1846
+ request,
1847
+ {},
1848
+ options
1861
1849
  );
1862
1850
  }
1863
- /** Import the stored legacy workspace override as an inactive charter draft. */
1864
- async importLegacyWorkspaceInstructionPolicyDraft(workspaceId, request = {}) {
1851
+ async selectBrowserTarget(workspaceId, browserSessionId, targetId, options = {}) {
1865
1852
  return await this.requestJson(
1866
1853
  "POST",
1867
- `/v1/workspaces/${workspaceId}/instruction-policies/import-legacy`,
1868
- request
1854
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets/${encodeURIComponent(targetId)}/select`,
1855
+ {},
1856
+ {},
1857
+ options
1869
1858
  );
1870
1859
  }
1871
- async diffWorkspaceInstructionPolicyRevisions(workspaceId, request) {
1872
- const params = new URLSearchParams({
1873
- fromRevisionId: request.fromRevisionId,
1874
- toRevisionId: request.toRevisionId
1875
- });
1860
+ async closeBrowserTarget(workspaceId, browserSessionId, targetId, options = {}) {
1876
1861
  return await this.requestJson(
1877
- "GET",
1878
- `/v1/workspaces/${workspaceId}/instruction-policies/diff?${params}`
1862
+ "DELETE",
1863
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets/${encodeURIComponent(targetId)}`,
1864
+ void 0,
1865
+ {},
1866
+ options
1879
1867
  );
1880
1868
  }
1881
- async activateWorkspaceInstructionPolicyRevision(workspaceId, revisionId, request) {
1869
+ async observeBrowserTarget(workspaceId, browserSessionId, targetId, options = {}) {
1882
1870
  return await this.requestJson(
1883
- "POST",
1884
- `/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}/activate`,
1885
- request
1871
+ "GET",
1872
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets/${encodeURIComponent(targetId)}/observation`,
1873
+ void 0,
1874
+ {},
1875
+ options
1886
1876
  );
1887
1877
  }
1888
- async rollbackWorkspaceInstructionPolicyRevision(workspaceId, request) {
1878
+ async actInBrowser(workspaceId, browserSessionId, request, options = {}) {
1889
1879
  return await this.requestJson(
1890
1880
  "POST",
1891
- `/v1/workspaces/${workspaceId}/instruction-policies/rollback`,
1892
- request
1881
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/actions`,
1882
+ request,
1883
+ {},
1884
+ options
1893
1885
  );
1894
1886
  }
1895
- async listPreferenceRegistry(workspaceId, options = {}) {
1896
- const params = new URLSearchParams();
1897
- if (options.scope) params.set("scope", options.scope);
1898
- if (options.status) params.set("status", options.status);
1899
- if (options.limit !== void 0) params.set("limit", String(options.limit));
1900
- const query = params.toString();
1887
+ async getBrowserActionReceipt(workspaceId, browserSessionId, operationId, options = {}) {
1901
1888
  return await this.requestJson(
1902
1889
  "GET",
1903
- `/v1/workspaces/${workspaceId}/preferences${query ? `?${query}` : ""}`
1890
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/operations/${encodeURIComponent(operationId)}`,
1891
+ void 0,
1892
+ {},
1893
+ options
1904
1894
  );
1905
1895
  }
1906
- async getPreferenceRegistry(workspaceId, preferenceId) {
1896
+ async listBrowserDiagnostics(workspaceId, browserSessionId, targetId, options = {}) {
1907
1897
  return await this.requestJson(
1908
1898
  "GET",
1909
- `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}`
1899
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/targets/${encodeURIComponent(targetId)}/diagnostics`,
1900
+ void 0,
1901
+ {
1902
+ ...options.kinds?.length ? { kinds: options.kinds.join(",") } : {},
1903
+ ...options.after !== void 0 ? { after: String(options.after) } : {},
1904
+ ...options.limit !== void 0 ? { limit: String(options.limit) } : {}
1905
+ },
1906
+ options.signal ? { signal: options.signal } : {}
1910
1907
  );
1911
1908
  }
1912
- async createPreferenceRegistryProposal(workspaceId, request) {
1909
+ async attachBrowserSession(workspaceId, browserSessionId, request, options = {}) {
1913
1910
  return await this.requestJson(
1914
1911
  "POST",
1915
- `/v1/workspaces/${workspaceId}/preferences/proposals`,
1916
- request
1912
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/attachments`,
1913
+ request,
1914
+ {},
1915
+ options
1917
1916
  );
1918
1917
  }
1919
- async activatePreferenceRegistryRevision(workspaceId, preferenceId, request) {
1918
+ async heartbeatBrowserSession(workspaceId, browserSessionId, options = {}) {
1920
1919
  return await this.requestJson(
1921
1920
  "POST",
1922
- `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/activate`,
1923
- request
1921
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/heartbeat`,
1922
+ {},
1923
+ {},
1924
+ options
1924
1925
  );
1925
1926
  }
1926
- async correctPreferenceRegistry(workspaceId, preferenceId, request) {
1927
+ async publishBrowserRevision(workspaceId, browserSessionId, request, options = {}) {
1927
1928
  return await this.requestJson(
1928
1929
  "POST",
1929
- `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/correct`,
1930
- request
1930
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/revisions`,
1931
+ request,
1932
+ {},
1933
+ options
1931
1934
  );
1932
1935
  }
1933
- async changePreferenceRegistryScope(workspaceId, preferenceId, request) {
1936
+ async suspendBrowserSession(workspaceId, browserSessionId, request, options = {}) {
1934
1937
  return await this.requestJson(
1935
1938
  "POST",
1936
- `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/scope`,
1937
- request
1939
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/suspend`,
1940
+ request,
1941
+ {},
1942
+ options
1943
+ );
1944
+ }
1945
+ async resumeBrowserSession(workspaceId, browserSessionId, request, options = {}) {
1946
+ return await this.requestJson(
1947
+ "POST",
1948
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/resume`,
1949
+ request,
1950
+ {},
1951
+ options
1952
+ );
1953
+ }
1954
+ async endBrowserSession(workspaceId, browserSessionId, request, options = {}) {
1955
+ return await this.requestJson(
1956
+ "POST",
1957
+ `/v1/workspaces/${workspaceId}/browser-sessions/${encodeURIComponent(browserSessionId)}/end`,
1958
+ request,
1959
+ {},
1960
+ options
1961
+ );
1962
+ }
1963
+ /** Workspace-wide ComputerSession inventory. Associations express
1964
+ * relevance, not access; peer sessions intentionally remain discoverable. */
1965
+ async listComputerSessions(workspaceId, options = {}) {
1966
+ return await this.requestJson(
1967
+ "GET",
1968
+ `/v1/workspaces/${workspaceId}/computer-sessions`,
1969
+ void 0,
1970
+ {},
1971
+ options
1972
+ );
1973
+ }
1974
+ async getComputerSession(workspaceId, computerSessionId, options = {}) {
1975
+ return await this.requestJson(
1976
+ "GET",
1977
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}`,
1978
+ void 0,
1979
+ {},
1980
+ options
1981
+ );
1982
+ }
1983
+ async createComputerSession(workspaceId, request, options = {}) {
1984
+ return await this.requestJson(
1985
+ "POST",
1986
+ `/v1/workspaces/${workspaceId}/computer-sessions`,
1987
+ request,
1988
+ {},
1989
+ options
1990
+ );
1991
+ }
1992
+ async listComputerTargets(workspaceId, computerSessionId, options = {}) {
1993
+ return await this.requestJson(
1994
+ "GET",
1995
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/targets`,
1996
+ void 0,
1997
+ {},
1998
+ options
1999
+ );
2000
+ }
2001
+ async observeComputerTarget(workspaceId, computerSessionId, targetId, options = {}) {
2002
+ return await this.requestJson(
2003
+ "GET",
2004
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/targets/${encodeURIComponent(targetId)}/observation`,
2005
+ void 0,
2006
+ {},
2007
+ options
2008
+ );
2009
+ }
2010
+ async actInComputer(workspaceId, computerSessionId, request, options = {}) {
2011
+ return await this.requestJson(
2012
+ "POST",
2013
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/actions`,
2014
+ request,
2015
+ {},
2016
+ options
2017
+ );
2018
+ }
2019
+ async getComputerActionReceipt(workspaceId, computerSessionId, operationId, options = {}) {
2020
+ return await this.requestJson(
2021
+ "GET",
2022
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/operations/${encodeURIComponent(operationId)}`,
2023
+ void 0,
2024
+ {},
2025
+ options
2026
+ );
2027
+ }
2028
+ async attachComputerSession(workspaceId, computerSessionId, request, options = {}) {
2029
+ return await this.requestJson(
2030
+ "POST",
2031
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/attachments`,
2032
+ request,
2033
+ {},
2034
+ options
2035
+ );
2036
+ }
2037
+ async heartbeatComputerSession(workspaceId, computerSessionId, options = {}) {
2038
+ return await this.requestJson(
2039
+ "POST",
2040
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/heartbeat`,
2041
+ {},
2042
+ {},
2043
+ options
2044
+ );
2045
+ }
2046
+ async endComputerSession(workspaceId, computerSessionId, request, options = {}) {
2047
+ return await this.requestJson(
2048
+ "POST",
2049
+ `/v1/workspaces/${workspaceId}/computer-sessions/${encodeURIComponent(computerSessionId)}/end`,
2050
+ request,
2051
+ {},
2052
+ options
2053
+ );
2054
+ }
2055
+ // --- Access + workspaces -----------------------------------------------------
2056
+ /**
2057
+ * The deployment's public client bootstrap config: the host-exposed models
2058
+ * (provider-grouped in `models`, flat in `allowedModels` for back-compat),
2059
+ * reasoning efforts, MCP servers, file-upload limits, and how the client is
2060
+ * expected to authenticate. Drives a composer's model picker without prior
2061
+ * knowledge of the host setup; safe to call before any auth is established.
2062
+ */
2063
+ async getClientConfig() {
2064
+ const config = await this.requestJson("GET", "/v1/config/client");
2065
+ if (config.apiContractRevision !== OPENGENI_API_CONTRACT_REVISION) {
2066
+ throw new OpenGeniApiContractMismatchError(
2067
+ OPENGENI_API_CONTRACT_REVISION,
2068
+ String(config.apiContractRevision || "(missing)")
2069
+ );
2070
+ }
2071
+ return config;
2072
+ }
2073
+ /** Authenticated model definitions plus workspace-specific selectability. */
2074
+ async getWorkspaceModelCatalog(workspaceId) {
2075
+ return await this.requestJson(
2076
+ "GET",
2077
+ `/v1/workspaces/${workspaceId}/model-catalog`
2078
+ );
2079
+ }
2080
+ /** Authenticated realtime voice models and credential readiness. */
2081
+ async getWorkspaceRealtimeModelCatalog(workspaceId) {
2082
+ return await this.requestJson(
2083
+ "GET",
2084
+ `/v1/workspaces/${workspaceId}/realtime-model-catalog`
2085
+ );
2086
+ }
2087
+ /** The caller's access context: subject, account + workspace grants, defaults. */
2088
+ async getAccessContext() {
2089
+ return await this.requestJson("GET", "/v1/access/me");
2090
+ }
2091
+ async listWorkspaces() {
2092
+ return await this.requestJson("GET", "/v1/workspaces");
2093
+ }
2094
+ async createWorkspace(request) {
2095
+ return await this.requestJson("POST", "/v1/workspaces", request);
2096
+ }
2097
+ async getWorkspace(workspaceId) {
2098
+ return await this.requestJson("GET", `/v1/workspaces/${workspaceId}`);
2099
+ }
2100
+ /** Read-time, secret-safe inventory of policy heads and visible workspace knowledge. */
2101
+ async getWorkspaceState(workspaceId, options = {}) {
2102
+ const params = new URLSearchParams();
2103
+ if (options.attemptId) params.set("attemptId", options.attemptId);
2104
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2105
+ return await this.requestJson(
2106
+ "GET",
2107
+ `/v1/workspaces/${workspaceId}/workspace-state${query}`
2108
+ );
2109
+ }
2110
+ /** Download the canonical, explicitly sanitized Workspace State export. */
2111
+ async exportWorkspaceState(workspaceId, options = {}) {
2112
+ const params = new URLSearchParams();
2113
+ if (options.attemptId) params.set("attemptId", options.attemptId);
2114
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2115
+ return await this.requestJson(
2116
+ "GET",
2117
+ `/v1/workspaces/${workspaceId}/workspace-state/export${query}`
2118
+ );
2119
+ }
2120
+ async updateWorkspace(workspaceId, request) {
2121
+ return await this.requestJson("PATCH", `/v1/workspaces/${workspaceId}`, request);
2122
+ }
2123
+ /** Inspect immutable instruction-policy history, active heads, and activation audit evidence. */
2124
+ async listWorkspaceInstructionPolicies(workspaceId, options = {}) {
2125
+ const params = new URLSearchParams();
2126
+ if (options.kind !== void 0) params.set("kind", options.kind);
2127
+ if (options.scope !== void 0) params.set("scope", options.scope);
2128
+ if (options.roleKey !== void 0) params.set("roleKey", options.roleKey);
2129
+ if (options.afterRevision !== void 0) {
2130
+ params.set("afterRevision", String(options.afterRevision));
2131
+ }
2132
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
2133
+ const query = params.toString();
2134
+ return await this.requestJson(
2135
+ "GET",
2136
+ `/v1/workspaces/${workspaceId}/instruction-policies${query ? `?${query}` : ""}`
2137
+ );
2138
+ }
2139
+ async getWorkspaceInstructionPolicyRevision(workspaceId, revisionId) {
2140
+ return await this.requestJson(
2141
+ "GET",
2142
+ `/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}`
2143
+ );
2144
+ }
2145
+ async createWorkspaceInstructionPolicyDraft(workspaceId, request) {
2146
+ return await this.requestJson(
2147
+ "POST",
2148
+ `/v1/workspaces/${workspaceId}/instruction-policies/drafts`,
2149
+ request
2150
+ );
2151
+ }
2152
+ /** List the newest immutable onboarding proposals and their inactive policy drafts. */
2153
+ async listWorkspaceInstructionPolicyOnboardingProposals(workspaceId, options = {}) {
2154
+ const params = new URLSearchParams();
2155
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
2156
+ const query = params.toString();
2157
+ return await this.requestJson(
2158
+ "GET",
2159
+ `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals${query ? `?${query}` : ""}`
2160
+ );
2161
+ }
2162
+ /** Create one draft-only proposal against an exact active-policy baseline. */
2163
+ async createWorkspaceInstructionPolicyOnboardingProposal(workspaceId, request) {
2164
+ return await this.requestJson(
2165
+ "POST",
2166
+ `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals`,
2167
+ request
2168
+ );
2169
+ }
2170
+ /** Import the stored legacy workspace override as an inactive charter draft. */
2171
+ async importLegacyWorkspaceInstructionPolicyDraft(workspaceId, request = {}) {
2172
+ return await this.requestJson(
2173
+ "POST",
2174
+ `/v1/workspaces/${workspaceId}/instruction-policies/import-legacy`,
2175
+ request
2176
+ );
2177
+ }
2178
+ async diffWorkspaceInstructionPolicyRevisions(workspaceId, request) {
2179
+ const params = new URLSearchParams({
2180
+ fromRevisionId: request.fromRevisionId,
2181
+ toRevisionId: request.toRevisionId
2182
+ });
2183
+ return await this.requestJson(
2184
+ "GET",
2185
+ `/v1/workspaces/${workspaceId}/instruction-policies/diff?${params}`
2186
+ );
2187
+ }
2188
+ async activateWorkspaceInstructionPolicyRevision(workspaceId, revisionId, request) {
2189
+ return await this.requestJson(
2190
+ "POST",
2191
+ `/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}/activate`,
2192
+ request
2193
+ );
2194
+ }
2195
+ async rollbackWorkspaceInstructionPolicyRevision(workspaceId, request) {
2196
+ return await this.requestJson(
2197
+ "POST",
2198
+ `/v1/workspaces/${workspaceId}/instruction-policies/rollback`,
2199
+ request
2200
+ );
2201
+ }
2202
+ /** Read the current organization profile plus immutable revision and activation history. */
2203
+ async listCompanyProfile(workspaceId, options = {}) {
2204
+ const params = new URLSearchParams();
2205
+ if (options.afterRevision !== void 0)
2206
+ params.set("afterRevision", String(options.afterRevision));
2207
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
2208
+ const query = params.toString();
2209
+ return await this.requestJson(
2210
+ "GET",
2211
+ `/v1/workspaces/${workspaceId}/company-profile${query ? `?${query}` : ""}`
2212
+ );
2213
+ }
2214
+ async getCompanyProfileRevision(workspaceId, revisionId) {
2215
+ return await this.requestJson(
2216
+ "GET",
2217
+ `/v1/workspaces/${workspaceId}/company-profile/revisions/${encodeURIComponent(revisionId)}`
2218
+ );
2219
+ }
2220
+ async updateCompanyProfile(workspaceId, request) {
2221
+ return await this.requestJson(
2222
+ "PUT",
2223
+ `/v1/workspaces/${workspaceId}/company-profile`,
2224
+ request
2225
+ );
2226
+ }
2227
+ async diffCompanyProfileRevisions(workspaceId, request) {
2228
+ const params = new URLSearchParams(request);
2229
+ return await this.requestJson(
2230
+ "GET",
2231
+ `/v1/workspaces/${workspaceId}/company-profile/diff?${params}`
2232
+ );
2233
+ }
2234
+ async activateCompanyProfileRevision(workspaceId, revisionId, request) {
2235
+ return await this.requestJson(
2236
+ "POST",
2237
+ `/v1/workspaces/${workspaceId}/company-profile/revisions/${encodeURIComponent(revisionId)}/activate`,
2238
+ request
2239
+ );
2240
+ }
2241
+ async rollbackCompanyProfile(workspaceId, request) {
2242
+ return await this.requestJson(
2243
+ "POST",
2244
+ `/v1/workspaces/${workspaceId}/company-profile/rollback`,
2245
+ request
2246
+ );
2247
+ }
2248
+ async listPreferenceRegistry(workspaceId, options = {}) {
2249
+ const params = new URLSearchParams();
2250
+ if (options.scope) params.set("scope", options.scope);
2251
+ if (options.status) params.set("status", options.status);
2252
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
2253
+ const query = params.toString();
2254
+ return await this.requestJson(
2255
+ "GET",
2256
+ `/v1/workspaces/${workspaceId}/preferences${query ? `?${query}` : ""}`
2257
+ );
2258
+ }
2259
+ async getPreferenceRegistry(workspaceId, preferenceId) {
2260
+ return await this.requestJson(
2261
+ "GET",
2262
+ `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}`
2263
+ );
2264
+ }
2265
+ async createPreferenceRegistryProposal(workspaceId, request) {
2266
+ return await this.requestJson(
2267
+ "POST",
2268
+ `/v1/workspaces/${workspaceId}/preferences/proposals`,
2269
+ request
2270
+ );
2271
+ }
2272
+ async activatePreferenceRegistryRevision(workspaceId, preferenceId, request) {
2273
+ return await this.requestJson(
2274
+ "POST",
2275
+ `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/activate`,
2276
+ request
2277
+ );
2278
+ }
2279
+ async correctPreferenceRegistry(workspaceId, preferenceId, request) {
2280
+ return await this.requestJson(
2281
+ "POST",
2282
+ `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/correct`,
2283
+ request
2284
+ );
2285
+ }
2286
+ async changePreferenceRegistryScope(workspaceId, preferenceId, request) {
2287
+ return await this.requestJson(
2288
+ "POST",
2289
+ `/v1/workspaces/${workspaceId}/preferences/${encodeURIComponent(preferenceId)}/scope`,
2290
+ request
1938
2291
  );
1939
2292
  }
1940
2293
  async deactivatePreferenceRegistry(workspaceId, preferenceId, request) {
@@ -2015,6 +2368,55 @@ var OpenGeniClient = class {
2015
2368
  `/v1/workspaces/${workspaceId}/members/${encodeURIComponent(subjectId)}`
2016
2369
  );
2017
2370
  }
2371
+ /** Exchange one signed Slack bearer for durable, token-free continuation state. */
2372
+ async prepareSlackUserLinkAccess(workspaceId, request) {
2373
+ return await this.requestJson(
2374
+ "POST",
2375
+ `/v1/workspaces/${workspaceId}/integrations/slack/user-link-intents`,
2376
+ request
2377
+ );
2378
+ }
2379
+ async getSlackUserLinkAccess(workspaceId, requestId) {
2380
+ return await this.requestJson(
2381
+ "GET",
2382
+ `/v1/workspaces/${workspaceId}/integrations/slack/user-link-intents/${requestId}`
2383
+ );
2384
+ }
2385
+ async requestSlackUserLinkWorkspaceAccess(workspaceId, requestId, request) {
2386
+ return await this.requestJson(
2387
+ "POST",
2388
+ `/v1/workspaces/${workspaceId}/integrations/slack/user-link-intents/${requestId}/request-access`,
2389
+ request
2390
+ );
2391
+ }
2392
+ async cancelSlackUserLinkAccess(workspaceId, requestId, request) {
2393
+ return await this.requestJson(
2394
+ "POST",
2395
+ `/v1/workspaces/${workspaceId}/integrations/slack/user-link-intents/${requestId}/cancel`,
2396
+ request
2397
+ );
2398
+ }
2399
+ async listSlackUserLinkAccessRequests(workspaceId) {
2400
+ const response = await this.requestJson(
2401
+ "GET",
2402
+ `/v1/workspaces/${workspaceId}/members/access-requests/slack`
2403
+ );
2404
+ return response.requests;
2405
+ }
2406
+ async approveSlackUserLinkAccessRequest(workspaceId, requestId, request) {
2407
+ return await this.requestJson(
2408
+ "POST",
2409
+ `/v1/workspaces/${workspaceId}/members/access-requests/slack/${requestId}/approve`,
2410
+ request
2411
+ );
2412
+ }
2413
+ async denySlackUserLinkAccessRequest(workspaceId, requestId, request) {
2414
+ return await this.requestJson(
2415
+ "POST",
2416
+ `/v1/workspaces/${workspaceId}/members/access-requests/slack/${requestId}/deny`,
2417
+ request
2418
+ );
2419
+ }
2018
2420
  // --- Scheduled tasks (write + runs) -------------------------------------------
2019
2421
  async createScheduledTask(workspaceId, request) {
2020
2422
  return await this.requestJson(
@@ -2367,21 +2769,38 @@ var OpenGeniClient = class {
2367
2769
  options
2368
2770
  );
2369
2771
  }
2772
+ /** Assemble one permanent generated-image receipt from bounded authenticated ranges. */
2773
+ async downloadRetainedArtifact(workspaceId, artifact, options = {}) {
2774
+ assertRetainedGeneratedImageReceipt(workspaceId, artifact);
2775
+ const bytes = await this.downloadRetainedArtifactBytes(artifact, options);
2776
+ return { artifact, bytes };
2777
+ }
2778
+ /** Mint a short-lived, zero-copy browser source for a validated generated image. */
2779
+ async createRetainedArtifactDownloadUrl(workspaceId, artifact, options = {}) {
2780
+ assertRetainedGeneratedImageReceipt(workspaceId, artifact);
2781
+ const download = await this.createFileDownloadUrl(workspaceId, artifact.artifactId, options);
2782
+ assertSafeArtifactDownloadUrl(download);
2783
+ return download;
2784
+ }
2370
2785
  /** Assemble one retained screenshot from bounded authenticated API ranges. */
2371
2786
  async downloadRetainedScreenshot(workspaceId, sessionId, artifactId, options = {}) {
2372
- const maxRetries = options.maxRetries ?? 2;
2373
- if (!Number.isInteger(maxRetries) || maxRetries < 0 || maxRetries > 3) {
2374
- throw new RangeError("retained screenshot maxRetries must be an integer from 0 to 3");
2375
- }
2376
2787
  const metadata = await this.getSessionRetainedArtifact(workspaceId, sessionId, artifactId);
2377
2788
  if (!metadata.available) return { metadata, bytes: null };
2378
2789
  if (metadata.kind !== "computer_screenshot" || metadata.contentType !== "image/png" || !metadata.dimensions || metadata.originalBytes <= 0 || metadata.originalBytes > COMPUTER_SCREENSHOT_MAX_BYTES) {
2379
2790
  throw new OpenGeniApiError(502, "retained screenshot metadata is invalid");
2380
2791
  }
2381
- const bytes = new Uint8Array(metadata.originalBytes);
2382
- const pageBytes = Math.min(metadata.retrieval.maxRangeBytes, RETAINED_OUTPUT_MAX_PAGE_BYTES);
2792
+ const bytes = await this.downloadRetainedArtifactBytes(metadata, options);
2793
+ return { metadata, bytes };
2794
+ }
2795
+ async downloadRetainedArtifactBytes(artifact, options) {
2796
+ const maxRetries = options.maxRetries ?? 2;
2797
+ if (!Number.isInteger(maxRetries) || maxRetries < 0 || maxRetries > 3) {
2798
+ throw new RangeError("retained artifact maxRetries must be an integer from 0 to 3");
2799
+ }
2800
+ const bytes = new Uint8Array(artifact.originalBytes);
2801
+ const pageBytes = Math.min(artifact.retrieval.maxRangeBytes, RETAINED_OUTPUT_MAX_PAGE_BYTES);
2383
2802
  if (!Number.isSafeInteger(pageBytes) || pageBytes <= 0) {
2384
- throw new OpenGeniApiError(502, "retained screenshot range metadata is invalid");
2803
+ throw new OpenGeniApiError(502, "retained artifact range metadata is invalid");
2385
2804
  }
2386
2805
  for (let start = 0; start < bytes.byteLength; start += pageBytes) {
2387
2806
  options.signal?.throwIfAborted();
@@ -2389,7 +2808,7 @@ var OpenGeniClient = class {
2389
2808
  let page = null;
2390
2809
  for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
2391
2810
  try {
2392
- page = await this.getSessionRetainedArtifactContent(workspaceId, sessionId, artifactId, {
2811
+ page = await this.getRetainedArtifactContentAtPath(artifact.retrieval.path, {
2393
2812
  range: `bytes=${start}-${end}`,
2394
2813
  ...options.signal ? { signal: options.signal } : {}
2395
2814
  });
@@ -2401,17 +2820,17 @@ var OpenGeniClient = class {
2401
2820
  }
2402
2821
  }
2403
2822
  }
2404
- if (!page) throw new OpenGeniApiError(502, "retained screenshot range retry exhausted");
2823
+ if (!page) throw new OpenGeniApiError(502, "retained artifact range retry exhausted");
2405
2824
  const expectedLength = end - start + 1;
2406
- if (page.status !== 206 || page.contentType !== metadata.contentType || page.contentLength !== expectedLength || page.contentRange !== `bytes ${start}-${end}/${metadata.originalBytes}`) {
2407
- throw new OpenGeniApiError(502, "retained screenshot range response is invalid");
2825
+ if (page.status !== 206 || page.contentType !== artifact.contentType || page.contentLength !== expectedLength || page.contentRange !== `bytes ${start}-${end}/${artifact.originalBytes}`) {
2826
+ throw new OpenGeniApiError(502, "retained artifact range response is invalid");
2408
2827
  }
2409
2828
  bytes.set(page.bytes, start);
2410
2829
  }
2411
- if (await sha256Hex(bytes) !== metadata.sha256) {
2412
- throw new OpenGeniApiError(502, "retained screenshot checksum mismatch");
2830
+ if (await sha256Hex(bytes) !== artifact.sha256) {
2831
+ throw new OpenGeniApiError(502, "retained artifact checksum mismatch");
2413
2832
  }
2414
- return { metadata, bytes };
2833
+ return bytes;
2415
2834
  }
2416
2835
  async getRetainedArtifactContentAtPath(path, options) {
2417
2836
  if (options.range && (options.range.length > 128 || /[^\x20-\x7e]/.test(options.range))) {
@@ -2469,11 +2888,57 @@ var OpenGeniClient = class {
2469
2888
  };
2470
2889
  }
2471
2890
  /** Mint a short-lived signed download URL for a ready file. */
2472
- async createFileDownloadUrl(workspaceId, fileId) {
2891
+ async createFileDownloadUrl(workspaceId, fileId, options = {}) {
2892
+ return await this.requestJson(
2893
+ "POST",
2894
+ `/v1/workspaces/${workspaceId}/files/${fileId}/download-url`,
2895
+ void 0,
2896
+ {},
2897
+ options
2898
+ );
2899
+ }
2900
+ // --- Video generation ---------------------------------------------------------------
2901
+ /** Read the effective workspace policy and executable Seedance capabilities. */
2902
+ async getVideoGenerationSettings(workspaceId, options = {}) {
2903
+ return await this.requestJson(
2904
+ "GET",
2905
+ `/v1/workspaces/${workspaceId}/video-generation`,
2906
+ void 0,
2907
+ {},
2908
+ options
2909
+ );
2910
+ }
2911
+ /** Replace the enabled video models/default under optimistic policy revision control. */
2912
+ async updateVideoGenerationPolicy(workspaceId, request, options = {}) {
2913
+ return await this.requestJson(
2914
+ "PUT",
2915
+ `/v1/workspaces/${workspaceId}/video-generation/policy`,
2916
+ request,
2917
+ {},
2918
+ options
2919
+ );
2920
+ }
2921
+ /** Read durable progress for one accepted video generation operation. */
2922
+ async getVideoGenerationOperation(workspaceId, operationId, options = {}) {
2473
2923
  return await this.requestJson(
2924
+ "GET",
2925
+ `/v1/workspaces/${workspaceId}/video-generation/operations/${operationId}`,
2926
+ void 0,
2927
+ {},
2928
+ options
2929
+ );
2930
+ }
2931
+ /** Mint a short-lived zero-copy URL for native Range-based video playback. */
2932
+ async createVideoArtifactPlaybackSource(workspaceId, artifactId, options = {}) {
2933
+ const source = await this.requestJson(
2474
2934
  "POST",
2475
- `/v1/workspaces/${workspaceId}/files/${fileId}/download-url`
2935
+ `/v1/workspaces/${workspaceId}/artifacts/${artifactId}/playback-source`,
2936
+ void 0,
2937
+ {},
2938
+ options
2476
2939
  );
2940
+ assertSafeVideoArtifactPlaybackSource(source, artifactId);
2941
+ return source;
2477
2942
  }
2478
2943
  // --- Documents ----------------------------------------------------------------------
2479
2944
  async createDocumentBase(workspaceId, request) {
@@ -2646,6 +3111,37 @@ var OpenGeniClient = class {
2646
3111
  request
2647
3112
  );
2648
3113
  }
3114
+ /** Resolve pinned components, Variable Set, and Rig requirements before installation. */
3115
+ async previewPackInstallation(workspaceId, packId, request = {}) {
3116
+ return await this.requestJson(
3117
+ "POST",
3118
+ `/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/installation-preview`,
3119
+ request
3120
+ );
3121
+ }
3122
+ /** Install, update, or repair a Pack from an exact previewed manifest. */
3123
+ async installPack(workspaceId, packId, request) {
3124
+ return await this.requestJson(
3125
+ "POST",
3126
+ `/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/install`,
3127
+ request
3128
+ );
3129
+ }
3130
+ /** Preview which Pack-owned components will be retained by other owners. */
3131
+ async previewPackUninstall(workspaceId, packId) {
3132
+ return await this.requestJson(
3133
+ "GET",
3134
+ `/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/uninstall-preview`
3135
+ );
3136
+ }
3137
+ /** Safely release Pack ownership and disable only now-ownerless components. */
3138
+ async uninstallPack(workspaceId, packId, request) {
3139
+ return await this.requestJson(
3140
+ "DELETE",
3141
+ `/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/installation`,
3142
+ request
3143
+ );
3144
+ }
2649
3145
  /** Unregister a workspace-scoped pack (built-in packs cannot be deleted). */
2650
3146
  async deletePack(workspaceId, packId) {
2651
3147
  await this.requestVoid(
@@ -2699,6 +3195,189 @@ var OpenGeniClient = class {
2699
3195
  }
2700
3196
  );
2701
3197
  }
3198
+ /** List installed protocol-neutral OpenAPI and GraphQL Integrations. */
3199
+ async listApiIntegrations(workspaceId) {
3200
+ return await this.requestJson(
3201
+ "GET",
3202
+ `/v1/workspaces/${workspaceId}/integrations`
3203
+ );
3204
+ }
3205
+ /** List curated provider presets without exposing deployment OAuth credentials. */
3206
+ async listApiIntegrationPresets(workspaceId) {
3207
+ return await this.requestJson(
3208
+ "GET",
3209
+ `/v1/workspaces/${workspaceId}/integrations/presets`
3210
+ );
3211
+ }
3212
+ /** Detect and compile an Integration without mutating workspace state. */
3213
+ async previewApiIntegration(workspaceId, request) {
3214
+ return await this.requestJson(
3215
+ "POST",
3216
+ `/v1/workspaces/${workspaceId}/integrations/preview`,
3217
+ request
3218
+ );
3219
+ }
3220
+ /** Start a signed PKCE OAuth flow for a built-in Google or Microsoft preset. */
3221
+ async startApiIntegrationOAuth(workspaceId, request) {
3222
+ return await this.requestJson(
3223
+ "POST",
3224
+ `/v1/workspaces/${workspaceId}/integrations/oauth/start`,
3225
+ request
3226
+ );
3227
+ }
3228
+ /** Install only the exact immutable revision and digest accepted in preview. */
3229
+ async installApiIntegration(workspaceId, request) {
3230
+ return await this.requestJson(
3231
+ "POST",
3232
+ `/v1/workspaces/${workspaceId}/integrations/install`,
3233
+ request
3234
+ );
3235
+ }
3236
+ async previewApiIntegrationUninstall(workspaceId, capabilityId, instanceKey) {
3237
+ return await this.requestJson(
3238
+ "GET",
3239
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/uninstall-preview`
3240
+ );
3241
+ }
3242
+ /** Remove one Integration instance without deleting its Connection or sibling instances. */
3243
+ async uninstallApiIntegration(workspaceId, capabilityId, instanceKey, request) {
3244
+ return await this.requestJson(
3245
+ "DELETE",
3246
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}`,
3247
+ request
3248
+ );
3249
+ }
3250
+ /** List immutable provider facets and their exact per-account bindings. */
3251
+ async listIntegrationFeatures(workspaceId, capabilityId, instanceKey) {
3252
+ return await this.requestJson(
3253
+ "GET",
3254
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features`
3255
+ );
3256
+ }
3257
+ /** Configure or OCC-update one adapter-owned feature on an Integration instance. */
3258
+ async configureIntegrationFeature(workspaceId, capabilityId, instanceKey, featureKey, request) {
3259
+ return await this.requestJson(
3260
+ "PUT",
3261
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features/${encodeURIComponent(featureKey)}`,
3262
+ request
3263
+ );
3264
+ }
3265
+ /** Browse source metadata through one exact Google Drive Integration instance. */
3266
+ async browseGoogleDriveIntegrationSource(workspaceId, capabilityId, instanceKey, featureKey, options = {}) {
3267
+ const query = new URLSearchParams();
3268
+ if (options.parentId) query.set("parentId", options.parentId);
3269
+ if (options.pageToken) query.set("pageToken", options.pageToken);
3270
+ const suffix = query.size > 0 ? `?${query}` : "";
3271
+ return await this.requestJson(
3272
+ "GET",
3273
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features/${encodeURIComponent(featureKey)}/browse${suffix}`
3274
+ );
3275
+ }
3276
+ /** Verify and bind document sources to one exact Google Drive Integration instance. */
3277
+ async saveGoogleDriveIntegrationSource(workspaceId, capabilityId, instanceKey, featureKey, request) {
3278
+ return await this.requestJson(
3279
+ "PUT",
3280
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features/${encodeURIComponent(featureKey)}/source`,
3281
+ request
3282
+ );
3283
+ }
3284
+ async pauseIntegrationFeature(workspaceId, capabilityId, instanceKey, featureKey, request) {
3285
+ return await this.mutateIntegrationFeatureLifecycle(
3286
+ workspaceId,
3287
+ capabilityId,
3288
+ instanceKey,
3289
+ featureKey,
3290
+ "pause",
3291
+ request
3292
+ );
3293
+ }
3294
+ async resumeIntegrationFeature(workspaceId, capabilityId, instanceKey, featureKey, request) {
3295
+ return await this.mutateIntegrationFeatureLifecycle(
3296
+ workspaceId,
3297
+ capabilityId,
3298
+ instanceKey,
3299
+ featureKey,
3300
+ "resume",
3301
+ request
3302
+ );
3303
+ }
3304
+ async removeIntegrationFeature(workspaceId, capabilityId, instanceKey, featureKey, request) {
3305
+ return await this.requestJson(
3306
+ "DELETE",
3307
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features/${encodeURIComponent(featureKey)}`,
3308
+ request
3309
+ );
3310
+ }
3311
+ async mutateIntegrationFeatureLifecycle(workspaceId, capabilityId, instanceKey, featureKey, action, request) {
3312
+ return await this.requestJson(
3313
+ "POST",
3314
+ `/v1/workspaces/${workspaceId}/integrations/${encodeURIComponent(capabilityId)}/instances/${encodeURIComponent(instanceKey)}/features/${encodeURIComponent(featureKey)}/${action}`,
3315
+ request
3316
+ );
3317
+ }
3318
+ async previewPlugin(workspaceId, request) {
3319
+ return await this.requestJson(
3320
+ "POST",
3321
+ `/v1/workspaces/${workspaceId}/plugins/preview`,
3322
+ request
3323
+ );
3324
+ }
3325
+ async listInstalledPlugins(workspaceId) {
3326
+ return await this.requestJson(
3327
+ "GET",
3328
+ `/v1/workspaces/${workspaceId}/plugins`
3329
+ );
3330
+ }
3331
+ async installPlugin(workspaceId, request) {
3332
+ return await this.requestJson(
3333
+ "POST",
3334
+ `/v1/workspaces/${workspaceId}/plugins/install`,
3335
+ request
3336
+ );
3337
+ }
3338
+ async previewPluginUninstall(workspaceId, pluginKey) {
3339
+ return await this.requestJson(
3340
+ "GET",
3341
+ `/v1/workspaces/${workspaceId}/plugins/${encodeURIComponent(pluginKey)}/uninstall-preview`
3342
+ );
3343
+ }
3344
+ async uninstallPlugin(workspaceId, pluginKey, request) {
3345
+ return await this.requestJson(
3346
+ "DELETE",
3347
+ `/v1/workspaces/${workspaceId}/plugins/${encodeURIComponent(pluginKey)}`,
3348
+ request
3349
+ );
3350
+ }
3351
+ /** Resolve one public skills.sh or GitHub Skill folder to an immutable review preview. */
3352
+ async previewSkillImport(workspaceId, request) {
3353
+ return await this.requestJson(
3354
+ "POST",
3355
+ `/v1/workspaces/${workspaceId}/skills/preview`,
3356
+ request
3357
+ );
3358
+ }
3359
+ /** Install only the exact commit and full-content digest accepted during preview. */
3360
+ async installSkill(workspaceId, request) {
3361
+ return await this.requestJson(
3362
+ "POST",
3363
+ `/v1/workspaces/${workspaceId}/skills/install`,
3364
+ request
3365
+ );
3366
+ }
3367
+ async previewSkillUninstall(workspaceId, capabilityId) {
3368
+ return await this.requestJson(
3369
+ "GET",
3370
+ `/v1/workspaces/${workspaceId}/skills/${encodeURIComponent(capabilityId)}/uninstall-preview`
3371
+ );
3372
+ }
3373
+ /** Remove the direct owner under an optimistic installation-version fence. */
3374
+ async uninstallSkill(workspaceId, capabilityId, request) {
3375
+ return await this.requestJson(
3376
+ "DELETE",
3377
+ `/v1/workspaces/${workspaceId}/skills/${encodeURIComponent(capabilityId)}`,
3378
+ request
3379
+ );
3380
+ }
2702
3381
  // --- Connections -------------------------------------------------------------------------------
2703
3382
  async listConnections(workspaceId) {
2704
3383
  const response = await this.requestJson(
@@ -2707,6 +3386,14 @@ var OpenGeniClient = class {
2707
3386
  );
2708
3387
  return response.connections;
2709
3388
  }
3389
+ /** List the secret-free Slack team -> OpenGeni tenant routing authority. */
3390
+ async listSlackInstallationBindings(workspaceId) {
3391
+ const response = await this.requestJson(
3392
+ "GET",
3393
+ `/v1/workspaces/${workspaceId}/connections/slack-bot/bindings`
3394
+ );
3395
+ return response.bindings;
3396
+ }
2710
3397
  async createConnection(workspaceId, request) {
2711
3398
  const response = await this.requestJson(
2712
3399
  "POST",
@@ -2804,8 +3491,13 @@ var OpenGeniClient = class {
2804
3491
  }
2805
3492
  // --- GitHub ----------------------------------------------------------------------------------
2806
3493
  /** GitHub App server configuration plus truthful workspace binding status. */
2807
- async getGitHubApp(workspaceId) {
2808
- return await this.requestJson("GET", `/v1/workspaces/${workspaceId}/github/app`);
3494
+ async getGitHubApp(workspaceId, options = {}) {
3495
+ return await this.requestJson(
3496
+ "GET",
3497
+ `/v1/workspaces/${workspaceId}/github/app`,
3498
+ void 0,
3499
+ options.returnPath ? { returnPath: options.returnPath } : void 0
3500
+ );
2809
3501
  }
2810
3502
  /** Build the GitHub owner-consent entry URL for fresh workspace-bound state. */
2811
3503
  githubConnectUrl(workspaceId, state) {
@@ -3035,6 +3727,7 @@ var OpenGeniClient = class {
3035
3727
  { target }
3036
3728
  );
3037
3729
  }
3730
+ /** Contract-checked JSON transport shared by opt-in typed SDK clients. */
3038
3731
  async requestJson(method, path, body, query = {}, options = {}) {
3039
3732
  const correlationId = crypto.randomUUID();
3040
3733
  let response;
@@ -3069,6 +3762,29 @@ var OpenGeniClient = class {
3069
3762
  throw error;
3070
3763
  }
3071
3764
  }
3765
+ /** Authenticated, contract-checked response for bounded streaming downloads. */
3766
+ async requestResponse(method, path, query = {}, options = {}) {
3767
+ const correlationId = crypto.randomUUID();
3768
+ let response;
3769
+ try {
3770
+ response = await this.fetchImpl(this.url(path, query), {
3771
+ method,
3772
+ headers: {
3773
+ ...this.headers(correlationId),
3774
+ Accept: "application/octet-stream"
3775
+ },
3776
+ ...options.signal ? { signal: options.signal } : {}
3777
+ });
3778
+ } catch (error) {
3779
+ if (isMutationMethod(method)) throw mutationTransportError(correlationId);
3780
+ throw error;
3781
+ }
3782
+ assertApiContractResponse(response);
3783
+ if (!response.ok) {
3784
+ throw await apiErrorFromResponse(response, { method, correlationId });
3785
+ }
3786
+ return response;
3787
+ }
3072
3788
  /** Like `requestJson` for endpoints that respond with no body (204). */
3073
3789
  async requestVoid(method, path, body) {
3074
3790
  const correlationId = crypto.randomUUID();
@@ -3224,6 +3940,31 @@ async function sha256Hex(bytes) {
3224
3940
  async function cancelResponseBody(response, reason) {
3225
3941
  await response.body?.cancel(reason).catch(() => void 0);
3226
3942
  }
3943
+ function assertRetainedGeneratedImageReceipt(workspaceId, artifact) {
3944
+ if (!parseRetainedGeneratedImageReference(artifact, workspaceId)) {
3945
+ throw new OpenGeniApiError(502, "retained generated image receipt is invalid");
3946
+ }
3947
+ }
3948
+ function assertSafeArtifactDownloadUrl(value) {
3949
+ if (!value || typeof value.url !== "string" || typeof value.expiresAt !== "string" || !Number.isFinite(Date.parse(value.expiresAt))) {
3950
+ throw new OpenGeniApiError(502, "retained artifact download URL is invalid");
3951
+ }
3952
+ let parsed;
3953
+ try {
3954
+ parsed = new URL(value.url);
3955
+ } catch {
3956
+ throw new OpenGeniApiError(502, "retained artifact download URL is invalid");
3957
+ }
3958
+ if (!["http:", "https:"].includes(parsed.protocol) || parsed.username || parsed.password) {
3959
+ throw new OpenGeniApiError(502, "retained artifact download URL is unsafe");
3960
+ }
3961
+ }
3962
+ function assertSafeVideoArtifactPlaybackSource(value, expectedArtifactId) {
3963
+ if (!value || value.schemaVersion !== 1 || value.artifactId !== expectedArtifactId || value.contentType !== "video/mp4" || value.acceptRanges !== "bytes" || !Number.isSafeInteger(value.sizeBytes) || value.sizeBytes <= 0 || value.sizeBytes > GENERATED_VIDEO_MAX_BYTES || !/^[0-9a-f]{64}$/.test(value.sha256)) {
3964
+ throw new OpenGeniApiError(502, "generated-video playback source is invalid");
3965
+ }
3966
+ assertSafeArtifactDownloadUrl({ url: value.url, expiresAt: value.expiresAt });
3967
+ }
3227
3968
  function parseBoundedContentLength(value) {
3228
3969
  if (value === null) return null;
3229
3970
  if (!/^\d+$/.test(value)) {
@@ -3271,246 +4012,16 @@ async function readBoundedResponseBytes(response, maxBytes, expectedBytes) {
3271
4012
  return bytes;
3272
4013
  }
3273
4014
 
3274
- // src/transcription.ts
3275
- var DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY = {
3276
- enabled: false,
3277
- acceptanceId: null,
3278
- primary: null,
3279
- language: null,
3280
- autoDetectLanguage: false,
3281
- diarization: { enabled: false, maxSpeakers: null },
3282
- retention: { mode: "none", maxDays: null },
3283
- privacy: { allowProviderLogging: false, allowProviderTraining: false },
3284
- fallback: { mode: "disabled", targets: [] },
3285
- cost: { currency: "USD", maxPerHour: null, maxPerMonth: null }
3286
- };
3287
- function resolveWorkspaceVoiceInputEnabled(settings) {
3288
- if (!isRecord(settings)) return null;
3289
- const voiceInput = settings.voiceInput;
3290
- if (isRecord(voiceInput) && typeof voiceInput.enabled === "boolean") {
3291
- return voiceInput.enabled;
3292
- }
3293
- const legacy = settings.transcription;
3294
- return isRecord(legacy) && typeof legacy.enabled === "boolean" ? legacy.enabled : null;
3295
- }
3296
- function resolveWorkspaceTranscriptionPolicy(settings) {
3297
- if (!isRecord(settings)) return cloneDefaultPolicy();
3298
- const candidate = settings.transcription;
3299
- if (!isWorkspaceTranscriptionPolicy(candidate)) return cloneDefaultPolicy();
3300
- return {
3301
- ...candidate,
3302
- primary: candidate.primary ? normalizeTarget(candidate.primary) : null,
3303
- language: candidate.language?.trim() ?? null,
3304
- diarization: { ...candidate.diarization },
3305
- retention: { ...candidate.retention },
3306
- privacy: { ...candidate.privacy },
3307
- fallback: {
3308
- mode: candidate.fallback.mode,
3309
- targets: candidate.fallback.targets.map(normalizeTarget)
3310
- },
3311
- cost: { ...candidate.cost }
3312
- };
3313
- }
3314
- function authorizeTranscriptionAdapter(policy, descriptor, selection = { kind: "primary" }) {
3315
- if (!isWorkspaceTranscriptionPolicy(policy)) {
3316
- return { authorized: false, reason: "unaccepted" };
3317
- }
3318
- if (!policy.enabled) return { authorized: false, reason: "disabled" };
3319
- if (!policy.acceptanceId) return { authorized: false, reason: "unaccepted" };
3320
- let target;
3321
- if (selection.kind === "primary") {
3322
- target = policy.primary;
3323
- } else {
3324
- if (policy.fallback.mode !== "explicit") {
3325
- return { authorized: false, reason: "fallback_disabled" };
3326
- }
3327
- target = policy.fallback.targets[selection.index];
3328
- if (!target) return { authorized: false, reason: "fallback_unaccepted" };
3329
- }
3330
- if (!target) return { authorized: false, reason: "target_missing" };
3331
- const acceptedTarget = normalizeTarget(target);
3332
- if (acceptedTarget.provider !== descriptor.provider) {
3333
- return { authorized: false, reason: "provider_mismatch" };
3334
- }
3335
- if (acceptedTarget.model !== descriptor.model) {
3336
- return { authorized: false, reason: "model_mismatch" };
3337
- }
3338
- if (acceptedTarget.credentialMode !== descriptor.credentialMode) {
3339
- return { authorized: false, reason: "credential_mode_mismatch" };
3340
- }
3341
- if (acceptedTarget.region !== descriptor.region) {
3342
- return { authorized: false, reason: "region_mismatch" };
3343
- }
3344
- return {
3345
- authorized: true,
3346
- acceptanceId: policy.acceptanceId,
3347
- target: acceptedTarget,
3348
- selection
3349
- };
3350
- }
3351
- function createTranscriptionSessionRequest(input) {
3352
- const sequenceFloor = input.sequenceFloor ?? 0;
3353
- if (!Number.isSafeInteger(sequenceFloor) || sequenceFloor < 0) return null;
3354
- const authorization = authorizeTranscriptionAdapter(
3355
- input.policy,
3356
- input.adapter.descriptor,
3357
- input.selection
3358
- );
3359
- if (!authorization.authorized) return null;
3360
- return {
3361
- localSessionId: input.localSessionId,
3362
- policyAcceptanceId: authorization.acceptanceId,
3363
- selection: authorization.selection,
3364
- target: { ...authorization.target },
3365
- language: input.policy.language?.trim() ?? null,
3366
- autoDetectLanguage: input.policy.autoDetectLanguage,
3367
- diarization: { ...input.policy.diarization },
3368
- retention: { ...input.policy.retention },
3369
- privacy: { ...input.policy.privacy },
3370
- cost: { ...input.policy.cost },
3371
- sequenceFloor
3372
- };
3373
- }
3374
- function cloneDefaultPolicy() {
3375
- return {
3376
- ...DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
3377
- diarization: { ...DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY.diarization },
3378
- retention: { ...DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY.retention },
3379
- privacy: { ...DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY.privacy },
3380
- fallback: { mode: "disabled", targets: [] },
3381
- cost: { ...DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY.cost }
3382
- };
3383
- }
3384
- function isWorkspaceTranscriptionPolicy(value) {
3385
- if (!isRecord(value) || typeof value.enabled !== "boolean") return false;
3386
- if (!hasOnlyKeys(value, [
3387
- "enabled",
3388
- "acceptanceId",
3389
- "primary",
3390
- "language",
3391
- "autoDetectLanguage",
3392
- "diarization",
3393
- "retention",
3394
- "privacy",
3395
- "fallback",
3396
- "cost"
3397
- ])) {
3398
- return false;
3399
- }
3400
- if (!(value.acceptanceId === null || isUuid(value.acceptanceId))) return false;
3401
- if (!(value.primary === null || isTarget(value.primary))) return false;
3402
- if (!(value.language === null || isBoundedString(value.language, 64))) return false;
3403
- if (typeof value.autoDetectLanguage !== "boolean") return false;
3404
- if (!isRecord(value.diarization) || !hasOnlyKeys(value.diarization, ["enabled", "maxSpeakers"]) || typeof value.diarization.enabled !== "boolean" || !(value.diarization.maxSpeakers === null || isBoundedInteger(value.diarization.maxSpeakers, 100) && value.diarization.maxSpeakers >= 2)) {
3405
- return false;
3406
- }
3407
- if (!value.diarization.enabled && value.diarization.maxSpeakers !== null) return false;
3408
- if (!isRecord(value.retention) || !hasOnlyKeys(value.retention, ["mode", "maxDays"])) {
3409
- return false;
3410
- }
3411
- if (value.retention.mode !== "none" && value.retention.mode !== "provider-policy") return false;
3412
- if (!(value.retention.maxDays === null || isBoundedInteger(value.retention.maxDays, 3650))) {
3413
- return false;
3414
- }
3415
- if (!isRecord(value.privacy) || !hasOnlyKeys(value.privacy, ["allowProviderLogging", "allowProviderTraining"]) || typeof value.privacy.allowProviderLogging !== "boolean" || typeof value.privacy.allowProviderTraining !== "boolean") {
3416
- return false;
3417
- }
3418
- if (!isRecord(value.fallback) || !hasOnlyKeys(value.fallback, ["mode", "targets"])) {
3419
- return false;
3420
- }
3421
- if (value.fallback.mode !== "disabled" && value.fallback.mode !== "explicit") return false;
3422
- if (!Array.isArray(value.fallback.targets) || value.fallback.targets.length > 8 || !value.fallback.targets.every(isTarget)) {
3423
- return false;
3424
- }
3425
- if (value.fallback.mode === "disabled" && value.fallback.targets.length !== 0) return false;
3426
- if (value.fallback.mode === "explicit" && value.fallback.targets.length === 0) return false;
3427
- if (!isRecord(value.cost) || !hasOnlyKeys(value.cost, ["currency", "maxPerHour", "maxPerMonth"]) || value.cost.currency !== "USD") {
3428
- return false;
3429
- }
3430
- if (!isNullableBoundedNumber(value.cost.maxPerHour, 1e4)) return false;
3431
- if (!isNullableBoundedNumber(value.cost.maxPerMonth, 1e6)) return false;
3432
- if (value.enabled && (!value.acceptanceId || !value.primary)) return false;
3433
- if (value.enabled && !value.autoDetectLanguage && value.language === null) return false;
3434
- if (value.autoDetectLanguage && value.language !== null) return false;
3435
- const targets = [value.primary, ...value.fallback.targets].filter(
3436
- (target) => target !== null
3437
- );
3438
- if (new Set(targets.map(targetKey)).size !== targets.length) return false;
3439
- return true;
3440
- }
3441
- function targetKey(target) {
3442
- return [
3443
- target.provider.trim(),
3444
- target.model?.trim() ?? "",
3445
- target.credentialMode,
3446
- target.credentialConnectionId ?? "",
3447
- target.region?.trim() ?? ""
3448
- ].join("\0");
3449
- }
3450
- function isTarget(value) {
3451
- if (!isRecord(value)) return false;
3452
- if (!hasOnlyKeys(value, ["provider", "model", "credentialMode", "credentialConnectionId", "region"])) {
3453
- return false;
3454
- }
3455
- if (!isBoundedString(value.provider, 128)) return false;
3456
- if (!(value.model === null || isBoundedString(value.model, 256))) return false;
3457
- if (value.credentialMode !== "managed" && value.credentialMode !== "byok") return false;
3458
- if (value.provider.trim() === "azure-speech" && value.credentialMode !== "byok") return false;
3459
- if (!(value.credentialConnectionId === null || isUuid(value.credentialConnectionId))) {
3460
- return false;
3461
- }
3462
- if (!(value.region === null || isBoundedString(value.region, 128))) return false;
3463
- if (value.credentialMode === "byok" && value.credentialConnectionId === null) return false;
3464
- if (value.credentialMode === "managed" && value.credentialConnectionId !== null) return false;
3465
- return true;
3466
- }
3467
- function normalizeTarget(target) {
3468
- return {
3469
- provider: target.provider.trim(),
3470
- model: target.model?.trim() ?? null,
3471
- credentialMode: target.credentialMode,
3472
- credentialConnectionId: target.credentialConnectionId,
3473
- region: target.region?.trim() ?? null
3474
- };
3475
- }
3476
- function isRecord(value) {
3477
- return typeof value === "object" && value !== null;
3478
- }
3479
- function hasOnlyKeys(value, keys) {
3480
- const accepted = new Set(keys);
3481
- return Object.keys(value).every((key) => accepted.has(key));
3482
- }
3483
- function isBoundedString(value, maximum) {
3484
- return typeof value === "string" && value.trim().length > 0 && value.length <= maximum;
3485
- }
3486
- function isUuid(value) {
3487
- return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
3488
- }
3489
- function isBoundedInteger(value, maximum) {
3490
- return Number.isInteger(value) && value >= 0 && value <= maximum;
3491
- }
3492
- function isNullableBoundedNumber(value, maximum) {
3493
- return value === null || typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= maximum;
3494
- }
3495
-
3496
4015
  export {
3497
4016
  parseSseStream,
3498
4017
  streamSessionEvents,
3499
4018
  streamWorkspaceControlEvents,
3500
- DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
3501
- SESSION_EVENT_TYPES,
3502
- KNOWN_PERMISSIONS,
3503
- OPENGENI_API_CONTRACT_REVISION,
3504
- OPENGENI_API_CONTRACT_HEADER,
3505
- OPENGENI_CORRELATION_HEADER,
3506
- RETAINED_OUTPUT_DEFAULT_PAGE_BYTES,
3507
- RETAINED_OUTPUT_MAX_PAGE_BYTES,
3508
- KNOWN_USAGE_EVENT_TYPES,
3509
- OpenGeniClient,
3510
- DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
3511
- resolveWorkspaceVoiceInputEnabled,
3512
- resolveWorkspaceTranscriptionPolicy,
3513
- authorizeTranscriptionAdapter,
3514
- createTranscriptionSessionRequest
4019
+ parseRetainedGeneratedImageReference,
4020
+ generatedImageSandboxPathMatches,
4021
+ parseGeneratedImageReceipt,
4022
+ parseRetainedGeneratedVideoReference,
4023
+ parseGeneratedVideoReceipt,
4024
+ parseMediaGenerationResult,
4025
+ OpenGeniClient
3515
4026
  };
3516
- //# sourceMappingURL=chunk-MBGBLVUV.js.map
4027
+ //# sourceMappingURL=chunk-ILQZR5N6.js.map