@telnyx/ai-agent-lib 0.2.5 → 0.2.8
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 +5 -0
- package/package.json +17 -6
- package/dist/agent-state.d.ts +0 -3
- package/dist/audio-stream-monitor.d.ts +0 -55
- package/dist/client.d.ts +0 -109
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -4113
- package/dist/logger.d.ts +0 -3
- package/dist/message.d.ts +0 -50
- package/dist/react/agent-state-auto-update.d.ts +0 -1
- package/dist/react/client-context.d.ts +0 -5
- package/dist/react/connection-state-auto-update.d.ts +0 -1
- package/dist/react/conversation-auto-update.d.ts +0 -1
- package/dist/react/transcript-auto-update.d.ts +0 -1
- package/dist/react/use-agent-state.d.ts +0 -3
- package/dist/react/use-client-connection-state.d.ts +0 -3
- package/dist/react/use-client.d.ts +0 -1
- package/dist/react/use-conversation.d.ts +0 -3
- package/dist/react/use-transcript.d.ts +0 -3
- package/dist/transcript.d.ts +0 -9
- package/dist/types.d.ts +0 -67
- package/dist/util.d.ts +0 -2
package/dist/logger.d.ts
DELETED
package/dist/message.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type TranscriptMessage = {
|
|
2
|
-
id: string;
|
|
3
|
-
jsonrpc: "2.0";
|
|
4
|
-
method: "ai_conversation";
|
|
5
|
-
params: {
|
|
6
|
-
type: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare function isTranscriptMessage(msg: unknown): msg is TranscriptMessage;
|
|
10
|
-
export type ResponseTextDelta = {
|
|
11
|
-
id: string;
|
|
12
|
-
jsonrpc: "2.0";
|
|
13
|
-
method: "ai_conversation";
|
|
14
|
-
params: {
|
|
15
|
-
content_index: number;
|
|
16
|
-
delta: string;
|
|
17
|
-
item_id: string;
|
|
18
|
-
output_index: number;
|
|
19
|
-
response_id: string;
|
|
20
|
-
type: "response.text.delta";
|
|
21
|
-
};
|
|
22
|
-
voice_sdk_id: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function isResponseTextDelta(message: unknown): message is ResponseTextDelta;
|
|
25
|
-
export type ConversationItemCreatedMessage = {
|
|
26
|
-
id: string;
|
|
27
|
-
jsonrpc: "2.0";
|
|
28
|
-
method: "ai_conversation";
|
|
29
|
-
params: {
|
|
30
|
-
item: {
|
|
31
|
-
content: Array<{
|
|
32
|
-
text: string;
|
|
33
|
-
type: "text";
|
|
34
|
-
} | {
|
|
35
|
-
image_url: {
|
|
36
|
-
url: string;
|
|
37
|
-
};
|
|
38
|
-
type: "image_url";
|
|
39
|
-
}> | string;
|
|
40
|
-
id: string;
|
|
41
|
-
role: string;
|
|
42
|
-
status: string;
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
previous_item_id: string;
|
|
46
|
-
type: "conversation.item.created";
|
|
47
|
-
};
|
|
48
|
-
voice_sdk_id: string;
|
|
49
|
-
};
|
|
50
|
-
export declare function isConversationItemCreatedMessage(message: unknown): message is ConversationItemCreatedMessage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function AgentStateAutoUpdate(): null;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from "react";
|
|
2
|
-
import type { TelnyxAIAgentConstructorParams } from "../client";
|
|
3
|
-
import { TelnyxAIAgent } from "../client";
|
|
4
|
-
export declare const ClientContext: import("react").Context<TelnyxAIAgent | null>;
|
|
5
|
-
export declare const TelnyxAIAgentProvider: ({ children, agentId, environment, versionId, debug, vad, }: PropsWithChildren & TelnyxAIAgentConstructorParams) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ConnectionStateAutoUpdate(): null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ConversationAutoUpdate: () => null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function TranscriptAutoUpdate(): null;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export type ConnectionState = "connecting" | "connected" | "disconnected" | "error";
|
|
2
|
-
export declare function useConnectionState(): ConnectionState;
|
|
3
|
-
export declare function useSetConnectionState(): (args_0: ConnectionState | ((prev: ConnectionState) => ConnectionState)) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useClient: () => import("..").TelnyxAIAgent;
|
package/dist/transcript.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "eventemitter3";
|
|
2
|
-
import type { TranscriptEvents, TranscriptItem } from "./types";
|
|
3
|
-
import { TelnyxRTC } from "@telnyx/webrtc";
|
|
4
|
-
export declare class Transcription extends EventEmitter<TranscriptEvents> {
|
|
5
|
-
private telnyxRTC;
|
|
6
|
-
transcript: TranscriptItem[];
|
|
7
|
-
constructor(client: TelnyxRTC);
|
|
8
|
-
private onSocketMessage;
|
|
9
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { INotification, Call, ICallOptions } from "@telnyx/webrtc";
|
|
2
|
-
import { SwEvent } from "@telnyx/webrtc";
|
|
3
|
-
export type Attachment = {
|
|
4
|
-
type: "image";
|
|
5
|
-
url: string;
|
|
6
|
-
};
|
|
7
|
-
export type TranscriptItem = {
|
|
8
|
-
id: string;
|
|
9
|
-
role: "user" | "assistant";
|
|
10
|
-
content: string;
|
|
11
|
-
timestamp: Date;
|
|
12
|
-
attachments?: Array<Attachment>;
|
|
13
|
-
};
|
|
14
|
-
export type AgentStateData = {
|
|
15
|
-
state: AgentState;
|
|
16
|
-
/** Latency in milliseconds from when user stopped speaking until agent response began. Only present when state is "speaking". */
|
|
17
|
-
userPerceivedLatencyMs?: number;
|
|
18
|
-
/** Latency in milliseconds for the initial agent greeting (first speech). Only present on first "speaking" state. */
|
|
19
|
-
greetingLatencyMs?: number;
|
|
20
|
-
/** UTC timestamp (ISO 8601) when user stopped speaking and thinking state began. Only present when state is "thinking". */
|
|
21
|
-
thinkingStartedAt?: string;
|
|
22
|
-
};
|
|
23
|
-
export type AIAgentEvents = {
|
|
24
|
-
"agent.connected": () => void;
|
|
25
|
-
"agent.disconnected": () => void;
|
|
26
|
-
"agent.error": (error: Error) => void;
|
|
27
|
-
"transcript.item": (item: TranscriptItem) => void;
|
|
28
|
-
"conversation.update": (call: INotification) => void;
|
|
29
|
-
"conversation.agent.state": (data: AgentStateData) => void;
|
|
30
|
-
"agent.audio.mute": (muted: boolean) => void;
|
|
31
|
-
};
|
|
32
|
-
export type AgentState = "speaking" | "listening" | "thinking";
|
|
33
|
-
export type TranscriptEvents = Pick<AIAgentEvents, "transcript.item">;
|
|
34
|
-
export type AgentStateEvents = Pick<AIAgentEvents, "conversation.agent.state">;
|
|
35
|
-
/**
|
|
36
|
-
* Configuration options for Voice Activity Detection (VAD).
|
|
37
|
-
* These thresholds control how the library detects user speech and measures latency.
|
|
38
|
-
*/
|
|
39
|
-
export type VADOptions = {
|
|
40
|
-
/**
|
|
41
|
-
* Volume threshold (0-255) for detecting speech.
|
|
42
|
-
* Audio levels above this value are considered speech.
|
|
43
|
-
* @default 10
|
|
44
|
-
*/
|
|
45
|
-
volumeThreshold?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Duration of silence (ms) before triggering "thinking" state.
|
|
48
|
-
* Lower values = faster response but may cut off natural pauses.
|
|
49
|
-
* Higher values = more tolerant of pauses but slower state transitions.
|
|
50
|
-
* @default 1000
|
|
51
|
-
*/
|
|
52
|
-
silenceDurationMs?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Minimum speech duration (ms) to count as real user speech.
|
|
55
|
-
* Filters out brief noise spikes. Short words like "yes"/"no" are ~150ms.
|
|
56
|
-
* @default 100
|
|
57
|
-
*/
|
|
58
|
-
minSpeechDurationMs?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Maximum latency (ms) to report. Values above this are considered
|
|
61
|
-
* stale (likely from old noise) and won't be reported.
|
|
62
|
-
* @default undefined (no limit)
|
|
63
|
-
*/
|
|
64
|
-
maxLatencyMs?: number;
|
|
65
|
-
};
|
|
66
|
-
export type { INotification, Call, ICallOptions };
|
|
67
|
-
export { SwEvent };
|
package/dist/util.d.ts
DELETED