@opengeni/sdk 0.44.0 → 0.44.6

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.
@@ -14,7 +14,7 @@ var OpenGeniApiError = class extends Error {
14
14
  const gatewayFailure = status >= 502 && status <= 504;
15
15
  const fromResponse = options.mutation !== void 0;
16
16
  const message = decoded?.message ?? (fromResponse ? "Request failed." : body || "(empty body)");
17
- const displayMessage = options.displayMessage ?? (gatewayFailure && fromResponse ? "OpenGeni is temporarily unavailable \u2014 retry." : `OpenGeni API ${status}: ${message}`);
17
+ const displayMessage = options.displayMessage ?? (gatewayFailure && fromResponse ? decoded?.message ?? "OpenGeni is temporarily unavailable \u2014 retry." : `OpenGeni API ${status}: ${message}`);
18
18
  super(correlationId ? `${displayMessage} Reference: ${correlationId}.` : displayMessage);
19
19
  this.name = "OpenGeniApiError";
20
20
  this.status = status;
@@ -113,4 +113,4 @@ export {
113
113
  isAbortError,
114
114
  isRetryableStreamError
115
115
  };
116
- //# sourceMappingURL=chunk-UD2DNDSS.js.map
116
+ //# sourceMappingURL=chunk-V5F253OG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["/** Error for a non-2xx OpenGeni API response. */\nexport class OpenGeniApiError extends Error {\n readonly status: number;\n readonly code: string | undefined;\n readonly retryable: boolean;\n readonly correlationId: string | undefined;\n /** True only when an uncontrolled transport failed after a mutation may have been accepted. */\n readonly outcomeUnknown: boolean;\n readonly body: string;\n readonly details: Record<string, unknown> | undefined;\n\n constructor(\n status: number,\n body: string,\n options: {\n code?: string | undefined;\n retryable?: boolean | undefined;\n correlationId?: string | undefined;\n outcomeUnknown?: boolean | undefined;\n displayMessage?: string | undefined;\n mutation?: boolean | undefined;\n } = {},\n ) {\n const decoded = decodeApiErrorBody(body);\n const correlationId = decoded?.requestId ?? boundedCorrelationId(options.correlationId);\n const gatewayFailure = status >= 502 && status <= 504;\n const fromResponse = options.mutation !== undefined;\n const message = decoded?.message ?? (fromResponse ? \"Request failed.\" : body || \"(empty body)\");\n const displayMessage =\n options.displayMessage ??\n (gatewayFailure && fromResponse\n ? (decoded?.message ?? \"OpenGeni is temporarily unavailable — retry.\")\n : `OpenGeni API ${status}: ${message}`);\n super(correlationId ? `${displayMessage} Reference: ${correlationId}.` : displayMessage);\n this.name = \"OpenGeniApiError\";\n this.status = status;\n this.code =\n options.code ??\n decoded?.code ??\n (gatewayFailure && fromResponse ? \"upstream_unavailable\" : undefined);\n this.retryable = options.retryable ?? decoded?.retryable ?? retryableApiStatus(status);\n this.correlationId = correlationId;\n this.outcomeUnknown =\n options.outcomeUnknown ?? (gatewayFailure && !!options.mutation && !decoded);\n this.body = !fromResponse || decoded ? body : \"\";\n this.details = decoded?.details;\n }\n}\n\nfunction decodeApiErrorBody(body: string): {\n code: string | undefined;\n message: string | undefined;\n requestId: string | undefined;\n retryable: boolean | undefined;\n details: Record<string, unknown> | undefined;\n} | null {\n if (!body) return null;\n try {\n const decoded: unknown = JSON.parse(body);\n if (!decoded || typeof decoded !== \"object\" || Array.isArray(decoded)) return null;\n const record = decoded as Record<string, unknown>;\n const nested =\n record.error && typeof record.error === \"object\" && !Array.isArray(record.error)\n ? (record.error as Record<string, unknown>)\n : record;\n const code = boundedApiField(nested.code);\n const message = boundedApiField(nested.message);\n const requestId = boundedCorrelationId(nested.requestId);\n const retryable = typeof nested.retryable === \"boolean\" ? nested.retryable : undefined;\n const details = boundedApiDetails(nested.details);\n if (!code && !message && !requestId && retryable === undefined && !details) return null;\n return {\n code,\n message,\n requestId,\n retryable,\n details,\n };\n } catch {\n return null;\n }\n}\n\nfunction boundedApiDetails(value: unknown): Record<string, unknown> | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return;\n const entries = Object.entries(value as Record<string, unknown>).slice(0, 16);\n const details: Record<string, unknown> = {};\n for (const [key, entry] of entries) {\n if (!/^[a-zA-Z][\\w.-]{0,63}$/.test(key)) continue;\n if (typeof entry === \"string\") {\n const bounded = boundedApiField(entry);\n if (bounded !== undefined) details[key] = bounded;\n } else if (typeof entry === \"number\" || typeof entry === \"boolean\" || entry === null) {\n details[key] = entry;\n }\n }\n return Object.keys(details).length > 0 ? details : undefined;\n}\n\nfunction boundedApiField(value: unknown): string | undefined {\n if (typeof value !== \"string\") return;\n const bytes = new TextEncoder().encode(value);\n return bytes.byteLength <= 512 ? value : new TextDecoder().decode(bytes.slice(0, 512));\n}\n\nfunction retryableApiStatus(status: number): boolean {\n return status === 408 || status === 409 || status === 425 || status === 429 || status >= 500;\n}\n\nfunction boundedCorrelationId(value: unknown): string | undefined {\n if (typeof value !== \"string\" || value.length > 128 || !/^[\\w.:-]+$/.test(value)) {\n return;\n }\n return value;\n}\n\n/** A short-lived session-list snapshot cursor can no longer be continued. */\nexport class OpenGeniSessionListCursorError extends OpenGeniApiError {}\n\n/** The browser bundle and API disagree about their state-changing wire contract. */\nexport class OpenGeniApiContractMismatchError extends Error {\n readonly expected: string;\n readonly actual: string;\n\n constructor(expected: string, actual: string) {\n super(`OpenGeni API contract mismatch: client expects ${expected}, API serves ${actual}`);\n this.name = \"OpenGeniApiContractMismatchError\";\n this.expected = expected;\n this.actual = actual;\n }\n}\n\n/** Error for an unrecoverable event-stream condition (not a transient drop). */\nexport class OpenGeniStreamError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"OpenGeniStreamError\";\n }\n}\n\nexport function isAbortError(error: unknown): boolean {\n return (\n (error instanceof DOMException && error.name === \"AbortError\") ||\n (error instanceof Error && error.name === \"AbortError\")\n );\n}\n\n/**\n * Transient conditions worth a reconnect: network-level failures (`fetch`\n * rejects with `TypeError`) and HTTP statuses that signal a temporary server\n * or contention condition. Auth/validation failures (401/403/404/...) are\n * permanent and surface to the caller instead.\n */\nexport function isRetryableStreamError(error: unknown): boolean {\n if (error instanceof OpenGeniApiError) return error.retryable;\n return error instanceof TypeError;\n}\n"],"mappings":";AACO,IAAM,mBAAN,cAA+B,MAAM;AAAA,E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AAC,aAAa,KAAK,KAAK,GAAG;AAChF;AAAA,EACF;AACA,SAAO;AACT;AAGO,IAAM,iCAAN,cAA6C,iBAAiB;AAAC;AAG/D,IAAM,mCAAN,cAA+C,MAAM;AAAA,EACjD;AAAA,EACA;AAAA,EAET,YAAY,UAAkB,QAAgB;AAC5C,UAAM,kDAAkD,QAAQ,gBAAgB,MAAM,EAAE;AACxF,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AACF;AAGO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC7C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,aAAa,OAAyB;AACpD,SACG,iBAAiB,gBAAgB,MAAM,SAAS,gBAChD,iBAAiB,SAAS,MAAM,SAAS;AAE9C;AAQO,SAAS,uBAAuB,OAAyB;AAC9D,MAAI,iBAAiB,iBAAkB,QAAO,MAAM;AACpD,SAAO,iBAAiB;AAC1B;","names":[]}
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, 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";
@@ -667,9 +667,14 @@ export declare class OpenGeniClient {
667
667
  activated: boolean;
668
668
  accountId: string;
669
669
  }>;
670
- /** P3: enable/disable Codex auto-rotation and/or pick the strategy. Returns the effective settings. */
670
+ /** Designate one owner-connected subscription for Apps only. */
671
+ designateCodexAppsAccount(workspaceId: string, accountId: string, expectedVersion: number): Promise<CodexAppsUpdate>;
672
+ /** Clear the Apps credential without changing any inference selection. */
673
+ clearCodexAppsAccount(workspaceId: string, expectedVersion: number): Promise<CodexAppsUpdate>;
674
+ /** Enable or disable Codex auto-rotation. Returns the effective settings. */
671
675
  setCodexRotationSettings(workspaceId: string, patch: {
672
676
  rotationEnabled?: boolean;
677
+ /** @deprecated Rotation now has one effective sharded strategy. */
673
678
  rotationStrategy?: CodexRotationSettings["rotationStrategy"];
674
679
  }): Promise<CodexRotationSettings>;
675
680
  /** Toggle only NEW automatic allocations under independent allocator OCC. */
@@ -5,8 +5,8 @@ import {
5
5
  projectSessionRealtimeLifecycle,
6
6
  sessionRealtimeOwnerStorageKey,
7
7
  sessionRealtimeOwnerStorageNamespace
8
- } from "./chunk-SLJ33Y7V.js";
9
- import "./chunk-UD2DNDSS.js";
8
+ } from "./chunk-KIHGPM7H.js";
9
+ import "./chunk-V5F253OG.js";
10
10
  export {
11
11
  CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,
12
12
  createCodexRealtimeController,
package/dist/core.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  OPENGENI_API_CONTRACT_REVISION,
4
4
  OpenGeniClient,
5
5
  resolveWorkspaceVoiceInputEnabled
6
- } from "./chunk-74LY67W7.js";
6
+ } from "./chunk-ONKUBP7A.js";
7
7
  import {
8
8
  OpenGeniApiContractMismatchError,
9
9
  OpenGeniApiError,
10
10
  OpenGeniSessionListCursorError,
11
11
  OpenGeniStreamError,
12
12
  isRetryableStreamError
13
- } from "./chunk-UD2DNDSS.js";
13
+ } from "./chunk-V5F253OG.js";
14
14
  export {
15
15
  OPENGENI_API_CONTRACT_HEADER,
16
16
  OPENGENI_API_CONTRACT_REVISION,
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  resolveWorkspaceVoiceInputEnabled,
18
18
  streamSessionEvents,
19
19
  streamWorkspaceControlEvents
20
- } from "./chunk-74LY67W7.js";
20
+ } from "./chunk-ONKUBP7A.js";
21
21
  import {
22
22
  CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
23
23
  CodexRealtimeMicrophoneError,
@@ -31,14 +31,14 @@ import {
31
31
  parseCodexRealtimeV3Event,
32
32
  projectSessionRealtimeLifecycle,
33
33
  startCodexRealtimeWebrtc
34
- } from "./chunk-SLJ33Y7V.js";
34
+ } from "./chunk-KIHGPM7H.js";
35
35
  import {
36
36
  OpenGeniApiContractMismatchError,
37
37
  OpenGeniApiError,
38
38
  OpenGeniSessionListCursorError,
39
39
  OpenGeniStreamError,
40
40
  isRetryableStreamError
41
- } from "./chunk-UD2DNDSS.js";
41
+ } from "./chunk-V5F253OG.js";
42
42
  import {
43
43
  createGatewayRealtimeTransportStarter
44
44
  } from "./chunk-DXDL7EEW.js";
package/dist/realtime.js CHANGED
@@ -23,8 +23,8 @@ import {
23
23
  sessionRealtimeOwnerStorageKey,
24
24
  sessionRealtimeOwnerStorageNamespace,
25
25
  startCodexRealtimeWebrtc
26
- } from "./chunk-SLJ33Y7V.js";
27
- import "./chunk-UD2DNDSS.js";
26
+ } from "./chunk-KIHGPM7H.js";
27
+ import "./chunk-V5F253OG.js";
28
28
  import {
29
29
  createGatewayRealtimeTransportStarter
30
30
  } from "./chunk-DXDL7EEW.js";
package/dist/types.d.ts CHANGED
@@ -606,6 +606,7 @@ export type SocialConnection = {
606
606
  accountHandle: string;
607
607
  accountName: string | null;
608
608
  externalAccountId: string | null;
609
+ ownership: "workspace" | "personal";
609
610
  status: SocialConnectionStatus;
610
611
  scopes: string[];
611
612
  credentialRef: string | null;
@@ -616,6 +617,7 @@ export type SocialConnection = {
616
617
  };
617
618
  export type SocialOAuthStartRequest = {
618
619
  provider: "x" | "reddit";
620
+ ownership?: "workspace" | "personal" | undefined;
619
621
  scopes?: string[] | undefined;
620
622
  returnPath?: string | undefined;
621
623
  };
@@ -1562,7 +1564,7 @@ export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
1562
1564
  * can introduce permissions without breaking older SDK consumers.
1563
1565
  */
1564
1566
  export type Permission = KnownPermission | (string & {});
1565
- 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_token" | "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";
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";
1566
1568
  export type ProductAccessMode = "local" | "configured" | "managed";
1567
1569
  export type ModelCapabilitySupportV1 = "supported" | "unsupported" | "unknown";
1568
1570
  export type ModelCapabilityStateV1 = {
@@ -1772,6 +1774,10 @@ export type CodexAccount = {
1772
1774
  /** Cached authoritative summary count, never detailed redemption authority. */
1773
1775
  resetCreditAvailableCount?: number | null;
1774
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;
1775
1781
  };
1776
1782
  export type CodexResetCredit = {
1777
1783
  id: string;
@@ -1832,24 +1838,37 @@ export type CodexAllocatorUpdate = {
1832
1838
  allocatorUpdatedAt: string | null;
1833
1839
  changed: boolean;
1834
1840
  };
1835
- /** Per-workspace Codex rotation/active settings. P1: rotation inert, only activeCredentialId loads. */
1841
+ /** Per-workspace Codex rotation/active settings. New servers return `sharded`. */
1836
1842
  export type CodexRotationSettings = {
1837
1843
  rotationEnabled: boolean;
1838
- rotationStrategy: "most_remaining" | "round_robin" | "drain_then_next";
1844
+ rotationStrategy: "sharded" | "most_remaining" | "round_robin" | "drain_then_next";
1839
1845
  activeCredentialId: string | null;
1840
1846
  };
1841
1847
  /** GET /codex/accounts — the accounts list + the workspace active pointer + settings. */
1842
1848
  export type CodexAccountsResponse = {
1843
1849
  accounts: CodexAccount[];
1844
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
+ };
1845
1859
  settings: CodexRotationSettings;
1846
1860
  };
1861
+ export type CodexAppsUpdate = {
1862
+ credentialId: string | null;
1863
+ version: number;
1864
+ designatedAt: string | null;
1865
+ changed: boolean;
1866
+ };
1847
1867
  /** Payload of a `codex.account.switched` session event. */
1848
1868
  export type CodexAccountSwitchedPayload = {
1849
1869
  fromAccountId: string | null;
1850
1870
  toAccountId: string;
1851
1871
  reason: "manual" | "exhausted" | "rotation";
1852
- droppedConnectors?: string[];
1853
1872
  };
1854
1873
  /** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */
1855
1874
  export type CodexConnectStart = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/sdk",
3
- "version": "0.44.0",
3
+ "version": "0.44.6",
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,
@@ -3418,11 +3419,37 @@ export class OpenGeniClient {
3418
3419
  );
3419
3420
  }
3420
3421
 
3421
- /** P3: enable/disable Codex auto-rotation and/or pick the strategy. Returns the effective settings. */
3422
+ /** Designate one owner-connected subscription for Apps only. */
3423
+ async designateCodexAppsAccount(
3424
+ workspaceId: string,
3425
+ accountId: string,
3426
+ expectedVersion: number,
3427
+ ): Promise<CodexAppsUpdate> {
3428
+ return await this.requestJson<CodexAppsUpdate>(
3429
+ "POST",
3430
+ `/v1/workspaces/${workspaceId}/codex/apps`,
3431
+ { accountId, expectedVersion },
3432
+ );
3433
+ }
3434
+
3435
+ /** Clear the Apps credential without changing any inference selection. */
3436
+ async clearCodexAppsAccount(
3437
+ workspaceId: string,
3438
+ expectedVersion: number,
3439
+ ): Promise<CodexAppsUpdate> {
3440
+ return await this.requestJson<CodexAppsUpdate>(
3441
+ "DELETE",
3442
+ `/v1/workspaces/${workspaceId}/codex/apps`,
3443
+ { expectedVersion },
3444
+ );
3445
+ }
3446
+
3447
+ /** Enable or disable Codex auto-rotation. Returns the effective settings. */
3422
3448
  async setCodexRotationSettings(
3423
3449
  workspaceId: string,
3424
3450
  patch: {
3425
3451
  rotationEnabled?: boolean;
3452
+ /** @deprecated Rotation now has one effective sharded strategy. */
3426
3453
  rotationStrategy?: CodexRotationSettings["rotationStrategy"];
3427
3454
  },
3428
3455
  ): Promise<CodexRotationSettings> {
package/src/errors.ts CHANGED
@@ -29,7 +29,7 @@ export class OpenGeniApiError extends Error {
29
29
  const displayMessage =
30
30
  options.displayMessage ??
31
31
  (gatewayFailure && fromResponse
32
- ? "OpenGeni is temporarily unavailable — retry."
32
+ ? (decoded?.message ?? "OpenGeni is temporarily unavailable — retry.")
33
33
  : `OpenGeni API ${status}: ${message}`);
34
34
  super(correlationId ? `${displayMessage} Reference: ${correlationId}.` : displayMessage);
35
35
  this.name = "OpenGeniApiError";
package/src/types.ts CHANGED
@@ -812,6 +812,7 @@ export type SocialConnection = {
812
812
  accountHandle: string;
813
813
  accountName: string | null;
814
814
  externalAccountId: string | null;
815
+ ownership: "workspace" | "personal";
815
816
  status: SocialConnectionStatus;
816
817
  scopes: string[];
817
818
  credentialRef: string | null;
@@ -823,6 +824,7 @@ export type SocialConnection = {
823
824
 
824
825
  export type SocialOAuthStartRequest = {
825
826
  provider: "x" | "reddit";
827
+ ownership?: "workspace" | "personal" | undefined;
826
828
  scopes?: string[] | undefined;
827
829
  returnPath?: string | undefined;
828
830
  };
@@ -2092,7 +2094,6 @@ export type FirstPartyMcpToolName =
2092
2094
  | "variable_set_set_variable"
2093
2095
  | "environment_set_variable"
2094
2096
  | "github_connect_link"
2095
- | "github_token"
2096
2097
  | "github_repositories_list"
2097
2098
  | "social_connections_list"
2098
2099
  | "social_posts_recent"
@@ -2368,6 +2369,10 @@ export type CodexAccount = {
2368
2369
  /** Cached authoritative summary count, never detailed redemption authority. */
2369
2370
  resetCreditAvailableCount?: number | null;
2370
2371
  resetCreditsCheckedAt?: string | null;
2372
+ /** True when this exact credential is the workspace's independent Apps credential. */
2373
+ appsDesignated: boolean;
2374
+ /** True only for the scoped managed human who connected it. */
2375
+ canEnableApps: boolean;
2371
2376
  };
2372
2377
 
2373
2378
  export type CodexResetCredit = {
@@ -2434,10 +2439,10 @@ export type CodexAllocatorUpdate = {
2434
2439
  changed: boolean;
2435
2440
  };
2436
2441
 
2437
- /** Per-workspace Codex rotation/active settings. P1: rotation inert, only activeCredentialId loads. */
2442
+ /** Per-workspace Codex rotation/active settings. New servers return `sharded`. */
2438
2443
  export type CodexRotationSettings = {
2439
2444
  rotationEnabled: boolean;
2440
- rotationStrategy: "most_remaining" | "round_robin" | "drain_then_next";
2445
+ rotationStrategy: "sharded" | "most_remaining" | "round_robin" | "drain_then_next";
2441
2446
  activeCredentialId: string | null;
2442
2447
  };
2443
2448
 
@@ -2445,18 +2450,29 @@ export type CodexRotationSettings = {
2445
2450
  export type CodexAccountsResponse = {
2446
2451
  accounts: CodexAccount[];
2447
2452
  activeAccountId: string | null;
2453
+ /** Added by Apps-aware servers; absent on older same-major deployments. */
2454
+ apps?: {
2455
+ available: boolean;
2456
+ credentialId: string | null;
2457
+ version: number;
2458
+ designatedAt: string | null;
2459
+ canDisable: boolean;
2460
+ };
2448
2461
  settings: CodexRotationSettings;
2449
2462
  };
2450
2463
 
2464
+ export type CodexAppsUpdate = {
2465
+ credentialId: string | null;
2466
+ version: number;
2467
+ designatedAt: string | null;
2468
+ changed: boolean;
2469
+ };
2470
+
2451
2471
  /** Payload of a `codex.account.switched` session event. */
2452
2472
  export type CodexAccountSwitchedPayload = {
2453
2473
  fromAccountId: string | null;
2454
2474
  toAccountId: string;
2455
2475
  reason: "manual" | "exhausted" | "rotation";
2456
- // P4 connector-aware rotation: the session's used connectors that the new account
2457
- // does NOT cover (a prefer-not-require failover that dropped a connector). Present
2458
- // only on such a switch; the UI renders a "dropped <connector>" badge on the pill.
2459
- droppedConnectors?: string[];
2460
2476
  };
2461
2477
 
2462
2478
  /** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */