@livekit/agents 1.0.34 → 1.0.36
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/dist/cli.cjs.map +1 -1
- package/dist/inference/api_protos.d.cts +4 -4
- package/dist/inference/api_protos.d.ts +4 -4
- package/dist/inference/llm.cjs +30 -3
- package/dist/inference/llm.cjs.map +1 -1
- package/dist/inference/llm.d.cts +3 -1
- package/dist/inference/llm.d.ts +3 -1
- package/dist/inference/llm.d.ts.map +1 -1
- package/dist/inference/llm.js +30 -3
- package/dist/inference/llm.js.map +1 -1
- package/dist/ipc/inference_proc_executor.cjs.map +1 -1
- package/dist/ipc/job_proc_executor.cjs.map +1 -1
- package/dist/ipc/job_proc_lazy_main.cjs +1 -1
- package/dist/ipc/job_proc_lazy_main.cjs.map +1 -1
- package/dist/ipc/job_proc_lazy_main.js +1 -1
- package/dist/ipc/job_proc_lazy_main.js.map +1 -1
- package/dist/llm/chat_context.cjs +20 -2
- package/dist/llm/chat_context.cjs.map +1 -1
- package/dist/llm/chat_context.d.cts +9 -0
- package/dist/llm/chat_context.d.ts +9 -0
- package/dist/llm/chat_context.d.ts.map +1 -1
- package/dist/llm/chat_context.js +20 -2
- package/dist/llm/chat_context.js.map +1 -1
- package/dist/llm/llm.cjs.map +1 -1
- package/dist/llm/llm.d.cts +1 -0
- package/dist/llm/llm.d.ts +1 -0
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js.map +1 -1
- package/dist/llm/provider_format/openai.cjs +43 -20
- package/dist/llm/provider_format/openai.cjs.map +1 -1
- package/dist/llm/provider_format/openai.d.ts.map +1 -1
- package/dist/llm/provider_format/openai.js +43 -20
- package/dist/llm/provider_format/openai.js.map +1 -1
- package/dist/llm/provider_format/openai.test.cjs +35 -0
- package/dist/llm/provider_format/openai.test.cjs.map +1 -1
- package/dist/llm/provider_format/openai.test.js +35 -0
- package/dist/llm/provider_format/openai.test.js.map +1 -1
- package/dist/llm/provider_format/utils.cjs +1 -1
- package/dist/llm/provider_format/utils.cjs.map +1 -1
- package/dist/llm/provider_format/utils.d.ts.map +1 -1
- package/dist/llm/provider_format/utils.js +1 -1
- package/dist/llm/provider_format/utils.js.map +1 -1
- package/dist/voice/agent_activity.cjs +19 -19
- package/dist/voice/agent_activity.cjs.map +1 -1
- package/dist/voice/agent_activity.d.ts.map +1 -1
- package/dist/voice/agent_activity.js +19 -19
- package/dist/voice/agent_activity.js.map +1 -1
- package/dist/voice/agent_session.cjs +64 -25
- package/dist/voice/agent_session.cjs.map +1 -1
- package/dist/voice/agent_session.d.cts +25 -1
- package/dist/voice/agent_session.d.ts +25 -1
- package/dist/voice/agent_session.d.ts.map +1 -1
- package/dist/voice/agent_session.js +64 -25
- package/dist/voice/agent_session.js.map +1 -1
- package/dist/voice/background_audio.cjs.map +1 -1
- package/dist/voice/generation.cjs +2 -1
- package/dist/voice/generation.cjs.map +1 -1
- package/dist/voice/generation.d.ts.map +1 -1
- package/dist/voice/generation.js +2 -1
- package/dist/voice/generation.js.map +1 -1
- package/dist/voice/index.cjs +14 -1
- package/dist/voice/index.cjs.map +1 -1
- package/dist/voice/index.d.cts +1 -0
- package/dist/voice/index.d.ts +1 -0
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +3 -1
- package/dist/voice/index.js.map +1 -1
- package/dist/voice/room_io/room_io.cjs +1 -0
- package/dist/voice/room_io/room_io.cjs.map +1 -1
- package/dist/voice/room_io/room_io.d.ts.map +1 -1
- package/dist/voice/room_io/room_io.js +1 -0
- package/dist/voice/room_io/room_io.js.map +1 -1
- package/dist/voice/speech_handle.cjs +12 -3
- package/dist/voice/speech_handle.cjs.map +1 -1
- package/dist/voice/speech_handle.d.cts +12 -2
- package/dist/voice/speech_handle.d.ts +12 -2
- package/dist/voice/speech_handle.d.ts.map +1 -1
- package/dist/voice/speech_handle.js +10 -2
- package/dist/voice/speech_handle.js.map +1 -1
- package/dist/voice/testing/index.cjs +52 -0
- package/dist/voice/testing/index.cjs.map +1 -0
- package/dist/voice/testing/index.d.cts +20 -0
- package/dist/voice/testing/index.d.ts +20 -0
- package/dist/voice/testing/index.d.ts.map +1 -0
- package/dist/voice/testing/index.js +31 -0
- package/dist/voice/testing/index.js.map +1 -0
- package/dist/voice/testing/run_result.cjs +477 -0
- package/dist/voice/testing/run_result.cjs.map +1 -0
- package/dist/voice/testing/run_result.d.cts +226 -0
- package/dist/voice/testing/run_result.d.ts +226 -0
- package/dist/voice/testing/run_result.d.ts.map +1 -0
- package/dist/voice/testing/run_result.js +451 -0
- package/dist/voice/testing/run_result.js.map +1 -0
- package/dist/voice/testing/types.cjs +46 -0
- package/dist/voice/testing/types.cjs.map +1 -0
- package/dist/voice/testing/types.d.cts +83 -0
- package/dist/voice/testing/types.d.ts +83 -0
- package/dist/voice/testing/types.d.ts.map +1 -0
- package/dist/voice/testing/types.js +19 -0
- package/dist/voice/testing/types.js.map +1 -0
- package/package.json +3 -3
- package/src/inference/llm.ts +42 -3
- package/src/ipc/job_proc_lazy_main.ts +1 -1
- package/src/llm/chat_context.ts +32 -2
- package/src/llm/llm.ts +1 -0
- package/src/llm/provider_format/openai.test.ts +40 -0
- package/src/llm/provider_format/openai.ts +46 -19
- package/src/llm/provider_format/utils.ts +5 -1
- package/src/voice/agent_activity.ts +24 -22
- package/src/voice/agent_session.ts +73 -28
- package/src/voice/generation.ts +1 -0
- package/src/voice/index.ts +1 -0
- package/src/voice/room_io/room_io.ts +1 -0
- package/src/voice/speech_handle.ts +24 -4
- package/src/voice/testing/index.ts +49 -0
- package/src/voice/testing/run_result.ts +576 -0
- package/src/voice/testing/types.ts +118 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { AgentHandoffItem, ChatItem } from '../../llm/chat_context.js';
|
|
2
|
+
import type { Task } from '../../utils.js';
|
|
3
|
+
import type { Agent } from '../agent.js';
|
|
4
|
+
import { type SpeechHandle } from '../speech_handle.js';
|
|
5
|
+
import { type AgentHandoffAssertOptions, type AgentHandoffEvent, type ChatMessageEvent, type EventType, type FunctionCallAssertOptions, type FunctionCallEvent, type FunctionCallOutputAssertOptions, type FunctionCallOutputEvent, type MessageAssertOptions, type RunEvent } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Result of a test run containing recorded events and assertion utilities.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const result = await session.run({ userInput: 'Hello' });
|
|
12
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
13
|
+
* result.expect.noMoreEvents();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class RunResult<T = unknown> {
|
|
17
|
+
private _events;
|
|
18
|
+
private doneFut;
|
|
19
|
+
private userInput?;
|
|
20
|
+
private handles;
|
|
21
|
+
private lastSpeechHandle?;
|
|
22
|
+
private runAssert?;
|
|
23
|
+
constructor(options?: {
|
|
24
|
+
userInput?: string;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* List of all recorded events generated during the run.
|
|
28
|
+
*/
|
|
29
|
+
get events(): RunEvent[];
|
|
30
|
+
/**
|
|
31
|
+
* Provides an assertion helper for verifying the run events.
|
|
32
|
+
*/
|
|
33
|
+
get expect(): RunAssert;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the final output of the run after completion.
|
|
36
|
+
*
|
|
37
|
+
* @throws Error - Not implemented yet.
|
|
38
|
+
*/
|
|
39
|
+
get finalOutput(): T;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether the run has finished processing all events.
|
|
42
|
+
*/
|
|
43
|
+
done(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Wait for the RunResult to complete. Returns `this` for method chaining.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const result = session.run({ userInput: 'Hi!' });
|
|
50
|
+
* await result.wait(); // waits for completion
|
|
51
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
wait(): Promise<this>;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
* Records an agent handoff event.
|
|
58
|
+
*/
|
|
59
|
+
_agentHandoff(params: {
|
|
60
|
+
item: AgentHandoffItem;
|
|
61
|
+
oldAgent?: Agent;
|
|
62
|
+
newAgent: Agent;
|
|
63
|
+
}): void;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
* Called when a chat item is added during the run.
|
|
67
|
+
*/
|
|
68
|
+
_itemAdded(item: ChatItem): void;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
* Watch a speech handle or task for completion.
|
|
72
|
+
*/
|
|
73
|
+
_watchHandle(handle: SpeechHandle | Task<void>): void;
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
* Unwatch a handle.
|
|
77
|
+
*/
|
|
78
|
+
_unwatchHandle(handle: SpeechHandle | Task<void>): void;
|
|
79
|
+
private _markDoneIfNeeded;
|
|
80
|
+
private _markDone;
|
|
81
|
+
/**
|
|
82
|
+
* Find the correct insertion index to maintain chronological order.
|
|
83
|
+
*/
|
|
84
|
+
private _findInsertionIndex;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Assertion helper for verifying run events in sequence.
|
|
88
|
+
*/
|
|
89
|
+
export declare class RunAssert {
|
|
90
|
+
private _events;
|
|
91
|
+
private _currentIndex;
|
|
92
|
+
constructor(runResult: RunResult);
|
|
93
|
+
/**
|
|
94
|
+
* Access a specific event by index for assertions.
|
|
95
|
+
* Supports negative indices (e.g., -1 for last event).
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* result.expect.at(0).isMessage({ role: 'user' });
|
|
100
|
+
* result.expect.at(-1).isMessage({ role: 'assistant' });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
at(index: number): EventAssert;
|
|
104
|
+
/**
|
|
105
|
+
* Advance to the next event, optionally filtering by type.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
110
|
+
* result.expect.nextEvent({ type: 'function_call' }).isFunctionCall({ name: 'foo' });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
nextEvent(options?: {
|
|
114
|
+
type?: EventType;
|
|
115
|
+
}): EventAssert;
|
|
116
|
+
/**
|
|
117
|
+
* Skip a specified number of upcoming events without assertions.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* result.expect.skipNext(2);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
skipNext(count?: number): this;
|
|
125
|
+
/**
|
|
126
|
+
* Assert that there are no further events.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* result.expect.noMoreEvents();
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
noMoreEvents(): void;
|
|
134
|
+
private _currentEvent;
|
|
135
|
+
/** @internal */
|
|
136
|
+
_raiseWithDebugInfo(message: string, index?: number): never;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Assertion wrapper for a single event.
|
|
140
|
+
*/
|
|
141
|
+
export declare class EventAssert {
|
|
142
|
+
protected _event: RunEvent;
|
|
143
|
+
protected _parent: RunAssert;
|
|
144
|
+
protected _index: number;
|
|
145
|
+
constructor(event: RunEvent, parent: RunAssert, index: number);
|
|
146
|
+
/**
|
|
147
|
+
* Get the underlying event.
|
|
148
|
+
*/
|
|
149
|
+
event(): RunEvent;
|
|
150
|
+
protected _raise(message: string): never;
|
|
151
|
+
/**
|
|
152
|
+
* Verify this event is a message with optional role matching.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
isMessage(options?: MessageAssertOptions): MessageAssert;
|
|
160
|
+
/**
|
|
161
|
+
* Verify this event is a function call with optional name/args matching.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* result.expect.nextEvent().isFunctionCall({ name: 'order_item', args: { id: 'big_mac' } });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
isFunctionCall(options?: FunctionCallAssertOptions): FunctionCallAssert;
|
|
169
|
+
/**
|
|
170
|
+
* Verify this event is a function call output with optional matching.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* result.expect.nextEvent().isFunctionCallOutput({ isError: false });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
isFunctionCallOutput(options?: FunctionCallOutputAssertOptions): FunctionCallOutputAssert;
|
|
178
|
+
/**
|
|
179
|
+
* Verify this event is an agent handoff with optional type matching.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* result.expect.nextEvent().isAgentHandoff({ newAgentType: MyAgent });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
isAgentHandoff(options?: AgentHandoffAssertOptions): AgentHandoffAssert;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Assertion wrapper for message events.
|
|
190
|
+
*/
|
|
191
|
+
export declare class MessageAssert extends EventAssert {
|
|
192
|
+
protected _event: ChatMessageEvent;
|
|
193
|
+
constructor(event: ChatMessageEvent, parent: RunAssert, index: number);
|
|
194
|
+
event(): ChatMessageEvent;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Assertion wrapper for function call events.
|
|
198
|
+
*/
|
|
199
|
+
export declare class FunctionCallAssert extends EventAssert {
|
|
200
|
+
protected _event: FunctionCallEvent;
|
|
201
|
+
constructor(event: FunctionCallEvent, parent: RunAssert, index: number);
|
|
202
|
+
event(): FunctionCallEvent;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Assertion wrapper for function call output events.
|
|
206
|
+
*/
|
|
207
|
+
export declare class FunctionCallOutputAssert extends EventAssert {
|
|
208
|
+
protected _event: FunctionCallOutputEvent;
|
|
209
|
+
constructor(event: FunctionCallOutputEvent, parent: RunAssert, index: number);
|
|
210
|
+
event(): FunctionCallOutputEvent;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Assertion wrapper for agent handoff events.
|
|
214
|
+
*/
|
|
215
|
+
export declare class AgentHandoffAssert extends EventAssert {
|
|
216
|
+
protected _event: AgentHandoffEvent;
|
|
217
|
+
constructor(event: AgentHandoffEvent, parent: RunAssert, index: number);
|
|
218
|
+
event(): AgentHandoffEvent;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Custom assertion error for test failures.
|
|
222
|
+
*/
|
|
223
|
+
export declare class AssertionError extends Error {
|
|
224
|
+
constructor(message: string);
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=run_result.d.ts.map
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { AgentHandoffItem, ChatItem } from '../../llm/chat_context.js';
|
|
2
|
+
import type { Task } from '../../utils.js';
|
|
3
|
+
import type { Agent } from '../agent.js';
|
|
4
|
+
import { type SpeechHandle } from '../speech_handle.js';
|
|
5
|
+
import { type AgentHandoffAssertOptions, type AgentHandoffEvent, type ChatMessageEvent, type EventType, type FunctionCallAssertOptions, type FunctionCallEvent, type FunctionCallOutputAssertOptions, type FunctionCallOutputEvent, type MessageAssertOptions, type RunEvent } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Result of a test run containing recorded events and assertion utilities.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const result = await session.run({ userInput: 'Hello' });
|
|
12
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
13
|
+
* result.expect.noMoreEvents();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class RunResult<T = unknown> {
|
|
17
|
+
private _events;
|
|
18
|
+
private doneFut;
|
|
19
|
+
private userInput?;
|
|
20
|
+
private handles;
|
|
21
|
+
private lastSpeechHandle?;
|
|
22
|
+
private runAssert?;
|
|
23
|
+
constructor(options?: {
|
|
24
|
+
userInput?: string;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* List of all recorded events generated during the run.
|
|
28
|
+
*/
|
|
29
|
+
get events(): RunEvent[];
|
|
30
|
+
/**
|
|
31
|
+
* Provides an assertion helper for verifying the run events.
|
|
32
|
+
*/
|
|
33
|
+
get expect(): RunAssert;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the final output of the run after completion.
|
|
36
|
+
*
|
|
37
|
+
* @throws Error - Not implemented yet.
|
|
38
|
+
*/
|
|
39
|
+
get finalOutput(): T;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether the run has finished processing all events.
|
|
42
|
+
*/
|
|
43
|
+
done(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Wait for the RunResult to complete. Returns `this` for method chaining.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const result = session.run({ userInput: 'Hi!' });
|
|
50
|
+
* await result.wait(); // waits for completion
|
|
51
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
wait(): Promise<this>;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
* Records an agent handoff event.
|
|
58
|
+
*/
|
|
59
|
+
_agentHandoff(params: {
|
|
60
|
+
item: AgentHandoffItem;
|
|
61
|
+
oldAgent?: Agent;
|
|
62
|
+
newAgent: Agent;
|
|
63
|
+
}): void;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
* Called when a chat item is added during the run.
|
|
67
|
+
*/
|
|
68
|
+
_itemAdded(item: ChatItem): void;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
* Watch a speech handle or task for completion.
|
|
72
|
+
*/
|
|
73
|
+
_watchHandle(handle: SpeechHandle | Task<void>): void;
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
* Unwatch a handle.
|
|
77
|
+
*/
|
|
78
|
+
_unwatchHandle(handle: SpeechHandle | Task<void>): void;
|
|
79
|
+
private _markDoneIfNeeded;
|
|
80
|
+
private _markDone;
|
|
81
|
+
/**
|
|
82
|
+
* Find the correct insertion index to maintain chronological order.
|
|
83
|
+
*/
|
|
84
|
+
private _findInsertionIndex;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Assertion helper for verifying run events in sequence.
|
|
88
|
+
*/
|
|
89
|
+
export declare class RunAssert {
|
|
90
|
+
private _events;
|
|
91
|
+
private _currentIndex;
|
|
92
|
+
constructor(runResult: RunResult);
|
|
93
|
+
/**
|
|
94
|
+
* Access a specific event by index for assertions.
|
|
95
|
+
* Supports negative indices (e.g., -1 for last event).
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* result.expect.at(0).isMessage({ role: 'user' });
|
|
100
|
+
* result.expect.at(-1).isMessage({ role: 'assistant' });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
at(index: number): EventAssert;
|
|
104
|
+
/**
|
|
105
|
+
* Advance to the next event, optionally filtering by type.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
110
|
+
* result.expect.nextEvent({ type: 'function_call' }).isFunctionCall({ name: 'foo' });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
nextEvent(options?: {
|
|
114
|
+
type?: EventType;
|
|
115
|
+
}): EventAssert;
|
|
116
|
+
/**
|
|
117
|
+
* Skip a specified number of upcoming events without assertions.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* result.expect.skipNext(2);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
skipNext(count?: number): this;
|
|
125
|
+
/**
|
|
126
|
+
* Assert that there are no further events.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* result.expect.noMoreEvents();
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
noMoreEvents(): void;
|
|
134
|
+
private _currentEvent;
|
|
135
|
+
/** @internal */
|
|
136
|
+
_raiseWithDebugInfo(message: string, index?: number): never;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Assertion wrapper for a single event.
|
|
140
|
+
*/
|
|
141
|
+
export declare class EventAssert {
|
|
142
|
+
protected _event: RunEvent;
|
|
143
|
+
protected _parent: RunAssert;
|
|
144
|
+
protected _index: number;
|
|
145
|
+
constructor(event: RunEvent, parent: RunAssert, index: number);
|
|
146
|
+
/**
|
|
147
|
+
* Get the underlying event.
|
|
148
|
+
*/
|
|
149
|
+
event(): RunEvent;
|
|
150
|
+
protected _raise(message: string): never;
|
|
151
|
+
/**
|
|
152
|
+
* Verify this event is a message with optional role matching.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* result.expect.nextEvent().isMessage({ role: 'assistant' });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
isMessage(options?: MessageAssertOptions): MessageAssert;
|
|
160
|
+
/**
|
|
161
|
+
* Verify this event is a function call with optional name/args matching.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* result.expect.nextEvent().isFunctionCall({ name: 'order_item', args: { id: 'big_mac' } });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
isFunctionCall(options?: FunctionCallAssertOptions): FunctionCallAssert;
|
|
169
|
+
/**
|
|
170
|
+
* Verify this event is a function call output with optional matching.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* result.expect.nextEvent().isFunctionCallOutput({ isError: false });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
isFunctionCallOutput(options?: FunctionCallOutputAssertOptions): FunctionCallOutputAssert;
|
|
178
|
+
/**
|
|
179
|
+
* Verify this event is an agent handoff with optional type matching.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* result.expect.nextEvent().isAgentHandoff({ newAgentType: MyAgent });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
isAgentHandoff(options?: AgentHandoffAssertOptions): AgentHandoffAssert;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Assertion wrapper for message events.
|
|
190
|
+
*/
|
|
191
|
+
export declare class MessageAssert extends EventAssert {
|
|
192
|
+
protected _event: ChatMessageEvent;
|
|
193
|
+
constructor(event: ChatMessageEvent, parent: RunAssert, index: number);
|
|
194
|
+
event(): ChatMessageEvent;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Assertion wrapper for function call events.
|
|
198
|
+
*/
|
|
199
|
+
export declare class FunctionCallAssert extends EventAssert {
|
|
200
|
+
protected _event: FunctionCallEvent;
|
|
201
|
+
constructor(event: FunctionCallEvent, parent: RunAssert, index: number);
|
|
202
|
+
event(): FunctionCallEvent;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Assertion wrapper for function call output events.
|
|
206
|
+
*/
|
|
207
|
+
export declare class FunctionCallOutputAssert extends EventAssert {
|
|
208
|
+
protected _event: FunctionCallOutputEvent;
|
|
209
|
+
constructor(event: FunctionCallOutputEvent, parent: RunAssert, index: number);
|
|
210
|
+
event(): FunctionCallOutputEvent;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Assertion wrapper for agent handoff events.
|
|
214
|
+
*/
|
|
215
|
+
export declare class AgentHandoffAssert extends EventAssert {
|
|
216
|
+
protected _event: AgentHandoffEvent;
|
|
217
|
+
constructor(event: AgentHandoffEvent, parent: RunAssert, index: number);
|
|
218
|
+
event(): AgentHandoffEvent;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Custom assertion error for test failures.
|
|
222
|
+
*/
|
|
223
|
+
export declare class AssertionError extends Error {
|
|
224
|
+
constructor(message: string);
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=run_result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_result.d.ts","sourceRoot":"","sources":["../../../src/voice/testing/run_result.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EAKd,MAAM,YAAY,CAAC;AAKpB;;;;;;;;;GASG;AACH,qBAAa,SAAS,CAAC,CAAC,GAAG,OAAO;IAChC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B,OAAO,CAAC,OAAO,CAA6C;IAC5D,OAAO,CAAC,gBAAgB,CAAC,CAAe;IACxC,OAAO,CAAC,SAAS,CAAC,CAAY;gBAQlB,OAAO,CAAC,EAAE;QAAE,SAA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