connectbase-client 5.6.3 → 5.7.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/CHANGELOG.md +33 -0
- package/dist/connect-base.umd.js +3 -3
- package/dist/index.d.mts +85 -3
- package/dist/index.d.ts +85 -3
- package/dist/index.js +59 -6
- package/dist/index.mjs +59 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -904,8 +904,11 @@ declare class AIAPI {
|
|
|
904
904
|
/**
|
|
905
905
|
* SSE 소비 본체. `chatStream`(공개)과 `chat`(집계)이 공유한다.
|
|
906
906
|
*
|
|
907
|
-
* `hooks.
|
|
908
|
-
* (usage /
|
|
907
|
+
* `hooks.onResultMeta` 는 **토큰 콜백으로는 표현되지 않는 결과 메타**
|
|
908
|
+
* (finishReason / toolCalls / usage / provider / model)를 집는 내부 훅이다.
|
|
909
|
+
* 이 값들은 한 청크에 모여 오지 않는다 — 실측상 finishReason 은 마지막 토큰 다음
|
|
910
|
+
* 청크에, usage/provider/model 은 그 다음 `done` 청크에 실린다. 그래서 "종료 청크에서만"
|
|
911
|
+
* 집으면 finishReason 을 통째로 놓친다. 공개 옵션으로 열지 않는 이유:
|
|
909
912
|
* 스트리밍 사용자는 그 값들을 콜백으로 이미 받거나 필요로 하지 않는데, 공개하면
|
|
910
913
|
* "언제 몇 번 불리는가" 가 계약이 되어 와이어 포맷을 못 바꾸게 된다.
|
|
911
914
|
*/
|
|
@@ -4055,6 +4058,54 @@ interface ScriptDetailResponse {
|
|
|
4055
4058
|
meta: ScriptMeta;
|
|
4056
4059
|
active?: ScriptVersion;
|
|
4057
4060
|
}
|
|
4061
|
+
/**
|
|
4062
|
+
* 스크립트 로그 1줄. 훅 에러와 Lua `log()` 출력이 같은 스트림으로 온다.
|
|
4063
|
+
*
|
|
4064
|
+
* 에러 줄(`level: "error"`)의 `msg` 에는 훅 이름, phase 별 실측, Lua traceback 이
|
|
4065
|
+
* 함께 실린다 — 서버 Lua 를 고칠 때 필요한 정보가 한 줄에 모여 있다:
|
|
4066
|
+
*
|
|
4067
|
+
* ```
|
|
4068
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value (setup 3ms / hook 5ms)
|
|
4069
|
+
* ```
|
|
4070
|
+
*/
|
|
4071
|
+
interface ScriptLogEntry {
|
|
4072
|
+
/** epoch ms. 증분 폴링 시 다음 요청의 `since` 로 넘긴다. */
|
|
4073
|
+
ts: number;
|
|
4074
|
+
level: "info" | "warn" | "error";
|
|
4075
|
+
msg: string;
|
|
4076
|
+
app_id?: string;
|
|
4077
|
+
script?: string;
|
|
4078
|
+
}
|
|
4079
|
+
interface ScriptLogsResponse {
|
|
4080
|
+
entries: ScriptLogEntry[];
|
|
4081
|
+
count: number;
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* 스크립트 실행 메트릭. `SCRIPT_TIMEOUT` 진단용.
|
|
4085
|
+
*
|
|
4086
|
+
* setup 은 플랫폼 비용(스크립트 로드 + state 직렬화), hook 은 사용자 Lua 비용이다.
|
|
4087
|
+
* `max_hook_latency_ms` 가 frame 훅 예산(기본 100ms)에 근접하면 무거운 작업을
|
|
4088
|
+
* `onInit`(5s 예산)으로 옮겨야 한다. `max_setup_latency_ms` 가 크면 룸 state 가
|
|
4089
|
+
* 너무 큰 것이라 사용자 코드를 고쳐도 낫지 않는다.
|
|
4090
|
+
*/
|
|
4091
|
+
interface ScriptMetricsResponse {
|
|
4092
|
+
app_id: string;
|
|
4093
|
+
name: string;
|
|
4094
|
+
calls: number;
|
|
4095
|
+
errors: number;
|
|
4096
|
+
/** 0.0 ~ 1.0 */
|
|
4097
|
+
error_rate: number;
|
|
4098
|
+
avg_latency_ms: number;
|
|
4099
|
+
max_latency_ms: number;
|
|
4100
|
+
/** 0 이면 아직 호출 없음 */
|
|
4101
|
+
last_called_at_ms: number;
|
|
4102
|
+
avg_setup_latency_ms: number;
|
|
4103
|
+
max_setup_latency_ms: number;
|
|
4104
|
+
avg_hook_latency_ms: number;
|
|
4105
|
+
max_hook_latency_ms: number;
|
|
4106
|
+
/** 0 이면 phase 측정 sample 없음 */
|
|
4107
|
+
phase_samples: number;
|
|
4108
|
+
}
|
|
4058
4109
|
|
|
4059
4110
|
/**
|
|
4060
4111
|
* 게임 서버 기능 opt-in 토글 API.
|
|
@@ -4389,6 +4440,37 @@ declare class GameAPI {
|
|
|
4389
4440
|
* 변경된 것에 대응.
|
|
4390
4441
|
*/
|
|
4391
4442
|
deleteScript(appId: string, name: string): Promise<void>;
|
|
4443
|
+
/**
|
|
4444
|
+
* 스크립트 로그 조회 — 훅 에러 + Lua `log()` 출력.
|
|
4445
|
+
*
|
|
4446
|
+
* **서버 Lua 를 디버깅하는 유일한 경로다.** 업로드 → 활성화 후 게임을 돌려보고
|
|
4447
|
+
* 이 메서드로 실패 원인을 확인한다. 에러 줄에는 훅 이름, setup/hook 실측 시간,
|
|
4448
|
+
* Lua traceback 의 파일:줄이 함께 실린다:
|
|
4449
|
+
*
|
|
4450
|
+
* ```
|
|
4451
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value
|
|
4452
|
+
* (setup 3ms / hook 5ms)
|
|
4453
|
+
* ```
|
|
4454
|
+
*
|
|
4455
|
+
* 예산 초과(`SCRIPT_TIMEOUT`)면 한도와 조치 방향까지 덧붙는다.
|
|
4456
|
+
*
|
|
4457
|
+
* @param since epoch ms. 직전 호출의 최신 timestamp 를 넣어 증분 폴링한다.
|
|
4458
|
+
* @param limit 1~1000 (기본 100)
|
|
4459
|
+
*
|
|
4460
|
+
* 버퍼는 스크립트당 최근 ~500 엔트리이며 파드 로컬이라 재시작 시 소실된다.
|
|
4461
|
+
*/
|
|
4462
|
+
getScriptLogs(appId: string, name: string, options?: {
|
|
4463
|
+
since?: number;
|
|
4464
|
+
limit?: number;
|
|
4465
|
+
}): Promise<ScriptLogsResponse>;
|
|
4466
|
+
/**
|
|
4467
|
+
* 스크립트 메트릭 조회 — 호출 수, 에러율, setup/hook 레이턴시.
|
|
4468
|
+
*
|
|
4469
|
+
* `SCRIPT_TIMEOUT` 진단에 쓴다. `maxHookLatencyMs` 가 frame 훅 예산(기본 100ms)에
|
|
4470
|
+
* 근접하면 무거운 작업을 `onInit`(5s 예산)으로 옮겨야 한다는 신호다.
|
|
4471
|
+
* `entity.*` 같은 primitive 는 블로킹 I/O 라 호출한 훅의 예산을 소모한다.
|
|
4472
|
+
*/
|
|
4473
|
+
getScriptMetrics(appId: string, name: string): Promise<ScriptMetricsResponse>;
|
|
4392
4474
|
}
|
|
4393
4475
|
|
|
4394
4476
|
interface CreateDocumentRequest {
|
|
@@ -10385,4 +10467,4 @@ declare class ConnectBase {
|
|
|
10385
10467
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10386
10468
|
}
|
|
10387
10469
|
|
|
10388
|
-
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 };
|
|
10470
|
+
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 ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, 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
|
@@ -904,8 +904,11 @@ declare class AIAPI {
|
|
|
904
904
|
/**
|
|
905
905
|
* SSE 소비 본체. `chatStream`(공개)과 `chat`(집계)이 공유한다.
|
|
906
906
|
*
|
|
907
|
-
* `hooks.
|
|
908
|
-
* (usage /
|
|
907
|
+
* `hooks.onResultMeta` 는 **토큰 콜백으로는 표현되지 않는 결과 메타**
|
|
908
|
+
* (finishReason / toolCalls / usage / provider / model)를 집는 내부 훅이다.
|
|
909
|
+
* 이 값들은 한 청크에 모여 오지 않는다 — 실측상 finishReason 은 마지막 토큰 다음
|
|
910
|
+
* 청크에, usage/provider/model 은 그 다음 `done` 청크에 실린다. 그래서 "종료 청크에서만"
|
|
911
|
+
* 집으면 finishReason 을 통째로 놓친다. 공개 옵션으로 열지 않는 이유:
|
|
909
912
|
* 스트리밍 사용자는 그 값들을 콜백으로 이미 받거나 필요로 하지 않는데, 공개하면
|
|
910
913
|
* "언제 몇 번 불리는가" 가 계약이 되어 와이어 포맷을 못 바꾸게 된다.
|
|
911
914
|
*/
|
|
@@ -4055,6 +4058,54 @@ interface ScriptDetailResponse {
|
|
|
4055
4058
|
meta: ScriptMeta;
|
|
4056
4059
|
active?: ScriptVersion;
|
|
4057
4060
|
}
|
|
4061
|
+
/**
|
|
4062
|
+
* 스크립트 로그 1줄. 훅 에러와 Lua `log()` 출력이 같은 스트림으로 온다.
|
|
4063
|
+
*
|
|
4064
|
+
* 에러 줄(`level: "error"`)의 `msg` 에는 훅 이름, phase 별 실측, Lua traceback 이
|
|
4065
|
+
* 함께 실린다 — 서버 Lua 를 고칠 때 필요한 정보가 한 줄에 모여 있다:
|
|
4066
|
+
*
|
|
4067
|
+
* ```
|
|
4068
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value (setup 3ms / hook 5ms)
|
|
4069
|
+
* ```
|
|
4070
|
+
*/
|
|
4071
|
+
interface ScriptLogEntry {
|
|
4072
|
+
/** epoch ms. 증분 폴링 시 다음 요청의 `since` 로 넘긴다. */
|
|
4073
|
+
ts: number;
|
|
4074
|
+
level: "info" | "warn" | "error";
|
|
4075
|
+
msg: string;
|
|
4076
|
+
app_id?: string;
|
|
4077
|
+
script?: string;
|
|
4078
|
+
}
|
|
4079
|
+
interface ScriptLogsResponse {
|
|
4080
|
+
entries: ScriptLogEntry[];
|
|
4081
|
+
count: number;
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* 스크립트 실행 메트릭. `SCRIPT_TIMEOUT` 진단용.
|
|
4085
|
+
*
|
|
4086
|
+
* setup 은 플랫폼 비용(스크립트 로드 + state 직렬화), hook 은 사용자 Lua 비용이다.
|
|
4087
|
+
* `max_hook_latency_ms` 가 frame 훅 예산(기본 100ms)에 근접하면 무거운 작업을
|
|
4088
|
+
* `onInit`(5s 예산)으로 옮겨야 한다. `max_setup_latency_ms` 가 크면 룸 state 가
|
|
4089
|
+
* 너무 큰 것이라 사용자 코드를 고쳐도 낫지 않는다.
|
|
4090
|
+
*/
|
|
4091
|
+
interface ScriptMetricsResponse {
|
|
4092
|
+
app_id: string;
|
|
4093
|
+
name: string;
|
|
4094
|
+
calls: number;
|
|
4095
|
+
errors: number;
|
|
4096
|
+
/** 0.0 ~ 1.0 */
|
|
4097
|
+
error_rate: number;
|
|
4098
|
+
avg_latency_ms: number;
|
|
4099
|
+
max_latency_ms: number;
|
|
4100
|
+
/** 0 이면 아직 호출 없음 */
|
|
4101
|
+
last_called_at_ms: number;
|
|
4102
|
+
avg_setup_latency_ms: number;
|
|
4103
|
+
max_setup_latency_ms: number;
|
|
4104
|
+
avg_hook_latency_ms: number;
|
|
4105
|
+
max_hook_latency_ms: number;
|
|
4106
|
+
/** 0 이면 phase 측정 sample 없음 */
|
|
4107
|
+
phase_samples: number;
|
|
4108
|
+
}
|
|
4058
4109
|
|
|
4059
4110
|
/**
|
|
4060
4111
|
* 게임 서버 기능 opt-in 토글 API.
|
|
@@ -4389,6 +4440,37 @@ declare class GameAPI {
|
|
|
4389
4440
|
* 변경된 것에 대응.
|
|
4390
4441
|
*/
|
|
4391
4442
|
deleteScript(appId: string, name: string): Promise<void>;
|
|
4443
|
+
/**
|
|
4444
|
+
* 스크립트 로그 조회 — 훅 에러 + Lua `log()` 출력.
|
|
4445
|
+
*
|
|
4446
|
+
* **서버 Lua 를 디버깅하는 유일한 경로다.** 업로드 → 활성화 후 게임을 돌려보고
|
|
4447
|
+
* 이 메서드로 실패 원인을 확인한다. 에러 줄에는 훅 이름, setup/hook 실측 시간,
|
|
4448
|
+
* Lua traceback 의 파일:줄이 함께 실린다:
|
|
4449
|
+
*
|
|
4450
|
+
* ```
|
|
4451
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value
|
|
4452
|
+
* (setup 3ms / hook 5ms)
|
|
4453
|
+
* ```
|
|
4454
|
+
*
|
|
4455
|
+
* 예산 초과(`SCRIPT_TIMEOUT`)면 한도와 조치 방향까지 덧붙는다.
|
|
4456
|
+
*
|
|
4457
|
+
* @param since epoch ms. 직전 호출의 최신 timestamp 를 넣어 증분 폴링한다.
|
|
4458
|
+
* @param limit 1~1000 (기본 100)
|
|
4459
|
+
*
|
|
4460
|
+
* 버퍼는 스크립트당 최근 ~500 엔트리이며 파드 로컬이라 재시작 시 소실된다.
|
|
4461
|
+
*/
|
|
4462
|
+
getScriptLogs(appId: string, name: string, options?: {
|
|
4463
|
+
since?: number;
|
|
4464
|
+
limit?: number;
|
|
4465
|
+
}): Promise<ScriptLogsResponse>;
|
|
4466
|
+
/**
|
|
4467
|
+
* 스크립트 메트릭 조회 — 호출 수, 에러율, setup/hook 레이턴시.
|
|
4468
|
+
*
|
|
4469
|
+
* `SCRIPT_TIMEOUT` 진단에 쓴다. `maxHookLatencyMs` 가 frame 훅 예산(기본 100ms)에
|
|
4470
|
+
* 근접하면 무거운 작업을 `onInit`(5s 예산)으로 옮겨야 한다는 신호다.
|
|
4471
|
+
* `entity.*` 같은 primitive 는 블로킹 I/O 라 호출한 훅의 예산을 소모한다.
|
|
4472
|
+
*/
|
|
4473
|
+
getScriptMetrics(appId: string, name: string): Promise<ScriptMetricsResponse>;
|
|
4392
4474
|
}
|
|
4393
4475
|
|
|
4394
4476
|
interface CreateDocumentRequest {
|
|
@@ -10385,4 +10467,4 @@ declare class ConnectBase {
|
|
|
10385
10467
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10386
10468
|
}
|
|
10387
10469
|
|
|
10388
|
-
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 };
|
|
10470
|
+
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 ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, 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
|
@@ -298,7 +298,8 @@ function aiErrorToApiError(err) {
|
|
|
298
298
|
const details = {};
|
|
299
299
|
if (err.provider) details.provider = err.provider;
|
|
300
300
|
if (err.model) details.model = err.model;
|
|
301
|
-
if (err.retryAfter !== void 0)
|
|
301
|
+
if (err.retryAfter !== void 0)
|
|
302
|
+
details.retry_after_seconds = err.retryAfter;
|
|
302
303
|
return new ApiError(
|
|
303
304
|
err.status ?? statusByCode[err.code] ?? 500,
|
|
304
305
|
err.message,
|
|
@@ -386,7 +387,7 @@ var AIAPI = class {
|
|
|
386
387
|
throw await this.http.buildApiError(response);
|
|
387
388
|
},
|
|
388
389
|
// 스트림 종료 청크에만 실리는 값들 — 토큰 콜백으로는 표현되지 않는다.
|
|
389
|
-
|
|
390
|
+
onResultMeta: (chunk) => {
|
|
390
391
|
if (chunk.finishReason)
|
|
391
392
|
aggregated.finishReason = chunk.finishReason;
|
|
392
393
|
if (chunk.toolCalls?.length) aggregated.toolCalls = chunk.toolCalls;
|
|
@@ -458,8 +459,11 @@ var AIAPI = class {
|
|
|
458
459
|
/**
|
|
459
460
|
* SSE 소비 본체. `chatStream`(공개)과 `chat`(집계)이 공유한다.
|
|
460
461
|
*
|
|
461
|
-
* `hooks.
|
|
462
|
-
* (usage /
|
|
462
|
+
* `hooks.onResultMeta` 는 **토큰 콜백으로는 표현되지 않는 결과 메타**
|
|
463
|
+
* (finishReason / toolCalls / usage / provider / model)를 집는 내부 훅이다.
|
|
464
|
+
* 이 값들은 한 청크에 모여 오지 않는다 — 실측상 finishReason 은 마지막 토큰 다음
|
|
465
|
+
* 청크에, usage/provider/model 은 그 다음 `done` 청크에 실린다. 그래서 "종료 청크에서만"
|
|
466
|
+
* 집으면 finishReason 을 통째로 놓친다. 공개 옵션으로 열지 않는 이유:
|
|
463
467
|
* 스트리밍 사용자는 그 값들을 콜백으로 이미 받거나 필요로 하지 않는데, 공개하면
|
|
464
468
|
* "언제 몇 번 불리는가" 가 계약이 되어 와이어 포맷을 못 바꾸게 된다.
|
|
465
469
|
*/
|
|
@@ -543,11 +547,12 @@ var AIAPI = class {
|
|
|
543
547
|
if (event.type === "heartbeat") {
|
|
544
548
|
continue;
|
|
545
549
|
}
|
|
546
|
-
if (event.
|
|
550
|
+
if (event.finishReason || event.toolCalls?.length || event.usage || event.provider || event.model) {
|
|
551
|
+
hooks?.onResultMeta?.(event);
|
|
552
|
+
}
|
|
547
553
|
if (event.reasoning) callbacks.onReasoning?.(event.reasoning);
|
|
548
554
|
if (event.content) callbacks.onToken?.(event.content);
|
|
549
555
|
if (event.done) {
|
|
550
|
-
if (!event.usage) hooks?.onFinalChunk?.(event);
|
|
551
556
|
callbacks.onDone?.();
|
|
552
557
|
return;
|
|
553
558
|
}
|
|
@@ -4818,6 +4823,54 @@ var GameAPI = class {
|
|
|
4818
4823
|
"GAME_DELETE_SCRIPT_FAILED"
|
|
4819
4824
|
);
|
|
4820
4825
|
}
|
|
4826
|
+
/**
|
|
4827
|
+
* 스크립트 로그 조회 — 훅 에러 + Lua `log()` 출력.
|
|
4828
|
+
*
|
|
4829
|
+
* **서버 Lua 를 디버깅하는 유일한 경로다.** 업로드 → 활성화 후 게임을 돌려보고
|
|
4830
|
+
* 이 메서드로 실패 원인을 확인한다. 에러 줄에는 훅 이름, setup/hook 실측 시간,
|
|
4831
|
+
* Lua traceback 의 파일:줄이 함께 실린다:
|
|
4832
|
+
*
|
|
4833
|
+
* ```
|
|
4834
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value
|
|
4835
|
+
* (setup 3ms / hook 5ms)
|
|
4836
|
+
* ```
|
|
4837
|
+
*
|
|
4838
|
+
* 예산 초과(`SCRIPT_TIMEOUT`)면 한도와 조치 방향까지 덧붙는다.
|
|
4839
|
+
*
|
|
4840
|
+
* @param since epoch ms. 직전 호출의 최신 timestamp 를 넣어 증분 폴링한다.
|
|
4841
|
+
* @param limit 1~1000 (기본 100)
|
|
4842
|
+
*
|
|
4843
|
+
* 버퍼는 스크립트당 최근 ~500 엔트리이며 파드 로컬이라 재시작 시 소실된다.
|
|
4844
|
+
*/
|
|
4845
|
+
async getScriptLogs(appId, name, options = {}) {
|
|
4846
|
+
const params = new URLSearchParams();
|
|
4847
|
+
if (typeof options.since === "number")
|
|
4848
|
+
params.set("since", String(options.since));
|
|
4849
|
+
if (typeof options.limit === "number")
|
|
4850
|
+
params.set("limit", String(options.limit));
|
|
4851
|
+
const qs = params.toString();
|
|
4852
|
+
return this.gameFetch(
|
|
4853
|
+
"GET",
|
|
4854
|
+
`/v1/game/${appId}/scripts/${name}/logs${qs ? `?${qs}` : ""}`,
|
|
4855
|
+
void 0,
|
|
4856
|
+
"GAME_GET_SCRIPT_LOGS_FAILED"
|
|
4857
|
+
);
|
|
4858
|
+
}
|
|
4859
|
+
/**
|
|
4860
|
+
* 스크립트 메트릭 조회 — 호출 수, 에러율, setup/hook 레이턴시.
|
|
4861
|
+
*
|
|
4862
|
+
* `SCRIPT_TIMEOUT` 진단에 쓴다. `maxHookLatencyMs` 가 frame 훅 예산(기본 100ms)에
|
|
4863
|
+
* 근접하면 무거운 작업을 `onInit`(5s 예산)으로 옮겨야 한다는 신호다.
|
|
4864
|
+
* `entity.*` 같은 primitive 는 블로킹 I/O 라 호출한 훅의 예산을 소모한다.
|
|
4865
|
+
*/
|
|
4866
|
+
async getScriptMetrics(appId, name) {
|
|
4867
|
+
return this.gameFetch(
|
|
4868
|
+
"GET",
|
|
4869
|
+
`/v1/game/${appId}/scripts/${name}/metrics`,
|
|
4870
|
+
void 0,
|
|
4871
|
+
"GAME_GET_SCRIPT_METRICS_FAILED"
|
|
4872
|
+
);
|
|
4873
|
+
}
|
|
4821
4874
|
};
|
|
4822
4875
|
|
|
4823
4876
|
// src/api/knowledge.ts
|
package/dist/index.mjs
CHANGED
|
@@ -249,7 +249,8 @@ function aiErrorToApiError(err) {
|
|
|
249
249
|
const details = {};
|
|
250
250
|
if (err.provider) details.provider = err.provider;
|
|
251
251
|
if (err.model) details.model = err.model;
|
|
252
|
-
if (err.retryAfter !== void 0)
|
|
252
|
+
if (err.retryAfter !== void 0)
|
|
253
|
+
details.retry_after_seconds = err.retryAfter;
|
|
253
254
|
return new ApiError(
|
|
254
255
|
err.status ?? statusByCode[err.code] ?? 500,
|
|
255
256
|
err.message,
|
|
@@ -337,7 +338,7 @@ var AIAPI = class {
|
|
|
337
338
|
throw await this.http.buildApiError(response);
|
|
338
339
|
},
|
|
339
340
|
// 스트림 종료 청크에만 실리는 값들 — 토큰 콜백으로는 표현되지 않는다.
|
|
340
|
-
|
|
341
|
+
onResultMeta: (chunk) => {
|
|
341
342
|
if (chunk.finishReason)
|
|
342
343
|
aggregated.finishReason = chunk.finishReason;
|
|
343
344
|
if (chunk.toolCalls?.length) aggregated.toolCalls = chunk.toolCalls;
|
|
@@ -409,8 +410,11 @@ var AIAPI = class {
|
|
|
409
410
|
/**
|
|
410
411
|
* SSE 소비 본체. `chatStream`(공개)과 `chat`(집계)이 공유한다.
|
|
411
412
|
*
|
|
412
|
-
* `hooks.
|
|
413
|
-
* (usage /
|
|
413
|
+
* `hooks.onResultMeta` 는 **토큰 콜백으로는 표현되지 않는 결과 메타**
|
|
414
|
+
* (finishReason / toolCalls / usage / provider / model)를 집는 내부 훅이다.
|
|
415
|
+
* 이 값들은 한 청크에 모여 오지 않는다 — 실측상 finishReason 은 마지막 토큰 다음
|
|
416
|
+
* 청크에, usage/provider/model 은 그 다음 `done` 청크에 실린다. 그래서 "종료 청크에서만"
|
|
417
|
+
* 집으면 finishReason 을 통째로 놓친다. 공개 옵션으로 열지 않는 이유:
|
|
414
418
|
* 스트리밍 사용자는 그 값들을 콜백으로 이미 받거나 필요로 하지 않는데, 공개하면
|
|
415
419
|
* "언제 몇 번 불리는가" 가 계약이 되어 와이어 포맷을 못 바꾸게 된다.
|
|
416
420
|
*/
|
|
@@ -494,11 +498,12 @@ var AIAPI = class {
|
|
|
494
498
|
if (event.type === "heartbeat") {
|
|
495
499
|
continue;
|
|
496
500
|
}
|
|
497
|
-
if (event.
|
|
501
|
+
if (event.finishReason || event.toolCalls?.length || event.usage || event.provider || event.model) {
|
|
502
|
+
hooks?.onResultMeta?.(event);
|
|
503
|
+
}
|
|
498
504
|
if (event.reasoning) callbacks.onReasoning?.(event.reasoning);
|
|
499
505
|
if (event.content) callbacks.onToken?.(event.content);
|
|
500
506
|
if (event.done) {
|
|
501
|
-
if (!event.usage) hooks?.onFinalChunk?.(event);
|
|
502
507
|
callbacks.onDone?.();
|
|
503
508
|
return;
|
|
504
509
|
}
|
|
@@ -4769,6 +4774,54 @@ var GameAPI = class {
|
|
|
4769
4774
|
"GAME_DELETE_SCRIPT_FAILED"
|
|
4770
4775
|
);
|
|
4771
4776
|
}
|
|
4777
|
+
/**
|
|
4778
|
+
* 스크립트 로그 조회 — 훅 에러 + Lua `log()` 출력.
|
|
4779
|
+
*
|
|
4780
|
+
* **서버 Lua 를 디버깅하는 유일한 경로다.** 업로드 → 활성화 후 게임을 돌려보고
|
|
4781
|
+
* 이 메서드로 실패 원인을 확인한다. 에러 줄에는 훅 이름, setup/hook 실측 시간,
|
|
4782
|
+
* Lua traceback 의 파일:줄이 함께 실린다:
|
|
4783
|
+
*
|
|
4784
|
+
* ```
|
|
4785
|
+
* [onTick] onTick error: <string>:12: attempt to index a nil value
|
|
4786
|
+
* (setup 3ms / hook 5ms)
|
|
4787
|
+
* ```
|
|
4788
|
+
*
|
|
4789
|
+
* 예산 초과(`SCRIPT_TIMEOUT`)면 한도와 조치 방향까지 덧붙는다.
|
|
4790
|
+
*
|
|
4791
|
+
* @param since epoch ms. 직전 호출의 최신 timestamp 를 넣어 증분 폴링한다.
|
|
4792
|
+
* @param limit 1~1000 (기본 100)
|
|
4793
|
+
*
|
|
4794
|
+
* 버퍼는 스크립트당 최근 ~500 엔트리이며 파드 로컬이라 재시작 시 소실된다.
|
|
4795
|
+
*/
|
|
4796
|
+
async getScriptLogs(appId, name, options = {}) {
|
|
4797
|
+
const params = new URLSearchParams();
|
|
4798
|
+
if (typeof options.since === "number")
|
|
4799
|
+
params.set("since", String(options.since));
|
|
4800
|
+
if (typeof options.limit === "number")
|
|
4801
|
+
params.set("limit", String(options.limit));
|
|
4802
|
+
const qs = params.toString();
|
|
4803
|
+
return this.gameFetch(
|
|
4804
|
+
"GET",
|
|
4805
|
+
`/v1/game/${appId}/scripts/${name}/logs${qs ? `?${qs}` : ""}`,
|
|
4806
|
+
void 0,
|
|
4807
|
+
"GAME_GET_SCRIPT_LOGS_FAILED"
|
|
4808
|
+
);
|
|
4809
|
+
}
|
|
4810
|
+
/**
|
|
4811
|
+
* 스크립트 메트릭 조회 — 호출 수, 에러율, setup/hook 레이턴시.
|
|
4812
|
+
*
|
|
4813
|
+
* `SCRIPT_TIMEOUT` 진단에 쓴다. `maxHookLatencyMs` 가 frame 훅 예산(기본 100ms)에
|
|
4814
|
+
* 근접하면 무거운 작업을 `onInit`(5s 예산)으로 옮겨야 한다는 신호다.
|
|
4815
|
+
* `entity.*` 같은 primitive 는 블로킹 I/O 라 호출한 훅의 예산을 소모한다.
|
|
4816
|
+
*/
|
|
4817
|
+
async getScriptMetrics(appId, name) {
|
|
4818
|
+
return this.gameFetch(
|
|
4819
|
+
"GET",
|
|
4820
|
+
`/v1/game/${appId}/scripts/${name}/metrics`,
|
|
4821
|
+
void 0,
|
|
4822
|
+
"GAME_GET_SCRIPT_METRICS_FAILED"
|
|
4823
|
+
);
|
|
4824
|
+
}
|
|
4772
4825
|
};
|
|
4773
4826
|
|
|
4774
4827
|
// src/api/knowledge.ts
|