@elizaos/test-utils 1.2.2
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/.npmignore +5 -0
- package/LICENSE +21 -0
- package/README.md +255 -0
- package/dist/index.d.ts +950 -0
- package/dist/index.js +3013 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
- package/tsup.config.ts +20 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
import * as _elizaos_core from '@elizaos/core';
|
|
2
|
+
import { TextGenerationParams, TextEmbeddingParams, IAgentRuntime, Character, Plugin, Memory, Content, IDatabaseAdapter, UUID, State, ActionResult, Action, Provider, Evaluator, Media, Service, ServiceTypeName, ProviderResult } from '@elizaos/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Realistic Test Model Provider - Provides configurable but realistic AI model responses
|
|
6
|
+
* Replaces hardcoded mock responses with intelligent, context-aware responses
|
|
7
|
+
*/
|
|
8
|
+
declare class TestModelProvider {
|
|
9
|
+
private responses;
|
|
10
|
+
private patterns;
|
|
11
|
+
private defaultResponse;
|
|
12
|
+
private contextHistory;
|
|
13
|
+
constructor(defaultResponse?: string, _options?: {
|
|
14
|
+
enableContextMemory?: boolean;
|
|
15
|
+
maxContextHistory?: number;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Add realistic default response patterns
|
|
19
|
+
*/
|
|
20
|
+
private addDefaultPatterns;
|
|
21
|
+
/**
|
|
22
|
+
* Generate text response based on prompt
|
|
23
|
+
*/
|
|
24
|
+
generateText(params: TextGenerationParams): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Generate embeddings for text (mock implementation with consistent vectors)
|
|
27
|
+
*/
|
|
28
|
+
generateEmbedding(params: TextEmbeddingParams): Promise<number[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Generate object-structured responses
|
|
31
|
+
*/
|
|
32
|
+
generateObject(params: any): Promise<Record<string, any>>;
|
|
33
|
+
/**
|
|
34
|
+
* Make response more contextual based on prompt content
|
|
35
|
+
*/
|
|
36
|
+
private makeContextual;
|
|
37
|
+
/**
|
|
38
|
+
* Generate intelligent default response based on prompt analysis
|
|
39
|
+
*/
|
|
40
|
+
private generateIntelligentDefault;
|
|
41
|
+
/**
|
|
42
|
+
* Extract key terms from prompt for contextualization
|
|
43
|
+
*/
|
|
44
|
+
private extractKeyTerms;
|
|
45
|
+
/**
|
|
46
|
+
* Simple hash function for deterministic embeddings
|
|
47
|
+
*/
|
|
48
|
+
private simpleHash;
|
|
49
|
+
/**
|
|
50
|
+
* Add interaction to context history
|
|
51
|
+
*/
|
|
52
|
+
private addToHistory;
|
|
53
|
+
/**
|
|
54
|
+
* Set a specific response for a prompt
|
|
55
|
+
*/
|
|
56
|
+
setResponse(prompt: string, response: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Add a pattern-based response
|
|
59
|
+
*/
|
|
60
|
+
addPattern(pattern: RegExp, response: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Set the default response
|
|
63
|
+
*/
|
|
64
|
+
setDefaultResponse(response: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Clear all custom responses and patterns
|
|
67
|
+
*/
|
|
68
|
+
clear(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get conversation history
|
|
71
|
+
*/
|
|
72
|
+
getHistory(): Array<{
|
|
73
|
+
prompt: string;
|
|
74
|
+
response: string;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a test model provider with specific scenarios
|
|
79
|
+
*/
|
|
80
|
+
declare function createTestModelProvider(scenarios?: Array<{
|
|
81
|
+
prompt: RegExp | string;
|
|
82
|
+
response: string;
|
|
83
|
+
}>, defaultResponse?: string): TestModelProvider;
|
|
84
|
+
/**
|
|
85
|
+
* Create specialized model provider for different types of testing
|
|
86
|
+
*/
|
|
87
|
+
declare function createSpecializedModelProvider(type: 'conversational' | 'analytical' | 'creative' | 'factual'): TestModelProvider;
|
|
88
|
+
/**
|
|
89
|
+
* Model handler wrapper that integrates with ElizaOS runtime
|
|
90
|
+
*/
|
|
91
|
+
declare function createModelHandler(provider: TestModelProvider): (runtime: IAgentRuntime, params: any) => Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Test scenario builder for common testing patterns
|
|
94
|
+
*/
|
|
95
|
+
declare class TestScenarioBuilder {
|
|
96
|
+
private scenarios;
|
|
97
|
+
addGreeting(response?: string): this;
|
|
98
|
+
addTaskCreation(response?: string): this;
|
|
99
|
+
addSearch(response?: string): this;
|
|
100
|
+
addCustom(prompt: RegExp | string, response: string): this;
|
|
101
|
+
build(defaultResponse?: string): TestModelProvider;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Convenience function to quickly create test scenarios
|
|
105
|
+
*/
|
|
106
|
+
declare function scenarios(): TestScenarioBuilder;
|
|
107
|
+
|
|
108
|
+
interface RuntimeConfig {
|
|
109
|
+
character: Character;
|
|
110
|
+
plugins: Array<Plugin | string>;
|
|
111
|
+
databaseUrl?: string;
|
|
112
|
+
apiKeys: Record<string, string>;
|
|
113
|
+
modelProviders?: Record<string, any>;
|
|
114
|
+
isolated?: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface RealRuntimeTestResult {
|
|
117
|
+
scenarioName: string;
|
|
118
|
+
passed: boolean;
|
|
119
|
+
errors: string[];
|
|
120
|
+
executedActions: string[];
|
|
121
|
+
createdMemories: number;
|
|
122
|
+
responseTime: number;
|
|
123
|
+
memoryUsage?: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Runtime Test Harness - Creates actual AgentRuntime instances for testing
|
|
127
|
+
* Uses the standard AgentRuntime without any mocks or proxies
|
|
128
|
+
*/
|
|
129
|
+
declare class RuntimeTestHarness {
|
|
130
|
+
private runtimes;
|
|
131
|
+
private databaseManager;
|
|
132
|
+
private testId;
|
|
133
|
+
constructor(testId?: string);
|
|
134
|
+
/**
|
|
135
|
+
* Creates an AgentRuntime instance for testing
|
|
136
|
+
* This uses the standard AgentRuntime - it will actually execute all functionality
|
|
137
|
+
*/
|
|
138
|
+
createTestRuntime(config: RuntimeConfig): Promise<IAgentRuntime>;
|
|
139
|
+
/**
|
|
140
|
+
* Loads a plugin by name from the ElizaOS ecosystem
|
|
141
|
+
* Uses dynamic imports to avoid circular dependencies during build
|
|
142
|
+
*/
|
|
143
|
+
private loadPlugin;
|
|
144
|
+
/**
|
|
145
|
+
* Creates a test model provider that gives realistic responses
|
|
146
|
+
*/
|
|
147
|
+
createRealisticModelProvider(scenarios?: Array<{
|
|
148
|
+
prompt: RegExp;
|
|
149
|
+
response: string;
|
|
150
|
+
}>): TestModelProvider;
|
|
151
|
+
/**
|
|
152
|
+
* Executes a real message processing test
|
|
153
|
+
*/
|
|
154
|
+
processTestMessage(runtime: IAgentRuntime, messageText: string, options?: {
|
|
155
|
+
roomId?: string;
|
|
156
|
+
entityId?: string;
|
|
157
|
+
expectedActions?: string[];
|
|
158
|
+
timeoutMs?: number;
|
|
159
|
+
}): Promise<RealRuntimeTestResult>;
|
|
160
|
+
/**
|
|
161
|
+
* Gets actions that were actually executed (not mocked)
|
|
162
|
+
*/
|
|
163
|
+
private getExecutedActions;
|
|
164
|
+
/**
|
|
165
|
+
* Validates that a runtime is actually functional
|
|
166
|
+
*/
|
|
167
|
+
validateRuntimeHealth(runtime: IAgentRuntime): Promise<{
|
|
168
|
+
healthy: boolean;
|
|
169
|
+
issues: string[];
|
|
170
|
+
services: string[];
|
|
171
|
+
plugins: string[];
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Cleanup all test resources
|
|
175
|
+
*/
|
|
176
|
+
cleanup(): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Convenience function to create and configure a test runtime
|
|
180
|
+
*/
|
|
181
|
+
declare function createTestRuntime(config?: Partial<RuntimeConfig>): Promise<{
|
|
182
|
+
runtime: IAgentRuntime;
|
|
183
|
+
harness: RuntimeTestHarness;
|
|
184
|
+
}>;
|
|
185
|
+
/**
|
|
186
|
+
* Helper to run a quick integration test
|
|
187
|
+
*/
|
|
188
|
+
declare function runIntegrationTest(testName: string, testFn: (runtime: IAgentRuntime) => Promise<void>, config?: Partial<RuntimeConfig>): Promise<RealRuntimeTestResult>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Standardized testing templates and patterns for ElizaOS
|
|
192
|
+
*
|
|
193
|
+
* This module provides consistent testing patterns, templates, and utilities
|
|
194
|
+
* to ensure testing consistency across all packages.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Standard test configuration interface
|
|
199
|
+
*/
|
|
200
|
+
interface TestConfig {
|
|
201
|
+
name: string;
|
|
202
|
+
timeout?: number;
|
|
203
|
+
retries?: number;
|
|
204
|
+
skipCondition?: () => boolean;
|
|
205
|
+
setup?: () => Promise<void>;
|
|
206
|
+
teardown?: () => Promise<void>;
|
|
207
|
+
expectedErrors?: unknown[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Template test result interface
|
|
211
|
+
*/
|
|
212
|
+
interface TemplateTestResult {
|
|
213
|
+
name: string;
|
|
214
|
+
passed: boolean;
|
|
215
|
+
duration: number;
|
|
216
|
+
error?: Error;
|
|
217
|
+
warnings?: string[];
|
|
218
|
+
metadata?: Record<string, unknown>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Base test template class
|
|
222
|
+
*/
|
|
223
|
+
declare abstract class TestTemplate {
|
|
224
|
+
protected config: TestConfig;
|
|
225
|
+
protected runtime?: IAgentRuntime;
|
|
226
|
+
constructor(config: TestConfig);
|
|
227
|
+
abstract execute(): Promise<TemplateTestResult>;
|
|
228
|
+
protected setup(): Promise<void>;
|
|
229
|
+
protected teardown(): Promise<void>;
|
|
230
|
+
protected shouldSkip(): boolean;
|
|
231
|
+
getConfig(): TestConfig;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Unit test template for isolated component testing
|
|
235
|
+
*/
|
|
236
|
+
declare class UnitTestTemplate extends TestTemplate {
|
|
237
|
+
private testFunction;
|
|
238
|
+
constructor(config: TestConfig, testFunction: () => Promise<void>);
|
|
239
|
+
execute(): Promise<TemplateTestResult>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Integration test template for real runtime testing
|
|
243
|
+
*/
|
|
244
|
+
declare class IntegrationTestTemplate extends TestTemplate {
|
|
245
|
+
private testFunction;
|
|
246
|
+
private character?;
|
|
247
|
+
constructor(config: TestConfig, testFunction: (runtime: IAgentRuntime) => Promise<void>, character?: Character);
|
|
248
|
+
execute(): Promise<TemplateTestResult>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Plugin test template for plugin-specific testing
|
|
252
|
+
*/
|
|
253
|
+
declare class PluginTestTemplate extends TestTemplate {
|
|
254
|
+
private plugin;
|
|
255
|
+
private testFunction;
|
|
256
|
+
constructor(config: TestConfig, plugin: Plugin, testFunction: (runtime: IAgentRuntime, plugin: Plugin) => Promise<void>);
|
|
257
|
+
execute(): Promise<TemplateTestResult>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Error handling test template
|
|
261
|
+
*/
|
|
262
|
+
declare class ErrorTestTemplate extends TestTemplate {
|
|
263
|
+
private testFunction;
|
|
264
|
+
private expectedError;
|
|
265
|
+
constructor(config: TestConfig, testFunction: () => Promise<void>, expectedError: string);
|
|
266
|
+
execute(): Promise<TemplateTestResult>;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Performance test template
|
|
270
|
+
*/
|
|
271
|
+
declare class PerformanceTestTemplate extends TestTemplate {
|
|
272
|
+
private testFunction;
|
|
273
|
+
private maxDuration;
|
|
274
|
+
private maxMemoryMB;
|
|
275
|
+
constructor(config: TestConfig, testFunction: () => Promise<void>, maxDuration: number, maxMemoryMB: number);
|
|
276
|
+
execute(): Promise<TemplateTestResult>;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Test suite for organizing related tests
|
|
280
|
+
*/
|
|
281
|
+
declare class TestSuite {
|
|
282
|
+
private tests;
|
|
283
|
+
private name;
|
|
284
|
+
constructor(name: string);
|
|
285
|
+
addTest(test: TestTemplate): void;
|
|
286
|
+
run(): Promise<{
|
|
287
|
+
suiteName: string;
|
|
288
|
+
totalTests: number;
|
|
289
|
+
passed: number;
|
|
290
|
+
failed: number;
|
|
291
|
+
duration: number;
|
|
292
|
+
results: TemplateTestResult[];
|
|
293
|
+
}>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Factory functions for creating common test scenarios
|
|
297
|
+
*/
|
|
298
|
+
declare function createUnitTest(name: string, testFunction: () => Promise<void>, options?: Partial<TestConfig>): UnitTestTemplate;
|
|
299
|
+
declare function createIntegrationTest(name: string, testFunction: (runtime: IAgentRuntime) => Promise<void>, character?: Character, options?: Partial<TestConfig>): IntegrationTestTemplate;
|
|
300
|
+
declare function createPluginTest(name: string, plugin: Plugin, testFunction: (runtime: IAgentRuntime, plugin: Plugin) => Promise<void>, options?: Partial<TestConfig>): PluginTestTemplate;
|
|
301
|
+
declare function createErrorTest(name: string, testFunction: () => Promise<void>, expectedError: any, options?: Partial<TestConfig>): ErrorTestTemplate;
|
|
302
|
+
declare function createPerformanceTest(name: string, testFunction: () => Promise<void>, maxDurationMs: number, maxMemoryMB: number, options?: Partial<TestConfig>): PerformanceTestTemplate;
|
|
303
|
+
/**
|
|
304
|
+
* Standard test data generators
|
|
305
|
+
*/
|
|
306
|
+
declare class TestDataGenerator {
|
|
307
|
+
static generateUUID(): string;
|
|
308
|
+
static generateMemory(overrides?: Partial<Memory>): Memory;
|
|
309
|
+
static generateCharacter(overrides?: Partial<Character>): Character;
|
|
310
|
+
static generateContent(overrides?: Partial<Content>): Content;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Test Database Manager - Creates isolated database instances for testing
|
|
315
|
+
* Each test gets its own database to prevent interference and ensure isolation
|
|
316
|
+
*/
|
|
317
|
+
declare class TestDatabaseManager {
|
|
318
|
+
private testDatabases;
|
|
319
|
+
private tempPaths;
|
|
320
|
+
/**
|
|
321
|
+
* Creates an isolated database for testing
|
|
322
|
+
* Uses PostgreSQL for testing when available, falls back to mock database
|
|
323
|
+
*/
|
|
324
|
+
createIsolatedDatabase(testId: string): Promise<IDatabaseAdapter>;
|
|
325
|
+
/**
|
|
326
|
+
* Creates a minimal mock database adapter for testing when real database unavailable
|
|
327
|
+
* This is a FUNCTIONAL mock that actually stores data in memory
|
|
328
|
+
*/
|
|
329
|
+
private createMockDatabase;
|
|
330
|
+
/**
|
|
331
|
+
* Cleanup a specific test database
|
|
332
|
+
*/
|
|
333
|
+
cleanupDatabase(testId: string): Promise<void>;
|
|
334
|
+
/**
|
|
335
|
+
* Cleanup all test databases
|
|
336
|
+
*/
|
|
337
|
+
cleanup(): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* Get statistics about test databases
|
|
340
|
+
*/
|
|
341
|
+
getStats(): {
|
|
342
|
+
activeDatabases: number;
|
|
343
|
+
tempPaths: string[];
|
|
344
|
+
memoryUsage: string;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Convenience function to create an isolated test database
|
|
349
|
+
*/
|
|
350
|
+
declare function createTestDatabase(testId?: string): Promise<{
|
|
351
|
+
adapter: IDatabaseAdapter;
|
|
352
|
+
manager: TestDatabaseManager;
|
|
353
|
+
testId: string;
|
|
354
|
+
}>;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Create a complete test environment with runtime, character, and conversation
|
|
358
|
+
*
|
|
359
|
+
* @param options - Configuration options for the test environment
|
|
360
|
+
* @returns Complete test environment
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* import { createTestEnvironment } from '@elizaos/core/test-utils';
|
|
365
|
+
*
|
|
366
|
+
* const { runtime, character, conversation } = createTestEnvironment({
|
|
367
|
+
* characterName: 'TestBot',
|
|
368
|
+
* conversationLength: 5,
|
|
369
|
+
* roomId: 'test-room-123'
|
|
370
|
+
* });
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
declare function createTestEnvironment(options?: {
|
|
374
|
+
characterName?: string;
|
|
375
|
+
conversationLength?: number;
|
|
376
|
+
roomId?: UUID;
|
|
377
|
+
plugins?: string[];
|
|
378
|
+
runtimeOverrides?: any;
|
|
379
|
+
characterOverrides?: any;
|
|
380
|
+
}): {
|
|
381
|
+
runtime: IAgentRuntime;
|
|
382
|
+
character: _elizaos_core.Character;
|
|
383
|
+
conversation: Memory[];
|
|
384
|
+
state: State;
|
|
385
|
+
roomId: `${string}-${string}-${string}-${string}-${string}`;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Create a test action with complete mock setup
|
|
389
|
+
*
|
|
390
|
+
* @param name - Action name
|
|
391
|
+
* @param options - Action configuration options
|
|
392
|
+
* @returns Mock action with handlers
|
|
393
|
+
*/
|
|
394
|
+
declare function createTestAction(name: string, options?: {
|
|
395
|
+
description?: string;
|
|
396
|
+
validateResult?: boolean;
|
|
397
|
+
handlerResult?: ActionResult;
|
|
398
|
+
examples?: any[];
|
|
399
|
+
}): Action;
|
|
400
|
+
/**
|
|
401
|
+
* Create a test provider with complete mock setup
|
|
402
|
+
*
|
|
403
|
+
* @param name - Provider name
|
|
404
|
+
* @param options - Provider configuration options
|
|
405
|
+
* @returns Mock provider
|
|
406
|
+
*/
|
|
407
|
+
declare function createTestProvider(name: string, options?: {
|
|
408
|
+
description?: string;
|
|
409
|
+
text?: string;
|
|
410
|
+
values?: Record<string, any>;
|
|
411
|
+
data?: Record<string, any>;
|
|
412
|
+
dynamic?: boolean;
|
|
413
|
+
isPrivate?: boolean;
|
|
414
|
+
}): Provider;
|
|
415
|
+
/**
|
|
416
|
+
* Create a test evaluator with complete mock setup
|
|
417
|
+
*
|
|
418
|
+
* @param name - Evaluator name
|
|
419
|
+
* @param options - Evaluator configuration options
|
|
420
|
+
* @returns Mock evaluator
|
|
421
|
+
*/
|
|
422
|
+
declare function createTestEvaluator(name: string, options?: {
|
|
423
|
+
description?: string;
|
|
424
|
+
alwaysRun?: boolean;
|
|
425
|
+
validateResult?: boolean;
|
|
426
|
+
handlerResult?: any;
|
|
427
|
+
}): Evaluator;
|
|
428
|
+
/**
|
|
429
|
+
* Create a complete plugin test scenario
|
|
430
|
+
*
|
|
431
|
+
* @param pluginName - Name of the plugin being tested
|
|
432
|
+
* @param options - Plugin test configuration
|
|
433
|
+
* @returns Complete plugin test scenario
|
|
434
|
+
*/
|
|
435
|
+
declare function createPluginTestScenario(pluginName: string, options?: {
|
|
436
|
+
actions?: string[];
|
|
437
|
+
providers?: string[];
|
|
438
|
+
evaluators?: string[];
|
|
439
|
+
services?: string[];
|
|
440
|
+
conversationSteps?: string[];
|
|
441
|
+
}): {
|
|
442
|
+
runtime: IAgentRuntime;
|
|
443
|
+
character: _elizaos_core.Character;
|
|
444
|
+
state: State;
|
|
445
|
+
roomId: `${string}-${string}-${string}-${string}-${string}`;
|
|
446
|
+
conversation: Memory[];
|
|
447
|
+
components: {
|
|
448
|
+
actions: Action[];
|
|
449
|
+
providers: Provider[];
|
|
450
|
+
evaluators: Evaluator[];
|
|
451
|
+
};
|
|
452
|
+
helpers: {
|
|
453
|
+
executeAction: (actionName: string, message?: Memory) => Promise<void | ActionResult>;
|
|
454
|
+
getProviderData: (providerName: string, message?: Memory) => Promise<_elizaos_core.ProviderResult>;
|
|
455
|
+
runEvaluator: (evaluatorName: string, message?: Memory) => Promise<void | ActionResult>;
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* Create a multi-agent test scenario
|
|
460
|
+
*
|
|
461
|
+
* @param agentCount - Number of agents to create
|
|
462
|
+
* @param options - Multi-agent test configuration
|
|
463
|
+
* @returns Multi-agent test scenario
|
|
464
|
+
*/
|
|
465
|
+
declare function createMultiAgentScenario(agentCount?: number, options?: {
|
|
466
|
+
sharedRoomId?: UUID;
|
|
467
|
+
agentNames?: string[];
|
|
468
|
+
conversationSteps?: Array<{
|
|
469
|
+
agentIndex: number;
|
|
470
|
+
message: string;
|
|
471
|
+
}>;
|
|
472
|
+
}): {
|
|
473
|
+
agents: {
|
|
474
|
+
runtime: IAgentRuntime;
|
|
475
|
+
character: _elizaos_core.Character;
|
|
476
|
+
index: number;
|
|
477
|
+
}[];
|
|
478
|
+
sharedRoomId: `${string}-${string}-${string}-${string}-${string}`;
|
|
479
|
+
conversation: Memory[];
|
|
480
|
+
helpers: {
|
|
481
|
+
sendMessage: (agentIndex: number, text: string) => Memory;
|
|
482
|
+
getAgentByName: (name: string) => {
|
|
483
|
+
runtime: IAgentRuntime;
|
|
484
|
+
character: _elizaos_core.Character;
|
|
485
|
+
index: number;
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @fileoverview Mock implementations for Character and related interfaces
|
|
492
|
+
*
|
|
493
|
+
* This module provides comprehensive mock implementations for character objects,
|
|
494
|
+
* agent configurations, and personality definitions.
|
|
495
|
+
*/
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Type representing overrides for Character mock creation
|
|
499
|
+
*/
|
|
500
|
+
type MockCharacterOverrides = Partial<Character>;
|
|
501
|
+
/**
|
|
502
|
+
* Create a comprehensive mock Character with intelligent defaults
|
|
503
|
+
*
|
|
504
|
+
* This function provides a fully-featured character mock that includes
|
|
505
|
+
* realistic personality traits, message examples, and configuration.
|
|
506
|
+
*
|
|
507
|
+
* @param overrides - Partial object to override specific properties
|
|
508
|
+
* @returns Complete mock Character object
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* import { createMockCharacter } from '@elizaos/core/test-utils';
|
|
513
|
+
*
|
|
514
|
+
* const mockCharacter = createMockCharacter({
|
|
515
|
+
* name: 'CustomAgent',
|
|
516
|
+
* bio: ['A specialized test agent'],
|
|
517
|
+
* plugins: ['@elizaos/plugin-test']
|
|
518
|
+
* });
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
declare function createMockCharacter(overrides?: MockCharacterOverrides): Character;
|
|
522
|
+
/**
|
|
523
|
+
* Create a minimal mock character with only required fields
|
|
524
|
+
*
|
|
525
|
+
* @param name - Character name
|
|
526
|
+
* @param overrides - Additional overrides
|
|
527
|
+
* @returns Minimal mock character
|
|
528
|
+
*/
|
|
529
|
+
declare function createMinimalMockCharacter(name?: string, overrides?: MockCharacterOverrides): Character;
|
|
530
|
+
/**
|
|
531
|
+
* Create a mock character for specific plugin testing
|
|
532
|
+
*
|
|
533
|
+
* @param pluginName - Name of the plugin to test
|
|
534
|
+
* @param overrides - Additional overrides
|
|
535
|
+
* @returns Plugin-specific mock character
|
|
536
|
+
*/
|
|
537
|
+
declare function createPluginTestCharacter(pluginName: string, overrides?: MockCharacterOverrides): Character;
|
|
538
|
+
/**
|
|
539
|
+
* Create a mock character with extensive conversation examples
|
|
540
|
+
*
|
|
541
|
+
* @param overrides - Additional overrides
|
|
542
|
+
* @returns Character with rich conversation examples
|
|
543
|
+
*/
|
|
544
|
+
declare function createRichConversationCharacter(overrides?: MockCharacterOverrides): Character;
|
|
545
|
+
/**
|
|
546
|
+
* Create multiple mock characters for multi-agent testing
|
|
547
|
+
*
|
|
548
|
+
* @param count - Number of characters to create
|
|
549
|
+
* @param baseName - Base name for characters (will be numbered)
|
|
550
|
+
* @param overrides - Common overrides for all characters
|
|
551
|
+
* @returns Array of mock characters
|
|
552
|
+
*/
|
|
553
|
+
declare function createMultipleCharacters(count?: number, baseName?: string, overrides?: MockCharacterOverrides): Character[];
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* @fileoverview Mock implementations for IDatabaseAdapter and related database interfaces
|
|
557
|
+
*
|
|
558
|
+
* This module provides comprehensive mock implementations for database operations,
|
|
559
|
+
* supporting both unit and integration testing scenarios.
|
|
560
|
+
*/
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Type representing overrides for IDatabaseAdapter mock creation
|
|
564
|
+
*/
|
|
565
|
+
type MockDatabaseOverrides = Partial<IDatabaseAdapter>;
|
|
566
|
+
/**
|
|
567
|
+
* Create a comprehensive mock of IDatabaseAdapter with intelligent defaults
|
|
568
|
+
*
|
|
569
|
+
* This function provides a fully-featured database adapter mock that implements
|
|
570
|
+
* all database operations with sensible defaults and proper return types.
|
|
571
|
+
*
|
|
572
|
+
* @param overrides - Partial object to override specific methods or properties
|
|
573
|
+
* @returns Complete mock implementation of IDatabaseAdapter
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```typescript
|
|
577
|
+
* import { createMockDatabase } from '@elizaos/core/test-utils';
|
|
578
|
+
* import { mock } from 'bun:test';
|
|
579
|
+
*
|
|
580
|
+
* const mockDb = createMockDatabase({
|
|
581
|
+
* getMemories: mock().mockResolvedValue([mockMemory]),
|
|
582
|
+
* createMemory: mock().mockResolvedValue('memory-id')
|
|
583
|
+
* });
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
declare function createMockDatabase(overrides?: MockDatabaseOverrides): IDatabaseAdapter;
|
|
587
|
+
/**
|
|
588
|
+
* Create a simple mock database connection object
|
|
589
|
+
*
|
|
590
|
+
* @param overrides - Partial object to override specific methods
|
|
591
|
+
* @returns Mock database connection
|
|
592
|
+
*/
|
|
593
|
+
declare function createMockDbConnection(overrides?: any): any;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* @fileoverview Mock implementations for Memory and related interfaces
|
|
597
|
+
*
|
|
598
|
+
* This module provides comprehensive mock implementations for memory objects,
|
|
599
|
+
* content structures, and memory-related operations.
|
|
600
|
+
*/
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Type representing overrides for Memory mock creation
|
|
604
|
+
*/
|
|
605
|
+
type MockMemoryOverrides = Partial<Memory>;
|
|
606
|
+
/**
|
|
607
|
+
* Type representing overrides for Content mock creation
|
|
608
|
+
*/
|
|
609
|
+
type MockContentOverrides = Partial<Content>;
|
|
610
|
+
/**
|
|
611
|
+
* Create a comprehensive mock Memory object with intelligent defaults
|
|
612
|
+
*
|
|
613
|
+
* This function provides a fully-featured memory mock that includes
|
|
614
|
+
* realistic content, metadata, and proper typing.
|
|
615
|
+
*
|
|
616
|
+
* @param overrides - Partial object to override specific properties
|
|
617
|
+
* @returns Complete mock Memory object
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```typescript
|
|
621
|
+
* import { createMockMemory } from '@elizaos/core/test-utils';
|
|
622
|
+
*
|
|
623
|
+
* const mockMessage = createMockMemory({
|
|
624
|
+
* content: { text: 'Hello, world!' },
|
|
625
|
+
* entityId: 'user-123'
|
|
626
|
+
* });
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
declare function createMockMemory(overrides?: MockMemoryOverrides): Memory;
|
|
630
|
+
/**
|
|
631
|
+
* Create a mock Content object with intelligent defaults
|
|
632
|
+
*
|
|
633
|
+
* @param overrides - Partial object to override specific properties
|
|
634
|
+
* @returns Complete mock Content object
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```typescript
|
|
638
|
+
* import { createMockContent } from '@elizaos/core/test-utils';
|
|
639
|
+
*
|
|
640
|
+
* const mockContent = createMockContent({
|
|
641
|
+
* text: 'Custom message',
|
|
642
|
+
* actions: ['SEND_MESSAGE']
|
|
643
|
+
* });
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
646
|
+
declare function createMockContent(overrides?: MockContentOverrides): Content;
|
|
647
|
+
/**
|
|
648
|
+
* Create a mock conversation memory (user message)
|
|
649
|
+
*
|
|
650
|
+
* @param text - The message text
|
|
651
|
+
* @param overrides - Additional overrides
|
|
652
|
+
* @returns Mock user message memory
|
|
653
|
+
*/
|
|
654
|
+
declare function createMockUserMessage(text: string, overrides?: MockMemoryOverrides): Memory;
|
|
655
|
+
/**
|
|
656
|
+
* Create a mock agent response memory
|
|
657
|
+
*
|
|
658
|
+
* @param text - The response text
|
|
659
|
+
* @param thought - Optional internal thought
|
|
660
|
+
* @param actions - Optional actions executed
|
|
661
|
+
* @param overrides - Additional overrides
|
|
662
|
+
* @returns Mock agent response memory
|
|
663
|
+
*/
|
|
664
|
+
declare function createMockAgentResponse(text: string, thought?: string, actions?: string[], overrides?: MockMemoryOverrides): Memory;
|
|
665
|
+
/**
|
|
666
|
+
* Create a mock fact memory for knowledge storage
|
|
667
|
+
*
|
|
668
|
+
* @param fact - The factual claim
|
|
669
|
+
* @param confidence - Confidence level (0-1)
|
|
670
|
+
* @param overrides - Additional overrides
|
|
671
|
+
* @returns Mock fact memory
|
|
672
|
+
*/
|
|
673
|
+
declare function createMockFact(fact: string, confidence?: number, overrides?: MockMemoryOverrides): Memory;
|
|
674
|
+
/**
|
|
675
|
+
* Create a mock memory with embedding vector
|
|
676
|
+
*
|
|
677
|
+
* @param text - The text content
|
|
678
|
+
* @param dimension - Embedding dimension (default: 1536 for OpenAI)
|
|
679
|
+
* @param overrides - Additional overrides
|
|
680
|
+
* @returns Mock memory with embedding
|
|
681
|
+
*/
|
|
682
|
+
declare function createMockMemoryWithEmbedding(text: string, dimension?: number, overrides?: MockMemoryOverrides): Memory;
|
|
683
|
+
/**
|
|
684
|
+
* Create a batch of mock conversation memories
|
|
685
|
+
*
|
|
686
|
+
* @param count - Number of memories to create
|
|
687
|
+
* @param roomId - Room ID for all memories
|
|
688
|
+
* @returns Array of mock conversation memories
|
|
689
|
+
*/
|
|
690
|
+
declare function createMockConversation(count?: number, roomId?: UUID): Memory[];
|
|
691
|
+
/**
|
|
692
|
+
* Create a mock Media attachment
|
|
693
|
+
*
|
|
694
|
+
* @param type - Media type
|
|
695
|
+
* @param url - Media URL
|
|
696
|
+
* @param overrides - Additional overrides
|
|
697
|
+
* @returns Mock Media object
|
|
698
|
+
*/
|
|
699
|
+
declare function createMockMedia(type?: 'image' | 'video' | 'audio' | 'document', url?: string, overrides?: Partial<Media>): Media;
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Simple mock utility for test utils that doesn't depend on bun:test
|
|
703
|
+
*/
|
|
704
|
+
interface MockFunction<T = any> {
|
|
705
|
+
(...args: any[]): T;
|
|
706
|
+
mockReturnValue: (value: T) => MockFunction<T>;
|
|
707
|
+
mockResolvedValue: (value: T) => MockFunction<T>;
|
|
708
|
+
mockRejectedValue: (error: any) => MockFunction<T>;
|
|
709
|
+
mockImplementation: (fn: (...args: any[]) => T) => MockFunction<T>;
|
|
710
|
+
calls: any[][];
|
|
711
|
+
mock: {
|
|
712
|
+
calls: any[][];
|
|
713
|
+
results: any[];
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
declare function mock<T = any>(implementation?: (...args: any[]) => T): MockFunction<T>;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* @fileoverview Mock implementations for IAgentRuntime and related interfaces
|
|
720
|
+
*
|
|
721
|
+
* This module provides comprehensive mock implementations for the core runtime interfaces,
|
|
722
|
+
* designed to support both unit testing and integration testing scenarios.
|
|
723
|
+
*/
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Type representing overrides for IAgentRuntime mock creation
|
|
727
|
+
*/
|
|
728
|
+
type MockRuntimeOverrides = Partial<IAgentRuntime & IDatabaseAdapter>;
|
|
729
|
+
/**
|
|
730
|
+
* Create a comprehensive mock of IAgentRuntime with intelligent defaults
|
|
731
|
+
*
|
|
732
|
+
* This function provides a fully-featured mock that implements both IAgentRuntime
|
|
733
|
+
* and IDatabaseAdapter interfaces, ensuring compatibility with all test scenarios.
|
|
734
|
+
*
|
|
735
|
+
* @param overrides - Partial object to override specific methods or properties
|
|
736
|
+
* @returns Complete mock implementation of IAgentRuntime
|
|
737
|
+
*
|
|
738
|
+
* @deprecated Use real runtime testing instead: import { createTestRuntime } from '@elizaos/core/test-utils'
|
|
739
|
+
*
|
|
740
|
+
* @example Legacy Mock Testing (Deprecated)
|
|
741
|
+
* ```typescript
|
|
742
|
+
* import { createMockRuntime } from '@elizaos/core/test-utils';
|
|
743
|
+
*
|
|
744
|
+
* const mockRuntime = createMockRuntime({
|
|
745
|
+
* getSetting: () => 'test-api-key',
|
|
746
|
+
* useModel: () => Promise.resolve('mock response')
|
|
747
|
+
* });
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
750
|
+
declare function createMockRuntime(overrides?: MockRuntimeOverrides): IAgentRuntime;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @fileoverview Mock implementations for Service and related interfaces
|
|
754
|
+
*
|
|
755
|
+
* This module provides comprehensive mock implementations for services,
|
|
756
|
+
* supporting both unit and integration testing scenarios.
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Type representing overrides for Service mock creation
|
|
761
|
+
*/
|
|
762
|
+
type MockServiceOverrides = Partial<Service>;
|
|
763
|
+
/**
|
|
764
|
+
* Create a comprehensive mock Service with intelligent defaults
|
|
765
|
+
*
|
|
766
|
+
* This function provides a fully-featured service mock that implements
|
|
767
|
+
* the Service interface with sensible defaults and proper lifecycle methods.
|
|
768
|
+
*
|
|
769
|
+
* @param serviceType - Type/category of the service
|
|
770
|
+
* @param overrides - Partial object to override specific methods or properties
|
|
771
|
+
* @returns Complete mock Service implementation
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```typescript
|
|
775
|
+
* import { createMockService } from '@elizaos/core/test-utils';
|
|
776
|
+
* import { mock } from 'bun:test';
|
|
777
|
+
*
|
|
778
|
+
* const mockService = createMockService(ServiceType.UNKNOWN, {
|
|
779
|
+
* someMethod: mock().mockResolvedValue('custom result')
|
|
780
|
+
* });
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
declare function createMockService(serviceType?: ServiceTypeName, overrides?: MockServiceOverrides): Service;
|
|
784
|
+
/**
|
|
785
|
+
* Create a mock database service
|
|
786
|
+
*
|
|
787
|
+
* @param overrides - Service-specific overrides
|
|
788
|
+
* @returns Mock database service
|
|
789
|
+
*/
|
|
790
|
+
declare function createMockDatabaseService(overrides?: MockServiceOverrides): Service;
|
|
791
|
+
/**
|
|
792
|
+
* Create a mock cache service
|
|
793
|
+
*
|
|
794
|
+
* @param overrides - Service-specific overrides
|
|
795
|
+
* @returns Mock cache service
|
|
796
|
+
*/
|
|
797
|
+
declare function createMockCacheService(overrides?: MockServiceOverrides): Service;
|
|
798
|
+
/**
|
|
799
|
+
* Create a mock HTTP service
|
|
800
|
+
*
|
|
801
|
+
* @param overrides - Service-specific overrides
|
|
802
|
+
* @returns Mock HTTP service
|
|
803
|
+
*/
|
|
804
|
+
declare function createMockHttpService(overrides?: MockServiceOverrides): Service;
|
|
805
|
+
/**
|
|
806
|
+
* Create a mock blockchain service
|
|
807
|
+
*
|
|
808
|
+
* @param overrides - Service-specific overrides
|
|
809
|
+
* @returns Mock blockchain service
|
|
810
|
+
*/
|
|
811
|
+
declare function createMockBlockchainService(overrides?: MockServiceOverrides): Service;
|
|
812
|
+
/**
|
|
813
|
+
* Create a mock AI model service
|
|
814
|
+
*
|
|
815
|
+
* @param overrides - Service-specific overrides
|
|
816
|
+
* @returns Mock AI model service
|
|
817
|
+
*/
|
|
818
|
+
declare function createMockModelService(overrides?: MockServiceOverrides): Service;
|
|
819
|
+
/**
|
|
820
|
+
* Create a mock messaging service
|
|
821
|
+
*
|
|
822
|
+
* @param overrides - Service-specific overrides
|
|
823
|
+
* @returns Mock messaging service
|
|
824
|
+
*/
|
|
825
|
+
declare function createMockMessagingService(overrides?: MockServiceOverrides): Service;
|
|
826
|
+
/**
|
|
827
|
+
* Create a service map with multiple mock services
|
|
828
|
+
*
|
|
829
|
+
* @param services - Array of service configurations
|
|
830
|
+
* @returns Map of service names to mock services
|
|
831
|
+
*/
|
|
832
|
+
declare function createMockServiceMap(services?: Array<{
|
|
833
|
+
name: string;
|
|
834
|
+
type?: ServiceTypeName;
|
|
835
|
+
overrides?: MockServiceOverrides;
|
|
836
|
+
}>): Map<string, Service>;
|
|
837
|
+
/**
|
|
838
|
+
* Create a mock service registry for runtime
|
|
839
|
+
*
|
|
840
|
+
* @param runtime - Mock runtime instance
|
|
841
|
+
* @param services - Services to register
|
|
842
|
+
* @returns Updated runtime with registered services
|
|
843
|
+
*/
|
|
844
|
+
declare function registerMockServices(runtime: any, services?: Array<{
|
|
845
|
+
name: string;
|
|
846
|
+
type?: ServiceTypeName;
|
|
847
|
+
overrides?: MockServiceOverrides;
|
|
848
|
+
}>): any;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* @fileoverview Mock implementations for State and related interfaces
|
|
852
|
+
*
|
|
853
|
+
* This module provides comprehensive mock implementations for state objects,
|
|
854
|
+
* provider results, and state composition utilities.
|
|
855
|
+
*/
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Type representing overrides for State mock creation
|
|
859
|
+
*/
|
|
860
|
+
type MockStateOverrides = Partial<State>;
|
|
861
|
+
/**
|
|
862
|
+
* Type representing overrides for ProviderResult mock creation
|
|
863
|
+
*/
|
|
864
|
+
type MockProviderResultOverrides = Partial<ProviderResult>;
|
|
865
|
+
/**
|
|
866
|
+
* Type representing overrides for ActionResult mock creation
|
|
867
|
+
*/
|
|
868
|
+
type MockActionResultOverrides = Partial<ActionResult>;
|
|
869
|
+
/**
|
|
870
|
+
* Create a comprehensive mock State object with intelligent defaults
|
|
871
|
+
*
|
|
872
|
+
* This function provides a fully-featured state mock that includes
|
|
873
|
+
* realistic data structures and proper typing for agent context.
|
|
874
|
+
*
|
|
875
|
+
* @param overrides - Partial object to override specific properties
|
|
876
|
+
* @returns Complete mock State object
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* ```typescript
|
|
880
|
+
* import { createMockState } from '@elizaos/core/test-utils';
|
|
881
|
+
*
|
|
882
|
+
* const mockState = createMockState({
|
|
883
|
+
* values: { currentUser: 'john_doe' },
|
|
884
|
+
* data: { conversationLength: 5 }
|
|
885
|
+
* });
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
declare function createMockState(overrides?: MockStateOverrides): State;
|
|
889
|
+
/**
|
|
890
|
+
* Create a mock ProviderResult object
|
|
891
|
+
*
|
|
892
|
+
* @param overrides - Partial object to override specific properties
|
|
893
|
+
* @returns Complete mock ProviderResult object
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```typescript
|
|
897
|
+
* import { createMockProviderResult } from '@elizaos/core/test-utils';
|
|
898
|
+
*
|
|
899
|
+
* const providerResult = createMockProviderResult({
|
|
900
|
+
* text: '[WEATHER] Current weather is sunny',
|
|
901
|
+
* values: { temperature: 72, conditions: 'sunny' }
|
|
902
|
+
* });
|
|
903
|
+
* ```
|
|
904
|
+
*/
|
|
905
|
+
declare function createMockProviderResult(overrides?: MockProviderResultOverrides): ProviderResult;
|
|
906
|
+
/**
|
|
907
|
+
* Create a mock ActionResult object
|
|
908
|
+
*
|
|
909
|
+
* @param overrides - Partial object to override specific properties
|
|
910
|
+
* @returns Complete mock ActionResult object
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* ```typescript
|
|
914
|
+
* import { createMockActionResult } from '@elizaos/core/test-utils';
|
|
915
|
+
*
|
|
916
|
+
* const actionResult = createMockActionResult({
|
|
917
|
+
* text: 'Action completed successfully',
|
|
918
|
+
* values: { success: true, id: 'action-123' }
|
|
919
|
+
* });
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
declare function createMockActionResult(overrides?: MockActionResultOverrides): ActionResult;
|
|
923
|
+
/**
|
|
924
|
+
* Create a state with specific provider context
|
|
925
|
+
*
|
|
926
|
+
* @param providerName - Name of the provider
|
|
927
|
+
* @param providerData - Data from the provider
|
|
928
|
+
* @param overrides - Additional state overrides
|
|
929
|
+
* @returns State with provider context
|
|
930
|
+
*/
|
|
931
|
+
declare function createMockStateWithProvider(providerName: string, providerData: any, overrides?: MockStateOverrides): State;
|
|
932
|
+
/**
|
|
933
|
+
* Create a state with action execution history
|
|
934
|
+
*
|
|
935
|
+
* @param actionResults - Array of action results
|
|
936
|
+
* @param overrides - Additional state overrides
|
|
937
|
+
* @returns State with action history
|
|
938
|
+
*/
|
|
939
|
+
declare function createMockStateWithActions(actionResults: ActionResult[], overrides?: MockStateOverrides): State;
|
|
940
|
+
/**
|
|
941
|
+
* Create a state with realistic conversation context
|
|
942
|
+
*
|
|
943
|
+
* @param conversationHistory - Array of recent messages
|
|
944
|
+
* @param currentUser - Current user name
|
|
945
|
+
* @param overrides - Additional state overrides
|
|
946
|
+
* @returns State with conversation context
|
|
947
|
+
*/
|
|
948
|
+
declare function createMockConversationState(conversationHistory?: string[], currentUser?: string, overrides?: MockStateOverrides): State;
|
|
949
|
+
|
|
950
|
+
export { ErrorTestTemplate, IntegrationTestTemplate, type MockActionResultOverrides, type MockCharacterOverrides, type MockContentOverrides, type MockDatabaseOverrides, type MockFunction, type MockMemoryOverrides, type MockProviderResultOverrides, type MockRuntimeOverrides, type MockServiceOverrides, type MockStateOverrides, PerformanceTestTemplate, PluginTestTemplate, type RealRuntimeTestResult, type RuntimeConfig, RuntimeTestHarness, type TemplateTestResult, type TestConfig, TestDataGenerator, TestDatabaseManager, TestModelProvider, TestScenarioBuilder, TestSuite, TestTemplate, UnitTestTemplate, createErrorTest, createIntegrationTest, createMinimalMockCharacter, createMockActionResult, createMockAgentResponse, createMockBlockchainService, createMockCacheService, createMockCharacter, createMockContent, createMockConversation, createMockConversationState, createMockDatabase, createMockDatabaseService, createMockDbConnection, createMockFact, createMockHttpService, createMockMedia, createMockMemory, createMockMemoryWithEmbedding, createMockMessagingService, createMockModelService, createMockProviderResult, createMockRuntime, createMockService, createMockServiceMap, createMockState, createMockStateWithActions, createMockStateWithProvider, createMockUserMessage, createModelHandler, createMultiAgentScenario, createMultipleCharacters, createPerformanceTest, createPluginTest, createPluginTestCharacter, createPluginTestScenario, createRichConversationCharacter, createSpecializedModelProvider, createTestAction, createTestDatabase, createTestEnvironment, createTestEvaluator, createTestModelProvider, createTestProvider, createTestRuntime, createUnitTest, mock, registerMockServices, runIntegrationTest, scenarios };
|