@charivo/core 0.33.0 → 0.34.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/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -785,6 +785,22 @@ interface FetchWithTimeoutOptions {
|
|
|
785
785
|
declare function fetchWithTimeout<T = Response>(input: RequestInfo | URL, init: Omit<RequestInit, "signal"> & {
|
|
786
786
|
signal?: never;
|
|
787
787
|
}, options: FetchWithTimeoutOptions, consumeBody?: (response: Response) => Promise<T>): Promise<T>;
|
|
788
|
+
/**
|
|
789
|
+
* Reads the most specific failure message a non-ok response carries.
|
|
790
|
+
*
|
|
791
|
+
* Remote clients talk to a caller-supplied route, and a route that took the
|
|
792
|
+
* trouble to explain itself is the only place the real cause lives -- a
|
|
793
|
+
* provider rate limit or an upstream outage reaches the browser as a bare
|
|
794
|
+
* status line otherwise. Routes in this repo answer with `{ error, details? }`,
|
|
795
|
+
* where `details` carries the vendor's own text; both are read here, most
|
|
796
|
+
* specific first, falling back to the status line.
|
|
797
|
+
*
|
|
798
|
+
* A body that is not JSON is not an error in itself, so it falls back. Any
|
|
799
|
+
* other read failure -- an abort or timeout part-way through the body --
|
|
800
|
+
* propagates, so `fetchWithTimeout` can classify it instead of it being masked
|
|
801
|
+
* as a provider error.
|
|
802
|
+
*/
|
|
803
|
+
declare function readResponseErrorMessage(response: Response): Promise<string>;
|
|
788
804
|
|
|
789
805
|
declare class Charivo {
|
|
790
806
|
private eventBus;
|
|
@@ -1007,4 +1023,4 @@ interface CharivoOptions {
|
|
|
1007
1023
|
*/
|
|
1008
1024
|
declare function createCharivo(options?: CharivoOptions): Charivo;
|
|
1009
1025
|
|
|
1010
|
-
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, 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, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1026
|
+
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, 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, fetchWithTimeout, getErrorMessage, isCharivoError, readResponseErrorMessage, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -785,6 +785,22 @@ interface FetchWithTimeoutOptions {
|
|
|
785
785
|
declare function fetchWithTimeout<T = Response>(input: RequestInfo | URL, init: Omit<RequestInit, "signal"> & {
|
|
786
786
|
signal?: never;
|
|
787
787
|
}, options: FetchWithTimeoutOptions, consumeBody?: (response: Response) => Promise<T>): Promise<T>;
|
|
788
|
+
/**
|
|
789
|
+
* Reads the most specific failure message a non-ok response carries.
|
|
790
|
+
*
|
|
791
|
+
* Remote clients talk to a caller-supplied route, and a route that took the
|
|
792
|
+
* trouble to explain itself is the only place the real cause lives -- a
|
|
793
|
+
* provider rate limit or an upstream outage reaches the browser as a bare
|
|
794
|
+
* status line otherwise. Routes in this repo answer with `{ error, details? }`,
|
|
795
|
+
* where `details` carries the vendor's own text; both are read here, most
|
|
796
|
+
* specific first, falling back to the status line.
|
|
797
|
+
*
|
|
798
|
+
* A body that is not JSON is not an error in itself, so it falls back. Any
|
|
799
|
+
* other read failure -- an abort or timeout part-way through the body --
|
|
800
|
+
* propagates, so `fetchWithTimeout` can classify it instead of it being masked
|
|
801
|
+
* as a provider error.
|
|
802
|
+
*/
|
|
803
|
+
declare function readResponseErrorMessage(response: Response): Promise<string>;
|
|
788
804
|
|
|
789
805
|
declare class Charivo {
|
|
790
806
|
private eventBus;
|
|
@@ -1007,4 +1023,4 @@ interface CharivoOptions {
|
|
|
1007
1023
|
*/
|
|
1008
1024
|
declare function createCharivo(options?: CharivoOptions): Charivo;
|
|
1009
1025
|
|
|
1010
|
-
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, 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, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1026
|
+
export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, 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, fetchWithTimeout, getErrorMessage, isCharivoError, readResponseErrorMessage, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
package/dist/index.js
CHANGED
|
@@ -607,6 +607,20 @@ function fetchWithTimeout(input, init, options, consumeBody) {
|
|
|
607
607
|
}
|
|
608
608
|
);
|
|
609
609
|
}
|
|
610
|
+
async function readResponseErrorMessage(response) {
|
|
611
|
+
let body;
|
|
612
|
+
try {
|
|
613
|
+
body = await response.json();
|
|
614
|
+
} catch (error) {
|
|
615
|
+
if (!(error instanceof SyntaxError)) {
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
const fields = typeof body === "object" && body !== null ? body : {};
|
|
620
|
+
const detail = typeof fields.details === "string" ? fields.details : void 0;
|
|
621
|
+
const summary = typeof fields.error === "string" ? fields.error : void 0;
|
|
622
|
+
return detail ?? summary ?? response.statusText;
|
|
623
|
+
}
|
|
610
624
|
|
|
611
625
|
// src/index.ts
|
|
612
626
|
var Charivo = class {
|
|
@@ -1227,6 +1241,6 @@ function createCharivo(options = {}) {
|
|
|
1227
1241
|
return charivo;
|
|
1228
1242
|
}
|
|
1229
1243
|
|
|
1230
|
-
export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, GEMINI_LIVE_ADAPTER, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1244
|
+
export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, GEMINI_LIVE_ADAPTER, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, readResponseErrorMessage, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
|
|
1231
1245
|
//# sourceMappingURL=index.js.map
|
|
1232
1246
|
//# sourceMappingURL=index.js.map
|