@opengeni/sdk 1.3.0 → 1.4.2
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 +25 -3
- package/dist/adapters/next.js +2 -2
- package/dist/artifacts.js +4 -4
- package/dist/azure-live-transport.d.ts +32 -0
- package/dist/browser.js +3 -3
- package/dist/chat/index.js +5 -5
- package/dist/{chunk-IB6SUE3R.js → chunk-DTIMLEPB.js} +1 -1
- package/dist/chunk-DTIMLEPB.js.map +1 -0
- package/dist/{chunk-VYCTL62C.js → chunk-GZQSWAKD.js} +1 -1
- package/dist/chunk-GZQSWAKD.js.map +1 -0
- package/dist/{chunk-2UXZUCEZ.js → chunk-JOI7XCG6.js} +110 -9
- package/dist/chunk-JOI7XCG6.js.map +1 -0
- package/dist/{chunk-CREM7YRK.js → chunk-TRUFUTDI.js} +2 -2
- package/dist/{chunk-CNSPJYF6.js → chunk-TX6ED3AP.js} +210 -6
- package/dist/chunk-TX6ED3AP.js.map +1 -0
- package/dist/{chunk-ZBICMU4Z.js → chunk-XIQIV4VL.js} +2 -2
- package/dist/{chunk-G5NZGPTB.js → chunk-XPWH3HKG.js} +2 -2
- package/dist/{chunk-YVH2PH4X.js → chunk-YWLJGEUB.js} +2 -2
- package/dist/{chunk-RSKO3CMZ.js → chunk-ZOSRUR2Q.js} +2 -2
- package/dist/codex-realtime-controller.d.ts +13 -0
- package/dist/codex-realtime-controller.js +3 -1
- package/dist/codex-realtime-v3-wire.d.ts +3 -2
- package/dist/codex-realtime.d.ts +4 -0
- package/dist/core.js +4 -4
- package/dist/document-authority.js +3 -3
- package/dist/editable-artifacts.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +55 -18
- package/dist/index.js.map +1 -1
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.js +248 -2
- package/dist/realtime.js.map +1 -1
- package/dist/session-proxy-client.d.ts +7 -3
- package/dist/session-proxy.d.ts +38 -7
- package/dist/session-proxy.js +2 -2
- package/dist/site.js +3 -3
- package/dist/transcription.d.ts +1 -1
- package/dist/types.d.ts +47 -8
- package/package.json +3 -3
- package/src/azure-live-transport.ts +286 -0
- package/src/codex-realtime-controller.ts +148 -4
- package/src/codex-realtime-v3-wire.ts +4 -3
- package/src/codex-realtime-v3.ts +11 -2
- package/src/codex-realtime.ts +9 -1
- package/src/index.ts +3 -0
- package/src/realtime.ts +15 -6
- package/src/session-proxy-client.ts +7 -3
- package/src/session-proxy.ts +321 -11
- package/src/transcription.ts +3 -0
- package/src/types.ts +49 -5
- package/dist/chunk-2UXZUCEZ.js.map +0 -1
- package/dist/chunk-CNSPJYF6.js.map +0 -1
- package/dist/chunk-IB6SUE3R.js.map +0 -1
- package/dist/chunk-VYCTL62C.js.map +0 -1
- /package/dist/{chunk-CREM7YRK.js.map → chunk-TRUFUTDI.js.map} +0 -0
- /package/dist/{chunk-ZBICMU4Z.js.map → chunk-XIQIV4VL.js.map} +0 -0
- /package/dist/{chunk-G5NZGPTB.js.map → chunk-XPWH3HKG.js.map} +0 -0
- /package/dist/{chunk-YVH2PH4X.js.map → chunk-YWLJGEUB.js.map} +0 -0
- /package/dist/{chunk-RSKO3CMZ.js.map → chunk-ZOSRUR2Q.js.map} +0 -0
package/dist/realtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/realtime.ts"],"sourcesContent":["/**\n * Public, provider-neutral realtime browser SDK.\n *\n * Import this subpath lazily in browser applications. The base `@opengeni/sdk`\n * entry remains free of eager realtime transport initialization.\n */\nimport {\n createCodexRealtimeController,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n type CodexRealtimeController,\n type CodexRealtimeControllerClient,\n type CodexRealtimeControllerSnapshot,\n type CodexRealtimeControllerStatus,\n type CodexRealtimeDiagnostic,\n type CodexRealtimeDiagnosticKind,\n type CodexRealtimeMicrophoneState,\n type CodexRealtimeOwnerStorage,\n type CreateCodexRealtimeControllerOptions,\n type RealtimeControllerTransportStarter,\n} from \"./codex-realtime-controller\";\nimport {\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n} from \"./gateway-realtime-transport\";\nimport type { SessionRealtimeModel, WorkspaceRealtimeModelCatalogResponse } from \"./types\";\n\n/** Exact backend-facing methods required by the batteries-included realtime SDK. */\nexport type SessionRealtimeClientLike = CodexRealtimeControllerClient & {\n getWorkspaceRealtimeModelCatalog(\n workspaceId: string,\n options?: { signal?: AbortSignal | undefined },\n ): Promise<WorkspaceRealtimeModelCatalogResponse>;\n};\n\nexport type SessionRealtimeTransportKind = \"codex\" | \"gateway\" | \"xai-subscription\";\n\n/** Provider-neutral names for the existing, battle-tested controller projection. */\nexport type SessionRealtimeController = CodexRealtimeController;\nexport type SessionRealtimeControllerSnapshot = CodexRealtimeControllerSnapshot;\nexport type SessionRealtimeControllerStatus = CodexRealtimeControllerStatus;\nexport type SessionRealtimeDiagnostic = CodexRealtimeDiagnostic;\nexport type SessionRealtimeDiagnosticKind = CodexRealtimeDiagnosticKind;\nexport type SessionRealtimeMicrophoneState = CodexRealtimeMicrophoneState;\nexport type SessionRealtimeOwnerStorage = CodexRealtimeOwnerStorage;\n\nexport type CreateSessionRealtimeControllerOptions = Omit<\n CreateCodexRealtimeControllerOptions,\n \"client\" | \"model\" | \"ownerStorageNamespace\" | \"startTransport\"\n> & {\n client: CodexRealtimeControllerClient;\n model: SessionRealtimeModel;\n};\n\n/** Select the existing transport without exposing provider mechanics to hosts. */\nexport function sessionRealtimeTransportKind(\n model: SessionRealtimeModel,\n): SessionRealtimeTransportKind {\n if (model === \"gpt-live-1-boulder-alpha\") return \"codex\";\n if (model === \"supergrok/grok-voice-think-fast-2.0\") return \"xai-subscription\";\n return \"gateway\";\n}\n\n/**\n * Compose the exact current controller with its existing Codex Live or AI\n * Gateway transport. Wire, ledger, delegation, recovery, and lifecycle\n * semantics remain owned by the existing implementations below this facade.\n */\nexport function createSessionRealtimeController(\n options: CreateSessionRealtimeControllerOptions,\n): SessionRealtimeController {\n const transport = sessionRealtimeTransportKind(options.model);\n return createCodexRealtimeController({\n ...options,\n ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),\n ...(transport === \"gateway\"\n ? { startTransport: createGatewayRealtimeTransportStarter() }\n : transport === \"xai-subscription\"\n ? { startTransport: createXaiSubscriptionRealtimeTransportStarter() }\n : {}),\n });\n}\n\nexport {\n createCodexRealtimeController,\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n};\nexport type {\n CodexRealtimeController,\n CodexRealtimeControllerClient,\n CodexRealtimeControllerSnapshot,\n CodexRealtimeControllerStatus,\n CodexRealtimeDiagnostic,\n CodexRealtimeDiagnosticKind,\n CodexRealtimeMicrophoneState,\n CodexRealtimeOwnerStorage,\n CreateCodexRealtimeControllerOptions,\n RealtimeControllerTransportStarter,\n};\n\nexport {\n CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,\n projectSessionRealtimeLifecycle,\n} from \"./codex-realtime-controller\";\nexport type { SessionRealtimeLifecycleProjection } from \"./codex-realtime-lifecycle\";\n\nexport {\n CodexRealtimeMicrophoneError,\n acquireCodexRealtimeMicrophone,\n codexRealtimeMicrophoneHealthy,\n startCodexRealtimeWebrtc,\n} from \"./codex-realtime\";\nexport type {\n AcquireCodexRealtimeMicrophoneOptions,\n CodexRealtimeAudibleOutputState,\n CodexRealtimeConnectionHealth,\n CodexRealtimeMicrophoneErrorCode,\n CodexRealtimeNegotiator,\n CodexRealtimeWebrtcSession,\n StartCodexRealtimeWebrtcOptions,\n} from \"./codex-realtime\";\n\nexport {\n CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,\n CODEX_REALTIME_V3_MAX_EVENT_BYTES,\n CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,\n CODEX_REALTIME_V3_MAX_TEXT_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,\n CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,\n contextAppendChunks,\n createCodexRealtimeV3Bridge,\n encodeCodexRealtimeV3DelegationContextAppend,\n encodeCodexRealtimeV3SessionContextAppend,\n parseCodexRealtimeV3Event,\n} from \"./codex-realtime-v3\";\nexport type {\n CodexRealtimeV3Bridge,\n CodexRealtimeV3BridgeFatal,\n CodexRealtimeV3BridgeOptions,\n CodexRealtimeV3BridgeSnapshot,\n CodexRealtimeV3ContextAppendChannel,\n CodexRealtimeV3DelegationContextAppend,\n CodexRealtimeV3Event,\n CodexRealtimeV3ParseFailure,\n CodexRealtimeV3ParseResult,\n CodexRealtimeV3SessionContextAppend,\n} from \"./codex-realtime-v3\";\n\nexport {\n CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,\n CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,\n} from \"./codex-realtime-v3-wire\";\nexport type { CodexRealtimeInitialItem } from \"./codex-realtime-v3-wire\";\n\nexport type {\n ActivateCodexRealtimeConnectionRequest,\n BeginSessionRealtimeRequest,\n CodexRealtimeVoice,\n CodexRealtimeWebrtcRequest,\n CodexRealtimeWebrtcResponse,\n CodexRealtimeWebrtcVersion,\n EndSessionRealtimeRequest,\n GatewayRealtimeConnectRequest,\n GatewayRealtimeConnectResponse,\n GatewayRealtimeInitialItem,\n RenewSessionRealtimeRequest,\n SessionRealtimeEndReason,\n SessionRealtimeLedgerEntry,\n SessionRealtimeMode,\n SessionRealtimeModel,\n SessionRealtimeMutationResponse,\n SessionRealtimeState,\n SyncSessionRealtimeLedgerRequest,\n SyncSessionRealtimeLedgerResponse,\n WorkspaceRealtimeModelCatalogItem,\n WorkspaceRealtimeModelCatalogResponse,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDO,SAAS,6BACd,OAC8B;AAC9B,MAAI,UAAU,2BAA4B,QAAO;AACjD,MAAI,UAAU,sCAAuC,QAAO;AAC5D,SAAO;AACT;AAOO,SAAS,gCACd,SAC2B;AAC3B,QAAM,YAAY,6BAA6B,QAAQ,KAAK;AAC5D,SAAO,8BAA8B;AAAA,IACnC,GAAG;AAAA,IACH,uBAAuB,qCAAqC,QAAQ,KAAK;AAAA,IACzE,GAAI,cAAc,YACd,EAAE,gBAAgB,sCAAsC,EAAE,IAC1D,cAAc,qBACZ,EAAE,gBAAgB,8CAA8C,EAAE,IAClE,CAAC;AAAA,EACT,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/azure-live-transport.ts","../src/realtime.ts"],"sourcesContent":["import { startCodexRealtimeWebrtc, type StartCodexRealtimeWebrtcOptions } from \"./codex-realtime\";\nimport type { RealtimeControllerTransportStarter } from \"./codex-realtime-controller\";\n\ntype Envelope = Record<string, unknown>;\nconst MAX_FRAGMENT_BYTES = 64_000;\n\n/** The most recent speech wins when the user talks for a long time between delegations. */\nfunction takeUtf8Tail(text: string, maxBytes = MAX_FRAGMENT_BYTES): string {\n const encoder = new TextEncoder();\n if (encoder.encode(text).byteLength <= maxBytes) return text;\n let tail = text.slice(-maxBytes);\n while (encoder.encode(tail).byteLength > maxBytes) tail = tail.slice(1);\n return tail;\n}\n\n/** Azure Live has timed transcript fragments, not provider-finalized turns. */\nexport class AzureLiveDataChannel extends EventTarget {\n private pending: {\n role: \"user\" | \"assistant\";\n text: string;\n startMs: number;\n endMs: number;\n } | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n private ordinal = 0;\n private readonly prefix = crypto.randomUUID();\n private closed = false;\n private closeSent = false;\n private providerClosed = false;\n private readonly delegations = new Set<string>();\n // Azure delegations carry no content, so the user's words since the previous\n // delegation become the delegation input.\n private userSinceDelegation = \"\";\n private draining: Promise<void> | null = null;\n private finishDrain: ((error?: Error) => void) | null = null;\n private readonly onOpen = () => this.dispatchEvent(new Event(\"open\"));\n private readonly onClose = () => {\n this.providerClosed = true;\n this.flush();\n this.finishDrain?.();\n this.dispatchEvent(new Event(\"close\"));\n };\n private readonly onError = () => this.dispatchEvent(new Event(\"error\"));\n private readonly onMessage = (event: MessageEvent) => {\n if (typeof event.data !== \"string\" || event.data.length > 1_048_576) return;\n let value: unknown;\n try {\n value = JSON.parse(event.data);\n } catch {\n return;\n }\n if (!value || typeof value !== \"object\") return;\n this.receive(value as Envelope);\n };\n constructor(\n private readonly raw: RTCDataChannel,\n private readonly drainTimeoutMs = 5_000,\n ) {\n super();\n raw.addEventListener(\"open\", this.onOpen);\n raw.addEventListener(\"close\", this.onClose);\n raw.addEventListener(\"error\", this.onError);\n raw.addEventListener(\"message\", this.onMessage);\n }\n get readyState(): RTCDataChannelState {\n return this.closed || this.providerClosed\n ? \"closed\"\n : this.closeSent\n ? \"closing\"\n : this.raw.readyState;\n }\n asRtcDataChannel(): RTCDataChannel {\n return this as unknown as RTCDataChannel;\n }\n private emit(value: Envelope): void {\n if (!this.closed)\n this.dispatchEvent(new MessageEvent(\"message\", { data: JSON.stringify(value) }));\n }\n private flush(): void {\n if (this.timer) clearTimeout(this.timer);\n this.timer = null;\n const pending = this.pending;\n this.pending = null;\n if (!pending?.text) return;\n this.emit({\n type: \"transcript.segment\",\n turn: {\n id: `${this.prefix}:${++this.ordinal}`,\n role: pending.role,\n transcript: pending.text,\n },\n start_ms: pending.startMs,\n end_ms: pending.endMs,\n });\n }\n private receive(value: Envelope): void {\n if (this.closed) return;\n if (\n value.type === \"session.input_transcript.delta\" ||\n value.type === \"session.output_transcript.delta\"\n ) {\n if (\n typeof value.delta !== \"string\" ||\n typeof value.start_ms !== \"number\" ||\n typeof value.end_ms !== \"number\"\n )\n return;\n const role = value.type === \"session.input_transcript.delta\" ? \"user\" : \"assistant\";\n if (role === \"user\")\n this.userSinceDelegation = takeUtf8Tail(this.userSinceDelegation + value.delta);\n if (\n this.pending &&\n (this.pending.role !== role ||\n new TextEncoder().encode(this.pending.text + value.delta).byteLength > MAX_FRAGMENT_BYTES)\n )\n this.flush();\n if (new TextEncoder().encode(value.delta).byteLength > MAX_FRAGMENT_BYTES) {\n this.emit({\n type: \"error\",\n error: { message: \"Voice transcript fragment exceeded the supported size\" },\n });\n return;\n }\n this.pending = {\n role,\n text: (this.pending?.text ?? \"\") + value.delta,\n startMs: this.pending?.startMs ?? value.start_ms,\n endMs: value.end_ms,\n };\n // Application grouping only: never present silence as a provider turn boundary.\n if (!this.timer) this.timer = setTimeout(() => this.flush(), 1_000);\n return;\n }\n if (value.type === \"session.delegation.created\") {\n const delegation = value.delegation as Envelope | undefined;\n if (delegation?.target !== \"client\" || typeof delegation.id !== \"string\") return;\n this.delegations.add(delegation.id);\n this.flush();\n const spoken = this.userSinceDelegation.trim();\n this.userSinceDelegation = \"\";\n this.emit({\n type: \"delegation.created\",\n item: {\n id: delegation.id,\n type: \"delegation\",\n target: \"client\",\n content: spoken ? [{ type: \"input_text\", text: spoken }] : [],\n },\n offset_ms: value.offset_ms,\n });\n return;\n }\n if (value.type === \"session.closed\") {\n this.providerClosed = true;\n this.flush();\n this.finishDrain?.();\n return;\n }\n if (\n value.type === \"session.started\" ||\n value.type === \"session.updated\" ||\n value.type === \"error\"\n )\n this.emit(value);\n }\n send(payload: string): void {\n if (this.readyState !== \"open\") throw Error(\"Hosted voice channel is not open\");\n const value = JSON.parse(payload) as Envelope;\n if (value.type !== \"session.context.append\" && value.type !== \"delegation.context.append\")\n throw Error(\"Unsupported hosted voice context event\");\n const content = Array.isArray(value.content)\n ? value.content.map((part) => (typeof part?.text === \"string\" ? part.text : \"\")).join(\"\")\n : \"\";\n // Existing bridge chunks are <=500 UTF-8 bytes, below Live's 500-token bound.\n this.raw.send(\n JSON.stringify({\n type:\n value.channel === \"speakable\" ? \"session.commentary.append\" : \"session.thinking.append\",\n content,\n // Replayed tasks from an earlier provider session are general context.\n delegation_id:\n value.type === \"delegation.context.append\" &&\n typeof value.delegation_item_id === \"string\" &&\n this.delegations.has(value.delegation_item_id)\n ? value.delegation_item_id\n : null,\n }),\n );\n }\n drain(): Promise<void> {\n if (this.draining) return this.draining;\n if (this.providerClosed || this.raw.readyState === \"closed\") {\n this.flush();\n return Promise.resolve();\n }\n if (this.closed || this.raw.readyState !== \"open\") {\n return Promise.reject(new Error(\"Hosted voice close is not confirmed\"));\n }\n const pending = new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.flush();\n this.finishDrain?.(\n new Error(\"Hosted voice is still closing; retry to preserve final speech\"),\n );\n }, this.drainTimeoutMs);\n this.finishDrain = (error) => {\n clearTimeout(timeout);\n this.finishDrain = null;\n if (error) reject(error);\n else resolve();\n };\n if (!this.closeSent) {\n this.closeSent = true;\n try {\n this.raw.send(JSON.stringify({ type: \"session.close\" }));\n } catch {\n this.finishDrain(new Error(\"Hosted voice close could not be sent\"));\n }\n }\n });\n this.draining = pending;\n // An uncertain close remains retryable; never resend the provider mutation.\n void pending.then(\n () => {\n if (this.draining === pending) this.draining = null;\n },\n () => {\n if (this.draining === pending) this.draining = null;\n },\n );\n return pending;\n }\n close(): void {\n if (this.closed) return;\n if (this.timer) clearTimeout(this.timer);\n this.timer = null;\n this.pending = null;\n this.finishDrain?.(new Error(\"Hosted voice channel was disposed before close confirmation\"));\n this.closed = true;\n this.raw.removeEventListener(\"open\", this.onOpen);\n this.raw.removeEventListener(\"close\", this.onClose);\n this.raw.removeEventListener(\"error\", this.onError);\n this.raw.removeEventListener(\"message\", this.onMessage);\n this.dispatchEvent(new Event(\"close\"));\n }\n}\n\nexport function createAzureLiveTransportStarter(\n options: Pick<StartCodexRealtimeWebrtcOptions, \"remoteAudio\" | \"createPeerConnection\"> = {},\n): RealtimeControllerTransportStarter {\n return async (input) => {\n let channel: AzureLiveDataChannel | undefined;\n try {\n const transport = await startCodexRealtimeWebrtc({\n ...input,\n ...options,\n activateRemoteAudio: false,\n expectedModel: \"opengeni-azure/gpt-live-1\",\n onEventsCreated(raw) {\n channel = new AzureLiveDataChannel(raw);\n input.onEventsCreated(channel.asRtcDataChannel());\n },\n negotiate: (request, requestOptions) =>\n input.client.negotiateCodexRealtimeWebrtc(\n input.workspaceId,\n input.sessionId,\n request,\n requestOptions,\n ),\n });\n const events = channel!;\n return {\n ...transport,\n events: events.asRtcDataChannel(),\n drain: () => events.drain(),\n stop() {\n events.close();\n transport.stop();\n },\n };\n } catch (error) {\n channel?.close();\n throw error;\n }\n };\n}\n","import { createAzureLiveTransportStarter } from \"./azure-live-transport\";\n/**\n * Public, provider-neutral realtime browser SDK.\n *\n * Import this subpath lazily in browser applications. The base `@opengeni/sdk`\n * entry remains free of eager realtime transport initialization.\n */\nimport {\n createCodexRealtimeController,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n type CodexRealtimeController,\n type CodexRealtimeControllerClient,\n type CodexRealtimeControllerSnapshot,\n type CodexRealtimeControllerStatus,\n type CodexRealtimeDiagnostic,\n type CodexRealtimeDiagnosticKind,\n type CodexRealtimeMicrophoneState,\n type CodexRealtimeOwnerStorage,\n type CreateCodexRealtimeControllerOptions,\n type RealtimeControllerTransportStarter,\n} from \"./codex-realtime-controller\";\nimport {\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n} from \"./gateway-realtime-transport\";\nimport type { SessionRealtimeModel, WorkspaceRealtimeModelCatalogResponse } from \"./types\";\n\n/** Exact backend-facing methods required by the batteries-included realtime SDK. */\nexport type SessionRealtimeClientLike = CodexRealtimeControllerClient & {\n getWorkspaceRealtimeModelCatalog(\n workspaceId: string,\n options?: { signal?: AbortSignal | undefined },\n ): Promise<WorkspaceRealtimeModelCatalogResponse>;\n};\n\nexport type SessionRealtimeTransportKind = \"codex\" | \"gateway\" | \"xai-subscription\" | \"azure-live\";\n\n/** Provider-neutral names for the existing, battle-tested controller projection. */\nexport type SessionRealtimeController = CodexRealtimeController;\nexport type SessionRealtimeControllerSnapshot = CodexRealtimeControllerSnapshot;\nexport type SessionRealtimeControllerStatus = CodexRealtimeControllerStatus;\nexport type SessionRealtimeDiagnostic = CodexRealtimeDiagnostic;\nexport type SessionRealtimeDiagnosticKind = CodexRealtimeDiagnosticKind;\nexport type SessionRealtimeMicrophoneState = CodexRealtimeMicrophoneState;\nexport type SessionRealtimeOwnerStorage = CodexRealtimeOwnerStorage;\n\nexport type CreateSessionRealtimeControllerOptions = Omit<\n CreateCodexRealtimeControllerOptions,\n \"client\" | \"model\" | \"ownerStorageNamespace\" | \"startTransport\"\n> & {\n client: CodexRealtimeControllerClient;\n model: SessionRealtimeModel;\n};\n\n/** Select the existing transport without exposing provider mechanics to hosts. */\nexport function sessionRealtimeTransportKind(\n model: SessionRealtimeModel,\n): SessionRealtimeTransportKind {\n if (model === \"opengeni-azure/gpt-live-1\") return \"azure-live\";\n if (model === \"gpt-live-1-boulder-alpha\") return \"codex\";\n if (model === \"supergrok/grok-voice-think-fast-2.0\") return \"xai-subscription\";\n return \"gateway\";\n}\n\n/**\n * Compose the exact current controller with its existing Codex Live or AI\n * Gateway transport. Wire, ledger, delegation, recovery, and lifecycle\n * semantics remain owned by the existing implementations below this facade.\n */\nexport function createSessionRealtimeController(\n options: CreateSessionRealtimeControllerOptions,\n): SessionRealtimeController {\n const transport = sessionRealtimeTransportKind(options.model);\n return createCodexRealtimeController({\n ...options,\n ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),\n ...(transport === \"azure-live\"\n ? {\n startTransport: createAzureLiveTransportStarter({\n remoteAudio: options.remoteAudio,\n createPeerConnection: options.createPeerConnection,\n }),\n }\n : transport === \"gateway\"\n ? { startTransport: createGatewayRealtimeTransportStarter() }\n : transport === \"xai-subscription\"\n ? { startTransport: createXaiSubscriptionRealtimeTransportStarter() }\n : {}),\n });\n}\n\nexport {\n createCodexRealtimeController,\n createGatewayRealtimeTransportStarter,\n createXaiSubscriptionRealtimeTransportStarter,\n hasStoredSessionRealtimeOwnerProof,\n sessionRealtimeOwnerStorageKey,\n sessionRealtimeOwnerStorageNamespace,\n};\nexport type {\n CodexRealtimeController,\n CodexRealtimeControllerClient,\n CodexRealtimeControllerSnapshot,\n CodexRealtimeControllerStatus,\n CodexRealtimeDiagnostic,\n CodexRealtimeDiagnosticKind,\n CodexRealtimeMicrophoneState,\n CodexRealtimeOwnerStorage,\n CreateCodexRealtimeControllerOptions,\n RealtimeControllerTransportStarter,\n};\n\nexport {\n CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,\n projectSessionRealtimeLifecycle,\n} from \"./codex-realtime-controller\";\nexport type { SessionRealtimeLifecycleProjection } from \"./codex-realtime-lifecycle\";\n\nexport {\n CodexRealtimeMicrophoneError,\n acquireCodexRealtimeMicrophone,\n codexRealtimeMicrophoneHealthy,\n startCodexRealtimeWebrtc,\n} from \"./codex-realtime\";\nexport type {\n AcquireCodexRealtimeMicrophoneOptions,\n CodexRealtimeAudibleOutputState,\n CodexRealtimeConnectionHealth,\n CodexRealtimeMicrophoneErrorCode,\n CodexRealtimeNegotiator,\n CodexRealtimeWebrtcSession,\n StartCodexRealtimeWebrtcOptions,\n} from \"./codex-realtime\";\n\nexport {\n CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,\n CODEX_REALTIME_V3_MAX_EVENT_BYTES,\n CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,\n CODEX_REALTIME_V3_MAX_TEXT_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_BYTES,\n CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,\n CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,\n contextAppendChunks,\n createCodexRealtimeV3Bridge,\n encodeCodexRealtimeV3DelegationContextAppend,\n encodeCodexRealtimeV3SessionContextAppend,\n parseCodexRealtimeV3Event,\n} from \"./codex-realtime-v3\";\nexport type {\n CodexRealtimeV3Bridge,\n CodexRealtimeV3BridgeFatal,\n CodexRealtimeV3BridgeOptions,\n CodexRealtimeV3BridgeSnapshot,\n CodexRealtimeV3ContextAppendChannel,\n CodexRealtimeV3DelegationContextAppend,\n CodexRealtimeV3Event,\n CodexRealtimeV3ParseFailure,\n CodexRealtimeV3ParseResult,\n CodexRealtimeV3SessionContextAppend,\n} from \"./codex-realtime-v3\";\n\nexport {\n CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,\n CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,\n} from \"./codex-realtime-v3-wire\";\nexport type { CodexRealtimeInitialItem } from \"./codex-realtime-v3-wire\";\n\nexport type {\n ActivateCodexRealtimeConnectionRequest,\n BeginSessionRealtimeRequest,\n CodexRealtimeVoice,\n CodexRealtimeWebrtcRequest,\n CodexRealtimeWebrtcResponse,\n CodexRealtimeWebrtcVersion,\n EndSessionRealtimeRequest,\n GatewayRealtimeConnectRequest,\n GatewayRealtimeConnectResponse,\n GatewayRealtimeInitialItem,\n RenewSessionRealtimeRequest,\n SessionRealtimeEndReason,\n SessionRealtimeLedgerEntry,\n SessionRealtimeMode,\n SessionRealtimeModel,\n SessionRealtimeMutationResponse,\n SessionRealtimeState,\n SyncSessionRealtimeLedgerRequest,\n SyncSessionRealtimeLedgerResponse,\n WorkspaceRealtimeModelCatalogItem,\n WorkspaceRealtimeModelCatalogResponse,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,qBAAqB;AAG3B,SAAS,aAAa,MAAc,WAAW,oBAA4B;AACzE,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,QAAQ,OAAO,IAAI,EAAE,cAAc,SAAU,QAAO;AACxD,MAAI,OAAO,KAAK,MAAM,CAAC,QAAQ;AAC/B,SAAO,QAAQ,OAAO,IAAI,EAAE,aAAa,SAAU,QAAO,KAAK,MAAM,CAAC;AACtE,SAAO;AACT;AAGO,IAAM,uBAAN,cAAmC,YAAY;AAAA,EAsCpD,YACmB,KACA,iBAAiB,KAClC;AACA,UAAM;AAHW;AACA;AAGjB,QAAI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,qCAAqC,QAAQ,KAAK;AAAA,IACzE,GAAI,cAAc,eACd;AAAA,MACE,gBAAgB,gCAAgC;AAAA,QAC9C,aAAa,QAAQ;AAAA,QACrB,sBAAsB,QAAQ;AAAA,MAChC,CAAC;AAAA,IACH,IACA,cAAc,YACZ,EAAE,gBAAgB,sCAAsC,EAAE,IAC1D,cAAc,qBACZ,EAAE,gBAAgB,8CAA8C,EAAE,IAClE,CAAC;AAAA,EACX,CAAC;AACH;","names":[]}
|
|
@@ -11,11 +11,15 @@ export declare class SessionProxySiteHtmlTooLargeError extends Error {
|
|
|
11
11
|
}
|
|
12
12
|
/** Server-only effective grant read; never derive external authority from access/me snapshots. */
|
|
13
13
|
export declare function getSessionProxyWorkspaceGrant(client: Pick<OpenGeniEmbeddingClient, "requestJson">, workspaceId: string, options?: OpenGeniRequestOptions): Promise<AccessGrant>;
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Exact association read. The API reauthorizes the source session on every
|
|
16
|
+
* call. `retained` proves a generated image or video, or a published sandbox
|
|
17
|
+
* file, originated in that session.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getSessionProxyArtifactAssociation(client: Pick<OpenGeniEmbeddingClient, "requestJson">, workspaceId: string, sessionId: string, kind: "editable" | "site" | "retained", artifactId: string, options?: OpenGeniRequestOptions): Promise<{
|
|
16
20
|
sessionId: string;
|
|
17
21
|
artifactId: string;
|
|
18
|
-
kind: "editable" | "site";
|
|
22
|
+
kind: "editable" | "site" | "retained";
|
|
19
23
|
}>;
|
|
20
24
|
/** Authenticated response stream for the server proxy; does not buffer Site HTML. */
|
|
21
25
|
export declare function downloadSessionProxySiteHtml(client: Pick<OpenGeniEmbeddingClient, "requestJsonResponse">, workspaceId: string, artifactId: string, options: {
|
package/dist/session-proxy.d.ts
CHANGED
|
@@ -82,14 +82,21 @@ export type SessionProxyCreateInput = {
|
|
|
82
82
|
export type SessionProxyMessageInput = {
|
|
83
83
|
/** Absent for `create`. */
|
|
84
84
|
sessionId?: string | undefined;
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* `realtime` is live voice: once when a call starts (refuse it, or rotate
|
|
87
|
+
* MCP credentials), and before each batch of finalized transcripts and spoken
|
|
88
|
+
* requests is saved (refuse it, or add `modelContext`).
|
|
89
|
+
*/
|
|
90
|
+
delivery: "create" | "send" | "steer" | "submit" | "realtime";
|
|
86
91
|
};
|
|
87
92
|
/** Server-side additions the host attaches to one forwarded user message or response. */
|
|
88
93
|
export type SessionProxyMessageExtras = {
|
|
89
94
|
/**
|
|
90
95
|
* Model-visible context for this message (current page, time zone, today's
|
|
91
96
|
* date). Placed before any context the browser sent. Not secret. Ignored for
|
|
92
|
-
* approval decisions and human-input responses, which are not new messages
|
|
97
|
+
* approval decisions and human-input responses, which are not new messages,
|
|
98
|
+
* and when a live voice call starts. Keep it stable for the same message:
|
|
99
|
+
* a retried voice entry must carry the same context to be accepted.
|
|
93
100
|
*/
|
|
94
101
|
modelContext?: string | undefined;
|
|
95
102
|
/**
|
|
@@ -157,9 +164,10 @@ export type SessionProxyHandlerOptions = {
|
|
|
157
164
|
createSession?: ((input: SessionProxyCreateInput, context: SessionProxyContext) => CreateSessionRequest | Response | Promise<CreateSessionRequest | Response>) | undefined;
|
|
158
165
|
/**
|
|
159
166
|
* Called before every forwarded user message (send, steer, composer submit,
|
|
160
|
-
* and browser-started create), approval decision,
|
|
161
|
-
*
|
|
162
|
-
*
|
|
167
|
+
* and browser-started create), approval decision, human-input response, and
|
|
168
|
+
* live voice start and transcript save (`delivery: "realtime"`).
|
|
169
|
+
* Return server-owned `modelContext` (messages and voice transcripts only)
|
|
170
|
+
* and MCP credential rotations, or a `Response` to reject the action.
|
|
163
171
|
*/
|
|
164
172
|
beforeForwardMessage?: ((input: SessionProxyMessageInput, context: SessionProxyContext) => SessionProxyMessageExtras | Response | undefined | Promise<SessionProxyMessageExtras | Response | undefined>) | undefined;
|
|
165
173
|
/**
|
|
@@ -174,7 +182,15 @@ export type SessionProxyHandlerOptions = {
|
|
|
174
182
|
basePath?: string | undefined;
|
|
175
183
|
/** Maximum JSON request body. Defaults to 1 MiB. */
|
|
176
184
|
maxBodyBytes?: number | undefined;
|
|
177
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Expose composer file attachments (upload begin/complete, download URL) and
|
|
187
|
+
* the media agents produce in a session: generated images, browser and
|
|
188
|
+
* computer screenshots, published sandbox files, and generated video
|
|
189
|
+
* playback. Workspace-level artifact reads must name their session in the
|
|
190
|
+
* `x-opengeni-session-id` header (`SessionConversation` does this); the proxy
|
|
191
|
+
* runs `authorizeSession` and only forwards an artifact OpenGeni proves that
|
|
192
|
+
* session produced. Defaults to true.
|
|
193
|
+
*/
|
|
178
194
|
files?: boolean | undefined;
|
|
179
195
|
/**
|
|
180
196
|
* Forward composer voice input (`POST .../transcriptions`, one recording per
|
|
@@ -184,6 +200,18 @@ export type SessionProxyHandlerOptions = {
|
|
|
184
200
|
* hide the microphone. Defaults to true.
|
|
185
201
|
*/
|
|
186
202
|
voiceInput?: boolean | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Forward live speech-to-speech voice for existing chats as the resolved
|
|
205
|
+
* user: the voice model catalog and the call lifecycle routes under
|
|
206
|
+
* `.../sessions/{id}/realtime`. Opengeni still requires that user's
|
|
207
|
+
* `sessions:control` permission, binds the call to that user and browser,
|
|
208
|
+
* runs spoken requests as ordinary steers of the chat, and meters
|
|
209
|
+
* deployment-funded voice against the organization's credits. The stock
|
|
210
|
+
* composer shows the voice button only when a voice model is available.
|
|
211
|
+
* `false` reports `realtimeVoice: false` in the client config so stock UIs
|
|
212
|
+
* hide it, and refuses the routes. Defaults to true.
|
|
213
|
+
*/
|
|
214
|
+
realtimeVoice?: boolean | undefined;
|
|
187
215
|
/**
|
|
188
216
|
* Let the browser read a file from the session's sandbox (`POST .../fs/read`)
|
|
189
217
|
* so `sandbox:` links in agent replies can be downloaded. Only `path`,
|
|
@@ -240,7 +268,10 @@ export type SessionProxyHandlerOptions = {
|
|
|
240
268
|
* settings decide which models end users see.
|
|
241
269
|
*/
|
|
242
270
|
modelSelection?: boolean | undefined;
|
|
243
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* SSE heartbeat interval. Defaults to 5 seconds, under Bun.serve's default
|
|
273
|
+
* 10-second `idleTimeout`, which otherwise closes a quiet event stream.
|
|
274
|
+
*/
|
|
244
275
|
heartbeatMs?: number | undefined;
|
|
245
276
|
};
|
|
246
277
|
/**
|
package/dist/session-proxy.js
CHANGED
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
downloadSessionProxySiteHtml,
|
|
7
7
|
getSessionProxyArtifactAssociation,
|
|
8
8
|
getSessionProxyWorkspaceGrant
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TX6ED3AP.js";
|
|
10
10
|
import "./chunk-UM4ZXXJR.js";
|
|
11
11
|
import "./chunk-U6CV2SXO.js";
|
|
12
12
|
import "./chunk-APXVSSSY.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-DTIMLEPB.js";
|
|
14
14
|
import "./chunk-V6GIY62B.js";
|
|
15
15
|
export {
|
|
16
16
|
SESSION_PROXY_SITE_HTML_MAX_BYTES,
|
package/dist/site.js
CHANGED
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
sanitizeOpenGeniSiteToolCallRequest,
|
|
19
19
|
serveSiteHttp,
|
|
20
20
|
siteSessionPath
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TRUFUTDI.js";
|
|
22
22
|
import "./chunk-4SMEOV3P.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-ZOSRUR2Q.js";
|
|
24
24
|
import "./chunk-VPVMLM7Q.js";
|
|
25
25
|
import "./chunk-APXVSSSY.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-DTIMLEPB.js";
|
|
27
27
|
import "./chunk-NC57YMUO.js";
|
|
28
28
|
import "./chunk-V6GIY62B.js";
|
|
29
29
|
export {
|
package/dist/transcription.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export type TranscriptionAuthorization = {
|
|
|
70
70
|
reason: TranscriptionPolicyBlockReason;
|
|
71
71
|
};
|
|
72
72
|
export type TranscriptionLifecycleStatus = "idle" | "requesting-permission" | "listening" | "reconnecting" | "cancelling" | "closed" | "error";
|
|
73
|
-
export type TranscriptionErrorCode = "permission_denied" | "not_supported" | "network" | "provider" | "policy_blocked" | "timeout" | "cancelled" | "unavailable" | "too_large" | "invalid_audio" | "unknown";
|
|
73
|
+
export type TranscriptionErrorCode = "insufficient_credits" | "allowance_exhausted" | "monthly_model_cost_limit" | "permission_denied" | "not_supported" | "network" | "provider" | "policy_blocked" | "timeout" | "cancelled" | "unavailable" | "too_large" | "invalid_audio" | "unknown";
|
|
74
74
|
/** Native browser voice input defaults to the configured deployment capability. */
|
|
75
75
|
export declare function resolveWorkspaceVoiceInputEnabled(settings: unknown): boolean | null;
|
|
76
76
|
export type TranscriptionTimeSpan = {
|
package/dist/types.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type CodexRealtimeWebrtcRequest = {
|
|
|
22
22
|
export type CodexRealtimeWebrtcResponse = {
|
|
23
23
|
sdp: string;
|
|
24
24
|
version: CodexRealtimeWebrtcVersion;
|
|
25
|
-
model: "gpt-live-1-boulder-alpha";
|
|
25
|
+
model: "gpt-live-1-boulder-alpha" | "opengeni-azure/gpt-live-1";
|
|
26
26
|
connectionId: string;
|
|
27
27
|
connectionEpoch: number;
|
|
28
28
|
startupFenceSequence: number;
|
|
@@ -186,7 +186,7 @@ export type SyncSessionRealtimeLedgerResponse = {
|
|
|
186
186
|
}>;
|
|
187
187
|
outbound: SessionRealtimeLedgerEntry[];
|
|
188
188
|
};
|
|
189
|
-
export type SessionRealtimeModel = "gpt-live-1-boulder-alpha" | "supergrok/grok-voice-think-fast-2.0" | "opengeni-gateway/openai/gpt-realtime-2.1" | "opengeni-gateway/openai/gpt-realtime-mini" | "opengeni-gateway/xai/grok-voice-think-fast-2.0" | "workspace-gateway/openai/gpt-realtime-2.1" | "workspace-gateway/openai/gpt-realtime-mini" | "workspace-gateway/xai/grok-voice-think-fast-2.0";
|
|
189
|
+
export type SessionRealtimeModel = "opengeni-azure/gpt-live-1" | "gpt-live-1-boulder-alpha" | "supergrok/grok-voice-think-fast-2.0" | "opengeni-gateway/openai/gpt-realtime-2.1" | "opengeni-gateway/openai/gpt-realtime-mini" | "opengeni-gateway/xai/grok-voice-think-fast-2.0" | "workspace-gateway/openai/gpt-realtime-2.1" | "workspace-gateway/openai/gpt-realtime-mini" | "workspace-gateway/xai/grok-voice-think-fast-2.0";
|
|
190
190
|
export type WorkspaceRealtimeModelCatalogItem = {
|
|
191
191
|
id: SessionRealtimeModel;
|
|
192
192
|
label: string;
|
|
@@ -194,6 +194,8 @@ export type WorkspaceRealtimeModelCatalogItem = {
|
|
|
194
194
|
description: string;
|
|
195
195
|
available: boolean;
|
|
196
196
|
unavailableReason: string | null;
|
|
197
|
+
/** Machine-readable reason when unavailable, e.g. `insufficient_credits`. */
|
|
198
|
+
unavailableCode?: string | null | undefined;
|
|
197
199
|
recommended: boolean;
|
|
198
200
|
};
|
|
199
201
|
export type WorkspaceRealtimeModelCatalogResponse = {
|
|
@@ -230,9 +232,16 @@ export type RenewSessionRealtimeRequest = {
|
|
|
230
232
|
export type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {
|
|
231
233
|
reason: Extract<SessionRealtimeEndReason, "user_stop" | "browser_unload">;
|
|
232
234
|
};
|
|
235
|
+
/** Server instruction to end a live call now (for example, out of credits). */
|
|
236
|
+
export type SessionRealtimeStopInstruction = {
|
|
237
|
+
code: string;
|
|
238
|
+
message: string;
|
|
239
|
+
};
|
|
233
240
|
export type SessionRealtimeMutationResponse = {
|
|
234
241
|
mode: SessionRealtimeMode;
|
|
235
242
|
replay: boolean;
|
|
243
|
+
/** Present on a heartbeat when the server stopped extending the lease. */
|
|
244
|
+
stop?: SessionRealtimeStopInstruction | undefined;
|
|
236
245
|
};
|
|
237
246
|
export type SessionStatus = "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "failed" | "cancelled";
|
|
238
247
|
export type SandboxBackend = "docker" | "modal" | "local" | "none" | "daytona" | "runloop" | "e2b" | "blaxel" | "cloudflare" | "vercel" | "selfhosted" | "opensandbox";
|
|
@@ -3332,6 +3341,13 @@ export type ClientConfig = {
|
|
|
3332
3341
|
modelSelection?: boolean | undefined;
|
|
3333
3342
|
/** Session proxy sandbox-path download opt-in; absent on native deployments. */
|
|
3334
3343
|
sandboxFiles?: boolean | undefined;
|
|
3344
|
+
/**
|
|
3345
|
+
* `false` when a host's session proxy turns live voice off
|
|
3346
|
+
* (`createSessionProxyHandler({ realtimeVoice: false })`), so UIs hide the
|
|
3347
|
+
* voice button. Otherwise absent: availability comes from the workspace's
|
|
3348
|
+
* realtime model catalog.
|
|
3349
|
+
*/
|
|
3350
|
+
realtimeVoice?: boolean | undefined;
|
|
3335
3351
|
/**
|
|
3336
3352
|
* Session proxy only: the workspace the proxy resolved for this user, so a
|
|
3337
3353
|
* browser pointed at the proxy (`<OpenGeniChat baseUrl=... />`) needs no
|
|
@@ -3339,9 +3355,11 @@ export type ClientConfig = {
|
|
|
3339
3355
|
*/
|
|
3340
3356
|
workspaceId?: string | undefined;
|
|
3341
3357
|
/**
|
|
3342
|
-
* Session proxy capability for the embedded artifact viewer
|
|
3343
|
-
* native deployments. The live socket is
|
|
3344
|
-
* directly; the cache partition identifies
|
|
3358
|
+
* Session proxy capability for the embedded artifact viewer and inline Site
|
|
3359
|
+
* previews; absent on native deployments. The live socket is
|
|
3360
|
+
* ticket-authenticated and reached directly; the cache partition identifies
|
|
3361
|
+
* the proxied user. `false` when the proxy does not serve artifacts, so
|
|
3362
|
+
* stock UIs show Site previews as unavailable instead of failing on click.
|
|
3345
3363
|
*/
|
|
3346
3364
|
artifacts?: {
|
|
3347
3365
|
editableLiveUrl: string;
|
|
@@ -3350,7 +3368,18 @@ export type ClientConfig = {
|
|
|
3350
3368
|
principalId: string;
|
|
3351
3369
|
authorizationEpoch: string;
|
|
3352
3370
|
};
|
|
3353
|
-
} | undefined;
|
|
3371
|
+
} | false | undefined;
|
|
3372
|
+
/**
|
|
3373
|
+
* Session proxy only: whether the browser may start a chat (the proxy has a
|
|
3374
|
+
* `createSession` hook). Stock UIs hide "New chat" when `false`; absent on
|
|
3375
|
+
* native deployments and older proxies.
|
|
3376
|
+
*/
|
|
3377
|
+
sessionCreation?: boolean | undefined;
|
|
3378
|
+
/**
|
|
3379
|
+
* Session proxy only: whether users may archive or restore their chats.
|
|
3380
|
+
* Stock UIs hide "Archive" when `false`; absent on native deployments.
|
|
3381
|
+
*/
|
|
3382
|
+
archive?: boolean | undefined;
|
|
3354
3383
|
/** Native browser microphone capture + server-side transcription capability. */
|
|
3355
3384
|
voiceInput?: ClientVoiceInputConfig | undefined;
|
|
3356
3385
|
/**
|
|
@@ -3416,7 +3445,7 @@ export type ClientResumableVoiceInputConfig = {
|
|
|
3416
3445
|
maxChunkSizeBytes: number;
|
|
3417
3446
|
providerSegmentSeconds: number;
|
|
3418
3447
|
};
|
|
3419
|
-
export type TranscriptionRecordingErrorCode = "permission_denied" | "not_supported" | "network" | "provider" | "policy_blocked" | "timeout" | "cancelled" | "unavailable" | "too_large" | "invalid_audio" | "unknown";
|
|
3448
|
+
export type TranscriptionRecordingErrorCode = "permission_denied" | "not_supported" | "network" | "provider" | "policy_blocked" | "timeout" | "cancelled" | "unavailable" | "too_large" | "invalid_audio" | "unknown" | "insufficient_credits" | "allowance_exhausted" | "monthly_model_cost_limit";
|
|
3420
3449
|
export type TranscriptionRecordingState = "uploading" | "segmenting" | "ready" | "transcribing" | "complete" | "failed" | "discarded";
|
|
3421
3450
|
export type TranscriptionRecordingSegmentState = "preparing" | "pending" | "transcribing" | "complete" | "failed";
|
|
3422
3451
|
export type TranscriptionRecordingSegment = {
|
|
@@ -4042,7 +4071,7 @@ export type UpdateSlackChannelRoutesRequest = {
|
|
|
4042
4071
|
targetWorkspaceId: string | null;
|
|
4043
4072
|
}>;
|
|
4044
4073
|
};
|
|
4045
|
-
export type VoiceInputProviderId = "supergrok-subscription" | "codex-subscription" | "openai" | "azure-openai";
|
|
4074
|
+
export type VoiceInputProviderId = "azure-mai" | "supergrok-subscription" | "codex-subscription" | "openai" | "azure-openai";
|
|
4046
4075
|
export type WorkspaceVoiceInputSettings = {
|
|
4047
4076
|
enabled: boolean;
|
|
4048
4077
|
preferredProvider?: VoiceInputProviderId | null | undefined;
|
|
@@ -5926,6 +5955,14 @@ export type CapabilityRuntime = {
|
|
|
5926
5955
|
state: "trusted" | "legacy_active" | "unverified";
|
|
5927
5956
|
reason: "trusted_source" | "verified_probe" | "active_installation_compatibility" | "missing_verification";
|
|
5928
5957
|
} | undefined;
|
|
5958
|
+
/**
|
|
5959
|
+
* Present when connecting needs an operator-registered OAuth client because
|
|
5960
|
+
* the provider refuses self-registration; `configured` is whether this
|
|
5961
|
+
* deployment has one. Connector surfaces offer the row only when true.
|
|
5962
|
+
*/
|
|
5963
|
+
operatorOAuthClient?: {
|
|
5964
|
+
configured: boolean;
|
|
5965
|
+
} | undefined;
|
|
5929
5966
|
};
|
|
5930
5967
|
export type CapabilityCatalogItem = {
|
|
5931
5968
|
id: string;
|
|
@@ -6673,6 +6710,8 @@ export type PromotionalCreditScope = {
|
|
|
6673
6710
|
export type PromotionalCreditBalance = PromotionalCreditScope & {
|
|
6674
6711
|
grantId: string;
|
|
6675
6712
|
remainingMicros: number;
|
|
6713
|
+
/** Also pays for dictation and live voice, like general credits (signup credits). */
|
|
6714
|
+
coversVoice?: boolean | undefined;
|
|
6676
6715
|
};
|
|
6677
6716
|
export type BillingBalance = {
|
|
6678
6717
|
accountId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Framework-agnostic TypeScript SDK for the OpenGeni API: typed client, session lifecycle, SSE event streaming with reconnect + replay-by-sequence, and proxy re-streaming helpers.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -182,8 +182,8 @@
|
|
|
182
182
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
183
183
|
},
|
|
184
184
|
"dependencies": {
|
|
185
|
-
"@opengeni/connect": "1.
|
|
186
|
-
"@opengeni/contracts": "1.
|
|
185
|
+
"@opengeni/connect": "1.4.2",
|
|
186
|
+
"@opengeni/contracts": "1.4.2"
|
|
187
187
|
},
|
|
188
188
|
"engines": {
|
|
189
189
|
"node": ">=18"
|