@charivo/core 0.24.0 → 0.26.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/README.md +39 -9
- package/dist/index.cjs +35 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -20
- package/dist/index.d.ts +45 -20
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -9,6 +9,13 @@ interface GazeCoordinates {
|
|
|
9
9
|
interface AvatarControlCatalog {
|
|
10
10
|
expressions: string[];
|
|
11
11
|
motions: Record<string, number>;
|
|
12
|
+
/**
|
|
13
|
+
* Optional semantic descriptions for each expression.
|
|
14
|
+
* Keys should correspond to IDs in the `expressions` array.
|
|
15
|
+
* Entries whose key is not present in `expressions` are ignored by consumers.
|
|
16
|
+
* When omitted or empty, no semantic hints are provided (preserving today's behavior).
|
|
17
|
+
*/
|
|
18
|
+
expressionDescriptions?: Record<string, string>;
|
|
12
19
|
}
|
|
13
20
|
interface Character {
|
|
14
21
|
id: string;
|
|
@@ -30,25 +37,6 @@ interface Message {
|
|
|
30
37
|
characterId?: string;
|
|
31
38
|
type: "user" | "character" | "system";
|
|
32
39
|
}
|
|
33
|
-
interface Conversation {
|
|
34
|
-
id: string;
|
|
35
|
-
messages: Message[];
|
|
36
|
-
characterId?: string;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
|
-
}
|
|
40
|
-
interface Plugin {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
version: string;
|
|
44
|
-
enabled: boolean;
|
|
45
|
-
}
|
|
46
|
-
interface CharivoConfig {
|
|
47
|
-
characters: Character[];
|
|
48
|
-
plugins: Plugin[];
|
|
49
|
-
llmProvider?: string;
|
|
50
|
-
renderProvider?: string;
|
|
51
|
-
}
|
|
52
40
|
type RealtimeTransportKind = "webrtc" | "websocket";
|
|
53
41
|
type RealtimeToolChoice = "auto" | "none" | "required";
|
|
54
42
|
declare const OPENAI_REALTIME_ADAPTER = "openai-webrtc";
|
|
@@ -788,6 +776,14 @@ declare class Charivo {
|
|
|
788
776
|
* Get the current render manager instance.
|
|
789
777
|
*/
|
|
790
778
|
getRenderManager(): RenderManager | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* Get the current TTS manager instance.
|
|
781
|
+
*/
|
|
782
|
+
getTTSManager(): TTSManager | undefined;
|
|
783
|
+
/**
|
|
784
|
+
* Get the current LLM manager instance.
|
|
785
|
+
*/
|
|
786
|
+
getLLMManager(): LLMManager | undefined;
|
|
791
787
|
/**
|
|
792
788
|
* Attach a Realtime manager to handle real-time conversation.
|
|
793
789
|
* Automatically connects the event emitter and enables Realtime mode.
|
|
@@ -824,5 +820,34 @@ declare class Charivo {
|
|
|
824
820
|
dispose(): Promise<void>;
|
|
825
821
|
private finishDispose;
|
|
826
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* Managers and character to wire into a new {@link Charivo}.
|
|
825
|
+
*
|
|
826
|
+
* Every field is optional — an instance with no managers is valid, and each
|
|
827
|
+
* modality is attached only when supplied. `null` is accepted alongside
|
|
828
|
+
* `undefined` so callers can pass a manager they hold as nullable state (a
|
|
829
|
+
* React ref, a feature-flagged modality) without converting it first.
|
|
830
|
+
*/
|
|
831
|
+
interface CharivoOptions {
|
|
832
|
+
llm?: LLMManager | null;
|
|
833
|
+
tts?: TTSManager | null;
|
|
834
|
+
stt?: STTManager | null;
|
|
835
|
+
realtime?: RealtimeManager | null;
|
|
836
|
+
renderer?: RenderManager | null;
|
|
837
|
+
character?: Character | null;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Create a Charivo instance with its managers already attached.
|
|
841
|
+
*
|
|
842
|
+
* Equivalent to `new Charivo()` followed by the matching `attach*` calls, then
|
|
843
|
+
* `setCharacter()`. The character is applied last so it reaches every
|
|
844
|
+
* character-aware manager supplied above it — the LLM, renderer, and realtime
|
|
845
|
+
* managers. Hand-wiring works in either order only because `attach*` re-applies
|
|
846
|
+
* an already-set character, and that coupling is easy to miss.
|
|
847
|
+
*
|
|
848
|
+
* Note that supplying `realtime` also enables realtime mode, exactly as
|
|
849
|
+
* `attachRealtime()` does.
|
|
850
|
+
*/
|
|
851
|
+
declare function createCharivo(options?: CharivoOptions): Charivo;
|
|
827
852
|
|
|
828
|
-
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo,
|
|
853
|
+
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, type EventMap, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ interface GazeCoordinates {
|
|
|
9
9
|
interface AvatarControlCatalog {
|
|
10
10
|
expressions: string[];
|
|
11
11
|
motions: Record<string, number>;
|
|
12
|
+
/**
|
|
13
|
+
* Optional semantic descriptions for each expression.
|
|
14
|
+
* Keys should correspond to IDs in the `expressions` array.
|
|
15
|
+
* Entries whose key is not present in `expressions` are ignored by consumers.
|
|
16
|
+
* When omitted or empty, no semantic hints are provided (preserving today's behavior).
|
|
17
|
+
*/
|
|
18
|
+
expressionDescriptions?: Record<string, string>;
|
|
12
19
|
}
|
|
13
20
|
interface Character {
|
|
14
21
|
id: string;
|
|
@@ -30,25 +37,6 @@ interface Message {
|
|
|
30
37
|
characterId?: string;
|
|
31
38
|
type: "user" | "character" | "system";
|
|
32
39
|
}
|
|
33
|
-
interface Conversation {
|
|
34
|
-
id: string;
|
|
35
|
-
messages: Message[];
|
|
36
|
-
characterId?: string;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
|
-
}
|
|
40
|
-
interface Plugin {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
version: string;
|
|
44
|
-
enabled: boolean;
|
|
45
|
-
}
|
|
46
|
-
interface CharivoConfig {
|
|
47
|
-
characters: Character[];
|
|
48
|
-
plugins: Plugin[];
|
|
49
|
-
llmProvider?: string;
|
|
50
|
-
renderProvider?: string;
|
|
51
|
-
}
|
|
52
40
|
type RealtimeTransportKind = "webrtc" | "websocket";
|
|
53
41
|
type RealtimeToolChoice = "auto" | "none" | "required";
|
|
54
42
|
declare const OPENAI_REALTIME_ADAPTER = "openai-webrtc";
|
|
@@ -788,6 +776,14 @@ declare class Charivo {
|
|
|
788
776
|
* Get the current render manager instance.
|
|
789
777
|
*/
|
|
790
778
|
getRenderManager(): RenderManager | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* Get the current TTS manager instance.
|
|
781
|
+
*/
|
|
782
|
+
getTTSManager(): TTSManager | undefined;
|
|
783
|
+
/**
|
|
784
|
+
* Get the current LLM manager instance.
|
|
785
|
+
*/
|
|
786
|
+
getLLMManager(): LLMManager | undefined;
|
|
791
787
|
/**
|
|
792
788
|
* Attach a Realtime manager to handle real-time conversation.
|
|
793
789
|
* Automatically connects the event emitter and enables Realtime mode.
|
|
@@ -824,5 +820,34 @@ declare class Charivo {
|
|
|
824
820
|
dispose(): Promise<void>;
|
|
825
821
|
private finishDispose;
|
|
826
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* Managers and character to wire into a new {@link Charivo}.
|
|
825
|
+
*
|
|
826
|
+
* Every field is optional — an instance with no managers is valid, and each
|
|
827
|
+
* modality is attached only when supplied. `null` is accepted alongside
|
|
828
|
+
* `undefined` so callers can pass a manager they hold as nullable state (a
|
|
829
|
+
* React ref, a feature-flagged modality) without converting it first.
|
|
830
|
+
*/
|
|
831
|
+
interface CharivoOptions {
|
|
832
|
+
llm?: LLMManager | null;
|
|
833
|
+
tts?: TTSManager | null;
|
|
834
|
+
stt?: STTManager | null;
|
|
835
|
+
realtime?: RealtimeManager | null;
|
|
836
|
+
renderer?: RenderManager | null;
|
|
837
|
+
character?: Character | null;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Create a Charivo instance with its managers already attached.
|
|
841
|
+
*
|
|
842
|
+
* Equivalent to `new Charivo()` followed by the matching `attach*` calls, then
|
|
843
|
+
* `setCharacter()`. The character is applied last so it reaches every
|
|
844
|
+
* character-aware manager supplied above it — the LLM, renderer, and realtime
|
|
845
|
+
* managers. Hand-wiring works in either order only because `attach*` re-applies
|
|
846
|
+
* an already-set character, and that coupling is easy to miss.
|
|
847
|
+
*
|
|
848
|
+
* Note that supplying `realtime` also enables realtime mode, exactly as
|
|
849
|
+
* `attachRealtime()` does.
|
|
850
|
+
*/
|
|
851
|
+
declare function createCharivo(options?: CharivoOptions): Charivo;
|
|
827
852
|
|
|
828
|
-
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo,
|
|
853
|
+
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, type EventMap, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
package/dist/index.js
CHANGED
|
@@ -934,6 +934,18 @@ var Charivo = class {
|
|
|
934
934
|
getRenderManager() {
|
|
935
935
|
return this.renderManager;
|
|
936
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Get the current TTS manager instance.
|
|
939
|
+
*/
|
|
940
|
+
getTTSManager() {
|
|
941
|
+
return this.ttsManager;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Get the current LLM manager instance.
|
|
945
|
+
*/
|
|
946
|
+
getLLMManager() {
|
|
947
|
+
return this.llmManager;
|
|
948
|
+
}
|
|
937
949
|
/**
|
|
938
950
|
* Attach a Realtime manager to handle real-time conversation.
|
|
939
951
|
* Automatically connects the event emitter and enables Realtime mode.
|
|
@@ -1058,7 +1070,29 @@ var Charivo = class {
|
|
|
1058
1070
|
}
|
|
1059
1071
|
}
|
|
1060
1072
|
};
|
|
1073
|
+
function createCharivo(options = {}) {
|
|
1074
|
+
const charivo = new Charivo();
|
|
1075
|
+
if (options.renderer) {
|
|
1076
|
+
charivo.attachRenderer(options.renderer);
|
|
1077
|
+
}
|
|
1078
|
+
if (options.llm) {
|
|
1079
|
+
charivo.attachLLM(options.llm);
|
|
1080
|
+
}
|
|
1081
|
+
if (options.tts) {
|
|
1082
|
+
charivo.attachTTS(options.tts);
|
|
1083
|
+
}
|
|
1084
|
+
if (options.stt) {
|
|
1085
|
+
charivo.attachSTT(options.stt);
|
|
1086
|
+
}
|
|
1087
|
+
if (options.realtime) {
|
|
1088
|
+
charivo.attachRealtime(options.realtime);
|
|
1089
|
+
}
|
|
1090
|
+
if (options.character) {
|
|
1091
|
+
charivo.setCharacter(options.character);
|
|
1092
|
+
}
|
|
1093
|
+
return charivo;
|
|
1094
|
+
}
|
|
1061
1095
|
|
|
1062
|
-
export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1096
|
+
export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1063
1097
|
//# sourceMappingURL=index.js.map
|
|
1064
1098
|
//# sourceMappingURL=index.js.map
|