playkit-sdk 1.2.12 → 1.3.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/LICENSE +86 -86
- package/README.md +246 -244
- package/dist/playkit-sdk.cjs.js +1723 -1530
- package/dist/playkit-sdk.cjs.js.map +1 -1
- package/dist/playkit-sdk.d.ts +66 -5
- package/dist/playkit-sdk.esm.js +1723 -1530
- package/dist/playkit-sdk.esm.js.map +1 -1
- package/dist/playkit-sdk.umd.js +1789 -1571
- package/dist/playkit-sdk.umd.js.map +1 -1
- package/package.json +70 -70
package/dist/playkit-sdk.d.ts
CHANGED
|
@@ -657,10 +657,12 @@ interface ChatCompletionResponse {
|
|
|
657
657
|
* Streaming chunk formats
|
|
658
658
|
*/
|
|
659
659
|
interface StreamChunk {
|
|
660
|
-
type: 'text-delta' | 'done' | 'error';
|
|
660
|
+
type: 'text-delta' | 'done' | 'finish' | 'abort' | 'error';
|
|
661
661
|
id?: string;
|
|
662
662
|
delta?: string;
|
|
663
663
|
error?: string;
|
|
664
|
+
errorText?: string;
|
|
665
|
+
reason?: string;
|
|
664
666
|
}
|
|
665
667
|
/**
|
|
666
668
|
* NPC Action parameter types
|
|
@@ -1069,6 +1071,8 @@ declare class AuthManager extends EventEmitter {
|
|
|
1069
1071
|
private logger;
|
|
1070
1072
|
/** Shared promise for current device auth flow - allows multiple callers to await the same result */
|
|
1071
1073
|
private currentDeviceAuthFlowPromise;
|
|
1074
|
+
/** Shared promise for current auth flow (startAuthFlow) - allows multiple callers to await the same result */
|
|
1075
|
+
private currentAuthFlowPromise;
|
|
1072
1076
|
constructor(config: SDKConfig);
|
|
1073
1077
|
/**
|
|
1074
1078
|
* Initialize authentication
|
|
@@ -1081,6 +1085,11 @@ declare class AuthManager extends EventEmitter {
|
|
|
1081
1085
|
* @deprecated 'headless' authentication is deprecated and will be removed in v2.0. Use 'device' instead.
|
|
1082
1086
|
*/
|
|
1083
1087
|
startAuthFlow(authMethod?: 'device' | 'headless'): Promise<void>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Internal method that executes the actual auth flow
|
|
1090
|
+
* @private
|
|
1091
|
+
*/
|
|
1092
|
+
private executeAuthFlow;
|
|
1084
1093
|
/**
|
|
1085
1094
|
* Exchange JWT for player token
|
|
1086
1095
|
*/
|
|
@@ -1254,7 +1263,7 @@ interface RechargeConfig {
|
|
|
1254
1263
|
checkBalanceAfterApiCall?: boolean;
|
|
1255
1264
|
/**
|
|
1256
1265
|
* Base URL for the recharge portal
|
|
1257
|
-
* @default 'https://playkit.ai/recharge'
|
|
1266
|
+
* @default 'https://players.playkit.ai/recharge'
|
|
1258
1267
|
*/
|
|
1259
1268
|
rechargePortalUrl?: string;
|
|
1260
1269
|
/**
|
|
@@ -2027,10 +2036,11 @@ declare class NPCClient extends EventEmitter {
|
|
|
2027
2036
|
/**
|
|
2028
2037
|
* Manually generate reply predictions based on current conversation.
|
|
2029
2038
|
* Uses the fast model for quick generation.
|
|
2039
|
+
* @param tempPrompt Optional temporary prompt to influence the prediction style/tone
|
|
2030
2040
|
* @param count Number of predictions to generate (default: uses predictionCount property)
|
|
2031
2041
|
* @returns Array of predicted player replies, or empty array on failure
|
|
2032
2042
|
*/
|
|
2033
|
-
generateReplyPredictions(count?: number): Promise<string[]>;
|
|
2043
|
+
generateReplyPredictions(tempPrompt?: string, count?: number): Promise<string[]>;
|
|
2034
2044
|
/**
|
|
2035
2045
|
* Parse predictions from JSON array response
|
|
2036
2046
|
*/
|
|
@@ -2188,6 +2198,8 @@ declare class AIContextManager extends EventEmitter<AIContextManagerEvents> {
|
|
|
2188
2198
|
private static _instance;
|
|
2189
2199
|
private config;
|
|
2190
2200
|
private playerDescription;
|
|
2201
|
+
private playerPrompt;
|
|
2202
|
+
private playerMemories;
|
|
2191
2203
|
private npcStates;
|
|
2192
2204
|
private autoCompactTimer;
|
|
2193
2205
|
private chatClientFactory;
|
|
@@ -2226,6 +2238,47 @@ declare class AIContextManager extends EventEmitter<AIContextManagerEvents> {
|
|
|
2226
2238
|
* Clear the player description.
|
|
2227
2239
|
*/
|
|
2228
2240
|
clearPlayerDescription(): void;
|
|
2241
|
+
/**
|
|
2242
|
+
* Set the player's character prompt/persona.
|
|
2243
|
+
* This defines how the player character speaks and behaves.
|
|
2244
|
+
* Used when generating reply predictions to match the player's tone.
|
|
2245
|
+
* @param prompt The player character's persona/prompt
|
|
2246
|
+
*/
|
|
2247
|
+
setPlayerPrompt(prompt: string | null): void;
|
|
2248
|
+
/**
|
|
2249
|
+
* Get the current player prompt.
|
|
2250
|
+
* @returns The player prompt, or null if not set
|
|
2251
|
+
*/
|
|
2252
|
+
getPlayerPrompt(): string | null;
|
|
2253
|
+
/**
|
|
2254
|
+
* Set or update a memory for the player character.
|
|
2255
|
+
* Memories are appended to the player prompt to form the full player context.
|
|
2256
|
+
* Set memoryContent to null or empty to remove the memory.
|
|
2257
|
+
* @param memoryName The name/key of the memory
|
|
2258
|
+
* @param memoryContent The content of the memory. Null or empty to remove.
|
|
2259
|
+
*/
|
|
2260
|
+
setPlayerMemory(memoryName: string, memoryContent: string | null): void;
|
|
2261
|
+
/**
|
|
2262
|
+
* Get a specific player memory by name.
|
|
2263
|
+
* @param memoryName The name of the memory to retrieve
|
|
2264
|
+
* @returns The memory content, or undefined if not found
|
|
2265
|
+
*/
|
|
2266
|
+
getPlayerMemory(memoryName: string): string | undefined;
|
|
2267
|
+
/**
|
|
2268
|
+
* Get all player memory names currently stored.
|
|
2269
|
+
* @returns Array of memory names
|
|
2270
|
+
*/
|
|
2271
|
+
getPlayerMemoryNames(): string[];
|
|
2272
|
+
/**
|
|
2273
|
+
* Clear all player memories (but keep player prompt).
|
|
2274
|
+
*/
|
|
2275
|
+
clearPlayerMemories(): void;
|
|
2276
|
+
/**
|
|
2277
|
+
* Build the complete player context from PlayerPrompt + PlayerMemories.
|
|
2278
|
+
* Used by NPCClient for generating reply predictions.
|
|
2279
|
+
* @returns The combined player context string, or null if no context is set
|
|
2280
|
+
*/
|
|
2281
|
+
buildPlayerContext(): string | null;
|
|
2229
2282
|
/**
|
|
2230
2283
|
* Register an NPC for context management.
|
|
2231
2284
|
* @param npc The NPC client to register
|
|
@@ -2675,8 +2728,8 @@ declare class TokenStorage {
|
|
|
2675
2728
|
declare class AuthFlowManager extends EventEmitter {
|
|
2676
2729
|
private baseURL;
|
|
2677
2730
|
private currentSessionId;
|
|
2678
|
-
private
|
|
2679
|
-
private
|
|
2731
|
+
private _uiContainer;
|
|
2732
|
+
private _isSuccess;
|
|
2680
2733
|
private currentLanguage;
|
|
2681
2734
|
private modal;
|
|
2682
2735
|
private identifierPanel;
|
|
@@ -2896,5 +2949,13 @@ declare class TokenValidator {
|
|
|
2896
2949
|
*/
|
|
2897
2950
|
declare const defaultTokenValidator: TokenValidator;
|
|
2898
2951
|
|
|
2952
|
+
declare global {
|
|
2953
|
+
interface Window {
|
|
2954
|
+
PlayKitSDK: typeof PlayKitSDK & {
|
|
2955
|
+
PlayKitSDK: typeof PlayKitSDK;
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2899
2960
|
export { AIContextManager, AuthFlowManager, AuthManager, BrowserStorage, BufferLogHandler, CallbackLogHandler, ChatClient, DeviceAuthFlowManager, ImageClient, LogLevel, Logger, MemoryStorage, NPCClient, PlayKitError, PlayKitSDK, PlayerClient, RechargeManager, SchemaLibrary, StreamParser, TokenStorage, TokenValidator, TranscriptionClient, createMultimodalMessage, createStorage, createTextMessage, PlayKitSDK as default, defaultContextManager, defaultSchemaLibrary, defaultTokenValidator, isLocalStorageAvailable };
|
|
2900
2961
|
export type { AIContextManagerConfig, AIContextManagerEvents, APIResult, AudioContentPart, AuthState, ChatCompletionResponse, ChatConfig, ChatResult, ChatStreamConfig, ChatWithToolsConfig, ChatWithToolsStreamConfig, ConversationSaveData, DeveloperTokenFallbackConfig, DeviceAuthFlowOptions, DeviceAuthInitResult, DeviceAuthResult, GameInfo, GeneratedImage, IStorage, ImageContentPart, ImageGenerationConfig, ImageGenerationResponse, ImageInput, ImageSize, LogConfig, LogEntry, LogHandler, MemoryEntry, Message, MessageContent, MessageContentPart, MessageRole, NPCConfig, PlayerInfo, RechargeConfig, RechargeEvents, RechargeModalOptions, SDKConfig, SDKMode, SchemaEntry, SetNicknameRequest, SetNicknameResponse, StreamChunk, StructuredGenerationConfig, StructuredOutputConfig, StructuredResult, TextContentPart, TokenRefreshResult, TokenScope, TokenStorageOptions, TokenValidatorOptions, TokenVerificationResult, TranscriptionConfig, TranscriptionOptions, TranscriptionResult, TranscriptionSegment, ValidatedPlayerInfo };
|