@opengeni/sdk 0.36.0 → 0.37.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/src/index.ts CHANGED
@@ -27,6 +27,56 @@ export { parseSseStream } from "./sse";
27
27
  export type { SseMessage } from "./sse";
28
28
  export { normalizeMcpOutput } from "./mcp-output";
29
29
  export type { NormalizedMcpOutput } from "./mcp-output";
30
+ export {
31
+ CodexRealtimeMicrophoneError,
32
+ acquireCodexRealtimeMicrophone,
33
+ codexRealtimeMicrophoneHealthy,
34
+ startCodexRealtimeWebrtc,
35
+ } from "./codex-realtime";
36
+ export type {
37
+ AcquireCodexRealtimeMicrophoneOptions,
38
+ CodexRealtimeAudibleOutputState,
39
+ CodexRealtimeConnectionHealth,
40
+ CodexRealtimeMicrophoneErrorCode,
41
+ CodexRealtimeNegotiator,
42
+ CodexRealtimeWebrtcSession,
43
+ StartCodexRealtimeWebrtcOptions,
44
+ } from "./codex-realtime";
45
+ export {
46
+ CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
47
+ contextAppendChunks,
48
+ createCodexRealtimeV3Bridge,
49
+ encodeCodexRealtimeV3DelegationContextAppend,
50
+ encodeCodexRealtimeV3SessionContextAppend,
51
+ parseCodexRealtimeV3Event,
52
+ } from "./codex-realtime-v3";
53
+ export type {
54
+ CodexRealtimeV3Bridge,
55
+ CodexRealtimeV3BridgeOptions,
56
+ CodexRealtimeV3BridgeSnapshot,
57
+ CodexRealtimeV3ContextAppendChannel,
58
+ CodexRealtimeV3DelegationContextAppend,
59
+ CodexRealtimeV3Event,
60
+ CodexRealtimeV3ParseFailure,
61
+ CodexRealtimeV3ParseResult,
62
+ CodexRealtimeV3SessionContextAppend,
63
+ } from "./codex-realtime-v3";
64
+ export { createCodexRealtimeController } from "./codex-realtime-controller";
65
+ export type {
66
+ CodexRealtimeController,
67
+ CodexRealtimeControllerClient,
68
+ CodexRealtimeDiagnostic,
69
+ CodexRealtimeDiagnosticKind,
70
+ CodexRealtimeControllerSnapshot,
71
+ CodexRealtimeControllerStatus,
72
+ CodexRealtimeMicrophoneState,
73
+ CodexRealtimeOwnerStorage,
74
+ CreateCodexRealtimeControllerOptions,
75
+ RealtimeControllerTransportStarter,
76
+ } from "./codex-realtime-controller";
77
+ export { createGatewayRealtimeTransportStarter } from "./gateway-realtime-transport";
78
+ export { projectSessionRealtimeLifecycle } from "./codex-realtime-lifecycle";
79
+ export type { SessionRealtimeLifecycleProjection } from "./codex-realtime-lifecycle";
30
80
  // Desktop (noVNC) transport contract — pure, zero-dep (the RFB import lives in
31
81
  // @opengeni/react). URL assembler + connection state machine + rotation fence.
32
82
  export { desktopSocketUrl, nextDesktopState, applyUrlRotation } from "./desktop";
@@ -169,10 +219,12 @@ export {
169
219
  } from "./types";
170
220
  export type {
171
221
  AccessContext,
222
+ ActivateCodexRealtimeConnectionRequest,
172
223
  AccessGrant,
173
224
  AccountGrant,
174
225
  AccountRole,
175
226
  AddWorkspaceMemberRequest,
227
+ BeginSessionRealtimeRequest,
176
228
  AgentMessageCompletedPayload,
177
229
  AgentTextDeltaPayload,
178
230
  AgentToolCallCreatedPayload,
@@ -215,6 +267,14 @@ export type {
215
267
  ClientConfig,
216
268
  ClientVoiceInputConfig,
217
269
  ClientModel,
270
+ CodexRealtimeVoice,
271
+ CodexRealtimeWebrtcRequest,
272
+ CodexRealtimeWebrtcResponse,
273
+ CodexRealtimeWebrtcVersion,
274
+ GatewayRealtimeConnectRequest,
275
+ GatewayRealtimeConnectResponse,
276
+ GatewayRealtimeInitialItem,
277
+ EndSessionRealtimeRequest,
218
278
  ModelAvailabilityV1,
219
279
  ModelBillingAttributionV1,
220
280
  ModelCapabilitiesV1,
@@ -224,8 +284,16 @@ export type {
224
284
  ModelCredentialSourceV1,
225
285
  ModelPricingScheduleV1,
226
286
  ModelPricingV1,
287
+ RenewSessionRealtimeRequest,
288
+ SessionRealtimeEndReason,
289
+ SessionRealtimeMode,
290
+ SessionRealtimeModel,
291
+ SessionRealtimeMutationResponse,
292
+ SessionRealtimeState,
227
293
  WorkspaceModelCatalogModel,
228
294
  WorkspaceModelCatalogResponse,
295
+ WorkspaceRealtimeModelCatalogItem,
296
+ WorkspaceRealtimeModelCatalogResponse,
229
297
  CodexAccount,
230
298
  CodexAccountOverview,
231
299
  CodexAccountsResponse,
@@ -261,6 +329,8 @@ export type {
261
329
  CreateCapabilityCatalogItemRequest,
262
330
  OpenGeniSlackBotInstallRequest,
263
331
  OpenGeniSlackBotInstallStart,
332
+ SlackReactionChannel,
333
+ SlackReactionChannelListResponse,
264
334
  CreateConnectionRequest,
265
335
  CreateCheckoutRequest,
266
336
  CreateCheckoutResponse,
@@ -535,6 +605,7 @@ export type {
535
605
  UpdateWorkspaceMemberRequest,
536
606
  UpdateWorkspaceRequest,
537
607
  UpdateWorkspaceSettingsRequest,
608
+ WorkspaceSlackReactionSummonSettings,
538
609
  TranscribeAudioResponse,
539
610
  UploadFileInput,
540
611
  UsageEvent,
package/src/types.ts CHANGED
@@ -5,6 +5,210 @@ import type { WorkspaceTranscriptionPolicy } from "./transcription";
5
5
  // publishable on its own; `test/contract-parity.test.ts` pins these types to
6
6
  // the contracts package so drift fails the gate instead of shipping.
7
7
 
8
+ export type CodexRealtimeWebrtcVersion = "v3";
9
+ export type CodexRealtimeVoice =
10
+ | "juniper"
11
+ | "maple"
12
+ | "spruce"
13
+ | "ember"
14
+ | "vale"
15
+ | "breeze"
16
+ | "arbor"
17
+ | "sol"
18
+ | "cove";
19
+
20
+ export type CodexRealtimeWebrtcRequest = {
21
+ realtimeId: string;
22
+ operationId: string;
23
+ browserInstanceId: string;
24
+ ownerKey: string;
25
+ expectedVersion: number;
26
+ expectedConnectionEpoch: number;
27
+ rotate: boolean;
28
+ browserActivation?: "required" | undefined;
29
+ sdp: string;
30
+ version: CodexRealtimeWebrtcVersion;
31
+ instructions?: string | undefined;
32
+ voice?: CodexRealtimeVoice | undefined;
33
+ };
34
+
35
+ export type CodexRealtimeWebrtcResponse = {
36
+ sdp: string;
37
+ version: CodexRealtimeWebrtcVersion;
38
+ model: "gpt-live-1-boulder-alpha";
39
+ connectionId: string;
40
+ connectionEpoch: number;
41
+ startupFenceSequence: number;
42
+ modeVersion: number;
43
+ replay: boolean;
44
+ };
45
+
46
+ export type GatewayRealtimeConnectRequest = {
47
+ realtimeId: string;
48
+ operationId: string;
49
+ browserInstanceId: string;
50
+ ownerKey: string;
51
+ expectedVersion: number;
52
+ expectedConnectionEpoch: number;
53
+ rotate: boolean;
54
+ };
55
+
56
+ export type GatewayRealtimeInitialItem = {
57
+ role: "user" | "developer" | "assistant";
58
+ text: string;
59
+ };
60
+
61
+ export type GatewayRealtimeConnectResponse = {
62
+ token: string;
63
+ url: string;
64
+ upstreamModelId: string;
65
+ expiresAt: number | null;
66
+ connectionId: string;
67
+ connectionEpoch: number;
68
+ startupFenceSequence: number;
69
+ modeVersion: number;
70
+ initialItems: GatewayRealtimeInitialItem[];
71
+ instructions: string;
72
+ replay: false;
73
+ };
74
+
75
+ export type ActivateCodexRealtimeConnectionRequest = {
76
+ operationId: string;
77
+ browserInstanceId: string;
78
+ ownerKey: string;
79
+ connectionEpoch: number;
80
+ expectedVersion: number;
81
+ expectedConnectionEpoch: number;
82
+ };
83
+
84
+ export type SessionRealtimeLedgerDirection = "provider_in" | "provider_out";
85
+ export type SessionRealtimeLedgerKind =
86
+ | "user_transcript"
87
+ | "assistant_transcript"
88
+ | "delegation_call"
89
+ | "delegation_progress"
90
+ | "delegation_result"
91
+ | "interruption"
92
+ | "session_update"
93
+ | "error";
94
+
95
+ export type SessionRealtimeLedgerEntry = {
96
+ id: string;
97
+ realtimeId: string;
98
+ operationId: string;
99
+ connectionEpoch: number;
100
+ sequence: number;
101
+ direction: SessionRealtimeLedgerDirection;
102
+ kind: SessionRealtimeLedgerKind;
103
+ role: "user" | "assistant" | null;
104
+ providerEventId: string | null;
105
+ delegationItemId: string | null;
106
+ sourceUpdateId: string | null;
107
+ historyItemId: string | null;
108
+ turnId: string | null;
109
+ text: string | null;
110
+ payload: Record<string, unknown>;
111
+ clientAckedAt: string | null;
112
+ providerAckedAt: string | null;
113
+ createdAt: string;
114
+ updatedAt: string;
115
+ };
116
+
117
+ export type SessionRealtimeInboundEntry = {
118
+ operationId: string;
119
+ kind: Exclude<
120
+ SessionRealtimeLedgerKind,
121
+ "delegation_progress" | "delegation_result" | "session_update"
122
+ >;
123
+ role?: "user" | "assistant" | null | undefined;
124
+ providerEventId?: string | null | undefined;
125
+ delegationItemId?: string | null | undefined;
126
+ text?: string | null | undefined;
127
+ payload?: Record<string, unknown> | undefined;
128
+ };
129
+
130
+ export type SyncSessionRealtimeLedgerRequest = {
131
+ browserInstanceId: string;
132
+ ownerKey: string;
133
+ expectedVersion: number;
134
+ connectionId: string;
135
+ connectionEpoch: number;
136
+ entries?: SessionRealtimeInboundEntry[] | undefined;
137
+ clientAckThroughSequence?: number | null | undefined;
138
+ providerAckSequences?: number[] | undefined;
139
+ providerStarted?:
140
+ | { providerSessionId: string; providerEventId?: string | null | undefined }
141
+ | undefined;
142
+ };
143
+
144
+ export type SyncSessionRealtimeLedgerResponse = {
145
+ accepted: Array<{ entry: SessionRealtimeLedgerEntry; replay: boolean }>;
146
+ outbound: SessionRealtimeLedgerEntry[];
147
+ };
148
+
149
+ export type SessionRealtimeModel =
150
+ | "gpt-live-1-boulder-alpha"
151
+ | "opengeni-gateway/openai/gpt-realtime-2.1"
152
+ | "opengeni-gateway/openai/gpt-realtime-mini"
153
+ | "opengeni-gateway/xai/grok-voice-think-fast-2.0"
154
+ | "workspace-gateway/openai/gpt-realtime-2.1"
155
+ | "workspace-gateway/openai/gpt-realtime-mini"
156
+ | "workspace-gateway/xai/grok-voice-think-fast-2.0";
157
+
158
+ export type WorkspaceRealtimeModelCatalogItem = {
159
+ id: SessionRealtimeModel;
160
+ label: string;
161
+ provider: "OpenGeni" | "Connected Codex" | "Your Gateway";
162
+ description: string;
163
+ available: boolean;
164
+ unavailableReason: string | null;
165
+ recommended: boolean;
166
+ };
167
+
168
+ export type WorkspaceRealtimeModelCatalogResponse = {
169
+ models: WorkspaceRealtimeModelCatalogItem[];
170
+ };
171
+ export type SessionRealtimeState = "active" | "ended";
172
+ export type SessionRealtimeEndReason = "user_stop" | "browser_unload" | "lease_expired";
173
+
174
+ export type SessionRealtimeMode = {
175
+ id: string;
176
+ sessionId: string;
177
+ operationId: string;
178
+ browserInstanceId: string;
179
+ model: SessionRealtimeModel;
180
+ state: SessionRealtimeState;
181
+ version: number;
182
+ connectionEpoch: number;
183
+ leaseExpiresAt: string;
184
+ lastHeartbeatAt: string;
185
+ startedAt: string;
186
+ endedAt: string | null;
187
+ endReason: SessionRealtimeEndReason | null;
188
+ };
189
+
190
+ export type BeginSessionRealtimeRequest = {
191
+ operationId: string;
192
+ browserInstanceId: string;
193
+ ownerKey: string;
194
+ model: SessionRealtimeModel;
195
+ };
196
+
197
+ export type RenewSessionRealtimeRequest = {
198
+ browserInstanceId: string;
199
+ ownerKey: string;
200
+ expectedVersion: number;
201
+ };
202
+
203
+ export type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {
204
+ reason: Extract<SessionRealtimeEndReason, "user_stop" | "browser_unload">;
205
+ };
206
+
207
+ export type SessionRealtimeMutationResponse = {
208
+ mode: SessionRealtimeMode;
209
+ replay: boolean;
210
+ };
211
+
8
212
  export type SessionStatus =
9
213
  | "queued"
10
214
  | "running"
@@ -228,7 +432,7 @@ export type AcknowledgeStreamResponse = {
228
432
  export type ViewerHeartbeatRequest = { leaseEpoch: number };
229
433
  export type ViewerHeartbeatResponse = { alive: boolean };
230
434
 
231
- export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
435
+ export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
232
436
  export type LatencyMode = "standard" | "priority" | "fast";
233
437
  export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
234
438
  export type GitCredentialBindingId = string;
@@ -614,6 +818,8 @@ export type Session = {
614
818
  // Per-session agent persona/system instructions supplied at create; null when
615
819
  // the session carried none. Org-visible metadata, never a timeline event.
616
820
  instructions: string | null;
821
+ /** Immutable normalized prompt-policy role; distinct from membership roles. */
822
+ policyRole: string | null;
617
823
  resources: ResourceRef[];
618
824
  skills: SessionSkill[];
619
825
  tools: ToolRef[];
@@ -841,6 +1047,8 @@ export const SESSION_EVENT_TYPES = [
841
1047
  // Defensive bounded projection for malformed/legacy oversized envelopes.
842
1048
  "session.event.envelope_omitted",
843
1049
  "session.status.changed",
1050
+ "session.realtime.started",
1051
+ "session.realtime.ended",
844
1052
  "session.requiresAction",
845
1053
  "session.humanInput.requested",
846
1054
  "session.context.compaction.requested",
@@ -1692,7 +1900,9 @@ export type CreateSessionRequest = {
1692
1900
  // projection before OpenGeni admits the initial turn. Replays must retain the
1693
1901
  // same UUID and idempotency key.
1694
1902
  requestedSessionId?: string | undefined;
1695
- initialMessage: string;
1903
+ initialMessage?: string | undefined;
1904
+ /** Create an idle session shell so realtime voice can be the first interaction. */
1905
+ startMode?: "realtime" | undefined;
1696
1906
  /** System instructions scoped to the initial turn; never visible timeline text. */
1697
1907
  turnInstructions?: string | undefined;
1698
1908
  // Per-session agent persona/system instructions (org-visible metadata, not a
@@ -1700,6 +1910,8 @@ export type CreateSessionRequest = {
1700
1910
  // how a host supplies per-agent-type prompts without leaking them into the
1701
1911
  // user-visible timeline. Trimmed, non-empty, max 32768 chars.
1702
1912
  instructions?: string | undefined;
1913
+ /** Immutable normalized prompt-policy role; distinct from membership roles. */
1914
+ policyRole?: string | undefined;
1703
1915
  resources?: ResourceRef[] | undefined;
1704
1916
  /** Inline skills fixed onto this session; omitted children inherit them. */
1705
1917
  skills?: SessionSkill[] | undefined;
@@ -1898,6 +2110,11 @@ export type ModelCapabilitiesV1 = {
1898
2110
  responsesWebSocket: ModelCapabilityStateV1;
1899
2111
  realtimeAudio: ModelCapabilityStateV1;
1900
2112
  };
2113
+ promptCaching?:
2114
+ | (ModelCapabilityStateV1 & {
2115
+ mode: "implicit" | "automatic" | "none";
2116
+ })
2117
+ | undefined;
1901
2118
  latencyModes: Array<{
1902
2119
  id: "standard" | "priority" | "fast";
1903
2120
  upstream: ModelCapabilitySupportV1;
@@ -1946,6 +2163,7 @@ export type ClientModel = {
1946
2163
  provider: string;
1947
2164
  providerLabel: string;
1948
2165
  api: "responses" | "chat";
2166
+ source?: "opengeni" | "codex" | "workspace_gateway" | undefined;
1949
2167
  contextWindowTokens?: number | undefined;
1950
2168
  schemaVersion?: 1 | undefined;
1951
2169
  aliases?: string[] | undefined;
@@ -2157,7 +2375,9 @@ export type CodexAccountOverview = {
2157
2375
  };
2158
2376
 
2159
2377
  /** Independently settled live overview keyed by workspace credential id. */
2160
- export type CodexOverviewResponse = { accounts: Record<string, CodexAccountOverview> };
2378
+ export type CodexOverviewResponse = {
2379
+ accounts: Record<string, CodexAccountOverview>;
2380
+ };
2161
2381
 
2162
2382
  export type CodexAllocatorUpdate = {
2163
2383
  allocatorEnabled: boolean;
@@ -2360,9 +2580,27 @@ export type WorkspaceSettings = {
2360
2580
  maxNestedAgentDepth?: number | null | undefined;
2361
2581
  /** Default for new Codex sessions; absent ⇒ remote_v2. */
2362
2582
  codexCompactionDefault?: "remote_v2" | "portable" | undefined;
2583
+ slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
2363
2584
  [key: string]: unknown;
2364
2585
  };
2365
2586
 
2587
+ export type WorkspaceSlackReactionSummonSettings = {
2588
+ enabled: boolean;
2589
+ emoji: string;
2590
+ channelPolicy: { mode: "bot_member" } | { mode: "allowlist"; channelIds: string[] };
2591
+ };
2592
+
2593
+ export type SlackReactionChannel = {
2594
+ id: string;
2595
+ name: string | null;
2596
+ isPrivate: boolean;
2597
+ };
2598
+
2599
+ export type SlackReactionChannelListResponse = {
2600
+ channels: SlackReactionChannel[];
2601
+ nextCursor: string | null;
2602
+ };
2603
+
2366
2604
  export type WorkspaceVoiceInputSettings = {
2367
2605
  enabled: boolean;
2368
2606
  };
@@ -2373,6 +2611,7 @@ export type UpdateWorkspaceSettingsRequest = {
2373
2611
  transcription?: WorkspaceTranscriptionPolicy | undefined;
2374
2612
  maxNestedAgentDepth?: number | null | undefined;
2375
2613
  codexCompactionDefault?: "remote_v2" | "portable" | undefined;
2614
+ slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
2376
2615
  [key: string]: unknown;
2377
2616
  };
2378
2617
 
@@ -2676,6 +2915,8 @@ export type SessionControlResponse = {
2676
2915
  effectiveControl: EffectiveSessionControl;
2677
2916
  interruptionCount: number;
2678
2917
  wakeCount: number;
2918
+ cancelledSessionCount: number;
2919
+ cancelledTurnCount: number;
2679
2920
  };
2680
2921
 
2681
2922
  export type WorkspaceInferenceControlResponse = {