@telnyx/ai-agent-lib 0.1.10 → 0.2.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.
@@ -0,0 +1,3 @@
1
+ import log from "loglevel";
2
+ declare const logger: log.Logger;
3
+ export default logger;
@@ -1,3 +1,3 @@
1
- import type { AgentState } from "../types";
2
- export declare function useAgentState(): AgentState;
3
- export declare function useSetAgentState(): (args_0: AgentState | ((prev: AgentState) => AgentState)) => void;
1
+ import type { AgentStateData } from "../types";
2
+ export declare function useAgentState(): AgentStateData;
3
+ export declare function useSetAgentState(): (args_0: AgentStateData | ((prev: AgentStateData) => AgentStateData)) => void;
package/dist/types.d.ts CHANGED
@@ -11,13 +11,20 @@ export type TranscriptItem = {
11
11
  timestamp: Date;
12
12
  attachments?: Array<Attachment>;
13
13
  };
14
+ export type AgentStateData = {
15
+ state: AgentState;
16
+ /** Round-trip latency in milliseconds from when user stopped speaking until agent response began. Only present when state is "speaking". */
17
+ latencyMs?: number;
18
+ /** UTC timestamp (ISO 8601) when user stopped speaking and thinking state began. Only present when state is "thinking". */
19
+ thinkingStartedAt?: string;
20
+ };
14
21
  export type AIAgentEvents = {
15
22
  "agent.connected": () => void;
16
23
  "agent.disconnected": () => void;
17
24
  "agent.error": (error: Error) => void;
18
25
  "transcript.item": (item: TranscriptItem) => void;
19
26
  "conversation.update": (call: INotification) => void;
20
- "conversation.agent.state": (state: AgentState) => void;
27
+ "conversation.agent.state": (data: AgentStateData) => void;
21
28
  "agent.audio.mute": (muted: boolean) => void;
22
29
  };
23
30
  export type AgentState = "speaking" | "listening" | "thinking";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telnyx/ai-agent-lib",
3
3
  "private": false,
4
- "version": "0.1.10",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -23,7 +23,8 @@
23
23
  "dependencies": {
24
24
  "@telnyx/webrtc": "^2.25.12",
25
25
  "eventemitter3": "^5.0.1",
26
- "jotai": "^2.12.5"
26
+ "jotai": "^2.12.5",
27
+ "loglevel": "^1.9.2"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@eslint/js": "^9.30.1",