@opengeni/sdk 0.44.3 → 0.46.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/dist/{chunk-UZNQOMWX.js → chunk-QKV5OCLJ.js} +163 -2
- package/dist/chunk-QKV5OCLJ.js.map +1 -0
- package/dist/client.d.ts +41 -2
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +80 -4
- package/package.json +1 -1
- package/src/client.ts +280 -1
- package/src/types.ts +113 -7
- package/dist/chunk-UZNQOMWX.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SessionEventStreamTransport, type StreamSessionEventsOptions } from "./stream";
|
|
2
2
|
import { type WorkspaceControlStreamTransport } from "./workspace-control-stream";
|
|
3
|
-
import type { AccessContext, ActivateCodexRealtimeConnectionRequest, AddWorkspaceMemberRequest, ApiKey, BillingEntitlementsResponse, CodexAccount, CodexAccountsResponse, CodexRotationSettings, CodexOverviewResponse, CodexAllocatorUpdate, CodexConnectionStatus, CodexRealtimeWebrtcRequest, CodexRealtimeWebrtcResponse, GatewayRealtimeConnectRequest, GatewayRealtimeConnectResponse, CodexConnectPoll, CodexConnectStart, CodexUsage, CodexUsageMap, BillingSummary, BillingUsageResponse, InsightsRange, WorkspaceInsightsResponse, BeginSessionRealtimeRequest, CapabilityCatalogItem, CapabilityCatalogResponse, CapabilityInstallation, AddDocumentRequest, CreateKnowledgeDropRequest, MoveDocumentRequest, ClientConfig, WorkspaceModelCatalogResponse, WorkspaceRealtimeModelCatalogResponse, ClientSessionEventInput, CompactSessionContextResult, ConnectionMetadata, CreateApiKeyRequest, CreateApiKeyResponse, CreateCapabilityCatalogItemRequest, CreateCheckoutRequest, CreateCheckoutResponse, OpenGeniSlackBotInstallRequest, OpenGeniSlackBotInstallStart, SlackReactionChannelListResponse, CreateConnectionRequest, CreateDocumentBaseRequest, CreateFileUploadRequest, CreateFileUploadResponse, CreateGitHubAppManifestRequest, CreateGitHubAppManifestResponse, CreateKnowledgeMemoryRequest, CreateScheduledTaskRequest, CreateSessionRequest, CreateSessionResponse, CreateVariableSetRequest, CreateRigRequest, CreateWorkspaceRequest, DeviceEnrollmentApproveResponse, DeviceEnrollmentDenyResponse, DeviceEnrollmentLookupResponse, MintEnrollTokenResponse, EndSessionRealtimeRequest, DiscoverMcpCapabilitiesResponse, Document, DocumentBase, DocumentSearchRequest, DocumentSearchResponse, EnableCapabilityRequest, EnablePackRequest, FileAsset, FileDownloadUrlResponse, GetPackResponse, GitHubAppInfo, GitHubRepositoriesResponse, GoogleDriveDisconnectRequest, GoogleDriveLifecycleActionRequest, KnowledgeMemory, KnowledgeMemorySearchRequest, ListPacksResponse, MachinesResponse, MetricSample, SwapActiveSandboxRequest, SwapActiveSandboxResponse, PackInstallation, LatencyMode, ReasoningEffort, RetainedArtifactContent, RetainedArtifactContentOptions, RetainedArtifactMetadata, RegisterCapabilityPackRequest, ResourceRef, ScheduledTask, ScheduledTaskRun, Session, SessionListResponse, UpdateSessionPinRequest, SessionEvent, SessionEventCompactResult, SessionEventCompactResultOptions, SessionEventListOptions, SessionEventPage, SessionGoal, SessionHumanInputRequest, SessionLineageResponse, SessionRealtimeMutationResponse, SyncSessionRealtimeLedgerRequest, SyncSessionRealtimeLedgerResponse, RenewSessionRealtimeRequest, SessionMcpCredentialUpdateInput, UpdateSessionMcpApprovalPolicyRequest, UpdateSessionMcpApprovalPolicyResponse, SessionQueueSnapshot, SessionQueueMutationResponse, ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, MoveSessionQueueItemRequest, NewSessionDraft, SaveComposerDraftRequest, SaveNewSessionDraftRequest, SteerSessionQueueItemRequest, SessionControlResponse, WorkspaceInferenceControlResponse, WorkspaceControlEvent, SessionTurn, SubmitHumanInputResponseRequest, SessionCapabilities, AttachViewerRequest, AttachViewerResponse, AcknowledgeStreamRequest, AcknowledgeStreamResponse, ViewerHeartbeatRequest, ViewerHeartbeatResponse, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitStatusRequest, GitStatusResponse, GitDiffRequest, GitDiffResponse, GitLogRequest, GitLogResponse, GitShowRequest, GitShowResponse, GetWorkspaceCaptureResponse, GetWorkspaceCaptureFileResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, ToolRef, TranscribeAudioResponse, UpdateConnectionRequest, UpdateKnowledgeMemoryRequest, UpdateScheduledTaskRequest, UpdateSessionGoalRequest, UpdateSessionRequest, UpdateSessionToolPolicyRequest, UpdateVariableSetRequest, UpdateRigRequest, UpdateWorkspaceMemberRequest, UpdateWorkspaceRequest, UpdateWorkspaceSettingsRequest, SetWorkspaceDefaultRigRequest, UploadFileInput, VariableSet, VariableSetVariableMetadata, Rig, RigVersion, RigChange, ProposeRigChangeRequest, WorkspaceMember, WorkspaceMemorySearchRequest, WorkspaceMemorySearchResponse, WorkspaceRegisteredPack, Workspace, OAuthStartRequest, OAuthStartResponse, SocialConnection, SocialOAuthStartRequest } from "./types";
|
|
3
|
+
import type { AccessContext, ActivateCodexRealtimeConnectionRequest, AddWorkspaceMemberRequest, ApiKey, BillingEntitlementsResponse, CodexAccount, CodexAccountsResponse, CodexAppsUpdate, CodexRotationSettings, CodexOverviewResponse, CodexAllocatorUpdate, CodexConnectionStatus, CodexRealtimeWebrtcRequest, CodexRealtimeWebrtcResponse, GatewayRealtimeConnectRequest, GatewayRealtimeConnectResponse, CodexConnectPoll, CodexConnectStart, CodexUsage, CodexUsageMap, BillingSummary, BillingUsageResponse, InsightsRange, WorkspaceInsightsResponse, BeginSessionRealtimeRequest, CapabilityCatalogItem, CapabilityCatalogResponse, CapabilityInstallation, AddDocumentRequest, CreateKnowledgeDropRequest, MoveDocumentRequest, ClientConfig, WorkspaceModelCatalogResponse, WorkspaceRealtimeModelCatalogResponse, ClientSessionEventInput, CompactSessionContextResult, ConnectionMetadata, CreateApiKeyRequest, CreateApiKeyResponse, CreateCapabilityCatalogItemRequest, CreateCheckoutRequest, CreateCheckoutResponse, OpenGeniSlackBotInstallRequest, OpenGeniSlackBotInstallStart, SlackReactionChannelListResponse, CreateConnectionRequest, CreateDocumentBaseRequest, CreateFileUploadRequest, CreateFileUploadResponse, CreateGitHubAppManifestRequest, CreateGitHubAppManifestResponse, CreateKnowledgeMemoryRequest, CreateScheduledTaskRequest, CreateSessionRequest, CreateSessionResponse, CreateVariableSetRequest, CreateRigRequest, CreateWorkspaceRequest, DeviceEnrollmentApproveResponse, DeviceEnrollmentDenyResponse, DeviceEnrollmentLookupResponse, MintEnrollTokenResponse, EndSessionRealtimeRequest, DiscoverMcpCapabilitiesResponse, Document, DocumentBase, DocumentSearchRequest, DocumentSearchResponse, EnableCapabilityRequest, EnablePackRequest, FileAsset, FileDownloadUrlResponse, GetPackResponse, GitHubAppInfo, GitHubRepositoriesResponse, GoogleDriveDisconnectRequest, GoogleDriveLifecycleActionRequest, KnowledgeMemory, KnowledgeMemorySearchRequest, ListPacksResponse, MachinesResponse, MetricSample, SwapActiveSandboxRequest, SwapActiveSandboxResponse, PackInstallation, LatencyMode, ReasoningEffort, RetainedArtifactContent, RetainedArtifactContentOptions, RetainedArtifactMetadata, RegisterCapabilityPackRequest, ResourceRef, ScheduledTask, ScheduledTaskRun, Session, SessionListResponse, UpdateSessionPinRequest, SessionEvent, SessionEventCompactResult, SessionEventCompactResultOptions, SessionEventListOptions, SessionEventPage, SessionGoal, SessionHumanInputRequest, SessionLineageResponse, SessionRealtimeMutationResponse, SyncSessionRealtimeLedgerRequest, SyncSessionRealtimeLedgerResponse, RenewSessionRealtimeRequest, SessionMcpCredentialUpdateInput, UpdateSessionMcpApprovalPolicyRequest, UpdateSessionMcpApprovalPolicyResponse, SessionQueueSnapshot, SessionQueueMutationResponse, ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, MoveSessionQueueItemRequest, NewSessionDraft, SaveComposerDraftRequest, SaveNewSessionDraftRequest, SteerSessionQueueItemRequest, SessionControlResponse, WorkspaceInferenceControlResponse, WorkspaceControlEvent, SessionTurn, SubmitHumanInputResponseRequest, SessionCapabilities, AttachViewerRequest, AttachViewerResponse, AcknowledgeStreamRequest, AcknowledgeStreamResponse, ViewerHeartbeatRequest, ViewerHeartbeatResponse, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitStatusRequest, GitStatusResponse, GitDiffRequest, GitDiffResponse, GitLogRequest, GitLogResponse, GitShowRequest, GitShowResponse, GetWorkspaceCaptureResponse, GetWorkspaceCaptureFileResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, ToolRef, TranscribeAudioResponse, TranscriptionRecordingListResponse, TranscriptionRecordingResponse, UploadTranscriptionRecordingChunkResponse, UpdateConnectionRequest, UpdateKnowledgeMemoryRequest, UpdateScheduledTaskRequest, UpdateSessionGoalRequest, UpdateSessionRequest, UpdateSessionToolPolicyRequest, UpdateVariableSetRequest, UpdateRigRequest, UpdateWorkspaceMemberRequest, UpdateWorkspaceRequest, UpdateWorkspaceSettingsRequest, SetWorkspaceDefaultRigRequest, UploadFileInput, VariableSet, VariableSetVariableMetadata, Rig, RigVersion, RigChange, ProposeRigChangeRequest, WorkspaceMember, WorkspaceMemorySearchRequest, WorkspaceMemorySearchResponse, WorkspaceRegisteredPack, Workspace, OAuthStartRequest, OAuthStartResponse, SocialConnection, SocialOAuthStartRequest } from "./types";
|
|
4
4
|
import type { ActivateWorkspaceInstructionPolicyRequest, CreateWorkspaceInstructionPolicyDraftRequest, CreateWorkspaceInstructionPolicyOnboardingProposalRequest, ImportLegacyWorkspaceInstructionPolicyDraftRequest, RollbackWorkspaceInstructionPolicyRequest, WorkspaceInstructionPolicyActivationResponse, WorkspaceInstructionPolicyDiffRequest, WorkspaceInstructionPolicyDiffResponse, WorkspaceInstructionPolicyListOptions, WorkspaceInstructionPolicyListResponse, WorkspaceInstructionPolicyOnboardingProposal, WorkspaceInstructionPolicyOnboardingProposalListOptions, WorkspaceInstructionPolicyOnboardingProposalListResponse, WorkspaceInstructionPolicyRevision } from "./workspace-instruction-policies";
|
|
5
5
|
import type { WorkspaceStateExportResponse, WorkspaceStateGetOptions, WorkspaceStateResponse } from "./workspace-state";
|
|
6
6
|
import type { ActivatePreferenceRegistryRevisionRequest, ChangePreferenceRegistryScopeRequest, CorrectPreferenceRegistryRequest, CreatePreferenceRegistryProposalRequest, DeactivatePreferenceRegistryRequest, PreferenceRegistryDetailResponse, PreferenceRegistryFullContent, PreferenceRegistryListOptions, PreferenceRegistryListResponse, PreferenceRegistryMutationResponse, PreferenceRegistryRecord, PreferenceRegistrySnapshot, RejectPreferenceRegistryProposalRequest, SupersedePreferenceRegistryRequest } from "./preference-registry";
|
|
@@ -51,6 +51,25 @@ export type TranscribeAudioInput = {
|
|
|
51
51
|
durationSeconds?: number | undefined;
|
|
52
52
|
signal?: AbortSignal | undefined;
|
|
53
53
|
};
|
|
54
|
+
export type CreateTranscriptionRecordingInput = {
|
|
55
|
+
recordingId: string;
|
|
56
|
+
mimeType: string;
|
|
57
|
+
signal?: AbortSignal | undefined;
|
|
58
|
+
};
|
|
59
|
+
export type UploadTranscriptionRecordingChunkInput = {
|
|
60
|
+
audio: Blob | File | Uint8Array;
|
|
61
|
+
mimeType: string;
|
|
62
|
+
sha256: string;
|
|
63
|
+
startMilliseconds: number;
|
|
64
|
+
durationMilliseconds: number;
|
|
65
|
+
signal?: AbortSignal | undefined;
|
|
66
|
+
};
|
|
67
|
+
export type FinalizeTranscriptionRecordingInput = {
|
|
68
|
+
chunkCount: number;
|
|
69
|
+
totalBytes: number;
|
|
70
|
+
totalDurationMilliseconds: number;
|
|
71
|
+
signal?: AbortSignal | undefined;
|
|
72
|
+
};
|
|
54
73
|
/**
|
|
55
74
|
* Typed client for the OpenGeni public API. Framework-agnostic: only needs
|
|
56
75
|
* WHATWG `fetch` + streams, so it runs in Node 18+, Bun, Deno, browsers, and
|
|
@@ -63,6 +82,21 @@ export declare class OpenGeniClient {
|
|
|
63
82
|
constructor(options: OpenGeniClientOptions);
|
|
64
83
|
/** Make one finalization attempt for a recording; callers may retry retained audio. */
|
|
65
84
|
transcribeAudio(workspaceId: string, input: TranscribeAudioInput): Promise<TranscribeAudioResponse>;
|
|
85
|
+
createTranscriptionRecording(workspaceId: string, input: CreateTranscriptionRecordingInput): Promise<TranscriptionRecordingResponse>;
|
|
86
|
+
getTranscriptionRecording(workspaceId: string, recordingId: string, options?: {
|
|
87
|
+
signal?: AbortSignal | undefined;
|
|
88
|
+
}): Promise<TranscriptionRecordingResponse>;
|
|
89
|
+
listTranscriptionRecordings(workspaceId: string, options?: {
|
|
90
|
+
signal?: AbortSignal | undefined;
|
|
91
|
+
}): Promise<TranscriptionRecordingListResponse>;
|
|
92
|
+
uploadTranscriptionRecordingChunk(workspaceId: string, recordingId: string, chunkNumber: number, input: UploadTranscriptionRecordingChunkInput): Promise<UploadTranscriptionRecordingChunkResponse>;
|
|
93
|
+
finalizeTranscriptionRecording(workspaceId: string, recordingId: string, input: FinalizeTranscriptionRecordingInput): Promise<TranscriptionRecordingResponse>;
|
|
94
|
+
processNextTranscriptionRecordingSegment(workspaceId: string, recordingId: string, options?: {
|
|
95
|
+
signal?: AbortSignal | undefined;
|
|
96
|
+
}): Promise<TranscriptionRecordingResponse>;
|
|
97
|
+
discardTranscriptionRecording(workspaceId: string, recordingId: string, options?: {
|
|
98
|
+
signal?: AbortSignal | undefined;
|
|
99
|
+
}): Promise<TranscriptionRecordingResponse>;
|
|
66
100
|
createSession(workspaceId: string, request: CreateSessionRequest): Promise<CreateSessionResponse>;
|
|
67
101
|
getNewSessionDraft(workspaceId: string): Promise<NewSessionDraft>;
|
|
68
102
|
saveNewSessionDraft(workspaceId: string, request: SaveNewSessionDraftRequest): Promise<NewSessionDraft>;
|
|
@@ -667,9 +701,14 @@ export declare class OpenGeniClient {
|
|
|
667
701
|
activated: boolean;
|
|
668
702
|
accountId: string;
|
|
669
703
|
}>;
|
|
670
|
-
/**
|
|
704
|
+
/** Designate one owner-connected subscription for Apps only. */
|
|
705
|
+
designateCodexAppsAccount(workspaceId: string, accountId: string, expectedVersion: number): Promise<CodexAppsUpdate>;
|
|
706
|
+
/** Clear the Apps credential without changing any inference selection. */
|
|
707
|
+
clearCodexAppsAccount(workspaceId: string, expectedVersion: number): Promise<CodexAppsUpdate>;
|
|
708
|
+
/** Enable or disable Codex auto-rotation. Returns the effective settings. */
|
|
671
709
|
setCodexRotationSettings(workspaceId: string, patch: {
|
|
672
710
|
rotationEnabled?: boolean;
|
|
711
|
+
/** @deprecated Rotation now has one effective sharded strategy. */
|
|
673
712
|
rotationStrategy?: CodexRotationSettings["rotationStrategy"];
|
|
674
713
|
}): Promise<CodexRotationSettings>;
|
|
675
714
|
/** Toggle only NEW automatic allocations under independent allocator OCC. */
|
package/dist/core.js
CHANGED
package/dist/index.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1564,7 +1564,7 @@ export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
|
|
|
1564
1564
|
* can introduce permissions without breaking older SDK consumers.
|
|
1565
1565
|
*/
|
|
1566
1566
|
export type Permission = KnownPermission | (string & {});
|
|
1567
|
-
export type FirstPartyMcpToolName = "set_session_title" | "goal_set" | "goal_update" | "goal_complete" | "goal_pause" | "memory_search" | "memory_save" | "memory_correct" | "preference_registry_summary" | "preference_registry_get" | "sandboxes_list" | "sandbox_attach" | "sandbox_swap" | "run_on" | "sandbox_provision" | "rig_list" | "rig_get" | "rig_propose_change" | "rig_verify" | "rig_promote" | "sessions_list" | "session_get" | "session_events" | "session_create" | "session_send_message" | "session_pause" | "session_resume" | "session_steer" | "set_other_session_title" | "variable_set_list" | "environment_list" | "variable_set_set_variable" | "environment_set_variable" | "github_connect_link" | "
|
|
1567
|
+
export type FirstPartyMcpToolName = "set_session_title" | "goal_set" | "goal_update" | "goal_complete" | "goal_pause" | "memory_search" | "memory_save" | "memory_correct" | "preference_registry_summary" | "preference_registry_get" | "sandboxes_list" | "sandbox_attach" | "sandbox_swap" | "run_on" | "sandbox_provision" | "rig_list" | "rig_get" | "rig_propose_change" | "rig_verify" | "rig_promote" | "sessions_list" | "session_get" | "session_events" | "session_create" | "session_send_message" | "session_pause" | "session_resume" | "session_steer" | "set_other_session_title" | "variable_set_list" | "environment_list" | "variable_set_set_variable" | "environment_set_variable" | "github_connect_link" | "github_repositories_list" | "social_connections_list" | "social_posts_recent" | "social_daily_analysis_context" | "social_search_live" | "social_mentions_live" | "social_thread_fetch" | "social_posts_sync" | "social_post_reply" | "scheduled_tasks_list" | "scheduled_tasks_get" | "scheduled_tasks_create" | "scheduled_tasks_update" | "scheduled_tasks_pause" | "scheduled_tasks_resume" | "scheduled_tasks_trigger" | "scheduled_tasks_delete" | "scheduled_task_runs_list" | "slack_bot_list_channels" | "slack_bot_channel_history" | "slack_bot_thread_replies" | "slack_bot_list_users" | "slack_bot_list_files" | "slack_bot_file_info" | "slack_bot_file_content" | "slack_bot_post_message" | "slack_bot_delete_message" | "artifacts_list" | "artifacts_get_source" | "artifacts_create" | "artifacts_publish" | "artifacts_rollback";
|
|
1568
1568
|
export type ProductAccessMode = "local" | "configured" | "managed";
|
|
1569
1569
|
export type ModelCapabilitySupportV1 = "supported" | "unsupported" | "unknown";
|
|
1570
1570
|
export type ModelCapabilityStateV1 = {
|
|
@@ -1774,6 +1774,10 @@ export type CodexAccount = {
|
|
|
1774
1774
|
/** Cached authoritative summary count, never detailed redemption authority. */
|
|
1775
1775
|
resetCreditAvailableCount?: number | null;
|
|
1776
1776
|
resetCreditsCheckedAt?: string | null;
|
|
1777
|
+
/** True when this exact credential is the workspace's independent Apps credential. */
|
|
1778
|
+
appsDesignated: boolean;
|
|
1779
|
+
/** True only for the scoped managed human who connected it. */
|
|
1780
|
+
canEnableApps: boolean;
|
|
1777
1781
|
};
|
|
1778
1782
|
export type CodexResetCredit = {
|
|
1779
1783
|
id: string;
|
|
@@ -1834,24 +1838,37 @@ export type CodexAllocatorUpdate = {
|
|
|
1834
1838
|
allocatorUpdatedAt: string | null;
|
|
1835
1839
|
changed: boolean;
|
|
1836
1840
|
};
|
|
1837
|
-
/** Per-workspace Codex rotation/active settings.
|
|
1841
|
+
/** Per-workspace Codex rotation/active settings. New servers return `sharded`. */
|
|
1838
1842
|
export type CodexRotationSettings = {
|
|
1839
1843
|
rotationEnabled: boolean;
|
|
1840
|
-
rotationStrategy: "most_remaining" | "round_robin" | "drain_then_next";
|
|
1844
|
+
rotationStrategy: "sharded" | "most_remaining" | "round_robin" | "drain_then_next";
|
|
1841
1845
|
activeCredentialId: string | null;
|
|
1842
1846
|
};
|
|
1843
1847
|
/** GET /codex/accounts — the accounts list + the workspace active pointer + settings. */
|
|
1844
1848
|
export type CodexAccountsResponse = {
|
|
1845
1849
|
accounts: CodexAccount[];
|
|
1846
1850
|
activeAccountId: string | null;
|
|
1851
|
+
/** Added by Apps-aware servers; absent on older same-major deployments. */
|
|
1852
|
+
apps?: {
|
|
1853
|
+
available: boolean;
|
|
1854
|
+
credentialId: string | null;
|
|
1855
|
+
version: number;
|
|
1856
|
+
designatedAt: string | null;
|
|
1857
|
+
canDisable: boolean;
|
|
1858
|
+
};
|
|
1847
1859
|
settings: CodexRotationSettings;
|
|
1848
1860
|
};
|
|
1861
|
+
export type CodexAppsUpdate = {
|
|
1862
|
+
credentialId: string | null;
|
|
1863
|
+
version: number;
|
|
1864
|
+
designatedAt: string | null;
|
|
1865
|
+
changed: boolean;
|
|
1866
|
+
};
|
|
1849
1867
|
/** Payload of a `codex.account.switched` session event. */
|
|
1850
1868
|
export type CodexAccountSwitchedPayload = {
|
|
1851
1869
|
fromAccountId: string | null;
|
|
1852
1870
|
toAccountId: string;
|
|
1853
1871
|
reason: "manual" | "exhausted" | "rotation";
|
|
1854
|
-
droppedConnectors?: string[];
|
|
1855
1872
|
};
|
|
1856
1873
|
/** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */
|
|
1857
1874
|
export type CodexConnectStart = {
|
|
@@ -1955,6 +1972,65 @@ export type ClientVoiceInputConfig = {
|
|
|
1955
1972
|
maxDurationSeconds: number;
|
|
1956
1973
|
maxSizeBytes: number;
|
|
1957
1974
|
acceptedMimeTypes: string[];
|
|
1975
|
+
resumable?: ClientResumableVoiceInputConfig | undefined;
|
|
1976
|
+
};
|
|
1977
|
+
export type ClientResumableVoiceInputConfig = {
|
|
1978
|
+
maxDurationSeconds: number;
|
|
1979
|
+
maxSizeBytes: number;
|
|
1980
|
+
maxChunkSizeBytes: number;
|
|
1981
|
+
providerSegmentSeconds: number;
|
|
1982
|
+
};
|
|
1983
|
+
export type TranscriptionRecordingErrorCode = "permission_denied" | "not_supported" | "network" | "provider" | "policy_blocked" | "timeout" | "cancelled" | "unavailable" | "too_large" | "invalid_audio" | "unknown";
|
|
1984
|
+
export type TranscriptionRecordingState = "uploading" | "segmenting" | "ready" | "transcribing" | "complete" | "failed" | "discarded";
|
|
1985
|
+
export type TranscriptionRecordingSegmentState = "preparing" | "pending" | "transcribing" | "complete" | "failed";
|
|
1986
|
+
export type TranscriptionRecordingSegment = {
|
|
1987
|
+
segmentNumber: number;
|
|
1988
|
+
state: TranscriptionRecordingSegmentState;
|
|
1989
|
+
startMilliseconds: number;
|
|
1990
|
+
durationMilliseconds: number;
|
|
1991
|
+
byteLength: number;
|
|
1992
|
+
errorCode: TranscriptionRecordingErrorCode | null;
|
|
1993
|
+
retryable: boolean;
|
|
1994
|
+
};
|
|
1995
|
+
export type TranscriptionRecording = {
|
|
1996
|
+
id: string;
|
|
1997
|
+
workspaceId: string;
|
|
1998
|
+
mimeType: string;
|
|
1999
|
+
state: TranscriptionRecordingState;
|
|
2000
|
+
nextChunkNumber: number;
|
|
2001
|
+
chunkCount: number;
|
|
2002
|
+
totalBytes: number;
|
|
2003
|
+
totalDurationMilliseconds: number;
|
|
2004
|
+
segmentCount: number;
|
|
2005
|
+
completedSegmentCount: number;
|
|
2006
|
+
transcriptText: string | null;
|
|
2007
|
+
languages: string[];
|
|
2008
|
+
errorCode: TranscriptionRecordingErrorCode | null;
|
|
2009
|
+
retryable: boolean;
|
|
2010
|
+
objectsCleaned: boolean;
|
|
2011
|
+
createdAt: string;
|
|
2012
|
+
updatedAt: string;
|
|
2013
|
+
expiresAt: string;
|
|
2014
|
+
};
|
|
2015
|
+
export type TranscriptionRecordingResponse = {
|
|
2016
|
+
recording: TranscriptionRecording;
|
|
2017
|
+
segments: TranscriptionRecordingSegment[];
|
|
2018
|
+
retryAfterMilliseconds?: number;
|
|
2019
|
+
};
|
|
2020
|
+
export type TranscriptionRecordingListResponse = {
|
|
2021
|
+
recordings: TranscriptionRecording[];
|
|
2022
|
+
};
|
|
2023
|
+
export type TranscriptionRecordingChunk = {
|
|
2024
|
+
chunkNumber: number;
|
|
2025
|
+
byteLength: number;
|
|
2026
|
+
sha256: string;
|
|
2027
|
+
startMilliseconds: number;
|
|
2028
|
+
durationMilliseconds: number;
|
|
2029
|
+
deduplicated: boolean;
|
|
2030
|
+
};
|
|
2031
|
+
export type UploadTranscriptionRecordingChunkResponse = {
|
|
2032
|
+
recording: TranscriptionRecording;
|
|
2033
|
+
chunk: TranscriptionRecordingChunk;
|
|
1958
2034
|
};
|
|
1959
2035
|
/** Response from POST /v1/workspaces/:workspaceId/transcriptions. */
|
|
1960
2036
|
export type TranscribeAudioResponse = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
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": {
|
package/src/client.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
BillingEntitlementsResponse,
|
|
21
21
|
CodexAccount,
|
|
22
22
|
CodexAccountsResponse,
|
|
23
|
+
CodexAppsUpdate,
|
|
23
24
|
CodexRotationSettings,
|
|
24
25
|
CodexOverviewResponse,
|
|
25
26
|
CodexAllocatorUpdate,
|
|
@@ -188,6 +189,9 @@ import type {
|
|
|
188
189
|
PtyCloseRequest,
|
|
189
190
|
ToolRef,
|
|
190
191
|
TranscribeAudioResponse,
|
|
192
|
+
TranscriptionRecordingListResponse,
|
|
193
|
+
TranscriptionRecordingResponse,
|
|
194
|
+
UploadTranscriptionRecordingChunkResponse,
|
|
191
195
|
UpdateConnectionRequest,
|
|
192
196
|
UpdateKnowledgeMemoryRequest,
|
|
193
197
|
UpdateScheduledTaskRequest,
|
|
@@ -328,6 +332,28 @@ export type TranscribeAudioInput = {
|
|
|
328
332
|
signal?: AbortSignal | undefined;
|
|
329
333
|
};
|
|
330
334
|
|
|
335
|
+
export type CreateTranscriptionRecordingInput = {
|
|
336
|
+
recordingId: string;
|
|
337
|
+
mimeType: string;
|
|
338
|
+
signal?: AbortSignal | undefined;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export type UploadTranscriptionRecordingChunkInput = {
|
|
342
|
+
audio: Blob | File | Uint8Array;
|
|
343
|
+
mimeType: string;
|
|
344
|
+
sha256: string;
|
|
345
|
+
startMilliseconds: number;
|
|
346
|
+
durationMilliseconds: number;
|
|
347
|
+
signal?: AbortSignal | undefined;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export type FinalizeTranscriptionRecordingInput = {
|
|
351
|
+
chunkCount: number;
|
|
352
|
+
totalBytes: number;
|
|
353
|
+
totalDurationMilliseconds: number;
|
|
354
|
+
signal?: AbortSignal | undefined;
|
|
355
|
+
};
|
|
356
|
+
|
|
331
357
|
/**
|
|
332
358
|
* Typed client for the OpenGeni public API. Framework-agnostic: only needs
|
|
333
359
|
* WHATWG `fetch` + streams, so it runs in Node 18+, Bun, Deno, browsers, and
|
|
@@ -401,6 +427,153 @@ export class OpenGeniClient {
|
|
|
401
427
|
return body;
|
|
402
428
|
}
|
|
403
429
|
|
|
430
|
+
async createTranscriptionRecording(
|
|
431
|
+
workspaceId: string,
|
|
432
|
+
input: CreateTranscriptionRecordingInput,
|
|
433
|
+
): Promise<TranscriptionRecordingResponse> {
|
|
434
|
+
return transcriptionRecordingResponse(
|
|
435
|
+
await this.requestJson<unknown>(
|
|
436
|
+
"POST",
|
|
437
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings`,
|
|
438
|
+
{ recordingId: input.recordingId, mimeType: input.mimeType },
|
|
439
|
+
{},
|
|
440
|
+
input.signal ? { signal: input.signal } : {},
|
|
441
|
+
),
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
async getTranscriptionRecording(
|
|
446
|
+
workspaceId: string,
|
|
447
|
+
recordingId: string,
|
|
448
|
+
options: { signal?: AbortSignal | undefined } = {},
|
|
449
|
+
): Promise<TranscriptionRecordingResponse> {
|
|
450
|
+
return transcriptionRecordingResponse(
|
|
451
|
+
await this.requestJson<unknown>(
|
|
452
|
+
"GET",
|
|
453
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings/${recordingId}`,
|
|
454
|
+
undefined,
|
|
455
|
+
{},
|
|
456
|
+
options.signal ? { signal: options.signal } : {},
|
|
457
|
+
),
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
async listTranscriptionRecordings(
|
|
462
|
+
workspaceId: string,
|
|
463
|
+
options: { signal?: AbortSignal | undefined } = {},
|
|
464
|
+
): Promise<TranscriptionRecordingListResponse> {
|
|
465
|
+
const body = await this.requestJson<unknown>(
|
|
466
|
+
"GET",
|
|
467
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings`,
|
|
468
|
+
undefined,
|
|
469
|
+
{},
|
|
470
|
+
options.signal ? { signal: options.signal } : {},
|
|
471
|
+
);
|
|
472
|
+
if (!isTranscriptionRecordingListResponse(body)) {
|
|
473
|
+
throw new OpenGeniApiError(502, "Invalid transcription recording list response.", {
|
|
474
|
+
code: "invalid_response",
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
return body;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
async uploadTranscriptionRecordingChunk(
|
|
481
|
+
workspaceId: string,
|
|
482
|
+
recordingId: string,
|
|
483
|
+
chunkNumber: number,
|
|
484
|
+
input: UploadTranscriptionRecordingChunkInput,
|
|
485
|
+
): Promise<UploadTranscriptionRecordingChunkResponse> {
|
|
486
|
+
const correlationId = crypto.randomUUID();
|
|
487
|
+
let response: Response;
|
|
488
|
+
try {
|
|
489
|
+
response = await this.fetchImpl(
|
|
490
|
+
this.url(
|
|
491
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings/${recordingId}/chunks/${chunkNumber}`,
|
|
492
|
+
),
|
|
493
|
+
{
|
|
494
|
+
method: "PUT",
|
|
495
|
+
headers: {
|
|
496
|
+
...this.headers(correlationId),
|
|
497
|
+
Accept: "application/json",
|
|
498
|
+
"Content-Type": input.mimeType,
|
|
499
|
+
"x-opengeni-chunk-sha256": input.sha256,
|
|
500
|
+
"x-opengeni-chunk-start-milliseconds": String(input.startMilliseconds),
|
|
501
|
+
"x-opengeni-chunk-duration-milliseconds": String(input.durationMilliseconds),
|
|
502
|
+
},
|
|
503
|
+
body: input.audio instanceof Uint8Array ? Uint8Array.from(input.audio) : input.audio,
|
|
504
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
505
|
+
},
|
|
506
|
+
);
|
|
507
|
+
} catch (error) {
|
|
508
|
+
if (input.signal?.aborted) throw error;
|
|
509
|
+
throw mutationTransportError(correlationId);
|
|
510
|
+
}
|
|
511
|
+
assertApiContractResponse(response);
|
|
512
|
+
if (!response.ok) throw await apiErrorFromResponse(response, { method: "PUT", correlationId });
|
|
513
|
+
await assertJsonResponse(response, { method: "PUT", correlationId });
|
|
514
|
+
const body = await response.json().catch(() => null);
|
|
515
|
+
if (!isUploadTranscriptionRecordingChunkResponse(body)) {
|
|
516
|
+
throw new OpenGeniApiError(response.status, "Invalid transcription chunk response.", {
|
|
517
|
+
code: "invalid_response",
|
|
518
|
+
mutation: true,
|
|
519
|
+
correlationId,
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return body;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
async finalizeTranscriptionRecording(
|
|
526
|
+
workspaceId: string,
|
|
527
|
+
recordingId: string,
|
|
528
|
+
input: FinalizeTranscriptionRecordingInput,
|
|
529
|
+
): Promise<TranscriptionRecordingResponse> {
|
|
530
|
+
return transcriptionRecordingResponse(
|
|
531
|
+
await this.requestJson<unknown>(
|
|
532
|
+
"POST",
|
|
533
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings/${recordingId}/finalize`,
|
|
534
|
+
{
|
|
535
|
+
chunkCount: input.chunkCount,
|
|
536
|
+
totalBytes: input.totalBytes,
|
|
537
|
+
totalDurationMilliseconds: input.totalDurationMilliseconds,
|
|
538
|
+
},
|
|
539
|
+
{},
|
|
540
|
+
input.signal ? { signal: input.signal } : {},
|
|
541
|
+
),
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
async processNextTranscriptionRecordingSegment(
|
|
546
|
+
workspaceId: string,
|
|
547
|
+
recordingId: string,
|
|
548
|
+
options: { signal?: AbortSignal | undefined } = {},
|
|
549
|
+
): Promise<TranscriptionRecordingResponse> {
|
|
550
|
+
return transcriptionRecordingResponse(
|
|
551
|
+
await this.requestJson<unknown>(
|
|
552
|
+
"POST",
|
|
553
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings/${recordingId}/process-next`,
|
|
554
|
+
{},
|
|
555
|
+
{},
|
|
556
|
+
options.signal ? { signal: options.signal } : {},
|
|
557
|
+
),
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
async discardTranscriptionRecording(
|
|
562
|
+
workspaceId: string,
|
|
563
|
+
recordingId: string,
|
|
564
|
+
options: { signal?: AbortSignal | undefined } = {},
|
|
565
|
+
): Promise<TranscriptionRecordingResponse> {
|
|
566
|
+
return transcriptionRecordingResponse(
|
|
567
|
+
await this.requestJson<unknown>(
|
|
568
|
+
"DELETE",
|
|
569
|
+
`/v1/workspaces/${workspaceId}/transcription-recordings/${recordingId}`,
|
|
570
|
+
undefined,
|
|
571
|
+
{},
|
|
572
|
+
options.signal ? { signal: options.signal } : {},
|
|
573
|
+
),
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
404
577
|
async createSession(
|
|
405
578
|
workspaceId: string,
|
|
406
579
|
request: CreateSessionRequest,
|
|
@@ -3418,11 +3591,37 @@ export class OpenGeniClient {
|
|
|
3418
3591
|
);
|
|
3419
3592
|
}
|
|
3420
3593
|
|
|
3421
|
-
/**
|
|
3594
|
+
/** Designate one owner-connected subscription for Apps only. */
|
|
3595
|
+
async designateCodexAppsAccount(
|
|
3596
|
+
workspaceId: string,
|
|
3597
|
+
accountId: string,
|
|
3598
|
+
expectedVersion: number,
|
|
3599
|
+
): Promise<CodexAppsUpdate> {
|
|
3600
|
+
return await this.requestJson<CodexAppsUpdate>(
|
|
3601
|
+
"POST",
|
|
3602
|
+
`/v1/workspaces/${workspaceId}/codex/apps`,
|
|
3603
|
+
{ accountId, expectedVersion },
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
/** Clear the Apps credential without changing any inference selection. */
|
|
3608
|
+
async clearCodexAppsAccount(
|
|
3609
|
+
workspaceId: string,
|
|
3610
|
+
expectedVersion: number,
|
|
3611
|
+
): Promise<CodexAppsUpdate> {
|
|
3612
|
+
return await this.requestJson<CodexAppsUpdate>(
|
|
3613
|
+
"DELETE",
|
|
3614
|
+
`/v1/workspaces/${workspaceId}/codex/apps`,
|
|
3615
|
+
{ expectedVersion },
|
|
3616
|
+
);
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
/** Enable or disable Codex auto-rotation. Returns the effective settings. */
|
|
3422
3620
|
async setCodexRotationSettings(
|
|
3423
3621
|
workspaceId: string,
|
|
3424
3622
|
patch: {
|
|
3425
3623
|
rotationEnabled?: boolean;
|
|
3624
|
+
/** @deprecated Rotation now has one effective sharded strategy. */
|
|
3426
3625
|
rotationStrategy?: CodexRotationSettings["rotationStrategy"];
|
|
3427
3626
|
},
|
|
3428
3627
|
): Promise<CodexRotationSettings> {
|
|
@@ -3568,6 +3767,86 @@ function isTranscribeAudioResponse(value: unknown): value is TranscribeAudioResp
|
|
|
3568
3767
|
);
|
|
3569
3768
|
}
|
|
3570
3769
|
|
|
3770
|
+
function isUploadTranscriptionRecordingChunkResponse(
|
|
3771
|
+
value: unknown,
|
|
3772
|
+
): value is UploadTranscriptionRecordingChunkResponse {
|
|
3773
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3774
|
+
const record = value as Record<string, unknown>;
|
|
3775
|
+
if (!isTranscriptionRecordingResponse({ recording: record.recording, segments: [] })) {
|
|
3776
|
+
return false;
|
|
3777
|
+
}
|
|
3778
|
+
if (!record.chunk || typeof record.chunk !== "object" || Array.isArray(record.chunk)) {
|
|
3779
|
+
return false;
|
|
3780
|
+
}
|
|
3781
|
+
const chunk = record.chunk as Record<string, unknown>;
|
|
3782
|
+
return (
|
|
3783
|
+
typeof chunk.chunkNumber === "number" &&
|
|
3784
|
+
typeof chunk.byteLength === "number" &&
|
|
3785
|
+
typeof chunk.sha256 === "string" &&
|
|
3786
|
+
typeof chunk.startMilliseconds === "number" &&
|
|
3787
|
+
typeof chunk.durationMilliseconds === "number" &&
|
|
3788
|
+
typeof chunk.deduplicated === "boolean"
|
|
3789
|
+
);
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
function isTranscriptionRecordingResponse(value: unknown): value is TranscriptionRecordingResponse {
|
|
3793
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3794
|
+
const response = value as Record<string, unknown>;
|
|
3795
|
+
if (
|
|
3796
|
+
!response.recording ||
|
|
3797
|
+
typeof response.recording !== "object" ||
|
|
3798
|
+
Array.isArray(response.recording)
|
|
3799
|
+
) {
|
|
3800
|
+
return false;
|
|
3801
|
+
}
|
|
3802
|
+
const recording = response.recording as Record<string, unknown>;
|
|
3803
|
+
return (
|
|
3804
|
+
typeof recording.id === "string" &&
|
|
3805
|
+
typeof recording.workspaceId === "string" &&
|
|
3806
|
+
typeof recording.mimeType === "string" &&
|
|
3807
|
+
typeof recording.state === "string" &&
|
|
3808
|
+
typeof recording.nextChunkNumber === "number" &&
|
|
3809
|
+
typeof recording.chunkCount === "number" &&
|
|
3810
|
+
typeof recording.totalBytes === "number" &&
|
|
3811
|
+
typeof recording.totalDurationMilliseconds === "number" &&
|
|
3812
|
+
typeof recording.segmentCount === "number" &&
|
|
3813
|
+
typeof recording.completedSegmentCount === "number" &&
|
|
3814
|
+
(recording.transcriptText === null || typeof recording.transcriptText === "string") &&
|
|
3815
|
+
Array.isArray(recording.languages) &&
|
|
3816
|
+
(recording.errorCode === null || typeof recording.errorCode === "string") &&
|
|
3817
|
+
typeof recording.retryable === "boolean" &&
|
|
3818
|
+
typeof recording.objectsCleaned === "boolean" &&
|
|
3819
|
+
typeof recording.createdAt === "string" &&
|
|
3820
|
+
typeof recording.updatedAt === "string" &&
|
|
3821
|
+
typeof recording.expiresAt === "string" &&
|
|
3822
|
+
(response.retryAfterMilliseconds === undefined ||
|
|
3823
|
+
(typeof response.retryAfterMilliseconds === "number" &&
|
|
3824
|
+
Number.isInteger(response.retryAfterMilliseconds) &&
|
|
3825
|
+
response.retryAfterMilliseconds > 0 &&
|
|
3826
|
+
response.retryAfterMilliseconds <= 60_000)) &&
|
|
3827
|
+
Array.isArray(response.segments)
|
|
3828
|
+
);
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
function transcriptionRecordingResponse(value: unknown): TranscriptionRecordingResponse {
|
|
3832
|
+
if (isTranscriptionRecordingResponse(value)) return value;
|
|
3833
|
+
throw new OpenGeniApiError(502, "Invalid transcription recording response.", {
|
|
3834
|
+
code: "invalid_response",
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
function isTranscriptionRecordingListResponse(
|
|
3839
|
+
value: unknown,
|
|
3840
|
+
): value is TranscriptionRecordingListResponse {
|
|
3841
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3842
|
+
const recordings = (value as Record<string, unknown>).recordings;
|
|
3843
|
+
return (
|
|
3844
|
+
Array.isArray(recordings) &&
|
|
3845
|
+
recordings.length <= 50 &&
|
|
3846
|
+
recordings.every((recording) => isTranscriptionRecordingResponse({ recording, segments: [] }))
|
|
3847
|
+
);
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3571
3850
|
function filenameForAudioMimeType(mimeType: string): string {
|
|
3572
3851
|
const bare = mimeType.trim().toLowerCase().split(";")[0] ?? "audio/webm";
|
|
3573
3852
|
switch (bare) {
|