llmist 1.1.0 → 1.3.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 +3 -58
- package/dist/{chunk-VXPZQZF5.js → chunk-RZTAKIDE.js} +1279 -360
- package/dist/chunk-RZTAKIDE.js.map +1 -0
- package/dist/{chunk-OIPLYP7M.js → chunk-TFIKR2RK.js} +459 -3
- package/dist/chunk-TFIKR2RK.js.map +1 -0
- package/dist/cli.cjs +1316 -393
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +49 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1446 -362
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +360 -32
- package/dist/index.d.ts +360 -32
- package/dist/index.js +177 -2
- package/dist/index.js.map +1 -1
- package/dist/{mock-stream-DKF5yatf.d.cts → mock-stream-DNt-HBTn.d.cts} +525 -79
- package/dist/{mock-stream-DKF5yatf.d.ts → mock-stream-DNt-HBTn.d.ts} +525 -79
- package/dist/testing/index.cjs +1739 -362
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +437 -3
- package/dist/testing/index.d.ts +437 -3
- package/dist/testing/index.js +54 -4
- package/package.json +1 -1
- package/dist/chunk-OIPLYP7M.js.map +0 -1
- package/dist/chunk-VXPZQZF5.js.map +0 -1
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { B as BaseGadget } from '../mock-stream-
|
|
2
|
-
export {
|
|
1
|
+
import { B as BaseGadget, L as LLMStream, a as LLMStreamChunk, b as LLMMessage, I as IConversationManager } from '../mock-stream-DNt-HBTn.cjs';
|
|
2
|
+
export { d as MockBuilder, f as MockManager, j as MockMatcher, k as MockMatcherContext, l as MockOptions, M as MockProviderAdapter, n as MockRegistration, o as MockResponse, p as MockStats, c as createMockAdapter, e as createMockClient, h as createMockStream, i as createTextMockStream, g as getMockManager, m as mockLLM } from '../mock-stream-DNt-HBTn.cjs';
|
|
3
3
|
import { ZodType } from 'zod';
|
|
4
|
+
import { PassThrough, Readable, Writable } from 'node:stream';
|
|
4
5
|
import 'tslog';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -271,4 +272,437 @@ declare class MockGadgetBuilder {
|
|
|
271
272
|
*/
|
|
272
273
|
declare function mockGadget(): MockGadgetBuilder;
|
|
273
274
|
|
|
274
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Stream testing utilities for llmist.
|
|
277
|
+
* Provides helpers for creating and consuming test streams.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Create an async iterable stream from an array of chunks.
|
|
282
|
+
* Useful for creating deterministic test streams.
|
|
283
|
+
*
|
|
284
|
+
* @param chunks - Array of chunks to yield
|
|
285
|
+
* @returns An async iterable that yields the chunks in order
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const stream = createTestStream([
|
|
290
|
+
* { text: "Hello " },
|
|
291
|
+
* { text: "world", finishReason: "stop", usage: { inputTokens: 10, outputTokens: 5 } }
|
|
292
|
+
* ]);
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare function createTestStream(chunks: LLMStreamChunk[]): LLMStream;
|
|
296
|
+
/**
|
|
297
|
+
* Create a stream that yields text in specified chunks.
|
|
298
|
+
* Automatically adds finishReason and usage to the final chunk.
|
|
299
|
+
*
|
|
300
|
+
* @param text - The full text to stream
|
|
301
|
+
* @param options - Configuration options
|
|
302
|
+
* @returns An async iterable stream
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* const stream = createTextStream("Hello, world!", { chunkSize: 5 });
|
|
307
|
+
* // Yields: "Hello", ", wor", "ld!"
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
declare function createTextStream(text: string, options?: {
|
|
311
|
+
/** Size of each chunk (default: entire text as one chunk) */
|
|
312
|
+
chunkSize?: number;
|
|
313
|
+
/** Delay before starting the stream in ms */
|
|
314
|
+
delayMs?: number;
|
|
315
|
+
/** Delay between chunks in ms */
|
|
316
|
+
chunkDelayMs?: number;
|
|
317
|
+
/** Custom usage stats */
|
|
318
|
+
usage?: {
|
|
319
|
+
inputTokens: number;
|
|
320
|
+
outputTokens: number;
|
|
321
|
+
totalTokens: number;
|
|
322
|
+
};
|
|
323
|
+
/** Custom finish reason (default: "stop") */
|
|
324
|
+
finishReason?: string;
|
|
325
|
+
}): LLMStream;
|
|
326
|
+
/**
|
|
327
|
+
* Collect all chunks from a stream into an array.
|
|
328
|
+
* Useful for asserting on stream output in tests.
|
|
329
|
+
*
|
|
330
|
+
* @param stream - The stream to collect from
|
|
331
|
+
* @returns Array of all chunks from the stream
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const chunks = await collectStream(myStream);
|
|
336
|
+
* expect(chunks).toHaveLength(3);
|
|
337
|
+
* expect(chunks[2].finishReason).toBe("stop");
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
declare function collectStream(stream: LLMStream): Promise<LLMStreamChunk[]>;
|
|
341
|
+
/**
|
|
342
|
+
* Collect all text from a stream into a single string.
|
|
343
|
+
*
|
|
344
|
+
* @param stream - The stream to collect from
|
|
345
|
+
* @returns Concatenated text from all chunks
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* const text = await collectStreamText(myStream);
|
|
350
|
+
* expect(text).toBe("Hello, world!");
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function collectStreamText(stream: LLMStream): Promise<string>;
|
|
354
|
+
/**
|
|
355
|
+
* Get the final chunk from a stream (containing finishReason and usage).
|
|
356
|
+
*
|
|
357
|
+
* @param stream - The stream to consume
|
|
358
|
+
* @returns The final chunk from the stream
|
|
359
|
+
*/
|
|
360
|
+
declare function getStreamFinalChunk(stream: LLMStream): Promise<LLMStreamChunk | undefined>;
|
|
361
|
+
/**
|
|
362
|
+
* Create an empty stream that yields nothing.
|
|
363
|
+
* Useful for testing edge cases.
|
|
364
|
+
*/
|
|
365
|
+
declare function createEmptyStream(): LLMStream;
|
|
366
|
+
/**
|
|
367
|
+
* Create a stream that throws an error after yielding some chunks.
|
|
368
|
+
* Useful for testing error handling.
|
|
369
|
+
*
|
|
370
|
+
* @param chunksBeforeError - Chunks to yield before throwing
|
|
371
|
+
* @param error - The error to throw
|
|
372
|
+
*/
|
|
373
|
+
declare function createErrorStream(chunksBeforeError: LLMStreamChunk[], error: Error): LLMStream;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Conversation fixture generators for testing.
|
|
377
|
+
* Provides utilities for creating test conversation data.
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Create a conversation with a specified number of turns.
|
|
382
|
+
* Each turn consists of a user message and an assistant response.
|
|
383
|
+
*
|
|
384
|
+
* @param turnCount - Number of conversation turns to generate
|
|
385
|
+
* @param options - Configuration options
|
|
386
|
+
* @returns Array of LLMMessages representing the conversation
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* const messages = createConversation(5);
|
|
391
|
+
* // Creates 10 messages: 5 user + 5 assistant
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
declare function createConversation(turnCount: number, options?: {
|
|
395
|
+
/** Prefix for user messages (default: "User message") */
|
|
396
|
+
userPrefix?: string;
|
|
397
|
+
/** Prefix for assistant messages (default: "Assistant response") */
|
|
398
|
+
assistantPrefix?: string;
|
|
399
|
+
/** Base content length per message (default: 100 chars) */
|
|
400
|
+
contentLength?: number;
|
|
401
|
+
}): LLMMessage[];
|
|
402
|
+
/**
|
|
403
|
+
* Create a conversation with gadget calls interspersed.
|
|
404
|
+
* Simulates an agent conversation with tool usage.
|
|
405
|
+
*
|
|
406
|
+
* @param turnCount - Number of conversation turns
|
|
407
|
+
* @param gadgetCallsPerTurn - Number of gadget calls per assistant turn
|
|
408
|
+
* @returns Array of LLMMessages including gadget call/result pairs
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```typescript
|
|
412
|
+
* const messages = createConversationWithGadgets(3, 2);
|
|
413
|
+
* // Creates: user, assistant+gadget, gadget-result, assistant+gadget, gadget-result, assistant (per turn)
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
declare function createConversationWithGadgets(turnCount: number, gadgetCallsPerTurn?: number, options?: {
|
|
417
|
+
/** Gadget names to cycle through (default: ["search", "calculate", "read"]) */
|
|
418
|
+
gadgetNames?: string[];
|
|
419
|
+
/** Content length for messages */
|
|
420
|
+
contentLength?: number;
|
|
421
|
+
}): LLMMessage[];
|
|
422
|
+
/**
|
|
423
|
+
* Estimate token count for a message array.
|
|
424
|
+
* Uses a simple 4-characters-per-token heuristic.
|
|
425
|
+
*
|
|
426
|
+
* @param messages - Messages to estimate tokens for
|
|
427
|
+
* @returns Estimated token count
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const messages = createConversation(10);
|
|
432
|
+
* const tokens = estimateTokens(messages);
|
|
433
|
+
* // Returns approximate token count
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
declare function estimateTokens(messages: LLMMessage[]): number;
|
|
437
|
+
/**
|
|
438
|
+
* Create a single user message.
|
|
439
|
+
*/
|
|
440
|
+
declare function createUserMessage(content: string): LLMMessage;
|
|
441
|
+
/**
|
|
442
|
+
* Create a single assistant message.
|
|
443
|
+
*/
|
|
444
|
+
declare function createAssistantMessage(content: string): LLMMessage;
|
|
445
|
+
/**
|
|
446
|
+
* Create a system message.
|
|
447
|
+
*/
|
|
448
|
+
declare function createSystemMessage(content: string): LLMMessage;
|
|
449
|
+
/**
|
|
450
|
+
* Create a minimal conversation for quick tests.
|
|
451
|
+
* Returns a single turn: one user message and one assistant response.
|
|
452
|
+
*/
|
|
453
|
+
declare function createMinimalConversation(): LLMMessage[];
|
|
454
|
+
/**
|
|
455
|
+
* Create a conversation that exceeds a target token count.
|
|
456
|
+
* Useful for testing compaction triggers.
|
|
457
|
+
*
|
|
458
|
+
* @param targetTokens - Minimum token count to exceed
|
|
459
|
+
* @param options - Configuration options
|
|
460
|
+
* @returns Conversation with at least targetTokens tokens
|
|
461
|
+
*/
|
|
462
|
+
declare function createLargeConversation(targetTokens: number, options?: {
|
|
463
|
+
/** Average tokens per turn (default: 200) */
|
|
464
|
+
tokensPerTurn?: number;
|
|
465
|
+
}): LLMMessage[];
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Mock ConversationManager for testing compaction and agent components.
|
|
469
|
+
* Implements IConversationManager interface with test-friendly features.
|
|
470
|
+
*/
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* A mock implementation of IConversationManager for testing.
|
|
474
|
+
* Tracks all operations and allows inspection of state changes.
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* const mockConvo = new MockConversationManager([
|
|
479
|
+
* { role: "user", content: "Hello" },
|
|
480
|
+
* { role: "assistant", content: "Hi!" }
|
|
481
|
+
* ]);
|
|
482
|
+
*
|
|
483
|
+
* // Use in compaction tests
|
|
484
|
+
* compactionManager.checkAndCompact(mockConvo, 1);
|
|
485
|
+
*
|
|
486
|
+
* // Assert on state changes
|
|
487
|
+
* expect(mockConvo.wasReplaceHistoryCalled()).toBe(true);
|
|
488
|
+
* expect(mockConvo.getReplacementHistory()).toHaveLength(2);
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
declare class MockConversationManager implements IConversationManager {
|
|
492
|
+
private history;
|
|
493
|
+
private readonly baseMessages;
|
|
494
|
+
private replacementHistory;
|
|
495
|
+
private replaceHistoryCallCount;
|
|
496
|
+
private addedMessages;
|
|
497
|
+
constructor(history?: LLMMessage[], baseMessages?: LLMMessage[]);
|
|
498
|
+
addUserMessage(content: string): void;
|
|
499
|
+
addAssistantMessage(content: string): void;
|
|
500
|
+
addGadgetCall(gadgetName: string, parameters: Record<string, unknown>, result: string): void;
|
|
501
|
+
getMessages(): LLMMessage[];
|
|
502
|
+
getHistoryMessages(): LLMMessage[];
|
|
503
|
+
getBaseMessages(): LLMMessage[];
|
|
504
|
+
replaceHistory(newHistory: LLMMessage[]): void;
|
|
505
|
+
/**
|
|
506
|
+
* Check if replaceHistory was called.
|
|
507
|
+
*/
|
|
508
|
+
wasReplaceHistoryCalled(): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Get the number of times replaceHistory was called.
|
|
511
|
+
*/
|
|
512
|
+
getReplaceHistoryCallCount(): number;
|
|
513
|
+
/**
|
|
514
|
+
* Get the most recent history passed to replaceHistory.
|
|
515
|
+
* Returns undefined if replaceHistory was never called.
|
|
516
|
+
*/
|
|
517
|
+
getReplacementHistory(): LLMMessage[] | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* Get all messages that were added via add* methods.
|
|
520
|
+
*/
|
|
521
|
+
getAddedMessages(): LLMMessage[];
|
|
522
|
+
/**
|
|
523
|
+
* Reset all tracking state while preserving the conversation.
|
|
524
|
+
*/
|
|
525
|
+
resetTracking(): void;
|
|
526
|
+
/**
|
|
527
|
+
* Completely reset the mock to initial state.
|
|
528
|
+
* Note: baseMessages cannot be changed after construction.
|
|
529
|
+
*/
|
|
530
|
+
reset(history?: LLMMessage[]): void;
|
|
531
|
+
/**
|
|
532
|
+
* Set the history directly (for test setup).
|
|
533
|
+
*/
|
|
534
|
+
setHistory(messages: LLMMessage[]): void;
|
|
535
|
+
/**
|
|
536
|
+
* Get the current history length.
|
|
537
|
+
*/
|
|
538
|
+
getHistoryLength(): number;
|
|
539
|
+
/**
|
|
540
|
+
* Get total message count (base + history).
|
|
541
|
+
*/
|
|
542
|
+
getTotalMessageCount(): number;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Create a mock conversation manager with a pre-populated conversation.
|
|
546
|
+
*
|
|
547
|
+
* @param turnCount - Number of conversation turns
|
|
548
|
+
* @param baseMessages - Optional base messages (system prompts)
|
|
549
|
+
* @returns Configured MockConversationManager
|
|
550
|
+
*/
|
|
551
|
+
declare function createMockConversationManager(turnCount: number, baseMessages?: LLMMessage[]): MockConversationManager;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* CLI testing utilities for llmist.
|
|
555
|
+
* Provides helpers for testing CLI commands without real I/O.
|
|
556
|
+
*/
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Options for creating a test environment.
|
|
560
|
+
*/
|
|
561
|
+
interface TestEnvironmentOptions {
|
|
562
|
+
/** Input to provide via stdin (string or line array) */
|
|
563
|
+
stdin?: string | string[];
|
|
564
|
+
/** Whether stdin is a TTY (default: false) */
|
|
565
|
+
isTTY?: boolean;
|
|
566
|
+
/** Environment variables to set */
|
|
567
|
+
env?: Record<string, string>;
|
|
568
|
+
/** Command line arguments (default: ["node", "llmist"]) */
|
|
569
|
+
argv?: string[];
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* A test environment with captured I/O streams.
|
|
573
|
+
*/
|
|
574
|
+
interface TestEnvironment {
|
|
575
|
+
/** Stdin readable stream */
|
|
576
|
+
stdin: Readable;
|
|
577
|
+
/** Stdout writable stream (PassThrough for capturing) */
|
|
578
|
+
stdout: PassThrough;
|
|
579
|
+
/** Stderr writable stream (PassThrough for capturing) */
|
|
580
|
+
stderr: PassThrough;
|
|
581
|
+
/** Whether stdin is TTY */
|
|
582
|
+
isTTY: boolean;
|
|
583
|
+
/** Command line arguments */
|
|
584
|
+
argv: string[];
|
|
585
|
+
/** Environment variables */
|
|
586
|
+
env: Record<string, string>;
|
|
587
|
+
/** Exit code if set */
|
|
588
|
+
exitCode?: number;
|
|
589
|
+
/** Function to set exit code */
|
|
590
|
+
setExitCode: (code: number) => void;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Create a test environment with mocked I/O streams.
|
|
594
|
+
*
|
|
595
|
+
* @param options - Configuration options
|
|
596
|
+
* @returns A test environment with captured streams
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```typescript
|
|
600
|
+
* const env = createTestEnvironment({
|
|
601
|
+
* stdin: '{"param": "value"}',
|
|
602
|
+
* isTTY: false
|
|
603
|
+
* });
|
|
604
|
+
*
|
|
605
|
+
* // Pass to CLI command
|
|
606
|
+
* await executeCommand(env);
|
|
607
|
+
*
|
|
608
|
+
* // Check output
|
|
609
|
+
* const output = await collectOutput(env.stdout);
|
|
610
|
+
* expect(output).toContain("Success");
|
|
611
|
+
* ```
|
|
612
|
+
*/
|
|
613
|
+
declare function createTestEnvironment(options?: TestEnvironmentOptions): TestEnvironment;
|
|
614
|
+
/**
|
|
615
|
+
* Create a readable stream from a string or array of lines.
|
|
616
|
+
*
|
|
617
|
+
* @param input - String content or array of lines
|
|
618
|
+
* @returns A Readable stream
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```typescript
|
|
622
|
+
* const stream = createMockReadable("line1\nline2\n");
|
|
623
|
+
* // or
|
|
624
|
+
* const stream = createMockReadable(["line1", "line2"]);
|
|
625
|
+
* ```
|
|
626
|
+
*/
|
|
627
|
+
declare function createMockReadable(input?: string | string[]): Readable;
|
|
628
|
+
/**
|
|
629
|
+
* Create a writable stream that collects all written data.
|
|
630
|
+
*
|
|
631
|
+
* @returns A writable stream with getData() method
|
|
632
|
+
*/
|
|
633
|
+
declare function createMockWritable(): Writable & {
|
|
634
|
+
getData(): string;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* Collect all output from a PassThrough stream.
|
|
638
|
+
* Waits for the stream to end before returning.
|
|
639
|
+
*
|
|
640
|
+
* @param stream - The stream to collect from
|
|
641
|
+
* @param timeout - Maximum time to wait in ms (default: 5000)
|
|
642
|
+
* @returns All data written to the stream
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```typescript
|
|
646
|
+
* const output = await collectOutput(env.stdout);
|
|
647
|
+
* expect(output).toContain("Expected text");
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
declare function collectOutput(stream: PassThrough, timeout?: number): Promise<string>;
|
|
651
|
+
/**
|
|
652
|
+
* Collect output without waiting for stream end.
|
|
653
|
+
* Returns immediately with whatever has been written.
|
|
654
|
+
*
|
|
655
|
+
* @param stream - The stream to read from
|
|
656
|
+
* @returns Currently buffered data
|
|
657
|
+
*/
|
|
658
|
+
declare function getBufferedOutput(stream: PassThrough): string;
|
|
659
|
+
/**
|
|
660
|
+
* Create a mock prompt function for testing interactive input.
|
|
661
|
+
*
|
|
662
|
+
* @param responses - Array of responses to return in order
|
|
663
|
+
* @returns A prompt function that returns the next response
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```typescript
|
|
667
|
+
* const prompt = createMockPrompt(["yes", "no", "maybe"]);
|
|
668
|
+
* expect(await prompt("Question 1?")).toBe("yes");
|
|
669
|
+
* expect(await prompt("Question 2?")).toBe("no");
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
declare function createMockPrompt(responses: string[]): (question: string) => Promise<string>;
|
|
673
|
+
/**
|
|
674
|
+
* Mock prompt that records questions and returns configured responses.
|
|
675
|
+
*/
|
|
676
|
+
declare class MockPromptRecorder {
|
|
677
|
+
private responses;
|
|
678
|
+
private index;
|
|
679
|
+
private questions;
|
|
680
|
+
constructor(responses: string[]);
|
|
681
|
+
/**
|
|
682
|
+
* The prompt function to use in tests.
|
|
683
|
+
*/
|
|
684
|
+
prompt: (question: string) => Promise<string>;
|
|
685
|
+
/**
|
|
686
|
+
* Get all questions that were asked.
|
|
687
|
+
*/
|
|
688
|
+
getQuestions(): string[];
|
|
689
|
+
/**
|
|
690
|
+
* Get the number of questions asked.
|
|
691
|
+
*/
|
|
692
|
+
getQuestionCount(): number;
|
|
693
|
+
/**
|
|
694
|
+
* Reset the recorder state.
|
|
695
|
+
*/
|
|
696
|
+
reset(newResponses?: string[]): void;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Wait for a condition to be true, with timeout.
|
|
700
|
+
* Useful for async testing scenarios.
|
|
701
|
+
*
|
|
702
|
+
* @param condition - Function that returns true when condition is met
|
|
703
|
+
* @param timeout - Maximum time to wait in ms (default: 5000)
|
|
704
|
+
* @param interval - Check interval in ms (default: 50)
|
|
705
|
+
*/
|
|
706
|
+
declare function waitFor(condition: () => boolean, timeout?: number, interval?: number): Promise<void>;
|
|
707
|
+
|
|
708
|
+
export { MockConversationManager, type MockGadget, MockGadgetBuilder, type MockGadgetConfig, MockPromptRecorder, type RecordedCall, type TestEnvironment, type TestEnvironmentOptions, type TestGadgetOptions, type TestGadgetResult, collectOutput, collectStream, collectStreamText, createAssistantMessage, createConversation, createConversationWithGadgets, createEmptyStream, createErrorStream, createLargeConversation, createMinimalConversation, createMockConversationManager, createMockGadget, createMockPrompt, createMockReadable, createMockWritable, createSystemMessage, createTestEnvironment, createTestStream, createTextStream, createUserMessage, estimateTokens, getBufferedOutput, getStreamFinalChunk, mockGadget, testGadget, testGadgetBatch, waitFor };
|