@charivo/core 0.32.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/README.md CHANGED
@@ -27,16 +27,17 @@ It exports:
27
27
  The public API is factory-first: pluggable managers/clients/players/
28
28
  transcribers/renderers are created via `create*` factories and consumed
29
29
  through their interfaces; concrete implementation classes are not
30
- exported. `Charivo`, the `CharivoError` taxonomy, and the OpenAI/OpenClaw
31
- provider classes (`OpenAILLMProvider`, `OpenClawLLMProvider`,
32
- `OpenAITTSProvider`, `OpenAISTTProvider`, `OpenAIRealtimeProvider`) are
33
- the three exceptions, exported directly as concrete classes: `Charivo`
30
+ exported. `Charivo`, the `CharivoError` taxonomy, and the server provider
31
+ classes (`OpenAILLMProvider`, `OpenClawLLMProvider`, `OpenAITTSProvider`,
32
+ `OpenAISTTProvider`, `OpenAIRealtimeProvider`, `GeminiRealtimeProvider`) are
33
+ the three exceptions, exported directly as concrete classes (the providers
34
+ from `@charivo/server/*`): `Charivo`
34
35
  owns the instance lifecycle (wiring managers, the event bus, and
35
36
  `dispose()`), so although `createCharivo()` is the preferred way in, the
36
37
  class stays exported for wiring that happens after construction;
37
38
  `CharivoError` is a taxonomy
38
39
  checked via `isCharivoError`/`error.code`, not constructed; the
39
- OpenAI/OpenClaw providers are exported because consumers rely on
40
+ providers are exported because consumers rely on
40
41
  `instanceof` checks and provider methods outside the narrow core
41
42
  interface — a contract `packages/server/__tests__/barrel.test.ts` pins;
42
43
  their factories are also browser-callable via `dangerouslyAllowBrowser`
@@ -100,6 +101,10 @@ The `Charivo` instance wires managers together:
100
101
  - `attachRealtime(realtimeManager)`
101
102
  - `detachLLM()`
102
103
  - `detachRenderer()`
104
+ - `detachTTS()`
105
+ - `detachSTT()`
106
+ - `detachRealtime()`
107
+ - `isRealtimeModeEnabled()`
103
108
  - `getRenderManager()`
104
109
  - `getLLMManager()`
105
110
  - `getTTSManager()`
@@ -114,6 +119,7 @@ The `Charivo` instance wires managers together:
114
119
  - `getHistory()`
115
120
  - `on(event, listener)`
116
121
  - `off(event, listener)`
122
+ - `emit(event, payload)`
117
123
 
118
124
  `detachRenderer()` disconnects the render manager's event-bus listeners and
119
125
  releases any held expression, without destroying the manager, so it remains
package/dist/index.cjs CHANGED
@@ -153,6 +153,7 @@ function toCharivoError(kind, error, fallbackMessage) {
153
153
  // src/types.ts
154
154
  var OPENAI_REALTIME_ADAPTER = "openai-webrtc";
155
155
  var OPENAI_REALTIME_AGENTS_ADAPTER = "openai-agents-webrtc";
156
+ var GEMINI_LIVE_ADAPTER = "gemini-live-websocket";
156
157
 
157
158
  // src/browser-lifecycle.ts
158
159
  var subscribers = /* @__PURE__ */ new Set();
@@ -608,6 +609,20 @@ function fetchWithTimeout(input, init, options, consumeBody) {
608
609
  }
609
610
  );
610
611
  }
612
+ async function readResponseErrorMessage(response) {
613
+ let body;
614
+ try {
615
+ body = await response.json();
616
+ } catch (error) {
617
+ if (!(error instanceof SyntaxError)) {
618
+ throw error;
619
+ }
620
+ }
621
+ const fields = typeof body === "object" && body !== null ? body : {};
622
+ const detail = typeof fields.details === "string" ? fields.details : void 0;
623
+ const summary = typeof fields.error === "string" ? fields.error : void 0;
624
+ return detail ?? summary ?? response.statusText;
625
+ }
611
626
 
612
627
  // src/index.ts
613
628
  var Charivo = class {
@@ -1236,6 +1251,7 @@ exports.CharivoStateError = CharivoStateError;
1236
1251
  exports.CharivoTimeoutError = CharivoTimeoutError;
1237
1252
  exports.CharivoTransportError = CharivoTransportError;
1238
1253
  exports.DEFAULT_FETCH_TIMEOUT_MS = DEFAULT_FETCH_TIMEOUT_MS;
1254
+ exports.GEMINI_LIVE_ADAPTER = GEMINI_LIVE_ADAPTER;
1239
1255
  exports.OPENAI_REALTIME_ADAPTER = OPENAI_REALTIME_ADAPTER;
1240
1256
  exports.OPENAI_REALTIME_AGENTS_ADAPTER = OPENAI_REALTIME_AGENTS_ADAPTER;
1241
1257
  exports.assertToolResultObject = assertToolResultObject;
@@ -1246,6 +1262,7 @@ exports.createToolRegistry = createToolRegistry;
1246
1262
  exports.fetchWithTimeout = fetchWithTimeout;
1247
1263
  exports.getErrorMessage = getErrorMessage;
1248
1264
  exports.isCharivoError = isCharivoError;
1265
+ exports.readResponseErrorMessage = readResponseErrorMessage;
1249
1266
  exports.snapshotToolResult = snapshotToolResult;
1250
1267
  exports.subscribeBrowserLifecycle = subscribeBrowserLifecycle;
1251
1268
  exports.toCharivoError = toCharivoError;