@opengeni/sdk 0.37.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -24,12 +24,12 @@ export type { SessionEventStreamTransport, StreamConnectionState, StreamSessionE
24
24
  export { streamWorkspaceControlEvents } from "./workspace-control-stream";
25
25
  export type { WorkspaceControlStreamTransport } from "./workspace-control-stream";
26
26
  export type { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest, RollbackWorkspaceArtifactRequest, WorkspaceArtifact, WorkspaceArtifactContentResponse, WorkspaceArtifactDetailResponse, WorkspaceArtifactEvent, WorkspaceArtifactListOptions, WorkspaceArtifactListResponse, WorkspaceArtifactMutationResponse, WorkspaceArtifactVersion, } from "./workspace-artifacts";
27
- export { normalizeWorkspaceInstructionPolicyRoleKey } from "./workspace-instruction-policies";
28
- export type { ActivateWorkspaceInstructionPolicyRequest, CreateWorkspaceInstructionPolicyDraftRequest, ImportLegacyWorkspaceInstructionPolicyDraftRequest, RollbackWorkspaceInstructionPolicyRequest, WorkspaceInstructionPolicyActivationEvent, WorkspaceInstructionPolicyActivationResponse, WorkspaceInstructionPolicyActivationType, WorkspaceInstructionPolicyConflictResponse, WorkspaceInstructionPolicyDiffRequest, WorkspaceInstructionPolicyDiffResponse, WorkspaceInstructionPolicyDraftProvenanceSource, WorkspaceInstructionPolicyHead, WorkspaceInstructionPolicyKind, WorkspaceInstructionPolicyListOptions, WorkspaceInstructionPolicyListResponse, WorkspaceInstructionPolicyProvenanceSource, WorkspaceInstructionPolicyRevision, WorkspaceInstructionPolicyRevisionIdentity, WorkspaceInstructionPolicyScope, WorkspaceInstructionPolicyTarget, } from "./workspace-instruction-policies";
29
- export type { WorkspaceStateDocumentStatusCounts, WorkspaceStateGapCode, WorkspaceStateMemoryKindCounts, WorkspaceStateMemoryStatusCounts, WorkspaceStateResponse, WorkspaceStateSourceKindCounts, } from "./workspace-state";
27
+ export { normalizeWorkspaceInstructionPolicyRoleKey, WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS, } from "./workspace-instruction-policies";
28
+ export type { ActivateWorkspaceInstructionPolicyRequest, CreateWorkspaceInstructionPolicyDraftRequest, CreateWorkspaceInstructionPolicyOnboardingProposalRequest, ImportLegacyWorkspaceInstructionPolicyDraftRequest, RollbackWorkspaceInstructionPolicyRequest, WorkspaceInstructionPolicyActivationEvent, WorkspaceInstructionPolicyActivationResponse, WorkspaceInstructionPolicyActivationType, WorkspaceInstructionPolicyConflictResponse, WorkspaceInstructionPolicyDiffRequest, WorkspaceInstructionPolicyDiffResponse, WorkspaceInstructionPolicyDraftProvenanceSource, WorkspaceInstructionPolicyHead, WorkspaceInstructionPolicyKind, WorkspaceInstructionPolicyListOptions, WorkspaceInstructionPolicyListResponse, WorkspaceInstructionPolicyOnboardingProposal, WorkspaceInstructionPolicyOnboardingProposalConflictResponse, WorkspaceInstructionPolicyOnboardingProposalContentErrorResponse, WorkspaceInstructionPolicyOnboardingProposalListOptions, WorkspaceInstructionPolicyOnboardingProposalListResponse, WorkspaceInstructionPolicyOnboardingProposalSource, WorkspaceInstructionPolicyOnboardingProposalStaleResponse, WorkspaceInstructionPolicyOperationReuseResponse, WorkspaceInstructionPolicyProvenanceSource, WorkspaceInstructionPolicyRevision, WorkspaceInstructionPolicyRevisionIdentity, WorkspaceInstructionPolicyScope, WorkspaceInstructionPolicyTarget, } from "./workspace-instruction-policies";
29
+ export type { WorkspaceStateDocumentStatusCounts, WorkspaceStateAttemptGovernance, WorkspaceStateGapCode, WorkspaceStateGetOptions, WorkspaceStateGovernanceDriftStatus, WorkspaceStateMemoryKindCounts, WorkspaceStateMemoryStatusCounts, WorkspaceStateResponse, WorkspaceStateSourceKindCounts, } from "./workspace-state";
30
30
  export { normalizePreferenceRegistryStableKey } from "./preference-registry";
31
31
  export type { ActivatePreferenceRegistryRevisionRequest, ChangePreferenceRegistryScopeRequest, CorrectPreferenceRegistryRequest, CreatePreferenceRegistryProposalRequest, DeactivatePreferenceRegistryRequest, PreferenceRegistryConflictStrategy, PreferenceRegistryDescriptor, PreferenceRegistryDescriptorProvenance, PreferenceRegistryDetailResponse, PreferenceRegistryEvent, PreferenceRegistryFullContent, PreferenceRegistryListOptions, PreferenceRegistryListResponse, PreferenceRegistryMutationResponse, PreferenceRegistryPrecedence, PreferenceRegistryProvenanceSource, PreferenceRegistryRecord, PreferenceRegistryRevisionSummary, PreferenceRegistryScope, PreferenceRegistryScopeTarget, PreferenceRegistrySnapshot, PreferenceRegistryStatus, PreferenceRegistryTrust, RejectPreferenceRegistryProposalRequest, SupersedePreferenceRegistryRequest, } from "./preference-registry";
32
32
  export { DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY, authorizeTranscriptionAdapter, createTranscriptionSessionRequest, resolveWorkspaceVoiceInputEnabled, resolveWorkspaceTranscriptionPolicy, } from "./transcription";
33
33
  export type { TranscriptionAdapter, TranscriptionAdapterDescriptor, TranscriptionAdapterStartContext, TranscriptionAuthorization, TranscriptionCredentialMode, TranscriptionDiagnostic, TranscriptionErrorCode, TranscriptionEvent, TranscriptionEventListener, TranscriptionLifecycleStatus, TranscriptionPolicyBlockReason, TranscriptionResultMetadata, TranscriptionSession, TranscriptionSessionRequest, TranscriptionSpeaker, TranscriptionTargetSelection, TranscriptionTimeSpan, TranscriptionWord, WorkspaceTranscriptionPolicy, WorkspaceTranscriptionTarget, } from "./transcription";
34
- export { KNOWN_PERMISSIONS, KNOWN_USAGE_EVENT_TYPES, OPENGENI_API_CONTRACT_HEADER, OPENGENI_API_CONTRACT_REVISION, OPENGENI_CORRELATION_HEADER, RETAINED_OUTPUT_DEFAULT_PAGE_BYTES, RETAINED_OUTPUT_MAX_PAGE_BYTES, SESSION_EVENT_TYPES, } from "./types";
35
- export type { AccessContext, ActivateCodexRealtimeConnectionRequest, AccessGrant, AccountGrant, AccountRole, AddWorkspaceMemberRequest, BeginSessionRealtimeRequest, AgentMessageCompletedPayload, AgentTextDeltaPayload, AgentToolCallCreatedPayload, AgentToolCallOutputPayload, ApiKey, BillingBalance, BillingEntitlementsResponse, BillingMode, BillingSummary, BillingUsageResponse, InsightsRange, InsightsBillingPath, InsightsModelUsageRow, InsightsSeriesPoint, InsightsDepthBucket, InsightsModelFacet, InsightsSpendDriver, InsightsWarmGroupRow, InsightsLiveWarmLease, InsightsFloorSession, InsightsScheduleRow, WorkspaceInsightsSnapshot, WorkspaceInsightsResponse, CapabilityCatalogItem, CapabilityCatalogResponse, CapabilityInstallation, CapabilityInstallationStatus, CapabilityKind, CapabilityPack, CapabilityPackConnector, CapabilityPackConnectorAuthModel, CapabilityPackVariableSetSpec, CapabilityPackKnowledge, CapabilityPackScheduledTaskTemplate, CapabilityPackSkill, CapabilityPackSkillFile, CapabilityRuntime, CapabilitySource, CapabilityUnavailableReason, ClientConfig, ClientVoiceInputConfig, ClientModel, CodexRealtimeVoice, CodexRealtimeWebrtcRequest, CodexRealtimeWebrtcResponse, CodexRealtimeWebrtcVersion, GatewayRealtimeConnectRequest, GatewayRealtimeConnectResponse, GatewayRealtimeInitialItem, EndSessionRealtimeRequest, ModelAvailabilityV1, ModelBillingAttributionV1, ModelCapabilitiesV1, ModelCapabilityStateV1, ModelCapabilitySupportV1, ModelCredentialReadinessV1, ModelCredentialSourceV1, ModelPricingScheduleV1, ModelPricingV1, RenewSessionRealtimeRequest, SessionRealtimeEndReason, SessionRealtimeMode, SessionRealtimeModel, SessionRealtimeMutationResponse, SessionRealtimeState, WorkspaceModelCatalogModel, WorkspaceModelCatalogResponse, WorkspaceRealtimeModelCatalogItem, WorkspaceRealtimeModelCatalogResponse, CodexAccount, CodexAccountOverview, CodexAccountsResponse, CodexAllocatorUpdate, CodexAccountSwitchedPayload, CodexConnectionStatus, CodexConnectStart, CodexConnectPoll, CodexFleetConfidence, CodexFleetCacheState, CodexFleetDecisionEventPayload, CodexFleetDecisionScore, CodexFleetShadowComparison, CodexOverviewResponse, CodexResetCredit, CodexResetRedemptionRecovery, CodexRotationSettings, CodexUsage, CodexUsageMap, CodexUsagePayload, CodexUsageWindow, CompactSessionContextResult, ClientSessionEventInput, CompleteFileUploadResponse, ConnectionKind, ConnectionMetadata, ConnectionOwnership, ConnectionResponse, ConnectionStatus, AddDocumentRequest, CreateApiKeyRequest, CreateApiKeyResponse, CreateCapabilityCatalogItemRequest, OpenGeniSlackBotInstallRequest, OpenGeniSlackBotInstallStart, SlackReactionChannel, SlackReactionChannelListResponse, CreateConnectionRequest, CreateCheckoutRequest, CreateCheckoutResponse, CreateDocumentBaseRequest, CreateFileUploadRequest, CreateFileUploadResponse, CreateGitHubAppManifestRequest, CreateGitHubAppManifestResponse, CreateKnowledgeDropRequest, CreateKnowledgeMemoryRequest, CreateScheduledTaskRequest, CreateSessionRequest, CreateVariableSetRequest, CreateWorkspaceEnvironmentRequest, CreateWorkspaceRequest, DiscoverMcpCapabilitiesResponse, Document, DocumentBase, DocumentCuration, DocumentCurationStatus, DocumentSearchMode, DocumentSearchRequest, DocumentSearchResponse, DocumentSearchResult, DocumentStatus, DocumentVisibility, MoveDocumentRequest, EnableCapabilityRequest, EnablePackRequest, Entitlements, EntitlementValue, EntitlementsMode, FileAsset, HumanInputAnswer, HumanInputOption, HumanInputQuestion, HumanInputQuestionKind, HumanInputResponse, FileDownloadUrlResponse, FileResourceRef, FileStatus, FileUploadData, FirstPartyMcpToolName, GetPackResponse, GitHubAppInfo, GitHubAppSetupMode, GitHubBindingStatus, GitHubInstallationBinding, GitHubInstallationLifecycle, GitHubRepositoriesResponse, GoogleDriveBrowseItem, GoogleDriveBrowseResponse, GoogleDriveConnectionMetadata, GoogleDriveOAuthStartRequest, GoogleDriveOAuthStartResponse, GoogleDriveReadPolicy, GoogleDriveSelectedSource, GoogleDriveSyncCadence, GoogleDriveTargetScope, GitHubRepository, GitHubRepositoryScope, GoalSpec, IntegrationClientMetadata, KnownPermission, KnownSessionEventType, KnownUsageEventType, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemorySearchRequest, KnowledgeMemoryStatus, KnowledgeSourceKind, KnowledgeSourceRef, GitCredentialProvider, GitCredentialBindingId, GitRepositoryAccess, ListApiKeysResponse, ListConnectionsResponse, ListPacksResponse, ListWorkspaceMembersResponse, McpServerConnectionRef, McpPersonalConnectionDelegation, McpPersonalConnectionSummary, OAuthStartRequest, OAuthStartResponse, PackInstallation, PackInstallationStatus, Permission, ProductAccessMode, LatencyMode, ReasoningEffort, RetainedArtifactContent, RetainedArtifactContentOptions, RetainedArtifactMetadata, RetainedArtifactReference, RetainedArtifactUnavailable, RetainedOutputKind, RetainedOutputUnavailableReason, RecordingAvailablePayload, RecordingCodec, RecordingContentType, RecordingFailedPayload, RecordingFailedReason, RecordingMode, RecordingStartedPayload, RegisterCapabilityPackRequest, RepositoryResourceRef, ResourceRef, SaveGoogleDriveSourceRequest, SandboxBackend, SandboxCapabilityName, SandboxOs, ScheduledTask, ScheduledTaskAgentConfig, ScheduledTaskAgentConfigInput, ScheduledTaskDayOfWeek, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, Session, SessionCapabilities, SessionListResponse, SessionLineageResponse, SessionEffectiveToolPolicy, SessionQueueMutationResponse, SessionQueueSnapshot, SessionControlResponse, ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, EffectiveControlBlocker, EffectiveControlResumeOption, EffectiveSessionControl, MoveSessionQueueItemRequest, NewSessionDraft, NewSessionDraftOptions, SaveComposerDraftRequest, SaveNewSessionDraftRequest, SessionCommandReceipt, SteerSessionQueueItemRequest, WorkspaceInferenceControlResponse, SessionPendingInputPreview, SessionSystemUpdate, SessionSystemUpdateKind, SessionSystemUpdateState, SessionSummary, LineageNode, SessionMcpCredentialUpdateInput, SessionMcpApprovalPolicy, SessionMcpServerInput, SessionMcpServerMetadata, SessionToolPolicy, FileSystemCapability, TerminalCapability, GitCapability, DesktopStreamCapability, RecordingCapability, ComputerUseCapability, ClientAuthConfig, StreamUrlRotatedPayload, StreamOpenedPayload, StreamClosedPayload, StreamRevokedPayload, AttachViewerRequest, AttachViewerResponse, ViewerHolder, AcknowledgeStreamRequest, AcknowledgeStreamResponse, ViewerHeartbeatRequest, ViewerHeartbeatResponse, SessionEvent, SessionEventCompactResult, SessionEventCompactResultOptions, SessionEventListOptions, SessionEventLatestClass, SessionEventPage, SessionEventPayloadMode, SessionEventReadDirection, SessionEventReadMode, SessionEventResultMode, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalCreatedBy, SessionGoalStatus, SessionHumanInputRequest, SessionStatus, SessionStatusChangedPayload, SessionStructuredCapabilities, SessionTurn, ServiceTurnInitiator, ServiceTurnInitiatorContext, TurnInitiatorContext, SessionTurnSource, SessionTurnStatus, SubmitHumanInputResponseRequest, TurnInitiator, ToolAuthNeededPayload, UpdateConnectionRequest, SandboxCommandOutputDeltaPayload, FsChangeKind, FsChangedPayload, GitChangedPayload, TerminalPtyStartedPayload, TerminalPtyOutputDeltaPayload, TerminalPtyExitedPayload, FsNodeType, FsTreeNode, FsEncoding, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitFileStatusCode, GitFileStatus, GitStatusRequest, GitStatusResponse, GitDiffLineType, GitDiffLine, GitDiffHunk, GitFileDiff, GitDiffRequest, GitDiffResponse, GitLogRequest, GitCommit, GitLogResponse, GitShowRequest, GitShowResponse, SetWorkspaceEnvironmentVariableRequest, WorkspaceCaptureFile, WorkspaceCaptureRepo, WorkspaceCaptureDegradedReason, WorkspaceCaptureStats, WorkspaceCaptureManifest, WorkspaceRevisionCapturedPayload, WorkspaceRevisionDegradedPayload, WorkspaceCaptureSignedUrl, GetWorkspaceCaptureResponse, GetWorkspaceCaptureFileResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, ToolRef, UpdateKnowledgeMemoryRequest, UpdateScheduledTaskRequest, UpdateSessionGoalRequest, UpdateSessionMcpApprovalPolicyRequest, UpdateSessionMcpApprovalPolicyResponse, UpdateSessionPinRequest, UpdateSessionRequest, UpdateSessionToolPolicyRequest, UpdateVariableSetRequest, UpdateWorkspaceEnvironmentRequest, UpdateWorkspaceMemberRequest, UpdateWorkspaceRequest, UpdateWorkspaceSettingsRequest, WorkspaceSlackReactionSummonSettings, TranscribeAudioResponse, UploadFileInput, UsageEvent, UsageEventType, UserApprovalDecisionEventInput, UserHumanInputResponseEventInput, UserMessageEventInput, Workspace, WorkspaceControlEvent, VariableSet, VariableSetVariableMetadata, Rig, RigVersion, RigCheck, RigChange, RigChangeKind, RigChangeStatus, RigCheckResult, RigChangeVerification, CreateRigRequest, UpdateRigRequest, RigSetupAppendPayload, RigDefinitionEditPayload, ProposeRigChangeRequest, WorkspaceEnvironment, WorkspaceEnvironmentVariableMetadata, WorkspaceMember, WorkspaceMemorySearchMode, WorkspaceMemorySearchRequest, WorkspaceMemorySearchResult, WorkspaceMemorySearchResponse, WorkspaceSettings, WorkspaceVoiceInputSettings, WorkspaceRegisteredPack, MetricSample, MachineState, MachineKind, MachineView, MachinesResponse, MachineMetricsSeriesResponse, SwapActiveSandboxRequest, SwapActiveSandboxResponse, EnrollmentOs, DeviceEnrollmentLookupRequest, DeviceEnrollmentLookupResponse, DeviceEnrollmentLookupMachine, DeviceEnrollmentApproveRequest, DeviceEnrollmentApproveResponse, DeviceEnrollmentDenyRequest, DeviceEnrollmentDenyResponse, MintEnrollTokenRequest, MintEnrollTokenResponse, EnrollmentCredentials, EnrollTokenExchangeRequest, EnrollTokenExchangeResponse, } from "./types";
34
+ export { DEFAULT_FILE_RESOURCE_MOUNT_ROOT, KNOWN_PERMISSIONS, KNOWN_USAGE_EVENT_TYPES, OPENGENI_API_CONTRACT_HEADER, OPENGENI_API_CONTRACT_REVISION, OPENGENI_CORRELATION_HEADER, RETAINED_OUTPUT_DEFAULT_PAGE_BYTES, RETAINED_OUTPUT_MAX_PAGE_BYTES, SESSION_EVENT_TYPES, } from "./types";
35
+ export type { AccessContext, ActivateCodexRealtimeConnectionRequest, AccessGrant, AccountGrant, AccountRole, AddWorkspaceMemberRequest, BeginSessionRealtimeRequest, AgentMessageCompletedPayload, AgentTextDeltaPayload, AgentToolCallCreatedPayload, AgentToolCallOutputPayload, ApiKey, BillingBalance, BillingEntitlementsResponse, BillingMode, BillingSummary, BillingUsageResponse, InsightsRange, InsightsBillingPath, InsightsModelUsageRow, InsightsSeriesPoint, InsightsDepthBucket, InsightsModelFacet, InsightsSpendDriver, InsightsWarmGroupRow, InsightsLiveWarmLease, InsightsFloorSession, InsightsScheduleRow, WorkspaceInsightsSnapshot, WorkspaceInsightsResponse, CapabilityCatalogItem, CapabilityCatalogResponse, CapabilityInstallation, CapabilityInstallationStatus, CapabilityKind, CapabilityPack, CapabilityPackConnector, CapabilityPackConnectorAuthModel, CapabilityPackVariableSetSpec, CapabilityPackKnowledge, CapabilityPackScheduledTaskTemplate, CapabilityPackSkill, CapabilityPackSkillFile, CapabilityRuntime, CapabilitySource, CapabilityUnavailableReason, ClientConfig, ClientVoiceInputConfig, ClientModel, CodexRealtimeVoice, CodexRealtimeWebrtcRequest, CodexRealtimeWebrtcResponse, CodexRealtimeWebrtcVersion, GatewayRealtimeConnectRequest, GatewayRealtimeConnectResponse, GatewayRealtimeInitialItem, EndSessionRealtimeRequest, ModelAvailabilityV1, ModelBillingAttributionV1, ModelCapabilitiesV1, ModelCapabilityStateV1, ModelCapabilitySupportV1, ModelCredentialReadinessV1, ModelCredentialSourceV1, ModelPricingScheduleV1, ModelPricingV1, RenewSessionRealtimeRequest, SessionRealtimeEndReason, SessionRealtimeMode, SessionRealtimeModel, SessionRealtimeMutationResponse, SessionRealtimeState, WorkspaceModelCatalogModel, WorkspaceModelCatalogResponse, WorkspaceRealtimeModelCatalogItem, WorkspaceRealtimeModelCatalogResponse, CodexAccount, CodexAccountOverview, CodexAccountsResponse, CodexAllocatorUpdate, CodexAccountSwitchedPayload, CodexConnectionStatus, CodexConnectStart, CodexConnectPoll, CodexFleetConfidence, CodexFleetCacheState, CodexFleetDecisionEventPayload, CodexFleetDecisionScore, CodexFleetShadowComparison, CodexOverviewResponse, CodexResetCredit, CodexResetRedemptionRecovery, CodexRotationSettings, CodexUsage, CodexUsageMap, CodexUsagePayload, CodexUsageWindow, CompactSessionContextResult, ClientSessionEventInput, CompleteFileUploadResponse, ConnectionKind, ConnectionMetadata, ConnectionOwnership, ConnectionResponse, ConnectionStatus, AddDocumentRequest, CreateApiKeyRequest, CreateApiKeyResponse, CreateCapabilityCatalogItemRequest, OpenGeniSlackBotInstallRequest, OpenGeniSlackBotInstallStart, SlackReactionChannel, SlackReactionChannelListResponse, CreateConnectionRequest, CreateCheckoutRequest, CreateCheckoutResponse, CreateDocumentBaseRequest, CreateFileUploadRequest, CreateFileUploadResponse, CreateGitHubAppManifestRequest, CreateGitHubAppManifestResponse, CreateKnowledgeDropRequest, CreateKnowledgeMemoryRequest, CreateScheduledTaskRequest, CreateSessionRequest, CreateVariableSetRequest, CreateWorkspaceEnvironmentRequest, CreateWorkspaceRequest, DiscoverMcpCapabilitiesResponse, Document, DocumentAuthorityKind, DocumentBase, DocumentCuration, DocumentCurationStatus, DocumentSearchMode, DocumentSearchRequest, DocumentSearchResponse, DocumentSearchResult, DocumentStatus, DocumentVisibility, MoveDocumentRequest, EnableCapabilityRequest, EnablePackRequest, Entitlements, EntitlementValue, EntitlementsMode, FileAsset, HumanInputAnswer, HumanInputOption, HumanInputQuestion, HumanInputQuestionKind, HumanInputResponse, FileDownloadUrlResponse, FileResourceRef, FileStatus, FileUploadData, FirstPartyMcpToolName, GetPackResponse, GitHubAppInfo, GitHubAppSetupMode, GitHubBindingStatus, GitHubInstallationBinding, GitHubInstallationLifecycle, GitHubRepositoriesResponse, GoogleDriveBrowseItem, GoogleDriveBrowseResponse, GoogleDriveConnectionLifecycle, GoogleDriveConnectionLifecycleState, GoogleDriveConnectionMetadata, GoogleDriveDisconnectRequest, GoogleDriveLifecycleActionRequest, GoogleDriveOAuthStartRequest, GoogleDriveOAuthStartResponse, GoogleDriveReadPolicy, GoogleDriveSelectedSource, GoogleDriveSyncCadence, GoogleDriveTargetScope, GitHubRepository, GitHubRepositoryScope, GoalSpec, IntegrationClientMetadata, KnownPermission, KnownSessionEventType, KnownUsageEventType, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemorySearchRequest, KnowledgeMemoryStatus, KnowledgeSourceKind, KnowledgeSourceRef, GitCredentialProvider, GitCredentialBindingId, GitRepositoryAccess, ListApiKeysResponse, ListConnectionsResponse, ListPacksResponse, ListWorkspaceMembersResponse, McpServerConnectionRef, McpPersonalConnectionDelegation, McpPersonalConnectionSummary, OAuthStartRequest, OAuthStartResponse, PackInstallation, PackInstallationStatus, Permission, ProductAccessMode, LatencyMode, ReasoningEffort, RetainedArtifactContent, RetainedArtifactContentOptions, RetainedArtifactMetadata, RetainedArtifactReference, RetainedArtifactUnavailable, RetainedOutputKind, RetainedOutputUnavailableReason, RecordingAvailablePayload, RecordingCodec, RecordingContentType, RecordingFailedPayload, RecordingFailedReason, RecordingMode, RecordingStartedPayload, RegisterCapabilityPackRequest, RepositoryResourceRef, ResourceRef, SaveGoogleDriveSourceRequest, SandboxBackend, SandboxCapabilityName, SandboxOs, ScheduledTask, ScheduledTaskAgentConfig, ScheduledTaskAgentConfigInput, ScheduledTaskDayOfWeek, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, Session, SessionCapabilities, SessionListResponse, SessionLineageResponse, SessionEffectiveToolPolicy, SessionQueueMutationResponse, SessionQueueSnapshot, SessionControlResponse, ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, EffectiveControlBlocker, EffectiveControlResumeOption, EffectiveSessionControl, MoveSessionQueueItemRequest, NewSessionDraft, NewSessionDraftOptions, SaveComposerDraftRequest, SaveNewSessionDraftRequest, SessionCommandReceipt, SteerSessionQueueItemRequest, WorkspaceInferenceControlResponse, SessionPendingInputPreview, SessionSystemUpdate, SessionSystemUpdateKind, SessionSystemUpdateState, SessionSummary, LineageNode, SessionMcpCredentialUpdateInput, SessionMcpApprovalPolicy, SessionMcpServerInput, SessionMcpServerMetadata, SessionToolPolicy, FileSystemCapability, TerminalCapability, GitCapability, DesktopStreamCapability, RecordingCapability, ComputerUseCapability, ClientAuthConfig, StreamUrlRotatedPayload, StreamOpenedPayload, StreamClosedPayload, StreamRevokedPayload, AttachViewerRequest, AttachViewerResponse, ViewerHolder, AcknowledgeStreamRequest, AcknowledgeStreamResponse, ViewerHeartbeatRequest, ViewerHeartbeatResponse, SessionEvent, SessionEventCompactResult, SessionEventCompactResultOptions, SessionEventListOptions, SessionEventLatestClass, SessionEventPage, SessionEventPayloadMode, SessionEventReadDirection, SessionEventReadMode, SessionEventResultMode, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalCreatedBy, SessionGoalStatus, SessionHumanInputRequest, SessionStatus, SessionStatusChangedPayload, SessionStructuredCapabilities, SessionTurn, ServiceTurnInitiator, ServiceTurnInitiatorContext, TurnInitiatorContext, SessionTurnSource, SessionTurnStatus, SubmitHumanInputResponseRequest, TurnInitiator, ToolAuthNeededPayload, UpdateConnectionRequest, SandboxCommandOutputDeltaPayload, FsChangeKind, FsChangedPayload, GitChangedPayload, TerminalPtyStartedPayload, TerminalPtyOutputDeltaPayload, TerminalPtyExitedPayload, FsNodeType, FsTreeNode, FsEncoding, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitFileStatusCode, GitFileStatus, GitStatusRequest, GitStatusResponse, GitDiffLineType, GitDiffLine, GitDiffHunk, GitFileDiff, GitDiffRequest, GitDiffResponse, GitLogRequest, GitCommit, GitLogResponse, GitShowRequest, GitShowResponse, SetWorkspaceEnvironmentVariableRequest, WorkspaceCaptureFile, WorkspaceCaptureRepo, WorkspaceCaptureDegradedReason, WorkspaceCaptureStats, WorkspaceCaptureManifest, WorkspaceRevisionCapturedPayload, WorkspaceRevisionDegradedPayload, WorkspaceCaptureSignedUrl, GetWorkspaceCaptureResponse, GetWorkspaceCaptureFileResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, ToolRef, UpdateKnowledgeMemoryRequest, UpdateScheduledTaskRequest, UpdateSessionGoalRequest, UpdateSessionMcpApprovalPolicyRequest, UpdateSessionMcpApprovalPolicyResponse, UpdateSessionPinRequest, UpdateSessionRequest, UpdateSessionToolPolicyRequest, UpdateVariableSetRequest, UpdateWorkspaceEnvironmentRequest, UpdateWorkspaceMemberRequest, UpdateWorkspaceRequest, UpdateWorkspaceSettingsRequest, WorkspaceSlackReactionSummonSettings, TranscribeAudioResponse, UploadFileInput, UsageEvent, UsageEventType, UserApprovalDecisionEventInput, UserHumanInputResponseEventInput, UserMessageEventInput, Workspace, WorkspaceControlEvent, VariableSet, VariableSetVariableMetadata, Rig, RigVersion, RigCheck, RigChange, RigChangeKind, RigChangeStatus, RigCheckResult, RigChangeVerification, CreateRigRequest, UpdateRigRequest, RigSetupAppendPayload, RigDefinitionEditPayload, ProposeRigChangeRequest, WorkspaceEnvironment, WorkspaceEnvironmentVariableMetadata, WorkspaceMember, WorkspaceMemorySearchMode, WorkspaceMemorySearchRequest, WorkspaceMemorySearchResult, WorkspaceMemorySearchResponse, WorkspaceSettings, WorkspaceVoiceInputSettings, WorkspaceRegisteredPack, MetricSample, MachineState, MachineKind, MachineView, MachinesResponse, MachineMetricsSeriesResponse, SwapActiveSandboxRequest, SwapActiveSandboxResponse, EnrollmentOs, DeviceEnrollmentLookupRequest, DeviceEnrollmentLookupResponse, DeviceEnrollmentLookupMachine, DeviceEnrollmentApproveRequest, DeviceEnrollmentApproveResponse, DeviceEnrollmentDenyRequest, DeviceEnrollmentDenyResponse, MintEnrollTokenRequest, MintEnrollTokenResponse, EnrollmentCredentials, EnrollTokenExchangeRequest, EnrollTokenExchangeResponse, } from "./types";
package/dist/index.js CHANGED
@@ -1,18 +1,5 @@
1
1
  import {
2
- CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
3
- CodexRealtimeMicrophoneError,
4
- acquireCodexRealtimeMicrophone,
5
- codexRealtimeMicrophoneHealthy,
6
- contextAppendChunks,
7
- createCodexRealtimeController,
8
- createCodexRealtimeV3Bridge,
9
- encodeCodexRealtimeV3DelegationContextAppend,
10
- encodeCodexRealtimeV3SessionContextAppend,
11
- parseCodexRealtimeV3Event,
12
- projectSessionRealtimeLifecycle,
13
- startCodexRealtimeWebrtc
14
- } from "./chunk-OB5PGV6N.js";
15
- import {
2
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
16
3
  DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
17
4
  KNOWN_PERMISSIONS,
18
5
  KNOWN_USAGE_EVENT_TYPES,
@@ -30,7 +17,21 @@ import {
30
17
  resolveWorkspaceVoiceInputEnabled,
31
18
  streamSessionEvents,
32
19
  streamWorkspaceControlEvents
33
- } from "./chunk-VOQ235WN.js";
20
+ } from "./chunk-DKNW4WMJ.js";
21
+ import {
22
+ CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
23
+ CodexRealtimeMicrophoneError,
24
+ acquireCodexRealtimeMicrophone,
25
+ codexRealtimeMicrophoneHealthy,
26
+ contextAppendChunks,
27
+ createCodexRealtimeController,
28
+ createCodexRealtimeV3Bridge,
29
+ encodeCodexRealtimeV3DelegationContextAppend,
30
+ encodeCodexRealtimeV3SessionContextAppend,
31
+ parseCodexRealtimeV3Event,
32
+ projectSessionRealtimeLifecycle,
33
+ startCodexRealtimeWebrtc
34
+ } from "./chunk-XBBPYTI5.js";
34
35
  import {
35
36
  OpenGeniApiContractMismatchError,
36
37
  OpenGeniApiError,
@@ -395,6 +396,7 @@ function ttydResizeFrame(columns, rows) {
395
396
  }
396
397
 
397
398
  // src/workspace-instruction-policies.ts
399
+ var WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS = 262144;
398
400
  function normalizeWorkspaceInstructionPolicyRoleKey(value) {
399
401
  return value.normalize("NFKC").trim().toLowerCase().replace(/\s+/gu, "-").replace(/-+/g, "-");
400
402
  }
@@ -406,6 +408,7 @@ function normalizePreferenceRegistryStableKey(value) {
406
408
  export {
407
409
  CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
408
410
  CodexRealtimeMicrophoneError,
411
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
409
412
  DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
410
413
  KNOWN_PERMISSIONS,
411
414
  KNOWN_USAGE_EVENT_TYPES,
@@ -423,6 +426,7 @@ export {
423
426
  TTYD_SUBPROTOCOL,
424
427
  TtydClientCommand,
425
428
  TtydServerCommand,
429
+ WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
426
430
  acquireCodexRealtimeMicrophone,
427
431
  applyUrlRotation,
428
432
  authorizeTranscriptionAdapter,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/artifact-client.ts","../src/proxy.ts","../src/mcp-output.ts","../src/desktop.ts","../src/terminal.ts","../src/workspace-instruction-policies.ts","../src/preference-registry.ts"],"sourcesContent":["import { OpenGeniClient as OpenGeniCoreClient } from \"./client\";\nimport type {\n CreateWorkspaceArtifactRequest,\n PublishWorkspaceArtifactVersionRequest,\n RollbackWorkspaceArtifactRequest,\n WorkspaceArtifactContentResponse,\n WorkspaceArtifactDetailResponse,\n WorkspaceArtifactListOptions,\n WorkspaceArtifactListResponse,\n WorkspaceArtifactMutationResponse,\n} from \"./workspace-artifacts\";\n\n/** Public SDK client. Artifact operations stay out of the console's eager core graph. */\nexport class OpenGeniClient extends OpenGeniCoreClient {\n async listWorkspaceArtifacts(\n workspaceId: string,\n options: WorkspaceArtifactListOptions = {},\n ): Promise<WorkspaceArtifactListResponse> {\n const query = new URLSearchParams();\n if (options.limit !== undefined) query.set(\"limit\", String(options.limit));\n if (options.cursor) query.set(\"cursor\", options.cursor);\n const suffix = query.size > 0 ? `?${query.toString()}` : \"\";\n return await this.requestJson<WorkspaceArtifactListResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts${suffix}`,\n );\n }\n\n async getWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n ): Promise<WorkspaceArtifactDetailResponse> {\n return await this.requestJson<WorkspaceArtifactDetailResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}`,\n );\n }\n\n async getWorkspaceArtifactContent(\n workspaceId: string,\n artifactId: string,\n versionId?: string,\n ): Promise<WorkspaceArtifactContentResponse> {\n const query = versionId ? `?versionId=${encodeURIComponent(versionId)}` : \"\";\n return await this.requestJson<WorkspaceArtifactContentResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}`,\n );\n }\n\n async createWorkspaceArtifact(\n workspaceId: string,\n request: CreateWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts`,\n request,\n );\n }\n\n async publishWorkspaceArtifactVersion(\n workspaceId: string,\n artifactId: string,\n request: PublishWorkspaceArtifactVersionRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/versions`,\n request,\n );\n }\n\n async rollbackWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n request: RollbackWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/rollback`,\n request,\n );\n }\n}\n","import type { OpenGeniClient } from \"./client\";\nimport type { StreamSessionEventsOptions } from \"./stream\";\nimport type { SessionEvent } from \"./types\";\n\n/**\n * Proxy-through-your-own-API helpers.\n *\n * The intended pattern: a customer's server consumes the OpenGeni event\n * stream with its own API key (`client.streamEvents(...)`) and re-emits it to\n * its browser clients over its own authenticated endpoint — the OpenGeni key\n * never reaches the browser. The re-emitted wire format is identical to\n * OpenGeni's own SSE stream (`id: <sequence>`, `event: <type>`,\n * `data: <event JSON>`), so the browser side can consume it with this same\n * SDK's streaming core (or a plain `EventSource`), including resume via\n * `?after=` / `Last-Event-ID`.\n */\n\n/** Format one event exactly as OpenGeni's API emits it over SSE. */\nexport function formatSseEvent(event: SessionEvent): string {\n return `id: ${event.sequence}\\nevent: ${event.type}\\ndata: ${JSON.stringify(event)}\\n\\n`;\n}\n\nexport type SseReStreamOptions = {\n /**\n * Emit `: ping` comment lines at this interval, keeping intermediaries from\n * idling the connection out. Disabled when omitted.\n */\n heartbeatMs?: number;\n /**\n * Called when the downstream consumer cancels (e.g. the browser\n * disconnected). Use it to abort the upstream OpenGeni stream — an async\n * iterator that is mid-`await` cannot be interrupted by `return()` alone.\n */\n onCancel?: () => void;\n};\n\n/**\n * Re-emit a stream of session events as an SSE byte stream. Pull-based, so\n * upstream consumption follows downstream demand; cancelling the returned\n * stream fires `onCancel` and ends the upstream iterator.\n */\nexport function sessionEventsToSseStream(\n events: AsyncIterable<SessionEvent>,\n options: SseReStreamOptions = {},\n): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n const iterator = events[Symbol.asyncIterator]();\n let heartbeat: ReturnType<typeof setInterval> | undefined;\n let cancelled = false;\n\n const stopHeartbeat = (): void => {\n if (heartbeat !== undefined) {\n clearInterval(heartbeat);\n heartbeat = undefined;\n }\n };\n\n return new ReadableStream<Uint8Array>({\n start: (controller) => {\n if (options.heartbeatMs !== undefined) {\n heartbeat = setInterval(() => {\n try {\n controller.enqueue(encoder.encode(\": ping\\n\\n\"));\n } catch {\n stopHeartbeat();\n }\n }, options.heartbeatMs);\n }\n },\n pull: async (controller) => {\n let result: IteratorResult<SessionEvent, unknown>;\n try {\n result = await iterator.next();\n } catch (error) {\n stopHeartbeat();\n throw error;\n }\n if (cancelled) {\n return;\n }\n if (result.done) {\n stopHeartbeat();\n controller.close();\n return;\n }\n controller.enqueue(encoder.encode(formatSseEvent(result.value)));\n },\n cancel: () => {\n cancelled = true;\n stopHeartbeat();\n options.onCancel?.();\n // Fire-and-forget: if the iterator is suspended mid-await, return()\n // settles only after onCancel unblocks it; cancel must not hang on it.\n void Promise.resolve(iterator.return?.(undefined)).then(\n () => undefined,\n () => undefined,\n );\n },\n });\n}\n\n/** Wrap an event stream in a ready-to-return SSE `Response`. */\nexport function sessionEventsToSseResponse(\n events: AsyncIterable<SessionEvent>,\n options: SseReStreamOptions = {},\n): Response {\n return new Response(sessionEventsToSseStream(events, options), {\n headers: {\n \"Content-Type\": \"text/event-stream; charset=utf-8\",\n \"Cache-Control\": \"no-cache, no-transform\",\n Connection: \"keep-alive\",\n },\n });\n}\n\n/**\n * Read the resume cursor a reconnecting SSE client sent: the `after` query\n * parameter, or the standard `Last-Event-ID` header (the re-emitted stream\n * sets `id:` to the sequence). Returns 0 (full replay) when absent.\n */\nexport function resumeSequenceFromRequest(request: Request): number {\n const url = new URL(request.url);\n const raw = url.searchParams.get(\"after\") ?? request.headers.get(\"Last-Event-ID\");\n const parsed = raw === null ? 0 : Number(raw);\n return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : 0;\n}\n\nexport type ProxySessionEventStreamOptions = Omit<StreamSessionEventsOptions, \"after\"> & {\n /**\n * Resume cursor. Pass a number, or the incoming browser `Request` to\n * honor its `?after=` / `Last-Event-ID` automatically.\n */\n after?: number | Request;\n /** See {@link SseReStreamOptions.heartbeatMs}. */\n heartbeatMs?: number;\n};\n\n/**\n * One-call proxy: consume the OpenGeni stream server-side and return an SSE\n * `Response` for your own browser clients. Works anywhere WHATWG `Response`\n * is the handler return type (Hono, Next.js route handlers, Bun.serve,\n * Cloudflare Workers, ...).\n *\n * The upstream OpenGeni connection is torn down when the downstream client\n * disconnects, and also when `options.signal` (e.g. the incoming request's\n * signal) aborts.\n */\nexport function proxySessionEventStream(\n client: OpenGeniClient,\n workspaceId: string,\n sessionId: string,\n options: ProxySessionEventStreamOptions = {},\n): Response {\n const { after, heartbeatMs, signal, ...streamOptions } = options;\n const upstream = new AbortController();\n if (signal?.aborted) {\n upstream.abort();\n } else {\n signal?.addEventListener(\"abort\", () => upstream.abort(), { once: true });\n }\n const resolvedAfter = after instanceof Request ? resumeSequenceFromRequest(after) : (after ?? 0);\n const events = client.streamEvents(workspaceId, sessionId, {\n ...streamOptions,\n after: resolvedAfter,\n signal: upstream.signal,\n });\n return sessionEventsToSseResponse(events, {\n ...(heartbeatMs !== undefined ? { heartbeatMs } : {}),\n onCancel: () => upstream.abort(),\n });\n}\n","/**\n * A transport-tolerant MCP tool result.\n *\n * `value` is the canonical machine-readable payload after recognized MCP/JSON\n * envelopes are removed. `text` is the best presentation string without\n * discarding structured data. `raw` always retains the original evidence.\n */\nexport type NormalizedMcpOutput = Readonly<{\n raw: unknown;\n value: unknown;\n text: string;\n isError: boolean;\n}>;\n\nconst MAX_MCP_OUTPUT_DEPTH = 8;\nconst RESULT_ENVELOPE_KEYS = new Set([\"result\", \"isError\", \"jsonrpc\", \"id\", \"_meta\"]);\n\n/** Normalize common direct, JSON, and standard MCP result envelopes without throwing. */\nexport function normalizeMcpOutput(output: unknown): NormalizedMcpOutput {\n const normalized = normalizeValue(output, 0, new Set<object>());\n return {\n raw: output,\n value: normalized.value,\n text: normalized.text,\n isError: normalized.isError,\n };\n}\n\ntype NormalizedValue = Omit<NormalizedMcpOutput, \"raw\">;\n\nfunction normalizeValue(value: unknown, depth: number, ancestors: Set<object>): NormalizedValue {\n if (value === null || value === undefined) {\n return { value, text: \"\", isError: false };\n }\n if (typeof value === \"string\") {\n return normalizeText(value, depth, ancestors);\n }\n if (typeof value !== \"object\") {\n return { value, text: String(value), isError: false };\n }\n if (depth >= MAX_MCP_OUTPUT_DEPTH || ancestors.has(value)) {\n return { value, text: safeStringify(value), isError: false };\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return { value, text: safeStringify(value), isError: false };\n }\n\n const record = value as Record<string, unknown>;\n const envelopeError = record.isError === true;\n\n if (record.type === \"text\" && typeof record.text === \"string\") {\n const normalized = normalizeText(record.text, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: record.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n if (\"structuredContent\" in record) {\n const normalized = normalizeValue(record.structuredContent, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: firstMcpText(record.content) ?? normalized.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n if (isMcpContent(record.content)) {\n const text = firstMcpText(record.content);\n if (text !== null) {\n const normalized = normalizeText(text, depth + 1, ancestors);\n return {\n value: normalized.value,\n text,\n isError: envelopeError || normalized.isError,\n };\n }\n return {\n value,\n text: safeStringify(value),\n isError: envelopeError,\n };\n }\n\n if (isResultEnvelope(record)) {\n const normalized = normalizeValue(record.result, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: normalized.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n return {\n value,\n text: safeStringify(value),\n isError: envelopeError,\n };\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizeText(text: string, depth: number, ancestors: Set<object>): NormalizedValue {\n try {\n const parsed: unknown = JSON.parse(text);\n const normalized = normalizeValue(parsed, depth + 1, ancestors);\n return {\n value: normalized.value,\n text,\n isError: normalized.isError,\n };\n } catch {\n return { value: text, text, isError: false };\n }\n}\n\nfunction isMcpContent(value: unknown): value is readonly Record<string, unknown>[] {\n return (\n Array.isArray(value) &&\n value.some(\n (part) =>\n part !== null &&\n typeof part === \"object\" &&\n typeof (part as { type?: unknown }).type === \"string\",\n )\n );\n}\n\nfunction firstMcpText(value: unknown): string | null {\n if (!Array.isArray(value)) {\n return null;\n }\n for (const part of value) {\n if (\n part !== null &&\n typeof part === \"object\" &&\n (part as { type?: unknown }).type === \"text\" &&\n typeof (part as { text?: unknown }).text === \"string\"\n ) {\n return (part as { text: string }).text;\n }\n }\n return null;\n}\n\nfunction isResultEnvelope(record: Record<string, unknown>): boolean {\n return \"result\" in record && Object.keys(record).every((key) => RESULT_ENVELOPE_KEYS.has(key));\n}\n\nfunction safeStringify(value: unknown): string {\n try {\n return JSON.stringify(value) ?? \"\";\n } catch {\n return String(value);\n }\n}\n","// Zero-dependency desktop (noVNC) transport contract.\n//\n// The actual `@novnc/novnc` RFB import is a browser-only DOM dependency and\n// lives in `@opengeni/react` (lazily imported, SSR-safe). The framework-agnostic\n// SDK ships only the transport CONTRACT: a URL assembler, the minimal RFB\n// surface the component drives, the connection state machine, and the\n// rotation/fence reducers — all pure and unit-testable, with no DOM and no deps.\n//\n// Channel A (terminal-as-events, files, git) needs NO new transport here: those\n// are event projections + the synchronous fs/git/terminal point queries on\n// `OpenGeniClient`. Only the desktop pixel plane (Channel B, direct-to-provider)\n// needs this.\n\nimport type { DesktopStreamCapability, StreamUrlRotatedPayload } from \"./types\";\n\n/**\n * Translate the negotiated desktop capability into the WebSocket URL the noVNC\n * RFB client connects to. The scoped provider token is ALREADY embedded in the\n * minted `url` (Modal tunnel host, Blaxel `bl_preview_token`, Daytona signed\n * preview) by `session.resolveExposedPort(6080)` — we do NOT append `cap.token`\n * as a query param (that double-auth was an adversarial-review bug: the box runs\n * `-nopw` in v1, so the RFB password is meaningless and the real auth is the\n * tunnel token in the host). We only normalize the scheme to `ws`/`wss` and, when\n * the minted URL points at a `vnc.html` viewer page, rewrite it to the\n * websockify socket path noVNC actually dials.\n */\nexport function desktopSocketUrl(cap: Pick<DesktopStreamCapability, \"url\">): string {\n if (!cap.url) {\n throw new Error(\"desktop capability has no url (transport is null)\");\n }\n const u = new URL(cap.url);\n // https → wss, http → ws (noVNC dials a WebSocket, not the HTTP viewer page).\n if (u.protocol === \"https:\") {\n u.protocol = \"wss:\";\n } else if (u.protocol === \"http:\") {\n u.protocol = \"ws:\";\n }\n // A minted `…/vnc.html` (or `…/vnc_lite.html`) viewer page → the websockify\n // socket the page itself would open (`…/websockify`). A bare host/path with no\n // viewer page is already the socket path; leave it untouched.\n if (/\\/vnc(_lite)?\\.html$/.test(u.pathname)) {\n u.pathname = u.pathname.replace(/\\/vnc(_lite)?\\.html$/, \"/websockify\");\n u.search = \"\";\n u.hash = \"\";\n }\n return u.toString();\n}\n\n/**\n * The minimal RFB surface the React component drives. Lets tests (and 3rd\n * parties swapping noVNC for a WebRTC client in v3) provide a fake without the\n * DOM. Matches `@novnc/novnc`'s RFB constructor + lifecycle.\n */\nexport interface DesktopRfbLike {\n viewOnly: boolean;\n scaleViewport: boolean;\n /**\n * 1:1 viewport clipping. We always drive this FALSE: with clipping on, noVNC\n * paints the framebuffer pixel-for-pixel and scrolls/crops to the container\n * (the \"zoomed in\" look). FALSE lets `scaleViewport` shrink the 1280x800 frame\n * to fit the panel (aspect-preserved). Declared so the hook can pin it instead\n * of relying on noVNC's default — `scaleViewport=true` forces clip off\n * internally, but a stale/partial state on reconnect could leave it on.\n */\n clipViewport: boolean;\n addEventListener(\n type: \"connect\" | \"disconnect\" | \"securityfailure\",\n cb: (e?: unknown) => void,\n ): void;\n removeEventListener?: (\n type: \"connect\" | \"disconnect\" | \"securityfailure\",\n cb: (e?: unknown) => void,\n ) => void;\n disconnect(): void;\n}\n\nexport type DesktopRfbFactory = (\n target: HTMLElement,\n url: string,\n opts: { credentials?: { password?: string | undefined } | undefined },\n) => DesktopRfbLike;\n\nexport type DesktopConnectionState =\n | \"idle\"\n | \"negotiating\"\n | \"connecting\"\n | \"connected\"\n | \"rotating\"\n | \"reconnecting\"\n | \"error\"\n | \"ended\";\n\nexport type DesktopStreamEvent =\n | { type: \"negotiated\" }\n | { type: \"connected\" }\n | { type: \"disconnected\" }\n | { type: \"rotate\" }\n | { type: \"fail\" }\n | { type: \"abort\" };\n\n/**\n * Pure reducer for the desktop connection lifecycle. The component owns the RFB\n * object + DOM; this owns the transitions so they are unit-testable. Mirrors the\n * Channel-A stream reducer discipline.\n */\nexport function nextDesktopState(\n current: DesktopConnectionState,\n ev: DesktopStreamEvent,\n): DesktopConnectionState {\n switch (ev.type) {\n case \"negotiated\":\n return \"connecting\";\n case \"connected\":\n return \"connected\";\n case \"rotate\":\n return current === \"connected\" ? \"rotating\" : current;\n case \"disconnected\":\n // A deliberate teardown (ended) stays ended; everything else reconnects.\n return current === \"ended\" ? \"ended\" : \"reconnecting\";\n case \"fail\":\n return \"error\";\n case \"abort\":\n return \"ended\";\n default:\n return current;\n }\n}\n\n// `DesktopStreamCapability` is the desktop cell of `SessionCapabilities`; alias\n// it for the rotation reducer below without depending on the whole doc.\nexport type DesktopStreamCapabilityLike = {\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n};\n\n/**\n * Apply a `stream.url.rotated` event onto a desktop capability, fencing on\n * leaseEpoch (split-brain). A rotation minted under an epoch the client has\n * already advanced PAST is from a superseded owner and is dropped (returns\n * null); otherwise the fresh url/token/expiresAt are folded in.\n */\nexport function applyUrlRotation<T extends DesktopStreamCapabilityLike>(\n cap: T,\n payload: StreamUrlRotatedPayload,\n knownEpoch: number,\n): T | null {\n if (payload.leaseEpoch < knownEpoch) {\n return null;\n }\n return { ...cap, url: payload.url, token: payload.token, expiresAt: payload.expiresAt };\n}\n","// Zero-dependency interactive-terminal (ttyd PTY-over-websocket) transport\n// contract. Symmetric with `desktop.ts`: the SDK ships only the pure transport\n// CONTRACT (a URL assembler + the ttyd wire-protocol frame codec), with no DOM\n// and no deps. The actual WebSocket open + xterm attach lives in `@opengeni/react`\n// (`use-terminal-stream.ts`).\n//\n// The interactive terminal is a REAL PTY streamed over the SAME Modal raw-TLS\n// tunnel as the desktop noVNC, with the SAME scoped stream-token mechanism. The\n// box bakes `ttyd` on `TERMINAL_STREAM_PORT` (7681); `session.resolveExposedPort`\n// mints the tunnel URL. The Terminal capability cell carries transport \"pty-ws\" +\n// that url + the scoped token when the box is warm and a viewer is attached.\n\nimport type { TerminalCapability } from \"./types\";\n\n/**\n * Translate the negotiated `pty-ws` Terminal capability into the WebSocket URL\n * the ttyd client dials. The scoped provider token is ALREADY embedded in the\n * minted `url` (the Modal tunnel host) by `session.resolveExposedPort(7681)` —\n * we do NOT append `cap.token` (identical posture to the desktop: the gate is the\n * unguessable short-TTL tunnel URL + the server-recorded scoped stream token; ttyd\n * runs `--writable` with no `-c` credential in v1). We only normalize the scheme\n * to `ws`/`wss`; a bare host is already the ttyd websocket endpoint.\n */\nexport function terminalSocketUrl(cap: Pick<TerminalCapability, \"url\">): string {\n if (!cap.url) {\n throw new Error(\"terminal capability has no url (transport is not pty-ws)\");\n }\n const u = new URL(cap.url);\n // https → wss, http → ws (ttyd is dialed as a WebSocket, not an HTTP page).\n if (u.protocol === \"https:\") {\n u.protocol = \"wss:\";\n } else if (u.protocol === \"http:\") {\n u.protocol = \"ws:\";\n }\n return u.toString();\n}\n\n// ── ttyd wire protocol ───────────────────────────────────────────────────────\n// ttyd frames are a single ASCII command char + payload. These mirror ttyd's\n// `protocol.h` Command enum. Client→server and server→client share the byte 0/1/2\n// values but mean different things per direction (see below).\n\n/** ttyd subprotocol — REQUIRED on the WebSocket handshake or ttyd refuses it. */\nexport const TTYD_SUBPROTOCOL = \"tty\";\n\n/** Client→server command bytes (the first char of each outbound text frame). */\nexport const TtydClientCommand = {\n /** stdin: \"0\" + raw input bytes. */\n INPUT: \"0\",\n /** window resize: \"1\" + JSON.stringify({ columns, rows }). */\n RESIZE: \"1\",\n /** flow-control pause (back-pressure): \"2\". */\n PAUSE: \"2\",\n /** flow-control resume: \"3\". */\n RESUME: \"3\",\n} as const;\n\n/** Server→client command bytes (the first char of each inbound frame). */\nexport const TtydServerCommand = {\n /** stdout/stderr: \"0\" + raw output bytes (write the rest into xterm). */\n OUTPUT: \"0\",\n /** set the window title: \"1\" + title string. */\n SET_WINDOW_TITLE: \"1\",\n /** ttyd client preferences JSON: \"2\" + json (ignored by us). */\n SET_PREFERENCES: \"2\",\n} as const;\n\n/**\n * The ttyd handshake's first frame: an auth message. ttyd expects\n * `JSON.stringify({ AuthToken })` as the FIRST text frame on the socket. We send\n * an empty token — our gate is the tunnel URL + scoped stream token, NOT a ttyd\n * `-c` basic-auth credential (which the box does not set in v1). Optional ttyd\n * `columns`/`rows` can ride this frame to seed the PTY size before the first\n * resize. Pure (string-building only) so it stays unit-testable in the SDK.\n */\nexport function ttydAuthFrame(opts?: { columns?: number; rows?: number }): string {\n const frame: { AuthToken: string; columns?: number; rows?: number } = { AuthToken: \"\" };\n if (opts?.columns && opts.columns > 0) frame.columns = opts.columns;\n if (opts?.rows && opts.rows > 0) frame.rows = opts.rows;\n return JSON.stringify(frame);\n}\n\n/** Build a client→server INPUT (stdin) frame: \"0\" + data. */\nexport function ttydInputFrame(data: string): string {\n return TtydClientCommand.INPUT + data;\n}\n\n/** Build a client→server RESIZE frame: \"1\" + JSON.stringify({ columns, rows }). */\nexport function ttydResizeFrame(columns: number, rows: number): string {\n return TtydClientCommand.RESIZE + JSON.stringify({ columns, rows });\n}\n","export type WorkspaceInstructionPolicyKind = \"charter\" | \"policy\";\nexport type WorkspaceInstructionPolicyScope = \"global\" | \"role\";\nexport type WorkspaceInstructionPolicyProvenanceSource =\n | \"human\"\n | \"onboarding\"\n | \"knowledge_proposal\"\n | \"legacy_import\";\nexport type WorkspaceInstructionPolicyDraftProvenanceSource = Exclude<\n WorkspaceInstructionPolicyProvenanceSource,\n \"legacy_import\"\n>;\nexport type WorkspaceInstructionPolicyActivationType = \"activate\" | \"rollback\";\n\nexport function normalizeWorkspaceInstructionPolicyRoleKey(value: string): string {\n return value.normalize(\"NFKC\").trim().toLowerCase().replace(/\\s+/gu, \"-\").replace(/-+/g, \"-\");\n}\n\nexport type WorkspaceInstructionPolicyTarget = {\n kind: WorkspaceInstructionPolicyKind;\n scope: WorkspaceInstructionPolicyScope;\n roleKey: string | null;\n};\n\nexport type WorkspaceInstructionPolicyRevisionIdentity = {\n id: string;\n revision: number;\n contentHash: string;\n};\n\nexport type WorkspaceInstructionPolicyRevision = WorkspaceInstructionPolicyRevisionIdentity &\n WorkspaceInstructionPolicyTarget & {\n accountId: string;\n workspaceId: string;\n content: string;\n provenance: {\n source: WorkspaceInstructionPolicyProvenanceSource;\n sourceId: string | null;\n };\n supersedesRevisionId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n };\n\nexport type WorkspaceInstructionPolicyHead = WorkspaceInstructionPolicyTarget & {\n workspaceId: string;\n revisionId: string;\n revision: number;\n contentHash: string;\n activationVersion: number;\n activatedAt: string;\n};\n\nexport type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPolicyTarget & {\n id: string;\n accountId: string;\n workspaceId: string;\n type: WorkspaceInstructionPolicyActivationType;\n activationVersion: number;\n oldRevision: WorkspaceInstructionPolicyRevisionIdentity | null;\n newRevision: WorkspaceInstructionPolicyRevisionIdentity;\n actorSubjectId: string;\n reason: string;\n createdAt: string;\n};\n\nexport type CreateWorkspaceInstructionPolicyDraftRequest = WorkspaceInstructionPolicyTarget & {\n content: string;\n provenanceSource?: WorkspaceInstructionPolicyDraftProvenanceSource;\n provenanceSourceId?: string | null;\n supersedesRevisionId?: string | null;\n};\n\nexport type ImportLegacyWorkspaceInstructionPolicyDraftRequest = {\n supersedesRevisionId?: string | null;\n};\n\nexport type WorkspaceInstructionPolicyListOptions = {\n kind?: WorkspaceInstructionPolicyKind;\n scope?: WorkspaceInstructionPolicyScope;\n roleKey?: string;\n afterRevision?: number;\n limit?: number;\n};\n\nexport type WorkspaceInstructionPolicyListResponse = {\n revisions: WorkspaceInstructionPolicyRevision[];\n activeHeads: WorkspaceInstructionPolicyHead[];\n activationEvents: WorkspaceInstructionPolicyActivationEvent[];\n nextAfterRevision: number | null;\n};\n\nexport type WorkspaceInstructionPolicyDiffRequest = {\n fromRevisionId: string;\n toRevisionId: string;\n};\n\nexport type WorkspaceInstructionPolicyDiffResponse = {\n from: WorkspaceInstructionPolicyRevision;\n to: WorkspaceInstructionPolicyRevision;\n format: \"unified\";\n diff: string;\n};\n\nexport type ActivateWorkspaceInstructionPolicyRequest = {\n expectedCurrentRevisionId: string | null;\n reason: string;\n};\n\nexport type RollbackWorkspaceInstructionPolicyRequest = {\n targetRevisionId: string;\n expectedCurrentRevisionId: string;\n reason: string;\n};\n\nexport type WorkspaceInstructionPolicyActivationResponse = {\n head: WorkspaceInstructionPolicyHead;\n event: WorkspaceInstructionPolicyActivationEvent;\n};\n\nexport type WorkspaceInstructionPolicyConflictResponse = {\n code: \"WORKSPACE_INSTRUCTION_POLICY_CONFLICT\";\n message: string;\n currentHead: WorkspaceInstructionPolicyHead | null;\n};\n","export type PreferenceRegistryScope = \"organization\" | \"workspace\" | \"user\";\nexport type PreferenceRegistryStatus =\n | \"proposed\"\n | \"active\"\n | \"inactive\"\n | \"rejected\"\n | \"superseded\"\n | \"expired\";\nexport type PreferenceRegistryProvenanceSource =\n | \"human\"\n | \"onboarding\"\n | \"knowledge_proposal\"\n | \"imported_document\"\n | \"slack\"\n | \"meeting_transcript\"\n | \"call_transcript\";\nexport type PreferenceRegistryTrust =\n | \"untrusted_proposal\"\n | \"personal\"\n | \"workspace_managed\"\n | \"organization_managed\";\nexport type PreferenceRegistryConflictStrategy = \"override\" | \"merge\" | \"reject\" | \"inform\";\n\nexport function normalizePreferenceRegistryStableKey(value: string): string {\n return value.normalize(\"NFKC\").trim().toLowerCase().replace(/\\s+/gu, \"-\").replace(/-+/g, \"-\");\n}\n\nexport type PreferenceRegistryScopeTarget = {\n scope: PreferenceRegistryScope;\n workspaceId: string | null;\n subjectId: string | null;\n};\n\nexport type PreferenceRegistryPrecedence = {\n tier: PreferenceRegistryScope;\n rank: number;\n conflictStrategy: PreferenceRegistryConflictStrategy;\n conflictsWith: string[];\n};\n\nexport type PreferenceRegistryRevisionSummary = {\n id: string;\n preferenceId: string;\n revision: number;\n contentHash: string;\n title: string;\n description: string;\n precedence: PreferenceRegistryPrecedence;\n provenance: {\n source: PreferenceRegistryProvenanceSource;\n sourceId: string | null;\n trust: PreferenceRegistryTrust;\n };\n expiresAt: string | null;\n correctsRevisionId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n};\n\nexport type PreferenceRegistryDescriptorProvenance = {\n source: PreferenceRegistryProvenanceSource;\n sourceIdHash: string | null;\n trust: PreferenceRegistryTrust;\n};\n\nexport type PreferenceRegistryRecord = {\n id: string;\n accountId: string;\n stableKey: string;\n target: PreferenceRegistryScopeTarget;\n status: PreferenceRegistryStatus;\n scopeVersion: number;\n activationVersion: number;\n activeRevision: PreferenceRegistryRevisionSummary | null;\n supersededByPreferenceId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PreferenceRegistryEvent = {\n id: string;\n accountId: string;\n preferenceId: string;\n type:\n | \"proposal_created\"\n | \"activated\"\n | \"corrected\"\n | \"rejected\"\n | \"deactivated\"\n | \"superseded\"\n | \"scope_changed\";\n version: number;\n oldRevisionId: string | null;\n newRevisionId: string | null;\n oldTarget: PreferenceRegistryScopeTarget | null;\n newTarget: PreferenceRegistryScopeTarget | null;\n relatedPreferenceId: string | null;\n actorSubjectId: string;\n reason: string;\n createdAt: string;\n};\n\nexport type PreferenceRegistryDescriptor = {\n id: string;\n stableKey: string;\n title: string;\n description: string;\n scope: PreferenceRegistryScope;\n activeVersion: number;\n revisionId: string;\n contentHash: string;\n precedence: PreferenceRegistryPrecedence;\n provenance: PreferenceRegistryDescriptorProvenance;\n expiresAt: string | null;\n retrievalHandle: string;\n};\n\nexport type PreferenceRegistrySnapshot = {\n id: string;\n workspaceId: string;\n sessionId: string;\n turnId: string;\n attemptId: string;\n executionGeneration: number;\n initiatingHumanSubjectId: string;\n descriptorHash: string;\n descriptors: PreferenceRegistryDescriptor[];\n truncated: boolean;\n createdAt: string;\n};\n\nexport type PreferenceRegistryFullContent = {\n descriptor: PreferenceRegistryDescriptor;\n content: string;\n};\n\nexport type CreatePreferenceRegistryProposalRequest = {\n stableKey: string;\n scope: PreferenceRegistryScope;\n title: string;\n description: string;\n content: string;\n precedenceRank?: number;\n conflictStrategy?: PreferenceRegistryConflictStrategy;\n conflictsWith?: string[];\n expiresAt?: string | null;\n provenanceSource?: PreferenceRegistryProvenanceSource;\n provenanceSourceId?: string | null;\n};\n\nexport type ActivatePreferenceRegistryRevisionRequest = {\n revisionId: string;\n expectedCurrentRevisionId: string | null;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type CorrectPreferenceRegistryRequest = {\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n title: string;\n description: string;\n content: string;\n precedenceRank?: number;\n conflictStrategy?: PreferenceRegistryConflictStrategy;\n conflictsWith?: string[];\n expiresAt?: string | null;\n reason: string;\n};\n\nexport type DeactivatePreferenceRegistryRequest = {\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type ChangePreferenceRegistryScopeRequest = {\n scope: PreferenceRegistryScope;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type SupersedePreferenceRegistryRequest = {\n replacementPreferenceId: string;\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type RejectPreferenceRegistryProposalRequest = {\n revisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\nexport type PreferenceRegistryListOptions = {\n scope?: PreferenceRegistryScope;\n status?: PreferenceRegistryStatus;\n limit?: number;\n};\nexport type PreferenceRegistryListResponse = { preferences: PreferenceRegistryRecord[] };\nexport type PreferenceRegistryDetailResponse = {\n preference: PreferenceRegistryRecord;\n revisions: PreferenceRegistryRevisionSummary[];\n events: PreferenceRegistryEvent[];\n};\nexport type PreferenceRegistryMutationResponse = {\n preference: PreferenceRegistryRecord;\n event: PreferenceRegistryEvent;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAMA,kBAAN,cAA6B,eAAmB;AAAA,EACrD,MAAM,uBACJ,aACA,UAAwC,CAAC,GACD;AACxC,UAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAI,QAAQ,UAAU,OAAW,OAAM,IAAI,SAAS,OAAO,QAAQ,KAAK,CAAC;AACzE,QAAI,QAAQ,OAAQ,OAAM,IAAI,UAAU,QAAQ,MAAM;AACtD,UAAM,SAAS,MAAM,OAAO,IAAI,IAAI,MAAM,SAAS,CAAC,KAAK;AACzD,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW,uBAAuB,MAAM;AAAA,IAC5D;AAAA,EACF;AAAA,EAEA,MAAM,qBACJ,aACA,YAC0C;AAC1C,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW,wBAAwB,mBAAmB,UAAU,CAAC;AAAA,IACrF;AAAA,EACF;AAAA,EAEA,MAAM,4BACJ,aACA,YACA,WAC2C;AAC3C,UAAM,QAAQ,YAAY,cAAc,mBAAmB,SAAS,CAAC,KAAK;AAC1E,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW,wBAAwB,mBAAmB,UAAU,CAAC,WAAW,KAAK;AAAA,IACrG;AAAA,EACF;AAAA,EAEA,MAAM,wBACJ,aACA,SAC4C;AAC5C,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,gCACJ,aACA,YACA,SAC4C;AAC5C,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW,wBAAwB,mBAAmB,UAAU,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2CAA2C,OAAuB;AAChF,SAAO,MAAM,UAAU,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ,OAAO,GAAG;AAC9F;;;ACQO,SAAS,qCAAqC,OAAuB;AAC1E,SAAO,MAAM,UAAU,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ,OAAO,GAAG;AAC9F;","names":["OpenGeniClient"]}
1
+ {"version":3,"sources":["../src/artifact-client.ts","../src/proxy.ts","../src/mcp-output.ts","../src/desktop.ts","../src/terminal.ts","../src/workspace-instruction-policies.ts","../src/preference-registry.ts"],"sourcesContent":["import { OpenGeniClient as OpenGeniCoreClient } from \"./client\";\nimport type {\n CreateWorkspaceArtifactRequest,\n PublishWorkspaceArtifactVersionRequest,\n RollbackWorkspaceArtifactRequest,\n WorkspaceArtifactContentResponse,\n WorkspaceArtifactDetailResponse,\n WorkspaceArtifactListOptions,\n WorkspaceArtifactListResponse,\n WorkspaceArtifactMutationResponse,\n} from \"./workspace-artifacts\";\n\n/** Public SDK client. Artifact operations stay out of the console's eager core graph. */\nexport class OpenGeniClient extends OpenGeniCoreClient {\n async listWorkspaceArtifacts(\n workspaceId: string,\n options: WorkspaceArtifactListOptions = {},\n ): Promise<WorkspaceArtifactListResponse> {\n const query = new URLSearchParams();\n if (options.limit !== undefined) query.set(\"limit\", String(options.limit));\n if (options.cursor) query.set(\"cursor\", options.cursor);\n const suffix = query.size > 0 ? `?${query.toString()}` : \"\";\n return await this.requestJson<WorkspaceArtifactListResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts${suffix}`,\n );\n }\n\n async getWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n ): Promise<WorkspaceArtifactDetailResponse> {\n return await this.requestJson<WorkspaceArtifactDetailResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}`,\n );\n }\n\n async getWorkspaceArtifactContent(\n workspaceId: string,\n artifactId: string,\n versionId?: string,\n ): Promise<WorkspaceArtifactContentResponse> {\n const query = versionId ? `?versionId=${encodeURIComponent(versionId)}` : \"\";\n return await this.requestJson<WorkspaceArtifactContentResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}`,\n );\n }\n\n async createWorkspaceArtifact(\n workspaceId: string,\n request: CreateWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts`,\n request,\n );\n }\n\n async publishWorkspaceArtifactVersion(\n workspaceId: string,\n artifactId: string,\n request: PublishWorkspaceArtifactVersionRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/versions`,\n request,\n );\n }\n\n async rollbackWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n request: RollbackWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/rollback`,\n request,\n );\n }\n}\n","import type { OpenGeniClient } from \"./client\";\nimport type { StreamSessionEventsOptions } from \"./stream\";\nimport type { SessionEvent } from \"./types\";\n\n/**\n * Proxy-through-your-own-API helpers.\n *\n * The intended pattern: a customer's server consumes the OpenGeni event\n * stream with its own API key (`client.streamEvents(...)`) and re-emits it to\n * its browser clients over its own authenticated endpoint — the OpenGeni key\n * never reaches the browser. The re-emitted wire format is identical to\n * OpenGeni's own SSE stream (`id: <sequence>`, `event: <type>`,\n * `data: <event JSON>`), so the browser side can consume it with this same\n * SDK's streaming core (or a plain `EventSource`), including resume via\n * `?after=` / `Last-Event-ID`.\n */\n\n/** Format one event exactly as OpenGeni's API emits it over SSE. */\nexport function formatSseEvent(event: SessionEvent): string {\n return `id: ${event.sequence}\\nevent: ${event.type}\\ndata: ${JSON.stringify(event)}\\n\\n`;\n}\n\nexport type SseReStreamOptions = {\n /**\n * Emit `: ping` comment lines at this interval, keeping intermediaries from\n * idling the connection out. Disabled when omitted.\n */\n heartbeatMs?: number;\n /**\n * Called when the downstream consumer cancels (e.g. the browser\n * disconnected). Use it to abort the upstream OpenGeni stream — an async\n * iterator that is mid-`await` cannot be interrupted by `return()` alone.\n */\n onCancel?: () => void;\n};\n\n/**\n * Re-emit a stream of session events as an SSE byte stream. Pull-based, so\n * upstream consumption follows downstream demand; cancelling the returned\n * stream fires `onCancel` and ends the upstream iterator.\n */\nexport function sessionEventsToSseStream(\n events: AsyncIterable<SessionEvent>,\n options: SseReStreamOptions = {},\n): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n const iterator = events[Symbol.asyncIterator]();\n let heartbeat: ReturnType<typeof setInterval> | undefined;\n let cancelled = false;\n\n const stopHeartbeat = (): void => {\n if (heartbeat !== undefined) {\n clearInterval(heartbeat);\n heartbeat = undefined;\n }\n };\n\n return new ReadableStream<Uint8Array>({\n start: (controller) => {\n if (options.heartbeatMs !== undefined) {\n heartbeat = setInterval(() => {\n try {\n controller.enqueue(encoder.encode(\": ping\\n\\n\"));\n } catch {\n stopHeartbeat();\n }\n }, options.heartbeatMs);\n }\n },\n pull: async (controller) => {\n let result: IteratorResult<SessionEvent, unknown>;\n try {\n result = await iterator.next();\n } catch (error) {\n stopHeartbeat();\n throw error;\n }\n if (cancelled) {\n return;\n }\n if (result.done) {\n stopHeartbeat();\n controller.close();\n return;\n }\n controller.enqueue(encoder.encode(formatSseEvent(result.value)));\n },\n cancel: () => {\n cancelled = true;\n stopHeartbeat();\n options.onCancel?.();\n // Fire-and-forget: if the iterator is suspended mid-await, return()\n // settles only after onCancel unblocks it; cancel must not hang on it.\n void Promise.resolve(iterator.return?.(undefined)).then(\n () => undefined,\n () => undefined,\n );\n },\n });\n}\n\n/** Wrap an event stream in a ready-to-return SSE `Response`. */\nexport function sessionEventsToSseResponse(\n events: AsyncIterable<SessionEvent>,\n options: SseReStreamOptions = {},\n): Response {\n return new Response(sessionEventsToSseStream(events, options), {\n headers: {\n \"Content-Type\": \"text/event-stream; charset=utf-8\",\n \"Cache-Control\": \"no-cache, no-transform\",\n Connection: \"keep-alive\",\n },\n });\n}\n\n/**\n * Read the resume cursor a reconnecting SSE client sent: the `after` query\n * parameter, or the standard `Last-Event-ID` header (the re-emitted stream\n * sets `id:` to the sequence). Returns 0 (full replay) when absent.\n */\nexport function resumeSequenceFromRequest(request: Request): number {\n const url = new URL(request.url);\n const raw = url.searchParams.get(\"after\") ?? request.headers.get(\"Last-Event-ID\");\n const parsed = raw === null ? 0 : Number(raw);\n return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : 0;\n}\n\nexport type ProxySessionEventStreamOptions = Omit<StreamSessionEventsOptions, \"after\"> & {\n /**\n * Resume cursor. Pass a number, or the incoming browser `Request` to\n * honor its `?after=` / `Last-Event-ID` automatically.\n */\n after?: number | Request;\n /** See {@link SseReStreamOptions.heartbeatMs}. */\n heartbeatMs?: number;\n};\n\n/**\n * One-call proxy: consume the OpenGeni stream server-side and return an SSE\n * `Response` for your own browser clients. Works anywhere WHATWG `Response`\n * is the handler return type (Hono, Next.js route handlers, Bun.serve,\n * Cloudflare Workers, ...).\n *\n * The upstream OpenGeni connection is torn down when the downstream client\n * disconnects, and also when `options.signal` (e.g. the incoming request's\n * signal) aborts.\n */\nexport function proxySessionEventStream(\n client: OpenGeniClient,\n workspaceId: string,\n sessionId: string,\n options: ProxySessionEventStreamOptions = {},\n): Response {\n const { after, heartbeatMs, signal, ...streamOptions } = options;\n const upstream = new AbortController();\n if (signal?.aborted) {\n upstream.abort();\n } else {\n signal?.addEventListener(\"abort\", () => upstream.abort(), { once: true });\n }\n const resolvedAfter = after instanceof Request ? resumeSequenceFromRequest(after) : (after ?? 0);\n const events = client.streamEvents(workspaceId, sessionId, {\n ...streamOptions,\n after: resolvedAfter,\n signal: upstream.signal,\n });\n return sessionEventsToSseResponse(events, {\n ...(heartbeatMs !== undefined ? { heartbeatMs } : {}),\n onCancel: () => upstream.abort(),\n });\n}\n","/**\n * A transport-tolerant MCP tool result.\n *\n * `value` is the canonical machine-readable payload after recognized MCP/JSON\n * envelopes are removed. `text` is the best presentation string without\n * discarding structured data. `raw` always retains the original evidence.\n */\nexport type NormalizedMcpOutput = Readonly<{\n raw: unknown;\n value: unknown;\n text: string;\n isError: boolean;\n}>;\n\nconst MAX_MCP_OUTPUT_DEPTH = 8;\nconst RESULT_ENVELOPE_KEYS = new Set([\"result\", \"isError\", \"jsonrpc\", \"id\", \"_meta\"]);\n\n/** Normalize common direct, JSON, and standard MCP result envelopes without throwing. */\nexport function normalizeMcpOutput(output: unknown): NormalizedMcpOutput {\n const normalized = normalizeValue(output, 0, new Set<object>());\n return {\n raw: output,\n value: normalized.value,\n text: normalized.text,\n isError: normalized.isError,\n };\n}\n\ntype NormalizedValue = Omit<NormalizedMcpOutput, \"raw\">;\n\nfunction normalizeValue(value: unknown, depth: number, ancestors: Set<object>): NormalizedValue {\n if (value === null || value === undefined) {\n return { value, text: \"\", isError: false };\n }\n if (typeof value === \"string\") {\n return normalizeText(value, depth, ancestors);\n }\n if (typeof value !== \"object\") {\n return { value, text: String(value), isError: false };\n }\n if (depth >= MAX_MCP_OUTPUT_DEPTH || ancestors.has(value)) {\n return { value, text: safeStringify(value), isError: false };\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return { value, text: safeStringify(value), isError: false };\n }\n\n const record = value as Record<string, unknown>;\n const envelopeError = record.isError === true;\n\n if (record.type === \"text\" && typeof record.text === \"string\") {\n const normalized = normalizeText(record.text, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: record.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n if (\"structuredContent\" in record) {\n const normalized = normalizeValue(record.structuredContent, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: firstMcpText(record.content) ?? normalized.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n if (isMcpContent(record.content)) {\n const text = firstMcpText(record.content);\n if (text !== null) {\n const normalized = normalizeText(text, depth + 1, ancestors);\n return {\n value: normalized.value,\n text,\n isError: envelopeError || normalized.isError,\n };\n }\n return {\n value,\n text: safeStringify(value),\n isError: envelopeError,\n };\n }\n\n if (isResultEnvelope(record)) {\n const normalized = normalizeValue(record.result, depth + 1, ancestors);\n return {\n value: normalized.value,\n text: normalized.text,\n isError: envelopeError || normalized.isError,\n };\n }\n\n return {\n value,\n text: safeStringify(value),\n isError: envelopeError,\n };\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizeText(text: string, depth: number, ancestors: Set<object>): NormalizedValue {\n try {\n const parsed: unknown = JSON.parse(text);\n const normalized = normalizeValue(parsed, depth + 1, ancestors);\n return {\n value: normalized.value,\n text,\n isError: normalized.isError,\n };\n } catch {\n return { value: text, text, isError: false };\n }\n}\n\nfunction isMcpContent(value: unknown): value is readonly Record<string, unknown>[] {\n return (\n Array.isArray(value) &&\n value.some(\n (part) =>\n part !== null &&\n typeof part === \"object\" &&\n typeof (part as { type?: unknown }).type === \"string\",\n )\n );\n}\n\nfunction firstMcpText(value: unknown): string | null {\n if (!Array.isArray(value)) {\n return null;\n }\n for (const part of value) {\n if (\n part !== null &&\n typeof part === \"object\" &&\n (part as { type?: unknown }).type === \"text\" &&\n typeof (part as { text?: unknown }).text === \"string\"\n ) {\n return (part as { text: string }).text;\n }\n }\n return null;\n}\n\nfunction isResultEnvelope(record: Record<string, unknown>): boolean {\n return \"result\" in record && Object.keys(record).every((key) => RESULT_ENVELOPE_KEYS.has(key));\n}\n\nfunction safeStringify(value: unknown): string {\n try {\n return JSON.stringify(value) ?? \"\";\n } catch {\n return String(value);\n }\n}\n","// Zero-dependency desktop (noVNC) transport contract.\n//\n// The actual `@novnc/novnc` RFB import is a browser-only DOM dependency and\n// lives in `@opengeni/react` (lazily imported, SSR-safe). The framework-agnostic\n// SDK ships only the transport CONTRACT: a URL assembler, the minimal RFB\n// surface the component drives, the connection state machine, and the\n// rotation/fence reducers — all pure and unit-testable, with no DOM and no deps.\n//\n// Channel A (terminal-as-events, files, git) needs NO new transport here: those\n// are event projections + the synchronous fs/git/terminal point queries on\n// `OpenGeniClient`. Only the desktop pixel plane (Channel B, direct-to-provider)\n// needs this.\n\nimport type { DesktopStreamCapability, StreamUrlRotatedPayload } from \"./types\";\n\n/**\n * Translate the negotiated desktop capability into the WebSocket URL the noVNC\n * RFB client connects to. The scoped provider token is ALREADY embedded in the\n * minted `url` (Modal tunnel host, Blaxel `bl_preview_token`, Daytona signed\n * preview) by `session.resolveExposedPort(6080)` — we do NOT append `cap.token`\n * as a query param (that double-auth was an adversarial-review bug: the box runs\n * `-nopw` in v1, so the RFB password is meaningless and the real auth is the\n * tunnel token in the host). We only normalize the scheme to `ws`/`wss` and, when\n * the minted URL points at a `vnc.html` viewer page, rewrite it to the\n * websockify socket path noVNC actually dials.\n */\nexport function desktopSocketUrl(cap: Pick<DesktopStreamCapability, \"url\">): string {\n if (!cap.url) {\n throw new Error(\"desktop capability has no url (transport is null)\");\n }\n const u = new URL(cap.url);\n // https → wss, http → ws (noVNC dials a WebSocket, not the HTTP viewer page).\n if (u.protocol === \"https:\") {\n u.protocol = \"wss:\";\n } else if (u.protocol === \"http:\") {\n u.protocol = \"ws:\";\n }\n // A minted `…/vnc.html` (or `…/vnc_lite.html`) viewer page → the websockify\n // socket the page itself would open (`…/websockify`). A bare host/path with no\n // viewer page is already the socket path; leave it untouched.\n if (/\\/vnc(_lite)?\\.html$/.test(u.pathname)) {\n u.pathname = u.pathname.replace(/\\/vnc(_lite)?\\.html$/, \"/websockify\");\n u.search = \"\";\n u.hash = \"\";\n }\n return u.toString();\n}\n\n/**\n * The minimal RFB surface the React component drives. Lets tests (and 3rd\n * parties swapping noVNC for a WebRTC client in v3) provide a fake without the\n * DOM. Matches `@novnc/novnc`'s RFB constructor + lifecycle.\n */\nexport interface DesktopRfbLike {\n viewOnly: boolean;\n scaleViewport: boolean;\n /**\n * 1:1 viewport clipping. We always drive this FALSE: with clipping on, noVNC\n * paints the framebuffer pixel-for-pixel and scrolls/crops to the container\n * (the \"zoomed in\" look). FALSE lets `scaleViewport` shrink the 1280x800 frame\n * to fit the panel (aspect-preserved). Declared so the hook can pin it instead\n * of relying on noVNC's default — `scaleViewport=true` forces clip off\n * internally, but a stale/partial state on reconnect could leave it on.\n */\n clipViewport: boolean;\n addEventListener(\n type: \"connect\" | \"disconnect\" | \"securityfailure\",\n cb: (e?: unknown) => void,\n ): void;\n removeEventListener?: (\n type: \"connect\" | \"disconnect\" | \"securityfailure\",\n cb: (e?: unknown) => void,\n ) => void;\n disconnect(): void;\n}\n\nexport type DesktopRfbFactory = (\n target: HTMLElement,\n url: string,\n opts: { credentials?: { password?: string | undefined } | undefined },\n) => DesktopRfbLike;\n\nexport type DesktopConnectionState =\n | \"idle\"\n | \"negotiating\"\n | \"connecting\"\n | \"connected\"\n | \"rotating\"\n | \"reconnecting\"\n | \"error\"\n | \"ended\";\n\nexport type DesktopStreamEvent =\n | { type: \"negotiated\" }\n | { type: \"connected\" }\n | { type: \"disconnected\" }\n | { type: \"rotate\" }\n | { type: \"fail\" }\n | { type: \"abort\" };\n\n/**\n * Pure reducer for the desktop connection lifecycle. The component owns the RFB\n * object + DOM; this owns the transitions so they are unit-testable. Mirrors the\n * Channel-A stream reducer discipline.\n */\nexport function nextDesktopState(\n current: DesktopConnectionState,\n ev: DesktopStreamEvent,\n): DesktopConnectionState {\n switch (ev.type) {\n case \"negotiated\":\n return \"connecting\";\n case \"connected\":\n return \"connected\";\n case \"rotate\":\n return current === \"connected\" ? \"rotating\" : current;\n case \"disconnected\":\n // A deliberate teardown (ended) stays ended; everything else reconnects.\n return current === \"ended\" ? \"ended\" : \"reconnecting\";\n case \"fail\":\n return \"error\";\n case \"abort\":\n return \"ended\";\n default:\n return current;\n }\n}\n\n// `DesktopStreamCapability` is the desktop cell of `SessionCapabilities`; alias\n// it for the rotation reducer below without depending on the whole doc.\nexport type DesktopStreamCapabilityLike = {\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n};\n\n/**\n * Apply a `stream.url.rotated` event onto a desktop capability, fencing on\n * leaseEpoch (split-brain). A rotation minted under an epoch the client has\n * already advanced PAST is from a superseded owner and is dropped (returns\n * null); otherwise the fresh url/token/expiresAt are folded in.\n */\nexport function applyUrlRotation<T extends DesktopStreamCapabilityLike>(\n cap: T,\n payload: StreamUrlRotatedPayload,\n knownEpoch: number,\n): T | null {\n if (payload.leaseEpoch < knownEpoch) {\n return null;\n }\n return { ...cap, url: payload.url, token: payload.token, expiresAt: payload.expiresAt };\n}\n","// Zero-dependency interactive-terminal (ttyd PTY-over-websocket) transport\n// contract. Symmetric with `desktop.ts`: the SDK ships only the pure transport\n// CONTRACT (a URL assembler + the ttyd wire-protocol frame codec), with no DOM\n// and no deps. The actual WebSocket open + xterm attach lives in `@opengeni/react`\n// (`use-terminal-stream.ts`).\n//\n// The interactive terminal is a REAL PTY streamed over the SAME Modal raw-TLS\n// tunnel as the desktop noVNC, with the SAME scoped stream-token mechanism. The\n// box bakes `ttyd` on `TERMINAL_STREAM_PORT` (7681); `session.resolveExposedPort`\n// mints the tunnel URL. The Terminal capability cell carries transport \"pty-ws\" +\n// that url + the scoped token when the box is warm and a viewer is attached.\n\nimport type { TerminalCapability } from \"./types\";\n\n/**\n * Translate the negotiated `pty-ws` Terminal capability into the WebSocket URL\n * the ttyd client dials. The scoped provider token is ALREADY embedded in the\n * minted `url` (the Modal tunnel host) by `session.resolveExposedPort(7681)` —\n * we do NOT append `cap.token` (identical posture to the desktop: the gate is the\n * unguessable short-TTL tunnel URL + the server-recorded scoped stream token; ttyd\n * runs `--writable` with no `-c` credential in v1). We only normalize the scheme\n * to `ws`/`wss`; a bare host is already the ttyd websocket endpoint.\n */\nexport function terminalSocketUrl(cap: Pick<TerminalCapability, \"url\">): string {\n if (!cap.url) {\n throw new Error(\"terminal capability has no url (transport is not pty-ws)\");\n }\n const u = new URL(cap.url);\n // https → wss, http → ws (ttyd is dialed as a WebSocket, not an HTTP page).\n if (u.protocol === \"https:\") {\n u.protocol = \"wss:\";\n } else if (u.protocol === \"http:\") {\n u.protocol = \"ws:\";\n }\n return u.toString();\n}\n\n// ── ttyd wire protocol ───────────────────────────────────────────────────────\n// ttyd frames are a single ASCII command char + payload. These mirror ttyd's\n// `protocol.h` Command enum. Client→server and server→client share the byte 0/1/2\n// values but mean different things per direction (see below).\n\n/** ttyd subprotocol — REQUIRED on the WebSocket handshake or ttyd refuses it. */\nexport const TTYD_SUBPROTOCOL = \"tty\";\n\n/** Client→server command bytes (the first char of each outbound text frame). */\nexport const TtydClientCommand = {\n /** stdin: \"0\" + raw input bytes. */\n INPUT: \"0\",\n /** window resize: \"1\" + JSON.stringify({ columns, rows }). */\n RESIZE: \"1\",\n /** flow-control pause (back-pressure): \"2\". */\n PAUSE: \"2\",\n /** flow-control resume: \"3\". */\n RESUME: \"3\",\n} as const;\n\n/** Server→client command bytes (the first char of each inbound frame). */\nexport const TtydServerCommand = {\n /** stdout/stderr: \"0\" + raw output bytes (write the rest into xterm). */\n OUTPUT: \"0\",\n /** set the window title: \"1\" + title string. */\n SET_WINDOW_TITLE: \"1\",\n /** ttyd client preferences JSON: \"2\" + json (ignored by us). */\n SET_PREFERENCES: \"2\",\n} as const;\n\n/**\n * The ttyd handshake's first frame: an auth message. ttyd expects\n * `JSON.stringify({ AuthToken })` as the FIRST text frame on the socket. We send\n * an empty token — our gate is the tunnel URL + scoped stream token, NOT a ttyd\n * `-c` basic-auth credential (which the box does not set in v1). Optional ttyd\n * `columns`/`rows` can ride this frame to seed the PTY size before the first\n * resize. Pure (string-building only) so it stays unit-testable in the SDK.\n */\nexport function ttydAuthFrame(opts?: { columns?: number; rows?: number }): string {\n const frame: { AuthToken: string; columns?: number; rows?: number } = { AuthToken: \"\" };\n if (opts?.columns && opts.columns > 0) frame.columns = opts.columns;\n if (opts?.rows && opts.rows > 0) frame.rows = opts.rows;\n return JSON.stringify(frame);\n}\n\n/** Build a client→server INPUT (stdin) frame: \"0\" + data. */\nexport function ttydInputFrame(data: string): string {\n return TtydClientCommand.INPUT + data;\n}\n\n/** Build a client→server RESIZE frame: \"1\" + JSON.stringify({ columns, rows }). */\nexport function ttydResizeFrame(columns: number, rows: number): string {\n return TtydClientCommand.RESIZE + JSON.stringify({ columns, rows });\n}\n","export const WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS = 262_144;\n\nexport type WorkspaceInstructionPolicyKind = \"charter\" | \"policy\";\nexport type WorkspaceInstructionPolicyScope = \"global\" | \"role\";\nexport type WorkspaceInstructionPolicyProvenanceSource =\n | \"human\"\n | \"onboarding\"\n | \"knowledge_proposal\"\n | \"legacy_import\";\nexport type WorkspaceInstructionPolicyDraftProvenanceSource = Exclude<\n WorkspaceInstructionPolicyProvenanceSource,\n \"legacy_import\"\n>;\nexport type WorkspaceInstructionPolicyActivationType = \"activate\" | \"rollback\";\n\nexport function normalizeWorkspaceInstructionPolicyRoleKey(value: string): string {\n return value.normalize(\"NFKC\").trim().toLowerCase().replace(/\\s+/gu, \"-\").replace(/-+/g, \"-\");\n}\n\nexport type WorkspaceInstructionPolicyTarget = {\n kind: WorkspaceInstructionPolicyKind;\n scope: WorkspaceInstructionPolicyScope;\n roleKey: string | null;\n};\n\nexport type WorkspaceInstructionPolicyRevisionIdentity = {\n id: string;\n revision: number;\n contentHash: string;\n};\n\nexport type WorkspaceInstructionPolicyRevision = WorkspaceInstructionPolicyRevisionIdentity &\n WorkspaceInstructionPolicyTarget & {\n operationId: string;\n accountId: string;\n workspaceId: string;\n content: string;\n provenance: {\n source: WorkspaceInstructionPolicyProvenanceSource;\n sourceId: string | null;\n };\n supersedesRevisionId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n };\n\nexport type WorkspaceInstructionPolicyHead = WorkspaceInstructionPolicyTarget & {\n workspaceId: string;\n revisionId: string;\n revision: number;\n contentHash: string;\n activationVersion: number;\n activatedAt: string;\n};\n\nexport type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPolicyTarget & {\n id: string;\n operationId: string;\n accountId: string;\n workspaceId: string;\n type: WorkspaceInstructionPolicyActivationType;\n activationVersion: number;\n oldRevision: WorkspaceInstructionPolicyRevisionIdentity | null;\n newRevision: WorkspaceInstructionPolicyRevisionIdentity;\n actorSubjectId: string;\n reason: string;\n createdAt: string;\n};\n\nexport type CreateWorkspaceInstructionPolicyDraftRequest = WorkspaceInstructionPolicyTarget & {\n operationId?: string;\n content: string;\n provenanceSource?: WorkspaceInstructionPolicyDraftProvenanceSource;\n provenanceSourceId?: string | null;\n supersedesRevisionId?: string | null;\n};\n\nexport type ImportLegacyWorkspaceInstructionPolicyDraftRequest = {\n operationId?: string;\n supersedesRevisionId?: string | null;\n};\n\nexport type WorkspaceInstructionPolicyListOptions = {\n kind?: WorkspaceInstructionPolicyKind;\n scope?: WorkspaceInstructionPolicyScope;\n roleKey?: string;\n afterRevision?: number;\n limit?: number;\n};\n\nexport type WorkspaceInstructionPolicyListResponse = {\n revisions: WorkspaceInstructionPolicyRevision[];\n activeHeads: WorkspaceInstructionPolicyHead[];\n activationEvents: WorkspaceInstructionPolicyActivationEvent[];\n nextAfterRevision: number | null;\n};\n\nexport type WorkspaceInstructionPolicyDiffRequest = {\n fromRevisionId: string;\n toRevisionId: string;\n};\n\nexport type WorkspaceInstructionPolicyDiffResponse = {\n from: WorkspaceInstructionPolicyRevision;\n to: WorkspaceInstructionPolicyRevision;\n format: \"unified\";\n diff: string;\n};\n\nexport type ActivateWorkspaceInstructionPolicyRequest = {\n operationId?: string;\n expectedCurrentRevisionId: string | null;\n expectedActivationVersion?: number;\n reason: string;\n};\n\nexport type RollbackWorkspaceInstructionPolicyRequest = {\n operationId?: string;\n targetRevisionId: string;\n expectedCurrentRevisionId: string;\n expectedActivationVersion?: number;\n reason: string;\n};\n\nexport type WorkspaceInstructionPolicyActivationResponse = {\n head: WorkspaceInstructionPolicyHead;\n event: WorkspaceInstructionPolicyActivationEvent;\n};\n\nexport type WorkspaceInstructionPolicyConflictResponse = {\n code: \"WORKSPACE_INSTRUCTION_POLICY_CONFLICT\";\n message: string;\n currentHead: WorkspaceInstructionPolicyHead | null;\n};\n\nexport type WorkspaceInstructionPolicyOperationReuseResponse = {\n code: \"WORKSPACE_INSTRUCTION_POLICY_OPERATION_REUSED\";\n message: string;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalSource = {\n id: string;\n version: string;\n confidenceBps: number;\n};\n\nexport type CreateWorkspaceInstructionPolicyOnboardingProposalRequest =\n WorkspaceInstructionPolicyTarget & {\n operationId?: string;\n content: string;\n sourceId: string;\n sourceVersion: string;\n confidenceBps: number;\n expectedCurrentRevisionId: string | null;\n expectedActivationVersion: number;\n };\n\nexport type WorkspaceInstructionPolicyOnboardingProposal = WorkspaceInstructionPolicyTarget & {\n id: string;\n operationId: string;\n accountId: string;\n workspaceId: string;\n source: WorkspaceInstructionPolicyOnboardingProposalSource;\n baseline: WorkspaceInstructionPolicyHead | null;\n draft: WorkspaceInstructionPolicyRevision;\n status: \"proposed\";\n createdBySubjectId: string;\n createdAt: string;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalListOptions = {\n limit?: number;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalListResponse = {\n proposals: WorkspaceInstructionPolicyOnboardingProposal[];\n truncated: boolean;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalContentErrorResponse = {\n code:\n | \"WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_PROPOSAL_EMPTY\"\n | \"WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_PROPOSAL_OVERSIZED\";\n message: string;\n maxChars: number;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalStaleResponse = {\n code: \"WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_PROPOSAL_STALE\";\n message: string;\n currentHead: WorkspaceInstructionPolicyHead | null;\n};\n\nexport type WorkspaceInstructionPolicyOnboardingProposalConflictResponse = {\n code: \"WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_PROPOSAL_CONFLICT\";\n message: string;\n existingProposalId: string;\n existingDraftRevisionId: string;\n};\n","export type PreferenceRegistryScope = \"organization\" | \"workspace\" | \"user\";\nexport type PreferenceRegistryStatus =\n | \"proposed\"\n | \"active\"\n | \"inactive\"\n | \"rejected\"\n | \"superseded\"\n | \"expired\";\nexport type PreferenceRegistryProvenanceSource =\n | \"human\"\n | \"onboarding\"\n | \"knowledge_proposal\"\n | \"imported_document\"\n | \"slack\"\n | \"meeting_transcript\"\n | \"call_transcript\";\nexport type PreferenceRegistryTrust =\n | \"untrusted_proposal\"\n | \"personal\"\n | \"workspace_managed\"\n | \"organization_managed\";\nexport type PreferenceRegistryConflictStrategy = \"override\" | \"merge\" | \"reject\" | \"inform\";\n\nexport function normalizePreferenceRegistryStableKey(value: string): string {\n return value.normalize(\"NFKC\").trim().toLowerCase().replace(/\\s+/gu, \"-\").replace(/-+/g, \"-\");\n}\n\nexport type PreferenceRegistryScopeTarget = {\n scope: PreferenceRegistryScope;\n workspaceId: string | null;\n subjectId: string | null;\n};\n\nexport type PreferenceRegistryPrecedence = {\n tier: PreferenceRegistryScope;\n rank: number;\n conflictStrategy: PreferenceRegistryConflictStrategy;\n conflictsWith: string[];\n};\n\nexport type PreferenceRegistryRevisionSummary = {\n id: string;\n preferenceId: string;\n revision: number;\n contentHash: string;\n title: string;\n description: string;\n precedence: PreferenceRegistryPrecedence;\n provenance: {\n source: PreferenceRegistryProvenanceSource;\n sourceId: string | null;\n trust: PreferenceRegistryTrust;\n };\n expiresAt: string | null;\n correctsRevisionId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n};\n\nexport type PreferenceRegistryDescriptorProvenance = {\n source: PreferenceRegistryProvenanceSource;\n sourceIdHash: string | null;\n trust: PreferenceRegistryTrust;\n};\n\nexport type PreferenceRegistryRecord = {\n id: string;\n accountId: string;\n stableKey: string;\n target: PreferenceRegistryScopeTarget;\n status: PreferenceRegistryStatus;\n scopeVersion: number;\n activationVersion: number;\n activeRevision: PreferenceRegistryRevisionSummary | null;\n supersededByPreferenceId: string | null;\n createdBySubjectId: string;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PreferenceRegistryEvent = {\n id: string;\n accountId: string;\n preferenceId: string;\n type:\n | \"proposal_created\"\n | \"activated\"\n | \"corrected\"\n | \"rejected\"\n | \"deactivated\"\n | \"superseded\"\n | \"scope_changed\";\n version: number;\n oldRevisionId: string | null;\n newRevisionId: string | null;\n oldTarget: PreferenceRegistryScopeTarget | null;\n newTarget: PreferenceRegistryScopeTarget | null;\n relatedPreferenceId: string | null;\n actorSubjectId: string;\n reason: string;\n createdAt: string;\n};\n\nexport type PreferenceRegistryDescriptor = {\n id: string;\n stableKey: string;\n title: string;\n description: string;\n scope: PreferenceRegistryScope;\n activeVersion: number;\n revisionId: string;\n contentHash: string;\n precedence: PreferenceRegistryPrecedence;\n provenance: PreferenceRegistryDescriptorProvenance;\n expiresAt: string | null;\n retrievalHandle: string;\n};\n\nexport type PreferenceRegistrySnapshot = {\n id: string;\n workspaceId: string;\n sessionId: string;\n turnId: string;\n attemptId: string;\n executionGeneration: number;\n initiatingHumanSubjectId: string;\n descriptorHash: string;\n descriptors: PreferenceRegistryDescriptor[];\n truncated: boolean;\n createdAt: string;\n};\n\nexport type PreferenceRegistryFullContent = {\n descriptor: PreferenceRegistryDescriptor;\n content: string;\n};\n\nexport type CreatePreferenceRegistryProposalRequest = {\n stableKey: string;\n scope: PreferenceRegistryScope;\n title: string;\n description: string;\n content: string;\n precedenceRank?: number;\n conflictStrategy?: PreferenceRegistryConflictStrategy;\n conflictsWith?: string[];\n expiresAt?: string | null;\n provenanceSource?: PreferenceRegistryProvenanceSource;\n provenanceSourceId?: string | null;\n};\n\nexport type ActivatePreferenceRegistryRevisionRequest = {\n revisionId: string;\n expectedCurrentRevisionId: string | null;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type CorrectPreferenceRegistryRequest = {\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n title: string;\n description: string;\n content: string;\n precedenceRank?: number;\n conflictStrategy?: PreferenceRegistryConflictStrategy;\n conflictsWith?: string[];\n expiresAt?: string | null;\n reason: string;\n};\n\nexport type DeactivatePreferenceRegistryRequest = {\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type ChangePreferenceRegistryScopeRequest = {\n scope: PreferenceRegistryScope;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type SupersedePreferenceRegistryRequest = {\n replacementPreferenceId: string;\n expectedCurrentRevisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\n\nexport type RejectPreferenceRegistryProposalRequest = {\n revisionId: string;\n expectedScopeVersion: number;\n reason: string;\n};\nexport type PreferenceRegistryListOptions = {\n scope?: PreferenceRegistryScope;\n status?: PreferenceRegistryStatus;\n limit?: number;\n};\nexport type PreferenceRegistryListResponse = { preferences: PreferenceRegistryRecord[] };\nexport type PreferenceRegistryDetailResponse = {\n preference: PreferenceRegistryRecord;\n revisions: PreferenceRegistryRevisionSummary[];\n events: PreferenceRegistryEvent[];\n};\nexport type PreferenceRegistryMutationResponse = {\n preference: PreferenceRegistryRecord;\n event: PreferenceRegistryEvent;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAMA,kBAAN,cAA6B,eAAmB;AAAA,EACrD,MAAM,uBACJ,aACA,UAAwC,CAAC,GACD;AACxC,UAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAI,QAAQ,UAAU,OAAW,OAAM,IAAI,SAAS,OAAO,QAAQ,KAAK,CAAC;AACzE,QAAI,QAAQ,OAAQ,OAAM,IAAI,UAAU,QAAQ,MAAM;AACtD,UAAM,SAAS,MAAM,OA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EAAE,aAAa,UAAU;AAC3B,MAAE,WAAW;AAAA,EACf,WAAW,EAAE,aAAa,SAAS;AACjC,MAAE,WAAW;AAAA,EACf;AACA,SAAO,EAAE,SAAS;AACpB;AAQO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAAA;AAAA,EAE/B,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,QAAQ;AACV;AAGO,IAAM,oBAAoB;AAAA;AAAA,EAE/B,QAAQ;AAAA;AAAA,EAER,kBAAkB;AAAA;AAAA,EAElB,iBAAiB;AACnB;AAUO,SAAS,cAAc,MAAoD;AAChF,QAAM,QAAgE,EAAE,WAAW,GAAG;AACtF,MAAI,MAAM,WAAW,KAAK,UAAU,EAAG,OAAM,UAAU,KAAK;AAC5D,MAAI,MAAM,QAAQ,KAAK,OAAO,EAAG,OAAM,OAAO,KAAK;AACnD,SAAO,KAAK,UAAU,KAAK;AAC7B;AAGO,SAAS,eAAe,MAAsB;AACnD,SAAO,kBAAkB,QAAQ;AACnC;AAGO,SAAS,gBAAgB,SAAiB,MAAsB;AACrE,SAAO,kBAAkB,SAAS,KAAK,UAAU,EAAE,SAAS,KAAK,CAAC;AACpE;;;AC1FO,IAAM,iDAAiD;AAevD,SAAS,2CAA2C,OAAuB;AAChF,SAAO,MAAM,UAAU,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ,OAAO,GAAG;AAC9F;;;ACMO,SAAS,qCAAqC,OAAuB;AAC1E,SAAO,MAAM,UAAU,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ,OAAO,GAAG;AAC9F;","names":["OpenGeniClient"]}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Public, provider-neutral realtime browser SDK.
3
+ *
4
+ * Import this subpath lazily in browser applications. The base `@opengeni/sdk`
5
+ * entry remains free of eager realtime transport initialization.
6
+ */
7
+ import { createCodexRealtimeController, hasStoredSessionRealtimeOwnerProof, sessionRealtimeOwnerStorageKey, sessionRealtimeOwnerStorageNamespace, type CodexRealtimeController, type CodexRealtimeControllerClient, type CodexRealtimeControllerSnapshot, type CodexRealtimeControllerStatus, type CodexRealtimeDiagnostic, type CodexRealtimeDiagnosticKind, type CodexRealtimeMicrophoneState, type CodexRealtimeOwnerStorage, type CreateCodexRealtimeControllerOptions, type RealtimeControllerTransportStarter } from "./codex-realtime-controller";
8
+ import { createGatewayRealtimeTransportStarter } from "./gateway-realtime-transport";
9
+ import type { SessionRealtimeModel, WorkspaceRealtimeModelCatalogResponse } from "./types";
10
+ /** Exact backend-facing methods required by the batteries-included realtime SDK. */
11
+ export type SessionRealtimeClientLike = CodexRealtimeControllerClient & {
12
+ getWorkspaceRealtimeModelCatalog(workspaceId: string): Promise<WorkspaceRealtimeModelCatalogResponse>;
13
+ };
14
+ export type SessionRealtimeTransportKind = "codex" | "gateway";
15
+ /** Provider-neutral names for the existing, battle-tested controller projection. */
16
+ export type SessionRealtimeController = CodexRealtimeController;
17
+ export type SessionRealtimeControllerSnapshot = CodexRealtimeControllerSnapshot;
18
+ export type SessionRealtimeControllerStatus = CodexRealtimeControllerStatus;
19
+ export type SessionRealtimeDiagnostic = CodexRealtimeDiagnostic;
20
+ export type SessionRealtimeDiagnosticKind = CodexRealtimeDiagnosticKind;
21
+ export type SessionRealtimeMicrophoneState = CodexRealtimeMicrophoneState;
22
+ export type SessionRealtimeOwnerStorage = CodexRealtimeOwnerStorage;
23
+ export type CreateSessionRealtimeControllerOptions = Omit<CreateCodexRealtimeControllerOptions, "client" | "model" | "ownerStorageNamespace" | "startTransport"> & {
24
+ client: CodexRealtimeControllerClient;
25
+ model: SessionRealtimeModel;
26
+ };
27
+ /** Select the existing transport without exposing provider mechanics to hosts. */
28
+ export declare function sessionRealtimeTransportKind(model: SessionRealtimeModel): SessionRealtimeTransportKind;
29
+ /**
30
+ * Compose the exact current controller with its existing Codex Live or AI
31
+ * Gateway transport. Wire, ledger, delegation, recovery, and lifecycle
32
+ * semantics remain owned by the existing implementations below this facade.
33
+ */
34
+ export declare function createSessionRealtimeController(options: CreateSessionRealtimeControllerOptions): SessionRealtimeController;
35
+ export { createCodexRealtimeController, createGatewayRealtimeTransportStarter, hasStoredSessionRealtimeOwnerProof, sessionRealtimeOwnerStorageKey, sessionRealtimeOwnerStorageNamespace, };
36
+ export type { CodexRealtimeController, CodexRealtimeControllerClient, CodexRealtimeControllerSnapshot, CodexRealtimeControllerStatus, CodexRealtimeDiagnostic, CodexRealtimeDiagnosticKind, CodexRealtimeMicrophoneState, CodexRealtimeOwnerStorage, CreateCodexRealtimeControllerOptions, RealtimeControllerTransportStarter, };
37
+ export { CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS, projectSessionRealtimeLifecycle, } from "./codex-realtime-controller";
38
+ export type { SessionRealtimeLifecycleProjection } from "./codex-realtime-lifecycle";
39
+ export { CodexRealtimeMicrophoneError, acquireCodexRealtimeMicrophone, codexRealtimeMicrophoneHealthy, startCodexRealtimeWebrtc, } from "./codex-realtime";
40
+ export type { AcquireCodexRealtimeMicrophoneOptions, CodexRealtimeAudibleOutputState, CodexRealtimeConnectionHealth, CodexRealtimeMicrophoneErrorCode, CodexRealtimeNegotiator, CodexRealtimeWebrtcSession, StartCodexRealtimeWebrtcOptions, } from "./codex-realtime";
41
+ export { CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES, CODEX_REALTIME_V3_MAX_EVENT_BYTES, CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES, CODEX_REALTIME_V3_MAX_TEXT_BYTES, CODEX_REALTIME_V3_PENDING_MAX_BYTES, CODEX_REALTIME_V3_PENDING_MAX_ENTRIES, CODEX_REALTIME_V3_SYNC_MAX_ENTRIES, contextAppendChunks, createCodexRealtimeV3Bridge, encodeCodexRealtimeV3DelegationContextAppend, encodeCodexRealtimeV3SessionContextAppend, parseCodexRealtimeV3Event, } from "./codex-realtime-v3";
42
+ export type { CodexRealtimeV3Bridge, CodexRealtimeV3BridgeFatal, CodexRealtimeV3BridgeOptions, CodexRealtimeV3BridgeSnapshot, CodexRealtimeV3ContextAppendChannel, CodexRealtimeV3DelegationContextAppend, CodexRealtimeV3Event, CodexRealtimeV3ParseFailure, CodexRealtimeV3ParseResult, CodexRealtimeV3SessionContextAppend, } from "./codex-realtime-v3";
43
+ export { CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT, CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS, } from "./codex-realtime-v3-wire";
44
+ export type { CodexRealtimeInitialItem } from "./codex-realtime-v3-wire";
45
+ export type { ActivateCodexRealtimeConnectionRequest, BeginSessionRealtimeRequest, CodexRealtimeVoice, CodexRealtimeWebrtcRequest, CodexRealtimeWebrtcResponse, CodexRealtimeWebrtcVersion, EndSessionRealtimeRequest, GatewayRealtimeConnectRequest, GatewayRealtimeConnectResponse, GatewayRealtimeInitialItem, RenewSessionRealtimeRequest, SessionRealtimeEndReason, SessionRealtimeLedgerEntry, SessionRealtimeMode, SessionRealtimeModel, SessionRealtimeMutationResponse, SessionRealtimeState, SyncSessionRealtimeLedgerRequest, SyncSessionRealtimeLedgerResponse, WorkspaceRealtimeModelCatalogItem, WorkspaceRealtimeModelCatalogResponse, } from "./types";
@@ -0,0 +1,73 @@
1
+ import {
2
+ CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
3
+ CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,
4
+ CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,
5
+ CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,
6
+ CODEX_REALTIME_V3_MAX_EVENT_BYTES,
7
+ CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,
8
+ CODEX_REALTIME_V3_MAX_TEXT_BYTES,
9
+ CODEX_REALTIME_V3_PENDING_MAX_BYTES,
10
+ CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,
11
+ CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,
12
+ CodexRealtimeMicrophoneError,
13
+ acquireCodexRealtimeMicrophone,
14
+ codexRealtimeMicrophoneHealthy,
15
+ contextAppendChunks,
16
+ createCodexRealtimeController,
17
+ createCodexRealtimeV3Bridge,
18
+ encodeCodexRealtimeV3DelegationContextAppend,
19
+ encodeCodexRealtimeV3SessionContextAppend,
20
+ hasStoredSessionRealtimeOwnerProof,
21
+ parseCodexRealtimeV3Event,
22
+ projectSessionRealtimeLifecycle,
23
+ sessionRealtimeOwnerStorageKey,
24
+ sessionRealtimeOwnerStorageNamespace,
25
+ startCodexRealtimeWebrtc
26
+ } from "./chunk-XBBPYTI5.js";
27
+ import "./chunk-OINSI33U.js";
28
+ import {
29
+ createGatewayRealtimeTransportStarter
30
+ } from "./chunk-DXDL7EEW.js";
31
+
32
+ // src/realtime.ts
33
+ function sessionRealtimeTransportKind(model) {
34
+ return model === "gpt-live-1-boulder-alpha" ? "codex" : "gateway";
35
+ }
36
+ function createSessionRealtimeController(options) {
37
+ const transport = sessionRealtimeTransportKind(options.model);
38
+ return createCodexRealtimeController({
39
+ ...options,
40
+ ownerStorageNamespace: sessionRealtimeOwnerStorageNamespace(options.model),
41
+ ...transport === "gateway" ? { startTransport: createGatewayRealtimeTransportStarter() } : {}
42
+ });
43
+ }
44
+ export {
45
+ CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
46
+ CODEX_REALTIME_INITIAL_ITEMS_MAX_COUNT,
47
+ CODEX_REALTIME_INITIAL_ITEMS_MAX_TOKENS,
48
+ CODEX_REALTIME_NEGOTIATION_TIMEOUT_MS,
49
+ CODEX_REALTIME_V3_MAX_EVENT_BYTES,
50
+ CODEX_REALTIME_V3_MAX_IDENTIFIER_BYTES,
51
+ CODEX_REALTIME_V3_MAX_TEXT_BYTES,
52
+ CODEX_REALTIME_V3_PENDING_MAX_BYTES,
53
+ CODEX_REALTIME_V3_PENDING_MAX_ENTRIES,
54
+ CODEX_REALTIME_V3_SYNC_MAX_ENTRIES,
55
+ CodexRealtimeMicrophoneError,
56
+ acquireCodexRealtimeMicrophone,
57
+ codexRealtimeMicrophoneHealthy,
58
+ contextAppendChunks,
59
+ createCodexRealtimeController,
60
+ createCodexRealtimeV3Bridge,
61
+ createGatewayRealtimeTransportStarter,
62
+ createSessionRealtimeController,
63
+ encodeCodexRealtimeV3DelegationContextAppend,
64
+ encodeCodexRealtimeV3SessionContextAppend,
65
+ hasStoredSessionRealtimeOwnerProof,
66
+ parseCodexRealtimeV3Event,
67
+ projectSessionRealtimeLifecycle,
68
+ sessionRealtimeOwnerStorageKey,
69
+ sessionRealtimeOwnerStorageNamespace,
70
+ sessionRealtimeTransportKind,
71
+ startCodexRealtimeWebrtc
72
+ };
73
+ //# sourceMappingURL=realtime.js.map
@@ -0,0 +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 { createGatewayRealtimeTransportStarter } 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 ): Promise<WorkspaceRealtimeModelCatalogResponse>;\n};\n\nexport type SessionRealtimeTransportKind = \"codex\" | \"gateway\";\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 return model === \"gpt-live-1-boulder-alpha\" ? \"codex\" : \"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\" ? { startTransport: createGatewayRealtimeTransportStarter() } : {}),\n });\n}\n\nexport {\n createCodexRealtimeController,\n createGatewayRealtimeTransportStarter,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDO,SAAS,6BACd,OAC8B;AAC9B,SAAO,UAAU,6BAA6B,UAAU;AAC1D;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,YAAY,EAAE,gBAAgB,sCAAsC,EAAE,IAAI,CAAC;AAAA,EAC/F,CAAC;AACH;","names":[]}
package/dist/types.d.ts CHANGED
@@ -318,10 +318,12 @@ export type RepositoryResourceRef = {
318
318
  githubInstallationId?: number | undefined;
319
319
  githubRepositoryId?: number | undefined;
320
320
  };
321
+ /** Value mirror of `@opengeni/contracts`; parity-tested without adding an SDK runtime dependency. */
322
+ export declare const DEFAULT_FILE_RESOURCE_MOUNT_ROOT: ".opengeni/files";
321
323
  export type FileResourceRef = {
322
324
  kind: "file";
323
325
  fileId: string;
324
- /** Optional workspace-relative override; defaults to `files/<file-id>`. */
326
+ /** Optional workspace-relative override; defaults to `.opengeni/files/<file-id>`. */
325
327
  mountPath?: string | undefined;
326
328
  };
327
329
  export type ResourceRef = RepositoryResourceRef | FileResourceRef;
@@ -470,6 +472,16 @@ export type OpenGeniSlackBotInstallStart = {
470
472
  export type GoogleDriveTargetScope = "user" | "workspace" | "organization";
471
473
  export type GoogleDriveSyncCadence = "manual" | "hourly" | "daily";
472
474
  export type GoogleDriveReadPolicy = "allow" | "ask" | "block";
475
+ export type GoogleDriveConnectionLifecycleState = "active" | "paused" | "token_revoked" | "app_removed" | "disconnected" | "reconnect_required" | "reconsent_required";
476
+ export type GoogleDriveConnectionLifecycle = {
477
+ state: Exclude<GoogleDriveConnectionLifecycleState, "app_removed">;
478
+ recoverable: true;
479
+ observedAt: string;
480
+ } | {
481
+ state: "app_removed";
482
+ recoverable: false;
483
+ observedAt: string;
484
+ };
473
485
  export type GoogleDriveSelectedSource = {
474
486
  id: string;
475
487
  name: string;
@@ -488,6 +500,7 @@ export type GoogleDriveConnectionMetadata = {
488
500
  googleDisplayName: string | null;
489
501
  verifiedAt: string;
490
502
  accessMode: "metadata_readonly" | "readonly";
503
+ lifecycle?: GoogleDriveConnectionLifecycle | undefined;
491
504
  selectedSources?: GoogleDriveSelectedSource[] | undefined;
492
505
  /** @deprecated Read selectedSources; retained while existing connections migrate. */
493
506
  selectedSource?: GoogleDriveSelectedSource | null | undefined;
@@ -500,6 +513,14 @@ export type GoogleDriveOAuthStartResponse = {
500
513
  authorizationUrl: string;
501
514
  expiresAt: string;
502
515
  };
516
+ export type GoogleDriveLifecycleActionRequest = {
517
+ action: "pause" | "resume";
518
+ expectedVersion: number;
519
+ };
520
+ export type GoogleDriveDisconnectRequest = {
521
+ expectedVersion: number;
522
+ idempotencyKey: string;
523
+ };
503
524
  export type GoogleDriveBrowseItem = {
504
525
  id: string;
505
526
  name: string;
@@ -763,8 +784,6 @@ export type HumanInputQuestion = {
763
784
  required: boolean;
764
785
  allowOther: boolean;
765
786
  validation?: {
766
- minLength?: number | null | undefined;
767
- maxLength?: number | null | undefined;
768
787
  minSelections?: number | null | undefined;
769
788
  maxSelections?: number | null | undefined;
770
789
  } | null | undefined;
@@ -1547,6 +1566,7 @@ export type ModelCapabilitiesV1 = {
1547
1566
  codeExecution: ModelCapabilityStateV1;
1548
1567
  };
1549
1568
  inputModalities: Array<"text" | "image" | "audio">;
1569
+ inputFileMediaTypes?: string[] | undefined;
1550
1570
  outputModalities: Array<"text" | "image" | "audio">;
1551
1571
  transports: {
1552
1572
  sse: ModelCapabilityStateV1;
@@ -2604,6 +2624,7 @@ export type UploadFileInput = {
2604
2624
  export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
2605
2625
  export type KnowledgeSourceKind = "manual_upload" | "meeting_transcript" | "repository" | "email" | "chat" | "document" | "web" | "other";
2606
2626
  export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
2627
+ export type DocumentAuthorityKind = "organization" | "workspace" | "personal";
2607
2628
  export type DocumentVisibility = "workspace" | "private";
2608
2629
  export type DocumentCurationStatus = "none" | "pending" | "suggested" | "auto_filed" | "failed";
2609
2630
  export type DocumentCuration = {
@@ -2641,6 +2662,9 @@ export type Document = {
2641
2662
  sourceUpdatedAt: string | null;
2642
2663
  sourceVersion: string | null;
2643
2664
  aclTags: string[];
2665
+ authorityKind: DocumentAuthorityKind;
2666
+ authorityWorkspaceId: string | null;
2667
+ authoritySubjectId: string | null;
2644
2668
  visibility: DocumentVisibility;
2645
2669
  createdBy: string | null;
2646
2670
  agentAccess: boolean;
@@ -2674,6 +2698,9 @@ export type DocumentSearchResult = {
2674
2698
  sourceUpdatedAt: string | null;
2675
2699
  sourceVersion: string | null;
2676
2700
  aclTags: string[];
2701
+ authorityKind: DocumentAuthorityKind;
2702
+ authorityWorkspaceId: string | null;
2703
+ authoritySubjectId: string | null;
2677
2704
  };
2678
2705
  export type CreateDocumentBaseRequest = {
2679
2706
  name: string;
@@ -2691,6 +2718,7 @@ export type AddDocumentRequest = {
2691
2718
  sourceUpdatedAt?: string | undefined;
2692
2719
  sourceVersion?: string | undefined;
2693
2720
  aclTags?: string[] | undefined;
2721
+ authorityKind?: DocumentAuthorityKind | undefined;
2694
2722
  visibility?: DocumentVisibility | undefined;
2695
2723
  agentAccess?: boolean | undefined;
2696
2724
  };
@@ -2699,6 +2727,7 @@ export type CreateKnowledgeDropRequest = {
2699
2727
  fileId?: string | undefined;
2700
2728
  filename?: string | undefined;
2701
2729
  title?: string | undefined;
2730
+ authorityKind?: DocumentAuthorityKind | undefined;
2702
2731
  visibility?: DocumentVisibility | undefined;
2703
2732
  agentAccess?: boolean | undefined;
2704
2733
  };