@opengeni/sdk 0.37.0 → 0.41.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.
package/README.md CHANGED
@@ -37,6 +37,56 @@ for await (const event of client.streamEvents(workspaceId, session.id)) {
37
37
  }
38
38
  ```
39
39
 
40
+ ## Realtime browser controller (`@opengeni/sdk/realtime`)
41
+
42
+ The public realtime subpath owns the provider-neutral browser controller and
43
+ the existing Codex Live, WebRTC/V3, and AI Gateway transports. It selects the
44
+ transport from the catalog model without changing the backend API, durable
45
+ ledger, delegation, context, or recovery semantics:
46
+
47
+ ```ts
48
+ import { OpenGeniClient } from "@opengeni/sdk";
49
+ import type { SessionRealtimeClientLike } from "@opengeni/sdk/realtime";
50
+
51
+ const client = new OpenGeniClient({ baseUrl: "/opengeni-api" });
52
+ const realtimeClient: SessionRealtimeClientLike = client;
53
+ const catalog = await realtimeClient.getWorkspaceRealtimeModelCatalog(workspaceId);
54
+ const model = catalog.models.find((candidate) => candidate.available)?.id;
55
+ if (!model) throw new Error("No realtime model is available");
56
+
57
+ // Lazy import keeps the base SDK entry safe for server and non-realtime hosts.
58
+ const { createSessionRealtimeController } = await import("@opengeni/sdk/realtime");
59
+ const controller = createSessionRealtimeController({
60
+ client: realtimeClient,
61
+ workspaceId,
62
+ sessionId,
63
+ model,
64
+ remoteAudio,
65
+ });
66
+
67
+ const unsubscribe = controller.subscribe((snapshot) => {
68
+ console.log(snapshot.status, snapshot.microphone, snapshot.diagnostic);
69
+ });
70
+ await controller.start();
71
+
72
+ // Later:
73
+ await controller.stop();
74
+ unsubscribe();
75
+ controller.close();
76
+ ```
77
+
78
+ `SessionRealtimeClientLike` is the exact proxy-friendly backend surface:
79
+ catalog, begin, Codex/Gateway negotiation, activation, heartbeat, ledger sync,
80
+ and end. Existing `OpenGeniClient` methods remain the implementation. Current
81
+ Codex-named controller and transport exports remain available as compatibility
82
+ aliases, but new integrations should use the provider-neutral names.
83
+
84
+ Do not put API credentials in browser bundles. Browser hosts should either use
85
+ the deployment's normal browser authentication or expose these same methods
86
+ through a tenant-scoped, same-origin proxy. The SDK does not move persistence,
87
+ prompt construction, context processing, delegation, or provider credentials
88
+ out of `apps/api`, `apps/worker`, or `packages/db`.
89
+
40
90
  ## Workspace artifacts
41
91
 
42
92
  Workspace artifacts are generic, immutable HTML publications. The SDK does not
@@ -360,7 +410,7 @@ Every public endpoint group has typed methods:
360
410
  | Scheduled tasks | `createScheduledTask`, `listScheduledTasks`, `getScheduledTask`, `updateScheduledTask`, `pauseScheduledTask`, `resumeScheduledTask`, `triggerScheduledTask`, `deleteScheduledTask`, `listScheduledTaskRuns` |
361
411
  | Variable sets | `listVariable sets`, `createVariable set`, `getVariable set`, `updateVariable set`, `deleteVariable set`, `setVariable setVariable`, `deleteVariable setVariable` (values are write-only) |
362
412
  | Files | `uploadFile`, `beginFileUpload`, `completeFileUpload`, `getFile`, `createFileDownloadUrl` |
363
- | Documents | `createDocumentBase`, `listDocumentBases`, `getDocumentBase`, `addDocument`, `listDocuments`, `reindexDocument`, `searchDocuments` |
413
+ | Documents | `createDocumentBase`, `listDocumentBases`, `getDocumentBase`, `addDocument`, `listDocuments`, `reindexDocument`, `searchDocuments`, `searchKnowledge` (effective organization + workspace + immutable initiating-user personal scope) |
364
414
  | Packs | `listPacks`, `registerPack`, `getPack`, `enablePack`, `deletePack`, `listPackInstallations` |
365
415
  | Capabilities | `listCapabilities`, `createCapability`, `enableCapability`, `disableCapability`, `discoverMcpCapabilities` |
366
416
  | GitHub | `getGitHubApp`, `githubConnectUrl`, `listGitHubRepositories`, `syncGitHubRepositories`, `createGitHubAppManifest` |
@@ -263,6 +263,7 @@ async function sleep2(delayMs, signal) {
263
263
  }
264
264
 
265
265
  // src/types.ts
266
+ var DEFAULT_FILE_RESOURCE_MOUNT_ROOT = ".opengeni/files";
266
267
  var SESSION_EVENT_TYPES = [
267
268
  "session.created",
268
269
  // Defensive bounded projection for malformed/legacy oversized envelopes.
@@ -1517,10 +1518,13 @@ var OpenGeniClient = class {
1517
1518
  return await this.requestJson("GET", `/v1/workspaces/${workspaceId}`);
1518
1519
  }
1519
1520
  /** Read-time, secret-safe inventory of policy heads and visible workspace knowledge. */
1520
- async getWorkspaceState(workspaceId) {
1521
+ async getWorkspaceState(workspaceId, options = {}) {
1522
+ const params = new URLSearchParams();
1523
+ if (options.attemptId) params.set("attemptId", options.attemptId);
1524
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1521
1525
  return await this.requestJson(
1522
1526
  "GET",
1523
- `/v1/workspaces/${workspaceId}/workspace-state`
1527
+ `/v1/workspaces/${workspaceId}/workspace-state${query}`
1524
1528
  );
1525
1529
  }
1526
1530
  async updateWorkspace(workspaceId, request) {
@@ -1555,6 +1559,24 @@ var OpenGeniClient = class {
1555
1559
  request
1556
1560
  );
1557
1561
  }
1562
+ /** List the newest immutable onboarding proposals and their inactive policy drafts. */
1563
+ async listWorkspaceInstructionPolicyOnboardingProposals(workspaceId, options = {}) {
1564
+ const params = new URLSearchParams();
1565
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
1566
+ const query = params.toString();
1567
+ return await this.requestJson(
1568
+ "GET",
1569
+ `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals${query ? `?${query}` : ""}`
1570
+ );
1571
+ }
1572
+ /** Create one draft-only proposal against an exact active-policy baseline. */
1573
+ async createWorkspaceInstructionPolicyOnboardingProposal(workspaceId, request) {
1574
+ return await this.requestJson(
1575
+ "POST",
1576
+ `/v1/workspaces/${workspaceId}/instruction-policies/onboarding-proposals`,
1577
+ request
1578
+ );
1579
+ }
1558
1580
  /** Import the stored legacy workspace override as an inactive charter draft. */
1559
1581
  async importLegacyWorkspaceInstructionPolicyDraft(workspaceId, request = {}) {
1560
1582
  return await this.requestJson(
@@ -2335,6 +2357,22 @@ var OpenGeniClient = class {
2335
2357
  );
2336
2358
  return response.connection;
2337
2359
  }
2360
+ async disconnectGoogleDriveConnection(workspaceId, connectionId, request) {
2361
+ const response = await this.requestJson(
2362
+ "DELETE",
2363
+ `/v1/workspaces/${workspaceId}/connections/${connectionId}`,
2364
+ request
2365
+ );
2366
+ return response.connection;
2367
+ }
2368
+ async transitionGoogleDriveLifecycle(workspaceId, connectionId, request) {
2369
+ const response = await this.requestJson(
2370
+ "PATCH",
2371
+ `/v1/workspaces/${workspaceId}/connections/google-drive/${connectionId}/lifecycle`,
2372
+ request
2373
+ );
2374
+ return response.connection;
2375
+ }
2338
2376
  /** Start an OAuth connection flow; redirect the user to the returned `authorizationUrl`. */
2339
2377
  async startConnectionOAuth(workspaceId, request, options = {}) {
2340
2378
  return await this.requestJson(
@@ -3014,6 +3052,7 @@ export {
3014
3052
  parseSseStream,
3015
3053
  streamSessionEvents,
3016
3054
  streamWorkspaceControlEvents,
3055
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
3017
3056
  SESSION_EVENT_TYPES,
3018
3057
  KNOWN_PERMISSIONS,
3019
3058
  OPENGENI_API_CONTRACT_REVISION,
@@ -3029,4 +3068,4 @@ export {
3029
3068
  authorizeTranscriptionAdapter,
3030
3069
  createTranscriptionSessionRequest
3031
3070
  };
3032
- //# sourceMappingURL=chunk-VOQ235WN.js.map
3071
+ //# sourceMappingURL=chunk-DKNW4WMJ.js.map