webmcp-cli 1.0.0 → 1.2.1
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/agent/features/agent-simulator.d.ts +67 -0
- package/dist/agent/features/agent-simulator.js +368 -0
- package/dist/agent/features/agent-simulator.js.map +1 -0
- package/dist/agent/features/index.d.ts +8 -0
- package/dist/agent/features/index.js +9 -0
- package/dist/agent/features/index.js.map +1 -0
- package/dist/agent/features/simulation-judge.d.ts +78 -0
- package/dist/agent/features/simulation-judge.js +276 -0
- package/dist/agent/features/simulation-judge.js.map +1 -0
- package/dist/agent/features/test-case-generator.d.ts +35 -0
- package/dist/agent/features/test-case-generator.js +257 -0
- package/dist/agent/features/test-case-generator.js.map +1 -0
- package/dist/agent/index.d.ts +7 -0
- package/dist/agent/index.js +10 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/llm-client.d.ts +76 -0
- package/dist/agent/llm-client.js +198 -0
- package/dist/agent/llm-client.js.map +1 -0
- package/dist/audit/run-single-page-audit.d.ts +41 -0
- package/dist/audit/run-single-page-audit.js +103 -0
- package/dist/audit/run-single-page-audit.js.map +1 -0
- package/dist/bin/webmcp.d.ts +5 -0
- package/dist/bin/webmcp.js +14 -0
- package/dist/bin/webmcp.js.map +1 -0
- package/dist/browser/audit-runner.d.ts +30 -0
- package/dist/browser/audit-runner.js +77 -0
- package/dist/browser/audit-runner.js.map +1 -0
- package/dist/browser/index.d.ts +6 -0
- package/dist/browser/index.js +7 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/interceptor.d.ts +68 -0
- package/dist/browser/interceptor.js +257 -0
- package/dist/browser/interceptor.js.map +1 -0
- package/dist/browser/playwright.d.ts +98 -0
- package/dist/browser/playwright.js +158 -0
- package/dist/browser/playwright.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +12 -0
- package/dist/cli/commands/audit.js +349 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/interactive.d.ts +10 -0
- package/dist/cli/commands/interactive.js +34 -0
- package/dist/cli/commands/interactive.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +84 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/options/parse-audit-options.d.ts +12 -0
- package/dist/cli/options/parse-audit-options.js +64 -0
- package/dist/cli/options/parse-audit-options.js.map +1 -0
- package/dist/core/constants.d.ts +102 -0
- package/dist/core/constants.js +214 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/types/audit.d.ts +260 -0
- package/dist/core/types/audit.js +5 -0
- package/dist/core/types/audit.js.map +1 -0
- package/dist/core/types/index.d.ts +6 -0
- package/dist/core/types/index.js +7 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/rule.d.ts +190 -0
- package/dist/core/types/rule.js +26 -0
- package/dist/core/types/rule.js.map +1 -0
- package/dist/core/types/tool.d.ts +312 -0
- package/dist/core/types/tool.js +6 -0
- package/dist/core/types/tool.js.map +1 -0
- package/dist/detection/declarative.d.ts +27 -0
- package/dist/detection/declarative.js +343 -0
- package/dist/detection/declarative.js.map +1 -0
- package/dist/detection/imperative.d.ts +38 -0
- package/dist/detection/imperative.js +99 -0
- package/dist/detection/imperative.js.map +1 -0
- package/dist/detection/index.d.ts +5 -0
- package/dist/detection/index.js +6 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/advice-service.d.ts +38 -0
- package/dist/llm/advice-service.js +243 -0
- package/dist/llm/advice-service.js.map +1 -0
- package/dist/llm/evaluator.d.ts +89 -0
- package/dist/llm/evaluator.js +274 -0
- package/dist/llm/evaluator.js.map +1 -0
- package/dist/llm/index.d.ts +11 -0
- package/dist/llm/index.js +15 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/json-response.d.ts +12 -0
- package/dist/llm/json-response.js +67 -0
- package/dist/llm/json-response.js.map +1 -0
- package/dist/llm/providers/mock.d.ts +29 -0
- package/dist/llm/providers/mock.js +324 -0
- package/dist/llm/providers/mock.js.map +1 -0
- package/dist/llm/providers/openrouter.d.ts +53 -0
- package/dist/llm/providers/openrouter.js +321 -0
- package/dist/llm/providers/openrouter.js.map +1 -0
- package/dist/llm/request-cache.d.ts +28 -0
- package/dist/llm/request-cache.js +99 -0
- package/dist/llm/request-cache.js.map +1 -0
- package/dist/llm/types.d.ts +233 -0
- package/dist/llm/types.js +7 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/rules/best-practices/BP-001.d.ts +11 -0
- package/dist/rules/best-practices/BP-001.js +56 -0
- package/dist/rules/best-practices/BP-001.js.map +1 -0
- package/dist/rules/best-practices/BP-002.d.ts +11 -0
- package/dist/rules/best-practices/BP-002.js +63 -0
- package/dist/rules/best-practices/BP-002.js.map +1 -0
- package/dist/rules/best-practices/BP-003.d.ts +11 -0
- package/dist/rules/best-practices/BP-003.js +68 -0
- package/dist/rules/best-practices/BP-003.js.map +1 -0
- package/dist/rules/coverage/COV-001.d.ts +8 -0
- package/dist/rules/coverage/COV-001.js +51 -0
- package/dist/rules/coverage/COV-001.js.map +1 -0
- package/dist/rules/description/DESC-003.d.ts +13 -0
- package/dist/rules/description/DESC-003.js +96 -0
- package/dist/rules/description/DESC-003.js.map +1 -0
- package/dist/rules/description/DESC-004.d.ts +8 -0
- package/dist/rules/description/DESC-004.js +61 -0
- package/dist/rules/description/DESC-004.js.map +1 -0
- package/dist/rules/description/DESC-005.d.ts +12 -0
- package/dist/rules/description/DESC-005.js +70 -0
- package/dist/rules/description/DESC-005.js.map +1 -0
- package/dist/rules/description/index.d.ts +4 -0
- package/dist/rules/description/index.js +5 -0
- package/dist/rules/description/index.js.map +1 -0
- package/dist/rules/implementation/IMP-001.d.ts +10 -0
- package/dist/rules/implementation/IMP-001.js +36 -0
- package/dist/rules/implementation/IMP-001.js.map +1 -0
- package/dist/rules/implementation/IMP-003.d.ts +9 -0
- package/dist/rules/implementation/IMP-003.js +45 -0
- package/dist/rules/implementation/IMP-003.js.map +1 -0
- package/dist/rules/implementation/IMP-004.d.ts +9 -0
- package/dist/rules/implementation/IMP-004.js +48 -0
- package/dist/rules/implementation/IMP-004.js.map +1 -0
- package/dist/rules/implementation/IMP-005.d.ts +9 -0
- package/dist/rules/implementation/IMP-005.js +54 -0
- package/dist/rules/implementation/IMP-005.js.map +1 -0
- package/dist/rules/implementation/IMP-007.d.ts +8 -0
- package/dist/rules/implementation/IMP-007.js +79 -0
- package/dist/rules/implementation/IMP-007.js.map +1 -0
- package/dist/rules/implementation/IMP-013.d.ts +9 -0
- package/dist/rules/implementation/IMP-013.js +55 -0
- package/dist/rules/implementation/IMP-013.js.map +1 -0
- package/dist/rules/implementation/index.d.ts +9 -0
- package/dist/rules/implementation/index.js +10 -0
- package/dist/rules/implementation/index.js.map +1 -0
- package/dist/rules/index.d.ts +51 -0
- package/dist/rules/index.js +100 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/llm/LLM-001.d.ts +14 -0
- package/dist/rules/llm/LLM-001.js +78 -0
- package/dist/rules/llm/LLM-001.js.map +1 -0
- package/dist/rules/llm/LLM-002.d.ts +14 -0
- package/dist/rules/llm/LLM-002.js +77 -0
- package/dist/rules/llm/LLM-002.js.map +1 -0
- package/dist/rules/llm/LLM-003.d.ts +16 -0
- package/dist/rules/llm/LLM-003.js +82 -0
- package/dist/rules/llm/LLM-003.js.map +1 -0
- package/dist/rules/llm/LLM-004.d.ts +14 -0
- package/dist/rules/llm/LLM-004.js +87 -0
- package/dist/rules/llm/LLM-004.js.map +1 -0
- package/dist/rules/llm/LLM-005.d.ts +16 -0
- package/dist/rules/llm/LLM-005.js +105 -0
- package/dist/rules/llm/LLM-005.js.map +1 -0
- package/dist/rules/llm/index.d.ts +10 -0
- package/dist/rules/llm/index.js +11 -0
- package/dist/rules/llm/index.js.map +1 -0
- package/dist/rules/runner.d.ts +54 -0
- package/dist/rules/runner.js +138 -0
- package/dist/rules/runner.js.map +1 -0
- package/dist/rules/schema/SCHEMA-001.d.ts +9 -0
- package/dist/rules/schema/SCHEMA-001.js +57 -0
- package/dist/rules/schema/SCHEMA-001.js.map +1 -0
- package/dist/rules/schema/SCHEMA-002.d.ts +9 -0
- package/dist/rules/schema/SCHEMA-002.js +59 -0
- package/dist/rules/schema/SCHEMA-002.js.map +1 -0
- package/dist/rules/schema/SCHEMA-003.d.ts +10 -0
- package/dist/rules/schema/SCHEMA-003.js +66 -0
- package/dist/rules/schema/SCHEMA-003.js.map +1 -0
- package/dist/rules/schema/SCHEMA-011.d.ts +10 -0
- package/dist/rules/schema/SCHEMA-011.js +62 -0
- package/dist/rules/schema/SCHEMA-011.js.map +1 -0
- package/dist/rules/security/SEC-001.d.ts +12 -0
- package/dist/rules/security/SEC-001.js +66 -0
- package/dist/rules/security/SEC-001.js.map +1 -0
- package/dist/rules/utils/keywords.d.ts +35 -0
- package/dist/rules/utils/keywords.js +100 -0
- package/dist/rules/utils/keywords.js.map +1 -0
- package/dist/scoring/calculator.d.ts +27 -0
- package/dist/scoring/calculator.js +194 -0
- package/dist/scoring/calculator.js.map +1 -0
- package/dist/scoring/grades.d.ts +34 -0
- package/dist/scoring/grades.js +167 -0
- package/dist/scoring/grades.js.map +1 -0
- package/dist/scoring/index.d.ts +5 -0
- package/dist/scoring/index.js +6 -0
- package/dist/scoring/index.js.map +1 -0
- package/dist/ui/banner.d.ts +21 -0
- package/dist/ui/banner.js +60 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/design-tokens.d.ts +23 -0
- package/dist/ui/design-tokens.js +58 -0
- package/dist/ui/design-tokens.js.map +1 -0
- package/dist/ui/findings.d.ts +23 -0
- package/dist/ui/findings.js +190 -0
- package/dist/ui/findings.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +10 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/ink/App.d.ts +14 -0
- package/dist/ui/ink/App.js +113 -0
- package/dist/ui/ink/App.js.map +1 -0
- package/dist/ui/ink/FullScreenLayout.d.ts +16 -0
- package/dist/ui/ink/FullScreenLayout.js +29 -0
- package/dist/ui/ink/FullScreenLayout.js.map +1 -0
- package/dist/ui/ink/InteractiveApp.d.ts +28 -0
- package/dist/ui/ink/InteractiveApp.js +229 -0
- package/dist/ui/ink/InteractiveApp.js.map +1 -0
- package/dist/ui/ink/RealAuditApp.d.ts +19 -0
- package/dist/ui/ink/RealAuditApp.js +170 -0
- package/dist/ui/ink/RealAuditApp.js.map +1 -0
- package/dist/ui/ink/components/AnimatedProgressBar.d.ts +20 -0
- package/dist/ui/ink/components/AnimatedProgressBar.js +46 -0
- package/dist/ui/ink/components/AnimatedProgressBar.js.map +1 -0
- package/dist/ui/ink/components/AsciiLogo.d.ts +12 -0
- package/dist/ui/ink/components/AsciiLogo.js +35 -0
- package/dist/ui/ink/components/AsciiLogo.js.map +1 -0
- package/dist/ui/ink/components/CategoryBars.d.ts +18 -0
- package/dist/ui/ink/components/CategoryBars.js +18 -0
- package/dist/ui/ink/components/CategoryBars.js.map +1 -0
- package/dist/ui/ink/components/FindingsTable.d.ts +18 -0
- package/dist/ui/ink/components/FindingsTable.js +19 -0
- package/dist/ui/ink/components/FindingsTable.js.map +1 -0
- package/dist/ui/ink/components/Footer.d.ts +15 -0
- package/dist/ui/ink/components/Footer.js +20 -0
- package/dist/ui/ink/components/Footer.js.map +1 -0
- package/dist/ui/ink/components/Header.d.ts +11 -0
- package/dist/ui/ink/components/Header.js +12 -0
- package/dist/ui/ink/components/Header.js.map +1 -0
- package/dist/ui/ink/components/LinkList.d.ts +17 -0
- package/dist/ui/ink/components/LinkList.js +44 -0
- package/dist/ui/ink/components/LinkList.js.map +1 -0
- package/dist/ui/ink/components/Navigation.d.ts +26 -0
- package/dist/ui/ink/components/Navigation.js +62 -0
- package/dist/ui/ink/components/Navigation.js.map +1 -0
- package/dist/ui/ink/components/ProgressBar.d.ts +15 -0
- package/dist/ui/ink/components/ProgressBar.js +14 -0
- package/dist/ui/ink/components/ProgressBar.js.map +1 -0
- package/dist/ui/ink/components/ScoreCard.d.ts +30 -0
- package/dist/ui/ink/components/ScoreCard.js +26 -0
- package/dist/ui/ink/components/ScoreCard.js.map +1 -0
- package/dist/ui/ink/components/SimulationResults.d.ts +33 -0
- package/dist/ui/ink/components/SimulationResults.js +23 -0
- package/dist/ui/ink/components/SimulationResults.js.map +1 -0
- package/dist/ui/ink/components/Spinner.d.ts +11 -0
- package/dist/ui/ink/components/Spinner.js +12 -0
- package/dist/ui/ink/components/Spinner.js.map +1 -0
- package/dist/ui/ink/components/ToolCard.d.ts +23 -0
- package/dist/ui/ink/components/ToolCard.js +20 -0
- package/dist/ui/ink/components/ToolCard.js.map +1 -0
- package/dist/ui/ink/components/shared/Badge.d.ts +21 -0
- package/dist/ui/ink/components/shared/Badge.js +39 -0
- package/dist/ui/ink/components/shared/Badge.js.map +1 -0
- package/dist/ui/ink/components/shared/Card.d.ts +18 -0
- package/dist/ui/ink/components/shared/Card.js +11 -0
- package/dist/ui/ink/components/shared/Card.js.map +1 -0
- package/dist/ui/ink/components/shared/HelpOverlay.d.ts +10 -0
- package/dist/ui/ink/components/shared/HelpOverlay.js +28 -0
- package/dist/ui/ink/components/shared/HelpOverlay.js.map +1 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.d.ts +11 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.js +21 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.js.map +1 -0
- package/dist/ui/ink/components/shared/Menu.d.ts +23 -0
- package/dist/ui/ink/components/shared/Menu.js +43 -0
- package/dist/ui/ink/components/shared/Menu.js.map +1 -0
- package/dist/ui/ink/components/shared/Table.d.ts +23 -0
- package/dist/ui/ink/components/shared/Table.js +40 -0
- package/dist/ui/ink/components/shared/Table.js.map +1 -0
- package/dist/ui/ink/components/views/CrawlingView.d.ts +12 -0
- package/dist/ui/ink/components/views/CrawlingView.js +34 -0
- package/dist/ui/ink/components/views/CrawlingView.js.map +1 -0
- package/dist/ui/ink/components/views/DashboardView.d.ts +21 -0
- package/dist/ui/ink/components/views/DashboardView.js +51 -0
- package/dist/ui/ink/components/views/DashboardView.js.map +1 -0
- package/dist/ui/ink/components/views/FindingDetailView.d.ts +16 -0
- package/dist/ui/ink/components/views/FindingDetailView.js +34 -0
- package/dist/ui/ink/components/views/FindingDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/FindingsView.d.ts +16 -0
- package/dist/ui/ink/components/views/FindingsView.js +79 -0
- package/dist/ui/ink/components/views/FindingsView.js.map +1 -0
- package/dist/ui/ink/components/views/OnboardingView.d.ts +12 -0
- package/dist/ui/ink/components/views/OnboardingView.js +40 -0
- package/dist/ui/ink/components/views/OnboardingView.js.map +1 -0
- package/dist/ui/ink/components/views/SimulationView.d.ts +17 -0
- package/dist/ui/ink/components/views/SimulationView.js +53 -0
- package/dist/ui/ink/components/views/SimulationView.js.map +1 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.d.ts +11 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.js +53 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/ToolDetailView.d.ts +15 -0
- package/dist/ui/ink/components/views/ToolDetailView.js +25 -0
- package/dist/ui/ink/components/views/ToolDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/ToolsView.d.ts +15 -0
- package/dist/ui/ink/components/views/ToolsView.js +43 -0
- package/dist/ui/ink/components/views/ToolsView.js.map +1 -0
- package/dist/ui/ink/demo.d.ts +6 -0
- package/dist/ui/ink/demo.js +254 -0
- package/dist/ui/ink/demo.js.map +1 -0
- package/dist/ui/ink/hooks/useAnimation.d.ts +29 -0
- package/dist/ui/ink/hooks/useAnimation.js +89 -0
- package/dist/ui/ink/hooks/useAnimation.js.map +1 -0
- package/dist/ui/ink/hooks/useAudit.d.ts +69 -0
- package/dist/ui/ink/hooks/useAudit.js +99 -0
- package/dist/ui/ink/hooks/useAudit.js.map +1 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.d.ts +19 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.js +204 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.js.map +1 -0
- package/dist/ui/ink/hooks/useKeyboardNav.d.ts +23 -0
- package/dist/ui/ink/hooks/useKeyboardNav.js +81 -0
- package/dist/ui/ink/hooks/useKeyboardNav.js.map +1 -0
- package/dist/ui/ink/hooks/useNavigation.d.ts +16 -0
- package/dist/ui/ink/hooks/useNavigation.js +42 -0
- package/dist/ui/ink/hooks/useNavigation.js.map +1 -0
- package/dist/ui/ink/hooks/useTerminalSize.d.ts +10 -0
- package/dist/ui/ink/hooks/useTerminalSize.js +29 -0
- package/dist/ui/ink/hooks/useTerminalSize.js.map +1 -0
- package/dist/ui/ink/index.d.ts +43 -0
- package/dist/ui/ink/index.js +50 -0
- package/dist/ui/ink/index.js.map +1 -0
- package/dist/ui/ink/render.d.ts +24 -0
- package/dist/ui/ink/render.js +14 -0
- package/dist/ui/ink/render.js.map +1 -0
- package/dist/ui/ink/theme.d.ts +37 -0
- package/dist/ui/ink/theme.js +38 -0
- package/dist/ui/ink/theme.js.map +1 -0
- package/dist/ui/ink/types.d.ts +77 -0
- package/dist/ui/ink/types.js +5 -0
- package/dist/ui/ink/types.js.map +1 -0
- package/dist/ui/score-display.d.ts +16 -0
- package/dist/ui/score-display.js +201 -0
- package/dist/ui/score-display.js.map +1 -0
- package/dist/ui/spinner.d.ts +45 -0
- package/dist/ui/spinner.js +112 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/utils.d.ts +13 -0
- package/dist/ui/utils.js +25 -0
- package/dist/ui/utils.js.map +1 -0
- package/package.json +61 -9
- package/index.js +0 -105
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Simulator
|
|
3
|
+
*
|
|
4
|
+
* Simulates AI agent interactions with WebMCP tools using function calling.
|
|
5
|
+
* Tests whether an LLM can correctly route to tools and extract parameters.
|
|
6
|
+
*/
|
|
7
|
+
import { LLMClient, type LLMToolCall } from '../llm-client.js';
|
|
8
|
+
import type { DetectedTool } from '../../core/types/tool.js';
|
|
9
|
+
import type { TestCase } from './test-case-generator.js';
|
|
10
|
+
export interface SimulationConfig {
|
|
11
|
+
maxRounds: number;
|
|
12
|
+
mockToolResponses: boolean;
|
|
13
|
+
model: string;
|
|
14
|
+
siteContext: string;
|
|
15
|
+
maxCost?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface SimulationRound {
|
|
18
|
+
roundNumber: number;
|
|
19
|
+
userMessage: string;
|
|
20
|
+
agentResponse: {
|
|
21
|
+
text: string | null;
|
|
22
|
+
toolCalls: LLMToolCall[];
|
|
23
|
+
};
|
|
24
|
+
toolResults: ToolResult[];
|
|
25
|
+
evaluation: RoundEvaluation;
|
|
26
|
+
}
|
|
27
|
+
export interface ToolResult {
|
|
28
|
+
toolName: string;
|
|
29
|
+
input: Record<string, unknown>;
|
|
30
|
+
output: string;
|
|
31
|
+
success: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RoundEvaluation {
|
|
34
|
+
correctToolSelected: boolean | null;
|
|
35
|
+
parameterAccuracy: number;
|
|
36
|
+
hallucinatedParams: string[];
|
|
37
|
+
missingRequiredParams: string[];
|
|
38
|
+
unnecessaryRound: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface SimulationResult {
|
|
41
|
+
testCase: TestCase;
|
|
42
|
+
model: string;
|
|
43
|
+
rounds: SimulationRound[];
|
|
44
|
+
totalRounds: number;
|
|
45
|
+
toolInvocations: number;
|
|
46
|
+
correctToolOnFirstTry: boolean;
|
|
47
|
+
finalSuccess: boolean;
|
|
48
|
+
totalLatencyMs: number;
|
|
49
|
+
totalCost: number;
|
|
50
|
+
evaluation: {
|
|
51
|
+
routingAccuracy: number;
|
|
52
|
+
parameterAccuracy: number;
|
|
53
|
+
hallucinationRate: number;
|
|
54
|
+
roundEfficiency: number;
|
|
55
|
+
overallScore: number;
|
|
56
|
+
failureReason: string | null;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Run a single simulation for a test case
|
|
61
|
+
*/
|
|
62
|
+
export declare function runSimulation(testCase: TestCase, tools: DetectedTool[], config: SimulationConfig, llm?: LLMClient): Promise<SimulationResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Run simulations for multiple test cases
|
|
65
|
+
*/
|
|
66
|
+
export declare function runSimulations(testCases: TestCase[], tools: DetectedTool[], config: SimulationConfig, onProgress?: (completed: number, total: number) => void): Promise<SimulationResult[]>;
|
|
67
|
+
export default runSimulation;
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Simulator
|
|
3
|
+
*
|
|
4
|
+
* Simulates AI agent interactions with WebMCP tools using function calling.
|
|
5
|
+
* Tests whether an LLM can correctly route to tools and extract parameters.
|
|
6
|
+
*/
|
|
7
|
+
import { LLMClient, createLLMClient } from '../llm-client.js';
|
|
8
|
+
// ═══════════════════════════════════════════════════════
|
|
9
|
+
// AGENT SYSTEM PROMPT
|
|
10
|
+
// ═══════════════════════════════════════════════════════
|
|
11
|
+
function buildAgentSystemPrompt(siteContext) {
|
|
12
|
+
return `You are an AI assistant integrated into a web browser. The user is currently viewing a ${siteContext} website. You have access to the website's functionality through the tools provided.
|
|
13
|
+
|
|
14
|
+
BEHAVIOR RULES:
|
|
15
|
+
1. When the user asks you to do something, check if any of the available tools can help accomplish their goal.
|
|
16
|
+
2. If a tool can help, invoke it with the correct parameters extracted from the user's request.
|
|
17
|
+
3. If required parameters are missing from the user's request, ask the user for them — do NOT guess or hallucinate values.
|
|
18
|
+
4. If optional parameters are missing, you may omit them or use reasonable defaults.
|
|
19
|
+
5. If no tool matches the user's request, tell them honestly that you can't help with that specific task on this website.
|
|
20
|
+
6. If the user's request is ambiguous and could match multiple tools, ask for clarification.
|
|
21
|
+
7. After invoking a tool, summarize the result for the user in natural language.
|
|
22
|
+
|
|
23
|
+
IMPORTANT:
|
|
24
|
+
- Only use the tools you've been given. Do NOT make up tools that don't exist.
|
|
25
|
+
- Use the exact parameter names and types defined in each tool's schema.
|
|
26
|
+
- Do NOT provide parameters that the user didn't mention or that you can't reasonably infer.
|
|
27
|
+
- If a parameter expects specific formats (like airport codes, dates), try to convert the user's input to that format.`;
|
|
28
|
+
}
|
|
29
|
+
// ═══════════════════════════════════════════════════════
|
|
30
|
+
// MOCK RESPONSE GENERATOR
|
|
31
|
+
// ═══════════════════════════════════════════════════════
|
|
32
|
+
function generateMockResponse(toolCall, tools) {
|
|
33
|
+
const tool = tools.find(t => t.name === toolCall.toolName);
|
|
34
|
+
if (!tool) {
|
|
35
|
+
return JSON.stringify({
|
|
36
|
+
error: 'Tool not found',
|
|
37
|
+
message: `Unknown tool: ${toolCall.toolName}`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// Generate a plausible mock response based on tool name
|
|
41
|
+
const name = toolCall.toolName.toLowerCase();
|
|
42
|
+
if (name.includes('search') || name.includes('find') || name.includes('list')) {
|
|
43
|
+
return JSON.stringify({
|
|
44
|
+
results: [
|
|
45
|
+
{ id: 'result-1', name: 'Example Result 1', description: 'First result' },
|
|
46
|
+
{ id: 'result-2', name: 'Example Result 2', description: 'Second result' },
|
|
47
|
+
{ id: 'result-3', name: 'Example Result 3', description: 'Third result' },
|
|
48
|
+
],
|
|
49
|
+
total: 3,
|
|
50
|
+
message: `Found 3 results for your query`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (name.includes('create') || name.includes('add') || name.includes('book')) {
|
|
54
|
+
return JSON.stringify({
|
|
55
|
+
success: true,
|
|
56
|
+
id: 'new-item-123',
|
|
57
|
+
message: 'Successfully created new item',
|
|
58
|
+
details: toolCall.toolInput,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (name.includes('get') || name.includes('fetch') || name.includes('retrieve')) {
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
id: toolCall.toolInput['id'] || 'item-1',
|
|
64
|
+
name: 'Retrieved Item',
|
|
65
|
+
status: 'active',
|
|
66
|
+
createdAt: '2026-01-15T10:00:00Z',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (name.includes('update') || name.includes('edit') || name.includes('modify')) {
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
success: true,
|
|
72
|
+
message: 'Successfully updated item',
|
|
73
|
+
changes: toolCall.toolInput,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (name.includes('delete') || name.includes('remove') || name.includes('cancel')) {
|
|
77
|
+
return JSON.stringify({
|
|
78
|
+
success: true,
|
|
79
|
+
message: 'Successfully deleted item',
|
|
80
|
+
id: toolCall.toolInput['id'] || 'deleted-item',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Default response
|
|
84
|
+
return JSON.stringify({
|
|
85
|
+
success: true,
|
|
86
|
+
message: `Tool ${toolCall.toolName} executed successfully`,
|
|
87
|
+
input: toolCall.toolInput,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// ═══════════════════════════════════════════════════════
|
|
91
|
+
// EVALUATION FUNCTIONS
|
|
92
|
+
// ═══════════════════════════════════════════════════════
|
|
93
|
+
function evaluateRound(roundNumber, toolCalls, testCase, _tools) {
|
|
94
|
+
const expected = testCase.expectedBehavior;
|
|
95
|
+
// No tool calls
|
|
96
|
+
if (toolCalls.length === 0) {
|
|
97
|
+
return {
|
|
98
|
+
correctToolSelected: expected.shouldInvokeTool ? false : null,
|
|
99
|
+
parameterAccuracy: 0,
|
|
100
|
+
hallucinatedParams: [],
|
|
101
|
+
missingRequiredParams: Object.keys(expected.expectedParams),
|
|
102
|
+
unnecessaryRound: roundNumber > 1,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Check first tool call (primary action)
|
|
106
|
+
const firstCall = toolCalls[0];
|
|
107
|
+
if (!firstCall) {
|
|
108
|
+
return {
|
|
109
|
+
correctToolSelected: expected.shouldInvokeTool ? false : null,
|
|
110
|
+
parameterAccuracy: 0,
|
|
111
|
+
hallucinatedParams: [],
|
|
112
|
+
missingRequiredParams: Object.keys(expected.expectedParams),
|
|
113
|
+
unnecessaryRound: roundNumber > 1,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const correctTool = firstCall.toolName === expected.toolName;
|
|
117
|
+
// Evaluate parameter accuracy
|
|
118
|
+
const expectedParams = expected.expectedParams;
|
|
119
|
+
const actualParams = firstCall.toolInput;
|
|
120
|
+
let correctParams = 0;
|
|
121
|
+
let totalExpected = Object.keys(expectedParams).length;
|
|
122
|
+
const hallucinatedParams = [];
|
|
123
|
+
const missingParams = [];
|
|
124
|
+
// Check expected params
|
|
125
|
+
for (const [key, value] of Object.entries(expectedParams)) {
|
|
126
|
+
if (key in actualParams) {
|
|
127
|
+
// Simple equality check (could be more sophisticated)
|
|
128
|
+
if (actualParams[key] === value ||
|
|
129
|
+
String(actualParams[key]).toLowerCase() === String(value).toLowerCase()) {
|
|
130
|
+
correctParams++;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
missingParams.push(key);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Check for hallucinated params (params not in expected)
|
|
138
|
+
for (const key of Object.keys(actualParams)) {
|
|
139
|
+
if (!(key in expectedParams)) {
|
|
140
|
+
// Only flag if this param wasn't provided by user
|
|
141
|
+
hallucinatedParams.push(key);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const paramAccuracy = totalExpected > 0 ? correctParams / totalExpected : 1;
|
|
145
|
+
return {
|
|
146
|
+
correctToolSelected: correctTool,
|
|
147
|
+
parameterAccuracy: paramAccuracy,
|
|
148
|
+
hallucinatedParams,
|
|
149
|
+
missingRequiredParams: missingParams,
|
|
150
|
+
unnecessaryRound: roundNumber > 1 && correctTool && paramAccuracy > 0.8,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function buildSimulationResult(testCase, model, rounds, totalLatency, totalCost) {
|
|
154
|
+
// Aggregate metrics
|
|
155
|
+
const toolInvocations = rounds.reduce((sum, r) => sum + r.agentResponse.toolCalls.length, 0);
|
|
156
|
+
const correctToolOnFirstTry = rounds[0]?.evaluation.correctToolSelected === true;
|
|
157
|
+
// Check if final result was successful
|
|
158
|
+
const lastRound = rounds[rounds.length - 1];
|
|
159
|
+
const expected = testCase.expectedBehavior;
|
|
160
|
+
let finalSuccess = false;
|
|
161
|
+
let failureReason = null;
|
|
162
|
+
if (!expected.shouldInvokeTool) {
|
|
163
|
+
// Out of scope - success if no tool was called
|
|
164
|
+
finalSuccess = toolInvocations === 0;
|
|
165
|
+
if (!finalSuccess) {
|
|
166
|
+
failureReason = 'Called a tool when none should have been used';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// Should invoke tool - check if correct tool was ever called
|
|
171
|
+
const correctToolCalled = rounds.some(r => r.agentResponse.toolCalls.some(tc => tc.toolName === expected.toolName));
|
|
172
|
+
if (!correctToolCalled) {
|
|
173
|
+
failureReason = `Never called expected tool: ${expected.toolName}`;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// Check parameter accuracy of the correct call
|
|
177
|
+
const correctCallRound = rounds.find(r => r.agentResponse.toolCalls.some(tc => tc.toolName === expected.toolName));
|
|
178
|
+
if (correctCallRound && correctCallRound.evaluation.parameterAccuracy >= 0.5) {
|
|
179
|
+
finalSuccess = true;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
failureReason = 'Called correct tool but with wrong parameters';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Calculate aggregate scores
|
|
187
|
+
const routingAccuracy = correctToolOnFirstTry ? 1 :
|
|
188
|
+
rounds.some(r => r.evaluation.correctToolSelected) ? 0.5 : 0;
|
|
189
|
+
const avgParamAccuracy = rounds.length > 0
|
|
190
|
+
? rounds.reduce((sum, r) => sum + r.evaluation.parameterAccuracy, 0) / rounds.length
|
|
191
|
+
: 0;
|
|
192
|
+
const totalHallucinated = rounds.reduce((sum, r) => sum + r.evaluation.hallucinatedParams.length, 0);
|
|
193
|
+
const totalParams = rounds.reduce((sum, r) => sum + Object.keys(r.agentResponse.toolCalls[0]?.toolInput || {}).length, 0);
|
|
194
|
+
const hallucinationRate = totalParams > 0 ? totalHallucinated / totalParams : 0;
|
|
195
|
+
// Round efficiency: 1.0 = solved in 1 round, less for more rounds
|
|
196
|
+
const optimalRounds = 1;
|
|
197
|
+
const roundEfficiency = optimalRounds / Math.max(rounds.length, 1);
|
|
198
|
+
// Overall score (weighted)
|
|
199
|
+
const overallScore = Math.round((routingAccuracy * 40 +
|
|
200
|
+
avgParamAccuracy * 30 +
|
|
201
|
+
(1 - hallucinationRate) * 15 +
|
|
202
|
+
roundEfficiency * 15) * 100 / 100);
|
|
203
|
+
return {
|
|
204
|
+
testCase,
|
|
205
|
+
model,
|
|
206
|
+
rounds,
|
|
207
|
+
totalRounds: rounds.length,
|
|
208
|
+
toolInvocations,
|
|
209
|
+
correctToolOnFirstTry,
|
|
210
|
+
finalSuccess,
|
|
211
|
+
totalLatencyMs: totalLatency,
|
|
212
|
+
totalCost,
|
|
213
|
+
evaluation: {
|
|
214
|
+
routingAccuracy,
|
|
215
|
+
parameterAccuracy: avgParamAccuracy,
|
|
216
|
+
hallucinationRate,
|
|
217
|
+
roundEfficiency,
|
|
218
|
+
overallScore,
|
|
219
|
+
failureReason,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// ═══════════════════════════════════════════════════════
|
|
224
|
+
// SIMULATION RUNNER
|
|
225
|
+
// ═══════════════════════════════════════════════════════
|
|
226
|
+
/**
|
|
227
|
+
* Run a single simulation for a test case
|
|
228
|
+
*/
|
|
229
|
+
export async function runSimulation(testCase, tools, config, llm) {
|
|
230
|
+
const client = llm || createLLMClient({ model: config.model });
|
|
231
|
+
// Convert tools to LLM format
|
|
232
|
+
const llmTools = tools.map(t => ({
|
|
233
|
+
name: t.name,
|
|
234
|
+
description: t.description,
|
|
235
|
+
input_schema: t.inputSchema || { type: 'object', properties: {} },
|
|
236
|
+
}));
|
|
237
|
+
const messages = [
|
|
238
|
+
{ role: 'system', content: buildAgentSystemPrompt(config.siteContext) },
|
|
239
|
+
];
|
|
240
|
+
const rounds = [];
|
|
241
|
+
let currentMessage = testCase.prompt;
|
|
242
|
+
let totalLatency = 0;
|
|
243
|
+
let totalCost = 0;
|
|
244
|
+
let isComplete = false;
|
|
245
|
+
for (let round = 1; round <= config.maxRounds && !isComplete; round++) {
|
|
246
|
+
// Add user message
|
|
247
|
+
messages.push({ role: 'user', content: currentMessage });
|
|
248
|
+
try {
|
|
249
|
+
// Get agent response with tools
|
|
250
|
+
const response = await client.chatWithTools(messages, llmTools);
|
|
251
|
+
totalLatency += response.latencyMs;
|
|
252
|
+
totalCost += response.cost;
|
|
253
|
+
// Check cost limit
|
|
254
|
+
if (config.maxCost && totalCost >= config.maxCost) {
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
// Process tool calls
|
|
258
|
+
const toolResults = [];
|
|
259
|
+
if (response.toolCalls.length > 0) {
|
|
260
|
+
for (const toolCall of response.toolCalls) {
|
|
261
|
+
// Add assistant message with tool call
|
|
262
|
+
messages.push({
|
|
263
|
+
role: 'assistant',
|
|
264
|
+
content: null,
|
|
265
|
+
tool_calls: [{
|
|
266
|
+
id: `call_${round}_${toolCall.toolName}`,
|
|
267
|
+
type: 'function',
|
|
268
|
+
function: {
|
|
269
|
+
name: toolCall.toolName,
|
|
270
|
+
arguments: JSON.stringify(toolCall.toolInput),
|
|
271
|
+
},
|
|
272
|
+
}],
|
|
273
|
+
});
|
|
274
|
+
// Generate mock tool response
|
|
275
|
+
const toolOutput = config.mockToolResponses
|
|
276
|
+
? generateMockResponse(toolCall, tools)
|
|
277
|
+
: JSON.stringify({ error: 'Real tool execution not implemented' });
|
|
278
|
+
toolResults.push({
|
|
279
|
+
toolName: toolCall.toolName,
|
|
280
|
+
input: toolCall.toolInput,
|
|
281
|
+
output: toolOutput,
|
|
282
|
+
success: true,
|
|
283
|
+
});
|
|
284
|
+
// Add tool result to conversation
|
|
285
|
+
messages.push({
|
|
286
|
+
role: 'tool',
|
|
287
|
+
content: toolOutput,
|
|
288
|
+
tool_call_id: `call_${round}_${toolCall.toolName}`,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
// Get agent's follow-up response
|
|
292
|
+
const followUp = await client.chatWithTools(messages, llmTools);
|
|
293
|
+
totalLatency += followUp.latencyMs;
|
|
294
|
+
totalCost += followUp.cost;
|
|
295
|
+
messages.push({ role: 'assistant', content: followUp.text });
|
|
296
|
+
// Complete if no more tool calls
|
|
297
|
+
if (followUp.toolCalls.length === 0) {
|
|
298
|
+
isComplete = true;
|
|
299
|
+
}
|
|
300
|
+
rounds.push({
|
|
301
|
+
roundNumber: round,
|
|
302
|
+
userMessage: currentMessage,
|
|
303
|
+
agentResponse: { text: followUp.text, toolCalls: response.toolCalls },
|
|
304
|
+
toolResults,
|
|
305
|
+
evaluation: evaluateRound(round, response.toolCalls, testCase, tools),
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
// Agent responded with text only
|
|
310
|
+
messages.push({ role: 'assistant', content: response.text });
|
|
311
|
+
rounds.push({
|
|
312
|
+
roundNumber: round,
|
|
313
|
+
userMessage: currentMessage,
|
|
314
|
+
agentResponse: { text: response.text, toolCalls: [] },
|
|
315
|
+
toolResults: [],
|
|
316
|
+
evaluation: evaluateRound(round, [], testCase, tools),
|
|
317
|
+
});
|
|
318
|
+
// If agent asked a clarifying question, we'd need to respond
|
|
319
|
+
// For now, we complete after text-only response
|
|
320
|
+
isComplete = true;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
// Handle API errors gracefully
|
|
325
|
+
rounds.push({
|
|
326
|
+
roundNumber: round,
|
|
327
|
+
userMessage: currentMessage,
|
|
328
|
+
agentResponse: { text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`, toolCalls: [] },
|
|
329
|
+
toolResults: [],
|
|
330
|
+
evaluation: {
|
|
331
|
+
correctToolSelected: null,
|
|
332
|
+
parameterAccuracy: 0,
|
|
333
|
+
hallucinatedParams: [],
|
|
334
|
+
missingRequiredParams: [],
|
|
335
|
+
unnecessaryRound: false,
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
isComplete = true;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return buildSimulationResult(testCase, config.model, rounds, totalLatency, totalCost);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Run simulations for multiple test cases
|
|
345
|
+
*/
|
|
346
|
+
export async function runSimulations(testCases, tools, config, onProgress) {
|
|
347
|
+
const results = [];
|
|
348
|
+
const llm = createLLMClient({ model: config.model });
|
|
349
|
+
let totalCost = 0;
|
|
350
|
+
for (let i = 0; i < testCases.length; i++) {
|
|
351
|
+
// Check cost limit
|
|
352
|
+
if (config.maxCost && totalCost >= config.maxCost) {
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
const testCase = testCases[i];
|
|
356
|
+
if (!testCase)
|
|
357
|
+
continue;
|
|
358
|
+
const result = await runSimulation(testCase, tools, config, llm);
|
|
359
|
+
results.push(result);
|
|
360
|
+
totalCost += result.totalCost;
|
|
361
|
+
if (onProgress) {
|
|
362
|
+
onProgress(i + 1, testCases.length);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return results;
|
|
366
|
+
}
|
|
367
|
+
export default runSimulation;
|
|
368
|
+
//# sourceMappingURL=agent-simulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-simulator.js","sourceRoot":"","sources":["../../../src/agent/features/agent-simulator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAmD,MAAM,kBAAkB,CAAC;AA8D/G,0DAA0D;AAC1D,sBAA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AC;QAE9B,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Features Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all agent simulation features.
|
|
5
|
+
*/
|
|
6
|
+
export { generateTestCases, type TestCase, type TestCaseCategory, type TestCaseGenerationConfig, } from './test-case-generator.js';
|
|
7
|
+
export { runSimulation, runSimulations, type SimulationConfig, type SimulationResult, type SimulationRound, type ToolResult, type RoundEvaluation, } from './agent-simulator.js';
|
|
8
|
+
export { judgeSimulation, judgeSimulations, type SimulationJudgment, type JudgmentResult, type KeyMoment, type ToolImprovement, type AggregateJudgment, type FailurePattern, } from './simulation-judge.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Features Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all agent simulation features.
|
|
5
|
+
*/
|
|
6
|
+
export { generateTestCases, } from './test-case-generator.js';
|
|
7
|
+
export { runSimulation, runSimulations, } from './agent-simulator.js';
|
|
8
|
+
export { judgeSimulation, judgeSimulations, } from './simulation-judge.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/features/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,GAIlB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,cAAc,GAMf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,gBAAgB,GAOjB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulation Judge
|
|
3
|
+
*
|
|
4
|
+
* Uses LLM to evaluate simulation results and provide structured scoring
|
|
5
|
+
* with actionable improvement suggestions.
|
|
6
|
+
*/
|
|
7
|
+
import { LLMClient } from '../llm-client.js';
|
|
8
|
+
import type { DetectedTool } from '../../core/types/tool.js';
|
|
9
|
+
import type { SimulationResult } from './agent-simulator.js';
|
|
10
|
+
export interface JudgmentResult {
|
|
11
|
+
toolSelection: {
|
|
12
|
+
score: number;
|
|
13
|
+
reasoning: string;
|
|
14
|
+
};
|
|
15
|
+
parameterAccuracy: {
|
|
16
|
+
score: number;
|
|
17
|
+
reasoning: string;
|
|
18
|
+
};
|
|
19
|
+
conversationEfficiency: {
|
|
20
|
+
score: number;
|
|
21
|
+
reasoning: string;
|
|
22
|
+
};
|
|
23
|
+
errorHandling: {
|
|
24
|
+
score: number;
|
|
25
|
+
reasoning: string;
|
|
26
|
+
};
|
|
27
|
+
userExperience: {
|
|
28
|
+
score: number;
|
|
29
|
+
reasoning: string;
|
|
30
|
+
};
|
|
31
|
+
toolDefinitionQuality: {
|
|
32
|
+
score: number;
|
|
33
|
+
reasoning: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface SimulationJudgment {
|
|
37
|
+
scores: JudgmentResult;
|
|
38
|
+
overallScore: number;
|
|
39
|
+
verdict: 'PASS' | 'PARTIAL' | 'FAIL';
|
|
40
|
+
keyMoments: KeyMoment[];
|
|
41
|
+
toolImprovements: ToolImprovement[];
|
|
42
|
+
summary: string;
|
|
43
|
+
}
|
|
44
|
+
export interface KeyMoment {
|
|
45
|
+
moment: string;
|
|
46
|
+
impact: 'positive' | 'negative' | 'neutral';
|
|
47
|
+
severity: 'minor' | 'major' | 'critical';
|
|
48
|
+
toolFix?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ToolImprovement {
|
|
51
|
+
tool: string;
|
|
52
|
+
issue: string;
|
|
53
|
+
suggestedFix: string;
|
|
54
|
+
estimatedImpact: string;
|
|
55
|
+
}
|
|
56
|
+
export interface AggregateJudgment {
|
|
57
|
+
totalSimulations: number;
|
|
58
|
+
passRate: number;
|
|
59
|
+
avgScore: number;
|
|
60
|
+
failurePatterns: FailurePattern[];
|
|
61
|
+
topImprovements: ToolImprovement[];
|
|
62
|
+
summary: string;
|
|
63
|
+
}
|
|
64
|
+
export interface FailurePattern {
|
|
65
|
+
pattern: string;
|
|
66
|
+
frequency: number;
|
|
67
|
+
affectedTools: string[];
|
|
68
|
+
suggestedFix: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Judge a single simulation result
|
|
72
|
+
*/
|
|
73
|
+
export declare function judgeSimulation(simulation: SimulationResult, tools: DetectedTool[], llm?: LLMClient): Promise<SimulationJudgment>;
|
|
74
|
+
/**
|
|
75
|
+
* Judge multiple simulations and provide aggregate analysis
|
|
76
|
+
*/
|
|
77
|
+
export declare function judgeSimulations(simulations: SimulationResult[], tools: DetectedTool[], llm?: LLMClient): Promise<AggregateJudgment>;
|
|
78
|
+
export default judgeSimulation;
|