@elevenlabs/react 0.14.2 → 1.0.0-rc.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 +33 -1085
- package/dist/conversation/ConversationClientTools.d.ts +39 -0
- package/dist/conversation/ConversationClientTools.d.ts.map +1 -0
- package/dist/conversation/ConversationClientTools.js +87 -0
- package/dist/conversation/ConversationClientTools.js.map +1 -0
- package/dist/conversation/ConversationContext.d.ts +47 -0
- package/dist/conversation/ConversationContext.d.ts.map +1 -0
- package/dist/conversation/ConversationContext.js +61 -0
- package/dist/conversation/ConversationContext.js.map +1 -0
- package/dist/conversation/ConversationControls.d.ts +34 -0
- package/dist/conversation/ConversationControls.d.ts.map +1 -0
- package/dist/conversation/ConversationControls.js +113 -0
- package/dist/conversation/ConversationControls.js.map +1 -0
- package/dist/conversation/ConversationFeedback.d.ts +19 -0
- package/dist/conversation/ConversationFeedback.d.ts.map +1 -0
- package/dist/conversation/ConversationFeedback.js +44 -0
- package/dist/conversation/ConversationFeedback.js.map +1 -0
- package/dist/conversation/ConversationInput.d.ts +18 -0
- package/dist/conversation/ConversationInput.d.ts.map +1 -0
- package/dist/conversation/ConversationInput.js +40 -0
- package/dist/conversation/ConversationInput.js.map +1 -0
- package/dist/conversation/ConversationMode.d.ts +19 -0
- package/dist/conversation/ConversationMode.d.ts.map +1 -0
- package/dist/conversation/ConversationMode.js +40 -0
- package/dist/conversation/ConversationMode.js.map +1 -0
- package/dist/conversation/ConversationProvider.d.ts +4 -0
- package/dist/conversation/ConversationProvider.d.ts.map +1 -0
- package/dist/conversation/ConversationProvider.js +127 -0
- package/dist/conversation/ConversationProvider.js.map +1 -0
- package/dist/conversation/ConversationStatus.d.ts +19 -0
- package/dist/conversation/ConversationStatus.d.ts.map +1 -0
- package/dist/conversation/ConversationStatus.js +44 -0
- package/dist/conversation/ConversationStatus.js.map +1 -0
- package/dist/conversation/ListenerMap.d.ts +29 -0
- package/dist/conversation/ListenerMap.d.ts.map +1 -0
- package/dist/conversation/ListenerMap.js +63 -0
- package/dist/conversation/ListenerMap.js.map +1 -0
- package/dist/conversation/ListenerSet.d.ts +7 -0
- package/dist/conversation/ListenerSet.d.ts.map +1 -0
- package/dist/conversation/ListenerSet.js +17 -0
- package/dist/conversation/ListenerSet.js.map +1 -0
- package/dist/conversation/types.d.ts +9 -0
- package/dist/conversation/types.d.ts.map +1 -0
- package/dist/conversation/types.js +2 -0
- package/dist/conversation/types.js.map +1 -0
- package/dist/conversation/useConversation.d.ts +45 -0
- package/dist/conversation/useConversation.d.ts.map +1 -0
- package/dist/conversation/useConversation.js +76 -0
- package/dist/conversation/useConversation.js.map +1 -0
- package/dist/conversation/useStableCallbacks.d.ts +13 -0
- package/dist/conversation/useStableCallbacks.d.ts.map +1 -0
- package/dist/conversation/useStableCallbacks.js +33 -0
- package/dist/conversation/useStableCallbacks.js.map +1 -0
- package/dist/index.d.ts +19 -47
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.iife.js +984 -0
- package/dist/lib.iife.js.map +1 -0
- package/dist/scribe.d.ts +1 -0
- package/dist/scribe.d.ts.map +1 -0
- package/dist/scribe.js +307 -0
- package/dist/scribe.js.map +1 -0
- package/dist/version.d.ts +2 -1
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +25 -20
- package/.turbo/turbo-build.log +0 -29
- package/.turbo/turbo-check-types.log +0 -4
- package/.turbo/turbo-generate-version.log +0 -4
- package/.turbo/turbo-lint$colon$es.log +0 -6
- package/.turbo/turbo-lint$colon$prettier.log +0 -6
- package/CHANGELOG.md +0 -45
- package/dist/lib.cjs +0 -2
- package/dist/lib.cjs.map +0 -1
- package/dist/lib.modern.js +0 -2
- package/dist/lib.modern.js.map +0 -1
- package/dist/lib.module.js +0 -2
- package/dist/lib.module.js.map +0 -1
- package/dist/lib.umd.js +0 -2
- package/dist/lib.umd.js.map +0 -1
- package/jest.config.cjs +0 -23
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ClientToolsConfig } from "@elevenlabs/client";
|
|
2
|
+
import type { ClientTool, ClientTools } from "./types";
|
|
3
|
+
type ClientToolEntry = ClientToolsConfig["clientTools"][string];
|
|
4
|
+
/**
|
|
5
|
+
* Creates a fresh clientTools object by merging option-provided tools with
|
|
6
|
+
* hook-registered tools from the registry. Throws if a hook-registered tool
|
|
7
|
+
* name conflicts with an option-provided tool.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildClientTools(optionTools: Record<string, ClientToolEntry> | undefined, registry: Map<string, ClientToolEntry>): Record<string, ClientToolEntry>;
|
|
10
|
+
export declare function ConversationClientToolsProvider({ children, }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Registers a named client tool with the nearest `ConversationProvider`.
|
|
13
|
+
* The tool is available during any active conversation and is automatically
|
|
14
|
+
* unregistered when the component unmounts.
|
|
15
|
+
*
|
|
16
|
+
* The handler always reflects the latest closure value (ref pattern),
|
|
17
|
+
* so it is safe to reference component state or props without listing
|
|
18
|
+
* them as dependencies.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam TTools - An interface mapping tool names to function signatures.
|
|
21
|
+
* @typeParam TName - The specific tool name (inferred from the first argument).
|
|
22
|
+
* @param name - The tool name (must match the name configured on the agent).
|
|
23
|
+
* @param handler - The function invoked when the agent calls this tool.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* type Tools = {
|
|
28
|
+
* get_weather: (params: { city: string }) => string;
|
|
29
|
+
* set_volume: (params: { level: number }) => void;
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* useConversationClientTool<Tools>("get_weather", (params) => {
|
|
33
|
+
* return `Weather in ${params.city} is sunny.`;
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function useConversationClientTool<TTools extends ClientTools = Record<string, ClientTool>, TName extends string & keyof TTools = string & keyof TTools>(name: TName, handler: TTools[TName]): void;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=ConversationClientTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationClientTools.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationClientTools.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEvD,KAAK,eAAe,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EACxD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACrC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAYjC;AAeD,wBAAgB,+BAA+B,CAAC,EAC9C,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,2CAqCzB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,SAAS,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACvD,KAAK,SAAS,MAAM,GAAG,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,MAAM,EAC3D,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAiB3C"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { ConversationContext } from "./ConversationContext";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a fresh clientTools object by merging option-provided tools with
|
|
6
|
+
* hook-registered tools from the registry. Throws if a hook-registered tool
|
|
7
|
+
* name conflicts with an option-provided tool.
|
|
8
|
+
*/
|
|
9
|
+
export function buildClientTools(optionTools, registry) {
|
|
10
|
+
const clientTools = { ...optionTools };
|
|
11
|
+
for (const [name, handler] of registry) {
|
|
12
|
+
if (Object.hasOwn(clientTools, name)) {
|
|
13
|
+
throw new Error(`Client tool "${name}" is already provided via props/options. ` +
|
|
14
|
+
`Remove it from props or do not register it with useConversationClientTool.`);
|
|
15
|
+
}
|
|
16
|
+
clientTools[name] = handler;
|
|
17
|
+
}
|
|
18
|
+
return clientTools;
|
|
19
|
+
}
|
|
20
|
+
const ConversationClientToolsContext = createContext(null);
|
|
21
|
+
export function ConversationClientToolsProvider({ children, }) {
|
|
22
|
+
const ctx = useContext(ConversationContext);
|
|
23
|
+
if (!ctx) {
|
|
24
|
+
throw new Error("ConversationClientToolsProvider must be rendered inside a ConversationProvider");
|
|
25
|
+
}
|
|
26
|
+
const { clientToolsRegistry, clientToolsRef } = ctx;
|
|
27
|
+
const registerClientTool = useCallback((name, handler) => {
|
|
28
|
+
if (clientToolsRegistry.has(name)) {
|
|
29
|
+
throw new Error(`Client tool "${name}" is already registered by another hook. ` +
|
|
30
|
+
`Each tool name must be unique.`);
|
|
31
|
+
}
|
|
32
|
+
clientToolsRegistry.set(name, handler);
|
|
33
|
+
clientToolsRef.current[name] = handler;
|
|
34
|
+
return () => {
|
|
35
|
+
if (clientToolsRegistry.get(name) === handler) {
|
|
36
|
+
clientToolsRegistry.delete(name);
|
|
37
|
+
}
|
|
38
|
+
if (clientToolsRef.current[name] === handler) {
|
|
39
|
+
delete clientToolsRef.current[name];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [clientToolsRegistry, clientToolsRef]);
|
|
43
|
+
return (_jsx(ConversationClientToolsContext.Provider, { value: registerClientTool, children: children }));
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Hook
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
/**
|
|
49
|
+
* Registers a named client tool with the nearest `ConversationProvider`.
|
|
50
|
+
* The tool is available during any active conversation and is automatically
|
|
51
|
+
* unregistered when the component unmounts.
|
|
52
|
+
*
|
|
53
|
+
* The handler always reflects the latest closure value (ref pattern),
|
|
54
|
+
* so it is safe to reference component state or props without listing
|
|
55
|
+
* them as dependencies.
|
|
56
|
+
*
|
|
57
|
+
* @typeParam TTools - An interface mapping tool names to function signatures.
|
|
58
|
+
* @typeParam TName - The specific tool name (inferred from the first argument).
|
|
59
|
+
* @param name - The tool name (must match the name configured on the agent).
|
|
60
|
+
* @param handler - The function invoked when the agent calls this tool.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* type Tools = {
|
|
65
|
+
* get_weather: (params: { city: string }) => string;
|
|
66
|
+
* set_volume: (params: { level: number }) => void;
|
|
67
|
+
* };
|
|
68
|
+
*
|
|
69
|
+
* useConversationClientTool<Tools>("get_weather", (params) => {
|
|
70
|
+
* return `Weather in ${params.city} is sunny.`;
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function useConversationClientTool(name, handler) {
|
|
75
|
+
const registerClientTool = useContext(ConversationClientToolsContext);
|
|
76
|
+
if (!registerClientTool) {
|
|
77
|
+
throw new Error("useConversationClientTool must be used within a ConversationProvider");
|
|
78
|
+
}
|
|
79
|
+
const handlerRef = useRef(handler);
|
|
80
|
+
// eslint-disable-next-line react-hooks/refs -- intentional sync during render for latest-ref pattern
|
|
81
|
+
handlerRef.current = handler;
|
|
82
|
+
useLayoutEffect(() => {
|
|
83
|
+
const stableHandler = parameters => handlerRef.current(parameters);
|
|
84
|
+
return registerClientTool(name, stableHandler);
|
|
85
|
+
}, [registerClientTool, name]);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=ConversationClientTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationClientTools.js","sourceRoot":"","sources":["../../src/conversation/ConversationClientTools.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAK5D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAAwD,EACxD,QAAsC;IAEtC,MAAM,WAAW,GAAoC,EAAE,GAAG,WAAW,EAAE,CAAC;IACxE,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CACb,gBAAgB,IAAI,2CAA2C;gBAC7D,4EAA4E,CAC/E,CAAC;QACJ,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAC9B,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAWD,MAAM,8BAA8B,GAAG,aAAa,CAClD,IAAI,CACL,CAAC;AAEF,MAAM,UAAU,+BAA+B,CAAC,EAC9C,QAAQ,GACgB;IACxB,MAAM,GAAG,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;IAEpD,MAAM,kBAAkB,GAAuB,WAAW,CACxD,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACb,gBAAg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AAI,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type MutableRefObject, type RefObject } from "react";
|
|
2
|
+
import type { Callbacks, ClientToolsConfig, Conversation } from "@elevenlabs/client";
|
|
3
|
+
import type { HookOptions } from "./types";
|
|
4
|
+
type ClientToolEntry = ClientToolsConfig["clientTools"][string];
|
|
5
|
+
export type ConversationContextValue = {
|
|
6
|
+
conversation: Conversation | null;
|
|
7
|
+
/** Stable ref to the active conversation — use in callbacks to avoid re-renders. */
|
|
8
|
+
conversationRef: RefObject<Conversation | null>;
|
|
9
|
+
startSession: (options?: HookOptions) => void;
|
|
10
|
+
endSession: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* For sub-providers — register callback handlers to be composed into the
|
|
13
|
+
* next `Conversation.startSession()` call. Returns an unsubscribe function.
|
|
14
|
+
*/
|
|
15
|
+
registerCallbacks: (callbacks: Partial<Callbacks>) => () => void;
|
|
16
|
+
/** Registry of hook-registered client tools. Survives across sessions. */
|
|
17
|
+
clientToolsRegistry: Map<string, ClientToolEntry>;
|
|
18
|
+
/** Ref to the live clientTools object currently held by BaseConversation. */
|
|
19
|
+
clientToolsRef: MutableRefObject<Record<string, ClientToolEntry>>;
|
|
20
|
+
};
|
|
21
|
+
export declare const ConversationContext: import("react").Context<ConversationContextValue | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the raw `Conversation` instance (or `null` if no session is active).
|
|
24
|
+
* This is a public escape hatch for advanced use cases that need direct access
|
|
25
|
+
* to the underlying `@elevenlabs/client` Conversation object.
|
|
26
|
+
*
|
|
27
|
+
* Can be used outside a `ConversationProvider` — returns `null` in that case.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useRawConversation(): Conversation | null;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a stable ref to the active `Conversation` instance.
|
|
32
|
+
* The ref's `.current` is `null` when no session is active, and updates
|
|
33
|
+
* without causing re-renders — ideal for use inside callbacks and sub-providers.
|
|
34
|
+
*
|
|
35
|
+
* Must be used within a `ConversationProvider`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useRawConversationRef(): RefObject<Conversation | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Registers callback handlers with the nearest `ConversationProvider`.
|
|
40
|
+
* Uses a ref internally so the latest callback values are always invoked
|
|
41
|
+
* without re-subscribing on every render.
|
|
42
|
+
*
|
|
43
|
+
* Must be used within a `ConversationProvider`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function useRegisterCallbacks(callbacks: Partial<Callbacks>): void;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=ConversationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationContext.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsD,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,KAAK,eAAe,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,oFAAoF;IACpF,eAAe,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAChD,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC;IACjE,0EAA0E;IAC1E,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,6EAA6E;IAC7E,cAAc,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CACnE,CAAC;AAEF,eAAO,MAAM,mBAAmB,0DACsB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAGxD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAQtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAgCxE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createContext, useContext, useLayoutEffect, useRef } from "react";
|
|
2
|
+
export const ConversationContext = createContext(null);
|
|
3
|
+
/**
|
|
4
|
+
* Returns the raw `Conversation` instance (or `null` if no session is active).
|
|
5
|
+
* This is a public escape hatch for advanced use cases that need direct access
|
|
6
|
+
* to the underlying `@elevenlabs/client` Conversation object.
|
|
7
|
+
*
|
|
8
|
+
* Can be used outside a `ConversationProvider` — returns `null` in that case.
|
|
9
|
+
*/
|
|
10
|
+
export function useRawConversation() {
|
|
11
|
+
const ctx = useContext(ConversationContext);
|
|
12
|
+
return ctx?.conversation ?? null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns a stable ref to the active `Conversation` instance.
|
|
16
|
+
* The ref's `.current` is `null` when no session is active, and updates
|
|
17
|
+
* without causing re-renders — ideal for use inside callbacks and sub-providers.
|
|
18
|
+
*
|
|
19
|
+
* Must be used within a `ConversationProvider`.
|
|
20
|
+
*/
|
|
21
|
+
export function useRawConversationRef() {
|
|
22
|
+
const ctx = useContext(ConversationContext);
|
|
23
|
+
if (!ctx) {
|
|
24
|
+
throw new Error("useRawConversationRef must be used within a ConversationProvider");
|
|
25
|
+
}
|
|
26
|
+
return ctx.conversationRef;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Registers callback handlers with the nearest `ConversationProvider`.
|
|
30
|
+
* Uses a ref internally so the latest callback values are always invoked
|
|
31
|
+
* without re-subscribing on every render.
|
|
32
|
+
*
|
|
33
|
+
* Must be used within a `ConversationProvider`.
|
|
34
|
+
*/
|
|
35
|
+
export function useRegisterCallbacks(callbacks) {
|
|
36
|
+
const ctx = useContext(ConversationContext);
|
|
37
|
+
if (!ctx) {
|
|
38
|
+
throw new Error("useRegisterCallbacks must be used within a ConversationProvider");
|
|
39
|
+
}
|
|
40
|
+
const { registerCallbacks } = ctx;
|
|
41
|
+
const callbacksRef = useRef(callbacks);
|
|
42
|
+
callbacksRef.current = callbacks;
|
|
43
|
+
// Re-subscribe when the set of provided callback keys changes.
|
|
44
|
+
const activeKeys = Object.keys(callbacks)
|
|
45
|
+
.filter(key => callbacks[key] !== undefined)
|
|
46
|
+
.sort();
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
const stableCallbacks = Object.fromEntries(activeKeys.map((key) => [
|
|
49
|
+
key,
|
|
50
|
+
(...args) => {
|
|
51
|
+
const fn = callbacksRef.current[key];
|
|
52
|
+
if (typeof fn === "function") {
|
|
53
|
+
fn(...args);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
]));
|
|
57
|
+
return registerCallbacks(stableCallbacks);
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- activeKeys.join() is a stable scalar derived from activeKeys; no split needed since the effect closes over activeKeys directly
|
|
59
|
+
}, [registerCallbacks, activeKeys.join("|")]);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=ConversationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationContext.js","sourceRoot":"","sources":["../../src/conversation/ConversationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,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H,CAAC,GAAG,IAAa,EAAE,EAAE;gBACnB,MAAM,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,GAAsB,CAAC,CAAC;gBACxD,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;oBAC5B,EAA8B,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;SACF,CAAC,CACmB,CAAC;QACxB,OAAO,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAC1C,yLAAyL;IAC3L,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type FormatConfig, type InputDeviceConfig, type OutputConfig } from "@elevenlabs/client";
|
|
2
|
+
import type { HookOptions } from "./types";
|
|
3
|
+
export type ConversationControlsValue = {
|
|
4
|
+
startSession: (options?: HookOptions) => void;
|
|
5
|
+
endSession: () => void;
|
|
6
|
+
sendUserMessage: (text: string) => void;
|
|
7
|
+
sendContextualUpdate: (text: string) => void;
|
|
8
|
+
sendUserActivity: () => void;
|
|
9
|
+
sendMCPToolApprovalResult: (toolCallId: string, isApproved: boolean) => void;
|
|
10
|
+
setVolume: (options: {
|
|
11
|
+
volume: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
changeInputDevice: (config: FormatConfig & InputDeviceConfig) => Promise<void>;
|
|
14
|
+
changeOutputDevice: (config: FormatConfig & OutputConfig) => Promise<void>;
|
|
15
|
+
getInputByteFrequencyData: () => Uint8Array;
|
|
16
|
+
getOutputByteFrequencyData: () => Uint8Array;
|
|
17
|
+
getInputVolume: () => number;
|
|
18
|
+
getOutputVolume: () => number;
|
|
19
|
+
getId: () => string;
|
|
20
|
+
};
|
|
21
|
+
export declare const ConversationControlsContext: import("react").Context<ConversationControlsValue | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Reads from `ConversationContext` and provides stable action references to
|
|
24
|
+
* `ConversationControlsContext`. Must be rendered inside a `ConversationProvider`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ConversationControlsProvider({ children, }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Returns stable action references for controlling the conversation.
|
|
29
|
+
* All function references are stable and will never cause re-renders.
|
|
30
|
+
*
|
|
31
|
+
* Must be used within a `ConversationProvider`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useConversationControls(): ConversationControlsValue;
|
|
34
|
+
//# sourceMappingURL=ConversationControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationControls.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationControls.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,MAAM,yBAAyB,GAAG;IACtC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,yBAAyB,EAAE,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,OAAO,KAChB,IAAI,CAAC;IACV,SAAS,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,iBAAiB,EAAE,CACjB,MAAM,EAAE,YAAY,GAAG,iBAAiB,KACrC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,kBAAkB,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,yBAAyB,EAAE,MAAM,UAAU,CAAC;IAC5C,0BAA0B,EAAE,MAAM,UAAU,CAAC;IAC7C,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,KAAK,EAAE,MAAM,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,2BAA2B,2DACe,CAAC;AAExD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,2CA+HzB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,yBAAyB,CAQnE"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
3
|
+
import { VoiceConversation, } from "@elevenlabs/client";
|
|
4
|
+
import { ConversationContext } from "./ConversationContext";
|
|
5
|
+
export const ConversationControlsContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* Reads from `ConversationContext` and provides stable action references to
|
|
8
|
+
* `ConversationControlsContext`. Must be rendered inside a `ConversationProvider`.
|
|
9
|
+
*/
|
|
10
|
+
export function ConversationControlsProvider({ children, }) {
|
|
11
|
+
const ctx = useContext(ConversationContext);
|
|
12
|
+
if (!ctx) {
|
|
13
|
+
throw new Error("ConversationControlsProvider must be rendered inside a ConversationProvider");
|
|
14
|
+
}
|
|
15
|
+
const { conversationRef } = ctx;
|
|
16
|
+
const getConversation = useCallback(() => {
|
|
17
|
+
const conversation = conversationRef.current;
|
|
18
|
+
if (!conversation) {
|
|
19
|
+
throw new Error("No active conversation. Call startSession() first.");
|
|
20
|
+
}
|
|
21
|
+
return conversation;
|
|
22
|
+
}, [conversationRef]);
|
|
23
|
+
const sendUserMessage = useCallback((text) => {
|
|
24
|
+
getConversation().sendUserMessage(text);
|
|
25
|
+
}, [getConversation]);
|
|
26
|
+
const sendContextualUpdate = useCallback((text) => {
|
|
27
|
+
getConversation().sendContextualUpdate(text);
|
|
28
|
+
}, [getConversation]);
|
|
29
|
+
const sendUserActivity = useCallback(() => {
|
|
30
|
+
getConversation().sendUserActivity();
|
|
31
|
+
}, [getConversation]);
|
|
32
|
+
const sendMCPToolApprovalResult = useCallback((toolCallId, isApproved) => {
|
|
33
|
+
getConversation().sendMCPToolApprovalResult(toolCallId, isApproved);
|
|
34
|
+
}, [getConversation]);
|
|
35
|
+
const setVolume = useCallback((options) => {
|
|
36
|
+
getConversation().setVolume(options);
|
|
37
|
+
}, [getConversation]);
|
|
38
|
+
const changeInputDevice = useCallback(async (config) => {
|
|
39
|
+
const conversation = getConversation();
|
|
40
|
+
if (conversation instanceof VoiceConversation) {
|
|
41
|
+
return await conversation.changeInputDevice(config);
|
|
42
|
+
}
|
|
43
|
+
throw new Error("Device switching is only available for voice conversations");
|
|
44
|
+
}, [getConversation]);
|
|
45
|
+
const changeOutputDevice = useCallback(async (config) => {
|
|
46
|
+
const conversation = getConversation();
|
|
47
|
+
if (conversation instanceof VoiceConversation) {
|
|
48
|
+
return await conversation.changeOutputDevice(config);
|
|
49
|
+
}
|
|
50
|
+
throw new Error("Device switching is only available for voice conversations");
|
|
51
|
+
}, [getConversation]);
|
|
52
|
+
const getInputByteFrequencyData = useCallback(() => {
|
|
53
|
+
return getConversation().getInputByteFrequencyData();
|
|
54
|
+
}, [getConversation]);
|
|
55
|
+
const getOutputByteFrequencyData = useCallback(() => {
|
|
56
|
+
return getConversation().getOutputByteFrequencyData();
|
|
57
|
+
}, [getConversation]);
|
|
58
|
+
const getInputVolume = useCallback(() => {
|
|
59
|
+
return getConversation().getInputVolume();
|
|
60
|
+
}, [getConversation]);
|
|
61
|
+
const getOutputVolume = useCallback(() => {
|
|
62
|
+
return getConversation().getOutputVolume();
|
|
63
|
+
}, [getConversation]);
|
|
64
|
+
const getId = useCallback(() => {
|
|
65
|
+
return getConversation().getId();
|
|
66
|
+
}, [getConversation]);
|
|
67
|
+
const value = useMemo(() => ({
|
|
68
|
+
startSession: ctx.startSession,
|
|
69
|
+
endSession: ctx.endSession,
|
|
70
|
+
sendUserMessage,
|
|
71
|
+
sendContextualUpdate,
|
|
72
|
+
sendUserActivity,
|
|
73
|
+
sendMCPToolApprovalResult,
|
|
74
|
+
setVolume,
|
|
75
|
+
changeInputDevice,
|
|
76
|
+
changeOutputDevice,
|
|
77
|
+
getInputByteFrequencyData,
|
|
78
|
+
getOutputByteFrequencyData,
|
|
79
|
+
getInputVolume,
|
|
80
|
+
getOutputVolume,
|
|
81
|
+
getId,
|
|
82
|
+
}), [
|
|
83
|
+
ctx.startSession,
|
|
84
|
+
ctx.endSession,
|
|
85
|
+
sendUserMessage,
|
|
86
|
+
sendContextualUpdate,
|
|
87
|
+
sendUserActivity,
|
|
88
|
+
sendMCPToolApprovalResult,
|
|
89
|
+
setVolume,
|
|
90
|
+
changeInputDevice,
|
|
91
|
+
changeOutputDevice,
|
|
92
|
+
getInputByteFrequencyData,
|
|
93
|
+
getOutputByteFrequencyData,
|
|
94
|
+
getInputVolume,
|
|
95
|
+
getOutputVolume,
|
|
96
|
+
getId,
|
|
97
|
+
]);
|
|
98
|
+
return (_jsx(ConversationControlsContext.Provider, { value: value, children: children }));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns stable action references for controlling the conversation.
|
|
102
|
+
* All function references are stable and will never cause re-renders.
|
|
103
|
+
*
|
|
104
|
+
* Must be used within a `ConversationProvider`.
|
|
105
|
+
*/
|
|
106
|
+
export function useConversationControls() {
|
|
107
|
+
const ctx = useContext(ConversationControlsContext);
|
|
108
|
+
if (!ctx) {
|
|
109
|
+
throw new Error("useConversationControls must be used within a ConversationProvider");
|
|
110
|
+
}
|
|
111
|
+
return ctx;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=ConversationControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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K,EAAE,KAAK,YAC/C,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,GAAG,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;IACpD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ConversationFeedbackValue = {
|
|
2
|
+
canSendFeedback: boolean;
|
|
3
|
+
sendFeedback: (like: boolean) => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Reads from `ConversationContext` and registers an `onCanSendFeedbackChange`
|
|
7
|
+
* callback. Manages its own `canSendFeedback` state and provides it along with
|
|
8
|
+
* a `sendFeedback` action through `ConversationFeedbackContext`.
|
|
9
|
+
* Must be rendered inside a `ConversationProvider`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ConversationFeedbackProvider({ children, }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current feedback state and a `sendFeedback` action.
|
|
14
|
+
* Re-renders only when `canSendFeedback` changes.
|
|
15
|
+
*
|
|
16
|
+
* Must be used within a `ConversationProvider`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useConversationFeedback(): ConversationFeedbackValue;
|
|
19
|
+
//# sourceMappingURL=ConversationFeedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationFeedback.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationFeedback.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,2CA8BzB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,yBAAyB,CAQnE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from "react";
|
|
3
|
+
import { useRawConversationRef, useRegisterCallbacks } from "./ConversationContext";
|
|
4
|
+
const ConversationFeedbackContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Reads from `ConversationContext` and registers an `onCanSendFeedbackChange`
|
|
7
|
+
* callback. Manages its own `canSendFeedback` state and provides it along with
|
|
8
|
+
* a `sendFeedback` action through `ConversationFeedbackContext`.
|
|
9
|
+
* Must be rendered inside a `ConversationProvider`.
|
|
10
|
+
*/
|
|
11
|
+
export function ConversationFeedbackProvider({ children, }) {
|
|
12
|
+
const conversationRef = useRawConversationRef();
|
|
13
|
+
const [canSendFeedback, setCanSendFeedback] = useState(false);
|
|
14
|
+
useRegisterCallbacks({
|
|
15
|
+
onCanSendFeedbackChange({ canSendFeedback: newValue }) {
|
|
16
|
+
setCanSendFeedback(newValue);
|
|
17
|
+
},
|
|
18
|
+
onDisconnect() {
|
|
19
|
+
setCanSendFeedback(false);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const sendFeedback = useCallback((like) => {
|
|
23
|
+
conversationRef.current?.sendFeedback(like);
|
|
24
|
+
}, [conversationRef]);
|
|
25
|
+
const value = useMemo(() => ({
|
|
26
|
+
canSendFeedback,
|
|
27
|
+
sendFeedback,
|
|
28
|
+
}), [canSendFeedback, sendFeedback]);
|
|
29
|
+
return (_jsx(ConversationFeedbackContext.Provider, { value: value, children: children }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the current feedback state and a `sendFeedback` action.
|
|
33
|
+
* Re-renders only when `canSendFeedback` changes.
|
|
34
|
+
*
|
|
35
|
+
* Must be used within a `ConversationProvider`.
|
|
36
|
+
*/
|
|
37
|
+
export function useConversationFeedback() {
|
|
38
|
+
const ctx = useContext(ConversationFeedbackContext);
|
|
39
|
+
if (!ctx) {
|
|
40
|
+
throw new Error("useConversationFeedback must be used within a ConversationProvider");
|
|
41
|
+
}
|
|
42
|
+
return ctx;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ConversationFeedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationFeedback.js","sourceRoot":"","sources":["../../src/conversation/ConversationFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAOpF,MAAM,2BAA2B,GAC/B,aAAa,CAAmC,IAAI,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,QAAQ,GACgB;IACxB,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;IAChD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,oBAAoB,CAAC;QACnB,uBAAuB,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE;YACnD,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QACD,YAAY;YACV,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,IAAa,EAAE,EAAE;QACjD,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,eAAe;QACf,YAAY;KACb,CAAC,EACF,CAAC,eAAe,EAAE,YAAY,CAAC,CAChC,CAAC;IAEF,OAAO,CACL,KAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC/C,QAAQ,GAC4B,CACxC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,GAAG,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;IACpD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConversationInputValue = {
|
|
2
|
+
isMuted: boolean;
|
|
3
|
+
setMuted: (isMuted: boolean) => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Reads from `ConversationContext` and manages microphone mute state.
|
|
7
|
+
* `setMuted` calls `conversation.setMicMuted()` and updates local state.
|
|
8
|
+
* Must be rendered inside a `ConversationProvider`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ConversationInputProvider({ children, }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current microphone mute state and a function to change it.
|
|
13
|
+
* Re-renders only when the mute state changes.
|
|
14
|
+
*
|
|
15
|
+
* Must be used within a `ConversationProvider`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useConversationInput(): ConversationInputValue;
|
|
18
|
+
//# sourceMappingURL=ConversationInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationInput.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationInput.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,2CA8BzB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAQ7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from "react";
|
|
3
|
+
import { useRawConversationRef, useRegisterCallbacks, } from "./ConversationContext";
|
|
4
|
+
const ConversationInputContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Reads from `ConversationContext` and manages microphone mute state.
|
|
7
|
+
* `setMuted` calls `conversation.setMicMuted()` and updates local state.
|
|
8
|
+
* Must be rendered inside a `ConversationProvider`.
|
|
9
|
+
*/
|
|
10
|
+
export function ConversationInputProvider({ children, }) {
|
|
11
|
+
const conversationRef = useRawConversationRef();
|
|
12
|
+
const [isMuted, setIsMuted] = useState(false);
|
|
13
|
+
useRegisterCallbacks({
|
|
14
|
+
onDisconnect() { setIsMuted(false); },
|
|
15
|
+
});
|
|
16
|
+
const setMuted = useCallback((muted) => {
|
|
17
|
+
const conversation = conversationRef.current;
|
|
18
|
+
if (!conversation) {
|
|
19
|
+
throw new Error("No active conversation. Call startSession() first.");
|
|
20
|
+
}
|
|
21
|
+
conversation.setMicMuted(muted);
|
|
22
|
+
setIsMuted(muted);
|
|
23
|
+
}, [conversationRef]);
|
|
24
|
+
const value = useMemo(() => ({ isMuted, setMuted }), [isMuted, setMuted]);
|
|
25
|
+
return (_jsx(ConversationInputContext.Provider, { value: value, children: children }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the current microphone mute state and a function to change it.
|
|
29
|
+
* Re-renders only when the mute state changes.
|
|
30
|
+
*
|
|
31
|
+
* Must be used within a `ConversationProvider`.
|
|
32
|
+
*/
|
|
33
|
+
export function useConversationInput() {
|
|
34
|
+
const ctx = useContext(ConversationInputContext);
|
|
35
|
+
if (!ctx) {
|
|
36
|
+
throw new Error("useConversationInput must be used within a ConversationProvider");
|
|
37
|
+
}
|
|
38
|
+
return ctx;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ConversationInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationInput.js","sourceRoot":"","sources":["../../src/conversation/ConversationInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,wBAAwB,GAAG,aAAa,CAC5C,IAAI,CACL,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,QAAQ,GACgB;IACxB,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;IAChD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,oBAAoB,CAAC;QACnB,YAAY,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAc,EAAE,EAAE;QACjB,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC;QAC7C,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,EACD,CAAC,eAAe,CAAC,CAClB,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAC7B,CAAC,OAAO,EAAE,QAAQ,CAAC,CACpB,CAAC;IAEF,OAAO,CACL,KAAC,wBAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC5C,QAAQ,GACyB,CACrC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,GAAG,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ConversationModeValue = {
|
|
2
|
+
mode: "speaking" | "listening";
|
|
3
|
+
isSpeaking: boolean;
|
|
4
|
+
isListening: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Reads from `ConversationContext` and registers an `onModeChange` callback.
|
|
8
|
+
* Manages its own `mode` state and provides it through
|
|
9
|
+
* `ConversationModeContext`. Must be rendered inside a `ConversationProvider`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ConversationModeProvider({ children, }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current conversation mode (speaking/listening) and
|
|
14
|
+
* convenience booleans. Re-renders only when the mode changes.
|
|
15
|
+
*
|
|
16
|
+
* Must be used within a `ConversationProvider`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useConversationMode(): ConversationModeValue;
|
|
19
|
+
//# sourceMappingURL=ConversationMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationMode.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationMode.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,2CA0BzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,CAQ3D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
3
|
+
import { useRegisterCallbacks } from "./ConversationContext";
|
|
4
|
+
const ConversationModeContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Reads from `ConversationContext` and registers an `onModeChange` callback.
|
|
7
|
+
* Manages its own `mode` state and provides it through
|
|
8
|
+
* `ConversationModeContext`. Must be rendered inside a `ConversationProvider`.
|
|
9
|
+
*/
|
|
10
|
+
export function ConversationModeProvider({ children, }) {
|
|
11
|
+
const [mode, setMode] = useState("listening");
|
|
12
|
+
useRegisterCallbacks({
|
|
13
|
+
onModeChange({ mode: newMode }) {
|
|
14
|
+
setMode(newMode);
|
|
15
|
+
},
|
|
16
|
+
onDisconnect() {
|
|
17
|
+
setMode("listening");
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const value = useMemo(() => ({
|
|
21
|
+
mode,
|
|
22
|
+
isSpeaking: mode === "speaking",
|
|
23
|
+
isListening: mode === "listening",
|
|
24
|
+
}), [mode]);
|
|
25
|
+
return (_jsx(ConversationModeContext.Provider, { value: value, children: children }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the current conversation mode (speaking/listening) and
|
|
29
|
+
* convenience booleans. Re-renders only when the mode changes.
|
|
30
|
+
*
|
|
31
|
+
* Must be used within a `ConversationProvider`.
|
|
32
|
+
*/
|
|
33
|
+
export function useConversationMode() {
|
|
34
|
+
const ctx = useContext(ConversationModeContext);
|
|
35
|
+
if (!ctx) {
|
|
36
|
+
throw new Error("useConversationMode must be used within a ConversationProvider");
|
|
37
|
+
}
|
|
38
|
+
return ctx;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ConversationMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationMode.js","sourceRoot":"","sources":["../../src/conversation/ConversationMode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAQ7D,MAAM,uBAAuB,GAAG,aAAa,CAC3C,IAAI,CACL,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,QAAQ,GACgB;IACxB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAO,WAAW,CAAC,CAAC;IAEpD,oBAAoB,CAAC;QACnB,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;YAC5B,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;QACD,YAAY;YACV,OAAO,CAAC,WAAW,CAAC,CAAC;QACvB,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,UAAU,EAAE,IAAI,KAAK,UAAU;QAC/B,WAAW,EAAE,IAAI,KAAK,WAAW;KAClC,CAAC,EACF,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC3C,QAAQ,GACwB,CACpC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type HookOptions } from "./types";
|
|
2
|
+
export type ConversationProviderProps = React.PropsWithChildren<HookOptions>;
|
|
3
|
+
export declare function ConversationProvider({ children, ...defaultOptions }: ConversationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ConversationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationProvider.d.ts","sourceRoot":"","sources":["../../src/conversation/ConversationProvider.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AA0B3C,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAE7E,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,GAAG,cAAc,EAClB,EAAE,yBAAyB,2CA8J3B"}
|