@agentforge/testing 0.16.22 โ†’ 0.16.23

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 CHANGED
@@ -6,11 +6,11 @@
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue)](https://www.typescriptlang.org/)
7
7
  [![License](https://img.shields.io/badge/license-MIT-green)](../../LICENSE)
8
8
 
9
- ## ๐ŸŽ‰ Status: Production Ready & Published
9
+ ## Status: Production Ready & Published
10
10
 
11
11
  **Complete testing toolkit** | **Full TypeScript support** | **Comprehensive documentation**
12
12
 
13
- ## ๐Ÿ“ฆ Installation
13
+ ## Installation
14
14
 
15
15
  ```bash
16
16
  npm install --save-dev @agentforge/testing
@@ -20,15 +20,15 @@ pnpm add -D @agentforge/testing
20
20
  yarn add -D @agentforge/testing
21
21
  ```
22
22
 
23
- ## โœจ Features
23
+ ## Features
24
24
 
25
- - ๐ŸŽญ **Mock Factories** - Create mock LLMs, tools, and states for testing
26
- - ๐Ÿ”ง **Test Helpers** - Assertion helpers and state builders
27
- - ๐Ÿ“ฆ **Fixtures** - Pre-built sample agents, tools, and conversations
28
- - ๐Ÿƒ **Test Runners** - Agent test runner and conversation simulator
29
- - ๐Ÿ“ธ **Snapshot Testing** - State and message snapshot utilities
30
- - โœ… **Full TypeScript** - Complete type safety and inference
31
- - ๐Ÿงช **Vitest Integration** - Works seamlessly with Vitest
25
+ - **Mock Factories** - Create mock LLMs, tools, and states for testing
26
+ - **Test Helpers** - Assertion helpers and state builders
27
+ - **Fixtures** - Pre-built sample agents, tools, and conversations
28
+ - **Test Runners** - Agent test runner and conversation simulator
29
+ - **Snapshot Testing** - State and message snapshot utilities
30
+ - **Full TypeScript** - Complete type safety and inference
31
+ - **Vitest Integration** - Works seamlessly with Vitest
32
32
 
33
33
  ## Quick Start
34
34
 
@@ -368,21 +368,21 @@ describe('ReAct Agent Integration Tests', () => {
368
368
  - `calculatorTool` - Calculator tool
369
369
  - `searchTool` - Search tool
370
370
 
371
- ## ๐Ÿ“– Documentation
371
+ ## Documentation
372
372
 
373
- - ๐Ÿ“š **[Full Documentation](https://tvscoundrel.github.io/agentforge/)**
374
- - ๐Ÿš€ **[Quick Start](https://tvscoundrel.github.io/agentforge/guide/quick-start)**
375
- - ๐Ÿงช **[Testing API Reference](https://tvscoundrel.github.io/agentforge/api/testing)**
376
- - ๐Ÿ’ก **[Testing Tutorial](https://tvscoundrel.github.io/agentforge/tutorials/testing)**
373
+ - **[Full Documentation](https://tvscoundrel.github.io/agentforge/)**
374
+ - **[Quick Start](https://tvscoundrel.github.io/agentforge/guide/quick-start)**
375
+ - **[Testing API Reference](https://tvscoundrel.github.io/agentforge/api/testing)**
376
+ - **[Testing Tutorial](https://tvscoundrel.github.io/agentforge/tutorials/testing)**
377
377
 
378
- ## ๐Ÿ”— Links
378
+ ## Links
379
379
 
380
380
  - [GitHub Repository](https://github.com/TVScoundrel/agentforge)
381
381
  - [npm Package](https://www.npmjs.com/package/@agentforge/testing)
382
382
  - [Changelog](https://tvscoundrel.github.io/agentforge/changelog.html) - See what's new before upgrading
383
383
  - [Report Issues](https://github.com/TVScoundrel/agentforge/issues)
384
384
 
385
- ## ๐Ÿ“š Related Packages
385
+ ## Related Packages
386
386
 
387
387
  - [@agentforge/core](https://www.npmjs.com/package/@agentforge/core) - Core abstractions
388
388
  - [@agentforge/patterns](https://www.npmjs.com/package/@agentforge/patterns) - Agent patterns
package/dist/index.cjs CHANGED
@@ -18693,7 +18693,7 @@ var ConversationSimulator = class {
18693
18693
  console.log(`User: ${input}`);
18694
18694
  }
18695
18695
  const result = await this.agent.invoke({ messages: messages$1 });
18696
- const aiMessage = result.messages[result.messages.length - 1];
18696
+ const aiMessage = extractLatestMessage(result);
18697
18697
  messages$1.push(aiMessage);
18698
18698
  if (this.config.verbose) {
18699
18699
  console.log(`AI: ${aiMessage.content}`);
@@ -18742,7 +18742,7 @@ var ConversationSimulator = class {
18742
18742
  const userMessage = new messages.HumanMessage(input);
18743
18743
  messages$1.push(userMessage);
18744
18744
  const result = await this.agent.invoke({ messages: messages$1 });
18745
- const aiMessage = result.messages[result.messages.length - 1];
18745
+ const aiMessage = extractLatestMessage(result);
18746
18746
  messages$1.push(aiMessage);
18747
18747
  turns++;
18748
18748
  }
@@ -18765,6 +18765,14 @@ var ConversationSimulator = class {
18765
18765
  function createConversationSimulator(agent, config2) {
18766
18766
  return new ConversationSimulator(agent, config2);
18767
18767
  }
18768
+ function extractLatestMessage(state) {
18769
+ const messages = extractMessages(state);
18770
+ const latestMessage = messages[messages.length - 1];
18771
+ if (!latestMessage) {
18772
+ throw new Error("Agent response did not include any messages");
18773
+ }
18774
+ return latestMessage;
18775
+ }
18768
18776
  var ROOT_SNAPSHOT_DIFF_KEY = "$root";
18769
18777
  function createSnapshotObject() {
18770
18778
  return /* @__PURE__ */ Object.create(null);