connectbase-client 5.5.0 → 5.6.1
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/CHANGELOG.md +42 -0
- package/dist/connect-base.umd.js +5 -5
- package/dist/index.d.mts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +66 -11
- package/dist/index.mjs +66 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -264,6 +264,14 @@ declare class HttpClient {
|
|
|
264
264
|
*/
|
|
265
265
|
private bootRestorePromise;
|
|
266
266
|
private bootRestoreAlwaysAwait;
|
|
267
|
+
/**
|
|
268
|
+
* 클라이언트 생성 시 명시된 요청 타임아웃(ms). 미지정이면 `undefined`.
|
|
269
|
+
*
|
|
270
|
+
* API 모듈이 자기 엔드포인트에 맞는 기본 타임아웃을 고를 때, 사용자가 명시한 값이
|
|
271
|
+
* 있으면 그쪽을 존중하기 위해 필요하다 (`ai.chat` 이 이 값을 읽는다). `config` 자체를
|
|
272
|
+
* 노출하면 토큰/스토리지 설정까지 새므로 이 필드만 읽기 전용으로 연다.
|
|
273
|
+
*/
|
|
274
|
+
get requestTimeoutMs(): number | undefined;
|
|
267
275
|
constructor(config: HttpClientConfig);
|
|
268
276
|
/**
|
|
269
277
|
* 페이지 진입 시 fire-and-forget 으로 시작된 cookie 복구 promise 를 SDK 가 등록한다.
|
|
@@ -635,6 +643,29 @@ interface AIChatStreamCallbacks {
|
|
|
635
643
|
/**
|
|
636
644
|
* `chatStream` 호출 옵션. `signal` 로 진행 중인 SSE 스트림을 취소할 수 있다.
|
|
637
645
|
*/
|
|
646
|
+
interface AIChatOptions {
|
|
647
|
+
/**
|
|
648
|
+
* 이 1회 생성에 허용할 시간(ms). 미지정이면 클라이언트 생성 시 준
|
|
649
|
+
* `requestTimeoutMs`, 그것도 없으면 서버 기본값과 같은 90초.
|
|
650
|
+
*
|
|
651
|
+
* 이 값은 **서버까지 전달되는 생성 예산**이다 — 클라이언트가 먼저 끊는 게 아니라
|
|
652
|
+
* 서버가 이 시간을 다 쓰고 `504 provider_timeout` 을 돌려준다. 그래서 시간이 넘쳤을
|
|
653
|
+
* 때 "게이트웨이가 끊었다" 와 "모델이 형식을 어겼다" 를 에러로 구분할 수 있다.
|
|
654
|
+
* 상한은 300초(서버리스 함수의 최대 timeout 과 같은 값)이며, 넘겨도 300초로 clamp 된다.
|
|
655
|
+
*
|
|
656
|
+
* 300초로도 부족한 긴 생성은 `chatStream` 을 쓸 것 — 스트리밍은 총량 상한이 없고
|
|
657
|
+
* 토큰이 흐르는 한 계속된다.
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```ts
|
|
661
|
+
* // 함수 안에서 긴 번역 배치 — 함수 timeout(300s) 안에서 4분을 준다
|
|
662
|
+
* const res = await ctx.cb.ai.chat({ messages }, { timeout: 240_000 })
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
timeout?: number;
|
|
666
|
+
/** 진행 중인 요청을 취소하기 위한 `AbortSignal`. */
|
|
667
|
+
signal?: AbortSignal;
|
|
668
|
+
}
|
|
638
669
|
interface AIChatStreamOptions {
|
|
639
670
|
/**
|
|
640
671
|
* 진행 중인 스트림을 취소하기 위한 `AbortSignal`. abort 하면 SSE 연결이
|
|
@@ -778,8 +809,11 @@ declare class AIAPI {
|
|
|
778
809
|
/**
|
|
779
810
|
* AI 채팅 (동기). ConnectBase 서버 프록시 경유 — provider API key 는 server-side `AppAIConfig`
|
|
780
811
|
* 에서만 사용되어 클라이언트에 노출되지 않습니다. raw provider URL 직접 호출 금지 (안티 패턴).
|
|
812
|
+
*
|
|
813
|
+
* @param options `options.timeout` 으로 이 1회 생성의 시간 예산(ms)을 정한다 — 자세한
|
|
814
|
+
* 의미와 상한은 {@link AIChatOptions.timeout} 참고. 미지정이면 90초.
|
|
781
815
|
*/
|
|
782
|
-
chat(request: AIChatRequest): Promise<AIChatResponse>;
|
|
816
|
+
chat(request: AIChatRequest, options?: AIChatOptions): Promise<AIChatResponse>;
|
|
783
817
|
/**
|
|
784
818
|
* AI 채팅 스트리밍 (SSE)
|
|
785
819
|
*
|
|
@@ -10293,4 +10327,4 @@ declare class ConnectBase {
|
|
|
10293
10327
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10294
10328
|
}
|
|
10295
10329
|
|
|
10296
|
-
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
|
10330
|
+
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
package/dist/index.d.ts
CHANGED
|
@@ -264,6 +264,14 @@ declare class HttpClient {
|
|
|
264
264
|
*/
|
|
265
265
|
private bootRestorePromise;
|
|
266
266
|
private bootRestoreAlwaysAwait;
|
|
267
|
+
/**
|
|
268
|
+
* 클라이언트 생성 시 명시된 요청 타임아웃(ms). 미지정이면 `undefined`.
|
|
269
|
+
*
|
|
270
|
+
* API 모듈이 자기 엔드포인트에 맞는 기본 타임아웃을 고를 때, 사용자가 명시한 값이
|
|
271
|
+
* 있으면 그쪽을 존중하기 위해 필요하다 (`ai.chat` 이 이 값을 읽는다). `config` 자체를
|
|
272
|
+
* 노출하면 토큰/스토리지 설정까지 새므로 이 필드만 읽기 전용으로 연다.
|
|
273
|
+
*/
|
|
274
|
+
get requestTimeoutMs(): number | undefined;
|
|
267
275
|
constructor(config: HttpClientConfig);
|
|
268
276
|
/**
|
|
269
277
|
* 페이지 진입 시 fire-and-forget 으로 시작된 cookie 복구 promise 를 SDK 가 등록한다.
|
|
@@ -635,6 +643,29 @@ interface AIChatStreamCallbacks {
|
|
|
635
643
|
/**
|
|
636
644
|
* `chatStream` 호출 옵션. `signal` 로 진행 중인 SSE 스트림을 취소할 수 있다.
|
|
637
645
|
*/
|
|
646
|
+
interface AIChatOptions {
|
|
647
|
+
/**
|
|
648
|
+
* 이 1회 생성에 허용할 시간(ms). 미지정이면 클라이언트 생성 시 준
|
|
649
|
+
* `requestTimeoutMs`, 그것도 없으면 서버 기본값과 같은 90초.
|
|
650
|
+
*
|
|
651
|
+
* 이 값은 **서버까지 전달되는 생성 예산**이다 — 클라이언트가 먼저 끊는 게 아니라
|
|
652
|
+
* 서버가 이 시간을 다 쓰고 `504 provider_timeout` 을 돌려준다. 그래서 시간이 넘쳤을
|
|
653
|
+
* 때 "게이트웨이가 끊었다" 와 "모델이 형식을 어겼다" 를 에러로 구분할 수 있다.
|
|
654
|
+
* 상한은 300초(서버리스 함수의 최대 timeout 과 같은 값)이며, 넘겨도 300초로 clamp 된다.
|
|
655
|
+
*
|
|
656
|
+
* 300초로도 부족한 긴 생성은 `chatStream` 을 쓸 것 — 스트리밍은 총량 상한이 없고
|
|
657
|
+
* 토큰이 흐르는 한 계속된다.
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```ts
|
|
661
|
+
* // 함수 안에서 긴 번역 배치 — 함수 timeout(300s) 안에서 4분을 준다
|
|
662
|
+
* const res = await ctx.cb.ai.chat({ messages }, { timeout: 240_000 })
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
timeout?: number;
|
|
666
|
+
/** 진행 중인 요청을 취소하기 위한 `AbortSignal`. */
|
|
667
|
+
signal?: AbortSignal;
|
|
668
|
+
}
|
|
638
669
|
interface AIChatStreamOptions {
|
|
639
670
|
/**
|
|
640
671
|
* 진행 중인 스트림을 취소하기 위한 `AbortSignal`. abort 하면 SSE 연결이
|
|
@@ -778,8 +809,11 @@ declare class AIAPI {
|
|
|
778
809
|
/**
|
|
779
810
|
* AI 채팅 (동기). ConnectBase 서버 프록시 경유 — provider API key 는 server-side `AppAIConfig`
|
|
780
811
|
* 에서만 사용되어 클라이언트에 노출되지 않습니다. raw provider URL 직접 호출 금지 (안티 패턴).
|
|
812
|
+
*
|
|
813
|
+
* @param options `options.timeout` 으로 이 1회 생성의 시간 예산(ms)을 정한다 — 자세한
|
|
814
|
+
* 의미와 상한은 {@link AIChatOptions.timeout} 참고. 미지정이면 90초.
|
|
781
815
|
*/
|
|
782
|
-
chat(request: AIChatRequest): Promise<AIChatResponse>;
|
|
816
|
+
chat(request: AIChatRequest, options?: AIChatOptions): Promise<AIChatResponse>;
|
|
783
817
|
/**
|
|
784
818
|
* AI 채팅 스트리밍 (SSE)
|
|
785
819
|
*
|
|
@@ -10293,4 +10327,4 @@ declare class ConnectBase {
|
|
|
10293
10327
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10294
10328
|
}
|
|
10295
10329
|
|
|
10296
|
-
export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
|
10330
|
+
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
package/dist/index.js
CHANGED
|
@@ -283,6 +283,9 @@ var GameError = class extends Error {
|
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
// src/api/ai.ts
|
|
286
|
+
var AI_CHAT_DEFAULT_TIMEOUT_MS = 9e4;
|
|
287
|
+
var AI_CHAT_MAX_TIMEOUT_MS = 3e5;
|
|
288
|
+
var AI_CHAT_CLIENT_GRACE_MS = 1e4;
|
|
286
289
|
var AIAPI = class {
|
|
287
290
|
constructor(http) {
|
|
288
291
|
this.http = http;
|
|
@@ -290,9 +293,22 @@ var AIAPI = class {
|
|
|
290
293
|
/**
|
|
291
294
|
* AI 채팅 (동기). ConnectBase 서버 프록시 경유 — provider API key 는 server-side `AppAIConfig`
|
|
292
295
|
* 에서만 사용되어 클라이언트에 노출되지 않습니다. raw provider URL 직접 호출 금지 (안티 패턴).
|
|
296
|
+
*
|
|
297
|
+
* @param options `options.timeout` 으로 이 1회 생성의 시간 예산(ms)을 정한다 — 자세한
|
|
298
|
+
* 의미와 상한은 {@link AIChatOptions.timeout} 참고. 미지정이면 90초.
|
|
293
299
|
*/
|
|
294
|
-
async chat(request) {
|
|
295
|
-
|
|
300
|
+
async chat(request, options) {
|
|
301
|
+
const budgetMs = Math.min(
|
|
302
|
+
options?.timeout ?? this.http.requestTimeoutMs ?? AI_CHAT_DEFAULT_TIMEOUT_MS,
|
|
303
|
+
AI_CHAT_MAX_TIMEOUT_MS
|
|
304
|
+
);
|
|
305
|
+
return this.http.post(
|
|
306
|
+
"/v1/public/ai/chat",
|
|
307
|
+
// timeoutSeconds 는 서버가 쓰는 생성 예산. 마지막에 펼쳐 호출자가 임의로 넣은
|
|
308
|
+
// 값이 이 계산을 덮어쓰지 못하게 한다.
|
|
309
|
+
{ ...request, timeoutSeconds: Math.ceil(budgetMs / 1e3) },
|
|
310
|
+
{ timeout: budgetMs + AI_CHAT_CLIENT_GRACE_MS, signal: options?.signal }
|
|
311
|
+
);
|
|
296
312
|
}
|
|
297
313
|
/**
|
|
298
314
|
* AI 채팅 스트리밍 (SSE)
|
|
@@ -11107,6 +11123,30 @@ function fetchCredentialsForPath(url) {
|
|
|
11107
11123
|
return path.startsWith("/v1/public/") ? "omit" : "include";
|
|
11108
11124
|
}
|
|
11109
11125
|
var TOKEN_STORAGE_KEY = "cb_auth_tokens";
|
|
11126
|
+
function gatewayCodeFromStatus(status) {
|
|
11127
|
+
switch (status) {
|
|
11128
|
+
case 502:
|
|
11129
|
+
return "bad_gateway";
|
|
11130
|
+
case 503:
|
|
11131
|
+
return "service_unavailable";
|
|
11132
|
+
case 504:
|
|
11133
|
+
return "gateway_timeout";
|
|
11134
|
+
default:
|
|
11135
|
+
return void 0;
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
function gatewayMessageFromStatus(status) {
|
|
11139
|
+
switch (status) {
|
|
11140
|
+
case 502:
|
|
11141
|
+
return "\uAC8C\uC774\uD2B8\uC6E8\uC774\uAC00 \uC11C\uBC84\uB85C\uBD80\uD130 \uC62C\uBC14\uB978 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (502)";
|
|
11142
|
+
case 503:
|
|
11143
|
+
return "\uC11C\uBC84\uAC00 \uC77C\uC2DC\uC801\uC73C\uB85C \uC694\uCCAD\uC744 \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (503)";
|
|
11144
|
+
case 504:
|
|
11145
|
+
return "\uAC8C\uC774\uD2B8\uC6E8\uC774\uAC00 \uC751\uB2F5\uC744 \uAE30\uB2E4\uB9AC\uB2E4 \uC5F0\uACB0\uC744 \uB04A\uC5C8\uC2B5\uB2C8\uB2E4 (504). \uC624\uB798 \uAC78\uB9AC\uB294 \uC791\uC5C5\uC774\uBA74 \uC694\uCCAD \uD0C0\uC784\uC544\uC6C3\uC744 \uB298\uB9AC\uAC70\uB098 \uC2A4\uD2B8\uB9AC\uBC0D\uC744 \uC0AC\uC6A9\uD558\uC138\uC694";
|
|
11146
|
+
default:
|
|
11147
|
+
return void 0;
|
|
11148
|
+
}
|
|
11149
|
+
}
|
|
11110
11150
|
function decodeJwtPayload(token) {
|
|
11111
11151
|
try {
|
|
11112
11152
|
const part = token.split(".")[1];
|
|
@@ -11151,6 +11191,16 @@ var HttpClient = class {
|
|
|
11151
11191
|
this.warnIfUnsafePersistence();
|
|
11152
11192
|
this.restoreTokens();
|
|
11153
11193
|
}
|
|
11194
|
+
/**
|
|
11195
|
+
* 클라이언트 생성 시 명시된 요청 타임아웃(ms). 미지정이면 `undefined`.
|
|
11196
|
+
*
|
|
11197
|
+
* API 모듈이 자기 엔드포인트에 맞는 기본 타임아웃을 고를 때, 사용자가 명시한 값이
|
|
11198
|
+
* 있으면 그쪽을 존중하기 위해 필요하다 (`ai.chat` 이 이 값을 읽는다). `config` 자체를
|
|
11199
|
+
* 노출하면 토큰/스토리지 설정까지 새므로 이 필드만 읽기 전용으로 연다.
|
|
11200
|
+
*/
|
|
11201
|
+
get requestTimeoutMs() {
|
|
11202
|
+
return this.config.requestTimeoutMs;
|
|
11203
|
+
}
|
|
11154
11204
|
/**
|
|
11155
11205
|
* 페이지 진입 시 fire-and-forget 으로 시작된 cookie 복구 promise 를 SDK 가 등록한다.
|
|
11156
11206
|
* 같은 promise 가 `prepareHeaders` 에서 await 되어, 첫 인증 호출이 cookie 복구
|
|
@@ -11604,9 +11654,13 @@ var HttpClient = class {
|
|
|
11604
11654
|
}
|
|
11605
11655
|
async handleResponse(response) {
|
|
11606
11656
|
if (!response.ok) {
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11657
|
+
let errorData = {};
|
|
11658
|
+
let bodyIsJson = true;
|
|
11659
|
+
try {
|
|
11660
|
+
errorData = await response.json();
|
|
11661
|
+
} catch {
|
|
11662
|
+
bodyIsJson = false;
|
|
11663
|
+
}
|
|
11610
11664
|
const retryAfterHeader = response.status === 429 ? response.headers.get("Retry-After") : null;
|
|
11611
11665
|
let retryAfterSeconds;
|
|
11612
11666
|
if (retryAfterHeader) {
|
|
@@ -11625,17 +11679,18 @@ var HttpClient = class {
|
|
|
11625
11679
|
}
|
|
11626
11680
|
const rawError = errorData.error;
|
|
11627
11681
|
if (rawError && typeof rawError === "object" && "message" in rawError) {
|
|
11682
|
+
const structured = rawError;
|
|
11628
11683
|
const details = {
|
|
11629
|
-
...
|
|
11684
|
+
...structured.details && typeof structured.details === "object" ? structured.details : {}
|
|
11630
11685
|
};
|
|
11631
11686
|
if (retryAfterSeconds !== void 0) {
|
|
11632
11687
|
details.retry_after_seconds = retryAfterSeconds;
|
|
11633
11688
|
}
|
|
11634
11689
|
const err2 = new ApiError(
|
|
11635
11690
|
response.status,
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
Object.keys(details).length > 0 ? details :
|
|
11691
|
+
typeof structured.message === "string" && structured.message !== "" ? structured.message : "Unknown error",
|
|
11692
|
+
typeof structured.code === "string" ? structured.code : void 0,
|
|
11693
|
+
Object.keys(details).length > 0 ? details : void 0
|
|
11639
11694
|
);
|
|
11640
11695
|
this.emitError(err2);
|
|
11641
11696
|
throw err2;
|
|
@@ -11643,8 +11698,8 @@ var HttpClient = class {
|
|
|
11643
11698
|
const flatMessage = typeof errorData.message === "string" && errorData.message !== "" ? errorData.message : void 0;
|
|
11644
11699
|
const explicitCode = typeof errorData.code === "string" && errorData.code !== "" ? errorData.code : void 0;
|
|
11645
11700
|
const errorIsCode = typeof rawError === "string" && /^[a-z][a-z0-9_]*$/.test(rawError);
|
|
11646
|
-
const message = flatMessage ?? (typeof rawError === "string" && rawError !== "" ? rawError : "Unknown error");
|
|
11647
|
-
const code = explicitCode ?? (errorIsCode ? rawError : void 0);
|
|
11701
|
+
const message = flatMessage ?? (typeof rawError === "string" && rawError !== "" ? rawError : void 0) ?? (bodyIsJson ? void 0 : gatewayMessageFromStatus(response.status)) ?? (response.statusText !== "" ? response.statusText : "Unknown error");
|
|
11702
|
+
const code = explicitCode ?? (errorIsCode ? rawError : void 0) ?? gatewayCodeFromStatus(response.status);
|
|
11648
11703
|
const legacyDetails = {};
|
|
11649
11704
|
if (retryAfterSeconds !== void 0) {
|
|
11650
11705
|
legacyDetails.retry_after_seconds = retryAfterSeconds;
|
package/dist/index.mjs
CHANGED
|
@@ -234,6 +234,9 @@ var GameError = class extends Error {
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
// src/api/ai.ts
|
|
237
|
+
var AI_CHAT_DEFAULT_TIMEOUT_MS = 9e4;
|
|
238
|
+
var AI_CHAT_MAX_TIMEOUT_MS = 3e5;
|
|
239
|
+
var AI_CHAT_CLIENT_GRACE_MS = 1e4;
|
|
237
240
|
var AIAPI = class {
|
|
238
241
|
constructor(http) {
|
|
239
242
|
this.http = http;
|
|
@@ -241,9 +244,22 @@ var AIAPI = class {
|
|
|
241
244
|
/**
|
|
242
245
|
* AI 채팅 (동기). ConnectBase 서버 프록시 경유 — provider API key 는 server-side `AppAIConfig`
|
|
243
246
|
* 에서만 사용되어 클라이언트에 노출되지 않습니다. raw provider URL 직접 호출 금지 (안티 패턴).
|
|
247
|
+
*
|
|
248
|
+
* @param options `options.timeout` 으로 이 1회 생성의 시간 예산(ms)을 정한다 — 자세한
|
|
249
|
+
* 의미와 상한은 {@link AIChatOptions.timeout} 참고. 미지정이면 90초.
|
|
244
250
|
*/
|
|
245
|
-
async chat(request) {
|
|
246
|
-
|
|
251
|
+
async chat(request, options) {
|
|
252
|
+
const budgetMs = Math.min(
|
|
253
|
+
options?.timeout ?? this.http.requestTimeoutMs ?? AI_CHAT_DEFAULT_TIMEOUT_MS,
|
|
254
|
+
AI_CHAT_MAX_TIMEOUT_MS
|
|
255
|
+
);
|
|
256
|
+
return this.http.post(
|
|
257
|
+
"/v1/public/ai/chat",
|
|
258
|
+
// timeoutSeconds 는 서버가 쓰는 생성 예산. 마지막에 펼쳐 호출자가 임의로 넣은
|
|
259
|
+
// 값이 이 계산을 덮어쓰지 못하게 한다.
|
|
260
|
+
{ ...request, timeoutSeconds: Math.ceil(budgetMs / 1e3) },
|
|
261
|
+
{ timeout: budgetMs + AI_CHAT_CLIENT_GRACE_MS, signal: options?.signal }
|
|
262
|
+
);
|
|
247
263
|
}
|
|
248
264
|
/**
|
|
249
265
|
* AI 채팅 스트리밍 (SSE)
|
|
@@ -11058,6 +11074,30 @@ function fetchCredentialsForPath(url) {
|
|
|
11058
11074
|
return path.startsWith("/v1/public/") ? "omit" : "include";
|
|
11059
11075
|
}
|
|
11060
11076
|
var TOKEN_STORAGE_KEY = "cb_auth_tokens";
|
|
11077
|
+
function gatewayCodeFromStatus(status) {
|
|
11078
|
+
switch (status) {
|
|
11079
|
+
case 502:
|
|
11080
|
+
return "bad_gateway";
|
|
11081
|
+
case 503:
|
|
11082
|
+
return "service_unavailable";
|
|
11083
|
+
case 504:
|
|
11084
|
+
return "gateway_timeout";
|
|
11085
|
+
default:
|
|
11086
|
+
return void 0;
|
|
11087
|
+
}
|
|
11088
|
+
}
|
|
11089
|
+
function gatewayMessageFromStatus(status) {
|
|
11090
|
+
switch (status) {
|
|
11091
|
+
case 502:
|
|
11092
|
+
return "\uAC8C\uC774\uD2B8\uC6E8\uC774\uAC00 \uC11C\uBC84\uB85C\uBD80\uD130 \uC62C\uBC14\uB978 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (502)";
|
|
11093
|
+
case 503:
|
|
11094
|
+
return "\uC11C\uBC84\uAC00 \uC77C\uC2DC\uC801\uC73C\uB85C \uC694\uCCAD\uC744 \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (503)";
|
|
11095
|
+
case 504:
|
|
11096
|
+
return "\uAC8C\uC774\uD2B8\uC6E8\uC774\uAC00 \uC751\uB2F5\uC744 \uAE30\uB2E4\uB9AC\uB2E4 \uC5F0\uACB0\uC744 \uB04A\uC5C8\uC2B5\uB2C8\uB2E4 (504). \uC624\uB798 \uAC78\uB9AC\uB294 \uC791\uC5C5\uC774\uBA74 \uC694\uCCAD \uD0C0\uC784\uC544\uC6C3\uC744 \uB298\uB9AC\uAC70\uB098 \uC2A4\uD2B8\uB9AC\uBC0D\uC744 \uC0AC\uC6A9\uD558\uC138\uC694";
|
|
11097
|
+
default:
|
|
11098
|
+
return void 0;
|
|
11099
|
+
}
|
|
11100
|
+
}
|
|
11061
11101
|
function decodeJwtPayload(token) {
|
|
11062
11102
|
try {
|
|
11063
11103
|
const part = token.split(".")[1];
|
|
@@ -11102,6 +11142,16 @@ var HttpClient = class {
|
|
|
11102
11142
|
this.warnIfUnsafePersistence();
|
|
11103
11143
|
this.restoreTokens();
|
|
11104
11144
|
}
|
|
11145
|
+
/**
|
|
11146
|
+
* 클라이언트 생성 시 명시된 요청 타임아웃(ms). 미지정이면 `undefined`.
|
|
11147
|
+
*
|
|
11148
|
+
* API 모듈이 자기 엔드포인트에 맞는 기본 타임아웃을 고를 때, 사용자가 명시한 값이
|
|
11149
|
+
* 있으면 그쪽을 존중하기 위해 필요하다 (`ai.chat` 이 이 값을 읽는다). `config` 자체를
|
|
11150
|
+
* 노출하면 토큰/스토리지 설정까지 새므로 이 필드만 읽기 전용으로 연다.
|
|
11151
|
+
*/
|
|
11152
|
+
get requestTimeoutMs() {
|
|
11153
|
+
return this.config.requestTimeoutMs;
|
|
11154
|
+
}
|
|
11105
11155
|
/**
|
|
11106
11156
|
* 페이지 진입 시 fire-and-forget 으로 시작된 cookie 복구 promise 를 SDK 가 등록한다.
|
|
11107
11157
|
* 같은 promise 가 `prepareHeaders` 에서 await 되어, 첫 인증 호출이 cookie 복구
|
|
@@ -11555,9 +11605,13 @@ var HttpClient = class {
|
|
|
11555
11605
|
}
|
|
11556
11606
|
async handleResponse(response) {
|
|
11557
11607
|
if (!response.ok) {
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11608
|
+
let errorData = {};
|
|
11609
|
+
let bodyIsJson = true;
|
|
11610
|
+
try {
|
|
11611
|
+
errorData = await response.json();
|
|
11612
|
+
} catch {
|
|
11613
|
+
bodyIsJson = false;
|
|
11614
|
+
}
|
|
11561
11615
|
const retryAfterHeader = response.status === 429 ? response.headers.get("Retry-After") : null;
|
|
11562
11616
|
let retryAfterSeconds;
|
|
11563
11617
|
if (retryAfterHeader) {
|
|
@@ -11576,17 +11630,18 @@ var HttpClient = class {
|
|
|
11576
11630
|
}
|
|
11577
11631
|
const rawError = errorData.error;
|
|
11578
11632
|
if (rawError && typeof rawError === "object" && "message" in rawError) {
|
|
11633
|
+
const structured = rawError;
|
|
11579
11634
|
const details = {
|
|
11580
|
-
...
|
|
11635
|
+
...structured.details && typeof structured.details === "object" ? structured.details : {}
|
|
11581
11636
|
};
|
|
11582
11637
|
if (retryAfterSeconds !== void 0) {
|
|
11583
11638
|
details.retry_after_seconds = retryAfterSeconds;
|
|
11584
11639
|
}
|
|
11585
11640
|
const err2 = new ApiError(
|
|
11586
11641
|
response.status,
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
Object.keys(details).length > 0 ? details :
|
|
11642
|
+
typeof structured.message === "string" && structured.message !== "" ? structured.message : "Unknown error",
|
|
11643
|
+
typeof structured.code === "string" ? structured.code : void 0,
|
|
11644
|
+
Object.keys(details).length > 0 ? details : void 0
|
|
11590
11645
|
);
|
|
11591
11646
|
this.emitError(err2);
|
|
11592
11647
|
throw err2;
|
|
@@ -11594,8 +11649,8 @@ var HttpClient = class {
|
|
|
11594
11649
|
const flatMessage = typeof errorData.message === "string" && errorData.message !== "" ? errorData.message : void 0;
|
|
11595
11650
|
const explicitCode = typeof errorData.code === "string" && errorData.code !== "" ? errorData.code : void 0;
|
|
11596
11651
|
const errorIsCode = typeof rawError === "string" && /^[a-z][a-z0-9_]*$/.test(rawError);
|
|
11597
|
-
const message = flatMessage ?? (typeof rawError === "string" && rawError !== "" ? rawError : "Unknown error");
|
|
11598
|
-
const code = explicitCode ?? (errorIsCode ? rawError : void 0);
|
|
11652
|
+
const message = flatMessage ?? (typeof rawError === "string" && rawError !== "" ? rawError : void 0) ?? (bodyIsJson ? void 0 : gatewayMessageFromStatus(response.status)) ?? (response.statusText !== "" ? response.statusText : "Unknown error");
|
|
11653
|
+
const code = explicitCode ?? (errorIsCode ? rawError : void 0) ?? gatewayCodeFromStatus(response.status);
|
|
11599
11654
|
const legacyDetails = {};
|
|
11600
11655
|
if (retryAfterSeconds !== void 0) {
|
|
11601
11656
|
legacyDetails.retry_after_seconds = retryAfterSeconds;
|