@telnyx/ai-agent-lib 0.1.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 ADDED
@@ -0,0 +1,3 @@
1
+ # Telnyx AI Agent Library
2
+
3
+ This library provides a set of tools and utilities for building AI agents that can interact with Telnyx's services. It includes components for managing audio streams, handling agent states, and more.
@@ -0,0 +1,3 @@
1
+ import EventEmitter from "eventemitter3";
2
+ import type { AgentStateEvents } from "./types";
3
+ export declare const agentStateBus: EventEmitter<AgentStateEvents, any>;
@@ -0,0 +1,11 @@
1
+ export declare class AudioStreamMonitor {
2
+ private animationFrameId;
3
+ private stream;
4
+ private audioContext;
5
+ private source;
6
+ private analyser;
7
+ private updateAgentState;
8
+ setMonitoredAudioStream(stream: MediaStream): void;
9
+ stopAudioStreamMonitor(): void;
10
+ startAudioStreamMonitor(): void;
11
+ }
@@ -0,0 +1,27 @@
1
+ import { Call } from "@telnyx/webrtc";
2
+ import EventEmitter from "eventemitter3";
3
+ import type { AIAgentEvents, TranscriptItem } from "./types";
4
+ export type TelnyxAIAgentConstructorParams = {
5
+ agentId: string;
6
+ versionId?: string;
7
+ environment?: "production" | "development";
8
+ };
9
+ export declare class TelnyxAIAgent extends EventEmitter<AIAgentEvents> {
10
+ private telnyxRTC;
11
+ private transcription;
12
+ agentId: string;
13
+ versionId: string;
14
+ private audioStreamMonitor;
15
+ activeCall: Call | null;
16
+ constructor(params: TelnyxAIAgentConstructorParams);
17
+ connect(): Promise<void>;
18
+ disconnect(): Promise<void>;
19
+ get transcript(): TranscriptItem[];
20
+ startConversation(): Promise<void>;
21
+ endConversation(): void | undefined;
22
+ private onClientReady;
23
+ private onClientOrSocketError;
24
+ private onNotification;
25
+ private onTranscriptItem;
26
+ private onAgentStateChange;
27
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./client";
2
+ export * from "./react/client-context";
3
+ export * from "./react/use-transcript";
4
+ export * from "./react/use-client-connection-state";
5
+ export * from "./react/use-client";
6
+ export * from "./react/use-conversation";
7
+ export * from "./react/use-agent-state";