playkit-sdk 1.2.13 → 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 +1706 -1530
- package/dist/playkit-sdk.cjs.js.map +1 -1
- package/dist/playkit-sdk.d.ts +59 -5
- package/dist/playkit-sdk.esm.js +1706 -1530
- package/dist/playkit-sdk.esm.js.map +1 -1
- package/dist/playkit-sdk.umd.js +1769 -1568
- 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
|
|
@@ -1261,7 +1263,7 @@ interface RechargeConfig {
|
|
|
1261
1263
|
checkBalanceAfterApiCall?: boolean;
|
|
1262
1264
|
/**
|
|
1263
1265
|
* Base URL for the recharge portal
|
|
1264
|
-
* @default 'https://playkit.ai/recharge'
|
|
1266
|
+
* @default 'https://players.playkit.ai/recharge'
|
|
1265
1267
|
*/
|
|
1266
1268
|
rechargePortalUrl?: string;
|
|
1267
1269
|
/**
|
|
@@ -2034,10 +2036,11 @@ declare class NPCClient extends EventEmitter {
|
|
|
2034
2036
|
/**
|
|
2035
2037
|
* Manually generate reply predictions based on current conversation.
|
|
2036
2038
|
* Uses the fast model for quick generation.
|
|
2039
|
+
* @param tempPrompt Optional temporary prompt to influence the prediction style/tone
|
|
2037
2040
|
* @param count Number of predictions to generate (default: uses predictionCount property)
|
|
2038
2041
|
* @returns Array of predicted player replies, or empty array on failure
|
|
2039
2042
|
*/
|
|
2040
|
-
generateReplyPredictions(count?: number): Promise<string[]>;
|
|
2043
|
+
generateReplyPredictions(tempPrompt?: string, count?: number): Promise<string[]>;
|
|
2041
2044
|
/**
|
|
2042
2045
|
* Parse predictions from JSON array response
|
|
2043
2046
|
*/
|
|
@@ -2195,6 +2198,8 @@ declare class AIContextManager extends EventEmitter<AIContextManagerEvents> {
|
|
|
2195
2198
|
private static _instance;
|
|
2196
2199
|
private config;
|
|
2197
2200
|
private playerDescription;
|
|
2201
|
+
private playerPrompt;
|
|
2202
|
+
private playerMemories;
|
|
2198
2203
|
private npcStates;
|
|
2199
2204
|
private autoCompactTimer;
|
|
2200
2205
|
private chatClientFactory;
|
|
@@ -2233,6 +2238,47 @@ declare class AIContextManager extends EventEmitter<AIContextManagerEvents> {
|
|
|
2233
2238
|
* Clear the player description.
|
|
2234
2239
|
*/
|
|
2235
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;
|
|
2236
2282
|
/**
|
|
2237
2283
|
* Register an NPC for context management.
|
|
2238
2284
|
* @param npc The NPC client to register
|
|
@@ -2682,8 +2728,8 @@ declare class TokenStorage {
|
|
|
2682
2728
|
declare class AuthFlowManager extends EventEmitter {
|
|
2683
2729
|
private baseURL;
|
|
2684
2730
|
private currentSessionId;
|
|
2685
|
-
private
|
|
2686
|
-
private
|
|
2731
|
+
private _uiContainer;
|
|
2732
|
+
private _isSuccess;
|
|
2687
2733
|
private currentLanguage;
|
|
2688
2734
|
private modal;
|
|
2689
2735
|
private identifierPanel;
|
|
@@ -2903,5 +2949,13 @@ declare class TokenValidator {
|
|
|
2903
2949
|
*/
|
|
2904
2950
|
declare const defaultTokenValidator: TokenValidator;
|
|
2905
2951
|
|
|
2952
|
+
declare global {
|
|
2953
|
+
interface Window {
|
|
2954
|
+
PlayKitSDK: typeof PlayKitSDK & {
|
|
2955
|
+
PlayKitSDK: typeof PlayKitSDK;
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2906
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 };
|
|
2907
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 };
|